@osdk/generator 2.1.0-beta.9 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (499) hide show
  1. package/CHANGELOG.md +350 -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 +1 -0
  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 +4 -1
  75. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  76. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +10 -1
  77. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  78. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +4 -1
  79. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  80. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +672 -628
  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 +30 -8
  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 +2 -0
  89. package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
  90. package/build/browser/v2.0/generatePerObjectDataFiles.js +1 -0
  91. package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -1
  92. package/build/browser/v2.0/generatePerQueryDataFiles.js +10 -4
  93. package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
  94. package/build/browser/v2.0/generatePerQueryDataFiles.test.js +2 -0
  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 +13 -4
  101. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  102. package/build/browser/validateWireOntologyAssumptions.js +1 -0
  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 +1 -0
  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 +4 -1
  184. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  185. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +10 -1
  186. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  187. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +4 -1
  188. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  189. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +672 -628
  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 +30 -8
  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 +2 -0
  198. package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
  199. package/build/esm/v2.0/generatePerObjectDataFiles.js +1 -0
  200. package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -1
  201. package/build/esm/v2.0/generatePerQueryDataFiles.js +10 -4
  202. package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
  203. package/build/esm/v2.0/generatePerQueryDataFiles.test.js +2 -0
  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 +13 -4
  210. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  211. package/build/esm/validateWireOntologyAssumptions.js +1 -0
  212. package/build/esm/validateWireOntologyAssumptions.js.map +1 -1
  213. package/build/types/GenerateContext/EnhanceCommon.d.ts +6 -0
  214. package/build/types/GenerateContext/EnhanceCommon.d.ts.map +1 -0
  215. package/build/types/GenerateContext/EnhancedAction.d.ts +13 -0
  216. package/build/types/GenerateContext/EnhancedAction.d.ts.map +1 -0
  217. package/build/types/GenerateContext/EnhancedBase.d.ts +20 -0
  218. package/build/types/GenerateContext/EnhancedBase.d.ts.map +1 -0
  219. package/build/types/GenerateContext/EnhancedInterfaceType.d.ts +12 -0
  220. package/build/types/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -0
  221. package/build/types/GenerateContext/EnhancedObjectType.d.ts +11 -0
  222. package/build/types/GenerateContext/EnhancedObjectType.d.ts.map +1 -0
  223. package/build/types/GenerateContext/EnhancedOntologyDefinition.d.ts +28 -0
  224. package/build/types/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -0
  225. package/build/types/GenerateContext/EnhancedQuery.d.ts +13 -0
  226. package/build/types/GenerateContext/EnhancedQuery.d.ts.map +1 -0
  227. package/build/types/GenerateContext/EnhancedSharedPropertyType.d.ts +7 -0
  228. package/build/types/GenerateContext/EnhancedSharedPropertyType.d.ts.map +1 -0
  229. package/build/types/GenerateContext/ForeignType.d.ts +8 -0
  230. package/build/types/GenerateContext/ForeignType.d.ts.map +1 -0
  231. package/build/types/GenerateContext/GenerateContext.d.ts +13 -0
  232. package/build/types/GenerateContext/GenerateContext.d.ts.map +1 -0
  233. package/build/types/GenerateContext/enhanceOntology.d.ts +9 -0
  234. package/build/types/GenerateContext/enhanceOntology.d.ts.map +1 -0
  235. package/build/types/MinimalFs.d.ts +9 -0
  236. package/build/types/MinimalFs.d.ts.map +1 -0
  237. package/build/types/WireOntologyDefinition.d.ts +2 -0
  238. package/build/types/WireOntologyDefinition.d.ts.map +1 -0
  239. package/build/types/generateClientSdkPackage.d.ts +33 -0
  240. package/build/types/generateClientSdkPackage.d.ts.map +1 -0
  241. package/build/types/generateClientSdkPackage.test.d.ts +1 -0
  242. package/build/types/generateClientSdkPackage.test.d.ts.map +1 -0
  243. package/build/types/index.d.ts +4 -0
  244. package/build/types/index.d.ts.map +1 -0
  245. package/build/{browser → types}/shared/apiNamespaces/startsWithApiNamespace.d.ts +0 -1
  246. package/build/types/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +1 -0
  247. package/build/types/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +1 -0
  248. package/build/types/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +1 -0
  249. package/build/{browser → types}/shared/getObjectImports.d.ts +2 -2
  250. package/build/types/shared/getObjectImports.d.ts.map +1 -0
  251. package/build/{browser → types}/shared/getObjectTypeApiNamesFromQuery.d.ts +1 -2
  252. package/build/types/shared/getObjectTypeApiNamesFromQuery.d.ts.map +1 -0
  253. package/build/types/shared/getObjectTypesFromQueryDataType.d.ts +2 -0
  254. package/build/types/shared/getObjectTypesFromQueryDataType.d.ts.map +1 -0
  255. package/build/{browser → types}/shared/propertyJsdoc.d.ts +2 -3
  256. package/build/types/shared/propertyJsdoc.d.ts.map +1 -0
  257. package/build/types/shared/sanitizeMetadata.d.ts +1 -0
  258. package/build/types/shared/sanitizeMetadata.d.ts.map +1 -0
  259. package/build/types/shared/sanitizeMetadata.test.d.ts +1 -0
  260. package/build/types/shared/sanitizeMetadata.test.d.ts.map +1 -0
  261. package/build/{browser → types}/util/InMemoryFs.d.ts +2 -3
  262. package/build/types/util/InMemoryFs.d.ts.map +1 -0
  263. package/build/{browser → types}/util/commaSeparatedIdentifiers.d.ts +0 -1
  264. package/build/types/util/commaSeparatedIdentifiers.d.ts.map +1 -0
  265. package/build/{browser → types}/util/commaSeparatedTypeIdentifiers.d.ts +0 -1
  266. package/build/types/util/commaSeparatedTypeIdentifiers.d.ts.map +1 -0
  267. package/build/{browser → types}/util/deleteUndefineds.d.ts +0 -1
  268. package/build/types/util/deleteUndefineds.d.ts.map +1 -0
  269. package/build/{browser → types}/util/reservedKeywords.d.ts +0 -1
  270. package/build/types/util/reservedKeywords.d.ts.map +1 -0
  271. package/build/{browser → types}/util/stringUnionFrom.d.ts +0 -1
  272. package/build/types/util/stringUnionFrom.d.ts.map +1 -0
  273. package/build/types/util/stringify.d.ts +20 -0
  274. package/build/types/util/stringify.d.ts.map +1 -0
  275. package/build/types/util/test/TodoWireOntology.d.ts +2 -0
  276. package/build/types/util/test/TodoWireOntology.d.ts.map +1 -0
  277. package/build/{browser → types}/util/test/compileThis.d.ts +0 -1
  278. package/build/types/util/test/compileThis.d.ts.map +1 -0
  279. package/build/types/util/test/createMockMinimalFiles.d.ts +12 -0
  280. package/build/types/util/test/createMockMinimalFiles.d.ts.map +1 -0
  281. package/build/{browser → types}/util/test/formatTs.d.ts +0 -1
  282. package/build/types/util/test/formatTs.d.ts.map +1 -0
  283. package/build/types/util/verifyOutDir.d.ts +8 -0
  284. package/build/types/util/verifyOutDir.d.ts.map +1 -0
  285. package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +1 -0
  286. package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +1 -0
  287. package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +1 -0
  288. package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +1 -0
  289. package/build/{esm → types}/v2.0/generateClientSdkVersionTwoPointZero.d.ts +0 -1
  290. package/build/types/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -0
  291. package/build/types/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +1 -0
  292. package/build/types/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +1 -0
  293. package/build/{browser → types}/v2.0/generateMetadata.d.ts +0 -1
  294. package/build/types/v2.0/generateMetadata.d.ts.map +1 -0
  295. package/build/types/v2.0/generatePerActionDataFiles.d.ts +2 -0
  296. package/build/types/v2.0/generatePerActionDataFiles.d.ts.map +1 -0
  297. package/build/types/v2.0/generatePerActionDataFiles.test.d.ts +1 -0
  298. package/build/types/v2.0/generatePerActionDataFiles.test.d.ts.map +1 -0
  299. package/build/types/v2.0/generatePerInterfaceDataFiles.d.ts +1 -0
  300. package/build/types/v2.0/generatePerInterfaceDataFiles.d.ts.map +1 -0
  301. package/build/{esm → types}/v2.0/generatePerObjectDataFiles.d.ts +0 -1
  302. package/build/types/v2.0/generatePerObjectDataFiles.d.ts.map +1 -0
  303. package/build/{browser → types}/v2.0/generatePerQueryDataFiles.d.ts +2 -3
  304. package/build/types/v2.0/generatePerQueryDataFiles.d.ts.map +1 -0
  305. package/build/types/v2.0/generatePerQueryDataFiles.test.d.ts +1 -0
  306. package/build/types/v2.0/generatePerQueryDataFiles.test.d.ts.map +1 -0
  307. package/build/{esm → types}/v2.0/generateRootIndexTsFile.d.ts +0 -1
  308. package/build/types/v2.0/generateRootIndexTsFile.d.ts.map +1 -0
  309. package/build/{browser → types}/v2.0/getDescriptionIfPresent.d.ts +0 -1
  310. package/build/types/v2.0/getDescriptionIfPresent.d.ts.map +1 -0
  311. package/build/{browser → types}/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +4 -6
  312. package/build/types/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -0
  313. package/build/{browser → types}/validateWireOntologyAssumptions.d.ts +0 -1
  314. package/build/types/validateWireOntologyAssumptions.d.ts.map +1 -0
  315. package/package.json +26 -12
  316. package/build/browser/GenerateContext/EnhanceCommon.d.ts +0 -7
  317. package/build/browser/GenerateContext/EnhanceCommon.d.ts.map +0 -1
  318. package/build/browser/GenerateContext/EnhancedAction.d.ts +0 -14
  319. package/build/browser/GenerateContext/EnhancedAction.d.ts.map +0 -1
  320. package/build/browser/GenerateContext/EnhancedBase.d.ts +0 -21
  321. package/build/browser/GenerateContext/EnhancedBase.d.ts.map +0 -1
  322. package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts +0 -13
  323. package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts.map +0 -1
  324. package/build/browser/GenerateContext/EnhancedObjectType.d.ts +0 -12
  325. package/build/browser/GenerateContext/EnhancedObjectType.d.ts.map +0 -1
  326. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts +0 -27
  327. package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts.map +0 -1
  328. package/build/browser/GenerateContext/EnhancedQuery.d.ts +0 -14
  329. package/build/browser/GenerateContext/EnhancedQuery.d.ts.map +0 -1
  330. package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts +0 -8
  331. package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts.map +0 -1
  332. package/build/browser/GenerateContext/ForeignType.d.ts +0 -9
  333. package/build/browser/GenerateContext/ForeignType.d.ts.map +0 -1
  334. package/build/browser/GenerateContext/GenerateContext.d.ts +0 -14
  335. package/build/browser/GenerateContext/GenerateContext.d.ts.map +0 -1
  336. package/build/browser/GenerateContext/enhanceOntology.d.ts +0 -10
  337. package/build/browser/GenerateContext/enhanceOntology.d.ts.map +0 -1
  338. package/build/browser/MinimalFs.d.ts +0 -10
  339. package/build/browser/MinimalFs.d.ts.map +0 -1
  340. package/build/browser/WireOntologyDefinition.d.ts +0 -4
  341. package/build/browser/WireOntologyDefinition.d.ts.map +0 -1
  342. package/build/browser/generateClientSdkPackage.d.ts +0 -47
  343. package/build/browser/generateClientSdkPackage.d.ts.map +0 -1
  344. package/build/browser/generateClientSdkPackage.test.d.ts +0 -2
  345. package/build/browser/generateClientSdkPackage.test.d.ts.map +0 -1
  346. package/build/browser/index.d.ts +0 -5
  347. package/build/browser/index.d.ts.map +0 -1
  348. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +0 -1
  349. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +0 -2
  350. package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +0 -1
  351. package/build/browser/shared/getObjectImports.d.ts.map +0 -1
  352. package/build/browser/shared/getObjectTypeApiNamesFromQuery.d.ts.map +0 -1
  353. package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts +0 -3
  354. package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts.map +0 -1
  355. package/build/browser/shared/propertyJsdoc.d.ts.map +0 -1
  356. package/build/browser/shared/sanitizeMetadata.d.ts +0 -2
  357. package/build/browser/shared/sanitizeMetadata.d.ts.map +0 -1
  358. package/build/browser/shared/sanitizeMetadata.test.d.ts +0 -2
  359. package/build/browser/shared/sanitizeMetadata.test.d.ts.map +0 -1
  360. package/build/browser/util/InMemoryFs.d.ts.map +0 -1
  361. package/build/browser/util/commaSeparatedIdentifiers.d.ts.map +0 -1
  362. package/build/browser/util/commaSeparatedTypeIdentifiers.d.ts.map +0 -1
  363. package/build/browser/util/deleteUndefineds.d.ts.map +0 -1
  364. package/build/browser/util/reservedKeywords.d.ts.map +0 -1
  365. package/build/browser/util/stringUnionFrom.d.ts.map +0 -1
  366. package/build/browser/util/stringify.d.ts +0 -20
  367. package/build/browser/util/stringify.d.ts.map +0 -1
  368. package/build/browser/util/test/TodoWireOntology.d.ts +0 -217
  369. package/build/browser/util/test/TodoWireOntology.d.ts.map +0 -1
  370. package/build/browser/util/test/compileThis.d.ts.map +0 -1
  371. package/build/browser/util/test/createMockMinimalFiles.d.ts +0 -13
  372. package/build/browser/util/test/createMockMinimalFiles.d.ts.map +0 -1
  373. package/build/browser/util/test/formatTs.d.ts.map +0 -1
  374. package/build/browser/util/verifyOutDir.d.ts +0 -9
  375. package/build/browser/util/verifyOutDir.d.ts.map +0 -1
  376. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +0 -2
  377. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +0 -1
  378. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +0 -2
  379. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +0 -1
  380. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +0 -4
  381. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +0 -1
  382. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +0 -2
  383. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +0 -1
  384. package/build/browser/v2.0/generateMetadata.d.ts.map +0 -1
  385. package/build/browser/v2.0/generatePerActionDataFiles.d.ts +0 -3
  386. package/build/browser/v2.0/generatePerActionDataFiles.d.ts.map +0 -1
  387. package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts +0 -2
  388. package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts.map +0 -1
  389. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts +0 -2
  390. package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts.map +0 -1
  391. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts +0 -3
  392. package/build/browser/v2.0/generatePerObjectDataFiles.d.ts.map +0 -1
  393. package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +0 -1
  394. package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts +0 -2
  395. package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts.map +0 -1
  396. package/build/browser/v2.0/generateRootIndexTsFile.d.ts +0 -3
  397. package/build/browser/v2.0/generateRootIndexTsFile.d.ts.map +0 -1
  398. package/build/browser/v2.0/getDescriptionIfPresent.d.ts.map +0 -1
  399. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +0 -1
  400. package/build/browser/validateWireOntologyAssumptions.d.ts.map +0 -1
  401. package/build/esm/GenerateContext/EnhanceCommon.d.ts +0 -7
  402. package/build/esm/GenerateContext/EnhanceCommon.d.ts.map +0 -1
  403. package/build/esm/GenerateContext/EnhancedAction.d.ts +0 -14
  404. package/build/esm/GenerateContext/EnhancedAction.d.ts.map +0 -1
  405. package/build/esm/GenerateContext/EnhancedBase.d.ts +0 -21
  406. package/build/esm/GenerateContext/EnhancedBase.d.ts.map +0 -1
  407. package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts +0 -13
  408. package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts.map +0 -1
  409. package/build/esm/GenerateContext/EnhancedObjectType.d.ts +0 -12
  410. package/build/esm/GenerateContext/EnhancedObjectType.d.ts.map +0 -1
  411. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts +0 -27
  412. package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts.map +0 -1
  413. package/build/esm/GenerateContext/EnhancedQuery.d.ts +0 -14
  414. package/build/esm/GenerateContext/EnhancedQuery.d.ts.map +0 -1
  415. package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts +0 -8
  416. package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts.map +0 -1
  417. package/build/esm/GenerateContext/ForeignType.d.ts +0 -9
  418. package/build/esm/GenerateContext/ForeignType.d.ts.map +0 -1
  419. package/build/esm/GenerateContext/GenerateContext.d.ts +0 -14
  420. package/build/esm/GenerateContext/GenerateContext.d.ts.map +0 -1
  421. package/build/esm/GenerateContext/enhanceOntology.d.ts +0 -10
  422. package/build/esm/GenerateContext/enhanceOntology.d.ts.map +0 -1
  423. package/build/esm/MinimalFs.d.ts +0 -10
  424. package/build/esm/MinimalFs.d.ts.map +0 -1
  425. package/build/esm/WireOntologyDefinition.d.ts +0 -4
  426. package/build/esm/WireOntologyDefinition.d.ts.map +0 -1
  427. package/build/esm/generateClientSdkPackage.d.ts +0 -47
  428. package/build/esm/generateClientSdkPackage.d.ts.map +0 -1
  429. package/build/esm/generateClientSdkPackage.test.d.ts +0 -2
  430. package/build/esm/generateClientSdkPackage.test.d.ts.map +0 -1
  431. package/build/esm/index.d.ts +0 -5
  432. package/build/esm/index.d.ts.map +0 -1
  433. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.d.ts +0 -2
  434. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +0 -1
  435. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +0 -2
  436. package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +0 -1
  437. package/build/esm/shared/getObjectImports.d.ts +0 -4
  438. package/build/esm/shared/getObjectImports.d.ts.map +0 -1
  439. package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts +0 -4
  440. package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts.map +0 -1
  441. package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts +0 -3
  442. package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts.map +0 -1
  443. package/build/esm/shared/propertyJsdoc.d.ts +0 -6
  444. package/build/esm/shared/propertyJsdoc.d.ts.map +0 -1
  445. package/build/esm/shared/sanitizeMetadata.d.ts +0 -2
  446. package/build/esm/shared/sanitizeMetadata.d.ts.map +0 -1
  447. package/build/esm/shared/sanitizeMetadata.test.d.ts +0 -2
  448. package/build/esm/shared/sanitizeMetadata.test.d.ts.map +0 -1
  449. package/build/esm/util/InMemoryFs.d.ts +0 -7
  450. package/build/esm/util/InMemoryFs.d.ts.map +0 -1
  451. package/build/esm/util/commaSeparatedIdentifiers.d.ts +0 -2
  452. package/build/esm/util/commaSeparatedIdentifiers.d.ts.map +0 -1
  453. package/build/esm/util/commaSeparatedTypeIdentifiers.d.ts +0 -2
  454. package/build/esm/util/commaSeparatedTypeIdentifiers.d.ts.map +0 -1
  455. package/build/esm/util/deleteUndefineds.d.ts +0 -2
  456. package/build/esm/util/deleteUndefineds.d.ts.map +0 -1
  457. package/build/esm/util/reservedKeywords.d.ts +0 -2
  458. package/build/esm/util/reservedKeywords.d.ts.map +0 -1
  459. package/build/esm/util/stringUnionFrom.d.ts +0 -2
  460. package/build/esm/util/stringUnionFrom.d.ts.map +0 -1
  461. package/build/esm/util/stringify.d.ts +0 -20
  462. package/build/esm/util/stringify.d.ts.map +0 -1
  463. package/build/esm/util/test/TodoWireOntology.d.ts +0 -217
  464. package/build/esm/util/test/TodoWireOntology.d.ts.map +0 -1
  465. package/build/esm/util/test/compileThis.d.ts +0 -3
  466. package/build/esm/util/test/compileThis.d.ts.map +0 -1
  467. package/build/esm/util/test/createMockMinimalFiles.d.ts +0 -13
  468. package/build/esm/util/test/createMockMinimalFiles.d.ts.map +0 -1
  469. package/build/esm/util/test/formatTs.d.ts +0 -2
  470. package/build/esm/util/test/formatTs.d.ts.map +0 -1
  471. package/build/esm/util/verifyOutDir.d.ts +0 -9
  472. package/build/esm/util/verifyOutDir.d.ts.map +0 -1
  473. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +0 -2
  474. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +0 -1
  475. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +0 -2
  476. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +0 -1
  477. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +0 -1
  478. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +0 -2
  479. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +0 -1
  480. package/build/esm/v2.0/generateMetadata.d.ts +0 -3
  481. package/build/esm/v2.0/generateMetadata.d.ts.map +0 -1
  482. package/build/esm/v2.0/generatePerActionDataFiles.d.ts +0 -3
  483. package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +0 -1
  484. package/build/esm/v2.0/generatePerActionDataFiles.test.d.ts +0 -2
  485. package/build/esm/v2.0/generatePerActionDataFiles.test.d.ts.map +0 -1
  486. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts +0 -2
  487. package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts.map +0 -1
  488. package/build/esm/v2.0/generatePerObjectDataFiles.d.ts.map +0 -1
  489. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts +0 -9
  490. package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +0 -1
  491. package/build/esm/v2.0/generatePerQueryDataFiles.test.d.ts +0 -2
  492. package/build/esm/v2.0/generatePerQueryDataFiles.test.d.ts.map +0 -1
  493. package/build/esm/v2.0/generateRootIndexTsFile.d.ts.map +0 -1
  494. package/build/esm/v2.0/getDescriptionIfPresent.d.ts +0 -2
  495. package/build/esm/v2.0/getDescriptionIfPresent.d.ts.map +0 -1
  496. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +0 -12
  497. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +0 -1
  498. package/build/esm/validateWireOntologyAssumptions.d.ts +0 -3
  499. 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","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.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 forInternalUse: true,\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, 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 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 forInternalUse: true,\n }, true);\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;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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;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;AACA;AACA;AACA;AACA;;AAEA,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;AAE5EN,QAAQ,CAAC,2BAA2B,EAAE,MAAM;EAC1CE,EAAE,CAAC,cAAc,EAAE,YAAY;IAC7B,MAAMK,MAAM,GAAGH,sBAAsB,CAAC,CAAC;IAGvC,MAAME,2BAA2B,CAC/B;MACEE,EAAE,EAAED,MAAM,CAACE,YAAY;MACvBC,QAAQ,EAAEP,eAAe,CAAC;QACxBQ,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;MACxB,CAAC,CAAC;MACFG,MAAM,EAZQ,MAYG;MACjBL,SAAS,EAAE,KAAK;MAChBM,cAAc,EAAE;IAClB,CAAC,EACD,IACF,CAAC;IAEDjB,MAAM,CAACM,MAAM,CAACY,QAAQ,CAAC,CAAC,CAAC,CAACC,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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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bC,SAAS,EAAE;oBAAEJ,IAAI,EAAE;kBAAO;gBAC5B,CAAC,EACD;kBACEG,IAAI,EAAE,cAAc;kBACpBC,SAAS,EAAE;oBACTJ,IAAI,EAAE,QAAQ;oBACdE,MAAM,EAAE,CACN;sBACEC,IAAI,EAAE,cAAc;sBACpBC,SAAS,EAAE;wBAAEJ,IAAI,EAAE;sBAAS;oBAC9B,CAAC,EACD;sBACEG,IAAI,EAAE,eAAe;sBACrBC,SAAS,EAAE;wBAAEJ,IAAI,EAAE;sBAAU;oBAC/B,CAAC;kBAEL;gBACF,CAAC;cAEL;YACF;UACF,CAAC;UACDM,mBAAmB,EAAE,CAAC;QACxB,CAAC;QACDlE,SAAS,EAAE,KAAK;QAChBC,eAAe,EAAE,IAAIC,GAAG,CAAC,CAAC;QAC1BC,kBAAkB,EAAE,IAAID,GAAG,CAAC,CAAC;QAC7BE,YAAY,EAAE,IAAIF,GAAG,CAAC;MACxB,CAAC,CAAC;MACFG,MAAM,EAnGQ,MAmGG;MACjBL,SAAS,EAAE,KAAK;MAChBM,cAAc,EAAE;IAClB,CAAC,EACD,IACF,CAAC;IACDjB,MAAM,CAACM,MAAM,CAACY,QAAQ,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAC1DC,qBAAqB,CAAC;AAC7B;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;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,13 +13,16 @@
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
28
  ontology,
