@osdk/maker 0.13.0-beta.11 → 0.13.0-beta.12

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 (510) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/build/browser/api/action/ActionLevelValidationDefinition.js +2 -0
  3. package/build/browser/api/action/ActionLevelValidationDefinition.js.map +1 -0
  4. package/build/browser/api/action/ActionParameter.js +2 -0
  5. package/build/browser/api/action/ActionParameter.js.map +1 -0
  6. package/build/browser/api/action/ActionParameterAllowedValues.js +2 -0
  7. package/build/browser/api/action/ActionParameterAllowedValues.js.map +1 -0
  8. package/build/browser/api/action/ActionParameterConditionalOverride.js +2 -0
  9. package/build/browser/api/action/ActionParameterConditionalOverride.js.map +1 -0
  10. package/build/browser/api/action/ActionParameterConfiguration.js +2 -0
  11. package/build/browser/api/action/ActionParameterConfiguration.js.map +1 -0
  12. package/build/browser/api/action/ActionParameterType.js +22 -0
  13. package/build/browser/api/action/ActionParameterType.js.map +1 -0
  14. package/build/browser/api/action/ActionSection.js +2 -0
  15. package/build/browser/api/action/ActionSection.js.map +1 -0
  16. package/build/browser/api/action/ActionStatus.js +2 -0
  17. package/build/browser/api/action/ActionStatus.js.map +1 -0
  18. package/build/browser/api/action/ActionType.js +2 -0
  19. package/build/browser/api/action/ActionType.js.map +1 -0
  20. package/build/browser/api/action/ActionValidationRule.js +2 -0
  21. package/build/browser/api/action/ActionValidationRule.js.map +1 -0
  22. package/build/browser/api/action/ConditionDefinition.js +2 -0
  23. package/build/browser/api/action/ConditionDefinition.js.map +1 -0
  24. package/build/browser/api/action/MappingValue.js +2 -0
  25. package/build/browser/api/action/MappingValue.js.map +1 -0
  26. package/build/browser/api/action/SectionConditionalOverride.js +2 -0
  27. package/build/browser/api/action/SectionConditionalOverride.js.map +1 -0
  28. package/build/browser/api/action/SubmissionMetadata.js +2 -0
  29. package/build/browser/api/action/SubmissionMetadata.js.map +1 -0
  30. package/build/browser/api/common/BlueprintIcons.js +2 -0
  31. package/build/browser/api/common/BlueprintIcons.js.map +1 -0
  32. package/build/browser/api/common/OntologyDefinition.js +2 -0
  33. package/build/browser/api/common/OntologyDefinition.js.map +1 -0
  34. package/build/browser/api/common/OntologyEntityBase.js +2 -0
  35. package/build/browser/api/common/OntologyEntityBase.js.map +1 -0
  36. package/build/browser/api/{types.js → common/OntologyEntityTypeEnum.js} +2 -8
  37. package/build/browser/api/common/OntologyEntityTypeEnum.js.map +1 -0
  38. package/build/browser/api/common/OntologyEntityTypeMapping.js +2 -0
  39. package/build/browser/api/common/OntologyEntityTypeMapping.js.map +1 -0
  40. package/build/browser/api/common/TypeClass.js +2 -0
  41. package/build/browser/api/common/TypeClass.js.map +1 -0
  42. package/build/browser/api/defineAction.js +16 -28
  43. package/build/browser/api/defineAction.js.map +1 -1
  44. package/build/browser/api/defineInterface.js +7 -32
  45. package/build/browser/api/defineInterface.js.map +1 -1
  46. package/build/browser/api/defineInterfaceLinkConstraint.js +3 -2
  47. package/build/browser/api/defineInterfaceLinkConstraint.js.map +1 -1
  48. package/build/browser/api/defineLink.js +3 -3
  49. package/build/browser/api/defineLink.js.map +1 -1
  50. package/build/browser/api/defineObject.js +9 -29
  51. package/build/browser/api/defineObject.js.map +1 -1
  52. package/build/browser/api/defineOntology.js +14 -557
  53. package/build/browser/api/defineOntology.js.map +1 -1
  54. package/build/browser/api/defineSpt.js +1 -1
  55. package/build/browser/api/defineSpt.js.map +1 -1
  56. package/build/browser/api/defineValueType.js +1 -1
  57. package/build/browser/api/defineValueType.js.map +1 -1
  58. package/build/browser/api/importOntologyEntity.js +1 -1
  59. package/build/browser/api/importOntologyEntity.js.map +1 -1
  60. package/build/browser/api/{defineImportSpt.js → importSharedPropertyType.js} +2 -3
  61. package/build/browser/api/importSharedPropertyType.js.map +1 -0
  62. package/build/browser/api/interface/InterfacePropertyType.js +2 -0
  63. package/build/browser/api/interface/InterfacePropertyType.js.map +1 -0
  64. package/build/browser/api/interface/InterfaceType.js +2 -0
  65. package/build/browser/api/interface/InterfaceType.js.map +1 -0
  66. package/build/browser/api/interface/getFlattenedInterfaceProperties.js +27 -0
  67. package/build/browser/api/interface/getFlattenedInterfaceProperties.js.map +1 -0
  68. package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +42 -0
  69. package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -0
  70. package/build/browser/api/links/LinkType.js +2 -0
  71. package/build/browser/api/links/LinkType.js.map +1 -0
  72. package/build/browser/api/namespace/combineApiNamespaceIfMissing.js +20 -0
  73. package/build/browser/api/namespace/combineApiNamespaceIfMissing.js.map +1 -0
  74. package/build/browser/api/object/InterfaceImplementation.js +2 -0
  75. package/build/browser/api/object/InterfaceImplementation.js.map +1 -0
  76. package/build/browser/api/object/ObjectPropertyType.js +2 -0
  77. package/build/browser/api/object/ObjectPropertyType.js.map +1 -0
  78. package/build/browser/api/object/ObjectPropertyTypeUserDefinition.js +2 -0
  79. package/build/browser/api/object/ObjectPropertyTypeUserDefinition.js.map +1 -0
  80. package/build/browser/api/object/ObjectType.js +2 -0
  81. package/build/browser/api/object/ObjectType.js.map +1 -0
  82. package/build/browser/api/object/ObjectTypeDatasourceDefinition.js +2 -0
  83. package/build/browser/api/object/ObjectTypeDatasourceDefinition.js.map +1 -0
  84. package/build/browser/api/object/ObjectTypeDefinition.js +2 -0
  85. package/build/browser/api/object/ObjectTypeDefinition.js.map +1 -0
  86. package/build/browser/api/object/ObjectTypeStatus.js +2 -0
  87. package/build/browser/api/object/ObjectTypeStatus.js.map +1 -0
  88. package/build/browser/api/objectStatus.test.js.map +1 -1
  89. package/build/browser/api/overall.test.js +2 -5
  90. package/build/browser/api/overall.test.js.map +1 -1
  91. package/build/browser/api/properties/Nullability.js +2 -0
  92. package/build/browser/api/properties/Nullability.js.map +1 -0
  93. package/build/browser/api/properties/PropertyTypeType.js +34 -0
  94. package/build/browser/api/properties/PropertyTypeType.js.map +1 -0
  95. package/build/browser/api/properties/SharedPropertyType.js +2 -0
  96. package/build/browser/api/properties/SharedPropertyType.js.map +1 -0
  97. package/build/browser/api/propertyConversionUtils.js +0 -238
  98. package/build/browser/api/propertyConversionUtils.js.map +1 -1
  99. package/build/browser/api/values/ValueTypeDefinitionVersion.js +2 -0
  100. package/build/browser/api/values/ValueTypeDefinitionVersion.js.map +1 -0
  101. package/build/browser/api/values/ValueTypeType.js +2 -0
  102. package/build/browser/api/values/ValueTypeType.js.map +1 -0
  103. package/build/browser/api/wrapWithProxy.js +1 -0
  104. package/build/browser/api/wrapWithProxy.js.map +1 -1
  105. package/build/browser/cli/main.js +1 -1
  106. package/build/browser/conversion/toConjure/distributeTypeHelper.js +23 -0
  107. package/build/browser/conversion/toConjure/distributeTypeHelper.js.map +1 -0
  108. package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js +88 -0
  109. package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -0
  110. package/build/browser/conversion/toMarketplace/convertActionParameters.js +31 -0
  111. package/build/browser/conversion/toMarketplace/convertActionParameters.js.map +1 -0
  112. package/build/browser/conversion/toMarketplace/convertActionSections.js +43 -0
  113. package/build/browser/conversion/toMarketplace/convertActionSections.js.map +1 -0
  114. package/build/browser/conversion/toMarketplace/convertActionValidation.js +93 -0
  115. package/build/browser/conversion/toMarketplace/convertActionValidation.js.map +1 -0
  116. package/build/browser/conversion/toMarketplace/convertActionVisibility.js +41 -0
  117. package/build/browser/conversion/toMarketplace/convertActionVisibility.js.map +1 -0
  118. package/build/browser/conversion/toMarketplace/convertCardinality.js +23 -0
  119. package/build/browser/conversion/toMarketplace/convertCardinality.js.map +1 -0
  120. package/build/browser/conversion/toMarketplace/convertConditionDefinition.js +86 -0
  121. package/build/browser/conversion/toMarketplace/convertConditionDefinition.js.map +1 -0
  122. package/build/browser/conversion/toMarketplace/convertDataConstraintToDataConstraints.js +26 -0
  123. package/build/browser/conversion/toMarketplace/convertDataConstraintToDataConstraints.js.map +1 -0
  124. package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js +89 -0
  125. package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -0
  126. package/build/browser/conversion/toMarketplace/convertInterface.js +47 -0
  127. package/build/browser/conversion/toMarketplace/convertInterface.js.map +1 -0
  128. package/build/browser/conversion/toMarketplace/convertLink.js +119 -0
  129. package/build/browser/conversion/toMarketplace/convertLink.js.map +1 -0
  130. package/build/browser/conversion/toMarketplace/convertMappingValue.js +41 -0
  131. package/build/browser/conversion/toMarketplace/convertMappingValue.js.map +1 -0
  132. package/build/browser/conversion/toMarketplace/convertNullabilityToDataConstraint.js +43 -0
  133. package/build/browser/conversion/toMarketplace/convertNullabilityToDataConstraint.js.map +1 -0
  134. package/build/browser/conversion/toMarketplace/convertObject.js +108 -0
  135. package/build/browser/conversion/toMarketplace/convertObject.js.map +1 -0
  136. package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js +53 -0
  137. package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -0
  138. package/build/browser/conversion/toMarketplace/convertOntologyDefinition.js +28 -0
  139. package/build/browser/conversion/toMarketplace/convertOntologyDefinition.js.map +1 -0
  140. package/build/browser/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js +57 -0
  141. package/build/browser/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js.map +1 -0
  142. package/build/browser/conversion/toMarketplace/convertOntologyToValueTypeIr.js +24 -0
  143. package/build/browser/conversion/toMarketplace/convertOntologyToValueTypeIr.js.map +1 -0
  144. package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js +35 -0
  145. package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -0
  146. package/build/browser/conversion/toMarketplace/convertSpt.js +62 -0
  147. package/build/browser/conversion/toMarketplace/convertSpt.js.map +1 -0
  148. package/build/browser/conversion/toMarketplace/convertValueType.js +25 -0
  149. package/build/browser/conversion/toMarketplace/convertValueType.js.map +1 -0
  150. package/build/browser/conversion/toMarketplace/convertValueTypeDataConstraints.js +30 -0
  151. package/build/browser/conversion/toMarketplace/convertValueTypeDataConstraints.js.map +1 -0
  152. package/build/browser/conversion/toMarketplace/convertValueTypesToIr.js +34 -0
  153. package/build/browser/conversion/toMarketplace/convertValueTypesToIr.js.map +1 -0
  154. package/build/browser/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js +83 -0
  155. package/build/browser/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js.map +1 -0
  156. package/build/browser/conversion/toMarketplace/getFormContentOrdering.js +39 -0
  157. package/build/browser/conversion/toMarketplace/getFormContentOrdering.js.map +1 -0
  158. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +124 -0
  159. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -0
  160. package/build/browser/index.js +5 -5
  161. package/build/browser/index.js.map +1 -1
  162. package/build/browser/util/OptionalFields.js +2 -0
  163. package/build/browser/util/OptionalFields.js.map +1 -0
  164. package/build/browser/util/RequiredFields.js +2 -0
  165. package/build/browser/util/RequiredFields.js.map +1 -0
  166. package/build/cjs/index.cjs +1017 -963
  167. package/build/cjs/index.cjs.map +1 -1
  168. package/build/cjs/index.d.cts +382 -346
  169. package/build/esm/api/action/ActionLevelValidationDefinition.js +2 -0
  170. package/build/esm/api/action/ActionLevelValidationDefinition.js.map +1 -0
  171. package/build/esm/api/action/ActionParameter.js +2 -0
  172. package/build/esm/api/action/ActionParameter.js.map +1 -0
  173. package/build/esm/api/action/ActionParameterAllowedValues.js +2 -0
  174. package/build/esm/api/action/ActionParameterAllowedValues.js.map +1 -0
  175. package/build/esm/api/action/ActionParameterConditionalOverride.js +2 -0
  176. package/build/esm/api/action/ActionParameterConditionalOverride.js.map +1 -0
  177. package/build/esm/api/action/ActionParameterConfiguration.js +2 -0
  178. package/build/esm/api/action/ActionParameterConfiguration.js.map +1 -0
  179. package/build/esm/api/action/ActionParameterType.js +22 -0
  180. package/build/esm/api/action/ActionParameterType.js.map +1 -0
  181. package/build/esm/api/action/ActionSection.js +2 -0
  182. package/build/esm/api/action/ActionSection.js.map +1 -0
  183. package/build/esm/api/action/ActionStatus.js +2 -0
  184. package/build/esm/api/action/ActionStatus.js.map +1 -0
  185. package/build/esm/api/action/ActionType.js +2 -0
  186. package/build/esm/api/action/ActionType.js.map +1 -0
  187. package/build/esm/api/action/ActionValidationRule.js +2 -0
  188. package/build/esm/api/action/ActionValidationRule.js.map +1 -0
  189. package/build/esm/api/action/ConditionDefinition.js +2 -0
  190. package/build/esm/api/action/ConditionDefinition.js.map +1 -0
  191. package/build/esm/api/action/MappingValue.js +2 -0
  192. package/build/esm/api/action/MappingValue.js.map +1 -0
  193. package/build/esm/api/action/SectionConditionalOverride.js +2 -0
  194. package/build/esm/api/action/SectionConditionalOverride.js.map +1 -0
  195. package/build/esm/api/action/SubmissionMetadata.js +2 -0
  196. package/build/esm/api/action/SubmissionMetadata.js.map +1 -0
  197. package/build/esm/api/common/BlueprintIcons.js +2 -0
  198. package/build/esm/api/common/BlueprintIcons.js.map +1 -0
  199. package/build/esm/api/common/OntologyDefinition.js +2 -0
  200. package/build/esm/api/common/OntologyDefinition.js.map +1 -0
  201. package/build/esm/api/common/OntologyEntityBase.js +2 -0
  202. package/build/esm/api/common/OntologyEntityBase.js.map +1 -0
  203. package/build/esm/api/{types.js → common/OntologyEntityTypeEnum.js} +2 -8
  204. package/build/esm/api/common/OntologyEntityTypeEnum.js.map +1 -0
  205. package/build/esm/api/common/OntologyEntityTypeMapping.js +2 -0
  206. package/build/esm/api/common/OntologyEntityTypeMapping.js.map +1 -0
  207. package/build/esm/api/common/TypeClass.js +2 -0
  208. package/build/esm/api/common/TypeClass.js.map +1 -0
  209. package/build/esm/api/defineAction.js +16 -28
  210. package/build/esm/api/defineAction.js.map +1 -1
  211. package/build/esm/api/defineInterface.js +7 -32
  212. package/build/esm/api/defineInterface.js.map +1 -1
  213. package/build/esm/api/defineInterfaceLinkConstraint.js +3 -2
  214. package/build/esm/api/defineInterfaceLinkConstraint.js.map +1 -1
  215. package/build/esm/api/defineLink.js +3 -3
  216. package/build/esm/api/defineLink.js.map +1 -1
  217. package/build/esm/api/defineObject.js +9 -29
  218. package/build/esm/api/defineObject.js.map +1 -1
  219. package/build/esm/api/defineOntology.js +14 -557
  220. package/build/esm/api/defineOntology.js.map +1 -1
  221. package/build/esm/api/defineSpt.js +1 -1
  222. package/build/esm/api/defineSpt.js.map +1 -1
  223. package/build/esm/api/defineValueType.js +1 -1
  224. package/build/esm/api/defineValueType.js.map +1 -1
  225. package/build/esm/api/importOntologyEntity.js +1 -1
  226. package/build/esm/api/importOntologyEntity.js.map +1 -1
  227. package/build/esm/api/{defineImportSpt.js → importSharedPropertyType.js} +2 -3
  228. package/build/esm/api/importSharedPropertyType.js.map +1 -0
  229. package/build/esm/api/interface/InterfacePropertyType.js +2 -0
  230. package/build/esm/api/interface/InterfacePropertyType.js.map +1 -0
  231. package/build/esm/api/interface/InterfaceType.js +2 -0
  232. package/build/esm/api/interface/InterfaceType.js.map +1 -0
  233. package/build/esm/api/interface/getFlattenedInterfaceProperties.js +27 -0
  234. package/build/esm/api/interface/getFlattenedInterfaceProperties.js.map +1 -0
  235. package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +42 -0
  236. package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -0
  237. package/build/esm/api/links/LinkType.js +2 -0
  238. package/build/esm/api/links/LinkType.js.map +1 -0
  239. package/build/esm/api/namespace/combineApiNamespaceIfMissing.js +20 -0
  240. package/build/esm/api/namespace/combineApiNamespaceIfMissing.js.map +1 -0
  241. package/build/esm/api/object/InterfaceImplementation.js +2 -0
  242. package/build/esm/api/object/InterfaceImplementation.js.map +1 -0
  243. package/build/esm/api/object/ObjectPropertyType.js +2 -0
  244. package/build/esm/api/object/ObjectPropertyType.js.map +1 -0
  245. package/build/esm/api/object/ObjectPropertyTypeUserDefinition.js +2 -0
  246. package/build/esm/api/object/ObjectPropertyTypeUserDefinition.js.map +1 -0
  247. package/build/esm/api/object/ObjectType.js +2 -0
  248. package/build/esm/api/object/ObjectType.js.map +1 -0
  249. package/build/esm/api/object/ObjectTypeDatasourceDefinition.js +2 -0
  250. package/build/esm/api/object/ObjectTypeDatasourceDefinition.js.map +1 -0
  251. package/build/esm/api/object/ObjectTypeDefinition.js +2 -0
  252. package/build/esm/api/object/ObjectTypeDefinition.js.map +1 -0
  253. package/build/esm/api/object/ObjectTypeStatus.js +2 -0
  254. package/build/esm/api/object/ObjectTypeStatus.js.map +1 -0
  255. package/build/esm/api/objectStatus.test.js.map +1 -1
  256. package/build/esm/api/overall.test.js +2 -5
  257. package/build/esm/api/overall.test.js.map +1 -1
  258. package/build/esm/api/properties/Nullability.js +2 -0
  259. package/build/esm/api/properties/Nullability.js.map +1 -0
  260. package/build/esm/api/properties/PropertyTypeType.js +34 -0
  261. package/build/esm/api/properties/PropertyTypeType.js.map +1 -0
  262. package/build/esm/api/properties/SharedPropertyType.js +2 -0
  263. package/build/esm/api/properties/SharedPropertyType.js.map +1 -0
  264. package/build/esm/api/propertyConversionUtils.js +0 -238
  265. package/build/esm/api/propertyConversionUtils.js.map +1 -1
  266. package/build/esm/api/values/ValueTypeDefinitionVersion.js +2 -0
  267. package/build/esm/api/values/ValueTypeDefinitionVersion.js.map +1 -0
  268. package/build/esm/api/values/ValueTypeType.js +2 -0
  269. package/build/esm/api/values/ValueTypeType.js.map +1 -0
  270. package/build/esm/api/wrapWithProxy.js +1 -0
  271. package/build/esm/api/wrapWithProxy.js.map +1 -1
  272. package/build/esm/cli/main.js +1 -1
  273. package/build/esm/conversion/toConjure/distributeTypeHelper.js +23 -0
  274. package/build/esm/conversion/toConjure/distributeTypeHelper.js.map +1 -0
  275. package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js +88 -0
  276. package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -0
  277. package/build/esm/conversion/toMarketplace/convertActionParameters.js +31 -0
  278. package/build/esm/conversion/toMarketplace/convertActionParameters.js.map +1 -0
  279. package/build/esm/conversion/toMarketplace/convertActionSections.js +43 -0
  280. package/build/esm/conversion/toMarketplace/convertActionSections.js.map +1 -0
  281. package/build/esm/conversion/toMarketplace/convertActionValidation.js +93 -0
  282. package/build/esm/conversion/toMarketplace/convertActionValidation.js.map +1 -0
  283. package/build/esm/conversion/toMarketplace/convertActionVisibility.js +41 -0
  284. package/build/esm/conversion/toMarketplace/convertActionVisibility.js.map +1 -0
  285. package/build/esm/conversion/toMarketplace/convertCardinality.js +23 -0
  286. package/build/esm/conversion/toMarketplace/convertCardinality.js.map +1 -0
  287. package/build/esm/conversion/toMarketplace/convertConditionDefinition.js +86 -0
  288. package/build/esm/conversion/toMarketplace/convertConditionDefinition.js.map +1 -0
  289. package/build/esm/conversion/toMarketplace/convertDataConstraintToDataConstraints.js +26 -0
  290. package/build/esm/conversion/toMarketplace/convertDataConstraintToDataConstraints.js.map +1 -0
  291. package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js +89 -0
  292. package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -0
  293. package/build/esm/conversion/toMarketplace/convertInterface.js +47 -0
  294. package/build/esm/conversion/toMarketplace/convertInterface.js.map +1 -0
  295. package/build/esm/conversion/toMarketplace/convertLink.js +119 -0
  296. package/build/esm/conversion/toMarketplace/convertLink.js.map +1 -0
  297. package/build/esm/conversion/toMarketplace/convertMappingValue.js +41 -0
  298. package/build/esm/conversion/toMarketplace/convertMappingValue.js.map +1 -0
  299. package/build/esm/conversion/toMarketplace/convertNullabilityToDataConstraint.js +43 -0
  300. package/build/esm/conversion/toMarketplace/convertNullabilityToDataConstraint.js.map +1 -0
  301. package/build/esm/conversion/toMarketplace/convertObject.js +108 -0
  302. package/build/esm/conversion/toMarketplace/convertObject.js.map +1 -0
  303. package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js +53 -0
  304. package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -0
  305. package/build/esm/conversion/toMarketplace/convertOntologyDefinition.js +28 -0
  306. package/build/esm/conversion/toMarketplace/convertOntologyDefinition.js.map +1 -0
  307. package/build/esm/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js +57 -0
  308. package/build/esm/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js.map +1 -0
  309. package/build/esm/conversion/toMarketplace/convertOntologyToValueTypeIr.js +24 -0
  310. package/build/esm/conversion/toMarketplace/convertOntologyToValueTypeIr.js.map +1 -0
  311. package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js +35 -0
  312. package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -0
  313. package/build/esm/conversion/toMarketplace/convertSpt.js +62 -0
  314. package/build/esm/conversion/toMarketplace/convertSpt.js.map +1 -0
  315. package/build/esm/conversion/toMarketplace/convertValueType.js +25 -0
  316. package/build/esm/conversion/toMarketplace/convertValueType.js.map +1 -0
  317. package/build/esm/conversion/toMarketplace/convertValueTypeDataConstraints.js +30 -0
  318. package/build/esm/conversion/toMarketplace/convertValueTypeDataConstraints.js.map +1 -0
  319. package/build/esm/conversion/toMarketplace/convertValueTypesToIr.js +34 -0
  320. package/build/esm/conversion/toMarketplace/convertValueTypesToIr.js.map +1 -0
  321. package/build/esm/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js +83 -0
  322. package/build/esm/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js.map +1 -0
  323. package/build/esm/conversion/toMarketplace/getFormContentOrdering.js +39 -0
  324. package/build/esm/conversion/toMarketplace/getFormContentOrdering.js.map +1 -0
  325. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +124 -0
  326. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -0
  327. package/build/esm/index.js +5 -5
  328. package/build/esm/index.js.map +1 -1
  329. package/build/esm/util/OptionalFields.js +2 -0
  330. package/build/esm/util/OptionalFields.js.map +1 -0
  331. package/build/esm/util/RequiredFields.js +2 -0
  332. package/build/esm/util/RequiredFields.js.map +1 -0
  333. package/build/types/api/action/ActionLevelValidationDefinition.d.ts +7 -0
  334. package/build/types/api/action/ActionLevelValidationDefinition.d.ts.map +1 -0
  335. package/build/types/api/action/ActionParameter.d.ts +14 -0
  336. package/build/types/api/action/ActionParameter.d.ts.map +1 -0
  337. package/build/types/api/action/ActionParameterAllowedValues.d.ts +50 -0
  338. package/build/types/api/action/ActionParameterAllowedValues.d.ts.map +1 -0
  339. package/build/types/api/action/ActionParameterConditionalOverride.d.ts +26 -0
  340. package/build/types/api/action/ActionParameterConditionalOverride.d.ts.map +1 -0
  341. package/build/types/api/action/ActionParameterConfiguration.d.ts +20 -0
  342. package/build/types/api/action/ActionParameterConfiguration.d.ts.map +1 -0
  343. package/build/types/api/action/ActionParameterType.d.ts +6 -0
  344. package/build/types/api/action/ActionParameterType.d.ts.map +1 -0
  345. package/build/types/api/action/ActionSection.d.ts +13 -0
  346. package/build/types/api/action/ActionSection.d.ts.map +1 -0
  347. package/build/types/api/action/ActionStatus.d.ts +2 -0
  348. package/build/types/api/action/ActionStatus.d.ts.map +1 -0
  349. package/build/types/api/action/ActionType.d.ts +36 -0
  350. package/build/types/api/action/ActionType.d.ts.map +1 -0
  351. package/build/types/api/action/ActionValidationRule.d.ts +2 -0
  352. package/build/types/api/action/ActionValidationRule.d.ts.map +1 -0
  353. package/build/types/api/action/ConditionDefinition.d.ts +15 -0
  354. package/build/types/api/action/ConditionDefinition.d.ts.map +1 -0
  355. package/build/types/api/action/MappingValue.d.ts +13 -0
  356. package/build/types/api/action/MappingValue.d.ts.map +1 -0
  357. package/build/types/api/action/SectionConditionalOverride.d.ts +2 -0
  358. package/build/types/api/action/SectionConditionalOverride.d.ts.map +1 -0
  359. package/build/types/api/action/SubmissionMetadata.d.ts +6 -0
  360. package/build/types/api/action/SubmissionMetadata.d.ts.map +1 -0
  361. package/build/types/api/{iconNames.d.ts.map → common/BlueprintIcons.d.ts.map} +1 -1
  362. package/build/types/api/common/OntologyDefinition.d.ts +6 -0
  363. package/build/types/api/common/OntologyDefinition.d.ts.map +1 -0
  364. package/build/types/api/common/OntologyEntityBase.d.ts +5 -0
  365. package/build/types/api/common/OntologyEntityBase.d.ts.map +1 -0
  366. package/build/types/api/common/OntologyEntityTypeEnum.d.ts +8 -0
  367. package/build/types/api/common/OntologyEntityTypeEnum.d.ts.map +1 -0
  368. package/build/types/api/common/OntologyEntityTypeMapping.d.ts +16 -0
  369. package/build/types/api/common/OntologyEntityTypeMapping.d.ts.map +1 -0
  370. package/build/types/api/common/TypeClass.d.ts +4 -0
  371. package/build/types/api/common/TypeClass.d.ts.map +1 -0
  372. package/build/types/api/defineAction.d.ts +30 -1
  373. package/build/types/api/defineAction.d.ts.map +1 -1
  374. package/build/types/api/defineInterface.d.ts +5 -3
  375. package/build/types/api/defineInterface.d.ts.map +1 -1
  376. package/build/types/api/defineInterfaceLinkConstraint.d.ts +1 -1
  377. package/build/types/api/defineInterfaceLinkConstraint.d.ts.map +1 -1
  378. package/build/types/api/defineLink.d.ts +1 -1
  379. package/build/types/api/defineLink.d.ts.map +1 -1
  380. package/build/types/api/defineObject.d.ts +2 -4
  381. package/build/types/api/defineObject.d.ts.map +1 -1
  382. package/build/types/api/defineOntology.d.ts +10 -3
  383. package/build/types/api/defineOntology.d.ts.map +1 -1
  384. package/build/types/api/defineSpt.d.ts +2 -1
  385. package/build/types/api/defineSpt.d.ts.map +1 -1
  386. package/build/types/api/defineValueType.d.ts +2 -1
  387. package/build/types/api/defineValueType.d.ts.map +1 -1
  388. package/build/types/api/importOntologyEntity.d.ts +1 -1
  389. package/build/types/api/importOntologyEntity.d.ts.map +1 -1
  390. package/build/types/api/{defineImportSpt.d.ts → importSharedPropertyType.d.ts} +2 -1
  391. package/build/types/api/importSharedPropertyType.d.ts.map +1 -0
  392. package/build/types/api/interface/InterfacePropertyType.d.ts +5 -0
  393. package/build/types/api/interface/InterfacePropertyType.d.ts.map +1 -0
  394. package/build/types/api/interface/InterfaceType.d.ts +10 -0
  395. package/build/types/api/interface/InterfaceType.d.ts.map +1 -0
  396. package/build/types/api/interface/getFlattenedInterfaceProperties.d.ts +3 -0
  397. package/build/types/api/interface/getFlattenedInterfaceProperties.d.ts.map +1 -0
  398. package/build/types/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.d.ts +3 -0
  399. package/build/types/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.d.ts.map +1 -0
  400. package/build/types/api/links/LinkType.d.ts +71 -0
  401. package/build/types/api/links/LinkType.d.ts.map +1 -0
  402. package/build/types/api/namespace/combineApiNamespaceIfMissing.d.ts +1 -0
  403. package/build/types/api/namespace/combineApiNamespaceIfMissing.d.ts.map +1 -0
  404. package/build/types/api/object/InterfaceImplementation.d.ts +8 -0
  405. package/build/types/api/object/InterfaceImplementation.d.ts.map +1 -0
  406. package/build/types/api/object/ObjectPropertyType.d.ts +27 -0
  407. package/build/types/api/object/ObjectPropertyType.d.ts.map +1 -0
  408. package/build/types/api/object/ObjectPropertyTypeUserDefinition.d.ts +3 -0
  409. package/build/types/api/object/ObjectPropertyTypeUserDefinition.d.ts.map +1 -0
  410. package/build/types/api/object/ObjectType.d.ts +29 -0
  411. package/build/types/api/object/ObjectType.d.ts.map +1 -0
  412. package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts +11 -0
  413. package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts.map +1 -0
  414. package/build/types/api/object/ObjectTypeDefinition.d.ts +26 -0
  415. package/build/types/api/object/ObjectTypeDefinition.d.ts.map +1 -0
  416. package/build/types/api/object/ObjectTypeStatus.d.ts +5 -0
  417. package/build/types/api/object/ObjectTypeStatus.d.ts.map +1 -0
  418. package/build/types/api/properties/Nullability.d.ts +4 -0
  419. package/build/types/api/properties/Nullability.d.ts.map +1 -0
  420. package/build/types/api/properties/PropertyTypeType.d.ts +33 -0
  421. package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -0
  422. package/build/types/api/properties/SharedPropertyType.d.ts +22 -0
  423. package/build/types/api/properties/SharedPropertyType.d.ts.map +1 -0
  424. package/build/types/api/propertyConversionUtils.d.ts +2 -20
  425. package/build/types/api/propertyConversionUtils.d.ts.map +1 -1
  426. package/build/types/api/values/ValueTypeDefinitionVersion.d.ts +14 -0
  427. package/build/types/api/values/ValueTypeDefinitionVersion.d.ts.map +1 -0
  428. package/build/types/api/values/ValueTypeType.d.ts +178 -0
  429. package/build/types/api/values/ValueTypeType.d.ts.map +1 -0
  430. package/build/types/api/wrapWithProxy.d.ts +1 -1
  431. package/build/types/api/wrapWithProxy.d.ts.map +1 -1
  432. package/build/types/conversion/toConjure/distributeTypeHelper.d.ts +3 -0
  433. package/build/types/conversion/toConjure/distributeTypeHelper.d.ts.map +1 -0
  434. package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts +4 -0
  435. package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts.map +1 -0
  436. package/build/types/conversion/toMarketplace/convertActionParameters.d.ts +3 -0
  437. package/build/types/conversion/toMarketplace/convertActionParameters.d.ts.map +1 -0
  438. package/build/types/conversion/toMarketplace/convertActionSections.d.ts +3 -0
  439. package/build/types/conversion/toMarketplace/convertActionSections.d.ts.map +1 -0
  440. package/build/types/conversion/toMarketplace/convertActionValidation.d.ts +3 -0
  441. package/build/types/conversion/toMarketplace/convertActionValidation.d.ts.map +1 -0
  442. package/build/types/conversion/toMarketplace/convertActionVisibility.d.ts +2 -0
  443. package/build/types/conversion/toMarketplace/convertActionVisibility.d.ts.map +1 -0
  444. package/build/types/conversion/toMarketplace/convertCardinality.d.ts +3 -0
  445. package/build/types/conversion/toMarketplace/convertCardinality.d.ts.map +1 -0
  446. package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts +3 -0
  447. package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts.map +1 -0
  448. package/build/types/conversion/toMarketplace/convertDataConstraintToDataConstraints.d.ts +2 -0
  449. package/build/types/conversion/toMarketplace/convertDataConstraintToDataConstraints.d.ts.map +1 -0
  450. package/build/types/conversion/toMarketplace/convertDatasourceDefinition.d.ts +4 -0
  451. package/build/types/conversion/toMarketplace/convertDatasourceDefinition.d.ts.map +1 -0
  452. package/build/types/conversion/toMarketplace/convertInterface.d.ts +3 -0
  453. package/build/types/conversion/toMarketplace/convertInterface.d.ts.map +1 -0
  454. package/build/types/conversion/toMarketplace/convertLink.d.ts +3 -0
  455. package/build/types/conversion/toMarketplace/convertLink.d.ts.map +1 -0
  456. package/build/types/conversion/toMarketplace/convertMappingValue.d.ts +3 -0
  457. package/build/types/conversion/toMarketplace/convertMappingValue.d.ts.map +1 -0
  458. package/build/types/conversion/toMarketplace/convertNullabilityToDataConstraint.d.ts +7 -0
  459. package/build/types/conversion/toMarketplace/convertNullabilityToDataConstraint.d.ts.map +1 -0
  460. package/build/types/conversion/toMarketplace/convertObject.d.ts +9 -0
  461. package/build/types/conversion/toMarketplace/convertObject.d.ts.map +1 -0
  462. package/build/types/conversion/toMarketplace/convertObjectPropertyType.d.ts +3 -0
  463. package/build/types/conversion/toMarketplace/convertObjectPropertyType.d.ts.map +1 -0
  464. package/build/types/conversion/toMarketplace/convertOntologyDefinition.d.ts +3 -0
  465. package/build/types/conversion/toMarketplace/convertOntologyDefinition.d.ts.map +1 -0
  466. package/build/types/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.d.ts +3 -0
  467. package/build/types/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.d.ts.map +1 -0
  468. package/build/types/conversion/toMarketplace/convertOntologyToValueTypeIr.d.ts +3 -0
  469. package/build/types/conversion/toMarketplace/convertOntologyToValueTypeIr.d.ts.map +1 -0
  470. package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts +3 -0
  471. package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts.map +1 -0
  472. package/build/types/conversion/toMarketplace/convertSpt.d.ts +3 -0
  473. package/build/types/conversion/toMarketplace/convertSpt.d.ts.map +1 -0
  474. package/build/types/conversion/toMarketplace/convertValueType.d.ts +3 -0
  475. package/build/types/conversion/toMarketplace/convertValueType.d.ts.map +1 -0
  476. package/build/types/conversion/toMarketplace/convertValueTypeDataConstraints.d.ts +2 -0
  477. package/build/types/conversion/toMarketplace/convertValueTypeDataConstraints.d.ts.map +1 -0
  478. package/build/types/conversion/toMarketplace/convertValueTypesToIr.d.ts +3 -0
  479. package/build/types/conversion/toMarketplace/convertValueTypesToIr.d.ts.map +1 -0
  480. package/build/types/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.d.ts +2 -0
  481. package/build/types/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.d.ts.map +1 -0
  482. package/build/types/conversion/toMarketplace/getFormContentOrdering.d.ts +3 -0
  483. package/build/types/conversion/toMarketplace/getFormContentOrdering.d.ts.map +1 -0
  484. package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts +3 -0
  485. package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts.map +1 -0
  486. package/build/types/index.d.ts +22 -6
  487. package/build/types/index.d.ts.map +1 -1
  488. package/build/types/util/OptionalFields.d.ts +4 -0
  489. package/build/types/util/OptionalFields.d.ts.map +1 -0
  490. package/build/types/util/RequiredFields.d.ts +4 -0
  491. package/build/types/util/RequiredFields.d.ts.map +1 -0
  492. package/package.json +3 -3
  493. package/build/browser/api/defineImportSpt.js.map +0 -1
  494. package/build/browser/api/iconNames.js +0 -2
  495. package/build/browser/api/iconNames.js.map +0 -1
  496. package/build/browser/api/ontologyUtils.js +0 -243
  497. package/build/browser/api/ontologyUtils.js.map +0 -1
  498. package/build/browser/api/types.js.map +0 -1
  499. package/build/esm/api/defineImportSpt.js.map +0 -1
  500. package/build/esm/api/iconNames.js +0 -2
  501. package/build/esm/api/iconNames.js.map +0 -1
  502. package/build/esm/api/ontologyUtils.js +0 -243
  503. package/build/esm/api/ontologyUtils.js.map +0 -1
  504. package/build/esm/api/types.js.map +0 -1
  505. package/build/types/api/defineImportSpt.d.ts.map +0 -1
  506. package/build/types/api/ontologyUtils.d.ts +0 -8
  507. package/build/types/api/ontologyUtils.d.ts.map +0 -1
  508. package/build/types/api/types.d.ts +0 -625
  509. package/build/types/api/types.d.ts.map +0 -1
  510. /package/build/types/api/{iconNames.d.ts → common/BlueprintIcons.d.ts} +0 -0
