@osdk/maker 0.13.0-beta.10 → 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 +24 -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 +38 -15
  43. package/build/browser/api/defineAction.js.map +1 -1
  44. package/build/browser/api/defineInterface.js +14 -34
  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 -550
  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 +172 -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 +1054 -966
  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 +38 -15
  210. package/build/esm/api/defineAction.js.map +1 -1
  211. package/build/esm/api/defineInterface.js +14 -34
  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 -550
  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 +172 -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 +5 -5
  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) {
905
+ return {
906
+ apiName: valueType.apiName,
907
+ version: valueType.version,
908
+ packageNamespace: valueType.packageNamespace,
909
+ displayMetadata: valueType.displayMetadata
910
+ };
911
+ }
912
+
913
+ // src/conversion/toMarketplace/convertDataConstraintToDataConstraints.ts
914
+ function convertDataConstraintToDataConstraints(dc) {
756
915
  return {
757
- valueTypes: convertValueTypesToIr(ontology[OntologyEntityTypeEnum.VALUE_TYPE])
916
+ propertyTypeConstraints: [{
917
+ constraints: dataConstraintToPropertyTypeDataConstraint(dc)
918
+ // known limitation: structs don't carry field-level data constraint failure messages
919
+ }]
758
920
  };
759
921
  }
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
- }));
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
+ }
776
988
  }
777
- function convertToWireOntologyIr(ontology) {
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
+ }));
778
999
  return {
779
- ontology: convertToWireBlockData(ontology),
780
- importedOntology: convertToWireBlockData(importedTypes),
781
- valueTypes: convertOntologyToValueTypeIr(ontology),
782
- importedValueTypes: convertOntologyToValueTypeIr(importedTypes)
1000
+ propertyTypeConstraints
783
1001
  };
784
1002
  }
785
- function convertToWireBlockData(ontology) {
786
- 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
- }
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),
@@ -856,104 +1073,11 @@ function convertObject(objectType) {
856
1073
  })),
857
1074
  allImplementsInterfaces: {}
858
1075
  },
859
- datasources: [...propertyDatasources, objectDatasource],
860
- entityMetadata: {
861
- arePatchesEnabled: objectType.editsEnabled ?? false
862
- }
863
- };
864
- }
865
- function extractPropertyDatasource(property, objectTypeApiName) {
866
- if (!isExotic(property.type)) {
867
- return [];
868
- }
869
- const identifier = objectTypeApiName + "." + property.apiName;
870
- switch (property.type) {
871
- case "geotimeSeries":
872
- const geotimeDefinition = {
873
- type: "geotimeSeries",
874
- geotimeSeries: {
875
- geotimeSeriesIntegrationRid: identifier,
876
- properties: [property.apiName]
877
- }
878
- };
879
- return [buildDatasource(property.apiName, geotimeDefinition)];
880
- 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)
945
- }
946
- };
947
- case "dataset":
948
- default:
949
- return {
950
- type: "datasetV2",
951
- datasetV2: {
952
- datasetRid: objectType.apiName,
953
- propertyMapping: buildPropertyMapping(properties)
954
- }
955
- };
956
- }
1076
+ datasources: [...propertyDatasources, objectDatasource],
1077
+ entityMetadata: {
1078
+ arePatchesEnabled: objectType.editsEnabled ?? false
1079
+ }
1080
+ };
957
1081
  }
