@osdk/generator 2.1.0-beta.3 → 2.1.0-beta.31

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 (447) hide show
  1. package/CHANGELOG.md +311 -0
  2. package/build/browser/GenerateContext/EnhanceCommon.js +0 -15
  3. package/build/browser/GenerateContext/EnhanceCommon.js.map +1 -1
  4. package/build/browser/GenerateContext/EnhancedAction.js +1 -1
  5. package/build/browser/GenerateContext/EnhancedAction.js.map +1 -1
  6. package/build/browser/GenerateContext/EnhancedBase.js +2 -7
  7. package/build/browser/GenerateContext/EnhancedBase.js.map +1 -1
  8. package/build/browser/GenerateContext/EnhancedInterfaceType.js +1 -1
  9. package/build/browser/GenerateContext/EnhancedInterfaceType.js.map +1 -1
  10. package/build/browser/GenerateContext/EnhancedObjectType.js +2 -2
  11. package/build/browser/GenerateContext/EnhancedObjectType.js.map +1 -1
  12. package/build/browser/GenerateContext/EnhancedOntologyDefinition.js +1 -8
  13. package/build/browser/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
  14. package/build/browser/GenerateContext/EnhancedQuery.js +2 -2
  15. package/build/browser/GenerateContext/EnhancedQuery.js.map +1 -1
  16. package/build/browser/GenerateContext/EnhancedSharedPropertyType.js +1 -1
  17. package/build/browser/GenerateContext/EnhancedSharedPropertyType.js.map +1 -1
  18. package/build/browser/GenerateContext/ForeignType.js +1 -1
  19. package/build/browser/GenerateContext/ForeignType.js.map +1 -1
  20. package/build/browser/GenerateContext/GenerateContext.js +0 -15
  21. package/build/browser/GenerateContext/GenerateContext.js.map +1 -1
  22. package/build/browser/GenerateContext/enhanceOntology.js +1 -0
  23. package/build/browser/GenerateContext/enhanceOntology.js.map +1 -1
  24. package/build/browser/MinimalFs.js +0 -15
  25. package/build/browser/MinimalFs.js.map +1 -1
  26. package/build/browser/WireOntologyDefinition.js +0 -15
  27. package/build/browser/WireOntologyDefinition.js.map +1 -1
  28. package/build/browser/generateClientSdkPackage.js +5 -3
  29. package/build/browser/generateClientSdkPackage.js.map +1 -1
  30. package/build/browser/generateClientSdkPackage.test.js +3 -2
  31. package/build/browser/generateClientSdkPackage.test.js.map +1 -1
  32. package/build/browser/index.js +1 -0
  33. package/build/browser/index.js.map +1 -1
  34. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.js +1 -0
  35. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.js.map +1 -1
  36. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js +1 -0
  37. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js.map +1 -1
  38. package/build/browser/shared/getObjectImports.js +1 -0
  39. package/build/browser/shared/getObjectImports.js.map +1 -1
  40. package/build/browser/shared/getObjectTypeApiNamesFromQuery.js +1 -0
  41. package/build/browser/shared/getObjectTypeApiNamesFromQuery.js.map +1 -1
  42. package/build/browser/shared/getObjectTypesFromQueryDataType.js +1 -0
  43. package/build/browser/shared/getObjectTypesFromQueryDataType.js.map +1 -1
  44. package/build/browser/shared/propertyJsdoc.js +1 -0
  45. package/build/browser/shared/propertyJsdoc.js.map +1 -1
  46. package/build/browser/shared/sanitizeMetadata.js +9 -0
  47. package/build/browser/shared/sanitizeMetadata.js.map +1 -1
  48. package/build/browser/shared/sanitizeMetadata.test.js +1 -0
  49. package/build/browser/shared/sanitizeMetadata.test.js.map +1 -1
  50. package/build/browser/util/InMemoryFs.js +1 -0
  51. package/build/browser/util/InMemoryFs.js.map +1 -1
  52. package/build/browser/util/commaSeparatedIdentifiers.js +1 -0
  53. package/build/browser/util/commaSeparatedIdentifiers.js.map +1 -1
  54. package/build/browser/util/commaSeparatedTypeIdentifiers.js +1 -0
  55. package/build/browser/util/commaSeparatedTypeIdentifiers.js.map +1 -1
  56. package/build/browser/util/deleteUndefineds.js +1 -0
  57. package/build/browser/util/deleteUndefineds.js.map +1 -1
  58. package/build/browser/util/reservedKeywords.js +1 -0
  59. package/build/browser/util/reservedKeywords.js.map +1 -1
  60. package/build/browser/util/stringUnionFrom.js +1 -0
  61. package/build/browser/util/stringUnionFrom.js.map +1 -1
  62. package/build/browser/util/stringify.js +16 -0
  63. package/build/browser/util/stringify.js.map +1 -1
  64. package/build/browser/util/test/TodoWireOntology.js +24 -5
  65. package/build/browser/util/test/TodoWireOntology.js.map +1 -1
  66. package/build/browser/util/test/compileThis.js +1 -0
  67. package/build/browser/util/test/compileThis.js.map +1 -1
  68. package/build/browser/util/test/createMockMinimalFiles.js +1 -0
  69. package/build/browser/util/test/createMockMinimalFiles.js.map +1 -1
  70. package/build/browser/util/test/formatTs.js +1 -0
  71. package/build/browser/util/test/formatTs.js.map +1 -1
  72. package/build/browser/util/verifyOutDir.js +1 -0
  73. package/build/browser/util/verifyOutDir.js.map +1 -1
  74. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +10 -7
  75. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  76. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +22 -20
  77. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  78. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +7 -3
  79. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  80. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +572 -557
  81. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  82. package/build/browser/v2.0/generateMetadata.js +4 -1
  83. package/build/browser/v2.0/generateMetadata.js.map +1 -1
  84. package/build/browser/v2.0/generatePerActionDataFiles.js +33 -10
  85. package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -1
  86. package/build/browser/v2.0/generatePerActionDataFiles.test.js +1 -0
  87. package/build/browser/v2.0/generatePerActionDataFiles.test.js.map +1 -1
  88. package/build/browser/v2.0/generatePerInterfaceDataFiles.js +6 -3
  89. package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
  90. package/build/browser/v2.0/generatePerObjectDataFiles.js +2 -1
  91. package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -1
  92. package/build/browser/v2.0/generatePerQueryDataFiles.js +15 -9
  93. package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
  94. package/build/browser/v2.0/generatePerQueryDataFiles.test.js +9 -8
  95. package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  96. package/build/browser/v2.0/generateRootIndexTsFile.js +3 -1
  97. package/build/browser/v2.0/generateRootIndexTsFile.js.map +1 -1
  98. package/build/browser/v2.0/getDescriptionIfPresent.js +1 -0
  99. package/build/browser/v2.0/getDescriptionIfPresent.js.map +1 -1
  100. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +26 -12
  101. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  102. package/build/browser/validateWireOntologyAssumptions.js +3 -2
  103. package/build/browser/validateWireOntologyAssumptions.js.map +1 -1
  104. package/build/cjs/chunk-XOCES5YA.cjs +978 -0
  105. package/build/cjs/chunk-XOCES5YA.cjs.map +1 -0
  106. package/build/cjs/index.cjs +1392 -0
  107. package/build/cjs/index.cjs.map +1 -0
  108. package/build/cjs/index.d.cts +31 -0
  109. package/build/cjs/prompt-YMFYYBNJ.cjs +860 -0
  110. package/build/cjs/prompt-YMFYYBNJ.cjs.map +1 -0
  111. package/build/esm/GenerateContext/EnhanceCommon.js +0 -15
  112. package/build/esm/GenerateContext/EnhanceCommon.js.map +1 -1
  113. package/build/esm/GenerateContext/EnhancedAction.js +1 -1
  114. package/build/esm/GenerateContext/EnhancedAction.js.map +1 -1
  115. package/build/esm/GenerateContext/EnhancedBase.js +2 -7
  116. package/build/esm/GenerateContext/EnhancedBase.js.map +1 -1
  117. package/build/esm/GenerateContext/EnhancedInterfaceType.js +1 -1
  118. package/build/esm/GenerateContext/EnhancedInterfaceType.js.map +1 -1
  119. package/build/esm/GenerateContext/EnhancedObjectType.js +2 -2
  120. package/build/esm/GenerateContext/EnhancedObjectType.js.map +1 -1
  121. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js +1 -8
  122. package/build/esm/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
  123. package/build/esm/GenerateContext/EnhancedQuery.js +2 -2
  124. package/build/esm/GenerateContext/EnhancedQuery.js.map +1 -1
  125. package/build/esm/GenerateContext/EnhancedSharedPropertyType.js +1 -1
  126. package/build/esm/GenerateContext/EnhancedSharedPropertyType.js.map +1 -1
  127. package/build/esm/GenerateContext/ForeignType.js +1 -1
  128. package/build/esm/GenerateContext/ForeignType.js.map +1 -1
  129. package/build/esm/GenerateContext/GenerateContext.js +0 -15
  130. package/build/esm/GenerateContext/GenerateContext.js.map +1 -1
  131. package/build/esm/GenerateContext/enhanceOntology.js +1 -0
  132. package/build/esm/GenerateContext/enhanceOntology.js.map +1 -1
  133. package/build/esm/MinimalFs.js +0 -15
  134. package/build/esm/MinimalFs.js.map +1 -1
  135. package/build/esm/WireOntologyDefinition.js +0 -15
  136. package/build/esm/WireOntologyDefinition.js.map +1 -1
  137. package/build/esm/generateClientSdkPackage.js +5 -3
  138. package/build/esm/generateClientSdkPackage.js.map +1 -1
  139. package/build/esm/generateClientSdkPackage.test.js +3 -2
  140. package/build/esm/generateClientSdkPackage.test.js.map +1 -1
  141. package/build/esm/index.js +1 -0
  142. package/build/esm/index.js.map +1 -1
  143. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.js +1 -0
  144. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.js.map +1 -1
  145. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js +1 -0
  146. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js.map +1 -1
  147. package/build/esm/shared/getObjectImports.js +1 -0
  148. package/build/esm/shared/getObjectImports.js.map +1 -1
  149. package/build/esm/shared/getObjectTypeApiNamesFromQuery.js +1 -0
  150. package/build/esm/shared/getObjectTypeApiNamesFromQuery.js.map +1 -1
  151. package/build/esm/shared/getObjectTypesFromQueryDataType.js +1 -0
  152. package/build/esm/shared/getObjectTypesFromQueryDataType.js.map +1 -1
  153. package/build/esm/shared/propertyJsdoc.js +1 -0
  154. package/build/esm/shared/propertyJsdoc.js.map +1 -1
  155. package/build/esm/shared/sanitizeMetadata.js +9 -0
  156. package/build/esm/shared/sanitizeMetadata.js.map +1 -1
  157. package/build/esm/shared/sanitizeMetadata.test.js +1 -0
  158. package/build/esm/shared/sanitizeMetadata.test.js.map +1 -1
  159. package/build/esm/util/InMemoryFs.js +1 -0
  160. package/build/esm/util/InMemoryFs.js.map +1 -1
  161. package/build/esm/util/commaSeparatedIdentifiers.js +1 -0
  162. package/build/esm/util/commaSeparatedIdentifiers.js.map +1 -1
  163. package/build/esm/util/commaSeparatedTypeIdentifiers.js +1 -0
  164. package/build/esm/util/commaSeparatedTypeIdentifiers.js.map +1 -1
  165. package/build/esm/util/deleteUndefineds.js +1 -0
  166. package/build/esm/util/deleteUndefineds.js.map +1 -1
  167. package/build/esm/util/reservedKeywords.js +1 -0
  168. package/build/esm/util/reservedKeywords.js.map +1 -1
  169. package/build/esm/util/stringUnionFrom.js +1 -0
  170. package/build/esm/util/stringUnionFrom.js.map +1 -1
  171. package/build/esm/util/stringify.js +16 -0
  172. package/build/esm/util/stringify.js.map +1 -1
  173. package/build/esm/util/test/TodoWireOntology.js +24 -5
  174. package/build/esm/util/test/TodoWireOntology.js.map +1 -1
  175. package/build/esm/util/test/compileThis.js +1 -0
  176. package/build/esm/util/test/compileThis.js.map +1 -1
  177. package/build/esm/util/test/createMockMinimalFiles.js +1 -0
  178. package/build/esm/util/test/createMockMinimalFiles.js.map +1 -1
  179. package/build/esm/util/test/formatTs.js +1 -0
  180. package/build/esm/util/test/formatTs.js.map +1 -1
  181. package/build/esm/util/verifyOutDir.js +1 -0
  182. package/build/esm/util/verifyOutDir.js.map +1 -1
  183. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +10 -7
  184. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  185. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +22 -20
  186. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  187. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +7 -3
  188. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  189. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +572 -557
  190. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  191. package/build/esm/v2.0/generateMetadata.js +4 -1
  192. package/build/esm/v2.0/generateMetadata.js.map +1 -1
  193. package/build/esm/v2.0/generatePerActionDataFiles.js +33 -10
  194. package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -1
  195. package/build/esm/v2.0/generatePerActionDataFiles.test.js +1 -0
  196. package/build/esm/v2.0/generatePerActionDataFiles.test.js.map +1 -1
  197. package/build/esm/v2.0/generatePerInterfaceDataFiles.js +6 -3
  198. package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
  199. package/build/esm/v2.0/generatePerObjectDataFiles.js +2 -1
  200. package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -1
  201. package/build/esm/v2.0/generatePerQueryDataFiles.js +15 -9
  202. package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
  203. package/build/esm/v2.0/generatePerQueryDataFiles.test.js +9 -8
  204. package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  205. package/build/esm/v2.0/generateRootIndexTsFile.js +3 -1
  206. package/build/esm/v2.0/generateRootIndexTsFile.js.map +1 -1
  207. package/build/esm/v2.0/getDescriptionIfPresent.js +1 -0
  208. package/build/esm/v2.0/getDescriptionIfPresent.js.map +1 -1
  209. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +26 -12
  210. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  211. package/build/esm/validateWireOntologyAssumptions.js +3 -2
  212. package/build/esm/validateWireOntologyAssumptions.js.map +1 -1
  213. package/build/types/GenerateContext/EnhanceCommon.d.ts +6 -0
  214. package/build/types/GenerateContext/EnhancedAction.d.ts +13 -0
  215. package/build/types/GenerateContext/EnhancedBase.d.ts +20 -0
  216. package/build/types/GenerateContext/EnhancedInterfaceType.d.ts +12 -0
  217. package/build/types/GenerateContext/EnhancedObjectType.d.ts +11 -0
  218. package/build/types/GenerateContext/EnhancedOntologyDefinition.d.ts +28 -0
  219. package/build/types/GenerateContext/EnhancedQuery.d.ts +13 -0
  220. package/build/types/GenerateContext/EnhancedSharedPropertyType.d.ts +7 -0
  221. package/build/types/GenerateContext/ForeignType.d.ts +8 -0
  222. package/build/types/GenerateContext/GenerateContext.d.ts +13 -0
  223. package/build/types/GenerateContext/enhanceOntology.d.ts +9 -0
  224. package/build/types/MinimalFs.d.ts +7 -0
  225. package/build/types/WireOntologyDefinition.d.ts +2 -0
  226. package/build/types/generateClientSdkPackage.d.ts +31 -0
  227. package/build/types/generateClientSdkPackage.test.d.ts +1 -0
  228. package/build/types/index.d.ts +4 -0
  229. package/build/{browser → types}/shared/apiNamespaces/startsWithApiNamespace.d.ts +0 -1
  230. package/build/types/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +1 -0
  231. package/build/{browser → types}/shared/getObjectImports.d.ts +2 -2
  232. package/build/{browser → types}/shared/getObjectTypeApiNamesFromQuery.d.ts +1 -2
  233. package/build/types/shared/getObjectTypesFromQueryDataType.d.ts +2 -0
  234. package/build/{browser → types}/shared/propertyJsdoc.d.ts +2 -3
  235. package/build/types/shared/sanitizeMetadata.d.ts +1 -0
  236. package/build/types/shared/sanitizeMetadata.test.d.ts +1 -0
  237. package/build/{browser → types}/util/InMemoryFs.d.ts +2 -3
  238. package/build/{browser → types}/util/commaSeparatedIdentifiers.d.ts +0 -1
  239. package/build/{browser → types}/util/commaSeparatedTypeIdentifiers.d.ts +0 -1
  240. package/build/{browser → types}/util/deleteUndefineds.d.ts +0 -1
  241. package/build/{browser → types}/util/reservedKeywords.d.ts +0 -1
  242. package/build/{browser → types}/util/stringUnionFrom.d.ts +0 -1
  243. package/build/types/util/stringify.d.ts +20 -0
  244. package/build/types/util/test/TodoWireOntology.d.ts +2 -0
  245. package/build/{browser → types}/util/test/compileThis.d.ts +0 -1
  246. package/build/types/util/test/createMockMinimalFiles.d.ts +10 -0
  247. package/build/{browser → types}/util/test/formatTs.d.ts +0 -1
  248. package/build/types/util/verifyOutDir.d.ts +8 -0
  249. package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +1 -0
  250. package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +1 -0
  251. package/build/{esm → types}/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -2
  252. package/build/types/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +1 -0
  253. package/build/{browser → types}/v2.0/generateMetadata.d.ts +0 -1
  254. package/build/{esm → types}/v2.0/generatePerActionDataFiles.d.ts +1 -2
  255. package/build/types/v2.0/generatePerActionDataFiles.test.d.ts +1 -0
  256. package/build/types/v2.0/generatePerInterfaceDataFiles.d.ts +1 -0
  257. package/build/{esm → types}/v2.0/generatePerObjectDataFiles.d.ts +0 -1
  258. package/build/{browser → types}/v2.0/generatePerQueryDataFiles.d.ts +2 -5
  259. package/build/types/v2.0/generatePerQueryDataFiles.test.d.ts +1 -0
  260. package/build/{esm → types}/v2.0/generateRootIndexTsFile.d.ts +0 -1
  261. package/build/{browser → types}/v2.0/getDescriptionIfPresent.d.ts +0 -1
  262. package/build/{browser → types}/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +4 -6
  263. package/build/{browser → types}/validateWireOntologyAssumptions.d.ts +0 -1
  264. package/package.json +29 -13
  265. package/build/browser/GenerateContext/EnhanceCommon.d.ts +0 -7
  266. package/build/browser/GenerateContext/EnhanceCommon.d.ts.map +0 -1
  267. package/build/browser/GenerateContext/EnhancedAction.d.ts +0 -14
  268. package/build/browser/GenerateContext/EnhancedAction.d.ts.map +0 -1
  269. package/build/browser/GenerateContext/EnhancedBase.d.ts +0 -21
  270. package/build/browser/GenerateContext/EnhancedBase.d.ts.map +0 -1
  271. package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts +0 -13
  272. package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts.map +0 -1
  273. package/build/browser/GenerateContext/EnhancedObjectType.d.ts +0 -12
  274. package/build/browser/GenerateContext/EnhancedObjectType.d.ts.map +0 -1
  275. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts +0 -27
  276. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts.map +0 -1
  277. package/build/browser/GenerateContext/EnhancedQuery.d.ts +0 -14
  278. package/build/browser/GenerateContext/EnhancedQuery.d.ts.map +0 -1
  279. package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts +0 -8
  280. package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts.map +0 -1
  281. package/build/browser/GenerateContext/ForeignType.d.ts +0 -9
  282. package/build/browser/GenerateContext/ForeignType.d.ts.map +0 -1
  283. package/build/browser/GenerateContext/GenerateContext.d.ts +0 -13
  284. package/build/browser/GenerateContext/GenerateContext.d.ts.map +0 -1
  285. package/build/browser/GenerateContext/enhanceOntology.d.ts +0 -10
  286. package/build/browser/GenerateContext/enhanceOntology.d.ts.map +0 -1
  287. package/build/browser/MinimalFs.d.ts +0 -10
  288. package/build/browser/MinimalFs.d.ts.map +0 -1
  289. package/build/browser/WireOntologyDefinition.d.ts +0 -4
  290. package/build/browser/WireOntologyDefinition.d.ts.map +0 -1
  291. package/build/browser/generateClientSdkPackage.d.ts +0 -47
  292. package/build/browser/generateClientSdkPackage.d.ts.map +0 -1
  293. package/build/browser/generateClientSdkPackage.test.d.ts +0 -2
  294. package/build/browser/generateClientSdkPackage.test.d.ts.map +0 -1
  295. package/build/browser/index.d.ts +0 -5
  296. package/build/browser/index.d.ts.map +0 -1
  297. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +0 -1
  298. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +0 -2
  299. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +0 -1
  300. package/build/browser/shared/getObjectImports.d.ts.map +0 -1
  301. package/build/browser/shared/getObjectTypeApiNamesFromQuery.d.ts.map +0 -1
  302. package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts +0 -3
  303. package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts.map +0 -1
  304. package/build/browser/shared/propertyJsdoc.d.ts.map +0 -1
  305. package/build/browser/shared/sanitizeMetadata.d.ts +0 -2
  306. package/build/browser/shared/sanitizeMetadata.d.ts.map +0 -1
  307. package/build/browser/shared/sanitizeMetadata.test.d.ts +0 -2
  308. package/build/browser/shared/sanitizeMetadata.test.d.ts.map +0 -1
  309. package/build/browser/util/InMemoryFs.d.ts.map +0 -1
  310. package/build/browser/util/commaSeparatedIdentifiers.d.ts.map +0 -1
  311. package/build/browser/util/commaSeparatedTypeIdentifiers.d.ts.map +0 -1
  312. package/build/browser/util/deleteUndefineds.d.ts.map +0 -1
  313. package/build/browser/util/reservedKeywords.d.ts.map +0 -1
  314. package/build/browser/util/stringUnionFrom.d.ts.map +0 -1
  315. package/build/browser/util/stringify.d.ts +0 -20
  316. package/build/browser/util/stringify.d.ts.map +0 -1
  317. package/build/browser/util/test/TodoWireOntology.d.ts +0 -217
  318. package/build/browser/util/test/TodoWireOntology.d.ts.map +0 -1
  319. package/build/browser/util/test/compileThis.d.ts.map +0 -1
  320. package/build/browser/util/test/createMockMinimalFiles.d.ts +0 -13
  321. package/build/browser/util/test/createMockMinimalFiles.d.ts.map +0 -1
  322. package/build/browser/util/test/formatTs.d.ts.map +0 -1
  323. package/build/browser/util/verifyOutDir.d.ts +0 -9
  324. package/build/browser/util/verifyOutDir.d.ts.map +0 -1
  325. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +0 -2
  326. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +0 -1
  327. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +0 -2
  328. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +0 -1
  329. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +0 -4
  330. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +0 -1
  331. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +0 -2
  332. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +0 -1
  333. package/build/browser/v2.0/generateMetadata.d.ts.map +0 -1
  334. package/build/browser/v2.0/generatePerActionDataFiles.d.ts +0 -3
  335. package/build/browser/v2.0/generatePerActionDataFiles.d.ts.map +0 -1
  336. package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts +0 -2
  337. package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts.map +0 -1
  338. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts +0 -2
  339. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts.map +0 -1
  340. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts +0 -3
  341. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts.map +0 -1
  342. package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +0 -1
  343. package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts +0 -2
  344. package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts.map +0 -1
  345. package/build/browser/v2.0/generateRootIndexTsFile.d.ts +0 -3
  346. package/build/browser/v2.0/generateRootIndexTsFile.d.ts.map +0 -1
  347. package/build/browser/v2.0/getDescriptionIfPresent.d.ts.map +0 -1
  348. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +0 -1
  349. package/build/browser/validateWireOntologyAssumptions.d.ts.map +0 -1
  350. package/build/esm/GenerateContext/EnhanceCommon.d.ts +0 -7
  351. package/build/esm/GenerateContext/EnhanceCommon.d.ts.map +0 -1
  352. package/build/esm/GenerateContext/EnhancedAction.d.ts +0 -14
  353. package/build/esm/GenerateContext/EnhancedAction.d.ts.map +0 -1
  354. package/build/esm/GenerateContext/EnhancedBase.d.ts +0 -21
  355. package/build/esm/GenerateContext/EnhancedBase.d.ts.map +0 -1
  356. package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts +0 -13
  357. package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts.map +0 -1
  358. package/build/esm/GenerateContext/EnhancedObjectType.d.ts +0 -12
  359. package/build/esm/GenerateContext/EnhancedObjectType.d.ts.map +0 -1
  360. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts +0 -27
  361. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts.map +0 -1
  362. package/build/esm/GenerateContext/EnhancedQuery.d.ts +0 -14
  363. package/build/esm/GenerateContext/EnhancedQuery.d.ts.map +0 -1
  364. package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts +0 -8
  365. package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts.map +0 -1
  366. package/build/esm/GenerateContext/ForeignType.d.ts +0 -9
  367. package/build/esm/GenerateContext/ForeignType.d.ts.map +0 -1
  368. package/build/esm/GenerateContext/GenerateContext.d.ts +0 -13
  369. package/build/esm/GenerateContext/GenerateContext.d.ts.map +0 -1
  370. package/build/esm/GenerateContext/enhanceOntology.d.ts +0 -10
  371. package/build/esm/GenerateContext/enhanceOntology.d.ts.map +0 -1
  372. package/build/esm/MinimalFs.d.ts +0 -10
  373. package/build/esm/MinimalFs.d.ts.map +0 -1
  374. package/build/esm/WireOntologyDefinition.d.ts +0 -4
  375. package/build/esm/WireOntologyDefinition.d.ts.map +0 -1
  376. package/build/esm/generateClientSdkPackage.d.ts +0 -47
  377. package/build/esm/generateClientSdkPackage.d.ts.map +0 -1
  378. package/build/esm/generateClientSdkPackage.test.d.ts +0 -2
  379. package/build/esm/generateClientSdkPackage.test.d.ts.map +0 -1
  380. package/build/esm/index.d.ts +0 -5
  381. package/build/esm/index.d.ts.map +0 -1
  382. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.d.ts +0 -2
  383. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +0 -1
  384. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +0 -2
  385. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +0 -1
  386. package/build/esm/shared/getObjectImports.d.ts +0 -4
  387. package/build/esm/shared/getObjectImports.d.ts.map +0 -1
  388. package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts +0 -4
  389. package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts.map +0 -1
  390. package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts +0 -3
  391. package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts.map +0 -1
  392. package/build/esm/shared/propertyJsdoc.d.ts +0 -6
  393. package/build/esm/shared/propertyJsdoc.d.ts.map +0 -1
  394. package/build/esm/shared/sanitizeMetadata.d.ts +0 -2
  395. package/build/esm/shared/sanitizeMetadata.d.ts.map +0 -1
  396. package/build/esm/shared/sanitizeMetadata.test.d.ts +0 -2
  397. package/build/esm/shared/sanitizeMetadata.test.d.ts.map +0 -1
  398. package/build/esm/util/InMemoryFs.d.ts +0 -7
  399. package/build/esm/util/InMemoryFs.d.ts.map +0 -1
  400. package/build/esm/util/commaSeparatedIdentifiers.d.ts +0 -2
  401. package/build/esm/util/commaSeparatedIdentifiers.d.ts.map +0 -1
  402. package/build/esm/util/commaSeparatedTypeIdentifiers.d.ts +0 -2
  403. package/build/esm/util/commaSeparatedTypeIdentifiers.d.ts.map +0 -1
  404. package/build/esm/util/deleteUndefineds.d.ts +0 -2
  405. package/build/esm/util/deleteUndefineds.d.ts.map +0 -1
  406. package/build/esm/util/reservedKeywords.d.ts +0 -2
  407. package/build/esm/util/reservedKeywords.d.ts.map +0 -1
  408. package/build/esm/util/stringUnionFrom.d.ts +0 -2
  409. package/build/esm/util/stringUnionFrom.d.ts.map +0 -1
  410. package/build/esm/util/stringify.d.ts +0 -20
  411. package/build/esm/util/stringify.d.ts.map +0 -1
  412. package/build/esm/util/test/TodoWireOntology.d.ts +0 -217
  413. package/build/esm/util/test/TodoWireOntology.d.ts.map +0 -1
  414. package/build/esm/util/test/compileThis.d.ts +0 -3
  415. package/build/esm/util/test/compileThis.d.ts.map +0 -1
  416. package/build/esm/util/test/createMockMinimalFiles.d.ts +0 -13
  417. package/build/esm/util/test/createMockMinimalFiles.d.ts.map +0 -1
  418. package/build/esm/util/test/formatTs.d.ts +0 -2
  419. package/build/esm/util/test/formatTs.d.ts.map +0 -1
  420. package/build/esm/util/verifyOutDir.d.ts +0 -9
  421. package/build/esm/util/verifyOutDir.d.ts.map +0 -1
  422. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +0 -2
  423. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +0 -1
  424. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +0 -2
  425. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +0 -1
  426. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +0 -1
  427. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +0 -2
  428. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +0 -1
  429. package/build/esm/v2.0/generateMetadata.d.ts +0 -3
  430. package/build/esm/v2.0/generateMetadata.d.ts.map +0 -1
  431. package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +0 -1
  432. package/build/esm/v2.0/generatePerActionDataFiles.test.d.ts +0 -2
  433. package/build/esm/v2.0/generatePerActionDataFiles.test.d.ts.map +0 -1
  434. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts +0 -2
  435. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts.map +0 -1
  436. package/build/esm/v2.0/generatePerObjectDataFiles.d.ts.map +0 -1
  437. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts +0 -9
  438. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +0 -1
  439. package/build/esm/v2.0/generatePerQueryDataFiles.test.d.ts +0 -2
  440. package/build/esm/v2.0/generatePerQueryDataFiles.test.d.ts.map +0 -1
  441. package/build/esm/v2.0/generateRootIndexTsFile.d.ts.map +0 -1
  442. package/build/esm/v2.0/getDescriptionIfPresent.d.ts +0 -2
  443. package/build/esm/v2.0/getDescriptionIfPresent.d.ts.map +0 -1
  444. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +0 -12
  445. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +0 -1
  446. package/build/esm/validateWireOntologyAssumptions.d.ts +0 -3
  447. package/build/esm/validateWireOntologyAssumptions.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"generatePerQueryDataFiles.test.js","names":["ts","describe","expect","it","enhanceOntology","createMockMinimalFiles","TodoWireOntology","generatePerQueryDataFilesV2","helper","fs","minimalFiles","ontology","sanitized","importExt","externalObjects","Map","externalInterfaces","externalSpts","outDir","getFiles","toMatchInlineSnapshot","writeFile","rootFileNames","Object","keys","console","log","files","forEach","fileName","version","servicesHost","getScriptFileNames","getScriptVersion","toString","getScriptSnapshot","undefined","ScriptSnapshot","fromString","getCurrentDirectory","getCompilationSettings","getDefaultLibFileName","options","getDefaultLibFilePath","fileExists","path","readFile","readDirectory","extensions","exclude","include","depth","sys","directoryExists","getDirectories","langServices","createLanguageService","q","getDocCommentTemplateAtPosition","createDocumentRegistry","actionTypes","interfaceTypes","objectTypes","apiName","description","displayName","rid","queryTypes","doThing","parameters","foo","dataType","type","paramStruct","fields","name","fieldType","output","sharedPropertyTypes"],"sources":["generatePerQueryDataFiles.test.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 * as ts from \"typescript\";\nimport { describe, expect, it } from \"vitest\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { createMockMinimalFiles } from \"../util/test/createMockMinimalFiles.js\";\nimport { TodoWireOntology } from \"../util/test/TodoWireOntology.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\ndescribe(\"generatePerQueryDataFiles\", () => {\n it(\"is stable v2\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n await generatePerQueryDataFilesV2({\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: TodoWireOntology,\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n }, true);\n expect(helper.getFiles()).toMatchInlineSnapshot(`\n {\n \"/foo/ontology/queries.ts\": \"export { getCount } from './queries/getCount.js';\n export { returnsTodo } from './queries/returnsTodo.js';\n \",\n \"/foo/ontology/queries/getCount.ts\": \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n\n export namespace getCount {\n export interface Signature {\n (query: getCount.Parameters): Promise<getCount.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * (no ontology metadata)\n */\n readonly completed: QueryParam.PrimitiveType<'boolean'>;\n }\n\n export type ReturnType = QueryResult.PrimitiveType<'integer'>;\n }\n\n export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'getCount';\n rid: 'rid.query.1';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * (no ontology metadata)\n */\n completed: {\n nullable: false;\n type: 'boolean';\n };\n };\n output: {\n nullable: false;\n type: 'integer';\n };\n signature: getCount.Signature;\n };\n apiName: 'getCount';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const getCount: getCount = {\n apiName: 'getCount',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n \"/foo/ontology/queries/returnsTodo.ts\": \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n import type { Todo } from '../objects/Todo.js';\n\n export namespace returnsTodo {\n export interface Signature {\n (query: returnsTodo.Parameters): Promise<returnsTodo.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * description: Random desc so we test jsdoc\n */\n readonly someTodo: QueryParam.ObjectType<Todo>;\n }\n\n export type ReturnType = QueryResult.ObjectType<Todo>;\n }\n\n export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'returnsTodo';\n rid: 'rid.query.2';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * description: Random desc so we test jsdoc\n */\n someTodo: {\n description: 'Random desc so we test jsdoc';\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n };\n output: {\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n signature: returnsTodo.Signature;\n };\n apiName: 'returnsTodo';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const returnsTodo: returnsTodo = {\n apiName: 'returnsTodo',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n }\n `);\n await helper.minimalFiles.writeFile(\"/bar/test.ts\", `\n import {returnsTodo} from \"/foo/ontology/queries/returnsTodo.ts\";\n\n returnsTodo({someTodo:/*marker*/})\n `);\n const rootFileNames = Object.keys(helper.getFiles());\n console.log(rootFileNames);\n const files = {};\n // initialize the list of files\n rootFileNames.forEach(fileName => {\n files[fileName] = { version: 0 };\n });\n const servicesHost = {\n getScriptFileNames: () => Object.keys(helper.getFiles()),\n getScriptVersion: fileName => files[fileName] && files[fileName].version.toString(),\n getScriptSnapshot: fileName => {\n if (!helper.getFiles()[fileName]) {\n return undefined;\n }\n return ts.ScriptSnapshot.fromString(helper.getFiles()[fileName]);\n },\n getCurrentDirectory: () => \"/bar\",\n getCompilationSettings: () => ({}),\n getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),\n fileExists: (path) => {\n console.log(path);\n return helper.getFiles()[path] !== undefined;\n },\n readFile: (path) => {\n console.log(\"readFile: \", path);\n return helper.getFiles()[path];\n },\n readDirectory: (path, extensions, exclude, include, depth) => {\n console.log(\"readDirectory\", path);\n return ts.sys.readDirectory(path, extensions, exclude, include, depth);\n },\n directoryExists: ts.sys.directoryExists,\n getDirectories: ts.sys.getDirectories,\n };\n const langServices = ts.createLanguageService(servicesHost);\n const q = langServices.getDocCommentTemplateAtPosition(\"/bar/test.ts\", 1);\n console.log(q);\n ts.createDocumentRegistry();\n });\n it(\"generates structs for queries\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n await generatePerQueryDataFilesV2({\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n ontology: {\n apiName: \"foo\",\n description: \"foo\",\n displayName: \"foo\",\n rid: \"ri.foo\",\n },\n queryTypes: {\n doThing: {\n rid: \"rid.query.1\",\n version: \"0\",\n apiName: \"doThing\",\n parameters: {\n foo: {\n dataType: { type: \"string\" },\n },\n paramStruct: {\n dataType: {\n type: \"struct\",\n fields: [\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n output: {\n type: \"struct\",\n fields: [\n {\n name: \"aString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"anInteger\",\n fieldType: { type: \"integer\" },\n },\n {\n name: \"aLong\",\n fieldType: { type: \"long\" },\n },\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n sharedPropertyTypes: {},\n },\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n }, true);\n expect(helper.getFiles()[\"/foo/ontology/queries/doThing.ts\"])\n .toMatchInlineSnapshot(`\n \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n\n export namespace doThing {\n export interface Signature {\n (query: doThing.Parameters): Promise<doThing.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * (no ontology metadata)\n */\n readonly foo: QueryParam.PrimitiveType<'string'>;\n\n /**\n * (no ontology metadata)\n */\n readonly paramStruct: {\n readonly aDate: QueryParam.PrimitiveType<'datetime'>;\n\n readonly nestedStruct: {\n readonly nestedInteger: QueryParam.PrimitiveType<'integer'>;\n\n readonly nestedString: QueryParam.PrimitiveType<'string'>;\n };\n };\n }\n\n export interface ReturnType {\n aDate: QueryResult.PrimitiveType<'datetime'>;\n\n aLong: QueryResult.PrimitiveType<'long'>;\n\n anInteger: QueryResult.PrimitiveType<'integer'>;\n\n aString: QueryResult.PrimitiveType<'string'>;\n\n nestedStruct: {\n nestedInteger: QueryResult.PrimitiveType<'integer'>;\n\n nestedString: QueryResult.PrimitiveType<'string'>;\n };\n }\n }\n\n export interface doThing extends QueryDefinition<doThing.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'doThing';\n rid: 'rid.query.1';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * (no ontology metadata)\n */\n foo: {\n nullable: false;\n type: 'string';\n };\n /**\n * (no ontology metadata)\n */\n paramStruct: {\n nullable: false;\n struct: {\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n };\n output: {\n nullable: false;\n struct: {\n aString: {\n type: 'string';\n nullable: false;\n };\n anInteger: {\n type: 'integer';\n nullable: false;\n };\n aLong: {\n type: 'long';\n nullable: false;\n };\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n signature: doThing.Signature;\n };\n apiName: 'doThing';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const doThing: doThing = {\n apiName: 'doThing',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,EAAE,MAAM,YAAY;AAChC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,sBAAsB,QAAQ,wCAAwC;AAC/E,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5EN,QAAQ,CAAC,2BAA2B,EAAE,MAAM;EACxCE,EAAE,CAAC,cAAc,EAAE,YAAY;IAC3B,MAAMK,MAAM,GAAGH,sBAAsB,CAAC,CAAC;IAEvC,MAAME,2BAA2B,CAAC;MAC9BE,EAAE,EAAED,MAAM,CAACE,YAAY;MACvBC,QAAQ,EAAEP,eAAe,CAAC;QACtBQ,SAAS,EAAEN,gBAAgB;QAC3BO,SAAS,EAAE,KAAK;QAChBC,eAAe,EAAE,IAAIC,GAAG,CAAC,CAAC;QAC1BC,kBAAkB,EAAE,IAAID,GAAG,CAAC,CAAC;QAC7BE,YAAY,EAAE,IAAIF,GAAG,CAAC;MAC1B,CAAC,CAAC;MACFG,MAAM,EAVQ,MAUG;MACjBL,SAAS,EAAE;IACf,CAAC,EAAE,IAAI,CAAC;IACRX,MAAM,CAACM,MAAM,CAACW,QAAQ,CAAC,CAAC,CAAC,CAACC,qBAAqB,CAAC;AACxD;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;AAC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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;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,OAAO,CAAC;EACJ,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"generatePerQueryDataFiles.test.js","names":["ts","describe","expect","it","enhanceOntology","createMockMinimalFiles","TodoWireOntology","generatePerQueryDataFilesV2","helper","fs","minimalFiles","ontology","sanitized","importExt","externalObjects","Map","externalInterfaces","externalSpts","outDir","forInternalUse","getFiles","toMatchInlineSnapshot","writeFile","rootFileNames","Object","keys","console","log","files","forEach","fileName","version","servicesHost","getScriptFileNames","getScriptVersion","toString","getScriptSnapshot","undefined","ScriptSnapshot","fromString","getCurrentDirectory","getCompilationSettings","getDefaultLibFileName","options","getDefaultLibFilePath","fileExists","path","readFile","readDirectory","extensions","exclude","include","depth","sys","directoryExists","getDirectories","langServices","createLanguageService","q","getDocCommentTemplateAtPosition","createDocumentRegistry","actionTypes","interfaceTypes","objectTypes","apiName","description","displayName","rid","queryTypes","doThing","parameters","foo","dataType","type","paramStruct","fields","name","fieldType","output","sharedPropertyTypes"],"sources":["generatePerQueryDataFiles.test.ts"],"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\nimport * as ts from \"typescript\";\nimport { describe, expect, it } from \"vitest\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { createMockMinimalFiles } from \"../util/test/createMockMinimalFiles.js\";\nimport { TodoWireOntology } from \"../util/test/TodoWireOntology.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\n\ndescribe(\"generatePerQueryDataFiles\", () => {\n it(\"is stable v2\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n\n await generatePerQueryDataFilesV2(\n {\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: TodoWireOntology,\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n forInternalUse: true,\n },\n true,\n );\n\n expect(helper.getFiles()).toMatchInlineSnapshot(`\n {\n \"/foo/ontology/queries.ts\": \"export { getCount } from './queries/getCount.js';\n export { returnsTodo } from './queries/returnsTodo.js';\n \",\n \"/foo/ontology/queries/getCount.ts\": \"import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n\n export namespace getCount {\n export interface Signature {\n (query: getCount.Parameters): Promise<getCount.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * (no ontology metadata)\n */\n readonly completed: QueryParam.PrimitiveType<'boolean'>;\n }\n\n export type ReturnType = QueryResult.PrimitiveType<'integer'>;\n }\n\n export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'getCount';\n rid: 'rid.query.1';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * (no ontology metadata)\n */\n completed: {\n nullable: false;\n type: 'boolean';\n };\n };\n output: {\n nullable: false;\n type: 'integer';\n };\n signature: getCount.Signature;\n };\n apiName: 'getCount';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const getCount: getCount = {\n apiName: 'getCount',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n \"/foo/ontology/queries/returnsTodo.ts\": \"import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n import type { Todo } from '../objects/Todo.js';\n\n export namespace returnsTodo {\n export interface Signature {\n (query: returnsTodo.Parameters): Promise<returnsTodo.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * description: Random desc so we test jsdoc\n */\n readonly someTodo: QueryParam.ObjectType<Todo>;\n }\n\n export type ReturnType = QueryResult.ObjectType<Todo>;\n }\n\n export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'returnsTodo';\n rid: 'rid.query.2';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * description: Random desc so we test jsdoc\n */\n someTodo: {\n description: 'Random desc so we test jsdoc';\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n };\n output: {\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n signature: returnsTodo.Signature;\n };\n apiName: 'returnsTodo';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const returnsTodo: returnsTodo = {\n apiName: 'returnsTodo',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n }\n `);\n\n await helper.minimalFiles.writeFile(\n \"/bar/test.ts\",\n `\n import {returnsTodo} from \"/foo/ontology/queries/returnsTodo.ts\";\n\n returnsTodo({someTodo:/*marker*/})\n `,\n );\n\n const rootFileNames = Object.keys(helper.getFiles());\n console.log(rootFileNames);\n\n const files: ts.MapLike<{ version: number }> = {};\n\n // initialize the list of files\n rootFileNames.forEach(fileName => {\n files[fileName] = { version: 0 };\n });\n\n const servicesHost: ts.LanguageServiceHost = {\n getScriptFileNames: () => Object.keys(helper.getFiles()),\n getScriptVersion: fileName =>\n files[fileName] && files[fileName].version.toString(),\n getScriptSnapshot: fileName => {\n if (!helper.getFiles()[fileName]) {\n return undefined;\n }\n\n return ts.ScriptSnapshot.fromString(\n helper.getFiles()[fileName],\n );\n },\n getCurrentDirectory: () => \"/bar\",\n getCompilationSettings: () => ({}),\n getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),\n fileExists: (path: string) => {\n console.log(path);\n return helper.getFiles()[path] !== undefined;\n },\n readFile: (path: string) => {\n console.log(\"readFile: \", path);\n return helper.getFiles()[path];\n },\n readDirectory: (path, extensions, exclude, include, depth) => {\n console.log(\"readDirectory\", path);\n return ts.sys.readDirectory(path, extensions, exclude, include, depth);\n },\n directoryExists: ts.sys.directoryExists,\n getDirectories: ts.sys.getDirectories,\n };\n\n const langServices = ts.createLanguageService(servicesHost);\n\n const q = langServices.getDocCommentTemplateAtPosition(\"/bar/test.ts\", 1);\n console.log(q);\n ts.createDocumentRegistry();\n });\n\n it(\"generates structs for queries\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n\n await generatePerQueryDataFilesV2(\n {\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n ontology: {\n apiName: \"foo\",\n description: \"foo\",\n displayName: \"foo\",\n rid: \"ri.foo\",\n },\n queryTypes: {\n doThing: {\n rid: \"rid.query.1\",\n version: \"0\",\n apiName: \"doThing\",\n parameters: {\n foo: {\n dataType: { type: \"string\" },\n },\n paramStruct: {\n dataType: {\n type: \"struct\",\n fields: [\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n output: {\n type: \"struct\",\n fields: [\n {\n name: \"aString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"anInteger\",\n fieldType: { type: \"integer\" },\n },\n {\n name: \"aLong\",\n fieldType: { type: \"long\" },\n },\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n sharedPropertyTypes: {},\n },\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n forInternalUse: true,\n },\n true,\n );\n expect(helper.getFiles()[\"/foo/ontology/queries/doThing.ts\"])\n .toMatchInlineSnapshot(`\n \"import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n\n export namespace doThing {\n export interface Signature {\n (query: doThing.Parameters): Promise<doThing.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * (no ontology metadata)\n */\n readonly foo: QueryParam.PrimitiveType<'string'>;\n\n /**\n * (no ontology metadata)\n */\n readonly paramStruct: {\n readonly aDate: QueryParam.PrimitiveType<'datetime'>;\n\n readonly nestedStruct: {\n readonly nestedInteger: QueryParam.PrimitiveType<'integer'>;\n\n readonly nestedString: QueryParam.PrimitiveType<'string'>;\n };\n };\n }\n\n export interface ReturnType {\n aDate: QueryResult.PrimitiveType<'datetime'>;\n\n aLong: QueryResult.PrimitiveType<'long'>;\n\n anInteger: QueryResult.PrimitiveType<'integer'>;\n\n aString: QueryResult.PrimitiveType<'string'>;\n\n nestedStruct: {\n nestedInteger: QueryResult.PrimitiveType<'integer'>;\n\n nestedString: QueryResult.PrimitiveType<'string'>;\n };\n }\n }\n\n export interface doThing extends QueryDefinition<doThing.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'doThing';\n rid: 'rid.query.1';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * (no ontology metadata)\n */\n foo: {\n nullable: false;\n type: 'string';\n };\n /**\n * (no ontology metadata)\n */\n paramStruct: {\n nullable: false;\n struct: {\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n };\n output: {\n nullable: false;\n struct: {\n aString: {\n type: 'string';\n nullable: false;\n };\n anInteger: {\n type: 'integer';\n nullable: false;\n };\n aLong: {\n type: 'long';\n nullable: false;\n };\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n signature: doThing.Signature;\n };\n apiName: 'doThing';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const doThing: doThing = {\n apiName: 'doThing',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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ACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;EACN,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  import path from "node:path";
17
18
  import { ForeignType } from "../GenerateContext/ForeignType.js";
18
19
  import { formatTs } from "../util/test/formatTs.js";
@@ -23,7 +24,7 @@ export async function generateRootIndexTsFile({
23
24
  ontologyApiNamespace,
24
25
  ontology
25
26
  }) {
26
- fs.writeFile(path.join(outDir, "index.ts"), await formatTs(`export {${helper(ontology.actionTypes)}} from "./ontology/actions${importExt}";
27
+ await fs.writeFile(path.join(outDir, "index.ts"), await formatTs(`export {${helper(ontology.actionTypes)}} from "./ontology/actions${importExt}";
27
28
  export * as $Actions from "./ontology/actions${importExt}";
28
29
  export {${helper(ontology.interfaceTypes)}} from "./ontology/interfaces${importExt}";
29
30
  export * as $Interfaces from "./ontology/interfaces${importExt}";
@@ -31,6 +32,7 @@ export async function generateRootIndexTsFile({
31
32
  export * as $Objects from "./ontology/objects${importExt}";
32
33
  export {${helper(ontology.queryTypes)}} from "./ontology/queries${importExt}";
33
34
  export * as $Queries from "./ontology/queries${importExt}";
35
+ export { $osdkMetadata } from "./OntologyMetadata${importExt}";
34
36
  ${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
35
37
  `));
36
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generateRootIndexTsFile.js","names":["path","ForeignType","formatTs","generateRootIndexTsFile","fs","outDir","importExt","ontologyApiNamespace","ontology","writeFile","join","helper","actionTypes","interfaceTypes","objectTypes","queryTypes","x","Object","values","filter","map","a","shortApiName"],"sources":["generateRootIndexTsFile.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 path from \"node:path\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport { formatTs } from \"../util/test/formatTs.js\";\nexport async function generateRootIndexTsFile({ fs, outDir, importExt, ontologyApiNamespace, ontology }) {\n fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`export {${helper(ontology.actionTypes)}} from \"./ontology/actions${importExt}\";\n export * as $Actions from \"./ontology/actions${importExt}\";\n export {${helper(ontology.interfaceTypes)}} from \"./ontology/interfaces${importExt}\";\n export * as $Interfaces from \"./ontology/interfaces${importExt}\";\n export {${helper(ontology.objectTypes)}} from \"./ontology/objects${importExt}\";\n export * as $Objects from \"./ontology/objects${importExt}\";\n export {${helper(ontology.queryTypes)}} from \"./ontology/queries${importExt}\";\n export * as $Queries from \"./ontology/queries${importExt}\";\n ${ontologyApiNamespace == null\n ? `export { $ontologyRid } from \"./OntologyMetadata${importExt}\";`\n : ``}\n `));\n}\nfunction helper(x) {\n return Object.values(x).filter(x => !(x instanceof ForeignType)).map(a => a.shortApiName).join(\", \");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,WAAW;AAC5B,SAASC,WAAW,QAAQ,mCAAmC;AAC/D,SAASC,QAAQ,QAAQ,0BAA0B;AACnD,OAAO,eAAeC,uBAAuBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC,SAAS;EAAEC,oBAAoB;EAAEC;AAAS,CAAC,EAAE;EACrGJ,EAAE,CAACK,SAAS,CAACT,IAAI,CAACU,IAAI,CAACL,MAAM,EAAE,UAAU,CAAC,EAAE,MAAMH,QAAQ,CAAC,WAAWS,MAAM,CAACH,QAAQ,CAACI,WAAW,CAAC,6BAA6BN,SAAS;AAC5I,uDAAuDA,SAAS;AAChE,kBAAkBK,MAAM,CAACH,QAAQ,CAACK,cAAc,CAAC,gCAAgCP,SAAS;AAC1F,6DAA6DA,SAAS;AACtE,kBAAkBK,MAAM,CAACH,QAAQ,CAACM,WAAW,CAAC,6BAA6BR,SAAS;AACpF,uDAAuDA,SAAS;AAChE,kBAAkBK,MAAM,CAACH,QAAQ,CAACO,UAAU,CAAC,6BAA6BT,SAAS;AACnF,uDAAuDA,SAAS;AAChE,UAAUC,oBAAoB,IAAI,IAAI,GAC5B,mDAAmDD,SAAS,IAAI,GAChE,EAAE;AACZ,KAAK,CAAC,CAAC;AACP;AACA,SAASK,MAAMA,CAACK,CAAC,EAAE;EACf,OAAOC,MAAM,CAACC,MAAM,CAACF,CAAC,CAAC,CAACG,MAAM,CAACH,CAAC,IAAI,EAAEA,CAAC,YAAYf,WAAW,CAAC,CAAC,CAACmB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,YAAY,CAAC,CAACZ,IAAI,CAAC,IAAI,CAAC;AACxG","ignoreList":[]}
1
+ {"version":3,"file":"generateRootIndexTsFile.js","names":["path","ForeignType","formatTs","generateRootIndexTsFile","fs","outDir","importExt","ontologyApiNamespace","ontology","writeFile","join","helper","actionTypes","interfaceTypes","objectTypes","queryTypes","x","Object","values","filter","map","a","shortApiName"],"sources":["generateRootIndexTsFile.ts"],"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\nimport path from \"node:path\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { GenerateContext } from \"../GenerateContext/GenerateContext.js\";\nimport { formatTs } from \"../util/test/formatTs.js\";\n\nexport async function generateRootIndexTsFile(\n { fs, outDir, importExt, ontologyApiNamespace, ontology }: GenerateContext,\n): Promise<void> {\n await fs.writeFile(\n path.join(outDir, \"index.ts\"),\n await formatTs(\n `export {${\n helper(ontology.actionTypes)\n }} from \"./ontology/actions${importExt}\";\n export * as $Actions from \"./ontology/actions${importExt}\";\n export {${\n helper(ontology.interfaceTypes)\n }} from \"./ontology/interfaces${importExt}\";\n export * as $Interfaces from \"./ontology/interfaces${importExt}\";\n export {${\n helper(ontology.objectTypes)\n }} from \"./ontology/objects${importExt}\";\n export * as $Objects from \"./ontology/objects${importExt}\";\n export {${\n helper(ontology.queryTypes)\n }} from \"./ontology/queries${importExt}\";\n export * as $Queries from \"./ontology/queries${importExt}\";\n export { $osdkMetadata } from \"./OntologyMetadata${importExt}\";\n ${\n ontologyApiNamespace == null\n ? `export { $ontologyRid } from \"./OntologyMetadata${importExt}\";`\n : ``\n }\n `,\n ),\n );\n}\n\nfunction helper(x: Record<string, { shortApiName: string }>) {\n return Object.values(x).filter(x => !(x instanceof ForeignType)).map(a =>\n a.shortApiName\n ).join(\n \", \",\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,IAAI,MAAM,WAAW;AAC5B,SAASC,WAAW,QAAQ,mCAAmC;AAE/D,SAASC,QAAQ,QAAQ,0BAA0B;AAEnD,OAAO,eAAeC,uBAAuBA,CAC3C;EAAEC,EAAE;EAAEC,MAAM;EAAEC,SAAS;EAAEC,oBAAoB;EAAEC;AAA0B,CAAC,EAC3D;EACf,MAAMJ,EAAE,CAACK,SAAS,CAChBT,IAAI,CAACU,IAAI,CAACL,MAAM,EAAE,UAAU,CAAC,EAC7B,MAAMH,QAAQ,CACZ,WACES,MAAM,CAACH,QAAQ,CAACI,WAAW,CAAC,6BACDN,SAAS;AAC5C,uDAAuDA,SAAS;AAChE,kBACQK,MAAM,CAACH,QAAQ,CAACK,cAAc,CAAC,gCACDP,SAAS;AAC/C,6DAA6DA,SAAS;AACtE,kBACQK,MAAM,CAACH,QAAQ,CAACM,WAAW,CAAC,6BACDR,SAAS;AAC5C,uDAAuDA,SAAS;AAChE,kBACQK,MAAM,CAACH,QAAQ,CAACO,UAAU,CAAC,6BACAT,SAAS;AAC5C,uDAAuDA,SAAS;AAChE,2DAA2DA,SAAS;AACpE,UACQC,oBAAoB,IAAI,IAAI,GACxB,mDAAmDD,SAAS,IAAI,GAChE,EAAE;AACd,KAEI,CACF,CAAC;AACH;AAEA,SAASK,MAAMA,CAACK,CAA2C,EAAE;EAC3D,OAAOC,MAAM,CAACC,MAAM,CAACF,CAAC,CAAC,CAACG,MAAM,CAACH,CAAC,IAAI,EAAEA,CAAC,YAAYf,WAAW,CAAC,CAAC,CAACmB,GAAG,CAACC,CAAC,IACpEA,CAAC,CAACC,YACJ,CAAC,CAACZ,IAAI,CACJ,IACF,CAAC;AACH","ignoreList":[]}
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  export function getDescriptionIfPresent(description, includeNewline) {
17
18
  if (description) {
18
19
  return `/**
@@ -1 +1 @@
1
- {"version":3,"file":"getDescriptionIfPresent.js","names":["getDescriptionIfPresent","description","includeNewline"],"sources":["getDescriptionIfPresent.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 */\nexport function getDescriptionIfPresent(description, includeNewline) {\n if (description) {\n return `/**\n * ${description}\n */${includeNewline ? \"\\n\" : \"\"}`;\n }\n return \"\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,uBAAuBA,CAACC,WAAW,EAAEC,cAAc,EAAE;EACjE,IAAID,WAAW,EAAE;IACb,OAAO;AACf,KAAKA,WAAW;AAChB,KAAKC,cAAc,GAAG,IAAI,GAAG,EAAE,EAAE;EAC7B;EACA,OAAO,EAAE;AACb","ignoreList":[]}
1
+ {"version":3,"file":"getDescriptionIfPresent.js","names":["getDescriptionIfPresent","description","includeNewline"],"sources":["getDescriptionIfPresent.ts"],"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\nexport function getDescriptionIfPresent(\n description?: string,\n includeNewline?: boolean,\n): string {\n if (description) {\n return `/**\n * ${description}\n */${includeNewline ? \"\\n\" : \"\"}`;\n }\n return \"\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,uBAAuBA,CACrCC,WAAoB,EACpBC,cAAwB,EAChB;EACR,IAAID,WAAW,EAAE;IACf,OAAO;AACX,KAAKA,WAAW;AAChB,KAAKC,cAAc,GAAG,IAAI,GAAG,EAAE,EAAE;EAC/B;EACA,OAAO,EAAE;AACX","ignoreList":[]}
@@ -13,23 +13,27 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "@osdk/generator-converters";
18
+ import consola from "consola";
17
19
  import { EnhancedObjectType } from "../GenerateContext/EnhancedObjectType.js";
18
20
  import { ForeignType } from "../GenerateContext/ForeignType.js";
19
21
  import { getObjectImports } from "../shared/getObjectImports.js";
20
22
  import { propertyJsdoc } from "../shared/propertyJsdoc.js";
21
23
  import { deleteUndefineds } from "../util/deleteUndefineds.js";
22
24
  import { stringify } from "../util/stringify.js";
25
+
23
26
  /** @internal */
24
27
  export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
25
- ontology
28
+ ontology,
29
+ forInternalUse
26
30
  }, currentFilePath) {
27
31
  const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
28
32
  if (object instanceof ForeignType) {
29
33
  throw new Error("Should not be generating types for an external type");
30
34
  }
31
35
  const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));
32
- const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));
36
+ const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true, consola));
33
37
  const objectDefIdentifier = object.getDefinitionIdentifier(true);
34
38
  const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
35
39
  const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
@@ -39,7 +43,7 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
39
43
  const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;
40
44
  const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;
41
45
  const identifiers = {
42
- objectDefIdentifier: `${object.shortApiName}`,
46
+ objectDefIdentifier: object.shortApiName,
43
47
  osdkObjectLinksIdentifier,
44
48
  osdkObjectPropsIdentifier,
45
49
  osdkObjectStrictPropsIdentifier,
@@ -48,19 +52,19 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
48
52
  propertyKeysIdentifier
49
53
  };
50
54
  const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);
