@osdk/client 2.1.0-beta.2 → 2.1.0-beta.21

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 (298) hide show
  1. package/CHANGELOG.md +297 -0
  2. package/build/browser/Client.d.ts +6 -22
  3. package/build/browser/Client.d.ts.map +1 -1
  4. package/build/browser/Client.js +3 -1
  5. package/build/browser/Client.js.map +1 -1
  6. package/build/browser/MinimalClientContext.d.ts +1 -1
  7. package/build/browser/MinimalClientContext.d.ts.map +1 -1
  8. package/build/browser/__unstable/ConjureSupport.js +5 -5
  9. package/build/browser/__unstable/ConjureSupport.js.map +1 -1
  10. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
  11. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
  12. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js +2 -2
  13. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
  14. package/build/browser/actions/actions.test.js +28 -0
  15. package/build/browser/actions/actions.test.js.map +1 -1
  16. package/build/browser/actions/applyAction.js +1 -1
  17. package/build/browser/actions/applyAction.js.map +1 -1
  18. package/build/browser/createClient.d.ts +1 -1
  19. package/build/browser/createClient.d.ts.map +1 -1
  20. package/build/browser/createClient.js +41 -19
  21. package/build/browser/createClient.js.map +1 -1
  22. package/build/browser/createClient.test.js +24 -0
  23. package/build/browser/createClient.test.js.map +1 -1
  24. package/build/browser/createGeotimeSeriesProperty.d.ts +1 -1
  25. package/build/browser/createGeotimeSeriesProperty.d.ts.map +1 -1
  26. package/build/browser/createGeotimeSeriesProperty.js +4 -1
  27. package/build/browser/createGeotimeSeriesProperty.js.map +1 -1
  28. package/build/browser/createMinimalClient.js +9 -4
  29. package/build/browser/createMinimalClient.js.map +1 -1
  30. package/build/browser/createPlatformClient.d.ts +1 -1
  31. package/build/browser/createPlatformClient.d.ts.map +1 -1
  32. package/build/browser/createTimeseriesProperty.d.ts.map +1 -1
  33. package/build/browser/fetchMetadata.test.js +14 -0
  34. package/build/browser/fetchMetadata.test.js.map +1 -1
  35. package/build/browser/index.d.ts +2 -2
  36. package/build/browser/index.d.ts.map +1 -1
  37. package/build/browser/index.js +1 -1
  38. package/build/browser/index.js.map +1 -1
  39. package/build/browser/intellisense.test.js +1 -1
  40. package/build/browser/intellisense.test.js.map +1 -1
  41. package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
  42. package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
  43. package/build/browser/internal/conversions/modernToLegacyWhereClause.js +11 -3
  44. package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  45. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +208 -7
  46. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  47. package/build/browser/object/AttachmentUpload.d.ts.map +1 -1
  48. package/build/browser/object/AttachmentUpload.js +5 -7
  49. package/build/browser/object/AttachmentUpload.js.map +1 -1
  50. package/build/browser/object/aggregate.js +4 -5
  51. package/build/browser/object/aggregate.js.map +1 -1
  52. package/build/browser/object/aggregate.test.js +6 -9
  53. package/build/browser/object/aggregate.test.js.map +1 -1
  54. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
  55. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
  56. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
  57. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  58. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +4 -3
  59. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  60. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +41 -85
  61. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  62. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js +0 -6
  63. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
  64. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +60 -89
  65. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  66. package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js +2 -2
  67. package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
  68. package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js +14 -38
  69. package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
  70. package/build/browser/object/convertWireToOsdkObjects.js +42 -6
  71. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  72. package/build/browser/object/convertWireToOsdkObjects.test.js +177 -45
  73. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  74. package/build/browser/object/fetchPage.d.ts.map +1 -1
  75. package/build/browser/object/fetchPage.js +34 -23
  76. package/build/browser/object/fetchPage.js.map +1 -1
  77. package/build/browser/object/fetchPage.test.js +75 -1
  78. package/build/browser/object/fetchPage.test.js.map +1 -1
  79. package/build/browser/object/object.test.d.ts.map +1 -1
  80. package/build/browser/object/object.test.js +25 -1
  81. package/build/browser/object/object.test.js.map +1 -1
  82. package/build/browser/object/timeseries.test.js +10 -0
  83. package/build/browser/object/timeseries.test.js.map +1 -1
  84. package/build/browser/objectSet/InterfaceObjectSet.test.d.ts +2 -0
  85. package/build/browser/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
  86. package/build/browser/objectSet/InterfaceObjectSet.test.js +61 -0
  87. package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -0
  88. package/build/browser/objectSet/ObjectSet.test.js +162 -48
  89. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  90. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +136 -74
  91. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  92. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +150 -42
  93. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  94. package/build/browser/objectSet/createObjectSet.js +10 -8
  95. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  96. package/build/browser/objectSet/toConjureObjectSet.js +2 -0
  97. package/build/browser/objectSet/toConjureObjectSet.js.map +1 -1
  98. package/build/browser/ontology/makeConjureContext.d.ts +1 -1
  99. package/build/browser/ontology/makeConjureContext.d.ts.map +1 -1
  100. package/build/browser/public/internal.d.ts +4 -0
  101. package/build/browser/public/internal.d.ts.map +1 -0
  102. package/build/browser/public/internal.js +19 -0
  103. package/build/browser/public/internal.js.map +1 -0
  104. package/build/browser/public-utils/createAndFetchTempObjectSetRid.d.ts +11 -0
  105. package/build/browser/public-utils/createAndFetchTempObjectSetRid.d.ts.map +1 -0
  106. package/build/browser/public-utils/createAndFetchTempObjectSetRid.js +32 -0
  107. package/build/browser/public-utils/createAndFetchTempObjectSetRid.js.map +1 -0
  108. package/build/browser/public-utils/hydrateAttachmentFromRid.d.ts +10 -0
  109. package/build/browser/public-utils/hydrateAttachmentFromRid.d.ts.map +1 -0
  110. package/build/{esm/createAttachmentFromRid.js → browser/public-utils/hydrateAttachmentFromRid.js} +9 -4
  111. package/build/browser/public-utils/hydrateAttachmentFromRid.js.map +1 -0
  112. package/build/browser/public-utils/hydrateObjectSetFromRid.d.ts +11 -0
  113. package/build/browser/public-utils/hydrateObjectSetFromRid.d.ts.map +1 -0
  114. package/build/browser/public-utils/hydrateObjectSetFromRid.js +37 -0
  115. package/build/browser/public-utils/hydrateObjectSetFromRid.js.map +1 -0
  116. package/build/browser/queries/applyQuery.d.ts.map +1 -1
  117. package/build/browser/queries/applyQuery.js +3 -4
  118. package/build/browser/queries/applyQuery.js.map +1 -1
  119. package/build/browser/queries/queries.test.js +30 -2
  120. package/build/browser/queries/queries.test.js.map +1 -1
  121. package/build/browser/tsserver.js +1 -1
  122. package/build/browser/tsserver.js.map +1 -1
  123. package/build/browser/util/UserAgent.js +1 -1
  124. package/build/browser/util/UserAgent.js.map +1 -1
  125. package/build/browser/util/datetimeConverters.d.ts +22 -0
  126. package/build/browser/util/datetimeConverters.d.ts.map +1 -0
  127. package/build/browser/util/datetimeConverters.js +55 -0
  128. package/build/browser/util/datetimeConverters.js.map +1 -0
  129. package/build/browser/util/datetimeConverters.test.d.ts +2 -0
  130. package/build/browser/util/datetimeConverters.test.d.ts.map +1 -0
  131. package/build/browser/util/datetimeConverters.test.js +75 -0
  132. package/build/browser/util/datetimeConverters.test.js.map +1 -0
  133. package/build/browser/util/objectSetUtils.d.ts +4 -0
  134. package/build/browser/util/objectSetUtils.d.ts.map +1 -0
  135. package/build/browser/util/objectSetUtils.js +25 -0
  136. package/build/browser/util/objectSetUtils.js.map +1 -0
  137. package/build/browser/util/timeseriesUtils.d.ts +1 -1
  138. package/build/browser/util/timeseriesUtils.d.ts.map +1 -1
  139. package/build/browser/util/timeseriesUtils.js +1 -1
  140. package/build/browser/util/timeseriesUtils.js.map +1 -1
  141. package/build/browser/util/toDataValue.js +6 -0
  142. package/build/browser/util/toDataValue.js.map +1 -1
  143. package/build/browser/util/toDataValue.test.js +9 -1
  144. package/build/browser/util/toDataValue.test.js.map +1 -1
  145. package/build/browser/util/toDataValueQueries.js +6 -0
  146. package/build/browser/util/toDataValueQueries.js.map +1 -1
  147. package/build/esm/Client.d.ts +6 -22
  148. package/build/esm/Client.d.ts.map +1 -1
  149. package/build/esm/Client.js +3 -1
  150. package/build/esm/Client.js.map +1 -1
  151. package/build/esm/MinimalClientContext.d.ts +1 -1
  152. package/build/esm/MinimalClientContext.d.ts.map +1 -1
  153. package/build/esm/__unstable/ConjureSupport.js +5 -5
  154. package/build/esm/__unstable/ConjureSupport.js.map +1 -1
  155. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
  156. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
  157. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +2 -2
  158. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
  159. package/build/esm/actions/actions.test.js +28 -0
  160. package/build/esm/actions/actions.test.js.map +1 -1
  161. package/build/esm/actions/applyAction.js +1 -1
  162. package/build/esm/actions/applyAction.js.map +1 -1
  163. package/build/esm/createClient.d.ts +1 -1
  164. package/build/esm/createClient.d.ts.map +1 -1
  165. package/build/esm/createClient.js +41 -19
  166. package/build/esm/createClient.js.map +1 -1
  167. package/build/esm/createClient.test.js +24 -0
  168. package/build/esm/createClient.test.js.map +1 -1
  169. package/build/esm/createGeotimeSeriesProperty.d.ts +1 -1
  170. package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -1
  171. package/build/esm/createGeotimeSeriesProperty.js +4 -1
  172. package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
  173. package/build/esm/createMinimalClient.js +9 -4
  174. package/build/esm/createMinimalClient.js.map +1 -1
  175. package/build/esm/createPlatformClient.d.ts +1 -1
  176. package/build/esm/createPlatformClient.d.ts.map +1 -1
  177. package/build/esm/createTimeseriesProperty.d.ts.map +1 -1
  178. package/build/esm/fetchMetadata.test.js +14 -0
  179. package/build/esm/fetchMetadata.test.js.map +1 -1
  180. package/build/esm/index.d.ts +2 -2
  181. package/build/esm/index.d.ts.map +1 -1
  182. package/build/esm/index.js +1 -1
  183. package/build/esm/index.js.map +1 -1
  184. package/build/esm/intellisense.test.js +1 -1
  185. package/build/esm/intellisense.test.js.map +1 -1
  186. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
  187. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
  188. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +11 -3
  189. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  190. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +208 -7
  191. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  192. package/build/esm/object/AttachmentUpload.d.ts.map +1 -1
  193. package/build/esm/object/AttachmentUpload.js +5 -7
  194. package/build/esm/object/AttachmentUpload.js.map +1 -1
  195. package/build/esm/object/aggregate.js +4 -5
  196. package/build/esm/object/aggregate.js.map +1 -1
  197. package/build/esm/object/aggregate.test.js +6 -9
  198. package/build/esm/object/aggregate.test.js.map +1 -1
  199. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
  200. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
  201. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
  202. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  203. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +4 -3
  204. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  205. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +41 -85
  206. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  207. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js +0 -6
  208. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
  209. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +60 -89
  210. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  211. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js +2 -2
  212. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
  213. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js +14 -38
  214. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
  215. package/build/esm/object/convertWireToOsdkObjects.js +42 -6
  216. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  217. package/build/esm/object/convertWireToOsdkObjects.test.js +177 -45
  218. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  219. package/build/esm/object/fetchPage.d.ts.map +1 -1
  220. package/build/esm/object/fetchPage.js +34 -23
  221. package/build/esm/object/fetchPage.js.map +1 -1
  222. package/build/esm/object/fetchPage.test.js +75 -1
  223. package/build/esm/object/fetchPage.test.js.map +1 -1
  224. package/build/esm/object/object.test.d.ts.map +1 -1
  225. package/build/esm/object/object.test.js +25 -1
  226. package/build/esm/object/object.test.js.map +1 -1
  227. package/build/esm/object/timeseries.test.js +10 -0
  228. package/build/esm/object/timeseries.test.js.map +1 -1
  229. package/build/esm/objectSet/InterfaceObjectSet.test.d.ts +2 -0
  230. package/build/esm/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
  231. package/build/esm/objectSet/InterfaceObjectSet.test.js +61 -0
  232. package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -0
  233. package/build/esm/objectSet/ObjectSet.test.js +162 -48
  234. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  235. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +136 -77
  236. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  237. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +150 -42
  238. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  239. package/build/esm/objectSet/createObjectSet.js +10 -8
  240. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  241. package/build/esm/objectSet/toConjureObjectSet.js +2 -0
  242. package/build/esm/objectSet/toConjureObjectSet.js.map +1 -1
  243. package/build/esm/ontology/makeConjureContext.d.ts +1 -1
  244. package/build/esm/ontology/makeConjureContext.d.ts.map +1 -1
  245. package/build/esm/public/internal.d.ts +4 -0
  246. package/build/esm/public/internal.d.ts.map +1 -0
  247. package/build/esm/public/internal.js +19 -0
  248. package/build/esm/public/internal.js.map +1 -0
  249. package/build/esm/public-utils/createAndFetchTempObjectSetRid.d.ts +11 -0
  250. package/build/esm/public-utils/createAndFetchTempObjectSetRid.d.ts.map +1 -0
  251. package/build/esm/public-utils/createAndFetchTempObjectSetRid.js +32 -0
  252. package/build/esm/public-utils/createAndFetchTempObjectSetRid.js.map +1 -0
  253. package/build/esm/public-utils/hydrateAttachmentFromRid.d.ts +10 -0
  254. package/build/esm/public-utils/hydrateAttachmentFromRid.d.ts.map +1 -0
  255. package/build/{browser/createAttachmentFromRid.js → esm/public-utils/hydrateAttachmentFromRid.js} +9 -4
  256. package/build/esm/public-utils/hydrateAttachmentFromRid.js.map +1 -0
  257. package/build/esm/public-utils/hydrateObjectSetFromRid.d.ts +11 -0
  258. package/build/esm/public-utils/hydrateObjectSetFromRid.d.ts.map +1 -0
  259. package/build/esm/public-utils/hydrateObjectSetFromRid.js +37 -0
  260. package/build/esm/public-utils/hydrateObjectSetFromRid.js.map +1 -0
  261. package/build/esm/queries/applyQuery.d.ts.map +1 -1
  262. package/build/esm/queries/applyQuery.js +3 -4
  263. package/build/esm/queries/applyQuery.js.map +1 -1
  264. package/build/esm/queries/queries.test.js +30 -2
  265. package/build/esm/queries/queries.test.js.map +1 -1
  266. package/build/esm/tsserver.js +1 -1
  267. package/build/esm/tsserver.js.map +1 -1
  268. package/build/esm/util/UserAgent.js +1 -1
  269. package/build/esm/util/UserAgent.js.map +1 -1
  270. package/build/esm/util/datetimeConverters.d.ts +22 -0
  271. package/build/esm/util/datetimeConverters.d.ts.map +1 -0
  272. package/build/esm/util/datetimeConverters.js +55 -0
  273. package/build/esm/util/datetimeConverters.js.map +1 -0
  274. package/build/esm/util/datetimeConverters.test.d.ts +2 -0
  275. package/build/esm/util/datetimeConverters.test.d.ts.map +1 -0
  276. package/build/esm/util/datetimeConverters.test.js +75 -0
  277. package/build/esm/util/datetimeConverters.test.js.map +1 -0
  278. package/build/esm/util/objectSetUtils.d.ts +4 -0
  279. package/build/esm/util/objectSetUtils.d.ts.map +1 -0
  280. package/build/esm/util/objectSetUtils.js +25 -0
  281. package/build/esm/util/objectSetUtils.js.map +1 -0
  282. package/build/esm/util/timeseriesUtils.d.ts +1 -1
  283. package/build/esm/util/timeseriesUtils.d.ts.map +1 -1
  284. package/build/esm/util/timeseriesUtils.js +1 -1
  285. package/build/esm/util/timeseriesUtils.js.map +1 -1
  286. package/build/esm/util/toDataValue.js +6 -0
  287. package/build/esm/util/toDataValue.js.map +1 -1
  288. package/build/esm/util/toDataValue.test.js +9 -1
  289. package/build/esm/util/toDataValue.test.js.map +1 -1
  290. package/build/esm/util/toDataValueQueries.js +6 -0
  291. package/build/esm/util/toDataValueQueries.js.map +1 -1
  292. package/package.json +23 -19
  293. package/build/browser/createAttachmentFromRid.d.ts +0 -10
  294. package/build/browser/createAttachmentFromRid.d.ts.map +0 -1
  295. package/build/browser/createAttachmentFromRid.js.map +0 -1
  296. package/build/esm/createAttachmentFromRid.d.ts +0 -10
  297. package/build/esm/createAttachmentFromRid.d.ts.map +0 -1
  298. package/build/esm/createAttachmentFromRid.js.map +0 -1