958
1082
  function extractMarkingGroups(properties, markingType) {
959
1083
  return properties.map((prop) => {
@@ -963,159 +1087,261 @@ function extractMarkingGroups(properties, markingType) {
963
1087
  return void 0;
964
1088
  }).filter((val) => val !== void 0);
965
1089
  }
966
- function buildPropertyMapping(properties) {
967
- return Object.fromEntries(properties.map((prop) => {
968
- if (prop.editOnly) {
969
- return [prop.apiName, {
970
- type: "editOnly",
971
- editOnly: {}
972
- }];
973
- }
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
- }]))
1090
+ function extractPropertyDatasource(property, objectTypeApiName) {
1091
+ if (!isExotic(property.type)) {
1092
+ return [];
1093
+ }
1094
+ const identifier = objectTypeApiName + "." + property.apiName;
1095
+ switch (property.type) {
1096
+ case "geotimeSeries":
1097
+ const geotimeDefinition = {
1098
+ type: "geotimeSeries",
1099
+ geotimeSeries: {
1100
+ geotimeSeriesIntegrationRid: identifier,
1101
+ properties: [property.apiName]
983
1102
  }
984
1103
  };
985
- return [prop.apiName, structMapping];
1104
+ return [buildDatasource(property.apiName, geotimeDefinition)];
1105
+ case "mediaReference":
1106
+ const mediaSetDefinition = {
1107
+ type: "mediaSetView",
1108
+ mediaSetView: {
1109
+ assumedMarkings: [],
1110
+ mediaSetViewLocator: identifier,
1111
+ properties: [property.apiName]
1112
+ }
1113
+ };
1114
+ return [buildDatasource(property.apiName, mediaSetDefinition)];
1115
+ default:
1116
+ return [];
1117
+ }
1118
+ }
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)
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: {}
986
1152
  }
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] = [];
1105
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
+ });
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,73 +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
- },
1146
- extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
1147
- // these are omitted from our internal types but we need to re-add them for the final json
1148
- properties: [],
1149
- // TODO(mwalther): Support propertiesV3
1150
- propertiesV3: {}
1151
- };
1152
- }
1153
1357
  function dumpOntologyFullMetadata() {
1154
- return convertToWireOntologyIr(ontologyDefinition);
1155
- }
1156
- function convertSpt({
1157
- type,
1158
- array,
1159
- description,
1160
- apiName,
1161
- displayName,
1162
- visibility,
1163
- gothamMapping,
1164
- typeClasses,
1165
- valueType,
1166
- nullability
1167
- }) {
1168
- const dataConstraint = convertNullabilityToDataConstraint({
1169
- type,
1170
- nullability
1171
- });
1172
- return {
1173
- apiName,
1174
- displayMetadata: {
1175
- displayName: displayName ?? apiName,
1176
- visibility: visibility ?? "NORMAL",
1177
- description
1178
- },
1179
- type: array ? {
1180
- type: "array",
1181
- array: {
1182
- subtype: convertType(type)
1183
- }
1184
- } : convertType(type),
1185
- aliases: [],
1186
- baseFormatter: void 0,
1187
- dataConstraints: dataConstraint,
1188
- gothamMapping,
1189
- indexedForSearch: true,
1190
- typeClasses: typeClasses ?? [],
1191
- valueType: valueType === void 0 ? void 0 : {
1192
- apiName: valueType.apiName,
1193
- version: valueType.version,
1194
- packageNamespace: valueType.packageNamespace,
1195
- displayMetadata: valueType.displayMetadata
1196
- }
1197
- };
1358
+ return convertOntologyDefinition(ontologyDefinition);
1198
1359
  }
