@osdk/maker 0.34.0 → 0.35.0-main-833f47a4aeef6f7cfcab024ca3623aada385701b

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 (50) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/browser/api/InterfaceActionTypeConstraintDefinition.js +2 -0
  3. package/build/browser/api/InterfaceActionTypeConstraintDefinition.js.map +1 -0
  4. package/build/browser/api/defineInterface.js +2 -0
  5. package/build/browser/api/defineInterface.js.map +1 -1
  6. package/build/browser/api/defineInterfaceActionTypeConstraint.js +55 -0
  7. package/build/browser/api/defineInterfaceActionTypeConstraint.js.map +1 -0
  8. package/build/browser/api/defineInterfaceLinkConstraint.js +1 -0
  9. package/build/browser/api/defineInterfaceLinkConstraint.js.map +1 -1
  10. package/build/browser/api/defineOntology.js +44 -5
  11. package/build/browser/api/defineOntology.js.map +1 -1
  12. package/build/browser/api/interface/InterfaceType.js.map +1 -1
  13. package/build/browser/cli/main.js +2 -2
  14. package/build/browser/cli/main.js.map +1 -1
  15. package/build/browser/conversion/toMarketplace/convertObject.js +2 -1
  16. package/build/browser/conversion/toMarketplace/convertObject.js.map +1 -1
  17. package/build/browser/index.js +2 -0
  18. package/build/browser/index.js.map +1 -1
  19. package/build/cjs/index.cjs +189 -13
  20. package/build/cjs/index.cjs.map +1 -1
  21. package/build/cjs/index.d.cts +22 -2
  22. package/build/esm/api/InterfaceActionTypeConstraintDefinition.js +2 -0
  23. package/build/esm/api/InterfaceActionTypeConstraintDefinition.js.map +1 -0
  24. package/build/esm/api/defineInterface.js +2 -0
  25. package/build/esm/api/defineInterface.js.map +1 -1
  26. package/build/esm/api/defineInterfaceActionTypeConstraint.js +55 -0
  27. package/build/esm/api/defineInterfaceActionTypeConstraint.js.map +1 -0
  28. package/build/esm/api/defineInterfaceLinkConstraint.js +1 -0
  29. package/build/esm/api/defineInterfaceLinkConstraint.js.map +1 -1
  30. package/build/esm/api/defineOntology.js +44 -5
  31. package/build/esm/api/defineOntology.js.map +1 -1
  32. package/build/esm/api/interface/InterfaceType.js.map +1 -1
  33. package/build/esm/cli/main.js +2 -2
  34. package/build/esm/cli/main.js.map +1 -1
  35. package/build/esm/conversion/toMarketplace/convertObject.js +2 -1
  36. package/build/esm/conversion/toMarketplace/convertObject.js.map +1 -1
  37. package/build/esm/index.js +2 -0
  38. package/build/esm/index.js.map +1 -1
  39. package/build/types/api/InterfaceActionTypeConstraintDefinition.d.ts +16 -0
  40. package/build/types/api/InterfaceActionTypeConstraintDefinition.d.ts.map +1 -0
  41. package/build/types/api/defineInterfaceActionTypeConstraint.d.ts +2 -0
  42. package/build/types/api/defineInterfaceActionTypeConstraint.d.ts.map +1 -0
  43. package/build/types/api/defineOntology.d.ts +1 -0
  44. package/build/types/api/defineOntology.d.ts.map +1 -1
  45. package/build/types/api/interface/InterfaceType.d.ts +1 -0
  46. package/build/types/api/interface/InterfaceType.d.ts.map +1 -1
  47. package/build/types/conversion/toMarketplace/convertObject.d.ts.map +1 -1
  48. package/build/types/index.d.ts +2 -0
  49. package/build/types/index.d.ts.map +1 -1
  50. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @osdk/maker
2
2
 
3
+ ## 0.35.0-main-833f47a4aeef6f7cfcab024ca3623aada385701b
4
+
5
+ ### Minor Changes
6
+
7
+ - 833f47a: add support for interface action type constraint in ontology as code
8
+
9
+ ### Patch Changes
10
+
11
+ - b5d0a61: transitive OAC imports
12
+ - Updated dependencies [b5d0a61]
13
+ - Updated dependencies [833f47a]
14
+ - @osdk/generator-converters.ontologyir@2.31.1-main-833f47a4aeef6f7cfcab024ca3623aada385701b
15
+ - @osdk/api@2.31.1-main-833f47a4aeef6f7cfcab024ca3623aada385701b
16
+
3
17
  ## 0.34.0
4
18
 
5
19
  ### Patch Changes
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=InterfaceActionTypeConstraintDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InterfaceActionTypeConstraintDefinition.js","names":[],"sources":["InterfaceActionTypeConstraintDefinition.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 { OntologyIrBaseParameterConstraintType } from \"@osdk/client.unstable\";\nimport type { InterfaceType } from \"./interface/InterfaceType.js\";\n\nexport interface ParameterConstraintDefinition {\n apiName: string;\n displayName: string;\n type: OntologyIrBaseParameterConstraintType;\n requireImplementation: boolean;\n}\n\nexport interface InterfaceActionTypeConstraintDefinition {\n interfaceType: InterfaceType;\n apiName: string;\n displayName: string;\n description: string;\n requireImplementation: boolean;\n parameters: Array<ParameterConstraintDefinition>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -80,7 +80,9 @@ export function defineInterface(interfaceDefInput) {
80
80
  } : undefined
81
81
  },
82
82
  extendsInterfaces,
83
+ linkedInterfaces: [],
83
84
  links: [],
85
+ actionTypeConstraints: [],
84
86
  status,
85
87
  propertiesV2,
86
88
  propertiesV3,