@@ -13,114 +13,85 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { createAttachmentFromRid } from "../../createAttachmentFromRid.js";
16
+ import invariant from "tiny-invariant";
17
17
  import { GeotimeSeriesPropertyImpl } from "../../createGeotimeSeriesProperty.js";
18
18
  import { TimeSeriesPropertyImpl } from "../../createTimeseriesProperty.js";
19
- import { createClientCache } from "../Cache.js";
19
+ import { hydrateAttachmentFromRidInternal } from "../../public-utils/hydrateAttachmentFromRid.js";
20
20
  import { get$as } from "./getDollarAs.js";
21
21
  import { get$link } from "./getDollarLink.js";
22
- import { CachedPropertiesRef, ClientRef, ObjectDefRef, RawObject, UnderlyingOsdkObject } from "./InternalSymbols.js";
23
- const objectPrototypeCache = createClientCache(function (client, objectDef) {
24
- return Object.create(null, {
22
+ import { ClientRef, ObjectDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
23
+ const specialPropertyTypes = new Set(["attachment", "geotimeSeriesReference", "numericTimeseries", "stringTimeseries", "sensorTimeseries"]);
24
+ // kept separate so we are not redefining these functions
25
+ // every time an object is created.
26
+ const basePropDefs = {
27
+ "$as": {
28
+ get: function () {
29
+ return get$as(this[ObjectDefRef]);
30
+ }
31
+ },
32
+ "$link": {
33
+ get: function () {
34
+ return get$link(this);
35
+ }
36
+ }
37
+ };
38
+ /** @internal */
39
+ export function createOsdkObject(client, objectDef, rawObj) {
40
+ // updates the object's "hidden class/map".
41
+ Object.defineProperties(rawObj, {
42
+ [UnderlyingOsdkObject]: {
43
+ enumerable: false,
44
+ value: rawObj
45
+ },
25
46
  [ObjectDefRef]: {
26
- value: objectDef
47
+ value: objectDef,
48
+ enumerable: false
27
49
  },
28
50
  [ClientRef]: {
29
- value: client
30
- },
31
- "$as": {
32
- value: get$as(objectDef)
51
+ value: client,
52
+ enumerable: false
33
53
  },
34
- "$link": {
35
- get: function () {
36
- return get$link(this);
37
- }
38
- },
39
- "$updateInternalValues": {
40
- value: function (newValues) {
41
- this[RawObject] = Object.assign({}, this[RawObject], newValues);
42
- }
43
- }
54
+ ...basePropDefs
44
55
  });
45
- });
46
- /** @internal */
47
- export function createOsdkObject(client, objectDef, rawObj) {
48
- // We use multiple layers of prototypes to maximize reuse and also to keep
49
- // [RawObject] out of `ownKeys`. This keeps the code in the proxy below simpler.
50
- const objectHolderPrototype = Object.create(objectPrototypeCache.get(client, objectDef), {
51
- [RawObject]: {
52
- value: rawObj,
53
- writable: true // so we can allow updates
54
- },
55
- [CachedPropertiesRef]: {
56
- value: new Map(),
57
- writable: true
56
+ // Assign the special values
57
+ for (const propKey of Object.keys(rawObj)) {
58
+ if (propKey in objectDef.properties && typeof objectDef.properties[propKey].type === "string" && specialPropertyTypes.has(objectDef.properties[propKey].type)) {
59
+ rawObj[propKey] = createSpecialProperty(client, objectDef, rawObj, propKey);
58
60
  }
59
- });
60
- // we separate the holder out so we can update
61
- // the underlying data without having to return a new object
62
- // we also need the holder so we can customize the console.log output
63
- const holder = Object.create(objectHolderPrototype);
64
- const osdkObject = new Proxy(holder, {
65
- ownKeys(target) {
66
- return Reflect.ownKeys(target[RawObject]);
67
- },
68
- get(target, p, receiver) {
69
- switch (p) {
70
- case UnderlyingOsdkObject:
71
- // effectively point back to the proxy
72
- return receiver;
73
- }
74
- if (p in target) return target[p];
75
- if (p in rawObj) {
76
- const rawValue = target[RawObject][p];
77
- const propDef = objectDef.properties[p];
78
- if (propDef) {
61
+ }
62
+ return Object.freeze(rawObj);
63
+ }
64
+ function createSpecialProperty(client, objectDef, rawObject, p) {
65
+ const rawValue = rawObject[p];
66
+ const propDef = objectDef.properties[p];
67
+ if (process.env.NODE_ENV !== "production") {
68
+ !(propDef != null && typeof propDef.type === "string" && specialPropertyTypes.has(propDef.type)) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
69
+ }
70
+ {
71
+ {
72
+ {
73
+ {
79
74
  if (propDef.type === "attachment") {
80
75
  if (Array.isArray(rawValue)) {
81
- return rawValue.map(a => createAttachmentFromRid(client, a.rid));
76
+ return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));
82
77
  }
83
- return createAttachmentFromRid(client, rawValue.rid);
78
+ return hydrateAttachmentFromRidInternal(client, rawValue.rid);
84
79
  }
85
- if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries") {
86
- return new TimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);
80
+ if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries" || propDef.type === "sensorTimeseries") {
81
+ return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);
87
82
  }
88
83
  if (propDef.type === "geotimeSeriesReference") {
89
- const instance = target[CachedPropertiesRef].get(p);
90
- if (instance != null) {
91
- return instance;
92
- }
93
- const geotimeProp = new GeotimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);
94
- target[CachedPropertiesRef].set(p, geotimeProp);
95
- return geotimeProp;
84
+ return new GeotimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p, rawValue.type === "geotimeSeriesValue" ? {
85
+ time: rawValue.timestamp,
86
+ value: {
87
+ type: "Point",
88
+ coordinates: rawValue.position
89
+ }
90
+ } : undefined);
96
91
  }
97
92
  }
98
- return rawValue;
99
93
  }
100
- // we do not do any fall through to avoid unexpected behavior
101
- },
102
- set(target, p, newValue) {
103
- // allow the prototype to update this value
104
- if (p === RawObject) {
105
- // symbol only exists internally so no one else can hit this
106
- target[p] = newValue;
107
- return true;
108
- }
109
- return false;
110
- },
111
- getOwnPropertyDescriptor(target, p) {
112
- if (p === RawObject) {
113
- return Reflect.getOwnPropertyDescriptor(target, p);
114
- }
115
- if (target[RawObject][p] != null) {
116
- return {
117
- configurable: true,
118
- enumerable: true
119
- };
120
- }
121
- return undefined;
122
94
  }
123
- });
124
- return osdkObject;
95
+ }
125
96
  }
126
97
  //# sourceMappingURL=createOsdkObject.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkObject.js","names":["createAttachmentFromRid","GeotimeSeriesPropertyImpl","TimeSeriesPropertyImpl","createClientCache","get$as","get$link","CachedPropertiesRef","ClientRef","ObjectDefRef","RawObject","UnderlyingOsdkObject","objectPrototypeCache","client","objectDef","Object","create","value","get","newValues","assign","createOsdkObject","rawObj","objectHolderPrototype","writable","Map","holder","osdkObject","Proxy","ownKeys","target","Reflect","p","receiver","rawValue","propDef","properties","type","Array","isArray","map","a","rid","apiName","primaryKeyApiName","instance","geotimeProp","set","newValue","getOwnPropertyDescriptor","configurable","enumerable","undefined"],"sources":["createOsdkObject.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createAttachmentFromRid } from \"../../createAttachmentFromRid.js\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport { createClientCache } from \"../Cache.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport { CachedPropertiesRef, ClientRef, ObjectDefRef, RawObject, UnderlyingOsdkObject, } from \"./InternalSymbols.js\";\nconst objectPrototypeCache = createClientCache(function (client, objectDef) {\n return Object.create(null, {\n [ObjectDefRef]: { value: objectDef },\n [ClientRef]: { value: client },\n \"$as\": { value: get$as(objectDef) },\n \"$link\": {\n get: function () {\n return get$link(this);\n },\n },\n \"$updateInternalValues\": {\n value: function (newValues) {\n this[RawObject] = Object.assign({}, this[RawObject], newValues);\n },\n },\n });\n});\n/** @internal */\nexport function createOsdkObject(client, objectDef, rawObj) {\n // We use multiple layers of prototypes to maximize reuse and also to keep\n // [RawObject] out of `ownKeys`. This keeps the code in the proxy below simpler.\n const objectHolderPrototype = Object.create(objectPrototypeCache.get(client, objectDef), {\n [RawObject]: {\n value: rawObj,\n writable: true, // so we can allow updates\n },\n [CachedPropertiesRef]: {\n value: new Map(),\n writable: true,\n },\n });\n // we separate the holder out so we can update\n // the underlying data without having to return a new object\n // we also need the holder so we can customize the console.log output\n const holder = Object.create(objectHolderPrototype);\n const osdkObject = new Proxy(holder, {\n ownKeys(target) {\n return Reflect.ownKeys(target[RawObject]);\n },\n get(target, p, receiver) {\n switch (p) {\n case UnderlyingOsdkObject:\n // effectively point back to the proxy\n return receiver;\n }\n if (p in target)\n return target[p];\n if (p in rawObj) {\n const rawValue = target[RawObject][p];\n const propDef = objectDef.properties[p];\n if (propDef) {\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a => createAttachmentFromRid(client, a.rid));\n }\n return createAttachmentFromRid(client, rawValue.rid);\n }\n if (propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\") {\n return new TimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);\n }\n if (propDef.type === \"geotimeSeriesReference\") {\n const instance = target[CachedPropertiesRef].get(p);\n if (instance != null) {\n return instance;\n }\n const geotimeProp = new GeotimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);\n target[CachedPropertiesRef].set(p, geotimeProp);\n return geotimeProp;\n }\n }\n return rawValue;\n }\n // we do not do any fall through to avoid unexpected behavior\n },\n set(target, p, newValue) {\n // allow the prototype to update this value\n if (p === RawObject) {\n // symbol only exists internally so no one else can hit this\n target[p] = newValue;\n return true;\n }\n return false;\n },\n getOwnPropertyDescriptor(target, p) {\n if (p === RawObject) {\n return Reflect.getOwnPropertyDescriptor(target, p);\n }\n if (target[RawObject][p] != null) {\n return { configurable: true, enumerable: true };\n }\n return undefined;\n },\n });\n return osdkObject;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAuB,QAAQ,kCAAkC;AAC1E,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,mBAAmB,EAAEC,SAAS,EAAEC,YAAY,EAAEC,SAAS,EAAEC,oBAAoB,QAAS,sBAAsB;AACrH,MAAMC,oBAAoB,GAAGR,iBAAiB,CAAC,UAAUS,MAAM,EAAEC,SAAS,EAAE;EACxE,OAAOC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAE;IACvB,CAACP,YAAY,GAAG;MAAEQ,KAAK,EAAEH;IAAU,CAAC;IACpC,CAACN,SAAS,GAAG;MAAES,KAAK,EAAEJ;IAAO,CAAC;IAC9B,KAAK,EAAE;MAAEI,KAAK,EAAEZ,MAAM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QACA,OAAOZ,QAAQ;MACnB;MACA;IACJ,CAAC;IACDa,GAAGA,CAACjB,MAAM,EAAEE,CAAC,EAAEgB,QAAQ,EAAE;MACrB;MACA,IAAIhB,CAAC,KAAKtB,SAAS,EAAE;QACjB;QACAoB,MAAM,CAACE,CAAC,CAAC,GAAGgB,QAAQ;QACpB,OAAO,IAAI;MACf;MACA,OAAO,KAAK;IAChB,CAAC;IACDC,wBAAwBA,CAACnB,MAAM,EAAEE,CAAC,EAAE;MAChC,IAAIA,CAAC,KAAKtB,SAAS,EAAE;QACjB,OAAOqB,OAAO,CAACkB,wBAAwB,CAACnB,MAAM,EAAEE,CAAC,CAAC;MACtD;MACA,IAAIF,MAAM,CAACpB,SAAS,CAAC,CAACsB,CAAC,CAAC,IAAI,IAAI,EAAE;QAC9B,OAAO;UAAEkB,YAAY,EAAE,IAAI;UAAEC,UAAU,EAAE;QAAK,CAAC;MACnD;MACA,OAAOC,SAAS;IACpB;EACJ,CAAC,CAAC;EACF,OAAOzB,UAAU;AACrB","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","createOsdkObject","client","objectDef","rawObj","Object","defineProperties","enumerable","value","propKey","keys","properties","type","has","createSpecialProperty","freeze","rawObject","p","rawValue","propDef","process","env","NODE_ENV","Array","isArray","map","a","rid","apiName","primaryKeyApiName","time","timestamp","coordinates","position","undefined"],"sources":["createOsdkObject.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport { ClientRef, ObjectDefRef, UnderlyingOsdkObject, } from \"./InternalSymbols.js\";\nconst specialPropertyTypes = new Set([\n \"attachment\",\n \"geotimeSeriesReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n]);\n// kept separate so we are not redefining these functions\n// every time an object is created.\nconst basePropDefs = {\n \"$as\": {\n get: function () {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function () {\n return get$link(this);\n },\n },\n};\n/** @internal */\nexport function createOsdkObject(client, objectDef, rawObj) {\n // updates the object's \"hidden class/map\".\n Object.defineProperties(rawObj, {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: rawObj,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false },\n [ClientRef]: { value: client, enumerable: false },\n ...basePropDefs,\n });\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)) {\n rawObj[propKey] = createSpecialProperty(client, objectDef, rawObj, propKey);\n }\n }\n return Object.freeze(rawObj);\n}\nfunction createSpecialProperty(client, objectDef, rawObject, p) {\n const rawValue = rawObject[p];\n const propDef = objectDef.properties[p];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type));\n }\n {\n {\n {\n {\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));\n }\n return hydrateAttachmentFromRidInternal(client, rawValue.rid);\n }\n if (propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\") {\n return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);\n }\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p, rawValue.type === \"geotimeSeriesValue\"\n ? {\n time: rawValue.timestamp,\n value: {\n type: \"Point\",\n coordinates: rawValue.position,\n },\n }\n : undefined);\n }\n }\n }\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E,SAASC,gCAAgC,QAAQ,gDAAgD;AACjG,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,YAAY,EAAEC,oBAAoB,QAAS,sBAAsB;AACrF,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAAC,CACjC,YAAY,EACZ,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CACrB,CAAC;AACF;AACA;AACA,MAAMC,YAAY,GAAG;EACjB,KAAK,EAAE;IACHC,GAAG,EAAE,SAAAA,CAAA,EAAY;MACb,OAAOR,MAAM,CAAC,IAAI,CAACG,YAAY,CAAC,CAAC;IACrC;EACJ,CAAC;EACD,OAAO,EAAE;IACLK,GAAG,EAAE,SAAAA,CAAA,EAAY;MACb,OAAOP,QAAQ,CAAC,IAAI,CAAC;IACzB;EACJ;AACJ,CAAC;AACD;AACA,OAAO,S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AAO,CAACP,IAAI,CAAC,IAAAQ,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAD7ClC,SAAS,UAATA,SAAS;EAEb;EACA;IACI;MACI;QACI;UACI,IAAI+B,OAAO,CAACP,IAAI,KAAK,YAAY,EAAE;YAC/B,IAAIW,KAAK,CAACC,OAAO,CAACN,QAAQ,CAAC,EAAE;cACzB,OAAOA,QAAQ,CAACO,GAAG,CAACC,CAAC,IAAInC,gCAAgC,CAACW,MAAM,EAAEwB,CAAC,CAACC,GAAG,CAAC,CAAC;YAC7E;YACA,OAAOpC,gCAAgC,CAACW,MAAM,EAAEgB,QAAQ,CAACS,GAAG,CAAC;UACjE;UACA,IAAIR,OAAO,CAACP,IAAI,KAAK,mBAAmB,IACjCO,OAAO,CAACP,IAAI,KAAK,kBAAkB,IACnCO,OAAO,CAACP,IAAI,KAAK,kBAAkB,EAAE;YACxC,OAAO,IAAItB,sBAAsB,CAACY,MAAM,EAAEC,SAAS,CAACyB,OAAO,EAAEZ,SAAS,CAACb,SAAS,CAAC0B,iBAAiB,CAAC,EAAEZ,CAAC,CAAC;UAC3G;UACA,IAAIE,OAAO,CAACP,IAAI,KAAK,wBAAwB,EAAE;YAC3C,OAAO,IAAIvB,yBAAyB,CAACa,MAAM,EAAEC,SAAS,CAACyB,OAAO,EAAEZ,SAAS,CAACb,SAAS,CAAC0B,iBAAiB,CAAC,EAAEZ,CAAC,EAAEC,QAAQ,CAACN,IAAI,KAAK,oBAAoB,GAC3I;cACEkB,IAAI,EAAEZ,QAAQ,CAACa,SAAS;cACxBvB,KAAK,EAAE;gBACHI,IAAI,EAAE,OAAO;gBACboB,WAAW,EAAEd,QAAQ,CAACe;cAC1B;YACJ,CAAC,GACCC,SAAS,CAAC;UACpB;QACJ;MACJ;IACJ;EACJ;AACJ","ignoreList":[]}
@@ -45,10 +45,10 @@ function $asFactory(objDef) {
45
45
  throw new Error(`Object does not implement interface '${targetMinDef}'.`);
46
46
  }
47
47
  const underlying = this[UnderlyingOsdkObject];
48
- const existing = osdkObjectToInterfaceView.get(underlying).get(targetInterfaceApiName);
48
+ const existing = osdkObjectToInterfaceView.get(underlying).get(targetInterfaceApiName)?.deref();
49
49
  if (existing) return existing;
50
50
  const osdkInterface = createOsdkInterface(underlying, def.def);
51
- osdkObjectToInterfaceView.get(underlying).set(targetInterfaceApiName, osdkInterface);
51
+ osdkObjectToInterfaceView.get(underlying).set(targetInterfaceApiName, new WeakRef(osdkInterface));
52
52
  return osdkInterface;
53
53
  };
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getDollarAs.js","names":["InterfaceDefinitions","createSimpleCache","createOsdkInterface","UnderlyingOsdkObject","get$as","WeakMap","$asFactory","get","osdkObjectToInterfaceView","Map","objDef","targetMinDef","targetInterfaceApiName","apiName","interfaceMap","Error","type","def","underlying","existing","osdkInterface","set"],"sources":["getDollarAs.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { InterfaceDefinitions, } from \"../../ontology/OntologyProvider.js\";\nimport { createSimpleCache } from \"../SimpleCache.js\";\nimport { createOsdkInterface } from \"./createOsdkInterface.js\";\nimport { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nexport const get$as = createSimpleCache(new WeakMap(), $asFactory).get;\nconst osdkObjectToInterfaceView = createSimpleCache(new WeakMap(), () => new Map());\nfunction $asFactory(objDef) {\n // We use the exact same logic for both the interface rep and the underlying rep\n return function $as(targetMinDef) {\n let targetInterfaceApiName;\n if (typeof targetMinDef === \"string\") {\n if (targetMinDef === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n // this is sufficient to determine if we implement the interface\n if (objDef.interfaceMap?.[targetMinDef] == null) {\n throw new Error(`Object does not implement interface '${targetMinDef}'.`);\n }\n targetInterfaceApiName = targetMinDef;\n }\n else if (targetMinDef.apiName === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n else {\n if (targetMinDef.type === \"object\") {\n throw new Error(`'${targetMinDef.apiName}' is not an interface nor is it '${objDef.apiName}', which is the object type.`);\n }\n targetInterfaceApiName = targetMinDef.apiName;\n }\n const def = objDef[InterfaceDefinitions][targetInterfaceApiName];\n if (!def) {\n throw new Error(`Object does not implement interface '${targetMinDef}'.`);\n }\n const underlying = this[UnderlyingOsdkObject];\n const existing = osdkObjectToInterfaceView\n .get(underlying)\n .get(targetInterfaceApiName);\n if (existing)\n return existing;\n const osdkInterface = createOsdkInterface(underlying, def.def);\n osdkObjectToInterfaceView.get(underlying).set(targetInterfaceApiName, osdkInterface);\n return osdkInterface;\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAoB,QAAS,oCAAoC;AAC1E,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,OAAO,MAAMC,MAAM,GAAGH,iBAAiB,CAAC,IAAII,OAAO,CAAC,CAAC,EAAEC,UAAU,CAAC,CAACC,GAAG;AACtE,MAAMC,yBAAyB,GAAGP,iBAAiB,CAAC,IAAII,OAAO,CAAC,CAAC,EAAE,MAAM,IAAII,GAAG,CAAC,CAAC,CAAC;AACnF,SAASH,UAAUA,CAACI,MAAM,EAAE;EACxB;EACA,OAAO,UAAaC,YAAY,EAAE;IAC9B,IAAIC,sBAAsB;IAC1B,IAAI,OAAOD,YAAY,KAAK,QAAQ,EAAE;MAClC,IAAIA,YAAY,KAAKD,MAAM,CAACG,OAAO,EAAE;QACjC,OAAO,IAAI,CAACV,oBAAoB,CAAC;MACrC;MACA;MACA,IAAIO,MAAM,CAACI,YAAY,GAAGH,YAAY,CAAC,IAAI,IAAI,EAAE;QAC7C,MAAM,IAAII,KAAK,CAAC,wCAAwCJ,YAAY,IAAI,CAAC;MAC7E;MACAC,sBAAsB,GAAGD,YAAY;IACzC,CAAC,MACI,IAAIA,YAAY,CAACE,OAAO,KAAKH,MAAM,CAACG,OAAO,EAAE;MAC9C,OAAO,IAAI,CAACV,oBAAoB,CAAC;IACrC,CAAC,MACI;MACD,IAAIQ,YAAY,CAACK,IAAI,KAAK,QAAQ,EAAE;QAChC,MAAM,IAAID,KAAK,CAAC,IAAIJ,YAAY,CAACE,OAAO,oCAAoCH,MAAM,CAACG,OAAO,8BAA8B,CAAC;MAC7H;MACAD,sBAAsB,GAAGD,YAAY,CAACE,OAAO;IACjD;IACA,MAAMI,GAAG,GAAGP,MAAM,CAACV,oBAAoB,CAAC,CAACY,sBAAsB,CAAC;IAChE,IAAI,CAACK,GAAG,EAAE;MACN,MAAM,IAAIF,KAAK,CAAC,wCAAwCJ,YAAY,IAAI,CAAC;IAC7E;IACA,MAAMO,UAAU,GAAG,IAAI,CAACf,oBAAoB,CAAC;IAC7C,MAAMgB,QAAQ,GAAGX,yBAAyB,CACrCD,GAAG,CAACW,UAAU,CAAC,CACfX,GAAG,CAACK,sBAAsB,CAAC;IAChC,IAAIO,QAAQ,EACR,OAAOA,QAAQ;IACnB,MAAMC,aAAa,GAAGlB,mBAAmB,CAACgB,UAAU,EAAED,GAAG,CAACA,GAAG,CAAC;IAC9DT,yBAAyB,CAACD,GAAG,CAACW,UAAU,CAAC,CAACG,GAAG,CAACT,sBAAsB,EAAEQ,aAAa,CAAC;IACpF,OAAOA,aAAa;EACxB,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"file":"getDollarAs.js","names":["InterfaceDefinitions","createSimpleCache","createOsdkInterface","UnderlyingOsdkObject","get$as","WeakMap","$asFactory","get","osdkObjectToInterfaceView","Map","objDef","targetMinDef","targetInterfaceApiName","apiName","interfaceMap","Error","type","def","underlying","existing","deref","osdkInterface","set","WeakRef"],"sources":["getDollarAs.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { InterfaceDefinitions, } from \"../../ontology/OntologyProvider.js\";\nimport { createSimpleCache } from \"../SimpleCache.js\";\nimport { createOsdkInterface } from \"./createOsdkInterface.js\";\nimport { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nexport const get$as = createSimpleCache(new WeakMap(), $asFactory).get;\nconst osdkObjectToInterfaceView = createSimpleCache(new WeakMap(), () => new Map());\nfunction $asFactory(objDef) {\n // We use the exact same logic for both the interface rep and the underlying rep\n return function $as(targetMinDef) {\n let targetInterfaceApiName;\n if (typeof targetMinDef === \"string\") {\n if (targetMinDef === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n // this is sufficient to determine if we implement the interface\n if (objDef.interfaceMap?.[targetMinDef] == null) {\n throw new Error(`Object does not implement interface '${targetMinDef}'.`);\n }\n targetInterfaceApiName = targetMinDef;\n }\n else if (targetMinDef.apiName === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n else {\n if (targetMinDef.type === \"object\") {\n throw new Error(`'${targetMinDef.apiName}' is not an interface nor is it '${objDef.apiName}', which is the object type.`);\n }\n targetInterfaceApiName = targetMinDef.apiName;\n }\n const def = objDef[InterfaceDefinitions][targetInterfaceApiName];\n if (!def) {\n throw new Error(`Object does not implement interface '${targetMinDef}'.`);\n }\n const underlying = this[UnderlyingOsdkObject];\n const existing = osdkObjectToInterfaceView\n .get(underlying)\n .get(targetInterfaceApiName)?.deref();\n if (existing)\n return existing;\n const osdkInterface = createOsdkInterface(underlying, def.def);\n osdkObjectToInterfaceView.get(underlying).set(targetInterfaceApiName, new WeakRef(osdkInterface));\n return osdkInterface;\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAoB,QAAS,oCAAoC;AAC1E,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,OAAO,MAAMC,MAAM,GAAGH,iBAAiB,CAAC,IAAII,OAAO,CAAC,CAAC,EAAEC,UAAU,CAAC,CAACC,GAAG;AACtE,MAAMC,yBAAyB,GAAGP,iBAAiB,CAAC,IAAII,OAAO,CAAC,CAAC,EAAE,MAAM,IAAII,GAAG,CAAC,CAAC,CAAC;AACnF,SAASH,UAAUA,CAACI,MAAM,EAAE;EACxB;EACA,OAAO,UAAaC,YAAY,EAAE;IAC9B,IAAIC,sBAAsB;IAC1B,IAAI,OAAOD,YAAY,KAAK,QAAQ,EAAE;MAClC,IAAIA,YAAY,KAAKD,MAAM,CAACG,OAAO,EAAE;QACjC,OAAO,IAAI,CAACV,oBAAoB,CAAC;MACrC;MACA;MACA,IAAIO,MAAM,CAACI,YAAY,GAAGH,YAAY,CAAC,IAAI,IAAI,EAAE;QAC7C,MAAM,IAAII,KAAK,CAAC,wCAAwCJ,YAAY,IAAI,CAAC;MAC7E;MACAC,sBAAsB,GAAGD,YAAY;IACzC,CAAC,MACI,IAAIA,YAAY,CAACE,OAAO,KAAKH,MAAM,CAACG,OAAO,EAAE;MAC9C,OAAO,IAAI,CAACV,oBAAoB,CAAC;IACrC,CAAC,MACI;MACD,IAAIQ,YAAY,CAACK,IAAI,KAAK,QAAQ,EAAE;QAChC,MAAM,IAAID,KAAK,CAAC,IAAIJ,YAAY,CAACE,OAAO,oCAAoCH,MAAM,CAACG,OAAO,8BAA8B,CAAC;MAC7H;MACAD,sBAAsB,GAAGD,YAAY,CAACE,OAAO;IACjD;IACA,MAAMI,GAAG,GAAGP,MAAM,CAACV,oBAAoB,CAAC,CAACY,sBAAsB,CAAC;IAChE,IAAI,CAACK,GAAG,EAAE;MACN,MAAM,IAAIF,KAAK,CAAC,wCAAwCJ,YAAY,IAAI,CAAC;IAC7E;IACA,MAAMO,UAAU,GAAG,IAAI,CAACf,oBAAoB,CAAC;IAC7C,MAAMgB,QAAQ,GAAGX,yBAAyB,CACrCD,GAAG,CAACW,UAAU,CAAC,CACfX,GAAG,CAACK,sBAAsB,CAAC,EAAEQ,KAAK,CAAC,CAAC;IACzC,IAAID,QAAQ,EACR,OAAOA,QAAQ;IACnB,MAAME,aAAa,GAAGnB,mBAAmB,CAACgB,UAAU,EAAED,GAAG,CAACA,GAAG,CAAC;IAC9DT,yBAAyB,CAACD,GAAG,CAACW,UAAU,CAAC,CAACI,GAAG,CAACV,sBAAsB,EAAE,IAAIW,OAAO,CAACF,aAAa,CAAC,CAAC;IACjG,OAAOA,aAAa;EACxB,CAAC;AACL","ignoreList":[]}
@@ -15,46 +15,22 @@
15
15
  */
