@osdk/maker 0.13.0-beta.8 → 0.13.0

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 (514) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/README.md +55 -13
  3. package/build/browser/api/action/ActionLevelValidationDefinition.js +2 -0
  4. package/build/browser/api/action/ActionLevelValidationDefinition.js.map +1 -0
  5. package/build/browser/api/action/ActionParameter.js +2 -0
  6. package/build/browser/api/action/ActionParameter.js.map +1 -0
  7. package/build/browser/api/action/ActionParameterAllowedValues.js +2 -0
  8. package/build/browser/api/action/ActionParameterAllowedValues.js.map +1 -0
  9. package/build/browser/api/action/ActionParameterConditionalOverride.js +2 -0
  10. package/build/browser/api/action/ActionParameterConditionalOverride.js.map +1 -0
  11. package/build/browser/api/action/ActionParameterConfiguration.js +2 -0
  12. package/build/browser/api/action/ActionParameterConfiguration.js.map +1 -0
  13. package/build/browser/api/action/ActionParameterType.js +22 -0
  14. package/build/browser/api/action/ActionParameterType.js.map +1 -0
  15. package/build/browser/api/action/ActionSection.js +2 -0
  16. package/build/browser/api/action/ActionSection.js.map +1 -0
  17. package/build/browser/api/action/ActionStatus.js +2 -0
  18. package/build/browser/api/action/ActionStatus.js.map +1 -0
  19. package/build/browser/api/action/ActionType.js +2 -0
  20. package/build/browser/api/action/ActionType.js.map +1 -0
  21. package/build/browser/api/action/ActionValidationRule.js +2 -0
  22. package/build/browser/api/action/ActionValidationRule.js.map +1 -0
  23. package/build/browser/api/action/ConditionDefinition.js +2 -0
  24. package/build/browser/api/action/ConditionDefinition.js.map +1 -0
  25. package/build/browser/api/action/MappingValue.js +2 -0
  26. package/build/browser/api/action/MappingValue.js.map +1 -0
  27. package/build/browser/api/action/SectionConditionalOverride.js +2 -0
  28. package/build/browser/api/action/SectionConditionalOverride.js.map +1 -0
  29. package/build/browser/api/action/SubmissionMetadata.js +2 -0
  30. package/build/browser/api/action/SubmissionMetadata.js.map +1 -0
  31. package/build/browser/api/common/BlueprintIcons.js +2 -0
  32. package/build/browser/api/common/BlueprintIcons.js.map +1 -0
  33. package/build/browser/api/common/OntologyDefinition.js +2 -0
  34. package/build/browser/api/common/OntologyDefinition.js.map +1 -0
  35. package/build/browser/api/common/OntologyEntityBase.js +2 -0
  36. package/build/browser/api/common/OntologyEntityBase.js.map +1 -0
  37. package/build/browser/api/{types.js → common/OntologyEntityTypeEnum.js} +2 -8
  38. package/build/browser/api/common/OntologyEntityTypeEnum.js.map +1 -0
  39. package/build/browser/api/common/OntologyEntityTypeMapping.js +2 -0
  40. package/build/browser/api/common/OntologyEntityTypeMapping.js.map +1 -0
  41. package/build/browser/api/common/TypeClass.js +2 -0
  42. package/build/browser/api/common/TypeClass.js.map +1 -0
  43. package/build/browser/api/defineAction.js +64 -41
  44. package/build/browser/api/defineAction.js.map +1 -1
  45. package/build/browser/api/defineInterface.js +14 -34
  46. package/build/browser/api/defineInterface.js.map +1 -1
  47. package/build/browser/api/defineInterfaceLinkConstraint.js +3 -2
  48. package/build/browser/api/defineInterfaceLinkConstraint.js.map +1 -1
  49. package/build/browser/api/defineLink.js +33 -12
  50. package/build/browser/api/defineLink.js.map +1 -1
  51. package/build/browser/api/defineObject.js +11 -29
  52. package/build/browser/api/defineObject.js.map +1 -1
  53. package/build/browser/api/defineOntology.js +16 -552
  54. package/build/browser/api/defineOntology.js.map +1 -1
  55. package/build/browser/api/defineSpt.js +1 -1
  56. package/build/browser/api/defineSpt.js.map +1 -1
  57. package/build/browser/api/defineValueType.js +1 -1
  58. package/build/browser/api/defineValueType.js.map +1 -1
  59. package/build/browser/api/importOntologyEntity.js +1 -1
  60. package/build/browser/api/importOntologyEntity.js.map +1 -1
  61. package/build/browser/api/{defineImportSpt.js → importSharedPropertyType.js} +2 -3
  62. package/build/browser/api/importSharedPropertyType.js.map +1 -0
  63. package/build/browser/api/interface/InterfacePropertyType.js +2 -0
  64. package/build/browser/api/interface/InterfacePropertyType.js.map +1 -0
  65. package/build/browser/api/interface/InterfaceType.js +2 -0
  66. package/build/browser/api/interface/InterfaceType.js.map +1 -0
  67. package/build/browser/api/interface/getFlattenedInterfaceProperties.js +27 -0
  68. package/build/browser/api/interface/getFlattenedInterfaceProperties.js.map +1 -0
  69. package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +42 -0
  70. package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -0
  71. package/build/browser/api/links/LinkType.js +2 -0
  72. package/build/browser/api/links/LinkType.js.map +1 -0
  73. package/build/browser/api/namespace/combineApiNamespaceIfMissing.js +20 -0
  74. package/build/browser/api/namespace/combineApiNamespaceIfMissing.js.map +1 -0
  75. package/build/browser/api/object/InterfaceImplementation.js +2 -0
  76. package/build/browser/api/object/InterfaceImplementation.js.map +1 -0
  77. package/build/browser/api/object/ObjectPropertyType.js +2 -0
  78. package/build/browser/api/object/ObjectPropertyType.js.map +1 -0
  79. package/build/browser/api/object/ObjectPropertyTypeUserDefinition.js +2 -0
  80. package/build/browser/api/object/ObjectPropertyTypeUserDefinition.js.map +1 -0
  81. package/build/browser/api/object/ObjectType.js +2 -0
  82. package/build/browser/api/object/ObjectType.js.map +1 -0
  83. package/build/browser/api/object/ObjectTypeDatasourceDefinition.js +2 -0
  84. package/build/browser/api/object/ObjectTypeDatasourceDefinition.js.map +1 -0
  85. package/build/browser/api/object/ObjectTypeDefinition.js +2 -0
  86. package/build/browser/api/object/ObjectTypeDefinition.js.map +1 -0
  87. package/build/browser/api/object/ObjectTypeStatus.js +2 -0
  88. package/build/browser/api/object/ObjectTypeStatus.js.map +1 -0
  89. package/build/browser/api/objectStatus.test.js.map +1 -1
  90. package/build/browser/api/overall.test.js +1982 -690
  91. package/build/browser/api/overall.test.js.map +1 -1
  92. package/build/browser/api/properties/Nullability.js +2 -0
  93. package/build/browser/api/properties/Nullability.js.map +1 -0
  94. package/build/browser/api/properties/PropertyTypeType.js +34 -0
  95. package/build/browser/api/properties/PropertyTypeType.js.map +1 -0
  96. package/build/browser/api/properties/SharedPropertyType.js +2 -0
  97. package/build/browser/api/properties/SharedPropertyType.js.map +1 -0
  98. package/build/browser/api/propertyConversionUtils.js +0 -238
  99. package/build/browser/api/propertyConversionUtils.js.map +1 -1
  100. package/build/browser/api/values/ValueTypeDefinitionVersion.js +2 -0
  101. package/build/browser/api/values/ValueTypeDefinitionVersion.js.map +1 -0
  102. package/build/browser/api/values/ValueTypeType.js +2 -0
  103. package/build/browser/api/values/ValueTypeType.js.map +1 -0
  104. package/build/browser/api/wrapWithProxy.js +1 -0
  105. package/build/browser/api/wrapWithProxy.js.map +1 -1
  106. package/build/browser/cli/main.js +10 -1
  107. package/build/browser/cli/main.js.map +1 -1
  108. package/build/browser/conversion/toConjure/distributeTypeHelper.js +23 -0
  109. package/build/browser/conversion/toConjure/distributeTypeHelper.js.map +1 -0
  110. package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js +88 -0
  111. package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -0
  112. package/build/browser/conversion/toMarketplace/convertActionParameters.js +31 -0
  113. package/build/browser/conversion/toMarketplace/convertActionParameters.js.map +1 -0
  114. package/build/browser/conversion/toMarketplace/convertActionSections.js +43 -0
  115. package/build/browser/conversion/toMarketplace/convertActionSections.js.map +1 -0
  116. package/build/browser/conversion/toMarketplace/convertActionValidation.js +93 -0
  117. package/build/browser/conversion/toMarketplace/convertActionValidation.js.map +1 -0
  118. package/build/browser/conversion/toMarketplace/convertActionVisibility.js +41 -0
  119. package/build/browser/conversion/toMarketplace/convertActionVisibility.js.map +1 -0
  120. package/build/browser/conversion/toMarketplace/convertCardinality.js +23 -0
  121. package/build/browser/conversion/toMarketplace/convertCardinality.js.map +1 -0
  122. package/build/browser/conversion/toMarketplace/convertConditionDefinition.js +86 -0
  123. package/build/browser/conversion/toMarketplace/convertConditionDefinition.js.map +1 -0
  124. package/build/browser/conversion/toMarketplace/convertDataConstraintToDataConstraints.js +26 -0
  125. package/build/browser/conversion/toMarketplace/convertDataConstraintToDataConstraints.js.map +1 -0
  126. package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js +89 -0
  127. package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -0
  128. package/build/browser/conversion/toMarketplace/convertInterface.js +47 -0
  129. package/build/browser/conversion/toMarketplace/convertInterface.js.map +1 -0
  130. package/build/browser/conversion/toMarketplace/convertLink.js +132 -0
  131. package/build/browser/conversion/toMarketplace/convertLink.js.map +1 -0
  132. package/build/browser/conversion/toMarketplace/convertMappingValue.js +41 -0
  133. package/build/browser/conversion/toMarketplace/convertMappingValue.js.map +1 -0
  134. package/build/browser/conversion/toMarketplace/convertNullabilityToDataConstraint.js +43 -0
  135. package/build/browser/conversion/toMarketplace/convertNullabilityToDataConstraint.js.map +1 -0
  136. package/build/browser/conversion/toMarketplace/convertObject.js +108 -0
  137. package/build/browser/conversion/toMarketplace/convertObject.js.map +1 -0
  138. package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js +53 -0
  139. package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -0
  140. package/build/browser/conversion/toMarketplace/convertOntologyDefinition.js +29 -0
  141. package/build/browser/conversion/toMarketplace/convertOntologyDefinition.js.map +1 -0
  142. package/build/browser/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js +57 -0
  143. package/build/browser/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js.map +1 -0
  144. package/build/browser/conversion/toMarketplace/convertOntologyToValueTypeIr.js +24 -0
  145. package/build/browser/conversion/toMarketplace/convertOntologyToValueTypeIr.js.map +1 -0
  146. package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js +35 -0
  147. package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -0
  148. package/build/browser/conversion/toMarketplace/convertSpt.js +62 -0
  149. package/build/browser/conversion/toMarketplace/convertSpt.js.map +1 -0
  150. package/build/browser/conversion/toMarketplace/convertValueType.js +25 -0
  151. package/build/browser/conversion/toMarketplace/convertValueType.js.map +1 -0
  152. package/build/browser/conversion/toMarketplace/convertValueTypeDataConstraints.js +30 -0
  153. package/build/browser/conversion/toMarketplace/convertValueTypeDataConstraints.js.map +1 -0
  154. package/build/browser/conversion/toMarketplace/convertValueTypesToIr.js +34 -0
  155. package/build/browser/conversion/toMarketplace/convertValueTypesToIr.js.map +1 -0
  156. package/build/browser/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js +83 -0
  157. package/build/browser/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js.map +1 -0
  158. package/build/browser/conversion/toMarketplace/getFormContentOrdering.js +39 -0
  159. package/build/browser/conversion/toMarketplace/getFormContentOrdering.js.map +1 -0
  160. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +124 -0
  161. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -0
  162. package/build/browser/index.js +5 -5
  163. package/build/browser/index.js.map +1 -1
  164. package/build/browser/util/OptionalFields.js +2 -0
  165. package/build/browser/util/OptionalFields.js.map +1 -0
  166. package/build/browser/util/RequiredFields.js +2 -0
  167. package/build/browser/util/RequiredFields.js.map +1 -0
  168. package/build/cjs/index.cjs +1116 -982
  169. package/build/cjs/index.cjs.map +1 -1
  170. package/build/cjs/index.d.cts +417 -346
  171. package/build/esm/api/action/ActionLevelValidationDefinition.js +2 -0
  172. package/build/esm/api/action/ActionLevelValidationDefinition.js.map +1 -0
  173. package/build/esm/api/action/ActionParameter.js +2 -0
  174. package/build/esm/api/action/ActionParameter.js.map +1 -0
  175. package/build/esm/api/action/ActionParameterAllowedValues.js +2 -0
  176. package/build/esm/api/action/ActionParameterAllowedValues.js.map +1 -0
  177. package/build/esm/api/action/ActionParameterConditionalOverride.js +2 -0
  178. package/build/esm/api/action/ActionParameterConditionalOverride.js.map +1 -0
  179. package/build/esm/api/action/ActionParameterConfiguration.js +2 -0
  180. package/build/esm/api/action/ActionParameterConfiguration.js.map +1 -0
  181. package/build/esm/api/action/ActionParameterType.js +22 -0
  182. package/build/esm/api/action/ActionParameterType.js.map +1 -0
  183. package/build/esm/api/action/ActionSection.js +2 -0
  184. package/build/esm/api/action/ActionSection.js.map +1 -0
  185. package/build/esm/api/action/ActionStatus.js +2 -0
  186. package/build/esm/api/action/ActionStatus.js.map +1 -0
  187. package/build/esm/api/action/ActionType.js +2 -0
  188. package/build/esm/api/action/ActionType.js.map +1 -0
  189. package/build/esm/api/action/ActionValidationRule.js +2 -0
  190. package/build/esm/api/action/ActionValidationRule.js.map +1 -0
  191. package/build/esm/api/action/ConditionDefinition.js +2 -0
  192. package/build/esm/api/action/ConditionDefinition.js.map +1 -0
  193. package/build/esm/api/action/MappingValue.js +2 -0
  194. package/build/esm/api/action/MappingValue.js.map +1 -0
  195. package/build/esm/api/action/SectionConditionalOverride.js +2 -0
  196. package/build/esm/api/action/SectionConditionalOverride.js.map +1 -0
  197. package/build/esm/api/action/SubmissionMetadata.js +2 -0
  198. package/build/esm/api/action/SubmissionMetadata.js.map +1 -0
  199. package/build/esm/api/common/BlueprintIcons.js +2 -0
  200. package/build/esm/api/common/BlueprintIcons.js.map +1 -0
  201. package/build/esm/api/common/OntologyDefinition.js +2 -0
  202. package/build/esm/api/common/OntologyDefinition.js.map +1 -0
  203. package/build/esm/api/common/OntologyEntityBase.js +2 -0
  204. package/build/esm/api/common/OntologyEntityBase.js.map +1 -0
  205. package/build/esm/api/{types.js → common/OntologyEntityTypeEnum.js} +2 -8
  206. package/build/esm/api/common/OntologyEntityTypeEnum.js.map +1 -0
  207. package/build/esm/api/common/OntologyEntityTypeMapping.js +2 -0
  208. package/build/esm/api/common/OntologyEntityTypeMapping.js.map +1 -0
  209. package/build/esm/api/common/TypeClass.js +2 -0
  210. package/build/esm/api/common/TypeClass.js.map +1 -0
  211. package/build/esm/api/defineAction.js +64 -41
  212. package/build/esm/api/defineAction.js.map +1 -1
  213. package/build/esm/api/defineInterface.js +14 -34
  214. package/build/esm/api/defineInterface.js.map +1 -1
  215. package/build/esm/api/defineInterfaceLinkConstraint.js +3 -2
  216. package/build/esm/api/defineInterfaceLinkConstraint.js.map +1 -1
  217. package/build/esm/api/defineLink.js +33 -12
  218. package/build/esm/api/defineLink.js.map +1 -1
  219. package/build/esm/api/defineObject.js +11 -29
  220. package/build/esm/api/defineObject.js.map +1 -1
  221. package/build/esm/api/defineOntology.js +16 -552
  222. package/build/esm/api/defineOntology.js.map +1 -1
  223. package/build/esm/api/defineSpt.js +1 -1
  224. package/build/esm/api/defineSpt.js.map +1 -1
  225. package/build/esm/api/defineValueType.js +1 -1
  226. package/build/esm/api/defineValueType.js.map +1 -1
  227. package/build/esm/api/importOntologyEntity.js +1 -1
  228. package/build/esm/api/importOntologyEntity.js.map +1 -1
  229. package/build/esm/api/{defineImportSpt.js → importSharedPropertyType.js} +2 -3
  230. package/build/esm/api/importSharedPropertyType.js.map +1 -0
  231. package/build/esm/api/interface/InterfacePropertyType.js +2 -0
  232. package/build/esm/api/interface/InterfacePropertyType.js.map +1 -0
  233. package/build/esm/api/interface/InterfaceType.js +2 -0
  234. package/build/esm/api/interface/InterfaceType.js.map +1 -0
  235. package/build/esm/api/interface/getFlattenedInterfaceProperties.js +27 -0
  236. package/build/esm/api/interface/getFlattenedInterfaceProperties.js.map +1 -0
  237. package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +42 -0
  238. package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -0
  239. package/build/esm/api/links/LinkType.js +2 -0
  240. package/build/esm/api/links/LinkType.js.map +1 -0
  241. package/build/esm/api/namespace/combineApiNamespaceIfMissing.js +20 -0
  242. package/build/esm/api/namespace/combineApiNamespaceIfMissing.js.map +1 -0
  243. package/build/esm/api/object/InterfaceImplementation.js +2 -0
  244. package/build/esm/api/object/InterfaceImplementation.js.map +1 -0
  245. package/build/esm/api/object/ObjectPropertyType.js +2 -0
  246. package/build/esm/api/object/ObjectPropertyType.js.map +1 -0
  247. package/build/esm/api/object/ObjectPropertyTypeUserDefinition.js +2 -0
  248. package/build/esm/api/object/ObjectPropertyTypeUserDefinition.js.map +1 -0
  249. package/build/esm/api/object/ObjectType.js +2 -0
  250. package/build/esm/api/object/ObjectType.js.map +1 -0
  251. package/build/esm/api/object/ObjectTypeDatasourceDefinition.js +2 -0
  252. package/build/esm/api/object/ObjectTypeDatasourceDefinition.js.map +1 -0
  253. package/build/esm/api/object/ObjectTypeDefinition.js +2 -0
  254. package/build/esm/api/object/ObjectTypeDefinition.js.map +1 -0
  255. package/build/esm/api/object/ObjectTypeStatus.js +2 -0
  256. package/build/esm/api/object/ObjectTypeStatus.js.map +1 -0
  257. package/build/esm/api/objectStatus.test.js.map +1 -1
  258. package/build/esm/api/overall.test.js +1982 -690
  259. package/build/esm/api/overall.test.js.map +1 -1
  260. package/build/esm/api/properties/Nullability.js +2 -0
  261. package/build/esm/api/properties/Nullability.js.map +1 -0
  262. package/build/esm/api/properties/PropertyTypeType.js +34 -0
  263. package/build/esm/api/properties/PropertyTypeType.js.map +1 -0
  264. package/build/esm/api/properties/SharedPropertyType.js +2 -0
  265. package/build/esm/api/properties/SharedPropertyType.js.map +1 -0
  266. package/build/esm/api/propertyConversionUtils.js +0 -238
  267. package/build/esm/api/propertyConversionUtils.js.map +1 -1
  268. package/build/esm/api/values/ValueTypeDefinitionVersion.js +2 -0
  269. package/build/esm/api/values/ValueTypeDefinitionVersion.js.map +1 -0
  270. package/build/esm/api/values/ValueTypeType.js +2 -0
  271. package/build/esm/api/values/ValueTypeType.js.map +1 -0
  272. package/build/esm/api/wrapWithProxy.js +1 -0
  273. package/build/esm/api/wrapWithProxy.js.map +1 -1
  274. package/build/esm/cli/main.js +10 -1
  275. package/build/esm/cli/main.js.map +1 -1
  276. package/build/esm/conversion/toConjure/distributeTypeHelper.js +23 -0
  277. package/build/esm/conversion/toConjure/distributeTypeHelper.js.map +1 -0
  278. package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js +88 -0
  279. package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -0
  280. package/build/esm/conversion/toMarketplace/convertActionParameters.js +31 -0
  281. package/build/esm/conversion/toMarketplace/convertActionParameters.js.map +1 -0
  282. package/build/esm/conversion/toMarketplace/convertActionSections.js +43 -0
  283. package/build/esm/conversion/toMarketplace/convertActionSections.js.map +1 -0
  284. package/build/esm/conversion/toMarketplace/convertActionValidation.js +93 -0
  285. package/build/esm/conversion/toMarketplace/convertActionValidation.js.map +1 -0
  286. package/build/esm/conversion/toMarketplace/convertActionVisibility.js +41 -0
  287. package/build/esm/conversion/toMarketplace/convertActionVisibility.js.map +1 -0
  288. package/build/esm/conversion/toMarketplace/convertCardinality.js +23 -0
  289. package/build/esm/conversion/toMarketplace/convertCardinality.js.map +1 -0
  290. package/build/esm/conversion/toMarketplace/convertConditionDefinition.js +86 -0
  291. package/build/esm/conversion/toMarketplace/convertConditionDefinition.js.map +1 -0
  292. package/build/esm/conversion/toMarketplace/convertDataConstraintToDataConstraints.js +26 -0
  293. package/build/esm/conversion/toMarketplace/convertDataConstraintToDataConstraints.js.map +1 -0
  294. package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js +89 -0
  295. package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -0
  296. package/build/esm/conversion/toMarketplace/convertInterface.js +47 -0
  297. package/build/esm/conversion/toMarketplace/convertInterface.js.map +1 -0
  298. package/build/esm/conversion/toMarketplace/convertLink.js +132 -0
  299. package/build/esm/conversion/toMarketplace/convertLink.js.map +1 -0
  300. package/build/esm/conversion/toMarketplace/convertMappingValue.js +41 -0
  301. package/build/esm/conversion/toMarketplace/convertMappingValue.js.map +1 -0
  302. package/build/esm/conversion/toMarketplace/convertNullabilityToDataConstraint.js +43 -0
  303. package/build/esm/conversion/toMarketplace/convertNullabilityToDataConstraint.js.map +1 -0
  304. package/build/esm/conversion/toMarketplace/convertObject.js +108 -0
  305. package/build/esm/conversion/toMarketplace/convertObject.js.map +1 -0
  306. package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js +53 -0
  307. package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -0
  308. package/build/esm/conversion/toMarketplace/convertOntologyDefinition.js +29 -0
  309. package/build/esm/conversion/toMarketplace/convertOntologyDefinition.js.map +1 -0
  310. package/build/esm/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js +57 -0
  311. package/build/esm/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.js.map +1 -0
  312. package/build/esm/conversion/toMarketplace/convertOntologyToValueTypeIr.js +24 -0
  313. package/build/esm/conversion/toMarketplace/convertOntologyToValueTypeIr.js.map +1 -0
  314. package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js +35 -0
  315. package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -0
  316. package/build/esm/conversion/toMarketplace/convertSpt.js +62 -0
  317. package/build/esm/conversion/toMarketplace/convertSpt.js.map +1 -0
  318. package/build/esm/conversion/toMarketplace/convertValueType.js +25 -0
  319. package/build/esm/conversion/toMarketplace/convertValueType.js.map +1 -0
  320. package/build/esm/conversion/toMarketplace/convertValueTypeDataConstraints.js +30 -0
  321. package/build/esm/conversion/toMarketplace/convertValueTypeDataConstraints.js.map +1 -0
  322. package/build/esm/conversion/toMarketplace/convertValueTypesToIr.js +34 -0
  323. package/build/esm/conversion/toMarketplace/convertValueTypesToIr.js.map +1 -0
  324. package/build/esm/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js +83 -0
  325. package/build/esm/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.js.map +1 -0
  326. package/build/esm/conversion/toMarketplace/getFormContentOrdering.js +39 -0
  327. package/build/esm/conversion/toMarketplace/getFormContentOrdering.js.map +1 -0
  328. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +124 -0
  329. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -0
  330. package/build/esm/index.js +5 -5
  331. package/build/esm/index.js.map +1 -1
  332. package/build/esm/util/OptionalFields.js +2 -0
  333. package/build/esm/util/OptionalFields.js.map +1 -0
  334. package/build/esm/util/RequiredFields.js +2 -0
  335. package/build/esm/util/RequiredFields.js.map +1 -0
  336. package/build/types/api/action/ActionLevelValidationDefinition.d.ts +7 -0
  337. package/build/types/api/action/ActionLevelValidationDefinition.d.ts.map +1 -0
  338. package/build/types/api/action/ActionParameter.d.ts +14 -0
  339. package/build/types/api/action/ActionParameter.d.ts.map +1 -0
  340. package/build/types/api/action/ActionParameterAllowedValues.d.ts +50 -0
  341. package/build/types/api/action/ActionParameterAllowedValues.d.ts.map +1 -0
  342. package/build/types/api/action/ActionParameterConditionalOverride.d.ts +26 -0
  343. package/build/types/api/action/ActionParameterConditionalOverride.d.ts.map +1 -0
  344. package/build/types/api/action/ActionParameterConfiguration.d.ts +20 -0
  345. package/build/types/api/action/ActionParameterConfiguration.d.ts.map +1 -0
  346. package/build/types/api/action/ActionParameterType.d.ts +6 -0
  347. package/build/types/api/action/ActionParameterType.d.ts.map +1 -0
  348. package/build/types/api/action/ActionSection.d.ts +13 -0
  349. package/build/types/api/action/ActionSection.d.ts.map +1 -0
  350. package/build/types/api/action/ActionStatus.d.ts +2 -0
  351. package/build/types/api/action/ActionStatus.d.ts.map +1 -0
  352. package/build/types/api/action/ActionType.d.ts +36 -0
  353. package/build/types/api/action/ActionType.d.ts.map +1 -0
  354. package/build/types/api/action/ActionValidationRule.d.ts +2 -0
  355. package/build/types/api/action/ActionValidationRule.d.ts.map +1 -0
  356. package/build/types/api/action/ConditionDefinition.d.ts +15 -0
  357. package/build/types/api/action/ConditionDefinition.d.ts.map +1 -0
  358. package/build/types/api/action/MappingValue.d.ts +13 -0
  359. package/build/types/api/action/MappingValue.d.ts.map +1 -0
  360. package/build/types/api/action/SectionConditionalOverride.d.ts +2 -0
  361. package/build/types/api/action/SectionConditionalOverride.d.ts.map +1 -0
  362. package/build/types/api/action/SubmissionMetadata.d.ts +6 -0
  363. package/build/types/api/action/SubmissionMetadata.d.ts.map +1 -0
  364. package/build/types/api/{iconNames.d.ts.map → common/BlueprintIcons.d.ts.map} +1 -1
  365. package/build/types/api/common/OntologyDefinition.d.ts +6 -0
  366. package/build/types/api/common/OntologyDefinition.d.ts.map +1 -0
  367. package/build/types/api/common/OntologyEntityBase.d.ts +5 -0
  368. package/build/types/api/common/OntologyEntityBase.d.ts.map +1 -0
  369. package/build/types/api/common/OntologyEntityTypeEnum.d.ts +8 -0
  370. package/build/types/api/common/OntologyEntityTypeEnum.d.ts.map +1 -0
  371. package/build/types/api/common/OntologyEntityTypeMapping.d.ts +16 -0
  372. package/build/types/api/common/OntologyEntityTypeMapping.d.ts.map +1 -0
  373. package/build/types/api/common/TypeClass.d.ts +4 -0
  374. package/build/types/api/common/TypeClass.d.ts.map +1 -0
  375. package/build/types/api/defineAction.d.ts +38 -3
  376. package/build/types/api/defineAction.d.ts.map +1 -1
  377. package/build/types/api/defineInterface.d.ts +5 -3
  378. package/build/types/api/defineInterface.d.ts.map +1 -1
  379. package/build/types/api/defineInterfaceLinkConstraint.d.ts +1 -1
  380. package/build/types/api/defineInterfaceLinkConstraint.d.ts.map +1 -1
  381. package/build/types/api/defineLink.d.ts +1 -1
  382. package/build/types/api/defineLink.d.ts.map +1 -1
  383. package/build/types/api/defineObject.d.ts +2 -4
  384. package/build/types/api/defineObject.d.ts.map +1 -1
  385. package/build/types/api/defineOntology.d.ts +11 -4
  386. package/build/types/api/defineOntology.d.ts.map +1 -1
  387. package/build/types/api/defineSpt.d.ts +2 -1
  388. package/build/types/api/defineSpt.d.ts.map +1 -1
  389. package/build/types/api/defineValueType.d.ts +2 -1
  390. package/build/types/api/defineValueType.d.ts.map +1 -1
  391. package/build/types/api/importOntologyEntity.d.ts +1 -1
  392. package/build/types/api/importOntologyEntity.d.ts.map +1 -1
  393. package/build/types/api/{defineImportSpt.d.ts → importSharedPropertyType.d.ts} +2 -1
  394. package/build/types/api/importSharedPropertyType.d.ts.map +1 -0
  395. package/build/types/api/interface/InterfacePropertyType.d.ts +5 -0
  396. package/build/types/api/interface/InterfacePropertyType.d.ts.map +1 -0
  397. package/build/types/api/interface/InterfaceType.d.ts +10 -0
  398. package/build/types/api/interface/InterfaceType.d.ts.map +1 -0
  399. package/build/types/api/interface/getFlattenedInterfaceProperties.d.ts +3 -0
  400. package/build/types/api/interface/getFlattenedInterfaceProperties.d.ts.map +1 -0
  401. package/build/types/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.d.ts +3 -0
  402. package/build/types/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.d.ts.map +1 -0
  403. package/build/types/api/links/LinkType.d.ts +100 -0
  404. package/build/types/api/links/LinkType.d.ts.map +1 -0
  405. package/build/types/api/namespace/combineApiNamespaceIfMissing.d.ts +1 -0
  406. package/build/types/api/namespace/combineApiNamespaceIfMissing.d.ts.map +1 -0
  407. package/build/types/api/object/InterfaceImplementation.d.ts +8 -0
  408. package/build/types/api/object/InterfaceImplementation.d.ts.map +1 -0
  409. package/build/types/api/object/ObjectPropertyType.d.ts +27 -0
  410. package/build/types/api/object/ObjectPropertyType.d.ts.map +1 -0
  411. package/build/types/api/object/ObjectPropertyTypeUserDefinition.d.ts +3 -0
  412. package/build/types/api/object/ObjectPropertyTypeUserDefinition.d.ts.map +1 -0
  413. package/build/types/api/object/ObjectType.d.ts +29 -0
  414. package/build/types/api/object/ObjectType.d.ts.map +1 -0
  415. package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts +11 -0
  416. package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts.map +1 -0
  417. package/build/types/api/object/ObjectTypeDefinition.d.ts +26 -0
  418. package/build/types/api/object/ObjectTypeDefinition.d.ts.map +1 -0
  419. package/build/types/api/object/ObjectTypeStatus.d.ts +5 -0
  420. package/build/types/api/object/ObjectTypeStatus.d.ts.map +1 -0
  421. package/build/types/api/properties/Nullability.d.ts +4 -0
  422. package/build/types/api/properties/Nullability.d.ts.map +1 -0
  423. package/build/types/api/properties/PropertyTypeType.d.ts +33 -0
  424. package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -0
  425. package/build/types/api/properties/SharedPropertyType.d.ts +22 -0
  426. package/build/types/api/properties/SharedPropertyType.d.ts.map +1 -0
  427. package/build/types/api/propertyConversionUtils.d.ts +2 -20
  428. package/build/types/api/propertyConversionUtils.d.ts.map +1 -1
  429. package/build/types/api/values/ValueTypeDefinitionVersion.d.ts +14 -0
  430. package/build/types/api/values/ValueTypeDefinitionVersion.d.ts.map +1 -0
  431. package/build/types/api/values/ValueTypeType.d.ts +178 -0
  432. package/build/types/api/values/ValueTypeType.d.ts.map +1 -0
  433. package/build/types/api/wrapWithProxy.d.ts +1 -1
  434. package/build/types/api/wrapWithProxy.d.ts.map +1 -1
  435. package/build/types/cli/main.d.ts.map +1 -1
  436. package/build/types/conversion/toConjure/distributeTypeHelper.d.ts +3 -0
  437. package/build/types/conversion/toConjure/distributeTypeHelper.d.ts.map +1 -0
  438. package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts +4 -0
  439. package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts.map +1 -0
  440. package/build/types/conversion/toMarketplace/convertActionParameters.d.ts +3 -0
  441. package/build/types/conversion/toMarketplace/convertActionParameters.d.ts.map +1 -0
  442. package/build/types/conversion/toMarketplace/convertActionSections.d.ts +3 -0
  443. package/build/types/conversion/toMarketplace/convertActionSections.d.ts.map +1 -0
  444. package/build/types/conversion/toMarketplace/convertActionValidation.d.ts +3 -0
  445. package/build/types/conversion/toMarketplace/convertActionValidation.d.ts.map +1 -0
  446. package/build/types/conversion/toMarketplace/convertActionVisibility.d.ts +2 -0
  447. package/build/types/conversion/toMarketplace/convertActionVisibility.d.ts.map +1 -0
  448. package/build/types/conversion/toMarketplace/convertCardinality.d.ts +3 -0
  449. package/build/types/conversion/toMarketplace/convertCardinality.d.ts.map +1 -0
  450. package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts +3 -0
  451. package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts.map +1 -0
  452. package/build/types/conversion/toMarketplace/convertDataConstraintToDataConstraints.d.ts +2 -0
  453. package/build/types/conversion/toMarketplace/convertDataConstraintToDataConstraints.d.ts.map +1 -0
  454. package/build/types/conversion/toMarketplace/convertDatasourceDefinition.d.ts +4 -0
  455. package/build/types/conversion/toMarketplace/convertDatasourceDefinition.d.ts.map +1 -0
  456. package/build/types/conversion/toMarketplace/convertInterface.d.ts +3 -0
  457. package/build/types/conversion/toMarketplace/convertInterface.d.ts.map +1 -0
  458. package/build/types/conversion/toMarketplace/convertLink.d.ts +3 -0
  459. package/build/types/conversion/toMarketplace/convertLink.d.ts.map +1 -0
  460. package/build/types/conversion/toMarketplace/convertMappingValue.d.ts +3 -0
  461. package/build/types/conversion/toMarketplace/convertMappingValue.d.ts.map +1 -0
  462. package/build/types/conversion/toMarketplace/convertNullabilityToDataConstraint.d.ts +7 -0
  463. package/build/types/conversion/toMarketplace/convertNullabilityToDataConstraint.d.ts.map +1 -0
  464. package/build/types/conversion/toMarketplace/convertObject.d.ts +9 -0
  465. package/build/types/conversion/toMarketplace/convertObject.d.ts.map +1 -0
  466. package/build/types/conversion/toMarketplace/convertObjectPropertyType.d.ts +3 -0
  467. package/build/types/conversion/toMarketplace/convertObjectPropertyType.d.ts.map +1 -0
  468. package/build/types/conversion/toMarketplace/convertOntologyDefinition.d.ts +3 -0
  469. package/build/types/conversion/toMarketplace/convertOntologyDefinition.d.ts.map +1 -0
  470. package/build/types/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.d.ts +3 -0
  471. package/build/types/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.d.ts.map +1 -0
  472. package/build/types/conversion/toMarketplace/convertOntologyToValueTypeIr.d.ts +3 -0
  473. package/build/types/conversion/toMarketplace/convertOntologyToValueTypeIr.d.ts.map +1 -0
  474. package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts +3 -0
  475. package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts.map +1 -0
  476. package/build/types/conversion/toMarketplace/convertSpt.d.ts +3 -0
  477. package/build/types/conversion/toMarketplace/convertSpt.d.ts.map +1 -0
  478. package/build/types/conversion/toMarketplace/convertValueType.d.ts +3 -0
  479. package/build/types/conversion/toMarketplace/convertValueType.d.ts.map +1 -0
  480. package/build/types/conversion/toMarketplace/convertValueTypeDataConstraints.d.ts +2 -0
  481. package/build/types/conversion/toMarketplace/convertValueTypeDataConstraints.d.ts.map +1 -0
  482. package/build/types/conversion/toMarketplace/convertValueTypesToIr.d.ts +3 -0
  483. package/build/types/conversion/toMarketplace/convertValueTypesToIr.d.ts.map +1 -0
  484. package/build/types/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.d.ts +2 -0
  485. package/build/types/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.d.ts.map +1 -0
  486. package/build/types/conversion/toMarketplace/getFormContentOrdering.d.ts +3 -0
  487. package/build/types/conversion/toMarketplace/getFormContentOrdering.d.ts.map +1 -0
  488. package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts +3 -0
  489. package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts.map +1 -0
  490. package/build/types/index.d.ts +22 -6
  491. package/build/types/index.d.ts.map +1 -1
  492. package/build/types/util/OptionalFields.d.ts +4 -0
  493. package/build/types/util/OptionalFields.d.ts.map +1 -0
  494. package/build/types/util/RequiredFields.d.ts +4 -0
  495. package/build/types/util/RequiredFields.d.ts.map +1 -0
  496. package/package.json +6 -6
  497. package/build/browser/api/defineImportSpt.js.map +0 -1
  498. package/build/browser/api/iconNames.js +0 -2
  499. package/build/browser/api/iconNames.js.map +0 -1
  500. package/build/browser/api/ontologyUtils.js +0 -243
  501. package/build/browser/api/ontologyUtils.js.map +0 -1
  502. package/build/browser/api/types.js.map +0 -1
  503. package/build/esm/api/defineImportSpt.js.map +0 -1
  504. package/build/esm/api/iconNames.js +0 -2
  505. package/build/esm/api/iconNames.js.map +0 -1
  506. package/build/esm/api/ontologyUtils.js +0 -243
  507. package/build/esm/api/ontologyUtils.js.map +0 -1
  508. package/build/esm/api/types.js.map +0 -1
  509. package/build/types/api/defineImportSpt.d.ts.map +0 -1
  510. package/build/types/api/ontologyUtils.d.ts +0 -8
  511. package/build/types/api/ontologyUtils.d.ts.map +0 -1
  512. package/build/types/api/types.d.ts +0 -625
  513. package/build/types/api/types.d.ts.map +0 -1
  514. /package/build/types/api/{iconNames.d.ts → common/BlueprintIcons.d.ts} +0 -0
