@osdk/maker 0.15.0 → 0.16.0-beta.10

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 (240) hide show
  1. package/CHANGELOG.md +89 -126
  2. package/README.md +18 -1
  3. package/build/browser/api/cloneDefinition.js +36 -0
  4. package/build/browser/api/cloneDefinition.js.map +1 -0
  5. package/build/browser/api/code-snippets/createCodeSnippets.js +1 -1
  6. package/build/browser/api/code-snippets/createCodeSnippets.js.map +1 -1
  7. package/build/browser/api/defineAction.js +9 -1
  8. package/build/browser/api/defineAction.js.map +1 -1
  9. package/build/browser/api/defineCreateInterfaceObjectAction.js +3 -1
  10. package/build/browser/api/defineCreateInterfaceObjectAction.js.map +1 -1
  11. package/build/browser/api/defineCreateObjectAction.js +3 -1
  12. package/build/browser/api/defineCreateObjectAction.js.map +1 -1
  13. package/build/browser/api/defineCreateOrModifyObjectAction.js +3 -1
  14. package/build/browser/api/defineCreateOrModifyObjectAction.js.map +1 -1
  15. package/build/browser/api/defineDeleteInterfaceObjectAction.js +3 -1
  16. package/build/browser/api/defineDeleteInterfaceObjectAction.js.map +1 -1
  17. package/build/browser/api/defineDeleteObjectAction.js +3 -1
  18. package/build/browser/api/defineDeleteObjectAction.js.map +1 -1
  19. package/build/browser/api/defineFunction.js +61 -0
  20. package/build/browser/api/defineFunction.js.map +1 -0
  21. package/build/browser/api/defineInterface.js +3 -1
  22. package/build/browser/api/defineInterface.js.map +1 -1
  23. package/build/browser/api/defineInterfaceLinkConstraint.js +6 -2
  24. package/build/browser/api/defineInterfaceLinkConstraint.js.map +1 -1
  25. package/build/browser/api/defineLink.js +3 -1
  26. package/build/browser/api/defineLink.js.map +1 -1
  27. package/build/browser/api/defineModifyInterfaceObjectAction.js +3 -1
  28. package/build/browser/api/defineModifyInterfaceObjectAction.js.map +1 -1
  29. package/build/browser/api/defineModifyObjectAction.js +3 -1
  30. package/build/browser/api/defineModifyObjectAction.js.map +1 -1
  31. package/build/browser/api/defineObject.js +29 -10
  32. package/build/browser/api/defineObject.js.map +1 -1
  33. package/build/browser/api/defineOntology.js +29 -0
  34. package/build/browser/api/defineOntology.js.map +1 -1
  35. package/build/browser/api/defineSpt.js +3 -1
  36. package/build/browser/api/defineSpt.js.map +1 -1
  37. package/build/browser/api/defineValueType.js +3 -1
  38. package/build/browser/api/defineValueType.js.map +1 -1
  39. package/build/browser/api/interface/InterfaceType.js.map +1 -1
  40. package/build/browser/api/object/ObjectPropertyType.js.map +1 -1
  41. package/build/browser/api/object/ObjectTypeDatasourceDefinition.js.map +1 -1
  42. package/build/browser/api/properties/PropertyTypeType.js.map +1 -1
  43. package/build/browser/api/properties/ReducerType.js +2 -0
  44. package/build/browser/api/properties/ReducerType.js.map +1 -0
  45. package/build/browser/api/properties/SharedPropertyType.js.map +1 -1
  46. package/build/browser/cli/main.js +1 -1
  47. package/build/browser/cli/main.js.map +1 -1
  48. package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js +17 -6
  49. package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -1
  50. package/build/browser/conversion/toMarketplace/convertInterface.js +2 -1
  51. package/build/browser/conversion/toMarketplace/convertInterface.js.map +1 -1
  52. package/build/browser/conversion/toMarketplace/convertMainValue.js +36 -0
  53. package/build/browser/conversion/toMarketplace/convertMainValue.js.map +1 -0
  54. package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js +4 -3
  55. package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -1
  56. package/build/browser/conversion/toMarketplace/convertReducers.js +53 -0
  57. package/build/browser/conversion/toMarketplace/convertReducers.js.map +1 -0
  58. package/build/browser/conversion/toMarketplace/convertSpt.js +5 -3
  59. package/build/browser/conversion/toMarketplace/convertSpt.js.map +1 -1
  60. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +4 -2
  61. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
  62. package/build/browser/index.js +5 -2
  63. package/build/browser/index.js.map +1 -1
  64. package/build/cjs/index.cjs +267 -105
  65. package/build/cjs/index.cjs.map +1 -1
  66. package/build/cjs/index.d.cts +214 -164
  67. package/build/esm/api/cloneDefinition.js +36 -0
  68. package/build/esm/api/cloneDefinition.js.map +1 -0
  69. package/build/esm/api/code-snippets/createCodeSnippets.js +1 -1
  70. package/build/esm/api/code-snippets/createCodeSnippets.js.map +1 -1
  71. package/build/esm/api/defineAction.js +9 -1
  72. package/build/esm/api/defineAction.js.map +1 -1
  73. package/build/esm/api/defineCreateInterfaceObjectAction.js +3 -1
  74. package/build/esm/api/defineCreateInterfaceObjectAction.js.map +1 -1
  75. package/build/esm/api/defineCreateObjectAction.js +3 -1
  76. package/build/esm/api/defineCreateObjectAction.js.map +1 -1
  77. package/build/esm/api/defineCreateOrModifyObjectAction.js +3 -1
  78. package/build/esm/api/defineCreateOrModifyObjectAction.js.map +1 -1
  79. package/build/esm/api/defineDeleteInterfaceObjectAction.js +3 -1
  80. package/build/esm/api/defineDeleteInterfaceObjectAction.js.map +1 -1
  81. package/build/esm/api/defineDeleteObjectAction.js +3 -1
  82. package/build/esm/api/defineDeleteObjectAction.js.map +1 -1
  83. package/build/esm/api/defineFunction.js +61 -0
  84. package/build/esm/api/defineFunction.js.map +1 -0
  85. package/build/esm/api/defineInterface.js +3 -1
  86. package/build/esm/api/defineInterface.js.map +1 -1
  87. package/build/esm/api/defineInterfaceLinkConstraint.js +6 -2
  88. package/build/esm/api/defineInterfaceLinkConstraint.js.map +1 -1
  89. package/build/esm/api/defineLink.js +3 -1
  90. package/build/esm/api/defineLink.js.map +1 -1
  91. package/build/esm/api/defineModifyInterfaceObjectAction.js +3 -1
  92. package/build/esm/api/defineModifyInterfaceObjectAction.js.map +1 -1
  93. package/build/esm/api/defineModifyObjectAction.js +3 -1
  94. package/build/esm/api/defineModifyObjectAction.js.map +1 -1
  95. package/build/esm/api/defineObject.js +29 -10
  96. package/build/esm/api/defineObject.js.map +1 -1
  97. package/build/esm/api/defineOntology.js +29 -0
  98. package/build/esm/api/defineOntology.js.map +1 -1
  99. package/build/esm/api/defineSpt.js +3 -1
  100. package/build/esm/api/defineSpt.js.map +1 -1
  101. package/build/esm/api/defineValueType.js +3 -1
  102. package/build/esm/api/defineValueType.js.map +1 -1
  103. package/build/esm/api/interface/InterfaceType.js.map +1 -1
  104. package/build/esm/api/object/ObjectPropertyType.js.map +1 -1
  105. package/build/esm/api/object/ObjectTypeDatasourceDefinition.js.map +1 -1
  106. package/build/esm/api/properties/PropertyTypeType.js.map +1 -1
  107. package/build/esm/api/properties/ReducerType.js +2 -0
  108. package/build/esm/api/properties/ReducerType.js.map +1 -0
  109. package/build/esm/api/properties/SharedPropertyType.js.map +1 -1
  110. package/build/esm/cli/main.js +1 -1
  111. package/build/esm/cli/main.js.map +1 -1
  112. package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js +17 -6
  113. package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -1
  114. package/build/esm/conversion/toMarketplace/convertInterface.js +2 -1
  115. package/build/esm/conversion/toMarketplace/convertInterface.js.map +1 -1
  116. package/build/esm/conversion/toMarketplace/convertMainValue.js +36 -0
  117. package/build/esm/conversion/toMarketplace/convertMainValue.js.map +1 -0
  118. package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js +4 -3
  119. package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -1
  120. package/build/esm/conversion/toMarketplace/convertReducers.js +53 -0
  121. package/build/esm/conversion/toMarketplace/convertReducers.js.map +1 -0
  122. package/build/esm/conversion/toMarketplace/convertSpt.js +5 -3
  123. package/build/esm/conversion/toMarketplace/convertSpt.js.map +1 -1
  124. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +4 -2
  125. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
  126. package/build/esm/index.js +5 -2
  127. package/build/esm/index.js.map +1 -1
  128. package/build/types/api/cloneDefinition.d.ts +9 -0
  129. package/build/types/api/cloneDefinition.d.ts.map +1 -0
  130. package/build/types/api/defineAction.d.ts +1 -1
  131. package/build/types/api/defineAction.d.ts.map +1 -1
  132. package/build/types/api/defineCreateInterfaceObjectAction.d.ts +1 -1
  133. package/build/types/api/defineCreateInterfaceObjectAction.d.ts.map +1 -1
  134. package/build/types/api/defineCreateObjectAction.d.ts +1 -1
  135. package/build/types/api/defineCreateObjectAction.d.ts.map +1 -1
  136. package/build/types/api/defineCreateOrModifyObjectAction.d.ts +1 -1
  137. package/build/types/api/defineCreateOrModifyObjectAction.d.ts.map +1 -1
  138. package/build/types/api/defineDeleteInterfaceObjectAction.d.ts +1 -1
  139. package/build/types/api/defineDeleteInterfaceObjectAction.d.ts.map +1 -1
  140. package/build/types/api/defineDeleteObjectAction.d.ts +1 -1
  141. package/build/types/api/defineDeleteObjectAction.d.ts.map +1 -1
  142. package/build/types/api/defineFunction.d.ts +19 -0
  143. package/build/types/api/defineFunction.d.ts.map +1 -0
  144. package/build/types/api/defineInterface.d.ts +1 -1
  145. package/build/types/api/defineInterface.d.ts.map +1 -1
  146. package/build/types/api/defineInterfaceLinkConstraint.d.ts +1 -1
  147. package/build/types/api/defineInterfaceLinkConstraint.d.ts.map +1 -1
  148. package/build/types/api/defineLink.d.ts +1 -1
  149. package/build/types/api/defineLink.d.ts.map +1 -1
  150. package/build/types/api/defineModifyInterfaceObjectAction.d.ts +1 -1
  151. package/build/types/api/defineModifyInterfaceObjectAction.d.ts.map +1 -1
  152. package/build/types/api/defineModifyObjectAction.d.ts +1 -1
  153. package/build/types/api/defineModifyObjectAction.d.ts.map +1 -1
  154. package/build/types/api/defineObject.d.ts +1 -1
  155. package/build/types/api/defineObject.d.ts.map +1 -1
  156. package/build/types/api/defineOntology.d.ts +5 -0
  157. package/build/types/api/defineOntology.d.ts.map +1 -1
  158. package/build/types/api/defineSpt.d.ts +3 -1
  159. package/build/types/api/defineSpt.d.ts.map +1 -1
  160. package/build/types/api/defineValueType.d.ts +1 -1
  161. package/build/types/api/defineValueType.d.ts.map +1 -1
  162. package/build/types/api/interface/InterfaceType.d.ts +1 -1
  163. package/build/types/api/interface/InterfaceType.d.ts.map +1 -1
  164. package/build/types/api/object/ObjectPropertyType.d.ts +2 -0
  165. package/build/types/api/object/ObjectPropertyType.d.ts.map +1 -1
  166. package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts +10 -3
  167. package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts.map +1 -1
  168. package/build/types/api/properties/PropertyTypeType.d.ts +4 -0
  169. package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -1
  170. package/build/types/api/properties/ReducerType.d.ts +4 -0
  171. package/build/types/api/properties/ReducerType.d.ts.map +1 -0
  172. package/build/types/api/properties/SharedPropertyType.d.ts +2 -0
  173. package/build/types/api/properties/SharedPropertyType.d.ts.map +1 -1
  174. package/build/types/conversion/toMarketplace/convertDatasourceDefinition.d.ts.map +1 -1
  175. package/build/types/conversion/toMarketplace/convertMainValue.d.ts +4 -0
  176. package/build/types/conversion/toMarketplace/convertMainValue.d.ts.map +1 -0
  177. package/build/types/conversion/toMarketplace/convertObjectPropertyType.d.ts.map +1 -1
  178. package/build/types/conversion/toMarketplace/convertReducers.d.ts +6 -0
  179. package/build/types/conversion/toMarketplace/convertReducers.d.ts.map +1 -0
  180. package/build/types/conversion/toMarketplace/convertSpt.d.ts +1 -1
  181. package/build/types/conversion/toMarketplace/convertSpt.d.ts.map +1 -1
  182. package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts +2 -1
  183. package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts.map +1 -1
  184. package/build/types/index.d.ts +14 -6
  185. package/build/types/index.d.ts.map +1 -1
  186. package/package.json +6 -5
  187. package/build/browser/api/test/actions.test.js +0 -14397
  188. package/build/browser/api/test/actions.test.js.map +0 -1
  189. package/build/browser/api/test/interfaces.test.js +0 -1189
  190. package/build/browser/api/test/interfaces.test.js.map +0 -1
  191. package/build/browser/api/test/links.test.js +0 -2019
  192. package/build/browser/api/test/links.test.js.map +0 -1
  193. package/build/browser/api/test/markingconstraint.test.js +0 -134
  194. package/build/browser/api/test/markingconstraint.test.js.map +0 -1
  195. package/build/browser/api/test/misc.test.js +0 -1315
  196. package/build/browser/api/test/misc.test.js.map +0 -1
  197. package/build/browser/api/test/objectStatus.test.js +0 -160
  198. package/build/browser/api/test/objectStatus.test.js.map +0 -1
  199. package/build/browser/api/test/objects.test.js +0 -3856
  200. package/build/browser/api/test/objects.test.js.map +0 -1
  201. package/build/browser/api/test/spt.test.js +0 -722
  202. package/build/browser/api/test/spt.test.js.map +0 -1
  203. package/build/browser/api/test/valueTypes.test.js +0 -307
  204. package/build/browser/api/test/valueTypes.test.js.map +0 -1
  205. package/build/esm/api/test/actions.test.js +0 -14397
  206. package/build/esm/api/test/actions.test.js.map +0 -1
  207. package/build/esm/api/test/interfaces.test.js +0 -1189
  208. package/build/esm/api/test/interfaces.test.js.map +0 -1
  209. package/build/esm/api/test/links.test.js +0 -2019
  210. package/build/esm/api/test/links.test.js.map +0 -1
  211. package/build/esm/api/test/markingconstraint.test.js +0 -134
  212. package/build/esm/api/test/markingconstraint.test.js.map +0 -1
  213. package/build/esm/api/test/misc.test.js +0 -1315
  214. package/build/esm/api/test/misc.test.js.map +0 -1
  215. package/build/esm/api/test/objectStatus.test.js +0 -160
  216. package/build/esm/api/test/objectStatus.test.js.map +0 -1
  217. package/build/esm/api/test/objects.test.js +0 -3856
  218. package/build/esm/api/test/objects.test.js.map +0 -1
  219. package/build/esm/api/test/spt.test.js +0 -722
  220. package/build/esm/api/test/spt.test.js.map +0 -1
  221. package/build/esm/api/test/valueTypes.test.js +0 -307
  222. package/build/esm/api/test/valueTypes.test.js.map +0 -1
  223. package/build/types/api/test/actions.test.d.ts +0 -1
  224. package/build/types/api/test/actions.test.d.ts.map +0 -1
  225. package/build/types/api/test/interfaces.test.d.ts +0 -1
  226. package/build/types/api/test/interfaces.test.d.ts.map +0 -1
  227. package/build/types/api/test/links.test.d.ts +0 -1
  228. package/build/types/api/test/links.test.d.ts.map +0 -1
  229. package/build/types/api/test/markingconstraint.test.d.ts +0 -1
  230. package/build/types/api/test/markingconstraint.test.d.ts.map +0 -1
  231. package/build/types/api/test/misc.test.d.ts +0 -1
  232. package/build/types/api/test/misc.test.d.ts.map +0 -1
  233. package/build/types/api/test/objectStatus.test.d.ts +0 -1
  234. package/build/types/api/test/objectStatus.test.d.ts.map +0 -1
  235. package/build/types/api/test/objects.test.d.ts +0 -1
  236. package/build/types/api/test/objects.test.d.ts.map +0 -1
  237. package/build/types/api/test/spt.test.d.ts +0 -1
  238. package/build/types/api/test/spt.test.d.ts.map +0 -1
  239. package/build/types/api/test/valueTypes.test.d.ts +0 -1
  240. package/build/types/api/test/valueTypes.test.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyTypeType.js","names":["isPropertyTypeType","v","type","isExotic","undefined","includes","isStruct"],"sources":["PropertyTypeType.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 { StructFieldType } from \"@osdk/client.unstable\";\n\nexport type PropertyTypeType =\n | PropertyTypeTypePrimitive\n | PropertyTypeTypeExotic;\n\nexport type PropertyTypeTypePrimitive =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"short\"\n | \"string\"\n | \"timestamp\"\n | \"attachment\";\n\nexport type PropertyTypeTypeExotic =\n | \"geopoint\"\n | \"geoshape\"\n | \"mediaReference\"\n | \"geotimeSeries\"\n | PropertyTypeTypeMarking\n | PropertyTypeTypeStruct\n | PropertyTypeTypeString\n | PropertyTypeTypeDecimal;\n\ntype PropertyTypeTypeMarking = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, PropertyTypeTypeMarking>;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText?: boolean;\n supportsEfficientLeadingWildcard?: boolean;\n supportsExactMatching?: boolean;\n supportsFullTextRegex?: boolean;\n enableAsciiFolding?: boolean;\n};\n\ntype PropertyTypeTypeDecimal = {\n type: \"decimal\";\n precision?: number;\n scale?: number;\n};\n\nexport type PropertyTypeTypesWithoutStruct = Exclude<\n PropertyTypeType,\n PropertyTypeTypeStruct\n>;\nexport function isPropertyTypeType(\n v: PropertyTypeType,\n): v is PropertyTypeType {\n return v === \"boolean\" || v === \"byte\"\n || v === \"date\" || v === \"decimal\" || v === \"double\"\n || v === \"float\" || v === \"geopoint\" || v === \"geoshape\"\n || v === \"integer\" || v === \"long\"\n || (typeof v === \"object\" && v.type === \"marking\")\n || v === \"short\" || v === \"string\"\n || v === \"timestamp\";\n}\nexport function isExotic(\n type: PropertyTypeType | undefined,\n): type is PropertyTypeTypeExotic {\n if (type === undefined) {\n return false;\n }\n if (typeof type === \"string\") {\n return [\"geopoint\", \"geoshape\", \"mediaReference\", \"geotimeSeries\"].includes(\n type,\n );\n } else if (typeof type === \"object\" && type != null) {\n return type.type === \"marking\" || type.type === \"struct\"\n || type.type === \"string\"\n || type.type === \"decimal\";\n }\n return false;\n}\nexport function isStruct(\n type: PropertyTypeType,\n): type is PropertyTypeTypeStruct {\n return typeof type === \"object\" && type.type === \"struct\";\n}\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends\n Optional<\n Omit<\n StructFieldType,\n \"fieldType\" | \"structFieldRid\" | \"apiName\"\n >,\n \"typeClasses\" | \"aliases\"\n >\n{\n fieldType: PropertyTypeTypesWithoutStruct;\n requireImplementation?: boolean;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkEA,OAAO,SAASA,kBAAkBA,CAChCC,CAAmB,EACI;EACvB,OAAOA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IACjCA,CAAC,KAAK,MAAM,IAAIA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,QAAQ,IACjDA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,UAAU,IAAIA,CAAC,KAAK,UAAU,IACrDA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IAC9B,OAAOA,CAAC,KAAK,QAAQ,IAAIA,CAAC,CAACC,IAAI,KAAK,SAAU,IAC/CD,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,QAAQ,IAC/BA,CAAC,KAAK,WAAW;AACxB;AACA,OAAO,SAASE,QAAQA,CACtBD,IAAkC,EACF;EAChC,IAAIA,IAAI,KAAKE,SAAS,EAAE;IACtB,OAAO,KAAK;EACd;EACA,IAAI,OAAOF,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAACG,QAAQ,CACzEH,IACF,CAAC;EACH,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,IAAI,IAAI,EAAE;IACnD,OAAOA,IAAI,CAACA,IAAI,KAAK,SAAS,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ,IACnDA,IAAI,CAACA,IAAI,KAAK,QAAQ,IACtBA,IAAI,CAACA,IAAI,KAAK,SAAS;EAC9B;EACA,OAAO,KAAK;AACd;AACA,OAAO,SAASI,QAAQA,CACtBJ,IAAsB,EACU;EAChC,OAAO,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;AAC3D","ignoreList":[]}