16
16
  import { getWireObjectSet } from "../../objectSet/createObjectSet.js";
17
17
  import { fetchSingle, fetchSingleWithErrors } from "../fetchSingle.js";
18
- import { ClientRef, ObjectDefRef, RawObject } from "./InternalSymbols.js";
18
+ import { ClientRef, ObjectDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
19
19
  /** @internal */
20
20
  export function get$link(holder) {
21
- return new Proxy(holder, DollarLinkProxyHandler);
22
- }
23
- const DollarLinkProxyHandler = {
24
- get(target, p) {
25
- const {
26
- [ObjectDefRef]: objDef,
27
- [ClientRef]: client,
28
- [RawObject]: rawObj
29
- } = target;
30
- const linkDef = objDef.links[p];
31
- if (linkDef == null) {
32
- return;
33
- }
21
+ const client = holder[ClientRef];
22
+ const objDef = holder[ObjectDefRef];
23
+ const rawObj = holder[UnderlyingOsdkObject];
24
+ return Object.freeze(Object.fromEntries(Object.keys(objDef.links).map(linkName => {
25
+ const linkDef = objDef.links[linkName];
34
26
  const objectSet = client.objectSetFactory(objDef, client).where({
35
27
  [objDef.primaryKeyApiName]: rawObj.$primaryKey
36
- }).pivotTo(p);
37
- if (!linkDef.multiplicity) {
38
- return {
39
- fetchOne: options => fetchSingle(client, objDef, options ?? {}, getWireObjectSet(objectSet)),
40
- fetchOneWithErrors: options => fetchSingleWithErrors(client, objDef, options ?? {}, getWireObjectSet(objectSet))
41
- };
42
- } else {
43
- return objectSet;
44
- }
45
- },
46
- ownKeys(target) {
47
- return [...Object.keys(target[ObjectDefRef].links)];
48
- },
49
- getOwnPropertyDescriptor(target, p) {
50
- if (target[ObjectDefRef].links[p]) {
51
- return {
52
- enumerable: true,
53
- configurable: true,
54
- // fixme
55
- writable: false
56
- };
57
- }
58
- }
59
- };
28
+ }).pivotTo(linkName);
29
+ const value = !linkDef.multiplicity ? {
30
+ fetchOne: options => fetchSingle(client, objDef, options ?? {}, getWireObjectSet(objectSet)),
31
+ fetchOneWithErrors: options => fetchSingleWithErrors(client, objDef, options ?? {}, getWireObjectSet(objectSet))
32
+ } : objectSet;
33
+ return [linkName, value];
34
+ })));
35
+ }
60
36
  //# sourceMappingURL=getDollarLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDollarLink.js","names":["getWireObjectSet","fetchSingle","fetchSingleWithErrors","ClientRef","ObjectDefRef","RawObject","get$link","holder","Proxy","DollarLinkProxyHandler","get","target","p","objDef","client","rawObj","linkDef","links","objectSet","objectSetFactory","where","primaryKeyApiName","$primaryKey","pivotTo","multiplicity","fetchOne","options","fetchOneWithErrors","ownKeys","Object","keys","getOwnPropertyDescriptor","enumerable","configurable","writable"],"sources":["getDollarLink.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getWireObjectSet } from \"../../objectSet/createObjectSet.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../fetchSingle.js\";\nimport { ClientRef, ObjectDefRef, RawObject } from \"./InternalSymbols.js\";\n/** @internal */\nexport function get$link(holder) {\n return new Proxy(holder, DollarLinkProxyHandler);\n}\nconst DollarLinkProxyHandler = {\n get(target, p) {\n const { [ObjectDefRef]: objDef, [ClientRef]: client, [RawObject]: rawObj, } = target;\n const linkDef = objDef.links[p];\n if (linkDef == null) {\n return;\n }\n const objectSet = client.objectSetFactory(objDef, client)\n .where({\n [objDef.primaryKeyApiName]: rawObj.$primaryKey,\n })\n .pivotTo(p);\n if (!linkDef.multiplicity) {\n return {\n fetchOne: (options) => fetchSingle(client, objDef, options ?? {}, getWireObjectSet(objectSet)),\n fetchOneWithErrors: (options) => fetchSingleWithErrors(client, objDef, options ?? {}, getWireObjectSet(objectSet)),\n };\n }\n else {\n return objectSet;\n }\n },\n ownKeys(target) {\n return [...Object.keys(target[ObjectDefRef].links)];\n },\n getOwnPropertyDescriptor(target, p) {\n if (target[ObjectDefRef].links[p]) {\n return {\n enumerable: true,\n configurable: true, // fixme\n writable: false,\n };\n }\n },\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,mBAAmB;AACtE,SAASC,SAAS,EAAEC,YAAY,EAAEC,SAAS,QAAQ,sBAAsB;AACzE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Y,CAAC,CAACa,KAAK,CAACL,CAAC,CAAC,EAAE;MAC/B,OAAO;QACHoB,UAAU,EAAE,IAAI;QAChBC,YAAY,EAAE,IAAI;QAAE;QACpBC,QAAQ,EAAE;MACd,CAAC;IACL;EACJ;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"getDollarLink.js","names":["getWireObjectSet","fetchSingle","fetchSingleWithErrors","ClientRef","ObjectDefRef","UnderlyingOsdkObject","get$link","holder","client","objDef","rawObj","Object","freeze","fromEntries","keys","links","map","linkName","linkDef","objectSet","objectSetFactory","where","primaryKeyApiName","$primaryKey","pivotTo","value","multiplicity","fetchOne","options","fetchOneWithErrors"],"sources":["getDollarLink.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getWireObjectSet } from \"../../objectSet/createObjectSet.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../fetchSingle.js\";\nimport { ClientRef, ObjectDefRef, UnderlyingOsdkObject, } from \"./InternalSymbols.js\";\n/** @internal */\nexport function get$link(holder) {\n const client = holder[ClientRef];\n const objDef = holder[ObjectDefRef];\n const rawObj = holder[UnderlyingOsdkObject];\n return Object.freeze(Object.fromEntries(Object.keys(objDef.links).map((linkName) => {\n const linkDef = objDef.links[linkName];\n const objectSet = client.objectSetFactory(objDef, client)\n .where({\n [objDef.primaryKeyApiName]: rawObj.$primaryKey,\n })\n .pivotTo(linkName);\n const value = !linkDef.multiplicity\n ? {\n fetchOne: (options) => fetchSingle(client, objDef, options ?? {}, getWireObjectSet(objectSet)),\n fetchOneWithErrors: (options) => fetchSingleWithErrors(client, objDef, options ?? {}, getWireObjectSet(objectSet)),\n }\n : objectSet;\n return [linkName, value];\n })));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,mBAAmB;AACtE,SAASC,SAAS,EAAEC,YAAY,EAAEC,oBAAoB,QAAS,sBAAsB;AACrF;AACA,OAAO,SAASC,QAAQA,CAACC,MAAM,EAAE;EAC7B,MAAMC,MAAM,GAAGD,MAAM,CAACJ,SAAS,CAAC;EAChC,MAAMM,MAAM,GAAGF,MAAM,CAACH,YAAY,CAAC;EACnC,MAAMM,MAAM,GAAGH,MAAM,CAACF,oBAAoB,CAAC;EAC3C,OAAOM,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,WAAW,CAACF,MAAM,CAACG,IAAI,CAACL,MAAM,CAACM,KAAK,CAAC,CAACC,GAAG,CAAEC,QAAQ,IAAK;IAChF,MAAMC,OAAO,GAAGT,MAAM,CAACM,KAAK,CAACE,QAAQ,CAAC;IACtC,MAAME,SAAS,GAAGX,MAAM,CAACY,gBAAgB,CAACX,MAAM,EAAED,MAAM,CAAC,CACpDa,KAAK,CAAC;MACP,CAACZ,MAAM,CAACa,iBAAiB,GAAGZ,MAAM,CAACa;IACvC,CAAC,CAAC,CACGC,OAAO,CAACP,QAAQ,CAAC;IACtB,MAAMQ,KAAK,GAAG,CAACP,OAAO,CAACQ,YAAY,GAC7B;MACEC,QAAQ,EAAGC,OAAO,IAAK3B,WAAW,CAACO,MAAM,EAAEC,MAAM,EAAEmB,OAAO,IAAI,CAAC,CAAC,EAAE5B,gBAAgB,CAACmB,SAAS,CAAC,CAAC;MAC9FU,kBAAkB,EAAGD,OAAO,IAAK1B,qBAAqB,CAACM,MAAM,EAAEC,MAAM,EAAEmB,OAAO,IAAI,CAAC,CAAC,EAAE5B,gBAAgB,CAACmB,SAAS,CAAC;IACrH,CAAC,GACCA,SAAS;IACf,OAAO,CAACF,QAAQ,EAAEQ,KAAK,CAAC;EAC5B,CAAC,CAAC,CAAC,CAAC;AACR","ignoreList":[]}