1199
1360
  function convertObjectStatus(status) {
1200
1361
  if (status === void 0) {
@@ -1263,121 +1424,32 @@ function convertAction(action) {
1263
1424
  blueprint: action.icon ?? {
1264
1425
  locator: "edit",
1265
1426
  color: "#000000"
1266
- }
1267
- },
1268
- successMessage: action.submissionMetadata?.successMessage ? [{
1269
- type: "message",
1270
- message: action.submissionMetadata.successMessage
1271
- }] : [],
1272
- typeClasses: action.typeClasses ?? [],
1273
- ...action.submissionMetadata?.submitButtonDisplayMetadata && {
1274
- submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
1275
- },
1276
- ...action.submissionMetadata?.undoButtonConfiguration && {
1277
- undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
1278
- }
1279
- },
1280
- parameterOrdering,
1281
- formContentOrdering: getFormContentOrdering(action, parameterOrdering),
1282
- parameters: actionParameters,
1283
- sections: actionSections,
1284
- status: typeof action.status === "string" ? {
1285
- type: action.status,
1286
- [action.status]: {}
1287
- } : action.status,
1288
- entities: action.entities
1289
- }
1290
- }
1291
- };
1292
- }
1293
- function convertActionValidation(action) {
1294
- return {
1295
- actionTypeLevelValidation: {
1296
- rules: Object.fromEntries((action.validation ?? [{
1297
- condition: {
1298
- type: "true",
1299
- true: {}
1300
- },
1301
- displayMetadata: {
1302
- failureMessage: "",
1303
- typeClasses: []
1304
- }
1305
- }]).map((rule, idx) => [idx, rule]))
1306
- },
1307
- parameterValidations: Object.fromEntries((action.parameters ?? []).map((p) => {
1308
- return [p.id, {
1309
- defaultValidation: {
1310
- display: {
1311
- renderHint: renderHintFromBaseType(p),
1312
- visibility: convertActionVisibility(p.validation.defaultVisibility),
1313
- ...p.defaultValue && {
1314
- prefill: p.defaultValue
1315
- }
1316
- },
1317
- validation: {
1318
- allowedValues: extractAllowedValues(p.validation.allowedValues),
1319
- required: convertParameterRequirementConstraint(p.validation.required)
1320
- }
1321
- },
1322
- conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation)) ?? []
1323
- }];
1324
- })),
1325
- sectionValidations: {
1326
- ...Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [section.id, {
1327
- defaultDisplayMetadata: section.defaultVisibility === "hidden" ? {
1328
- visibility: {
1329
- type: "hidden",
1330
- hidden: {}
1331
- }
1332
- } : {
1333
- visibility: {
1334
- type: "visible",
1335
- 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
1336
1439
  }
1337
1440
  },
1338
- conditionalOverrides: section.conditionalOverrides?.map((override) => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible")) ?? []
1339
- }]))
1340
- }
1341
- };
1342
- }
1343
- function convertActionParameters(action) {
1344
- return Object.fromEntries((action.parameters ?? []).map((p) => [p.id, {
1345
- id: p.id,
1346
- type: typeof p.type === "string" ? {
1347
- type: p.type,
1348
- [p.type]: {}
1349
- } : p.type,
1350
- displayMetadata: {
1351
- displayName: p.displayName,
1352
- description: p.description ?? "",
1353
- typeClasses: []
1354
- }
1355
- }]));
1356
- }
1357
- function convertActionSections(action) {
1358
- return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [sectionId, {
1359
- id: sectionId,
1360
- content: section.parameters.map((p) => ({
1361
- type: "parameterId",
1362
- parameterId: p
1363
- })),
1364
- displayMetadata: {
1365
- collapsedByDefault: section.collapsedByDefault ?? false,
1366
- columnCount: section.columnCount ?? 1,
1367
- description: section.description ?? "",
1368
- displayName: section.displayName ?? convertToDisplayName(sectionId),
1369
- showTitleBar: section.showTitleBar ?? true,
1370
- ...section.style && {
1371
- style: section.style === "box" ? {
1372
- type: "box",
1373
- box: {}
1374
- } : {
1375
- type: "minimal",
1376
- minimal: {}
1377
- }
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
1378
1450
  }
1379
1451
  }
1380
- }]));
1452
+ };
1381
1453
  }
