@osdk/generator-converters.preview 0.1.0-beta.0

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.
Files changed (40) hide show
  1. package/build/browser/ActionLogicRuleConverter.js +149 -0
  2. package/build/browser/ActionLogicRuleConverter.js.map +1 -0
  3. package/build/browser/PreviewOntologyIrConverter.js +116 -0
  4. package/build/browser/PreviewOntologyIrConverter.js.map +1 -0
  5. package/build/browser/cli/generate-sdk.js +105 -0
  6. package/build/browser/cli/generate-sdk.js.map +1 -0
  7. package/build/browser/index.js +18 -0
  8. package/build/browser/index.js.map +1 -0
  9. package/build/browser/ridUtils.js +28 -0
  10. package/build/browser/ridUtils.js.map +1 -0
  11. package/build/browser/ridUtils.test.js +43 -0
  12. package/build/browser/ridUtils.test.js.map +1 -0
  13. package/build/cjs/index.cjs +224 -0
  14. package/build/cjs/index.cjs.map +1 -0
  15. package/build/cjs/index.d.cts +32 -0
  16. package/build/esm/ActionLogicRuleConverter.js +149 -0
  17. package/build/esm/ActionLogicRuleConverter.js.map +1 -0
  18. package/build/esm/PreviewOntologyIrConverter.js +116 -0
  19. package/build/esm/PreviewOntologyIrConverter.js.map +1 -0
  20. package/build/esm/cli/generate-sdk.js +105 -0
  21. package/build/esm/cli/generate-sdk.js.map +1 -0
  22. package/build/esm/index.js +18 -0
  23. package/build/esm/index.js.map +1 -0
  24. package/build/esm/ridUtils.js +28 -0
  25. package/build/esm/ridUtils.js.map +1 -0
  26. package/build/esm/ridUtils.test.js +43 -0
  27. package/build/esm/ridUtils.test.js.map +1 -0
  28. package/build/types/ActionLogicRuleConverter.d.ts +6 -0
  29. package/build/types/ActionLogicRuleConverter.d.ts.map +1 -0
  30. package/build/types/PreviewOntologyIrConverter.d.ts +29 -0
  31. package/build/types/PreviewOntologyIrConverter.d.ts.map +1 -0
  32. package/build/types/cli/generate-sdk.d.ts +1 -0
  33. package/build/types/cli/generate-sdk.d.ts.map +1 -0
  34. package/build/types/index.d.ts +1 -0
  35. package/build/types/index.d.ts.map +1 -0
  36. package/build/types/ridUtils.d.ts +5 -0
  37. package/build/types/ridUtils.d.ts.map +1 -0
  38. package/build/types/ridUtils.test.d.ts +1 -0
  39. package/build/types/ridUtils.test.d.ts.map +1 -0
  40. package/package.json +80 -0