1
+ {"version":3,"file":"PropertyTypeType.js","names":["isPropertyTypeType","v","type","isExotic","undefined","includes","isStruct"],"sources":["PropertyTypeType.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 { StructFieldType } from \"@osdk/client.unstable\";\n\nexport type PropertyTypeType =\n | PropertyTypeTypePrimitive\n | PropertyTypeTypeExotic;\n\nexport type PropertyTypeTypePrimitive =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"short\"\n | \"string\"\n | \"timestamp\"\n | \"attachment\";\n\nexport type PropertyTypeTypeExotic =\n | \"geopoint\"\n | \"geoshape\"\n | \"mediaReference\"\n | \"geotimeSeries\"\n | PropertyTypeTypeMarking\n | PropertyTypeTypeStruct\n | PropertyTypeTypeString\n | PropertyTypeTypeDecimal;\n\ntype PropertyTypeTypeMarking = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, PropertyTypeTypeMarking>;\n };\n mainValue?: {\n fields: string | Array<string>;\n // TODO(ethana): we can infer this type from fields\n type: PropertyTypeType;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText?: boolean;\n supportsEfficientLeadingWildcard?: boolean;\n supportsExactMatching?: boolean;\n supportsFullTextRegex?: boolean;\n enableAsciiFolding?: boolean;\n};\n\ntype PropertyTypeTypeDecimal = {\n type: \"decimal\";\n precision?: number;\n scale?: number;\n};\n\nexport type PropertyTypeTypesWithoutStruct = Exclude<\n PropertyTypeType,\n PropertyTypeTypeStruct\n>;\nexport function isPropertyTypeType(\n v: PropertyTypeType,\n): v is PropertyTypeType {\n return v === \"boolean\" || v === \"byte\"\n || v === \"date\" || v === \"decimal\" || v === \"double\"\n || v === \"float\" || v === \"geopoint\" || v === \"geoshape\"\n || v === \"integer\" || v === \"long\"\n || (typeof v === \"object\" && v.type === \"marking\")\n || v === \"short\" || v === \"string\"\n || v === \"timestamp\";\n}\nexport function isExotic(\n type: PropertyTypeType | undefined,\n): type is PropertyTypeTypeExotic {\n if (type === undefined) {\n return false;\n }\n if (typeof type === \"string\") {\n return [\"geopoint\", \"geoshape\", \"mediaReference\", \"geotimeSeries\"].includes(\n type,\n );\n } else if (typeof type === \"object\" && type != null) {\n return type.type === \"marking\" || type.type === \"struct\"\n || type.type === \"string\"\n || type.type === \"decimal\";\n }\n return false;\n}\nexport function isStruct(\n type: PropertyTypeType,\n): type is PropertyTypeTypeStruct {\n return typeof type === \"object\" && type.type === \"struct\";\n}\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends\n Optional<\n Omit<\n StructFieldType,\n \"fieldType\" | \"structFieldRid\" | \"apiName\"\n >,\n \"typeClasses\" | \"aliases\"\n >\n{\n fieldType: PropertyTypeTypesWithoutStruct;\n requireImplementation?: boolean;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuEA,OAAO,SAASA,kBAAkBA,CAChCC,CAAmB,EACI;EACvB,OAAOA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IACjCA,CAAC,KAAK,MAAM,IAAIA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,QAAQ,IACjDA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,UAAU,IAAIA,CAAC,KAAK,UAAU,IACrDA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IAC9B,OAAOA,CAAC,KAAK,QAAQ,IAAIA,CAAC,CAACC,IAAI,KAAK,SAAU,IAC/CD,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,QAAQ,IAC/BA,CAAC,KAAK,WAAW;AACxB;AACA,OAAO,SAASE,QAAQA,CACtBD,IAAkC,EACF;EAChC,IAAIA,IAAI,KAAKE,SAAS,EAAE;IACtB,OAAO,KAAK;EACd;EACA,IAAI,OAAOF,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAACG,QAAQ,CACzEH,IACF,CAAC;EACH,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,IAAI,IAAI,EAAE;IACnD,OAAOA,IAAI,CAACA,IAAI,KAAK,SAAS,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ,IACnDA,IAAI,CAACA,IAAI,KAAK,QAAQ,IACtBA,IAAI,CAACA,IAAI,KAAK,SAAS;EAC9B;EACA,OAAO,KAAK;AACd;AACA,OAAO,SAASI,QAAQA,CACtBJ,IAAsB,EACU;EAChC,OAAO,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;AAC3D","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ReducerType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReducerType.js","names":[],"sources":["ReducerType.ts"],"sourcesContent":["/*\n * Copyright 2026 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\nexport type ReducerType = {\n direction:\n | \"ascending\" // first (A -> Z) value, least recent date, etc.\n | \"descending\"; // last (Z -> A) value, most recent date, etc.\n structField?: string;\n};\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"SharedPropertyType.js","names":[],"sources":["SharedPropertyType.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 OntologyIrBaseFormatter,\n OntologyIrValueTypeReferenceWithMetadata,\n SharedPropertyTypeGothamMapping,\n Visibility,\n} from \"@osdk/client.unstable\";\nimport type { OntologyEntityBase } from \"../common/OntologyEntityBase.js\";\nimport type { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport type { TypeClass } from \"../common/TypeClass.js\";\nimport type { Nullability } from \"./Nullability.js\";\nimport type { PropertyTypeType } from \"./PropertyTypeType.js\";\n\nexport interface SharedPropertyType extends OntologyEntityBase, PropertyType {\n apiName: string;\n nonNameSpacedApiName: string;\n aliases?: Array<string>;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n baseFormatter?: OntologyIrBaseFormatter;\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE;\n}\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: OntologyIrValueTypeReferenceWithMetadata;\n visibility?: Visibility;\n typeClasses?: TypeClass[];\n nullability?: Nullability;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"SharedPropertyType.js","names":[],"sources":["SharedPropertyType.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 OntologyIrBaseFormatter,\n OntologyIrValueTypeReferenceWithMetadata,\n SharedPropertyTypeGothamMapping,\n Visibility,\n} from \"@osdk/client.unstable\";\nimport type { OntologyEntityBase } from \"../common/OntologyEntityBase.js\";\nimport type { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport type { TypeClass } from \"../common/TypeClass.js\";\nimport type { Nullability } from \"./Nullability.js\";\nimport type { PropertyTypeType } from \"./PropertyTypeType.js\";\nimport type { ReducerType } from \"./ReducerType.js\";\n\nexport interface SharedPropertyType extends OntologyEntityBase, PropertyType {\n apiName: string;\n nonNameSpacedApiName: string;\n aliases?: Array<string>;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n baseFormatter?: OntologyIrBaseFormatter;\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE;\n}\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n reducers?: Array<ReducerType>;\n description?: string;\n displayName?: string;\n valueType?: OntologyIrValueTypeReferenceWithMetadata;\n visibility?: Visibility;\n typeClasses?: TypeClass[];\n nullability?: Nullability;\n}\n"],"mappings":"","ignoreList":[]}
@@ -24,7 +24,7 @@ import { defineOntology } from "../api/defineOntology.js";
24
24
  const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