@@ -1 +1 @@
1
- {"version":3,"file":"defineInterface.js","names":["invariant","API_NAME_PATTERN","isValidApiName","cloneDefinition","OntologyEntityTypeEnum","namespace","ontologyDefinition","updateOntology","withoutNamespace","isInterfaceSharedPropertyType","mapSimplifiedStatusToInterfaceTypeStatus","combineApiNamespaceIfMissing","isExotic","isPropertyTypeType","defineInterface","interfaceDefInput","interfaceDef","apiName","INTERFACE_TYPE","undefined","process","env","NODE_ENV","spts","Object","fromEntries","entries","properties","filter","_name","prop","map","s","spt","required","sharedPropertyType","propertiesV2","propName","type","sptApiName","verifyBasePropertyDefinition","propertiesV3","propertyBase","extendsInterfaces","extends","Array","isArray","status","deprecated","message","deadline","fullInterface","displayMetadata","displayName","description","icon","blueprint","color","locator","links","permission","searchable","__type","unNamespacedTypeApiName","JSON","stringify","key"],"sources":["defineInterface.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { InterfaceTypeStatus } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { API_NAME_PATTERN, isValidApiName } from \"../util/ApiNameValidator.js\";\nimport { cloneDefinition } from \"./cloneDefinition.js\";\nimport type { BlueprintIcon } from \"./common/BlueprintIcons.js\";\nimport type { EntityPermission } from \"./common/EntityPermission.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n namespace,\n ontologyDefinition,\n updateOntology,\n withoutNamespace,\n} from \"./defineOntology.js\";\nimport {\n type InterfaceDefinedProperty,\n type InterfacePropertyType,\n isInterfaceSharedPropertyType,\n} from \"./interface/InterfacePropertyType.js\";\nimport { type InterfaceType } from \"./interface/InterfaceType.js\";\nimport { mapSimplifiedStatusToInterfaceTypeStatus } from \"./interface/mapSimplifiedStatusToInterfaceTypeStatus.js\";\nimport { combineApiNamespaceIfMissing } from \"./namespace/combineApiNamespaceIfMissing.js\";\nimport { isExotic, isPropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport { type SharedPropertyType } from \"./properties/SharedPropertyType.js\";\n\nexport type SimplifiedInterfaceTypeStatus =\n | { type: \"deprecated\"; message: string; deadline: string }\n | { type: \"active\" }\n | { type: \"experimental\" }\n | { type: \"example\" };\n\ntype PropertyBase =\n | SharedPropertyType\n | InterfaceDefinedProperty;\ntype SptWithOptional = {\n required: boolean;\n sharedPropertyType: SharedPropertyType;\n};\n\nexport type InterfaceTypeDefinition = {\n apiName: string;\n displayName?: string;\n description?: string;\n icon?: { locator: BlueprintIcon; color: string };\n status?: SimplifiedInterfaceTypeStatus;\n properties?: Record<\n string,\n PropertyBase | SptWithOptional\n >;\n extends?: InterfaceType | InterfaceType[];\n searchable?: boolean;\n permission?: EntityPermission;\n};\n\nexport function defineInterface(\n interfaceDefInput: InterfaceTypeDefinition,\n): InterfaceType {\n const interfaceDef = cloneDefinition(interfaceDefInput);\n const apiName = namespace + interfaceDef.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName]\n === undefined,\n `Interface ${apiName} already exists`,\n );\n\n invariant(\n isValidApiName(interfaceDef.apiName),\n `Invalid API name ${interfaceDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`,\n );\n\n // legacy support for propertiesV2 (only SPTs)\n const spts: Record<string, SptWithOptional> = Object.fromEntries(\n Object.entries(interfaceDef.properties ?? {}).filter(([_name, prop]) => {\n return isInterfaceSharedPropertyType(prop) || \"apiName\" in prop;\n }).map(([s, spt]) => {\n const required = isInterfaceSharedPropertyType(spt) ? spt.required : true;\n return [s, {\n sharedPropertyType: (isInterfaceSharedPropertyType(spt)\n ? spt.sharedPropertyType\n : spt) as SharedPropertyType,\n required,\n }];\n }),\n );\n const propertiesV2 = Object.fromEntries(\n Object.entries(spts).map<\n [string, { required: boolean; sharedPropertyType: SharedPropertyType }]\n >(\n ([propName, type]) => {\n const sptApiName = combineApiNamespaceIfMissing(\n namespace,\n type.sharedPropertyType.apiName,\n );\n return [sptApiName, {\n required: type.required,\n sharedPropertyType: verifyBasePropertyDefinition(\n namespace,\n propName,\n type.sharedPropertyType,\n ),\n }];\n },\n ),\n );\n\n const propertiesV3 = Object.fromEntries(\n Object.entries(interfaceDef.properties ?? {}).map<\n [string, InterfacePropertyType]\n >(([apiName, prop]) => {\n invariant(\n isValidApiName(apiName),\n `Invalid API name ${apiName} for property on interface ${interfaceDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`,\n );\n const required =\n (typeof prop === \"object\" && isInterfaceSharedPropertyType(prop))\n ? prop.required\n : true;\n const propertyBase: PropertyBase =\n (typeof prop === \"object\" && isInterfaceSharedPropertyType(prop))\n ? prop.sharedPropertyType\n : prop;\n if (\n typeof propertyBase === \"object\"\n && \"nonNameSpacedApiName\" in propertyBase\n ) {\n // SPT\n return [apiName, {\n required,\n sharedPropertyType: propertyBase,\n }];\n } else {\n // IDP\n return [apiName, propertyBase];\n }\n }),\n );\n\n const extendsInterfaces = interfaceDef.extends\n ? (Array.isArray(interfaceDef.extends)\n ? interfaceDef.extends\n : [interfaceDef.extends])\n : [];\n\n const status: InterfaceTypeStatus = mapSimplifiedStatusToInterfaceTypeStatus(\n interfaceDef.status ?? { type: \"active\" },\n );\n\n invariant(\n status.type !== \"deprecated\"\n || (status.deprecated.message && status.deprecated.deadline),\n `Deprecated status must include message and deadline properties.`,\n );\n\n const fullInterface: InterfaceType = {\n apiName,\n displayMetadata: {\n displayName: interfaceDef.displayName ?? interfaceDef.apiName,\n description: interfaceDef.description ?? interfaceDef.displayName\n ?? interfaceDef.apiName,\n icon: interfaceDef.icon !== undefined\n ? {\n type: \"blueprint\",\n blueprint: {\n color: interfaceDef.icon.color,\n locator: interfaceDef.icon.locator,\n },\n }\n : undefined,\n },\n extendsInterfaces,\n links: [],\n status,\n propertiesV2,\n propertiesV3,\n permission: interfaceDef.permission,\n searchable: interfaceDef.searchable ?? true,\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE,\n };\n\n updateOntology(fullInterface);\n return fullInterface;\n}\n\nfunction verifyBasePropertyDefinition(\n namespace: string,\n apiName: string,\n type: SharedPropertyType,\n): SharedPropertyType {\n const unNamespacedTypeApiName = withoutNamespace(type.apiName);\n invariant(\n isPropertyTypeType(type.type) || isExotic(type.type),\n `Invalid data type ${\n JSON.stringify(type)\n } for property ${apiName} on InterfaceType ${apiName}`,\n );\n invariant(\n namespace + apiName === type.apiName\n || apiName === unNamespacedTypeApiName,\n `property key and it's apiName must be identical. ${\n JSON.stringify({ key: apiName, apiName: type.apiName })\n }`,\n );\n return type;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,6BAA6B;AAC9E,SAASC,eAAe,QAAQ,sBAAsB;AAGtD,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,QACX,qBAAqB;AAC5B,SAGEC,6BAA6B,QACxB,sCAAsC;AAE7C,SAASC,wCAAwC,QAAQ,yDAAyD;AAClH,SAASC,4BAA4B,QAAQ,6CAA6C;AAC1F,SAASC,QAAQ,EAAEC,kBAAkB,QAAQ,kCAAkC;AAgC/E,OAAO,SAASC,eAAeA,CAC7BC,iBAA0C,EAC3B;EACf,MAAMC,YAAY,GAAGb,eAAe,CAACY,iBAAiB,CAAC;EACvD,MAAME,OAAO,GAAGZ,SAAS,GAAGW,YAAY,CAACC,OAAO;EAChD,EACEX,kBAAkB,CAACF,sBAAsB,CAACc,cAAc,CAAC,CAACD,OAAO,CAAC,KAC5DE,SAAS,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAFjBtB,SAAS,QAGP,aAAaiB,OAAO,iBAAiB,IAHvCjB,SAAS;EAMT,CACEE,cAAc,CAACc,YAAY,CAACC,OAAO,CAAC,GAAAG,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADtCtB,SAAS,QAEP,oBAAoBgB,YAAY,CAACC,OAAO,oCAAoChB,gBAAgB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uB,IAAA3C,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAF1CtB,SAAS,QAGP,oDACEgE,IAAI,CAACC,SAAS,CAAC;IAAEC,GAAG,EAAEjD,OAAO;IAAEA,OAAO,EAAEqB,IAAI,CAACrB;EAAQ,CAAC,CAAC,EACvD,IALJjB,SAAS;EAOT,OAAOsC,IAAI;AACb","ignoreList":[]}
1
+ {"version":3,"file":"defineInterface.js","names":["invariant","API_NAME_PATTERN","isValidApiName","cloneDefinition","OntologyEntityTypeEnum","namespace","ontologyDefinition","updateOntology","withoutNamespace","isInterfaceSharedPropertyType","mapSimplifiedStatusToInterfaceTypeStatus","combineApiNamespaceIfMissing","isExotic","isPropertyTypeType","defineInterface","interfaceDefInput","interfaceDef","apiName","INTERFACE_TYPE","undefined","process","env","NODE_ENV","spts","Object","fromEntries","entries","properties","filter","_name","prop","map","s","spt","required","sharedPropertyType","propertiesV2","propName","type","sptApiName","verifyBasePropertyDefinition","propertiesV3","propertyBase","extendsInterfaces","extends","Array","isArray","status","deprecated","message","deadline","fullInterface","displayMetadata","displayName","description","icon","blueprint","color","locator","linkedInterfaces","links","actionTypeConstraints","permission","searchable","__type","unNamespacedTypeApiName","JSON","stringify","key"],"sources":["defineInterface.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { InterfaceTypeStatus } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { API_NAME_PATTERN, isValidApiName } from \"../util/ApiNameValidator.js\";\nimport { cloneDefinition } from \"./cloneDefinition.js\";\nimport type { BlueprintIcon } from \"./common/BlueprintIcons.js\";\nimport type { EntityPermission } from \"./common/EntityPermission.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n namespace,\n ontologyDefinition,\n updateOntology,\n withoutNamespace,\n} from \"./defineOntology.js\";\nimport {\n type InterfaceDefinedProperty,\n type InterfacePropertyType,\n isInterfaceSharedPropertyType,\n} from \"./interface/InterfacePropertyType.js\";\nimport { type InterfaceType } from \"./interface/InterfaceType.js\";\nimport { mapSimplifiedStatusToInterfaceTypeStatus } from \"./interface/mapSimplifiedStatusToInterfaceTypeStatus.js\";\nimport { combineApiNamespaceIfMissing } from \"./namespace/combineApiNamespaceIfMissing.js\";\nimport { isExotic, isPropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport { type SharedPropertyType } from \"./properties/SharedPropertyType.js\";\n\nexport type SimplifiedInterfaceTypeStatus =\n | { type: \"deprecated\"; message: string; deadline: string }\n | { type: \"active\" }\n | { type: \"experimental\" }\n | { type: \"example\" };\n\ntype PropertyBase =\n | SharedPropertyType\n | InterfaceDefinedProperty;\ntype SptWithOptional = {\n required: boolean;\n sharedPropertyType: SharedPropertyType;\n};\n\nexport type InterfaceTypeDefinition = {\n apiName: string;\n displayName?: string;\n description?: string;\n icon?: { locator: BlueprintIcon; color: string };\n status?: SimplifiedInterfaceTypeStatus;\n properties?: Record<\n string,\n PropertyBase | SptWithOptional\n >;\n extends?: InterfaceType | InterfaceType[];\n searchable?: boolean;\n permission?: EntityPermission;\n};\n\nexport function defineInterface(\n interfaceDefInput: InterfaceTypeDefinition,\n): InterfaceType {\n const interfaceDef = cloneDefinition(interfaceDefInput);\n const apiName = namespace + interfaceDef.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName]\n === undefined,\n `Interface ${apiName} already exists`,\n );\n\n invariant(\n isValidApiName(interfaceDef.apiName),\n `Invalid API name ${interfaceDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`,\n );\n\n // legacy support for propertiesV2 (only SPTs)\n const spts: Record<string, SptWithOptional> = Object.fromEntries(\n Object.entries(interfaceDef.properties ?? {}).filter(([_name, prop]) => {\n return isInterfaceSharedPropertyType(prop) || \"apiName\" in prop;\n }).map(([s, spt]) => {\n const required = isInterfaceSharedPropertyType(spt) ? spt.required : true;\n return [s, {\n sharedPropertyType: (isInterfaceSharedPropertyType(spt)\n ? spt.sharedPropertyType\n : spt) as SharedPropertyType,\n required,\n }];\n }),\n );\n const propertiesV2 = Object.fromEntries(\n Object.entries(spts).map<\n [string, { required: boolean; sharedPropertyType: SharedPropertyType }]\n >(\n ([propName, type]) => {\n const sptApiName = combineApiNamespaceIfMissing(\n namespace,\n type.sharedPropertyType.apiName,\n );\n return [sptApiName, {\n required: type.required,\n sharedPropertyType: verifyBasePropertyDefinition(\n namespace,\n propName,\n type.sharedPropertyType,\n ),\n }];\n },\n ),\n );\n\n const propertiesV3 = Object.fromEntries(\n Object.entries(interfaceDef.properties ?? {}).map<\n [string, InterfacePropertyType]\n >(([apiName, prop]) => {\n invariant(\n isValidApiName(apiName),\n `Invalid API name ${apiName} for property on interface ${interfaceDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`,\n );\n const required =\n (typeof prop === \"object\" && isInterfaceSharedPropertyType(prop))\n ? prop.required\n : true;\n const propertyBase: PropertyBase =\n (typeof prop === \"object\" && isInterfaceSharedPropertyType(prop))\n ? prop.sharedPropertyType\n : prop;\n if (\n typeof propertyBase === \"object\"\n && \"nonNameSpacedApiName\" in propertyBase\n ) {\n // SPT\n return [apiName, {\n required,\n sharedPropertyType: propertyBase,\n }];\n } else {\n // IDP\n return [apiName, propertyBase];\n }\n }),\n );\n\n const extendsInterfaces = interfaceDef.extends\n ? (Array.isArray(interfaceDef.extends)\n ? interfaceDef.extends\n : [interfaceDef.extends])\n : [];\n\n const status: InterfaceTypeStatus = mapSimplifiedStatusToInterfaceTypeStatus(\n interfaceDef.status ?? { type: \"active\" },\n );\n\n invariant(\n status.type !== \"deprecated\"\n || (status.deprecated.message && status.deprecated.deadline),\n `Deprecated status must include message and deadline properties.`,\n );\n\n const fullInterface: InterfaceType = {\n apiName,\n displayMetadata: {\n displayName: interfaceDef.displayName ?? interfaceDef.apiName,\n description: interfaceDef.description ?? interfaceDef.displayName\n ?? interfaceDef.apiName,\n icon: interfaceDef.icon !== undefined\n ? {\n type: \"blueprint\",\n blueprint: {\n color: interfaceDef.icon.color,\n locator: interfaceDef.icon.locator,\n },\n }\n : undefined,\n },\n extendsInterfaces,\n linkedInterfaces: [],\n links: [],\n actionTypeConstraints: [],\n status,\n propertiesV2,\n propertiesV3,\n permission: interfaceDef.permission,\n searchable: interfaceDef.searchable ?? true,\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE,\n };\n\n updateOntology(fullInterface);\n return fullInterface;\n}\n\nfunction verifyBasePropertyDefinition(\n namespace: string,\n apiName: string,\n type: SharedPropertyType,\n): SharedPropertyType {\n const unNamespacedTypeApiName = withoutNamespace(type.apiName);\n invariant(\n isPropertyTypeType(type.type) || isExotic(type.type),\n `Invalid data type ${\n JSON.stringify(type)\n } for property ${apiName} on InterfaceType ${apiName}`,\n );\n invariant(\n namespace + apiName === type.apiName\n || apiName === unNamespacedTypeApiName,\n `property key and it's apiName must be identical. ${\n JSON.stringify({ key: apiName, apiName: type.apiName })\n }`,\n );\n return type;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,6BAA6B;AAC9E,SAASC,eAAe,QAAQ,sBAAsB;AAGtD,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,QACX,qBAAqB;AAC5B,SAGEC,6BAA6B,QACxB,sCAAsC;AAE7C,SAASC,wC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C,UAAU;IACnCC,UAAU,EAAE/C,YAAY,CAAC+C,UAAU,IAAI,IAAI;IAC3CC,MAAM,EAAE5D,sBAAsB,CAACc;EACjC,CAAC;EAEDX,cAAc,CAAC4C,aAAa,CAAC;EAC7B,OAAOA,aAAa;AACtB;AAEA,SAASX,4BAA4BA,CACnCnC,SAAiB,EACjBY,OAAe,EACfqB,IAAwB,EACJ;EACpB,MAAM2B,uBAAuB,GAAGzD,gBAAgB,CAAC8B,IAAI,CAACrB,OAAO,CAAC;EAC9D,EACEJ,kBAAkB,CAACyB,IAAI,CAACA,IAAI,CAAC,IAAI1B,QAAQ,CAAC0B,IAAI,CAACA,IAAI,CAAC,IAAAlB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADtDtB,SAAS,QAEP,qBACEkE,IAAI,CAACC,SAAS,CAAC7B,IAAI,CAAC,iBACLrB,OAAO,qBAAqBA,OAAO,EAAE,IAJxDjB,SAAS;EAMT,EACEK,SAAS,GAAGY,OAAO,KAAKqB,IAAI,CAACrB,OAAO,IAC/BA,OAAO,KAAKgD,uBAAuB,IAAA7C,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAF1CtB,SAAS,QAGP,oDACEkE,IAAI,CAACC,SAAS,CAAC;IAAEC,GAAG,EAAEnD,OAAO;IAAEA,OAAO,EAAEqB,IAAI,CAACrB;EAAQ,CAAC,CAAC,EACvD,IALJjB,SAAS;EAOT,OAAOsC,IAAI;AACb","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import invariant from "tiny-invariant";
18
+ import { cloneDefinition } from "./cloneDefinition.js";
19
+ import { OntologyEntityTypeEnum } from "./common/OntologyEntityTypeEnum.js";
20
+ import { importedTypes, namespace } from "./defineOntology.js";
21
+ import { combineApiNamespaceIfMissing } from "./namespace/combineApiNamespaceIfMissing.js";
22
+ export function defineInterfaceActionTypeConstraint(input) {
23
+ const def = cloneDefinition(input);
24
+ !(importedTypes[OntologyEntityTypeEnum.INTERFACE_TYPE][def.interfaceType.apiName] == null) ? process.env.NODE_ENV !== "production" ? invariant(false, `Cannot define an action type constraint on imported interface ${def.interfaceType.apiName}. The interface must be locally defined.`) : invariant(false) : void 0;
25
+ const apiNameWithNamespace = combineApiNamespaceIfMissing(namespace, def.apiName);
26
+ !!def.requireImplementation ? process.env.NODE_ENV !== "production" ? invariant(false, `requireImplementation is not yet supported for action type constraints`) : invariant(false) : void 0;
27
+ for (const param of def.parameters) {
28
+ !!param.requireImplementation ? process.env.NODE_ENV !== "production" ? invariant(false, `requireImplementation is not yet supported for parameter constraints`) : invariant(false) : void 0;
29
+ }
30
+ !(def.interfaceType.actionTypeConstraints.find(a => a.metadata.apiName === apiNameWithNamespace) == null) ? process.env.NODE_ENV !== "production" ? invariant(false, `Action type constraint with apiName ${apiNameWithNamespace} already exists on interface ${def.interfaceType.apiName}`) : invariant(false) : void 0;
31
+ const parameters = {};
32
+ const seenParamApiNames = new Set();
33
+ for (const param of def.parameters) {
34
+ !!seenParamApiNames.has(param.apiName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Duplicate parameter constraint apiName "${param.apiName}" in action type constraint ${apiNameWithNamespace}`) : invariant(false) : void 0;
35
+ seenParamApiNames.add(param.apiName);
36
+ parameters[param.apiName] = {
37
+ displayMetadata: {
38
+ displayName: param.displayName,
39
+ apiName: param.apiName
40
+ },
41
+ type: param.type,
42
+ requireImplementation: param.requireImplementation
43
+ };
44
+ }
45
+ def.interfaceType.actionTypeConstraints.push({
46
+ metadata: {
47
+ apiName: apiNameWithNamespace,
48
+ displayName: def.displayName,
49
+ description: def.description
50
+ },
51
+ parameters,
52
+ requireImplementation: def.requireImplementation
53
+ });
54
+ }
55
+ //# sourceMappingURL=defineInterfaceActionTypeConstraint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineInterfaceActionTypeConstraint.js","names":["invariant","cloneDefinition","OntologyEntityTypeEnum","importedTypes","namespace","combineApiNamespaceIfMissing","defineInterfaceActionTypeConstraint","input","def","INTERFACE_TYPE","interfaceType","apiName","process","env","NODE_ENV","apiNameWithNamespace","requireImplementation","param","parameters","actionTypeConstraints","find","a","metadata","seenParamApiNames","Set","has","add","displayMetadata","displayName","type","push","description"],"sources":["defineInterfaceActionTypeConstraint.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 InterfaceParameterConstraintApiName,\n OntologyIrInterfaceParameterConstraint,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { cloneDefinition } from \"./cloneDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport { importedTypes, namespace } from \"./defineOntology.js\";\nimport type { InterfaceActionTypeConstraintDefinition } from \"./InterfaceActionTypeConstraintDefinition.js\";\nimport { combineApiNamespaceIfMissing } from \"./namespace/combineApiNamespaceIfMissing.js\";\n\nexport function defineInterfaceActionTypeConstraint(\n input: InterfaceActionTypeConstraintDefinition,\n): void {\n const def = cloneDefinition(input);\n\n invariant(\n importedTypes[OntologyEntityTypeEnum.INTERFACE_TYPE][\n def.interfaceType.apiName\n ]\n == null,\n `Cannot define an action type constraint on imported interface ${def.interfaceType.apiName}. The interface must be locally defined.`,\n );\n\n const apiNameWithNamespace = combineApiNamespaceIfMissing(\n namespace,\n def.apiName,\n );\n\n invariant(\n !def.requireImplementation,\n `requireImplementation is not yet supported for action type constraints`,\n );\n\n for (const param of def.parameters) {\n invariant(\n !param.requireImplementation,\n `requireImplementation is not yet supported for parameter constraints`,\n );\n }\n\n invariant(\n def.interfaceType.actionTypeConstraints.find(\n a => a.metadata.apiName === apiNameWithNamespace,\n ) == null,\n `Action type constraint with apiName ${apiNameWithNamespace} already exists on interface ${def.interfaceType.apiName}`,\n );\n\n const parameters: Record<\n InterfaceParameterConstraintApiName,\n OntologyIrInterfaceParameterConstraint\n > = {};\n const seenParamApiNames = new Set<string>();\n for (const param of def.parameters) {\n invariant(\n !seenParamApiNames.has(param.apiName),\n `Duplicate parameter constraint apiName \"${param.apiName}\" in action type constraint ${apiNameWithNamespace}`,\n );\n seenParamApiNames.add(param.apiName);\n parameters[param.apiName] = {\n displayMetadata: {\n displayName: param.displayName,\n apiName: param.apiName,\n },\n type: param.type,\n requireImplementation: param.requireImplementation,\n };\n }\n\n def.interfaceType.actionTypeConstraints.push({\n metadata: {\n apiName: apiNameWithNamespace,\n displayName: def.displayName,\n description: def.description,\n },\n parameters,\n requireImplementation: def.requireImplementation,\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,aAAa,EAAEC,SAAS,QAAQ,qBAAqB;AAE9D,SAASC,4BAA4B,QAAQ,6CAA6C;AAE1F,OAAO,SAASC,mCAAmCA,CACjDC,KAA8C,EACxC;EACN,M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,KAAK,CAACN,OAAO,+BAA+BI,oBAAoB,EAAE,IAF/Gf,SAAS;IAITuB,iBAAiB,CAACG,GAAG,CAACT,KAAK,CAACN,OAAO,CAAC;IACpCO,UAAU,CAACD,KAAK,CAACN,OAAO,CAAC,GAAG;MAC1BgB,eAAe,EAAE;QACfC,WAAW,EAAEX,KAAK,CAACW,WAAW;QAC9BjB,OAAO,EAAEM,KAAK,CAACN;MACjB,CAAC;MACDkB,IAAI,EAAEZ,KAAK,CAACY,IAAI;MAChBb,qBAAqB,EAAEC,KAAK,CAACD;IAC/B,CAAC;EACH;EAEAR,GAAG,CAACE,aAAa,CAACS,qBAAqB,CAACW,IAAI,CAAC;IAC3CR,QAAQ,EAAE;MACRX,OAAO,EAAEI,oBAAoB;MAC7Ba,WAAW,EAAEpB,GAAG,CAACoB,WAAW;MAC5BG,WAAW,EAAEvB,GAAG,CAACuB;IACnB,CAAC;IACDb,UAAU;IACVF,qBAAqB,EAAER,GAAG,CAACQ;EAC7B,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -30,6 +30,7 @@ export function defineInterfaceLinkConstraint(linkDefInput) {
30
30
  metadata: fromLinkMeta,
31
31
  required: linkDef.required ?? true
32
32
  });
33
+ linkDef.from.linkedInterfaces?.push(linkDef.toMany ?? linkDef.toOne);
33
34
  }
34
35
  function getLinkedType(t) {
35
36
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"defineInterfaceLinkConstraint.js","names":["invariant","cloneDefinition","OntologyEntityTypeEnum","importedTypes","namespace","withoutNamespace","combineApiNamespaceIfMissing","defineInterfaceLinkConstraint","linkDefInput","linkDef","INTERFACE_TYPE","from","apiName","process","env","NODE_ENV","fromLinkMeta","getLinkMeta","links","find","a","metadata","push","cardinality","toMany","linkedEntityTypeId","getLinkedType","toOne","required","t","type","interfaceType","meta","displayName","description","apiNameWithNamespace","apiNameWithoutNamespace"],"sources":["defineInterfaceLinkConstraint.ts"],"sourcesContent":["/*\n * Copyright 2024 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 invariant from \"tiny-invariant\";\nimport { cloneDefinition } from \"./cloneDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n importedTypes,\n namespace,\n withoutNamespace,\n} from \"./defineOntology.js\";\nimport type { InterfaceType } from \"./interface/InterfaceType.js\";\nimport { combineApiNamespaceIfMissing } from \"./namespace/combineApiNamespaceIfMissing.js\";\n\ntype Meta = { apiName: string; displayName?: string; description?: string };\ntype ApiNameOrInterfaceType = string | InterfaceType;\n\ntype Many = {\n apiName: string;\n from: InterfaceType;\n toMany: ApiNameOrInterfaceType;\n toOne?: never;\n displayName?: string;\n description?: string;\n required?: boolean;\n};\ntype One = {\n apiName: string;\n from: InterfaceType;\n toOne: ApiNameOrInterfaceType;\n toMany?: never;\n displayName?: string;\n description?: string;\n required?: boolean;\n};\n\nexport function defineInterfaceLinkConstraint(\n linkDefInput: One | Many,\n): void {\n const linkDef = cloneDefinition(linkDefInput);\n\n invariant(\n importedTypes[OntologyEntityTypeEnum.INTERFACE_TYPE][linkDef.from.apiName]\n == null,\n `Cannot define a link constraint from imported interface ${linkDef.from.apiName}. The \"from\" side must be a locally defined interface.`,\n );\n\n const fromLinkMeta = getLinkMeta(linkDef);\n\n invariant(\n linkDef.from.links.find(a => a.metadata.apiName === fromLinkMeta.apiName)\n == null,\n `Link with apiName ${fromLinkMeta.apiName} already exists on ${linkDef.apiName}`,\n );\n\n linkDef.from.links.push({\n cardinality: linkDef.toMany ? \"MANY\" : \"SINGLE\",\n linkedEntityTypeId: getLinkedType(linkDef.toMany ?? linkDef.toOne),\n metadata: fromLinkMeta,\n required: linkDef.required ?? true,\n });\n}\n\nfunction getLinkedType(t: string | InterfaceType) {\n return {\n type: \"interfaceType\" as const,\n interfaceType: typeof t === \"string\" ? t : t.apiName,\n };\n}\n\nfunction getLinkMeta(meta: One | Many): Required<Meta> {\n const { apiName, displayName, description } = meta;\n const apiNameWithNamespace = combineApiNamespaceIfMissing(namespace, apiName);\n const apiNameWithoutNamespace = withoutNamespace(apiNameWithNamespace);\n return {\n apiName: apiNameWithNamespace,\n displayName: displayName ?? apiNameWithoutNamespace,\n description: description ?? displayName ?? apiNameWithoutNamespace,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,aAAa,EACbC,SAAS,EACTC,gBAAgB,QACX,qBAAqB;AAE5B,SAASC,4BAA4B,QAAQ,6CAA6C;AAwB1F,OAAO,SAASC,6BAA6BA,CAC3CC,YAAwB,EAClB;EACN,MAAMC,OAAO,GAAGR,eAAe,CAACO,YAAY,CAAC;EAE7C,EACEL,aAAa,CAACD,sBAAsB,CAACQ,cAAc,CAAC,CAACD,OAAO,CAACE,IAAI,CAACC,OAAO,CAAC,IACrE,IAAI,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAFXf,SAAS,QAGP,2DAA2DS,OAAO,CAACE,IAAI,CAACC,OAAO,wDAAwD,IAHzIZ,SAAS;EAMT,MAAMgB,YAAY,GAAGC,WAAW,CAACR,OAAO,CAAC;EAEzC,EACEA,OAAO,CAACE,IAAI,CAACO,KAAK,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,CAACT,OAAO,KAAKI,YAAY,CAACJ,OAAO,CAAC,IACpE,IAAI,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAFXf,SAAS,QAGP,qBAAqBgB,YAAY,CAACJ,OAAO,sBAAsBH,OAAO,CAACG,OAAO,EAAE,IAHlFZ,SAAS;EAMTS,OAAO,CAACE,IAAI,CAACO,KAAK,CAACI,IAAI,CAAC;IACtBC,WAAW,EAAEd,OAAO,CAACe,MAAM,GAAG,MAAM,GAAG,QAAQ;IAC/CC,kBAAkB,EAAEC,aAAa,CAACjB,OAAO,CAACe,MAAM,IAAIf,OAAO,CAACkB,KAAK,CAAC;IAClEN,QAAQ,EAAEL,YAAY;IACtBY,QAAQ,EAAEnB,OAAO,CAACmB,QAAQ,IAAI;EAChC,CAAC,CAAC;AACJ;AAEA,SAASF,aAAaA,CAACG,CAAyB,EAAE;EAChD,OAAO;IACLC,IAAI,EAAE,eAAwB;IAC9BC,aAAa,EAAE,OAAOF,CAAC,KAAK,QAAQ,GAAGA,CAAC,GAAGA,CAAC,CAACjB;EAC/C,CAAC;AACH;AAEA,SAASK,WAAWA,CAACe,IAAgB,EAAkB;EACrD,MAAM;IAAEpB,OAAO;IAAEqB,WAAW;IAAEC;EAAY,CAAC,GAAGF,IAAI;EAClD,MAAMG,oBAAoB,GAAG7B,4BAA4B,CAACF,SAAS,EAAEQ,OAAO,CAAC;EAC7E,MAAMwB,uBAAuB,GAAG/B,gBAAgB,CAAC8B,oBAAoB,CAAC;EACtE,OAAO;IACLvB,OAAO,EAAEuB,oBAAoB;IAC7BF,WAAW,EAAEA,WAAW,IAAIG,uBAAuB;IACnDF,WAAW,EAAEA,WAAW,IAAID,WAAW,IAAIG;EAC7C,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"defineInterfaceLinkConstraint.js","names":["invariant","cloneDefinition","OntologyEntityTypeEnum","importedTypes","namespace","withoutNamespace","combineApiNamespaceIfMissing","defineInterfaceLinkConstraint","linkDefInput","linkDef","INTERFACE_TYPE","from","apiName","process","env","NODE_ENV","fromLinkMeta","getLinkMeta","links","find","a","metadata","push","cardinality","toMany","linkedEntityTypeId","getLinkedType","toOne","required","linkedInterfaces","t","type","interfaceType","meta","displayName","description","apiNameWithNamespace","apiNameWithoutNamespace"],"sources":["defineInterfaceLinkConstraint.ts"],"sourcesContent":["/*\n * Copyright 2024 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 invariant from \"tiny-invariant\";\nimport { cloneDefinition } from \"./cloneDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n importedTypes,\n namespace,\n withoutNamespace,\n} from \"./defineOntology.js\";\nimport type { InterfaceType } from \"./interface/InterfaceType.js\";\nimport { combineApiNamespaceIfMissing } from \"./namespace/combineApiNamespaceIfMissing.js\";\n\ntype Meta = { apiName: string; displayName?: string; description?: string };\ntype ApiNameOrInterfaceType = string | InterfaceType;\n\ntype Many = {\n apiName: string;\n from: InterfaceType;\n toMany: ApiNameOrInterfaceType;\n toOne?: never;\n displayName?: string;\n description?: string;\n required?: boolean;\n};\ntype One = {\n apiName: string;\n from: InterfaceType;\n toOne: ApiNameOrInterfaceType;\n toMany?: never;\n displayName?: string;\n description?: string;\n required?: boolean;\n};\n\nexport function defineInterfaceLinkConstraint(\n linkDefInput: One | Many,\n): void {\n const linkDef = cloneDefinition(linkDefInput);\n\n invariant(\n importedTypes[OntologyEntityTypeEnum.INTERFACE_TYPE][linkDef.from.apiName]\n == null,\n `Cannot define a link constraint from imported interface ${linkDef.from.apiName}. The \"from\" side must be a locally defined interface.`,\n );\n\n const fromLinkMeta = getLinkMeta(linkDef);\n\n invariant(\n linkDef.from.links.find(a => a.metadata.apiName === fromLinkMeta.apiName)\n == null,\n `Link with apiName ${fromLinkMeta.apiName} already exists on ${linkDef.apiName}`,\n );\n\n linkDef.from.links.push({\n cardinality: linkDef.toMany ? \"MANY\" : \"SINGLE\",\n linkedEntityTypeId: getLinkedType(linkDef.toMany ?? linkDef.toOne),\n metadata: fromLinkMeta,\n required: linkDef.required ?? true,\n });\n linkDef.from.linkedInterfaces?.push(linkDef.toMany ?? linkDef.toOne);\n}\n\nfunction getLinkedType(t: string | InterfaceType) {\n return {\n type: \"interfaceType\" as const,\n interfaceType: typeof t === \"string\" ? t : t.apiName,\n };\n}\n\nfunction getLinkMeta(meta: One | Many): Required<Meta> {\n const { apiName, displayName, description } = meta;\n const apiNameWithNamespace = combineApiNamespaceIfMissing(namespace, apiName);\n const apiNameWithoutNamespace = withoutNamespace(apiNameWithNamespace);\n return {\n apiName: apiNameWithNamespace,\n displayName: displayName ?? apiNameWithoutNamespace,\n description: description ?? displayName ?? apiNameWithoutNamespace,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,aAAa,EACbC,SAAS,EACTC,gBAAgB,QACX,qBAAqB;AAE5B,SAASC,4BAA4B,QAAQ,6CAA6C;AAwB1F,OAAO,SAASC,6BAA6BA,CAC3CC,YAAwB,EAClB;EACN,MAAMC,OAAO,GAAGR,eAAe,CAACO,YAAY,CAAC;EAE7C,EACEL,aAAa,CAACD,sBAAsB,CAACQ,cAAc,CAAC,CAACD,OAAO,CAACE,IAAI,CAACC,OAAO,CAAC,IACrE,IAAI,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAFXf,SAAS,QAGP,2DAA2DS,OAAO,CAACE,IAAI,CAACC,OA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AO,EAAEwB,oBAAoB;IAC7BF,WAAW,EAAEA,WAAW,IAAIG,uBAAuB;IACnDF,WAAW,EAAEA,WAAW,IAAID,WAAW,IAAIG;EAC7C,CAAC;AACH","ignoreList":[]}
@@ -122,7 +122,7 @@ export function writeStaticObjects(outputDir) {
122
122
  const entityFileNameBase = camel(withoutNamespace(apiName)) + (ontologyTypeEnumKey === OntologyEntityTypeEnum.VALUE_TYPE ? "ValueType" : "");
123
123
  const filePath = path.join(typeDirPath, `${entityFileNameBase}.ts`);
124
124
  const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);
125
- const entityJSON = JSON.stringify(entity, null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
125
+ const entityJSON = JSON.stringify(explodeInterfaceType(entity), null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
126
126
  const content = `
127
127
  import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';
128
128
  import type { ${entityTypeName} } from '@osdk/maker';
@@ -171,6 +171,44 @@ export function buildDatasource(apiName, definition, classificationMarkingGroupN
171
171
  })
172
172
  };
173
173
  }
174
+
175
+ // convert linked interface api name references to full type before codegen
176
+ export function explodeInterfaceType(entity) {
177
+ if (entity.__type === OntologyEntityTypeEnum.INTERFACE_TYPE) {
178
+ return filterCyclicReferences({
179
+ ...entity,
180
+ linkedInterfaces: (entity.linkedInterfaces ?? []).map(interfaceTypeOrApiName => typeof interfaceTypeOrApiName === "string" ? ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][interfaceTypeOrApiName] : interfaceTypeOrApiName)
181
+ });
182
+ } else {
183
+ return entity;
184
+ }
185
+ }
186
+ function filterCyclicReferences(iface, ancestors = new Set(), expanded = new Set()) {
187
+ ancestors.add(iface.apiName);
188
+ const processLinked = linked => {
189
+ if (typeof linked === "string") return linked;
190
+ if (ancestors.has(linked.apiName)) return linked.apiName;
191
+ if (expanded.has(linked.apiName)) {
192
+ const {
193
+ linkedInterfaces: _,
194
+ extendsInterfaces: __,
195
+ ...shallow
196
+ } = linked;
197
+ return {
198
+ ...shallow,
199
+ linkedInterfaces: [],
200
+ extendsInterfaces: []
201
+ };
202
+ }
203
+ return filterCyclicReferences(linked, new Set(ancestors), expanded);
204
+ };
205
+ expanded.add(iface.apiName);
206
+ return {
207
+ ...iface,
208
+ linkedInterfaces: (iface.linkedInterfaces ?? []).map(processLinked),
209
+ extendsInterfaces: iface.extendsInterfaces.map(parent => processLinked(parent))
210
+ };
211
+ }
174
212
  export function cleanAndValidateLinkTypeId(apiName) {
175
213
  // Insert a dash before any uppercase letter that follows a lowercase letter or digit
176
214
  const step1 = apiName.replace(/([a-z0-9])([A-Z])/g, "$1-$2");
@@ -269,6 +307,7 @@ export function convertAction(action) {
269
307
  message: action.submissionMetadata.successMessage
270
308
  }] : [],
271
309
  typeClasses: action.typeClasses ?? [],
310
+ applyingMessage: [],
272
311
  ...(action.submissionMetadata?.submitButtonDisplayMetadata && {
273
312
  submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
274
313
  }),
@@ -276,7 +315,7 @@ export function convertAction(action) {
276
315
  undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
277
316
  })
278
317
  },
279
- parameterOrdering: parameterOrdering,
318
+ parameterOrdering,
280
319
  formContentOrdering: getFormContentOrdering(action, parameterOrdering),
281
320
  parameters: actionParameters,
282
321
  sections: actionSections,
@@ -341,14 +380,14 @@ export function extractAllowedValues(allowedValues) {
341
380
  type: "text",
342
381
  text: {
343
382
  ...(minLength === undefined ? {} : {
344
- minLength: minLength
383
+ minLength
345
384
  }),
346
385
  ...(maxLength === undefined ? {} : {
347
- maxLength: maxLength
386
+ maxLength
348
387
  }),
349
388
  ...(regex === undefined ? {} : {
350
389
  regex: {
351
- regex: regex,
390
+ regex,
352
391
  failureMessage: "Invalid input"
353
392
  }
354
393
  })
@@ -1 +1 @@
1
- {"version":3,"file":"defineOntology.js","names":["fs","path","convertActionParameters","convertActionSections","convertActionValidation","convertOntologyDefinition","convertOntologyToValueTypeIr","getFormContentOrdering","createCodeSnippets","OntologyEntityTypeEnum","ontologyDefinition","importedTypes","dependencies","namespace","updateOntology","entity","__type","VALUE_TYPE","apiName","undefined","push","defineOntology","ns","body","outputDir","dependencyFile","codeSnippetFiles","snippetPackageName","snippetFileOutputDir","randomnessKey","OBJECT_TYPE","ACTION_TYPE","LINK_TYPE","INTERFACE_TYPE","SHARED_PROPERTY_TYPE","e","console","error","writeStaticObjects","writeDependencyFile","codegenDir","resolve","typeDirs","existsSync","mkdirSync","recursive","Object","values","forEach","typeDirNameFromMap","currentTypeDirPath","join","rmSync","force","topLevelExportStatements","entries","ontologyTypeEnumKey","entities","typeDirName","typeDirPath","entityModuleNames","entityFileNameBase","camel","withoutNamespace","filePath","entityTypeName","getEntityTypeName","entityJSON","JSON","stringify","replace","_","prefix","value","content","slice","writeFileSync","flag","entityModuleName","length","mainIndexContent","dependencyInjectionString","mainIndexFilePath","buildDatasource","definition","classificationMarkingGroupName","mandatoryMarkingGroupName","needsSecurity","securityConfig","classificationConstraint","markingGroupName","markingConstraint","datasourceName","datasource","editsConfiguration","onlyAllowPrivilegedEdits","redacted","dataSecurity","cleanAndValidateLinkTypeId","step1","linkTypeId","toLowerCase","test","Error","dumpOntologyFullMetadata","dumpValueTypeWireType","convertObjectStatus","status","type","active","experimental","example","deprecated","message","deadline","replacedBy","convertAction","action","actionValidation","actionParameters","actionSections","parameterOrdering","parameters","map","p","id","actionType","actionTypeLogic","logic","rules","validation","metadata","displayMetadata","configuration","defaultLayout","defaultFormat","displayAndFormat","table","columnWidthByParameterRid","enableFileImport","fitHorizontally","frozenColumnCount","rowHeightInLines","enableLayoutUserSwitch","enableLayoutSwitch","description","displayName","icon","blueprint","locator","color","successMessage","submissionMetadata","typeClasses","submitButtonDisplayMetadata","undoButtonConfiguration","formContentOrdering","sections","extractAllowedValues","allowedValues","oneOf","labelledValues","otherValueAllowed","allowed","min","max","range","minimum","inclusive","maximum","minLength","maxLength","regex","text","failureMessage","datetime","objectTypeReference","interfaceTypeRids","interfaceTypes","geotimeSeriesReference","geotimeSeries","user","filter","fromGroups","group","groupFilter","groupId","staticValue","string","name","parameterId","parameter","multipassGroup","k","renderHintFromBaseType","checkbox","numericInput","userDropdown","textInput","dateTimePicker","filePicker","mandatoryMarkingPicker","cbacMarkingPicker","dropdown","extractNamespace","substring","lastIndexOf","lastDot","str","result","c","toUpperCase","charAt","namespaceNoDot","endsWith","addNamespaceIfNone","includes","initializeOntologyState","getOntologyDefinition","getImportedTypes","getNamespace"],"sources":["defineOntology.ts"],"sourcesContent":["/*\n * Copyright 2024 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 ActionTypeStatus,\n OntologyIr,\n OntologyIrActionTypeBlockDataV2,\n OntologyIrAllowedParameterValues,\n OntologyIrObjectTypeDatasource,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrParameter,\n OntologyIrSection,\n OntologyIrValueTypeBlockData,\n ParameterId,\n ParameterRenderHint,\n SectionId,\n} from \"@osdk/client.unstable\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { convertActionParameters } from \"../conversion/toMarketplace/convertActionParameters.js\";\nimport { convertActionSections } from \"../conversion/toMarketplace/convertActionSections.js\";\nimport { convertActionValidation } from \"../conversion/toMarketplace/convertActionValidation.js\";\nimport { convertOntologyDefinition } from \"../conversion/toMarketplace/convertOntologyDefinition.js\";\nimport { convertOntologyToValueTypeIr } from \"../conversion/toMarketplace/convertOntologyToValueTypeIr.js\";\nimport { getFormContentOrdering } from \"../conversion/toMarketplace/getFormContentOrdering.js\";\nimport type {\n ActionParameter,\n ActionParameterValidation,\n} from \"./action/ActionParameter.js\";\nimport type { ActionParameterAllowedValues } from \"./action/ActionParameterAllowedValues.js\";\nimport type { ActionType } from \"./action/ActionType.js\";\nimport { createCodeSnippets } from \"./code-snippets/createCodeSnippets.js\";\nimport type { OntologyDefinition } from \"./common/OntologyDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport type { OntologyEntityType } from \"./common/OntologyEntityTypeMapping.js\";\n\n// type -> apiName -> entity\n/** @internal */\nexport let ontologyDefinition: OntologyDefinition;\n\n// type -> apiName -> entity\n/** @internal */\nexport let importedTypes: OntologyDefinition;\n\n// namespace -> version\n/** @internal */\nexport let dependencies: Record<string, string>;\n\n/** @internal */\nexport let namespace: string;\n\nexport function updateOntology<\n T extends OntologyEntityType,\n>(\n entity: T,\n): void {\n if (entity.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {\n ontologyDefinition[entity.__type][entity.apiName] = entity;\n return;\n }\n // value types are a special case\n if (\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName]\n === undefined\n ) {\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] = [];\n }\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName]\n .push(entity);\n}\n\nexport async function defineOntology(\n ns: string,\n body: () => void | Promise<void>,\n outputDir: string | undefined,\n dependencyFile?: string,\n codeSnippetFiles?: boolean,\n snippetPackageName?: string,\n snippetFileOutputDir?: string,\n randomnessKey?: string,\n): Promise<OntologyIr> {\n namespace = ns;\n dependencies = {};\n ontologyDefinition = {\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n SHARED_PROPERTY_TYPE: {},\n VALUE_TYPE: {},\n };\n importedTypes = {\n SHARED_PROPERTY_TYPE: {},\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n VALUE_TYPE: {},\n };\n try {\n await body();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected error while processing the body of the ontology\",\n e,\n );\n throw e;\n }\n if (outputDir) {\n writeStaticObjects(outputDir);\n }\n if (dependencyFile) {\n writeDependencyFile(dependencyFile);\n }\n if (codeSnippetFiles) {\n createCodeSnippets(\n ontologyDefinition,\n snippetPackageName,\n snippetFileOutputDir,\n );\n }\n\n return convertOntologyDefinition(ontologyDefinition, randomnessKey);\n}\n\nexport function writeStaticObjects(outputDir: string): void {\n const codegenDir = path.resolve(outputDir, \"codegen\");\n const typeDirs = {\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"shared-property-types\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"action-types\",\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"object-types\",\n [OntologyEntityTypeEnum.LINK_TYPE]: \"link-types\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"interface-types\",\n [OntologyEntityTypeEnum.VALUE_TYPE]: \"value-types\",\n };\n\n if (!fs.existsSync(codegenDir)) {\n fs.mkdirSync(codegenDir, { recursive: true });\n }\n\n Object.values(typeDirs).forEach(typeDirNameFromMap => {\n const currentTypeDirPath = path.join(codegenDir, typeDirNameFromMap);\n if (fs.existsSync(currentTypeDirPath)) {\n fs.rmSync(currentTypeDirPath, { recursive: true, force: true });\n }\n fs.mkdirSync(currentTypeDirPath, { recursive: true });\n });\n\n const topLevelExportStatements: string[] = [];\n\n Object.entries(ontologyDefinition).forEach(\n ([ontologyTypeEnumKey, entities]) => {\n const typeDirName =\n typeDirs[ontologyTypeEnumKey as OntologyEntityTypeEnum];\n\n const typeDirPath = path.join(codegenDir, typeDirName);\n const entityModuleNames: string[] = [];\n\n Object.entries(entities).forEach(\n ([apiName, entity]: [string, OntologyEntityType]) => {\n const entityFileNameBase = camel(withoutNamespace(apiName))\n + (ontologyTypeEnumKey as OntologyEntityTypeEnum\n === OntologyEntityTypeEnum.VALUE_TYPE\n ? \"ValueType\"\n : \"\");\n const filePath = path.join(typeDirPath, `${entityFileNameBase}.ts`);\n const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);\n const entityJSON = JSON.stringify(entity, null, 2).replace(\n /(\"__type\"\\s*:\\s*)\"([^\"]*)\"/g,\n (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`,\n );\n const content = `\nimport { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\nimport type { ${entityTypeName} } from '@osdk/maker';\n\n/** @type {import('@osdk/maker').${entityTypeName}} */\nconst ${entityFileNameBase}_base: ${entityTypeName} = ${\n ontologyTypeEnumKey === \"VALUE_TYPE\"\n ? entityJSON.slice(1, -2)\n : entityJSON\n } as unknown as ${entityTypeName};\n \nexport const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFileNameBase}_base);\n `;\n fs.writeFileSync(filePath, content, { flag: \"w\" });\n entityModuleNames.push(entityFileNameBase);\n },\n );\n\n for (const entityModuleName of entityModuleNames) {\n topLevelExportStatements.push(\n `export { ${entityModuleName} } from \"./codegen/${typeDirName}/${entityModuleName}.js\";`,\n );\n }\n },\n );\n\n if (topLevelExportStatements.length > 0) {\n const mainIndexContent = dependencyInjectionString()\n + topLevelExportStatements.join(\"\\n\") + \"\\n\";\n const mainIndexFilePath = path.join(outputDir, \"index.ts\");\n fs.writeFileSync(mainIndexFilePath, mainIndexContent, { flag: \"w\" });\n }\n}\n\nexport function buildDatasource(\n apiName: string,\n definition: OntologyIrObjectTypeDatasourceDefinition,\n classificationMarkingGroupName?: string,\n mandatoryMarkingGroupName?: string,\n): OntologyIrObjectTypeDatasource {\n const needsSecurity = classificationMarkingGroupName !== undefined\n || mandatoryMarkingGroupName !== undefined;\n\n const securityConfig = needsSecurity\n ? {\n classificationConstraint: classificationMarkingGroupName\n ? {\n markingGroupName: classificationMarkingGroupName,\n }\n : undefined,\n markingConstraint: mandatoryMarkingGroupName\n ? {\n markingGroupName: mandatoryMarkingGroupName,\n }\n : undefined,\n }\n : undefined;\n return ({\n datasourceName: apiName,\n datasource: definition,\n editsConfiguration: {\n onlyAllowPrivilegedEdits: false,\n },\n redacted: false,\n ...((securityConfig !== undefined) && { dataSecurity: securityConfig }),\n });\n}\n\nexport function cleanAndValidateLinkTypeId(apiName: string): string {\n // Insert a dash before any uppercase letter that follows a lowercase letter or digit\n const step1 = apiName.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\");\n // Insert a dash after a sequence of uppercase letters when followed by a lowercase letter\n // then convert the whole string to lowercase\n // e.g., apiName, APIname, and apiNAME will all be converted to api-name\n const linkTypeId = step1.replace(/([A-Z])([A-Z][a-z])/g, \"$1-$2\")\n .toLowerCase();\n\n const VALIDATION_PATTERN = /^([a-z][a-z0-9\\-]*)$/;\n if (!VALIDATION_PATTERN.test(linkTypeId)) {\n throw new Error(\n `LinkType id '${linkTypeId}' must be lower case with dashes.`,\n );\n }\n return linkTypeId;\n}\n\nexport function dumpOntologyFullMetadata(): OntologyIr {\n return convertOntologyDefinition(ontologyDefinition);\n}\n\nexport function dumpValueTypeWireType(): OntologyIrValueTypeBlockData {\n return convertOntologyToValueTypeIr(ontologyDefinition);\n}\n\nexport function convertObjectStatus(status: any): any {\n if (status === undefined) {\n return {\n type: \"active\",\n active: {},\n };\n }\n\n if (status === \"active\") {\n return {\n type: \"active\",\n active: {},\n };\n }\n\n if (status === \"experimental\") {\n return {\n type: \"experimental\",\n experimental: {},\n };\n }\n\n if (status === \"example\") {\n return {\n type: \"example\",\n example: {},\n };\n }\n\n if (typeof status === \"object\" && status.type === \"deprecated\") {\n return {\n type: \"deprecated\",\n deprecated: {\n message: status.message,\n deadline: status.deadline,\n replacedBy: undefined,\n },\n };\n }\n\n return status;\n}\n\nexport function convertAction(\n action: ActionType,\n): OntologyIrActionTypeBlockDataV2 {\n const actionValidation = convertActionValidation(action);\n const actionParameters: Record<ParameterId, OntologyIrParameter> =\n convertActionParameters(action);\n const actionSections: Record<SectionId, OntologyIrSection> =\n convertActionSections(action);\n const parameterOrdering = action.parameterOrdering\n ?? (action.parameters ?? []).map(p => p.id);\n return {\n actionType: {\n actionTypeLogic: {\n logic: {\n rules: action.rules,\n },\n validation: actionValidation,\n },\n metadata: {\n apiName: action.apiName,\n displayMetadata: {\n configuration: {\n defaultLayout: action.defaultFormat ?? \"FORM\",\n displayAndFormat: action.displayAndFormat ?? {\n table: {\n columnWidthByParameterRid: {},\n enableFileImport: true,\n fitHorizontally: false,\n frozenColumnCount: 0,\n rowHeightInLines: 1,\n },\n },\n enableLayoutUserSwitch: action.enableLayoutSwitch ?? false,\n },\n description: action.description ?? \"\",\n displayName: action.displayName,\n icon: {\n type: \"blueprint\",\n blueprint: action.icon ?? { locator: \"edit\", color: \"#000000\" },\n },\n successMessage: action.submissionMetadata?.successMessage\n ? [{\n type: \"message\",\n message: action.submissionMetadata.successMessage,\n }]\n : [],\n typeClasses: action.typeClasses ?? [],\n ...(action.submissionMetadata?.submitButtonDisplayMetadata\n && {\n submitButtonDisplayMetadata:\n action.submissionMetadata.submitButtonDisplayMetadata,\n }),\n ...(action.submissionMetadata?.undoButtonConfiguration\n && {\n undoButtonConfiguration:\n action.submissionMetadata.undoButtonConfiguration,\n }),\n },\n parameterOrdering: parameterOrdering,\n formContentOrdering: getFormContentOrdering(action, parameterOrdering),\n parameters: actionParameters,\n sections: actionSections,\n status: typeof action.status === \"string\"\n ? {\n type: action.status,\n [action.status]: {},\n } as unknown as ActionTypeStatus\n : action.status,\n entities: action.entities,\n },\n },\n };\n}\n\nexport function extractAllowedValues(\n allowedValues: ActionParameterAllowedValues,\n): OntologyIrAllowedParameterValues {\n switch (allowedValues.type) {\n case \"oneOf\":\n return {\n type: \"oneOf\",\n oneOf: {\n type: \"oneOf\",\n oneOf: {\n labelledValues: allowedValues.oneOf,\n otherValueAllowed: {\n allowed: allowedValues.otherValueAllowed\n ?? false,\n },\n },\n },\n };\n case \"range\":\n const { min, max } = allowedValues;\n return {\n type: \"range\",\n range: {\n type: \"range\",\n range: {\n ...(min === undefined\n ? {}\n : { minimum: { inclusive: true, value: min } }),\n ...(max === undefined\n ? {}\n : { maximum: { inclusive: true, value: max } }),\n },\n },\n };\n case \"text\":\n const { minLength, maxLength, regex } = allowedValues;\n return {\n type: \"text\",\n text: {\n type: \"text\",\n text: {\n ...(minLength === undefined\n ? {}\n : { minLength: minLength }),\n ...(maxLength === undefined\n ? {}\n : { maxLength: maxLength }),\n ...(regex === undefined\n ? {}\n : { regex: { regex: regex, failureMessage: \"Invalid input\" } }),\n },\n },\n };\n case \"datetime\":\n const { minimum, maximum } = allowedValues;\n return {\n type: \"datetime\",\n datetime: {\n type: \"datetime\",\n datetime: {\n minimum,\n maximum,\n },\n },\n };\n case \"objectTypeReference\":\n return {\n type: \"objectTypeReference\",\n objectTypeReference: {\n type: \"objectTypeReference\",\n objectTypeReference: {\n interfaceTypeRids: allowedValues.interfaceTypes,\n },\n },\n };\n case \"redacted\":\n return {\n type: \"redacted\",\n redacted: {},\n };\n case \"geotimeSeriesReference\":\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {\n type: \"geotimeSeries\",\n geotimeSeries: {},\n },\n };\n case \"user\":\n return {\n type: \"user\",\n user: {\n type: \"user\",\n user: {\n filter: (allowedValues.fromGroups ?? []).map(group => {\n return {\n type: \"groupFilter\",\n groupFilter: {\n groupId: group.type === \"static\"\n ? {\n type: \"staticValue\",\n staticValue: {\n type: \"string\",\n string: group.name,\n },\n }\n : {\n type: \"parameterId\",\n parameterId: group.parameter,\n },\n },\n };\n }),\n },\n },\n };\n case \"multipassGroup\":\n return {\n type: \"multipassGroup\",\n multipassGroup: {\n type: \"group\",\n group: {},\n },\n };\n default:\n const k: Partial<OntologyIrAllowedParameterValues[\"type\"]> =\n allowedValues.type;\n return {\n type: k,\n [k]: {\n type: k,\n [k]: {},\n },\n } as unknown as OntologyIrAllowedParameterValues;\n // TODO(dpaquin): there's probably a TS clean way to do this\n }\n}\n\nexport function renderHintFromBaseType(\n parameter: ActionParameter,\n validation?: ActionParameterValidation,\n): ParameterRenderHint {\n // TODO(dpaquin): these are just guesses, we should find where they're actually defined\n const type = typeof parameter.type === \"string\"\n ? parameter.type\n : parameter.type.type;\n switch (type) {\n case \"boolean\":\n case \"booleanList\":\n return { type: \"checkbox\", checkbox: {} };\n case \"integer\":\n case \"integerList\":\n case \"long\":\n case \"longList\":\n case \"double\":\n case \"doubleList\":\n case \"decimal\":\n case \"decimalList\":\n return { type: \"numericInput\", numericInput: {} };\n case \"string\":\n if (\n validation?.allowedValues?.type === \"user\"\n || validation?.allowedValues?.type === \"multipassGroup\"\n ) {\n return { type: \"userDropdown\", userDropdown: {} };\n }\n case \"stringList\":\n case \"geohash\":\n case \"geohashList\":\n case \"geoshape\":\n case \"geoshapeList\":\n case \"objectSetRid\":\n return { type: \"textInput\", textInput: {} };\n case \"timestamp\":\n case \"timestampList\":\n case \"date\":\n case \"dateList\":\n return { type: \"dateTimePicker\", dateTimePicker: {} };\n case \"attachment\":\n case \"attachmentList\":\n return { type: \"filePicker\", filePicker: {} };\n case \"marking\":\n case \"markingList\":\n if (parameter.validation.allowedValues?.type === \"mandatoryMarking\") {\n return { type: \"mandatoryMarkingPicker\", mandatoryMarkingPicker: {} };\n } else if (parameter.validation.allowedValues?.type === \"cbacMarking\") {\n return { type: \"cbacMarkingPicker\", cbacMarkingPicker: {} };\n } else {\n throw new Error(\n `The allowed values for \"${parameter.displayName}\" are not compatible with the base parameter type`,\n );\n }\n case \"timeSeriesReference\":\n case \"objectReference\":\n case \"objectReferenceList\":\n case \"interfaceReference\":\n case \"interfaceReferenceList\":\n case \"objectTypeReference\":\n case \"mediaReference\":\n case \"mediaReferenceList\":\n case \"geotimeSeriesReference\":\n case \"geotimeSeriesReferenceList\":\n return { type: \"dropdown\", dropdown: {} };\n case \"struct\":\n case \"structList\":\n throw new Error(\"Structs are not supported yet\");\n default:\n throw new Error(`Unknown type ${type}`);\n }\n}\n\nexport function extractNamespace(apiName: string): string {\n return apiName.substring(0, apiName.lastIndexOf(\".\") + 1);\n}\n\nexport function withoutNamespace(apiName: string): string {\n const lastDot = apiName.lastIndexOf(\".\");\n if (lastDot === -1) {\n return apiName;\n }\n return apiName.substring(lastDot + 1);\n}\n\nfunction camel(str: string): string {\n if (!str) {\n return str;\n }\n let result = str.replace(/[-_]+(.)?/g, (_, c) => (c ? c.toUpperCase() : \"\"));\n result = result.charAt(0).toLowerCase() + result.slice(1);\n return result;\n}\n\n/**\n * Gets the TypeScript type name corresponding to an OntologyEntityTypeEnum value\n */\nfunction getEntityTypeName(type: string): string {\n return {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"ObjectType\",\n [OntologyEntityTypeEnum.LINK_TYPE]: \"LinkType\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"InterfaceType\",\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"SharedPropertyType\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"ActionType\",\n [OntologyEntityTypeEnum.VALUE_TYPE]: \"ValueTypeDefinitionVersion\",\n }[type]!;\n}\n\nfunction writeDependencyFile(dependencyFile: string): void {\n fs.writeFileSync(dependencyFile, JSON.stringify(dependencies, null, 2));\n}\n\nfunction dependencyInjectionString(): string {\n const namespaceNoDot: string = namespace.endsWith(\".\")\n ? namespace.slice(0, -1)\n : namespace;\n\n return `import { addDependency } from \"@osdk/maker\";\n// @ts-ignore\naddDependency(\"${namespaceNoDot}\", new URL(import.meta.url).pathname);\n`;\n}\n\nexport function addNamespaceIfNone(apiName: string): string {\n return apiName.includes(\".\") ? apiName : namespace + apiName;\n}\n\nexport function initializeOntologyState(ns: string): void {\n namespace = ns;\n dependencies = {};\n ontologyDefinition = {\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n SHARED_PROPERTY_TYPE: {},\n VALUE_TYPE: {},\n };\n importedTypes = {\n SHARED_PROPERTY_TYPE: {},\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n VALUE_TYPE: {},\n };\n}\n\nexport function getOntologyDefinition(): OntologyDefinition {\n return ontologyDefinition;\n}\n\nexport function getImportedTypes(): OntologyDefinition {\n return importedTypes;\n}\n\nexport function getNamespace(): string {\n return namespace;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAO,KAAKA,EAAE,MAAM,IAAI;AACxB,OAAO,KAAKC,IAAI,MAAM,MAAM;AAC5B,SAASC,uBAAuB,QAAQ,wDAAwD;AAChG,SAASC,qBAAqB,QAAQ,sDAAsD;AAC5F,SAASC,uBAAuB,QAAQ,wDAAwD;AAChG,SAASC,yBAAyB,QAAQ,0DAA0D;AACpG,SAASC,4BAA4B,QAAQ,6DAA6D;AAC1G,SAASC,sBAAsB,QAAQ,uDAAuD;AAO9F,SAASC,kBAAkB,QAAQ,uCAAuC;AAE1E,SAASC,sBAAsB,QAAQ,oCAAoC;AAG3E;AACA;AACA,OAAO,IAAIC,kBAAsC;;AAEjD;AACA;AACA,OAAO,IAAIC,aAAiC;;AAE5C;AACA;AACA,OAAO,IAAIC,YAAoC;;AAE/C;AACA,OAAO,IAAIC,SAAiB;AAE5B,OAAO,SAASC,cAAcA,CAG5BC,MAAS,EACH;EACN,IAAIA,MAAM,CAACC,MAAM,KAAKP,sBAAsB,CAACQ,UAAU,EAAE;IACvDP,kBAAkB,CAACK,MAAM,CAACC,MAAM,CAAC,CAACD,MAAM,CAACG,OAAO,CAAC,GAAGH,MAAM;IAC1D;EACF;EACA;EACA,IACEL,kBAAkB,CAACD,sBAAsB,CAACQ,UAAU,CAAC,CAACF,MAAM,CAACG,OAAO,CAAC,KAC/D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AAA,EAAW;EACrC,OAAO/M,SAAS;AAClB","ignoreList":[]}
1
+ {"version":3,"file":"defineOntology.js","names":["fs","path","convertActionParameters","convertActionSections","convertActionValidation","convertOntologyDefinition","convertOntologyToValueTypeIr","getFormContentOrdering","createCodeSnippets","OntologyEntityTypeEnum","ontologyDefinition","importedTypes","dependencies","namespace","updateOntology","entity","__type","VALUE_TYPE","apiName","undefined","push","defineOntology","ns","body","outputDir","dependencyFile","codeSnippetFiles","snippetPackageName","snippetFileOutputDir","randomnessKey","OBJECT_TYPE","ACTION_TYPE","LINK_TYPE","INTERFACE_TYPE","SHARED_PROPERTY_TYPE","e","console","error","writeStaticObjects","writeDependencyFile","codegenDir","resolve","typeDirs","existsSync","mkdirSync","recursive","Object","values","forEach","typeDirNameFromMap","currentTypeDirPath","join","rmSync","force","topLevelExportStatements","entries","ontologyTypeEnumKey","entities","typeDirName","typeDirPath","entityModuleNames","entityFileNameBase","camel","withoutNamespace","filePath","entityTypeName","getEntityTypeName","entityJSON","JSON","stringify","explodeInterfaceType","replace","_","prefix","value","content","slice","writeFileSync","flag","entityModuleName","length","mainIndexContent","dependencyInjectionString","mainIndexFilePath","buildDatasource","definition","classificationMarkingGroupName","mandatoryMarkingGroupName","needsSecurity","securityConfig","classificationConstraint","markingGroupName","markingConstraint","datasourceName","datasource","editsConfiguration","onlyAllowPrivilegedEdits","redacted","dataSecurity","filterCyclicReferences","linkedInterfaces","map","interfaceTypeOrApiName","iface","ancestors","Set","expanded","add","processLinked","linked","has","extendsInterfaces","__","shallow","parent","cleanAndValidateLinkTypeId","step1","linkTypeId","toLowerCase","test","Error","dumpOntologyFullMetadata","dumpValueTypeWireType","convertObjectStatus","status","type","active","experimental","example","deprecated","message","deadline","replacedBy","convertAction","action","actionValidation","actionParameters","actionSections","parameterOrdering","parameters","p","id","actionType","actionTypeLogic","logic","rules","validation","metadata","displayMetadata","configuration","defaultLayout","defaultFormat","displayAndFormat","table","columnWidthByParameterRid","enableFileImport","fitHorizontally","frozenColumnCount","rowHeightInLines","enableLayoutUserSwitch","enableLayoutSwitch","description","displayName","icon","blueprint","locator","color","successMessage","submissionMetadata","typeClasses","applyingMessage","submitButtonDisplayMetadata","undoButtonConfiguration","formContentOrdering","sections","extractAllowedValues","allowedValues","oneOf","labelledValues","otherValueAllowed","allowed","min","max","range","minimum","inclusive","maximum","minLength","maxLength","regex","text","failureMessage","datetime","objectTypeReference","interfaceTypeRids","interfaceTypes","geotimeSeriesReference","geotimeSeries","user","filter","fromGroups","group","groupFilter","groupId","staticValue","string","name","parameterId","parameter","multipassGroup","k","renderHintFromBaseType","checkbox","numericInput","userDropdown","textInput","dateTimePicker","filePicker","mandatoryMarkingPicker","cbacMarkingPicker","dropdown","extractNamespace","substring","lastIndexOf","lastDot","str","result","c","toUpperCase","charAt","namespaceNoDot","endsWith","addNamespaceIfNone","includes","initializeOntologyState","getOntologyDefinition","getImportedTypes","getNamespace"],"sources":["defineOntology.ts"],"sourcesContent":["/*\n * Copyright 2024 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 ActionTypeStatus,\n OntologyIr,\n OntologyIrActionTypeBlockDataV2,\n OntologyIrAllowedParameterValues,\n OntologyIrObjectTypeDatasource,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrParameter,\n OntologyIrSection,\n OntologyIrValueTypeBlockData,\n ParameterId,\n ParameterRenderHint,\n SectionId,\n} from \"@osdk/client.unstable\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { convertActionParameters } from \"../conversion/toMarketplace/convertActionParameters.js\";\nimport { convertActionSections } from \"../conversion/toMarketplace/convertActionSections.js\";\nimport { convertActionValidation } from \"../conversion/toMarketplace/convertActionValidation.js\";\nimport { convertOntologyDefinition } from \"../conversion/toMarketplace/convertOntologyDefinition.js\";\nimport { convertOntologyToValueTypeIr } from \"../conversion/toMarketplace/convertOntologyToValueTypeIr.js\";\nimport { getFormContentOrdering } from \"../conversion/toMarketplace/getFormContentOrdering.js\";\nimport type {\n ActionParameter,\n ActionParameterValidation,\n} from \"./action/ActionParameter.js\";\nimport type { ActionParameterAllowedValues } from \"./action/ActionParameterAllowedValues.js\";\nimport type { ActionType } from \"./action/ActionType.js\";\nimport { createCodeSnippets } from \"./code-snippets/createCodeSnippets.js\";\nimport type { OntologyDefinition } from \"./common/OntologyDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport type { OntologyEntityType } from \"./common/OntologyEntityTypeMapping.js\";\nimport type { InterfaceType } from \"./interface/InterfaceType.js\";\n\n// type -> apiName -> entity\n/** @internal */\nexport let ontologyDefinition: OntologyDefinition;\n\n// type -> apiName -> entity\n/** @internal */\nexport let importedTypes: OntologyDefinition;\n\n// namespace -> version\n/** @internal */\nexport let dependencies: Record<string, string>;\n\n/** @internal */\nexport let namespace: string;\n\nexport function updateOntology<\n T extends OntologyEntityType,\n>(\n entity: T,\n): void {\n if (entity.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {\n ontologyDefinition[entity.__type][entity.apiName] = entity;\n return;\n }\n // value types are a special case\n if (\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName]\n === undefined\n ) {\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] = [];\n }\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName]\n .push(entity);\n}\n\nexport async function defineOntology(\n ns: string,\n body: () => void | Promise<void>,\n outputDir: string | undefined,\n dependencyFile?: string,\n codeSnippetFiles?: boolean,\n snippetPackageName?: string,\n snippetFileOutputDir?: string,\n randomnessKey?: string,\n): Promise<OntologyIr> {\n namespace = ns;\n dependencies = {};\n ontologyDefinition = {\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n SHARED_PROPERTY_TYPE: {},\n VALUE_TYPE: {},\n };\n importedTypes = {\n SHARED_PROPERTY_TYPE: {},\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n VALUE_TYPE: {},\n };\n try {\n await body();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected error while processing the body of the ontology\",\n e,\n );\n throw e;\n }\n if (outputDir) {\n writeStaticObjects(outputDir);\n }\n if (dependencyFile) {\n writeDependencyFile(dependencyFile);\n }\n if (codeSnippetFiles) {\n createCodeSnippets(\n ontologyDefinition,\n snippetPackageName,\n snippetFileOutputDir,\n );\n }\n\n return convertOntologyDefinition(ontologyDefinition, randomnessKey);\n}\n\nexport function writeStaticObjects(outputDir: string): void {\n const codegenDir = path.resolve(outputDir, \"codegen\");\n const typeDirs = {\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"shared-property-types\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"action-types\",\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"object-types\",\n [OntologyEntityTypeEnum.LINK_TYPE]: \"link-types\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"interface-types\",\n [OntologyEntityTypeEnum.VALUE_TYPE]: \"value-types\",\n };\n\n if (!fs.existsSync(codegenDir)) {\n fs.mkdirSync(codegenDir, { recursive: true });\n }\n\n Object.values(typeDirs).forEach(typeDirNameFromMap => {\n const currentTypeDirPath = path.join(codegenDir, typeDirNameFromMap);\n if (fs.existsSync(currentTypeDirPath)) {\n fs.rmSync(currentTypeDirPath, { recursive: true, force: true });\n }\n fs.mkdirSync(currentTypeDirPath, { recursive: true });\n });\n\n const topLevelExportStatements: string[] = [];\n\n Object.entries(ontologyDefinition).forEach(\n ([ontologyTypeEnumKey, entities]) => {\n const typeDirName =\n typeDirs[ontologyTypeEnumKey as OntologyEntityTypeEnum];\n\n const typeDirPath = path.join(codegenDir, typeDirName);\n const entityModuleNames: string[] = [];\n\n Object.entries(entities).forEach(\n ([apiName, entity]: [string, OntologyEntityType]) => {\n const entityFileNameBase = camel(withoutNamespace(apiName))\n + (ontologyTypeEnumKey as OntologyEntityTypeEnum\n === OntologyEntityTypeEnum.VALUE_TYPE\n ? \"ValueType\"\n : \"\");\n const filePath = path.join(typeDirPath, `${entityFileNameBase}.ts`);\n const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);\n const entityJSON = JSON.stringify(\n explodeInterfaceType(entity),\n null,\n 2,\n ).replace(\n /(\"__type\"\\s*:\\s*)\"([^\"]*)\"/g,\n (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`,\n );\n const content = `\nimport { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\nimport type { ${entityTypeName} } from '@osdk/maker';\n\n/** @type {import('@osdk/maker').${entityTypeName}} */\nconst ${entityFileNameBase}_base: ${entityTypeName} = ${\n ontologyTypeEnumKey === \"VALUE_TYPE\"\n ? entityJSON.slice(1, -2)\n : entityJSON\n } as unknown as ${entityTypeName};\n \nexport const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFileNameBase}_base);\n `;\n fs.writeFileSync(filePath, content, { flag: \"w\" });\n entityModuleNames.push(entityFileNameBase);\n },\n );\n\n for (const entityModuleName of entityModuleNames) {\n topLevelExportStatements.push(\n `export { ${entityModuleName} } from \"./codegen/${typeDirName}/${entityModuleName}.js\";`,\n );\n }\n },\n );\n\n if (topLevelExportStatements.length > 0) {\n const mainIndexContent = dependencyInjectionString()\n + topLevelExportStatements.join(\"\\n\") + \"\\n\";\n const mainIndexFilePath = path.join(outputDir, \"index.ts\");\n fs.writeFileSync(mainIndexFilePath, mainIndexContent, { flag: \"w\" });\n }\n}\n\nexport function buildDatasource(\n apiName: string,\n definition: OntologyIrObjectTypeDatasourceDefinition,\n classificationMarkingGroupName?: string,\n mandatoryMarkingGroupName?: string,\n): OntologyIrObjectTypeDatasource {\n const needsSecurity = classificationMarkingGroupName !== undefined\n || mandatoryMarkingGroupName !== undefined;\n\n const securityConfig = needsSecurity\n ? {\n classificationConstraint: classificationMarkingGroupName\n ? {\n markingGroupName: classificationMarkingGroupName,\n }\n : undefined,\n markingConstraint: mandatoryMarkingGroupName\n ? {\n markingGroupName: mandatoryMarkingGroupName,\n }\n : undefined,\n }\n : undefined;\n return ({\n datasourceName: apiName,\n datasource: definition,\n editsConfiguration: {\n onlyAllowPrivilegedEdits: false,\n },\n redacted: false,\n ...((securityConfig !== undefined) && { dataSecurity: securityConfig }),\n });\n}\n\n// convert linked interface api name references to full type before codegen\nexport function explodeInterfaceType(\n entity: OntologyEntityType,\n): OntologyEntityType {\n if (entity.__type === OntologyEntityTypeEnum.INTERFACE_TYPE) {\n return filterCyclicReferences({\n ...entity,\n linkedInterfaces: (entity.linkedInterfaces ?? []).map(\n interfaceTypeOrApiName =>\n typeof interfaceTypeOrApiName === \"string\"\n ? ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][\n interfaceTypeOrApiName\n ]\n : interfaceTypeOrApiName,\n ),\n });\n } else {\n return entity;\n }\n}\n\nfunction filterCyclicReferences(\n iface: InterfaceType,\n ancestors = new Set<string>(),\n expanded = new Set<string>(),\n): InterfaceType {\n ancestors.add(iface.apiName);\n\n const processLinked = (\n linked: InterfaceType | string,\n ): InterfaceType | string => {\n if (typeof linked === \"string\") return linked;\n if (ancestors.has(linked.apiName)) return linked.apiName;\n if (expanded.has(linked.apiName)) {\n const { linkedInterfaces: _, extendsInterfaces: __, ...shallow } = linked;\n return {\n ...shallow,\n linkedInterfaces: [],\n extendsInterfaces: [],\n } as InterfaceType;\n }\n return filterCyclicReferences(linked, new Set(ancestors), expanded);\n };\n\n expanded.add(iface.apiName);\n return {\n ...iface,\n linkedInterfaces: (iface.linkedInterfaces ?? []).map(processLinked),\n extendsInterfaces: iface.extendsInterfaces.map(\n parent => processLinked(parent) as InterfaceType,\n ),\n };\n}\n\nexport function cleanAndValidateLinkTypeId(apiName: string): string {\n // Insert a dash before any uppercase letter that follows a lowercase letter or digit\n const step1 = apiName.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\");\n // Insert a dash after a sequence of uppercase letters when followed by a lowercase letter\n // then convert the whole string to lowercase\n // e.g., apiName, APIname, and apiNAME will all be converted to api-name\n const linkTypeId = step1.replace(/([A-Z])([A-Z][a-z])/g, \"$1-$2\")\n .toLowerCase();\n\n const VALIDATION_PATTERN = /^([a-z][a-z0-9\\-]*)$/;\n if (!VALIDATION_PATTERN.test(linkTypeId)) {\n throw new Error(\n `LinkType id '${linkTypeId}' must be lower case with dashes.`,\n );\n }\n return linkTypeId;\n}\n\nexport function dumpOntologyFullMetadata(): OntologyIr {\n return convertOntologyDefinition(ontologyDefinition);\n}\n\nexport function dumpValueTypeWireType(): OntologyIrValueTypeBlockData {\n return convertOntologyToValueTypeIr(ontologyDefinition);\n}\n\nexport function convertObjectStatus(status: any): any {\n if (status === undefined) {\n return {\n type: \"active\",\n active: {},\n };\n }\n\n if (status === \"active\") {\n return {\n type: \"active\",\n active: {},\n };\n }\n\n if (status === \"experimental\") {\n return {\n type: \"experimental\",\n experimental: {},\n };\n }\n\n if (status === \"example\") {\n return {\n type: \"example\",\n example: {},\n };\n }\n\n if (typeof status === \"object\" && status.type === \"deprecated\") {\n return {\n type: \"deprecated\",\n deprecated: {\n message: status.message,\n deadline: status.deadline,\n replacedBy: undefined,\n },\n };\n }\n\n return status;\n}\n\nexport function convertAction(\n action: ActionType,\n): OntologyIrActionTypeBlockDataV2 {\n const actionValidation = convertActionValidation(action);\n const actionParameters: Record<ParameterId, OntologyIrParameter> =\n convertActionParameters(action);\n const actionSections: Record<SectionId, OntologyIrSection> =\n convertActionSections(action);\n const parameterOrdering = action.parameterOrdering\n ?? (action.parameters ?? []).map(p => p.id);\n return {\n actionType: {\n actionTypeLogic: {\n logic: {\n rules: action.rules,\n },\n validation: actionValidation,\n },\n metadata: {\n apiName: action.apiName,\n displayMetadata: {\n configuration: {\n defaultLayout: action.defaultFormat ?? \"FORM\",\n displayAndFormat: action.displayAndFormat ?? {\n table: {\n columnWidthByParameterRid: {},\n enableFileImport: true,\n fitHorizontally: false,\n frozenColumnCount: 0,\n rowHeightInLines: 1,\n },\n },\n enableLayoutUserSwitch: action.enableLayoutSwitch ?? false,\n },\n description: action.description ?? \"\",\n displayName: action.displayName,\n icon: {\n type: \"blueprint\",\n blueprint: action.icon ?? { locator: \"edit\", color: \"#000000\" },\n },\n successMessage: action.submissionMetadata?.successMessage\n ? [{\n type: \"message\",\n message: action.submissionMetadata.successMessage,\n }]\n : [],\n typeClasses: action.typeClasses ?? [],\n applyingMessage: [],\n ...(action.submissionMetadata?.submitButtonDisplayMetadata\n && {\n submitButtonDisplayMetadata:\n action.submissionMetadata.submitButtonDisplayMetadata,\n }),\n ...(action.submissionMetadata?.undoButtonConfiguration\n && {\n undoButtonConfiguration:\n action.submissionMetadata.undoButtonConfiguration,\n }),\n },\n parameterOrdering,\n formContentOrdering: getFormContentOrdering(action, parameterOrdering),\n parameters: actionParameters,\n sections: actionSections,\n status: typeof action.status === \"string\"\n ? {\n type: action.status,\n [action.status]: {},\n } as unknown as ActionTypeStatus\n : action.status,\n entities: action.entities,\n },\n },\n };\n}\n\nexport function extractAllowedValues(\n allowedValues: ActionParameterAllowedValues,\n): OntologyIrAllowedParameterValues {\n switch (allowedValues.type) {\n case \"oneOf\":\n return {\n type: \"oneOf\",\n oneOf: {\n type: \"oneOf\",\n oneOf: {\n labelledValues: allowedValues.oneOf,\n otherValueAllowed: {\n allowed: allowedValues.otherValueAllowed\n ?? false,\n },\n },\n },\n };\n case \"range\":\n const { min, max } = allowedValues;\n return {\n type: \"range\",\n range: {\n type: \"range\",\n range: {\n ...(min === undefined\n ? {}\n : { minimum: { inclusive: true, value: min } }),\n ...(max === undefined\n ? {}\n : { maximum: { inclusive: true, value: max } }),\n },\n },\n };\n case \"text\":\n const { minLength, maxLength, regex } = allowedValues;\n return {\n type: \"text\",\n text: {\n type: \"text\",\n text: {\n ...(minLength === undefined\n ? {}\n : { minLength }),\n ...(maxLength === undefined\n ? {}\n : { maxLength }),\n ...(regex === undefined\n ? {}\n : { regex: { regex, failureMessage: \"Invalid input\" } }),\n },\n },\n };\n case \"datetime\":\n const { minimum, maximum } = allowedValues;\n return {\n type: \"datetime\",\n datetime: {\n type: \"datetime\",\n datetime: {\n minimum,\n maximum,\n },\n },\n };\n case \"objectTypeReference\":\n return {\n type: \"objectTypeReference\",\n objectTypeReference: {\n type: \"objectTypeReference\",\n objectTypeReference: {\n interfaceTypeRids: allowedValues.interfaceTypes,\n },\n },\n };\n case \"redacted\":\n return {\n type: \"redacted\",\n redacted: {},\n };\n case \"geotimeSeriesReference\":\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {\n type: \"geotimeSeries\",\n geotimeSeries: {},\n },\n };\n case \"user\":\n return {\n type: \"user\",\n user: {\n type: \"user\",\n user: {\n filter: (allowedValues.fromGroups ?? []).map(group => {\n return {\n type: \"groupFilter\",\n groupFilter: {\n groupId: group.type === \"static\"\n ? {\n type: \"staticValue\",\n staticValue: {\n type: \"string\",\n string: group.name,\n },\n }\n : {\n type: \"parameterId\",\n parameterId: group.parameter,\n },\n },\n };\n }),\n },\n },\n };\n case \"multipassGroup\":\n return {\n type: \"multipassGroup\",\n multipassGroup: {\n type: \"group\",\n group: {},\n },\n };\n default:\n const k: Partial<OntologyIrAllowedParameterValues[\"type\"]> =\n allowedValues.type;\n return {\n type: k,\n [k]: {\n type: k,\n [k]: {},\n },\n } as unknown as OntologyIrAllowedParameterValues;\n // TODO(dpaquin): there's probably a TS clean way to do this\n }\n}\n\nexport function renderHintFromBaseType(\n parameter: ActionParameter,\n validation?: ActionParameterValidation,\n): ParameterRenderHint {\n // TODO(dpaquin): these are just guesses, we should find where they're actually defined\n const type = typeof parameter.type === \"string\"\n ? parameter.type\n : parameter.type.type;\n switch (type) {\n case \"boolean\":\n case \"booleanList\":\n return { type: \"checkbox\", checkbox: {} };\n case \"integer\":\n case \"integerList\":\n case \"long\":\n case \"longList\":\n case \"double\":\n case \"doubleList\":\n case \"decimal\":\n case \"decimalList\":\n return { type: \"numericInput\", numericInput: {} };\n case \"string\":\n if (\n validation?.allowedValues?.type === \"user\"\n || validation?.allowedValues?.type === \"multipassGroup\"\n ) {\n return { type: \"userDropdown\", userDropdown: {} };\n }\n case \"stringList\":\n case \"geohash\":\n case \"geohashList\":\n case \"geoshape\":\n case \"geoshapeList\":\n case \"objectSetRid\":\n return { type: \"textInput\", textInput: {} };\n case \"timestamp\":\n case \"timestampList\":\n case \"date\":\n case \"dateList\":\n return { type: \"dateTimePicker\", dateTimePicker: {} };\n case \"attachment\":\n case \"attachmentList\":\n return { type: \"filePicker\", filePicker: {} };\n case \"marking\":\n case \"markingList\":\n if (parameter.validation.allowedValues?.type === \"mandatoryMarking\") {\n return { type: \"mandatoryMarkingPicker\", mandatoryMarkingPicker: {} };\n } else if (parameter.validation.allowedValues?.type === \"cbacMarking\") {\n return { type: \"cbacMarkingPicker\", cbacMarkingPicker: {} };\n } else {\n throw new Error(\n `The allowed values for \"${parameter.displayName}\" are not compatible with the base parameter type`,\n );\n }\n case \"timeSeriesReference\":\n case \"objectReference\":\n case \"objectReferenceList\":\n case \"interfaceReference\":\n case \"interfaceReferenceList\":\n case \"objectTypeReference\":\n case \"mediaReference\":\n case \"mediaReferenceList\":\n case \"geotimeSeriesReference\":\n case \"geotimeSeriesReferenceList\":\n return { type: \"dropdown\", dropdown: {} };\n case \"struct\":\n case \"structList\":\n throw new Error(\"Structs are not supported yet\");\n default:\n throw new Error(`Unknown type ${type}`);\n }\n}\n\nexport function extractNamespace(apiName: string): string {\n return apiName.substring(0, apiName.lastIndexOf(\".\") + 1);\n}\n\nexport function withoutNamespace(apiName: string): string {\n const lastDot = apiName.lastIndexOf(\".\");\n if (lastDot === -1) {\n return apiName;\n }\n return apiName.substring(lastDot + 1);\n}\n\nfunction camel(str: string): string {\n if (!str) {\n return str;\n }\n let result = str.replace(/[-_]+(.)?/g, (_, c) => (c ? c.toUpperCase() : \"\"));\n result = result.charAt(0).toLowerCase() + result.slice(1);\n return result;\n}\n\n/**\n * Gets the TypeScript type name corresponding to an OntologyEntityTypeEnum value\n */\nfunction getEntityTypeName(type: string): string {\n return {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"ObjectType\",\n [OntologyEntityTypeEnum.LINK_TYPE]: \"LinkType\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"InterfaceType\",\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"SharedPropertyType\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"ActionType\",\n [OntologyEntityTypeEnum.VALUE_TYPE]: \"ValueTypeDefinitionVersion\",\n }[type]!;\n}\n\nfunction writeDependencyFile(dependencyFile: string): void {\n fs.writeFileSync(dependencyFile, JSON.stringify(dependencies, null, 2));\n}\n\nfunction dependencyInjectionString(): string {\n const namespaceNoDot: string = namespace.endsWith(\".\")\n ? namespace.slice(0, -1)\n : namespace;\n\n return `import { addDependency } from \"@osdk/maker\";\n// @ts-ignore\naddDependency(\"${namespaceNoDot}\", new URL(import.meta.url).pathname);\n`;\n}\n\nexport function addNamespaceIfNone(apiName: string): string {\n return apiName.includes(\".\") ? apiName : namespace + apiName;\n}\n\nexport function initializeOntologyState(ns: string): void {\n namespace = ns;\n dependencies = {};\n ontologyDefinition = {\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n SHARED_PROPERTY_TYPE: {},\n VALUE_TYPE: {},\n };\n importedTypes = {\n SHARED_PROPERTY_TYPE: {},\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n VALUE_TYPE: {},\n };\n}\n\nexport function getOntologyDefinition(): OntologyDefinition {\n return ontologyDefinition;\n}\n\nexport function getImportedTypes(): OntologyDefinition {\n return importedTypes;\n}\n\nexport function getNamespace(): string {\n return namespace;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAO,KAAKA,EAAE,MAAM,IAAI;AACxB,OAAO,KAAKC,IAAI,MAAM,MAAM;AAC5B,SAASC,uBAAuB,QAAQ,wDAAwD;AAChG,SAASC,qBAAqB,QAAQ,sDAAsD;AAC5F,SAASC,uBAAuB,QAAQ,wDAAwD;AAChG,SAASC,yBAAyB,QAAQ,0DAA0D;AACpG,SAASC,4BAA4B,QAAQ,6DAA6D;AAC1G,SAASC,sBAAsB,QAAQ,uDAAuD;AAO9F,SAASC,kBAAkB,QAAQ,uCAAuC;AAE1E,SAASC,sBAAsB,QAAQ,oCAAoC;AAI3E;AACA;AACA,OAAO,IAAIC,kBAAsC;;AAEjD;AACA;AACA,OAAO,IAAIC,aAAiC;;AAE5C;AACA;AACA,OAAO,IAAIC,YAAoC;;AAE/C;AACA,OAAO,IAAIC,SAAiB;AAE5B,OAAO,SAASC,cAAcA,CAG5BC,MAAS,EACH;EACN,IAAIA,MAAM,CAACC,MAAM,KAAKP,sBAAsB,CAACQ,UAAU,EAAE;IACvDP,kBAAkB,CAACK,MAAM,CAACC,MAAM,CAAC,CAACD,MAAM,CAACG,OAAO,CAAC,GAAGH,MAAM;IAC1D;EACF;EACA;EACA,IACEL,kBAAkB,CAACD,sBAAsB,CAACQ,UAAU,CAAC,CAACF,MAAM,CAACG,OAAO,CAAC,KAC/DC,SAAS,EACf;IACAT,kBAAkB,CAACD,sBAAsB,CAACQ,UAAU,CAAC,CAACF,MAAM,CAACG,OAAO,CAAC,GAAG,EAAE;EAC5E;EACAR,kBAAkB,CAACD,sBAAsB,CAACQ,UAAU,CAAC,CAACF,MAAM,CAACG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A,OAAO,SAASkO,gBAAgBA,CAAA,EAAuB;EACrD,OAAOjO,aAAa;AACtB;AAEA,OAAO,SAASkO,YAAYA,CAAA,EAAW;EACrC,OAAOhO,SAAS;AAClB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"InterfaceType.js","names":[],"sources":["InterfaceType.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 InterfaceTypeStatus,\n OntologyIrMarketplaceInterfaceType,\n} from \"@osdk/client.unstable\";\nimport type { EntityPermission } from \"../common/EntityPermission.js\";\nimport type { OntologyEntityBase } from \"../common/OntologyEntityBase.js\";\nimport type { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport type {\n InterfacePropertyType,\n InterfaceSharedPropertyType,\n} from \"./InterfacePropertyType.js\";\n\nexport interface InterfaceType extends\n OntologyEntityBase,\n Omit<\n OntologyIrMarketplaceInterfaceType,\n // we want our simplified representation\n | \"properties\"\n // these things don't need to exist as the system works fine without them (I'm told)\n | \"propertiesV2\"\n | \"propertiesV3\"\n | \"extendsInterfaces\"\n | \"extendsInterfacesMetadata\"\n >\n{\n propertiesV2: Record<string, InterfaceSharedPropertyType>;\n propertiesV3: Record<string, InterfacePropertyType>;\n extendsInterfaces: Array<InterfaceType>;\n permission?: EntityPermission;\n status: InterfaceTypeStatus;\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"InterfaceType.js","names":[],"sources":["InterfaceType.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 InterfaceTypeStatus,\n OntologyIrMarketplaceInterfaceType,\n} from \"@osdk/client.unstable\";\nimport type { EntityPermission } from \"../common/EntityPermission.js\";\nimport type { OntologyEntityBase } from \"../common/OntologyEntityBase.js\";\nimport type { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport type {\n InterfacePropertyType,\n InterfaceSharedPropertyType,\n} from \"./InterfacePropertyType.js\";\n\nexport interface InterfaceType extends\n OntologyEntityBase,\n Omit<\n OntologyIrMarketplaceInterfaceType,\n // we want our simplified representation\n | \"properties\"\n // these things don't need to exist as the system works fine without them (I'm told)\n | \"propertiesV2\"\n | \"propertiesV3\"\n | \"extendsInterfaces\"\n | \"extendsInterfacesMetadata\"\n >\n{\n propertiesV2: Record<string, InterfaceSharedPropertyType>;\n propertiesV3: Record<string, InterfacePropertyType>;\n extendsInterfaces: Array<InterfaceType>;\n linkedInterfaces?: Array<InterfaceType | string>; // full metadata of linked entities used for X-OAC imports\n permission?: EntityPermission;\n status: InterfaceTypeStatus;\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE;\n}\n"],"mappings":"","ignoreList":[]}
@@ -25,7 +25,7 @@ import { defineOntology } from "../api/defineOntology.js";
25
25
  const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
26
26
  const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
27
27
  export default async function main(args = process.argv) {
28
- const commandLineOpts = await yargs(hideBin(args)).version("0.34.0" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
28
+ const commandLineOpts = await yargs(hideBin(args)).version("0.35.0-main-833f47a4aeef6f7cfcab024ca3623aada385701b" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
29
29
  input: {
30
30
  alias: "i",
31
31
  describe: "Input file",
@@ -105,7 +105,7 @@ export default async function main(args = process.argv) {
105
105
  }
106
106
  const ontologyIr = await loadOntology(commandLineOpts.input, apiNamespace, commandLineOpts.outputDir, commandLineOpts.dependencies, commandLineOpts.generateCodeSnippets, commandLineOpts.codeSnippetPackageName, commandLineOpts.codeSnippetDir, commandLineOpts.randomnessKey);
107
107
  consola.info(`Saving ontology to ${commandLineOpts.output}`);
108
- await fs.writeFile(commandLineOpts.output, JSON.stringify(ontologyIr, null, 2));
108
+ await fs.writeFile(commandLineOpts.output, JSON.stringify(ontologyIr, (key, value) => key === "linkedInterfaces" ? undefined : value, 2));
109
109
  // No point in generating block if there aren't any value types
110
110
  if (ontologyIr.valueTypes.valueTypes.length > 0 || ontologyIr.importedValueTypes.valueTypes.length > 0) {
111
111
  await fs.writeFile(commandLineOpts.valueTypesOutput, JSON.stringify(ontologyIr.valueTypes, null, 2));