51
- return `${imports}${function (object) {
55
+ return `${imports}${function (object, forInternalUse = false) {
52
56
  return `import type {
53
57
  PropertyKeys as $PropertyKeys,
54
58
  ObjectTypeDefinition as $ObjectTypeDefinition,
55
59
  ObjectMetadata as $ObjectMetadata,
56
- } from "@osdk/api";
60
+ } from "${forInternalUse ? "@osdk/api" : "@osdk/client"}";
57
61
  import type {
58
62
  ObjectSet as $ObjectSet,
59
63
  Osdk as $Osdk,
60
64
  OsdkObject as $OsdkObject,
61
65
  PropertyValueWireToClient as $PropType,
62
66
  SingleLinkAccessor as $SingleLinkAccessor,
63
- } from "@osdk/api";
67
+ } from "${forInternalUse ? "@osdk/api" : "@osdk/client"}";
64
68
 
65
69
 
66
70
  export namespace ${object.shortApiName} {
@@ -82,7 +86,7 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
82
86
 
83
87
  ${createDefinition(object, ontology, object.shortApiName, identifiers)}
84
88
  `;
85
- }(object)}
89
+ }(object, forInternalUse)}
86
90
 
87
91
  export const ${object.shortApiName}: ${objectDefIdentifier}
88
92
  = {
@@ -100,7 +104,7 @@ export function createOsdkObject(object, identifier, {
100
104
  object.getCleanedUpDefinition(true);
101
105
  return `
102
106
  export type ${identifier}<
103
- OPTIONS extends never | "$notStrict" | "$rid" = never,
107
+ OPTIONS extends never | "$rid" = never,
104
108
  K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
105
109
  >
106
110
  = $Osdk.Instance<
@@ -112,7 +116,7 @@ export function createOsdkObject(object, identifier, {
112
116
 
113
117
  /** @deprecated use ${identifier} */
114
118
  export type OsdkObject<
115
- OPTIONS extends never | "$notStrict" | "$rid" = never,
119
+ OPTIONS extends never | "$rid" = never,
116
120
  K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
117
121
  > = ${identifier}<OPTIONS, K>;
118
122
  ;
@@ -143,6 +147,9 @@ function maybeStripNamespace(type, q) {
143
147
  }
144
148
  }
145
149
  export function createProps(type, identifier, strict) {
150
+ if (identifier === "StrictProps") {
151
+ return `export type StrictProps = Props`;
152
+ }
146
153
  const definition = type.getCleanedUpDefinition(true);
147
154
  return `export interface ${identifier} {
148
155
  ${stringify(definition.properties, {
@@ -150,7 +157,7 @@ ${stringify(definition.properties, {
150
157
  return [`readonly "${maybeStripNamespace(type, apiName)}"${
151
158
  // after we convert everything over we can do this:
152
159
  // !strict || propertyDefinition.nullable ? "?" : ""
153
- ""}`, `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict ? `| undefined` : ""}`];
160
+ ""}`, (typeof propertyDefinition.type === "object" ? remapStructType(propertyDefinition.type) : `$PropType[${JSON.stringify(propertyDefinition.type)}]`) + `${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict && !(definition.type === "object" && definition.primaryKeyApiName === apiName) ? `| undefined` : ""}`];
154
161
  }
155
162
  })}
156
163
  }`;
@@ -183,7 +190,7 @@ export function createDefinition(object, ontology, identifier, {
183
190
  ${stringify(definition.properties, {
184
191
  "*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
185
192
  apiName
186
- })}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<"${propertyDefinition.type}", "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
193
+ })}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<${JSON.stringify(propertyDefinition.type)}, "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
187
194
  })}
188
195
  }`
189
196
  })}
@@ -207,6 +214,13 @@ ${stringify(definition.links, {
207
214
  `}`;
208
215
  }
209
216
  export function createPropertyKeys(type) {
210
- return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map(a => maybeStripNamespace(type, a)).map(a => `"${a}"`).join("|")};`;
217
+ const properties = Object.keys(type.getCleanedUpDefinition(true).properties);
218
+ return `export type PropertyKeys = ${properties.length === 0 ? "never" : properties.map(a => maybeStripNamespace(type, a)).map(a => `"${a}"`).join("|")};`;
219
+ }
220
+ function remapStructType(structType) {
221
+ let output = `{`;
222
+ Object.entries(structType).map(([key, value]) => output += `${key}:$PropType[${JSON.stringify(value)}]|undefined;`);
223
+ output += "}";
224
+ return output;
211
225
  }
212
226
  //# sourceMappingURL=wireObjectTypeV2ToSdkObjectConstV2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedObjectType","ForeignType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","currentFilePath","object","requireObjectType","objectType","apiName","Error","uniqueLinkTargetTypes","Set","linkTypes","map","a","objectTypeApiName","definition","raw","objectDefIdentifier","getDefinitionIdentifier","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","identifiers","imports","createPropertyKeys","createLinks","createProps","createObjectSet","createOsdkObject","createDefinition","fullApiName","identifier","getCleanedUpDefinition","maybeStripNamespace","type","q","apiNamespace","startsWith","slice","length","strict","properties","*","propertyDefinition","_","JSON","multiplicity","nullable","links","targetType","getImportedDefinitionIdentifier","Object","keys","key","linkTarget","join"],"sources":["wireObjectTypeV2ToSdkObjectConstV2.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 { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport { EnhancedObjectType } from \"../GenerateContext/EnhancedObjectType.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { propertyJsdoc } from \"../shared/propertyJsdoc.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\n/** @internal */\nexport function wireObjectTypeV2ToSdkObjectConstV2(wireObject, { ontology }, currentFilePath) {\n const object = ontology.requireObjectType(wireObject.objectType.apiName, true);\n if (object instanceof ForeignType) {\n throw new Error(\"Should not be generating types for an external type\");\n }\n const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));\n const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));\n const objectDefIdentifier = object.getDefinitionIdentifier(true);\n const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;\n const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;\n const identifiers = {\n objectDefIdentifier: `${object.shortApiName}`,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n function getV2Types(object) {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectMetadata as $ObjectMetadata,\n } from \"@osdk/api\";\n import type {\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n OsdkObject as $OsdkObject,\n PropertyValueWireToClient as $PropType,\n SingleLinkAccessor as $SingleLinkAccessor,\n } from \"@osdk/api\";\n\n\n export namespace ${object.shortApiName} {\n\n ${createPropertyKeys(object)}\n\n\n ${createLinks(ontology, object, \"Links\")}\n\n ${createProps(object, \"Props\", false)}\n ${createProps(object, \"StrictProps\", true)}\n\n ${createObjectSet(object, identifiers)}\n \n ${createOsdkObject(object, \"OsdkInstance\", identifiers)}\n } \n\n\n\n ${createDefinition(object, ontology, object.shortApiName, identifiers)}\n `;\n }\n const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);\n return `${imports}${getV2Types(object)}\n\n export const ${object.shortApiName}: ${objectDefIdentifier}\n = {\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\",\n apiName: \"${object.fullApiName}\",\n osdkMetadata: $osdkMetadata, \n };`;\n}\nexport function createOsdkObject(object, identifier, { osdkObjectPropsIdentifier, objectDefIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export type ${identifier}<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > \n = $Osdk.Instance<\n ${objectDefIdentifier}, \n OPTIONS,\n K\n >;\n \n\n /** @deprecated use ${identifier} */\n export type OsdkObject<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > = ${identifier}<OPTIONS, K>;\n ;\n `;\n}\nexport function createObjectSet(object, { objectDefIdentifier, objectSetIdentifier, propertyKeysIdentifier, osdkObjectIdentifier, }) {\n return `\nexport interface ObjectSet extends \n$ObjectSet<${objectDefIdentifier},\n\n${objectSetIdentifier}\n>\n{\n\n}\n`;\n}\nfunction maybeStripNamespace(type, q) {\n if (type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)) {\n return q.slice(type.apiNamespace.length + 1);\n }\n else {\n return q;\n }\n}\nexport function createProps(type, identifier, strict) {\n const definition = type.getCleanedUpDefinition(true);\n return `export interface ${identifier} {\n${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => {\n return [\n `readonly \"${maybeStripNamespace(type, apiName)}\"${\n // after we convert everything over we can do this:\n // !strict || propertyDefinition.nullable ? \"?\" : \"\"\n \"\"}`,\n `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? \"[]\" : \"\"}${propertyDefinition.nullable || !strict ? `| undefined` : \"\"}`,\n ];\n },\n })}\n }`;\n}\nexport function createDefinition(object, ontology, identifier, { objectDefIdentifier, objectSetIdentifier, osdkObjectPropsIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export interface ${identifier} extends ${object instanceof EnhancedObjectType\n ? `$ObjectTypeDefinition`\n : `$InterfaceDefinition`} {\n osdkMetadata: typeof $osdkMetadata;\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\";\n apiName: \"${object.fullApiName}\";\n __DefinitionMetadata?: {\n objectSet: ${objectSetIdentifier};\n props: ${osdkObjectPropsIdentifier};\n linksType: ${osdkObjectLinksIdentifier};\n strictProps: ${osdkObjectStrictPropsIdentifier};\n ${stringify(definition, {\n links: (_value) => `{\n ${stringify(definition.links, {\n \"*\": (definition) => `$ObjectMetadata.Link<${ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true)}, ${definition.multiplicity}>`,\n })}\n }`,\n properties: (_value) => (`{\n ${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => [\n `${propertyJsdoc(propertyDefinition, { apiName })}\"${maybeStripNamespace(object, apiName)}\"`,\n `$PropertyDef<\"${propertyDefinition.type}\", \"${propertyDefinition.nullable ? \"nullable\" : \"non-nullable\"}\", \"${propertyDefinition.multiplicity ? \"array\" : \"single\"}\">`,\n ],\n })}\n }`),\n })}\n } \n}\n `;\n}\nexport function createLinks(ontology, object, identifier) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n ${Object.keys(definition.links).length === 0\n ? `export type ${identifier} = {};`\n : `\n export interface ${identifier} {\n${stringify(definition.links, {\n \"*\": (definition, _, key) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true);\n return [\n `readonly ${key}`,\n `${definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `$SingleLinkAccessor<${linkTarget}>`}\n `,\n ];\n },\n })}\n }\n `}`;\n}\nexport function createPropertyKeys(type) {\n return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map((a) => maybeStripNamespace(type, a)).map(a => `\"${a}\"`).join(\"|\")};`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,kBAAkB,QAAQ,0CAA0C;AAC7E,SAASC,WAAW,QAAQ,mCAAmC;AAC/D,SAASC,gBAAgB,QAAQ,+BAA+B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,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAAC8C,IAAI,CAAC,GAAG,CAAC,GAAG;AAC3K","ignoreList":[]}
1
+ {"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","consola","EnhancedObjectType","ForeignType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","forInternalUse","currentFilePath","object","requireObjectType","objectType","apiName","Error","uniqueLinkTargetTypes","Set","linkTypes","map","a","objectTypeApiName","definition","raw","objectDefIdentifier","getDefinitionIdentifier","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","identifiers","imports","createPropertyKeys","createLinks","createProps","createObjectSet","createOsdkObject","createDefinition","fullApiName","identifier","getCleanedUpDefinition","maybeStripNamespace","type","q","apiNamespace","startsWith","slice","length","strict","properties","*","propertyDefinition","_","remapStructType","JSON","multiplicity","nullable","primaryKeyApiName","links","targetType","getImportedDefinitionIdentifier","Object","keys","key","linkTarget","join","structType","output","entries","value"],"sources":["wireObjectTypeV2ToSdkObjectConstV2.ts"],"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\nimport type { ObjectTypeFullMetadata } from \"@osdk/foundry.ontologies\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport consola from \"consola\";\nimport type { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { EnhancedObjectType } from \"../GenerateContext/EnhancedObjectType.js\";\nimport type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { GenerateContext } from \"../GenerateContext/GenerateContext.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { propertyJsdoc } from \"../shared/propertyJsdoc.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\n\n/** @internal */\nexport function wireObjectTypeV2ToSdkObjectConstV2(\n wireObject: ObjectTypeFullMetadata,\n { ontology, forInternalUse }: Pick<\n GenerateContext,\n \"ontology\" | \"forInternalUse\"\n >,\n currentFilePath: string,\n) {\n const object = ontology.requireObjectType(\n wireObject.objectType.apiName,\n true,\n );\n if (object instanceof ForeignType) {\n throw new Error(\"Should not be generating types for an external type\");\n }\n const uniqueLinkTargetTypes = new Set(\n wireObject.linkTypes.map(a =>\n ontology.requireObjectType(a.objectTypeApiName, false)\n ),\n );\n\n const definition = deleteUndefineds(\n wireObjectTypeFullMetadataToSdkObjectMetadata(\n object.raw,\n true,\n consola,\n ),\n );\n\n const objectDefIdentifier = object.getDefinitionIdentifier(true);\n\n const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;\n const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;\n\n const identifiers: Identifiers = {\n objectDefIdentifier: object.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n\n function getV2Types(\n object: EnhancedObjectType,\n forInternalUse: boolean = false,\n ) {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectMetadata as $ObjectMetadata,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n import type {\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n OsdkObject as $OsdkObject,\n PropertyValueWireToClient as $PropType,\n SingleLinkAccessor as $SingleLinkAccessor,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n\n\n export namespace ${object.shortApiName} {\n\n ${createPropertyKeys(object)}\n\n\n ${createLinks(ontology, object, \"Links\")}\n\n ${createProps(object, \"Props\", false)}\n ${createProps(object, \"StrictProps\", true)}\n\n ${createObjectSet(object, identifiers)}\n \n ${createOsdkObject(object, \"OsdkInstance\", identifiers)}\n } \n\n\n\n ${createDefinition(object, ontology, object.shortApiName, identifiers)}\n `;\n }\n\n const imports = getObjectImports(\n uniqueLinkTargetTypes,\n definition.apiName,\n currentFilePath,\n true,\n );\n\n return `${imports}${getV2Types(object, forInternalUse)}\n\n export const ${object.shortApiName}: ${objectDefIdentifier}\n = {\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\",\n apiName: \"${object.fullApiName}\",\n osdkMetadata: $osdkMetadata, \n };`;\n}\n\nexport interface Identifiers extends\n Record<\n | \"osdkObjectIdentifier\"\n | \"propertyKeysIdentifier\"\n | \"osdkObjectPropsIdentifier\"\n | \"objectDefIdentifier\"\n | \"osdkObjectLinksIdentifier\"\n | \"osdkObjectStrictPropsIdentifier\"\n | \"objectSetIdentifier\",\n string\n >\n{}\n\nexport function createOsdkObject(\n object: EnhancedObjectType | EnhancedInterfaceType,\n identifier: string,\n {\n osdkObjectPropsIdentifier,\n objectDefIdentifier,\n osdkObjectStrictPropsIdentifier,\n osdkObjectLinksIdentifier,\n }: Identifiers,\n) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export type ${identifier}<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > \n = $Osdk.Instance<\n ${objectDefIdentifier}, \n OPTIONS,\n K\n >;\n \n\n /** @deprecated use ${identifier} */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > = ${identifier}<OPTIONS, K>;\n ;\n `;\n}\n\nexport function createObjectSet(\n object: EnhancedObjectType | EnhancedInterfaceType,\n {\n objectDefIdentifier,\n objectSetIdentifier,\n propertyKeysIdentifier,\n osdkObjectIdentifier,\n }: Identifiers,\n) {\n return `\nexport interface ObjectSet extends \n$ObjectSet<${objectDefIdentifier},\n\n${objectSetIdentifier}\n>\n{\n\n}\n`;\n}\n\nfunction maybeStripNamespace(\n type: EnhancedInterfaceType | EnhancedObjectType,\n q: string,\n) {\n if (\n type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)\n ) {\n return q.slice(type.apiNamespace.length + 1);\n } else {\n return q;\n }\n}\n\nexport function createProps(\n type: EnhancedInterfaceType | EnhancedObjectType,\n identifier: string,\n strict: boolean,\n): string {\n if (identifier === \"StrictProps\") {\n return `export type StrictProps = Props`;\n }\n const definition = type.getCleanedUpDefinition(true);\n return `export interface ${identifier} {\n${\n stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => {\n return [\n `readonly \"${maybeStripNamespace(type, apiName)}\"${\n // after we convert everything over we can do this:\n // !strict || propertyDefinition.nullable ? \"?\" : \"\"\n \"\"}`,\n (typeof propertyDefinition.type === \"object\"\n ? remapStructType(propertyDefinition.type)\n : `$PropType[${JSON.stringify(propertyDefinition.type)}]`)\n + `${propertyDefinition.multiplicity ? \"[]\" : \"\"}${\n propertyDefinition.nullable\n || (!strict\n && !(definition.type === \"object\"\n && definition.primaryKeyApiName === apiName))\n ? `| undefined`\n : \"\"\n }`,\n ] as [string, string];\n },\n })\n }\n }`;\n}\n\nexport function createDefinition(\n object: EnhancedObjectType | EnhancedInterfaceType,\n ontology: EnhancedOntologyDefinition,\n identifier: string,\n {\n objectDefIdentifier,\n objectSetIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n osdkObjectLinksIdentifier,\n }: Identifiers,\n) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export interface ${identifier} extends ${\n object instanceof EnhancedObjectType\n ? `$ObjectTypeDefinition`\n : `$InterfaceDefinition`\n } {\n osdkMetadata: typeof $osdkMetadata;\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\";\n apiName: \"${object.fullApiName}\";\n __DefinitionMetadata?: {\n objectSet: ${objectSetIdentifier};\n props: ${osdkObjectPropsIdentifier};\n linksType: ${osdkObjectLinksIdentifier};\n strictProps: ${osdkObjectStrictPropsIdentifier};\n ${\n stringify(definition, {\n links: (_value) =>\n `{\n ${\n stringify(definition.links, {\n \"*\": (definition) =>\n `$ObjectMetadata.Link<${\n ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true)\n }, ${definition.multiplicity}>`,\n })\n }\n }`,\n properties: (_value) => (`{\n ${\n stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) =>\n [\n `${propertyJsdoc(propertyDefinition, { apiName })}\"${\n maybeStripNamespace(object, apiName)\n }\"`,\n `$PropertyDef<${JSON.stringify(propertyDefinition.type)}, \"${\n propertyDefinition.nullable ? \"nullable\" : \"non-nullable\"\n }\", \"${propertyDefinition.multiplicity ? \"array\" : \"single\"}\">`,\n ] as [string, string],\n })\n }\n }`),\n })\n }\n } \n}\n `;\n}\n\nexport function createLinks(\n ontology: EnhancedOntologyDefinition,\n object: EnhancedObjectType | EnhancedInterfaceType,\n identifier: string,\n) {\n const definition = object.getCleanedUpDefinition(true);\n\n return `\n ${\n Object.keys(definition.links).length === 0\n ? `export type ${identifier} = {};`\n : `\n export interface ${identifier} {\n${\n stringify(definition.links, {\n \"*\": (definition, _, key) => {\n const linkTarget = ontology.requireObjectType(\n definition.targetType,\n )\n .getImportedDefinitionIdentifier(true);\n\n return [\n `readonly ${key}`,\n `${\n definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `$SingleLinkAccessor<${linkTarget}>`\n }\n `,\n ];\n },\n })\n }\n }\n `\n }`;\n}\n\nexport function createPropertyKeys(\n type: EnhancedObjectType | EnhancedInterfaceType,\n) {\n const properties = Object.keys(type.getCleanedUpDefinition(true).properties);\n return `export type PropertyKeys = ${\n properties.length === 0\n ? \"never\"\n : properties.map(\n (a) => maybeStripNamespace(type, a),\n ).map(a => `\"${a}\"`).join(\"|\")\n };`;\n}\n\nfunction remapStructType(structType: Record<string, any>): string {\n let output = `{`;\n Object.entries(structType).map(([key, value]) =>\n output += `${key}:$PropType[${JSON.stringify(value)}]|undefined;`\n );\n output += \"}\";\n return output;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,OAAOC,OAAO,MAAM,SAAS;AAE7B,SAASC,kBAAkB,QAAQ,0CAA0C;AAE7E,SAASC,WAAW,QAAQ,mCAAmC;AAE/D,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;;AAEhD;AACA,OAAO,SAASC,kCAAkCA,CAChDC,UAAkC,EAClC;EAAEC,QAAQ;EAAEC;AAGZ,CAAC,EACDC,eAAuB,EACvB;EACA,MAAMC,MAAM,GAAGH,QAAQ,CAACI,iBAAiB,CACvCL,UAAU,CAACM,UAAU,CAACC,OAAO,EAC7B,IACF,CAAC;EACD,IAAIH,MAAM,YAAYV,WAAW,EAAE;IACjC,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AO,8BACLA,UAAU,CAACF,MAAM,KAAK,CAAC,GACnB,OAAO,GACPE,UAAU,CAACjC,GAAG,CACbC,CAAC,IAAKwB,mBAAmB,CAACC,IAAI,EAAEzB,CAAC,CACpC,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAACgD,IAAI,CAAC,GAAG,CAAC,GAC/B;AACL;AAEA,SAASZ,eAAeA,CAACa,UAA+B,EAAU;EAChE,IAAIC,MAAM,GAAG,GAAG;EAChBN,MAAM,CAACO,OAAO,CAACF,UAAU,CAAC,CAAClD,GAAG,CAAC,CAAC,CAAC+C,GAAG,EAAEM,KAAK,CAAC,KAC1CF,MAAM,IAAI,GAAGJ,GAAG,cAAcT,IAAI,CAACpD,SAAS,CAACmE,KAAK,CAAC,cACrD,CAAC;EACDF,MAAM,IAAI,GAAG;EACb,OAAOA,MAAM;AACf","ignoreList":[]}
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  import invariant from "tiny-invariant";
17
18
  export function validateWireOntologyAssumptions(ontology) {
18
19
  invariantNotStartWithDollarSign(ontology.ontology.apiName);
@@ -25,9 +26,9 @@ export function validateWireOntologyAssumptions(ontology) {
25
26
  }
26
27
  }
27
28
  function invariantMapKeyMatchesApiName(key, value) {
28
- !(key === value.apiName) ? invariant(false, "Key in the map should be the same as the apiName.") : void 0;
29
+ !(key === value.apiName) ? process.env.NODE_ENV !== "production" ? invariant(false, "Key in the map should be the same as the apiName.") : invariant(false) : void 0;
29
30
  }
30
31
  function invariantNotStartWithDollarSign(value) {
31
- !!value.startsWith("$") ? invariant(false, "apiName should not start with $") : void 0;
32
+ !!value.startsWith("$") ? process.env.NODE_ENV !== "production" ? invariant(false, "apiName should not start with $") : invariant(false) : void 0;
32
33
  }
33
34
  //# sourceMappingURL=validateWireOntologyAssumptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateWireOntologyAssumptions.js","names":["invariant","validateWireOntologyAssumptions","ontology","invariantNotStartWithDollarSign","apiName","objectKey","objectType","Object","entries","objectTypes","invariantMapKeyMatchesApiName","propertyKey","propertyType","properties","key","value","startsWith"],"sources":["validateWireOntologyAssumptions.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 invariant from \"tiny-invariant\";\nexport function validateWireOntologyAssumptions(ontology) {\n invariantNotStartWithDollarSign(ontology.ontology.apiName);\n for (const [objectKey, objectType] of Object.entries(ontology.objectTypes)) {\n invariantMapKeyMatchesApiName(objectKey, objectType.objectType);\n invariantNotStartWithDollarSign(objectType.objectType.apiName);\n for (const [propertyKey, propertyType] of Object.entries(objectType.objectType.properties)) {\n invariantNotStartWithDollarSign(propertyKey);\n }\n }\n}\nfunction invariantMapKeyMatchesApiName(key, value) {\n invariant(key === value.apiName, \"Key in the map should be the same as the apiName.\");\n}\nfunction invariantNotStartWithDollarSign(value) {\n invariant(!value.startsWith(\"$\"), \"apiName should not start with $\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,OAAO,SAASC,+BAA+BA,CAACC,QAAQ,EAAE;EACtDC,+BAA+B,CAACD,QAAQ,CAACA,QAAQ,CAACE,OAAO,CAAC;EAC1D,KAAK,MAAM,CAACC,SAAS,EAAEC,UAAU,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,QAAQ,CAACO,WAAW,CAAC,EAAE;IACxEC,6BAA6B,CAACL,SAAS,EAAEC,UAAU,CAACA,UAAU,CAAC;IAC/DH,+BAA+B,CAACG,UAAU,CAACA,UAAU,CAACF,OAAO,CAAC;IAC9D,KAAK,MAAM,CAACO,WAAW,EAAEC,YAAY,CAAC,IAAIL,MAAM,CAACC,OAAO,CAACF,UAAU,CAACA,UAAU,CAACO,UAAU,CAAC,EAAE;MACxFV,+BAA+B,CAACQ,WAAW,CAAC;IAChD;EACJ;AACJ;AACA,SAASD,6BAA6BA,CAACI,GAAG,EAAEC,KAAK,EAAE;EAC/C,EAAUD,GAAG,KAAKC,KAAK,CAACX,OAAO,IAA/BJ,SAAS,QAAwB,mDAAmD;AACxF;AACA,SAASG,+BAA+BA,CAACY,KAAK,EAAE;EAC5C,CAAU,CAACA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,GAAhChB,SAAS,QAAyB,iCAAiC;AACvE","ignoreList":[]}
1
+ {"version":3,"file":"validateWireOntologyAssumptions.js","names":["invariant","validateWireOntologyAssumptions","ontology","invariantNotStartWithDollarSign","apiName","objectKey","objectType","Object","entries","objectTypes","invariantMapKeyMatchesApiName","propertyKey","propertyType","properties","key","value","process","env","NODE_ENV","startsWith"],"sources":["validateWireOntologyAssumptions.ts"],"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\nimport invariant from \"tiny-invariant\";\nimport type { WireOntologyDefinition } from \"./WireOntologyDefinition.js\";\n\nexport function validateWireOntologyAssumptions(\n ontology: WireOntologyDefinition,\n): void {\n invariantNotStartWithDollarSign(ontology.ontology.apiName);\n\n for (const [objectKey, objectType] of Object.entries(ontology.objectTypes)) {\n invariantMapKeyMatchesApiName(objectKey, objectType.objectType);\n invariantNotStartWithDollarSign(objectType.objectType.apiName);\n\n for (\n const [propertyKey, propertyType] of Object.entries(\n objectType.objectType.properties,\n )\n ) {\n invariantNotStartWithDollarSign(propertyKey);\n }\n }\n}\n\nfunction invariantMapKeyMatchesApiName(\n key: string,\n value: { apiName: string },\n) {\n invariant(\n key === value.apiName,\n \"Key in the map should be the same as the apiName.\",\n );\n}\nfunction invariantNotStartWithDollarSign(value: string) {\n invariant(\n !value.startsWith(\"$\"),\n \"apiName should not start with $\",\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AAGtC,OAAO,SAASC,+BAA+BA,CAC7CC,QAAgC,EAC1B;EACNC,+BAA+B,CAACD,QAAQ,CAACA,QAAQ,CAACE,OAAO,CAAC;EAE1D,KAAK,MAAM,CAACC,SAAS,EAAEC,UAAU,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,QAAQ,CAACO,WAAW,CAAC,EAAE;IAC1EC,6BAA6B,CAACL,SAAS,EAAEC,UAAU,CAACA,UAAU,CAAC;IAC/DH,+BAA+B,CAACG,UAAU,CAACA,UAAU,CAACF,OAAO,CAAC;IAE9D,KACE,MAAM,CAACO,WAAW,EAAEC,YAAY,CAAC,IAAIL,MAAM,CAACC,OAAO,CACjDF,UAAU,CAACA,UAAU,CAACO,UACxB,CAAC,EACD;MACAV,+BAA+B,CAACQ,WAAW,CAAC;IAC9C;EACF;AACF;AAEA,SAASD,6BAA6BA,CACpCI,GAAW,EACXC,KAA0B,EAC1B;EACA,EACED,GAAG,KAAKC,KAAK,CAACX,OAAO,IAAAY,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADvBlB,SAAS,QAEP,mDAAmD,IAFrDA,SAAS;AAIX;AACA,SAASG,+BAA+BA,CAACY,KAAa,EAAE;EACtD,CACE,CAACA,KAAK,CAACI,UAAU,CAAC,GAAG,CAAC,GAAAH,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADxBlB,SAAS,QAEP,iCAAiC,IAFnCA,SAAS;AAIX","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import type { EnhancedOntologyDefinition } from "./EnhancedOntologyDefinition.js";
2
+ export interface EnhanceCommon {
3
+ importExt: string;
4
+ /** DO NOT USE THIS IN THE CONSTRUCTOR(S) */
5
+ enhancedOntology: EnhancedOntologyDefinition;
6
+ }
@@ -0,0 +1,13 @@
1
+ import type { ActionTypeV2, LogicRule } from "@osdk/foundry.ontologies";
2
+ import type { EnhanceCommon } from "./EnhanceCommon.js";
3
+ import { EnhancedBase } from "./EnhancedBase.js";
4
+ export declare class EnhancedAction extends EnhancedBase<ActionTypeV2> {
5
+ raw: ActionTypeV2;
6
+ constructor(common: EnhanceCommon, raw: ActionTypeV2);
7
+ get description(): string | undefined;
8
+ get parameters(): ActionTypeV2["parameters"];
9
+ get operations(): LogicRule[];
10
+ get paramsIdentifier(): string;
11
+ get definitionIdentifier(): string;
12
+ get definitionParamsIdentifier(): string;
13
+ }
@@ -0,0 +1,20 @@
1
+ import type { EnhanceCommon } from "./EnhanceCommon.js";
2
+ export declare abstract class AbstractImportable {
3
+ protected _common: EnhanceCommon;
4
+ shortApiName: string;
5
+ fullApiName: string;
6
+ apiNamespace: string | undefined;
7
+ /**
8
+ * Either a path relative to the ourDir (e.g. "./ontology/objects/foo.js") or a normal
9
+ * module import (e.g. "@something/foo")/
10
+ */
11
+ importPath: string;
12
+ uniqueImportName: string;
13
+ constructor(common: EnhanceCommon, fullApiName: string, basePath: string, isLocal?: boolean);
14
+ getImportPathRelTo: (filePath: string) => string;
15
+ }
16
+ export declare abstract class EnhancedBase<T> extends AbstractImportable {
17
+ raw: T;
18
+ constructor(common: EnhanceCommon, raw: T, fullApiName: string, basePath: string);
19
+ }
20
+ export declare function extractNamespace(fqApiName: string): [string | undefined, string];
@@ -0,0 +1,12 @@
1
+ import type { InterfaceMetadata } from "@osdk/api";
2
+ import type { InterfaceType } from "@osdk/foundry.ontologies";
3
+ import type { EnhanceCommon } from "./EnhanceCommon.js";
4
+ import { EnhancedBase } from "./EnhancedBase.js";
5
+ export declare class EnhancedInterfaceType extends EnhancedBase<InterfaceType> {
6
+ raw: InterfaceType;
7
+ constructor(common: EnhanceCommon, raw: InterfaceType);
8
+ getDefinitionIdentifier(v2: boolean): string;
9
+ getImportedDefinitionIdentifier(v2: boolean): string;
10
+ get properties(): InterfaceType["properties"];
11
+ getCleanedUpDefinition(v2: boolean): InterfaceMetadata;
12
+ }
@@ -0,0 +1,11 @@
1
+ import type { ObjectMetadata } from "@osdk/api";
2
+ import type { ObjectTypeFullMetadata } from "@osdk/foundry.ontologies";
3
+ import type { EnhanceCommon } from "./EnhanceCommon.js";
4
+ import { EnhancedBase } from "./EnhancedBase.js";
5
+ export declare class EnhancedObjectType extends EnhancedBase<ObjectTypeFullMetadata> {
6
+ raw: ObjectTypeFullMetadata;
7
+ constructor(common: EnhanceCommon, raw: ObjectTypeFullMetadata);
8
+ getDefinitionIdentifier(v2: boolean): string;
9
+ getImportedDefinitionIdentifier(v2: boolean): string;
10
+ getCleanedUpDefinition(v2: boolean): ObjectMetadata;
11
+ }
@@ -0,0 +1,28 @@
1
+ import type { OntologyV2 } from "@osdk/foundry.ontologies";
2
+ import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
3
+ import type { EnhanceCommon } from "./EnhanceCommon.js";
4
+ import { EnhancedAction } from "./EnhancedAction.js";
5
+ import { EnhancedInterfaceType } from "./EnhancedInterfaceType.js";
6
+ import { EnhancedObjectType } from "./EnhancedObjectType.js";
7
+ import { EnhancedQuery } from "./EnhancedQuery.js";
8
+ import { EnhancedSharedPropertyType } from "./EnhancedSharedPropertyType.js";
9
+ import { ForeignType } from "./ForeignType.js";
10
+ type RequiredType<K extends "objectTypes" | "actionTypes" | "interfaceTypes" | "queryTypes" | "sharedPropertyTypes"> = <L extends boolean = false>(fullApiName: string, localOnly?: L) => L extends true ? EnhancedOntologyDefinition[K][string] : ForeignType;
11
+ export declare class EnhancedOntologyDefinition {
12
+ #private;
13
+ ontology: OntologyV2;
14
+ objectTypes: Record<string, EnhancedObjectType | ForeignType>;
15
+ actionTypes: Record<string, EnhancedAction>;
16
+ queryTypes: Record<string, EnhancedQuery>;
17
+ interfaceTypes: Record<string, EnhancedInterfaceType | ForeignType>;
18
+ sharedPropertyTypes: Record<string, EnhancedSharedPropertyType | ForeignType>;
19
+ raw: WireOntologyDefinition;
20
+ common: EnhanceCommon;
21
+ constructor(raw: WireOntologyDefinition, importExt: string, externalObjects?: Map<string, string>, externalInterfaces?: Map<string, string>, externalSpts?: Map<string, string>);
22
+ requireObjectType: RequiredType<"objectTypes">;
23
+ requireInterfaceType: RequiredType<"interfaceTypes">;
24
+ requireActionType: RequiredType<"actionTypes">;
25
+ requireQueryType: RequiredType<"queryTypes">;
26
+ requireSharedPropertyType: RequiredType<"sharedPropertyTypes">;
27
+ }
28
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { QueryDataType, QueryTypeV2 } from "@osdk/foundry.ontologies";
2
+ import type { EnhanceCommon } from "./EnhanceCommon.js";
3
+ import { EnhancedBase } from "./EnhancedBase.js";
4
+ export declare class EnhancedQuery extends EnhancedBase<QueryTypeV2> {
5
+ raw: QueryTypeV2;
6
+ constructor(common: EnhanceCommon, raw: QueryTypeV2);
7
+ get description(): string | undefined;
8
+ get parameters(): QueryTypeV2["parameters"];
9
+ get output(): QueryDataType;
10
+ get paramsIdentifier(): string;
11
+ get definitionIdentifier(): string;
12
+ get definitionParamsIdentifier(): string;
13
+ }
@@ -0,0 +1,7 @@
1
+ import type { SharedPropertyType } from "@osdk/foundry.ontologies";
2
+ import type { EnhanceCommon } from "./EnhanceCommon.js";
3
+ import { EnhancedBase } from "./EnhancedBase.js";
4
+ export declare class EnhancedSharedPropertyType extends EnhancedBase<SharedPropertyType> {
5
+ raw: SharedPropertyType;
6
+ constructor(common: EnhanceCommon, raw: SharedPropertyType);
7
+ }
@@ -0,0 +1,8 @@
1
+ import type { EnhanceCommon } from "./EnhanceCommon.js";
2
+ import { AbstractImportable } from "./EnhancedBase.js";
3
+ export declare class ForeignType extends AbstractImportable {
4
+ _common: EnhanceCommon;
5
+ constructor(_common: EnhanceCommon, apiNamespace: string | undefined, shortApiName: string, destinationPackage: string);
6
+ getImportedDefinitionIdentifier(v2: boolean): string;
7
+ getDefinitionIdentifier(v2: boolean): string;
8
+ }
@@ -0,0 +1,13 @@
1
+ import type { MinimalFs } from "../MinimalFs.js";
2
+ import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
3
+ import type { EnhancedOntologyDefinition } from "./EnhancedOntologyDefinition.js";
4
+ export interface GenerateContext {
5
+ sanitizedOntology: WireOntologyDefinition;
6
+ ontology: EnhancedOntologyDefinition;
7
+ importExt?: string;
8
+ fs: MinimalFs;
9
+ outDir: string;
10
+ ontologyApiNamespace?: string | undefined;
11
+ apiNamespacePackageMap?: Map<string, string>;
12
+ forInternalUse?: boolean;
13
+ }
@@ -0,0 +1,9 @@
1
+ import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
2
+ import { EnhancedOntologyDefinition } from "./EnhancedOntologyDefinition.js";
3
+ export declare function enhanceOntology({ sanitized, importExt, externalObjects, externalInterfaces, externalSpts }: {
4
+ sanitized: WireOntologyDefinition;
5
+ externalObjects?: Map<string, string>;
6
+ externalInterfaces?: Map<string, string>;
7
+ externalSpts?: Map<string, string>;
8
+ importExt: string;
9
+ }): EnhancedOntologyDefinition;