1382
1454
  function extractAllowedValues(allowedValues) {
1383
1455
  switch (allowedValues.type) {
@@ -1576,31 +1648,6 @@ function renderHintFromBaseType(parameter) {
1576
1648
  throw new Error(`Unknown type ${type}`);
1577
1649
  }
1578
1650
  }
1579
- function convertParameterRequirementConstraint(required) {
1580
- if (typeof required === "boolean") {
1581
- return required ? {
1582
- type: "required",
1583
- required: {}
1584
- } : {
1585
- type: "notRequired",
1586
- notRequired: {}
1587
- };
1588
- }
1589
- const {
1590
- min,
1591
- max
1592
- } = required.listLength;
1593
- return {
1594
- type: "listLengthValidation",
1595
- listLengthValidation: {
1596
- minLength: min,
1597
- maxLength: max
1598
- }
1599
- };
1600
- }
1601
- function sanitize(namespace2, s) {
1602
- return s.includes(".") ? s : namespace2 + s;
1603
- }
1604
1651
  function withoutNamespace(apiName) {
1605
1652
  const lastDot = apiName.lastIndexOf(".");
1606
1653
  if (lastDot === -1) {
@@ -1639,17 +1686,11 @@ addDependency("${namespaceNoDot}", new URL(import.meta.url).pathname);
1639
1686
  function addNamespaceIfNone(apiName) {
1640
1687
  return apiName.includes(".") ? apiName : namespace + apiName;
1641
1688
  }
1642
- function convertCardinality(cardinality) {
1643
- if (cardinality === "OneToMany" || cardinality === void 0) {
1644
- return "ONE_TO_MANY";
1645
- }
1646
- return "ONE_TO_ONE";
1647
- }
1648
1689
 
1649
1690
  // src/cli/main.ts
1650
1691
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
1651
1692
  async function main(args = process.argv) {
1652
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.10").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({
1653
1694
  input: {
1654
1695
  alias: "i",
1655
1696
  describe: "Input file",
@@ -1732,9 +1773,41 @@ function addDependency(namespaceNoDot, fileInPackage) {
1732
1773
  const packageJson = JSON.parse(fs__namespace.readFileSync(packageJsonPath, "utf-8"));
1733
1774
  dependencies[namespaceNoDot] = packageJson.version ?? "";
1734
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";
1735
1808
  function defineCreateInterfaceObjectAction(interfaceType, objectType, validation) {
1736
- const allProperties = Object.entries(getAllInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1737
- 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) {
1738
1811
  consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the create action because they are structs`);
1739
1812
  }
1740
1813
  return defineAction({
@@ -1860,8 +1933,8 @@ function defineCreateObjectAction(def) {
1860
1933
  });
1861
1934
  }
1862
1935
  function defineModifyInterfaceObjectAction(interfaceType, objectType, validation) {
1863
- const allProperties = Object.entries(getAllInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1864
- 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) {
1865
1938
  consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the modify action because they are structs`);
1866
1939
  }
1867
1940
  return defineAction({
@@ -2131,6 +2204,23 @@ function defineAction(actionDef) {
2131
2204
  if (rule.type === "deleteObjectRule") {
2132
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;
2133
2206
  }
2207
+ if (rule.type === "modifyInterfaceRule") {
2208
+ const interfaceParam = actionDef.parameters.find((p) => p.id === rule.modifyInterfaceRule.interfaceObjectToModifyParameter);
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;
2210
+ const interfaceReference = interfaceParam.type.type === "interfaceReference" ? interfaceParam.type.interfaceReference.interfaceTypeRid : interfaceParam.type.interfaceReferenceList.interfaceTypeRid;
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;
2212
+ const interfaceType = ontologyDefinition.INTERFACE_TYPE[interfaceReference];
2213
+ Object.keys(rule.modifyInterfaceRule.sharedPropertyValues).forEach((spt) => {
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;
2215
+ });
2216
+ }
2217
+ if (rule.type === "addInterfaceRule") {
2218
+ const interfaceType = ontologyDefinition.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName] ?? importedTypes.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName];
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;
2220
+ Object.keys(rule.addInterfaceRule.sharedPropertyValues).forEach((spt) => {
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;
2222
+ });
2223
+ }
2134
2224
  });
2135
2225
  const fullAction = {
2136
2226
  ...actionDef,
@@ -2204,7 +2294,7 @@ function createParameters(def, parameterSet) {
2204
2294
  });
2205
2295
  return [...targetParam, ...Array.from(parameterSet).map((id) => ({
2206
2296
  id,
2207
- 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),
2208
2298
  type: def.parameterConfiguration?.[id]?.customParameterType ?? extractActionParameterType(def.objectType.properties?.[id]),
2209
2299
  validation: def.parameterConfiguration?.[id] !== void 0 ? {
2210
2300
  ...def.parameterConfiguration?.[id],
@@ -2233,14 +2323,14 @@ function referencedParameterIds(actionDef) {
2233
2323
  actionDef.rules.forEach((rule) => {
2234
2324
  switch (rule.type) {
2235
2325
  case "addInterfaceRule":
2236
- rule.addInterfaceRule.interfaceApiName = sanitize2(rule.addInterfaceRule.interfaceApiName);
2326
+ rule.addInterfaceRule.interfaceApiName = sanitize(rule.addInterfaceRule.interfaceApiName);
2237
2327
  parameterIds.add(rule.addInterfaceRule.objectTypeParameter);
2238
2328
  Object.entries(rule.addInterfaceRule.sharedPropertyValues).forEach(([k, v]) => {
2239
2329
  if (v.type === "parameterId") {
2240
2330
  parameterIds.add(v.parameterId);
2241
2331
  }
2242
2332
  delete rule.addInterfaceRule.sharedPropertyValues[k];
2243
- rule.addInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
2333
+ rule.addInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
2244
2334
  });
2245
2335
  break;
2246
2336
  case "modifyInterfaceRule":
@@ -2250,7 +2340,7 @@ function referencedParameterIds(actionDef) {
2250
2340
  parameterIds.add(v.parameterId);
2251
2341
  }
2252
2342
  delete rule.modifyInterfaceRule.sharedPropertyValues[k];
2253
- rule.modifyInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
2343
+ rule.modifyInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
2254
2344
  });
2255
2345
  break;
2256
2346
  case "addObjectRule":
@@ -2479,16 +2569,10 @@ function extractActionParameterType(pt) {
2479
2569
  function maybeAddList(type, pt) {
2480
2570
  return pt.array ?? false ? type + "List" : type;
2481
2571
  }
2482
- function isActionParameterTypePrimitive(type) {
2483
- 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);
2484
- }
2485
- function isStruct(type) {
2486
- return typeof type === "object" && type.type === "struct";
2487
- }
2488
2572
  function kebab(s) {
2489
2573
  return s.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/\./g, "-").toLowerCase();
2490
2574
  }
2491
- function sanitize2(s) {
2575
+ function sanitize(s) {
2492
2576
  return s.includes(".") ? s : namespace + s;
2493
2577
  }
2494
2578
  function convertValidationRule(actionValidation) {
@@ -2585,42 +2669,6 @@ function validateParameterOrdering(parameterOrdering, parameterSet, actionApiNam
2585
2669
  const extraneousParameters = parameterOrdering.filter((param) => !parameterSet.has(param));
2586
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;
2587
2671
  }
2588
-
2589
- // src/api/importOntologyEntity.ts
2590
- function importOntologyEntity(e) {
2591
- if (e.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
2592
- importedTypes[e.__type][e.apiName] = e;
2593
- return;
2594
- }
2595
- if (importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] === void 0) {
2596
- importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] = [];
2597
- }
2598
- importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName].push(e);
2599
- }
2600
-
2601
- // src/api/defineImportSpt.ts
2602
- function importSharedPropertyType(opts) {
2603
- const {
2604
- apiName,
2605
- packageName,
2606
- typeHint,
2607
- array
2608
- } = opts;
2609
- const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
2610
- if (packageName !== void 0) {
2611
- !!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name format invalid ends with period") : invariant5__default.default(false) : void 0;
2612
- !(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;
2613
- }
2614
- const spt = {
2615
- apiName: fullApiName,
2616
- type: typeHint,
2617
- nonNameSpacedApiName: apiName,
2618
- array: array ?? false,
2619
- __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
2620
- };
2621
- importOntologyEntity(spt);
2622
- return spt;
2623
- }
2624
2672
  function defineSharedPropertyType(sptDef) {
2625
2673
  const apiName = namespace + sptDef.apiName;
2626
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;
@@ -2638,20 +2686,54 @@ function defineSharedPropertyType(sptDef) {
2638
2686
  return fullSpt;
2639
2687
  }
2640
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
+
2641
2721
  // src/api/defineInterface.ts
2642
2722
  function defineInterface(interfaceDef) {
2643
2723
  const apiName = namespace + interfaceDef.apiName;
2644
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;
2645
- const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([propApiName, type]) => {
2725
+ const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([unNamespacedPropApiName, type]) => {
2646
2726
  if (typeof type === "object" && "propertyDefinition" in type) {
2647
- return [namespace + propApiName, {
2727
+ const apiName3 = combineApiNamespaceIfMissing(namespace, typeof type.propertyDefinition === "object" && "apiName" in type.propertyDefinition ? type.propertyDefinition.apiName : unNamespacedPropApiName);
2728
+ return [apiName3, {
2648
2729
  required: type.required,
2649
- sharedPropertyType: unifyBasePropertyDefinition(namespace, propApiName, type.propertyDefinition)
2730
+ sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type.propertyDefinition)
2650
2731
  }];
2651
2732
  }
2652
- return [namespace + propApiName, {
2733
+ const apiName2 = combineApiNamespaceIfMissing(namespace, typeof type === "object" && "apiName" in type ? type.apiName : unNamespacedPropApiName);
2734
+ return [apiName2, {
2653
2735
  required: true,
2654
- sharedPropertyType: unifyBasePropertyDefinition(namespace, propApiName, type)
2736
+ sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type)
2655
2737
  }];
2656
2738
  }));
2657
2739
  const extendsInterfaces = interfaceDef.extends ? Array.isArray(interfaceDef.extends) ? interfaceDef.extends : [interfaceDef.extends] : [];
@@ -2682,34 +2764,6 @@ function defineInterface(interfaceDef) {
2682
2764
  updateOntology(fullInterface);
2683
2765
  return fullInterface;
2684
2766
  }
2685
- function isPropertyTypeType(v) {
2686
- 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";
2687
- }
2688
- function mapSimplifiedStatusToInterfaceTypeStatus(status) {
2689
- switch (status.type) {
2690
- case "deprecated":
2691
- return {
2692
- type: "deprecated",
2693
- deprecated: {
2694
- message: status.message,
2695
- deadline: status.deadline,
2696
- replacedBy: void 0
2697
- }
2698
- };
2699
- case "active":
2700
- return {
2701
- type: "active",
2702
- active: {}
2703
- };
2704
- case "experimental":
2705
- return {
2706
- type: "experimental",
2707
- experimental: {}
2708
- };
2709
- default:
2710
- throw new Error(`Invalid status type: ${status.type}`);
2711
- }
2712
- }
2713
2767
  function unifyBasePropertyDefinition(namespace2, apiName, type) {
2714
2768
  if (typeof type === "string" || typeof type === "object" && !("apiName" in type)) {
2715
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;
@@ -2751,7 +2805,7 @@ function getLinkMeta(meta) {
2751
2805
  displayName,
2752
2806
  description
2753
2807
  } = meta;
2754
- const apiNameWithNamespace = sanitize(namespace, apiName);
2808
+ const apiNameWithNamespace = combineApiNamespaceIfMissing(namespace, apiName);
2755
2809
  const apiNameWithoutNamespace = withoutNamespace(apiNameWithNamespace);
2756
2810
  return {
2757
2811
  apiName: apiNameWithNamespace,
@@ -2801,7 +2855,7 @@ function convertLinkTypeMetadata(metadata) {
2801
2855
  return {
2802
2856
  apiName: metadata.apiName,
2803
2857
  displayMetadata: {
2804
- displayName: metadata.displayName ?? convertToDisplayName(metadata.apiName),
2858
+ displayName: metadata.displayName ?? uppercaseFirstLetter(metadata.apiName),
2805
2859
  pluralDisplayName: metadata.pluralDisplayName ?? convertToPluralDisplayName(metadata.apiName),
2806
2860
  visibility: metadata.visibility ?? "NORMAL",
2807
2861
  groupDisplayName: metadata.groupDisplayName ?? ""
@@ -2897,6 +2951,40 @@ function defineValueType(valueTypeDef) {
2897
2951
  return vt;
2898
2952
  }
2899
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
+
2900
2988
  // src/api/wrapWithProxy.ts
2901
2989
  function wrapWithProxy(entity) {
2902
2990
  return new Proxy(entity, {
@@ -2912,9 +3000,9 @@ exports.MODIFY_OBJECT_PARAMETER = MODIFY_OBJECT_PARAMETER;
2912
3000
  exports.OntologyEntityTypeEnum = OntologyEntityTypeEnum;
2913
3001
  exports.addDependency = addDependency;
2914
3002
  exports.addNamespaceIfNone = addNamespaceIfNone;
2915
- exports.convertToDisplayName = convertToDisplayName;
3003
+ exports.convertToDisplayName = uppercaseFirstLetter;
2916
3004
  exports.convertToPluralDisplayName = convertToPluralDisplayName;
2917
- exports.convertType = convertType;
3005
+ exports.convertType = propertyTypeTypeToOntologyIrType;
2918
3006
  exports.default = main;
2919
3007
  exports.defineAction = defineAction;
2920
3008
  exports.defineCreateInterfaceObjectAction = defineCreateInterfaceObjectAction;