@osdk/generator 2.0.0-beta.12 → 2.0.0-beta.14

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 (300) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/build/browser/GenerateContext/EnhanceCommon.d.ts +9 -0
  3. package/build/browser/GenerateContext/EnhanceCommon.d.ts.map +1 -0
  4. package/build/browser/GenerateContext/EnhanceCommon.js +17 -0
  5. package/build/browser/GenerateContext/EnhanceCommon.js.map +1 -0
  6. package/build/browser/GenerateContext/EnhancedAction.d.ts +14 -0
  7. package/build/browser/GenerateContext/EnhancedAction.d.ts.map +1 -0
  8. package/build/browser/GenerateContext/EnhancedAction.js +42 -0
  9. package/build/browser/GenerateContext/EnhancedAction.js.map +1 -0
  10. package/build/browser/GenerateContext/EnhancedBase.d.ts +23 -0
  11. package/build/browser/GenerateContext/EnhancedBase.d.ts.map +1 -0
  12. package/build/browser/GenerateContext/EnhancedBase.js +72 -0
  13. package/build/browser/GenerateContext/EnhancedBase.js.map +1 -0
  14. package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts +13 -0
  15. package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -0
  16. package/build/browser/GenerateContext/EnhancedInterfaceType.js +38 -0
  17. package/build/browser/GenerateContext/EnhancedInterfaceType.js.map +1 -0
  18. package/build/browser/GenerateContext/EnhancedObjectType.d.ts +12 -0
  19. package/build/browser/GenerateContext/EnhancedObjectType.d.ts.map +1 -0
  20. package/build/browser/GenerateContext/EnhancedObjectType.js +35 -0
  21. package/build/browser/GenerateContext/EnhancedObjectType.js.map +1 -0
  22. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts +27 -0
  23. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -0
  24. package/build/browser/GenerateContext/EnhancedOntologyDefinition.js +77 -0
  25. package/build/browser/GenerateContext/EnhancedOntologyDefinition.js.map +1 -0
  26. package/build/browser/GenerateContext/EnhancedQuery.d.ts +14 -0
  27. package/build/browser/GenerateContext/EnhancedQuery.d.ts.map +1 -0
  28. package/build/browser/GenerateContext/EnhancedQuery.js +42 -0
  29. package/build/browser/GenerateContext/EnhancedQuery.js.map +1 -0
  30. package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts +8 -0
  31. package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts.map +1 -0
  32. package/build/browser/GenerateContext/EnhancedSharedPropertyType.js +24 -0
  33. package/build/browser/GenerateContext/EnhancedSharedPropertyType.js.map +1 -0
  34. package/build/browser/GenerateContext/ForeignType.d.ts +10 -0
  35. package/build/browser/GenerateContext/ForeignType.d.ts.map +1 -0
  36. package/build/browser/GenerateContext/ForeignType.js +36 -0
  37. package/build/browser/GenerateContext/ForeignType.js.map +1 -0
  38. package/build/browser/GenerateContext/GenerateContext.d.ts +13 -0
  39. package/build/browser/GenerateContext/GenerateContext.d.ts.map +1 -0
  40. package/build/browser/GenerateContext/GenerateContext.js +17 -0
  41. package/build/browser/GenerateContext/GenerateContext.js.map +1 -0
  42. package/build/browser/GenerateContext/enhanceOntology.d.ts +4 -0
  43. package/build/browser/GenerateContext/enhanceOntology.d.ts.map +1 -0
  44. package/build/browser/GenerateContext/enhanceOntology.js +20 -0
  45. package/build/browser/GenerateContext/enhanceOntology.js.map +1 -0
  46. package/build/browser/MinimalFs.d.ts +10 -0
  47. package/build/browser/MinimalFs.d.ts.map +1 -0
  48. package/build/browser/MinimalFs.js +17 -0
  49. package/build/browser/MinimalFs.js.map +1 -0
  50. package/build/browser/WireOntologyDefinition.d.ts +4 -0
  51. package/build/browser/WireOntologyDefinition.d.ts.map +1 -0
  52. package/build/browser/WireOntologyDefinition.js +17 -0
  53. package/build/browser/WireOntologyDefinition.js.map +1 -0
  54. package/build/browser/generateClientSdkPackage.d.ts +47 -0
  55. package/build/browser/generateClientSdkPackage.d.ts.map +1 -0
  56. package/build/browser/generateClientSdkPackage.js +126 -0
  57. package/build/browser/generateClientSdkPackage.js.map +1 -0
  58. package/build/browser/generateClientSdkPackage.test.d.ts +2 -0
  59. package/build/browser/generateClientSdkPackage.test.d.ts.map +1 -0
  60. package/build/browser/generateClientSdkPackage.test.js +67 -0
  61. package/build/browser/generateClientSdkPackage.test.js.map +1 -0
  62. package/build/browser/index.d.ts +5 -0
  63. package/build/browser/index.d.ts.map +1 -0
  64. package/build/browser/index.js +17 -1311
  65. package/build/browser/index.js.map +1 -1
  66. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.d.ts +2 -0
  67. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +1 -0
  68. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.js +23 -0
  69. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.js.map +1 -0
  70. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +2 -0
  71. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +1 -0
  72. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js +46 -0
  73. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js.map +1 -0
  74. package/build/browser/shared/getObjectImports.d.ts +4 -0
  75. package/build/browser/shared/getObjectImports.d.ts.map +1 -0
  76. package/build/browser/shared/getObjectImports.js +24 -0
  77. package/build/browser/shared/getObjectImports.js.map +1 -0
  78. package/build/browser/shared/getObjectTypeApiNamesFromQuery.d.ts +4 -0
  79. package/build/browser/shared/getObjectTypeApiNamesFromQuery.d.ts.map +1 -0
  80. package/build/browser/shared/getObjectTypeApiNamesFromQuery.js +27 -0
  81. package/build/browser/shared/getObjectTypeApiNamesFromQuery.js.map +1 -0
  82. package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts +3 -0
  83. package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts.map +1 -0
  84. package/build/browser/shared/getObjectTypesFromQueryDataType.js +57 -0
  85. package/build/browser/shared/getObjectTypesFromQueryDataType.js.map +1 -0
  86. package/build/browser/shared/propertyJsdoc.d.ts +6 -0
  87. package/build/browser/shared/propertyJsdoc.d.ts.map +1 -0
  88. package/build/browser/shared/propertyJsdoc.js +38 -0
  89. package/build/browser/shared/propertyJsdoc.js.map +1 -0
  90. package/build/browser/shared/sanitizeMetadata.d.ts +2 -0
  91. package/build/browser/shared/sanitizeMetadata.d.ts.map +1 -0
  92. package/build/browser/shared/sanitizeMetadata.js +33 -0
  93. package/build/browser/shared/sanitizeMetadata.js.map +1 -0
  94. package/build/browser/shared/sanitizeMetadata.test.d.ts +2 -0
  95. package/build/browser/shared/sanitizeMetadata.test.d.ts.map +1 -0
  96. package/build/browser/shared/sanitizeMetadata.test.js +44 -0
  97. package/build/browser/shared/sanitizeMetadata.test.js.map +1 -0
  98. package/build/browser/util/InMemoryFs.d.ts +7 -0
  99. package/build/browser/util/InMemoryFs.d.ts.map +1 -0
  100. package/build/browser/util/InMemoryFs.js +30 -0
  101. package/build/browser/util/InMemoryFs.js.map +1 -0
  102. package/build/browser/util/commaSeparatedIdentifiers.d.ts +2 -0
  103. package/build/browser/util/commaSeparatedIdentifiers.d.ts.map +1 -0
  104. package/build/browser/util/commaSeparatedIdentifiers.js +25 -0
  105. package/build/browser/util/commaSeparatedIdentifiers.js.map +1 -0
  106. package/build/browser/util/commaSeparatedTypeIdentifiers.d.ts +2 -0
  107. package/build/browser/util/commaSeparatedTypeIdentifiers.d.ts.map +1 -0
  108. package/build/browser/util/commaSeparatedTypeIdentifiers.js +19 -0
  109. package/build/browser/util/commaSeparatedTypeIdentifiers.js.map +1 -0
  110. package/build/browser/util/deleteUndefineds.d.ts +2 -0
  111. package/build/browser/util/deleteUndefineds.d.ts.map +1 -0
  112. package/build/browser/util/deleteUndefineds.js +19 -0
  113. package/build/browser/util/deleteUndefineds.js.map +1 -0
  114. package/build/browser/util/reservedKeywords.d.ts +2 -0
  115. package/build/browser/util/reservedKeywords.d.ts.map +1 -0
  116. package/build/browser/util/reservedKeywords.js +21 -0
  117. package/build/browser/util/reservedKeywords.js.map +1 -0
  118. package/build/browser/util/stringUnionFrom.d.ts +2 -0
  119. package/build/browser/util/stringUnionFrom.d.ts.map +1 -0
  120. package/build/browser/util/stringUnionFrom.js +23 -0
  121. package/build/browser/util/stringUnionFrom.js.map +1 -0
  122. package/build/browser/util/stringify.d.ts +20 -0
  123. package/build/browser/util/stringify.d.ts.map +1 -0
  124. package/build/browser/util/stringify.js +36 -0
  125. package/build/browser/util/stringify.js.map +1 -0
  126. package/build/browser/util/test/TodoWireOntology.d.ts +217 -0
  127. package/build/browser/util/test/TodoWireOntology.d.ts.map +1 -0
  128. package/build/browser/util/test/TodoWireOntology.js +232 -0
  129. package/build/browser/util/test/TodoWireOntology.js.map +1 -0
  130. package/build/browser/util/test/compileThis.d.ts +3 -0
  131. package/build/browser/util/test/compileThis.d.ts.map +1 -0
  132. package/build/browser/util/test/compileThis.js +41 -0
  133. package/build/browser/util/test/compileThis.js.map +1 -0
  134. package/build/browser/util/test/createMockMinimalFiles.d.ts +13 -0
  135. package/build/browser/util/test/createMockMinimalFiles.d.ts.map +1 -0
  136. package/build/browser/util/test/createMockMinimalFiles.js +37 -0
  137. package/build/browser/util/test/createMockMinimalFiles.js.map +1 -0
  138. package/build/browser/util/test/formatTs.d.ts +2 -0
  139. package/build/browser/util/test/formatTs.d.ts.map +1 -0
  140. package/build/browser/util/test/formatTs.js +32 -0
  141. package/build/browser/util/test/formatTs.js.map +1 -0
  142. package/build/browser/util/verifyOutDir.d.ts +9 -0
  143. package/build/browser/util/verifyOutDir.d.ts.map +1 -0
  144. package/build/browser/util/verifyOutDir.js +35 -0
  145. package/build/browser/util/verifyOutDir.js.map +1 -0
  146. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +2 -0
  147. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +1 -0
  148. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +114 -0
  149. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -0
  150. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +2 -0
  151. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +1 -0
  152. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +273 -0
  153. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -0
  154. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +4 -0
  155. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -0
  156. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +119 -0
  157. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -0
  158. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +2 -0
  159. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +1 -0
  160. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +1949 -0
  161. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -0
  162. package/build/browser/v2.0/generateMetadata.d.ts +3 -0
  163. package/build/browser/v2.0/generateMetadata.d.ts.map +1 -0
  164. package/build/browser/v2.0/generateMetadata.js +35 -0
  165. package/build/browser/v2.0/generateMetadata.js.map +1 -0
  166. package/build/browser/v2.0/generatePerActionDataFiles.d.ts +3 -0
  167. package/build/browser/v2.0/generatePerActionDataFiles.d.ts.map +1 -0
  168. package/build/browser/v2.0/generatePerActionDataFiles.js +240 -0
  169. package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -0
  170. package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts +2 -0
  171. package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts.map +1 -0
  172. package/build/browser/v2.0/generatePerActionDataFiles.test.js +51 -0
  173. package/build/browser/v2.0/generatePerActionDataFiles.test.js.map +1 -0
  174. package/build/browser/v2.0/generatePerQueryDataFiles.d.ts +9 -0
  175. package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +1 -0
  176. package/build/browser/v2.0/generatePerQueryDataFiles.js +194 -0
  177. package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -0
  178. package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts +2 -0
  179. package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts.map +1 -0
  180. package/build/browser/v2.0/generatePerQueryDataFiles.test.js +199 -0
  181. package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -0
  182. package/build/browser/v2.0/getDescriptionIfPresent.d.ts +2 -0
  183. package/build/browser/v2.0/getDescriptionIfPresent.d.ts.map +1 -0
  184. package/build/browser/v2.0/getDescriptionIfPresent.js +24 -0
  185. package/build/browser/v2.0/getDescriptionIfPresent.js.map +1 -0
  186. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +13 -0
  187. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -0
  188. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +205 -0
  189. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -0
  190. package/build/browser/validateWireOntologyAssumptions.d.ts +3 -0
  191. package/build/browser/validateWireOntologyAssumptions.d.ts.map +1 -0
  192. package/build/browser/validateWireOntologyAssumptions.js +33 -0
  193. package/build/browser/validateWireOntologyAssumptions.js.map +1 -0
  194. package/build/esm/GenerateContext/EnhanceCommon.js +17 -0
  195. package/build/esm/GenerateContext/EnhanceCommon.js.map +1 -0
  196. package/build/esm/GenerateContext/EnhancedAction.js +42 -0
  197. package/build/esm/GenerateContext/EnhancedAction.js.map +1 -0
  198. package/build/esm/GenerateContext/EnhancedBase.d.ts.map +1 -1
  199. package/build/esm/GenerateContext/EnhancedBase.js +72 -0
  200. package/build/esm/GenerateContext/EnhancedBase.js.map +1 -0
  201. package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts +2 -2
  202. package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -1
  203. package/build/esm/GenerateContext/EnhancedInterfaceType.js +38 -0
  204. package/build/esm/GenerateContext/EnhancedInterfaceType.js.map +1 -0
  205. package/build/esm/GenerateContext/EnhancedObjectType.d.ts +2 -2
  206. package/build/esm/GenerateContext/EnhancedObjectType.d.ts.map +1 -1
  207. package/build/esm/GenerateContext/EnhancedObjectType.js +35 -0
  208. package/build/esm/GenerateContext/EnhancedObjectType.js.map +1 -0
  209. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js +77 -0
  210. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js.map +1 -0
  211. package/build/esm/GenerateContext/EnhancedQuery.js +42 -0
  212. package/build/esm/GenerateContext/EnhancedQuery.js.map +1 -0
  213. package/build/esm/GenerateContext/EnhancedSharedPropertyType.js +24 -0
  214. package/build/esm/GenerateContext/EnhancedSharedPropertyType.js.map +1 -0
  215. package/build/esm/GenerateContext/ForeignType.js +36 -0
  216. package/build/esm/GenerateContext/ForeignType.js.map +1 -0
  217. package/build/esm/GenerateContext/GenerateContext.js +17 -0
  218. package/build/esm/GenerateContext/GenerateContext.js.map +1 -0
  219. package/build/esm/GenerateContext/enhanceOntology.js +20 -0
  220. package/build/esm/GenerateContext/enhanceOntology.js.map +1 -0
  221. package/build/esm/MinimalFs.js +17 -0
  222. package/build/esm/MinimalFs.js.map +1 -0
  223. package/build/esm/WireOntologyDefinition.js +17 -0
  224. package/build/esm/WireOntologyDefinition.js.map +1 -0
  225. package/build/esm/generateClientSdkPackage.d.ts +1 -6
  226. package/build/esm/generateClientSdkPackage.d.ts.map +1 -1
  227. package/build/esm/generateClientSdkPackage.js +126 -0
  228. package/build/esm/generateClientSdkPackage.js.map +1 -0
  229. package/build/esm/generateClientSdkPackage.test.js +67 -0
  230. package/build/esm/generateClientSdkPackage.test.js.map +1 -0
  231. package/build/esm/index.js +17 -1311
  232. package/build/esm/index.js.map +1 -1
  233. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.js +23 -0
  234. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.js.map +1 -0
  235. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js +46 -0
  236. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js.map +1 -0
  237. package/build/esm/shared/getObjectImports.js +24 -0
  238. package/build/esm/shared/getObjectImports.js.map +1 -0
  239. package/build/esm/shared/getObjectTypeApiNamesFromQuery.js +27 -0
  240. package/build/esm/shared/getObjectTypeApiNamesFromQuery.js.map +1 -0
  241. package/build/esm/shared/getObjectTypesFromQueryDataType.js +57 -0
  242. package/build/esm/shared/getObjectTypesFromQueryDataType.js.map +1 -0
  243. package/build/esm/shared/propertyJsdoc.js +38 -0
  244. package/build/esm/shared/propertyJsdoc.js.map +1 -0
  245. package/build/esm/shared/sanitizeMetadata.js +33 -0
  246. package/build/esm/shared/sanitizeMetadata.js.map +1 -0
  247. package/build/esm/shared/sanitizeMetadata.test.js +44 -0
  248. package/build/esm/shared/sanitizeMetadata.test.js.map +1 -0
  249. package/build/esm/util/InMemoryFs.js +30 -0
  250. package/build/esm/util/InMemoryFs.js.map +1 -0
  251. package/build/esm/util/commaSeparatedIdentifiers.js +25 -0
  252. package/build/esm/util/commaSeparatedIdentifiers.js.map +1 -0
  253. package/build/esm/util/commaSeparatedTypeIdentifiers.js +19 -0
  254. package/build/esm/util/commaSeparatedTypeIdentifiers.js.map +1 -0
  255. package/build/esm/util/deleteUndefineds.js +19 -0
  256. package/build/esm/util/deleteUndefineds.js.map +1 -0
  257. package/build/esm/util/reservedKeywords.js +21 -0
  258. package/build/esm/util/reservedKeywords.js.map +1 -0
  259. package/build/esm/util/stringUnionFrom.js +23 -0
  260. package/build/esm/util/stringUnionFrom.js.map +1 -0
  261. package/build/esm/util/stringify.js +36 -0
  262. package/build/esm/util/stringify.js.map +1 -0
  263. package/build/esm/util/test/TodoWireOntology.js +232 -0
  264. package/build/esm/util/test/TodoWireOntology.js.map +1 -0
  265. package/build/esm/util/test/compileThis.js +41 -0
  266. package/build/esm/util/test/compileThis.js.map +1 -0
  267. package/build/esm/util/test/createMockMinimalFiles.js +37 -0
  268. package/build/esm/util/test/createMockMinimalFiles.js.map +1 -0
  269. package/build/esm/util/test/formatTs.js +32 -0
  270. package/build/esm/util/test/formatTs.js.map +1 -0
  271. package/build/esm/util/verifyOutDir.js +35 -0
  272. package/build/esm/util/verifyOutDir.js.map +1 -0
  273. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +114 -0
  274. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -0
  275. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +273 -0
  276. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -0
  277. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +119 -0
  278. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -0
  279. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +1949 -0
  280. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -0
  281. package/build/esm/v2.0/generateMetadata.js +35 -0
  282. package/build/esm/v2.0/generateMetadata.js.map +1 -0
  283. package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
  284. package/build/esm/v2.0/generatePerActionDataFiles.js +240 -0
  285. package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -0
  286. package/build/esm/v2.0/generatePerActionDataFiles.test.js +51 -0
  287. package/build/esm/v2.0/generatePerActionDataFiles.test.js.map +1 -0
  288. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  289. package/build/esm/v2.0/generatePerQueryDataFiles.js +194 -0
  290. package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -0
  291. package/build/esm/v2.0/generatePerQueryDataFiles.test.js +199 -0
  292. package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -0
  293. package/build/esm/v2.0/getDescriptionIfPresent.js +24 -0
  294. package/build/esm/v2.0/getDescriptionIfPresent.js.map +1 -0
  295. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  296. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +205 -0
  297. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -0
  298. package/build/esm/validateWireOntologyAssumptions.js +33 -0
  299. package/build/esm/validateWireOntologyAssumptions.js.map +1 -0
  300. package/package.json +6 -8
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Verify that the target outDir does not yet exist OR is empty.
18
+ *
19
+ * Re-generating an ontology on top of itself is not supported and may leave old
20
+ * files around or refuse to update files with new contents in some cases.
21
+ */
22
+ export async function verifyOutDir(outDir, fs) {
23
+ // if outDir exists and is not empty, we cannot proceed with the generation
24
+ try {
25
+ const contents = await fs.readdir(outDir);
26
+ if (contents.length !== 0) {
27
+ throw new Error(`outDir ${outDir} is not empty, please delete its contents and try again`);
28
+ }
29
+ } catch (e) {
30
+ if (!(e.code === "ENOENT")) {
31
+ throw e;
32
+ } // acceptable, we'll create the directory ourselves
33
+ }
34
+ }
35
+ //# sourceMappingURL=verifyOutDir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyOutDir.js","names":["verifyOutDir","outDir","fs","contents","readdir","length","Error","e","code"],"sources":["verifyOutDir.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Verify that the target outDir does not yet exist OR is empty.\n *\n * Re-generating an ontology on top of itself is not supported and may leave old\n * files around or refuse to update files with new contents in some cases.\n */\nexport async function verifyOutDir(outDir, fs) {\n // if outDir exists and is not empty, we cannot proceed with the generation\n try {\n const contents = await fs.readdir(outDir);\n if (contents.length !== 0) {\n throw new Error(`outDir ${outDir} is not empty, please delete its contents and try again`);\n }\n }\n catch (e) {\n if (e.code === \"ENOENT\") {\n // acceptable, we'll create the directory ourselves\n }\n else {\n throw e;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeA,YAAYA,CAACC,MAAM,EAAEC,EAAE,EAAE;EAC3C;EACA,IAAI;IACA,MAAMC,QAAQ,GAAG,MAAMD,EAAE,CAACE,OAAO,CAACH,MAAM,CAAC;IACzC,IAAIE,QAAQ,CAACE,MAAM,KAAK,CAAC,EAAE;MACvB,MAAM,IAAIC,KAAK,CAAC,UAAUL,MAAM,yDAAyD,CAAC;IAC9F;EACJ,CAAC,CACD,OAAOM,CAAC,EAAE;IACN,MAAIA,CAAC,CAACC,IAAI,KAAK,QAAQ,GAGlB;MACD,MAAMD,CAAC;IACX,CAAC,CAJG;EAKR;AACJ","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts","sourceRoot":"","sources":["../../../src/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.ts"],"names":[],"mappings":""}
@@ -0,0 +1,114 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "@osdk/generator-converters";
17
+ import fastDeepEqual from "fast-deep-equal";
18
+ import invariant from "tiny-invariant";
19
+ import { propertyJsdoc } from "../shared/propertyJsdoc.js";
20
+ import { deleteUndefineds } from "../util/deleteUndefineds.js";
21
+ import { stringify } from "../util/stringify.js";
22
+ import { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps } from "./wireObjectTypeV2ToSdkObjectConstV2.js";
23
+ /** @internal */
24
+ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
25
+ const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));
26
+ const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
27
+ const parents = definition.implements?.map(p => {
28
+ !(ontology.interfaceTypes[p] != null) ? invariant(false, `Expected to find a parent interface named ${p} in the ontology and did not.`) : void 0;
29
+ const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).raw, v2));
30
+ return it;
31
+ }) ?? [];
32
+ const mergedProperties = {
33
+ ...definition.properties
34
+ };
35
+ for (const parent of parents) {
36
+ for (const apiName of Object.keys(parent.properties)) {
37
+ if (definition.properties[apiName] != null) {
38
+ !fastDeepEqual(definition.properties[apiName], parent.properties[apiName]) ? invariant(false, `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`) : void 0;
39
+ } else if (mergedProperties[apiName] != null) {
40
+ !fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]) ? invariant(false, `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`) : void 0;
41
+ }
42
+ mergedProperties[apiName] = parent.properties[apiName];
43
+ }
44
+ }
45
+ const ogProperties = definition.properties;
46
+ definition.properties = mergedProperties;
47
+ const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;
48
+ const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;
49
+ // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;
50
+ const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;
51
+ const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;
52
+ const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;
53
+ const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;
54
+ const ids = {
55
+ objectDefIdentifier: interfaceDef.shortApiName,
56
+ osdkObjectLinksIdentifier,
57
+ osdkObjectPropsIdentifier,
58
+ osdkObjectStrictPropsIdentifier,
59
+ objectSetIdentifier,
60
+ osdkObjectIdentifier,
61
+ propertyKeysIdentifier
62
+ };
63
+
64
+ // FIXME: We need to fill in the imports
65
+ // if we want links to work
66
+
67
+ return `${[].join("\n")}
68
+ ${v2 ? function () {
69
+ return `import type {
70
+ InterfaceDefinition as $InterfaceDefinition,
71
+ ObjectSet as $ObjectSet,
72
+ Osdk as $Osdk,
73
+ PropertyValueWireToClient as $PropType,
74
+ } from "@osdk/api";
75
+
76
+ ${Object.keys(definition.links).length === 0 ? `export type ${osdkObjectLinksIdentifier} = {};` : `
77
+ export interface ${osdkObjectLinksIdentifier} {
78
+ ${stringify(definition.links, {
79
+ "*": definition => {
80
+ const linkTarget = ontology.requireObjectType(definition.targetType).getImportedDefinitionIdentifier(v2);
81
+ return `${definition.multiplicity ? `${linkTarget}["objectSet"]` : `SingleLinkAccessor<${linkTarget}>`}
82
+ `;
83
+ }
84
+ })}
85
+ }
86
+ `}
87
+
88
+ export namespace ${interfaceDef.shortApiName} {
89
+
90
+ ${createPropertyKeys(interfaceDef)}
91
+
92
+
93
+ ${createProps(interfaceDef, "Props", false)}
94
+ ${createProps(interfaceDef, "StrictProps", true)}
95
+
96
+
97
+ ${createObjectSet(interfaceDef, ids)}
98
+
99
+ ${createOsdkObject(interfaceDef, "OsdkObject", ids)}
100
+
101
+ }
102
+
103
+ ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}
104
+
105
+ `;
106
+ }() : ""}
107
+
108
+ export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {
109
+ type: "interface",
110
+ apiName: "${interfaceDef.fullApiName}",
111
+ osdkMetadata: $osdkMetadata,
112
+ };`;
113
+ }
114
+ //# sourceMappingURL=UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","fastDeepEqual","invariant","propertyJsdoc","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","definition","raw","objectDefIdentifier","getDefinitionIdentifier","parents","implements","map","p","interfaceTypes","it","requireInterfaceType","mergedProperties","properties","parent","apiName","Object","keys","ogProperties","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","join","links","length","linkTarget","requireObjectType","targetType","getImportedDefinitionIdentifier","multiplicity","fullApiName"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { propertyJsdoc } from \"../shared/propertyJsdoc.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps, } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {\n const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n const parents = definition.implements?.map(p => {\n invariant(ontology.interfaceTypes[p] != null, `Expected to find a parent interface named ${p} in the ontology and did not.`);\n const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).raw, v2));\n return it;\n }) ?? [];\n const mergedProperties = { ...definition.properties };\n for (const parent of parents) {\n for (const apiName of Object.keys(parent.properties)) {\n if (definition.properties[apiName] != null) {\n invariant(fastDeepEqual(definition.properties[apiName], parent.properties[apiName]), `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`);\n }\n else if (mergedProperties[apiName] != null) {\n invariant(fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]), `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`);\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n const ogProperties = definition.properties;\n definition.properties = mergedProperties;\n function localPropertyJsdoc(apiName) {\n const property = definition.properties[apiName];\n const isInherited = ogProperties[apiName] == null;\n return propertyJsdoc(property, { isInherited, apiName });\n }\n function maybeStripNamespace(q) {\n if (interfaceDef.apiNamespace && q.startsWith(`${interfaceDef.apiNamespace}.`)) {\n return q.slice(interfaceDef.apiNamespace.length + 1);\n }\n else {\n return q;\n }\n }\n const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n const ids = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n function getV2Types() {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n \n ${Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(v2);\n return `${definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`}\n `;\n },\n })}\n }\n `}\n\n export namespace ${interfaceDef.shortApiName} {\n\n ${createPropertyKeys(interfaceDef)}\n\n\n ${createProps(interfaceDef, \"Props\", false)}\n ${createProps(interfaceDef, \"StrictProps\", true)}\n\n\n ${createObjectSet(interfaceDef, ids)}\n\n ${createOsdkObject(interfaceDef, \"OsdkObject\", ids)}\n \n } \n\n ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}\n\n`;\n }\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types() : \"\"}\n\n export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {\n type: \"interface\",\n apiName: \"${interfaceDef.fullApiName}\",\n osdkMetadata: $osdkMetadata,\n };`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,EAAEC,kBAAkB,EAAEC,WAAW,QAAS,yCAAyC;AAC/I;AACA,OAAO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UAAU,GAAG/B,QAAQ,CAACgC,iBAAiB,CAAC9B,UAAU,CAAC+B,UAAU,CAAC,CAC/DC,+BAA+B,CAACjC,EAAE,CAAC;QACxC,OAAO,GAAGC,UAAU,CAACiC,YAAY,GAC3B,GAAGJ,UAAU,eAAe,GAC5B,sBAAsBA,UAAU,GAAG;AAC7D,WAAW;MACK;IACJ,CAAC,CAAC;AACd;AACA,KAAK;AACL;AACA,uBAAuBhC,YAAY,CAACsB,YAAY;AAChD;AACA,QAAQzB,kBAAkB,CAACG,YAAY,CAAC;AACxC;AACA;AACA,QAAQF,WAAW,CAACE,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC;AACjD,QAAQF,WAAW,CAACE,YAAY,EAAE,aAAa,EAAE,IAAI,CAAC;AACtD;AACA;AACA,QAAQL,eAAe,CAACK,YAAY,EAAE4B,GAAG,CAAC;AAC1C;AACA,QAAQhC,gBAAgB,CAACI,YAAY,EAAE,YAAY,EAAE4B,GAAG,CAAC;AACzD;AACA;AACA;AACA,MAAMlC,gBAAgB,CAACM,YAAY,EAAEC,QAAQ,EAAED,YAAY,CAACsB,YAAY,EAAEM,GAAG,CAAC;AAC9E;AACA,CAAC;EACG,CAAC,CAMiB,CAAC,GAAG,EAAE;AAC5B;AACA,mBAAmB5B,YAAY,CAACsB,YAAY,KAAKtB,YAAY,CAACsB,YAAY;AAC1E;AACA,kBAAkBtB,YAAY,CAACqC,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts","sourceRoot":"","sources":["../../../src/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,273 @@
1
+ /*
2
+ * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { format } from "prettier";
17
+ import { describe, expect, it } from "vitest";
18
+ import { enhanceOntology } from "../GenerateContext/enhanceOntology.js";
19
+ import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from "./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js";
20
+ function simpleSpt(apiName, metadataLevel = 2) {
21
+ return {
22
+ apiName,
23
+ dataType: {
24
+ type: "integer"
25
+ },
26
+ rid: `${apiName}Rid`,
27
+ displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,
28
+ description: metadataLevel >= 2 ? `${apiName} property desc` : undefined
29
+ };
30
+ }
31
+ function simpleInterface(apiName, spts, parents, metadataLevel = 2) {
32
+ const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));
33
+ return {
34
+ apiName,
35
+ rid: `${apiName}Rid`,
36
+ displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,
37
+ description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,
38
+ extendsInterfaces: parents,
39
+ links: {},
40
+ properties
41
+ };
42
+ }
43
+ function simpleOntology(apiName, interfaces) {
44
+ const interfaceTypes = Object.fromEntries(interfaces.map(i => [i.apiName, i]));
45
+ const sharedPropertyTypes = Object.fromEntries(interfaces.flatMap(i => Object.entries(i.properties)));
46
+ return {
47
+ actionTypes: {},
48
+ interfaceTypes,
49
+ objectTypes: {},
50
+ ontology: {
51
+ apiName,
52
+ description: `${apiName} ontology desc`,
53
+ displayName: `${apiName} ontology dn`,
54
+ rid: `${apiName} ontology rid`
55
+ },
56
+ queryTypes: {},
57
+ sharedPropertyTypes
58
+ };
59
+ }
60
+ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
61
+ it("Does not say (inherited) on properties locally defined", async () => {
62
+ const ontology = enhanceOntology(simpleOntology("ontology", [simpleInterface("Bar", [simpleSpt("bar", 0)], [], 0)]), undefined, new Map(), "");
63
+ const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true), {
64
+ parser: "typescript",
65
+ printWidth: 100
66
+ });
67
+ expect(formattedCode).toMatchInlineSnapshot(`
68
+ "import type {
69
+ InterfaceDefinition as $InterfaceDefinition,
70
+ ObjectSet as $ObjectSet,
71
+ Osdk as $Osdk,
72
+ PropertyValueWireToClient as $PropType,
73
+ } from "@osdk/api";
74
+
75
+ export type OsdkObjectLinks$Bar = {};
76
+
77
+ export namespace Bar {
78
+ export type PropertyKeys = "bar";
79
+
80
+ export interface Props {
81
+ readonly bar: $PropType["integer"] | undefined;
82
+ }
83
+ export interface StrictProps {
84
+ readonly bar: $PropType["integer"] | undefined;
85
+ }
86
+
87
+ export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}
88
+
89
+ export type OsdkObject<
90
+ OPTIONS extends never | "$notStrict" | "$rid" = never,
91
+ K extends keyof Bar.Props = keyof Bar.Props,
92
+ > = $Osdk<Bar, K | OPTIONS>;
93
+ }
94
+
95
+ export interface Bar extends $InterfaceDefinition<"Bar", Bar> {
96
+ osdkMetadata: typeof $osdkMetadata;
97
+ type: "interface";
98
+ apiName: "Bar";
99
+ __DefinitionMetadata?: {
100
+ objectSet: Bar.ObjectSet;
101
+ props: Bar.Props;
102
+ linksType: OsdkObjectLinks$Bar;
103
+ strictProps: Bar.StrictProps;
104
+ apiName: "Bar";
105
+ displayName: "Bar";
106
+ implements: [];
107
+ links: {};
108
+ properties: {
109
+ /**
110
+ * (no ontology metadata)
111
+ */
112
+ bar: $PropertyDef<"integer", "nullable", "single">;
113
+ };
114
+ rid: "BarRid";
115
+ type: "interface";
116
+ };
117
+ }
118
+
119
+ export const Bar: Bar = {
120
+ type: "interface",
121
+ apiName: "Bar",
122
+ osdkMetadata: $osdkMetadata,
123
+ };
124
+ "
125
+ `);
126
+ });
127
+ it("Generates properties for inherited SPTs", async () => {
128
+ const fooSpt = simpleSpt("foo");
129
+ const barSpt = simpleSpt("bar");
130
+ const ontology = enhanceOntology(simpleOntology("ontology", [simpleInterface("Foo", [fooSpt], ["Parent"]), simpleInterface("Parent", [barSpt], [])]), undefined, new Map(), "");
131
+ const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {
132
+ parser: "typescript"
133
+ });
134
+ expect(formattedCode).toMatchInlineSnapshot(`
135
+ "import type {
136
+ InterfaceDefinition as $InterfaceDefinition,
137
+ ObjectSet as $ObjectSet,
138
+ Osdk as $Osdk,
139
+ PropertyValueWireToClient as $PropType,
140
+ } from "@osdk/api";
141
+
142
+ export type OsdkObjectLinks$Foo = {};
143
+
144
+ export namespace Foo {
145
+ export type PropertyKeys = "foo";
146
+
147
+ export interface Props {
148
+ readonly foo: $PropType["integer"] | undefined;
149
+ }
150
+ export interface StrictProps {
151
+ readonly foo: $PropType["integer"] | undefined;
152
+ }
153
+
154
+ export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}
155
+
156
+ export type OsdkObject<
157
+ OPTIONS extends never | "$notStrict" | "$rid" = never,
158
+ K extends keyof Foo.Props = keyof Foo.Props,
159
+ > = $Osdk<Foo, K | OPTIONS>;
160
+ }
161
+
162
+ export interface Foo extends $InterfaceDefinition<"Foo", Foo> {
163
+ osdkMetadata: typeof $osdkMetadata;
164
+ type: "interface";
165
+ apiName: "Foo";
166
+ __DefinitionMetadata?: {
167
+ objectSet: Foo.ObjectSet;
168
+ props: Foo.Props;
169
+ linksType: OsdkObjectLinks$Foo;
170
+ strictProps: Foo.StrictProps;
171
+ apiName: "Foo";
172
+ description: "Foo interface desc";
173
+ displayName: "Foo interface dn";
174
+ implements: ["Parent"];
175
+ links: {};
176
+ properties: {
177
+ /**
178
+ * display name: 'foo property dn',
179
+ * description: foo property desc
180
+ */
181
+ foo: $PropertyDef<"integer", "nullable", "single">;
182
+ };
183
+ rid: "FooRid";
184
+ type: "interface";
185
+ };
186
+ }
187
+
188
+ export const Foo: Foo = {
189
+ type: "interface",
190
+ apiName: "Foo",
191
+ osdkMetadata: $osdkMetadata,
192
+ };
193
+ "
194
+ `);
195
+ });
196
+ it("allows for SPT reuse if the same", async () => {
197
+ const fooSpt = simpleSpt("foo");
198
+ const barSpt = simpleSpt("bar");
199
+ const ontology = enhanceOntology(simpleOntology("ontology", [simpleInterface("Foo", [fooSpt, barSpt], ["Parent"]), simpleInterface("Parent", [barSpt], [])]), undefined, new Map(), "");
200
+ const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {
201
+ parser: "typescript"
202
+ });
203
+ expect(formattedCode).toMatchInlineSnapshot(`
204
+ "import type {
205
+ InterfaceDefinition as $InterfaceDefinition,
206
+ ObjectSet as $ObjectSet,
207
+ Osdk as $Osdk,
208
+ PropertyValueWireToClient as $PropType,
209
+ } from "@osdk/api";
210
+
211
+ export type OsdkObjectLinks$Foo = {};
212
+
213
+ export namespace Foo {
214
+ export type PropertyKeys = "foo" | "bar";
215
+
216
+ export interface Props {
217
+ readonly bar: $PropType["integer"] | undefined;
218
+ readonly foo: $PropType["integer"] | undefined;
219
+ }
220
+ export interface StrictProps {
221
+ readonly bar: $PropType["integer"] | undefined;
222
+ readonly foo: $PropType["integer"] | undefined;
223
+ }
224
+
225
+ export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}
226
+
227
+ export type OsdkObject<
228
+ OPTIONS extends never | "$notStrict" | "$rid" = never,
229
+ K extends keyof Foo.Props = keyof Foo.Props,
230
+ > = $Osdk<Foo, K | OPTIONS>;
231
+ }
232
+
233
+ export interface Foo extends $InterfaceDefinition<"Foo", Foo> {
234
+ osdkMetadata: typeof $osdkMetadata;
235
+ type: "interface";
236
+ apiName: "Foo";
237
+ __DefinitionMetadata?: {
238
+ objectSet: Foo.ObjectSet;
239
+ props: Foo.Props;
240
+ linksType: OsdkObjectLinks$Foo;
241
+ strictProps: Foo.StrictProps;
242
+ apiName: "Foo";
243
+ description: "Foo interface desc";
244
+ displayName: "Foo interface dn";
245
+ implements: ["Parent"];
246
+ links: {};
247
+ properties: {
248
+ /**
249
+ * display name: 'bar property dn',
250
+ * description: bar property desc
251
+ */
252
+ bar: $PropertyDef<"integer", "nullable", "single">;
253
+ /**
254
+ * display name: 'foo property dn',
255
+ * description: foo property desc
256
+ */
257
+ foo: $PropertyDef<"integer", "nullable", "single">;
258
+ };
259
+ rid: "FooRid";
260
+ type: "interface";
261
+ };
262
+ }
263
+
264
+ export const Foo: Foo = {
265
+ type: "interface",
266
+ apiName: "Foo",
267
+ osdkMetadata: $osdkMetadata,
268
+ };
269
+ "
270
+ `);
271
+ });
272
+ });
273
+ //# sourceMappingURL=UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","enhanceOntology","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","properties","Object","fromEntries","map","spt","extendsInterfaces","links","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","Map","formattedCode","Bar","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\nfunction simpleSpt(apiName, metadataLevel = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n };\n}\nfunction simpleInterface(apiName, spts, parents, metadataLevel = 2) {\n const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n };\n}\nfunction simpleOntology(apiName, interfaces) {\n const interfaceTypes = Object\n .fromEntries(interfaces.map(i => [i.apiName, i]));\n const sharedPropertyTypes = Object\n .fromEntries(interfaces.flatMap(i => Object.entries(i.properties)));\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n };\n}\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology(simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]), undefined, new Map(), \"\");\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true), {\n parser: \"typescript\",\n printWidth: 100,\n });\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export interface StrictProps {\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkObject<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk<Bar, K | OPTIONS>;\n }\n\n export interface Bar extends $InterfaceDefinition<\"Bar\", Bar> {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n displayName: \"Bar\";\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology(simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]), undefined, new Map(), \"\");\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\n });\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export interface StrictProps {\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkObject<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk<Foo, K | OPTIONS>;\n }\n\n export interface Foo extends $InterfaceDefinition<\"Foo\", Foo> {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology(simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]), undefined, new Map(), \"\");\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\n });\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export interface StrictProps {\n readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkObject<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk<Foo, K | OPTIONS>;\n }\n\n export interface Foo extends $InterfaceDefinition<\"Foo\", Foo> {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFtC,EAAE,CAAC,yCAAyC,EAAE,YAAY;IACtD,MAAMuC,MAAM,GAAGpC,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAMqC,MAAM,GAAGrC,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAM4B,QAAQ,GAAG9B,eAAe,CAACqB,cAAc,CAAC,UAAU,EAAE,CACxDV,eAAe,CAAC,KAAK,EAAE,CAAC2B,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAC5C3B,eAAe,CAAC,QAAQ,EAAE,CAAC4B,MAAM,CAAC,EAAE,EAAE,CAAC,CAC1C,CAAC,EAAE7B,SAAS,EAAE,IAAIsB,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;IAC7B,MAAMC,aAAa,GAAG,MAAMrC,MAAM,CAACK,8CAA8C,CAAC6B,QAAQ,CAACP,cAAc,CAACiB,GAAG,EAAEV,QAAQ,EAAE,IAAI,CAAC,EAAE;MAC5HK,MAAM,EAAE;IACZ,CAAC,CAAC;IACFrC,MAAM,CAACmC,aAAa,CAAC,CAACI,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFtC,EAAE,CAAC,kCAAkC,EAAE,YAAY;IAC/C,MAAMuC,MAAM,GAAGpC,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAMqC,MAAM,GAAGrC,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAM4B,QAAQ,GAAG9B,eAAe,CAACqB,cAAc,CAAC,UAAU,EAAE,CACxDV,eAAe,CAAC,KAAK,EAAE,CAAC2B,MAAM,EAAEC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EACpD5B,eAAe,CAAC,QAAQ,EAAE,CAAC4B,MAAM,CAAC,EAAE,EAAE,CAAC,CAC1C,CAAC,EAAE7B,SAAS,EAAE,IAAIsB,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;IAC7B,MAAMC,aAAa,GAAG,MAAMrC,MAAM,CAACK,8CAA8C,CAAC6B,QAAQ,CAACP,cAAc,CAACiB,GAAG,EAAEV,QAAQ,EAAE,IAAI,CAAC,EAAE;MAC5HK,MAAM,EAAE;IACZ,CAAC,CAAC;IACFrC,MAAM,CAACmC,aAAa,CAAC,CAACI,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import type { MinimalFs } from "../MinimalFs.js";
2
+ import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
3
+ export declare function generateClientSdkVersionTwoPointZero(ontology: WireOntologyDefinition, userAgent: string, fs: MinimalFs, outDir: string, packageType?: "module" | "commonjs", ontologyApiNamespace?: string, apiNamespacePackageMap?: Map<string, string>): Promise<void>;
4
+ //# sourceMappingURL=generateClientSdkVersionTwoPointZero.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateClientSdkVersionTwoPointZero.d.ts","sourceRoot":"","sources":["../../../src/v2.0/generateClientSdkVersionTwoPointZero.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAgE3E,wBAAsB,oCAAoC,CACxD,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,MAAM,EACd,WAAW,GAAE,QAAQ,GAAG,UAAuB,EAC/C,oBAAoB,CAAC,EAAE,MAAM,EAC7B,sBAAsB,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,iBAgDxD"}
@@ -0,0 +1,119 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import path from "node:path";
17
+ import { enhanceOntology } from "../GenerateContext/enhanceOntology.js";
18
+ import { sanitizeMetadata } from "../shared/sanitizeMetadata.js";
19
+ import { formatTs } from "../util/test/formatTs.js";
20
+ import { verifyOutDir } from "../util/verifyOutDir.js";
21
+ import { generateOntologyMetadataFile } from "./generateMetadata.js";
22
+ import { generatePerActionDataFiles } from "./generatePerActionDataFiles.js";
23
+ import { generatePerQueryDataFilesV2 } from "./generatePerQueryDataFiles.js";
24
+ import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from "./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js";
25
+ import { wireObjectTypeV2ToSdkObjectConstV2 } from "./wireObjectTypeV2ToSdkObjectConstV2.js";
26
+ async function generateRootIndexTsFile({
27
+ fs,
28
+ outDir,
29
+ importExt,
30
+ ontologyApiNamespace
31
+ }) {
32
+ fs.writeFile(path.join(outDir, "index.ts"), await formatTs(`export * from "./ontology/actions${importExt}";
33
+ export * as $Actions from "./ontology/actions${importExt}";
34
+ export * from "./ontology/interfaces${importExt}";
35
+ export * as $Interfaces from "./ontology/interfaces${importExt}";
36
+ export * from "./ontology/objects${importExt}";
37
+ export * as $Objects from "./ontology/objects${importExt}";
38
+ export * from "./ontology/queries${importExt}";
39
+ export * as $Queries from "./ontology/queries${importExt}";
40
+ ${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
41
+ `));
42
+ }
43
+ async function generateEachObjectFile(ctx) {
44
+ const {
45
+ fs,
46
+ outDir,
47
+ ontology,
48
+ importExt
49
+ } = ctx;
50
+ await fs.mkdir(path.join(outDir, "ontology", "objects"), {
51
+ recursive: true
52
+ });
53
+ for (const obj of Object.values(ontology.objectTypes)) {
54
+ const relPath = path.join(".", "ontology", `objects`, `${obj.shortApiName}.ts`);
55
+ const outFilePath = path.join(outDir, relPath);
56
+ await fs.writeFile(outFilePath, await formatTs(`
57
+ import type { PropertyDef as $PropertyDef } from "@osdk/api";
58
+ import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
59
+ import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
60
+ ${wireObjectTypeV2ToSdkObjectConstV2(obj.raw, ctx, relPath)}
61
+ `));
62
+ }
63
+ }
64
+ export async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs, outDir, packageType = "commonjs", ontologyApiNamespace, apiNamespacePackageMap = new Map()) {
65
+ const importExt = packageType === "module" ? ".js" : "";
66
+ await verifyOutDir(outDir, fs);
67
+ const sanitizedOntology = sanitizeMetadata(ontology);
68
+ await fs.mkdir(outDir, {
69
+ recursive: true
70
+ });
71
+ const enhancedOntology = enhanceOntology(sanitizedOntology, ontologyApiNamespace, apiNamespacePackageMap, importExt);
72
+ const ctx = {
73
+ sanitizedOntology,
74
+ ontology: enhancedOntology,
75
+ importExt,
76
+ fs,
77
+ outDir,
78
+ ontologyApiNamespace,
79
+ apiNamespacePackageMap
80
+ };
81
+ await generateRootIndexTsFile(ctx);
82
+ await generateOntologyMetadataFile(ctx, userAgent);
83
+ await generateEachObjectFile(ctx);
84
+ await generateOntologyInterfaces(ctx);
85
+ const actionsDir = path.join(outDir, "ontology", "actions");
86
+ await fs.mkdir(actionsDir, {
87
+ recursive: true
88
+ });
89
+ await generatePerActionDataFiles(ctx);
90
+ await fs.writeFile(path.join(outDir, "ontology", "objects.ts"), await formatTs(`
91
+ ${Object.values(enhancedOntology.objectTypes).map(objType => `export * from "./objects/${objType.shortApiName}${importExt}";`).join("\n")}
92
+ ${Object.keys(ontology.objectTypes).length === 0 ? "export {};" : ""}
93
+ `));
94
+ await generatePerQueryDataFilesV2(ctx, true);
95
+ }
96
+ /** @internal */
97
+ async function generateOntologyInterfaces({
98
+ fs,
99
+ outDir,
100
+ ontology,
101
+ importExt
102
+ }) {
103
+ const interfacesDir = path.join(outDir, "ontology", "interfaces");
104
+ await fs.mkdir(interfacesDir, {
105
+ recursive: true
106
+ });
107
+ for (const obj of Object.values(ontology.interfaceTypes)) {
108
+ await fs.writeFile(path.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`
109
+ import type { PropertyDef as $PropertyDef } from "@osdk/api";
110
+ import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
111
+ ${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
112
+ `));
113
+ }
114
+ await fs.writeFile(interfacesDir + ".ts", await formatTs(`
115
+ ${Object.values(ontology.interfaceTypes).map(interfaceType => `export * from "./interfaces/${interfaceType.shortApiName}${importExt}";`).join("\n")}
116
+ ${Object.keys(ontology.interfaceTypes).length === 0 ? "export {}" : ""}
117
+ `));
118
+ }
119
+ //# sourceMappingURL=generateClientSdkVersionTwoPointZero.js.map