@@ -0,0 +1,224 @@
1
+ 'use strict';
2
+
3
+ var generatorConverters_ontologyir = require('@osdk/generator-converters.ontologyir');
4
+ var crypto = require('crypto');
5
+
6
+ // src/PreviewOntologyIrConverter.ts
7
+
8
+ // src/ActionLogicRuleConverter.ts
9
+ function buildObjectTypeLookup(ir) {
10
+ if (!ir?.objectTypes) {
11
+ return void 0;
12
+ }
13
+ const byId = /* @__PURE__ */ new Map();
14
+ const byHyphenated = /* @__PURE__ */ new Map();
15
+ for (const [key, value] of Object.entries(ir.objectTypes)) {
16
+ const apiName = value.objectType.apiName;
17
+ byId.set(key, apiName);
18
+ byHyphenated.set(apiName.replace(/\./g, "-"), apiName);
19
+ }
20
+ return {
21
+ byId,
22
+ byHyphenated
23
+ };
24
+ }
25
+ function buildInterfaceTypeLookup(ir) {
26
+ if (!ir?.interfaceTypes) {
27
+ return void 0;
28
+ }
29
+ const byId = /* @__PURE__ */ new Map();
30
+ const byHyphenated = /* @__PURE__ */ new Map();
31
+ for (const [key, value] of Object.entries(ir.interfaceTypes)) {
32
+ const apiName = value.interfaceType.apiName;
33
+ byId.set(key, apiName);
34
+ byHyphenated.set(apiName.replace(/\./g, "-"), apiName);
35
+ }
36
+ return {
37
+ byId,
38
+ byHyphenated
39
+ };
40
+ }
41
+ function resolveApiName(id, lookup) {
42
+ if (!lookup) {
43
+ return id;
44
+ }
45
+ return lookup.byId.get(id) ?? lookup.byHyphenated.get(id) ?? id;
46
+ }
47
+ function getObjectReferenceType(action, paramKey) {
48
+ const param = action.actionType.metadata.parameters[paramKey];
49
+ if (!param || param.type.type !== "objectReference") {
50
+ throw new Error(`Parameter '${paramKey}' must be an objectReference type`);
51
+ }
52
+ return param.type.objectReference;
53
+ }
54
+ function convertIrLogicRuleToActionLogicRule(irRule, action, ir) {
55
+ const objectLookup = buildObjectTypeLookup(ir);
56
+ const interfaceLookup = buildInterfaceTypeLookup(ir);
57
+ switch (irRule.type) {
58
+ case "addObjectRule": {
59
+ const r = irRule.addObjectRule;
60
+ const propertyArguments = {};
61
+ for (const [k, v] of Object.entries(r.propertyValues)) {
62
+ propertyArguments[k] = v;
63
+ }
64
+ const result = {
65
+ type: "createObject",
66
+ objectTypeApiName: resolveApiName(r.objectTypeId, objectLookup),
67
+ propertyArguments,
68
+ structPropertyArguments: {}
69
+ };
70
+ return result;
71
+ }
72
+ case "addOrModifyObjectRuleV2": {
73
+ const r = irRule.addOrModifyObjectRuleV2;
74
+ const objRef = getObjectReferenceType(action, r.objectToModify);
75
+ const result = {
76
+ type: "createOrModifyObject",
77
+ objectTypeApiName: resolveApiName(objRef.objectTypeId, objectLookup),
78
+ propertyArguments: {},
79
+ structPropertyArguments: {}
80
+ };
81
+ return result;
82
+ }
83
+ case "modifyObjectRule": {
84
+ const r = irRule.modifyObjectRule;
85
+ getObjectReferenceType(action, r.objectToModify);
86
+ const result = {
87
+ type: "modifyObject",
88
+ objectToModify: r.objectToModify,
89
+ propertyArguments: {},
90
+ structPropertyArguments: {}
91
+ };
92
+ return result;
93
+ }
94
+ case "deleteObjectRule": {
95
+ const r = irRule.deleteObjectRule;
96
+ const result = {
97
+ type: "deleteObject",
98
+ objectToDelete: r.objectToDelete
99
+ };
100
+ return result;
101
+ }
102
+ case "addInterfaceRule": {
103
+ const r = irRule.addInterfaceRule;
104
+ const interfaceApiName = resolveApiName(r.interfaceApiName, interfaceLookup);
105
+ const result = {
106
+ type: "createInterface",
107
+ interfaceTypeApiName: interfaceApiName,
108
+ objectType: interfaceApiName,
109
+ sharedPropertyArguments: {},
110
+ structPropertyArguments: {}
111
+ };
112
+ return result;
113
+ }
114
+ case "modifyInterfaceRule": {
115
+ const r = irRule.modifyInterfaceRule;
116
+ const result = {
117
+ type: "modifyInterface",
118
+ interfaceObjectToModify: r.interfaceObjectToModifyParameter,
119
+ sharedPropertyArguments: {},
120
+ structPropertyArguments: {}
121
+ };
122
+ return result;
123
+ }
124
+ case "addLinkRule":
125
+ throw new Error("addLinkRule is not supported for ActionLogicRule");
126
+ case "deleteLinkRule":
127
+ throw new Error("deleteLinkRule is not supported for ActionLogicRule");
128
+ default:
129
+ throw new Error(`Unsupported logic rule type: ${irRule.type}`);
130
+ }
131
+ }
132
+ function toUuid(str) {
133
+ const hashHex = crypto.createHash("sha256").update(str).digest("hex");
134
+ return `${hashHex.slice(0, 8)}-${hashHex.slice(8, 12)}-${hashHex.slice(12, 16)}-${hashHex.slice(16, 20)}-${hashHex.slice(20, 32)}`;
135
+ }
136
+
137
+ // src/PreviewOntologyIrConverter.ts
138
+ var PreviewOntologyIrConverter = class {
139
+ /**
140
+ * Main entry point - converts IR to full metadata with enhanced action types.
141
+ * Returns ActionTypeFullMetadata which includes fullLogicRules.
142
+ */
143
+ static getPreviewFullMetadataFromIr(ir) {
144
+ const baseMetadata = generatorConverters_ontologyir.OntologyIrToFullMetadataConverter.getFullMetadataFromIr(ir);
145
+ const actionTypes = this.convertActionTypesWithFullLogicRules(Object.values(ir.actionTypes), ir);
146
+ const objectTypes = this.convertObjectTypesWithUuidRids(baseMetadata.objectTypes);
147
+ return {
148
+ ...baseMetadata,
149
+ objectTypes,
150
+ actionTypes,
151
+ ontology: {
152
+ apiName: "ontology",
153
+ rid: "ri.ontology.main.ontology.0",
154
+ displayName: "ontology",
155
+ description: "local ontology"
156
+ }
157
+ };
158
+ }
159
+ /**
160
+ * Post-process object types to use UUID-based RIDs for properties.
161
+ */
162
+ static convertObjectTypesWithUuidRids(objectTypes) {
163
+ const result = {};
164
+ for (const [apiName, fullMetadata] of Object.entries(objectTypes)) {
165
+ const objectType = fullMetadata.objectType;
166
+ const properties = {};
167
+ for (const [propKey, prop] of Object.entries(objectType.properties)) {
168
+ properties[propKey] = {
169
+ ...prop,
170
+ rid: `ri.ontology.main.property.${toUuid(apiName + "." + propKey)}`
171
+ };
172
+ }
173
+ result[apiName] = {
174
+ ...fullMetadata,
175
+ objectType: {
176
+ ...objectType,
177
+ rid: `ri.ontology.main.object-type.${toUuid(apiName)}`,
178
+ properties
179
+ }
180
+ };
181
+ }
182
+ return result;
183
+ }
184
+ /**
185
+ * Convert IR action types to ActionTypeFullMetadata format.
186
+ * Uses base converter for parameters and operations, adds fullLogicRules.
187
+ */
188
+ static convertActionTypesWithFullLogicRules(actions, ir) {
189
+ const result = {};
190
+ for (const action of actions) {
191
+ const metadata = action.actionType.metadata;
192
+ const actionType = {
193
+ rid: `ri.ontology.main.action-type.${toUuid(metadata.apiName)}`,
194
+ apiName: metadata.apiName,
195
+ displayName: metadata.displayMetadata.displayName,
196
+ description: metadata.displayMetadata.description,
197
+ parameters: generatorConverters_ontologyir.OntologyIrToFullMetadataConverter.getOsdkActionParameters(action),
198
+ operations: generatorConverters_ontologyir.OntologyIrToFullMetadataConverter.getOsdkActionOperations(action),
199
+ status: this.convertActionTypeStatus(metadata.status)
200
+ };
201
+ result[actionType.apiName] = {
202
+ actionType,
203
+ fullLogicRules: action.actionType.actionTypeLogic.logic.rules.map((rule) => convertIrLogicRuleToActionLogicRule(rule, action, ir))
204
+ };
205
+ }
206
+ return result;
207
+ }
208
+ static convertActionTypeStatus(status) {
209
+ switch (status.type) {
210
+ case "active":
211
+ return "ACTIVE";
212
+ case "deprecated":
213
+ return "DEPRECATED";
214
+ case "experimental":
215
+ return "EXPERIMENTAL";
216
+ case "example":
217
+ throw new Error("Example status cannot be mapped to ActionTypeStatus");
218
+ }
219
+ }
220
+ };
221
+
222
+ exports.PreviewOntologyIrConverter = PreviewOntologyIrConverter;
223
+ //# sourceMappingURL=index.cjs.map
224
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ActionLogicRuleConverter.ts","../../src/ridUtils.ts","../../src/PreviewOntologyIrConverter.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 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction buildObjectTypeLookup(ir) {\n if (!ir?.objectTypes) {\n return undefined;\n }\n const byId = new Map();\n const byHyphenated = new Map();\n for (const [key, value] of Object.entries(ir.objectTypes)) {\n const apiName = value.objectType.apiName;\n byId.set(key, apiName);\n byHyphenated.set(apiName.replace(/\\./g, \"-\"), apiName);\n }\n return {\n byId,\n byHyphenated\n };\n}\nfunction buildInterfaceTypeLookup(ir) {\n if (!ir?.interfaceTypes) {\n return undefined;\n }\n const byId = new Map();\n const byHyphenated = new Map();\n for (const [key, value] of Object.entries(ir.interfaceTypes)) {\n const apiName = value.interfaceType.apiName;\n byId.set(key, apiName);\n byHyphenated.set(apiName.replace(/\\./g, \"-\"), apiName);\n }\n return {\n byId,\n byHyphenated\n };\n}\nfunction resolveApiName(id, lookup) {\n if (!lookup) {\n return id;\n }\n return lookup.byId.get(id) ?? lookup.byHyphenated.get(id) ?? id;\n}\nfunction getObjectReferenceType(action, paramKey) {\n const param = action.actionType.metadata.parameters[paramKey];\n if (!param || param.type.type !== \"objectReference\") {\n throw new Error(`Parameter '${paramKey}' must be an objectReference type`);\n }\n return param.type.objectReference;\n}\n\n/**\n * Convert OntologyIrLogicRule to ActionLogicRule for use in ActionTypeFullMetadata.\n */\nexport function convertIrLogicRuleToActionLogicRule(irRule, action, ir) {\n const objectLookup = buildObjectTypeLookup(ir);\n const interfaceLookup = buildInterfaceTypeLookup(ir);\n switch (irRule.type) {\n case \"addObjectRule\":\n {\n const r = irRule.addObjectRule;\n const propertyArguments = {};\n for (const [k, v] of Object.entries(r.propertyValues)) {\n propertyArguments[k] = v;\n }\n const result = {\n type: \"createObject\",\n objectTypeApiName: resolveApiName(r.objectTypeId, objectLookup),\n propertyArguments,\n structPropertyArguments: {}\n };\n return result;\n }\n case \"addOrModifyObjectRuleV2\":\n {\n const r = irRule.addOrModifyObjectRuleV2;\n const objRef = getObjectReferenceType(action, r.objectToModify);\n const result = {\n type: \"createOrModifyObject\",\n objectTypeApiName: resolveApiName(objRef.objectTypeId, objectLookup),\n propertyArguments: {},\n structPropertyArguments: {}\n };\n return result;\n }\n case \"modifyObjectRule\":\n {\n const r = irRule.modifyObjectRule;\n getObjectReferenceType(action, r.objectToModify);\n const result = {\n type: \"modifyObject\",\n objectToModify: r.objectToModify,\n propertyArguments: {},\n structPropertyArguments: {}\n };\n return result;\n }\n case \"deleteObjectRule\":\n {\n const r = irRule.deleteObjectRule;\n const result = {\n type: \"deleteObject\",\n objectToDelete: r.objectToDelete\n };\n return result;\n }\n case \"addInterfaceRule\":\n {\n const r = irRule.addInterfaceRule;\n const interfaceApiName = resolveApiName(r.interfaceApiName, interfaceLookup);\n const result = {\n type: \"createInterface\",\n interfaceTypeApiName: interfaceApiName,\n objectType: interfaceApiName,\n sharedPropertyArguments: {},\n structPropertyArguments: {}\n };\n return result;\n }\n case \"modifyInterfaceRule\":\n {\n const r = irRule.modifyInterfaceRule;\n const result = {\n type: \"modifyInterface\",\n interfaceObjectToModify: r.interfaceObjectToModifyParameter,\n sharedPropertyArguments: {},\n structPropertyArguments: {}\n };\n return result;\n }\n case \"addLinkRule\":\n throw new Error(\"addLinkRule is not supported for ActionLogicRule\");\n case \"deleteLinkRule\":\n throw new Error(\"deleteLinkRule is not supported for ActionLogicRule\");\n default:\n throw new Error(`Unsupported logic rule type: ${irRule.type}`);\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createHash } from \"node:crypto\";\n\n/**\n * Generate a deterministic UUID from a string.\n * Uses SHA-256 hash truncated to UUID format for consistency.\n */\nexport function toUuid(str) {\n const hashHex = createHash(\"sha256\").update(str).digest(\"hex\");\n // Format as UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n return `${hashHex.slice(0, 8)}-${hashHex.slice(8, 12)}-${hashHex.slice(12, 16)}-${hashHex.slice(16, 20)}-${hashHex.slice(20, 32)}`;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OntologyIrToFullMetadataConverter } from \"@osdk/generator-converters.ontologyir\";\nimport { convertIrLogicRuleToActionLogicRule } from \"./ActionLogicRuleConverter.js\";\nimport { toUuid } from \"./ridUtils.js\";\n\n/**\n * Extended return type that uses ActionTypeFullMetadata instead of ActionTypeV2.\n */\n\n/**\n * Preview converter that extends the base OntologyIrToFullMetadataConverter\n * to return ActionTypeFullMetadata with fullLogicRules instead of ActionTypeV2.\n */\nexport class PreviewOntologyIrConverter {\n /**\n * Main entry point - converts IR to full metadata with enhanced action types.\n * Returns ActionTypeFullMetadata which includes fullLogicRules.\n */\n static getPreviewFullMetadataFromIr(ir) {\n const baseMetadata = OntologyIrToFullMetadataConverter.getFullMetadataFromIr(ir);\n const actionTypes = this.convertActionTypesWithFullLogicRules(Object.values(ir.actionTypes), ir);\n\n // Post-process object types to use UUID-based RIDs\n const objectTypes = this.convertObjectTypesWithUuidRids(baseMetadata.objectTypes);\n return {\n ...baseMetadata,\n objectTypes,\n actionTypes,\n ontology: {\n apiName: \"ontology\",\n rid: \"ri.ontology.main.ontology.0\",\n displayName: \"ontology\",\n description: \"local ontology\"\n }\n };\n }\n\n /**\n * Post-process object types to use UUID-based RIDs for properties.\n */\n static convertObjectTypesWithUuidRids(objectTypes) {\n const result = {};\n for (const [apiName, fullMetadata] of Object.entries(objectTypes)) {\n const objectType = fullMetadata.objectType;\n const properties = {};\n for (const [propKey, prop] of Object.entries(objectType.properties)) {\n properties[propKey] = {\n ...prop,\n rid: `ri.ontology.main.property.${toUuid(apiName + \".\" + propKey)}`\n };\n }\n result[apiName] = {\n ...fullMetadata,\n objectType: {\n ...objectType,\n rid: `ri.ontology.main.object-type.${toUuid(apiName)}`,\n properties\n }\n };\n }\n return result;\n }\n\n /**\n * Convert IR action types to ActionTypeFullMetadata format.\n * Uses base converter for parameters and operations, adds fullLogicRules.\n */\n static convertActionTypesWithFullLogicRules(actions, ir) {\n const result = {};\n for (const action of actions) {\n const metadata = action.actionType.metadata;\n const actionType = {\n rid: `ri.ontology.main.action-type.${toUuid(metadata.apiName)}`,\n apiName: metadata.apiName,\n displayName: metadata.displayMetadata.displayName,\n description: metadata.displayMetadata.description,\n parameters: OntologyIrToFullMetadataConverter.getOsdkActionParameters(action),\n operations: OntologyIrToFullMetadataConverter.getOsdkActionOperations(action),\n status: this.convertActionTypeStatus(metadata.status)\n };\n result[actionType.apiName] = {\n actionType,\n fullLogicRules: action.actionType.actionTypeLogic.logic.rules.map(rule => convertIrLogicRuleToActionLogicRule(rule, action, ir))\n };\n }\n return result;\n }\n static convertActionTypeStatus(status) {\n switch (status.type) {\n case \"active\":\n return \"ACTIVE\";\n case \"deprecated\":\n return \"DEPRECATED\";\n case \"experimental\":\n return \"EXPERIMENTAL\";\n case \"example\":\n throw new Error(\"Example status cannot be mapped to ActionTypeStatus\");\n }\n }\n}"]}
@@ -0,0 +1,32 @@
1
+ import { OntologyIrOntologyBlockDataV2 } from '@osdk/client.unstable';
2
+ import * as Ontologies from '@osdk/foundry.ontologies';
3
+
4
+ /**
5
+ * Extended return type that uses ActionTypeFullMetadata instead of ActionTypeV2.
6
+ */
7
+ interface PreviewOntologyFullMetadata extends Omit<Ontologies.OntologyFullMetadata, "actionTypes"> {
8
+ actionTypes: Record<string, Ontologies.ActionTypeFullMetadata>;
9
+ }
10
+ /**
11
+ * Preview converter that extends the base OntologyIrToFullMetadataConverter
12
+ * to return ActionTypeFullMetadata with fullLogicRules instead of ActionTypeV2.
13
+ */
14
+ declare class PreviewOntologyIrConverter {
15
+ /**
16
+ * Main entry point - converts IR to full metadata with enhanced action types.
17
+ * Returns ActionTypeFullMetadata which includes fullLogicRules.
18
+ */
19
+ static getPreviewFullMetadataFromIr(ir: OntologyIrOntologyBlockDataV2): PreviewOntologyFullMetadata;
20
+ /**
21
+ * Post-process object types to use UUID-based RIDs for properties.
22
+ */
23
+ private static convertObjectTypesWithUuidRids;
24
+ /**
25
+ * Convert IR action types to ActionTypeFullMetadata format.
26
+ * Uses base converter for parameters and operations, adds fullLogicRules.
27
+ */
28
+ private static convertActionTypesWithFullLogicRules;
29
+ private static convertActionTypeStatus;
30
+ }
31
+
32
+ export { type PreviewOntologyFullMetadata, PreviewOntologyIrConverter };
@@ -0,0 +1,149 @@
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
+ function buildObjectTypeLookup(ir) {
18
+ if (!ir?.objectTypes) {
19
+ return undefined;
20
+ }
21
+ const byId = new Map();
22
+ const byHyphenated = new Map();
23
+ for (const [key, value] of Object.entries(ir.objectTypes)) {
24
+ const apiName = value.objectType.apiName;
25
+ byId.set(key, apiName);
26
+ byHyphenated.set(apiName.replace(/\./g, "-"), apiName);
27
+ }
28
+ return {
29
+ byId,
30
+ byHyphenated
31
+ };
32
+ }
33
+ function buildInterfaceTypeLookup(ir) {
34
+ if (!ir?.interfaceTypes) {
35
+ return undefined;
36
+ }
37
+ const byId = new Map();
38
+ const byHyphenated = new Map();
39
+ for (const [key, value] of Object.entries(ir.interfaceTypes)) {
40
+ const apiName = value.interfaceType.apiName;
41
+ byId.set(key, apiName);
42
+ byHyphenated.set(apiName.replace(/\./g, "-"), apiName);
43
+ }
44
+ return {
45
+ byId,
46
+ byHyphenated
47
+ };
48
+ }
49
+ function resolveApiName(id, lookup) {
50
+ if (!lookup) {
51
+ return id;
52
+ }
53
+ return lookup.byId.get(id) ?? lookup.byHyphenated.get(id) ?? id;
54
+ }
55
+ function getObjectReferenceType(action, paramKey) {
56
+ const param = action.actionType.metadata.parameters[paramKey];
57
+ if (!param || param.type.type !== "objectReference") {
58
+ throw new Error(`Parameter '${paramKey}' must be an objectReference type`);
59
+ }
60
+ return param.type.objectReference;
61
+ }
62
+
63
+ /**
64
+ * Convert OntologyIrLogicRule to ActionLogicRule for use in ActionTypeFullMetadata.
65
+ */
66
+ export function convertIrLogicRuleToActionLogicRule(irRule, action, ir) {
67
+ const objectLookup = buildObjectTypeLookup(ir);
68
+ const interfaceLookup = buildInterfaceTypeLookup(ir);
69
+ switch (irRule.type) {
70
+ case "addObjectRule":
71
+ {
72
+ const r = irRule.addObjectRule;
73
+ const propertyArguments = {};
74
+ for (const [k, v] of Object.entries(r.propertyValues)) {
75
+ propertyArguments[k] = v;
76
+ }
77
+ const result = {
78
+ type: "createObject",
79
+ objectTypeApiName: resolveApiName(r.objectTypeId, objectLookup),
80
+ propertyArguments,
81
+ structPropertyArguments: {}
82
+ };
83
+ return result;
84
+ }
85
+ case "addOrModifyObjectRuleV2":
86
+ {
87
+ const r = irRule.addOrModifyObjectRuleV2;
88
+ const objRef = getObjectReferenceType(action, r.objectToModify);
89
+ const result = {
90
+ type: "createOrModifyObject",
91
+ objectTypeApiName: resolveApiName(objRef.objectTypeId, objectLookup),
92
+ propertyArguments: {},
93
+ structPropertyArguments: {}
94
+ };
95
+ return result;
96
+ }
97
+ case "modifyObjectRule":
98
+ {
99
+ const r = irRule.modifyObjectRule;
100
+ getObjectReferenceType(action, r.objectToModify);
101
+ const result = {
102
+ type: "modifyObject",
103
+ objectToModify: r.objectToModify,
104
+ propertyArguments: {},
105
+ structPropertyArguments: {}
106
+ };
107
+ return result;
108
+ }
109
+ case "deleteObjectRule":
110
+ {
111
+ const r = irRule.deleteObjectRule;
112
+ const result = {
113
+ type: "deleteObject",
114
+ objectToDelete: r.objectToDelete
115
+ };
116
+ return result;
117
+ }
118
+ case "addInterfaceRule":
119
+ {
120
+ const r = irRule.addInterfaceRule;
121
+ const interfaceApiName = resolveApiName(r.interfaceApiName, interfaceLookup);
122
+ return {
123
+ type: "createInterface",
124
+ interfaceTypeApiName: interfaceApiName,
125
+ objectType: interfaceApiName,
126
+ sharedPropertyArguments: {},
127
+ structPropertyArguments: {}
128
+ };
129
+ }
130
+ case "modifyInterfaceRule":
131
+ {
132
+ const r = irRule.modifyInterfaceRule;
133
+ const result = {
134
+ type: "modifyInterface",
135
+ interfaceObjectToModify: r.interfaceObjectToModifyParameter,
136
+ sharedPropertyArguments: {},
137
+ structPropertyArguments: {}
138
+ };
139
+ return result;
140
+ }
141
+ case "addLinkRule":
142
+ throw new Error("addLinkRule is not supported for ActionLogicRule");
143
+ case "deleteLinkRule":
144
+ throw new Error("deleteLinkRule is not supported for ActionLogicRule");
145
+ default:
146
+ throw new Error(`Unsupported logic rule type: ${irRule.type}`);
147
+ }
148
+ }
149
+ //# sourceMappingURL=ActionLogicRuleConverter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionLogicRuleConverter.js","names":["buildObjectTypeLookup","ir","objectTypes","undefined","byId","Map","byHyphenated","key","value","Object","entries","apiName","objectType","set","replace","buildInterfaceTypeLookup","interfaceTypes","interfaceType","resolveApiName","id","lookup","get","getObjectReferenceType","action","paramKey","param","actionType","metadata","parameters","type","Error","objectReference","convertIrLogicRuleToActionLogicRule","irRule","objectLookup","interfaceLookup","r","addObjectRule","propertyArguments","k","v","propertyValues","result","objectTypeApiName","objectTypeId","structPropertyArguments","addOrModifyObjectRuleV2","objRef","objectToModify","modifyObjectRule","deleteObjectRule","objectToDelete","addInterfaceRule","interfaceApiName","interfaceTypeApiName","sharedPropertyArguments","modifyInterfaceRule","interfaceObjectToModify","interfaceObjectToModifyParameter"],"sources":["ActionLogicRuleConverter.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n OntologyIrActionTypeBlockDataV2,\n OntologyIrLogicRule,\n OntologyIrOntologyBlockDataV2,\n} from \"@osdk/client.unstable\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\n\ninterface ApiNameLookup {\n byId: Map<string, string>;\n byHyphenated: Map<string, string>;\n}\n\nfunction buildObjectTypeLookup(\n ir: OntologyIrOntologyBlockDataV2 | undefined,\n): ApiNameLookup | undefined {\n if (!ir?.objectTypes) {\n return undefined;\n }\n const byId = new Map<string, string>();\n const byHyphenated = new Map<string, string>();\n for (const [key, value] of Object.entries(ir.objectTypes)) {\n const apiName = value.objectType.apiName;\n byId.set(key, apiName);\n byHyphenated.set(apiName.replace(/\\./g, \"-\"), apiName);\n }\n return { byId, byHyphenated };\n}\n\nfunction buildInterfaceTypeLookup(\n ir: OntologyIrOntologyBlockDataV2 | undefined,\n): ApiNameLookup | undefined {\n if (!ir?.interfaceTypes) {\n return undefined;\n }\n const byId = new Map<string, string>();\n const byHyphenated = new Map<string, string>();\n for (const [key, value] of Object.entries(ir.interfaceTypes)) {\n const apiName = value.interfaceType.apiName;\n byId.set(key, apiName);\n byHyphenated.set(apiName.replace(/\\./g, \"-\"), apiName);\n }\n return { byId, byHyphenated };\n}\n\nfunction resolveApiName(id: string, lookup: ApiNameLookup | undefined): string {\n if (!lookup) {\n return id;\n }\n return lookup.byId.get(id) ?? lookup.byHyphenated.get(id) ?? id;\n}\n\nfunction getObjectReferenceType(\n action: OntologyIrActionTypeBlockDataV2,\n paramKey: string,\n): { objectTypeId: string } {\n const param = action.actionType.metadata.parameters[paramKey];\n if (!param || param.type.type !== \"objectReference\") {\n throw new Error(\n `Parameter '${paramKey}' must be an objectReference type`,\n );\n }\n return param.type.objectReference;\n}\n\n/**\n * Convert OntologyIrLogicRule to ActionLogicRule for use in ActionTypeFullMetadata.\n */\nexport function convertIrLogicRuleToActionLogicRule(\n irRule: OntologyIrLogicRule,\n action: OntologyIrActionTypeBlockDataV2,\n ir?: OntologyIrOntologyBlockDataV2,\n): Ontologies.ActionLogicRule {\n const objectLookup = buildObjectTypeLookup(ir);\n const interfaceLookup = buildInterfaceTypeLookup(ir);\n\n switch (irRule.type) {\n case \"addObjectRule\": {\n const r = irRule.addObjectRule;\n const propertyArguments: Record<\n Ontologies.PropertyApiName,\n Ontologies.LogicRuleArgument\n > = {};\n for (const [k, v] of Object.entries(r.propertyValues)) {\n propertyArguments[k] = v as Ontologies.LogicRuleArgument;\n }\n const result: Ontologies.CreateObjectLogicRule & {\n type: \"createObject\";\n } = {\n type: \"createObject\",\n objectTypeApiName: resolveApiName(r.objectTypeId, objectLookup),\n propertyArguments,\n structPropertyArguments: {},\n };\n return result;\n }\n\n case \"addOrModifyObjectRuleV2\": {\n const r = irRule.addOrModifyObjectRuleV2;\n const objRef = getObjectReferenceType(action, r.objectToModify);\n const result: Ontologies.CreateOrModifyObjectLogicRule & {\n type: \"createOrModifyObject\";\n } = {\n type: \"createOrModifyObject\",\n objectTypeApiName: resolveApiName(objRef.objectTypeId, objectLookup),\n propertyArguments: {},\n structPropertyArguments: {},\n };\n return result;\n }\n\n case \"modifyObjectRule\": {\n const r = irRule.modifyObjectRule;\n getObjectReferenceType(action, r.objectToModify);\n const result: Ontologies.ModifyObjectLogicRule & {\n type: \"modifyObject\";\n } = {\n type: \"modifyObject\",\n objectToModify: r.objectToModify,\n propertyArguments: {},\n structPropertyArguments: {},\n };\n return result;\n }\n\n case \"deleteObjectRule\": {\n const r = irRule.deleteObjectRule;\n const result: Ontologies.DeleteObjectLogicRule & {\n type: \"deleteObject\";\n } = {\n type: \"deleteObject\",\n objectToDelete: r.objectToDelete,\n };\n return result;\n }\n\n case \"addInterfaceRule\": {\n const r = irRule.addInterfaceRule;\n const interfaceApiName = resolveApiName(\n r.interfaceApiName,\n interfaceLookup,\n );\n const result: Ontologies.CreateInterfaceLogicRule & {\n type: \"createInterface\";\n } = {\n type: \"createInterface\",\n interfaceTypeApiName: interfaceApiName,\n objectType: interfaceApiName,\n sharedPropertyArguments: {},\n structPropertyArguments: {},\n };\n return result;\n }\n\n case \"modifyInterfaceRule\": {\n const r = irRule.modifyInterfaceRule;\n const result: Ontologies.ModifyInterfaceLogicRule & {\n type: \"modifyInterface\";\n } = {\n type: \"modifyInterface\",\n interfaceObjectToModify: r.interfaceObjectToModifyParameter,\n sharedPropertyArguments: {},\n structPropertyArguments: {},\n };\n return result;\n }\n\n case \"addLinkRule\":\n throw new Error(\"addLinkRule is not supported for ActionLogicRule\");\n\n case \"deleteLinkRule\":\n throw new Error(\"deleteLinkRule is not supported for ActionLogicRule\");\n\n default:\n throw new Error(\n `Unsupported logic rule type: ${(irRule as { type: string }).type}`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,SAASA,qBAAqBA,CAC5BC,EAA6C,EAClB;EAC3B,IAAI,CAACA,EAAE,EAAEC,WAAW,EAAE;IACpB,OAAOC,SAAS;EAClB;EACA,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAiB,CAAC;EACtC,MAAMC,YAAY,GAAG,IAAID,GAAG,CAAiB,CAAC;EAC9C,KAAK,MAAM,CAACE,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACT,EAAE,CAACC,WAAW,CAAC,EAAE;IACzD,MAAMS,OAAO,GAAGH,KAAK,CAACI,UAAU,CAACD,OAAO;IACxCP,IAAI,CAACS,GAAG,CAACN,GAAG,EAAEI,OAAO,CAAC;IACtBL,YAAY,CAACO,GAAG,CAACF,OAAO,CAACG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAEH,OAAO,CAAC;EACxD;EACA,OAAO;IAAEP,IAAI;IAAEE;EAAa,CAAC;AAC/B;AAEA,SAASS,wBAAwBA,CAC/Bd,EAA6C,EAClB;EAC3B,IAAI,CAACA,EAAE,EAAEe,cAAc,EAAE;IACvB,OAAOb,SAAS;EAClB;EACA,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAiB,CAAC;EACtC,MAAMC,YAAY,GAAG,IAAID,GAAG,CAAiB,CAAC;EAC9C,KAAK,MAAM,CAACE,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACT,EAAE,CAACe,cAAc,CAAC,EAAE;IAC5D,MAAML,OAAO,GAAGH,KAAK,CAACS,aAAa,CAACN,OAAO;IAC3CP,IAAI,CAACS,GAAG,CAACN,GAAG,EAAEI,OAAO,CAAC;IAC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Ac,CACrCkB,CAAC,CAACiB,gBAAgB,EAClBlB,eACF,CAAC;QAUD,OAPI;UACFN,IAAI,EAAE,iBAAiB;UACvByB,oBAAoB,EAAED,gBAAgB;UACtCzC,UAAU,EAAEyC,gBAAgB;UAC5BE,uBAAuB,EAAE,CAAC,CAAC;UAC3BV,uBAAuB,EAAE,CAAC;QAC5B,CAAC;MAEH;IAEA,KAAK,qBAAqB;MAAE;QAC1B,MAAMT,CAAC,GAAGH,MAAM,CAACuB,mBAAmB;QACpC,MAAMd,MAEL,GAAG;UACFb,IAAI,EAAE,iBAAiB;UACvB4B,uBAAuB,EAAErB,CAAC,CAACsB,gCAAgC;UAC3DH,uBAAuB,EAAE,CAAC,CAAC;UAC3BV,uBAAuB,EAAE,CAAC;QAC5B,CAAC;QACD,OAAOH,MAAM;MACf;IAEA,KAAK,aAAa;MAChB,MAAM,IAAIZ,KAAK,CAAC,kDAAkD,CAAC;IAErE,KAAK,gBAAgB;MACnB,MAAM,IAAIA,KAAK,CAAC,qDAAqD,CAAC;IAExE;MACE,MAAM,IAAIA,KAAK,CACb,gCAAiCG,MAAM,CAAsBJ,IAAI,EACnE,CAAC;EACL;AACF","ignoreList":[]}
@@ -0,0 +1,116 @@
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 { OntologyIrToFullMetadataConverter } from "@osdk/generator-converters.ontologyir";
18
+ import { convertIrLogicRuleToActionLogicRule } from "./ActionLogicRuleConverter.js";
19
+ import { toUuid } from "./ridUtils.js";
20
+
21
+ /**
22
+ * Extended return type that uses ActionTypeFullMetadata instead of ActionTypeV2.
23
+ */
24
+
25
+ /**
26
+ * Preview converter that extends the base OntologyIrToFullMetadataConverter
27
+ * to return ActionTypeFullMetadata with fullLogicRules instead of ActionTypeV2.
28
+ */
29
+ export class PreviewOntologyIrConverter {
30
+ /**
31
+ * Main entry point - converts IR to full metadata with enhanced action types.
32
+ * Returns ActionTypeFullMetadata which includes fullLogicRules.
33
+ */
34
+ static getPreviewFullMetadataFromIr(ir) {
35
+ const baseMetadata = OntologyIrToFullMetadataConverter.getFullMetadataFromIr(ir);
36
+ const actionTypes = this.convertActionTypesWithFullLogicRules(Object.values(ir.actionTypes), ir);
37
+
38
+ // Post-process object types to use UUID-based RIDs
39
+ const objectTypes = this.convertObjectTypesWithUuidRids(baseMetadata.objectTypes);
40
+ return {
41
+ ...baseMetadata,
42
+ objectTypes,
43
+ actionTypes,
44
+ ontology: {
45
+ apiName: "ontology",
46
+ rid: "ri.ontology.main.ontology.0",
47
+ displayName: "ontology",
48
+ description: "local ontology"
49
+ }
50
+ };
51
+ }
52
+
53
+ /**
54
+ * Post-process object types to use UUID-based RIDs for properties.
55
+ */
56
+ static convertObjectTypesWithUuidRids(objectTypes) {
57
+ const result = {};
58
+ for (const [apiName, fullMetadata] of Object.entries(objectTypes)) {
59
+ const objectType = fullMetadata.objectType;
60
+ const properties = {};
61
+ for (const [propKey, prop] of Object.entries(objectType.properties)) {
62
+ properties[propKey] = {
63
+ ...prop,
64
+ rid: `ri.ontology.main.property.${toUuid(apiName + "." + propKey)}`
65
+ };
66
+ }
67
+ result[apiName] = {
68
+ ...fullMetadata,
69
+ objectType: {
70
+ ...objectType,
71
+ rid: `ri.ontology.main.object-type.${toUuid(apiName)}`,
72
+ properties
73
+ }
74
+ };
75
+ }
76
+ return result;
77
+ }
78
+
79
+ /**
80
+ * Convert IR action types to ActionTypeFullMetadata format.
81
+ * Uses base converter for parameters and operations, adds fullLogicRules.
82
+ */
83
+ static convertActionTypesWithFullLogicRules(actions, ir) {
84
+ const result = {};
85
+ for (const action of actions) {
86
+ const metadata = action.actionType.metadata;
87
+ const actionType = {
88
+ rid: `ri.ontology.main.action-type.${toUuid(metadata.apiName)}`,
89
+ apiName: metadata.apiName,
90
+ displayName: metadata.displayMetadata.displayName,
91
+ description: metadata.displayMetadata.description,
92
+ parameters: OntologyIrToFullMetadataConverter.getOsdkActionParameters(action),
93
+ operations: OntologyIrToFullMetadataConverter.getOsdkActionOperations(action),
94
+ status: this.convertActionTypeStatus(metadata.status)
95
+ };
96
+ result[actionType.apiName] = {
97
+ actionType,
98
+ fullLogicRules: action.actionType.actionTypeLogic.logic.rules.map(rule => convertIrLogicRuleToActionLogicRule(rule, action, ir))
99
+ };
100
+ }
101
+ return result;
102
+ }
103
+ static convertActionTypeStatus(status) {
104
+ switch (status.type) {
105
+ case "active":
106
+ return "ACTIVE";
107
+ case "deprecated":
108
+ return "DEPRECATED";
109
+ case "experimental":
110
+ return "EXPERIMENTAL";
111
+ case "example":
112
+ throw new Error("Example status cannot be mapped to ActionTypeStatus");
113
+ }
114
+ }
115
+ }
116
+ //# sourceMappingURL=PreviewOntologyIrConverter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewOntologyIrConverter.js","names":["OntologyIrToFullMetadataConverter","convertIrLogicRuleToActionLogicRule","toUuid","PreviewOntologyIrConverter","getPreviewFullMetadataFromIr","ir","baseMetadata","getFullMetadataFromIr","actionTypes","convertActionTypesWithFullLogicRules","Object","values","objectTypes","convertObjectTypesWithUuidRids","ontology","apiName","rid","displayName","description","result","fullMetadata","entries","objectType","properties","propKey","prop","actions","action","metadata","actionType","displayMetadata","parameters","getOsdkActionParameters","operations","getOsdkActionOperations","status","convertActionTypeStatus","fullLogicRules","actionTypeLogic","logic","rules","map","rule","type","Error"],"sources":["PreviewOntologyIrConverter.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n OntologyIrActionTypeBlockDataV2,\n OntologyIrActionTypeStatus,\n OntologyIrOntologyBlockDataV2,\n} from \"@osdk/client.unstable\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\nimport { OntologyIrToFullMetadataConverter } from \"@osdk/generator-converters.ontologyir\";\nimport { convertIrLogicRuleToActionLogicRule } from \"./ActionLogicRuleConverter.js\";\nimport { toUuid } from \"./ridUtils.js\";\n\n/**\n * Extended return type that uses ActionTypeFullMetadata instead of ActionTypeV2.\n */\nexport interface PreviewOntologyFullMetadata\n extends Omit<Ontologies.OntologyFullMetadata, \"actionTypes\">\n{\n actionTypes: Record<string, Ontologies.ActionTypeFullMetadata>;\n}\n\n/**\n * Preview converter that extends the base OntologyIrToFullMetadataConverter\n * to return ActionTypeFullMetadata with fullLogicRules instead of ActionTypeV2.\n */\nexport class PreviewOntologyIrConverter {\n /**\n * Main entry point - converts IR to full metadata with enhanced action types.\n * Returns ActionTypeFullMetadata which includes fullLogicRules.\n */\n static getPreviewFullMetadataFromIr(\n ir: OntologyIrOntologyBlockDataV2,\n ): PreviewOntologyFullMetadata {\n const baseMetadata = OntologyIrToFullMetadataConverter\n .getFullMetadataFromIr(ir);\n\n const actionTypes = this.convertActionTypesWithFullLogicRules(\n Object.values(ir.actionTypes),\n ir,\n );\n\n // Post-process object types to use UUID-based RIDs\n const objectTypes = this.convertObjectTypesWithUuidRids(\n baseMetadata.objectTypes,\n );\n\n return {\n ...baseMetadata,\n objectTypes,\n actionTypes,\n ontology: {\n apiName: \"ontology\",\n rid: \"ri.ontology.main.ontology.0\",\n displayName: \"ontology\",\n description: \"local ontology\",\n },\n };\n }\n\n /**\n * Post-process object types to use UUID-based RIDs for properties.\n */\n private static convertObjectTypesWithUuidRids(\n objectTypes: Record<string, Ontologies.ObjectTypeFullMetadata>,\n ): Record<string, Ontologies.ObjectTypeFullMetadata> {\n const result: Record<string, Ontologies.ObjectTypeFullMetadata> = {};\n\n for (const [apiName, fullMetadata] of Object.entries(objectTypes)) {\n const objectType = fullMetadata.objectType;\n const properties: Record<string, Ontologies.PropertyV2> = {};\n\n for (const [propKey, prop] of Object.entries(objectType.properties)) {\n properties[propKey] = {\n ...prop,\n rid: `ri.ontology.main.property.${toUuid(apiName + \".\" + propKey)}`,\n };\n }\n\n result[apiName] = {\n ...fullMetadata,\n objectType: {\n ...objectType,\n rid: `ri.ontology.main.object-type.${toUuid(apiName)}`,\n properties,\n },\n };\n }\n\n return result;\n }\n\n /**\n * Convert IR action types to ActionTypeFullMetadata format.\n * Uses base converter for parameters and operations, adds fullLogicRules.\n */\n private static convertActionTypesWithFullLogicRules(\n actions: OntologyIrActionTypeBlockDataV2[],\n ir: OntologyIrOntologyBlockDataV2,\n ): Record<string, Ontologies.ActionTypeFullMetadata> {\n const result: Record<string, Ontologies.ActionTypeFullMetadata> = {};\n\n for (const action of actions) {\n const metadata = action.actionType.metadata;\n const actionType: Ontologies.ActionTypeV2 = {\n rid: `ri.ontology.main.action-type.${toUuid(metadata.apiName)}`,\n apiName: metadata.apiName,\n displayName: metadata.displayMetadata.displayName,\n description: metadata.displayMetadata.description,\n parameters: OntologyIrToFullMetadataConverter.getOsdkActionParameters(\n action,\n ),\n operations: OntologyIrToFullMetadataConverter.getOsdkActionOperations(\n action,\n ),\n status: this.convertActionTypeStatus(metadata.status),\n };\n\n result[actionType.apiName] = {\n actionType,\n fullLogicRules: action.actionType.actionTypeLogic.logic.rules.map(\n rule => convertIrLogicRuleToActionLogicRule(rule, action, ir),\n ),\n };\n }\n\n return result;\n }\n\n private static convertActionTypeStatus(\n status: OntologyIrActionTypeStatus,\n ): \"ACTIVE\" | \"DEPRECATED\" | \"EXPERIMENTAL\" {\n switch (status.type) {\n case \"active\":\n return \"ACTIVE\";\n case \"deprecated\":\n return \"DEPRECATED\";\n case \"experimental\":\n return \"EXPERIMENTAL\";\n case \"example\":\n throw new Error(\n \"Example status cannot be mapped to ActionTypeStatus\",\n );\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,iCAAiC,QAAQ,uCAAuC;AACzF,SAASC,mCAAmC,QAAQ,+BAA+B;AACnF,SAASC,MAAM,QAAQ,eAAe;;AAEtC;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,CAAC;EACtC;AACF;AACA;AACA;EACE,OAAOC,4BAA4BA,CACjCC,EAAiC,EACJ;IAC7B,MAAMC,YAAY,GAAGN,iCAAiC,CACnDO,qBAAqB,CAACF,EAAE,CAAC;IAE5B,MAAMG,WAAW,GAAG,IAAI,CAACC,oCAAoC,CAC3DC,MAAM,CAACC,MAAM,CAACN,EAAE,CAACG,WAAW,CAAC,EAC7BH,EACF,CAAC;;IAED;IACA,MAAMO,WAAW,GAAG,IAAI,CAACC,8BAA8B,CACrDP,YAAY,CAACM,WACf,CAAC;IAED,OAAO;MACL,GAAGN,YAAY;MACfM,WAAW;MACXJ,WAAW;MACXM,QAAQ,EAAE;QACRC,OAAO,EAAE,UAAU;QACnBC,GAAG,EAAE,6BAA6B;QAClCC,WAAW,EAAE,UAAU;QACvBC,WAAW,EAAE;MACf;IACF,CAAC;EACH;;EAEA;AACF;AACA;EACE,OAAeL,8BAA8BA,CAC3CD,WAA8D,EACX;IACnD,MAAMO,MAAyD,GAAG,CAAC,CAAC;IAEpE,KAAK,MAAM,CAACJ,OAAO,EAAEK,YAAY,CAAC,IAAIV,MAAM,CAACW,OAAO,CAACT,WAAW,CAAC,EAAE;MACjE,MAAMU,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