@osdk/generator-converters.ontologyir 2.3.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,813 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { hash } from "node:crypto";
18
+ /**
19
+ * TypeScript equivalent of OntologyIrToFullMetadataConverter.java
20
+ * Converts ontology IR data to full metadata format for OSDK generation
21
+ */
22
+ export class OntologyIrToFullMetadataConverter {
23
+ /**
24
+ * Main entry point - converts IR to full metadata
25
+ */
26
+ static getFullMetadataFromIr(ir) {
27
+ const interfaceTypes = this.getOsdkInterfaceTypes(Object.values(ir.interfaceTypes));
28
+ const sharedPropertyTypes = this.getOsdkSharedPropertyTypes(Object.values(ir.sharedPropertyTypes));
29
+ const objectTypes = this.getOsdkObjectTypes(Object.values(ir.objectTypes), Object.values(ir.linkTypes));
30
+ const actionTypes = this.getOsdkActionTypes(Object.values(ir.actionTypes));
31
+ return {
32
+ interfaceTypes,
33
+ sharedPropertyTypes,
34
+ objectTypes,
35
+ queryTypes: {},
36
+ actionTypes,
37
+ ontology: {
38
+ apiName: "ontology",
39
+ rid: `ri.00000`,
40
+ displayName: "ontology",
41
+ description: ""
42
+ }
43
+ };
44
+ }
45
+
46
+ /**
47
+ * Convert IR object types to OSDK format
48
+ */
49
+ static getOsdkObjectTypes(objects, links) {
50
+ const linkMappings = this.getLinkMappings(links);
51
+ const result = {};
52
+ for (const fullObject of objects) {
53
+ const object = fullObject.objectType;
54
+ const icon = object.displayMetadata.icon;
55
+ if (icon.type !== "blueprint") {
56
+ throw new Error("Only blueprint icons are supported");
57
+ }
58
+
59
+ // Ensure we have exactly one primary key
60
+ if (object.primaryKeys.length !== 1) {
61
+ throw new Error("Object must have exactly 1 primary key");
62
+ }
63
+ const primaryKey = object.primaryKeys[0];
64
+ const titleProperty = object.titlePropertyTypeRid;
65
+ const properties = {};
66
+ for (const [propKey, prop] of Object.entries(object.propertyTypes)) {
67
+ const visibility = prop.displayMetadata.visibility;
68
+ let visibilityEnum = "NORMAL";
69
+ if (!visibility) {
70
+ visibilityEnum = "NORMAL";
71
+ } else {
72
+ switch (visibility) {
73
+ case "PROMINENT":
74
+ visibilityEnum = "PROMINENT";
75
+ break;
76
+ case "NORMAL":
77
+ visibilityEnum = "NORMAL";
78
+ break;
79
+ case "HIDDEN":
80
+ visibilityEnum = "HIDDEN";
81
+ break;
82
+ default:
83
+ visibilityEnum = "NORMAL";
84
+ }
85
+ }
86
+ const dataType = this.getOsdkPropertyType(prop.type);
87
+ if (dataType) {
88
+ const status = {
89
+ type: prop.status.type,
90
+ ...(prop.status[prop.status.type] ?? {})
91
+ };
92
+ properties[propKey] = {
93
+ displayName: prop.displayMetadata.displayName,
94
+ rid: `ri.${object.apiName}.${propKey}`,
95
+ status,
96
+ description: prop.displayMetadata.description ?? undefined,
97
+ visibility: visibilityEnum,
98
+ dataType
99
+ };
100
+ }
101
+ }
102
+ const objectTypeV2 = {
103
+ apiName: object.apiName,
104
+ description: object.displayMetadata.description ?? undefined,
105
+ displayName: object.displayMetadata.displayName,
106
+ pluralDisplayName: "",
107
+ // Not available in IR
108
+ primaryKey,
109
+ titleProperty,
110
+ icon: {
111
+ type: "blueprint",
112
+ color: icon.blueprint.color,
113
+ name: icon.blueprint.locator
114
+ },
115
+ status: this.convertObjectTypeStatus(object.status),
116
+ properties,
117
+ rid: `ri.${object.apiName}`
118
+ };
119
+ const sharedPropertyTypeMappings = {};
120
+ const implementsInterfaces2 = {};
121
+ for (const ii of object.implementsInterfaces2) {
122
+ const interfaceApiName = ii.interfaceTypeApiName;
123
+ const propertyMappings = {};
124
+ for (const [sharedPropKey, propMapping] of Object.entries(ii.properties)) {
125
+ const propertyApiName = propMapping.propertyTypeRid;
126
+ propertyMappings[sharedPropKey] = propertyApiName;
127
+ sharedPropertyTypeMappings[sharedPropKey] = propertyApiName;
128
+ }
129
+ implementsInterfaces2[interfaceApiName] = {
130
+ properties: propertyMappings
131
+ };
132
+ }
133
+ const objectApiName = object.apiName;
134
+ result[objectApiName] = {
135
+ objectType: objectTypeV2,
136
+ implementsInterfaces: [],
137
+ // Empty for now - legacy field
138
+ implementsInterfaces2,
139
+ sharedPropertyTypeMapping: sharedPropertyTypeMappings,
140
+ linkTypes: linkMappings[objectApiName] || []
141
+ };
142
+ }
143
+ return result;
144
+ }
145
+
146
+ /**
147
+ * Create link mappings from IR link types
148
+ */
149
+ static getLinkMappings(links) {
150
+ const result = {};
151
+ for (const link of links) {
152
+ const linkType = link.linkType;
153
+ const linkApiName = linkType.id;
154
+ const linkStatus = this.convertLinkTypeStatus(linkType.status);
155
+ let mappings;
156
+ switch (linkType.definition.type) {
157
+ case "manyToMany":
158
+ {
159
+ const linkDef = linkType.definition.manyToMany;
160
+ const sideA = {
161
+ apiName: linkApiName,
162
+ displayName: linkApiName,
163
+ cardinality: "MANY",
164
+ objectTypeApiName: linkDef.objectTypeRidA,
165
+ linkTypeRid: `ri.${linkDef.objectTypeRidA}.${linkApiName}.${linkDef.objectTypeRidB}`,
166
+ status: linkStatus
167
+ };
168
+ const sideB = {
169
+ ...sideA,
170
+ objectTypeApiName: linkDef.objectTypeRidB
171
+ };
172
+ mappings = {
173
+ [linkDef.objectTypeRidA]: sideA,
174
+ [linkDef.objectTypeRidB]: sideB
175
+ };
176
+ break;
177
+ }
178
+ case "oneToMany":
179
+ {
180
+ const linkDef = linkType.definition.oneToMany;
181
+ const sideOne = {
182
+ apiName: linkApiName,
183
+ displayName: linkApiName,
184
+ objectTypeApiName: linkDef.objectTypeRidOneSide,
185
+ cardinality: "ONE",
186
+ linkTypeRid: `ri.${linkDef.objectTypeRidOneSide}.${linkApiName}.${linkDef.objectTypeRidManySide}`,
187
+ status: linkStatus
188
+ };
189
+ const sideMany = {
190
+ ...sideOne,
191
+ cardinality: "MANY",
192
+ objectTypeApiName: linkDef.objectTypeRidManySide
193
+ };
194
+ mappings = {
195
+ [linkDef.objectTypeRidOneSide]: sideOne,
196
+ [linkDef.objectTypeRidManySide]: sideMany
197
+ };
198
+ break;
199
+ }
200
+ default:
201
+ throw new Error("Unknown link definition type");
202
+ }
203
+
204
+ // Add mappings to result
205
+ for (const [objectTypeApiName, linkSide] of Object.entries(mappings)) {
206
+ if (!result[objectTypeApiName]) {
207
+ result[objectTypeApiName] = [];
208
+ }
209
+ result[objectTypeApiName].push(linkSide);
210
+ }
211
+ }
212
+ return result;
213
+ }
214
+
215
+ /**
216
+ * Convert IR action types to OSDK format
217
+ */
218
+ static getOsdkActionTypes(actions) {
219
+ const result = {};
220
+ for (const action of actions) {
221
+ const metadata = action.actionType.metadata;
222
+ const actionType = {
223
+ rid: `ri.action.${metadata.apiName}`,
224
+ apiName: metadata.apiName,
225
+ displayName: metadata.displayMetadata.displayName,
226
+ description: metadata.displayMetadata.description,
227
+ parameters: this.getOsdkActionParameters(action),
228
+ operations: this.getOsdkActionOperations(action),
229
+ status: this.convertActionTypeStatus(metadata.status)
230
+ };
231
+ result[actionType.apiName] = actionType;
232
+ }
233
+ return result;
234
+ }
235
+
236
+ /**
237
+ * Convert action operations from IR
238
+ */
239
+ static getOsdkActionOperations(action) {
240
+ return action.actionType.actionTypeLogic.logic.rules.map(irLogic => {
241
+ switch (irLogic.type) {
242
+ case "addInterfaceRule":
243
+ {
244
+ const r = irLogic.addInterfaceRule;
245
+ return {
246
+ type: "createInterfaceObject",
247
+ interfaceTypeApiName: r.interfaceApiName
248
+ };
249
+ }
250
+ case "addLinkRule":
251
+ throw new Error("Add link rule not supported");
252
+ case "addObjectRule":
253
+ {
254
+ const r = irLogic.addObjectRule;
255
+ return {
256
+ type: "createObject",
257
+ objectTypeApiName: r.objectTypeId
258
+ };
259
+ }
260
+ case "addOrModifyObjectRuleV2":
261
+ {
262
+ const r = irLogic.addOrModifyObjectRuleV2;
263
+ return {
264
+ type: "modifyObject",
265
+ objectTypeApiName: r.objectToModify
266
+ };
267
+ }
268
+ case "deleteLinkRule":
269
+ throw new Error("Delete link rule not supported");
270
+ case "deleteObjectRule":
271
+ {
272
+ const r = irLogic.deleteObjectRule;
273
+ return {
274
+ type: "deleteObject",
275
+ objectTypeApiName: r.objectToDelete
276
+ };
277
+ }
278
+ case "modifyInterfaceRule":
279
+ {
280
+ const r = irLogic.modifyInterfaceRule;
281
+ const parameter = action.actionType.metadata.parameters[r.interfaceObjectToModifyParameter];
282
+ if (!parameter) {
283
+ throw new Error("Could not find interface type api name");
284
+ }
285
+ let interfaceTypeApiName = null;
286
+ switch (parameter.type.type) {
287
+ case "interfaceReference":
288
+ interfaceTypeApiName = parameter.type.interfaceReference.interfaceTypeRid;
289
+ break;
290
+ case "interfaceReferenceList":
291
+ interfaceTypeApiName = parameter.type.interfaceReferenceList.interfaceTypeRid;
292
+ break;
293
+ default:
294
+ interfaceTypeApiName = null;
295
+ }
296
+ if (!interfaceTypeApiName) {
297
+ throw new Error("Could not find interface type api name");
298
+ }
299
+ return {
300
+ type: "modifyInterfaceObject",
301
+ interfaceTypeApiName
302
+ };
303
+ }
304
+ case "modifyObjectRule":
305
+ {
306
+ const r = irLogic.modifyObjectRule;
307
+ return {
308
+ type: "modifyObject",
309
+ objectTypeApiName: r.objectToModify
310
+ };
311
+ }
312
+ default:
313
+ throw new Error("Unknown logic rule type");
314
+ }
315
+ });
316
+ }
317
+
318
+ /**
319
+ * Convert action parameters from IR
320
+ */
321
+ static getOsdkActionParameters(action) {
322
+ const result = {};
323
+ for (const [paramKey, irParameter] of Object.entries(action.actionType.metadata.parameters)) {
324
+ let dataType;
325
+ switch (irParameter.type.type) {
326
+ case "attachment":
327
+ dataType = {
328
+ type: "attachment"
329
+ };
330
+ break;
331
+ case "attachmentList":
332
+ dataType = {
333
+ type: "array",
334
+ subType: {
335
+ type: "attachment"
336
+ }
337
+ };
338
+ break;
339
+ case "boolean":
340
+ dataType = {
341
+ type: "boolean"
342
+ };
343
+ break;
344
+ case "booleanList":
345
+ dataType = {
346
+ type: "array",
347
+ subType: {
348
+ type: "boolean"
349
+ }
350
+ };
351
+ break;
352
+ case "date":
353
+ dataType = {
354
+ type: "date"
355
+ };
356
+ break;
357
+ case "dateList":
358
+ dataType = {
359
+ type: "array",
360
+ subType: {
361
+ type: "date"
362
+ }
363
+ };
364
+ break;
365
+ case "decimal":
366
+ throw new Error("Decimal type not supported");
367
+ case "decimalList":
368
+ throw new Error("Decimal list type not supported");
369
+ case "double":
370
+ dataType = {
371
+ type: "double"
372
+ };
373
+ break;
374
+ case "doubleList":
375
+ dataType = {
376
+ type: "array",
377
+ subType: {
378
+ type: "double"
379
+ }
380
+ };
381
+ break;
382
+ case "geohash":
383
+ dataType = {
384
+ type: "geohash"
385
+ };
386
+ break;
387
+ case "geohashList":
388
+ dataType = {
389
+ type: "array",
390
+ subType: {
391
+ type: "geohash"
392
+ }
393
+ };
394
+ break;
395
+ case "geoshape":
396
+ dataType = {
397
+ type: "geoshape"
398
+ };
399
+ break;
400
+ case "geoshapeList":
401
+ dataType = {
402
+ type: "array",
403
+ subType: {
404
+ type: "geoshape"
405
+ }
406
+ };
407
+ break;
408
+ case "geotimeSeriesReference":
409
+ throw new Error("Geotime series reference type not supported");
410
+ case "geotimeSeriesReferenceList":
411
+ throw new Error("Geotime series reference list type not supported");
412
+ case "integer":
413
+ dataType = {
414
+ type: "integer"
415
+ };
416
+ break;
417
+ case "integerList":
418
+ dataType = {
419
+ type: "array",
420
+ subType: {
421
+ type: "integer"
422
+ }
423
+ };
424
+ break;
425
+ case "interfaceReference":
426
+ throw new Error("Interface reference type not supported");
427
+ case "interfaceReferenceList":
428
+ throw new Error("Interface reference list type not supported");
429
+ case "long":
430
+ dataType = {
431
+ type: "long"
432
+ };
433
+ break;
434
+ case "longList":
435
+ dataType = {
436
+ type: "array",
437
+ subType: {
438
+ type: "long"
439
+ }
440
+ };
441
+ break;
442
+ case "marking":
443
+ dataType = {
444
+ type: "marking"
445
+ };
446
+ break;
447
+ case "markingList":
448
+ dataType = {
449
+ type: "array",
450
+ subType: {
451
+ type: "marking"
452
+ }
453
+ };
454
+ break;
455
+ case "mediaReference":
456
+ dataType = {
457
+ type: "mediaReference"
458
+ };
459
+ break;
460
+ case "mediaReferenceList":
461
+ dataType = {
462
+ type: "array",
463
+ subType: {
464
+ type: "mediaReference"
465
+ }
466
+ };
467
+ break;
468
+ case "objectReference":
469
+ {
470
+ const t = irParameter.type.objectReference;
471
+ dataType = {
472
+ type: "object",
473
+ objectTypeApiName: t.objectTypeId,
474
+ objectApiName: t.objectTypeId
475
+ };
476
+ break;
477
+ }
478
+ case "objectReferenceList":
479
+ {
480
+ const t = irParameter.type.objectReferenceList;
481
+ dataType = {
482
+ type: "array",
483
+ subType: {
484
+ type: "object",
485
+ objectTypeApiName: t.objectTypeId,
486
+ objectApiName: t.objectTypeId
487
+ }
488
+ };
489
+ break;
490
+ }
491
+ case "objectSetRid":
492
+ dataType = {
493
+ type: "objectSet"
494
+ };
495
+ break;
496
+ case "objectTypeReference":
497
+ dataType = {
498
+ type: "objectType"
499
+ };
500
+ break;
501
+ case "string":
502
+ dataType = {
503
+ type: "string"
504
+ };
505
+ break;
506
+ case "stringList":
507
+ dataType = {
508
+ type: "array",
509
+ subType: {
510
+ type: "string"
511
+ }
512
+ };
513
+ break;
514
+ case "struct":
515
+ throw new Error("Struct type not supported (lazy implementation)");
516
+ case "structList":
517
+ throw new Error("Struct list type not supported");
518
+ case "timeSeriesReference":
519
+ throw new Error("Time series reference type not supported");
520
+ case "timestamp":
521
+ dataType = {
522
+ type: "timestamp"
523
+ };
524
+ break;
525
+ case "timestampList":
526
+ dataType = {
527
+ type: "array",
528
+ subType: {
529
+ type: "timestamp"
530
+ }
531
+ };
532
+ break;
533
+ default:
534
+ throw new Error("Unknown parameter type");
535
+ }
536
+ result[paramKey] = {
537
+ displayName: irParameter.displayMetadata.displayName,
538
+ description: irParameter.displayMetadata.description,
539
+ required: true,
540
+ dataType
541
+ };
542
+ }
543
+ return result;
544
+ }
545
+
546
+ /**
547
+ * Convert interface types from IR
548
+ */
549
+ static getOsdkInterfaceTypes(interfaces) {
550
+ const result = {};
551
+ for (const interfaceData of interfaces) {
552
+ const interfaceType = interfaceData.interfaceType;
553
+
554
+ // Convert shared properties to interface shared properties
555
+ const properties = {};
556
+ for (const [propKey, propValue] of Object.entries(interfaceType.propertiesV2)) {
557
+ const spt = propValue.sharedPropertyType;
558
+ const dataType = this.getOsdkPropertyType(spt.type);
559
+ if (dataType) {
560
+ properties[propKey] = {
561
+ rid: `ri.interface.${interfaceType.apiName}.${spt.apiName}`,
562
+ apiName: spt.apiName,
563
+ displayName: spt.displayMetadata.displayName,
564
+ description: spt.displayMetadata.description ?? undefined,
565
+ dataType,
566
+ required: false // Default to false for now - this should come from IR if available
567
+ };
568
+ }
569
+ }
570
+ const result_interfaceType = {
571
+ apiName: interfaceType.apiName,
572
+ rid: `ri.interface.${interfaceType.apiName}`,
573
+ properties,
574
+ allProperties: properties,
575
+ // Same as properties for now
576
+ extendsInterfaces: interfaceType.extendsInterfaces.map(val => val),
577
+ allExtendsInterfaces: interfaceType.extendsInterfaces.map(val => val),
578
+ // Same as extendsInterfaces for now
579
+ implementedByObjectTypes: [],
580
+ // Empty for now
581
+ displayName: interfaceType.displayMetadata.displayName,
582
+ description: interfaceType.displayMetadata.description ?? undefined,
583
+ links: this.getOsdkInterfaceLinkTypes(interfaceType.links),
584
+ allLinks: this.getOsdkInterfaceLinkTypes(interfaceType.links) // Same as links for now
585
+ };
586
+ result[result_interfaceType.apiName] = result_interfaceType;
587
+ }
588
+ return result;
589
+ }
590
+
591
+ /**
592
+ * Convert interface link types from IR
593
+ */
594
+ static getOsdkInterfaceLinkTypes(ilts) {
595
+ const result = {};
596
+ for (const ilt of ilts) {
597
+ let linkedEntityApiName;
598
+ switch (ilt.linkedEntityTypeId.type) {
599
+ case "interfaceType":
600
+ {
601
+ const interfaceType = ilt.linkedEntityTypeId.interfaceType;
602
+ linkedEntityApiName = {
603
+ type: "interfaceTypeApiName",
604
+ apiName: interfaceType
605
+ };
606
+ break;
607
+ }
608
+ case "objectType":
609
+ throw new Error("Interface links to object types should not be possible in ontology as code yet");
610
+ default:
611
+ throw new Error("Unknown linked entity type");
612
+ }
613
+ let cardinality;
614
+ switch (ilt.cardinality) {
615
+ case "SINGLE":
616
+ cardinality = "ONE";
617
+ break;
618
+ case "MANY":
619
+ cardinality = "MANY";
620
+ break;
621
+ default:
622
+ throw new Error("Unknown cardinality type");
623
+ }
624
+ const interfaceLinkType = {
625
+ rid: `ri.interfacelink.${linkedEntityApiName.apiName}.${ilt.metadata.apiName}`,
626
+ apiName: ilt.metadata.apiName,
627
+ displayName: ilt.metadata.displayName,
628
+ description: ilt.metadata.description,
629
+ linkedEntityApiName,
630
+ cardinality,
631
+ required: ilt.required
632
+ };
633
+ result[interfaceLinkType.apiName] = interfaceLinkType;
634
+ }
635
+ return result;
636
+ }
637
+
638
+ /**
639
+ * Convert shared property types from IR
640
+ */
641
+ static getOsdkSharedPropertyTypes(spts) {
642
+ const result = {};
643
+ for (const spt of spts) {
644
+ const dataType = this.getOsdkPropertyType(spt.sharedPropertyType.type);
645
+ if (dataType) {
646
+ const sharedPropertyType = {
647
+ rid: `ri.spt.${spt.sharedPropertyType.apiName}`,
648
+ apiName: spt.sharedPropertyType.apiName,
649
+ displayName: spt.sharedPropertyType.displayMetadata.displayName,
650
+ description: spt.sharedPropertyType.displayMetadata.description ?? undefined,
651
+ dataType
652
+ };
653
+ result[sharedPropertyType.apiName] = sharedPropertyType;
654
+ } else {
655
+ throw new Error(`Unsupported property type '${JSON.stringify(spt.sharedPropertyType.type)}' for spt '${spt.sharedPropertyType.apiName}'`);
656
+ }
657
+ }
658
+ return result;
659
+ }
660
+
661
+ /**
662
+ * Convert property types from IR to OSDK format
663
+ */
664
+ static getOsdkPropertyType(type) {
665
+ switch (type.type) {
666
+ case "array":
667
+ {
668
+ const value = type.array;
669
+ const subType = this.getOsdkPropertyType(value.subtype);
670
+ return subType ? {
671
+ type: "array",
672
+ subType
673
+ } : null;
674
+ }
675
+ case "boolean":
676
+ return {
677
+ type: "boolean"
678
+ };
679
+ case "byte":
680
+ return {
681
+ type: "byte"
682
+ };
683
+ case "date":
684
+ return {
685
+ type: "date"
686
+ };
687
+ case "decimal":
688
+ return {
689
+ type: "decimal"
690
+ };
691
+ case "double":
692
+ return {
693
+ type: "double"
694
+ };
695
+ case "float":
696
+ return {
697
+ type: "float"
698
+ };
699
+ case "geohash":
700
+ return {
701
+ type: "geopoint"
702
+ };
703
+ case "geoshape":
704
+ return {
705
+ type: "geoshape"
706
+ };
707
+ case "integer":
708
+ return {
709
+ type: "integer"
710
+ };
711
+ case "long":
712
+ return {
713
+ type: "long"
714
+ };
715
+ case "short":
716
+ return {
717
+ type: "short"
718
+ };
719
+ case "string":
720
+ return {
721
+ type: "string"
722
+ };
723
+ case "experimentalTimeDependentV1":
724
+ return null;
725
+ case "timestamp":
726
+ return {
727
+ type: "timestamp"
728
+ };
729
+ case "attachment":
730
+ return {
731
+ type: "attachment"
732
+ };
733
+ case "marking":
734
+ return {
735
+ type: "marking"
736
+ };
737
+ case "cipherText":
738
+ return null;
739
+ case "mediaReference":
740
+ return null;
741
+ case "vector":
742
+ return null;
743
+ case "geotimeSeriesReference":
744
+ return null;
745
+ case "struct":
746
+ {
747
+ const value = type.struct;
748
+ const ridBase = `ri.struct.${hash("sha256", JSON.stringify(type)).slice(0, 10)}`;
749
+ return {
750
+ type: "struct",
751
+ structFieldTypes: value.structFields.map(field => {
752
+ const fieldDataType = this.getOsdkPropertyType(field.fieldType);
753
+ if (!fieldDataType) {
754
+ throw new Error(`Unsupported field type in struct: ${field.apiName}`);
755
+ }
756
+ return {
757
+ apiName: field.apiName,
758
+ rid: `${ridBase}.${field.apiName}`,
759
+ dataType: fieldDataType
760
+ };
761
+ })
762
+ };
763
+ }
764
+ default:
765
+ return null;
766
+ }
767
+ }
768
+ static convertObjectTypeStatus(status) {
769
+ switch (status.type) {
770
+ case "active":
771
+ return "ACTIVE";
772
+ case "deprecated":
773
+ return "DEPRECATED";
774
+ case "endorsed":
775
+ throw new Error("Endorsed status is not supported yet");
776
+ case "example":
777
+ throw new Error("Example status has no mapping");
778
+ case "experimental":
779
+ return "EXPERIMENTAL";
780
+ default:
781
+ throw new Error(`Unknown object type status: ${status}`);
782
+ }
783
+ }
784
+ static convertActionTypeStatus(status) {
785
+ switch (status.type) {
786
+ case "active":
787
+ return "ACTIVE";
788
+ case "deprecated":
789
+ return "DEPRECATED";
790
+ case "example":
791
+ throw new Error("Example status has no mapping");
792
+ case "experimental":
793
+ return "EXPERIMENTAL";
794
+ default:
795
+ throw new Error(`Unknown action type status: ${status}`);
796
+ }
797
+ }
798
+ static convertLinkTypeStatus(status) {
799
+ switch (status.type) {
800
+ case "active":
801
+ return "ACTIVE";
802
+ case "deprecated":
803
+ return "DEPRECATED";
804
+ case "example":
805
+ throw new Error("Example status has no mapping");
806
+ case "experimental":
807
+ return "EXPERIMENTAL";
808
+ default:
809
+ throw new Error(`Unknown link type status: ${status}`);
810
+ }
811
+ }
812
+ }
813
+ //# sourceMappingURL=OntologyIrToFullMetadataConverter.js.map