@@ -6,6 +6,7 @@ var consola = require('consola');
6
6
  var fs2 = require('fs/promises');
7
7
  var path2 = require('path');
8
8
  var invariant5 = require('tiny-invariant');
9
+ var uuid = require('uuid');
9
10
  var yargs = require('yargs');
10
11
  var helpers = require('yargs/helpers');
11
12
  var fs = require('fs');
@@ -39,7 +40,23 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
39
40
 
40
41
  // src/cli/main.ts
41
42
 
42
- // src/api/types.ts
43
+ // src/conversion/toMarketplace/convertActionParameters.ts
44
+ function convertActionParameters(action) {
45
+ return Object.fromEntries((action.parameters ?? []).map((p) => [p.id, {
46
+ id: p.id,
47
+ type: typeof p.type === "string" ? {
48
+ type: p.type,
49
+ [p.type]: {}
50
+ } : p.type,
51
+ displayMetadata: {
52
+ displayName: p.displayName,
53
+ description: p.description ?? "",
54
+ typeClasses: []
55
+ }
56
+ }]));
57
+ }
58
+
59
+ // src/api/common/OntologyEntityTypeEnum.ts
43
60
  var OntologyEntityTypeEnum = /* @__PURE__ */ (function(OntologyEntityTypeEnum2) {
44
61
  OntologyEntityTypeEnum2["OBJECT_TYPE"] = "OBJECT_TYPE";
45
62
  OntologyEntityTypeEnum2["LINK_TYPE"] = "LINK_TYPE";
@@ -49,18 +66,49 @@ var OntologyEntityTypeEnum = /* @__PURE__ */ (function(OntologyEntityTypeEnum2)
49
66
  OntologyEntityTypeEnum2["VALUE_TYPE"] = "VALUE_TYPE";
50
67
  return OntologyEntityTypeEnum2;
51
68
  })({});
52
- var MODIFY_OBJECT_PARAMETER = "objectToModifyParameter";
53
- var CREATE_OR_MODIFY_OBJECT_PARAMETER = "objectToCreateOrModifyParameter";
69
+
70
+ // src/api/interface/getFlattenedInterfaceProperties.ts
71
+ function getFlattenedInterfaceProperties(interfaceType) {
72
+ let properties = interfaceType.propertiesV2;
73
+ interfaceType.extendsInterfaces.forEach((ext) => {
74
+ properties = {
75
+ ...properties,
76
+ ...getFlattenedInterfaceProperties(ext)
77
+ };
78
+ });
79
+ return properties;
80
+ }
81
+
82
+ // src/api/properties/PropertyTypeType.ts
83
+ function isPropertyTypeType(v) {
84
+ 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";
85
+ }
86
+ function isExotic(type) {
87
+ if (type === void 0) {
88
+ return false;
89
+ }
90
+ if (typeof type === "string") {
91
+ return ["geopoint", "geoshape", "mediaReference", "geotimeSeries"].includes(type);
92
+ } else if (typeof type === "object" && type != null) {
93
+ return type.type === "marking" || type.type === "struct";
94
+ }
95
+ return false;
96
+ }
97
+ function isStruct(type) {
98
+ return typeof type === "object" && type.type === "struct";
99
+ }
54
100
 
55
101
  // src/api/defineObject.ts
56
102
  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))$/;
