@osdk/maker 0.13.0-beta.16 → 0.13.0-beta.17

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 (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/browser/api/defineAction.js +6 -6
  3. package/build/browser/api/defineAction.js.map +1 -1
  4. package/build/browser/api/overall.test.js +1 -1
  5. package/build/browser/api/overall.test.js.map +1 -1
  6. package/build/browser/cli/main.js +1 -1
  7. package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js +2 -2
  8. package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -1
  9. package/build/browser/conversion/toMarketplace/convertActionValidation.js +16 -2
  10. package/build/browser/conversion/toMarketplace/convertActionValidation.js.map +1 -1
  11. package/build/browser/conversion/toMarketplace/convertConditionDefinition.js +5 -3
  12. package/build/browser/conversion/toMarketplace/convertConditionDefinition.js.map +1 -1
  13. package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js +2 -2
  14. package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -1
  15. package/build/cjs/index.cjs +85 -72
  16. package/build/cjs/index.cjs.map +1 -1
  17. package/build/esm/api/defineAction.js +6 -6
  18. package/build/esm/api/defineAction.js.map +1 -1
  19. package/build/esm/api/overall.test.js +1 -1
  20. package/build/esm/api/overall.test.js.map +1 -1
  21. package/build/esm/cli/main.js +1 -1
  22. package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js +2 -2
  23. package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -1
  24. package/build/esm/conversion/toMarketplace/convertActionValidation.js +16 -2
  25. package/build/esm/conversion/toMarketplace/convertActionValidation.js.map +1 -1
  26. package/build/esm/conversion/toMarketplace/convertConditionDefinition.js +5 -3
  27. package/build/esm/conversion/toMarketplace/convertConditionDefinition.js.map +1 -1
  28. package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js +2 -2
  29. package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -1
  30. package/build/types/api/defineAction.d.ts.map +1 -1
  31. package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts +1 -1
  32. package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts.map +1 -1
  33. package/build/types/conversion/toMarketplace/convertActionValidation.d.ts +1 -0
  34. package/build/types/conversion/toMarketplace/convertActionValidation.d.ts.map +1 -1
  35. package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts +1 -1
  36. package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts.map +1 -1
  37. package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts +1 -1
  38. package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts.map +1 -1
  39. package/package.json +2 -2
@@ -24,7 +24,7 @@ import { hideBin } from "yargs/helpers";
24
24
  import { defineOntology } from "../api/defineOntology.js";
25
25
  const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
26
26
  export default async function main(args = process.argv) {
27
- const commandLineOpts = await yargs(hideBin(args)).version("0.13.0-beta.16" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
27
+ const commandLineOpts = await yargs(hideBin(args)).version("0.13.0-beta.17" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
28
28
  input: {
29
29
  alias: "i",
30
30
  describe: "Input file",
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { extractAllowedValues } from "../../api/defineOntology.js";
18
18
  import { convertConditionDefinition } from "./convertConditionDefinition.js";
19
- export function convertActionParameterConditionalOverride(override, validation) {
19
+ export function convertActionParameterConditionalOverride(override, validation, objectProperties) {
20
20
  let parameterBlockOverride;
21
21
  switch (override.type) {
22
22
  case "required":
@@ -81,7 +81,7 @@ export function convertActionParameterConditionalOverride(override, validation)
81
81
  throw new Error(`Unknown parameter override type`);
82
82
  }
83
83
  return {
84
- condition: convertConditionDefinition(override.condition),
84
+ condition: convertConditionDefinition(override.condition, objectProperties),
85
85
  parameterBlockOverrides: [parameterBlockOverride]
86
86
  };
87
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"convertActionParameterConditionalOverride.js","names":["extractAllowedValues","convertConditionDefinition","convertActionParameterConditionalOverride","override","validation","parameterBlockOverride","type","parameterRequired","required","notRequired","visibility","defaultVisibility","hidden","editable","disabled","prefill","defaultValue","allowedValues","constraint","Error","condition","parameterBlockOverrides"],"sources":["convertActionParameterConditionalOverride.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 OntologyIrConditionalOverride,\n OntologyIrParameterValidationBlockOverride,\n} from \"@osdk/client.unstable\";\nimport type { ActionParameterValidation } from \"../../api/action/ActionParameter.js\";\nimport type { ActionParameterConditionalOverride } from \"../../api/action/ActionParameterConditionalOverride.js\";\nimport { extractAllowedValues } from \"../../api/defineOntology.js\";\nimport { convertConditionDefinition } from \"./convertConditionDefinition.js\";\n\nexport function convertActionParameterConditionalOverride(\n override: ActionParameterConditionalOverride,\n validation: ActionParameterValidation,\n): OntologyIrConditionalOverride {\n let parameterBlockOverride: OntologyIrParameterValidationBlockOverride;\n switch (override.type) {\n case \"required\":\n parameterBlockOverride = {\n type: \"parameterRequired\",\n parameterRequired: {\n required: validation.required\n ? {\n type: \"notRequired\",\n notRequired: {},\n }\n : {\n type: \"required\",\n required: {},\n },\n },\n };\n break;\n case \"visibility\":\n parameterBlockOverride = {\n type: \"visibility\",\n visibility: {\n visibility: validation.defaultVisibility === \"editable\"\n ? {\n type: \"hidden\",\n hidden: {},\n }\n : {\n type: \"editable\",\n editable: {},\n },\n },\n };\n break;\n case \"disabled\":\n parameterBlockOverride = {\n type: \"visibility\",\n visibility: {\n visibility: validation.defaultVisibility === \"editable\"\n ? {\n type: \"disabled\",\n disabled: {},\n }\n : {\n type: \"editable\",\n editable: {},\n },\n },\n };\n break;\n case \"defaultValue\":\n parameterBlockOverride = {\n type: \"prefill\",\n prefill: {\n prefill: override.defaultValue,\n },\n };\n break;\n case \"constraint\":\n parameterBlockOverride = {\n type: \"allowedValues\",\n allowedValues: {\n allowedValues: extractAllowedValues(override.constraint),\n },\n };\n break;\n default:\n throw new Error(`Unknown parameter override type`);\n }\n return {\n condition: convertConditionDefinition(override.condition),\n parameterBlockOverrides: [parameterBlockOverride],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,0BAA0B,QAAQ,iCAAiC;AAE5E,OAAO,SAASC,yCAAyCA,CACvDC,QAA4C,EAC5CC,UAAqC,EACN;EAC/B,IAAIC,sBAAkE;EACtE,QAAQF,QAAQ,CAACG,IAAI;IACnB,KAAK,UAAU;MACbD,sBAAsB,GAAG;QACvBC,IAAI,EAAE,mBAAmB;QACzBC,iBAAiB,EAAE;UACjBC,QAAQ,EAAEJ,UAAU,CAACI,QAAQ,GACzB;YACAF,IAAI,EAAE,aAAa;YACnBG,WAAW,EAAE,CAAC;UAChB,CAAC,GACC;YACAH,IAAI,EAAE,UAAU;YAChBE,QAAQ,EAAE,CAAC;UACb;QACJ;MACF,CAAC;MACD;IACF,KAAK,YAAY;MACfH,sBAAsB,GAAG;QACvBC,IAAI,EAAE,YAAY;QAClBI,UAAU,EAAE;UACVA,UAAU,EAAEN,UAAU,CAACO,iBAAiB,KAAK,UAAU,GACnD;YACAL,IAAI,EAAE,QAAQ;YACdM,MAAM,EAAE,CAAC;UACX,CAAC,GACC;YACAN,IAAI,EAAE,UAAU;YAChBO,QAAQ,EAAE,CAAC;UACb;QACJ;MACF,CAAC;MACD;IACF,KAAK,UAAU;MACbR,sBAAsB,GAAG;QACvBC,IAAI,EAAE,YAAY;QAClBI,UAAU,EAAE;UACVA,UAAU,EAAEN,UAAU,CAACO,iBAAiB,KAAK,UAAU,GACnD;YACAL,IAAI,EAAE,UAAU;YAChBQ,QAAQ,EAAE,CAAC;UACb,CAAC,GACC;YACAR,IAAI,EAAE,UAAU;YAChBO,QAAQ,EAAE,CAAC;UACb;QACJ;MACF,CAAC;MACD;IACF,KAAK,cAAc;MACjBR,sBAAsB,GAAG;QACvBC,IAAI,EAAE,SAAS;QACfS,OAAO,EAAE;UACPA,OAAO,EAAEZ,QAAQ,CAACa;QACpB;MACF,CAAC;MACD;IACF,KAAK,YAAY;MACfX,sBAAsB,GAAG;QACvBC,IAAI,EAAE,eAAe;QACrBW,aAAa,EAAE;UACbA,aAAa,EAAEjB,oBAAoB,CAACG,QAAQ,CAACe,UAAU;QACzD;MACF,CAAC;MACD;IACF;MACE,MAAM,IAAIC,KAAK,CAAC,iCAAiC,CAAC;EACtD;EACA,OAAO;IACLC,SAAS,EAAEnB,0BAA0B,CAACE,QAAQ,CAACiB,SAAS,CAAC;IACzDC,uBAAuB,EAAE,CAAChB,sBAAsB;EAClD,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"convertActionParameterConditionalOverride.js","names":["extractAllowedValues","convertConditionDefinition","convertActionParameterConditionalOverride","override","validation","objectProperties","parameterBlockOverride","type","parameterRequired","required","notRequired","visibility","defaultVisibility","hidden","editable","disabled","prefill","defaultValue","allowedValues","constraint","Error","condition","parameterBlockOverrides"],"sources":["convertActionParameterConditionalOverride.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 OntologyIrConditionalOverride,\n OntologyIrParameterValidationBlockOverride,\n} from \"@osdk/client.unstable\";\nimport type { ActionParameterValidation } from \"../../api/action/ActionParameter.js\";\nimport type { ActionParameterConditionalOverride } from \"../../api/action/ActionParameterConditionalOverride.js\";\nimport { extractAllowedValues } from \"../../api/defineOntology.js\";\nimport { convertConditionDefinition } from \"./convertConditionDefinition.js\";\n\nexport function convertActionParameterConditionalOverride(\n override: ActionParameterConditionalOverride,\n validation: ActionParameterValidation,\n objectProperties?: Array<String>,\n): OntologyIrConditionalOverride {\n let parameterBlockOverride: OntologyIrParameterValidationBlockOverride;\n switch (override.type) {\n case \"required\":\n parameterBlockOverride = {\n type: \"parameterRequired\",\n parameterRequired: {\n required: validation.required\n ? {\n type: \"notRequired\",\n notRequired: {},\n }\n : {\n type: \"required\",\n required: {},\n },\n },\n };\n break;\n case \"visibility\":\n parameterBlockOverride = {\n type: \"visibility\",\n visibility: {\n visibility: validation.defaultVisibility === \"editable\"\n ? {\n type: \"hidden\",\n hidden: {},\n }\n : {\n type: \"editable\",\n editable: {},\n },\n },\n };\n break;\n case \"disabled\":\n parameterBlockOverride = {\n type: \"visibility\",\n visibility: {\n visibility: validation.defaultVisibility === \"editable\"\n ? {\n type: \"disabled\",\n disabled: {},\n }\n : {\n type: \"editable\",\n editable: {},\n },\n },\n };\n break;\n case \"defaultValue\":\n parameterBlockOverride = {\n type: \"prefill\",\n prefill: {\n prefill: override.defaultValue,\n },\n };\n break;\n case \"constraint\":\n parameterBlockOverride = {\n type: \"allowedValues\",\n allowedValues: {\n allowedValues: extractAllowedValues(override.constraint),\n },\n };\n break;\n default:\n throw new Error(`Unknown parameter override type`);\n }\n return {\n condition: convertConditionDefinition(override.condition, objectProperties),\n parameterBlockOverrides: [parameterBlockOverride],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,0BAA0B,QAAQ,iCAAiC;AAE5E,OAAO,SAASC,yCAAyCA,CACvDC,QAA4C,EAC5CC,UAAqC,EACrCC,gBAAgC,EACD;EAC/B,IAAIC,sBAAkE;EACtE,QAAQH,QAAQ,CAACI,IAAI;IACnB,KAAK,UAAU;MACbD,sBAAsB,GAAG;QACvBC,IAAI,EAAE,mBAAmB;QACzBC,iBAAiB,EAAE;UACjBC,QAAQ,EAAEL,UAAU,CAACK,QAAQ,GACzB;YACAF,IAAI,EAAE,aAAa;YACnBG,WAAW,EAAE,CAAC;UAChB,CAAC,GACC;YACAH,IAAI,EAAE,UAAU;YAChBE,QAAQ,EAAE,CAAC;UACb;QACJ;MACF,CAAC;MACD;IACF,KAAK,YAAY;MACfH,sBAAsB,GAAG;QACvBC,IAAI,EAAE,YAAY;QAClBI,UAAU,EAAE;UACVA,UAAU,EAAEP,UAAU,CAACQ,iBAAiB,KAAK,UAAU,GACnD;YACAL,IAAI,EAAE,QAAQ;YACdM,MAAM,EAAE,CAAC;UACX,CAAC,GACC;YACAN,IAAI,EAAE,UAAU;YAChBO,QAAQ,EAAE,CAAC;UACb;QACJ;MACF,CAAC;MACD;IACF,KAAK,UAAU;MACbR,sBAAsB,GAAG;QACvBC,IAAI,EAAE,YAAY;QAClBI,UAAU,EAAE;UACVA,UAAU,EAAEP,UAAU,CAACQ,iBAAiB,KAAK,UAAU,GACnD;YACAL,IAAI,EAAE,UAAU;YAChBQ,QAAQ,EAAE,CAAC;UACb,CAAC,GACC;YACAR,IAAI,EAAE,UAAU;YAChBO,QAAQ,EAAE,CAAC;UACb;QACJ;MACF,CAAC;MACD;IACF,KAAK,cAAc;MACjBR,sBAAsB,GAAG;QACvBC,IAAI,EAAE,SAAS;QACfS,OAAO,EAAE;UACPA,OAAO,EAAEb,QAAQ,CAACc;QACpB;MACF,CAAC;MACD;IACF,KAAK,YAAY;MACfX,sBAAsB,GAAG;QACvBC,IAAI,EAAE,eAAe;QACrBW,aAAa,EAAE;UACbA,aAAa,EAAElB,oBAAoB,CAACG,QAAQ,CAACgB,UAAU;QACzD;MACF,CAAC;MACD;IACF;MACE,MAAM,IAAIC,KAAK,CAAC,iCAAiC,CAAC;EACtD;EACA,OAAO;IACLC,SAAS,EAAEpB,0BAA0B,CAACE,QAAQ,CAACkB,SAAS,EAAEhB,gBAAgB,CAAC;IAC3EiB,uBAAuB,EAAE,CAAChB,sBAAsB;EAClD,CAAC;AACH","ignoreList":[]}
@@ -47,7 +47,7 @@ export function convertActionValidation(action) {
47
47
  required: convertParameterRequirementConstraint(p.validation.required)
48
48
  }
49
49
  },
50
- conditionalOverrides: p.validation.conditionalOverrides?.map(override => convertActionParameterConditionalOverride(override, p.validation)) ?? []
50
+ conditionalOverrides: p.validation.conditionalOverrides?.map(override => convertActionParameterConditionalOverride(override, p.validation, getActionTypeObjectParameters(action))) ?? []
51
51
  }];
52
52
  })),