@@ -30,7 +33,7 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
30
33
  throw new Error("Should not be generating types for an external type");
31
34
  }
32
35
  const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));
33
- const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));
36
+ const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true, consola));
34
37
  const objectDefIdentifier = object.getDefinitionIdentifier(true);
35
38
  const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
36
39
  const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
@@ -40,7 +43,7 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
40
43
  const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;
41
44
  const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;
42
45
  const identifiers = {
43
- objectDefIdentifier: `${object.shortApiName}`,
46
+ objectDefIdentifier: object.shortApiName,
44
47
  osdkObjectLinksIdentifier,
45
48
  osdkObjectPropsIdentifier,
46
49
  osdkObjectStrictPropsIdentifier,
@@ -154,7 +157,7 @@ ${stringify(definition.properties, {
154
157
  return [`readonly "${maybeStripNamespace(type, apiName)}"${
155
158
  // after we convert everything over we can do this:
156
159
  // !strict || propertyDefinition.nullable ? "?" : ""
157
- ""}`, `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict && !(definition.type === "object" && definition.primaryKeyApiName === apiName) ? `| 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` : ""}`];
158
161
  }
159
162
  })}
160
163
  }`;
@@ -187,7 +190,7 @@ export function createDefinition(object, ontology, identifier, {
187
190
  ${stringify(definition.properties, {
188
191
  "*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
189
192
  apiName
190
- })}"${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"}">`]
191
194
  })}