57
103
  var ISO_8601_DATETIME = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/;
104
+ var API_NAME_PATTERN = /^([a-zA-Z][a-zA-Z0-9\\-]*)$/;
58
105
  function defineObject(objectDef) {
59
106
  const apiName = namespace + objectDef.apiName;
60
107
  const propertyApiNames = objectDef.properties ? Object.keys(objectDef.properties) : [];
61
108
  if (ontologyDefinition[OntologyEntityTypeEnum.OBJECT_TYPE][apiName] !== void 0) {
62
109
  throw new Error(`Object type with apiName ${objectDef.apiName} is already defined`);
63
110
  }
111
+ !API_NAME_PATTERN.test(objectDef.apiName) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Invalid API name ${objectDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`) : invariant5__default.default(false) : void 0;
64
112
  !propertyApiNames.includes(objectDef.titlePropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`) : invariant5__default.default(false) : void 0;
65
113
  !propertyApiNames.includes(objectDef.primaryKeyPropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} does not exist on object ${objectDef.apiName}`) : invariant5__default.default(false) : void 0;
66
114
  !!objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.editOnly ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} on object ${objectDef.apiName} cannot be edit-only`) : invariant5__default.default(false) : void 0;
@@ -82,7 +130,7 @@ function defineObject(objectDef) {
82
130
  !!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;
83
131
  !!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;
84
132
  objectDef.implementsInterfaces?.forEach((interfaceImpl) => {
85
- const allInterfaceProperties = getAllInterfaceProperties(interfaceImpl.implements);
133
+ const allInterfaceProperties = getFlattenedInterfaceProperties(interfaceImpl.implements);
86
134
  const nonExistentInterfaceProperties = interfaceImpl.propertyMapping.map((val) => val.interfaceProperty).filter((interfaceProperty) => allInterfaceProperties[addNamespaceIfNone(interfaceProperty)] === void 0).map((interfaceProp) => ({
87
135
  type: "invalid",
88
136
  reason: `Interface property ${interfaceProp} referenced in ${objectDef.apiName} object does not exist`
@@ -97,7 +145,7 @@ function defineObject(objectDef) {
97
145
  reason: `Interface property ${interfaceProp[1].sharedPropertyType.apiName} not implemented by ${objectDef.apiName} object definition`
98
146
  };
99
147
  };
100
- const validations = Object.entries(getAllInterfaceProperties(interfaceImpl.implements)).map(validateProperty);
148
+ const validations = Object.entries(getFlattenedInterfaceProperties(interfaceImpl.implements)).map(validateProperty);
101
149
  const allFailedValidations = validations.concat(nonExistentInterfaceProperties).filter((val) => val.type === "invalid");
102
150
  !(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant5__default.default(false) : void 0;
103
151
  });
@@ -112,17 +160,6 @@ function defineObject(objectDef) {
112
160
  objectDef.apiName = apiName;
113
161
  return objectDef;
114
162
  }
115
- function isExotic(type) {
116
- if (type === void 0) {
117
- return false;
118
- }
119
- if (typeof type === "string") {
120
- return ["geopoint", "geoshape", "mediaReference", "geotimeSeries"].includes(type);
121
- } else if (typeof type === "object" && type != null) {
122
- return type.type === "marking" || type.type === "struct";
123
- }
124
- return false;
125
- }
126
163
  function formatValidationErrors(error) {
127
164
  return `Ontology Definition Error: ${error.reason}
128
165
  `;
@@ -145,56 +182,122 @@ function validateInterfaceImplProperty(spt, mappedObjectProp, object) {
145
182
  type: "valid"
146
183
  };
147
184
  }
148
- function convertToDisplayName(s) {
185
+ function uppercaseFirstLetter(s) {
149
186
  return s === void 0 || s == null ? "" : s.charAt(0).toUpperCase() + s.slice(1);
150
187
  }
151
188
  function convertToPluralDisplayName(s) {
152
- return s === void 0 || s == null ? "" : s.endsWith("s") ? convertToDisplayName(s) : convertToDisplayName(s) + "s";
153
- }
154
- function getAllInterfaceProperties(interfaceType) {
155
- let properties = interfaceType.propertiesV2;
156
- interfaceType.extendsInterfaces.forEach((ext) => {
157
- properties = {
158
- ...properties,
159
- ...getAllInterfaceProperties(ext)
160
- };
161
- });
162
- return properties;
189
+ return s === void 0 || s == null ? "" : s.endsWith("s") ? uppercaseFirstLetter(s) : uppercaseFirstLetter(s) + "s";
163
190
  }
164
191
  function convertUserObjectPropertyType(apiName, property) {
165
192
  property.apiName = apiName;
166
- property.displayName = property.displayName ?? convertToDisplayName(apiName);
193
+ property.displayName = property.displayName ?? uppercaseFirstLetter(apiName);
167
194
  return {
168
195
  ...property,
169
196
  apiName,
170
- displayName: property.displayName ?? convertToDisplayName(apiName),
197
+ displayName: property.displayName ?? uppercaseFirstLetter(apiName),
171
198
  type: property.type
172
199
  };
173
200
  }
174
- function convertActionVisibility(visibility) {
175
- switch (visibility) {
176
- case "editable":
177
- return {
178
- type: "editable",
179
- editable: {}
180
- };
181
- case "disabled":
201
+
202
+ // src/conversion/toMarketplace/convertActionSections.ts
203
+ function convertActionSections(action) {
204
+ return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [sectionId, {
205
+ id: sectionId,
206
+ content: section.parameters.map((p) => ({
207
+ type: "parameterId",
208
+ parameterId: p
209
+ })),
210
+ displayMetadata: {
211
+ collapsedByDefault: section.collapsedByDefault ?? false,
212
+ columnCount: section.columnCount ?? 1,
213
+ description: section.description ?? "",
214
+ displayName: section.displayName ?? uppercaseFirstLetter(sectionId),
215
+ showTitleBar: section.showTitleBar ?? true,
216
+ ...section.style && {
217
+ style: section.style === "box" ? {
218
+ type: "box",
219
+ box: {}
220
+ } : {
221
+ type: "minimal",
222
+ minimal: {}
223
+ }
224
+ }
225
+ }
226
+ }]));
227
+ }
228
+
229
+ // src/conversion/toMarketplace/convertConditionDefinition.ts
230
+ function convertConditionDefinition(condition) {
231
+ switch (condition.type) {
232
+ case "and":
233
+ if ("conditions" in condition) {
234
+ return {
235
+ type: "and",
236
+ and: {
237
+ conditions: condition.conditions.map((c) => convertConditionDefinition(c))
238
+ }
239
+ };
240
+ } else {
241
+ return condition;
242
+ }
243
+ case "or":
244
+ if ("conditions" in condition) {
245
+ return {
246
+ type: "or",
247
+ or: {
248
+ conditions: condition.conditions.map((c) => convertConditionDefinition(c))
249
+ }
250
+ };
251
+ } else {
252
+ return condition;
253
+ }
254
+ case "group":
182
255
  return {
183
- type: "disabled",
184
- disabled: {}
256
+ type: "comparison",
257
+ comparison: {
258
+ operator: "INTERSECTS",
259
+ left: {
260
+ type: "userProperty",
261
+ userProperty: {
262
+ userId: {
263
+ type: "currentUser",
264
+ currentUser: {}
265
+ },
266
+ propertyValue: {
267
+ type: "groupIds",
268
+ groupIds: {}
269
+ }
270
+ }
271
+ },
272
+ right: {
273
+ type: "staticValue",
274
+ staticValue: {
275
+ type: "stringList",
276
+ stringList: {
277
+ strings: [condition.name]
278
+ }
279
+ }
280
+ }
281
+ }
185
282
  };
186
- case "hidden":
283
+ case "parameter":
187
284
  return {
188
- type: "hidden",
189
- hidden: {}
285
+ type: "comparison",
286
+ comparison: {
287
+ operator: "EQUALS",
288
+ left: {
289
+ type: "parameterId",
290
+ parameterId: condition.parameterId
291
+ },
292
+ right: condition.matches
293
+ }
190
294
  };
191
295
  default:
192
- return {
193
- type: "editable",
194
- editable: {}
195
- };
296
+ return condition;
196
297
  }
197
298
  }
299
+
300
+ // src/conversion/toMarketplace/convertActionParameterConditionalOverride.ts
198
301
  function convertActionParameterConditionalOverride(override, validation) {
199
302
  let parameterBlockOverride;
200
303
  switch (override.type) {
@@ -264,6 +367,34 @@ function convertActionParameterConditionalOverride(override, validation) {
264
367
  parameterBlockOverrides: [parameterBlockOverride]
265
368
  };
266
369
  }
370
+
371
+ // src/conversion/toMarketplace/convertActionVisibility.ts
372
+ function convertActionVisibility(visibility) {
373
+ switch (visibility) {
374
+ case "editable":
375
+ return {
376
+ type: "editable",
377
+ editable: {}
378
+ };
379
+ case "disabled":
380
+ return {
381
+ type: "disabled",
382
+ disabled: {}
383
+ };
384
+ case "hidden":
385
+ return {
386
+ type: "hidden",
387
+ hidden: {}
388
+ };
389
+ default:
390
+ return {
391
+ type: "editable",
392
+ editable: {}
393
+ };
394
+ }
395
+ }
396
+
397
+ // src/conversion/toMarketplace/convertSectionConditionalOverride.ts
267
398
  function convertSectionConditionalOverride(override, defaultVisibility) {
268
399
  return {
269
400
  condition: convertConditionDefinition(override.condition),
@@ -281,227 +412,78 @@ function convertSectionConditionalOverride(override, defaultVisibility) {
281
412
  }]
282
413
  };
283
414
  }
284
- function convertConditionDefinition(condition) {
285
- switch (condition.type) {
286
- case "and":
287
- if ("conditions" in condition) {
288
- return {
289
- type: "and",
290
- and: {
291
- conditions: condition.conditions.map((c) => convertConditionDefinition(c))
415
+
416
+ // src/conversion/toMarketplace/convertActionValidation.ts
417
+ function convertActionValidation(action) {
418
+ return {
419
+ actionTypeLevelValidation: {
420
+ rules: Object.fromEntries((action.validation ?? [{
421
+ condition: {
422
+ type: "true",
423
+ true: {}
424
+ },
425
+ displayMetadata: {
426
+ failureMessage: "",
427
+ typeClasses: []
428
+ }
429
+ }]).map((rule, idx) => [idx, rule]))
430
+ },
431
+ parameterValidations: Object.fromEntries((action.parameters ?? []).map((p) => {
432
+ return [p.id, {
433
+ defaultValidation: {
434
+ display: {
435
+ renderHint: renderHintFromBaseType(p),
436
+ visibility: convertActionVisibility(p.validation.defaultVisibility),
437
+ ...p.defaultValue && {
438
+ prefill: p.defaultValue
439
+ }
440
+ },
441
+ validation: {
442
+ allowedValues: extractAllowedValues(p.validation.allowedValues),
443
+ required: convertParameterRequirementConstraint(p.validation.required)
292
444
  }
293
- };
294
- } else {
295
- return condition;
296
- }
297
- case "or":
298
- if ("conditions" in condition) {
299
- return {
300
- type: "or",
301
- or: {
302
- conditions: condition.conditions.map((c) => convertConditionDefinition(c))
445
+ },
446
+ conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation)) ?? []
447
+ }];
448
+ })),
449
+ sectionValidations: {
450
+ ...Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [section.id, {
451
+ defaultDisplayMetadata: section.defaultVisibility === "hidden" ? {
452
+ visibility: {
453
+ type: "hidden",
454
+ hidden: {}
303
455
  }
304
- };
305
- } else {
306
- return condition;
307
- }
308
- case "group":
309
- return {
310
- type: "comparison",
311
- comparison: {
312
- operator: "INTERSECTS",
313
- left: {
314
- type: "userProperty",
315
- userProperty: {
316
- userId: {
317
- type: "currentUser",
318
- currentUser: {}
319
- },
320
- propertyValue: {
321
- type: "groupIds",
322
- groupIds: {}
323
- }
324
- }
325
- },
326
- right: {
327
- type: "staticValue",
328
- staticValue: {
329
- type: "stringList",
330
- stringList: {
331
- strings: [condition.name]
332
- }
333
- }
456
+ } : {
457
+ visibility: {
458
+ type: "visible",
459
+ visible: {}
334
460
  }
335
- }
336
- };
337
- case "parameter":
338
- return {
339
- type: "comparison",
340
- comparison: {
341
- operator: "EQUALS",
342
- left: {
343
- type: "parameterId",
344
- parameterId: condition.parameterId
345
- },
346
- right: condition.matches
347
- }
348
- };
349
- default:
350
- return condition;
351
- }
352
- }
353
- function getFormContentOrdering(action, parameterOrdering) {
354
- if (!action.sections) return [];
355
- const parametersToSection = Object.fromEntries(Object.entries(action.sections).flatMap(([sectionId, section]) => section.parameters.map((param) => [param, sectionId])));
356
- const seenIds = /* @__PURE__ */ new Set();
357
- const formContentOrdering = [];
358
- parameterOrdering.forEach((param) => {
359
- if (param in parametersToSection && !seenIds.has(parametersToSection[param])) {
360
- formContentOrdering.push({
361
- type: "sectionId",
362
- sectionId: parametersToSection[param]
363
- });
364
- seenIds.add(parametersToSection[param]);
365
- } else if (!(param in parametersToSection)) {
366
- formContentOrdering.push({
367
- type: "parameterId",
368
- parameterId: param
369
- });
370
- seenIds.add(param);
461
+ },
462
+ conditionalOverrides: section.conditionalOverrides?.map((override) => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible")) ?? []
463
+ }]))
371
464
  }
372
- });
373
- return formContentOrdering;
374
- }
375
- function convertMappingValue(value) {
376
- switch (value.type) {
377
- case "uuid":
378
- return {
379
- type: "uniqueIdentifier",
380
- uniqueIdentifier: {
381
- linkId: value.linkId ?? crypto.randomUUID()
382
- }
383
- };
384
- case "currentTime":
385
- return {
386
- type: "currentTime",
387
- currentTime: {}
388
- };
389
- case "currentUser":
390
- return {
391
- type: "currentUser",
392
- currentUser: {}
393
- };
394
- default:
395
- return value;
396
- }
397
- }
398
- var defaultTypeClasses = [{
399
- kind: "render_hint",
400
- name: "SELECTABLE"
401
- }, {
402
- kind: "render_hint",
403
- name: "SORTABLE"
404
- }];
405
- function shouldNotHaveRenderHints(type) {
406
- return ["struct", "mediaReference", "geotimeSeries"].includes(getPropertyTypeName(type));
407
- }
408
- function hasRenderHints(typeClasses) {
409
- return (typeClasses ?? []).some((tc) => tc.kind.toLowerCase() === "render_hint");
410
- }
411
- function getPropertyTypeName(type) {
412
- return typeof type === "object" ? type.type : type;
413
- }
414
- function convertValueType(valueType) {
415
- return {
416
- apiName: valueType.apiName,
417
- version: valueType.version,
418
- packageNamespace: valueType.packageNamespace,
419
- displayMetadata: valueType.displayMetadata
420
- };
421
- }
422
- function convertValueTypeDataConstraints(dataConstraints) {
423
- if (dataConstraints.length === 0) {
424
- return void 0;
425
- }
426
- const propertyTypeConstraints = dataConstraints.map((constraint) => ({
427
- constraints: dataConstraintToPropertyTypeDataConstraint(constraint.constraint.constraint),
428
- failureMessage: constraint.constraint.failureMessage
429
- }));
430
- return {
431
- propertyTypeConstraints
432
465
  };
433
466
  }
434
- function dataConstraintToPropertyTypeDataConstraint(dc) {
435
- switch (dc.type) {
436
- case "array":
437
- return {
438
- ...dc
439
- };
440
- case "boolean":
441
- return {
442
- ...dc
443
- };
444
- case "binary":
445
- throw new Error("Binary type constraints are not supported");
446
- case "date":
447
- return {
448
- ...dc
449
- };
450
- case "decimal":
451
- return {
452
- ...dc
453
- };
454
- case "double":
455
- return {
456
- ...dc
457
- };
458
- case "float":
459
- return {
460
- ...dc
461
- };
462
- case "integer":
463
- return {
464
- ...dc
465
- };
466
- case "long":
467
- return {
468
- ...dc
469
- };
470
- case "map":
471
- throw new Error("Map type constraints are not supported");
472
- case "nullable":
473
- throw new Error("Nullable constraints are not supported");
474
- case "short":
475
- return {
476
- ...dc
477
- };
478
- case "string":
479
- return {
480
- ...dc
481
- };
482
- case "struct":
483
- return {
484
- type: "struct",
485
- struct: {
486
- elementConstraints: Object.fromEntries(Object.entries(dc.struct.elementConstraints).map(([field, constraint]) => [field, convertDataConstraintToDataConstraints(constraint)]))
487
- }
488
- };
489
- case "structV2":
490
- throw new Error("StructV2 constraints are not supported");
491
- case "timestamp":
492
- return {
493
- ...dc
494
- };
495
- default:
496
- throw new Error(`Unknown DataConstraint type: ${dc.type}`);
467
+ function convertParameterRequirementConstraint(required) {
468
+ if (typeof required === "boolean") {
469
+ return required ? {
470
+ type: "required",
471
+ required: {}
472
+ } : {
473
+ type: "notRequired",
474
+ notRequired: {}
475
+ };
497
476
  }
498
- }
499
- function convertDataConstraintToDataConstraints(dc) {
477
+ const {
478
+ min,
479
+ max
480
+ } = required.listLength;
500
481
  return {
501
- propertyTypeConstraints: [{
502
- constraints: dataConstraintToPropertyTypeDataConstraint(dc)
503
- // known limitation: structs don't carry field-level data constraint failure messages
504
- }]
482
+ type: "listLengthValidation",
483
+ listLengthValidation: {
484
+ minLength: min,
485
+ maxLength: max
486
+ }
505
487
  };
506
488
  }
507
489
  function convertNullabilityToDataConstraint(prop) {
@@ -529,7 +511,17 @@ function convertNullabilityToDataConstraint(prop) {
529
511
  nullabilityV2: prop.nullability
530
512
  };
531
513
  }
532
- function convertType(type) {
514
+
515
+ // src/conversion/toConjure/distributeTypeHelper.ts
516
+ function distributeTypeHelper(type) {
517
+ return {
518
+ type,
519
+ [type]: {}
520
+ };
521
+ }
522
+
523
+ // src/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.ts
524
+ function propertyTypeTypeToOntologyIrType(type) {
533
525
  switch (true) {
534
526
  case (typeof type === "object" && "markingType" in type):
535
527
  return {
@@ -552,14 +544,14 @@ function convertType(type) {
552
544
  },
553
545
  typeClasses: [],
554
546
  aliases: [],
555
- fieldType: convertType(fieldTypeDefinition)
547
+ fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition)
556
548
  };
557
549
  } else {
558
550
  if ("fieldType" in fieldTypeDefinition) {
559
551
  field = {
560
552
  ...fieldTypeDefinition,
561
553
  apiName: key,
562
- fieldType: convertType(fieldTypeDefinition.fieldType),
554
+ fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition.fieldType),
563
555
  typeClasses: fieldTypeDefinition.typeClasses ?? [],
564
556
  aliases: fieldTypeDefinition.aliases ?? []
565
557
  };
@@ -572,7 +564,7 @@ function convertType(type) {
572
564
  },
573
565
  typeClasses: [],
574
566
  aliases: [],
575
- fieldType: convertType(fieldTypeDefinition)
567
+ fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition)
576
568
  };
577
569
  }
578
570
  }
@@ -633,284 +625,207 @@ function convertType(type) {
633
625
  return distributeTypeHelper(type);
634
626
  }
635
627
  }
636
- function distributeTypeHelper(type) {
637
- return {
638
- type,
639
- [type]: {}
640
- };
641
- }
642
628
 
643
- // src/api/defineOntology.ts
644
- var ontologyDefinition;
645
- var importedTypes;
646
- var dependencies;
647
- var namespace;
648
- function updateOntology(entity) {
649
- if (entity.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
650
- ontologyDefinition[entity.__type][entity.apiName] = entity;
651
- return;
652
- }
653
- if (ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] === void 0) {
654
- ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] = [];
655
- }
656
- ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName].push(entity);
657
- }
658
- async function defineOntology(ns, body, outputDir, dependencyFile) {
659
- namespace = ns;
660
- dependencies = {};
661
- ontologyDefinition = {
662
- OBJECT_TYPE: {},
663
- ACTION_TYPE: {},
664
- LINK_TYPE: {},
665
- INTERFACE_TYPE: {},
666
- SHARED_PROPERTY_TYPE: {},
667
- VALUE_TYPE: {}
668
- };
669
- importedTypes = {
670
- SHARED_PROPERTY_TYPE: {},
671
- OBJECT_TYPE: {},
672
- ACTION_TYPE: {},
673
- LINK_TYPE: {},
674
- INTERFACE_TYPE: {},
675
- VALUE_TYPE: {}
676
- };
677
- try {
678
- await body();
679
- } catch (e) {
680
- console.error("Unexpected error while processing the body of the ontology", e);
681
- throw e;
682
- }
683
- if (outputDir) {
684
- writeStaticObjects(outputDir);
685
- }
686
- if (dependencyFile) {
687
- writeDependencyFile(dependencyFile);
688
- }
689
- return convertToWireOntologyIr(ontologyDefinition);
690
- }
691
- function writeStaticObjects(outputDir) {
692
- const codegenDir = path2__namespace.resolve(outputDir, "codegen");
693
- const typeDirs = {
694
- [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: "shared-property-types",
695
- [OntologyEntityTypeEnum.ACTION_TYPE]: "action-types",
696
- [OntologyEntityTypeEnum.OBJECT_TYPE]: "object-types",
697
- [OntologyEntityTypeEnum.LINK_TYPE]: "link-types",
698
- [OntologyEntityTypeEnum.INTERFACE_TYPE]: "interface-types",
699
- [OntologyEntityTypeEnum.VALUE_TYPE]: "value-types"
700
- };
701
- if (!fs__namespace.existsSync(codegenDir)) {
702
- fs__namespace.mkdirSync(codegenDir, {
703
- recursive: true
704
- });
705
- }
706
- Object.values(typeDirs).forEach((typeDirNameFromMap) => {
707
- const currentTypeDirPath = path2__namespace.join(codegenDir, typeDirNameFromMap);
708
- if (fs__namespace.existsSync(currentTypeDirPath)) {
709
- fs__namespace.rmSync(currentTypeDirPath, {
710
- recursive: true,
711
- force: true
712
- });
713
- }
714
- fs__namespace.mkdirSync(currentTypeDirPath, {
715
- recursive: true
716
- });
717
- });
718
- const topLevelExportStatements = [];
719
- Object.entries(ontologyDefinition).forEach(([ontologyTypeEnumKey, entities]) => {
720
- const typeDirName = typeDirs[ontologyTypeEnumKey];
721
- const typeDirPath = path2__namespace.join(codegenDir, typeDirName);
722
- const entityModuleNames = [];
723
- Object.entries(entities).forEach(([apiName, entity]) => {
724
- const entityFileNameBase = camel(withoutNamespace(apiName)) + (ontologyTypeEnumKey === OntologyEntityTypeEnum.VALUE_TYPE ? "ValueType" : "");
725
- const filePath = path2__namespace.join(typeDirPath, `${entityFileNameBase}.ts`);
726
- const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);
727
- const entityJSON = JSON.stringify(entity, null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
728
- const content = `
729
- import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';
730
- import type { ${entityTypeName} } from '@osdk/maker';
731
-
732
- const ${entityFileNameBase}_base: ${entityTypeName} = ${ontologyTypeEnumKey === "VALUE_TYPE" ? entityJSON.slice(1, -2) : entityJSON} as unknown as ${entityTypeName};
733
-
734
- export const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFileNameBase}_base);
735
- `;
736
- fs__namespace.writeFileSync(filePath, content, {
737
- flag: "w"
738
- });
739
- entityModuleNames.push(entityFileNameBase);
740
- });
741
- for (const entityModuleName of entityModuleNames) {
742
- topLevelExportStatements.push(`export { ${entityModuleName} } from "./codegen/${typeDirName}/${entityModuleName}.js";`);
743
- }
629
+ // src/conversion/toMarketplace/convertSpt.ts
630
+ function convertSpt({
631
+ type,
632
+ array,
633
+ description,
634
+ apiName,
635
+ displayName,
636
+ visibility,
637
+ gothamMapping,
638
+ typeClasses,
639
+ valueType,
640
+ nullability
641
+ }) {
642
+ const dataConstraint = convertNullabilityToDataConstraint({
643
+ type,
644
+ nullability
744
645
  });
745
- if (topLevelExportStatements.length > 0) {
746
- const mainIndexContent = dependencyInjectionString() + topLevelExportStatements.join("\n") + "\n";
747
- const mainIndexFilePath = path2__namespace.join(outputDir, "index.ts");
748
- fs__namespace.writeFileSync(mainIndexFilePath, mainIndexContent, {
749
- flag: "w"
750
- });
751
- }
752
- }
753
- function convertOntologyToValueTypeIr(ontology) {
754
646
  return {
755
- valueTypes: convertValueTypesToIr(ontology[OntologyEntityTypeEnum.VALUE_TYPE])
756
- };
757
- }
758
- function convertValueTypesToIr(valueTypes) {
759
- return Object.values(valueTypes).map((definitions) => ({
760
- metadata: {
761
- apiName: definitions[0].apiName,
762
- packageNamespace: definitions[0].packageNamespace,
763
- displayMetadata: definitions[0].displayMetadata,
764
- status: definitions[0].status
647
+ apiName,
648
+ displayMetadata: {
649
+ displayName: displayName ?? apiName,
650
+ visibility: visibility ?? "NORMAL",
651
+ description
765
652
  },
766
- // TODO(dpaquin): instead of deduping here, we should refactor the value type types from arrays to maps
767
- versions: Array.from(new Map(definitions.map((definition) => [definition.version, definition])).values()).map((definition) => ({
768
- version: definition.version,
769
- baseType: definition.baseType,
770
- constraints: definition.constraints,
771
- exampleValues: definition.exampleValues
772
- }))
773
- }));
774
- }
775
- function convertToWireOntologyIr(ontology) {
776
- return {
777
- ontology: convertToWireBlockData(ontology),
778
- importedOntology: convertToWireBlockData(importedTypes),
779
- valueTypes: convertOntologyToValueTypeIr(ontology),
780
- importedValueTypes: convertOntologyToValueTypeIr(importedTypes)
781
- };
782
- }
783
- function convertToWireBlockData(ontology) {
784
- return {
785
- objectTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.OBJECT_TYPE]).map(([apiName, objectType]) => {
786
- return [apiName, convertObject(objectType)];
787
- })),
788
- sharedPropertyTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]).map(([apiName, spt]) => [apiName, {
789
- sharedPropertyType: convertSpt(spt)
790
- }])),
791
- interfaceTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.INTERFACE_TYPE]).map(([apiName, interfaceType]) => {
792
- return [apiName, {
793
- interfaceType: convertInterface(interfaceType)
794
- }];
795
- })),
796
- linkTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.LINK_TYPE]).map(([id, link]) => {
797
- return [id, convertLink(link)];
798
- })),
799
- actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).map(([apiName, action]) => {
800
- return [apiName, convertAction(action)];
801
- })),
802
- blockPermissionInformation: {
803
- actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).filter(([apiName, action]) => action.validation).map(([apiName, action]) => {
804
- return [apiName, {
805
- restrictionStatus: {
806
- hasRolesApplied: true,
807
- ontologyPackageRid: null,
808
- publicProject: false
809
- }
810
- }];
811
- })),
812
- linkTypes: {},
813
- objectTypes: {}
653
+ type: array ? {
654
+ type: "array",
655
+ array: {
656
+ subtype: propertyTypeTypeToOntologyIrType(type)
657
+ }
658
+ } : propertyTypeTypeToOntologyIrType(type),
659
+ aliases: [],
660
+ baseFormatter: void 0,
661
+ dataConstraints: dataConstraint,
662
+ gothamMapping,
663
+ indexedForSearch: true,
664
+ typeClasses: typeClasses ?? [],
665
+ valueType: valueType === void 0 ? void 0 : {
666
+ apiName: valueType.apiName,
667
+ version: valueType.version,
668
+ packageNamespace: valueType.packageNamespace,
669
+ displayMetadata: valueType.displayMetadata
814
670
  }