@@ -39,7 +39,7 @@ export async function convertWireToOsdkObjects(client, objects, interfaceApiName
39
39
  const ret = [];
40
40
  for (const rawObj of objects) {
41
41
  const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
42
- !objectDef ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : void 0;
42
+ !objectDef ? process.env.NODE_ENV !== "production" ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : invariant(false) : void 0;
43
43
  // default value for when we are checking an object
44
44
  let objProps;
45
45
  let conforming = true;
@@ -65,6 +65,42 @@ export async function convertWireToOsdkObjects(client, objects, interfaceApiName
65
65
  client.logger?.debug(`END convertWireToOsdkObjects()`);
66
66
  return ret;
67
67
  }
68
+ /**
69
+ * @internal
70
+ */
71
+ export async function convertWireToOsdkObjects2(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}) {
72
+ client.logger?.debug(`START convertWireToOsdkObjects2()`);
73
+ fixObjectPropertiesInPlace(objects, forceRemoveRid);
74
+ const ret = [];
75
+ for (const rawObj of objects) {
76
+ const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
77
+ !objectDef ? process.env.NODE_ENV !== "production" ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : invariant(false) : void 0;
78
+ const interfaceToObjMapping = interfaceApiName ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName] : undefined;
79
+ const ifaceSelected = interfaceApiName && interfaceToObjMapping ? selectedProps ? Object.keys(interfaceToObjMapping).filter(val => {
80
+ selectedProps?.includes(interfaceToObjMapping[val]);
81
+ }) : [...Object.values(interfaceToObjMapping), objectDef.primaryKeyApiName] : undefined;
82
+ // default value for when we are checking an object
83
+ let objProps;
84
+ let conforming = true;
85
+ if (interfaceApiName && ifaceSelected) {
86
+ invariantInterfacesAsViews(objectDef, interfaceApiName, client);
87
+ objProps = ifaceSelected;
88
+ } else {
89
+ objProps = selectedProps ?? Object.keys(objectDef.properties);
90
+ }
91
+ conforming &&= isConforming(client, objectDef, rawObj, objProps);
92
+ if (strictNonNull === "throw" && !conforming) {
93
+ throw new Error("Unable to safely convert objects as some non nullable properties are null");
94
+ } else if (strictNonNull === "drop" && !conforming) {
95
+ continue;
96
+ }
97
+ let osdkObject = createOsdkObject(client, objectDef, rawObj);
98
+ if (interfaceApiName) osdkObject = osdkObject.$as(interfaceApiName);
99
+ ret.push(osdkObject);
100
+ }
101
+ client.logger?.debug(`END convertWireToOsdkObjects2()`);
102
+ return ret;
103
+ }
68
104
  /**
69
105
  * Utility function that lets us take down selected property names from an interface
70
106
  * and convert them to an array of property names on an object.
@@ -99,7 +135,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
99
135
  function isConforming(client, def, obj, propsToCheck) {
100
136
  for (const propName of propsToCheck) {
101
137
  if (def.properties[propName].nullable === false && obj[propName] == null) {
102
- if (process?.env?.NODE_ENV !== "production") {
138
+ if (process.env.NODE_ENV !== "production") {
103
139
  client.logger?.debug({
104
140
  obj: {
105
141
  $objectType: obj["$objectType"],
@@ -134,13 +170,13 @@ function fixObjectPropertiesInPlace(objs, forceRemoveRid) {
134
170
  delete obj.__rid;
135
171
  }
136
172
  // Backend returns as __apiName but we want to stick to $ structure
137
- obj.$apiName = obj.__apiName;
173
+ obj.$apiName ??= obj.__apiName;
138
174
  // for now these are the same but when we start doing interface projections the $objectType will always be underlying and
139
175
  // the $apiName will be for the current view (in current designs)
140
- obj.$objectType = obj.__apiName;
176
+ obj.$objectType = obj.$apiName;
141
177
  // copying over for now as its always returned. In the future, this should just be inferred from underlying
142
- obj.$primaryKey = obj.__primaryKey;
143
- obj.$title = obj.__title;
178
+ obj.$primaryKey ??= obj.__primaryKey;
179
+ obj.$title ??= obj.__title;
144
180
  // we don't want people to use these
145
181
  delete obj.__apiName;
146
182
  delete obj.__primaryKey;
@@ -1 +1 @@
1
- {"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","selectedProps","strictNonNull","logger","debug","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","primaryKeyApiName","$primaryKey","def","obj","propsToCheck","propName","nullable","process","env","NODE_ENV","$objectType","warning","warn","console","error","objs","__rid","$rid","__apiName","__primaryKey","$title","__title"],"sources":["convertWireToOsdkObjects.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\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false) {\n client.logger?.debug(`START convertWireToOsdkObjects()`);\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n // default value for when we are checking an object\n let objProps;\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n objProps = convertInterfacePropNamesToObjectPropNames(objectDef, ifaceDef.apiName, ifaceSelected);\n }\n else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\"Unable to safely convert objects as some non nullable properties are null\");\n }\n else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n let osdkObject = createOsdkObject(client, objectDef, rawObj);\n if (interfaceApiName)\n osdkObject = osdkObject.$as(interfaceApiName);\n ret.push(osdkObject);\n }\n client.logger?.debug(`END convertWireToOsdkObjects()`);\n return ret;\n}\n/**\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nfunction convertInterfacePropNamesToObjectPropNames(objectDef, interfaceApiName, ifacePropsToMap) {\n return ifacePropsToMap.map((ifaceProp) => objectDef.interfaceMap[interfaceApiName][ifaceProp]);\n}\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {\n const newProps = {};\n for (const [sptProp, regularProp] of Object.entries(objectDef.interfaceMap[interfaceApiName])) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\nfunction isConforming(client, def, obj, propsToCheck) {\n for (const propName of propsToCheck) {\n if (def.properties[propName].nullable === false && obj[propName] == null) {\n if (process?.env?.NODE_ENV !== \"production\") {\n client.logger?.debug({\n obj: {\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n }, `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`);\n }\n return false;\n }\n }\n return true;\n}\nfunction invariantInterfacesAsViews(objectDef, interfaceApiName, client) {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning = \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n }\n else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\nfunction fixObjectPropertiesInPlace(objs, forceRemoveRid) {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName = obj.__apiName;\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.__apiName;\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey = obj.__primaryKey;\n obj.$title = obj.__title;\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.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CAACL,SAAS,EAAEjB,gBAAgB,EAAEF,MAAM,EAAE;EACrE,IAAImB,SAAS,CAACiB,YAAY,GAAGlC,gBAAgB,CAAC,IAAI,IAAI,EAAE;IACpD,MAAMoD,OAAO,GAAG,iOAAiO;IACjP,IAAItD,MAAM,CAACM,MAAM,EAAE;MACfN,MAAM,CAACM,MAAM,CAACiD,IAAI,CAACD,OAAO,CAAC;IAC/B,CAAC,MACI;MACD;MACAE,OAAO,CAACC,KAAK,CAAC,YAAYH,OAAO,EAAE,CAAC;IACxC;IACA,MAAM,IAAIzB,KAAK,CAACyB,OAAO,CAAC;EAC5B;AACJ;AACA,SAAS9C,0BAA0BA,CAACkD,IAAI,EAAEvD,cAAc,EAAE;EACtD,KAAK,MAAM2C,GAAG,IAAIY,IAAI,EAAE;IACpB,IAAIvD,cAAc,EAAE;MAChB,OAAO2C,GAAG,CAACa,KAAK;IACpB;IACA,IAAIb,GAAG,CAACa,KAAK,EAAE;MACXb,GAAG,CAACc,IAAI,GAAGd,GAAG,CAACa,KAAK;MACpB,OAAOb,GAAG,CAACa,KAAK;IACpB;IACA;IACAb,GAAG,CAACzB,QAAQ,GAAGyB,GAAG,CAACe,SAAS;IAC5B;IACA;IACAf,GAAG,CAACO,WAAW,GAAGP,GAAG,CAACe,SAAS;IAC/B;IACAf,GAAG,CAACF,WAAW,GAAGE,GAAG,CAACgB,YAAY;IAClChB,GAAG,CAACiB,MAAM,GAAGjB,GAAG,CAACkB,OAAO;IACxB;IACA,OAAOlB,GAAG,CAACe,SAAS;IACpB,OAAOf,GAAG,CAACgB,YAAY;IACvB,OAAOhB,GAAG,CAACkB,OAAO;EACtB;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","selectedProps","strictNonNull","logger","debug","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","process","env","NODE_ENV","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","convertWireToOsdkObjects2","interfaceToObjectTypeMappings","interfaceToObjMapping","filter","val","includes","values","primaryKeyApiName","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","$primaryKey","def","obj","propsToCheck","propName","nullable","$objectType","warning","warn","console","error","objs","__rid","$rid","__apiName","__primaryKey","$title","__title"],"sources":["convertWireToOsdkObjects.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\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false) {\n client.logger?.debug(`START convertWireToOsdkObjects()`);\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n // default value for when we are checking an object\n let objProps;\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n objProps = convertInterfacePropNamesToObjectPropNames(objectDef, ifaceDef.apiName, ifaceSelected);\n }\n else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\"Unable to safely convert objects as some non nullable properties are null\");\n }\n else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n let osdkObject = createOsdkObject(client, objectDef, rawObj);\n if (interfaceApiName)\n osdkObject = osdkObject.$as(interfaceApiName);\n ret.push(osdkObject);\n }\n client.logger?.debug(`END convertWireToOsdkObjects()`);\n return ret;\n}\n/**\n * @internal\n */\nexport async function convertWireToOsdkObjects2(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}) {\n client.logger?.debug(`START convertWireToOsdkObjects2()`);\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n const interfaceToObjMapping = interfaceApiName\n ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName]\n : undefined;\n const ifaceSelected = interfaceApiName && interfaceToObjMapping\n ? (selectedProps\n ? Object.keys(interfaceToObjMapping).filter(val => {\n selectedProps?.includes(interfaceToObjMapping[val]);\n })\n : [\n ...Object.values(interfaceToObjMapping),\n objectDef.primaryKeyApiName,\n ])\n : undefined;\n // default value for when we are checking an object\n let objProps;\n let conforming = true;\n if (interfaceApiName && ifaceSelected) {\n invariantInterfacesAsViews(objectDef, interfaceApiName, client);\n objProps = ifaceSelected;\n }\n else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\"Unable to safely convert objects as some non nullable properties are null\");\n }\n else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n let osdkObject = createOsdkObject(client, objectDef, rawObj);\n if (interfaceApiName)\n osdkObject = osdkObject.$as(interfaceApiName);\n ret.push(osdkObject);\n }\n client.logger?.debug(`END convertWireToOsdkObjects2()`);\n return ret;\n}\n/**\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nfunction convertInterfacePropNamesToObjectPropNames(objectDef, interfaceApiName, ifacePropsToMap) {\n return ifacePropsToMap.map((ifaceProp) => objectDef.interfaceMap[interfaceApiName][ifaceProp]);\n}\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {\n const newProps = {};\n for (const [sptProp, regularProp] of Object.entries(objectDef.interfaceMap[interfaceApiName])) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\nfunction isConforming(client, def, obj, propsToCheck) {\n for (const propName of propsToCheck) {\n if (def.properties[propName].nullable === false && obj[propName] == null) {\n if (process.env.NODE_ENV !== \"production\") {\n client.logger?.debug({\n obj: {\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n }, `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`);\n }\n return false;\n }\n }\n return true;\n}\nfunction invariantInterfacesAsViews(objectDef, interfaceApiName, client) {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning = \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n }\n else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\nfunction fixObjectPropertiesInPlace(objs, forceRemoveRid) {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName ??= obj.__apiName;\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.$apiName;\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey ??= obj.__primaryKey;\n obj.$title ??= obj.__title;\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,gDAAgD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAACC,MAAM,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,cAAc,GAAG,KAAK,EAAEC,aAAa,EAAEC,aAAa,GAAG,KAAK,EAAE;EAC5IL,MAAM,CAACM,MAAM,EAAEC,KAAK,CAAC,kCAAkC,CAAC;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