@@ -5,16 +5,14 @@ import {
55 DataTypeRulesInputTypeConfig ,
66 DataTypeRulesInputTypesConfig ,
77 DataTypeRulesItemOfCollectionConfig , DataTypeRulesNumberRangeConfig ,
8- DataTypeRulesParentTypeConfig , DataTypeRulesRegexConfig , GenericCombinationStrategy ,
9- TranslationConnection
8+ DataTypeRulesParentTypeConfig , DataTypeRulesRegexConfig ,
109} from "@code0-tech/sagittarius-graphql-types" ;
11- import { Translation } from "@code0-tech/tucana/pb/shared.translation_pb.ts" ;
1210import {
1311 DataTypeIdentifier as TucanaDataTypeIdentifier ,
1412 DefinitionDataType_Variant , DefinitionDataTypeRule
1513} from "@code0-tech/tucana/pb/shared.data_type_pb.ts"
1614import { GenericMapper as TucanaGenericMapper } from "@code0-tech/tucana/pb/shared.data_type_pb.ts"
17- import { ConstructedDataTypes } from "../parser.js" ;
15+ import { ConstructedDataTypes , getID } from "../parser.js" ;
1816import { getTranslationConnection } from "./translation.js" ;
1917
2018export enum GenericMapper_GenericCombinationStrategy {
@@ -57,7 +55,8 @@ function getDataType(identifier: string, constructedDataTypes: ConstructedDataTy
5755 console . error ( "Skipping Identifier because it can't be identified:" + identifier )
5856 return null
5957 }
60- const constructed = {
58+ const constructed : DataType = {
59+ id : `gid://sagittarius/DataType/${ getID ( constructedDataTypes ) } ` ,
6160 genericKeys : tucanaDataType . genericKeys ,
6261 identifier : tucanaDataType . identifier ,
6362 name : getTranslationConnection ( tucanaDataType . name ) ,
@@ -204,7 +203,9 @@ function getDataTypeIdentifier(identifier: TucanaDataTypeIdentifier | undefined,
204203 switch ( identifier . type . oneofKind ) {
205204 case "genericType" : {
206205 return {
206+ id : `gid://sagittarius/DataTypeIdentifier/${ getID ( constructedDataTypes ) } ` ,
207207 genericType : {
208+ id : `gid://sagittarius/GenericType/${ getID ( constructedDataTypes ) } ` ,
208209 dataType : getDataType ( identifier . type . genericType . dataTypeIdentifier , constructedDataTypes ) ,
209210 genericMappers : identifier . type . genericType . genericMappers . map ( ( mapper : TucanaGenericMapper ) => {
210211 return {
@@ -220,15 +221,16 @@ function getDataTypeIdentifier(identifier: TucanaDataTypeIdentifier | undefined,
220221 default :
221222 throw new Error ( "GenericCombinationStrategy was Unknown" ) ;
222223 }
223-
224224 return {
225+ id : `gid://sagittarius/GenericCombinationStrategy/${ getID ( constructedDataTypes ) } ` ,
225226 type : type
226227 }
227228 } ) ,
228229 sources : mapper . source . map ( id =>
229230 getDataTypeIdentifier ( id , constructedDataTypes )
230231 ) . filter ( id => id != null ) ,
231232 target : mapper . target ,
233+ id : `gid://sagittarius/GenericMapper/${ getID ( constructedDataTypes ) } ` ,
232234 }
233235 } ) ,
234236 }
@@ -237,12 +239,14 @@ function getDataTypeIdentifier(identifier: TucanaDataTypeIdentifier | undefined,
237239
238240 case "dataTypeIdentifier" : {
239241 return {
242+ id : `gid://sagittarius/DataTypeIdentifier/${ getID ( constructedDataTypes ) } ` ,
240243 dataType : getDataType ( identifier . type . dataTypeIdentifier , constructedDataTypes )
241244 }
242245 }
243246
244247 case "genericKey" : {
245248 return {
249+ id : `gid://sagittarius/DataTypeIdentifier/${ getID ( constructedDataTypes ) } ` ,
246250 genericKey : identifier . type . genericKey ,
247251 }
248252 }
0 commit comments