@@ -39,7 +39,23 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
39
39
 
40
40
  // src/cli/main.ts
41
41
 
42
- // src/api/types.ts
42
+ // src/conversion/toMarketplace/convertActionParameters.ts
43
+ function convertActionParameters(action) {
44
+ return Object.fromEntries((action.parameters ?? []).map((p) => [p.id, {
45
+ id: p.id,
46
+ type: typeof p.type === "string" ? {
47
+ type: p.type,
48
+ [p.type]: {}
49
+ } : p.type,
50
+ displayMetadata: {
51
+ displayName: p.displayName,
52
+ description: p.description ?? "",
53
+ typeClasses: []
54
+ }
55
+ }]));
56
+ }
57
+
58
+ // src/api/common/OntologyEntityTypeEnum.ts
43
59
  var OntologyEntityTypeEnum = /* @__PURE__ */ (function(OntologyEntityTypeEnum2) {
44
60
  OntologyEntityTypeEnum2["OBJECT_TYPE"] = "OBJECT_TYPE";
45
61
  OntologyEntityTypeEnum2["LINK_TYPE"] = "LINK_TYPE";
@@ -49,8 +65,37 @@ var OntologyEntityTypeEnum = /* @__PURE__ */ (function(OntologyEntityTypeEnum2)
49
65
  OntologyEntityTypeEnum2["VALUE_TYPE"] = "VALUE_TYPE";
50
66
  return OntologyEntityTypeEnum2;
51
67
  })({});
52
- var MODIFY_OBJECT_PARAMETER = "objectToModifyParameter";
53
- var CREATE_OR_MODIFY_OBJECT_PARAMETER = "objectToCreateOrModifyParameter";
68
+
69
+ // src/api/interface/getFlattenedInterfaceProperties.ts
70
+ function getFlattenedInterfaceProperties(interfaceType) {
71
+ let properties = interfaceType.propertiesV2;
72
+ interfaceType.extendsInterfaces.forEach((ext) => {
73
+ properties = {
74
+ ...properties,
75
+ ...getFlattenedInterfaceProperties(ext)
76
+ };
77
+ });
78
+ return properties;
79
+ }
80
+
81
+ // src/api/properties/PropertyTypeType.ts
82
+ function isPropertyTypeType(v) {
83
+ return v === "boolean" || v === "byte" || v === "date" || v === "decimal" || v === "double" || v === "float" || v === "geopoint" || v === "geoshape" || v === "integer" || v === "long" || typeof v === "object" && v.type === "marking" || v === "short" || v === "string" || v === "timestamp";
84
+ }
85
+ function isExotic(type) {
86
+ if (type === void 0) {
87
+ return false;
88
+ }
89
+ if (typeof type === "string") {
90
+ return ["geopoint", "geoshape", "mediaReference", "geotimeSeries"].includes(type);
91
+ } else if (typeof type === "object" && type != null) {
92
+ return type.type === "marking" || type.type === "struct";
93
+ }
94
+ return false;
95
+ }
96
+ function isStruct(type) {
97
+ return typeof type === "object" && type.type === "struct";
98
+ }
54
99
 
55
100
  // src/api/defineObject.ts
56
101
  var ISO_8601_DURATION = /^P(?!$)(?:(?:((?:\d+Y)|(?:\d+(?:\.|,)\d+Y$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+D)|(?:\d+(?:\.|,)\d+D$))?(T((?:\d+H)|(?:\d+(?:\.|,)\d+H$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+S)|(?:\d+(?:\.|,)\d+S$))?)?)|(?:\d+(?:(?:\.|,)\d+)?W))$/;
@@ -84,7 +129,7 @@ function defineObject(objectDef) {
84
129
  !!isExotic(objectDef.properties?.[objectDef.titlePropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Title property ${objectDef.titlePropertyApiName} must be a primitive type`) : invariant5__default.default(false) : void 0;
85
130
  !!isExotic(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} can only be primitive types`) : invariant5__default.default(false) : void 0;
86
131
  objectDef.implementsInterfaces?.forEach((interfaceImpl) => {
87
- const allInterfaceProperties = getAllInterfaceProperties(interfaceImpl.implements);
132
+ const allInterfaceProperties = getFlattenedInterfaceProperties(interfaceImpl.implements);
88
133
  const nonExistentInterfaceProperties = interfaceImpl.propertyMapping.map((val) => val.interfaceProperty).filter((interfaceProperty) => allInterfaceProperties[addNamespaceIfNone(interfaceProperty)] === void 0).map((interfaceProp) => ({
89
134
  type: "invalid",
90
135
  reason: `Interface property ${interfaceProp} referenced in ${objectDef.apiName} object does not exist`
@@ -99,7 +144,7 @@ function defineObject(objectDef) {
99
144
  reason: `Interface property ${interfaceProp[1].sharedPropertyType.apiName} not implemented by ${objectDef.apiName} object definition`
100
145
  };
101
146
  };
102
- const validations = Object.entries(getAllInterfaceProperties(interfaceImpl.implements)).map(validateProperty);
147
+ const validations = Object.entries(getFlattenedInterfaceProperties(interfaceImpl.implements)).map(validateProperty);
103
148
  const allFailedValidations = validations.concat(nonExistentInterfaceProperties).filter((val) => val.type === "invalid");
104
149
  !(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant5__default.default(false) : void 0;
105
150
  });
@@ -114,17 +159,6 @@ function defineObject(objectDef) {
114
159
  objectDef.apiName = apiName;
115
160
  return objectDef;
116
161
  }
117
- function isExotic(type) {
118
- if (type === void 0) {
119
- return false;
120
- }
121
- if (typeof type === "string") {
122
- return ["geopoint", "geoshape", "mediaReference", "geotimeSeries"].includes(type);
123
- } else if (typeof type === "object" && type != null) {
124
- return type.type === "marking" || type.type === "struct";
125
- }
126
- return false;
127
- }
128
162
  function formatValidationErrors(error) {
129
163
  return `Ontology Definition Error: ${error.reason}
130
164
  `;
@@ -147,56 +181,122 @@ function validateInterfaceImplProperty(spt, mappedObjectProp, object) {
147
181
  type: "valid"
148
182
  };
149
183
  }
150
- function convertToDisplayName(s) {
184
+ function uppercaseFirstLetter(s) {
151
185
  return s === void 0 || s == null ? "" : s.charAt(0).toUpperCase() + s.slice(1);
152
186
  }
153
187
  function convertToPluralDisplayName(s) {
154
- return s === void 0 || s == null ? "" : s.endsWith("s") ? convertToDisplayName(s) : convertToDisplayName(s) + "s";
155
- }
156
- function getAllInterfaceProperties(interfaceType) {
157
- let properties = interfaceType.propertiesV2;
158
- interfaceType.extendsInterfaces.forEach((ext) => {
159
- properties = {
160
- ...properties,
161
- ...getAllInterfaceProperties(ext)
162
- };
163
- });
164
- return properties;
188
+ return s === void 0 || s == null ? "" : s.endsWith("s") ? uppercaseFirstLetter(s) : uppercaseFirstLetter(s) + "s";
165
189
  }
166
190
  function convertUserObjectPropertyType(apiName, property) {
167
191
  property.apiName = apiName;
168
- property.displayName = property.displayName ?? convertToDisplayName(apiName);
192
+ property.displayName = property.displayName ?? uppercaseFirstLetter(apiName);
169
193
  return {
170
194
  ...property,
171
195
  apiName,
172
- displayName: property.displayName ?? convertToDisplayName(apiName),
196
+ displayName: property.displayName ?? uppercaseFirstLetter(apiName),
173
197
  type: property.type
174
198
  };
175
199
  }
176
- function convertActionVisibility(visibility) {
177
- switch (visibility) {
178
- case "editable":
179
- return {
180
- type: "editable",
181
- editable: {}
182
- };
183
- case "disabled":
200
+
201
+ // src/conversion/toMarketplace/convertActionSections.ts
202
+ function convertActionSections(action) {
203
+ return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [sectionId, {
204
+ id: sectionId,
205
+ content: section.parameters.map((p) => ({
206
+ type: "parameterId",
207
+ parameterId: p
208
+ })),
209
+ displayMetadata: {
210
+ collapsedByDefault: section.collapsedByDefault ?? false,
211
+ columnCount: section.columnCount ?? 1,
212
+ description: section.description ?? "",
213
+ displayName: section.displayName ?? uppercaseFirstLetter(sectionId),
214
+ showTitleBar: section.showTitleBar ?? true,
215
+ ...section.style && {
216
+ style: section.style === "box" ? {
217
+ type: "box",
218
+ box: {}
219
+ } : {
220
+ type: "minimal",
221
+ minimal: {}
222
+ }
223
+ }
224
+ }
225
+ }]));
226
+ }
227
+
228
+ // src/conversion/toMarketplace/convertConditionDefinition.ts
229
+ function convertConditionDefinition(condition) {
230
+ switch (condition.type) {
231
+ case "and":
232
+ if ("conditions" in condition) {
233
+ return {
234
+ type: "and",
235
+ and: {
236
+ conditions: condition.conditions.map((c) => convertConditionDefinition(c))
237
+ }
238
+ };
239
+ } else {
240
+ return condition;
241
+ }
242
+ case "or":
243
+ if ("conditions" in condition) {
244
+ return {
245
+ type: "or",
246
+ or: {
247
+ conditions: condition.conditions.map((c) => convertConditionDefinition(c))
248
+ }
249
+ };
250
+ } else {
251
+ return condition;
252
+ }
253
+ case "group":
184
254
  return {
185
- type: "disabled",
186
- disabled: {}
255
+ type: "comparison",
256
+ comparison: {
257
+ operator: "INTERSECTS",
258
+ left: {
259
+ type: "userProperty",
260
+ userProperty: {
261
+ userId: {
262
+ type: "currentUser",
263
+ currentUser: {}
264
+ },
265
+ propertyValue: {
266
+ type: "groupIds",
267
+ groupIds: {}
268
+ }
269
+ }
270
+ },
271
+ right: {
272
+ type: "staticValue",
273
+ staticValue: {
274
+ type: "stringList",
275
+ stringList: {
276
+ strings: [condition.name]
277
+ }
278
+ }
279
+ }
280
+ }
187
281
  };
188
- case "hidden":
282
+ case "parameter":
189
283
  return {
190
- type: "hidden",
191
- hidden: {}
284
+ type: "comparison",
285
+ comparison: {
286
+ operator: "EQUALS",
287
+ left: {
288
+ type: "parameterId",
289
+ parameterId: condition.parameterId
290
+ },
291
+ right: condition.matches
292
+ }
192
293
  };
193
294
  default:
194
- return {
195
- type: "editable",
196
- editable: {}
197
- };
295
+ return condition;
198
296
  }
199
297
  }
298
+
299
+ // src/conversion/toMarketplace/convertActionParameterConditionalOverride.ts
200
300
  function convertActionParameterConditionalOverride(override, validation) {
201
301
  let parameterBlockOverride;
202
302
  switch (override.type) {
@@ -266,6 +366,34 @@ function convertActionParameterConditionalOverride(override, validation) {
266
366
  parameterBlockOverrides: [parameterBlockOverride]
267
367
  };
268
368
  }
369
+
370
+ // src/conversion/toMarketplace/convertActionVisibility.ts
371
+ function convertActionVisibility(visibility) {
372
+ switch (visibility) {
373
+ case "editable":
374
+ return {
375
+ type: "editable",
376
+ editable: {}
377
+ };
378
+ case "disabled":
379
+ return {
380
+ type: "disabled",
381
+ disabled: {}
382
+ };
383
+ case "hidden":
384
+ return {
385
+ type: "hidden",
386
+ hidden: {}
387
+ };
388
+ default:
389
+ return {
390
+ type: "editable",
391
+ editable: {}
392
+ };
393
+ }
394
+ }
395
+
396
+ // src/conversion/toMarketplace/convertSectionConditionalOverride.ts
269
397
  function convertSectionConditionalOverride(override, defaultVisibility) {
270
398
  return {
271
399
  condition: convertConditionDefinition(override.condition),
@@ -283,227 +411,78 @@ function convertSectionConditionalOverride(override, defaultVisibility) {
283
411
  }]
284
412
  };
285
413
  }
286
- function convertConditionDefinition(condition) {
287
- switch (condition.type) {
288
- case "and":
289
- if ("conditions" in condition) {
290
- return {
291
- type: "and",
292
- and: {
293
- conditions: condition.conditions.map((c) => convertConditionDefinition(c))
414
+
415
+ // src/conversion/toMarketplace/convertActionValidation.ts
416
+ function convertActionValidation(action) {
417
+ return {
418
+ actionTypeLevelValidation: {
419
+ rules: Object.fromEntries((action.validation ?? [{
420
+ condition: {
421
+ type: "true",
422
+ true: {}
423
+ },
424
+ displayMetadata: {
425
+ failureMessage: "",
426
+ typeClasses: []
427
+ }
428
+ }]).map((rule, idx) => [idx, rule]))
429
+ },
430
+ parameterValidations: Object.fromEntries((action.parameters ?? []).map((p) => {
431
+ return [p.id, {
432
+ defaultValidation: {
433
+ display: {
434
+ renderHint: renderHintFromBaseType(p),
435
+ visibility: convertActionVisibility(p.validation.defaultVisibility),
436
+ ...p.defaultValue && {
437
+ prefill: p.defaultValue
438
+ }
439
+ },
440
+ validation: {
441
+ allowedValues: extractAllowedValues(p.validation.allowedValues),
442
+ required: convertParameterRequirementConstraint(p.validation.required)
294
443
  }
295
- };
296
- } else {
297
- return condition;
298
- }
299
- case "or":
300
- if ("conditions" in condition) {
301
- return {
302
- type: "or",
303
- or: {
304
- conditions: condition.conditions.map((c) => convertConditionDefinition(c))
444
+ },
445
+ conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation)) ?? []
446
+ }];
447
+ })),
448
+ sectionValidations: {
449
+ ...Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [section.id, {
450
+ defaultDisplayMetadata: section.defaultVisibility === "hidden" ? {
451
+ visibility: {
452
+ type: "hidden",
453
+ hidden: {}
305
454
  }
306
- };
307
- } else {
308
- return condition;
309
- }
310
- case "group":
311
- return {
312
- type: "comparison",
313
- comparison: {
314
- operator: "INTERSECTS",
315
- left: {
316
- type: "userProperty",
317
- userProperty: {
318
- userId: {
319
- type: "currentUser",
320
- currentUser: {}
321
- },
322
- propertyValue: {
323
- type: "groupIds",
324
- groupIds: {}
325
- }
326
- }
327
- },
328
- right: {
329
- type: "staticValue",
330
- staticValue: {
331
- type: "stringList",
332
- stringList: {
333
- strings: [condition.name]
334
- }
335
- }
455
+ } : {
456
+ visibility: {
457
+ type: "visible",
458
+ visible: {}
336
459
  }
337
- }
338
- };
339
- case "parameter":
340
- return {
341
- type: "comparison",
342
- comparison: {
343
- operator: "EQUALS",
344
- left: {
345
- type: "parameterId",
346
- parameterId: condition.parameterId
347
- },
348
- right: condition.matches
349
- }
350
- };
351
- default:
352
- return condition;
353
- }
354
- }
355
- function getFormContentOrdering(action, parameterOrdering) {
356
- if (!action.sections) return [];
357
- const parametersToSection = Object.fromEntries(Object.entries(action.sections).flatMap(([sectionId, section]) => section.parameters.map((param) => [param, sectionId])));
358
- const seenIds = /* @__PURE__ */ new Set();
359
- const formContentOrdering = [];
360
- parameterOrdering.forEach((param) => {
361
- if (param in parametersToSection && !seenIds.has(parametersToSection[param])) {
362
- formContentOrdering.push({
363
- type: "sectionId",
364
- sectionId: parametersToSection[param]
365
- });
366
- seenIds.add(parametersToSection[param]);
367
- } else if (!(param in parametersToSection)) {
368
- formContentOrdering.push({
369
- type: "parameterId",
370
- parameterId: param
371
- });
372
- seenIds.add(param);
460
+ },
461
+ conditionalOverrides: section.conditionalOverrides?.map((override) => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible")) ?? []
462
+ }]))
373
463
  }
374
- });
375
- return formContentOrdering;
376
- }
377
- function convertMappingValue(value) {
378
- switch (value.type) {
379
- case "uuid":
380
- return {
381
- type: "uniqueIdentifier",
382
- uniqueIdentifier: {
383
- linkId: value.linkId ?? crypto.randomUUID()
384
- }
385
- };
386
- case "currentTime":
387
- return {
388
- type: "currentTime",
389
- currentTime: {}
390
- };
391
- case "currentUser":
392
- return {
393
- type: "currentUser",
394
- currentUser: {}
395
- };
396
- default:
397
- return value;
398
- }
399
- }
400
- var defaultTypeClasses = [{
401
- kind: "render_hint",
402
- name: "SELECTABLE"
403
- }, {
404
- kind: "render_hint",
405
- name: "SORTABLE"
406
- }];
407
- function shouldNotHaveRenderHints(type) {
408
- return ["struct", "mediaReference", "geotimeSeries"].includes(getPropertyTypeName(type));
409
- }
410
- function hasRenderHints(typeClasses) {
411
- return (typeClasses ?? []).some((tc) => tc.kind.toLowerCase() === "render_hint");
412
- }
413
- function getPropertyTypeName(type) {
414
- return typeof type === "object" ? type.type : type;
415
- }
416
- function convertValueType(valueType) {
417
- return {
418
- apiName: valueType.apiName,
419
- version: valueType.version,
420
- packageNamespace: valueType.packageNamespace,
421
- displayMetadata: valueType.displayMetadata
422
- };
423
- }
424
- function convertValueTypeDataConstraints(dataConstraints) {
425
- if (dataConstraints.length === 0) {
426
- return void 0;
427
- }
428
- const propertyTypeConstraints = dataConstraints.map((constraint) => ({
429
- constraints: dataConstraintToPropertyTypeDataConstraint(constraint.constraint.constraint),
430
- failureMessage: constraint.constraint.failureMessage
431
- }));
432
- return {
433
- propertyTypeConstraints
434
464
  };
435
465
  }
436
- function dataConstraintToPropertyTypeDataConstraint(dc) {
437
- switch (dc.type) {
438
- case "array":
439
- return {
440
- ...dc
441
- };
442
- case "boolean":
443
- return {
444
- ...dc
445
- };
446
- case "binary":
447
- throw new Error("Binary type constraints are not supported");
448
- case "date":
449
- return {
450
- ...dc
451
- };
452
- case "decimal":
453
- return {
454
- ...dc
455
- };
456
- case "double":
457
- return {
458
- ...dc
459
- };
460
- case "float":
461
- return {
462
- ...dc
463
- };
464
- case "integer":
465
- return {
466
- ...dc
467
- };
468
- case "long":
469
- return {
470
- ...dc
471
- };
472
- case "map":
473
- throw new Error("Map type constraints are not supported");
474
- case "nullable":
475
- throw new Error("Nullable constraints are not supported");
476
- case "short":
477
- return {
478
- ...dc
479
- };
480
- case "string":
481
- return {
482
- ...dc
483
- };
484
- case "struct":
485
- return {
486
- type: "struct",
487
- struct: {
488
- elementConstraints: Object.fromEntries(Object.entries(dc.struct.elementConstraints).map(([field, constraint]) => [field, convertDataConstraintToDataConstraints(constraint)]))
489
- }
490
- };
491
- case "structV2":
492
- throw new Error("StructV2 constraints are not supported");
493
- case "timestamp":
494
- return {
495
- ...dc
496
- };
497
- default:
498
- throw new Error(`Unknown DataConstraint type: ${dc.type}`);
466
+ function convertParameterRequirementConstraint(required) {
467
+ if (typeof required === "boolean") {
468
+ return required ? {
469
+ type: "required",
470
+ required: {}
471
+ } : {
472
+ type: "notRequired",
473
+ notRequired: {}
474
+ };
499
475
  }
500
- }
501
- function convertDataConstraintToDataConstraints(dc) {
476
+ const {
477
+ min,
478
+ max
479
+ } = required.listLength;
502
480
  return {
503
- propertyTypeConstraints: [{
504
- constraints: dataConstraintToPropertyTypeDataConstraint(dc)
505
- // known limitation: structs don't carry field-level data constraint failure messages
506
- }]
481
+ type: "listLengthValidation",
482
+ listLengthValidation: {
483
+ minLength: min,
484
+ maxLength: max
485
+ }
507
486
  };
508
487
  }
509
488
  function convertNullabilityToDataConstraint(prop) {
@@ -531,7 +510,17 @@ function convertNullabilityToDataConstraint(prop) {
531
510
  nullabilityV2: prop.nullability
532
511
  };
533
512
  }
534
- function convertType(type) {
513
+
514
+ // src/conversion/toConjure/distributeTypeHelper.ts
515
+ function distributeTypeHelper(type) {
516
+ return {
517
+ type,
518
+ [type]: {}
519
+ };
520
+ }
521
+
522
+ // src/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.ts
523
+ function propertyTypeTypeToOntologyIrType(type) {
535
524
  switch (true) {
536
525
  case (typeof type === "object" && "markingType" in type):
537
526
  return {
@@ -554,14 +543,14 @@ function convertType(type) {
554
543
  },
555
544
  typeClasses: [],
556
545
  aliases: [],
557
- fieldType: convertType(fieldTypeDefinition)
546
+ fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition)
558
547
  };
559
548
  } else {
560
549
  if ("fieldType" in fieldTypeDefinition) {
561
550
  field = {
562
551
  ...fieldTypeDefinition,
563
552
  apiName: key,
564
- fieldType: convertType(fieldTypeDefinition.fieldType),
553
+ fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition.fieldType),
565
554
  typeClasses: fieldTypeDefinition.typeClasses ?? [],
566
555
  aliases: fieldTypeDefinition.aliases ?? []
567
556
  };
@@ -574,7 +563,7 @@ function convertType(type) {
574
563
  },
575
564
  typeClasses: [],
576
565
  aliases: [],
577
- fieldType: convertType(fieldTypeDefinition)
566
+ fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition)
578
567
  };
579
568
  }
580
569
  }
@@ -635,187 +624,415 @@ function convertType(type) {
635
624
  return distributeTypeHelper(type);
636
625
  }
637
626
  }
638
- function distributeTypeHelper(type) {
639
- return {
640
- type,
641
- [type]: {}
642
- };
643
- }
644
627
 
645
- // src/api/defineOntology.ts
646
- var ontologyDefinition;
647
- var importedTypes;
648
- var dependencies;
649
- var namespace;
650
- function updateOntology(entity) {
651
- if (entity.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
652
- ontologyDefinition[entity.__type][entity.apiName] = entity;
653
- return;
654
- }
655
- if (ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] === void 0) {
656
- ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] = [];
657
- }
658
- ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName].push(entity);
659
- }
660
- async function defineOntology(ns, body, outputDir, dependencyFile) {
661
- namespace = ns;
662
- dependencies = {};
663
- ontologyDefinition = {
664
- OBJECT_TYPE: {},
665
- ACTION_TYPE: {},
666
- LINK_TYPE: {},
667
- INTERFACE_TYPE: {},
668
- SHARED_PROPERTY_TYPE: {},
669
- VALUE_TYPE: {}
670
- };
671
- importedTypes = {
672
- SHARED_PROPERTY_TYPE: {},
673
- OBJECT_TYPE: {},
674
- ACTION_TYPE: {},
675
- LINK_TYPE: {},
676
- INTERFACE_TYPE: {},
677
- VALUE_TYPE: {}
628
+ // src/conversion/toMarketplace/convertSpt.ts
629
+ function convertSpt({
630
+ type,
631
+ array,
632
+ description,
633
+ apiName,
634
+ displayName,
635
+ visibility,
636
+ gothamMapping,
637
+ typeClasses,
638
+ valueType,
639
+ nullability
640
+ }) {
641
+ const dataConstraint = convertNullabilityToDataConstraint({
642
+ type,
643
+ nullability
644
+ });
645
+ return {
646
+ apiName,
647
+ displayMetadata: {
648
+ displayName: displayName ?? apiName,
649
+ visibility: visibility ?? "NORMAL",
650
+ description
651
+ },
652
+ type: array ? {
653
+ type: "array",
654
+ array: {
655
+ subtype: propertyTypeTypeToOntologyIrType(type)
656
+ }
657
+ } : propertyTypeTypeToOntologyIrType(type),
658
+ aliases: [],
659
+ baseFormatter: void 0,
660
+ dataConstraints: dataConstraint,
661
+ gothamMapping,
662
+ indexedForSearch: true,
663
+ typeClasses: typeClasses ?? [],
664
+ valueType: valueType === void 0 ? void 0 : {
665
+ apiName: valueType.apiName,
666
+ version: valueType.version,
667
+ packageNamespace: valueType.packageNamespace,
668
+ displayMetadata: valueType.displayMetadata
669
+ }
678
670
  };
679
- try {
680
- await body();
681
- } catch (e) {
682
- console.error("Unexpected error while processing the body of the ontology", e);
683
- throw e;
684
- }
685
- if (outputDir) {
686
- writeStaticObjects(outputDir);
687
- }
688
- if (dependencyFile) {
689
- writeDependencyFile(dependencyFile);
690
- }
691
- return convertToWireOntologyIr(ontologyDefinition);
692
671
  }
693
- function writeStaticObjects(outputDir) {
694
- const codegenDir = path2__namespace.resolve(outputDir, "codegen");
695
- const typeDirs = {
696
- [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: "shared-property-types",
697
- [OntologyEntityTypeEnum.ACTION_TYPE]: "action-types",
698
- [OntologyEntityTypeEnum.OBJECT_TYPE]: "object-types",
699
- [OntologyEntityTypeEnum.LINK_TYPE]: "link-types",
700
- [OntologyEntityTypeEnum.INTERFACE_TYPE]: "interface-types",
701
- [OntologyEntityTypeEnum.VALUE_TYPE]: "value-types"
672
+
673
+ // src/conversion/toMarketplace/convertInterface.ts
674
+ function convertInterface(interfaceType) {
675
+ const {
676
+ __type,
677
+ ...other
678
+ } = interfaceType;
679
+ return {
680
+ ...other,
681
+ propertiesV2: Object.fromEntries(Object.values(interfaceType.propertiesV2).map((spt) => [spt.sharedPropertyType.apiName, {
682
+ required: spt.required,
683
+ sharedPropertyType: convertSpt(spt.sharedPropertyType)
684
+ }])),
685
+ displayMetadata: {
686
+ displayName: interfaceType.displayMetadata.displayName,
687
+ description: interfaceType.displayMetadata.description,
688
+ icon: interfaceType.displayMetadata.icon ?? {
689
+ type: "blueprint",
690
+ blueprint: {
691
+ color: "#4C90F0",
692
+ locator: "layout-hierarchy"
693
+ }
694
+ }
695
+ },
696
+ extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
697
+ // these are omitted from our internal types but we need to re-add them for the final json
698
+ properties: [],
699
+ // TODO(mwalther): Support propertiesV3
700
+ propertiesV3: {}
702
701
  };
703
- if (!fs__namespace.existsSync(codegenDir)) {
704
- fs__namespace.mkdirSync(codegenDir, {
705
- recursive: true
706
- });
702
+ }
703
+
704
+ // src/conversion/toMarketplace/convertCardinality.ts
705
+ function convertCardinality(cardinality) {
706
+ if (cardinality === "OneToMany" || cardinality === void 0) {
707
+ return "ONE_TO_MANY";
707
708
  }
708
- Object.values(typeDirs).forEach((typeDirNameFromMap) => {
709
- const currentTypeDirPath = path2__namespace.join(codegenDir, typeDirNameFromMap);
710
- if (fs__namespace.existsSync(currentTypeDirPath)) {
711
- fs__namespace.rmSync(currentTypeDirPath, {
712
- recursive: true,
713
- force: true
714
- });
715
- }
716
- fs__namespace.mkdirSync(currentTypeDirPath, {
717
- recursive: true
718
- });
719
- });
720
- const topLevelExportStatements = [];
721
- Object.entries(ontologyDefinition).forEach(([ontologyTypeEnumKey, entities]) => {
722
- const typeDirName = typeDirs[ontologyTypeEnumKey];
723
- const typeDirPath = path2__namespace.join(codegenDir, typeDirName);
724
- const entityModuleNames = [];
725
- Object.entries(entities).forEach(([apiName, entity]) => {
726
- const entityFileNameBase = camel(withoutNamespace(apiName)) + (ontologyTypeEnumKey === OntologyEntityTypeEnum.VALUE_TYPE ? "ValueType" : "");
727
- const filePath = path2__namespace.join(typeDirPath, `${entityFileNameBase}.ts`);
728
- const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);
729
- const entityJSON = JSON.stringify(entity, null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
730
- const content = `
731
- import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';
732
- import type { ${entityTypeName} } from '@osdk/maker';
709
+ return "ONE_TO_ONE";
710
+ }
733
711
 
734
- const ${entityFileNameBase}_base: ${entityTypeName} = ${ontologyTypeEnumKey === "VALUE_TYPE" ? entityJSON.slice(1, -2) : entityJSON} as unknown as ${entityTypeName};
735
-
736
- export const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFileNameBase}_base);
737
- `;
738
- fs__namespace.writeFileSync(filePath, content, {
739
- flag: "w"
740
- });
741
- entityModuleNames.push(entityFileNameBase);
742
- });
743
- for (const entityModuleName of entityModuleNames) {
744
- topLevelExportStatements.push(`export { ${entityModuleName} } from "./codegen/${typeDirName}/${entityModuleName}.js";`);
712
+ // src/conversion/toMarketplace/convertLink.ts
713
+ function convertLink(linkType) {
714
+ let definition;
715
+ let datasource = void 0;
716
+ if ("one" in linkType) {
717
+ definition = {
718
+ type: "oneToMany",
719
+ oneToMany: {
720
+ cardinalityHint: convertCardinality(linkType.cardinality),
721
+ manyToOneLinkMetadata: linkType.toMany.metadata,
722
+ objectTypeRidManySide: linkType.toMany.object.apiName,
723
+ objectTypeRidOneSide: linkType.one.object.apiName,
724
+ oneToManyLinkMetadata: linkType.one.metadata,
725
+ oneSidePrimaryKeyToManySidePropertyMapping: [{
726
+ from: {
727
+ apiName: linkType.one.object.primaryKeyPropertyApiName,
728
+ object: linkType.one.object.apiName
729
+ },
730
+ to: {
731
+ apiName: linkType.manyForeignKeyProperty,
732
+ object: linkType.toMany.object.apiName
733
+ }
734
+ }]
735
+ }
736
+ };
737
+ } else {
738
+ definition = {
739
+ type: "manyToMany",
740
+ manyToMany: {
741
+ objectTypeAToBLinkMetadata: linkType.many.metadata,
742
+ objectTypeBToALinkMetadata: linkType.toMany.metadata,
743
+ objectTypeRidA: linkType.many.object.apiName,
744
+ objectTypeRidB: linkType.toMany.object.apiName,
745
+ peeringMetadata: void 0,
746
+ objectTypeAPrimaryKeyPropertyMapping: [{
747
+ from: {
748
+ apiName: linkType.many.object.primaryKeyPropertyApiName,
749
+ object: linkType.many.object.apiName
750
+ },
751
+ to: {
752
+ apiName: linkType.many.object.primaryKeyPropertyApiName,
753
+ object: linkType.many.object.apiName
754
+ }
755
+ }],
756
+ objectTypeBPrimaryKeyPropertyMapping: [{
757
+ from: {
758
+ apiName: linkType.toMany.object.primaryKeyPropertyApiName,
759
+ object: linkType.toMany.object.apiName
760
+ },
761
+ to: {
762
+ apiName: linkType.toMany.object.primaryKeyPropertyApiName,
763
+ object: linkType.toMany.object.apiName
764
+ }
765
+ }]
766
+ }
767
+ };
768
+ datasource = {
769
+ rid: "ri.ontology.main.datasource.link-".concat(linkType.apiName),
770
+ datasource: {
771
+ type: "dataset",
772
+ dataset: {
773
+ datasetRid: "link-".concat(linkType.apiName),
774
+ writebackDatasetRid: void 0,
775
+ objectTypeAPrimaryKeyMapping: [{
776
+ property: {
777
+ apiName: linkType.many.object.primaryKeyPropertyApiName,
778
+ object: linkType.many.object.apiName
779
+ },
780
+ column: linkType.many.object.primaryKeyPropertyApiName
781
+ }],
782
+ objectTypeBPrimaryKeyMapping: [{
783
+ property: {
784
+ apiName: linkType.toMany.object.primaryKeyPropertyApiName,
785
+ object: linkType.toMany.object.apiName
786
+ },
787
+ column: linkType.toMany.object.primaryKeyPropertyApiName
788
+ }]
789
+ }
790
+ },
791
+ editsConfiguration: {
792
+ onlyAllowPrivilegedEdits: false
793
+ },
794
+ redacted: linkType.redacted
795
+ };
796
+ }
797
+ return {
798
+ linkType: {
799
+ definition,
800
+ id: cleanAndValidateLinkTypeId(linkType.apiName),
801
+ status: linkType.status ?? {
802
+ type: "active",
803
+ active: {}
804
+ },
805
+ redacted: linkType.redacted ?? false
806
+ },
807
+ datasources: datasource !== void 0 ? [datasource] : [],
808
+ entityMetadata: {
809
+ arePatchesEnabled: linkType.editsEnabled ?? false
745
810
  }
746
- });
747
- if (topLevelExportStatements.length > 0) {
748
- const mainIndexContent = dependencyInjectionString() + topLevelExportStatements.join("\n") + "\n";
749
- const mainIndexFilePath = path2__namespace.join(outputDir, "index.ts");
750
- fs__namespace.writeFileSync(mainIndexFilePath, mainIndexContent, {
751
- flag: "w"
752
- });
811
+ };
812
+ }
813
+
814
+ // src/conversion/toMarketplace/convertDatasourceDefinition.ts
815
+ function convertDatasourceDefinition(objectType, properties) {
816
+ switch (objectType.datasource?.type) {
817
+ case "stream":
818
+ const window = objectType.datasource.retentionPeriod;
819
+ const retentionPolicy = window ? {
820
+ type: "time",
821
+ time: {
822
+ window
823
+ }
824
+ } : {
825
+ type: "none",
826
+ none: {}
827
+ };
828
+ const propertyMapping = Object.fromEntries(properties.map((prop) => [prop.apiName, prop.apiName]));
829
+ return {
830
+ type: "streamV2",
831
+ streamV2: {
832
+ streamLocator: objectType.apiName,
833
+ propertyMapping,
834
+ retentionPolicy,
835
+ propertySecurityGroups: void 0
836
+ }
837
+ };
838
+ case "restrictedView":
839
+ return {
840
+ type: "restrictedViewV2",
841
+ restrictedViewV2: {
842
+ restrictedViewRid: objectType.apiName,
843
+ propertyMapping: buildPropertyMapping(properties)
844
+ }
845
+ };
846
+ case "dataset":
847
+ default:
848
+ return {
849
+ type: "datasetV2",
850
+ datasetV2: {
851
+ datasetRid: objectType.apiName,
852
+ propertyMapping: buildPropertyMapping(properties)
853
+ }
854
+ };
753
855
  }
754
856
  }
755
- function convertOntologyToValueTypeIr(ontology) {
857
+ function buildPropertyMapping(properties) {
858
+ return Object.fromEntries(properties.map((prop) => {
859
+ if (prop.editOnly) {
860
+ return [prop.apiName, {
861
+ type: "editOnly",
862
+ editOnly: {}
863
+ }];
864
+ }
865
+ if (typeof prop.type === "object" && prop.type?.type === "struct") {
866
+ const structMapping = {
867
+ type: "struct",
868
+ struct: {
869
+ column: prop.apiName,
870
+ mapping: Object.fromEntries(Object.keys(prop.type.structDefinition).map((fieldName) => [fieldName, {
871
+ apiName: fieldName,
872
+ mappings: {}
873
+ }]))
874
+ }
875
+ };
876
+ return [prop.apiName, structMapping];
877
+ }
878
+ return [prop.apiName, {
879
+ type: "column",
880
+ column: prop.apiName
881
+ }];
882
+ }));
883
+ }
884
+
885
+ // src/api/propertyConversionUtils.ts
886
+ var defaultTypeClasses = [{
887
+ kind: "render_hint",
888
+ name: "SELECTABLE"
889
+ }, {
890
+ kind: "render_hint",
891
+ name: "SORTABLE"
892
+ }];
893
+ function shouldNotHaveRenderHints(type) {
894
+ return ["struct", "mediaReference", "geotimeSeries"].includes(getPropertyTypeName(type));
895
+ }
896
+ function hasRenderHints(typeClasses) {
897
+ return (typeClasses ?? []).some((tc) => tc.kind.toLowerCase() === "render_hint");
898
+ }
899
+ function getPropertyTypeName(type) {
900
+ return typeof type === "object" ? type.type : type;
901
+ }
902
+
903
+ // src/conversion/toMarketplace/convertValueType.ts
904
+ function convertValueType(valueType) {
756
905
  return {
757
- valueTypes: convertValueTypesToIr(ontology[OntologyEntityTypeEnum.VALUE_TYPE])
906
+ apiName: valueType.apiName,
907
+ version: valueType.version,
908
+ packageNamespace: valueType.packageNamespace,
909
+ displayMetadata: valueType.displayMetadata
758
910
  };
759
911
  }
760
- function convertValueTypesToIr(valueTypes) {
761
- return Object.values(valueTypes).map((definitions) => ({
762
- metadata: {
763
- apiName: definitions[0].apiName,
764
- packageNamespace: definitions[0].packageNamespace,
765
- displayMetadata: definitions[0].displayMetadata,
766
- status: definitions[0].status
767
- },
768
- // TODO(dpaquin): instead of deduping here, we should refactor the value type types from arrays to maps
769
- versions: Array.from(new Map(definitions.map((definition) => [definition.version, definition])).values()).map((definition) => ({
770
- version: definition.version,
771
- baseType: definition.baseType,
772
- constraints: definition.constraints,
773
- exampleValues: definition.exampleValues
774
- }))
775
- }));
776
- }
777
- function convertToWireOntologyIr(ontology) {
912
+
913
+ // src/conversion/toMarketplace/convertDataConstraintToDataConstraints.ts
914
+ function convertDataConstraintToDataConstraints(dc) {
778
915
  return {
779
- ontology: convertToWireBlockData(ontology),
780
- importedOntology: convertToWireBlockData(importedTypes),
781
- valueTypes: convertOntologyToValueTypeIr(ontology),
782
- importedValueTypes: convertOntologyToValueTypeIr(importedTypes)
916
+ propertyTypeConstraints: [{
917
+ constraints: dataConstraintToPropertyTypeDataConstraint(dc)
918
+ // known limitation: structs don't carry field-level data constraint failure messages
919
+ }]
783
920
  };
784
921
  }
785
- function convertToWireBlockData(ontology) {
922
+
923
+ // src/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.ts
924
+ function dataConstraintToPropertyTypeDataConstraint(dc) {
925
+ switch (dc.type) {
926
+ case "array":
927
+ return {
928
+ ...dc
929
+ };
930
+ case "boolean":
931
+ return {
932
+ ...dc
933
+ };
934
+ case "binary":
935
+ throw new Error("Binary type constraints are not supported");
936
+ case "date":
937
+ return {
938
+ ...dc
939
+ };
940
+ case "decimal":
941
+ return {
942
+ ...dc
943
+ };
944
+ case "double":
945
+ return {
946
+ ...dc
947
+ };
948
+ case "float":
949
+ return {
950
+ ...dc
951
+ };
952
+ case "integer":
953
+ return {
954
+ ...dc
955
+ };
956
+ case "long":
957
+ return {
958
+ ...dc
959
+ };
960
+ case "map":
961
+ throw new Error("Map type constraints are not supported");
962
+ case "nullable":
963
+ throw new Error("Nullable constraints are not supported");
964
+ case "short":
965
+ return {
966
+ ...dc
967
+ };
968
+ case "string":
969
+ return {
970
+ ...dc
971
+ };
972
+ case "struct":
973
+ return {
974
+ type: "struct",
975
+ struct: {
976
+ elementConstraints: Object.fromEntries(Object.entries(dc.struct.elementConstraints).map(([field, constraint]) => [field, convertDataConstraintToDataConstraints(constraint)]))
977
+ }
978
+ };
979
+ case "structV2":
980
+ throw new Error("StructV2 constraints are not supported");
981
+ case "timestamp":
982
+ return {
983
+ ...dc
984
+ };
985
+ default:
986
+ throw new Error(`Unknown DataConstraint type: ${dc.type}`);
987
+ }
988
+ }
989
+
990
+ // src/conversion/toMarketplace/convertValueTypeDataConstraints.ts
991
+ function convertValueTypeDataConstraints(dataConstraints) {
992
+ if (dataConstraints.length === 0) {
993
+ return void 0;
994
+ }
995
+ const propertyTypeConstraints = dataConstraints.map((constraint) => ({
996
+ constraints: dataConstraintToPropertyTypeDataConstraint(constraint.constraint.constraint),
997
+ failureMessage: constraint.constraint.failureMessage
998
+ }));
786
999
  return {
787
- objectTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.OBJECT_TYPE]).map(([apiName, objectType]) => {
788
- return [apiName, convertObject(objectType)];
789
- })),
790
- sharedPropertyTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]).map(([apiName, spt]) => [apiName, {
791
- sharedPropertyType: convertSpt(spt)
792
- }])),
793
- interfaceTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.INTERFACE_TYPE]).map(([apiName, interfaceType]) => {
794
- return [apiName, {
795
- interfaceType: convertInterface(interfaceType)
796
- }];
797
- })),
798
- linkTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.LINK_TYPE]).map(([id, link]) => {
799
- return [id, convertLink(link)];
800
- })),
801
- actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).map(([apiName, action]) => {
802
- return [apiName, convertAction(action)];
803
- })),
804
- blockPermissionInformation: {
805
- actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).filter(([apiName, action]) => action.validation).map(([apiName, action]) => {
806
- return [apiName, {
807
- restrictionStatus: {
808
- hasRolesApplied: true,
809
- ontologyPackageRid: null,
810
- publicProject: false
811
- }
812
- }];
813
- })),
814
- linkTypes: {},
815
- objectTypes: {}
816
- }
1000
+ propertyTypeConstraints
1001
+ };
1002
+ }
1003
+
1004
+ // src/conversion/toMarketplace/convertObjectPropertyType.ts
1005
+ function convertObjectPropertyType(property) {
1006
+ const apiName = namespace + property.apiName;
1007
+ !(!shouldNotHaveRenderHints(property.type) || !hasRenderHints(property.typeClasses)) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Property type ${apiName} of type '${getPropertyTypeName(property.type)}' should not have render hints`) : invariant5__default.default(false) : void 0;
1008
+ const output = {
1009
+ apiName: property.apiName,
1010
+ sharedPropertyTypeApiName: property.sharedPropertyType?.apiName,
1011
+ displayMetadata: {
1012
+ displayName: property.displayName,
1013
+ description: property.description,
1014
+ visibility: property.visibility ?? "NORMAL"
1015
+ },
1016
+ indexedForSearch: property.indexedForSearch ?? true,
1017
+ ruleSetBinding: void 0,
1018
+ baseFormatter: property.baseFormatter,
1019
+ type: property.array ? {
1020
+ type: "array",
1021
+ array: {
1022
+ subtype: propertyTypeTypeToOntologyIrType(property.type)
1023
+ }
1024
+ } : propertyTypeTypeToOntologyIrType(property.type),
1025
+ typeClasses: property.typeClasses ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),
1026
+ status: convertObjectStatus(property.status),
1027
+ inlineAction: void 0,
1028
+ dataConstraints: property.valueType ? convertValueTypeDataConstraints(property.valueType.constraints) : convertNullabilityToDataConstraint(property),
1029
+ sharedPropertyTypeRid: property.sharedPropertyType?.apiName,
1030
+ valueType: property.valueType ? convertValueType(property.valueType) : void 0
817
1031
  };
1032
+ return output;
818
1033
  }
1034
+
1035
+ // src/conversion/toMarketplace/convertObject.ts
819
1036
  function convertObject(objectType) {
820
1037
  const propertyDatasources = (objectType.properties ?? []).flatMap((prop) => extractPropertyDatasource(prop, objectType.apiName));
821
1038
  const classificationGroupMarkingNames = extractMarkingGroups(objectType.properties ?? [], "CBAC");
@@ -841,7 +1058,7 @@ function convertObject(objectType) {
841
1058
  visibility: objectType.visibility ?? "NORMAL"
842
1059
  },
843
1060
  primaryKeys: [objectType.primaryKeyPropertyApiName],
844
- propertyTypes: Object.fromEntries(objectType.properties?.map((val) => [val.apiName, convertProperty(val)]) ?? []),
1061
+ propertyTypes: Object.fromEntries(objectType.properties?.map((val) => [val.apiName, convertObjectPropertyType(val)]) ?? []),
845
1062
  titlePropertyTypeRid: objectType.titlePropertyApiName,
846
1063
  apiName: objectType.apiName,
847
1064
  status: convertObjectStatus(objectType.status),
@@ -862,6 +1079,14 @@ function convertObject(objectType) {
862
1079
  }
863
1080
  };
864
1081
  }
1082
+ function extractMarkingGroups(properties, markingType) {
1083
+ return properties.map((prop) => {
1084
+ if (typeof prop.type === "object" && prop.type.type === "marking" && prop.type.markingType === markingType) {
1085
+ return prop.type.markingInputGroupName;
1086
+ }
1087
+ return void 0;
1088
+ }).filter((val) => val !== void 0);
1089
+ }
865
1090
  function extractPropertyDatasource(property, objectTypeApiName) {
866
1091
  if (!isExotic(property.type)) {
867
1092
  return [];
@@ -878,244 +1103,245 @@ function extractPropertyDatasource(property, objectTypeApiName) {
878
1103
  };
879
1104
  return [buildDatasource(property.apiName, geotimeDefinition)];
880
1105
  case "mediaReference":
881
- const mediaSetDefinition = {
882
- type: "mediaSetView",
883
- mediaSetView: {
884
- assumedMarkings: [],
885
- mediaSetViewLocator: identifier,
886
- properties: [property.apiName]
887
- }
888
- };
889
- return [buildDatasource(property.apiName, mediaSetDefinition)];
890
- default:
891
- return [];
892
- }
893
- }
894
- function buildDatasource(apiName, definition, classificationMarkingGroupName, mandatoryMarkingGroupName) {
895
- const needsSecurity = classificationMarkingGroupName !== void 0 || mandatoryMarkingGroupName !== void 0;
896
- const securityConfig = needsSecurity ? {
897
- classificationConstraint: classificationMarkingGroupName ? {
898
- markingGroupName: classificationMarkingGroupName
899
- } : void 0,
900
- markingConstraint: mandatoryMarkingGroupName ? {
901
- markingGroupName: mandatoryMarkingGroupName
902
- } : void 0
903
- } : void 0;
904
- return {
905
- rid: "ri.ontology.main.datasource.".concat(apiName),
906
- datasource: definition,
907
- editsConfiguration: {
908
- onlyAllowPrivilegedEdits: false
909
- },
910
- redacted: false,
911
- ...securityConfig !== void 0 && {
912
- dataSecurity: securityConfig
913
- }
914
- };
915
- }
916
- function convertDatasourceDefinition(objectType, properties) {
917
- switch (objectType.datasource?.type) {
918
- case "stream":
919
- const window = objectType.datasource.retentionPeriod;
920
- const retentionPolicy = window ? {
921
- type: "time",
922
- time: {
923
- window
924
- }
925
- } : {
926
- type: "none",
927
- none: {}
928
- };
929
- const propertyMapping = Object.fromEntries(properties.map((prop) => [prop.apiName, prop.apiName]));
930
- return {
931
- type: "streamV2",
932
- streamV2: {
933
- streamLocator: objectType.apiName,
934
- propertyMapping,
935
- retentionPolicy,
936
- propertySecurityGroups: void 0
937
- }
938
- };
939
- case "restrictedView":
940
- return {
941
- type: "restrictedViewV2",
942
- restrictedViewV2: {
943
- restrictedViewRid: objectType.apiName,
944
- propertyMapping: buildPropertyMapping(properties)
1106
+ const mediaSetDefinition = {
1107
+ type: "mediaSetView",
1108
+ mediaSetView: {
1109
+ assumedMarkings: [],
1110
+ mediaSetViewLocator: identifier,
1111
+ properties: [property.apiName]
945
1112
  }
946
1113
  };
947
- case "dataset":
1114
+ return [buildDatasource(property.apiName, mediaSetDefinition)];
948
1115
  default:
949
- return {
950
- type: "datasetV2",
951
- datasetV2: {
952
- datasetRid: objectType.apiName,
953
- propertyMapping: buildPropertyMapping(properties)
954
- }
955
- };
1116
+ return [];
956
1117
  }
957
1118
  }
958
- function extractMarkingGroups(properties, markingType) {
959
- return properties.map((prop) => {
960
- if (typeof prop.type === "object" && prop.type.type === "marking" && prop.type.markingType === markingType) {
961
- return prop.type.markingInputGroupName;
962
- }
963
- return void 0;
964
- }).filter((val) => val !== void 0);
965
- }
966
- function buildPropertyMapping(properties) {
967
- return Object.fromEntries(properties.map((prop) => {
968
- if (prop.editOnly) {
969
- return [prop.apiName, {
970
- type: "editOnly",
971
- editOnly: {}
1119
+
1120
+ // src/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.ts
1121
+ function convertOntologyDefinitionToWireBlockData(ontology) {
1122
+ return {
1123
+ objectTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.OBJECT_TYPE]).map(([apiName, objectType]) => {
1124
+ return [apiName, convertObject(objectType)];
1125
+ })),
1126
+ sharedPropertyTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]).map(([apiName, spt]) => [apiName, {
1127
+ sharedPropertyType: convertSpt(spt)
1128
+ }])),
1129
+ interfaceTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.INTERFACE_TYPE]).map(([apiName, interfaceType]) => {
1130
+ return [apiName, {
1131
+ interfaceType: convertInterface(interfaceType)
972
1132
  }];
1133
+ })),
1134
+ linkTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.LINK_TYPE]).map(([id, link]) => {
1135
+ return [id, convertLink(link)];
1136
+ })),
1137
+ actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).map(([apiName, action]) => {
1138
+ return [apiName, convertAction(action)];
1139
+ })),
1140
+ blockPermissionInformation: {
1141
+ actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).filter(([apiName, action]) => action.validation).map(([apiName, action]) => {
1142
+ return [apiName, {
1143
+ restrictionStatus: {
1144
+ hasRolesApplied: true,
1145
+ ontologyPackageRid: null,
1146
+ publicProject: false
1147
+ }
1148
+ }];
1149
+ })),
1150
+ linkTypes: {},
1151
+ objectTypes: {}
973
1152
  }
974
- if (typeof prop.type === "object" && prop.type?.type === "struct") {
975
- const structMapping = {
976
- type: "struct",
977
- struct: {
978
- column: prop.apiName,
979
- mapping: Object.fromEntries(Object.keys(prop.type.structDefinition).map((fieldName) => [fieldName, {
980
- apiName: fieldName,
981
- mappings: {}
982
- }]))
983
- }
984
- };
985
- return [prop.apiName, structMapping];
986
- }
987
- return [prop.apiName, {
988
- type: "column",
989
- column: prop.apiName
990
- }];
991
- }));
1153
+ };
992
1154
  }
993
- function convertProperty(property) {
994
- const apiName = namespace + property.apiName;
995
- !(!shouldNotHaveRenderHints(property.type) || !hasRenderHints(property.typeClasses)) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Property type ${apiName} of type '${getPropertyTypeName(property.type)}' should not have render hints`) : invariant5__default.default(false) : void 0;
996
- const output = {
997
- apiName: property.apiName,
998
- sharedPropertyTypeApiName: property.sharedPropertyType?.apiName,
999
- displayMetadata: {
1000
- displayName: property.displayName,
1001
- description: property.description,
1002
- visibility: property.visibility ?? "NORMAL"
1155
+
1156
+ // src/conversion/toMarketplace/convertValueTypesToIr.ts
1157
+ function convertValueTypesToIr(valueTypes) {
1158
+ return Object.values(valueTypes).map((definitions) => ({
1159
+ metadata: {
1160
+ apiName: definitions[0].apiName,
1161
+ packageNamespace: definitions[0].packageNamespace,
1162
+ displayMetadata: definitions[0].displayMetadata,
1163
+ status: definitions[0].status
1003
1164
  },
1004
- indexedForSearch: property.indexedForSearch ?? true,
1005
- ruleSetBinding: void 0,
1006
- baseFormatter: property.baseFormatter,
1007
- type: property.array ? {
1008
- type: "array",
1009
- array: {
1010
- subtype: convertType(property.type)
1011
- }
1012
- } : convertType(property.type),
1013
- typeClasses: property.typeClasses ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),
1014
- status: convertObjectStatus(property.status),
1015
- inlineAction: void 0,
1016
- dataConstraints: property.valueType ? convertValueTypeDataConstraints(property.valueType.constraints) : convertNullabilityToDataConstraint(property),
1017
- sharedPropertyTypeRid: property.sharedPropertyType?.apiName,
1018
- valueType: property.valueType ? convertValueType(property.valueType) : void 0
1165
+ // TODO(dpaquin): instead of deduping here, we should refactor the value type types from arrays to maps
1166
+ versions: Array.from(new Map(definitions.map((definition) => [definition.version, definition])).values()).map((definition) => ({
1167
+ version: definition.version,
1168
+ baseType: definition.baseType,
1169
+ constraints: definition.constraints,
1170
+ exampleValues: definition.exampleValues
1171
+ }))
1172
+ }));
1173
+ }
1174
+
1175
+ // src/conversion/toMarketplace/convertOntologyToValueTypeIr.ts
1176
+ function convertOntologyToValueTypeIr(ontology) {
1177
+ return {
1178
+ valueTypes: convertValueTypesToIr(ontology[OntologyEntityTypeEnum.VALUE_TYPE])
1019
1179
  };
1020
- return output;
1021
1180
  }
1022
- function convertLink(linkType) {
1023
- let definition;
1024
- let datasource = void 0;
1025
- if ("one" in linkType) {
1026
- definition = {
1027
- type: "oneToMany",
1028
- oneToMany: {
1029
- cardinalityHint: convertCardinality(linkType.cardinality),
1030
- manyToOneLinkMetadata: linkType.toMany.metadata,
1031
- objectTypeRidManySide: linkType.toMany.object.apiName,
1032
- objectTypeRidOneSide: linkType.one.object.apiName,
1033
- oneToManyLinkMetadata: linkType.one.metadata,
1034
- oneSidePrimaryKeyToManySidePropertyMapping: [{
1035
- from: {
1036
- apiName: linkType.one.object.primaryKeyPropertyApiName,
1037
- object: linkType.one.object.apiName
1038
- },
1039
- to: {
1040
- apiName: linkType.manyForeignKeyProperty,
1041
- object: linkType.toMany.object.apiName
1042
- }
1043
- }]
1044
- }
1045
- };
1046
- } else {
1047
- definition = {
1048
- type: "manyToMany",
1049
- manyToMany: {
1050
- objectTypeAToBLinkMetadata: linkType.many.metadata,
1051
- objectTypeBToALinkMetadata: linkType.toMany.metadata,
1052
- objectTypeRidA: linkType.many.object.apiName,
1053
- objectTypeRidB: linkType.toMany.object.apiName,
1054
- peeringMetadata: void 0,
1055
- objectTypeAPrimaryKeyPropertyMapping: [{
1056
- from: {
1057
- apiName: linkType.many.object.primaryKeyPropertyApiName,
1058
- object: linkType.many.object.apiName
1059
- },
1060
- to: {
1061
- apiName: linkType.many.object.primaryKeyPropertyApiName,
1062
- object: linkType.many.object.apiName
1063
- }
1064
- }],
1065
- objectTypeBPrimaryKeyPropertyMapping: [{
1066
- from: {
1067
- apiName: linkType.toMany.object.primaryKeyPropertyApiName,
1068
- object: linkType.toMany.object.apiName
1069
- },
1070
- to: {
1071
- apiName: linkType.toMany.object.primaryKeyPropertyApiName,
1072
- object: linkType.toMany.object.apiName
1073
- }
1074
- }]
1075
- }
1076
- };
1077
- datasource = {
1078
- rid: "ri.ontology.main.datasource.link-".concat(linkType.apiName),
1079
- datasource: {
1080
- type: "dataset",
1081
- dataset: {
1082
- datasetRid: "link-".concat(linkType.apiName),
1083
- writebackDatasetRid: void 0,
1084
- objectTypeAPrimaryKeyMapping: [{
1085
- property: {
1086
- apiName: linkType.many.object.primaryKeyPropertyApiName,
1087
- object: linkType.many.object.apiName
1088
- },
1089
- column: linkType.many.object.primaryKeyPropertyApiName
1090
- }],
1091
- objectTypeBPrimaryKeyMapping: [{
1092
- property: {
1093
- apiName: linkType.toMany.object.primaryKeyPropertyApiName,
1094
- object: linkType.toMany.object.apiName
1095
- },
1096
- column: linkType.toMany.object.primaryKeyPropertyApiName
1097
- }]
1098
- }
1099
- },
1100
- editsConfiguration: {
1101
- onlyAllowPrivilegedEdits: false
1102
- },
1103
- redacted: linkType.redacted
1104
- };
1181
+
1182
+ // src/conversion/toMarketplace/convertOntologyDefinition.ts
1183
+ function convertOntologyDefinition(ontology) {
1184
+ return {
1185
+ ontology: convertOntologyDefinitionToWireBlockData(ontology),
1186
+ importedOntology: convertOntologyDefinitionToWireBlockData(importedTypes),
1187
+ valueTypes: convertOntologyToValueTypeIr(ontology),
1188
+ importedValueTypes: convertOntologyToValueTypeIr(importedTypes)
1189
+ };
1190
+ }
1191
+
1192
+ // src/conversion/toMarketplace/getFormContentOrdering.ts
1193
+ function getFormContentOrdering(action, parameterOrdering) {
1194
+ if (!action.sections) return [];
1195
+ const parametersToSection = Object.fromEntries(Object.entries(action.sections).flatMap(([sectionId, section]) => section.parameters.map((param) => [param, sectionId])));
1196
+ const seenIds = /* @__PURE__ */ new Set();
1197
+ const formContentOrdering = [];
1198
+ parameterOrdering.forEach((param) => {
1199
+ if (param in parametersToSection && !seenIds.has(parametersToSection[param])) {
1200
+ formContentOrdering.push({
1201
+ type: "sectionId",
1202
+ sectionId: parametersToSection[param]
1203
+ });
1204
+ seenIds.add(parametersToSection[param]);
1205
+ } else if (!(param in parametersToSection)) {
1206
+ formContentOrdering.push({
1207
+ type: "parameterId",
1208
+ parameterId: param
1209
+ });
1210
+ seenIds.add(param);
1211
+ }
1212
+ });
1213
+ return formContentOrdering;
1214
+ }
1215
+
1216
+ // src/api/defineOntology.ts
1217
+ var ontologyDefinition;
1218
+ var importedTypes;
1219
+ var dependencies;
1220
+ var namespace;
1221
+ function updateOntology(entity) {
1222
+ if (entity.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
1223
+ ontologyDefinition[entity.__type][entity.apiName] = entity;
1224
+ return;
1225
+ }
1226
+ if (ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] === void 0) {
1227
+ ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] = [];
1228
+ }
1229
+ ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName].push(entity);
1230
+ }
1231
+ async function defineOntology(ns, body, outputDir, dependencyFile) {
1232
+ namespace = ns;
1233
+ dependencies = {};
1234
+ ontologyDefinition = {
1235
+ OBJECT_TYPE: {},
1236
+ ACTION_TYPE: {},
1237
+ LINK_TYPE: {},
1238
+ INTERFACE_TYPE: {},
1239
+ SHARED_PROPERTY_TYPE: {},
1240
+ VALUE_TYPE: {}
1241
+ };
1242
+ importedTypes = {
1243
+ SHARED_PROPERTY_TYPE: {},
1244
+ OBJECT_TYPE: {},
1245
+ ACTION_TYPE: {},
1246
+ LINK_TYPE: {},
1247
+ INTERFACE_TYPE: {},
1248
+ VALUE_TYPE: {}
1249
+ };
1250
+ try {
1251
+ await body();
1252
+ } catch (e) {
1253
+ console.error("Unexpected error while processing the body of the ontology", e);
1254
+ throw e;
1255
+ }
1256
+ if (outputDir) {
1257
+ writeStaticObjects(outputDir);
1258
+ }
1259
+ if (dependencyFile) {
1260
+ writeDependencyFile(dependencyFile);
1261
+ }
1262
+ return convertOntologyDefinition(ontologyDefinition);
1263
+ }
1264
+ function writeStaticObjects(outputDir) {
1265
+ const codegenDir = path2__namespace.resolve(outputDir, "codegen");
1266
+ const typeDirs = {
1267
+ [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: "shared-property-types",
1268
+ [OntologyEntityTypeEnum.ACTION_TYPE]: "action-types",
1269
+ [OntologyEntityTypeEnum.OBJECT_TYPE]: "object-types",
1270
+ [OntologyEntityTypeEnum.LINK_TYPE]: "link-types",
1271
+ [OntologyEntityTypeEnum.INTERFACE_TYPE]: "interface-types",
1272
+ [OntologyEntityTypeEnum.VALUE_TYPE]: "value-types"
1273
+ };
1274
+ if (!fs__namespace.existsSync(codegenDir)) {
1275
+ fs__namespace.mkdirSync(codegenDir, {
1276
+ recursive: true
1277
+ });
1278
+ }
1279
+ Object.values(typeDirs).forEach((typeDirNameFromMap) => {
1280
+ const currentTypeDirPath = path2__namespace.join(codegenDir, typeDirNameFromMap);
1281
+ if (fs__namespace.existsSync(currentTypeDirPath)) {
1282
+ fs__namespace.rmSync(currentTypeDirPath, {
1283
+ recursive: true,
1284
+ force: true
1285
+ });
1286
+ }
1287
+ fs__namespace.mkdirSync(currentTypeDirPath, {
1288
+ recursive: true
1289
+ });
1290
+ });
1291
+ const topLevelExportStatements = [];
1292
+ Object.entries(ontologyDefinition).forEach(([ontologyTypeEnumKey, entities]) => {
1293
+ const typeDirName = typeDirs[ontologyTypeEnumKey];
1294
+ const typeDirPath = path2__namespace.join(codegenDir, typeDirName);
1295
+ const entityModuleNames = [];
1296
+ Object.entries(entities).forEach(([apiName, entity]) => {
1297
+ const entityFileNameBase = camel(withoutNamespace(apiName)) + (ontologyTypeEnumKey === OntologyEntityTypeEnum.VALUE_TYPE ? "ValueType" : "");
1298
+ const filePath = path2__namespace.join(typeDirPath, `${entityFileNameBase}.ts`);
1299
+ const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);
1300
+ const entityJSON = JSON.stringify(entity, null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
1301
+ const content = `
1302
+ import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';
1303
+ import type { ${entityTypeName} } from '@osdk/maker';
1304
+
1305
+ const ${entityFileNameBase}_base: ${entityTypeName} = ${ontologyTypeEnumKey === "VALUE_TYPE" ? entityJSON.slice(1, -2) : entityJSON} as unknown as ${entityTypeName};
1306
+
1307
+ export const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFileNameBase}_base);
1308
+ `;
1309
+ fs__namespace.writeFileSync(filePath, content, {
1310
+ flag: "w"
1311
+ });
1312
+ entityModuleNames.push(entityFileNameBase);
1313
+ });
1314
+ for (const entityModuleName of entityModuleNames) {
1315
+ topLevelExportStatements.push(`export { ${entityModuleName} } from "./codegen/${typeDirName}/${entityModuleName}.js";`);
1316
+ }
1317
+ });
1318
+ if (topLevelExportStatements.length > 0) {
1319
+ const mainIndexContent = dependencyInjectionString() + topLevelExportStatements.join("\n") + "\n";
1320
+ const mainIndexFilePath = path2__namespace.join(outputDir, "index.ts");
1321
+ fs__namespace.writeFileSync(mainIndexFilePath, mainIndexContent, {
1322
+ flag: "w"
1323
+ });
1105
1324
  }
1325
+ }
1326
+ function buildDatasource(apiName, definition, classificationMarkingGroupName, mandatoryMarkingGroupName) {
1327
+ const needsSecurity = classificationMarkingGroupName !== void 0 || mandatoryMarkingGroupName !== void 0;
1328
+ const securityConfig = needsSecurity ? {
1329
+ classificationConstraint: classificationMarkingGroupName ? {
1330
+ markingGroupName: classificationMarkingGroupName
1331
+ } : void 0,
1332
+ markingConstraint: mandatoryMarkingGroupName ? {
1333
+ markingGroupName: mandatoryMarkingGroupName
1334
+ } : void 0
1335
+ } : void 0;
1106
1336
  return {
1107
- linkType: {
1108
- definition,
1109
- id: cleanAndValidateLinkTypeId(linkType.apiName),
1110
- status: linkType.status ?? {
1111
- type: "active",
1112
- active: {}
1113
- },
1114
- redacted: linkType.redacted ?? false
1337
+ rid: "ri.ontology.main.datasource.".concat(apiName),
1338
+ datasource: definition,
1339
+ editsConfiguration: {
1340
+ onlyAllowPrivilegedEdits: false
1115
1341
  },
1116
- datasources: datasource !== void 0 ? [datasource] : [],
1117
- entityMetadata: {
1118
- arePatchesEnabled: linkType.editsEnabled ?? false
1342
+ redacted: false,
1343
+ ...securityConfig !== void 0 && {
1344
+ dataSecurity: securityConfig
1119
1345
  }
1120
1346
  };
1121
1347
  }
@@ -1128,80 +1354,8 @@ function cleanAndValidateLinkTypeId(apiName) {
1128
1354
  }
1129
1355
  return linkTypeId;
1130
1356
  }
1131
- function convertInterface(interfaceType) {
1132
- const {
1133
- __type,
1134
- ...other
1135
- } = interfaceType;
1136
- return {
1137
- ...other,
1138
- propertiesV2: Object.fromEntries(Object.values(interfaceType.propertiesV2).map((spt) => [spt.sharedPropertyType.apiName, {
1139
- required: spt.required,
1140
- sharedPropertyType: convertSpt(spt.sharedPropertyType)
1141
- }])),
1142
- displayMetadata: {
1143
- displayName: interfaceType.displayMetadata.displayName,
1144
- description: interfaceType.displayMetadata.description,
1145
- icon: interfaceType.displayMetadata.icon ?? {
1146
- type: "blueprint",
1147
- blueprint: {
1148
- color: "#4C90F0",
1149
- locator: "layout-hierarchy"
1150
- }
1151
- }
1152
- },
1153
- extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
1154
- // these are omitted from our internal types but we need to re-add them for the final json
1155
- properties: [],
1156
- // TODO(mwalther): Support propertiesV3
1157
- propertiesV3: {}
1158
- };
1159
- }
1160
1357
  function dumpOntologyFullMetadata() {
1161
- return convertToWireOntologyIr(ontologyDefinition);
1162
- }
1163
- function convertSpt({
1164
- type,
1165
- array,
1166
- description,
1167
- apiName,
1168
- displayName,
1169
- visibility,
1170
- gothamMapping,
1171
- typeClasses,
1172
- valueType,
1173
- nullability
1174
- }) {
1175
- const dataConstraint = convertNullabilityToDataConstraint({
1176
- type,
1177
- nullability
1178
- });
1179
- return {
1180
- apiName,
1181
- displayMetadata: {
1182
- displayName: displayName ?? apiName,
1183
- visibility: visibility ?? "NORMAL",
1184
- description
1185
- },
1186
- type: array ? {
1187
- type: "array",
1188
- array: {
1189
- subtype: convertType(type)
1190
- }
1191
- } : convertType(type),
1192
- aliases: [],
1193
- baseFormatter: void 0,
1194
- dataConstraints: dataConstraint,
1195
- gothamMapping,
1196
- indexedForSearch: true,
1197
- typeClasses: typeClasses ?? [],
1198
- valueType: valueType === void 0 ? void 0 : {
1199
- apiName: valueType.apiName,
1200
- version: valueType.version,
1201
- packageNamespace: valueType.packageNamespace,
1202
- displayMetadata: valueType.displayMetadata
1203
- }
1204
- };
1358
+ return convertOntologyDefinition(ontologyDefinition);
1205
1359
  }
1206
1360
  function convertObjectStatus(status) {
1207
1361
  if (status === void 0) {
@@ -1270,121 +1424,32 @@ function convertAction(action) {
1270
1424
  blueprint: action.icon ?? {
1271
1425
  locator: "edit",
1272
1426
  color: "#000000"
1273
- }
1274
- },
1275
- successMessage: action.submissionMetadata?.successMessage ? [{
1276
- type: "message",
1277
- message: action.submissionMetadata.successMessage
1278
- }] : [],
1279
- typeClasses: action.typeClasses ?? [],
1280
- ...action.submissionMetadata?.submitButtonDisplayMetadata && {
1281
- submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
1282
- },
1283
- ...action.submissionMetadata?.undoButtonConfiguration && {
1284
- undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
1285
- }
1286
- },
1287
- parameterOrdering,
1288
- formContentOrdering: getFormContentOrdering(action, parameterOrdering),
1289
- parameters: actionParameters,
1290
- sections: actionSections,
1291
- status: typeof action.status === "string" ? {
1292
- type: action.status,
1293
- [action.status]: {}
1294
- } : action.status,
1295
- entities: action.entities
1296
- }
1297
- }
1298
- };
1299
- }
1300
- function convertActionValidation(action) {
1301
- return {
1302
- actionTypeLevelValidation: {
1303
- rules: Object.fromEntries((action.validation ?? [{
1304
- condition: {
1305
- type: "true",
1306
- true: {}
1307
- },
1308
- displayMetadata: {
1309
- failureMessage: "",
1310
- typeClasses: []
1311
- }
1312
- }]).map((rule, idx) => [idx, rule]))
1313
- },
1314
- parameterValidations: Object.fromEntries((action.parameters ?? []).map((p) => {
1315
- return [p.id, {
1316
- defaultValidation: {
1317
- display: {
1318
- renderHint: renderHintFromBaseType(p),
1319
- visibility: convertActionVisibility(p.validation.defaultVisibility),
1320
- ...p.defaultValue && {
1321
- prefill: p.defaultValue
1322
- }
1323
- },
1324
- validation: {
1325
- allowedValues: extractAllowedValues(p.validation.allowedValues),
1326
- required: convertParameterRequirementConstraint(p.validation.required)
1327
- }
1328
- },
1329
- conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation)) ?? []
1330
- }];
1331
- })),
1332
- sectionValidations: {
1333
- ...Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [section.id, {
1334
- defaultDisplayMetadata: section.defaultVisibility === "hidden" ? {
1335
- visibility: {
1336
- type: "hidden",
1337
- hidden: {}
1338
- }
1339
- } : {
1340
- visibility: {
1341
- type: "visible",
1342
- visible: {}
1427
+ }
1428
+ },
1429
+ successMessage: action.submissionMetadata?.successMessage ? [{
1430
+ type: "message",
1431
+ message: action.submissionMetadata.successMessage
1432
+ }] : [],
1433
+ typeClasses: action.typeClasses ?? [],
1434
+ ...action.submissionMetadata?.submitButtonDisplayMetadata && {
1435
+ submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
1436
+ },
1437
+ ...action.submissionMetadata?.undoButtonConfiguration && {
1438
+ undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
1343
1439
  }
1344
1440
  },
1345
- conditionalOverrides: section.conditionalOverrides?.map((override) => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible")) ?? []
1346
- }]))
1347
- }
1348
- };
1349
- }
1350
- function convertActionParameters(action) {
1351
- return Object.fromEntries((action.parameters ?? []).map((p) => [p.id, {
1352
- id: p.id,
1353
- type: typeof p.type === "string" ? {
1354
- type: p.type,
1355
- [p.type]: {}
1356
- } : p.type,
1357
- displayMetadata: {
1358
- displayName: p.displayName,
1359
- description: p.description ?? "",
1360
- typeClasses: []
1361
- }
1362
- }]));
1363
- }
1364
- function convertActionSections(action) {
1365
- return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [sectionId, {
1366
- id: sectionId,
1367
- content: section.parameters.map((p) => ({
1368
- type: "parameterId",
1369
- parameterId: p
1370
- })),
1371
- displayMetadata: {
1372
- collapsedByDefault: section.collapsedByDefault ?? false,
1373
- columnCount: section.columnCount ?? 1,
1374
- description: section.description ?? "",
1375
- displayName: section.displayName ?? convertToDisplayName(sectionId),
1376
- showTitleBar: section.showTitleBar ?? true,
1377
- ...section.style && {
1378
- style: section.style === "box" ? {
1379
- type: "box",
1380
- box: {}
1381
- } : {
1382
- type: "minimal",
1383
- minimal: {}
1384
- }
1441
+ parameterOrdering,
1442
+ formContentOrdering: getFormContentOrdering(action, parameterOrdering),
1443
+ parameters: actionParameters,
1444
+ sections: actionSections,
1445
+ status: typeof action.status === "string" ? {
1446
+ type: action.status,
1447
+ [action.status]: {}
1448
+ } : action.status,
1449
+ entities: action.entities
1385
1450
  }
1386
1451
  }
1387
- }]));
1452
+ };
1388
1453
  }