815
671
  };
816
672
  }
817
- function convertObject(objectType) {
818
- const propertyDatasources = (objectType.properties ?? []).flatMap((prop) => extractPropertyDatasource(prop, objectType.apiName));
819
- const classificationGroupMarkingNames = extractMarkingGroups(objectType.properties ?? [], "CBAC");
820
- const mandatoryMarkingNames = extractMarkingGroups(objectType.properties ?? [], "MANDATORY");
821
- const classificationInputGroup = classificationGroupMarkingNames.length > 0 ? classificationGroupMarkingNames.reduce((l, r) => l + "/" + r) : void 0;
822
- const mandatoryInputGroup = mandatoryMarkingNames.length > 0 ? mandatoryMarkingNames.reduce((l, r) => l + "/" + r) : void 0;
823
- const objectDatasource = buildDatasource(objectType.apiName, convertDatasourceDefinition(objectType, objectType.properties ?? []), classificationInputGroup, mandatoryInputGroup);
824
- const implementations = objectType.implementsInterfaces ?? [];
673
+
674
+ // src/conversion/toMarketplace/convertInterface.ts
675
+ function convertInterface(interfaceType) {
676
+ const {
677
+ __type,
678
+ ...other
679
+ } = interfaceType;
825
680
  return {
826
- objectType: {
827
- displayMetadata: {
828
- description: objectType.description,
829
- displayName: objectType.displayName,
830
- groupDisplayName: void 0,
831
- icon: {
832
- type: "blueprint",
833
- blueprint: objectType.icon ?? {
834
- locator: "cube",
835
- color: "#2D72D2"
836
- }
837
- },
838
- pluralDisplayName: objectType.pluralDisplayName,
839
- visibility: objectType.visibility ?? "NORMAL"
840
- },
841
- primaryKeys: [objectType.primaryKeyPropertyApiName],
842
- propertyTypes: Object.fromEntries(objectType.properties?.map((val) => [val.apiName, convertProperty(val)]) ?? []),
843
- titlePropertyTypeRid: objectType.titlePropertyApiName,
844
- apiName: objectType.apiName,
845
- status: convertObjectStatus(objectType.status),
846
- redacted: false,
847
- implementsInterfaces2: implementations.map((impl) => ({
848
- interfaceTypeApiName: impl.implements.apiName,
849
- linksV2: {},
850
- propertiesV2: {},
851
- properties: Object.fromEntries(impl.propertyMapping.map((mapping) => [addNamespaceIfNone(mapping.interfaceProperty), {
852
- propertyTypeRid: mapping.mapsTo
853
- }]))
854
- })),
855
- allImplementsInterfaces: {}
681
+ ...other,
682
+ propertiesV2: Object.fromEntries(Object.values(interfaceType.propertiesV2).map((spt) => [spt.sharedPropertyType.apiName, {
683
+ required: spt.required,
684
+ sharedPropertyType: convertSpt(spt.sharedPropertyType)
685
+ }])),
686
+ displayMetadata: {
687
+ displayName: interfaceType.displayMetadata.displayName,
688
+ description: interfaceType.displayMetadata.description,
689
+ icon: interfaceType.displayMetadata.icon ?? {
690
+ type: "blueprint",
691
+ blueprint: {
692
+ color: "#4C90F0",
693
+ locator: "layout-hierarchy"
694
+ }
695
+ }
856
696
  },
857
- datasources: [...propertyDatasources, objectDatasource],
858
- entityMetadata: {
859
- arePatchesEnabled: objectType.editsEnabled ?? false
860
- }
697
+ extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
698
+ // these are omitted from our internal types but we need to re-add them for the final json
699
+ properties: [],
700
+ // TODO(mwalther): Support propertiesV3
701
+ propertiesV3: {}
861
702
  };
862
703
  }
863
- function extractPropertyDatasource(property, objectTypeApiName) {
864
- if (!isExotic(property.type)) {
865
- return [];
704
+
705
+ // src/conversion/toMarketplace/convertCardinality.ts
706
+ function convertCardinality(cardinality) {
707
+ if (cardinality === "OneToMany" || cardinality === void 0) {
708
+ return "ONE_TO_MANY";
866
709
  }
867
- const identifier = objectTypeApiName + "." + property.apiName;
868
- switch (property.type) {
869
- case "geotimeSeries":
870
- const geotimeDefinition = {
871
- type: "geotimeSeries",
872
- geotimeSeries: {
873
- geotimeSeriesIntegrationRid: identifier,
874
- properties: [property.apiName]
875
- }
876
- };
877
- return [buildDatasource(property.apiName, geotimeDefinition)];
878
- case "mediaReference":
879
- const mediaSetDefinition = {
880
- type: "mediaSetView",
881
- mediaSetView: {
882
- assumedMarkings: [],
883
- mediaSetViewLocator: identifier,
884
- properties: [property.apiName]
710
+ return "ONE_TO_ONE";
711
+ }
712
+
713
+ // src/conversion/toMarketplace/convertLink.ts
714
+ function convertLink(linkType) {
715
+ let definition;
716
+ let datasource = void 0;
717
+ if ("one" in linkType) {
718
+ definition = {
719
+ type: "oneToMany",
720
+ oneToMany: {
721
+ cardinalityHint: convertCardinality(linkType.cardinality),
722
+ manyToOneLinkMetadata: linkType.toMany.metadata,
723
+ objectTypeRidManySide: linkType.toMany.object.apiName,
724
+ objectTypeRidOneSide: linkType.one.object.apiName,
725
+ oneToManyLinkMetadata: linkType.one.metadata,
726
+ oneSidePrimaryKeyToManySidePropertyMapping: [{
727
+ from: {
728
+ apiName: linkType.one.object.primaryKeyPropertyApiName,
729
+ object: linkType.one.object.apiName
730
+ },
731
+ to: {
732
+ apiName: linkType.manyForeignKeyProperty,
733
+ object: linkType.toMany.object.apiName
734
+ }
735
+ }]
736
+ }
737
+ };
738
+ } else if ("intermediaryObjectType" in linkType) {
739
+ definition = {
740
+ type: "intermediary",
741
+ intermediary: {
742
+ objectTypeAToBLinkMetadata: linkType.many.metadata,
743
+ objectTypeBToALinkMetadata: linkType.toMany.metadata,
744
+ objectTypeRidA: linkType.many.object.apiName,
745
+ objectTypeRidB: linkType.toMany.object.apiName,
746
+ intermediaryObjectTypeRid: linkType.intermediaryObjectType.apiName,
747
+ aToIntermediaryLinkTypeRid: cleanAndValidateLinkTypeId(linkType.many.linkToIntermediary.apiName),
748
+ intermediaryToBLinkTypeRid: cleanAndValidateLinkTypeId(linkType.toMany.linkToIntermediary.apiName)
749
+ }
750
+ };
751
+ } else {
752
+ definition = {
753
+ type: "manyToMany",
754
+ manyToMany: {
755
+ objectTypeAToBLinkMetadata: linkType.many.metadata,
756
+ objectTypeBToALinkMetadata: linkType.toMany.metadata,
757
+ objectTypeRidA: linkType.many.object.apiName,
758
+ objectTypeRidB: linkType.toMany.object.apiName,
759
+ peeringMetadata: void 0,
760
+ objectTypeAPrimaryKeyPropertyMapping: [{
761
+ from: {
762
+ apiName: linkType.many.object.primaryKeyPropertyApiName,
763
+ object: linkType.many.object.apiName
764
+ },
765
+ to: {
766
+ apiName: linkType.many.object.primaryKeyPropertyApiName,
767
+ object: linkType.many.object.apiName
768
+ }
769
+ }],
770
+ objectTypeBPrimaryKeyPropertyMapping: [{
771
+ from: {
772
+ apiName: linkType.toMany.object.primaryKeyPropertyApiName,
773
+ object: linkType.toMany.object.apiName
774
+ },
775
+ to: {
776
+ apiName: linkType.toMany.object.primaryKeyPropertyApiName,
777
+ object: linkType.toMany.object.apiName
778
+ }
779
+ }]
780
+ }
781
+ };
782
+ datasource = {
783
+ datasourceName: linkType.apiName,
784
+ datasource: {
785
+ type: "dataset",
786
+ dataset: {
787
+ datasetRid: "link-".concat(linkType.apiName),
788
+ writebackDatasetRid: void 0,
789
+ objectTypeAPrimaryKeyMapping: [{
790
+ property: {
791
+ apiName: linkType.many.object.primaryKeyPropertyApiName,
792
+ object: linkType.many.object.apiName
793
+ },
794
+ column: linkType.many.object.primaryKeyPropertyApiName
795
+ }],
796
+ objectTypeBPrimaryKeyMapping: [{
797
+ property: {
798
+ apiName: linkType.toMany.object.primaryKeyPropertyApiName,
799
+ object: linkType.toMany.object.apiName
800
+ },
801
+ column: linkType.toMany.object.primaryKeyPropertyApiName
802
+ }]
885
803
  }
886
- };
887
- return [buildDatasource(property.apiName, mediaSetDefinition)];
888
- default:
889
- return [];
804
+ },
805
+ editsConfiguration: {
806
+ onlyAllowPrivilegedEdits: false
807
+ },
808
+ redacted: linkType.redacted
809
+ };
890
810
  }
891
- }
892
- function buildDatasource(apiName, definition, classificationMarkingGroupName, mandatoryMarkingGroupName) {
893
- const needsSecurity = classificationMarkingGroupName !== void 0 || mandatoryMarkingGroupName !== void 0;
894
- const securityConfig = needsSecurity ? {
895
- classificationConstraint: classificationMarkingGroupName ? {
896
- markingGroupName: classificationMarkingGroupName
897
- } : void 0,
898
- markingConstraint: mandatoryMarkingGroupName ? {
899
- markingGroupName: mandatoryMarkingGroupName
900
- } : void 0
901
- } : void 0;
902
811
  return {
903
- rid: "ri.ontology.main.datasource.".concat(apiName),
904
- datasource: definition,
905
- editsConfiguration: {
906
- onlyAllowPrivilegedEdits: false
812
+ linkType: {
813
+ definition,
814
+ id: cleanAndValidateLinkTypeId(linkType.apiName),
815
+ status: linkType.status ?? {
816
+ type: "active",
817
+ active: {}
818
+ },
819
+ redacted: linkType.redacted ?? false
907
820
  },
908
- redacted: false,
909
- ...securityConfig !== void 0 && {
910
- dataSecurity: securityConfig
821
+ datasources: datasource !== void 0 ? [datasource] : [],
822
+ entityMetadata: {
823
+ arePatchesEnabled: linkType.editsEnabled ?? false
911
824
  }
912
825
  };
913
826
  }
827
+
828
+ // src/conversion/toMarketplace/convertDatasourceDefinition.ts
914
829
  function convertDatasourceDefinition(objectType, properties) {
915
830
  switch (objectType.datasource?.type) {
916
831
  case "stream":
@@ -953,14 +868,6 @@ function convertDatasourceDefinition(objectType, properties) {
953
868
  };
954
869
  }
955
870
  }
956
- function extractMarkingGroups(properties, markingType) {
957
- return properties.map((prop) => {
958
- if (typeof prop.type === "object" && prop.type.type === "marking" && prop.type.markingType === markingType) {
959
- return prop.type.markingInputGroupName;
960
- }
961
- return void 0;
962
- }).filter((val) => val !== void 0);
963
- }
964
871
  function buildPropertyMapping(properties) {
965
872
  return Object.fromEntries(properties.map((prop) => {
966
873
  if (prop.editOnly) {
@@ -988,7 +895,128 @@ function buildPropertyMapping(properties) {
988
895
  }];
989
896
  }));
990
897
  }
991
- function convertProperty(property) {
898
+
899
+ // src/api/propertyConversionUtils.ts
900
+ var defaultTypeClasses = [{
901
+ kind: "render_hint",
902
+ name: "SELECTABLE"
903
+ }, {
904
+ kind: "render_hint",
905
+ name: "SORTABLE"
906
+ }];
907
+ function shouldNotHaveRenderHints(type) {
908
+ return ["struct", "mediaReference", "geotimeSeries"].includes(getPropertyTypeName(type));
909
+ }
910
+ function hasRenderHints(typeClasses) {
911
+ return (typeClasses ?? []).some((tc) => tc.kind.toLowerCase() === "render_hint");
912
+ }
913
+ function getPropertyTypeName(type) {
914
+ return typeof type === "object" ? type.type : type;
915
+ }
916
+
917
+ // src/conversion/toMarketplace/convertValueType.ts
918
+ function convertValueType(valueType) {
919
+ return {
920
+ apiName: valueType.apiName,
921
+ version: valueType.version,
922
+ packageNamespace: valueType.packageNamespace,
923
+ displayMetadata: valueType.displayMetadata
924
+ };
925
+ }
926
+
927
+ // src/conversion/toMarketplace/convertDataConstraintToDataConstraints.ts
928
+ function convertDataConstraintToDataConstraints(dc) {
929
+ return {
930
+ propertyTypeConstraints: [{
931
+ constraints: dataConstraintToPropertyTypeDataConstraint(dc)
932
+ // known limitation: structs don't carry field-level data constraint failure messages
933
+ }]
934
+ };
935
+ }
936
+
937
+ // src/conversion/toMarketplace/dataConstraintToPropertyTypeDataConstraint.ts
938
+ function dataConstraintToPropertyTypeDataConstraint(dc) {
939
+ switch (dc.type) {
940
+ case "array":
941
+ return {
942
+ ...dc
943
+ };
944
+ case "boolean":
945
+ return {
946
+ ...dc
947
+ };
948
+ case "binary":
949
+ throw new Error("Binary type constraints are not supported");
950
+ case "date":
951
+ return {
952
+ ...dc
953
+ };
954
+ case "decimal":
955
+ return {
956
+ ...dc
957
+ };
958
+ case "double":
959
+ return {
960
+ ...dc
961
+ };
962
+ case "float":
963
+ return {
964
+ ...dc
965
+ };
966
+ case "integer":
967
+ return {
968
+ ...dc
969
+ };
970
+ case "long":
971
+ return {
972
+ ...dc
973
+ };
974
+ case "map":
975
+ throw new Error("Map type constraints are not supported");
976
+ case "nullable":
977
+ throw new Error("Nullable constraints are not supported");
978
+ case "short":
979
+ return {
980
+ ...dc
981
+ };
982
+ case "string":
983
+ return {
984
+ ...dc
985
+ };
986
+ case "struct":
987
+ return {
988
+ type: "struct",
989
+ struct: {
990
+ elementConstraints: Object.fromEntries(Object.entries(dc.struct.elementConstraints).map(([field, constraint]) => [field, convertDataConstraintToDataConstraints(constraint)]))
991
+ }
992
+ };
993
+ case "structV2":
994
+ throw new Error("StructV2 constraints are not supported");
995
+ case "timestamp":
996
+ return {
997
+ ...dc
998
+ };
999
+ default:
1000
+ throw new Error(`Unknown DataConstraint type: ${dc.type}`);
1001
+ }
1002
+ }
1003
+
1004
+ // src/conversion/toMarketplace/convertValueTypeDataConstraints.ts
1005
+ function convertValueTypeDataConstraints(dataConstraints) {
1006
+ if (dataConstraints.length === 0) {
1007
+ return void 0;
1008
+ }
1009
+ const propertyTypeConstraints = dataConstraints.map((constraint) => ({
1010
+ constraints: dataConstraintToPropertyTypeDataConstraint(constraint.constraint.constraint),
1011
+ failureMessage: constraint.constraint.failureMessage
1012
+ }));
1013
+ return {
1014
+ propertyTypeConstraints
1015
+ };
1016
+ }
1017
+
1018
+ // src/conversion/toMarketplace/convertObjectPropertyType.ts
1019
+ function convertObjectPropertyType(property) {
992
1020
  const apiName = namespace + property.apiName;
993
1021
  !(!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;
994
1022
  const output = {
@@ -1005,9 +1033,9 @@ function convertProperty(property) {
1005
1033
  type: property.array ? {
1006
1034
  type: "array",
1007
1035
  array: {
1008
- subtype: convertType(property.type)
1036
+ subtype: propertyTypeTypeToOntologyIrType(property.type)
1009
1037
  }
1010
- } : convertType(property.type),
1038
+ } : propertyTypeTypeToOntologyIrType(property.type),
1011
1039
  typeClasses: property.typeClasses ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),
1012
1040
  status: convertObjectStatus(property.status),
1013
1041
  inlineAction: void 0,
@@ -1017,103 +1045,318 @@ function convertProperty(property) {
1017
1045
  };
1018
1046
  return output;
1019
1047
  }
1020
- function convertLink(linkType) {
1021
- let definition;
1022
- let datasource = void 0;
1023
- if ("one" in linkType) {
1024
- definition = {
1025
- type: "oneToMany",
1026
- oneToMany: {
1027
- cardinalityHint: convertCardinality(linkType.cardinality),
1028
- manyToOneLinkMetadata: linkType.toMany.metadata,
1029
- objectTypeRidManySide: linkType.toMany.object.apiName,
1030
- objectTypeRidOneSide: linkType.one.object.apiName,
1031
- oneToManyLinkMetadata: linkType.one.metadata,
1032
- oneSidePrimaryKeyToManySidePropertyMapping: [{
1033
- from: {
1034
- apiName: linkType.one.object.primaryKeyPropertyApiName,
1035
- object: linkType.one.object.apiName
1036
- },
1037
- to: {
1038
- apiName: linkType.manyForeignKeyProperty,
1039
- object: linkType.toMany.object.apiName
1040
- }
1041
- }]
1042
- }
1043
- };
1044
- } else {
1045
- definition = {
1046
- type: "manyToMany",
1047
- manyToMany: {
1048
- objectTypeAToBLinkMetadata: linkType.many.metadata,
1049
- objectTypeBToALinkMetadata: linkType.toMany.metadata,
1050
- objectTypeRidA: linkType.many.object.apiName,
1051
- objectTypeRidB: linkType.toMany.object.apiName,
1052
- peeringMetadata: void 0,
1053
- objectTypeAPrimaryKeyPropertyMapping: [{
1054
- from: {
1055
- apiName: linkType.many.object.primaryKeyPropertyApiName,
1056
- object: linkType.many.object.apiName
1057
- },
1058
- to: {
1059
- apiName: linkType.many.object.primaryKeyPropertyApiName,
1060
- object: linkType.many.object.apiName
1061
- }
1062
- }],
1063
- objectTypeBPrimaryKeyPropertyMapping: [{
1064
- from: {
1065
- apiName: linkType.toMany.object.primaryKeyPropertyApiName,
1066
- object: linkType.toMany.object.apiName
1067
- },
1068
- to: {
1069
- apiName: linkType.toMany.object.primaryKeyPropertyApiName,
1070
- object: linkType.toMany.object.apiName
1048
+
1049
+ // src/conversion/toMarketplace/convertObject.ts
1050
+ function convertObject(objectType) {
1051
+ const propertyDatasources = (objectType.properties ?? []).flatMap((prop) => extractPropertyDatasource(prop, objectType.apiName));
1052
+ const classificationGroupMarkingNames = extractMarkingGroups(objectType.properties ?? [], "CBAC");
1053
+ const mandatoryMarkingNames = extractMarkingGroups(objectType.properties ?? [], "MANDATORY");
1054
+ const classificationInputGroup = classificationGroupMarkingNames.length > 0 ? classificationGroupMarkingNames.reduce((l, r) => l + "/" + r) : void 0;
1055
+ const mandatoryInputGroup = mandatoryMarkingNames.length > 0 ? mandatoryMarkingNames.reduce((l, r) => l + "/" + r) : void 0;
1056
+ const objectDatasource = buildDatasource(objectType.apiName, convertDatasourceDefinition(objectType, objectType.properties ?? []), classificationInputGroup, mandatoryInputGroup);
1057
+ const implementations = objectType.implementsInterfaces ?? [];
1058
+ return {
1059
+ objectType: {
1060
+ displayMetadata: {
1061
+ description: objectType.description,
1062
+ displayName: objectType.displayName,
1063
+ groupDisplayName: void 0,
1064
+ icon: {
1065
+ type: "blueprint",
1066
+ blueprint: objectType.icon ?? {
1067
+ locator: "cube",
1068
+ color: "#2D72D2"
1071
1069
  }
1072
- }]
1073
- }
1074
- };
1075
- datasource = {
1076
- rid: "ri.ontology.main.datasource.link-".concat(linkType.apiName),
1077
- datasource: {
1078
- type: "dataset",
1079
- dataset: {
1080
- datasetRid: "link-".concat(linkType.apiName),
1081
- writebackDatasetRid: void 0,
1082
- objectTypeAPrimaryKeyMapping: [{
1083
- property: {
1084
- apiName: linkType.many.object.primaryKeyPropertyApiName,
1085
- object: linkType.many.object.apiName
1086
- },
1087
- column: linkType.many.object.primaryKeyPropertyApiName
1088
- }],
1089
- objectTypeBPrimaryKeyMapping: [{
1090
- property: {
1091
- apiName: linkType.toMany.object.primaryKeyPropertyApiName,
1092
- object: linkType.toMany.object.apiName
1093
- },
1094
- column: linkType.toMany.object.primaryKeyPropertyApiName
1095
- }]
1096
- }
1097
- },
1098
- editsConfiguration: {
1099
- onlyAllowPrivilegedEdits: false
1070
+ },
1071
+ pluralDisplayName: objectType.pluralDisplayName,
1072
+ visibility: objectType.visibility ?? "NORMAL"
1100
1073
  },
1101
- redacted: linkType.redacted
1102
- };
1074
+ primaryKeys: [objectType.primaryKeyPropertyApiName],
1075
+ propertyTypes: Object.fromEntries(objectType.properties?.map((val) => [val.apiName, convertObjectPropertyType(val)]) ?? []),
1076
+ titlePropertyTypeRid: objectType.titlePropertyApiName,
1077
+ apiName: objectType.apiName,
1078
+ status: convertObjectStatus(objectType.status),
1079
+ redacted: false,
1080
+ implementsInterfaces2: implementations.map((impl) => ({
1081
+ interfaceTypeApiName: impl.implements.apiName,
1082
+ linksV2: {},
1083
+ propertiesV2: {},
1084
+ properties: Object.fromEntries(impl.propertyMapping.map((mapping) => [addNamespaceIfNone(mapping.interfaceProperty), {
1085
+ propertyTypeRid: mapping.mapsTo
1086
+ }]))
1087
+ })),
1088
+ allImplementsInterfaces: {}
1089
+ },
1090
+ datasources: [...propertyDatasources, objectDatasource],
1091
+ entityMetadata: {
1092
+ arePatchesEnabled: objectType.editsEnabled ?? false
1093
+ }
1094
+ };
1095
+ }
1096
+ function extractMarkingGroups(properties, markingType) {
1097
+ return properties.map((prop) => {
1098
+ if (typeof prop.type === "object" && prop.type.type === "marking" && prop.type.markingType === markingType) {
1099
+ return prop.type.markingInputGroupName;
1100
+ }
1101
+ return void 0;
1102
+ }).filter((val) => val !== void 0);
1103
+ }
1104
+ function extractPropertyDatasource(property, objectTypeApiName) {
1105
+ if (!isExotic(property.type)) {
1106
+ return [];
1107
+ }
1108
+ const identifier = objectTypeApiName + "." + property.apiName;
1109
+ switch (property.type) {
1110
+ case "geotimeSeries":
1111
+ const geotimeDefinition = {
1112
+ type: "geotimeSeries",
1113
+ geotimeSeries: {
1114
+ geotimeSeriesIntegrationRid: identifier,
1115
+ properties: [property.apiName]
1116
+ }
1117
+ };
1118
+ return [buildDatasource(property.apiName, geotimeDefinition)];
1119
+ case "mediaReference":
1120
+ const mediaSetDefinition = {
1121
+ type: "mediaSetView",
1122
+ mediaSetView: {
1123
+ assumedMarkings: [],
1124
+ mediaSetViewLocator: identifier,
1125
+ properties: [property.apiName]
1126
+ }
1127
+ };
1128
+ return [buildDatasource(property.apiName, mediaSetDefinition)];
1129
+ default:
1130
+ return [];
1131
+ }
1132
+ }
1133
+
1134
+ // src/conversion/toMarketplace/convertOntologyDefinitionToWireBlockData.ts
1135
+ function convertOntologyDefinitionToWireBlockData(ontology) {
1136
+ return {
1137
+ objectTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.OBJECT_TYPE]).map(([apiName, objectType]) => {
1138
+ return [apiName, convertObject(objectType)];
1139
+ })),
1140
+ sharedPropertyTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]).map(([apiName, spt]) => [apiName, {
1141
+ sharedPropertyType: convertSpt(spt)
1142
+ }])),
1143
+ interfaceTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.INTERFACE_TYPE]).map(([apiName, interfaceType]) => {
1144
+ return [apiName, {
1145
+ interfaceType: convertInterface(interfaceType)
1146
+ }];
1147
+ })),
1148
+ linkTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.LINK_TYPE]).map(([id, link]) => {
1149
+ return [cleanAndValidateLinkTypeId(id), convertLink(link)];
1150
+ })),
1151
+ actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).map(([apiName, action]) => {
1152
+ return [apiName, convertAction(action)];
1153
+ })),
1154
+ blockPermissionInformation: {
1155
+ actionTypes: Object.fromEntries(Object.entries(ontology[OntologyEntityTypeEnum.ACTION_TYPE]).filter(([apiName, action]) => action.validation).map(([apiName, action]) => {
1156
+ return [apiName, {
1157
+ restrictionStatus: {
1158
+ hasRolesApplied: true,
1159
+ ontologyPackageRid: null,
1160
+ publicProject: false
1161
+ }
1162
+ }];
1163
+ })),
1164
+ linkTypes: {},
1165
+ objectTypes: {}
1166
+ }
1167
+ };
1168
+ }
1169
+
1170
+ // src/conversion/toMarketplace/convertValueTypesToIr.ts
1171
+ function convertValueTypesToIr(valueTypes) {
1172
+ return Object.values(valueTypes).map((definitions) => ({
1173
+ metadata: {
1174
+ apiName: definitions[0].apiName,
1175
+ packageNamespace: definitions[0].packageNamespace,
1176
+ displayMetadata: definitions[0].displayMetadata,
1177
+ status: definitions[0].status
1178
+ },
1179
+ // TODO(dpaquin): instead of deduping here, we should refactor the value type types from arrays to maps
1180
+ versions: Array.from(new Map(definitions.map((definition) => [definition.version, definition])).values()).map((definition) => ({
1181
+ version: definition.version,
1182
+ baseType: definition.baseType,
1183
+ constraints: definition.constraints,
1184
+ exampleValues: definition.exampleValues
1185
+ }))
1186
+ }));
1187
+ }
1188
+
1189
+ // src/conversion/toMarketplace/convertOntologyToValueTypeIr.ts
1190
+ function convertOntologyToValueTypeIr(ontology) {
1191
+ return {
1192
+ valueTypes: convertValueTypesToIr(ontology[OntologyEntityTypeEnum.VALUE_TYPE])
1193
+ };
1194
+ }
1195
+
1196
+ // src/conversion/toMarketplace/convertOntologyDefinition.ts
1197
+ function convertOntologyDefinition(ontology, randomnessKey) {
1198
+ return {
1199
+ ontology: convertOntologyDefinitionToWireBlockData(ontology),
1200
+ importedOntology: convertOntologyDefinitionToWireBlockData(importedTypes),
1201
+ valueTypes: convertOntologyToValueTypeIr(ontology),
1202
+ importedValueTypes: convertOntologyToValueTypeIr(importedTypes),
1203
+ randomnessKey
1204
+ };
1205
+ }
1206
+
1207
+ // src/conversion/toMarketplace/getFormContentOrdering.ts
1208
+ function getFormContentOrdering(action, parameterOrdering) {
1209
+ if (!action.sections) return [];
1210
+ const parametersToSection = Object.fromEntries(Object.entries(action.sections).flatMap(([sectionId, section]) => section.parameters.map((param) => [param, sectionId])));
1211
+ const seenIds = /* @__PURE__ */ new Set();
1212
+ const formContentOrdering = [];
1213
+ parameterOrdering.forEach((param) => {
1214
+ if (param in parametersToSection && !seenIds.has(parametersToSection[param])) {
1215
+ formContentOrdering.push({
1216
+ type: "sectionId",
1217
+ sectionId: parametersToSection[param]
1218
+ });
1219
+ seenIds.add(parametersToSection[param]);
1220
+ } else if (!(param in parametersToSection)) {
1221
+ formContentOrdering.push({
1222
+ type: "parameterId",
1223
+ parameterId: param
1224
+ });
1225
+ seenIds.add(param);
1226
+ }
1227
+ });
1228
+ return formContentOrdering;
1229
+ }
1230
+
1231
+ // src/api/defineOntology.ts
1232
+ var ontologyDefinition;
1233
+ var importedTypes;
1234
+ var dependencies;
1235
+ var namespace;
1236
+ function updateOntology(entity) {
1237
+ if (entity.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
1238
+ ontologyDefinition[entity.__type][entity.apiName] = entity;
1239
+ return;
1240
+ }
1241
+ if (ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] === void 0) {
1242
+ ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] = [];
1243
+ }
1244
+ ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName].push(entity);
1245
+ }
1246
+ async function defineOntology(ns, body, outputDir, dependencyFile, randomnessKey) {
1247
+ namespace = ns;
1248
+ dependencies = {};
1249
+ ontologyDefinition = {
1250
+ OBJECT_TYPE: {},
1251
+ ACTION_TYPE: {},
1252
+ LINK_TYPE: {},
1253
+ INTERFACE_TYPE: {},
1254
+ SHARED_PROPERTY_TYPE: {},
1255
+ VALUE_TYPE: {}
1256
+ };
1257
+ importedTypes = {
1258
+ SHARED_PROPERTY_TYPE: {},
1259
+ OBJECT_TYPE: {},
1260
+ ACTION_TYPE: {},
1261
+ LINK_TYPE: {},
1262
+ INTERFACE_TYPE: {},
1263
+ VALUE_TYPE: {}
1264
+ };
1265
+ try {
1266
+ await body();
1267
+ } catch (e) {
1268
+ console.error("Unexpected error while processing the body of the ontology", e);
1269
+ throw e;
1270
+ }
1271
+ if (outputDir) {
1272
+ writeStaticObjects(outputDir);
1273
+ }
1274
+ if (dependencyFile) {
1275
+ writeDependencyFile(dependencyFile);
1276
+ }
1277
+ return convertOntologyDefinition(ontologyDefinition, randomnessKey);
1278
+ }
1279
+ function writeStaticObjects(outputDir) {
1280
+ const codegenDir = path2__namespace.resolve(outputDir, "codegen");
1281
+ const typeDirs = {
1282
+ [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: "shared-property-types",
1283
+ [OntologyEntityTypeEnum.ACTION_TYPE]: "action-types",
1284
+ [OntologyEntityTypeEnum.OBJECT_TYPE]: "object-types",
1285
+ [OntologyEntityTypeEnum.LINK_TYPE]: "link-types",
1286
+ [OntologyEntityTypeEnum.INTERFACE_TYPE]: "interface-types",
1287
+ [OntologyEntityTypeEnum.VALUE_TYPE]: "value-types"
1288
+ };
1289
+ if (!fs__namespace.existsSync(codegenDir)) {
1290
+ fs__namespace.mkdirSync(codegenDir, {
1291
+ recursive: true
1292
+ });
1293
+ }
1294
+ Object.values(typeDirs).forEach((typeDirNameFromMap) => {
1295
+ const currentTypeDirPath = path2__namespace.join(codegenDir, typeDirNameFromMap);
1296
+ if (fs__namespace.existsSync(currentTypeDirPath)) {
1297
+ fs__namespace.rmSync(currentTypeDirPath, {
1298
+ recursive: true,
1299
+ force: true
1300
+ });
1301
+ }
1302
+ fs__namespace.mkdirSync(currentTypeDirPath, {
1303
+ recursive: true
1304
+ });
1305
+ });
1306
+ const topLevelExportStatements = [];
1307
+ Object.entries(ontologyDefinition).forEach(([ontologyTypeEnumKey, entities]) => {
1308
+ const typeDirName = typeDirs[ontologyTypeEnumKey];
1309
+ const typeDirPath = path2__namespace.join(codegenDir, typeDirName);
1310
+ const entityModuleNames = [];
1311
+ Object.entries(entities).forEach(([apiName, entity]) => {
1312
+ const entityFileNameBase = camel(withoutNamespace(apiName)) + (ontologyTypeEnumKey === OntologyEntityTypeEnum.VALUE_TYPE ? "ValueType" : "");
1313
+ const filePath = path2__namespace.join(typeDirPath, `${entityFileNameBase}.ts`);
1314
+ const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);
1315
+ const entityJSON = JSON.stringify(entity, null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
1316
+ const content = `
1317
+ import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';
1318
+ import type { ${entityTypeName} } from '@osdk/maker';
1319
+
1320
+ const ${entityFileNameBase}_base: ${entityTypeName} = ${ontologyTypeEnumKey === "VALUE_TYPE" ? entityJSON.slice(1, -2) : entityJSON} as unknown as ${entityTypeName};
1321
+
1322
+ export const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFileNameBase}_base);
1323
+ `;
1324
+ fs__namespace.writeFileSync(filePath, content, {
1325
+ flag: "w"
1326
+ });
1327
+ entityModuleNames.push(entityFileNameBase);
1328
+ });
1329
+ for (const entityModuleName of entityModuleNames) {
1330
+ topLevelExportStatements.push(`export { ${entityModuleName} } from "./codegen/${typeDirName}/${entityModuleName}.js";`);
1331
+ }
1332
+ });
1333
+ if (topLevelExportStatements.length > 0) {
1334
+ const mainIndexContent = dependencyInjectionString() + topLevelExportStatements.join("\n") + "\n";
1335
+ const mainIndexFilePath = path2__namespace.join(outputDir, "index.ts");
1336
+ fs__namespace.writeFileSync(mainIndexFilePath, mainIndexContent, {
1337
+ flag: "w"
1338
+ });
1103
1339
  }
1340
+ }
1341
+ function buildDatasource(apiName, definition, classificationMarkingGroupName, mandatoryMarkingGroupName) {
1342
+ const needsSecurity = classificationMarkingGroupName !== void 0 || mandatoryMarkingGroupName !== void 0;
1343
+ const securityConfig = needsSecurity ? {
1344
+ classificationConstraint: classificationMarkingGroupName ? {
1345
+ markingGroupName: classificationMarkingGroupName
1346
+ } : void 0,
1347
+ markingConstraint: mandatoryMarkingGroupName ? {
1348
+ markingGroupName: mandatoryMarkingGroupName
1349
+ } : void 0
1350
+ } : void 0;
1104
1351
  return {
1105
- linkType: {
1106
- definition,
1107
- id: cleanAndValidateLinkTypeId(linkType.apiName),
1108
- status: linkType.status ?? {
1109
- type: "active",
1110
- active: {}
1111
- },
1112
- redacted: linkType.redacted ?? false
1352
+ datasourceName: apiName,
1353
+ datasource: definition,
1354
+ editsConfiguration: {
1355
+ onlyAllowPrivilegedEdits: false
1113
1356
  },
1114
- datasources: datasource !== void 0 ? [datasource] : [],
1115
- entityMetadata: {
1116
- arePatchesEnabled: linkType.editsEnabled ?? false
1357
+ redacted: false,
1358
+ ...securityConfig !== void 0 && {
1359
+ dataSecurity: securityConfig
1117
1360
  }
1118
1361
  };
1119
1362
  }
@@ -1126,73 +1369,8 @@ function cleanAndValidateLinkTypeId(apiName) {
1126
1369
  }
1127
1370
  return linkTypeId;
1128
1371
  }
1129
- function convertInterface(interfaceType) {
1130
- const {
1131
- __type,
1132
- ...other
1133
- } = interfaceType;
1134
- return {
1135
- ...other,
1136
- propertiesV2: Object.fromEntries(Object.values(interfaceType.propertiesV2).map((spt) => [spt.sharedPropertyType.apiName, {
1137
- required: spt.required,
1138
- sharedPropertyType: convertSpt(spt.sharedPropertyType)
1139
- }])),
1140
- displayMetadata: {
1141
- displayName: interfaceType.displayMetadata.displayName,
1142
- description: interfaceType.displayMetadata.description
1143
- },
1144
- extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
1145
- // these are omitted from our internal types but we need to re-add them for the final json
1146
- properties: [],
1147
- // TODO(mwalther): Support propertiesV3
1148
- propertiesV3: {}
1149
- };
1150
- }
1151
1372
  function dumpOntologyFullMetadata() {
1152
- return convertToWireOntologyIr(ontologyDefinition);
1153
- }
1154
- function convertSpt({
1155
- type,
1156
- array,
1157
- description,
1158
- apiName,
1159
- displayName,
1160
- visibility,
1161
- gothamMapping,
1162
- typeClasses,
1163
- valueType,
1164
- nullability
1165
- }) {
1166
- const dataConstraint = convertNullabilityToDataConstraint({
1167
- type,
1168
- nullability
1169
- });
1170
- return {
1171
- apiName,
1172
- displayMetadata: {
1173
- displayName: displayName ?? apiName,
1174
- visibility: visibility ?? "NORMAL",
1175
- description
1176
- },
1177
- type: array ? {
1178
- type: "array",
1179
- array: {
1180
- subtype: convertType(type)
1181
- }
1182
- } : convertType(type),
1183
- aliases: [],
1184
- baseFormatter: void 0,
1185
- dataConstraints: dataConstraint,
1186
- gothamMapping,
1187
- indexedForSearch: true,
1188
- typeClasses: typeClasses ?? [],
1189
- valueType: valueType === void 0 ? void 0 : {
1190
- apiName: valueType.apiName,
1191
- version: valueType.version,
1192
- packageNamespace: valueType.packageNamespace,
1193
- displayMetadata: valueType.displayMetadata
1194
- }
1195
- };
1373
+ return convertOntologyDefinition(ontologyDefinition);
1196
1374
  }
1197
1375
  function convertObjectStatus(status) {
1198
1376
  if (status === void 0) {
@@ -1239,143 +1417,54 @@ function convertAction(action) {
1239
1417
  validation: actionValidation
1240
1418
  },
1241
1419
  metadata: {
1242
- apiName: action.apiName,
1243
- displayMetadata: {
1244
- configuration: {
1245
- defaultLayout: action.defaultFormat ?? "FORM",
1246
- displayAndFormat: action.displayAndFormat ?? {
1247
- table: {
1248
- columnWidthByParameterRid: {},
1249
- enableFileImport: true,
1250
- fitHorizontally: false,
1251
- frozenColumnCount: 0,
1252
- rowHeightInLines: 1
1253
- }
1254
- },
1255
- enableLayoutUserSwitch: action.enableLayoutSwitch ?? false
1256
- },
1257
- description: action.description ?? "",
1258
- displayName: action.displayName,
1259
- icon: {
1260
- type: "blueprint",
1261
- blueprint: action.icon ?? {
1262
- locator: "edit",
1263
- color: "#000000"
1264
- }
1265
- },
1266
- successMessage: action.submissionMetadata?.successMessage ? [{
1267
- type: "message",
1268
- message: action.submissionMetadata.successMessage
1269
- }] : [],
1270
- typeClasses: action.typeClasses ?? [],
1271
- ...action.submissionMetadata?.submitButtonDisplayMetadata && {
1272
- submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
1273
- },
1274
- ...action.submissionMetadata?.undoButtonConfiguration && {
1275
- undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
1276
- }
1277
- },
1278
- parameterOrdering,
1279
- formContentOrdering: getFormContentOrdering(action, parameterOrdering),
1280
- parameters: actionParameters,
1281
- sections: actionSections,
1282
- status: typeof action.status === "string" ? {
1283
- type: action.status,
1284
- [action.status]: {}
1285
- } : action.status,
1286
- entities: action.entities
1287
- }
1288
- }
1289
- };
1290
- }
1291
- function convertActionValidation(action) {
1292
- return {
1293
- actionTypeLevelValidation: {
1294
- rules: Object.fromEntries((action.validation ?? [{
1295
- condition: {
1296
- type: "true",
1297
- true: {}
1298
- },
1299
- displayMetadata: {
1300
- failureMessage: "",
1301
- typeClasses: []
1302
- }
1303
- }]).map((rule, idx) => [idx, rule]))
1304
- },
1305
- parameterValidations: Object.fromEntries((action.parameters ?? []).map((p) => {
1306
- return [p.id, {
1307
- defaultValidation: {
1308
- display: {
1309
- renderHint: renderHintFromBaseType(p),
1310
- visibility: convertActionVisibility(p.validation.defaultVisibility),
1311
- ...p.defaultValue && {
1312
- prefill: p.defaultValue
1313
- }
1314
- },
1315
- validation: {
1316
- allowedValues: extractAllowedValues(p.validation.allowedValues),
1317
- required: convertParameterRequirementConstraint(p.validation.required)
1318
- }
1319
- },
1320
- conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation)) ?? []
1321
- }];
1322
- })),
1323
- sectionValidations: {
1324
- ...Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [section.id, {
1325
- defaultDisplayMetadata: section.defaultVisibility === "hidden" ? {
1326
- visibility: {
1327
- type: "hidden",
1328
- hidden: {}
1329
- }
1330
- } : {
1331
- visibility: {
1332
- type: "visible",
1333
- visible: {}
1334
- }
1335
- },
1336
- conditionalOverrides: section.conditionalOverrides?.map((override) => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible")) ?? []
1337
- }]))
1338
- }
1339
- };
1340
- }
1341
- function convertActionParameters(action) {
1342
- return Object.fromEntries((action.parameters ?? []).map((p) => [p.id, {
1343
- id: p.id,
1344
- type: typeof p.type === "string" ? {
1345
- type: p.type,
1346
- [p.type]: {}
1347
- } : p.type,
1348
- displayMetadata: {
1349
- displayName: p.displayName,
1350
- description: p.description ?? "",
1351
- typeClasses: []
1352
- }
1353
- }]));
1354
- }
1355
- function convertActionSections(action) {
1356
- return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [sectionId, {
1357
- id: sectionId,
1358
- content: section.parameters.map((p) => ({
1359
- type: "parameterId",
1360
- parameterId: p
1361
- })),
1362
- displayMetadata: {
1363
- collapsedByDefault: section.collapsedByDefault ?? false,
1364
- columnCount: section.columnCount ?? 1,
1365
- description: section.description ?? "",
1366
- displayName: section.displayName ?? convertToDisplayName(sectionId),
1367
- showTitleBar: section.showTitleBar ?? true,
1368
- ...section.style && {
1369
- style: section.style === "box" ? {
1370
- type: "box",
1371
- box: {}
1372
- } : {
1373
- type: "minimal",
1374
- minimal: {}
1375
- }
1420
+ apiName: action.apiName,
1421
+ displayMetadata: {
1422
+ configuration: {
1423
+ defaultLayout: action.defaultFormat ?? "FORM",
1424
+ displayAndFormat: action.displayAndFormat ?? {
1425
+ table: {
1426
+ columnWidthByParameterRid: {},
1427
+ enableFileImport: true,
1428
+ fitHorizontally: false,
1429
+ frozenColumnCount: 0,
1430
+ rowHeightInLines: 1
1431
+ }
1432
+ },
1433
+ enableLayoutUserSwitch: action.enableLayoutSwitch ?? false
1434
+ },
1435
+ description: action.description ?? "",
1436
+ displayName: action.displayName,
1437
+ icon: {
1438
+ type: "blueprint",
1439
+ blueprint: action.icon ?? {
1440
+ locator: "edit",
1441
+ color: "#000000"
1442
+ }
1443
+ },
1444
+ successMessage: action.submissionMetadata?.successMessage ? [{
1445
+ type: "message",
1446
+ message: action.submissionMetadata.successMessage
1447
+ }] : [],
1448
+ typeClasses: action.typeClasses ?? [],
1449
+ ...action.submissionMetadata?.submitButtonDisplayMetadata && {
1450
+ submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
1451
+ },
1452
+ ...action.submissionMetadata?.undoButtonConfiguration && {
1453
+ undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
1454
+ }
1455
+ },
1456
+ parameterOrdering,
1457
+ formContentOrdering: getFormContentOrdering(action, parameterOrdering),
1458
+ parameters: actionParameters,
1459
+ sections: actionSections,
1460
+ status: typeof action.status === "string" ? {
1461
+ type: action.status,
1462
+ [action.status]: {}
1463
+ } : action.status,
1464
+ entities: action.entities
1376
1465
  }
1377
1466
  }
1378
- }]));
1467
+ };
1379
1468
  }
