@osdk/generator-converters.preview 0.1.0-beta.7 → 0.1.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.
@@ -4,88 +4,48 @@ var generatorConverters_ontologyir = require('@osdk/generator-converters.ontolog
4
4
  var crypto = require('crypto');
5
5
 
6
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) {
7
+ function getObjectReferenceTypeFromBlockData(action, paramKey) {
48
8
  const param = action.actionType.metadata.parameters[paramKey];
49
9
  if (!param || param.type.type !== "objectReference") {
50
10
  throw new Error(`Parameter '${paramKey}' must be an objectReference type`);
51
11
  }
52
12
  return param.type.objectReference;
53
13
  }
54
- function convertIrLogicRulesToActionLogicRules(rules, action, ir) {
55
- const objectLookup = buildObjectTypeLookup(ir);
56
- const interfaceLookup = buildInterfaceTypeLookup(ir);
57
- return rules.map((irRule) => convertSingleRule(irRule, action, objectLookup, interfaceLookup));
14
+ function convertBlockDataLogicRulesToActionLogicRules(rules, action, blockdata) {
15
+ const objectLookup = generatorConverters_ontologyir.buildBlockDataObjectTypeLookup(blockdata);
16
+ const interfaceLookup = generatorConverters_ontologyir.buildBlockDataInterfaceTypeLookup(blockdata);
17
+ return rules.map((rule) => convertBlockDataSingleRule(rule, action, objectLookup, interfaceLookup));
58
18
  }
59
- function convertSingleRule(irRule, action, objectLookup, interfaceLookup) {
60
- switch (irRule.type) {
19
+ function convertBlockDataSingleRule(rule, action, objectLookup, interfaceLookup) {
20
+ switch (rule.type) {
61
21
  case "addObjectRule": {
62
- const r = irRule.addObjectRule;
22
+ const r = rule.addObjectRule;
63
23
  const propertyArguments = {};
64
24
  for (const [k, v] of Object.entries(r.propertyValues)) {
65
25
  propertyArguments[k] = v;
66
26
  }
67
27
  const result = {
68
28
  type: "createObject",
69
- objectTypeApiName: resolveApiName(r.objectTypeId, objectLookup),
29
+ objectTypeApiName: generatorConverters_ontologyir.resolveBlockDataApiName(r.objectTypeId, objectLookup),
70
30
  propertyArguments,
71
31
  structPropertyArguments: {}
72
32
  };
73
33
  return result;
74
34
  }
75
35
  case "addOrModifyObjectRuleV2": {
76
- const r = irRule.addOrModifyObjectRuleV2;
77
- const objRef = getObjectReferenceType(action, r.objectToModify);
36
+ const r = rule.addOrModifyObjectRuleV2;
37
+ const objRef = getObjectReferenceTypeFromBlockData(action, r.objectToModify);
78
38
  const result = {
79
39
  type: "createOrModifyObject",
80
- objectTypeApiName: resolveApiName(objRef.objectTypeId, objectLookup),
40
+ objectTypeApiName: generatorConverters_ontologyir.resolveBlockDataApiName(objRef.objectTypeId, objectLookup),
81
41
  propertyArguments: {},
82
42
  structPropertyArguments: {}
83
43
  };
84
44
  return result;
85
45
  }
86
46
  case "modifyObjectRule": {
87
- const r = irRule.modifyObjectRule;
88
- getObjectReferenceType(action, r.objectToModify);
47
+ const r = rule.modifyObjectRule;
48
+ getObjectReferenceTypeFromBlockData(action, r.objectToModify);
89
49
  const modifyPropertyArguments = {};
90
50
  for (const [k, v] of Object.entries(r.propertyValues)) {
91
51
  modifyPropertyArguments[k] = v;
@@ -99,7 +59,7 @@ function convertSingleRule(irRule, action, objectLookup, interfaceLookup) {
99
59
  return result;
100
60
  }
101
61
  case "deleteObjectRule": {
102
- const r = irRule.deleteObjectRule;
62
+ const r = rule.deleteObjectRule;
103
63
  const result = {
104
64
  type: "deleteObject",
105
65
  objectToDelete: r.objectToDelete
@@ -107,8 +67,8 @@ function convertSingleRule(irRule, action, objectLookup, interfaceLookup) {
107
67
  return result;
108
68
  }
109
69
  case "addInterfaceRule": {
110
- const r = irRule.addInterfaceRule;
111
- const interfaceApiName = resolveApiName(r.interfaceApiName, interfaceLookup);
70
+ const r = rule.addInterfaceRule;
71
+ const interfaceApiName = generatorConverters_ontologyir.resolveBlockDataApiName(r.interfaceTypeRid, interfaceLookup);
112
72
  const result = {
113
73
  type: "createInterface",
114
74
  interfaceTypeApiName: interfaceApiName,
@@ -119,10 +79,10 @@ function convertSingleRule(irRule, action, objectLookup, interfaceLookup) {
119
79
  return result;
120
80
  }
121
81
  case "modifyInterfaceRule": {
122
- const r = irRule.modifyInterfaceRule;
82
+ const r = rule.modifyInterfaceRule;
123
83
  const result = {
124
84
  type: "modifyInterface",
125
- interfaceObjectToModify: r.interfaceObjectToModifyParameter,
85
+ interfaceObjectToModify: r.interfaceObjectToModify,
126
86
  sharedPropertyArguments: {},
127
87
  structPropertyArguments: {}
128
88
  };
@@ -133,7 +93,7 @@ function convertSingleRule(irRule, action, objectLookup, interfaceLookup) {
133
93
  case "deleteLinkRule":
134
94
  throw new Error("deleteLinkRule is not supported for ActionLogicRule");
135
95
  default:
136
- throw new Error(`Unsupported logic rule type: ${irRule.type}`);
96
+ throw new Error(`Unsupported logic rule type: ${rule.type}`);
137
97
  }
138
98
  }
139
99
  function toUuid(str) {
@@ -150,9 +110,9 @@ var PreviewOntologyIrConverter = class {
150
110
  * Main entry point - converts IR to full metadata with enhanced action types.
151
111
  * Returns ActionTypeFullMetadata which includes fullLogicRules.
152
112
  */
153
- static getPreviewFullMetadataFromIr(ir) {
154
- const baseMetadata = generatorConverters_ontologyir.OntologyIrToFullMetadataConverter.getFullMetadataFromIr(ir);
155
- const actionTypes = this.convertActionTypesWithFullLogicRules(Object.values(ir.actionTypes), ir);
113
+ static getPreviewFullMetadataFromBlockData(blockdata) {
114
+ const baseMetadata = generatorConverters_ontologyir.OntologyBlockDataToFullMetadataConverter.getFullMetadataFromBlockData(blockdata);
115
+ const actionTypes = this.convertActionTypesWithFullLogicRulesFromBlockData(blockdata.actionTypes, blockdata);
156
116
  const objectTypes = this.convertObjectTypesWithUuidRids(baseMetadata.objectTypes);
157
117
  return {
158
118
  ...baseMetadata,
@@ -201,18 +161,19 @@ var PreviewOntologyIrConverter = class {
201
161
  * Reuses base converter for action type conversion, then process
202
162
  * RIDs to use UUID-based format and adds fullLogicRules.
203
163
  */
204
- static convertActionTypesWithFullLogicRules(actions, ir) {
205
- const baseActionTypes = generatorConverters_ontologyir.OntologyIrToFullMetadataConverter.getOsdkActionTypes(actions);
206
- const actionsByApiName = new Map(actions.map((a) => [a.actionType.metadata.apiName, a]));
164
+ static convertActionTypesWithFullLogicRulesFromBlockData(actions, blockdata) {
165
+ const objectTypeLookup = generatorConverters_ontologyir.buildBlockDataObjectTypeLookup(blockdata);
166
+ const interfaceTypeLookup = generatorConverters_ontologyir.buildBlockDataInterfaceTypeLookup(blockdata);
167
+ const baseActionTypes = generatorConverters_ontologyir.OntologyBlockDataToFullMetadataConverter.getOsdkActionTypesFromBlockData(blockdata, objectTypeLookup, interfaceTypeLookup);
168
+ const actionsByApiName = new Map(Object.values(actions).map((a) => [a.actionType.metadata.apiName, a]));
207
169
  const result = {};
208
170
  for (const [apiName, baseActionType] of Object.entries(baseActionTypes)) {
209
171
  const action = actionsByApiName.get(apiName);
210
172
  result[apiName] = {
211
173
  actionType: {
212
- ...baseActionType,
213
- rid: `ri.ontology.main.action-type.${toUuid(apiName)}`
174
+ ...baseActionType
214
175
  },
215
- fullLogicRules: convertIrLogicRulesToActionLogicRules(action.actionType.actionTypeLogic.logic.rules, action, ir)
176
+ fullLogicRules: convertBlockDataLogicRulesToActionLogicRules(action.actionType.actionTypeLogic.logic.rules, action, blockdata)
216
177
  };
217
178
  }
218
179
  return result;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ActionLogicRuleConverter.ts","../../src/ridUtils.ts","../../src/PreviewOntologyIrConverter.ts"],"names":["createHash","OntologyIrToFullMetadataConverter"],"mappings":";;;;;;;;AAgBA,SAAS,sBAAsB,EAAI,EAAA;AACjC,EAAI,IAAA,CAAC,IAAI,WAAa,EAAA;AACpB,IAAO,OAAA,MAAA;AAAA;AAET,EAAM,MAAA,IAAA,uBAAW,GAAI,EAAA;AACrB,EAAM,MAAA,YAAA,uBAAmB,GAAI,EAAA;AAC7B,EAAW,KAAA,MAAA,CAAC,KAAK,KAAK,CAAA,IAAK,OAAO,OAAQ,CAAA,EAAA,CAAG,WAAW,CAAG,EAAA;AACzD,IAAM,MAAA,OAAA,GAAU,MAAM,UAAW,CAAA,OAAA;AACjC,IAAK,IAAA,CAAA,GAAA,CAAI,KAAK,OAAO,CAAA;AACrB,IAAA,YAAA,CAAa,IAAI,OAAQ,CAAA,OAAA,CAAQ,KAAO,EAAA,GAAG,GAAG,OAAO,CAAA;AAAA;AAEvD,EAAO,OAAA;AAAA,IACL,IAAA;AAAA,IACA;AAAA,GACF;AACF;AACA,SAAS,yBAAyB,EAAI,EAAA;AACpC,EAAI,IAAA,CAAC,IAAI,cAAgB,EAAA;AACvB,IAAO,OAAA,MAAA;AAAA;AAET,EAAM,MAAA,IAAA,uBAAW,GAAI,EAAA;AACrB,EAAM,MAAA,YAAA,uBAAmB,GAAI,EAAA;AAC7B,EAAW,KAAA,MAAA,CAAC,KAAK,KAAK,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AAA;AAAA,EAOA,OAAO,oCAAqC,CAAA,OAAA,EAAS,EAAI,EAAA;AACvD,IAAM,MAAA,eAAA,GAAkBA,gEAAkC,CAAA,kBAAA,CAAmB,OAAO,CAAA;AAGpF,IAAA,MAAM,gBAAmB,GAAA,IAAI,GAAI,CAAA,OAAA,CAAQ,GAAI,CAAA,CAAA,CAAA,KAAK,CAAC,CAAA,CAAE,UAAW,CAAA,QAAA,CAAS,OAAS,EAAA,CAAC,CAAC,CAAC,CAAA;AACrF,IAAA,MAAM,SAAS,EAAC;AAChB,IAAA,KAAA,MAAW,CAAC,OAAS,EAAA,cAAc,KAAK,MAAO,CAAA,OAAA,CAAQ,eAAe,CAAG,EAAA;AACvE,MAAM,MAAA,MAAA,GAAS,gBAAiB,CAAA,GAAA,CAAI,OAAO,CAAA;AAC3C,MAAA,MAAA,CAAO,OAAO,CAAI,GAAA;AAAA,QAChB,UAAY,EAAA;AAAA,UACV,GAAG,cAAA;AAAA,UACH,GAAK,EAAA,CAAA,6BAAA,EAAgC,MAAO,CAAA,OAAO,CAAC,CAAA;AAAA,SACtD;AAAA,QACA,cAAA,EAAgB,sCAAsC,MAAO,CAAA,UAAA,CAAW,gBAAgB,KAAM,CAAA,KAAA,EAAO,QAAQ,EAAE;AAAA,OACjH;AAAA;AAEF,IAAO,OAAA,MAAA;AAAA;AAEX","file":"index.cjs","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\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 * Build lookups once and convert all logic rules for an action.\n * Avoids rebuilding lookup Maps on every rule.\n */\nexport function convertIrLogicRulesToActionLogicRules(rules, action, ir) {\n const objectLookup = buildObjectTypeLookup(ir);\n const interfaceLookup = buildInterfaceTypeLookup(ir);\n return rules.map(irRule => convertSingleRule(irRule, action, objectLookup, interfaceLookup));\n}\n\n/**\n * Convert a single OntologyIrLogicRule to ActionLogicRule.\n * Kept as a public API for callers that only need a single rule conversion.\n */\nexport function convertIrLogicRuleToActionLogicRule(irRule, action, ir) {\n const objectLookup = buildObjectTypeLookup(ir);\n const interfaceLookup = buildInterfaceTypeLookup(ir);\n return convertSingleRule(irRule, action, objectLookup, interfaceLookup);\n}\nfunction convertSingleRule(irRule, action, objectLookup, interfaceLookup) {\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 // propertyArguments left empty: the downstream generator resolves\n // property mappings from the action parameter configuration rather\n // than from the logic rule itself for createOrModify rules.\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 // Validate that the parameter is an objectReference (throws if not)\n getObjectReferenceType(action, r.objectToModify);\n const modifyPropertyArguments = {};\n for (const [k, v] of Object.entries(r.propertyValues)) {\n modifyPropertyArguments[k] = v;\n }\n const result = {\n type: \"modifyObject\",\n objectToModify: r.objectToModify,\n propertyArguments: modifyPropertyArguments,\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 v5-like identifier from a string.\n * Uses SHA-256 hash truncated to UUID format with version (5) and\n * variant (RFC 4122) bits set for spec compliance.\n */\nexport function toUuid(str) {\n const hashBytes = createHash(\"sha256\").update(str).digest();\n // Set version to 5 (name-based SHA) in byte 6: clear top nibble, set to 0101\n hashBytes[6] = hashBytes[6] & 0x0f | 0x50;\n // Set variant to RFC 4122 in byte 8: clear top 2 bits, set to 10\n hashBytes[8] = hashBytes[8] & 0x3f | 0x80;\n const hex = hashBytes.subarray(0, 16).toString(\"hex\");\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.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 { convertIrLogicRulesToActionLogicRules } 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 and link types.\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 const linkTypes = fullMetadata.linkTypes.map(lt => ({\n ...lt,\n linkTypeRid: `ri.ontology.main.link-type.${toUuid(lt.linkTypeRid || lt.apiName)}`\n }));\n result[apiName] = {\n ...fullMetadata,\n linkTypes,\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 * Reuses base converter for action type conversion, then process\n * RIDs to use UUID-based format and adds fullLogicRules.\n */\n static convertActionTypesWithFullLogicRules(actions, ir) {\n const baseActionTypes = OntologyIrToFullMetadataConverter.getOsdkActionTypes(actions);\n\n // Build a lookup from apiName to the original IR action for logic rules\n const actionsByApiName = new Map(actions.map(a => [a.actionType.metadata.apiName, a]));\n const result = {};\n for (const [apiName, baseActionType] of Object.entries(baseActionTypes)) {\n const action = actionsByApiName.get(apiName);\n result[apiName] = {\n actionType: {\n ...baseActionType,\n rid: `ri.ontology.main.action-type.${toUuid(apiName)}`\n },\n fullLogicRules: convertIrLogicRulesToActionLogicRules(action.actionType.actionTypeLogic.logic.rules, action, ir)\n };\n }\n return result;\n }\n}"]}
1
+ {"version":3,"sources":["../../src/ActionLogicRuleConverter.ts","../../src/ridUtils.ts","../../src/PreviewOntologyIrConverter.ts"],"names":["buildBlockDataObjectTypeLookup","buildBlockDataInterfaceTypeLookup","resolveBlockDataApiName","createHash","OntologyBlockDataToFullMetadataConverter"],"mappings":";;;;;;AA8DA,SAAS,mCAAA,CAAoC,QAAQ,QAAU,EAAA;AAC7D,EAAA,MAAM,KAAQ,GAAA,MAAA,CAAO,UAAW,CAAA,QAAA,CAAS,WAAW,QAAQ,CAAA;AAC5D,EAAA,IAAI,CAAC,KAAA,IAAS,KAAM,CAAA,IAAA,CAAK,SAAS,iBAAmB,EAAA;AACnD,IAAA,MAAM,IAAI,KAAA,CAAM,CAAc,WAAA,EAAA,QAAQ,CAAmC,iCAAA,CAAA,CAAA;AAAA;AAE3E,EAAA,OAAO,MAAM,IAAK,CAAA,eAAA;AACpB;AAWO,SAAS,4CAAA,CAA6C,KAAO,EAAA,MAAA,EAAQ,SAAW,EAAA;AACrF,EAAM,MAAA,YAAA,GAAeA,8DAA+B,SAAS,CAAA;AAC7D,EAAM,MAAA,eAAA,GAAkBC,iEAAkC,SAAS,CAAA;AACnE,EAAO,OAAA,KAAA,CAAM,IAAI,CAAQ,IAAA,KAAA,0BAAA,CAA2B,MAAM,MAAQ,EAAA,YAAA,EAAc,eAAe,CAAC,CAAA;AAClG;AAqGA,SAAS,0BAA2B,CAAA,IAAA,EAAM,MAAQ,EAAA,YAAA,EAAc,eAAiB,EAAA;AA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gBAAA,GAAmBJ,8DAA+B,SAAS,CAAA;AACjE,IAAM,MAAA,mBAAA,GAAsBC,iEAAkC,SAAS,CAAA;AACvE,IAAA,MAAM,eAAkB,GAAAG,uEAAA,CAAyC,+BAAgC,CAAA,SAAA,EAAW,kBAAkB,mBAAmB,CAAA;AAGjJ,IAAA,MAAM,mBAAmB,IAAI,GAAA,CAAI,MAAO,CAAA,MAAA,CAAO,OAAO,CAAE,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAC,EAAE,UAAW,CAAA,QAAA,CAAS,OAAS,EAAA,CAAC,CAAC,CAAC,CAAA;AACpG,IAAA,MAAM,SAAS,EAAC;AAChB,IAAA,KAAA,MAAW,CAAC,OAAS,EAAA,cAAc,KAAK,MAAO,CAAA,OAAA,CAAQ,eAAe,CAAG,EAAA;AACvE,MAAM,MAAA,MAAA,GAAS,gBAAiB,CAAA,GAAA,CAAI,OAAO,CAAA;AAC3C,MAAA,MAAA,CAAO,OAAO,CAAI,GAAA;AAAA,QAChB,UAAY,EAAA;AAAA,UACV,GAAG;AAAA,SACL;AAAA,QACA,cAAA,EAAgB,6CAA6C,MAAO,CAAA,UAAA,CAAW,gBAAgB,KAAM,CAAA,KAAA,EAAO,QAAQ,SAAS;AAAA,OAC/H;AAAA;AAEF,IAAO,OAAA,MAAA;AAAA;AAEX","file":"index.cjs","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 { buildBlockDataInterfaceTypeLookup, buildBlockDataObjectTypeLookup, resolveBlockDataApiName } from \"@osdk/generator-converters.ontologyir\";\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}\nfunction getObjectReferenceTypeFromBlockData(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 * Build lookups once and convert all logic rules for an action.\n * Avoids rebuilding lookup Maps on every rule.\n */\nexport function convertIrLogicRulesToActionLogicRules(rules, action, ir) {\n const objectLookup = buildObjectTypeLookup(ir);\n const interfaceLookup = buildInterfaceTypeLookup(ir);\n return rules.map(irRule => convertSingleRule(irRule, action, objectLookup, interfaceLookup));\n}\nexport function convertBlockDataLogicRulesToActionLogicRules(rules, action, blockdata) {\n const objectLookup = buildBlockDataObjectTypeLookup(blockdata);\n const interfaceLookup = buildBlockDataInterfaceTypeLookup(blockdata);\n return rules.map(rule => convertBlockDataSingleRule(rule, action, objectLookup, interfaceLookup));\n}\n\n/**\n * Convert a single OntologyIrLogicRule to ActionLogicRule.\n * Kept as a public API for callers that only need a single rule conversion.\n */\nexport function convertIrLogicRuleToActionLogicRule(irRule, action, ir) {\n const objectLookup = buildObjectTypeLookup(ir);\n const interfaceLookup = buildInterfaceTypeLookup(ir);\n return convertSingleRule(irRule, action, objectLookup, interfaceLookup);\n}\nfunction convertSingleRule(irRule, action, objectLookup, interfaceLookup) {\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 // propertyArguments left empty: the downstream generator resolves\n // property mappings from the action parameter configuration rather\n // than from the logic rule itself for createOrModify rules.\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 // Validate that the parameter is an objectReference (throws if not)\n getObjectReferenceType(action, r.objectToModify);\n const modifyPropertyArguments = {};\n for (const [k, v] of Object.entries(r.propertyValues)) {\n modifyPropertyArguments[k] = v;\n }\n const result = {\n type: \"modifyObject\",\n objectToModify: r.objectToModify,\n propertyArguments: modifyPropertyArguments,\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}\nfunction convertBlockDataSingleRule(rule, action, objectLookup, interfaceLookup) {\n switch (rule.type) {\n case \"addObjectRule\":\n {\n const r = rule.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: resolveBlockDataApiName(r.objectTypeId, objectLookup),\n propertyArguments,\n structPropertyArguments: {}\n };\n return result;\n }\n case \"addOrModifyObjectRuleV2\":\n {\n const r = rule.addOrModifyObjectRuleV2;\n const objRef = getObjectReferenceTypeFromBlockData(action, r.objectToModify);\n // propertyArguments left empty: the downstream generator resolves\n // property mappings from the action parameter configuration rather\n // than from the logic rule itself for createOrModify rules.\n const result = {\n type: \"createOrModifyObject\",\n objectTypeApiName: resolveBlockDataApiName(objRef.objectTypeId, objectLookup),\n propertyArguments: {},\n structPropertyArguments: {}\n };\n return result;\n }\n case \"modifyObjectRule\":\n {\n const r = rule.modifyObjectRule;\n // Validate that the parameter is an objectReference (throws if not)\n getObjectReferenceTypeFromBlockData(action, r.objectToModify);\n const modifyPropertyArguments = {};\n for (const [k, v] of Object.entries(r.propertyValues)) {\n modifyPropertyArguments[k] = v;\n }\n const result = {\n type: \"modifyObject\",\n objectToModify: r.objectToModify,\n propertyArguments: modifyPropertyArguments,\n structPropertyArguments: {}\n };\n return result;\n }\n case \"deleteObjectRule\":\n {\n const r = rule.deleteObjectRule;\n const result = {\n type: \"deleteObject\",\n objectToDelete: r.objectToDelete\n };\n return result;\n }\n case \"addInterfaceRule\":\n {\n const r = rule.addInterfaceRule;\n const interfaceApiName = resolveBlockDataApiName(r.interfaceTypeRid, 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 = rule.modifyInterfaceRule;\n const result = {\n type: \"modifyInterface\",\n interfaceObjectToModify: r.interfaceObjectToModify,\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: ${rule.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 v5-like identifier from a string.\n * Uses SHA-256 hash truncated to UUID format with version (5) and\n * variant (RFC 4122) bits set for spec compliance.\n */\nexport function toUuid(str) {\n const hashBytes = createHash(\"sha256\").update(str).digest();\n // Set version to 5 (name-based SHA) in byte 6: clear top nibble, set to 0101\n hashBytes[6] = hashBytes[6] & 0x0f | 0x50;\n // Set variant to RFC 4122 in byte 8: clear top 2 bits, set to 10\n hashBytes[8] = hashBytes[8] & 0x3f | 0x80;\n const hex = hashBytes.subarray(0, 16).toString(\"hex\");\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.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 { buildBlockDataInterfaceTypeLookup, buildBlockDataObjectTypeLookup, OntologyBlockDataToFullMetadataConverter } from \"@osdk/generator-converters.ontologyir\";\nimport { convertBlockDataLogicRulesToActionLogicRules } 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 getPreviewFullMetadataFromBlockData(blockdata) {\n const baseMetadata = OntologyBlockDataToFullMetadataConverter.getFullMetadataFromBlockData(blockdata);\n const actionTypes = this.convertActionTypesWithFullLogicRulesFromBlockData(blockdata.actionTypes, blockdata);\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 and link types.\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 const linkTypes = fullMetadata.linkTypes.map(lt => ({\n ...lt,\n linkTypeRid: `ri.ontology.main.link-type.${toUuid(lt.linkTypeRid || lt.apiName)}`\n }));\n result[apiName] = {\n ...fullMetadata,\n linkTypes,\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 * Reuses base converter for action type conversion, then process\n * RIDs to use UUID-based format and adds fullLogicRules.\n */\n static convertActionTypesWithFullLogicRulesFromBlockData(actions, blockdata) {\n const objectTypeLookup = buildBlockDataObjectTypeLookup(blockdata);\n const interfaceTypeLookup = buildBlockDataInterfaceTypeLookup(blockdata);\n const baseActionTypes = OntologyBlockDataToFullMetadataConverter.getOsdkActionTypesFromBlockData(blockdata, objectTypeLookup, interfaceTypeLookup);\n\n // Build a lookup from apiName to the original IR action for logic rules\n const actionsByApiName = new Map(Object.values(actions).map(a => [a.actionType.metadata.apiName, a]));\n const result = {};\n for (const [apiName, baseActionType] of Object.entries(baseActionTypes)) {\n const action = actionsByApiName.get(apiName);\n result[apiName] = {\n actionType: {\n ...baseActionType\n },\n fullLogicRules: convertBlockDataLogicRulesToActionLogicRules(action.actionType.actionTypeLogic.logic.rules, action, blockdata)\n };\n }\n return result;\n }\n}"]}
@@ -1,4 +1,4 @@
1
- import { OntologyIrOntologyBlockDataV2 } from '@osdk/client.unstable';
1
+ import { OntologyBlockDataV2 } from '@osdk/client.unstable';
2
2
  import * as Ontologies from '@osdk/foundry.ontologies';
3
3
 
4
4
  /**
@@ -16,7 +16,7 @@ declare class PreviewOntologyIrConverter {
16
16
  * Main entry point - converts IR to full metadata with enhanced action types.
17
17
  * Returns ActionTypeFullMetadata which includes fullLogicRules.
18
18
  */
19
- static getPreviewFullMetadataFromIr(ir: OntologyIrOntologyBlockDataV2): PreviewOntologyFullMetadata;
19
+ static getPreviewFullMetadataFromBlockData(blockdata: OntologyBlockDataV2): PreviewOntologyFullMetadata;
20
20
  /**
21
21
  * Post-process object types to use UUID-based RIDs for properties and link types.
22
22
  */
@@ -26,7 +26,7 @@ declare class PreviewOntologyIrConverter {
26
26
  * Reuses base converter for action type conversion, then process
27
27
  * RIDs to use UUID-based format and adds fullLogicRules.
28
28
  */
29
- private static convertActionTypesWithFullLogicRules;
29
+ private static convertActionTypesWithFullLogicRulesFromBlockData;
30
30
  }
31
31
 
32
32
  export { type PreviewOntologyFullMetadata, PreviewOntologyIrConverter };
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import { buildBlockDataInterfaceTypeLookup, buildBlockDataObjectTypeLookup, resolveBlockDataApiName } from "@osdk/generator-converters.ontologyir";
17
18
  function buildObjectTypeLookup(ir) {
18
19
  if (!ir?.objectTypes) {
19
20
  return undefined;
@@ -59,6 +60,13 @@ function getObjectReferenceType(action, paramKey) {
59
60
  }
60
61
  return param.type.objectReference;
61
62
  }
63
+ function getObjectReferenceTypeFromBlockData(action, paramKey) {
64
+ const param = action.actionType.metadata.parameters[paramKey];
65
+ if (!param || param.type.type !== "objectReference") {
66
+ throw new Error(`Parameter '${paramKey}' must be an objectReference type`);
67
+ }
68
+ return param.type.objectReference;
69
+ }
62
70
 
63
71
  /**
64
72
  * Build lookups once and convert all logic rules for an action.
@@ -69,6 +77,11 @@ export function convertIrLogicRulesToActionLogicRules(rules, action, ir) {
69
77
  const interfaceLookup = buildInterfaceTypeLookup(ir);
70
78
  return rules.map(irRule => convertSingleRule(irRule, action, objectLookup, interfaceLookup));
71
79
  }
80
+ export function convertBlockDataLogicRulesToActionLogicRules(rules, action, blockdata) {
81
+ const objectLookup = buildBlockDataObjectTypeLookup(blockdata);
82
+ const interfaceLookup = buildBlockDataInterfaceTypeLookup(blockdata);
83
+ return rules.map(rule => convertBlockDataSingleRule(rule, action, objectLookup, interfaceLookup));
84
+ }
72
85
 
73
86
  /**
74
87
  * Convert a single OntologyIrLogicRule to ActionLogicRule.
@@ -168,4 +181,93 @@ function convertSingleRule(irRule, action, objectLookup, interfaceLookup) {
168
181
  throw new Error(`Unsupported logic rule type: ${irRule.type}`);
169
182
  }
170
183
  }
184
+ function convertBlockDataSingleRule(rule, action, objectLookup, interfaceLookup) {
185
+ switch (rule.type) {
186
+ case "addObjectRule":
187
+ {
188
+ const r = rule.addObjectRule;
189
+ const propertyArguments = {};
190
+ for (const [k, v] of Object.entries(r.propertyValues)) {
191
+ propertyArguments[k] = v;
192
+ }
193
+ const result = {
194
+ type: "createObject",
195
+ objectTypeApiName: resolveBlockDataApiName(r.objectTypeId, objectLookup),
196
+ propertyArguments,
197
+ structPropertyArguments: {}
198
+ };
199
+ return result;
200
+ }
201
+ case "addOrModifyObjectRuleV2":
202
+ {
203
+ const r = rule.addOrModifyObjectRuleV2;
204
+ const objRef = getObjectReferenceTypeFromBlockData(action, r.objectToModify);
205
+ // propertyArguments left empty: the downstream generator resolves
206
+ // property mappings from the action parameter configuration rather
207
+ // than from the logic rule itself for createOrModify rules.
208
+ const result = {
209
+ type: "createOrModifyObject",
210
+ objectTypeApiName: resolveBlockDataApiName(objRef.objectTypeId, objectLookup),
211
+ propertyArguments: {},
212
+ structPropertyArguments: {}
213
+ };
214
+ return result;
215
+ }
216
+ case "modifyObjectRule":
217
+ {
218
+ const r = rule.modifyObjectRule;
219
+ // Validate that the parameter is an objectReference (throws if not)
220
+ getObjectReferenceTypeFromBlockData(action, r.objectToModify);
221
+ const modifyPropertyArguments = {};
222
+ for (const [k, v] of Object.entries(r.propertyValues)) {
223
+ modifyPropertyArguments[k] = v;
224
+ }
225
+ const result = {
226
+ type: "modifyObject",
227
+ objectToModify: r.objectToModify,
228
+ propertyArguments: modifyPropertyArguments,
229
+ structPropertyArguments: {}
230
+ };
231
+ return result;
232
+ }
233
+ case "deleteObjectRule":
234
+ {
235
+ const r = rule.deleteObjectRule;
236
+ const result = {
237
+ type: "deleteObject",
238
+ objectToDelete: r.objectToDelete
239
+ };
240
+ return result;
241
+ }
242
+ case "addInterfaceRule":
243
+ {
244
+ const r = rule.addInterfaceRule;
245
+ const interfaceApiName = resolveBlockDataApiName(r.interfaceTypeRid, interfaceLookup);
246
+ return {
247
+ type: "createInterface",
248
+ interfaceTypeApiName: interfaceApiName,
249
+ objectType: interfaceApiName,
250
+ sharedPropertyArguments: {},
251
+ structPropertyArguments: {}
252
+ };
253
+ }
254
+ case "modifyInterfaceRule":
255
+ {
256
+ const r = rule.modifyInterfaceRule;
257
+ const result = {
258
+ type: "modifyInterface",
259
+ interfaceObjectToModify: r.interfaceObjectToModify,
260
+ sharedPropertyArguments: {},
261
+ structPropertyArguments: {}
262
+ };
263
+ return result;
264
+ }
265
+ case "addLinkRule":
266
+ throw new Error("addLinkRule is not supported for ActionLogicRule");
267
+ case "deleteLinkRule":
268
+ throw new Error("deleteLinkRule is not supported for ActionLogicRule");
269
+ default:
270
+ throw new Error(`Unsupported logic rule type: ${rule.type}`);
271
+ }
272
+ }
171
273
  //# sourceMappingURL=ActionLogicRuleConverter.js.map
@@ -1 +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","convertIrLogicRulesToActionLogicRules","rules","objectLookup","interfaceLookup","map","irRule","convertSingleRule","convertIrLogicRuleToActionLogicRule","r","addObjectRule","propertyArguments","k","v","propertyValues","result","objectTypeApiName","objectTypeId","structPropertyArguments","addOrModifyObjectRuleV2","objRef","objectToModify","modifyObjectRule","modifyPropertyArguments","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 * Build lookups once and convert all logic rules for an action.\n * Avoids rebuilding lookup Maps on every rule.\n */\nexport function convertIrLogicRulesToActionLogicRules(\n rules: OntologyIrLogicRule[],\n action: OntologyIrActionTypeBlockDataV2,\n ir?: OntologyIrOntologyBlockDataV2,\n): Ontologies.ActionLogicRule[] {\n const objectLookup = buildObjectTypeLookup(ir);\n const interfaceLookup = buildInterfaceTypeLookup(ir);\n\n return rules.map(irRule =>\n convertSingleRule(irRule, action, objectLookup, interfaceLookup)\n );\n}\n\n/**\n * Convert a single OntologyIrLogicRule to ActionLogicRule.\n * Kept as a public API for callers that only need a single rule conversion.\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 return convertSingleRule(irRule, action, objectLookup, interfaceLookup);\n}\n\nfunction convertSingleRule(\n irRule: OntologyIrLogicRule,\n action: OntologyIrActionTypeBlockDataV2,\n objectLookup: ApiNameLookup | undefined,\n interfaceLookup: ApiNameLookup | undefined,\n): Ontologies.ActionLogicRule {\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 // propertyArguments left empty: the downstream generator resolves\n // property mappings from the action parameter configuration rather\n // than from the logic rule itself for createOrModify rules.\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 // Validate that the parameter is an objectReference (throws if not)\n getObjectReferenceType(action, r.objectToModify);\n const modifyPropertyArguments: Record<\n Ontologies.PropertyApiName,\n Ontologies.LogicRuleArgument\n > = {};\n for (const [k, v] of Object.entries(r.propertyValues)) {\n modifyPropertyArguments[k] = v as Ontologies.LogicRuleArgument;\n }\n const result: Ontologies.ModifyObjectLogicRule & {\n type: \"modifyObject\";\n } = {\n type: \"modifyObject\",\n objectToModify: r.objectToModify,\n propertyArguments: modifyPropertyArguments,\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/B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FN,IAAI,EAAE,iBAAiB;UACvB8B,oBAAoB,EAAED,gBAAgB;UACtC9C,UAAU,EAAE8C,gBAAgB;UAC5BE,uBAAuB,EAAE,CAAC,CAAC;UAC3BX,uBAAuB,EAAE,CAAC;QAC5B,CAAC;MAEH;IAEA,KAAK,qBAAqB;MAAE;QAC1B,MAAMT,CAAC,GAAGH,MAAM,CAACwB,mBAAmB;QACpC,MAAMf,MAEL,GAAG;UACFjB,IAAI,EAAE,iBAAiB;UACvBiC,uBAAuB,EAAEtB,CAAC,CAACuB,gCAAgC;UAC3DH,uBAAuB,EAAE,CAAC,CAAC;UAC3BX,uBAAuB,EAAE,CAAC;QAC5B,CAAC;QACD,OAAOH,MAAM;MACf;IAEA,KAAK,aAAa;MAChB,MAAM,IAAIhB,KAAK,CAAC,kDAAkD,CAAC;IAErE,KAAK,gBAAgB;MACnB,MAAM,IAAIA,KAAK,CAAC,qDAAqD,CAAC;IAExE;MACE,MAAM,IAAIA,KAAK,CACb,gCAAiCO,MAAM,CAAsBR,IAAI,EACnE,CAAC;EACL;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ActionLogicRuleConverter.js","names":["buildBlockDataInterfaceTypeLookup","buildBlockDataObjectTypeLookup","resolveBlockDataApiName","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","getObjectReferenceTypeFromBlockData","convertIrLogicRulesToActionLogicRules","rules","objectLookup","interfaceLookup","map","irRule","convertSingleRule","convertBlockDataLogicRulesToActionLogicRules","blockdata","rule","convertBlockDataSingleRule","convertIrLogicRuleToActionLogicRule","r","addObjectRule","propertyArguments","k","v","propertyValues","result","objectTypeApiName","objectTypeId","structPropertyArguments","addOrModifyObjectRuleV2","objRef","objectToModify","modifyObjectRule","modifyPropertyArguments","deleteObjectRule","objectToDelete","addInterfaceRule","interfaceApiName","interfaceTypeApiName","sharedPropertyArguments","modifyInterfaceRule","interfaceObjectToModify","interfaceObjectToModifyParameter","interfaceTypeRid"],"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 ActionTypeBlockDataV2,\n LogicRule,\n OntologyBlockDataV2,\n OntologyIrActionTypeBlockDataV2,\n OntologyIrLogicRule,\n OntologyIrOntologyBlockDataV2,\n} from \"@osdk/client.unstable\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\nimport {\n type BlockDataApiNameLookup,\n buildBlockDataInterfaceTypeLookup,\n buildBlockDataObjectTypeLookup,\n resolveBlockDataApiName,\n} from \"@osdk/generator-converters.ontologyir\";\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\nfunction getObjectReferenceTypeFromBlockData(\n action: ActionTypeBlockDataV2,\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 * Build lookups once and convert all logic rules for an action.\n * Avoids rebuilding lookup Maps on every rule.\n */\nexport function convertIrLogicRulesToActionLogicRules(\n rules: OntologyIrLogicRule[],\n action: OntologyIrActionTypeBlockDataV2,\n ir?: OntologyIrOntologyBlockDataV2,\n): Ontologies.ActionLogicRule[] {\n const objectLookup = buildObjectTypeLookup(ir);\n const interfaceLookup = buildInterfaceTypeLookup(ir);\n\n return rules.map(irRule =>\n convertSingleRule(irRule, action, objectLookup, interfaceLookup)\n );\n}\n\nexport function convertBlockDataLogicRulesToActionLogicRules(\n rules: LogicRule[],\n action: ActionTypeBlockDataV2,\n blockdata?: OntologyBlockDataV2,\n): Ontologies.ActionLogicRule[] {\n const objectLookup = buildBlockDataObjectTypeLookup(blockdata);\n const interfaceLookup = buildBlockDataInterfaceTypeLookup(blockdata);\n\n return rules.map(rule =>\n convertBlockDataSingleRule(rule, action, objectLookup, interfaceLookup)\n );\n}\n\n/**\n * Convert a single OntologyIrLogicRule to ActionLogicRule.\n * Kept as a public API for callers that only need a single rule conversion.\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 return convertSingleRule(irRule, action, objectLookup, interfaceLookup);\n}\n\nfunction convertSingleRule(\n irRule: OntologyIrLogicRule,\n action: OntologyIrActionTypeBlockDataV2,\n objectLookup: ApiNameLookup | undefined,\n interfaceLookup: ApiNameLookup | undefined,\n): Ontologies.ActionLogicRule {\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 // propertyArguments left empty: the downstream generator resolves\n // property mappings from the action parameter configuration rather\n // than from the logic rule itself for createOrModify rules.\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 // Validate that the parameter is an objectReference (throws if not)\n getObjectReferenceType(action, r.objectToModify);\n const modifyPropertyArguments: Record<\n Ontologies.PropertyApiName,\n Ontologies.LogicRuleArgument\n > = {};\n for (const [k, v] of Object.entries(r.propertyValues)) {\n modifyPropertyArguments[k] = v as Ontologies.LogicRuleArgument;\n }\n const result: Ontologies.ModifyObjectLogicRule & {\n type: \"modifyObject\";\n } = {\n type: \"modifyObject\",\n objectToModify: r.objectToModify,\n propertyArguments: modifyPropertyArguments,\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\nfunction convertBlockDataSingleRule(\n rule: LogicRule,\n action: ActionTypeBlockDataV2,\n objectLookup: BlockDataApiNameLookup | undefined,\n interfaceLookup: BlockDataApiNameLookup | undefined,\n): Ontologies.ActionLogicRule {\n switch (rule.type) {\n case \"addObjectRule\": {\n const r = rule.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: resolveBlockDataApiName(\n r.objectTypeId,\n objectLookup,\n ),\n propertyArguments,\n structPropertyArguments: {},\n };\n return result;\n }\n\n case \"addOrModifyObjectRuleV2\": {\n const r = rule.addOrModifyObjectRuleV2;\n const objRef = getObjectReferenceTypeFromBlockData(\n action,\n r.objectToModify,\n );\n // propertyArguments left empty: the downstream generator resolves\n // property mappings from the action parameter configuration rather\n // than from the logic rule itself for createOrModify rules.\n const result: Ontologies.CreateOrModifyObjectLogicRule & {\n type: \"createOrModifyObject\";\n } = {\n type: \"createOrModifyObject\",\n objectTypeApiName: resolveBlockDataApiName(\n objRef.objectTypeId,\n objectLookup,\n ),\n propertyArguments: {},\n structPropertyArguments: {},\n };\n return result;\n }\n\n case \"modifyObjectRule\": {\n const r = rule.modifyObjectRule;\n // Validate that the parameter is an objectReference (throws if not)\n getObjectReferenceTypeFromBlockData(action, r.objectToModify);\n const modifyPropertyArguments: Record<\n Ontologies.PropertyApiName,\n Ontologies.LogicRuleArgument\n > = {};\n for (const [k, v] of Object.entries(r.propertyValues)) {\n modifyPropertyArguments[k] = v as Ontologies.LogicRuleArgument;\n }\n const result: Ontologies.ModifyObjectLogicRule & {\n type: \"modifyObject\";\n } = {\n type: \"modifyObject\",\n objectToModify: r.objectToModify,\n propertyArguments: modifyPropertyArguments,\n structPropertyArguments: {},\n };\n return result;\n }\n\n case \"deleteObjectRule\": {\n const r = rule.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 = rule.addInterfaceRule;\n const interfaceApiName = resolveBlockDataApiName(\n r.interfaceTypeRid,\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 = rule.modifyInterfaceRule;\n const result: Ontologies.ModifyInterfaceLogicRule & {\n type: \"modifyInterface\";\n } = {\n type: \"modifyInterface\",\n interfaceObjectToModify: r.interfaceObjectToModify,\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: ${(rule as { type: string }).type}`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SAEEA,iCAAiC,EACjCC,8BAA8B,EAC9BC,uBAAuB,QAClB,uCAAuC;AAO9C,SAASC,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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AAC,CAACsB,uBAAuB;UAClDF,uBAAuB,EAAE,CAAC,CAAC;UAC3BX,uBAAuB,EAAE,CAAC;QAC5B,CAAC;QACD,OAAOH,MAAM;MACf;IAEA,KAAK,aAAa;MAChB,MAAM,IAAIrB,KAAK,CAAC,kDAAkD,CAAC;IAErE,KAAK,gBAAgB;MACnB,MAAM,IAAIA,KAAK,CAAC,qDAAqD,CAAC;IAExE;MACE,MAAM,IAAIA,KAAK,CACb,gCAAiCY,IAAI,CAAsBb,IAAI,EACjE,CAAC;EACL;AACF","ignoreList":[]}
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { OntologyIrToFullMetadataConverter } from "@osdk/generator-converters.ontologyir";
18
- import { convertIrLogicRulesToActionLogicRules } from "./ActionLogicRuleConverter.js";
17
+ import { buildBlockDataInterfaceTypeLookup, buildBlockDataObjectTypeLookup, OntologyBlockDataToFullMetadataConverter } from "@osdk/generator-converters.ontologyir";
18
+ import { convertBlockDataLogicRulesToActionLogicRules } from "./ActionLogicRuleConverter.js";
19
19
  import { toUuid } from "./ridUtils.js";
20
20
 
21
21
  /**
@@ -31,10 +31,9 @@ export class PreviewOntologyIrConverter {
31
31
  * Main entry point - converts IR to full metadata with enhanced action types.
32
32
  * Returns ActionTypeFullMetadata which includes fullLogicRules.
33
33
  */
34
- static getPreviewFullMetadataFromIr(ir) {
35
- const baseMetadata = OntologyIrToFullMetadataConverter.getFullMetadataFromIr(ir);
36
- const actionTypes = this.convertActionTypesWithFullLogicRules(Object.values(ir.actionTypes), ir);
37
-
34
+ static getPreviewFullMetadataFromBlockData(blockdata) {
35
+ const baseMetadata = OntologyBlockDataToFullMetadataConverter.getFullMetadataFromBlockData(blockdata);
36
+ const actionTypes = this.convertActionTypesWithFullLogicRulesFromBlockData(blockdata.actionTypes, blockdata);
38
37
  // Post-process object types to use UUID-based RIDs
39
38
  const objectTypes = this.convertObjectTypesWithUuidRids(baseMetadata.objectTypes);
40
39
  return {
@@ -86,20 +85,21 @@ export class PreviewOntologyIrConverter {
86
85
  * Reuses base converter for action type conversion, then process
87
86
  * RIDs to use UUID-based format and adds fullLogicRules.
88
87
  */
89
- static convertActionTypesWithFullLogicRules(actions, ir) {
90
- const baseActionTypes = OntologyIrToFullMetadataConverter.getOsdkActionTypes(actions);
88
+ static convertActionTypesWithFullLogicRulesFromBlockData(actions, blockdata) {
89
+ const objectTypeLookup = buildBlockDataObjectTypeLookup(blockdata);
90
+ const interfaceTypeLookup = buildBlockDataInterfaceTypeLookup(blockdata);
91
+ const baseActionTypes = OntologyBlockDataToFullMetadataConverter.getOsdkActionTypesFromBlockData(blockdata, objectTypeLookup, interfaceTypeLookup);
91
92
 
92
93
  // Build a lookup from apiName to the original IR action for logic rules
93
- const actionsByApiName = new Map(actions.map(a => [a.actionType.metadata.apiName, a]));
94
+ const actionsByApiName = new Map(Object.values(actions).map(a => [a.actionType.metadata.apiName, a]));
94
95
  const result = {};
95
96
  for (const [apiName, baseActionType] of Object.entries(baseActionTypes)) {
96
97
  const action = actionsByApiName.get(apiName);
97
98
  result[apiName] = {
98
99
  actionType: {
99
- ...baseActionType,
100
- rid: `ri.ontology.main.action-type.${toUuid(apiName)}`
100
+ ...baseActionType
101
101
  },
102
- fullLogicRules: convertIrLogicRulesToActionLogicRules(action.actionType.actionTypeLogic.logic.rules, action, ir)
102
+ fullLogicRules: convertBlockDataLogicRulesToActionLogicRules(action.actionType.actionTypeLogic.logic.rules, action, blockdata)
103
103
  };
104
104
  }
105
105
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewOntologyIrConverter.js","names":["OntologyIrToFullMetadataConverter","convertIrLogicRulesToActionLogicRules","toUuid","PreviewOntologyIrConverter","getPreviewFullMetadataFromIr","ir","baseMetadata","getFullMetadataFromIr","actionTypes","convertActionTypesWithFullLogicRules","Object","values","objectTypes","convertObjectTypesWithUuidRids","ontology","apiName","rid","displayName","description","result","fullMetadata","entries","objectType","properties","propKey","prop","linkTypes","map","lt","linkTypeRid","actions","baseActionTypes","getOsdkActionTypes","actionsByApiName","Map","a","actionType","metadata","baseActionType","action","get","fullLogicRules","actionTypeLogic","logic","rules"],"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 OntologyIrOntologyBlockDataV2,\n} from \"@osdk/client.unstable\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\nimport { OntologyIrToFullMetadataConverter } from \"@osdk/generator-converters.ontologyir\";\nimport { convertIrLogicRulesToActionLogicRules } 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 and link types.\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 const linkTypes = fullMetadata.linkTypes.map(lt => ({\n ...lt,\n linkTypeRid: `ri.ontology.main.link-type.${\n toUuid(lt.linkTypeRid || lt.apiName)\n }` as Ontologies.LinkTypeRid,\n }));\n\n result[apiName] = {\n ...fullMetadata,\n linkTypes,\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 * Reuses base converter for action type conversion, then process\n * RIDs to use UUID-based format and adds fullLogicRules.\n */\n private static convertActionTypesWithFullLogicRules(\n actions: OntologyIrActionTypeBlockDataV2[],\n ir: OntologyIrOntologyBlockDataV2,\n ): Record<string, Ontologies.ActionTypeFullMetadata> {\n const baseActionTypes = OntologyIrToFullMetadataConverter\n .getOsdkActionTypes(actions);\n\n // Build a lookup from apiName to the original IR action for logic rules\n const actionsByApiName = new Map(\n actions.map(a => [a.actionType.metadata.apiName, a]),\n );\n\n const result: Record<string, Ontologies.ActionTypeFullMetadata> = {};\n for (const [apiName, baseActionType] of Object.entries(baseActionTypes)) {\n const action = actionsByApiName.get(apiName)!;\n result[apiName] = {\n actionType: {\n ...baseActionType,\n rid: `ri.ontology.main.action-type.${toUuid(apiName)}`,\n },\n fullLogicRules: convertIrLogicRulesToActionLogicRules(\n action.actionType.actionTypeLogic.logic.rules,\n action,\n ir,\n ),\n };\n }\n\n return result;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,iCAAiC,QAAQ,uCAAuC;AACzF,SAASC,qCAAqC,QAAQ,+BAA+B;AACrF,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,W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AACW,OAAO,CAACU,eAAe,CAAC,EAAE;MACvE,MAAMQ,MAAM,GAAGN,gBAAgB,CAACO,GAAG,CAACzB,OAAO,CAAE;MAC7CI,MAAM,CAACJ,OAAO,CAAC,GAAG;QAChBqB,UAAU,EAAE;UACV,GAAGE,cAAc;UACjBtB,GAAG,EAAE,gCAAgCd,MAAM,CAACa,OAAO,CAAC;QACtD,CAAC;QACD0B,cAAc,EAAExC,qCAAqC,CACnDsC,MAAM,CAACH,UAAU,CAACM,eAAe,CAACC,KAAK,CAACC,KAAK,EAC7CL,MAAM,EACNlC,EACF;MACF,CAAC;IACH;IAEA,OAAOc,MAAM;EACf;AACF","ignoreList":[]}
1
+ {"version":3,"file":"PreviewOntologyIrConverter.js","names":["buildBlockDataInterfaceTypeLookup","buildBlockDataObjectTypeLookup","OntologyBlockDataToFullMetadataConverter","convertBlockDataLogicRulesToActionLogicRules","toUuid","PreviewOntologyIrConverter","getPreviewFullMetadataFromBlockData","blockdata","baseMetadata","getFullMetadataFromBlockData","actionTypes","convertActionTypesWithFullLogicRulesFromBlockData","objectTypes","convertObjectTypesWithUuidRids","ontology","apiName","rid","displayName","description","result","fullMetadata","Object","entries","objectType","properties","propKey","prop","linkTypes","map","lt","linkTypeRid","actions","objectTypeLookup","interfaceTypeLookup","baseActionTypes","getOsdkActionTypesFromBlockData","actionsByApiName","Map","values","a","actionType","metadata","baseActionType","action","get","fullLogicRules","actionTypeLogic","logic","rules"],"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 ActionTypeBlockDataV2,\n OntologyBlockDataV2,\n} from \"@osdk/client.unstable\";\nimport type * as Ontologies from \"@osdk/foundry.ontologies\";\nimport {\n buildBlockDataInterfaceTypeLookup,\n buildBlockDataObjectTypeLookup,\n OntologyBlockDataToFullMetadataConverter,\n} from \"@osdk/generator-converters.ontologyir\";\nimport { convertBlockDataLogicRulesToActionLogicRules } 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 getPreviewFullMetadataFromBlockData(\n blockdata: OntologyBlockDataV2,\n ): PreviewOntologyFullMetadata {\n const baseMetadata = OntologyBlockDataToFullMetadataConverter\n .getFullMetadataFromBlockData(blockdata);\n\n const actionTypes = this.convertActionTypesWithFullLogicRulesFromBlockData(\n blockdata.actionTypes,\n blockdata,\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 and link types.\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 const linkTypes = fullMetadata.linkTypes.map(lt => ({\n ...lt,\n linkTypeRid: `ri.ontology.main.link-type.${\n toUuid(lt.linkTypeRid || lt.apiName)\n }` as Ontologies.LinkTypeRid,\n }));\n\n result[apiName] = {\n ...fullMetadata,\n linkTypes,\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 * Reuses base converter for action type conversion, then process\n * RIDs to use UUID-based format and adds fullLogicRules.\n */\n private static convertActionTypesWithFullLogicRulesFromBlockData(\n actions: Record<string, ActionTypeBlockDataV2>,\n blockdata: OntologyBlockDataV2,\n ): Record<string, Ontologies.ActionTypeFullMetadata> {\n const objectTypeLookup = buildBlockDataObjectTypeLookup(blockdata);\n const interfaceTypeLookup = buildBlockDataInterfaceTypeLookup(blockdata);\n const baseActionTypes = OntologyBlockDataToFullMetadataConverter\n .getOsdkActionTypesFromBlockData(\n blockdata,\n objectTypeLookup,\n interfaceTypeLookup,\n );\n\n // Build a lookup from apiName to the original IR action for logic rules\n const actionsByApiName = new Map(\n Object.values(actions).map(a => [a.actionType.metadata.apiName, a]),\n );\n const result: Record<string, Ontologies.ActionTypeFullMetadata> = {};\n for (const [apiName, baseActionType] of Object.entries(baseActionTypes)) {\n const action = actionsByApiName.get(apiName)!;\n result[apiName] = {\n actionType: {\n ...baseActionType,\n },\n fullLogicRules: convertBlockDataLogicRulesToActionLogicRules(\n action.actionType.actionTypeLogic.logic.rules,\n action,\n blockdata,\n ),\n };\n }\n\n return result;\n }\n}\n"],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