25
25
  const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
26
26
  export default async function main(args = process.argv) {
27
- const commandLineOpts = await yargs(hideBin(args)).version("0.15.0" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
27
+ const commandLineOpts = await yargs(hideBin(args)).version("0.16.0-beta.10" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
28
28
  input: {
29
29
  alias: "i",
30
30
  describe: "Input file",
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","names":["consola","fs","path","invariant","yargs","hideBin","defineOntology","apiNamespaceRegex","uuidRegex","main","args","process","argv","commandLineOpts","version","wrap","Math","min","terminalWidth","strict","help","options","input","alias","describe","type","default","coerce","resolve","output","apiNamespace","snapshotDir","outputDir","valueTypesOutput","dependencies","generateCodeSnippets","codeSnippetPackageName","codeSnippetDir","randomnessKey","parseAsync","length","slice","env","NODE_ENV","test","info","undefined","ontologyIr","loadOntology","writeFile","JSON","stringify","valueTypes","importedValueTypes","dependencyFile","snippetPackageName","q"],"sources":["main.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 { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { defineOntology } from \"../api/defineOntology.js\";\n\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/;\nconst uuidRegex =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;\n\nexport default async function main(\n args: string[] = process.argv,\n): Promise<void> {\n const commandLineOpts: {\n input: string;\n output: string;\n apiNamespace: string;\n snapshotDir: string;\n valueTypesOutput: string;\n outputDir?: string;\n dependencies?: string;\n generateCodeSnippets: boolean;\n codeSnippetPackageName: string;\n codeSnippetDir: string;\n randomnessKey?: string;\n } = await yargs(hideBin(args))\n .version(process.env.PACKAGE_VERSION ?? \"\")\n .wrap(Math.min(150, yargs().terminalWidth()))\n .strict()\n .help()\n .options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\",\n coerce: path.resolve,\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\",\n coerce: path.resolve,\n },\n apiNamespace: {\n describe: \"Api name prefix for namespaced ontology types\",\n type: \"string\",\n default: \"\",\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve,\n },\n outputDir: {\n alias: \"d\",\n describe: \"Directory for generated ontology entities\",\n type: \"string\",\n coerce: path.resolve,\n },\n valueTypesOutput: {\n describe: \"Value Type Output File\",\n type: \"string\",\n default: \"value-types.json\",\n coerce: path.resolve,\n },\n dependencies: {\n describe: \"File to write dependencies to\",\n type: \"string\",\n coerce: path.resolve,\n },\n generateCodeSnippets: {\n describe: \"Enable code snippet files creation\",\n type: \"boolean\",\n default: false,\n },\n codeSnippetPackageName: {\n describe:\n \"The package name that will be displayed in the code snippets\",\n default: \"\",\n type: \"string\",\n },\n codeSnippetDir: {\n describe: \"Directory for generated code snippet files\",\n type: \"string\",\n default: \"./\",\n coerce: path.resolve,\n },\n randomnessKey: {\n describe: \"Value used to assure uniqueness of entities\",\n type: \"string\",\n coerce: path.resolve,\n },\n })\n .parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace = (commandLineOpts.apiNamespace.slice(-1) !== \".\")\n ? commandLineOpts.apiNamespace + \".\"\n : commandLineOpts.apiNamespace;\n invariant(apiNamespace.length < 1024, \"API namespace is too long.\");\n invariant(\n apiNamespaceRegex.test(apiNamespace),\n \"API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$\",\n );\n }\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n\n if (\n !commandLineOpts.generateCodeSnippets\n && (commandLineOpts.codeSnippetPackageName !== \"\"\n || commandLineOpts.codeSnippetDir !== path.resolve(\"./\"))\n ) {\n consola.info(\n \"Package name and/or directory supplied for code snippets, but code snippet generation is false.\",\n );\n }\n\n if (commandLineOpts.randomnessKey !== undefined) {\n invariant(\n uuidRegex.test(commandLineOpts.randomnessKey),\n \"Supplied randomness key is not a uuid and shouldn't be used as a uniqueness guarantee\",\n );\n }\n\n const ontologyIr = await loadOntology(\n commandLineOpts.input,\n apiNamespace,\n commandLineOpts.outputDir,\n commandLineOpts.dependencies,\n commandLineOpts.generateCodeSnippets,\n commandLineOpts.codeSnippetPackageName,\n commandLineOpts.codeSnippetDir,\n commandLineOpts.randomnessKey,\n );\n\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await fs.writeFile(\n commandLineOpts.output,\n JSON.stringify(\n ontologyIr,\n null,\n 2,\n ),\n );\n // No point in generating block if there aren't any value types\n if (\n ontologyIr.valueTypes.valueTypes.length > 0\n || ontologyIr.importedValueTypes.valueTypes.length > 0\n ) {\n await fs.writeFile(\n commandLineOpts.valueTypesOutput,\n JSON.stringify(\n ontologyIr.valueTypes,\n null,\n 2,\n ),\n );\n }\n}\n\nasync function loadOntology(\n input: string,\n apiNamespace: string,\n outputDir: string | undefined,\n dependencyFile: string | undefined,\n generateCodeSnippets: boolean,\n snippetPackageName: string,\n codeSnippetDir: string,\n randomnessKey?: string,\n) {\n const q = await defineOntology(\n apiNamespace,\n async () => await import(input),\n outputDir,\n dependencyFile,\n generateCodeSnippets,\n snippetPackageName,\n codeSnippetDir,\n randomnessKey,\n );\n return q;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAO,KAAKC,EAAE,MAAM,kBAAkB;AACtC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,MAAMC,iBAAiB,GAAG,+BAA+B;AACzD,MAAMC,SAAS,GACb,gEAAgE;AAElE,eAAe,eAAeC,IAAIA,CAChCC,IAAc,GAAGC,OAAO,CAACC,IAAI,EACd;EACf,MAAMC,eAYL,GAAG,MAAMT,KAAK,CAACC,OAAO,CAACK,IAAI,CAAC,CAAC,CAC3BI,OAAO,CAAC,YAA+B,EAAE,CAAC,CAC1CC,IAAI,CAACC,IAAI,CAACC,GAAG,CAAC,GAAG,EAAEb,KAAK,CAAC,CAAC,CAACc,aAAa,CAAC,CAAC,CAAC,CAAC,CAC5CC,MAAM,CAAC,CAAC,CACRC,IAAI,CAAC,CAAC,CACNC,OAAO,CAAC;IACPC,KAAK,EAAE;MACLC,KAAK,EAAE,GAAG;MACVC,QAAQ,EAAE,YAAY;MACtBC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE,uBAAuB;MAChCC,MAAM,EAAEzB,IAAI,CAAC0B;IACf,CAAC;IACDC,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,eAAe,CAACmB,SAAS,EACzBnB,eAAe,CAACqB,YAAY,EAC5BrB,eAAe,CAACsB,oBAAoB,EACpCtB,eAAe,CAACuB,sBAAsB,EACtCvB,eAAe,CAACwB,cAAc,EAC9BxB,eAAe,CAACyB,aAClB,CAAC;EAEDtC,OAAO,CAAC6C,IAAI,CAAC,sBAAsBhC,eAAe,CAACgB,MAAM,EAAE,CAAC;EAC5D,MAAM5B,EAAE,CAACgD,SAAS,CAChBpC,eAAe,CAACgB,MAAM,EACtBqB,IAAI,CAACC,SAAS,CACZJ,UAAU,EACV,IAAI,EACJ,CACF,CACF,CAAC;EACD;EACA,IACEA,UAAU,CAACK,UAAU,CAACA,UAAU,CAACZ,MAAM,GAAG,CAAC,IACxCO,UAAU,CAACM,kBAAkB,CAACD,UAAU,CAACZ,MAAM,GAAG,CAAC,EACtD;IACA,MAAMvC,EAAE,CAACgD,SAAS,CAChBpC,eAAe,CAACoB,gBAAgB,EAChCiB,IAAI,CAACC,SAAS,CACZJ,UAAU,CAACK,UAAU,EACrB,IAAI,EACJ,CACF,CACF,CAAC;EACH;AACF;AAEA,eAAeJ,YAAYA,CACzB1B,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7BsB,cAAkC,EAClCnB,oBAA6B,EAC7BoB,kBAA0B,EAC1BlB,cAAsB,EACtBC,aAAsB,EACtB;EACA,MAAMkB,CAAC,GAAG,MAAMlD,cAAc,CAC5BwB,YAAY,EACZ,YAAY,MAAM,MAAM,CAACR,KAAK,CAAC,EAC/BU,SAAS,EACTsB,cAAc,EACdnB,oBAAoB,EACpBoB,kBAAkB,EAClBlB,cAAc,EACdC,aACF,CAAC;EACD,OAAOkB,CAAC;AACV","ignoreList":[]}
1
+ {"version":3,"file":"main.js","names":["consola","fs","path","invariant","yargs","hideBin","defineOntology","apiNamespaceRegex","uuidRegex","main","args","process","argv","commandLineOpts","version","wrap","Math","min","terminalWidth","strict","help","options","input","alias","describe","type","default","coerce","resolve","output","apiNamespace","snapshotDir","outputDir","valueTypesOutput","dependencies","generateCodeSnippets","codeSnippetPackageName","codeSnippetDir","randomnessKey","parseAsync","length","slice","env","NODE_ENV","test","info","undefined","ontologyIr","loadOntology","writeFile","JSON","stringify","valueTypes","importedValueTypes","dependencyFile","snippetPackageName","q"],"sources":["main.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 { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { defineOntology } from \"../api/defineOntology.js\";\n\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/;\nconst uuidRegex =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;\n\nexport default async function main(\n args: string[] = process.argv,\n): Promise<void> {\n const commandLineOpts: {\n input: string;\n output: string;\n apiNamespace: string;\n snapshotDir: string;\n valueTypesOutput: string;\n outputDir?: string;\n dependencies?: string;\n generateCodeSnippets: boolean;\n codeSnippetPackageName: string;\n codeSnippetDir: string;\n randomnessKey?: string;\n } = await yargs(hideBin(args))\n .version(process.env.PACKAGE_VERSION ?? \"\")\n .wrap(Math.min(150, yargs().terminalWidth()))\n .strict()\n .help()\n .options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\",\n coerce: path.resolve,\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\",\n coerce: path.resolve,\n },\n apiNamespace: {\n describe: \"Api name prefix for namespaced ontology types\",\n type: \"string\",\n default: \"\",\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve,\n },\n outputDir: {\n alias: \"d\",\n describe: \"Directory for generated ontology entities\",\n type: \"string\",\n coerce: path.resolve,\n },\n valueTypesOutput: {\n describe: \"Value Type Output File\",\n type: \"string\",\n default: \"value-types.json\",\n coerce: path.resolve,\n },\n dependencies: {\n describe: \"File to write dependencies to\",\n type: \"string\",\n coerce: path.resolve,\n },\n generateCodeSnippets: {\n describe: \"Enable code snippet files creation\",\n type: \"boolean\",\n default: false,\n },\n codeSnippetPackageName: {\n describe:\n \"The package name that will be displayed in the code snippets\",\n default: \"\",\n type: \"string\",\n },\n codeSnippetDir: {\n describe: \"Directory for generated code snippet files\",\n type: \"string\",\n default: \"./\",\n coerce: path.resolve,\n },\n randomnessKey: {\n describe: \"Value used to assure uniqueness of entities\",\n type: \"string\",\n coerce: path.resolve,\n },\n })\n .parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace = (commandLineOpts.apiNamespace.slice(-1) !== \".\")\n ? commandLineOpts.apiNamespace + \".\"\n : commandLineOpts.apiNamespace;\n invariant(apiNamespace.length < 1024, \"API namespace is too long.\");\n invariant(\n apiNamespaceRegex.test(apiNamespace),\n \"API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$\",\n );\n }\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n\n if (\n !commandLineOpts.generateCodeSnippets\n && (commandLineOpts.codeSnippetPackageName !== \"\"\n || commandLineOpts.codeSnippetDir !== path.resolve(\"./\"))\n ) {\n consola.info(\n \"Package name and/or directory supplied for code snippets, but code snippet generation is false.\",\n );\n }\n\n if (commandLineOpts.randomnessKey !== undefined) {\n invariant(\n uuidRegex.test(commandLineOpts.randomnessKey),\n \"Supplied randomness key is not a uuid and shouldn't be used as a uniqueness guarantee\",\n );\n }\n\n const ontologyIr = await loadOntology(\n commandLineOpts.input,\n apiNamespace,\n commandLineOpts.outputDir,\n commandLineOpts.dependencies,\n commandLineOpts.generateCodeSnippets,\n commandLineOpts.codeSnippetPackageName,\n commandLineOpts.codeSnippetDir,\n commandLineOpts.randomnessKey,\n );\n\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await fs.writeFile(\n commandLineOpts.output,\n JSON.stringify(\n ontologyIr,\n null,\n 2,\n ),\n );\n // No point in generating block if there aren't any value types\n if (\n ontologyIr.valueTypes.valueTypes.length > 0\n || ontologyIr.importedValueTypes.valueTypes.length > 0\n ) {\n await fs.writeFile(\n commandLineOpts.valueTypesOutput,\n JSON.stringify(\n ontologyIr.valueTypes,\n null,\n 2,\n ),\n );\n }\n}\n\nasync function loadOntology(\n input: string,\n apiNamespace: string,\n outputDir: string | undefined,\n dependencyFile: string | undefined,\n generateCodeSnippets: boolean,\n snippetPackageName: string,\n codeSnippetDir: string,\n randomnessKey?: string,\n) {\n const q = await defineOntology(\n apiNamespace,\n async () => await import(input),\n outputDir,\n dependencyFile,\n generateCodeSnippets,\n snippetPackageName,\n codeSnippetDir,\n randomnessKey,\n );\n return q;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAO,KAAKC,EAAE,MAAM,kBAAkB;AACtC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,MAAMC,iBAAiB,GAAG,+BAA+B;AACzD,MAAMC,SAAS,GACb,gEAAgE;AAElE,eAAe,eAAe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B,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7BsB,cAAkC,EAClCnB,oBAA6B,EAC7BoB,kBAA0B,EAC1BlB,cAAsB,EACtBC,aAAsB,EACtB;EACA,MAAMkB,CAAC,GAAG,MAAMlD,cAAc,CAC5BwB,YAAY,EACZ,YAAY,MAAM,MAAM,CAACR,KAAK,CAAC,EAC/BU,SAAS,EACTsB,cAAc,EACdnB,oBAAoB,EACpBoB,kBAAkB,EAClBlB,cAAc,EACdC,aACF,CAAC;EACD,OAAOkB,CAAC;AACV","ignoreList":[]}
@@ -16,7 +16,7 @@
16
16
 
17
17
  import invariant from "tiny-invariant";
18
18
  export function convertDatasourceDefinition(objectType, properties) {
19
- const baseDatasource = objectType.datasources?.find(ds => ["dataset", "stream", "restrictedView"].includes(ds.type));
19
+ const baseDatasource = objectType.datasources?.find(ds => ["dataset", "stream", "restrictedView", "direct"].includes(ds.type));
20
20
  switch (baseDatasource?.type) {
21
21
  case "stream":
22
22
  const window = baseDatasource.retentionPeriod;
@@ -55,6 +55,15 @@ export function convertDatasourceDefinition(objectType, properties) {
55
55
  propertyMapping: buildPropertyMapping(properties)
56
56
  }
57
57
  };
58
+ case "direct":
59
+ return {
60
+ type: "direct",
61
+ direct: {
62
+ directSourceRid: objectType.apiName,
63
+ propertyMapping: buildPropertyMapping(properties),
64
+ propertySecurityGroups: convertPropertySecurityGroups(baseDatasource, properties, objectType.primaryKeyPropertyApiName)
65
+ }
66
+ };
58
67
  case "dataset":
59
68
  default:
60
69
  if (objectType.properties?.some(prop => typeof prop.type === "object" && prop.type.type === "marking") || baseDatasource?.objectSecurityPolicy || baseDatasource?.propertySecurityGroups) {
@@ -95,6 +104,7 @@ function convertPropertySecurityGroups(ds, properties, primaryKeyPropertyApiName
95
104
  },
96
105
  additionalMandatory: {
97
106
  markings: {},
107
+ assumedMarkingsV2: {},
98
108
  assumedMarkings: []
99
109
  }
100
110
  }
@@ -121,7 +131,7 @@ function convertPropertySecurityGroups(ds, properties, primaryKeyPropertyApiName
121
131
  rid: ds.objectSecurityPolicy?.name || "defaultObjectSecurityPolicy",
122
132
  security: {
123
133
  type: "granular",
124
- granular: convertGranularPolicy(ds.objectSecurityPolicy?.granularPolicy, ds.objectSecurityPolicy?.additionalMandatoryMarkings)
134
+ granular: convertGranularPolicy(ds.objectSecurityPolicy?.granularPolicy, ds.objectSecurityPolicy?.appliedMarkings, ds.objectSecurityPolicy?.assumedMarkings)
125
135
  },
126
136
  type: {
127
137
  type: "primaryKey",
@@ -134,7 +144,7 @@ function convertPropertySecurityGroups(ds, properties, primaryKeyPropertyApiName
134
144
  rid: psg.name,
135
145
  security: {
136
146
  type: "granular",
137
- granular: convertGranularPolicy(psg.granularPolicy, psg.additionalMandatoryMarkings)
147
+ granular: convertGranularPolicy(psg.granularPolicy, psg.appliedMarkings, psg.assumedMarkings)
138
148
  },
139
149
  type: {
140
150
  type: "property",
@@ -146,7 +156,7 @@ function convertPropertySecurityGroups(ds, properties, primaryKeyPropertyApiName
146
156
  })) ?? [])]
147
157
  };
148
158
  }
149
- function convertGranularPolicy(granularPolicy, additionalMandatoryMarkings) {
159
+ function convertGranularPolicy(granularPolicy, appliedMarkings, assumedMarkings) {
150
160
  return {
151
161
  viewPolicy: {
152
162
  granularPolicyCondition: granularPolicy ? convertSecurityCondition(granularPolicy) : {
@@ -156,8 +166,9 @@ function convertGranularPolicy(granularPolicy, additionalMandatoryMarkings) {
156
166
  }
157
167
  },
158
168
  additionalMandatory: {
159
- markings: additionalMandatoryMarkings ?? {},
160
- assumedMarkings: []
169
+ markings: appliedMarkings ?? {},
170
+ assumedMarkings: [],
171
+ assumedMarkingsV2: assumedMarkings ?? {}
161
172
  }
162
173
  }
163
174
  };
@@ -1 +1 @@
1
- {"version":3,"file":"convertDatasourceDefinition.js","names":["invariant","convertDatasourceDefinition","objectType","properties","baseDatasource","datasources","find","ds","includes","type","window","retentionPeriod","retentionPolicy","time","none","propertyMapping","Object","fromEntries","map","prop","apiName","streamV2","streamLocator","propertySecurityGroups","undefined","restrictedViewV2","restrictedViewRid","buildPropertyMapping","datasetV2","datasetRid","some","objectSecurityPolicy","datasetV3","branchId","convertPropertySecurityGroups","primaryKeyPropertyApiName","groups","rid","security","granular","viewPolicy","granularPolicyCondition","and","conditions","additionalMandatory","markings","assumedMarkings","primaryKey","validPropertyNames","Set","usedProperties","forEach","psg","propertyName","has","process","env","NODE_ENV","name","add","objectSecurityPolicyGroup","convertGranularPolicy","granularPolicy","additionalMandatoryMarkings","filter","property","convertSecurityCondition","condition","c","or","comparison","operator","left","userProperty","groupIds","right","constant","strings","editOnly","structMapping","struct","column","mapping","keys","structDefinition","fieldName","mappings"],"sources":["convertDatasourceDefinition.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 MarkingType,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrPropertySecurityGroup,\n OntologyIrPropertySecurityGroups,\n OntologyIrSecurityGroupGranularCondition,\n OntologyIrSecurityGroupGranularSecurityDefinition,\n PropertyTypeMappingInfo,\n RetentionPolicy,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport type { ObjectType } from \"../../api/object/ObjectType.js\";\nimport type { ObjectTypeDatasourceDefinition_dataset } from \"../../api/object/ObjectTypeDatasourceDefinition.js\";\nimport type { SecurityConditionDefinition } from \"../../api/object/SecurityCondition.js\";\n\nexport function convertDatasourceDefinition(\n objectType: ObjectType,\n properties: ObjectPropertyType[],\n): OntologyIrObjectTypeDatasourceDefinition {\n const baseDatasource = objectType.datasources?.find(ds =>\n [\"dataset\", \"stream\", \"restrictedView\"].includes(ds.type)\n );\n switch (baseDatasource?.type) {\n case \"stream\":\n const window = baseDatasource.retentionPeriod;\n const retentionPolicy: RetentionPolicy = window\n ? { type: \"time\", time: { window } }\n : { type: \"none\", none: {} };\n const propertyMapping = Object.fromEntries(\n properties.map((\n prop,\n ) => [prop.apiName, prop.apiName]),\n );\n return {\n type: \"streamV2\",\n streamV2: {\n streamLocator: objectType.apiName,\n propertyMapping,\n retentionPolicy,\n propertySecurityGroups: undefined,\n },\n };\n case \"restrictedView\":\n return {\n type: \"restrictedViewV2\",\n restrictedViewV2: {\n restrictedViewRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n case \"derived\":\n return {\n type: \"datasetV2\",\n datasetV2: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n case \"dataset\":\n default:\n if (\n objectType.properties?.some(prop =>\n typeof prop.type === \"object\" && prop.type.type === \"marking\"\n )\n || baseDatasource?.objectSecurityPolicy\n || baseDatasource?.propertySecurityGroups\n ) {\n return {\n type: \"datasetV3\",\n datasetV3: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n branchId: \"master\",\n propertySecurityGroups: convertPropertySecurityGroups(\n baseDatasource,\n properties,\n objectType.primaryKeyPropertyApiName,\n ),\n },\n };\n }\n return {\n type: \"datasetV2\",\n datasetV2: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n }\n}\n\nfunction convertPropertySecurityGroups(\n ds: ObjectTypeDatasourceDefinition_dataset | undefined,\n properties: ObjectPropertyType[],\n primaryKeyPropertyApiName: string,\n): OntologyIrPropertySecurityGroups {\n if (\n !ds\n || (!(\"objectSecurityPolicy\" in ds) && !(\"propertySecurityGroups\" in ds))\n ) {\n return {\n groups: [\n {\n properties: properties.map(prop => prop.apiName),\n rid: \"defaultObjectSecurityPolicy\",\n security: {\n type: \"granular\",\n granular: {\n viewPolicy: {\n granularPolicyCondition: {\n type: \"and\",\n and: {\n conditions: [],\n },\n },\n additionalMandatory: {\n markings: {},\n assumedMarkings: [],\n },\n },\n },\n },\n type: {\n type: \"primaryKey\",\n primaryKey: {},\n },\n },\n ],\n };\n }\n\n const validPropertyNames = new Set(properties.map(prop => prop.apiName));\n const usedProperties = new Set();\n\n ds.propertySecurityGroups?.forEach(psg => {\n psg.properties.forEach(propertyName => {\n invariant(\n validPropertyNames.has(propertyName),\n `Property \"${propertyName}\" in property security group ${psg.name} does not exist in the properties list`,\n );\n invariant(\n !usedProperties.has(propertyName),\n `Property \"${propertyName}\" is used in multiple property security groups`,\n );\n invariant(\n propertyName !== primaryKeyPropertyApiName,\n `Property \"${propertyName}\" in property security group ${psg.name} cannot be the primary key`,\n );\n usedProperties.add(propertyName);\n });\n });\n\n const objectSecurityPolicyGroup: OntologyIrPropertySecurityGroup = {\n rid: ds.objectSecurityPolicy?.name || \"defaultObjectSecurityPolicy\",\n security: {\n type: \"granular\",\n granular: convertGranularPolicy(\n ds.objectSecurityPolicy?.granularPolicy,\n ds.objectSecurityPolicy?.additionalMandatoryMarkings,\n ),\n },\n type: {\n type: \"primaryKey\",\n primaryKey: {},\n },\n properties: properties\n .filter(prop => !usedProperties.has(prop.apiName))\n .map(prop => prop.apiName),\n };\n\n return {\n groups: [\n objectSecurityPolicyGroup,\n ...(ds.propertySecurityGroups?.map(psg => ({\n rid: psg.name,\n security: {\n type: \"granular\" as const,\n granular: convertGranularPolicy(\n psg.granularPolicy,\n psg.additionalMandatoryMarkings,\n ),\n },\n type: {\n type: \"property\" as const,\n property: {\n name: psg.name,\n },\n },\n properties: psg.properties ?? [],\n })) ?? []),\n ],\n };\n}\n\nfunction convertGranularPolicy(\n granularPolicy?: SecurityConditionDefinition,\n additionalMandatoryMarkings?: Record<string, MarkingType>,\n): OntologyIrSecurityGroupGranularSecurityDefinition {\n return {\n viewPolicy: {\n granularPolicyCondition: granularPolicy\n ? convertSecurityCondition(granularPolicy)\n : {\n type: \"and\",\n and: {\n conditions: [],\n },\n },\n additionalMandatory: {\n markings: additionalMandatoryMarkings ?? {},\n assumedMarkings: [],\n },\n },\n };\n}\n\nfunction convertSecurityCondition(\n condition: SecurityConditionDefinition,\n): OntologyIrSecurityGroupGranularCondition {\n switch (condition.type) {\n case \"and\":\n if (\"conditions\" in condition) {\n return {\n type: \"and\",\n and: {\n conditions: condition.conditions.map(c =>\n convertSecurityCondition(c)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"or\":\n if (\"conditions\" in condition) {\n return {\n type: \"or\",\n or: {\n conditions: condition.conditions.map(c =>\n convertSecurityCondition(c)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"markingProperty\":\n return {\n type: \"markings\",\n markings: {\n property: condition.property,\n },\n };\n case \"groupProperty\":\n return {\n type: \"comparison\",\n comparison: {\n operator: \"INTERSECTS\",\n left: {\n type: \"userProperty\",\n userProperty: {\n type: \"groupIds\",\n groupIds: {},\n },\n },\n right: {\n type: \"property\",\n property: condition.property,\n },\n },\n };\n case \"group\":\n return {\n type: \"comparison\",\n comparison: {\n operator: \"INTERSECTS\",\n left: {\n type: \"userProperty\",\n userProperty: {\n type: \"groupIds\",\n groupIds: {},\n },\n },\n right: {\n type: \"constant\",\n constant: {\n type: \"strings\",\n strings: [\n condition.name,\n ],\n },\n },\n },\n };\n\n default:\n return condition;\n }\n}\n\nfunction buildPropertyMapping(\n properties: ObjectPropertyType[],\n): Record<string, PropertyTypeMappingInfo> {\n return Object.fromEntries(\n properties.map((prop) => {\n // editOnly\n if (prop.editOnly) {\n return [prop.apiName, { type: \"editOnly\", editOnly: {} }];\n }\n // structs\n if (typeof prop.type === \"object\" && prop.type?.type === \"struct\") {\n const structMapping = {\n type: \"struct\",\n struct: {\n column: prop.apiName,\n mapping: Object.fromEntries(\n Object.keys(prop.type.structDefinition).map((fieldName) => [\n fieldName,\n { apiName: fieldName, mappings: {} },\n ]),\n ),\n },\n };\n return [prop.apiName, structMapping];\n }\n // default: column mapping\n return [prop.apiName, { type: \"column\", column: prop.apiName }];\n }),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,OAAOA,SAAS,MAAM,gBAAgB;AAMtC,OAAO,SAASC,2BAA2BA,CACzCC,UAAsB,EACtBC,UAAgC,EACU;EAC1C,MAAMC,cAAc,GAAGF,UAAU,CAACG,WAAW,EAAEC,IAAI,CAACC,EAAE,IACpD,CAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAACC,QAAQ,CAACD,EAAE,CAACE,IAAI,CAC1D,CAAC;EACD,QAAQL,cAAc,EAAEK,IAAI;IAC1B,KAAK,QAAQ;MACX,MAAMC,MAAM,GAAGN,cAAc,CAACO,eAAe;MAC7C,MAAMC,eAAgC,GAAGF,MAAM,GAC3C;QAAED,IAAI,EAAE,MAAM;QAAEI,IAAI,EAAE;UAAEH;QAAO;MAAE,CAAC,GAClC;QAAED,IAAI,EAAE,MAAM;QAAEK,IAAI,EAAE,CAAC;MAAE,CAAC;MAC9B,MAAMC,eAAe,GAAGC,MAAM,CAACC,WAAW,CACxCd,UAAU,CAACe,GAAG,CACZC,IAAI,IACD,CAACA,IAAI,CAACC,OAAO,EAAED,IAAI,CAACC,OAAO,CAAC,CACnC,CAAC;MACD,OAAO;QACLX,IAAI,EAAE,UAAU;QAChBY,QAAQ,EAAE;UACRC,aAAa,EAAEpB,UAAU,CAACkB,OAAO;UACjCL,eAAe;UACfH,eAAe;UACfW,sBAAsB,EAAEC;QAC1B;MACF,CAAC;IACH,KAAK,gBAAgB;MACnB,OAAO;QACLf,IAAI,EAAE,kBAAkB;QACxBgB,gBAAgB,EAAE;UAChBC,iBAAiB,EAAExB,UAAU,CAACkB,OAAO;UACrCL,eAAe,EAAEY,oBAAoB,CAACxB,UAAU;QAClD;MACF,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AC;MACD,OAAO,CAACnE,IAAI,CAACC,OAAO,EAAE2D,aAAa,CAAC;IACtC;IACA;IACA,OAAO,CAAC5D,IAAI,CAACC,OAAO,EAAE;MAAEX,IAAI,EAAE,QAAQ;MAAEwE,MAAM,EAAE9D,IAAI,CAACC;IAAQ,CAAC,CAAC;EACjE,CAAC,CACH,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"convertDatasourceDefinition.js","names":["invariant","convertDatasourceDefinition","objectType","properties","baseDatasource","datasources","find","ds","includes","type","window","retentionPeriod","retentionPolicy","time","none","propertyMapping","Object","fromEntries","map","prop","apiName","streamV2","streamLocator","propertySecurityGroups","undefined","restrictedViewV2","restrictedViewRid","buildPropertyMapping","datasetV2","datasetRid","direct","directSourceRid","convertPropertySecurityGroups","primaryKeyPropertyApiName","some","objectSecurityPolicy","datasetV3","branchId","groups","rid","security","granular","viewPolicy","granularPolicyCondition","and","conditions","additionalMandatory","markings","assumedMarkingsV2","assumedMarkings","primaryKey","validPropertyNames","Set","usedProperties","forEach","psg","propertyName","has","process","env","NODE_ENV","name","add","objectSecurityPolicyGroup","convertGranularPolicy","granularPolicy","appliedMarkings","filter","property","convertSecurityCondition","condition","c","or","comparison","operator","left","userProperty","groupIds","right","constant","strings","editOnly","structMapping","struct","column","mapping","keys","structDefinition","fieldName","mappings"],"sources":["convertDatasourceDefinition.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 MarkingType,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrPropertySecurityGroup,\n OntologyIrPropertySecurityGroups,\n OntologyIrSecurityGroupGranularCondition,\n OntologyIrSecurityGroupGranularSecurityDefinition,\n PropertyTypeMappingInfo,\n RetentionPolicy,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport type { ObjectType } from \"../../api/object/ObjectType.js\";\nimport type {\n ObjectTypeDatasourceDefinition_dataset,\n ObjectTypeDatasourceDefinition_direct,\n} from \"../../api/object/ObjectTypeDatasourceDefinition.js\";\nimport type { SecurityConditionDefinition } from \"../../api/object/SecurityCondition.js\";\n\nexport function convertDatasourceDefinition(\n objectType: ObjectType,\n properties: ObjectPropertyType[],\n): OntologyIrObjectTypeDatasourceDefinition {\n const baseDatasource = objectType.datasources?.find(ds =>\n [\"dataset\", \"stream\", \"restrictedView\", \"direct\"].includes(ds.type)\n );\n switch (baseDatasource?.type) {\n case \"stream\":\n const window = baseDatasource.retentionPeriod;\n const retentionPolicy: RetentionPolicy = window\n ? { type: \"time\", time: { window } }\n : { type: \"none\", none: {} };\n const propertyMapping = Object.fromEntries(\n properties.map((\n prop,\n ) => [prop.apiName, prop.apiName]),\n );\n return {\n type: \"streamV2\",\n streamV2: {\n streamLocator: objectType.apiName,\n propertyMapping,\n retentionPolicy,\n propertySecurityGroups: undefined,\n },\n };\n case \"restrictedView\":\n return {\n type: \"restrictedViewV2\",\n restrictedViewV2: {\n restrictedViewRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n case \"derived\":\n return {\n type: \"datasetV2\",\n datasetV2: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n case \"direct\":\n return {\n type: \"direct\",\n direct: {\n directSourceRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n propertySecurityGroups: convertPropertySecurityGroups(\n baseDatasource,\n properties,\n objectType.primaryKeyPropertyApiName,\n ),\n },\n };\n case \"dataset\":\n default:\n if (\n objectType.properties?.some(prop =>\n typeof prop.type === \"object\" && prop.type.type === \"marking\"\n )\n || baseDatasource?.objectSecurityPolicy\n || baseDatasource?.propertySecurityGroups\n ) {\n return {\n type: \"datasetV3\",\n datasetV3: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n branchId: \"master\",\n propertySecurityGroups: convertPropertySecurityGroups(\n baseDatasource,\n properties,\n objectType.primaryKeyPropertyApiName,\n ),\n },\n };\n }\n return {\n type: \"datasetV2\",\n datasetV2: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n }\n}\n\nfunction convertPropertySecurityGroups(\n ds:\n | ObjectTypeDatasourceDefinition_dataset\n | ObjectTypeDatasourceDefinition_direct\n | undefined,\n properties: ObjectPropertyType[],\n primaryKeyPropertyApiName: string,\n): OntologyIrPropertySecurityGroups {\n if (\n !ds\n || (!(\"objectSecurityPolicy\" in ds) && !(\"propertySecurityGroups\" in ds))\n ) {\n return {\n groups: [\n {\n properties: properties.map(prop => prop.apiName),\n rid: \"defaultObjectSecurityPolicy\",\n security: {\n type: \"granular\",\n granular: {\n viewPolicy: {\n granularPolicyCondition: {\n type: \"and\",\n and: {\n conditions: [],\n },\n },\n additionalMandatory: {\n markings: {},\n assumedMarkingsV2: {},\n assumedMarkings: [],\n },\n },\n },\n },\n type: {\n type: \"primaryKey\",\n primaryKey: {},\n },\n },\n ],\n };\n }\n\n const validPropertyNames = new Set(properties.map(prop => prop.apiName));\n const usedProperties = new Set();\n\n ds.propertySecurityGroups?.forEach(psg => {\n psg.properties.forEach(propertyName => {\n invariant(\n validPropertyNames.has(propertyName),\n `Property \"${propertyName}\" in property security group ${psg.name} does not exist in the properties list`,\n );\n invariant(\n !usedProperties.has(propertyName),\n `Property \"${propertyName}\" is used in multiple property security groups`,\n );\n invariant(\n propertyName !== primaryKeyPropertyApiName,\n `Property \"${propertyName}\" in property security group ${psg.name} cannot be the primary key`,\n );\n usedProperties.add(propertyName);\n });\n });\n\n const objectSecurityPolicyGroup: OntologyIrPropertySecurityGroup = {\n rid: ds.objectSecurityPolicy?.name || \"defaultObjectSecurityPolicy\",\n security: {\n type: \"granular\",\n granular: convertGranularPolicy(\n ds.objectSecurityPolicy?.granularPolicy,\n ds.objectSecurityPolicy?.appliedMarkings,\n ds.objectSecurityPolicy?.assumedMarkings,\n ),\n },\n type: {\n type: \"primaryKey\",\n primaryKey: {},\n },\n properties: properties\n .filter(prop => !usedProperties.has(prop.apiName))\n .map(prop => prop.apiName),\n };\n\n return {\n groups: [\n objectSecurityPolicyGroup,\n ...(ds.propertySecurityGroups?.map(psg => ({\n rid: psg.name,\n security: {\n type: \"granular\" as const,\n granular: convertGranularPolicy(\n psg.granularPolicy,\n psg.appliedMarkings,\n psg.assumedMarkings,\n ),\n },\n type: {\n type: \"property\" as const,\n property: {\n name: psg.name,\n },\n },\n properties: psg.properties ?? [],\n })) ?? []),\n ],\n };\n}\n\nfunction convertGranularPolicy(\n granularPolicy?: SecurityConditionDefinition,\n appliedMarkings?: Record<string, MarkingType>,\n assumedMarkings?: Record<string, MarkingType>,\n): OntologyIrSecurityGroupGranularSecurityDefinition {\n return {\n viewPolicy: {\n granularPolicyCondition: granularPolicy\n ? convertSecurityCondition(granularPolicy)\n : {\n type: \"and\",\n and: {\n conditions: [],\n },\n },\n additionalMandatory: {\n markings: appliedMarkings ?? {},\n assumedMarkings: [],\n assumedMarkingsV2: assumedMarkings ?? {},\n },\n },\n };\n}\n\nfunction convertSecurityCondition(\n condition: SecurityConditionDefinition,\n): OntologyIrSecurityGroupGranularCondition {\n switch (condition.type) {\n case \"and\":\n if (\"conditions\" in condition) {\n return {\n type: \"and\",\n and: {\n conditions: condition.conditions.map(c =>\n convertSecurityCondition(c)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"or\":\n if (\"conditions\" in condition) {\n return {\n type: \"or\",\n or: {\n conditions: condition.conditions.map(c =>\n convertSecurityCondition(c)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"markingProperty\":\n return {\n type: \"markings\",\n markings: {\n property: condition.property,\n },\n };\n case \"groupProperty\":\n return {\n type: \"comparison\",\n comparison: {\n operator: \"INTERSECTS\",\n left: {\n type: \"userProperty\",\n userProperty: {\n type: \"groupIds\",\n groupIds: {},\n },\n },\n right: {\n type: \"property\",\n property: condition.property,\n },\n },\n };\n case \"group\":\n return {\n type: \"comparison\",\n comparison: {\n operator: \"INTERSECTS\",\n left: {\n type: \"userProperty\",\n userProperty: {\n type: \"groupIds\",\n groupIds: {},\n },\n },\n right: {\n type: \"constant\",\n constant: {\n type: \"strings\",\n strings: [\n condition.name,\n ],\n },\n },\n },\n };\n\n default:\n return condition;\n }\n}\n\nfunction buildPropertyMapping(\n properties: ObjectPropertyType[],\n): Record<string, PropertyTypeMappingInfo> {\n return Object.fromEntries(\n properties.map((prop) => {\n // editOnly\n if (prop.editOnly) {\n return [prop.apiName, { type: \"editOnly\", editOnly: {} }];\n }\n // structs\n if (typeof prop.type === \"object\" && prop.type?.type === \"struct\") {\n const structMapping = {\n type: \"struct\",\n struct: {\n column: prop.apiName,\n mapping: Object.fromEntries(\n Object.keys(prop.type.structDefinition).map((fieldName) => [\n fieldName,\n { apiName: fieldName, mappings: {} },\n ]),\n ),\n },\n };\n return [prop.apiName, structMapping];\n }\n // default: column mapping\n return [prop.apiName, { type: \"column\", column: prop.apiName }];\n }),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,OAAOA,SAAS,MAAM,gBAAgB;AAStC,OAAO,SAASC,2BAA2BA,CACzCC,UAAsB,EACtBC,UAAgC,EACU;EAC1C,MAAMC,cAAc,GAAGF,UAAU,CAACG,WAAW,EAAEC,IAAI,CAACC,EAAE,IACpD,CAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAACD,EAAE,CAACE,IAAI,CACpE,CAAC;EACD,QAA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;IACtC;IACA;IACA,OAAO,CAAC/D,IAAI,CAACC,OAAO,EAAE;MAAEX,IAAI,EAAE,QAAQ;MAAE2E,MAAM,EAAEjE,IAAI,CAACC;IAAQ,CAAC,CAAC;EACjE,CAAC,CACH,CAAC;AACH","ignoreList":[]}
@@ -41,7 +41,8 @@ export function convertInterface(interfaceType) {
41
41
  extendsInterfaces: interfaceType.extendsInterfaces.map(i => i.apiName),
42
42
  // these are omitted from our internal types but we need to re-add them for the final json
43
43
  properties: [],
44
- propertiesV3: Object.fromEntries(Object.entries(interfaceType.propertiesV3).map(([apiName, prop]) => convertInterfaceProperty(prop, apiName)))
44
+ propertiesV3: Object.fromEntries(Object.entries(interfaceType.propertiesV3).map(([apiName, prop]) => convertInterfaceProperty(prop, apiName))),
45
+ extendsInterfacesMetadata: interfaceType.extendsInterfaces.map(i => convertInterface(i))
45
46
  };
46
47
  }
47
48
  //# sourceMappingURL=convertInterface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertInterface.js","names":["convertInterfaceProperty","convertSpt","convertInterface","interfaceType","__type","other","propertiesV2","Object","fromEntries","values","map","spt","sharedPropertyType","apiName","required","displayMetadata","displayName","description","icon","type","blueprint","color","locator","extendsInterfaces","i","properties","propertiesV3","entries","prop"],"sources":["convertInterface.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 { OntologyIrMarketplaceInterfaceType } from \"@osdk/client.unstable\";\nimport type { InterfaceType } from \"../../api/interface/InterfaceType.js\";\nimport { convertInterfaceProperty } from \"./convertInterfacePropertyType.js\";\nimport { convertSpt } from \"./convertSpt.js\";\n\nexport function convertInterface(\n interfaceType: InterfaceType,\n): OntologyIrMarketplaceInterfaceType {\n const { __type, ...other } = interfaceType;\n return {\n ...other,\n propertiesV2: Object.fromEntries(\n Object.values(interfaceType.propertiesV2)\n .map((\n spt,\n ) => [spt.sharedPropertyType.apiName, {\n required: spt.required,\n sharedPropertyType: convertSpt(spt.sharedPropertyType),\n }]),\n ),\n displayMetadata: {\n displayName: interfaceType.displayMetadata.displayName,\n description: interfaceType.displayMetadata.description,\n icon: interfaceType.displayMetadata.icon ?? {\n type: \"blueprint\",\n blueprint: { color: \"#4C90F0\", locator: \"layout-hierarchy\" },\n },\n },\n extendsInterfaces: interfaceType.extendsInterfaces.map(i => i.apiName),\n // these are omitted from our internal types but we need to re-add them for the final json\n properties: [],\n propertiesV3: Object.fromEntries(\n Object.entries(interfaceType.propertiesV3).map(([apiName, prop]) =>\n convertInterfaceProperty(prop, apiName)\n ),\n ),\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,wBAAwB,QAAQ,mCAAmC;AAC5E,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,OAAO,SAASC,gBAAgBA,CAC9BC,aAA4B,EACQ;EACpC,MAAM;IAAEC,MAAM;IAAE,GAAGC;EAAM,CAAC,GAAGF,aAAa;EAC1C,OAAO;IACL,GAAGE,KAAK;IACRC,YAAY,EAAEC,MAAM,CAACC,WAAW,CAC9BD,MAAM,CAACE,MAAM,CAACN,aAAa,CAACG,YAAY,CAAC,CACtCI,GAAG,CACFC,GAAG,IACA,CAACA,GAAG,CAACC,kBAAkB,CAACC,OAAO,EAAE;MACpCC,QAAQ,EAAEH,GAAG,CAACG,QAAQ;MACtBF,kBAAkB,EAAEX,UAAU,CAACU,GAAG,CAACC,kBAAkB;IACvD,CAAC,CAAC,CACN,CAAC;IACDG,eAAe,EAAE;MACfC,WAAW,EAAEb,aAAa,CAACY,eAAe,CAACC,WAAW;MACtDC,WAAW,EAAEd,aAAa,CAACY,eAAe,CAACE,WAAW;MACtDC,IAAI,EAAEf,aAAa,CAACY,eAAe,CAACG,IAAI,IAAI;QAC1CC,IAAI,EAAE,WAAW;QACjBC,SAAS,EAAE;UAAEC,KAAK,EAAE,SAAS;UAAEC,OAAO,EAAE;QAAmB;MAC7D;IACF,CAAC;IACDC,iBAAiB,EAAEpB,aAAa,CAACoB,iBAAiB,CAACb,GAAG,CAACc,CAAC,IAAIA,CAAC,CAACX,OAAO,CAAC;IACtE;IACAY,UAAU,EAAE,EAAE;IACdC,YAAY,EAAEnB,MAAM,CAACC,WAAW,CAC9BD,MAAM,CAACoB,OAAO,CAACxB,aAAa,CAACuB,YAAY,CAAC,CAAChB,GAAG,CAAC,CAAC,CAACG,OAAO,EAAEe,IAAI,CAAC,KAC7D5B,wBAAwB,CAAC4B,IAAI,EAAEf,OAAO,CACxC,CACF;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"convertInterface.js","names":["convertInterfaceProperty","convertSpt","convertInterface","interfaceType","__type","other","propertiesV2","Object","fromEntries","values","map","spt","sharedPropertyType","apiName","required","displayMetadata","displayName","description","icon","type","blueprint","color","locator","extendsInterfaces","i","properties","propertiesV3","entries","prop","extendsInterfacesMetadata"],"sources":["convertInterface.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 { OntologyIrMarketplaceInterfaceType } from \"@osdk/client.unstable\";\nimport type { InterfaceType } from \"../../api/interface/InterfaceType.js\";\nimport { convertInterfaceProperty } from \"./convertInterfacePropertyType.js\";\nimport { convertSpt } from \"./convertSpt.js\";\n\nexport function convertInterface(\n interfaceType: InterfaceType,\n): OntologyIrMarketplaceInterfaceType {\n const { __type, ...other } = interfaceType;\n return {\n ...other,\n propertiesV2: Object.fromEntries(\n Object.values(interfaceType.propertiesV2)\n .map((\n spt,\n ) => [spt.sharedPropertyType.apiName, {\n required: spt.required,\n sharedPropertyType: convertSpt(spt.sharedPropertyType),\n }]),\n ),\n displayMetadata: {\n displayName: interfaceType.displayMetadata.displayName,\n description: interfaceType.displayMetadata.description,\n icon: interfaceType.displayMetadata.icon ?? {\n type: \"blueprint\",\n blueprint: { color: \"#4C90F0\", locator: \"layout-hierarchy\" },\n },\n },\n extendsInterfaces: interfaceType.extendsInterfaces.map(i => i.apiName),\n // these are omitted from our internal types but we need to re-add them for the final json\n properties: [],\n propertiesV3: Object.fromEntries(\n Object.entries(interfaceType.propertiesV3).map(([apiName, prop]) =>\n convertInterfaceProperty(prop, apiName)\n ),\n ),\n extendsInterfacesMetadata: interfaceType.extendsInterfaces.map(i =>\n convertInterface(i)\n ),\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,wBAAwB,QAAQ,mCAAmC;AAC5E,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,OAAO,SAASC,gBAAgBA,CAC9BC,aAA4B,EACQ;EACpC,MAAM;IAAEC,MAAM;IAAE,GAAGC;EAAM,CAAC,GAAGF,aAAa;EAC1C,OAAO;IACL,GAAGE,KAAK;IACRC,YAAY,EAAEC,MAAM,CAACC,WAAW,CAC9BD,MAAM,CAACE,MAAM,CAACN,aAAa,CAACG,YAAY,CAAC,CACtCI,GAAG,CACFC,GAAG,IACA,CAACA,GAAG,CAACC,kBAAkB,CAACC,OAAO,EAAE;MACpCC,QAAQ,EAAEH,GAAG,CAACG,QAAQ;MACtBF,kBAAkB,EAAEX,UAAU,CAACU,GAAG,CAACC,kBAAkB;IACvD,CAAC,CAAC,CACN,CAAC;IACDG,eAAe,EAAE;MACfC,WAAW,EAAEb,aAAa,CAACY,eAAe,CAACC,WAAW;MACtDC,WAAW,EAAEd,aAAa,CAACY,eAAe,CAACE,WAAW;MACtDC,IAAI,EAAEf,aAAa,CAACY,eAAe,CAACG,IAAI,IAAI;QAC1CC,IAAI,EAAE,WAAW;QACjBC,SAAS,EAAE;UAAEC,KAAK,EAAE,SAAS;UAAEC,OAAO,EAAE;QAAmB;MAC7D;IACF,CAAC;IACDC,iBAAiB,EAAEpB,aAAa,CAACoB,iBAAiB,CAACb,GAAG,CAACc,CAAC,IAAIA,CAAC,CAACX,OAAO,CAAC;IACtE;IACAY,UAAU,EAAE,EAAE;IACdC,YAAY,EAAEnB,MAAM,CAACC,WAAW,CAC9BD,MAAM,CAACoB,OAAO,CAACxB,aAAa,CAACuB,YAAY,CAAC,CAAChB,GAAG,CAAC,CAAC,CAACG,OAAO,EAAEe,IAAI,CAAC,KAC7D5B,wBAAwB,CAAC4B,IAAI,EAAEf,OAAO,CACxC,CACF,CAAC;IACDgB,yBAAyB,EAAE1B,aAAa,CAACoB,iBAAiB,CAACb,GAAG,CAACc,CAAC,IAC9DtB,gBAAgB,CAACsB,CAAC,CACpB;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright 2026 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 { isStruct } from "../../api/properties/PropertyTypeType.js";
18
+ import { propertyTypeTypeToOntologyIrType } from "./propertyTypeTypeToOntologyIrType.js";
19
+ export function convertMainValue(type, apiName, sharedPropertyType) {
20
+ if (sharedPropertyType && isStruct(sharedPropertyType.type) && sharedPropertyType.type.mainValue) {
21
+ return {
22
+ fieldApiNames: Array.isArray(sharedPropertyType.type.mainValue.fields) ? sharedPropertyType.type.mainValue.fields : [sharedPropertyType.type.mainValue.fields],
23
+ structApiName: sharedPropertyType.apiName,
24
+ type: propertyTypeTypeToOntologyIrType(sharedPropertyType.type.mainValue.type)
25
+ };
26
+ }
27
+ if (isStruct(type) && type.mainValue) {
28
+ return {
29
+ fieldApiNames: Array.isArray(type.mainValue.fields) ? type.mainValue.fields : [type.mainValue.fields],
30
+ structApiName: apiName,
31
+ type: propertyTypeTypeToOntologyIrType(type.mainValue.type)
32
+ };
33
+ }
34
+ return undefined;
35
+ }
36
+ //# sourceMappingURL=convertMainValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertMainValue.js","names":["isStruct","propertyTypeTypeToOntologyIrType","convertMainValue","type","apiName","sharedPropertyType","mainValue","fieldApiNames","Array","isArray","fields","structApiName","undefined"],"sources":["convertMainValue.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { OntologyIrStructMainValue } from \"@osdk/client.unstable\";\nimport {\n isStruct,\n type PropertyTypeType,\n} from \"../../api/properties/PropertyTypeType.js\";\nimport type { SharedPropertyType } from \"../../api/properties/SharedPropertyType.js\";\nimport { propertyTypeTypeToOntologyIrType } from \"./propertyTypeTypeToOntologyIrType.js\";\n\nexport function convertMainValue(\n type: PropertyTypeType,\n apiName?: string,\n sharedPropertyType?: SharedPropertyType,\n): OntologyIrStructMainValue | undefined {\n if (\n sharedPropertyType && isStruct(sharedPropertyType.type)\n && sharedPropertyType.type.mainValue\n ) {\n return {\n fieldApiNames: Array.isArray(sharedPropertyType.type.mainValue.fields)\n ? sharedPropertyType.type.mainValue.fields\n : [sharedPropertyType.type.mainValue.fields],\n structApiName: sharedPropertyType.apiName,\n type: propertyTypeTypeToOntologyIrType(\n sharedPropertyType.type.mainValue.type,\n ),\n };\n }\n if (isStruct(type) && type.mainValue) {\n return {\n fieldApiNames: Array.isArray(type.mainValue.fields)\n ? type.mainValue.fields\n : [type.mainValue.fields],\n structApiName: apiName!,\n type: propertyTypeTypeToOntologyIrType(type.mainValue.type),\n };\n }\n\n return undefined;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SACEA,QAAQ,QAEH,0CAA0C;AAEjD,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,OAAO,SAASC,gBAAgBA,CAC9BC,IAAsB,EACtBC,OAAgB,EAChBC,kBAAuC,EACA;EACvC,IACEA,kBAAkB,IAAIL,QAAQ,CAACK,kBAAkB,CAACF,IAAI,CAAC,IACpDE,kBAAkB,CAACF,IAAI,CAACG,SAAS,EACpC;IACA,OAAO;MACLC,aAAa,EAAEC,KAAK,CAACC,OAAO,CAACJ,kBAAkB,CAACF,IAAI,CAACG,SAAS,CAACI,MAAM,CAAC,GAClEL,kBAAkB,CAACF,IAAI,CAACG,SAAS,CAACI,MAAM,GACxC,CAACL,kBAAkB,CAACF,IAAI,CAACG,SAAS,CAACI,MAAM,CAAC;MAC9CC,aAAa,EAAEN,kBAAkB,CAACD,OAAO;MACzCD,IAAI,EAAEF,gCAAgC,CACpCI,kBAAkB,CAACF,IAAI,CAACG,SAAS,CAACH,IACpC;IACF,CAAC;EACH;EACA,IAAIH,QAAQ,CAACG,IAAI,CAAC,IAAIA,IAAI,CAACG,SAAS,EAAE;IACpC,OAAO;MACLC,aAAa,EAAEC,KAAK,CAACC,OAAO,CAACN,IAAI,CAACG,SAAS,CAACI,MAAM,CAAC,GAC/CP,IAAI,CAACG,SAAS,CAACI,MAAM,GACrB,CAACP,IAAI,CAACG,SAAS,CAACI,MAAM,CAAC;MAC3BC,aAAa,EAAEP,OAAQ;MACvBD,IAAI,EAAEF,gCAAgC,CAACE,IAAI,CAACG,SAAS,CAACH,IAAI;IAC5D,CAAC;EACH;EAEA,OAAOS,SAAS;AAClB","ignoreList":[]}
@@ -18,6 +18,7 @@ import invariant from "tiny-invariant";
18
18
  import { convertObjectStatus, namespace } from "../../api/defineOntology.js";
19
19
  import { defaultTypeClasses, getPropertyTypeName, hasRenderHints, shouldBeIndexedForSearch, shouldNotHaveRenderHints } from "../../api/propertyConversionUtils.js";
20
20
  import { convertNullabilityToDataConstraint } from "./convertNullabilityToDataConstraint.js";
21
+ import { convertReducers } from "./convertReducers.js";
21
22
  import { convertValueType } from "./convertValueType.js";
22
23
  import { convertValueTypeDataConstraints } from "./convertValueTypeDataConstraints.js";
23
24
  import { propertyTypeTypeToOntologyIrType } from "./propertyTypeTypeToOntologyIrType.js";
@@ -38,10 +39,10 @@ export function convertObjectPropertyType(property) {
38
39
  type: property.array ? {
39
40
  type: "array",
40
41
  array: {
41
- subtype: propertyTypeTypeToOntologyIrType(property.type),
42
- reducers: []
42
+ subtype: propertyTypeTypeToOntologyIrType(property.type, property.apiName, property.sharedPropertyType),
43
+ reducers: convertReducers(property.type, property.apiName, property.reducers ?? [], property.sharedPropertyType)
43
44
  }
44
- } : propertyTypeTypeToOntologyIrType(property.type),
45
+ } : propertyTypeTypeToOntologyIrType(property.type, property.apiName),
45
46
  typeClasses: property.typeClasses ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),
46
47
  status: convertObjectStatus(property.status),
47
48
  inlineAction: undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"convertObjectPropertyType.js","names":["invariant","convertObjectStatus","namespace","defaultTypeClasses","getPropertyTypeName","hasRenderHints","shouldBeIndexedForSearch","shouldNotHaveRenderHints","convertNullabilityToDataConstraint","convertValueType","convertValueTypeDataConstraints","propertyTypeTypeToOntologyIrType","convertObjectPropertyType","property","apiName","type","typeClasses","process","env","NODE_ENV","output","sharedPropertyTypeApiName","sharedPropertyType","displayMetadata","displayName","description","visibility","indexedForSearch","ruleSetBinding","undefined","baseFormatter","array","subtype","reducers","status","inlineAction","dataConstraints","valueType","constraints","sharedPropertyTypeRid"],"sources":["convertObjectPropertyType.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 { OntologyIrPropertyType } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { convertObjectStatus, namespace } from \"../../api/defineOntology.js\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport {\n defaultTypeClasses,\n getPropertyTypeName,\n hasRenderHints,\n shouldBeIndexedForSearch,\n shouldNotHaveRenderHints,\n} from \"../../api/propertyConversionUtils.js\";\nimport { convertNullabilityToDataConstraint } from \"./convertNullabilityToDataConstraint.js\";\nimport { convertValueType } from \"./convertValueType.js\";\nimport { convertValueTypeDataConstraints } from \"./convertValueTypeDataConstraints.js\";\nimport { propertyTypeTypeToOntologyIrType } from \"./propertyTypeTypeToOntologyIrType.js\";\n\nexport function convertObjectPropertyType(\n property: ObjectPropertyType,\n): OntologyIrPropertyType {\n const apiName = namespace + property.apiName;\n invariant(\n !shouldNotHaveRenderHints(property.type)\n || !hasRenderHints(property.typeClasses),\n `Property type ${apiName} of type '${\n getPropertyTypeName(property.type)\n }' should not have render hints`,\n );\n const output: OntologyIrPropertyType = {\n apiName: property.apiName,\n sharedPropertyTypeApiName: property.sharedPropertyType?.apiName,\n displayMetadata: {\n displayName: property.displayName,\n description: property.description,\n visibility: property.visibility ?? \"NORMAL\",\n },\n indexedForSearch: property.indexedForSearch\n ?? shouldBeIndexedForSearch(property.type),\n ruleSetBinding: undefined,\n baseFormatter: property.baseFormatter,\n type: property.array\n ? {\n type: \"array\" as const,\n array: {\n subtype: propertyTypeTypeToOntologyIrType(property.type),\n reducers: [],\n },\n }\n : propertyTypeTypeToOntologyIrType(property.type),\n typeClasses: property.typeClasses\n ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),\n status: convertObjectStatus(property.status),\n inlineAction: undefined,\n dataConstraints: property.valueType\n ? convertValueTypeDataConstraints(property.valueType.constraints)\n : convertNullabilityToDataConstraint(property),\n sharedPropertyTypeRid: property.sharedPropertyType?.apiName,\n valueType: property.valueType\n ? convertValueType(property.valueType)\n : undefined,\n };\n return output;\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,mBAAmB,EAAEC,SAAS,QAAQ,6BAA6B;AAE5E,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,cAAc,EACdC,wBAAwB,EACxBC,wBAAwB,QACnB,sCAAsC;AAC7C,SAASC,kCAAkC,QAAQ,yCAAyC;AAC5F,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,+BAA+B,QAAQ,sCAAsC;AACtF,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,OAAO,SAASC,yBAAyBA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vBO,eAAe,EAAEvB,QAAQ,CAACwB,SAAS,GAC/B3B,+BAA+B,CAACG,QAAQ,CAACwB,SAAS,CAACC,WAAW,CAAC,GAC/D9B,kCAAkC,CAACK,QAAQ,CAAC;IAChD0B,qBAAqB,EAAE1B,QAAQ,CAACS,kBAAkB,EAAER,OAAO;IAC3DuB,SAAS,EAAExB,QAAQ,CAACwB,SAAS,GACzB5B,gBAAgB,CAACI,QAAQ,CAACwB,SAAS,CAAC,GACpCR;EACN,CAAC;EACD,OAAOT,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"file":"convertObjectPropertyType.js","names":["invariant","convertObjectStatus","namespace","defaultTypeClasses","getPropertyTypeName","hasRenderHints","shouldBeIndexedForSearch","shouldNotHaveRenderHints","convertNullabilityToDataConstraint","convertReducers","convertValueType","convertValueTypeDataConstraints","propertyTypeTypeToOntologyIrType","convertObjectPropertyType","property","apiName","type","typeClasses","process","env","NODE_ENV","output","sharedPropertyTypeApiName","sharedPropertyType","displayMetadata","displayName","description","visibility","indexedForSearch","ruleSetBinding","undefined","baseFormatter","array","subtype","reducers","status","inlineAction","dataConstraints","valueType","constraints","sharedPropertyTypeRid"],"sources":["convertObjectPropertyType.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 { OntologyIrPropertyType } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { convertObjectStatus, namespace } from \"../../api/defineOntology.js\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport {\n defaultTypeClasses,\n getPropertyTypeName,\n hasRenderHints,\n shouldBeIndexedForSearch,\n shouldNotHaveRenderHints,\n} from \"../../api/propertyConversionUtils.js\";\nimport { convertNullabilityToDataConstraint } from \"./convertNullabilityToDataConstraint.js\";\nimport { convertReducers } from \"./convertReducers.js\";\nimport { convertValueType } from \"./convertValueType.js\";\nimport { convertValueTypeDataConstraints } from \"./convertValueTypeDataConstraints.js\";\nimport { propertyTypeTypeToOntologyIrType } from \"./propertyTypeTypeToOntologyIrType.js\";\n\nexport function convertObjectPropertyType(\n property: ObjectPropertyType,\n): OntologyIrPropertyType {\n const apiName = namespace + property.apiName;\n invariant(\n !shouldNotHaveRenderHints(property.type)\n || !hasRenderHints(property.typeClasses),\n `Property type ${apiName} of type '${\n getPropertyTypeName(property.type)\n }' should not have render hints`,\n );\n const output: OntologyIrPropertyType = {\n apiName: property.apiName,\n sharedPropertyTypeApiName: property.sharedPropertyType?.apiName,\n displayMetadata: {\n displayName: property.displayName,\n description: property.description,\n visibility: property.visibility ?? \"NORMAL\",\n },\n indexedForSearch: property.indexedForSearch\n ?? shouldBeIndexedForSearch(property.type),\n ruleSetBinding: undefined,\n baseFormatter: property.baseFormatter,\n type: property.array\n ? {\n type: \"array\" as const,\n array: {\n subtype: propertyTypeTypeToOntologyIrType(\n property.type,\n property.apiName,\n property.sharedPropertyType,\n ),\n reducers: convertReducers(\n property.type,\n property.apiName,\n property.reducers ?? [],\n property.sharedPropertyType,\n ),\n },\n }\n : propertyTypeTypeToOntologyIrType(property.type, property.apiName),\n typeClasses: property.typeClasses\n ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),\n status: convertObjectStatus(property.status),\n inlineAction: undefined,\n dataConstraints: property.valueType\n ? convertValueTypeDataConstraints(property.valueType.constraints)\n : convertNullabilityToDataConstraint(property),\n sharedPropertyTypeRid: property.sharedPropertyType?.apiName,\n valueType: property.valueType\n ? convertValueType(property.valueType)\n : undefined,\n };\n return output;\n}\n"],"mappings":"AAAA;AACA;AACA;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,EAAEF,QAAQ,CAACkB,KAAK,GAChB;MACAhB,IAAI,EAAE,OAAgB;MACtBgB,KAAK,EAAE;QACLC,OAAO,EAAErB,gCAAgC,CACvCE,QAAQ,CAACE,IAAI,EACbF,QAAQ,CAACC,OAAO,EAChBD,QAAQ,CAACS,kBACX,CAAC;QACDW,QAAQ,EAAEzB,eAAe,CACvBK,QAAQ,CAACE,IAAI,EACbF,QAAQ,CAACC,OAAO,EAChBD,QAAQ,CAACoB,QAAQ,IAAI,EAAE,EACvBpB,QAAQ,CAACS,kBACX;MACF;IACF,CAAC,GACCX,gCAAgC,CAACE,QAAQ,CAACE,IAAI,EAAEF,QAAQ,CAACC,OAAO,CAAC;IACrEE,WAAW,EAAEH,QAAQ,CAACG,WAAW,KAC3BV,wBAAwB,CAACO,QAAQ,CAACE,IAAI,CAAC,GAAG,EAAE,GAAGb,kBAAkB,CAAC;IACxEgC,MAAM,EAAElC,mBAAmB,CAACa,QAAQ,CAACqB,MAAM,CAAC;IAC5CC,YAAY,EAAEN,SAAS;IACvBO,eAAe,EAAEvB,QAAQ,CAACwB,SAAS,GAC/B3B,+BAA+B,CAACG,QAAQ,CAACwB,SAAS,CAACC,WAAW,CAAC,GAC/D/B,kCAAkC,CAACM,QAAQ,CAAC;IAChD0B,qBAAqB,EAAE1B,QAAQ,CAACS,kBAAkB,EAAER,OAAO;IAC3DuB,SAAS,EAAExB,QAAQ,CAACwB,SAAS,GACzB5B,gBAAgB,CAACI,QAAQ,CAACwB,SAAS,CAAC,GACpCR;EACN,CAAC;EACD,OAAOT,MAAM;AACf","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Copyright 2026 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 { isStruct } from "../../api/properties/PropertyTypeType.js";
19
+ export function convertReducers(type, apiName, reducers, sharedPropertyType) {
20
+ reducers?.forEach(reducer => {
21
+ if (reducer.structField) {
22
+ !(isStruct(type) && Object.keys(type.structDefinition).includes(reducer.structField)) ? process.env.NODE_ENV !== "production" ? invariant(false, `Reducer structField ${reducer.structField} does not exist in struct definition`) : invariant(false) : void 0;
23
+ }
24
+ });
25
+ if (sharedPropertyType) {
26
+ return mapReducers(sharedPropertyType.apiName, sharedPropertyType.reducers);
27
+ } else {
28
+ return mapReducers(apiName, reducers);
29
+ }
30
+ }
31
+ export function mapReducers(apiName, reducers) {
32
+ return reducers?.map(reducer => {
33
+ switch (reducer.direction) {
34
+ case "ascending":
35
+ return {
36
+ direction: "ASCENDING_NULLS_LAST",
37
+ structApiName: reducer.structField ? apiName : undefined,
38
+ fieldApiName: reducer.structField
39
+ };
40
+ case "descending":
41
+ return {
42
+ direction: "DESCENDING_NULLS_LAST",
43
+ structApiName: reducer.structField ? apiName : undefined,
44
+ fieldApiName: reducer.structField
45
+ };
46
+ default:
47
+ {
48
+ throw new Error(`Unsupported reducer direction: ${reducer.direction}`);
49
+ }
50
+ }
51
+ }) ?? [];
52
+ }
53
+ //# sourceMappingURL=convertReducers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertReducers.js","names":["invariant","isStruct","convertReducers","type","apiName","reducers","sharedPropertyType","forEach","reducer","structField","Object","keys","structDefinition","includes","process","env","NODE_ENV","mapReducers","map","direction","structApiName","undefined","fieldApiName","Error"],"sources":["convertReducers.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { OntologyIrArrayPropertyTypeReducer } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type {\n PropertyTypeType,\n} from \"../../api/properties/PropertyTypeType.js\";\nimport { isStruct } from \"../../api/properties/PropertyTypeType.js\";\nimport type { ReducerType } from \"../../api/properties/ReducerType.js\";\nimport type { SharedPropertyType } from \"../../api/properties/SharedPropertyType.js\";\n\nexport function convertReducers(\n type: PropertyTypeType,\n apiName: string,\n reducers?: Array<ReducerType>,\n sharedPropertyType?: SharedPropertyType,\n): Array<OntologyIrArrayPropertyTypeReducer> {\n reducers?.forEach(reducer => {\n if (reducer.structField) {\n invariant(\n isStruct(type)\n && Object.keys(type.structDefinition).includes(reducer.structField),\n `Reducer structField ${reducer.structField} does not exist in struct definition`,\n );\n }\n });\n if (sharedPropertyType) {\n return mapReducers(sharedPropertyType.apiName, sharedPropertyType.reducers);\n } else {\n return mapReducers(apiName, reducers);\n }\n}\n\nexport function mapReducers(\n apiName: string,\n reducers?: Array<ReducerType>,\n): Array<OntologyIrArrayPropertyTypeReducer> {\n return reducers?.map(reducer => {\n switch (reducer.direction) {\n case \"ascending\":\n return {\n direction: \"ASCENDING_NULLS_LAST\",\n structApiName: reducer.structField ? apiName : undefined,\n fieldApiName: reducer.structField,\n };\n case \"descending\":\n return {\n direction: \"DESCENDING_NULLS_LAST\",\n structApiName: reducer.structField ? apiName : undefined,\n fieldApiName: reducer.structField,\n };\n default: {\n throw new Error(`Unsupported reducer direction: ${reducer.direction}`);\n }\n }\n }) ?? [];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AC,kCAAkCf,OAAO,CAACW,SAAS,EAAE,CAAC;QACxE;IACF;EACF,CAAC,CAAC,IAAI,EAAE;AACV","ignoreList":[]}
@@ -15,10 +15,12 @@
15
15
  */
16
16
 
17
17
  import { convertNullabilityToDataConstraint } from "./convertNullabilityToDataConstraint.js";
18
+ import { convertReducers } from "./convertReducers.js";
18
19
  import { propertyTypeTypeToOntologyIrType } from "./propertyTypeTypeToOntologyIrType.js";
19
20
  export function convertSpt({
20
21
  type,
21
22
  array,
23
+ reducers,
22
24
  description,
23
25
  apiName,
24
26
  displayName,
@@ -44,10 +46,10 @@ export function convertSpt({
44
46
  type: array ? {
45
47
  type: "array",
46
48
  array: {
47
- subtype: propertyTypeTypeToOntologyIrType(type),
48
- reducers: []
49
+ subtype: propertyTypeTypeToOntologyIrType(type, apiName),
50
+ reducers: convertReducers(type, apiName, reducers)
49
51
  }
50
- } : propertyTypeTypeToOntologyIrType(type),
52
+ } : propertyTypeTypeToOntologyIrType(type, apiName),
51
53
  aliases: aliases ?? [],
52
54
  baseFormatter,
53
55
  dataConstraints: dataConstraint,
@@ -1 +1 @@
1
- {"version":3,"file":"convertSpt.js","names":["convertNullabilityToDataConstraint","propertyTypeTypeToOntologyIrType","convertSpt","type","array","description","apiName","displayName","visibility","gothamMapping","typeClasses","aliases","valueType","nullability","baseFormatter","dataConstraint","displayMetadata","subtype","reducers","dataConstraints","indexedForSearch","undefined","version","packageNamespace"],"sources":["convertSpt.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 { OntologyIrSharedPropertyType } from \"@osdk/client.unstable\";\nimport type { SharedPropertyType } from \"../../api/properties/SharedPropertyType.js\";\nimport { convertNullabilityToDataConstraint } from \"./convertNullabilityToDataConstraint.js\";\nimport { propertyTypeTypeToOntologyIrType } from \"./propertyTypeTypeToOntologyIrType.js\";\n\nexport function convertSpt(\n {\n type,\n array,\n description,\n apiName,\n displayName,\n visibility,\n gothamMapping,\n typeClasses,\n aliases,\n valueType,\n nullability,\n baseFormatter,\n }: SharedPropertyType,\n): OntologyIrSharedPropertyType {\n const dataConstraint:\n | OntologyIrSharedPropertyType[\"dataConstraints\"]\n | undefined = convertNullabilityToDataConstraint({ type, nullability });\n return {\n apiName,\n displayMetadata: {\n displayName: displayName ?? apiName,\n visibility: visibility ?? \"NORMAL\",\n description,\n },\n type: array\n ? {\n type: \"array\" as const,\n array: {\n subtype: propertyTypeTypeToOntologyIrType(type),\n reducers: [],\n },\n }\n : propertyTypeTypeToOntologyIrType(type),\n aliases: aliases ?? [],\n baseFormatter,\n dataConstraints: dataConstraint,\n gothamMapping: gothamMapping,\n indexedForSearch: true,\n typeClasses: typeClasses ?? [],\n valueType: valueType === undefined ? undefined : {\n apiName: valueType.apiName,\n version: valueType.version,\n packageNamespace: valueType.packageNamespace,\n displayMetadata: valueType.displayMetadata,\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,kCAAkC,QAAQ,yCAAyC;AAC5F,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,OAAO,SAASC,UAAUA,CACxB;EACEC,IAAI;EACJC,KAAK;EACLC,WAAW;EACXC,OAAO;EACPC,WAAW;EACXC,UAAU;EACVC,aAAa;EACbC,WAAW;EACXC,OAAO;EACPC,SAAS;EACTC,WAAW;EACXC;AACkB,CAAC,EACS;EAC9B,MAAMC,cAEO,GAAGf,kCAAkC,CAAC;IAAEG,IAAI;IAAEU;EAAY,CAAC,CAAC;EACzE,OAAO;IACLP,OAAO;IACPU,eAAe,EAAE;MACfT,WAAW,EAAEA,WAAW,IAAID,OAAO;MACnCE,UAAU,EAAEA,UAAU,IAAI,QAAQ;MAClCH;IACF,CAAC;IACDF,IAAI,EAAEC,KAAK,GACP;MACAD,IAAI,EAAE,OAAgB;MACtBC,KAAK,EAAE;QACLa,OAAO,EAAEhB,gCAAgC,CAACE,IAAI,CAAC;QAC/Ce,QAAQ,EAAE;MACZ;IACF,CAAC,GACCjB,gCAAgC,CAACE,IAAI,CAAC;IAC1CQ,OAAO,EAAEA,OAAO,IAAI,EAAE;IACtBG,aAAa;IACbK,eAAe,EAAEJ,cAAc;IAC/BN,aAAa,EAAEA,aAAa;IAC5BW,gBAAgB,EAAE,IAAI;IACtBV,WAAW,EAAEA,WAAW,IAAI,EAAE;IAC9BE,SAAS,EAAEA,SAAS,KAAKS,SAAS,GAAGA,SAAS,GAAG;MAC/Cf,OAAO,EAAEM,SAAS,CAACN,OAAO;MAC1BgB,OAAO,EAAEV,SAAS,CAACU,OAAO;MAC1BC,gBAAgB,EAAEX,SAAS,CAACW,gBAAgB;MAC5CP,eAAe,EAAEJ,SAAS,CAACI;IAC7B;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"convertSpt.js","names":["convertNullabilityToDataConstraint","convertReducers","propertyTypeTypeToOntologyIrType","convertSpt","type","array","reducers","description","apiName","displayName","visibility","gothamMapping","typeClasses","aliases","valueType","nullability","baseFormatter","dataConstraint","displayMetadata","subtype","dataConstraints","indexedForSearch","undefined","version","packageNamespace"],"sources":["convertSpt.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 { OntologyIrSharedPropertyType } from \"@osdk/client.unstable\";\nimport type { SharedPropertyType } from \"../../api/properties/SharedPropertyType.js\";\nimport { convertNullabilityToDataConstraint } from \"./convertNullabilityToDataConstraint.js\";\nimport { convertReducers } from \"./convertReducers.js\";\nimport { propertyTypeTypeToOntologyIrType } from \"./propertyTypeTypeToOntologyIrType.js\";\n\nexport function convertSpt(\n {\n type,\n array,\n reducers,\n description,\n apiName,\n displayName,\n visibility,\n gothamMapping,\n typeClasses,\n aliases,\n valueType,\n nullability,\n baseFormatter,\n }: SharedPropertyType,\n): OntologyIrSharedPropertyType {\n const dataConstraint:\n | OntologyIrSharedPropertyType[\"dataConstraints\"]\n | undefined = convertNullabilityToDataConstraint({ type, nullability });\n return {\n apiName,\n displayMetadata: {\n displayName: displayName ?? apiName,\n visibility: visibility ?? \"NORMAL\",\n description,\n },\n type: array\n ? {\n type: \"array\" as const,\n array: {\n subtype: propertyTypeTypeToOntologyIrType(type, apiName),\n reducers: convertReducers(type, apiName, reducers),\n },\n }\n : propertyTypeTypeToOntologyIrType(type, apiName),\n aliases: aliases ?? [],\n baseFormatter,\n dataConstraints: dataConstraint,\n gothamMapping: gothamMapping,\n indexedForSearch: true,\n typeClasses: typeClasses ?? [],\n valueType: valueType === undefined ? undefined : {\n apiName: valueType.apiName,\n version: valueType.version,\n packageNamespace: valueType.packageNamespace,\n displayMetadata: valueType.displayMetadata,\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,kCAAkC,QAAQ,yCAAyC;AAC5F,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,OAAO,SAASC,UAAUA,CACxB;EACEC,IAAI;EACJC,KAAK;EACLC,QAAQ;EACRC,WAAW;EACXC,OAAO;EACPC,WAAW;EACXC,UAAU;EACVC,aAAa;EACbC,WAAW;EACXC,OAAO;EACPC,SAAS;EACTC,WAAW;EACXC;AACkB,CAAC,EACS;EAC9B,MAAMC,cAEO,GAAGjB,kCAAkC,CAAC;IAAEI,IAAI;IAAEW;EAAY,CAAC,CAAC;EACzE,OAAO;IACLP,OAAO;IACPU,eAAe,EAAE;MACfT,WAAW,EAAEA,WAAW,IAAID,OAAO;MACnCE,UAAU,EAAEA,UAAU,IAAI,QAAQ;MAClCH;IACF,CAAC;IACDH,IAAI,EAAEC,KAAK,GACP;MACAD,IAAI,EAAE,OAAgB;MACtBC,KAAK,EAAE;QACLc,OAAO,EAAEjB,gCAAgC,CAACE,IAAI,EAAEI,OAAO,CAAC;QACxDF,QAAQ,EAAEL,eAAe,CAACG,IAAI,EAAEI,OAAO,EAAEF,QAAQ;MACnD;IACF,CAAC,GACCJ,gCAAgC,CAACE,IAAI,EAAEI,OAAO,CAAC;IACnDK,OAAO,EAAEA,OAAO,IAAI,EAAE;IACtBG,aAAa;IACbI,eAAe,EAAEH,cAAc;IAC/BN,aAAa,EAAEA,aAAa;IAC5BU,gBAAgB,EAAE,IAAI;IACtBT,WAAW,EAAEA,WAAW,IAAI,EAAE;IAC9BE,SAAS,EAAEA,SAAS,KAAKQ,SAAS,GAAGA,SAAS,GAAG;MAC/Cd,OAAO,EAAEM,SAAS,CAACN,OAAO;MAC1Be,OAAO,EAAET,SAAS,CAACS,OAAO;MAC1BC,gBAAgB,EAAEV,SAAS,CAACU,gBAAgB;MAC5CN,eAAe,EAAEJ,SAAS,CAACI;IAC7B;EACF,CAAC;AACH","ignoreList":[]}
@@ -15,7 +15,8 @@
15
15
  */
16
16
 
17
17
  import { distributeTypeHelper } from "../toConjure/distributeTypeHelper.js";
18
- export function propertyTypeTypeToOntologyIrType(type) {
18
+ import { convertMainValue } from "./convertMainValue.js";
19
+ export function propertyTypeTypeToOntologyIrType(type, apiName, sharedPropertyType) {
19
20
  switch (true) {
20
21
  case typeof type === "object" && type.type === "marking":
21
22
  return {
@@ -72,7 +73,8 @@ export function propertyTypeTypeToOntologyIrType(type) {
72
73
  return {
73
74
  type: "struct",
74
75
  struct: {
75
- structFields
76
+ structFields: structFields,
77
+ mainValue: convertMainValue(type, apiName, sharedPropertyType)
76
78
  }
77
79
  };
78
80
  case typeof type === "object" && type.type === "string":