53
53
  sectionValidations: {
@@ -63,7 +63,7 @@ export function convertActionValidation(action) {
63
63
  visible: {}
64
64
  }
65
65
  },
66
- conditionalOverrides: section.conditionalOverrides?.map(override => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible")) ?? []
66
+ conditionalOverrides: section.conditionalOverrides?.map(override => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible", getActionTypeObjectParameters(action))) ?? []
67
67
  }]))
68
68
  }
69
69
  };
@@ -90,4 +90,18 @@ function convertParameterRequirementConstraint(required) {
90
90
  }
91
91
  };
92
92
  }
93
+ export function getActionTypeObjectParameters(actionType) {
94
+ switch (actionType.rules[0].type) {
95
+ case "addObjectRule":
96
+ return Object.keys(actionType.rules[0].addObjectRule.propertyValues);
97
+ case "modifyObjectRule":
98
+ return Object.keys(actionType.rules[0].modifyObjectRule.propertyValues);
99
+ case "addOrModifyObjectRuleV2":
100
+ return Object.keys(actionType.rules[0].addOrModifyObjectRuleV2.propertyValues);
101
+ case "deleteObjectRule":
102
+ return [];
103
+ default:
104
+ return undefined;
105
+ }
106
+ }
93
107
  //# sourceMappingURL=convertActionValidation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertActionValidation.js","names":["extractAllowedValues","renderHintFromBaseType","convertActionParameterConditionalOverride","convertActionVisibility","convertSectionConditionalOverride","convertActionValidation","action","actionTypeLevelValidation","rules","Object","fromEntries","validation","condition","type","true","displayMetadata","failureMessage","typeClasses","map","rule","idx","parameterValidations","parameters","p","id","defaultValidation","display","renderHint","visibility","defaultVisibility","defaultValue","prefill","allowedValues","required","convertParameterRequirementConstraint","conditionalOverrides","override","sectionValidations","entries","sections","sectionId","section","defaultDisplayMetadata","hidden","visible","notRequired","min","max","listLength","listLengthValidation","minLength","maxLength"],"sources":["convertActionValidation.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 OntologyIrActionValidation,\n ParameterRequiredConfiguration,\n} from \"@osdk/client.unstable\";\nimport type { ActionParameterRequirementConstraint } from \"../../api/action/ActionParameterConfiguration.js\";\nimport type { ActionType } from \"../../api/action/ActionType.js\";\nimport {\n extractAllowedValues,\n renderHintFromBaseType,\n} from \"../../api/defineOntology.js\";\nimport { convertActionParameterConditionalOverride } from \"./convertActionParameterConditionalOverride.js\";\nimport { convertActionVisibility } from \"./convertActionVisibility.js\";\nimport { convertSectionConditionalOverride } from \"./convertSectionConditionalOverride.js\";\n\nexport function convertActionValidation(\n action: ActionType,\n): OntologyIrActionValidation {\n return {\n actionTypeLevelValidation: {\n rules: Object.fromEntries(\n (action.validation\n ?? [{\n condition: { type: \"true\", true: {} },\n displayMetadata: { failureMessage: \"\", typeClasses: [] },\n }]).map((rule, idx) => [idx, rule]),\n ),\n },\n parameterValidations: Object.fromEntries(\n (action.parameters ?? []).map(p => {\n return [\n p.id,\n {\n defaultValidation: {\n display: {\n renderHint: renderHintFromBaseType(p),\n visibility: convertActionVisibility(\n p.validation.defaultVisibility,\n ),\n ...p.defaultValue\n && { prefill: p.defaultValue },\n },\n validation: {\n allowedValues: extractAllowedValues(\n p.validation.allowedValues!,\n ),\n required: convertParameterRequirementConstraint(\n p.validation.required!,\n ),\n },\n },\n conditionalOverrides: p.validation.conditionalOverrides?.map(\n (override) =>\n convertActionParameterConditionalOverride(\n override,\n p.validation,\n ),\n ) ?? [],\n },\n ];\n }),\n ),\n sectionValidations: {\n ...Object.fromEntries(\n Object.entries(action.sections ?? {}).map((\n [sectionId, section],\n ) => [\n section.id,\n {\n defaultDisplayMetadata: section.defaultVisibility === \"hidden\"\n ? {\n visibility: {\n type: \"hidden\",\n hidden: {},\n },\n }\n : {\n visibility: {\n type: \"visible\",\n visible: {},\n },\n },\n conditionalOverrides: section.conditionalOverrides?.map(\n (override) =>\n convertSectionConditionalOverride(\n override,\n section.defaultVisibility ?? \"visible\",\n ),\n ) ?? [],\n },\n ]),\n ),\n },\n };\n}\n\nfunction convertParameterRequirementConstraint(\n required: ActionParameterRequirementConstraint,\n): ParameterRequiredConfiguration {\n if (typeof required === \"boolean\") {\n return required\n ? { type: \"required\", required: {} }\n : { type: \"notRequired\", notRequired: {} };\n }\n const { min, max } = required.listLength;\n return {\n type: \"listLengthValidation\",\n listLengthValidation: { minLength: min, maxLength: max },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;A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C,oBAAoB,EAAE;MAAEC,SAAS,EAAEJ,GAAG;MAAEK,SAAS,EAAEJ;IAAI;EACzD,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"convertActionValidation.js","names":["extractAllowedValues","renderHintFromBaseType","convertActionParameterConditionalOverride","convertActionVisibility","convertSectionConditionalOverride","convertActionValidation","action","actionTypeLevelValidation","rules","Object","fromEntries","validation","condition","type","true","displayMetadata","failureMessage","typeClasses","map","rule","idx","parameterValidations","parameters","p","id","defaultValidation","display","renderHint","visibility","defaultVisibility","defaultValue","prefill","allowedValues","required","convertParameterRequirementConstraint","conditionalOverrides","override","getActionTypeObjectParameters","sectionValidations","entries","sections","sectionId","section","defaultDisplayMetadata","hidden","visible","notRequired","min","max","listLength","listLengthValidation","minLength","maxLength","actionType","keys","addObjectRule","propertyValues","modifyObjectRule","addOrModifyObjectRuleV2","undefined"],"sources":["convertActionValidation.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 OntologyIrActionValidation,\n ParameterRequiredConfiguration,\n} from \"@osdk/client.unstable\";\nimport type { ActionParameterRequirementConstraint } from \"../../api/action/ActionParameterConfiguration.js\";\nimport type { ActionType } from \"../../api/action/ActionType.js\";\nimport {\n extractAllowedValues,\n renderHintFromBaseType,\n} from \"../../api/defineOntology.js\";\nimport { convertActionParameterConditionalOverride } from \"./convertActionParameterConditionalOverride.js\";\nimport { convertActionVisibility } from \"./convertActionVisibility.js\";\nimport { convertSectionConditionalOverride } from \"./convertSectionConditionalOverride.js\";\n\nexport function convertActionValidation(\n action: ActionType,\n): OntologyIrActionValidation {\n return {\n actionTypeLevelValidation: {\n rules: Object.fromEntries(\n (action.validation\n ?? [{\n condition: { type: \"true\", true: {} },\n displayMetadata: { failureMessage: \"\", typeClasses: [] },\n }]).map((rule, idx) => [idx, rule]),\n ),\n },\n parameterValidations: Object.fromEntries(\n (action.parameters ?? []).map(p => {\n return [\n p.id,\n {\n defaultValidation: {\n display: {\n renderHint: renderHintFromBaseType(p),\n visibility: convertActionVisibility(\n p.validation.defaultVisibility,\n ),\n ...p.defaultValue\n && { prefill: p.defaultValue },\n },\n validation: {\n allowedValues: extractAllowedValues(\n p.validation.allowedValues!,\n ),\n required: convertParameterRequirementConstraint(\n p.validation.required!,\n ),\n },\n },\n conditionalOverrides: p.validation.conditionalOverrides?.map(\n (override) =>\n convertActionParameterConditionalOverride(\n override,\n p.validation,\n getActionTypeObjectParameters(action),\n ),\n ) ?? [],\n },\n ];\n }),\n ),\n sectionValidations: {\n ...Object.fromEntries(\n Object.entries(action.sections ?? {}).map((\n [sectionId, section],\n ) => [\n section.id,\n {\n defaultDisplayMetadata: section.defaultVisibility === \"hidden\"\n ? {\n visibility: {\n type: \"hidden\",\n hidden: {},\n },\n }\n : {\n visibility: {\n type: \"visible\",\n visible: {},\n },\n },\n conditionalOverrides: section.conditionalOverrides?.map(\n (override) =>\n convertSectionConditionalOverride(\n override,\n section.defaultVisibility ?? \"visible\",\n getActionTypeObjectParameters(action),\n ),\n ) ?? [],\n },\n ]),\n ),\n },\n };\n}\n\nfunction convertParameterRequirementConstraint(\n required: ActionParameterRequirementConstraint,\n): ParameterRequiredConfiguration {\n if (typeof required === \"boolean\") {\n return required\n ? { type: \"required\", required: {} }\n : { type: \"notRequired\", notRequired: {} };\n }\n const { min, max } = required.listLength;\n return {\n type: \"listLengthValidation\",\n listLengthValidation: { minLength: min, maxLength: max },\n };\n}\n\nexport function getActionTypeObjectParameters(\n actionType: ActionType,\n): Array<String> | undefined {\n switch (actionType.rules[0].type) {\n case \"addObjectRule\":\n return Object.keys(actionType.rules[0].addObjectRule.propertyValues);\n case \"modifyObjectRule\":\n return Object.keys(actionType.rules[0].modifyObjectRule.propertyValues);\n case \"addOrModifyObjectRuleV2\":\n return Object.keys(\n actionType.rules[0].addOrModifyObjectRuleV2.propertyValues,\n );\n case \"deleteObjectRule\":\n return [];\n default:\n return undefined;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,oBAAoB,EACpBC,sBAAsB,QACjB,6BAA6B;AACpC,SAASC,yCAAyC,QAAQ,gDAAgD;AAC1G,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,iCAAiC,QAAQ,wCAAwC;AAE1F,OAAO,SAASC,uBAAuBA,CACrCC,MAAkB,EACU;EAC5B,OAAO;IACLC,yBAAyB,EAAE;MACzBC,KAAK,EAAEC,MAAM,CAACC,WAAW,CACvB,CAACJ,MAAM,CAACK,UAAU,IACb,CAAC;QACFC,SAAS,EAAE;UAAEC,IAAI,EAAE,MAAM;UAAEC,IAAI,EAAE,CAAC;QAAE,CAAC;QACrCC,eAAe,EAAE;UAAEC,cAAc,EAAE,EAAE;UAAEC,WAAW,EAAE;QAAG;MACzD,CAAC,CAAC,EAAEC,GAAG,CAAC,CAACC,IAAI,EAAEC,GAAG,KAAK,CAACA,GAAG,EAAED,IAAI,CAAC,CACtC;IACF,CAAC;IACDE,oBAAoB,EAAEZ,MAAM,CAACC,WAAW,CACtC,CAACJ,MAAM,CAACgB,UAAU,IAAI,EAAE,EAAEJ,GAAG,CAACK,CAAC,IAAI;MACjC,OAAO,CACLA,CAAC,CAACC,EAAE,EACJ;QACEC,iBAAiB,EAAE;UACjBC,OAAO,EAAE;YACPC,UAAU,EAAE1B,sBAAsB,CAACsB,CAAC,CAAC;YACrCK,UAAU,EAAEzB,uBAAuB,CACjCoB,CAAC,CAACZ,UAAU,CAACkB,iBACf,CAA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AqCA,CAC5CD,QAA8C,EACd;EAChC,IAAI,OAAOA,QAAQ,KAAK,SAAS,EAAE;IACjC,OAAOA,QAAQ,GACX;MAAEpB,IAAI,EAAE,UAAU;MAAEoB,QAAQ,EAAE,CAAC;IAAE,CAAC,GAClC;MAAEpB,IAAI,EAAE,aAAa;MAAEiC,WAAW,EAAE,CAAC;IAAE,CAAC;EAC9C;EACA,MAAM;IAAEC,GAAG;IAAEC;EAAI,CAAC,GAAGf,QAAQ,CAACgB,UAAU;EACxC,OAAO;IACLpC,IAAI,EAAE,sBAAsB;IAC5BqC,oBAAoB,EAAE;MAAEC,SAAS,EAAEJ,GAAG;MAAEK,SAAS,EAAEJ;IAAI;EACzD,CAAC;AACH;AAEA,OAAO,SAASX,6BAA6BA,CAC3CgB,UAAsB,EACK;EAC3B,QAAQA,UAAU,CAAC7C,KAAK,CAAC,CAAC,CAAC,CAACK,IAAI;IAC9B,KAAK,eAAe;MAClB,OAAOJ,MAAM,CAAC6C,IAAI,CAACD,UAAU,CAAC7C,KAAK,CAAC,CAAC,CAAC,CAAC+C,aAAa,CAACC,cAAc,CAAC;IACtE,KAAK,kBAAkB;MACrB,OAAO/C,MAAM,CAAC6C,IAAI,CAACD,UAAU,CAAC7C,KAAK,CAAC,CAAC,CAAC,CAACiD,gBAAgB,CAACD,cAAc,CAAC;IACzE,KAAK,yBAAyB;MAC5B,OAAO/C,MAAM,CAAC6C,IAAI,CAChBD,UAAU,CAAC7C,KAAK,CAAC,CAAC,CAAC,CAACkD,uBAAuB,CAACF,cAC9C,CAAC;IACH,KAAK,kBAAkB;MACrB,OAAO,EAAE;IACX;MACE,OAAOG,SAAS;EACpB;AACF","ignoreList":[]}