192
195
  }`
193
196
  })}
@@ -214,4 +217,10 @@ export function createPropertyKeys(type) {
214
217
  const properties = Object.keys(type.getCleanedUpDefinition(true).properties);
215
218
  return `export type PropertyKeys = ${properties.length === 0 ? "never" : properties.map(a => maybeStripNamespace(type, a)).map(a => `"${a}"`).join("|")};`;
216
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;
225
+ }
217
226
  //# sourceMappingURL=wireObjectTypeV2ToSdkObjectConstV2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","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","_","JSON","multiplicity","nullable","primaryKeyApiName","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, forInternalUse }, 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, forInternalUse = false) {\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 const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);\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}\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 | \"$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}\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 if (identifier === \"StrictProps\") {\n return `export type StrictProps = Props`;\n }\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\n || (!strict\n && !(definition.type === \"object\"\n && definition.primaryKeyApiName === apiName))\n ? `| undefined`\n : \"\"}`,\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 const properties = Object.keys(type.getCleanedUpDefinition(true).properties);\n return `export type PropertyKeys = ${properties.length === 0\n ? \"never\"\n : 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;AAChE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD;AACA,OAAO,SAASC,kCAAkCA,CAACC,UAAU,EAAE;EAAEC,QAAQ;EAAEC;AAAe,CAAC,EAAEC,eAAe,EAAE;EAC1G,MAAMC,MAAM,GAAGH,QAAQ,CAACI,iBAAiB,CAACL,UAAU,CAACM,UAAU,CAACC,OAAO,EAAE,IAAI,CAAC;EAC9E,IAAIH,MAAM,YAAYV,WAAW,EAAE;I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,EAAEzB,CAAC,CAAC,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAAC+C,IAAI,CAAC,GAAG,CAAC,GAAG;AAC7F","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,YAAY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AAU,CAAC;EAC5E,OAAO,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);
@@ -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","process","env","NODE_ENV","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,IAAAY,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAA/BlB,SAAS,QAAwB,mDAAmD,IAApFA,SAAS;AACb;AACA,SAASG,+BAA+BA,CAACY,KAAK,EAAE;EAC5C,CAAU,CAACA,KAAK,CAACI,UAAU,CAAC,GAAG,CAAC,GAAAH,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAhClB,SAAS,QAAyB,iCAAiC,IAAnEA,SAAS;AACb","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":[]}