1389
1454
  function extractAllowedValues(allowedValues) {
1390
1455
  switch (allowedValues.type) {
@@ -1583,31 +1648,6 @@ function renderHintFromBaseType(parameter) {
1583
1648
  throw new Error(`Unknown type ${type}`);
1584
1649
  }
1585
1650
  }
1586
- function convertParameterRequirementConstraint(required) {
1587
- if (typeof required === "boolean") {
1588
- return required ? {
1589
- type: "required",
1590
- required: {}
1591
- } : {
1592
- type: "notRequired",
1593
- notRequired: {}
1594
- };
1595
- }
1596
- const {
1597
- min,
1598
- max
1599
- } = required.listLength;
1600
- return {
1601
- type: "listLengthValidation",
1602
- listLengthValidation: {
1603
- minLength: min,
1604
- maxLength: max
1605
- }
1606
- };
1607
- }
1608
- function sanitize(namespace2, s) {
1609
- return s.includes(".") ? s : namespace2 + s;
1610
- }
1611
1651
  function withoutNamespace(apiName) {
1612
1652
  const lastDot = apiName.lastIndexOf(".");
1613
1653
  if (lastDot === -1) {
@@ -1646,17 +1686,11 @@ addDependency("${namespaceNoDot}", new URL(import.meta.url).pathname);
1646
1686
  function addNamespaceIfNone(apiName) {
1647
1687
  return apiName.includes(".") ? apiName : namespace + apiName;
1648
1688
  }
1649
- function convertCardinality(cardinality) {
1650
- if (cardinality === "OneToMany" || cardinality === void 0) {
1651
- return "ONE_TO_MANY";
1652
- }
1653
- return "ONE_TO_ONE";
1654
- }
1655
1689
 
1656
1690
  // src/cli/main.ts
1657
1691
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
1658
1692
  async function main(args = process.argv) {
1659
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.11").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1693
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.12").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1660
1694
  input: {
1661
1695
  alias: "i",
1662
1696
  describe: "Input file",
@@ -1739,9 +1773,41 @@ function addDependency(namespaceNoDot, fileInPackage) {
1739
1773
  const packageJson = JSON.parse(fs__namespace.readFileSync(packageJsonPath, "utf-8"));
1740
1774
  dependencies[namespaceNoDot] = packageJson.version ?? "";
1741
1775
  }
1776
+ function convertMappingValue(value) {
1777
+ switch (value.type) {
1778
+ case "uuid":
1779
+ return {
1780
+ type: "uniqueIdentifier",
1781
+ uniqueIdentifier: {
1782
+ linkId: value.linkId ?? crypto.randomUUID()
1783
+ }
1784
+ };
1785
+ case "currentTime":
1786
+ return {
1787
+ type: "currentTime",
1788
+ currentTime: {}
1789
+ };
1790
+ case "currentUser":
1791
+ return {
1792
+ type: "currentUser",
1793
+ currentUser: {}
1794
+ };
1795
+ default:
1796
+ return value;
1797
+ }
1798
+ }
1799
+
1800
+ // src/api/action/ActionParameterType.ts
1801
+ function isActionParameterTypePrimitive(type) {
1802
+ return ["boolean", "booleanList", "integer", "integerList", "long", "longList", "double", "doubleList", "string", "stringList", "decimal", "decimalList", "timestamp", "timestampList", "geohash", "geohashList", "geoshape", "geoshapeList", "timeSeriesReference", "date", "dateList", "objectTypeReference", "objectReference", "attachment", "attachmentList", "marking", "markingList", "mediaReference", "mediaReferenceList", "geotimeSeriesReference", "geotimeSeriesReferenceList"].includes(type);
1803
+ }
1804
+
1805
+ // src/api/defineAction.ts
1806
+ var MODIFY_OBJECT_PARAMETER = "objectToModifyParameter";
1807
+ var CREATE_OR_MODIFY_OBJECT_PARAMETER = "objectToCreateOrModifyParameter";
1742
1808
  function defineCreateInterfaceObjectAction(interfaceType, objectType, validation) {
1743
- const allProperties = Object.entries(getAllInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1744
- if (allProperties.length !== Object.entries(getAllInterfaceProperties(interfaceType)).length) {
1809
+ const allProperties = Object.entries(getFlattenedInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1810
+ if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(interfaceType)).length) {
1745
1811
  consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the create action because they are structs`);
1746
1812
  }
1747
1813
  return defineAction({
@@ -1867,8 +1933,8 @@ function defineCreateObjectAction(def) {
1867
1933
  });
1868
1934
  }
1869
1935
  function defineModifyInterfaceObjectAction(interfaceType, objectType, validation) {
1870
- const allProperties = Object.entries(getAllInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1871
- if (allProperties.length !== Object.entries(getAllInterfaceProperties(interfaceType)).length) {
1936
+ const allProperties = Object.entries(getFlattenedInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1937
+ if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(interfaceType)).length) {
1872
1938
  consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the modify action because they are structs`);
1873
1939
  }
1874
1940
  return defineAction({
@@ -2139,28 +2205,20 @@ function defineAction(actionDef) {
2139
2205
  !parameterIds.some((id) => id === rule.deleteObjectRule.objectToDelete) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Object to delete parameter must be defined in parameters`) : invariant5__default.default(false) : void 0;
2140
2206
  }
2141
2207
  if (rule.type === "modifyInterfaceRule") {
2142
- Object.keys(rule.modifyInterfaceRule.sharedPropertyValues).forEach((spt) => {
2143
- !(ontologyDefinition.SHARED_PROPERTY_TYPE[spt] !== void 0 || importedTypes.SHARED_PROPERTY_TYPE[spt] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist.
2144
- If this SPT was imported, you may need to use [spt.apiName] as the key so that it is qualified with the right namespace`) : invariant5__default.default(false) : void 0;
2145
- });
2146
2208
  const interfaceParam = actionDef.parameters.find((p) => p.id === rule.modifyInterfaceRule.interfaceObjectToModifyParameter);
2147
2209
  !(interfaceParam !== void 0 && typeof interfaceParam.type === "object" && (interfaceParam.type.type === "interfaceReference" || interfaceParam.type.type === "interfaceReferenceList")) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Interface object to modify parameter must be an interface reference`) : invariant5__default.default(false) : void 0;
2148
2210
  const interfaceReference = interfaceParam.type.type === "interfaceReference" ? interfaceParam.type.interfaceReference.interfaceTypeRid : interfaceParam.type.interfaceReferenceList.interfaceTypeRid;
2149
2211
  !(ontologyDefinition.INTERFACE_TYPE[interfaceReference] !== void 0 || importedTypes.INTERFACE_TYPE[interfaceReference] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Interface type ${interfaceReference} does not exist`) : invariant5__default.default(false) : void 0;
2150
2212
  const interfaceType = ontologyDefinition.INTERFACE_TYPE[interfaceReference];
2151
2213
  Object.keys(rule.modifyInterfaceRule.sharedPropertyValues).forEach((spt) => {
2152
- !(interfaceType.propertiesV2[spt] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist in interface type ${interfaceReference}`) : invariant5__default.default(false) : void 0;
2214
+ !Object.keys(getFlattenedInterfaceProperties(interfaceType)).includes(spt) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist in interface type ${interfaceReference}`) : invariant5__default.default(false) : void 0;
2153
2215
  });
2154
2216
  }
2155
2217
  if (rule.type === "addInterfaceRule") {
2156
- Object.keys(rule.addInterfaceRule.sharedPropertyValues).forEach((spt) => {
2157
- !(ontologyDefinition.SHARED_PROPERTY_TYPE[spt] !== void 0 || importedTypes.SHARED_PROPERTY_TYPE[spt] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist.
2158
- If this SPT was imported, you may need to use [spt.apiName] as the key so that it is qualified with the right namespace`) : invariant5__default.default(false) : void 0;
2159
- });
2160
2218
  const interfaceType = ontologyDefinition.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName] ?? importedTypes.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName];
2161
2219
  !(interfaceType !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Interface type ${rule.addInterfaceRule.interfaceApiName} does not exist`) : invariant5__default.default(false) : void 0;
2162
2220
  Object.keys(rule.addInterfaceRule.sharedPropertyValues).forEach((spt) => {
2163
- !(interfaceType.propertiesV2[spt] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist in interface type ${interfaceType.apiName}`) : invariant5__default.default(false) : void 0;
2221
+ !Object.keys(getFlattenedInterfaceProperties(interfaceType)).includes(spt) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${spt} does not exist in interface type ${interfaceType.apiName}`) : invariant5__default.default(false) : void 0;
2164
2222
  });
2165
2223
  }
2166
2224
  });
@@ -2236,7 +2294,7 @@ function createParameters(def, parameterSet) {
2236
2294
  });
2237
2295
  return [...targetParam, ...Array.from(parameterSet).map((id) => ({
2238
2296
  id,
2239
- displayName: def.parameterConfiguration?.[id]?.displayName ?? def.objectType.properties?.[id]?.displayName ?? convertToDisplayName(id),
2297
+ displayName: def.parameterConfiguration?.[id]?.displayName ?? def.objectType.properties?.[id]?.displayName ?? uppercaseFirstLetter(id),
2240
2298
  type: def.parameterConfiguration?.[id]?.customParameterType ?? extractActionParameterType(def.objectType.properties?.[id]),
2241
2299
  validation: def.parameterConfiguration?.[id] !== void 0 ? {
2242
2300
  ...def.parameterConfiguration?.[id],
@@ -2265,14 +2323,14 @@ function referencedParameterIds(actionDef) {
2265
2323
  actionDef.rules.forEach((rule) => {
2266
2324
  switch (rule.type) {
2267
2325
  case "addInterfaceRule":
2268
- rule.addInterfaceRule.interfaceApiName = sanitize2(rule.addInterfaceRule.interfaceApiName);
2326
+ rule.addInterfaceRule.interfaceApiName = sanitize(rule.addInterfaceRule.interfaceApiName);
2269
2327
  parameterIds.add(rule.addInterfaceRule.objectTypeParameter);
2270
2328
  Object.entries(rule.addInterfaceRule.sharedPropertyValues).forEach(([k, v]) => {
2271
2329
  if (v.type === "parameterId") {
2272
2330
  parameterIds.add(v.parameterId);
2273
2331
  }
2274
2332
  delete rule.addInterfaceRule.sharedPropertyValues[k];
2275
- rule.addInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
2333
+ rule.addInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
2276
2334
  });
2277
2335
  break;
2278
2336
  case "modifyInterfaceRule":
@@ -2282,7 +2340,7 @@ function referencedParameterIds(actionDef) {
2282
2340
  parameterIds.add(v.parameterId);
2283
2341
  }
2284
2342
  delete rule.modifyInterfaceRule.sharedPropertyValues[k];
2285
- rule.modifyInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
2343
+ rule.modifyInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
2286
2344
  });
2287
2345
  break;
2288
2346
  case "addObjectRule":
@@ -2511,16 +2569,10 @@ function extractActionParameterType(pt) {
2511
2569
  function maybeAddList(type, pt) {
2512
2570
  return pt.array ?? false ? type + "List" : type;
2513
2571
  }
2514
- function isActionParameterTypePrimitive(type) {
2515
- return ["boolean", "booleanList", "integer", "integerList", "long", "longList", "double", "doubleList", "string", "stringList", "decimal", "decimalList", "timestamp", "timestampList", "geohash", "geohashList", "geoshape", "geoshapeList", "timeSeriesReference", "date", "dateList", "objectTypeReference", "objectReference", "attachment", "attachmentList", "marking", "markingList", "mediaReference", "mediaReferenceList", "geotimeSeriesReference", "geotimeSeriesReferenceList"].includes(type);
2516
- }
2517
- function isStruct(type) {
2518
- return typeof type === "object" && type.type === "struct";
2519
- }
2520
2572
  function kebab(s) {
2521
2573
  return s.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/\./g, "-").toLowerCase();
2522
2574
  }
2523
- function sanitize2(s) {
2575
+ function sanitize(s) {
2524
2576
  return s.includes(".") ? s : namespace + s;
2525
2577
  }
2526
2578
  function convertValidationRule(actionValidation) {
@@ -2617,42 +2669,6 @@ function validateParameterOrdering(parameterOrdering, parameterSet, actionApiNam
2617
2669
  const extraneousParameters = parameterOrdering.filter((param) => !parameterSet.has(param));
2618
2670
  !(extraneousParameters.length === 0 && missingParameters.length === 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Action parameter ordering for ${actionApiName} does not match expected parameters. Extraneous parameters in ordering: {${extraneousParameters}}, Missing parameters in ordering: {${missingParameters}}`) : invariant5__default.default(false) : void 0;
2619
2671
  }
2620
-
2621
- // src/api/importOntologyEntity.ts
2622
- function importOntologyEntity(e) {
2623
- if (e.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
2624
- importedTypes[e.__type][e.apiName] = e;
2625
- return;
2626
- }
2627
- if (importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] === void 0) {
2628
- importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] = [];
2629
- }
2630
- importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName].push(e);
2631
- }
2632
-
2633
- // src/api/defineImportSpt.ts
2634
- function importSharedPropertyType(opts) {
2635
- const {
2636
- apiName,
2637
- packageName,
2638
- typeHint,
2639
- array
2640
- } = opts;
2641
- const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
2642
- if (packageName !== void 0) {
2643
- !!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name format invalid ends with period") : invariant5__default.default(false) : void 0;
2644
- !(packageName.match("[A-Z]") == null) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name includes upper case characters") : invariant5__default.default(false) : void 0;
2645
- }
2646
- const spt = {
2647
- apiName: fullApiName,
2648
- type: typeHint,
2649
- nonNameSpacedApiName: apiName,
2650
- array: array ?? false,
2651
- __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
2652
- };
2653
- importOntologyEntity(spt);
2654
- return spt;
2655
- }
2656
2672
  function defineSharedPropertyType(sptDef) {
2657
2673
  const apiName = namespace + sptDef.apiName;
2658
2674
  !(ontologyDefinition[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Shared property type ${apiName} already exists`) : invariant5__default.default(false) : void 0;
@@ -2670,19 +2686,51 @@ function defineSharedPropertyType(sptDef) {
2670
2686
  return fullSpt;
2671
2687
  }
2672
2688
 
2689
+ // src/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.ts
2690
+ function mapSimplifiedStatusToInterfaceTypeStatus(status) {
2691
+ switch (status.type) {
2692
+ case "deprecated":
2693
+ return {
2694
+ type: "deprecated",
2695
+ deprecated: {
2696
+ message: status.message,
2697
+ deadline: status.deadline,
2698
+ replacedBy: void 0
2699
+ }
2700
+ };
2701
+ case "active":
2702
+ return {
2703
+ type: "active",
2704
+ active: {}
2705
+ };
2706
+ case "experimental":
2707
+ return {
2708
+ type: "experimental",
2709
+ experimental: {}
2710
+ };
2711
+ default:
2712
+ throw new Error(`Invalid status type: ${status.type}`);
2713
+ }
2714
+ }
2715
+
2716
+ // src/api/namespace/combineApiNamespaceIfMissing.ts
2717
+ function combineApiNamespaceIfMissing(namespace2, apiName) {
2718
+ return apiName.includes(".") ? apiName : namespace2 + apiName;
2719
+ }
2720
+
2673
2721
  // src/api/defineInterface.ts
2674
2722
  function defineInterface(interfaceDef) {
2675
2723
  const apiName = namespace + interfaceDef.apiName;
2676
2724
  !(ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Interface ${apiName} already exists`) : invariant5__default.default(false) : void 0;
2677
2725
  const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([unNamespacedPropApiName, type]) => {
2678
2726
  if (typeof type === "object" && "propertyDefinition" in type) {
2679
- const apiName3 = sanitize(namespace, typeof type.propertyDefinition === "object" && "apiName" in type.propertyDefinition ? type.propertyDefinition.apiName : unNamespacedPropApiName);
2727
+ const apiName3 = combineApiNamespaceIfMissing(namespace, typeof type.propertyDefinition === "object" && "apiName" in type.propertyDefinition ? type.propertyDefinition.apiName : unNamespacedPropApiName);
2680
2728
  return [apiName3, {
2681
2729
  required: type.required,
2682
2730
  sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type.propertyDefinition)
2683
2731
  }];
2684
2732
  }
2685
- const apiName2 = sanitize(namespace, typeof type === "object" && "apiName" in type ? type.apiName : unNamespacedPropApiName);
2733
+ const apiName2 = combineApiNamespaceIfMissing(namespace, typeof type === "object" && "apiName" in type ? type.apiName : unNamespacedPropApiName);
2686
2734
  return [apiName2, {
2687
2735
  required: true,
2688
2736
  sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type)
@@ -2716,34 +2764,6 @@ function defineInterface(interfaceDef) {
2716
2764
  updateOntology(fullInterface);
2717
2765
  return fullInterface;
2718
2766
  }
2719
- function isPropertyTypeType(v) {
2720
- return v === "boolean" || v === "byte" || v === "date" || v === "decimal" || v === "double" || v === "float" || v === "geopoint" || v === "geoshape" || v === "integer" || v === "long" || typeof v === "object" && v.type === "marking" || v === "short" || v === "string" || v === "timestamp";
2721
- }
2722
- function mapSimplifiedStatusToInterfaceTypeStatus(status) {
2723
- switch (status.type) {
2724
- case "deprecated":
2725
- return {
2726
- type: "deprecated",
2727
- deprecated: {
2728
- message: status.message,
2729
- deadline: status.deadline,
2730
- replacedBy: void 0
2731
- }
2732
- };
2733
- case "active":
2734
- return {
2735
- type: "active",
2736
- active: {}
2737
- };
2738
- case "experimental":
2739
- return {
2740
- type: "experimental",
2741
- experimental: {}
2742
- };
2743
- default:
2744
- throw new Error(`Invalid status type: ${status.type}`);
2745
- }
2746
- }
2747
2767
  function unifyBasePropertyDefinition(namespace2, apiName, type) {
2748
2768
  if (typeof type === "string" || typeof type === "object" && !("apiName" in type)) {
2749
2769
  !isPropertyTypeType(type) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Invalid data type ${JSON.stringify(type)} for property ${apiName} on InterfaceType ${apiName}`) : invariant5__default.default(false) : void 0;
@@ -2785,7 +2805,7 @@ function getLinkMeta(meta) {
2785
2805
  displayName,
2786
2806
  description
2787
2807
  } = meta;
2788
- const apiNameWithNamespace = sanitize(namespace, apiName);
2808
+ const apiNameWithNamespace = combineApiNamespaceIfMissing(namespace, apiName);
2789
2809
  const apiNameWithoutNamespace = withoutNamespace(apiNameWithNamespace);
2790
2810
  return {
2791
2811
  apiName: apiNameWithNamespace,
@@ -2835,7 +2855,7 @@ function convertLinkTypeMetadata(metadata) {
2835
2855
  return {
2836
2856
  apiName: metadata.apiName,
2837
2857
  displayMetadata: {
2838
- displayName: metadata.displayName ?? convertToDisplayName(metadata.apiName),
2858
+ displayName: metadata.displayName ?? uppercaseFirstLetter(metadata.apiName),
2839
2859
  pluralDisplayName: metadata.pluralDisplayName ?? convertToPluralDisplayName(metadata.apiName),
2840
2860
  visibility: metadata.visibility ?? "NORMAL",
2841
2861
  groupDisplayName: metadata.groupDisplayName ?? ""
@@ -2931,6 +2951,40 @@ function defineValueType(valueTypeDef) {
2931
2951
  return vt;
2932
2952
  }
2933
2953
 
2954
+ // src/api/importOntologyEntity.ts
2955
+ function importOntologyEntity(e) {
2956
+ if (e.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
2957
+ importedTypes[e.__type][e.apiName] = e;
2958
+ return;
2959
+ }
2960
+ if (importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] === void 0) {
2961
+ importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] = [];
2962
+ }
2963
+ importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName].push(e);
2964
+ }
2965
+ function importSharedPropertyType(opts) {
2966
+ const {
2967
+ apiName,
2968
+ packageName,
2969
+ typeHint,
2970
+ array
2971
+ } = opts;
2972
+ const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
2973
+ if (packageName !== void 0) {
2974
+ !!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name format invalid ends with period") : invariant5__default.default(false) : void 0;
2975
+ !(packageName.match("[A-Z]") == null) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name includes upper case characters") : invariant5__default.default(false) : void 0;
2976
+ }
2977
+ const spt = {
2978
+ apiName: fullApiName,
2979
+ type: typeHint,
2980
+ nonNameSpacedApiName: apiName,
2981
+ array: array ?? false,
2982
+ __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
2983
+ };
2984
+ importOntologyEntity(spt);
2985
+ return spt;
2986
+ }
2987
+
2934
2988
  // src/api/wrapWithProxy.ts
2935
2989
  function wrapWithProxy(entity) {
2936
2990
  return new Proxy(entity, {
@@ -2946,9 +3000,9 @@ exports.MODIFY_OBJECT_PARAMETER = MODIFY_OBJECT_PARAMETER;
2946
3000
  exports.OntologyEntityTypeEnum = OntologyEntityTypeEnum;
2947
3001
  exports.addDependency = addDependency;
2948
3002
  exports.addNamespaceIfNone = addNamespaceIfNone;
2949
- exports.convertToDisplayName = convertToDisplayName;
3003
+ exports.convertToDisplayName = uppercaseFirstLetter;
2950
3004
  exports.convertToPluralDisplayName = convertToPluralDisplayName;
2951
- exports.convertType = convertType;
3005
+ exports.convertType = propertyTypeTypeToOntologyIrType;
2952
3006
  exports.default = main;
2953
3007
  exports.defineAction = defineAction;
2954
3008
  exports.defineCreateInterfaceObjectAction = defineCreateInterfaceObjectAction;