@@ -14,14 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export function convertConditionDefinition(condition) {
17
+ import invariant from "tiny-invariant";
18
+ export function convertConditionDefinition(condition, objectProperties) {
18
19
  switch (condition.type) {
19
20
  case "and":
20
21
  if ("conditions" in condition) {
21
22
  return {
22
23
  type: "and",
23
24
  and: {
24
- conditions: condition.conditions.map(c => convertConditionDefinition(c))
25
+ conditions: condition.conditions.map(c => convertConditionDefinition(c, objectProperties))
25
26
  }
26
27
  };
27
28
  } else {
@@ -32,7 +33,7 @@ export function convertConditionDefinition(condition) {
32
33
  return {
33
34
  type: "or",
34
35
  or: {
35
- conditions: condition.conditions.map(c => convertConditionDefinition(c))
36
+ conditions: condition.conditions.map(c => convertConditionDefinition(c, objectProperties))
36
37
  }
37
38
  };
38
39
  } else {
@@ -68,6 +69,7 @@ export function convertConditionDefinition(condition) {
68
69
  }
69
70
  };
70
71
  case "parameter":
72
+ !objectProperties?.includes(condition.parameterId) ? process.env.NODE_ENV !== "production" ? invariant(false, `Action parameter condition references unknown parameter ${condition.parameterId}`) : invariant(false) : void 0;
71
73
  return {
72
74
  type: "comparison",
73
75
  comparison: {
@@ -1 +1 @@
1
- {"version":3,"file":"convertConditionDefinition.js","names":["convertConditionDefinition","condition","type","and","conditions","map","c","or","comparison","operator","left","userProperty","userId","currentUser","propertyValue","groupIds","right","staticValue","stringList","strings","name","parameterId","matches"],"sources":["convertConditionDefinition.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 { OntologyIrCondition } from \"@osdk/client.unstable\";\nimport type { ConditionDefinition } from \"../../api/action/ConditionDefinition.js\";\n\nexport function convertConditionDefinition(\n condition: ConditionDefinition,\n): OntologyIrCondition {\n switch (condition.type) {\n case \"and\":\n if (\"conditions\" in condition) {\n return {\n type: \"and\",\n and: {\n conditions: condition.conditions.map(c =>\n convertConditionDefinition(c)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"or\":\n if (\"conditions\" in condition) {\n return {\n type: \"or\",\n or: {\n conditions: condition.conditions.map(c =>\n convertConditionDefinition(c)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"group\":\n return {\n type: \"comparison\",\n comparison: {\n operator: \"INTERSECTS\",\n left: {\n type: \"userProperty\",\n userProperty: {\n userId: {\n type: \"currentUser\",\n currentUser: {},\n },\n propertyValue: {\n type: \"groupIds\",\n groupIds: {},\n },\n },\n },\n right: {\n type: \"staticValue\",\n staticValue: {\n type: \"stringList\",\n stringList: {\n strings: [\n condition.name,\n ],\n },\n },\n },\n },\n };\n case \"parameter\":\n return {\n type: \"comparison\",\n comparison: {\n operator: \"EQUALS\",\n left: {\n type: \"parameterId\",\n parameterId: condition.parameterId,\n },\n right: condition.matches,\n },\n };\n default:\n return condition;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,0BAA0BA,CACxCC,SAA8B,EACT;EACrB,QAAQA,SAAS,CAACC,IAAI;IACpB,KAAK,KAAK;MACR,IAAI,YAAY,IAAID,SAAS,EAAE;QAC7B,OAAO;UACLC,IAAI,EAAE,KAAK;UACXC,GAAG,EAAE;YACHC,UAAU,EAAEH,SAAS,CAACG,UAAU,CAACC,GAAG,CAACC,CAAC,IACpCN,0BAA0B,CAACM,CAAC,CAC9B;UACF;QACF,CAAC;MACH,CAAC,MAAM;QACL,OAAOL,SAAS;MAClB;IACF,KAAK,IAAI;MACP,IAAI,YAAY,IAAIA,SAAS,EAAE;QAC7B,OAAO;UACLC,IAAI,EAAE,IAAI;UACVK,EAAE,EAAE;YACFH,UAAU,EAAEH,SAAS,CAACG,UAAU,CAACC,GAAG,CAACC,CAAC,IACpCN,0BAA0B,CAACM,CAAC,CAC9B;UACF;QACF,CAAC;MACH,CAAC,MAAM;QACL,OAAOL,SAAS;MAClB;IACF,KAAK,OAAO;MACV,OAAO;QACLC,IAAI,EAAE,YAAY;QAClBM,UAAU,EAAE;UACVC,QAAQ,EAAE,YAAY;UACtBC,IAAI,EAAE;YACJR,IAAI,EAAE,cAAc;YACpBS,YAAY,EAAE;cACZC,MAAM,EAAE;gBACNV,IAAI,EAAE,aAAa;gBACnBW,WAAW,EAAE,CAAC;cAChB,CAAC;cACDC,aAAa,EAAE;gBACbZ,IAAI,EAAE,UAAU;gBAChBa,QAAQ,EAAE,CAAC;cACb;YACF;UACF,CAAC;UACDC,KAAK,EAAE;YACLd,IAAI,EAAE,aAAa;YACnBe,WAAW,EAAE;cACXf,IAAI,EAAE,YAAY;cAClBgB,UAAU,EAAE;gBACVC,OAAO,EAAE,CACPlB,SAAS,CAACmB,IAAI;cAElB;YACF;UACF;QACF;MACF,CAAC;IACH,KAAK,WAAW;MACd,OAAO;QACLlB,IAAI,EAAE,YAAY;QAClBM,UAAU,EAAE;UACVC,QAAQ,EAAE,QAAQ;UAClBC,IAAI,EAAE;YACJR,IAAI,EAAE,aAAa;YACnBmB,WAAW,EAAEpB,SAAS,CAACoB;UACzB,CAAC;UACDL,KAAK,EAAEf,SAAS,CAACqB;QACnB;MACF,CAAC;IACH;MACE,OAAOrB,SAAS;EACpB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"convertConditionDefinition.js","names":["invariant","convertConditionDefinition","condition","objectProperties","type","and","conditions","map","c","or","comparison","operator","left","userProperty","userId","currentUser","propertyValue","groupIds","right","staticValue","stringList","strings","name","includes","parameterId","process","env","NODE_ENV","matches"],"sources":["convertConditionDefinition.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 { OntologyIrCondition } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type { ConditionDefinition } from \"../../api/action/ConditionDefinition.js\";\n\nexport function convertConditionDefinition(\n condition: ConditionDefinition,\n objectProperties?: Array<String>,\n): OntologyIrCondition {\n switch (condition.type) {\n case \"and\":\n if (\"conditions\" in condition) {\n return {\n type: \"and\",\n and: {\n conditions: condition.conditions.map(c =>\n convertConditionDefinition(c, objectProperties)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"or\":\n if (\"conditions\" in condition) {\n return {\n type: \"or\",\n or: {\n conditions: condition.conditions.map(c =>\n convertConditionDefinition(c, objectProperties)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"group\":\n return {\n type: \"comparison\",\n comparison: {\n operator: \"INTERSECTS\",\n left: {\n type: \"userProperty\",\n userProperty: {\n userId: {\n type: \"currentUser\",\n currentUser: {},\n },\n propertyValue: {\n type: \"groupIds\",\n groupIds: {},\n },\n },\n },\n right: {\n type: \"staticValue\",\n staticValue: {\n type: \"stringList\",\n stringList: {\n strings: [\n condition.name,\n ],\n },\n },\n },\n },\n };\n case \"parameter\":\n invariant(\n objectProperties?.includes(condition.parameterId),\n `Action parameter condition references unknown parameter ${condition.parameterId}`,\n );\n return {\n type: \"comparison\",\n comparison: {\n operator: \"EQUALS\",\n left: {\n type: \"parameterId\",\n parameterId: condition.parameterId,\n },\n right: condition.matches,\n },\n };\n default:\n return condition;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AAGtC,OAAO,SAASC,0BAA0BA,CACxCC,SAA8B,EAC9BC,gBAAgC,EACX;EACrB,QAAQD,SAAS,CAACE,IAAI;IACpB,KAAK,K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,EAAE,IAFpFxB,SAAS;MAIT,OAAO;QACLI,IAAI,EAAE,YAAY;QAClBM,UAAU,EAAE;UACVC,QAAQ,EAAE,QAAQ;UAClBC,IAAI,EAAE;YACJR,IAAI,EAAE,aAAa;YACnBoB,WAAW,EAAEtB,SAAS,CAACsB;UACzB,CAAC;UACDN,KAAK,EAAEhB,SAAS,CAAC0B;QACnB;MACF,CAAC;IACH;MACE,OAAO1B,SAAS;EACpB;AACF","ignoreList":[]}
@@ -15,9 +15,9 @@
15
15
  */
16
16
 
17
17
  import { convertConditionDefinition } from "./convertConditionDefinition.js";
18
- export function convertSectionConditionalOverride(override, defaultVisibility) {
18
+ export function convertSectionConditionalOverride(override, defaultVisibility, objectProperties) {
19
19
  return {
20
- condition: convertConditionDefinition(override.condition),
20
+ condition: convertConditionDefinition(override.condition, objectProperties),
21
21
  sectionBlockOverrides: [{
22
22
  type: "visibility",
23
23
  visibility: {
@@ -1 +1 @@
1
- {"version":3,"file":"convertSectionConditionalOverride.js","names":["convertConditionDefinition","convertSectionConditionalOverride","override","defaultVisibility","condition","sectionBlockOverrides","type","visibility","hidden","visible"],"sources":["convertSectionConditionalOverride.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 { OntologyIrSectionConditionalOverride } from \"@osdk/client.unstable\";\nimport type { SectionConditionalOverride } from \"../../api/action/SectionConditionalOverride.js\";\nimport { convertConditionDefinition } from \"./convertConditionDefinition.js\";\n\nexport function convertSectionConditionalOverride(\n override: SectionConditionalOverride,\n defaultVisibility: \"visible\" | \"hidden\",\n): OntologyIrSectionConditionalOverride {\n return {\n condition: convertConditionDefinition(override.condition),\n sectionBlockOverrides: [\n {\n type: \"visibility\",\n visibility: {\n visibility: defaultVisibility === \"visible\"\n ? {\n type: \"hidden\",\n hidden: {},\n }\n : {\n type: \"visible\",\n visible: {},\n },\n },\n },\n ],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,0BAA0B,QAAQ,iCAAiC;AAE5E,OAAO,SAASC,iCAAiCA,CAC/CC,QAAoC,EACpCC,iBAAuC,EACD;EACtC,OAAO;IACLC,SAAS,EAAEJ,0BAA0B,CAACE,QAAQ,CAACE,SAAS,CAAC;IACzDC,qBAAqB,EAAE,CACrB;MACEC,IAAI,EAAE,YAAY;MAClBC,UAAU,EAAE;QACVA,UAAU,EAAEJ,iBAAiB,KAAK,SAAS,GACvC;UACAG,IAAI,EAAE,QAAQ;UACdE,MAAM,EAAE,CAAC;QACX,CAAC,GACC;UACAF,IAAI,EAAE,SAAS;UACfG,OAAO,EAAE,CAAC;QACZ;MACJ;IACF,CAAC;EAEL,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"convertSectionConditionalOverride.js","names":["convertConditionDefinition","convertSectionConditionalOverride","override","defaultVisibility","objectProperties","condition","sectionBlockOverrides","type","visibility","hidden","visible"],"sources":["convertSectionConditionalOverride.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 { OntologyIrSectionConditionalOverride } from \"@osdk/client.unstable\";\nimport type { SectionConditionalOverride } from \"../../api/action/SectionConditionalOverride.js\";\nimport { convertConditionDefinition } from \"./convertConditionDefinition.js\";\n\nexport function convertSectionConditionalOverride(\n override: SectionConditionalOverride,\n defaultVisibility: \"visible\" | \"hidden\",\n objectProperties?: Array<String>,\n): OntologyIrSectionConditionalOverride {\n return {\n condition: convertConditionDefinition(override.condition, objectProperties),\n sectionBlockOverrides: [\n {\n type: \"visibility\",\n visibility: {\n visibility: defaultVisibility === \"visible\"\n ? {\n type: \"hidden\",\n hidden: {},\n }\n : {\n type: \"visible\",\n visible: {},\n },\n },\n },\n ],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,0BAA0B,QAAQ,iCAAiC;AAE5E,OAAO,SAASC,iCAAiCA,CAC/CC,QAAoC,EACpCC,iBAAuC,EACvCC,gBAAgC,EACM;EACtC,OAAO;IACLC,SAAS,EAAEL,0BAA0B,CAACE,QAAQ,CAACG,SAAS,EAAED,gBAAgB,CAAC;IAC3EE,qBAAqB,EAAE,CACrB;MACEC,IAAI,EAAE,YAAY;MAClBC,UAAU,EAAE;QACVA,UAAU,EAAEL,iBAAiB,KAAK,SAAS,GACvC;UACAI,IAAI,EAAE,QAAQ;UACdE,MAAM,EAAE,CAAC;QACX,CAAC,GACC;UACAF,IAAI,EAAE,SAAS;UACfG,OAAO,EAAE,CAAC;QACZ;MACJ;IACF,CAAC;EAEL,CAAC;AACH","ignoreList":[]}