1380
1469
  function extractAllowedValues(allowedValues) {
1381
1470
  switch (allowedValues.type) {
@@ -1574,31 +1663,6 @@ function renderHintFromBaseType(parameter) {
1574
1663
  throw new Error(`Unknown type ${type}`);
1575
1664
  }
1576
1665
  }
1577
- function convertParameterRequirementConstraint(required) {
1578
- if (typeof required === "boolean") {
1579
- return required ? {
1580
- type: "required",
1581
- required: {}
1582
- } : {
1583
- type: "notRequired",
1584
- notRequired: {}
1585
- };
1586
- }
1587
- const {
1588
- min,
1589
- max
1590
- } = required.listLength;
1591
- return {
1592
- type: "listLengthValidation",
1593
- listLengthValidation: {
1594
- minLength: min,
1595
- maxLength: max
1596
- }
1597
- };
1598
- }
1599
- function sanitize(namespace2, s) {
1600
- return s.includes(".") ? s : namespace2 + s;
1601
- }
1602
1666
  function withoutNamespace(apiName) {
1603
1667
  const lastDot = apiName.lastIndexOf(".");
1604
1668
  if (lastDot === -1) {
@@ -1637,17 +1701,11 @@ addDependency("${namespaceNoDot}", new URL(import.meta.url).pathname);
1637
1701
  function addNamespaceIfNone(apiName) {
1638
1702
  return apiName.includes(".") ? apiName : namespace + apiName;
1639
1703
  }
1640
- function convertCardinality(cardinality) {
1641
- if (cardinality === "OneToMany" || cardinality === void 0) {
1642
- return "ONE_TO_MANY";
1643
- }
1644
- return "ONE_TO_ONE";
1645
- }
1646
1704
 
1647
1705
  // src/cli/main.ts
1648
1706
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
1649
1707
  async function main(args = process.argv) {
1650
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.8").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1708
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1651
1709
  input: {
1652
1710
  alias: "i",
1653
1711
  describe: "Input file",
@@ -1690,6 +1748,11 @@ async function main(args = process.argv) {
1690
1748
  describe: "File to write dependencies to",
1691
1749
  type: "string",
1692
1750
  coerce: path2__namespace.resolve
1751
+ },
1752
+ randomnessKey: {
1753
+ describe: "Value used to assure uniqueness of entities",
1754
+ type: "string",
1755
+ coerce: path2__namespace.resolve
1693
1756
  }
1694
1757
  }).parseAsync();
1695
1758
  let apiNamespace = "";
@@ -1699,6 +1762,9 @@ async function main(args = process.argv) {
1699
1762
  !apiNamespaceRegex.test(apiNamespace) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(.[a-z0-9-]+)*.$") : invariant5__default.default(false) : void 0;
1700
1763
  }
1701
1764
  consola.consola.info(`Loading ontology from ${commandLineOpts.input}`);
1765
+ if (commandLineOpts.randomnessKey !== void 0) {
1766
+ !uuid.validate(commandLineOpts.randomnessKey) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Supplied randomness key is not a uuid and shouldn't be used as a uniqueness guarantee") : invariant5__default.default(false) : void 0;
1767
+ }
1702
1768
  const ontologyIr = await loadOntology(commandLineOpts.input, apiNamespace, commandLineOpts.outputDir, commandLineOpts.dependencies);
1703
1769
  consola.consola.info(`Saving ontology to ${commandLineOpts.output}`);
1704
1770
  await fs2__namespace.writeFile(commandLineOpts.output, JSON.stringify(ontologyIr, null, 2));
@@ -1730,36 +1796,68 @@ function addDependency(namespaceNoDot, fileInPackage) {
1730
1796
  const packageJson = JSON.parse(fs__namespace.readFileSync(packageJsonPath, "utf-8"));
1731
1797
  dependencies[namespaceNoDot] = packageJson.version ?? "";
1732
1798
  }
1733
- function defineCreateInterfaceObjectAction(interfaceType, objectType, validation) {
1734
- const allProperties = Object.entries(getAllInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1735
- if (allProperties.length !== Object.entries(getAllInterfaceProperties(interfaceType)).length) {
1736
- consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the create action because they are structs`);
1799
+ function convertMappingValue(value) {
1800
+ switch (value.type) {
1801
+ case "uuid":
1802
+ return {
1803
+ type: "uniqueIdentifier",
1804
+ uniqueIdentifier: {
1805
+ linkId: value.linkId ?? crypto.randomUUID()
1806
+ }
1807
+ };
1808
+ case "currentTime":
1809
+ return {
1810
+ type: "currentTime",
1811
+ currentTime: {}
1812
+ };
1813
+ case "currentUser":
1814
+ return {
1815
+ type: "currentUser",
1816
+ currentUser: {}
1817
+ };
1818
+ default:
1819
+ return value;
1820
+ }
1821
+ }
1822
+
1823
+ // src/api/action/ActionParameterType.ts
1824
+ function isActionParameterTypePrimitive(type) {
1825
+ 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);
1826
+ }
1827
+
1828
+ // src/api/defineAction.ts
1829
+ var MODIFY_OBJECT_PARAMETER = "objectToModifyParameter";
1830
+ var CREATE_OR_MODIFY_OBJECT_PARAMETER = "objectToCreateOrModifyParameter";
1831
+ function defineCreateInterfaceObjectAction(def) {
1832
+ const allProperties = Object.entries(getFlattenedInterfaceProperties(def.interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type) && !(def.excludedProperties ?? []).includes(prop.sharedPropertyType.nonNameSpacedApiName));
1833
+ if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(def.interfaceType)).length) {
1834
+ consola.consola.info(`Some properties on ${def.interfaceType.apiName} were skipped in the create action because they are structs`);
1737
1835
  }
1738
1836
  return defineAction({
1739
- apiName: `create-${kebab(interfaceType.apiName.split(".").pop() ?? interfaceType.apiName)}${objectType === void 0 ? "" : `-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`}`,
1740
- displayName: `Create ${interfaceType.displayMetadata.displayName}`,
1837
+ apiName: `create-${kebab(def.interfaceType.apiName.split(".").pop() ?? def.interfaceType.apiName)}${def.objectType === void 0 ? "" : `-${kebab(def.objectType.apiName.split(".").pop() ?? def.objectType.apiName)}`}`,
1838
+ displayName: `Create ${def.interfaceType.displayMetadata.displayName}`,
1741
1839
  parameters: [{
1742
1840
  id: "objectTypeParameter",
1743
1841
  displayName: "Object type to create",
1744
1842
  type: {
1745
1843
  type: "objectTypeReference",
1746
1844
  objectTypeReference: {
1747
- interfaceTypeRids: [interfaceType.apiName]
1845
+ interfaceTypeRids: [def.interfaceType.apiName]
1748
1846
  }
1749
1847
  },
1750
1848
  validation: {
1751
1849
  required: true,
1752
- allowedValues: objectType === void 0 ? {
1850
+ allowedValues: def.objectType === void 0 ? {
1753
1851
  type: "objectTypeReference",
1754
- interfaceTypes: [interfaceType.apiName]
1852
+ interfaceTypes: [def.interfaceType.apiName]
1755
1853
  } : {
1756
1854
  type: "oneOf",
1757
1855
  oneOf: [{
1758
- label: objectType.displayName,
1856
+ label: def.objectType.displayName,
1759
1857
  value: {
1760
1858
  type: "objectType",
1761
1859
  objectType: {
1762
- objectTypeId: objectType.apiName
1860
+ objectTypeId: def.objectType.apiName
1763
1861
  }
1764
1862
  }
1765
1863
  }]
@@ -1777,9 +1875,9 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
1777
1875
  allowedValues: extractAllowedValuesFromPropertyType(prop.sharedPropertyType.type)
1778
1876
  }
1779
1877
  }))],
1780
- status: interfaceType.status.type !== "deprecated" ? interfaceType.status.type : interfaceType.status,
1878
+ status: def.interfaceType.status.type !== "deprecated" ? def.interfaceType.status.type : def.interfaceType.status,
1781
1879
  entities: {
1782
- affectedInterfaceTypes: [interfaceType.apiName],
1880
+ affectedInterfaceTypes: [def.interfaceType.apiName],
1783
1881
  affectedObjectTypes: [],
1784
1882
  affectedLinkTypes: [],
1785
1883
  typeGroups: []
@@ -1787,7 +1885,7 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
1787
1885
  rules: [{
1788
1886
  type: "addInterfaceRule",
1789
1887
  addInterfaceRule: {
1790
- interfaceApiName: interfaceType.apiName,
1888
+ interfaceApiName: def.interfaceType.apiName,
1791
1889
  objectTypeParameter: "objectTypeParameter",
1792
1890
  sharedPropertyValues: Object.fromEntries(allProperties.map(([id, _prop]) => [id, {
1793
1891
  type: "parameterId",
@@ -1795,8 +1893,8 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
1795
1893
  }]))
1796
1894
  }
1797
1895
  }],
1798
- ...validation ? {
1799
- validation: convertValidationRule(validation)
1896
+ ...def.validation ? {
1897
+ validation: convertValidationRule(def.validation)
1800
1898
  } : {}
1801
1899
  });
1802
1900
  }
@@ -1857,35 +1955,35 @@ function defineCreateObjectAction(def) {
1857
1955
  }
1858
1956
  });
1859
1957
  }
1860
- function defineModifyInterfaceObjectAction(interfaceType, objectType, validation) {
1861
- const allProperties = Object.entries(getAllInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1862
- if (allProperties.length !== Object.entries(getAllInterfaceProperties(interfaceType)).length) {
1863
- consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the modify action because they are structs`);
1958
+ function defineModifyInterfaceObjectAction(def) {
1959
+ const allProperties = Object.entries(getFlattenedInterfaceProperties(def.interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type) && !(def.excludedProperties ?? []).includes(prop.sharedPropertyType.nonNameSpacedApiName));
1960
+ if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(def.interfaceType)).length) {
1961
+ consola.consola.info(`Some properties on ${def.interfaceType.apiName} were skipped in the modify action because they are structs`);
1864
1962
  }
1865
1963
  return defineAction({
1866
- apiName: `modify-${kebab(interfaceType.apiName.split(".").pop() ?? interfaceType.apiName)}${objectType === void 0 ? "" : `-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`}`,
1867
- displayName: `Modify ${interfaceType.displayMetadata.displayName}`,
1964
+ apiName: `modify-${kebab(def.interfaceType.apiName.split(".").pop() ?? def.interfaceType.apiName)}${def.objectType === void 0 ? "" : `-${kebab(def.objectType.apiName.split(".").pop() ?? def.objectType.apiName)}`}`,
1965
+ displayName: `Modify ${def.interfaceType.displayMetadata.displayName}`,
1868
1966
  parameters: [{
1869
1967
  id: "interfaceObjectToModifyParameter",
1870
1968
  displayName: "Object type to modify",
1871
1969
  type: {
1872
1970
  type: "interfaceReference",
1873
1971
  interfaceReference: {
1874
- interfaceTypeRid: interfaceType.apiName
1972
+ interfaceTypeRid: def.interfaceType.apiName
1875
1973
  }
1876
1974
  },
1877
1975
  validation: {
1878
1976
  required: true,
1879
- allowedValues: objectType === void 0 ? {
1977
+ allowedValues: def.objectType === void 0 ? {
1880
1978
  type: "interfaceObjectQuery"
1881
1979
  } : {
1882
1980
  type: "oneOf",
1883
1981
  oneOf: [{
1884
- label: objectType.displayName,
1982
+ label: def.objectType.displayName,
1885
1983
  value: {
1886
1984
  type: "objectType",
1887
1985
  objectType: {
1888
- objectTypeId: objectType.apiName
1986
+ objectTypeId: def.objectType.apiName
1889
1987
  }
1890
1988
  }
1891
1989
  }]
@@ -1903,9 +2001,9 @@ function defineModifyInterfaceObjectAction(interfaceType, objectType, validation
1903
2001
  allowedValues: extractAllowedValuesFromPropertyType(prop.sharedPropertyType.type)
1904
2002
  }
1905
2003
  }))],
1906
- status: interfaceType.status.type !== "deprecated" ? interfaceType.status.type : interfaceType.status,
2004
+ status: def.interfaceType.status.type !== "deprecated" ? def.interfaceType.status.type : def.interfaceType.status,
1907
2005
  entities: {
1908
- affectedInterfaceTypes: [interfaceType.apiName],
2006
+ affectedInterfaceTypes: [def.interfaceType.apiName],
1909
2007
  affectedObjectTypes: [],
1910
2008
  affectedLinkTypes: [],
1911
2009
  typeGroups: []
@@ -1920,8 +2018,8 @@ function defineModifyInterfaceObjectAction(interfaceType, objectType, validation
1920
2018
  }]))
1921
2019
  }
1922
2020
  }],
1923
- ...validation ? {
1924
- validation: convertValidationRule(validation)
2021
+ ...def.validation ? {
2022
+ validation: convertValidationRule(def.validation)
1925
2023
  } : {}
1926
2024
  });
1927
2025
  }
