@osdk/client 2.2.0-beta.8 → 2.3.0-beta.1

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 (489) hide show
  1. package/CHANGELOG.md +388 -0
  2. package/build/browser/MinimalClientContext.js.map +1 -1
  3. package/build/browser/__unstable/ConjureSupport.js.map +1 -1
  4. package/build/browser/actions/ActionValidationError.js +1 -1
  5. package/build/browser/actions/ActionValidationError.js.map +1 -1
  6. package/build/browser/actions/actions.test.js +134 -89
  7. package/build/browser/actions/actions.test.js.map +1 -1
  8. package/build/browser/actions/applyAction.js.map +1 -1
  9. package/build/browser/createClient.js +5 -1
  10. package/build/browser/createClient.js.map +1 -1
  11. package/build/browser/createClient.test.js +14 -6
  12. package/build/browser/createClient.test.js.map +1 -1
  13. package/build/browser/createMinimalClient.js +2 -2
  14. package/build/browser/createMinimalClient.js.map +1 -1
  15. package/build/browser/createMinimalClientHelper.js +25 -0
  16. package/build/browser/createMinimalClientHelper.js.map +1 -0
  17. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +36 -13
  18. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  19. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
  20. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  21. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +93 -0
  22. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
  23. package/build/browser/fetchMetadata.js +1 -1
  24. package/build/browser/fetchMetadata.js.map +1 -1
  25. package/build/browser/fetchMetadata.test.js +11 -9
  26. package/build/browser/fetchMetadata.test.js.map +1 -1
  27. package/build/browser/index.js +0 -1
  28. package/build/browser/index.js.map +1 -1
  29. package/build/{esm/util/isOsdkBaseObject.js → browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js} +9 -4
  30. package/build/browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
  31. package/build/browser/intellisense.test.js +17 -1
  32. package/build/browser/intellisense.test.js.map +1 -1
  33. package/build/browser/logger/BaseLogger.js +59 -0
  34. package/build/browser/logger/BaseLogger.js.map +1 -0
  35. package/build/browser/logger/BrowserLogger.js +67 -0
  36. package/build/browser/logger/BrowserLogger.js.map +1 -0
  37. package/build/browser/logger/MinimalLogger.js +39 -0
  38. package/build/browser/logger/MinimalLogger.js.map +1 -0
  39. package/build/browser/logger/MinimalLogger.test.js +60 -0
  40. package/build/browser/logger/MinimalLogger.test.js.map +1 -0
  41. package/build/browser/logger/TestLogger.js +56 -0
  42. package/build/browser/logger/TestLogger.js.map +1 -0
  43. package/build/browser/object/SimpleOsdkProperties.js +2 -0
  44. package/build/browser/object/SimpleOsdkProperties.js.map +1 -0
  45. package/build/browser/object/attachment.test.js +20 -7
  46. package/build/browser/object/attachment.test.js.map +1 -1
  47. package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js +2 -0
  48. package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -0
  49. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
  50. package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -1
  51. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
  52. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  53. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +53 -35
  54. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  55. package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
  56. package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
  57. package/build/browser/object/convertWireToOsdkObjects.js +7 -15
  58. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  59. package/build/browser/object/convertWireToOsdkObjects.test.js +39 -33
  60. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  61. package/build/browser/object/fetchPage.js +17 -4
  62. package/build/browser/object/fetchPage.js.map +1 -1
  63. package/build/browser/object/fetchPage.test.js +56 -2
  64. package/build/browser/object/fetchPage.test.js.map +1 -1
  65. package/build/browser/object/geotimeseriesreference.test.js +56 -134
  66. package/build/browser/object/geotimeseriesreference.test.js.map +1 -1
  67. package/build/browser/object/media.test.js +19 -14
  68. package/build/browser/object/media.test.js.map +1 -1
  69. package/build/browser/object/object.test.js +96 -89
  70. package/build/browser/object/object.test.js.map +1 -1
  71. package/build/browser/object/timeseries.test.js +119 -85
  72. package/build/browser/object/timeseries.test.js.map +1 -1
  73. package/build/browser/objectSet/InterfaceObjectSet.test.js +37 -17
  74. package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
  75. package/build/browser/objectSet/ObjectSet.test.js +200 -116
  76. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  77. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +20 -16
  78. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  79. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +19 -12
  80. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  81. package/build/browser/objectSet/createObjectSet.js +2 -1
  82. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  83. package/build/browser/observable/ListPayload.js.map +1 -1
  84. package/build/browser/observable/ObjectPayload.js.map +1 -1
  85. package/build/browser/observable/ObservableClient.js.map +1 -1
  86. package/build/browser/observable/internal/ActionApplication.js +32 -32
  87. package/build/browser/observable/internal/ActionApplication.js.map +1 -1
  88. package/build/browser/observable/internal/BulkObjectLoader.js +93 -0
  89. package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -0
  90. package/build/browser/observable/internal/BulkObjectLoader.test.js +112 -0
  91. package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -0
  92. package/build/browser/observable/internal/CacheKey.js +1 -1
  93. package/build/browser/observable/internal/CacheKey.js.map +1 -1
  94. package/build/browser/observable/internal/CacheKeys.js +2 -2
  95. package/build/browser/observable/internal/CacheKeys.js.map +1 -1
  96. package/build/browser/observable/internal/{ChangedObjects.js → Changes.js} +20 -9
  97. package/build/browser/observable/internal/Changes.js.map +1 -0
  98. package/build/browser/observable/internal/Layer.js +3 -0
  99. package/build/browser/observable/internal/Layer.js.map +1 -1
  100. package/build/browser/observable/internal/ListQuery.js +414 -170
  101. package/build/browser/observable/internal/ListQuery.js.map +1 -1
  102. package/build/browser/observable/internal/ObjectQuery.js +34 -21
  103. package/build/browser/observable/internal/ObjectQuery.js.map +1 -1
  104. package/build/browser/observable/internal/ObservableClientImpl.js +4 -12
  105. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  106. package/build/browser/observable/internal/OptimisticJob.js +1 -1
  107. package/build/browser/observable/internal/OptimisticJob.js.map +1 -1
  108. package/build/browser/observable/internal/OrderByCanonicalizer.js +73 -0
  109. package/build/browser/observable/internal/OrderByCanonicalizer.js.map +1 -0
  110. package/build/browser/observable/internal/OrderByCanonicalizer.test.js +78 -0
  111. package/build/browser/observable/internal/OrderByCanonicalizer.test.js.map +1 -0
  112. package/build/browser/observable/internal/Query.js +64 -31
  113. package/build/browser/observable/internal/Query.js.map +1 -1
  114. package/build/browser/observable/internal/RefCounts.js +7 -2
  115. package/build/browser/observable/internal/RefCounts.js.map +1 -1
  116. package/build/browser/observable/internal/SimpleWhereClause.js +2 -0
  117. package/build/browser/observable/internal/SimpleWhereClause.js.map +1 -0
  118. package/build/browser/observable/internal/Store.js +86 -269
  119. package/build/browser/observable/internal/Store.js.map +1 -1
  120. package/build/browser/observable/internal/Store.test.js +401 -375
  121. package/build/browser/observable/internal/Store.test.js.map +1 -1
  122. package/build/browser/observable/internal/WhereClauseCanonicalizer.js +11 -3
  123. package/build/browser/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
  124. package/build/browser/observable/internal/objectMatchesWhereClause.js +0 -2
  125. package/build/browser/observable/internal/objectMatchesWhereClause.js.map +1 -1
  126. package/build/browser/observable/internal/objectMatchesWhereClause.test.js.map +1 -1
  127. package/build/browser/observable/internal/testUtils.js +85 -20
  128. package/build/browser/observable/internal/testUtils.js.map +1 -1
  129. package/build/browser/ontology/OntologyProvider.js.map +1 -1
  130. package/build/browser/ontology/StandardOntologyProvider.js +12 -5
  131. package/build/browser/ontology/StandardOntologyProvider.js.map +1 -1
  132. package/build/browser/ontology/StandardOntologyProvider.test.js +17 -16
  133. package/build/browser/ontology/StandardOntologyProvider.test.js.map +1 -1
  134. package/build/browser/ontology/loadFullObjectMetadata.js +0 -1
  135. package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -1
  136. package/build/browser/ontology/loadQueryMetadata.js +5 -2
  137. package/build/browser/ontology/loadQueryMetadata.js.map +1 -1
  138. package/build/browser/public/internal.js +2 -0
  139. package/build/browser/public/internal.js.map +1 -1
  140. package/build/browser/public/unstable-do-not-use.js +1 -0
  141. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  142. package/build/browser/public-utils/osdkConfig.js +49 -0
  143. package/build/browser/public-utils/osdkConfig.js.map +1 -0
  144. package/build/browser/{object/createObjectSpecifierFromPrimaryKey.js → public-utils/vite-env.d.ts} +2 -3
  145. package/build/browser/queries/applyQuery.js +6 -4
  146. package/build/browser/queries/applyQuery.js.map +1 -1
  147. package/build/browser/queries/queries.test.js +93 -27
  148. package/build/browser/queries/queries.test.js.map +1 -1
  149. package/build/browser/queries/types.js.map +1 -1
  150. package/build/browser/tsserver.js.map +1 -1
  151. package/build/browser/util/UserAgent.js +1 -1
  152. package/build/browser/util/extractRdpDefinition.js +140 -0
  153. package/build/browser/util/extractRdpDefinition.js.map +1 -0
  154. package/build/browser/util/extractRdpDefinition.test.js +233 -0
  155. package/build/browser/util/extractRdpDefinition.test.js.map +1 -0
  156. package/build/browser/util/{isOsdkBaseObject.js → isObjectSpecifiersObject.js} +2 -2
  157. package/build/browser/util/isObjectSpecifiersObject.js.map +1 -0
  158. package/build/browser/util/isPoint.js +20 -0
  159. package/build/browser/util/isPoint.js.map +1 -0
  160. package/build/browser/util/objectSpecifierUtils.js +48 -0
  161. package/build/browser/util/objectSpecifierUtils.js.map +1 -0
  162. package/build/browser/util/objectSpecifierUtils.test.js +42 -0
  163. package/build/browser/util/objectSpecifierUtils.test.js.map +1 -0
  164. package/build/browser/util/toDataValue.js +6 -2
  165. package/build/browser/util/toDataValue.js.map +1 -1
  166. package/build/browser/util/toDataValue.test.js +37 -16
  167. package/build/browser/util/toDataValue.test.js.map +1 -1
  168. package/build/browser/util/toDataValueQueries.js +4 -6
  169. package/build/browser/util/toDataValueQueries.js.map +1 -1
  170. package/build/cjs/{Client-DBTcM9gB.d.cts → Client-CgL2LKN9.d.cts} +6 -7
  171. package/build/cjs/{chunk-IU47QMYO.cjs → chunk-FKI2LO2O.cjs} +250 -82
  172. package/build/cjs/chunk-FKI2LO2O.cjs.map +1 -0
  173. package/build/cjs/chunk-T4NIFYZS.cjs +14 -0
  174. package/build/cjs/chunk-T4NIFYZS.cjs.map +1 -0
  175. package/build/cjs/{chunk-JPENHIJB.cjs → chunk-W5PFESFR.cjs} +174 -35
  176. package/build/cjs/chunk-W5PFESFR.cjs.map +1 -0
  177. package/build/cjs/index.cjs +212 -193
  178. package/build/cjs/index.cjs.map +1 -1
  179. package/build/cjs/index.d.cts +4 -24
  180. package/build/cjs/public/internal.cjs +61 -7
  181. package/build/cjs/public/internal.cjs.map +1 -1
  182. package/build/cjs/public/internal.d.cts +50 -3
  183. package/build/cjs/public/unstable-do-not-use.cjs +885 -620
  184. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  185. package/build/cjs/public/unstable-do-not-use.d.cts +35 -25
  186. package/build/esm/MinimalClientContext.js.map +1 -1
  187. package/build/esm/__unstable/ConjureSupport.js.map +1 -1
  188. package/build/esm/actions/ActionValidationError.js +1 -1
  189. package/build/esm/actions/ActionValidationError.js.map +1 -1
  190. package/build/esm/actions/actions.test.js +134 -89
  191. package/build/esm/actions/actions.test.js.map +1 -1
  192. package/build/esm/actions/applyAction.js.map +1 -1
  193. package/build/esm/createClient.js +5 -1
  194. package/build/esm/createClient.js.map +1 -1
  195. package/build/esm/createClient.test.js +14 -6
  196. package/build/esm/createClient.test.js.map +1 -1
  197. package/build/esm/createMinimalClient.js +2 -2
  198. package/build/esm/createMinimalClient.js.map +1 -1
  199. package/build/esm/createMinimalClientHelper.js +25 -0
  200. package/build/esm/createMinimalClientHelper.js.map +1 -0
  201. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +36 -13
  202. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  203. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
  204. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  205. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +93 -0
  206. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
  207. package/build/esm/fetchMetadata.js +1 -1
  208. package/build/esm/fetchMetadata.js.map +1 -1
  209. package/build/esm/fetchMetadata.test.js +11 -9
  210. package/build/esm/fetchMetadata.test.js.map +1 -1
  211. package/build/esm/index.js +0 -1
  212. package/build/esm/index.js.map +1 -1
  213. package/build/esm/{util/isOsdkObject.js → intellisense.test.helpers/showsObjectPropertyJsdoc.js} +9 -4
  214. package/build/esm/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
  215. package/build/esm/intellisense.test.js +17 -1
  216. package/build/esm/intellisense.test.js.map +1 -1
  217. package/build/esm/logger/BaseLogger.js +59 -0
  218. package/build/esm/logger/BaseLogger.js.map +1 -0
  219. package/build/esm/logger/BrowserLogger.js +67 -0
  220. package/build/esm/logger/BrowserLogger.js.map +1 -0
  221. package/build/esm/logger/MinimalLogger.js +39 -0
  222. package/build/esm/logger/MinimalLogger.js.map +1 -0
  223. package/build/esm/logger/MinimalLogger.test.js +60 -0
  224. package/build/esm/logger/MinimalLogger.test.js.map +1 -0
  225. package/build/esm/logger/TestLogger.js +56 -0
  226. package/build/esm/logger/TestLogger.js.map +1 -0
  227. package/build/esm/object/SimpleOsdkProperties.js +2 -0
  228. package/build/esm/object/SimpleOsdkProperties.js.map +1 -0
  229. package/build/esm/object/attachment.test.js +20 -7
  230. package/build/esm/object/attachment.test.js.map +1 -1
  231. package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js +2 -0
  232. package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -0
  233. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
  234. package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -1
  235. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
  236. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  237. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +53 -35
  238. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  239. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
  240. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
  241. package/build/esm/object/convertWireToOsdkObjects.js +7 -15
  242. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  243. package/build/esm/object/convertWireToOsdkObjects.test.js +39 -33
  244. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  245. package/build/esm/object/fetchPage.js +17 -4
  246. package/build/esm/object/fetchPage.js.map +1 -1
  247. package/build/esm/object/fetchPage.test.js +56 -2
  248. package/build/esm/object/fetchPage.test.js.map +1 -1
  249. package/build/esm/object/geotimeseriesreference.test.js +56 -134
  250. package/build/esm/object/geotimeseriesreference.test.js.map +1 -1
  251. package/build/esm/object/media.test.js +19 -14
  252. package/build/esm/object/media.test.js.map +1 -1
  253. package/build/esm/object/object.test.js +96 -89
  254. package/build/esm/object/object.test.js.map +1 -1
  255. package/build/esm/object/timeseries.test.js +119 -85
  256. package/build/esm/object/timeseries.test.js.map +1 -1
  257. package/build/esm/objectSet/InterfaceObjectSet.test.js +37 -17
  258. package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
  259. package/build/esm/objectSet/ObjectSet.test.js +200 -116
  260. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  261. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +20 -16
  262. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  263. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +19 -12
  264. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  265. package/build/esm/objectSet/createObjectSet.js +2 -1
  266. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  267. package/build/esm/observable/ListPayload.js.map +1 -1
  268. package/build/esm/observable/ObjectPayload.js.map +1 -1
  269. package/build/esm/observable/ObservableClient.js.map +1 -1
  270. package/build/esm/observable/internal/ActionApplication.js +32 -32
  271. package/build/esm/observable/internal/ActionApplication.js.map +1 -1
  272. package/build/esm/observable/internal/BulkObjectLoader.js +93 -0
  273. package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -0
  274. package/build/esm/observable/internal/BulkObjectLoader.test.js +112 -0
  275. package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -0
  276. package/build/esm/observable/internal/CacheKey.js +1 -1
  277. package/build/esm/observable/internal/CacheKey.js.map +1 -1
  278. package/build/esm/observable/internal/CacheKeys.js +2 -2
  279. package/build/esm/observable/internal/CacheKeys.js.map +1 -1
  280. package/build/esm/observable/internal/{ChangedObjects.js → Changes.js} +20 -9
  281. package/build/esm/observable/internal/Changes.js.map +1 -0
  282. package/build/esm/observable/internal/Layer.js +3 -0
  283. package/build/esm/observable/internal/Layer.js.map +1 -1
  284. package/build/esm/observable/internal/ListQuery.js +414 -170
  285. package/build/esm/observable/internal/ListQuery.js.map +1 -1
  286. package/build/esm/observable/internal/ObjectQuery.js +34 -21
  287. package/build/esm/observable/internal/ObjectQuery.js.map +1 -1
  288. package/build/esm/observable/internal/ObservableClientImpl.js +4 -12
  289. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  290. package/build/esm/observable/internal/OptimisticJob.js +1 -1
  291. package/build/esm/observable/internal/OptimisticJob.js.map +1 -1
  292. package/build/esm/observable/internal/OrderByCanonicalizer.js +73 -0
  293. package/build/esm/observable/internal/OrderByCanonicalizer.js.map +1 -0
  294. package/build/esm/observable/internal/OrderByCanonicalizer.test.js +78 -0
  295. package/build/esm/observable/internal/OrderByCanonicalizer.test.js.map +1 -0
  296. package/build/esm/observable/internal/Query.js +64 -31
  297. package/build/esm/observable/internal/Query.js.map +1 -1
  298. package/build/esm/observable/internal/RefCounts.js +7 -2
  299. package/build/esm/observable/internal/RefCounts.js.map +1 -1
  300. package/build/esm/observable/internal/SimpleWhereClause.js +2 -0
  301. package/build/esm/observable/internal/SimpleWhereClause.js.map +1 -0
  302. package/build/esm/observable/internal/Store.js +86 -269
  303. package/build/esm/observable/internal/Store.js.map +1 -1
  304. package/build/esm/observable/internal/Store.test.js +401 -375
  305. package/build/esm/observable/internal/Store.test.js.map +1 -1
  306. package/build/esm/observable/internal/WhereClauseCanonicalizer.js +11 -3
  307. package/build/esm/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
  308. package/build/esm/observable/internal/objectMatchesWhereClause.js +0 -2
  309. package/build/esm/observable/internal/objectMatchesWhereClause.js.map +1 -1
  310. package/build/esm/observable/internal/objectMatchesWhereClause.test.js.map +1 -1
  311. package/build/esm/observable/internal/testUtils.js +85 -20
  312. package/build/esm/observable/internal/testUtils.js.map +1 -1
  313. package/build/esm/ontology/OntologyProvider.js.map +1 -1
  314. package/build/esm/ontology/StandardOntologyProvider.js +12 -5
  315. package/build/esm/ontology/StandardOntologyProvider.js.map +1 -1
  316. package/build/esm/ontology/StandardOntologyProvider.test.js +17 -16
  317. package/build/esm/ontology/StandardOntologyProvider.test.js.map +1 -1
  318. package/build/esm/ontology/loadFullObjectMetadata.js +0 -1
  319. package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -1
  320. package/build/esm/ontology/loadQueryMetadata.js +5 -2
  321. package/build/esm/ontology/loadQueryMetadata.js.map +1 -1
  322. package/build/esm/public/internal.js +2 -0
  323. package/build/esm/public/internal.js.map +1 -1
  324. package/build/esm/public/unstable-do-not-use.js +1 -0
  325. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  326. package/build/esm/public-utils/osdkConfig.js +49 -0
  327. package/build/esm/public-utils/osdkConfig.js.map +1 -0
  328. package/build/esm/{object/createObjectSpecifierFromPrimaryKey.js → public-utils/vite-env.d.ts} +2 -3
  329. package/build/esm/queries/applyQuery.js +6 -4
  330. package/build/esm/queries/applyQuery.js.map +1 -1
  331. package/build/esm/queries/queries.test.js +93 -27
  332. package/build/esm/queries/queries.test.js.map +1 -1
  333. package/build/esm/queries/types.js.map +1 -1
  334. package/build/esm/tsserver.js.map +1 -1
  335. package/build/esm/util/UserAgent.js +1 -1
  336. package/build/esm/util/extractRdpDefinition.js +140 -0
  337. package/build/esm/util/extractRdpDefinition.js.map +1 -0
  338. package/build/esm/util/extractRdpDefinition.test.js +233 -0
  339. package/build/esm/util/extractRdpDefinition.test.js.map +1 -0
  340. package/build/{browser/util/isOsdkObject.js → esm/util/isObjectSpecifiersObject.js} +2 -2
  341. package/build/esm/util/isObjectSpecifiersObject.js.map +1 -0
  342. package/build/esm/util/isPoint.js +20 -0
  343. package/build/esm/util/isPoint.js.map +1 -0
  344. package/build/esm/util/objectSpecifierUtils.js +48 -0
  345. package/build/esm/util/objectSpecifierUtils.js.map +1 -0
  346. package/build/esm/util/objectSpecifierUtils.test.js +42 -0
  347. package/build/esm/util/objectSpecifierUtils.test.js.map +1 -0
  348. package/build/esm/util/toDataValue.js +6 -2
  349. package/build/esm/util/toDataValue.js.map +1 -1
  350. package/build/esm/util/toDataValue.test.js +37 -16
  351. package/build/esm/util/toDataValue.test.js.map +1 -1
  352. package/build/esm/util/toDataValueQueries.js +4 -6
  353. package/build/esm/util/toDataValueQueries.js.map +1 -1
  354. package/build/types/MinimalClientContext.d.ts +1 -1
  355. package/build/types/MinimalClientContext.d.ts.map +1 -1
  356. package/build/types/__unstable/ConjureSupport.d.ts +2 -2
  357. package/build/types/actions/applyAction.d.ts +1 -2
  358. package/build/types/actions/applyAction.d.ts.map +1 -1
  359. package/build/types/createClient.d.ts +1 -1
  360. package/build/types/createClient.d.ts.map +1 -1
  361. package/build/types/createClient.test.d.ts +2 -1
  362. package/build/types/createClient.test.d.ts.map +1 -1
  363. package/build/types/createMinimalClientHelper.d.ts +1 -0
  364. package/build/types/createMinimalClientHelper.d.ts.map +1 -0
  365. package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts +1 -0
  366. package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts.map +1 -0
  367. package/build/types/index.d.ts +4 -6
  368. package/build/types/index.d.ts.map +1 -1
  369. package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts +1 -0
  370. package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts.map +1 -0
  371. package/build/types/logger/BaseLogger.d.ts +33 -0
  372. package/build/types/logger/BaseLogger.d.ts.map +1 -0
  373. package/build/types/logger/BrowserLogger.d.ts +9 -0
  374. package/build/types/logger/BrowserLogger.d.ts.map +1 -0
  375. package/build/types/logger/MinimalLogger.d.ts +9 -0
  376. package/build/types/logger/MinimalLogger.d.ts.map +1 -0
  377. package/build/types/logger/MinimalLogger.test.d.ts +1 -0
  378. package/build/types/logger/MinimalLogger.test.d.ts.map +1 -0
  379. package/build/types/logger/TestLogger.d.ts +14 -0
  380. package/build/types/logger/TestLogger.d.ts.map +1 -0
  381. package/build/types/object/SimpleOsdkProperties.d.ts +1 -0
  382. package/build/types/object/SimpleOsdkProperties.d.ts.map +1 -0
  383. package/build/types/object/convertWireToOsdkObjects/BaseHolder.d.ts +1 -0
  384. package/build/types/object/convertWireToOsdkObjects/BaseHolder.d.ts.map +1 -0
  385. package/build/types/object/convertWireToOsdkObjects.d.ts +8 -1
  386. package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
  387. package/build/types/object/fetchPage.d.ts.map +1 -1
  388. package/build/types/object/object.test.d.ts.map +1 -1
  389. package/build/types/objectSet/ObjectSet.test.d.ts.map +1 -1
  390. package/build/types/observable/ListPayload.d.ts +5 -9
  391. package/build/types/observable/ListPayload.d.ts.map +1 -1
  392. package/build/types/observable/ObjectPayload.d.ts +4 -7
  393. package/build/types/observable/ObjectPayload.d.ts.map +1 -1
  394. package/build/types/observable/ObservableClient.d.ts +27 -11
  395. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  396. package/build/types/observable/internal/ActionApplication.d.ts +2 -2
  397. package/build/types/observable/internal/ActionApplication.d.ts.map +1 -1
  398. package/build/types/observable/internal/BulkObjectLoader.d.ts +8 -0
  399. package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -0
  400. package/build/types/observable/internal/BulkObjectLoader.test.d.ts +1 -0
  401. package/build/types/observable/internal/BulkObjectLoader.test.d.ts.map +1 -0
  402. package/build/types/observable/internal/CacheKeys.d.ts +1 -1
  403. package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
  404. package/build/types/observable/internal/Changes.d.ts +15 -0
  405. package/build/types/observable/internal/Changes.d.ts.map +1 -0
  406. package/build/types/observable/internal/Layer.d.ts +1 -0
  407. package/build/types/observable/internal/Layer.d.ts.map +1 -1
  408. package/build/types/observable/internal/ListQuery.d.ts +59 -14
  409. package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
  410. package/build/types/observable/internal/ObjectQuery.d.ts +5 -6
  411. package/build/types/observable/internal/ObjectQuery.d.ts.map +1 -1
  412. package/build/types/observable/internal/OptimisticJob.d.ts +1 -1
  413. package/build/types/observable/internal/OptimisticJob.d.ts.map +1 -1
  414. package/build/types/observable/internal/OrderByCanonicalizer.d.ts +12 -0
  415. package/build/types/observable/internal/OrderByCanonicalizer.d.ts.map +1 -0
  416. package/build/types/observable/internal/OrderByCanonicalizer.test.d.ts +1 -0
  417. package/build/types/observable/internal/OrderByCanonicalizer.test.d.ts.map +1 -0
  418. package/build/types/observable/internal/Query.d.ts +41 -6
  419. package/build/types/observable/internal/Query.d.ts.map +1 -1
  420. package/build/types/observable/internal/RefCounts.d.ts.map +1 -1
  421. package/build/types/observable/internal/SimpleWhereClause.d.ts +2 -0
  422. package/build/types/observable/internal/SimpleWhereClause.d.ts.map +1 -0
  423. package/build/types/observable/internal/Store.d.ts +20 -44
  424. package/build/types/observable/internal/Store.d.ts.map +1 -1
  425. package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts +2 -1
  426. package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts.map +1 -1
  427. package/build/types/observable/internal/objectMatchesWhereClause.d.ts +4 -2
  428. package/build/types/observable/internal/objectMatchesWhereClause.d.ts.map +1 -1
  429. package/build/types/observable/internal/testUtils.d.ts +39 -10
  430. package/build/types/observable/internal/testUtils.d.ts.map +1 -1
  431. package/build/types/ontology/OntologyProvider.d.ts +1 -1
  432. package/build/types/ontology/OntologyProvider.d.ts.map +1 -1
  433. package/build/types/ontology/loadQueryMetadata.d.ts +1 -1
  434. package/build/types/ontology/loadQueryMetadata.d.ts.map +1 -1
  435. package/build/types/public/internal.d.ts +2 -0
  436. package/build/types/public/internal.d.ts.map +1 -1
  437. package/build/types/public/unstable-do-not-use.d.ts +4 -5
  438. package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
  439. package/build/types/public-utils/osdkConfig.d.ts +8 -0
  440. package/build/types/public-utils/osdkConfig.d.ts.map +1 -0
  441. package/build/types/public-utils/vite-env.d.d.ts +3 -0
  442. package/build/types/public-utils/vite-env.d.d.ts.map +1 -0
  443. package/build/types/queries/applyQuery.d.ts +2 -2
  444. package/build/types/queries/applyQuery.d.ts.map +1 -1
  445. package/build/types/queries/types.d.ts +1 -1
  446. package/build/types/queries/types.d.ts.map +1 -1
  447. package/build/types/tsserver.d.ts +1 -1
  448. package/build/types/tsserver.d.ts.map +1 -1
  449. package/build/types/util/extractRdpDefinition.d.ts +4 -0
  450. package/build/types/util/extractRdpDefinition.d.ts.map +1 -0
  451. package/build/types/util/extractRdpDefinition.test.d.ts +1 -0
  452. package/build/types/util/extractRdpDefinition.test.d.ts.map +1 -0
  453. package/build/types/util/isObjectSpecifiersObject.d.ts +5 -0
  454. package/build/types/util/isObjectSpecifiersObject.d.ts.map +1 -0
  455. package/build/types/util/isPoint.d.ts +1 -0
  456. package/build/types/util/isPoint.d.ts.map +1 -0
  457. package/build/types/util/objectSpecifierUtils.d.ts +24 -0
  458. package/build/types/util/objectSpecifierUtils.d.ts.map +1 -0
  459. package/build/types/util/objectSpecifierUtils.test.d.ts +1 -0
  460. package/build/types/util/objectSpecifierUtils.test.d.ts.map +1 -0
  461. package/package.json +21 -18
  462. package/build/browser/Logger.js +0 -2
  463. package/build/browser/Logger.js.map +0 -1
  464. package/build/browser/object/createObjectSpecifierFromPrimaryKey.js.map +0 -1
  465. package/build/browser/observable/internal/ChangedObjects.js.map +0 -1
  466. package/build/browser/util/isOsdkBaseObject.js.map +0 -1
  467. package/build/browser/util/isOsdkObject.js.map +0 -1
  468. package/build/cjs/chunk-IU47QMYO.cjs.map +0 -1
  469. package/build/cjs/chunk-JPENHIJB.cjs.map +0 -1
  470. package/build/cjs/chunk-Q7SFCCGT.cjs +0 -11
  471. package/build/cjs/chunk-Q7SFCCGT.cjs.map +0 -1
  472. package/build/cjs/graphql-RGM5SRWV.cjs +0 -10532
  473. package/build/cjs/graphql-RGM5SRWV.cjs.map +0 -1
  474. package/build/esm/Logger.js +0 -2
  475. package/build/esm/Logger.js.map +0 -1
  476. package/build/esm/object/createObjectSpecifierFromPrimaryKey.js.map +0 -1
  477. package/build/esm/observable/internal/ChangedObjects.js.map +0 -1
  478. package/build/esm/util/isOsdkBaseObject.js.map +0 -1
  479. package/build/esm/util/isOsdkObject.js.map +0 -1
  480. package/build/types/Logger.d.ts +0 -17
  481. package/build/types/Logger.d.ts.map +0 -1
  482. package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts +0 -2
  483. package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts.map +0 -1
  484. package/build/types/observable/internal/ChangedObjects.d.ts +0 -11
  485. package/build/types/observable/internal/ChangedObjects.d.ts.map +0 -1
  486. package/build/types/util/isOsdkBaseObject.d.ts +0 -2
  487. package/build/types/util/isOsdkBaseObject.d.ts.map +0 -1
  488. package/build/types/util/isOsdkObject.d.ts +0 -2
  489. package/build/types/util/isOsdkObject.d.ts.map +0 -1
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { beforeEach, describe, expect, it, vi } from "vitest";
18
+ import { MinimalLogger } from "./MinimalLogger.js";
19
+ const orderedLevels = ["trace", "debug", "info", "warn", "error", "fatal"];
20
+ describe(MinimalLogger, () => {
21
+ const consoleMocks = Object.fromEntries(["log", "error", "warn", "trace"].map(name => [name, vi.spyOn(console, name)]));
22
+ beforeEach(() => {
23
+ for (const consoleMock of Object.values(consoleMocks)) {
24
+ consoleMock.mockClear();
25
+ }
26
+ });
27
+ it("does not debug log by default", () => {
28
+ const logger = new MinimalLogger();
29
+ logger.debug("hi");
30
+ for (const consoleMock of Object.values(consoleMocks)) {
31
+ expect(consoleMock).not.toHaveBeenCalled();
32
+ }
33
+ });
34
+ it("can log", () => {
35
+ new MinimalLogger({}, {});
36
+ });
37
+ describe.for(orderedLevels)("For level %s", level => {
38
+ const idx = orderedLevels.findIndex(a => a === level);
39
+ expect(idx).toBeGreaterThan(-1);
40
+ const shouldNotOutput = orderedLevels.slice(0, idx);
41
+ const shouldOutput = orderedLevels.slice(idx);
42
+ const x = [...shouldNotOutput.map(x => [x, false]), ...shouldOutput.map(x => [x, true])];
43
+ it.for(x)("It should log for %s? %s", ([levelToCheck, shouldLog]) => {
44
+ const logger = new MinimalLogger({}, {
45
+ level
46
+ });
47
+ logger[levelToCheck]("logging");
48
+ let calls = 0;
49
+ for (const consoleMock of Object.values(consoleMocks)) {
50
+ calls += consoleMock.mock.calls.length;
51
+ }
52
+ if (shouldLog) {
53
+ expect(calls === 1, `Should log one time but got ${calls}`);
54
+ } else {
55
+ expect(calls === 0, "should not call console.thing");
56
+ }
57
+ });
58
+ });
59
+ });
60
+ //# sourceMappingURL=MinimalLogger.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MinimalLogger.test.js","names":["beforeEach","describe","expect","it","vi","MinimalLogger","orderedLevels","consoleMocks","Object","fromEntries","map","name","spyOn","console","consoleMock","values","mockClear","logger","debug","not","toHaveBeenCalled","for","level","idx","findIndex","a","toBeGreaterThan","shouldNotOutput","slice","shouldOutput","x","levelToCheck","shouldLog","calls","mock","length"],"sources":["MinimalLogger.test.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { MockInstance } from \"vitest\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { MinimalLogger } from \"./MinimalLogger.js\";\n\nconst orderedLevels = [\n \"trace\",\n \"debug\",\n \"info\",\n \"warn\",\n \"error\",\n \"fatal\",\n] as const;\n\ndescribe(MinimalLogger, () => {\n const consoleTypes = [\"log\", \"error\", \"warn\", \"trace\"] as const;\n type consoleTypes = typeof consoleTypes[number];\n\n const consoleMocks = Object.fromEntries(\n consoleTypes.map(name =>\n [name, vi.spyOn(console, name)] as [consoleTypes, MockInstance<any>]\n ),\n ) as Record<\n typeof consoleTypes[number],\n MockInstance<any>\n >;\n\n beforeEach(() => {\n for (const consoleMock of Object.values(consoleMocks)) {\n consoleMock.mockClear();\n }\n });\n\n it(\"does not debug log by default\", () => {\n const logger = new MinimalLogger();\n logger.debug(\"hi\");\n\n for (const consoleMock of Object.values(consoleMocks)) {\n expect(consoleMock).not.toHaveBeenCalled();\n }\n });\n\n it(\"can log\", () => {\n new MinimalLogger({}, {});\n });\n\n describe.for(orderedLevels)(\"For level %s\", (level) => {\n const idx = orderedLevels.findIndex(a => a === level);\n expect(idx).toBeGreaterThan(-1);\n\n const shouldNotOutput = orderedLevels.slice(0, idx);\n const shouldOutput = orderedLevels.slice(idx);\n\n const x = [\n ...shouldNotOutput.map(x => [x, false] as const),\n ...shouldOutput.map(x => [x, true] as const),\n ];\n\n it.for(x)(\"It should log for %s? %s\", ([levelToCheck, shouldLog]) => {\n const logger = new MinimalLogger({}, { level });\n\n logger[levelToCheck](\"logging\");\n\n let calls = 0;\n\n for (const consoleMock of Object.values(consoleMocks)) {\n calls += consoleMock.mock.calls.length;\n }\n\n if (shouldLog) {\n expect(calls === 1, `Should log one time but got ${calls}`);\n } else {\n expect(calls === 0, \"should not call console.thing\");\n }\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAC7D,SAASC,aAAa,QAAQ,oBAAoB;AAElD,MAAMC,aAAa,GAAG,CACpB,OAAO,EACP,OAAO,EACP,MAAM,EACN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,CAACsB,KAAK,CAACL,GAAG,CAAC;IAE7C,MAAMO,CAAC,GAAG,CACR,GAAGH,eAAe,CAACjB,GAAG,CAACoB,CAAC,IAAI,CAACA,CAAC,EAAE,KAAK,CAAU,CAAC,EAChD,GAAGD,YAAY,CAACnB,GAAG,CAACoB,CAAC,IAAI,CAACA,CAAC,EAAE,IAAI,CAAU,CAAC,CAC7C;IAED3B,EAAE,CAACkB,GAAG,CAACS,CAAC,CAAC,CAAC,0BAA0B,EAAE,CAAC,CAACC,YAAY,EAAEC,SAAS,CAAC,KAAK;MACnE,MAAMf,MAAM,GAAG,IAAIZ,aAAa,CAAC,CAAC,CAAC,EAAE;QAAEiB;MAAM,CAAC,CAAC;MAE/CL,MAAM,CAACc,YAAY,CAAC,CAAC,SAAS,CAAC;MAE/B,IAAIE,KAAK,GAAG,CAAC;MAEb,KAAK,MAAMnB,WAAW,IAAIN,MAAM,CAACO,MAAM,CAACR,YAAY,CAAC,EAAE;QACrD0B,KAAK,IAAInB,WAAW,CAACoB,IAAI,CAACD,KAAK,CAACE,MAAM;MACxC;MAEA,IAAIH,SAAS,EAAE;QACb9B,MAAM,CAAC+B,KAAK,KAAK,CAAC,EAAE,+BAA+BA,KAAK,EAAE,CAAC;MAC7D,CAAC,MAAM;QACL/B,MAAM,CAAC+B,KAAK,KAAK,CAAC,EAAE,+BAA+B,CAAC;MACtD;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { Chalk } from "chalk";
18
+ import { vi } from "vitest";
19
+ import { BaseLogger } from "./BaseLogger.js";
20
+ const chalk = new Chalk(); // new Chalk({ level: 3 });
21
+
22
+ const colors = {
23
+ debug: [chalk.cyan, chalk.bgCyan],
24
+ info: [chalk.green, chalk.bgGreen],
25
+ trace: [chalk.gray, chalk.bgGray],
26
+ error: [chalk.red, chalk.bgRed],
27
+ warn: [chalk.yellow, chalk.bgYellow],
28
+ fatal: [chalk.redBright, chalk.bgRedBright]
29
+ };
30
+
31
+ /**
32
+ * A logger suitable for using in unit tests.
33
+ * - It uses chalk for colors (Node and browser console.log supports)
34
+ * - Does not rely on async behavior of `pino`.
35
+ */
36
+ export class TestLogger extends BaseLogger {
37
+ constructor(bindings = {}, options = {}) {
38
+ super(bindings, {
39
+ ...options,
40
+ level: options.level ?? "error"
41
+ }, TestLogger);
42
+ }
43
+ createLogMethod(name, bindings) {
44
+ const msgs = [colors[name][1](name)];
45
+ if (this.options?.msgPrefix) {
46
+ msgs.push(colors[name][0](this.options.msgPrefix));
47
+ }
48
+ if (typeof bindings === "object" && "methodName" in bindings) {
49
+ msgs.push(chalk.magenta(`.${bindings.methodName}()`));
50
+ }
51
+
52
+ // eslint-disable-next-line no-console
53
+ return vi.fn(console[name === "fatal" ? "error" : name].bind(console, msgs.join(" ")));
54
+ }
55
+ }
56
+ //# sourceMappingURL=TestLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestLogger.js","names":["Chalk","vi","BaseLogger","chalk","colors","debug","cyan","bgCyan","info","green","bgGreen","trace","gray","bgGray","error","red","bgRed","warn","yellow","bgYellow","fatal","redBright","bgRedBright","TestLogger","constructor","bindings","options","level","createLogMethod","name","msgs","msgPrefix","push","magenta","methodName","fn","console","bind","join"],"sources":["TestLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { Logger } from \"@osdk/api\";\nimport { Chalk } from \"chalk\";\nimport { vi } from \"vitest\";\nimport { BaseLogger } from \"./BaseLogger.js\";\n\nconst chalk = new Chalk(); // new Chalk({ level: 3 });\n\nconst colors = {\n debug: [chalk.cyan, chalk.bgCyan],\n info: [chalk.green, chalk.bgGreen],\n trace: [chalk.gray, chalk.bgGray],\n error: [chalk.red, chalk.bgRed],\n warn: [chalk.yellow, chalk.bgYellow],\n fatal: [chalk.redBright, chalk.bgRedBright],\n} as const;\n\n/**\n * A logger suitable for using in unit tests.\n * - It uses chalk for colors (Node and browser console.log supports)\n * - Does not rely on async behavior of `pino`.\n */\nexport class TestLogger extends BaseLogger implements Logger {\n constructor(\n bindings: Record<string, any> = {},\n options: { level?: string; msgPrefix?: string } = {},\n ) {\n super(\n bindings,\n { ...options, level: options.level ?? \"error\" },\n TestLogger,\n );\n }\n\n protected createLogMethod(\n name: \"trace\" | \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\",\n bindings: Record<string, any>,\n ): Logger.LogFn {\n const msgs: string[] = [colors[name][1](name)];\n\n if (this.options?.msgPrefix) {\n msgs.push(colors[name][0](this.options.msgPrefix));\n }\n\n if (typeof bindings === \"object\" && \"methodName\" in bindings) {\n msgs.push(chalk.magenta(`.${bindings.methodName}()`));\n }\n\n // eslint-disable-next-line no-console\n return vi.fn<Logger.LogFn>(console[name === \"fatal\" ? \"error\" : name].bind(\n console,\n msgs.join(\" \"),\n )) as Logger.LogFn;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAACH,OAAO,CAACK,SAAS,CAAC,CAAC;IACpD;IAEA,IAAI,OAAON,QAAQ,KAAK,QAAQ,IAAI,YAAY,IAAIA,QAAQ,EAAE;MAC5DK,IAAI,CAACE,IAAI,CAAC7B,KAAK,CAAC8B,OAAO,CAAC,IAAIR,QAAQ,CAACS,UAAU,IAAI,CAAC,CAAC;IACvD;;IAEA;IACA,OAAOjC,EAAE,CAACkC,EAAE,CAAeC,OAAO,CAACP,IAAI,KAAK,OAAO,GAAG,OAAO,GAAGA,IAAI,CAAC,CAACQ,IAAI,CACxED,OAAO,EACPN,IAAI,CAACQ,IAAI,CAAC,GAAG,CACf,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SimpleOsdkProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleOsdkProperties.js","names":[],"sources":["SimpleOsdkProperties.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\n/**\n * Represents a \"pure\" object from the wire that has its special properties with\n * $ prefix and is ready to be converted to an Osdk object.\n *\n * This object intentionally does not have any generics attached to keep it simple\n * to use.\n *\n * @internal\n */\nexport interface SimpleOsdkProperties {\n $apiName: string;\n $objectType: string;\n $primaryKey: string | number | boolean;\n $title: string | undefined;\n\n [key: string]:\n | string\n | Array<string>\n | number\n | Array<number>\n | boolean\n | Array<boolean>\n | undefined;\n}\n"],"mappings":"","ignoreList":[]}
@@ -14,15 +14,28 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { $ontologyRid, objectTypeWithAllPropertyTypes } from "@osdk/client.test.ontology";
18
- import { apiServer, stubData } from "@osdk/shared.test";
17
+ import { objectTypeWithAllPropertyTypes } from "@osdk/client.test.ontology";
18
+ import { LegacyFauxFoundry, startNodeApiServer, stubData } from "@osdk/shared.test";
19
19
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
20
20
  import { createClient } from "../createClient.js";