@@ -2129,6 +2227,23 @@ function defineAction(actionDef) {
2129
2227
  if (rule.type === "deleteObjectRule") {
2130
2228
  !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;
2131
2229
  }
2230
+ if (rule.type === "modifyInterfaceRule") {
2231
+ const interfaceParam = actionDef.parameters.find((p) => p.id === rule.modifyInterfaceRule.interfaceObjectToModifyParameter);
2232
+ !(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;
2233
+ const interfaceReference = interfaceParam.type.type === "interfaceReference" ? interfaceParam.type.interfaceReference.interfaceTypeRid : interfaceParam.type.interfaceReferenceList.interfaceTypeRid;
2234
+ !(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;
2235
+ const interfaceType = ontologyDefinition.INTERFACE_TYPE[interfaceReference];
2236
+ Object.keys(rule.modifyInterfaceRule.sharedPropertyValues).forEach((spt) => {
2237
+ !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;
2238
+ });
2239
+ }
2240
+ if (rule.type === "addInterfaceRule") {
2241
+ const interfaceType = ontologyDefinition.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName] ?? importedTypes.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName];
2242
+ !(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;
2243
+ Object.keys(rule.addInterfaceRule.sharedPropertyValues).forEach((spt) => {
2244
+ !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;
2245
+ });
2246
+ }
2132
2247
  });