21
21
  describe("attachments", () => {
22
+ let fauxFoundry;
23
+ let apiServer;
22
24
  let client;
23
25
  beforeAll(async () => {
24
- apiServer.listen();
25
- client = createClient("https://stack.palantir.com", $ontologyRid, async () => "myAccessToken");
26
+ ({
27
+ client,
28
+ apiServer,
29
+ fauxFoundry
30
+ } = startNodeApiServer(new LegacyFauxFoundry(), createClient));
31
+ fauxFoundry.attachments.registerAttachment({
32
+ filename: "file1.txt",
33
+ mediaType: "application/json",
34
+ rid: "ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75",
35
+ buffer: new TextEncoder().encode(JSON.stringify({
36
+ name: "Hello World"
37
+ }, null, 2))
38
+ });
26
39
  });
27
40
  afterAll(() => {
28
41
  apiServer.close();
@@ -37,8 +50,8 @@ describe("attachments", () => {
37
50
  expect(attachmentMetadata).toBeDefined();
38
51
  expect(attachmentMetadata?.filename).toEqual("file1.txt");
39
52
  expect(attachmentMetadata?.mediaType).toEqual("application/json");
40
- expect(attachmentMetadata?.sizeBytes).toEqual(18);
41
- expect(attachmentMetadata?.rid).toEqual("ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75");
53
+ expect(attachmentMetadata?.sizeBytes).toEqual(27);
54
+ expect(attachmentMetadata?.rid).toEqual(stubData.objectWithAllPropertyTypes1.attachment.rid);
42
55
  });
43
56
  it("reads attachment successfully", async () => {
44
57
  const result = await client(objectTypeWithAllPropertyTypes).where({
@@ -49,7 +62,7 @@ describe("attachments", () => {
49
62
  const attachmentContent = await object1?.attachment?.fetchContents();
50
63
  const attachmentText = await attachmentContent.text();
51
64
  expect(JSON.parse(attachmentText)).toEqual({
52
- name: "Hello World 2"
65
+ name: "Hello World"
53
66
  });
54
67
  });
55
68
  });
@@ -1 +1 @@
1
- {"version":3,"file":"attachment.test.js","names":["$ontologyRid","objectTypeWithAllPropertyTypes","apiServer","stubData","afterAll","beforeAll","describe","expect","it","createClient","client","listen","close","result","where","id","objectWithAllPropertyTypes1","fetchPage","object1","data","attachment","toBeDefined","attachmentMetadata","fetchMetadata","filename","toEqual","mediaType","sizeBytes","rid","attachmentContent","fetchContents","attachmentText","text","JSON","parse","name"],"sources":["attachment.test.ts"],"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 */\n\nimport {\n $ontologyRid,\n objectTypeWithAllPropertyTypes,\n} from \"@osdk/client.test.ontology\";\nimport { apiServer, stubData } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, it } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\n\ndescribe(\"attachments\", () => {\n let client: Client;\n\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\n \"https://stack.palantir.com\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n });\n\n afterAll(() => {\n apiServer.close();\n });\n\n it(\"reads attachment metadata successfully\", async () => {\n const result = await client(\n objectTypeWithAllPropertyTypes,\n )\n .where({ id: stubData.objectWithAllPropertyTypes1.id }).fetchPage();\n\n const object1 = result.data[0];\n expect(object1.attachment).toBeDefined();\n const attachmentMetadata = await object1.attachment?.fetchMetadata();\n expect(attachmentMetadata).toBeDefined();\n expect(attachmentMetadata?.filename).toEqual(\"file1.txt\");\n expect(attachmentMetadata?.mediaType).toEqual(\"application/json\");\n expect(attachmentMetadata?.sizeBytes).toEqual(18);\n expect(attachmentMetadata?.rid).toEqual(\n \"ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75\",\n );\n });\n\n it(\"reads attachment successfully\", async () => {\n const result = await client(objectTypeWithAllPropertyTypes)\n .where({ id: stubData.objectWithAllPropertyTypes1.id }).fetchPage();\n\n const object1 = result.data[0];\n expect(object1.attachment).toBeDefined();\n const attachmentContent = await object1?.attachment?.fetchContents();\n const attachmentText = await attachmentContent!.text();\n expect(JSON.parse(attachmentText)).toEqual({\n name: \"Hello World 2\",\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,YAAY,EACZC,8BAA8B,QACzB,4BAA4B;AACnC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,mBAAmB;AACvD,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAElE,SAASC,YAAY,QAAQ,oBAAoB;AAEjDH,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC5B,IAAII,MAAc;EAElBL,SAAS,CAAC,YAAY;IACpBH,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CACnB,4BAA4B,EAC5BT,YAAY,EACZ,YAAY,eACd,CAAC;EACH,CAAC,CAAC;EAEFI,QAAQ,CAAC,MAAM;IACbF,SAAS,CAACU,KAAK,CAAC,CAAC;EACnB,CAAC,CAAC;EAEFJ,EAAE,CAAC,wCAAwC,EAAE,YAAY;IACvD,MAAMK,MAAM,GAAG,MAAMH,MAAM,CACzBT,8BACF,CAAC,CACEa,KAAK,CAAC;MAAEC,EAAE,EAAEZ,QAAQ,CAACa,2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ACzCU,IAAI,EAAE;IACR,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"attachment.test.js","names":["objectTypeWithAllPropertyTypes","LegacyFauxFoundry","startNodeApiServer","stubData","afterAll","beforeAll","describe","expect","it","createClient","fauxFoundry","apiServer","client","attachments","registerAttachment","filename","mediaType","rid","buffer","TextEncoder","encode","JSON","stringify","name","close","result","where","id","objectWithAllPropertyTypes1","fetchPage","object1","data","attachment","toBeDefined","attachmentMetadata","fetchMetadata","toEqual","sizeBytes","attachmentContent","fetchContents","attachmentText","text","parse"],"sources":["attachment.test.ts"],"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 */\n\nimport { objectTypeWithAllPropertyTypes } from \"@osdk/client.test.ontology\";\nimport {\n LegacyFauxFoundry,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport { type SetupServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, it } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\n\ndescribe(\"attachments\", () => {\n let fauxFoundry: LegacyFauxFoundry;\n let apiServer: SetupServer;\n let client: Client;\n\n beforeAll(async () => {\n ({ client, apiServer, fauxFoundry } = startNodeApiServer(\n new LegacyFauxFoundry(),\n createClient,\n ));\n\n fauxFoundry.attachments.registerAttachment({\n filename: \"file1.txt\",\n mediaType: \"application/json\",\n rid:\n \"ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75\",\n buffer: new TextEncoder().encode(\n JSON.stringify({ name: \"Hello World\" }, null, 2),\n ),\n });\n });\n\n afterAll(() => {\n apiServer.close();\n });\n\n it(\"reads attachment metadata successfully\", async () => {\n const result = await client(\n objectTypeWithAllPropertyTypes,\n )\n .where({ id: stubData.objectWithAllPropertyTypes1.id }).fetchPage();\n\n const object1 = result.data[0];\n expect(object1.attachment).toBeDefined();\n const attachmentMetadata = await object1.attachment?.fetchMetadata();\n expect(attachmentMetadata).toBeDefined();\n expect(attachmentMetadata?.filename).toEqual(\"file1.txt\");\n expect(attachmentMetadata?.mediaType).toEqual(\"application/json\");\n expect(attachmentMetadata?.sizeBytes).toEqual(27);\n expect(attachmentMetadata?.rid).toEqual(\n stubData.objectWithAllPropertyTypes1.attachment.rid,\n );\n });\n\n it(\"reads attachment successfully\", async () => {\n const result = await client(objectTypeWithAllPropertyTypes)\n .where({ id: stubData.objectWithAllPropertyTypes1.id }).fetchPage();\n\n const object1 = result.data[0];\n expect(object1.attachment).toBeDefined();\n const attachmentContent = await object1?.attachment?.fetchContents();\n const attachmentText = await attachmentContent!.text();\n expect(JSON.parse(attachmentText)).toEqual({\n name: \"Hello World\",\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,8BAA8B,QAAQ,4BAA4B;AAC3E,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAE1B,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAElE,SAASC,YAAY,QAAQ,oBAAoB;AAEjDH,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC5B,IAAII,WAA8B;EAClC,IAAIC,SAAsB;EAC1B,IAAIC,MAAc;EAElBP,SAAS,CAAC,YAAY;IACpB,CAAC;MAAEO,MAAM;MAAED,SAAS;MAAED;IAAY,CAAC,GAAGR,kBAAkB,CACt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ACmB,OAAO,CACrCjC,QAAQ,CAACyB,2BAA2B,CAACI,UAAU,CAACf,GAClD,CAAC;EACH,CAAC,CAAC;EAEFT,EAAE,CAAC,+BAA+B,EAAE,YAAY;IAC9C,MAAMiB,MAAM,GAAG,MAAMb,MAAM,CAACZ,8BAA8B,CAAC,CACxD0B,KAAK,CAAC;MAAEC,EAAE,EAAExB,QAAQ,CAACyB,2BAA2B,CAACD;IAAG,CAAC,CAAC,CAACE,SAAS,CAAC,CAAC;IAErE,MAAMC,OAAO,GAAGL,MAAM,CAACM,IAAI,CAAC,CAAC,CAAC;IAC9BxB,MAAM,CAACuB,OAAO,CAACE,UAAU,CAAC,CAACC,WAAW,CAAC,CAAC;IACxC,MAAMK,iBAAiB,GAAG,MAAMR,OAAO,EAAEE,UAAU,EAAEO,aAAa,CAAC,CAAC;IACpE,MAAMC,cAAc,GAAG,MAAMF,iBAAiB,CAAEG,IAAI,CAAC,CAAC;IACtDlC,MAAM,CAACc,IAAI,CAACqB,KAAK,CAACF,cAAc,CAAC,CAAC,CAACJ,OAAO,CAAC;MACzCb,IAAI,EAAE;IACR,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=BaseHolder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseHolder.js","names":[],"sources":["BaseHolder.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ObjectOrInterfaceDefinition, ObjectSpecifier } from \"@osdk/api\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport type { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\n\nexport interface BaseHolder {\n readonly [UnderlyingOsdkObject]: ObjectHolder;\n\n readonly $apiName: string;\n readonly $objectType: string;\n readonly $primaryKey: string | number;\n readonly $title: string | undefined;\n readonly $objectSpecifier: ObjectSpecifier<any>;\n\n readonly \"$as\": (\n newDef: string | ObjectOrInterfaceDefinition,\n ) => ObjectHolder | InterfaceHolder;\n\n readonly \"$clone\": (\n newProps?: Record<string, any>,\n ) => this;\n\n // [key: `$$${string}`]: any;\n // Unlike SimpleOsdkProperties, all of our remaining types are unknown as the full\n // union is basically `any` when you consider the above fields.\n [key: string]: unknown;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"InterfaceHolder.js","names":[],"sources":["InterfaceHolder.ts"],"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 */\n\nimport type { InterfaceMetadata, Osdk } from \"@osdk/api\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type {\n InterfaceDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport interface InterfaceHolder<\n Q extends FetchedObjectTypeDefinition,\n> {\n [UnderlyingOsdkObject]: Osdk<Q> & ObjectHolder<Q>;\n [InterfaceDefRef]: InterfaceMetadata;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"InterfaceHolder.js","names":[],"sources":["InterfaceHolder.ts"],"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 */\n\nimport type { InterfaceMetadata, Osdk } from \"@osdk/api\";\nimport type { BaseHolder } from \"./BaseHolder.js\";\nimport type { InterfaceDefRef } from \"./InternalSymbols.js\";\n\n/** @internal */\nexport interface InterfaceHolder<\n _Q extends Osdk.Instance<any> = never,\n> extends BaseHolder {\n [InterfaceDefRef]: InterfaceMetadata;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectHolder.js","names":[],"sources":["ObjectHolder.ts"],"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 */\n\nimport type { Osdk } from \"@osdk/api\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { DollarAsFn } from \"./getDollarAs.js\";\nimport type { get$link } from \"./getDollarLink.js\";\nimport type {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\n\n/** @internal */\nexport interface ObjectHolder<Q extends FetchedObjectTypeDefinition> {\n readonly [UnderlyingOsdkObject]: Osdk<Q>;\n readonly [ObjectDefRef]: FetchedObjectTypeDefinition;\n readonly [ClientRef]: MinimalClient;\n readonly \"$as\": DollarAsFn;\n readonly \"$link\": ReturnType<typeof get$link>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ObjectHolder.js","names":[],"sources":["ObjectHolder.ts"],"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 */\n\nimport type { Osdk } from \"@osdk/api\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { BaseHolder } from \"./BaseHolder.js\";\nimport type { get$link } from \"./getDollarLink.js\";\nimport type { ClientRef, ObjectDefRef } from \"./InternalSymbols.js\";\n\n/**\n * @internal\n *\n * The unused generic parameter `_Q` can be used as an added check when casting.\n * That is its only purpose\n */\nexport interface ObjectHolder<_Q extends Osdk.Instance<any> = never>\n extends BaseHolder\n{\n readonly [ObjectDefRef]: FetchedObjectTypeDefinition;\n readonly [ClientRef]: MinimalClient;\n\n readonly \"$link\": ReturnType<typeof get$link>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -40,6 +40,10 @@ export function createOsdkInterface(underlying, interfaceDef) {
40
40
  value: underlying.$primaryKey,
41
41
  enumerable: "$primaryKey" in underlying
42
42
  },
43
+ "$objectSpecifier": {
44
+ value: underlying.$objectSpecifier,
45
+ enumerable: "$objectSpecifier" in underlying
46
+ },
43
47
  "$title": {
44
48
  value: underlying.$title,
45
49
  enumerable: "$title" in underlying
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$title","$rid","clone","fromEntries","keys","properties","map","p","objDef","apiNamespace","targetPropName","interfaceMap","update","$clone","key","Error","remappedProps","mapProperty","filter","x","propertyName"],"sources":["createOsdkInterface.ts"],"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 */\n\nimport type { InterfaceMetadata, Osdk } from \"@osdk/api\";\nimport { extractNamespace } from \"../../internal/conversions/modernToLegacyWhereClause.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport {\n InterfaceDefRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function createOsdkInterface<\n Q extends FetchedObjectTypeDefinition,\n>(\n underlying: Osdk<Q> & ObjectHolder<Q>,\n interfaceDef: InterfaceMetadata,\n) {\n const [objApiNamespace] = extractNamespace(interfaceDef.apiName);\n\n return Object.freeze(\n Object.defineProperties({}, {\n // first to minimize hidden classes\n [UnderlyingOsdkObject]: { value: underlying },\n\n \"$apiName\": { value: interfaceDef.apiName, enumerable: true },\n \"$as\": {\n value: underlying.$as,\n enumerable: false,\n },\n \"$objectType\": {\n value: underlying.$objectType,\n enumerable: \"$objectType\" in underlying,\n },\n \"$primaryKey\": {\n value: underlying.$primaryKey,\n enumerable: \"$primaryKey\" in underlying,\n },\n \"$title\": {\n value: underlying.$title,\n enumerable: \"$title\" in underlying,\n },\n \"$rid\": {\n value: (underlying as any).$rid,\n enumerable: \"$rid\" in underlying,\n },\n \"$clone\": {\n value: clone,\n enumerable: false,\n },\n\n [InterfaceDefRef]: { value: interfaceDef },\n\n ...Object.fromEntries(\n Object.keys(interfaceDef.properties).map(p => {\n const objDef = underlying[ObjectDefRef];\n\n const [apiNamespace, apiName] = extractNamespace(p);\n\n const targetPropName = objDef\n .interfaceMap![interfaceDef.apiName][p];\n\n return [apiNamespace === objApiNamespace ? apiName : p, {\n enumerable: targetPropName in underlying,\n value: underlying[targetPropName as keyof typeof underlying],\n }];\n }),\n ),\n }) as InterfaceHolder<any> & Osdk<any>,\n );\n function clone(update: Record<string, any> | undefined) {\n if (update == null) {\n return underlying.$clone().$as(interfaceDef);\n }\n\n for (const key of Object.keys(update)) {\n if (!(key in interfaceDef.properties)) {\n throw new Error(\n `Invalid property ${key} for interface ${interfaceDef.apiName}`,\n );\n }\n }\n\n const remappedProps = Object.fromEntries(\n Object.keys(update).map(p => mapProperty(p, update[p])).filter(x =>\n x != null\n ),\n );\n\n return underlying.$clone(remappedProps).$as(interfaceDef);\n }\n function mapProperty(propertyName: string, value: any) {\n const objDef = underlying[ObjectDefRef];\n const targetPropName =\n objDef.interfaceMap![interfaceDef.apiName][propertyName];\n // If the underlying object does not implement the SPT, throw errors\n if (targetPropName == null) {\n throw new Error(\n `Cannot clone interface with ${propertyName} as property is not implemented by the underlying object type ${objDef.apiName}`,\n );\n }\n return [targetPropName, value];\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;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,GAAGpB,UAAU,CAACH,YAAY,CAAC;IACvC,MAAMyB,cAAc,GAClBF,MAAM,CAACG,YAAY,CAAEtB,YAAY,CAACE,OAAO,CAAC,CAAC6B,YAAY,CAAC;IAC1D;IACA,IAAIV,cAAc,IAAI,IAAI,EAAE;MAC1B,MAAM,IAAIK,KAAK,CACb,+BAA+BK,YAAY,iEAAiEZ,MAAM,CAACjB,OAAO,EAC5H,CAAC;IACH;IACA,OAAO,CAACmB,cAAc,EAAEf,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$objectSpecifier","$title","$rid","clone","fromEntries","keys","properties","map","p","objDef","apiNamespace","targetPropName","interfaceMap","update","$clone","key","Error","remappedProps","mapProperty","filter","x","propertyName"],"sources":["createOsdkInterface.ts"],"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 */\n\nimport type { InterfaceMetadata } from \"@osdk/api\";\nimport { extractNamespace } from \"../../internal/conversions/modernToLegacyWhereClause.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport {\n InterfaceDefRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function createOsdkInterface<\n Q extends FetchedObjectTypeDefinition,\n>(\n underlying: ObjectHolder,\n interfaceDef: InterfaceMetadata,\n): InterfaceHolder {\n const [objApiNamespace] = extractNamespace(interfaceDef.apiName);\n\n return Object.freeze(\n Object.defineProperties({}, {\n // first to minimize hidden classes\n [UnderlyingOsdkObject]: { value: underlying },\n\n \"$apiName\": { value: interfaceDef.apiName, enumerable: true },\n \"$as\": {\n value: underlying.$as,\n enumerable: false,\n },\n \"$objectType\": {\n value: underlying.$objectType,\n enumerable: \"$objectType\" in underlying,\n },\n \"$primaryKey\": {\n value: underlying.$primaryKey,\n enumerable: \"$primaryKey\" in underlying,\n },\n \"$objectSpecifier\": {\n value: underlying.$objectSpecifier,\n enumerable: \"$objectSpecifier\" in underlying,\n },\n \"$title\": {\n value: underlying.$title,\n enumerable: \"$title\" in underlying,\n },\n \"$rid\": {\n value: (underlying as any).$rid,\n enumerable: \"$rid\" in underlying,\n },\n \"$clone\": {\n value: clone,\n enumerable: false,\n },\n\n [InterfaceDefRef]: { value: interfaceDef },\n\n ...Object.fromEntries(\n Object.keys(interfaceDef.properties).map(p => {\n const objDef = underlying[ObjectDefRef];\n\n const [apiNamespace, apiName] = extractNamespace(p);\n\n const targetPropName = objDef\n .interfaceMap![interfaceDef.apiName][p];\n\n return [apiNamespace === objApiNamespace ? apiName : p, {\n enumerable: targetPropName in underlying,\n value: underlying[targetPropName as keyof typeof underlying],\n }];\n }),\n ),\n }) as InterfaceHolder,\n );\n function clone(update: Record<string, any> | undefined) {\n if (update == null) {\n return underlying.$clone().$as(interfaceDef);\n }\n\n for (const key of Object.keys(update)) {\n if (!(key in interfaceDef.properties)) {\n throw new Error(\n `Invalid property ${key} for interface ${interfaceDef.apiName}`,\n );\n }\n }\n\n const remappedProps = Object.fromEntries(\n Object.keys(update).map(p => mapProperty(p, update[p])).filter(x =>\n x != null\n ),\n );\n\n return underlying.$clone(remappedProps).$as(interfaceDef);\n }\n function mapProperty(propertyName: string, value: any) {\n const objDef = underlying[ObjectDefRef];\n const targetPropName =\n objDef.interfaceMap![interfaceDef.apiName][propertyName];\n // If the underlying object does not implement the SPT, throw errors\n if (targetPropName == null) {\n throw new Error(\n `Cannot clone interface with ${propertyName} as property is not implemented by the underlying object type ${objDef.apiName}`,\n );\n }\n return [targetPropName, value];\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,yDAAyD;AAG1F,SACEC,eAAe,EACfC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,mBAAmBA,CAGjCC,UAAwB,EACxBC,YAA+B,EACd;EACjB,MAAM,CAACC,eAAe,CAAC,GAAGP,gBAAgB,CAACM,YAAY,CAACE,OAAO,CAAC;EAEhE,OAAOC,MAAM,CAACC,MAAM,CAClBD,MAAM,CAACE,gBAAgB,CAAC,CAAC,CAAC,EAAE;IAC1B;IACA,CAACR,oBAAoB,GAAG;MAAES,KAAK,EAAEP;IAAW,CAAC;IAE7C,UAAU,EAAE;MAAEO,KAAK,EAAEN,YAAY,CAACE,OAAO;MAAEK,UAAU,EAAE;IAAK,CAAC;IAC7D,KAAK,EAAE;MACLD,KAAK,EAAEP,UAAU,CAACS,GAAG;MACrBD,UAAU,EAAE;IACd,CAAC;IACD,aAAa,EAAE;MACbD,KAAK,EAAEP,UAAU,CAACU,WAAW;MAC7BF,UAAU,EAAE,aAAa,IAAIR;IAC/B,CAAC;IACD,aAAa,EAAE;MACbO,KAAK,EAAEP,UAAU,CAACW,WAAW;MAC7BH,UAAU,EAAE,aAAa,IAAIR;IAC/B,CAAC;IACD,kBAAkB,EAAE;MAClBO,KAAK,EAAEP,UAAU,CAACY,gBAAgB;MAClCJ,UAAU,EAAE,kBAAkB,IAAIR;IACpC,CAAC;IACD,QAAQ,EAAE;MACRO,KAAK,EAAEP,UAAU,CAACa,MAAM;MACxBL,UAAU,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IAEA,MAAM0B,aAAa,GAAGzB,MAAM,CAACY,WAAW,CACtCZ,MAAM,CAACa,IAAI,CAACQ,MAAM,CAAC,CAACN,GAAG,CAACC,CAAC,IAAIU,WAAW,CAACV,CAAC,EAAEK,MAAM,CAACL,CAAC,CAAC,CAAC,CAAC,CAACW,MAAM,CAACC,CAAC,IAC9DA,CAAC,IAAI,IACP,CACF,CAAC;IAED,OAAOhC,UAAU,CAAC0B,MAAM,CAACG,aAAa,CAAC,CAACpB,GAAG,CAACR,YAAY,CAAC;EAC3D;EACA,SAAS6B,WAAWA,CAACG,YAAoB,EAAE1B,KAAU,EAAE;IACrD,MAAMc,MAAM,GAAGrB,UAAU,CAACH,YAAY,CAAC;IACvC,MAAM0B,cAAc,GAClBF,MAAM,CAACG,YAAY,CAAEvB,YAAY,CAACE,OAAO,CAAC,CAAC8B,YAAY,CAAC;IAC1D;IACA,IAAIV,cAAc,IAAI,IAAI,EAAE;MAC1B,MAAM,IAAIK,KAAK,CACb,+BAA+BK,YAAY,iEAAiEZ,MAAM,CAAClB,OAAO,EAC5H,CAAC;IACH;IACA,OAAO,CAACoB,cAAc,EAAEhB,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
@@ -19,6 +19,7 @@ import { GeotimeSeriesPropertyImpl } from "../../createGeotimeSeriesProperty.js"
19
19
  import { MediaReferencePropertyImpl } from "../../createMediaReferenceProperty.js";
20
20
  import { TimeSeriesPropertyImpl } from "../../createTimeseriesProperty.js";
21
21
  import { hydrateAttachmentFromRidInternal } from "../../public-utils/hydrateAttachmentFromRid.js";
22
+ import { createObjectSpecifierFromPrimaryKey } from "../../util/objectSpecifierUtils.js";
22
23
  import { get$as } from "./getDollarAs.js";
23
24
  import { get$link } from "./getDollarLink.js";
24
25
  import { ClientRef, ObjectDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
@@ -39,6 +40,7 @@ const basePropDefs = {
39
40
  },
40
41
  "$clone": {
41
42
  value: function (update) {
43
+ // I think `rawObj` is the same thing as `this` and can be removed?
42
44
  const rawObj = this[UnderlyingOsdkObject];
43
45
  const def = this[ObjectDefRef];
44
46
  if (update == null) {
@@ -58,16 +60,29 @@ const basePropDefs = {
58
60
  };
59
61
  return createOsdkObject(this[ClientRef], this[ObjectDefRef], newObject);
60
62
  }
63
+ },
64
+ "$objectSpecifier": {
65
+ get: function () {
66
+ const rawObj = this[UnderlyingOsdkObject];
67
+ return createObjectSpecifierFromPrimaryKey(this[ObjectDefRef], rawObj.$primaryKey);
68
+ },
69
+ enumerable: true
61
70
  }
62
71
  };
63
72
 
64
- /** @internal */
65
- export function createOsdkObject(client, objectDef, rawObj) {
73
+ /**
74
+ * @internal
75
+ * @param client
76
+ * @param objectDef
77
+ * @param simpleOsdkProperties
78
+ */
79
+ export function createOsdkObject(client, objectDef, simpleOsdkProperties, derivedPropertyTypeByName = {}) {
66
80
  // updates the object's "hidden class/map".
81
+ const rawObj = simpleOsdkProperties;
67
82
  Object.defineProperties(rawObj, {
68
83
  [UnderlyingOsdkObject]: {
69
84
  enumerable: false,
70
- value: rawObj
85
+ value: simpleOsdkProperties
71
86
  },
72
87
  [ObjectDefRef]: {
73
88
  value: objectDef,
@@ -84,6 +99,17 @@ export function createOsdkObject(client, objectDef, rawObj) {
84
99
  for (const propKey of Object.keys(rawObj)) {
85
100
  if (propKey in objectDef.properties && typeof objectDef.properties[propKey].type === "string" && specialPropertyTypes.has(objectDef.properties[propKey].type)) {
86
101
  rawObj[propKey] = createSpecialProperty(client, objectDef, rawObj, propKey);
102
+ } else if (propKey in derivedPropertyTypeByName && typeof derivedPropertyTypeByName[propKey].type === "string" && specialPropertyTypes.has(derivedPropertyTypeByName[propKey].type)) {
103
+ const rawValue = rawObj[propKey];
104
+ if (derivedPropertyTypeByName[propKey].type === "attachment") {
105
+ if (Array.isArray(rawValue)) {
106
+ rawObj[propKey] = rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));
107
+ } else {
108
+ rawObj[propKey] = hydrateAttachmentFromRidInternal(client, rawValue.rid);
109
+ }
110
+ } else {
111
+ process.env.NODE_ENV !== "production" ? invariant(false, "Derived property aggregations for Timeseries and Media are not supported") : invariant(false);
112
+ }
87
113
  }
88
114
  }
89
115
  return Object.freeze(rawObj);
@@ -94,39 +120,31 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
94
120
  if (process.env.NODE_ENV !== "production") {
95
121
  !(propDef != null && typeof propDef.type === "string" && specialPropertyTypes.has(propDef.type)) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
96
122
  }
97
- {
98
- {
99
- {
100
- {
101
- if (propDef.type === "attachment") {
102
- if (Array.isArray(rawValue)) {
103
- return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));
104
- }
105
- return hydrateAttachmentFromRidInternal(client, rawValue.rid);
106
- }
107
- if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries" || propDef.type === "sensorTimeseries") {
108
- return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);
109
- }
110
- if (propDef.type === "geotimeSeriesReference") {
111
- return new GeotimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p, rawValue.type === "geotimeSeriesValue" ? {
112
- time: rawValue.timestamp,
113
- value: {
114
- type: "Point",
115
- coordinates: rawValue.position
116
- }
117
- } : undefined);
118
- }
119
- if (propDef.type === "mediaReference") {
120
- return new MediaReferencePropertyImpl({
121
- client,
122
- objectApiName: objectDef.apiName,
123
- primaryKey: rawObject[objectDef.primaryKeyApiName],
124
- propertyName: p
125
- });
126
- }
127
- }
128
- }
123
+ if (propDef.type === "attachment") {
124
+ if (Array.isArray(rawValue)) {
125
+ return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));
129
126
  }
127
+ return hydrateAttachmentFromRidInternal(client, rawValue.rid);
128
+ }
129
+ if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries" || propDef.type === "sensorTimeseries") {
130
+ return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);
131
+ }
132
+ if (propDef.type === "geotimeSeriesReference") {
133
+ return new GeotimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p, rawValue.type === "geotimeSeriesValue" ? {
134
+ time: rawValue.timestamp,
135
+ value: {
136
+ type: "Point",
137
+ coordinates: rawValue.position
138
+ }
139
+ } : undefined);
140
+ }
141
+ if (propDef.type === "mediaReference") {
142
+ return new MediaReferencePropertyImpl({
143
+ client,
144
+ objectApiName: objectDef.apiName,
145
+ primaryKey: rawObject[objectDef.primaryKeyApiName],
146
+ propertyName: p
147
+ });
130
148
  }
131
149
  }
132
150
  //# sourceMappingURL=createOsdkObject.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","client","objectDef","Object","defineProperties","enumerable","propKey","keys","properties","type","has","createSpecialProperty","freeze","rawObject","p","rawValue","propDef","process","env","NODE_ENV","Array","isArray","map","a","rid","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName"],"sources":["createOsdkObject.ts"],"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 */\n\nimport type { ObjectTypeDefinition, Osdk } from \"@osdk/api\";\nimport type { OntologyObjectV2 } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { MediaReferencePropertyImpl } from \"../../createMediaReferenceProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\ninterface InternalOsdkInstance {\n [ObjectDefRef]: FetchedObjectTypeDefinition;\n [ClientRef]: MinimalClient;\n}\n\nconst specialPropertyTypes = new Set(\n [\n \"attachment\",\n \"geotimeSeriesReference\",\n \"mediaReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n ],\n);\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(this: InternalOsdkInstance) {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function(this: InternalOsdkInstance & ObjectHolder<any>) {\n return get$link(this);\n },\n },\n \"$clone\": {\n value: function(\n this: InternalOsdkInstance & ObjectHolder<any>,\n update: Record<string, any> | undefined,\n ) {\n const rawObj = this[UnderlyingOsdkObject];\n const def = this[ObjectDefRef];\n\n if (update == null) {\n return createOsdkObject(this[ClientRef], def, { ...rawObj });\n }\n\n if (\n def.primaryKeyApiName in update\n && rawObj[def.primaryKeyApiName] !== update[def.primaryKeyApiName]\n ) {\n throw new Error(\n `Cannot update ${def.apiName} object with differing primary key values `,\n );\n }\n\n if (def.titleProperty in update && !(\"$title\" in update)) {\n update.$title = update[def.titleProperty];\n }\n\n const newObject = { ...this[UnderlyingOsdkObject], ...update };\n return createOsdkObject(this[ClientRef], this[ObjectDefRef], newObject);\n },\n },\n};\n\n/** @internal */\nexport function createOsdkObject<\n Q extends FetchedObjectTypeDefinition,\n>(\n client: MinimalClient,\n objectDef: Q,\n rawObj: OntologyObjectV2,\n): Osdk<ObjectTypeDefinition, any> {\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\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (\n propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)\n ) {\n rawObj[propKey] = createSpecialProperty(\n client,\n objectDef,\n rawObj as any,\n propKey,\n );\n }\n }\n\n return Object.freeze(rawObj) as Osdk<ObjectTypeDefinition, any>;\n}\n\nfunction createSpecialProperty(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n rawObject: Osdk.Instance<any>,\n p: keyof typeof rawObject & string | symbol,\n) {\n const rawValue = rawObject[p as any];\n const propDef = objectDef.properties[p as any];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(\n propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type),\n );\n }\n {\n {\n {\n {\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n }\n return hydrateAttachmentFromRidInternal(client, rawValue.rid);\n }\n\n if (\n propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\"\n ) {\n return new TimeSeriesPropertyImpl<\n (typeof propDef)[\"type\"] extends \"numericTimeseries\" ? number\n : (typeof propDef)[\"type\"] extends \"stringTimeseries\" ? string\n : number | string\n >(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n );\n }\n\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl<GeoJSON.Point>(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n rawValue.type === \"geotimeSeriesValue\"\n ? {\n time: rawValue.timestamp,\n value: {\n type: \"Point\",\n coordinates: rawValue.position,\n },\n }\n : undefined,\n );\n }\n if (propDef.type === \"mediaReference\") {\n return new MediaReferencePropertyImpl({\n client,\n objectApiName: objectDef.apiName,\n primaryKey: rawObject[objectDef.primaryKeyApiName as string],\n propertyName: p as string,\n });\n }\n }\n }\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,0BAA0B,QAAQ,uCAAuC;AAClF,SAASC,sBAAsB,QAAQ,mCAAmC;AAG1E,SAASC,gCAAgC,QAAQ,gDAAgD;AACjG,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAQ7B,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAClC,CACE,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CAEtB,CAAC;;AAED;AACA;AACA,MAAMC,YAAY,GAAG;EACnB,KAAK,EAAE;IACLC,GAAG,EAAE,SAAAA,CAAA,EAAqC;MACxC,OAAOR,MAAM,CAAC,IAAI,CAACG,YAAY,CAAC,CAAC;IACnC;EACF,CAAC;EACD,OAAO,EAAE;IACPK,GAAG,EAAE,SAAAA,CA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AE;cAC3B,OAAOA,QAAQ,CAACO,GAAG,CAACC,CAAC,IACnB3C,gCAAgC,CAACqB,MAAM,EAAEsB,CAAC,CAACC,GAAG,CAChD,CAAC;YACH;YACA,OAAO5C,gCAAgC,CAACqB,MAAM,EAAEc,QAAQ,CAACS,GAAG,CAAC;UAC/D;UAEA,IACER,OAAO,CAACP,IAAI,KAAK,mBAAmB,IACjCO,OAAO,CAACP,IAAI,KAAK,kBAAkB,IACnCO,OAAO,CAACP,IAAI,KAAK,kBAAkB,EACtC;YACA,OAAO,IAAI9B,sBAAsB,CAK/BsB,MAAM,EACNC,SAAS,CAACL,OAAO,EACjBgB,SAAS,CAACX,SAAS,CAACP,iBAAiB,CAAW,EAChDmB,CACF,CAAC;UACH;UAEA,IAAIE,OAAO,CAACP,IAAI,KAAK,wBAAwB,EAAE;YAC7C,OAAO,IAAIhC,yBAAyB,CAClCwB,MAAM,EACNC,SAAS,CAACL,OAAO,EACjBgB,SAAS,CAACX,SAAS,CAACP,iBAAiB,CAAW,EAChDmB,CAAC,EACDC,QAAQ,CAACN,IAAI,KAAK,oBAAoB,GAClC;cACAgB,IAAI,EAAEV,QAAQ,CAACW,SAAS;cACxBpC,KAAK,EAAE;gBACLmB,IAAI,EAAE,OAAO;gBACbkB,WAAW,EAAEZ,QAAQ,CAACa;cACxB;YACF,CAAC,GACCC,SACN,CAAC;UACH;UACA,IAAIb,OAAO,CAACP,IAAI,KAAK,gBAAgB,EAAE;YACrC,OAAO,IAAI/B,0BAA0B,CAAC;cACpCuB,MAAM;cACN6B,aAAa,EAAE5B,SAAS,CAACL,OAAO;cAChCkC,UAAU,EAAElB,SAAS,CAACX,SAAS,CAACP,iBAAiB,CAAW;cAC5DqC,YAAY,EAAElB;YAChB,CAAC,CAAC;UACJ;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","createObjectSpecifierFromPrimaryKey","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","$primaryKey","enumerable","client","objectDef","simpleOsdkProperties","derivedPropertyTypeByName","Object","defineProperties","propKey","keys","properties","type","has","createSpecialProperty","rawValue","Array","isArray","map","a","rid","process","env","NODE_ENV","freeze","rawObject","p","propDef","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName"],"sources":["createOsdkObject.ts"],"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 */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\nimport type { Attachment, ReferenceValue } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { MediaReferencePropertyImpl } from \"../../createMediaReferenceProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport { createObjectSpecifierFromPrimaryKey } from \"../../util/objectSpecifierUtils.js\";\nimport type { SimpleOsdkProperties } from \"../SimpleOsdkProperties.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\nconst specialPropertyTypes = new Set(\n [\n \"attachment\",\n \"geotimeSeriesReference\",\n \"mediaReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n ],\n);\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(this: ObjectHolder) {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function(this: ObjectHolder) {\n return get$link(this);\n },\n },\n \"$clone\": {\n value: function(\n this: ObjectHolder,\n update: Record<string, any> | undefined,\n ) {\n // I think `rawObj` is the same thing as `this` and can be removed?\n const rawObj = this[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const def = this[ObjectDefRef];\n\n if (update == null) {\n return createOsdkObject(this[ClientRef], def, { ...rawObj });\n }\n\n if (\n def.primaryKeyApiName in update\n && rawObj[def.primaryKeyApiName] !== update[def.primaryKeyApiName]\n ) {\n throw new Error(\n `Cannot update ${def.apiName} object with differing primary key values `,\n );\n }\n\n if (def.titleProperty in update && !(\"$title\" in update)) {\n update.$title = update[def.titleProperty];\n }\n\n const newObject = { ...this[UnderlyingOsdkObject], ...update };\n return createOsdkObject(this[ClientRef], this[ObjectDefRef], newObject);\n },\n },\n \"$objectSpecifier\": {\n get: function(this: ObjectHolder) {\n const rawObj = this[UnderlyingOsdkObject];\n return createObjectSpecifierFromPrimaryKey(\n this[ObjectDefRef],\n rawObj.$primaryKey,\n );\n },\n enumerable: true,\n },\n};\n\n/**\n * @internal\n * @param client\n * @param objectDef\n * @param simpleOsdkProperties\n */\nexport function createOsdkObject(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n simpleOsdkProperties: SimpleOsdkProperties,\n derivedPropertyTypeByName: Record<string, ObjectMetadata.Property> = {},\n): ObjectHolder {\n // updates the object's \"hidden class/map\".\n const rawObj = simpleOsdkProperties as ObjectHolder;\n Object.defineProperties(\n rawObj,\n {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: simpleOsdkProperties,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false },\n [ClientRef]: { value: client, enumerable: false },\n ...basePropDefs,\n } satisfies Record<keyof ObjectHolder, PropertyDescriptor>,\n );\n\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (\n propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)\n ) {\n rawObj[propKey] = createSpecialProperty(\n client,\n objectDef,\n rawObj,\n propKey,\n );\n } else if (\n propKey in derivedPropertyTypeByName\n && typeof (derivedPropertyTypeByName[propKey].type) === \"string\"\n && specialPropertyTypes.has(derivedPropertyTypeByName[propKey].type)\n ) {\n const rawValue = rawObj[propKey as any];\n if (derivedPropertyTypeByName[propKey].type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n rawObj[propKey] = rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n } else {\n rawObj[propKey] = hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n } else {\n invariant(\n false,\n \"Derived property aggregations for Timeseries and Media are not supported\",\n );\n }\n }\n }\n\n return Object.freeze(rawObj);\n}\n\nfunction createSpecialProperty(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n rawObject: ObjectHolder,\n p: keyof typeof rawObject & string | symbol,\n) {\n const rawValue = rawObject[p as any];\n const propDef = objectDef.properties[p as any];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(\n propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type),\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(\n client,\n (rawValue as Attachment).rid,\n );\n }\n\n if (\n propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\"\n ) {\n return new TimeSeriesPropertyImpl<\n (typeof propDef)[\"type\"] extends \"numericTimeseries\" ? number\n : (typeof propDef)[\"type\"] extends \"stringTimeseries\" ? string\n : number | string\n >(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n );\n }\n\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl<GeoJSON.Point>(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n (rawValue as ReferenceValue).type === \"geotimeSeriesValue\"\n ? {\n time: (rawValue as ReferenceValue).timestamp,\n value: {\n type: \"Point\",\n coordinates: (rawValue as ReferenceValue).position,\n },\n }\n : undefined,\n );\n }\n if (propDef.type === \"mediaReference\") {\n return new MediaReferencePropertyImpl({\n client,\n objectApiName: objectDef.apiName,\n primaryKey: rawObject[objectDef.primaryKeyApiName as string],\n propertyName: p as string,\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,0BAA0B,QAAQ,uCAAuC;AAClF,SAASC,sBAAsB,QAAQ,mCAAmC;AAG1E,SAASC,gCAAgC,QAAQ,gDAAgD;AACjG,SAASC,mCAAmC,QAAQ,oCAAoC;AAExF,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAClC,CACE,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CAEtB,CAAC;;AAED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KAAK,CAACC,OAAO,CAACF,QAAQ,CAAC,EAAE;MAC3B,OAAOA,QAAQ,CAACG,GAAG,CAACC,CAAC,IAAIxC,gCAAgC,CAACwB,MAAM,EAAEgB,CAAC,CAACC,GAAG,CAAC,CAAC;IAC3E;IACA,OAAOzC,gCAAgC,CACrCwB,MAAM,EACLY,QAAQ,CAAgBK,GAC3B,CAAC;EACH;EAEA,IACEO,OAAO,CAACf,IAAI,KAAK,mBAAmB,IACjCe,OAAO,CAACf,IAAI,KAAK,kBAAkB,IACnCe,OAAO,CAACf,IAAI,KAAK,kBAAkB,EACtC;IACA,OAAO,IAAIlC,sBAAsB,CAK/ByB,MAAM,EACNC,SAAS,CAACP,OAAO,EACjB4B,SAAS,CAACrB,SAAS,CAACT,iBAAiB,CAAW,EAChD+B,CACF,CAAC;EACH;EAEA,IAAIC,OAAO,CAACf,IAAI,KAAK,wBAAwB,EAAE;IAC7C,OAAO,IAAIpC,yBAAyB,CAClC2B,MAAM,EACNC,SAAS,CAACP,OAAO,EACjB4B,SAAS,CAACrB,SAAS,CAACT,iBAAiB,CAAW,EAChD+B,CAAC,EACAX,QAAQ,CAAoBH,IAAI,KAAK,oBAAoB,GACtD;MACAgB,IAAI,EAAGb,QAAQ,CAAoBc,SAAS;MAC5CvC,KAAK,EAAE;QACLsB,IAAI,EAAE,OAAO;QACbkB,WAAW,EAAGf,QAAQ,CAAoBgB;MAC5C;IACF,CAAC,GACCC,SACN,CAAC;EACH;EACA,IAAIL,OAAO,CAACf,IAAI,KAAK,gBAAgB,EAAE;IACrC,OAAO,IAAInC,0BAA0B,CAAC;MACpC0B,MAAM;MACN8B,aAAa,EAAE7B,SAAS,CAACP,OAAO;MAChCqC,UAAU,EAAET,SAAS,CAACrB,SAAS,CAACT,iBAAiB,CAAW;MAC5DwC,YAAY,EAAET;IAChB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -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","deref","osdkInterface","set","WeakRef"],"sources":["getDollarAs.ts"],"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 */\n\nimport type { ObjectOrInterfaceDefinition, Osdk, OsdkBase } from \"@osdk/api\";\nimport {\n type FetchedObjectTypeDefinition,\n InterfaceDefinitions,\n} from \"../../ontology/OntologyProvider.js\";\nimport { createSimpleCache } from \"../SimpleCache.js\";\nimport { createOsdkInterface } from \"./createOsdkInterface.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport type DollarAsFn = <\n Q extends FetchedObjectTypeDefinition,\n NEW_Q extends ObjectOrInterfaceDefinition,\n>(\n this: Osdk<any> & (InterfaceHolder<Q> | ObjectHolder<Q>),\n newDef: string | NEW_Q,\n) => OsdkBase<any>;\n\nexport const get$as: (key: FetchedObjectTypeDefinition) => DollarAsFn =\n createSimpleCache<\n FetchedObjectTypeDefinition,\n DollarAsFn\n >(new WeakMap(), $asFactory).get;\n\nconst osdkObjectToInterfaceView = createSimpleCache(\n new WeakMap<\n OsdkBase<any>,\n Map<string, WeakRef<OsdkBase<any>>>\n >(),\n () =>\n new Map<\n /* interface api name */ string,\n /* $as'd object */ WeakRef<OsdkBase<any>>\n >(),\n);\n\nfunction $asFactory(\n objDef: FetchedObjectTypeDefinition,\n): DollarAsFn {\n // We use the exact same logic for both the interface rep and the underlying rep\n\n return function $as<\n NEW_Q extends ObjectOrInterfaceDefinition,\n >(\n this: OsdkBase<any> & { [UnderlyingOsdkObject]: any },\n targetMinDef: NEW_Q | string,\n ): OsdkBase<any> {\n let targetInterfaceApiName: string;\n\n if (typeof targetMinDef === \"string\") {\n if (targetMinDef === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n\n // this is sufficient to determine if we implement the interface\n if (objDef.interfaceMap?.[targetMinDef] == null) {\n throw new Error(\n `Object does not implement interface '${targetMinDef}'.`,\n );\n }\n\n targetInterfaceApiName = targetMinDef;\n } else if (targetMinDef.apiName === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n } else {\n if (targetMinDef.type === \"object\") {\n throw new Error(\n `'${targetMinDef.apiName}' is not an interface nor is it '${objDef.apiName}', which is the object type.`,\n );\n }\n targetInterfaceApiName = targetMinDef.apiName;\n }\n\n const def = objDef[InterfaceDefinitions][targetInterfaceApiName];\n if (!def) {\n throw new Error(\n `Object does not implement interface '${targetInterfaceApiName}'.`,\n );\n }\n\n const underlying = this[UnderlyingOsdkObject];\n\n const existing = osdkObjectToInterfaceView\n .get(underlying)\n .get(targetInterfaceApiName)?.deref();\n if (existing) return existing;\n\n const osdkInterface = createOsdkInterface(underlying, def.def);\n osdkObjectToInterfaceView.get(underlying).set(\n targetInterfaceApiName,\n new WeakRef(osdkInterface),\n );\n return osdkInterface;\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAEEA,oBAAoB,QACf,oCAAoC;AAC3C,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,SAASC,oBAAoB,QAAQ,sBAAsB;;AAG3D;;AASA,OAAO,MAAMC,MAAwD,GACnEH,iBAAiB,C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AK,CAAC,CAAC;IACvC,IAAID,QAAQ,EAAE,OAAOA,QAAQ;IAE7B,MAAME,aAAa,GAAGnB,mBAAmB,CAACgB,UAAU,EAAED,GAAG,CAACA,GAAG,CAAC;IAC9DT,yBAAyB,CAACD,GAAG,CAACW,UAAU,CAAC,CAACI,GAAG,CAC3CV,sBAAsB,EACtB,IAAIW,OAAO,CAACF,aAAa,CAC3B,CAAC;IACD,OAAOA,aAAa;EACtB,CAAC;AACH","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.ts"],"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 */\n\nimport type { ObjectOrInterfaceDefinition, OsdkBase } from \"@osdk/api\";\nimport {\n type FetchedObjectTypeDefinition,\n InterfaceDefinitions,\n} from \"../../ontology/OntologyProvider.js\";\nimport { createSimpleCache } from \"../SimpleCache.js\";\nimport { createOsdkInterface } from \"./createOsdkInterface.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport type DollarAsFn = <\n Q extends FetchedObjectTypeDefinition,\n NEW_Q extends ObjectOrInterfaceDefinition,\n>(\n this: InterfaceHolder | ObjectHolder,\n newDef: string | NEW_Q,\n) => OsdkBase<any>;\n\nexport const get$as: (key: FetchedObjectTypeDefinition) => DollarAsFn =\n createSimpleCache<\n FetchedObjectTypeDefinition,\n DollarAsFn\n >(new WeakMap(), $asFactory).get;\n\nconst osdkObjectToInterfaceView = createSimpleCache(\n new WeakMap<\n OsdkBase<any>,\n Map<string, WeakRef<OsdkBase<any>>>\n >(),\n () =>\n new Map<\n /* interface api name */ string,\n /* $as'd object */ WeakRef<OsdkBase<any>>\n >(),\n);\n\nfunction $asFactory(\n objDef: FetchedObjectTypeDefinition,\n): DollarAsFn {\n // We use the exact same logic for both the interface rep and the underlying rep\n\n return function $as<\n NEW_Q extends ObjectOrInterfaceDefinition,\n >(\n this: OsdkBase<any> & { [UnderlyingOsdkObject]: any },\n targetMinDef: NEW_Q | string,\n ): OsdkBase<any> {\n let targetInterfaceApiName: string;\n\n if (typeof targetMinDef === \"string\") {\n if (targetMinDef === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n\n // this is sufficient to determine if we implement the interface\n if (objDef.interfaceMap?.[targetMinDef] == null) {\n throw new Error(\n `Object does not implement interface '${targetMinDef}'.`,\n );\n }\n\n targetInterfaceApiName = targetMinDef;\n } else if (targetMinDef.apiName === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n } else {\n if (targetMinDef.type === \"object\") {\n throw new Error(\n `'${targetMinDef.apiName}' is not an interface nor is it '${objDef.apiName}', which is the object type.`,\n );\n }\n targetInterfaceApiName = targetMinDef.apiName;\n }\n\n const def = objDef[InterfaceDefinitions][targetInterfaceApiName];\n if (!def) {\n throw new Error(\n `Object does not implement interface '${targetInterfaceApiName}'.`,\n );\n }\n\n const underlying = this[UnderlyingOsdkObject];\n\n const existing = osdkObjectToInterfaceView\n .get(underlying)\n .get(targetInterfaceApiName)?.deref();\n if (existing) return existing;\n\n const osdkInterface = createOsdkInterface(underlying, def.def);\n osdkObjectToInterfaceView.get(underlying).set(\n targetInterfaceApiName,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MAAMI,GAAG,GAAGP,MAAM,CAACV,oBAAoB,CAAC,CAACY,sBAAsB,CAAC;IAChE,IAAI,CAACK,GAAG,EAAE;MACR,MAAM,IAAIF,KAAK,CACb,wCAAwCH,sBAAsB,IAChE,CAAC;IACH;IAEA,MAAMM,UAAU,GAAG,IAAI,CAACf,oBAAoB,CAAC;IAE7C,MAAMgB,QAAQ,GAAGX,yBAAyB,CACvCD,GAAG,CAACW,UAAU,CAAC,CACfX,GAAG,CAACK,sBAAsB,CAAC,EAAEQ,KAAK,CAAC,CAAC;IACvC,IAAID,QAAQ,EAAE,OAAOA,QAAQ;IAE7B,MAAME,aAAa,GAAGnB,mBAAmB,CAACgB,UAAU,EAAED,GAAG,CAACA,GAAG,CAAC;IAC9DT,yBAAyB,CAACD,GAAG,CAACW,UAAU,CAAC,CAACI,GAAG,CAC3CV,sBAAsB,EACtB,IAAIW,OAAO,CAACF,aAAa,CAC3B,CAAC;IACD,OAAOA,aAAa;EACtB,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
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.ts"],"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 */\n\nimport type {\n ObjectSet,\n ObjectTypeDefinition,\n OsdkObjectLinksObject,\n SelectArg,\n WhereClause,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"../../objectSet/createObjectSet.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../fetchSingle.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function get$link(\n holder: ObjectHolder<any>,\n): OsdkObjectLinksObject<any> {\n const client = holder[ClientRef];\n const objDef = holder[ObjectDefRef];\n const rawObj = holder[UnderlyingOsdkObject];\n return Object.freeze(Object.fromEntries(\n Object.keys(objDef.links).map(\n (linkName) => {\n const linkDef = objDef.links[linkName as keyof typeof objDef.links];\n const objectSet =\n (client.objectSetFactory(objDef, client) as ObjectSet<any>)\n .where({\n [objDef.primaryKeyApiName]: rawObj.$primaryKey,\n } as WhereClause<ObjectTypeDefinition>)\n .pivotTo(linkName);\n\n const value = !linkDef.multiplicity\n ? {\n fetchOne: <A extends SelectArg<any>>(options?: A) =>\n fetchSingle(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n fetchOneWithErrors: <A extends SelectArg<any>>(options?: A) =>\n fetchSingleWithErrors(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n }\n : objectSet;\n\n return [linkName, value];\n },\n ),\n ));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,mBAAmB;AACtE,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,QAAQA,CACtBC,MAAyB,EACG;EAC5B,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,CACrCF,MAAM,CAACG,IAAI,CAACL,MAAM,CAACM,KAAK,CAAC,CAACC,GAAG,CAC1BC,QAAQ,IAAK;IACZ,MAAMC,OAAO,GAAGT,MAAM,CAACM,KAAK,CAACE,QAAQ,CAA8B;IACnE,MAAME,SAAS,GACZX,MAAM,CAACY,gBAAgB,CAACX,MAAM,EAAED,MAAM,CAAC,CACrCa,KAAK,CAAC;MACL,CAACZ,MAAM,CAACa,iBAAiB,GAAGZ,MAAM,CAACa;IACrC,CAAsC,CAAC,CACtCC,OAAO,CAACP,QAAQ,CAAC;IAEtB,MAAMQ,KAAK,GAAG,CAACP,OAAO,CAACQ,YAAY,GAC/B;MACAC,QAAQ,EAA6BC,OAAW,IAC9C3B,WAAW,CACTO,MAAM,EACNC,MAAM,EACNmB,OAAO,IAAI,CAAC,CAAC,EACb5B,gBAAgB,CAACmB,SAAS,CAC5B,CAAC;MACHU,kBAAkB,EAA6BD,OAAW,IACxD1B,qBAAqB,CACnBM,MAAM,EACNC,MAAM,EACNmB,OAAO,IAAI,CAAC,CAAC,EACb5B,gBAAgB,CAACmB,SAAS,CAC5B;IACJ,CAAC,GACCA,SAAS;IAEb,OAAO,CAACF,QAAQ,EAAEQ,KAAK,CAAC;EAC1B,CACF,CACF,CAAC,CAAC;AACJ","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.ts"],"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 */\n\nimport type {\n ObjectSet,\n OsdkObjectLinksObject,\n SelectArg,\n SingleLinkAccessor,\n WhereClause,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"../../objectSet/createObjectSet.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../fetchSingle.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\nexport function get$link(\n holder: ObjectHolder,\n): OsdkObjectLinksObject<any> {\n const client = holder[ClientRef];\n const objDef = holder[ObjectDefRef];\n const rawObj = holder[UnderlyingOsdkObject];\n return Object.freeze(Object.fromEntries(\n Object.keys(objDef.links).map(\n (linkName) => {\n const linkDef = objDef.links[linkName as keyof typeof objDef.links];\n const objectSet =\n (client.objectSetFactory(objDef, client) as ObjectSet<any>)\n .where({\n [objDef.primaryKeyApiName]: rawObj.$primaryKey,\n } as WhereClause<any>)\n .pivotTo(linkName);\n\n const value = !linkDef.multiplicity\n ? {\n fetchOne: <A extends SelectArg<any, any, any, any>>(\n options?: A,\n ) =>\n fetchSingle(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n fetchOneWithErrors: <A extends SelectArg<any, any, any, any>>(\n options?: A,\n ) =>\n fetchSingleWithErrors(\n client,\n objDef,\n options ?? {},\n getWireObjectSet(objectSet),\n ),\n } as SingleLinkAccessor<any>\n : objectSet;\n\n return [linkName, value];\n },\n ),\n ));\n}\n"],"mappings":"AAAA;AACA;AACA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