2133
2248
  const fullAction = {
2134
2249
  ...actionDef,
@@ -2202,7 +2317,7 @@ function createParameters(def, parameterSet) {
2202
2317
  });
2203
2318
  return [...targetParam, ...Array.from(parameterSet).map((id) => ({
2204
2319
  id,
2205
- displayName: def.parameterConfiguration?.[id]?.displayName ?? def.objectType.properties?.[id]?.displayName ?? convertToDisplayName(id),
2320
+ displayName: def.parameterConfiguration?.[id]?.displayName ?? def.objectType.properties?.[id]?.displayName ?? uppercaseFirstLetter(id),
2206
2321
  type: def.parameterConfiguration?.[id]?.customParameterType ?? extractActionParameterType(def.objectType.properties?.[id]),
2207
2322
  validation: def.parameterConfiguration?.[id] !== void 0 ? {
2208
2323
  ...def.parameterConfiguration?.[id],
@@ -2231,14 +2346,14 @@ function referencedParameterIds(actionDef) {
2231
2346
  actionDef.rules.forEach((rule) => {
2232
2347
  switch (rule.type) {
2233
2348
  case "addInterfaceRule":
2234
- rule.addInterfaceRule.interfaceApiName = sanitize2(rule.addInterfaceRule.interfaceApiName);
2349
+ rule.addInterfaceRule.interfaceApiName = sanitize(rule.addInterfaceRule.interfaceApiName);
2235
2350
  parameterIds.add(rule.addInterfaceRule.objectTypeParameter);
2236
2351
  Object.entries(rule.addInterfaceRule.sharedPropertyValues).forEach(([k, v]) => {
2237
2352
  if (v.type === "parameterId") {
2238
2353
  parameterIds.add(v.parameterId);
2239
2354
  }
2240
2355
  delete rule.addInterfaceRule.sharedPropertyValues[k];
2241
- rule.addInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
2356
+ rule.addInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
2242
2357
  });
2243
2358
  break;
2244
2359
  case "modifyInterfaceRule":
@@ -2248,7 +2363,7 @@ function referencedParameterIds(actionDef) {
2248
2363
  parameterIds.add(v.parameterId);
2249
2364
  }
2250
2365
  delete rule.modifyInterfaceRule.sharedPropertyValues[k];
2251
- rule.modifyInterfaceRule.sharedPropertyValues[sanitize2(k)] = v;
2366
+ rule.modifyInterfaceRule.sharedPropertyValues[sanitize(k)] = v;
2252
2367
  });
2253
2368
  break;
2254
2369
  case "addObjectRule":
@@ -2477,16 +2592,10 @@ function extractActionParameterType(pt) {
2477
2592
  function maybeAddList(type, pt) {
2478
2593
  return pt.array ?? false ? type + "List" : type;
2479
2594
  }
2480
- function isActionParameterTypePrimitive(type) {
2481
- 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);
2482
- }
2483
- function isStruct(type) {
2484
- return typeof type === "object" && type.type === "struct";
2485
- }
2486
2595
  function kebab(s) {
2487
2596
  return s.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/\./g, "-").toLowerCase();
2488
2597
  }
2489
- function sanitize2(s) {
2598
+ function sanitize(s) {
2490
2599
  return s.includes(".") ? s : namespace + s;
2491
2600
  }
2492
2601
  function convertValidationRule(actionValidation) {
@@ -2583,42 +2692,6 @@ function validateParameterOrdering(parameterOrdering, parameterSet, actionApiNam
2583
2692
  const extraneousParameters = parameterOrdering.filter((param) => !parameterSet.has(param));
2584
2693
  !(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;
2585
2694
  }
2586
-
2587
- // src/api/importOntologyEntity.ts
2588
- function importOntologyEntity(e) {
2589
- if (e.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
2590
- importedTypes[e.__type][e.apiName] = e;
2591
- return;
2592
- }
2593
- if (importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] === void 0) {
2594
- importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] = [];
2595
- }
2596
- importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName].push(e);
2597
- }
2598
-
2599
- // src/api/defineImportSpt.ts
2600
- function importSharedPropertyType(opts) {
2601
- const {
2602
- apiName,
2603
- packageName,
2604
- typeHint,
2605
- array
2606
- } = opts;
2607
- const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
2608
- if (packageName !== void 0) {
2609
- !!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name format invalid ends with period") : invariant5__default.default(false) : void 0;
2610
- !(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;
2611
- }
2612
- const spt = {
2613
- apiName: fullApiName,
2614
- type: typeHint,
2615
- nonNameSpacedApiName: apiName,
2616
- array: array ?? false,
2617
- __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
2618
- };
2619
- importOntologyEntity(spt);
2620
- return spt;
2621
- }
2622
2695
  function defineSharedPropertyType(sptDef) {
2623
2696
  const apiName = namespace + sptDef.apiName;
2624
2697
  !(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;
@@ -2636,20 +2709,54 @@ function defineSharedPropertyType(sptDef) {
2636
2709
  return fullSpt;
2637
2710
  }
2638
2711
 
2712
+ // src/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.ts
2713
+ function mapSimplifiedStatusToInterfaceTypeStatus(status) {
2714
+ switch (status.type) {
2715
+ case "deprecated":
2716
+ return {
2717
+ type: "deprecated",
2718
+ deprecated: {
2719
+ message: status.message,
2720
+ deadline: status.deadline,
2721
+ replacedBy: void 0
2722
+ }
2723
+ };
2724
+ case "active":
2725
+ return {
2726
+ type: "active",
2727
+ active: {}
2728
+ };
2729
+ case "experimental":
2730
+ return {
2731
+ type: "experimental",
2732
+ experimental: {}
2733
+ };
2734
+ default:
2735
+ throw new Error(`Invalid status type: ${status.type}`);
2736
+ }
2737
+ }
2738
+
2739
+ // src/api/namespace/combineApiNamespaceIfMissing.ts
2740
+ function combineApiNamespaceIfMissing(namespace2, apiName) {
2741
+ return apiName.includes(".") ? apiName : namespace2 + apiName;
2742
+ }
2743
+
2639
2744
  // src/api/defineInterface.ts
2640
2745
  function defineInterface(interfaceDef) {
2641
2746
  const apiName = namespace + interfaceDef.apiName;
2642
2747
  !(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;
2643
- const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([propApiName, type]) => {
2748
+ const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([unNamespacedPropApiName, type]) => {
2644
2749
  if (typeof type === "object" && "propertyDefinition" in type) {
2645
- return [namespace + propApiName, {
2750
+ const apiName3 = combineApiNamespaceIfMissing(namespace, typeof type.propertyDefinition === "object" && "apiName" in type.propertyDefinition ? type.propertyDefinition.apiName : unNamespacedPropApiName);
2751
+ return [apiName3, {
2646
2752
  required: type.required,
2647
- sharedPropertyType: unifyBasePropertyDefinition(namespace, propApiName, type.propertyDefinition)
2753
+ sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type.propertyDefinition)
2648
2754
  }];
2649
2755
  }
2650
- return [namespace + propApiName, {
2756
+ const apiName2 = combineApiNamespaceIfMissing(namespace, typeof type === "object" && "apiName" in type ? type.apiName : unNamespacedPropApiName);
2757
+ return [apiName2, {
2651
2758
  required: true,
2652
- sharedPropertyType: unifyBasePropertyDefinition(namespace, propApiName, type)
2759
+ sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type)
2653
2760
  }];
2654
2761
  }));
2655
2762
  const extendsInterfaces = interfaceDef.extends ? Array.isArray(interfaceDef.extends) ? interfaceDef.extends : [interfaceDef.extends] : [];
@@ -2680,34 +2787,6 @@ function defineInterface(interfaceDef) {
2680
2787
  updateOntology(fullInterface);
2681
2788
  return fullInterface;
2682
2789
  }
2683
- function isPropertyTypeType(v) {
2684
- 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";
2685
- }
2686
- function mapSimplifiedStatusToInterfaceTypeStatus(status) {
2687
- switch (status.type) {
2688
- case "deprecated":
2689
- return {
2690
- type: "deprecated",
2691
- deprecated: {
2692
- message: status.message,
2693
- deadline: status.deadline,
2694
- replacedBy: void 0
2695
- }
2696
- };
2697
- case "active":
2698
- return {
2699
- type: "active",
2700
- active: {}
2701
- };
2702
- case "experimental":
2703
- return {
2704
- type: "experimental",
2705
- experimental: {}
2706
- };
2707
- default:
2708
- throw new Error(`Invalid status type: ${status.type}`);
2709
- }
2710
- }
2711
2790
  function unifyBasePropertyDefinition(namespace2, apiName, type) {
2712
2791
  if (typeof type === "string" || typeof type === "object" && !("apiName" in type)) {
2713
2792
  !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;
@@ -2749,7 +2828,7 @@ function getLinkMeta(meta) {
2749
2828
  displayName,
2750
2829
  description
2751
2830
  } = meta;
2752
- const apiNameWithNamespace = sanitize(namespace, apiName);
2831
+ const apiNameWithNamespace = combineApiNamespaceIfMissing(namespace, apiName);
2753
2832
  const apiNameWithoutNamespace = withoutNamespace(apiNameWithNamespace);
2754
2833
  return {
2755
2834
  apiName: apiNameWithNamespace,
@@ -2766,15 +2845,30 @@ function defineLink(linkDefinition) {
2766
2845
  const typesMatch = foreignKey.type === linkDefinition.one.object.properties?.[linkDefinition.one.object.primaryKeyPropertyApiName].type;
2767
2846
  !typesMatch ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Link ${linkDefinition.apiName} has type mismatch between the one side's primary key and the foreign key on the many side`) : invariant5__default.default(false) : void 0;
2768
2847
  }
2769
- const fullLinkDefinition = "one" in linkDefinition ? {
2770
- ...linkDefinition,
2771
- one: convertUserOneToManyLinkDefinition(linkDefinition.one),
2772
- toMany: convertUserOneToManyLinkDefinition(linkDefinition.toMany)
2773
- } : {
2774
- ...linkDefinition,
2775
- many: convertUserManyToManyLinkDefinition(linkDefinition.many),
2776
- toMany: convertUserManyToManyLinkDefinition(linkDefinition.toMany)
2777
- };
2848
+ if ("intermediaryObjectType" in linkDefinition) {
2849
+ !("one" in linkDefinition.many.linkToIntermediary && linkDefinition.many.linkToIntermediary.one.object.apiName === linkDefinition.many.object.apiName && linkDefinition.many.linkToIntermediary.toMany.object.apiName === linkDefinition.intermediaryObjectType.apiName) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `LinkTypeA ${linkDefinition.many.linkToIntermediary.apiName} must be a many to one link from intermediary object ${linkDefinition.intermediaryObjectType.apiName} to objectA ${linkDefinition.many.object.apiName}`) : invariant5__default.default(false) : void 0;
2850
+ !("one" in linkDefinition.toMany.linkToIntermediary && linkDefinition.toMany.linkToIntermediary.one.object.apiName === linkDefinition.toMany.object.apiName && linkDefinition.toMany.linkToIntermediary.toMany.object.apiName === linkDefinition.intermediaryObjectType.apiName) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `LinkTypeB ${linkDefinition.toMany.linkToIntermediary.apiName} must be a many to one link from intermediary object ${linkDefinition.intermediaryObjectType.apiName} to objectB ${linkDefinition.toMany.object.apiName}`) : invariant5__default.default(false) : void 0;
2851
+ }
2852
+ let fullLinkDefinition;
2853
+ if ("one" in linkDefinition) {
2854
+ fullLinkDefinition = {
2855
+ ...linkDefinition,
2856
+ one: convertUserOneToManyLinkDefinition(linkDefinition.one),
2857
+ toMany: convertUserOneToManyLinkDefinition(linkDefinition.toMany)
2858
+ };
2859
+ } else if ("intermediaryObjectType" in linkDefinition) {
2860
+ fullLinkDefinition = {
2861
+ ...linkDefinition,
2862
+ many: convertUserIntermediaryLinkDefinition(linkDefinition.many),
2863
+ toMany: convertUserIntermediaryLinkDefinition(linkDefinition.toMany)
2864
+ };
2865
+ } else {
2866
+ fullLinkDefinition = {
2867
+ ...linkDefinition,
2868
+ many: convertUserManyToManyLinkDefinition(linkDefinition.many),
2869
+ toMany: convertUserManyToManyLinkDefinition(linkDefinition.toMany)
2870
+ };
2871
+ }
2778
2872
  const linkType = {
2779
2873
  cardinality: "one" in linkDefinition ? linkDefinition.cardinality : void 0,
2780
2874
  ...fullLinkDefinition,
@@ -2795,11 +2889,17 @@ function convertUserManyToManyLinkDefinition(manyToMany) {
2795
2889
  metadata: convertLinkTypeMetadata(manyToMany.metadata)
2796
2890
  };
2797
2891
  }
2892
+ function convertUserIntermediaryLinkDefinition(intermediary) {
2893
+ return {
2894
+ ...intermediary,
2895
+ metadata: convertLinkTypeMetadata(intermediary.metadata)
2896
+ };
2897
+ }
2798
2898
  function convertLinkTypeMetadata(metadata) {
2799
2899
  return {
2800
2900
  apiName: metadata.apiName,
2801
2901
  displayMetadata: {
2802
- displayName: metadata.displayName ?? convertToDisplayName(metadata.apiName),
2902
+ displayName: metadata.displayName ?? uppercaseFirstLetter(metadata.apiName),
2803
2903
  pluralDisplayName: metadata.pluralDisplayName ?? convertToPluralDisplayName(metadata.apiName),
2804
2904
  visibility: metadata.visibility ?? "NORMAL",
2805
2905
  groupDisplayName: metadata.groupDisplayName ?? ""
@@ -2895,6 +2995,40 @@ function defineValueType(valueTypeDef) {
2895
2995
  return vt;
2896
2996
  }
2897
2997
 
2998
+ // src/api/importOntologyEntity.ts
2999
+ function importOntologyEntity(e) {
3000
+ if (e.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
3001
+ importedTypes[e.__type][e.apiName] = e;
3002
+ return;
3003
+ }
3004
+ if (importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] === void 0) {
3005
+ importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] = [];
3006
+ }
3007
+ importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName].push(e);
3008
+ }
3009
+ function importSharedPropertyType(opts) {
3010
+ const {
3011
+ apiName,
3012
+ packageName,
3013
+ typeHint,
3014
+ array
3015
+ } = opts;
3016
+ const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
3017
+ if (packageName !== void 0) {
3018
+ !!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "Package name format invalid ends with period") : invariant5__default.default(false) : void 0;
3019
+ !(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;
3020
+ }
3021
+ const spt = {
3022
+ apiName: fullApiName,
3023
+ type: typeHint,
3024
+ nonNameSpacedApiName: apiName,
3025
+ array: array ?? false,
3026
+ __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
3027
+ };
3028
+ importOntologyEntity(spt);
3029
+ return spt;
3030
+ }
3031
+
2898
3032
  // src/api/wrapWithProxy.ts
2899
3033
  function wrapWithProxy(entity) {
2900
3034
  return new Proxy(entity, {
@@ -2910,9 +3044,9 @@ exports.MODIFY_OBJECT_PARAMETER = MODIFY_OBJECT_PARAMETER;
2910
3044
  exports.OntologyEntityTypeEnum = OntologyEntityTypeEnum;
2911
3045
  exports.addDependency = addDependency;
2912
3046
  exports.addNamespaceIfNone = addNamespaceIfNone;
2913
- exports.convertToDisplayName = convertToDisplayName;
3047
+ exports.convertToDisplayName = uppercaseFirstLetter;
2914
3048
  exports.convertToPluralDisplayName = convertToPluralDisplayName;
2915
- exports.convertType = convertType;
3049
+ exports.convertType = propertyTypeTypeToOntologyIrType;
2916
3050
  exports.default = main;
2917
3051
  exports.defineAction = defineAction;
2918
3052
  exports.defineCreateInterfaceObjectAction = defineCreateInterfaceObjectAction;