@osdk/client 2.7.1 → 2.8.0-beta.10

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 (388) hide show
  1. package/CHANGELOG.md +92 -157
  2. package/build/browser/Client.js +1 -1
  3. package/build/browser/Client.js.map +1 -1
  4. package/build/browser/MinimalClientContext.js.map +1 -1
  5. package/build/browser/actions/applyAction.js +5 -0
  6. package/build/browser/actions/applyAction.js.map +1 -1
  7. package/build/browser/createClient.js +2 -1
  8. package/build/browser/createClient.js.map +1 -1
  9. package/build/browser/createMinimalClient.js +1 -0
  10. package/build/browser/createMinimalClient.js.map +1 -1
  11. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +17 -1
  12. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  13. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +101 -0
  14. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  15. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +1 -1
  16. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -1
  17. package/build/browser/fetchMetadata.test.js +9 -0
  18. package/build/browser/fetchMetadata.test.js.map +1 -1
  19. package/build/browser/intellisense.test.js +1 -1
  20. package/build/browser/intellisense.test.js.map +1 -1
  21. package/build/browser/internal/conversions/modernToLegacyWhereClause.js +1 -1
  22. package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  23. package/build/browser/object/aggregate.js +1 -0
  24. package/build/browser/object/aggregate.js.map +1 -1
  25. package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
  26. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +3 -0
  27. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  28. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
  29. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  30. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +85 -3
  31. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  32. package/build/browser/object/convertWireToOsdkObjects.js +4 -4
  33. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  34. package/build/browser/object/convertWireToOsdkObjects.test.js +48 -27
  35. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  36. package/build/browser/object/fetchPage.js +18 -5
  37. package/build/browser/object/fetchPage.js.map +1 -1
  38. package/build/browser/object/object.test.js +123 -0
  39. package/build/browser/object/object.test.js.map +1 -1
  40. package/build/browser/objectSet/ObjectSet.test.js +6 -6
  41. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  42. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +4 -4
  43. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  44. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +3 -1
  45. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  46. package/build/browser/objectSet/createObjectSet.js +0 -4
  47. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  48. package/build/browser/objectSet/fetchLinksPage.js +1 -0
  49. package/build/browser/objectSet/fetchLinksPage.js.map +1 -1
  50. package/build/browser/observable/ObservableClient/ObserveLink.js.map +1 -1
  51. package/build/browser/observable/ObservableClient.js +11 -0
  52. package/build/browser/observable/ObservableClient.js.map +1 -1
  53. package/build/browser/observable/internal/AbstractHelper.js +56 -3
  54. package/build/browser/observable/internal/AbstractHelper.js.map +1 -1
  55. package/build/browser/observable/internal/AbstractHelper.test.js +114 -0
  56. package/build/browser/observable/internal/AbstractHelper.test.js.map +1 -0
  57. package/build/browser/observable/internal/BulkObjectLoader.js +71 -9
  58. package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
  59. package/build/browser/observable/internal/BulkObjectLoader.test.js +79 -0
  60. package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -1
  61. package/build/browser/observable/internal/CacheKeys.js +19 -8
  62. package/build/browser/observable/internal/CacheKeys.js.map +1 -1
  63. package/build/browser/observable/internal/ListQueryView.js +120 -0
  64. package/build/browser/observable/internal/ListQueryView.js.map +1 -0
  65. package/build/browser/observable/internal/ObservableClientImpl.js +136 -24
  66. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  67. package/build/browser/observable/internal/PivotCanonicalizer.js +4 -4
  68. package/build/browser/observable/internal/PivotCanonicalizer.js.map +1 -1
  69. package/build/browser/observable/internal/Query.js +7 -5
  70. package/build/browser/observable/internal/Query.js.map +1 -1
  71. package/build/browser/observable/internal/RdpCanonicalizer.test.js +23 -7
  72. package/build/browser/observable/internal/RdpCanonicalizer.test.js.map +1 -1
  73. package/build/browser/observable/internal/Store.js +19 -2
  74. package/build/browser/observable/internal/Store.js.map +1 -1
  75. package/build/browser/observable/internal/Store.test.js +328 -1
  76. package/build/browser/observable/internal/Store.test.js.map +1 -1
  77. package/build/browser/observable/internal/actions/ActionApplication.js +7 -4
  78. package/build/browser/observable/internal/actions/ActionApplication.js.map +1 -1
  79. package/build/browser/observable/internal/actions/OptimisticJob.js +1 -1
  80. package/build/browser/observable/internal/actions/OptimisticJob.js.map +1 -1
  81. package/build/browser/observable/internal/aggregation/AggregationCacheKey.js +5 -3
  82. package/build/browser/observable/internal/aggregation/AggregationCacheKey.js.map +1 -1
  83. package/build/browser/observable/internal/aggregation/AggregationQuery.js +28 -2
  84. package/build/browser/observable/internal/aggregation/AggregationQuery.js.map +1 -1
  85. package/build/browser/observable/internal/aggregation/AggregationsHelper.js +18 -2
  86. package/build/browser/observable/internal/aggregation/AggregationsHelper.js.map +1 -1
  87. package/build/browser/observable/internal/aggregation/AggregationsHelper.test.js +103 -0
  88. package/build/browser/observable/internal/aggregation/AggregationsHelper.test.js.map +1 -0
  89. package/build/browser/observable/internal/aggregation/ObjectAggregationQuery.js +22 -3
  90. package/build/browser/observable/internal/aggregation/ObjectAggregationQuery.js.map +1 -1
  91. package/build/browser/observable/internal/base-list/BaseListQuery.js +73 -6
  92. package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
  93. package/build/browser/observable/internal/function/FunctionQuery.js +27 -1
  94. package/build/browser/observable/internal/function/FunctionQuery.js.map +1 -1
  95. package/build/browser/observable/internal/function/FunctionsHelper.js +2 -1
  96. package/build/browser/observable/internal/function/FunctionsHelper.js.map +1 -1
  97. package/build/browser/observable/internal/getObjectTypesThatInvalidate.js +2 -2
  98. package/build/browser/observable/internal/getObjectTypesThatInvalidate.js.map +1 -1
  99. package/build/browser/observable/internal/links/LinksHelper.js +3 -2
  100. package/build/browser/observable/internal/links/LinksHelper.js.map +1 -1
  101. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js +7 -5
  102. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  103. package/build/browser/observable/internal/links/SpecificLinkQuery.js +97 -62
  104. package/build/browser/observable/internal/links/SpecificLinkQuery.js.map +1 -1
  105. package/build/browser/observable/internal/list/InterfaceListQuery.js +19 -1
  106. package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
  107. package/build/browser/observable/internal/list/ListQuery.js +30 -10
  108. package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
  109. package/build/browser/observable/internal/list/ListQuery.test.js +262 -1
  110. package/build/browser/observable/internal/list/ListQuery.test.js.map +1 -1
  111. package/build/browser/observable/internal/list/ListsHelper.js +1 -1
  112. package/build/browser/observable/internal/list/ListsHelper.js.map +1 -1
  113. package/build/browser/observable/internal/list/ObjectListQuery.js +22 -21
  114. package/build/browser/observable/internal/list/ObjectListQuery.js.map +1 -1
  115. package/build/browser/observable/internal/object/ObjectQuery.js +23 -6
  116. package/build/browser/observable/internal/object/ObjectQuery.js.map +1 -1
  117. package/build/browser/observable/internal/object/ObjectsHelper.js +12 -3
  118. package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -1
  119. package/build/browser/observable/internal/object/ObjectsHelper.test.js +200 -0
  120. package/build/browser/observable/internal/object/ObjectsHelper.test.js.map +1 -0
  121. package/build/browser/observable/internal/objectset/ObjectSetCacheKey.js.map +1 -1
  122. package/build/browser/observable/internal/objectset/ObjectSetHelper.js +3 -2
  123. package/build/browser/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
  124. package/build/browser/observable/internal/objectset/ObjectSetHelper.test.js +94 -0
  125. package/build/browser/observable/internal/objectset/ObjectSetHelper.test.js.map +1 -0
  126. package/build/browser/observable/internal/objectset/ObjectSetQuery.js +4 -1
  127. package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
  128. package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -0
  129. package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
  130. package/build/browser/observable/internal/testUtils.js.map +1 -1
  131. package/build/browser/observable/internal/utils/rdpFieldOperations.js +7 -2
  132. package/build/browser/observable/internal/utils/rdpFieldOperations.js.map +1 -1
  133. package/build/browser/observable/internal/utils/rdpFieldOperations.test.js +55 -0
  134. package/build/browser/observable/internal/utils/rdpFieldOperations.test.js.map +1 -1
  135. package/build/browser/ontology/loadActionMetadata.js +3 -1
  136. package/build/browser/ontology/loadActionMetadata.js.map +1 -1
  137. package/build/browser/ontology/loadFullObjectMetadata.js +2 -1
  138. package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -1
  139. package/build/browser/ontology/loadInterfaceMetadata.js +2 -1
  140. package/build/browser/ontology/loadInterfaceMetadata.js.map +1 -1
  141. package/build/browser/public/unstable-do-not-use.js +1 -0
  142. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  143. package/build/browser/util/UserAgent.js +2 -2
  144. package/build/browser/util/UserAgent.js.map +1 -1
  145. package/build/browser/util/interfaceUtils.js +7 -0
  146. package/build/browser/util/interfaceUtils.js.map +1 -1
  147. package/build/cjs/{chunk-OVZCGOMG.cjs → chunk-6VOFZIIJ.cjs} +196 -92
  148. package/build/cjs/chunk-6VOFZIIJ.cjs.map +1 -0
  149. package/build/cjs/{chunk-OZNDU7AU.cjs → chunk-YVZM2JPW.cjs} +237 -196
  150. package/build/cjs/chunk-YVZM2JPW.cjs.map +1 -0
  151. package/build/cjs/{createClient-BDmrDOzZ.d.cts → createClient-BPK4om7e.d.cts} +1 -0
  152. package/build/cjs/index.cjs +8 -8
  153. package/build/cjs/index.d.cts +1 -1
  154. package/build/cjs/public/internal.cjs +8 -8
  155. package/build/cjs/public/unstable-do-not-use.cjs +928 -360
  156. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  157. package/build/cjs/public/unstable-do-not-use.d.cts +65 -27
  158. package/build/esm/Client.js +1 -1
  159. package/build/esm/Client.js.map +1 -1
  160. package/build/esm/MinimalClientContext.js.map +1 -1
  161. package/build/esm/actions/applyAction.js +5 -0
  162. package/build/esm/actions/applyAction.js.map +1 -1
  163. package/build/esm/createClient.js +2 -1
  164. package/build/esm/createClient.js.map +1 -1
  165. package/build/esm/createMinimalClient.js +1 -0
  166. package/build/esm/createMinimalClient.js.map +1 -1
  167. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +17 -1
  168. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  169. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +101 -0
  170. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  171. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +1 -1
  172. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -1
  173. package/build/esm/fetchMetadata.test.js +9 -0
  174. package/build/esm/fetchMetadata.test.js.map +1 -1
  175. package/build/esm/intellisense.test.js +1 -1
  176. package/build/esm/intellisense.test.js.map +1 -1
  177. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +1 -1
  178. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  179. package/build/esm/object/aggregate.js +1 -0
  180. package/build/esm/object/aggregate.js.map +1 -1
  181. package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
  182. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +3 -0
  183. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  184. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
  185. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  186. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +85 -3
  187. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  188. package/build/esm/object/convertWireToOsdkObjects.js +4 -4
  189. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  190. package/build/esm/object/convertWireToOsdkObjects.test.js +48 -27
  191. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  192. package/build/esm/object/fetchPage.js +18 -5
  193. package/build/esm/object/fetchPage.js.map +1 -1
  194. package/build/esm/object/object.test.js +123 -0
  195. package/build/esm/object/object.test.js.map +1 -1
  196. package/build/esm/objectSet/ObjectSet.test.js +6 -6
  197. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  198. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +4 -4
  199. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  200. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +3 -1
  201. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  202. package/build/esm/objectSet/createObjectSet.js +0 -4
  203. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  204. package/build/esm/objectSet/fetchLinksPage.js +1 -0
  205. package/build/esm/objectSet/fetchLinksPage.js.map +1 -1
  206. package/build/esm/observable/ObservableClient/ObserveLink.js.map +1 -1
  207. package/build/esm/observable/ObservableClient.js +11 -0
  208. package/build/esm/observable/ObservableClient.js.map +1 -1
  209. package/build/esm/observable/internal/AbstractHelper.js +56 -3
  210. package/build/esm/observable/internal/AbstractHelper.js.map +1 -1
  211. package/build/esm/observable/internal/AbstractHelper.test.js +114 -0
  212. package/build/esm/observable/internal/AbstractHelper.test.js.map +1 -0
  213. package/build/esm/observable/internal/BulkObjectLoader.js +71 -9
  214. package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
  215. package/build/esm/observable/internal/BulkObjectLoader.test.js +79 -0
  216. package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -1
  217. package/build/esm/observable/internal/CacheKeys.js +19 -8
  218. package/build/esm/observable/internal/CacheKeys.js.map +1 -1
  219. package/build/esm/observable/internal/ListQueryView.js +120 -0
  220. package/build/esm/observable/internal/ListQueryView.js.map +1 -0
  221. package/build/esm/observable/internal/ObservableClientImpl.js +136 -24
  222. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  223. package/build/esm/observable/internal/PivotCanonicalizer.js +4 -4
  224. package/build/esm/observable/internal/PivotCanonicalizer.js.map +1 -1
  225. package/build/esm/observable/internal/Query.js +7 -5
  226. package/build/esm/observable/internal/Query.js.map +1 -1
  227. package/build/esm/observable/internal/RdpCanonicalizer.test.js +23 -7
  228. package/build/esm/observable/internal/RdpCanonicalizer.test.js.map +1 -1
  229. package/build/esm/observable/internal/Store.js +19 -2
  230. package/build/esm/observable/internal/Store.js.map +1 -1
  231. package/build/esm/observable/internal/Store.test.js +328 -1
  232. package/build/esm/observable/internal/Store.test.js.map +1 -1
  233. package/build/esm/observable/internal/actions/ActionApplication.js +7 -4
  234. package/build/esm/observable/internal/actions/ActionApplication.js.map +1 -1
  235. package/build/esm/observable/internal/actions/OptimisticJob.js +1 -1
  236. package/build/esm/observable/internal/actions/OptimisticJob.js.map +1 -1
  237. package/build/esm/observable/internal/aggregation/AggregationCacheKey.js +5 -3
  238. package/build/esm/observable/internal/aggregation/AggregationCacheKey.js.map +1 -1
  239. package/build/esm/observable/internal/aggregation/AggregationQuery.js +28 -2
  240. package/build/esm/observable/internal/aggregation/AggregationQuery.js.map +1 -1
  241. package/build/esm/observable/internal/aggregation/AggregationsHelper.js +18 -2
  242. package/build/esm/observable/internal/aggregation/AggregationsHelper.js.map +1 -1
  243. package/build/esm/observable/internal/aggregation/AggregationsHelper.test.js +103 -0
  244. package/build/esm/observable/internal/aggregation/AggregationsHelper.test.js.map +1 -0
  245. package/build/esm/observable/internal/aggregation/ObjectAggregationQuery.js +22 -3
  246. package/build/esm/observable/internal/aggregation/ObjectAggregationQuery.js.map +1 -1
  247. package/build/esm/observable/internal/base-list/BaseListQuery.js +73 -6
  248. package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
  249. package/build/esm/observable/internal/function/FunctionQuery.js +27 -1
  250. package/build/esm/observable/internal/function/FunctionQuery.js.map +1 -1
  251. package/build/esm/observable/internal/function/FunctionsHelper.js +2 -1
  252. package/build/esm/observable/internal/function/FunctionsHelper.js.map +1 -1
  253. package/build/esm/observable/internal/getObjectTypesThatInvalidate.js +2 -2
  254. package/build/esm/observable/internal/getObjectTypesThatInvalidate.js.map +1 -1
  255. package/build/esm/observable/internal/links/LinksHelper.js +3 -2
  256. package/build/esm/observable/internal/links/LinksHelper.js.map +1 -1
  257. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js +7 -5
  258. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  259. package/build/esm/observable/internal/links/SpecificLinkQuery.js +97 -62
  260. package/build/esm/observable/internal/links/SpecificLinkQuery.js.map +1 -1
  261. package/build/esm/observable/internal/list/InterfaceListQuery.js +19 -1
  262. package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
  263. package/build/esm/observable/internal/list/ListQuery.js +30 -10
  264. package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
  265. package/build/esm/observable/internal/list/ListQuery.test.js +262 -1
  266. package/build/esm/observable/internal/list/ListQuery.test.js.map +1 -1
  267. package/build/esm/observable/internal/list/ListsHelper.js +1 -1
  268. package/build/esm/observable/internal/list/ListsHelper.js.map +1 -1
  269. package/build/esm/observable/internal/list/ObjectListQuery.js +22 -21
  270. package/build/esm/observable/internal/list/ObjectListQuery.js.map +1 -1
  271. package/build/esm/observable/internal/object/ObjectQuery.js +23 -6
  272. package/build/esm/observable/internal/object/ObjectQuery.js.map +1 -1
  273. package/build/esm/observable/internal/object/ObjectsHelper.js +12 -3
  274. package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -1
  275. package/build/esm/observable/internal/object/ObjectsHelper.test.js +200 -0
  276. package/build/esm/observable/internal/object/ObjectsHelper.test.js.map +1 -0
  277. package/build/esm/observable/internal/objectset/ObjectSetCacheKey.js.map +1 -1
  278. package/build/esm/observable/internal/objectset/ObjectSetHelper.js +3 -2
  279. package/build/esm/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
  280. package/build/esm/observable/internal/objectset/ObjectSetHelper.test.js +94 -0
  281. package/build/esm/observable/internal/objectset/ObjectSetHelper.test.js.map +1 -0
  282. package/build/esm/observable/internal/objectset/ObjectSetQuery.js +4 -1
  283. package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
  284. package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -0
  285. package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
  286. package/build/esm/observable/internal/testUtils.js.map +1 -1
  287. package/build/esm/observable/internal/utils/rdpFieldOperations.js +7 -2
  288. package/build/esm/observable/internal/utils/rdpFieldOperations.js.map +1 -1
  289. package/build/esm/observable/internal/utils/rdpFieldOperations.test.js +55 -0
  290. package/build/esm/observable/internal/utils/rdpFieldOperations.test.js.map +1 -1
  291. package/build/esm/ontology/loadActionMetadata.js +3 -1
  292. package/build/esm/ontology/loadActionMetadata.js.map +1 -1
  293. package/build/esm/ontology/loadFullObjectMetadata.js +2 -1
  294. package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -1
  295. package/build/esm/ontology/loadInterfaceMetadata.js +2 -1
  296. package/build/esm/ontology/loadInterfaceMetadata.js.map +1 -1
  297. package/build/esm/public/unstable-do-not-use.js +1 -0
  298. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  299. package/build/esm/util/UserAgent.js +2 -2
  300. package/build/esm/util/UserAgent.js.map +1 -1
  301. package/build/esm/util/interfaceUtils.js +7 -0
  302. package/build/esm/util/interfaceUtils.js.map +1 -1
  303. package/build/types/Client.d.ts +1 -1
  304. package/build/types/MinimalClientContext.d.ts +1 -1
  305. package/build/types/actions/applyAction.d.ts.map +1 -1
  306. package/build/types/createClient.d.ts +1 -0
  307. package/build/types/createClient.d.ts.map +1 -1
  308. package/build/types/object/convertWireToOsdkObjects/InternalSymbols.d.ts +2 -0
  309. package/build/types/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  310. package/build/types/object/convertWireToOsdkObjects.d.ts +4 -4
  311. package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
  312. package/build/types/object/fetchPage.d.ts.map +1 -1
  313. package/build/types/object/object.test.d.ts.map +1 -1
  314. package/build/types/objectSet/createObjectSet.d.ts +5 -14
  315. package/build/types/objectSet/createObjectSet.d.ts.map +1 -1
  316. package/build/types/objectSet/fetchLinksPage.d.ts +1 -9
  317. package/build/types/objectSet/fetchLinksPage.d.ts.map +1 -1
  318. package/build/types/observable/ObservableClient/ObserveLink.d.ts +2 -1
  319. package/build/types/observable/ObservableClient/ObserveLink.d.ts.map +1 -1
  320. package/build/types/observable/ObservableClient.d.ts +71 -25
  321. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  322. package/build/types/observable/internal/AbstractHelper.d.ts +1 -1
  323. package/build/types/observable/internal/AbstractHelper.d.ts.map +1 -1
  324. package/build/types/observable/internal/AbstractHelper.test.d.ts +1 -0
  325. package/build/types/observable/internal/AbstractHelper.test.d.ts.map +1 -0
  326. package/build/types/observable/internal/BulkObjectLoader.d.ts +2 -1
  327. package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
  328. package/build/types/observable/internal/CacheKeys.d.ts +5 -0
  329. package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
  330. package/build/types/observable/internal/ListQueryView.d.ts +21 -0
  331. package/build/types/observable/internal/ListQueryView.d.ts.map +1 -0
  332. package/build/types/observable/internal/PivotCanonicalizer.d.ts +2 -2
  333. package/build/types/observable/internal/PivotCanonicalizer.d.ts.map +1 -1
  334. package/build/types/observable/internal/Query.d.ts.map +1 -1
  335. package/build/types/observable/internal/Store.d.ts.map +1 -1
  336. package/build/types/observable/internal/Store.test.d.ts.map +1 -1
  337. package/build/types/observable/internal/actions/ActionApplication.d.ts.map +1 -1
  338. package/build/types/observable/internal/actions/OptimisticJob.d.ts.map +1 -1
  339. package/build/types/observable/internal/aggregation/AggregationCacheKey.d.ts +6 -4
  340. package/build/types/observable/internal/aggregation/AggregationCacheKey.d.ts.map +1 -1
  341. package/build/types/observable/internal/aggregation/AggregationQuery.d.ts +8 -3
  342. package/build/types/observable/internal/aggregation/AggregationQuery.d.ts.map +1 -1
  343. package/build/types/observable/internal/aggregation/AggregationsHelper.d.ts +19 -14
  344. package/build/types/observable/internal/aggregation/AggregationsHelper.d.ts.map +1 -1
  345. package/build/types/observable/internal/aggregation/AggregationsHelper.test.d.ts +1 -0
  346. package/build/types/observable/internal/aggregation/AggregationsHelper.test.d.ts.map +1 -0
  347. package/build/types/observable/internal/aggregation/ObjectAggregationQuery.d.ts.map +1 -1
  348. package/build/types/observable/internal/base-list/BaseListQuery.d.ts +47 -2
  349. package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
  350. package/build/types/observable/internal/function/FunctionQuery.d.ts +1 -1
  351. package/build/types/observable/internal/function/FunctionQuery.d.ts.map +1 -1
  352. package/build/types/observable/internal/function/FunctionsHelper.d.ts +1 -0
  353. package/build/types/observable/internal/function/FunctionsHelper.d.ts.map +1 -1
  354. package/build/types/observable/internal/links/LinksHelper.d.ts +5 -5
  355. package/build/types/observable/internal/links/LinksHelper.d.ts.map +1 -1
  356. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts +8 -6
  357. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts.map +1 -1
  358. package/build/types/observable/internal/links/SpecificLinkQuery.d.ts +3 -4
  359. package/build/types/observable/internal/links/SpecificLinkQuery.d.ts.map +1 -1
  360. package/build/types/observable/internal/list/InterfaceListQuery.d.ts.map +1 -1
  361. package/build/types/observable/internal/list/ListQuery.d.ts +0 -3
  362. package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
  363. package/build/types/observable/internal/list/ListsHelper.d.ts +4 -4
  364. package/build/types/observable/internal/list/ListsHelper.d.ts.map +1 -1
  365. package/build/types/observable/internal/list/ObjectListQuery.d.ts.map +1 -1
  366. package/build/types/observable/internal/object/ObjectQuery.d.ts +2 -1
  367. package/build/types/observable/internal/object/ObjectQuery.d.ts.map +1 -1
  368. package/build/types/observable/internal/object/ObjectsHelper.d.ts +8 -4
  369. package/build/types/observable/internal/object/ObjectsHelper.d.ts.map +1 -1
  370. package/build/types/observable/internal/object/ObjectsHelper.test.d.ts +1 -0
  371. package/build/types/observable/internal/object/ObjectsHelper.test.d.ts.map +1 -0
  372. package/build/types/observable/internal/objectset/ObjectSetCacheKey.d.ts +2 -1
  373. package/build/types/observable/internal/objectset/ObjectSetCacheKey.d.ts.map +1 -1
  374. package/build/types/observable/internal/objectset/ObjectSetHelper.d.ts +3 -1
  375. package/build/types/observable/internal/objectset/ObjectSetHelper.d.ts.map +1 -1
  376. package/build/types/observable/internal/objectset/ObjectSetHelper.test.d.ts +1 -0
  377. package/build/types/observable/internal/objectset/ObjectSetHelper.test.d.ts.map +1 -0
  378. package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts +2 -0
  379. package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
  380. package/build/types/observable/internal/testUtils.d.ts +2 -2
  381. package/build/types/observable/internal/testUtils.d.ts.map +1 -1
  382. package/build/types/public/unstable-do-not-use.d.ts +1 -0
  383. package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
  384. package/build/types/util/interfaceUtils.d.ts +2 -1
  385. package/build/types/util/interfaceUtils.d.ts.map +1 -1
  386. package/package.json +15 -14
  387. package/build/cjs/chunk-OVZCGOMG.cjs.map +0 -1
  388. package/build/cjs/chunk-OZNDU7AU.cjs.map +0 -1
@@ -1 +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 {\n ObjectMetadata,\n ObjectOrInterfaceDefinition,\n ObjectSpecifier,\n} from \"@osdk/api\";\nimport type { FormatPropertyOptions } from \"../formatting/applyPropertyFormatter.js\";\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 $rid?: string;\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 readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n readonly ObjectMetadata: ObjectMetadata;\n };\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue\": <\n PropertyApiName extends string,\n >(\n propertyApiName: PropertyApiName,\n options?: FormatPropertyOptions,\n ) => string | undefined;\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
+ {"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 {\n ObjectMetadata,\n ObjectOrInterfaceDefinition,\n ObjectSpecifier,\n PropertySecurity,\n} from \"@osdk/api\";\nimport type { FormatPropertyOptions } from \"../formatting/applyPropertyFormatter.js\";\nimport type { InterfaceHolder } from \"./InterfaceHolder.js\";\nimport type {\n PropertySecuritiesRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\n/** @internal */\n\nexport interface BaseHolder {\n readonly [UnderlyingOsdkObject]: ObjectHolder;\n readonly [PropertySecuritiesRef]:\n | { [propName: string]: PropertySecurity[] }\n | undefined;\n\n readonly $apiName: string;\n readonly $objectType: string;\n readonly $primaryKey: string | number;\n readonly $title: string | undefined;\n readonly $rid?: string;\n readonly $objectSpecifier: ObjectSpecifier<any>;\n readonly $propertySecurities: PropertySecurity[];\n\n readonly \"$as\": (\n newDef: string | ObjectOrInterfaceDefinition,\n ) => ObjectHolder | InterfaceHolder;\n\n readonly \"$clone\": (\n newProps?: Record<string, any>,\n ) => this;\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n readonly ObjectMetadata: ObjectMetadata;\n };\n\n readonly \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue\": <\n PropertyApiName extends string,\n >(\n propertyApiName: PropertyApiName,\n options?: FormatPropertyOptions,\n ) => string | undefined;\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":[]}
@@ -25,4 +25,7 @@ export const InterfaceDefRef = Symbol("InterfaceDefinition");
25
25
 
26
26
  /** @internal */
27
27
  export const ClientRef = Symbol("ClientRef");
28
+
29
+ /** @internal */
30
+ export const PropertySecuritiesRef = Symbol("Property Securities");
28
31
  //# sourceMappingURL=InternalSymbols.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","ClientRef"],"sources":["InternalSymbols.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\";\n\n/** @internal */\nexport const UnderlyingOsdkObject = Symbol(\n process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined,\n);\n\n/** @internal */\nexport const ObjectDefRef = Symbol(\n process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined,\n);\n\n/** @internal */\nexport const InterfaceDefRef = Symbol(\n process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined,\n);\n\n/** @internal */\nexport const ClientRef = Symbol(\n process.env.MODE !== \"production\" ? \"ClientRef\" : undefined,\n);\n\nexport interface HolderBase<T extends ObjectOrInterfaceDefinition> {\n [UnderlyingOsdkObject]: OsdkBase<any>;\n [ObjectDefRef]?: T;\n [InterfaceDefRef]?: T;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CACJ,mBACtC,CAAC;;AAED;AACA,OAAO,MAAMC,YAAY,GAAGD,MAAM,CACI,kBACtC,CAAC;;AAED;AACA,OAAO,MAAME,eAAe,GAAGF,MAAM,CACC,qBACtC,CAAC;;AAED;AACA,OAAO,MAAMG,SAAS,GAAGH,MAAM,CACO,WACtC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","ClientRef","PropertySecuritiesRef"],"sources":["InternalSymbols.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 type { PropertySecurities } from \"@osdk/foundry.ontologies\";\n\n/** @internal */\nexport const UnderlyingOsdkObject = Symbol(\n process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined,\n);\n\n/** @internal */\nexport const ObjectDefRef = Symbol(\n process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined,\n);\n\n/** @internal */\nexport const InterfaceDefRef = Symbol(\n process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined,\n);\n\n/** @internal */\nexport const ClientRef = Symbol(\n process.env.MODE !== \"production\" ? \"ClientRef\" : undefined,\n);\n\n/** @internal */\nexport const PropertySecuritiesRef = Symbol(\n process.env.MODE !== \"production\" ? \"Property Securities\" : undefined,\n);\n\nexport interface HolderBase<T extends ObjectOrInterfaceDefinition> {\n [UnderlyingOsdkObject]: OsdkBase<any>;\n [ObjectDefRef]?: T;\n [InterfaceDefRef]?: T;\n [PropertySecuritiesRef]?: PropertySecurities[];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CACJ,mBACtC,CAAC;;AAED;AACA,OAAO,MAAMC,YAAY,GAAGD,MAAM,CACI,kBACtC,CAAC;;AAED;AACA,OAAO,MAAME,eAAe,GAAGF,MAAM,CACC,qBACtC,CAAC;;AAED;AACA,OAAO,MAAMG,SAAS,GAAGH,MAAM,CACO,WACtC,CAAC;;AAED;AACA,OAAO,MAAMI,qBAAqB,GAAGJ,MAAM,CACL,qBACtC,CAAC","ignoreList":[]}
@@ -57,6 +57,10 @@ export function createOsdkInterface(underlying, interfaceDef) {
57
57
  value: clone,
58
58
  enumerable: false
59
59
  },
60
+ "$propertySecurities": {
61
+ value: underlying.$propertySecurities,
62
+ enumerable: "$propertySecurities" in underlying
63
+ },
60
64
  "$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata": {
61
65
  value: {
62
66
  "ObjectMetadata": underlying[ObjectDefRef],
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","get$linkForInterface","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$objectSpecifier","$title","$rid","clone","$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue","get","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/extractNamespace.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { get$linkForInterface } from \"./getDollarLink.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 \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n value: {\n \"ObjectMetadata\": underlying[ObjectDefRef],\n \"InterfaceMetadata\": interfaceDef,\n },\n enumerable: false,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue\": {\n value: underlying.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue,\n enumerable: false,\n },\n\n \"$link\": {\n get: function(this: InterfaceHolder) {\n return get$linkForInterface(this);\n },\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 }\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AAM,CAACe,IAAI,CAACQ,MAAM,CAAC,EAAE;MACrC,IAAI,EAAEE,GAAG,IAAI5B,YAAY,CAACmB,UAAU,CAAC,EAAE;QACrC,MAAM,IAAIU,KAAK,CACb,oBAAoBD,GAAG,kBAAkB5B,YAAY,CAACE,OAAO,EAC/D,CAAC;MACH;IACF;IAEA,MAAM4B,aAAa,GAAG3B,MAAM,CAACc,WAAW,CACtCd,MAAM,CAACe,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,OAAOlC,UAAU,CAAC4B,MAAM,CAACG,aAAa,CAAC,CAACtB,GAAG,CAACR,YAAY,CAAC;EAC3D;EACA,SAAS+B,WAAWA,CAACG,YAAoB,EAAE5B,KAAU,EAAE;IACrD,MAAMgB,MAAM,GAAGvB,UAAU,CAACH,YAAY,CAAC;IACvC,MAAM4B,cAAc,GAClBF,MAAM,CAACG,YAAY,CAAEzB,YAAY,CAACE,OAAO,CAAC,CAACgC,YAAY,CAAC;IAC1D;IACA,IAAIV,cAAc,IAAI,IAAI,EAAE;MAC1B,MAAM,IAAIK,KAAK,CACb,+BAA+BK,YAAY,iEAAiEZ,MAAM,CAACpB,OAAO,EAC5H,CAAC;IACH;IACA,OAAO,CAACsB,cAAc,EAAElB,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkInterface.js","names":["extractNamespace","get$linkForInterface","InterfaceDefRef","ObjectDefRef","UnderlyingOsdkObject","createOsdkInterface","underlying","interfaceDef","objApiNamespace","apiName","Object","freeze","defineProperties","value","enumerable","$as","$objectType","$primaryKey","$objectSpecifier","$title","$rid","clone","$propertySecurities","$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue","get","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/extractNamespace.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { get$linkForInterface } from \"./getDollarLink.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 \"$propertySecurities\": {\n value: underlying.$propertySecurities,\n enumerable: \"$propertySecurities\" in underlying,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n value: {\n \"ObjectMetadata\": underlying[ObjectDefRef],\n \"InterfaceMetadata\": interfaceDef,\n },\n enumerable: false,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue\": {\n value: underlying.$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue,\n enumerable: false,\n },\n\n \"$link\": {\n get: function(this: InterfaceHolder) {\n return get$linkForInterface(this);\n },\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,gDAAgD;AAEjF,SAASC,oBAAoB,QAAQ,oBAAoB;AAEzD,SACEC,eAAe,EACfC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B;AACA,OAAO,SAASC,mBAAmBA,CAGjCC,UAAwB,EACxBC,YAA+B,EACd;EACjB,MAAM,CAACC,eAAe,CAAC,GAAGR,gBAAgB,CAACO,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,EAAE,QAAQ,IAAIR;IAC1B,CAAC;IACD,MAAM,EAAE;MACNO,KAAK,EAAGP,UAAU,CAASc,IAAI;MAC/BN,UAAU,EAAE,MAAM,IAA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IAAI,IAAI,EAAE;MAClB,OAAO5B,UAAU,CAAC6B,MAAM,CAAC,CAAC,CAACpB,GAAG,CAACR,YAAY,CAAC;IAC9C;IAEA,KAAK,MAAM6B,GAAG,IAAI1B,MAAM,CAACgB,IAAI,CAACQ,MAAM,CAAC,EAAE;MACrC,IAAI,EAAEE,GAAG,IAAI7B,YAAY,CAACoB,UAAU,CAAC,EAAE;QACrC,MAAM,IAAIU,KAAK,CACb,oBAAoBD,GAAG,kBAAkB7B,YAAY,CAACE,OAAO,EAC/D,CAAC;MACH;IACF;IAEA,MAAM6B,aAAa,GAAG5B,MAAM,CAACe,WAAW,CACtCf,MAAM,CAACgB,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,OAAOnC,UAAU,CAAC6B,MAAM,CAACG,aAAa,CAAC,CAACvB,GAAG,CAACR,YAAY,CAAC;EAC3D;EACA,SAASgC,WAAWA,CAACG,YAAoB,EAAE7B,KAAU,EAAE;IACrD,MAAMiB,MAAM,GAAGxB,UAAU,CAACH,YAAY,CAAC;IACvC,MAAM6B,cAAc,GAClBF,MAAM,CAACG,YAAY,CAAE1B,YAAY,CAACE,OAAO,CAAC,CAACiC,YAAY,CAAC;IAC1D;IACA,IAAIV,cAAc,IAAI,IAAI,EAAE;MAC1B,MAAM,IAAIK,KAAK,CACb,+BAA+BK,YAAY,iEAAiEZ,MAAM,CAACrB,OAAO,EAC5H,CAAC;IACH;IACA,OAAO,CAACuB,cAAc,EAAEnB,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
@@ -23,7 +23,7 @@ import { createObjectSpecifierFromPrimaryKey } from "../../util/objectSpecifierU
23
23
  import { applyPropertyFormatter } from "../formatting/applyPropertyFormatter.js";
24
24
  import { get$as } from "./getDollarAs.js";
25
25
  import { get$link } from "./getDollarLink.js";
26
- import { ClientRef, ObjectDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
26
+ import { ClientRef, ObjectDefRef, PropertySecuritiesRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
27
27
  const specialPropertyTypes = new Set(["attachment", "geotimeSeriesReference", "mediaReference", "numericTimeseries", "stringTimeseries", "sensorTimeseries"]);
28
28
 
29
29
  // kept separate so we are not redefining these functions
@@ -69,6 +69,12 @@ const basePropDefs = {
69
69
  },
70
70
  enumerable: true
71
71
  },
72
+ "$propertySecurities": {
73
+ get: function () {
74
+ return this[PropertySecuritiesRef];
75
+ },
76
+ enumerable: true
77
+ },
72
78
  "$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata": {
73
79
  get: function () {
74
80
  return {
@@ -94,14 +100,23 @@ const basePropDefs = {
94
100
  * @param objectDef
95
101
  * @param simpleOsdkProperties
96
102
  */
97
- export function createOsdkObject(client, objectDef, simpleOsdkProperties, derivedPropertyTypeByName = {}) {
103
+ export function createOsdkObject(client, objectDef, simpleOsdkProperties, derivedPropertyTypeByName = {}, wirePropertySecurities = []) {
104
+ const {
105
+ parsedObject,
106
+ clientPropertySecurities
107
+ } = parseWhenSecuritiesLoaded(wirePropertySecurities, simpleOsdkProperties, objectDef, derivedPropertyTypeByName);
108
+
98
109
  // updates the object's "hidden class/map".
99
- const rawObj = simpleOsdkProperties;
110
+ const rawObj = parsedObject;
100
111
  Object.defineProperties(rawObj, {
101
112
  [UnderlyingOsdkObject]: {
102
113
  enumerable: false,
103
114
  value: simpleOsdkProperties
104
115
  },
116
+ [PropertySecuritiesRef]: {
117
+ enumerable: false,
118
+ value: clientPropertySecurities
119
+ },
105
120
  [ObjectDefRef]: {
106
121
  value: objectDef,
107
122
  enumerable: false
@@ -179,4 +194,71 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
179
194
  });
180
195
  }
181
196
  }
197
+ function parseWhenSecuritiesLoaded(wirePropertySecurities, rawObject, objectDef, derivedPropertyTypeByName = {}) {
198
+ if (wirePropertySecurities == null || wirePropertySecurities.length === 0) {
199
+ return {
200
+ parsedObject: rawObject,
201
+ clientPropertySecurities: undefined
202
+ };
203
+ }
204
+ const parsedObject = {
205
+ ...rawObject
206
+ };
207
+ const clientPropertySecurities = {};
208
+ for (const propKey of Object.keys(rawObject)) {
209
+ if (propKey in objectDef.properties || propKey in derivedPropertyTypeByName) {
210
+ const value = rawObject[propKey];
211
+ if (Array.isArray(value)) {
212
+ const newVal = [];
213
+ const newSecurities = [];
214
+ value.forEach(spv => {
215
+ !(typeof spv === "object" && spv != null && "value" in spv && "propertySecurityIndex" in spv) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected destructured secured property value object in array") : invariant(false) : void 0;
216
+ const securedValue = spv;
217
+ newVal.push(securedValue.value);
218
+ const securityIndex = securedValue.propertySecurityIndex;
219
+ !(securityIndex != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected property security index to be defined") : invariant(false) : void 0;
220
+ !(securityIndex < wirePropertySecurities.length) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected property security index to be within bounds") : invariant(false) : void 0;
221
+ newSecurities.push(wirePropertySecurities[securityIndex].disjunction.map(wireToClientPropertySecurities));
222
+ });
223
+ parsedObject[propKey] = newVal;
224
+ clientPropertySecurities[propKey] = newSecurities;
225
+ } // Check if this is a secured property value object
226
+ else if (typeof value === "object" && value != null && "value" in value && "propertySecurityIndex" in value) {
227
+ const securedValue = value;
228
+ parsedObject[propKey] = securedValue.value;
229
+ const securityIndex = securedValue.propertySecurityIndex;
230
+ !(securityIndex != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected property security index to be defined") : invariant(false) : void 0;
231
+ !(securityIndex < wirePropertySecurities.length) ? process.env.NODE_ENV !== "production" ? invariant(false, "Expected property security index to be within bounds") : invariant(false) : void 0;
232
+ clientPropertySecurities[propKey] = wirePropertySecurities[securityIndex].disjunction.map(wireToClientPropertySecurities);
233
+ } else {
234
+ // Regular property without security
235
+ parsedObject[propKey] = value;
236
+ }
237
+ }
238
+ }
239
+ return {
240
+ parsedObject,
241
+ clientPropertySecurities
242
+ };
243
+ }
244
+ function wireToClientPropertySecurities(propertySecurity) {
245
+ switch (propertySecurity.type) {
246
+ case "propertyMarkingSummary":
247
+ return {
248
+ type: "propertyMarkings",
249
+ conjunctive: propertySecurity.conjunctive,
250
+ containerConjunctive: propertySecurity.containerConjunctive,
251
+ disjunctive: propertySecurity.disjunctive,
252
+ containerDisjunctive: propertySecurity.containerDisjunctive
253
+ };
254
+ case "errorComputingSecurity":
255
+ return {
256
+ type: "errorComputingSecurity"
257
+ };
258
+ case "unsupportedPolicy":
259
+ return {
260
+ type: "unsupportedPolicy"
261
+ };
262
+ }
263
+ }
182
264
  //# sourceMappingURL=createOsdkObject.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","createObjectSpecifierFromPrimaryKey","applyPropertyFormatter","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","$primaryKey","enumerable","ObjectMetadata","propertyApiName","options","propertyValue","properties","client","objectDef","simpleOsdkProperties","derivedPropertyTypeByName","Object","defineProperties","propKey","keys","type","has","createSpecialProperty","modifyRdpProperties","freeze","rawValue","definition","operation","num","Number","isSafeInteger","process","env","NODE_ENV","selectedOrCollectedPropertyType","Array","isArray","map","a","rid","rawObject","p","propDef","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName","mediaReference"],"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 { MediaReference } from \"@osdk/foundry.core\";\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 { DerivedPropertyRuntimeMetadata } from \"../../derivedProperties/derivedPropertyRuntimeMetadata.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 {\n applyPropertyFormatter,\n type FormatPropertyOptions,\n} from \"../formatting/applyPropertyFormatter.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 \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n get: function(this: ObjectHolder) {\n return {\n ObjectMetadata: this[ObjectDefRef],\n };\n },\n enumerable: false,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue\": {\n value: function(\n this: ObjectHolder,\n propertyApiName: string,\n options?: FormatPropertyOptions,\n ): string | undefined {\n const rawObj = this[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const def = this[ObjectDefRef];\n const propertyValue = rawObj[propertyApiName];\n\n return applyPropertyFormatter(\n propertyValue,\n def.properties[propertyApiName],\n rawObj,\n options,\n );\n },\n enumerable: false,\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: DerivedPropertyRuntimeMetadata = {},\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 }, // TODO: Potentially update when GA metadata field\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 (propKey in derivedPropertyTypeByName) {\n rawObj[propKey] = modifyRdpProperties(\n client,\n derivedPropertyTypeByName,\n rawObj[propKey],\n propKey,\n );\n }\n }\n\n return Object.freeze(rawObj);\n}\n\nfunction modifyRdpProperties(\n client: MinimalClient,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n rawValue: any,\n propKey: string,\n): any {\n if (\n derivedPropertyTypeByName[propKey].definition.type === \"selection\"\n && derivedPropertyTypeByName[propKey].definition.operation.type\n === \"count\"\n ) {\n const num = Number(rawValue);\n invariant(\n Number.isSafeInteger(num),\n \"Count aggregation for derived property \" + propKey\n + \" returned a value larger than safe integer.\",\n );\n return num;\n } // Selected or collected properties need to be deserialized specially when constructed with RDP\n else if (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n != null\n && typeof (derivedPropertyTypeByName[propKey]\n .selectedOrCollectedPropertyType.type)\n === \"string\"\n && specialPropertyTypes.has(\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n .type,\n )\n ) {\n switch (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n ?.type\n ) {\n case \"attachment\":\n if (Array.isArray(rawValue)) {\n return rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n } else {\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n break;\n default:\n invariant(\n false,\n \"Derived property aggregations for Timeseries and Media are not supported\",\n );\n }\n }\n return rawValue;\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 mediaReference: rawValue as MediaReference,\n });\n }\n}\n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yB,CAClCiC,MAAM,EACNC,SAAS,CAACZ,OAAO,EACjBuC,SAAS,CAAC3B,SAAS,CAACd,iBAAiB,CAAW,EAChD0C,CAAC,EACAhB,QAAQ,CAAoBL,IAAI,KAAK,oBAAoB,GACtD;MACAuB,IAAI,EAAGlB,QAAQ,CAAoBmB,SAAS;MAC5ClD,KAAK,EAAE;QACL0B,IAAI,EAAE,OAAO;QACbyB,WAAW,EAAGpB,QAAQ,CAAoBqB;MAC5C;IACF,CAAC,GACCC,SACN,CAAC;EACH;EACA,IAAIL,OAAO,CAACtB,IAAI,KAAK,gBAAgB,EAAE;IACrC,OAAO,IAAIxC,0BAA0B,CAAC;MACpCgC,MAAM;MACNoC,aAAa,EAAEnC,SAAS,CAACZ,OAAO;MAChCgD,UAAU,EAAET,SAAS,CAAC3B,SAAS,CAACd,iBAAiB,CAAW;MAC5DmD,YAAY,EAAET,CAAW;MACzBU,cAAc,EAAE1B;IAClB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","createObjectSpecifierFromPrimaryKey","applyPropertyFormatter","get$as","get$link","ClientRef","ObjectDefRef","PropertySecuritiesRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","$primaryKey","enumerable","ObjectMetadata","propertyApiName","options","propertyValue","properties","client","objectDef","simpleOsdkProperties","derivedPropertyTypeByName","wirePropertySecurities","parsedObject","clientPropertySecurities","parseWhenSecuritiesLoaded","Object","defineProperties","propKey","keys","type","has","createSpecialProperty","modifyRdpProperties","freeze","rawValue","definition","operation","num","Number","isSafeInteger","process","env","NODE_ENV","selectedOrCollectedPropertyType","Array","isArray","map","a","rid","rawObject","p","propDef","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName","mediaReference","length","newVal","newSecurities","forEach","spv","securedValue","push","securityIndex","propertySecurityIndex","disjunction","wireToClientPropertySecurities","propertySecurity","conjunctive","containerConjunctive","disjunctive","containerDisjunctive"],"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 { PropertySecurity } from \"@osdk/api\";\nimport type { MediaReference } from \"@osdk/foundry.core\";\nimport type {\n Attachment,\n PropertySecurities,\n PropertySecurity as WirePropertySecurity,\n ReferenceValue,\n SecuredPropertyValue,\n} 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 { DerivedPropertyRuntimeMetadata } from \"../../derivedProperties/derivedPropertyRuntimeMetadata.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 {\n applyPropertyFormatter,\n type FormatPropertyOptions,\n} from \"../formatting/applyPropertyFormatter.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 PropertySecuritiesRef,\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 \"$propertySecurities\": {\n get: function(this: ObjectHolder) {\n return this[PropertySecuritiesRef];\n },\n enumerable: true,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__metadata\": {\n get: function(this: ObjectHolder) {\n return {\n ObjectMetadata: this[ObjectDefRef],\n };\n },\n enumerable: false,\n },\n \"$__EXPERIMENTAL__NOT_SUPPORTED_YET__getFormattedValue\": {\n value: function(\n this: ObjectHolder,\n propertyApiName: string,\n options?: FormatPropertyOptions,\n ): string | undefined {\n const rawObj = this[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const def = this[ObjectDefRef];\n const propertyValue = rawObj[propertyApiName];\n\n return applyPropertyFormatter(\n propertyValue,\n def.properties[propertyApiName],\n rawObj,\n options,\n );\n },\n enumerable: false,\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: DerivedPropertyRuntimeMetadata = {},\n wirePropertySecurities: PropertySecurities[] | undefined = [],\n): ObjectHolder {\n const { parsedObject, clientPropertySecurities } = parseWhenSecuritiesLoaded(\n wirePropertySecurities,\n simpleOsdkProperties,\n objectDef,\n derivedPropertyTypeByName,\n );\n\n // updates the object's \"hidden class/map\".\n const rawObj = parsedObject as ObjectHolder;\n Object.defineProperties(\n rawObj,\n {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: simpleOsdkProperties,\n },\n [PropertySecuritiesRef]: {\n enumerable: false,\n value: clientPropertySecurities,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false }, // TODO: Potentially update when GA metadata field\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 (propKey in derivedPropertyTypeByName) {\n rawObj[propKey] = modifyRdpProperties(\n client,\n derivedPropertyTypeByName,\n rawObj[propKey],\n propKey,\n );\n }\n }\n\n return Object.freeze(rawObj);\n}\n\nfunction modifyRdpProperties(\n client: MinimalClient,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n rawValue: any,\n propKey: string,\n): any {\n if (\n derivedPropertyTypeByName[propKey].definition.type === \"selection\"\n && derivedPropertyTypeByName[propKey].definition.operation.type\n === \"count\"\n ) {\n const num = Number(rawValue);\n invariant(\n Number.isSafeInteger(num),\n \"Count aggregation for derived property \" + propKey\n + \" returned a value larger than safe integer.\",\n );\n return num;\n } // Selected or collected properties need to be deserialized specially when constructed with RDP\n else if (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n != null\n && typeof (derivedPropertyTypeByName[propKey]\n .selectedOrCollectedPropertyType.type)\n === \"string\"\n && specialPropertyTypes.has(\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n .type,\n )\n ) {\n switch (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n ?.type\n ) {\n case \"attachment\":\n if (Array.isArray(rawValue)) {\n return rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n } else {\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n break;\n default:\n invariant(\n false,\n \"Derived property aggregations for Timeseries and Media are not supported\",\n );\n }\n }\n return rawValue;\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 mediaReference: rawValue as MediaReference,\n });\n }\n}\n\nfunction parseWhenSecuritiesLoaded(\n wirePropertySecurities: PropertySecurities[] | undefined,\n rawObject: SimpleOsdkProperties,\n objectDef: FetchedObjectTypeDefinition,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata = {},\n): {\n parsedObject: SimpleOsdkProperties;\n clientPropertySecurities:\n | { [propName: string]: PropertySecurity[] | PropertySecurity[][] }\n | undefined;\n} {\n if (wirePropertySecurities == null || wirePropertySecurities.length === 0) {\n return { parsedObject: rawObject, clientPropertySecurities: undefined };\n }\n\n const parsedObject: SimpleOsdkProperties = { ...rawObject };\n const clientPropertySecurities: {\n [propName: string]: PropertySecurity[] | PropertySecurity[][];\n } = {};\n\n for (const propKey of Object.keys(rawObject)) {\n if (\n propKey in objectDef.properties || propKey in derivedPropertyTypeByName\n ) {\n const value = rawObject[propKey];\n\n if (Array.isArray(value)) {\n const newVal: any[] = [];\n const newSecurities: PropertySecurity[][] = [];\n value.forEach(spv => {\n invariant(\n typeof spv === \"object\"\n && spv != null\n && \"value\" in spv\n && \"propertySecurityIndex\" in spv,\n \"Expected destructured secured property value object in array\",\n );\n const securedValue = spv as SecuredPropertyValue;\n newVal.push(securedValue.value);\n const securityIndex = securedValue.propertySecurityIndex;\n invariant(\n securityIndex != null,\n \"Expected property security index to be defined\",\n );\n invariant(\n securityIndex < wirePropertySecurities.length,\n \"Expected property security index to be within bounds\",\n );\n newSecurities.push(\n wirePropertySecurities[securityIndex].disjunction\n .map(wireToClientPropertySecurities),\n );\n });\n parsedObject[propKey] = newVal;\n clientPropertySecurities[propKey] = newSecurities;\n } // Check if this is a secured property value object\n else if (\n typeof value === \"object\"\n && value != null\n && \"value\" in value\n && \"propertySecurityIndex\" in value\n ) {\n const securedValue = value as SecuredPropertyValue;\n parsedObject[propKey] = securedValue.value;\n\n const securityIndex = securedValue.propertySecurityIndex;\n invariant(\n securityIndex != null,\n \"Expected property security index to be defined\",\n );\n invariant(\n securityIndex < wirePropertySecurities.length,\n \"Expected property security index to be within bounds\",\n );\n clientPropertySecurities[propKey] =\n wirePropertySecurities[securityIndex].disjunction\n .map(wireToClientPropertySecurities);\n } else {\n // Regular property without security\n parsedObject[propKey] = value;\n }\n }\n }\n\n return { parsedObject, clientPropertySecurities };\n}\n\nfunction wireToClientPropertySecurities(\n propertySecurity: WirePropertySecurity,\n): PropertySecurity {\n switch (propertySecurity.type) {\n case \"propertyMarkingSummary\":\n return {\n type: \"propertyMarkings\",\n conjunctive: propertySecurity.conjunctive,\n containerConjunctive: propertySecurity.containerConjunctive,\n disjunctive: propertySecurity.disjunctive,\n containerDisjunctive: propertySecurity.containerDisjunctive,\n };\n case \"errorComputingSecurity\":\n return { type: \"errorComputingSecurity\" };\n case \"unsupportedPolicy\":\n return { type: \"unsupportedPolicy\" };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,OAAOA,SAA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OAAO;QAAEA,IAAI,EAAE;MAAoB,CAAC;EACxC;AACF","ignoreList":[]}
@@ -32,7 +32,7 @@ import { createOsdkObject } from "./convertWireToOsdkObjects/createOsdkObject.js
32
32
  * @internal
33
33
  * @param interfaceApiName - if undefined
34
34
  */
35
- export async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, derivedPropertyTypesByName, selectedProps, strictNonNull = false) {
35
+ export async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, derivedPropertyTypesByName, propertySecurities, selectedProps, strictNonNull = false) {
36
36
  // remove the __ prefixed properties and convert them to $ prefixed.
37
37
  // updates in place
38
38
  fixObjectPropertiesInPlace(objects, forceRemoveRid);
@@ -61,7 +61,7 @@ export async function convertWireToOsdkObjects(client, objects, interfaceApiName
61
61
  } else if (strictNonNull === "drop" && !conforming) {
62
62
  continue;
63
63
  }
64
- let osdkObject = createOsdkObject(client, objectDef, rawObj, derivedPropertyTypesByName);
64
+ let osdkObject = createOsdkObject(client, objectDef, rawObj, derivedPropertyTypesByName, propertySecurities);
65
65
  if (interfaceApiName) osdkObject = osdkObject.$as(interfaceApiName);
66
66
  ret.push(osdkObject);
67
67
  }
@@ -70,7 +70,7 @@ export async function convertWireToOsdkObjects(client, objects, interfaceApiName
70
70
  /**
71
71
  * @internal
72
72
  */
73
- export async function convertWireToOsdkObjects2(client, objects, interfaceApiName, derivedPropertyTypeByName, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}, interfaceToObjectTypeMappingsV2 = {}) {
73
+ export async function convertWireToOsdkObjects2(client, objects, interfaceApiName, derivedPropertyTypeByName, propertySecurities, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}, interfaceToObjectTypeMappingsV2 = {}) {
74
74
  fixObjectPropertiesInPlace(objects, forceRemoveRid);
75
75
 
76
76
  // prefer V2 mappings if non-empty, otherwise fall back to V1
@@ -100,7 +100,7 @@ export async function convertWireToOsdkObjects2(client, objects, interfaceApiNam
100
100
  } else if (strictNonNull === "drop" && !conforming) {
101
101
  continue;
102
102
  }
103
- let osdkObject = createOsdkObject(client, objectDef, rawObj, derivedPropertyTypeByName);
103
+ let osdkObject = createOsdkObject(client, objectDef, rawObj, derivedPropertyTypeByName, propertySecurities);
104
104
  if (interfaceApiName && isInterfaceScoped) osdkObject = osdkObject.$as(interfaceApiName);
105
105
  ret.push(osdkObject);
106
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","derivedPropertyTypesByName","selectedProps","strictNonNull","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","process","env","NODE_ENV","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","convertWireToOsdkObjects2","derivedPropertyTypeByName","interfaceToObjectTypeMappings","interfaceToObjectTypeMappingsV2","effectiveMappings","length","convertInterfaceToObjectTypeMappingsV2ToV1","isInterfaceScoped","interfaceToObjMapping","filter","val","includes","values","primaryKeyApiName","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","$primaryKey","def","obj","propsToCheck","propName","nullable","logger","debug","$objectType","warning","warn","console","error","objs","__rid","$rid","__score","$score","__apiName","__primaryKey","$title","__title","mappingsV2","fromEntries","objectTypeMappingsV2","objectTypeName","propertyMappings","impl","type","interfaceProp","propertyApiName"],"sources":["convertWireToOsdkObjects.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n InterfaceMetadata,\n NullabilityAdherence,\n ObjectMetadata,\n} from \"@osdk/api\";\nimport type {\n InterfacePropertyLocalPropertyImplementation,\n InterfaceToObjectTypeMappings,\n InterfaceToObjectTypeMappingsV2,\n InterfaceTypeApiName,\n OntologyObjectV2,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n type FetchedObjectTypeDefinition,\n} from \"../ontology/OntologyProvider.js\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\nimport type { InterfaceHolder } from \"./convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"./convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { SimpleOsdkProperties } from \"./SimpleOsdkProperties.js\";\n\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n forceRemoveRid: boolean = false,\n derivedPropertyTypesByName: DerivedPropertyRuntimeMetadata,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n // remove the __ prefixed properties and convert them to $ prefixed.\n // updates in place\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n rawObj.$apiName,\n );\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n\n objProps = convertInterfacePropNamesToObjectPropNames(\n objectDef,\n ifaceDef.apiName,\n ifaceSelected,\n );\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\",\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypesByName,\n );\n if (interfaceApiName) osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n): Promise<Array<InterfaceHolder>>;\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n): Promise<Array<ObjectHolder>>;\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n): Promise<Array<ObjectHolder | InterfaceHolder>>;\n/**\n * @internal\n */\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n forceRemoveRid: boolean = false,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n interfaceToObjectTypeMappings: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n > = {},\n interfaceToObjectTypeMappingsV2: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n > = {},\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n // prefer V2 mappings if non-empty, otherwise fall back to V1\n const effectiveMappings =\n Object.keys(interfaceToObjectTypeMappingsV2).length > 0\n ? convertInterfaceToObjectTypeMappingsV2ToV1(\n interfaceToObjectTypeMappingsV2,\n )\n : interfaceToObjectTypeMappings;\n\n const isInterfaceScoped = Object.keys(effectiveMappings).length > 0;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n rawObj.$apiName,\n );\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n const interfaceToObjMapping = (interfaceApiName && isInterfaceScoped)\n ? effectiveMappings[interfaceApiName as InterfaceTypeApiName][\n rawObj.$apiName\n ]\n : undefined;\n\n const ifaceSelected = interfaceApiName && interfaceToObjMapping\n ? (selectedProps\n ? Object.keys(interfaceToObjMapping).filter(\n val => {\n selectedProps?.includes(interfaceToObjMapping[val]);\n },\n )\n : [\n ...Object.values(interfaceToObjMapping),\n objectDef.primaryKeyApiName,\n ])\n : undefined;\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (interfaceApiName && ifaceSelected) {\n invariantInterfacesAsViews(objectDef, interfaceApiName, client);\n\n objProps = ifaceSelected;\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\",\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypeByName,\n );\n if (\n interfaceApiName && isInterfaceScoped\n ) osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\n/**\n * @internal\n *\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nexport function convertInterfacePropNamesToObjectPropNames(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n ifacePropsToMap: readonly string[],\n): string[] {\n return ifacePropsToMap.map((ifaceProp) =>\n objectDef.interfaceMap[interfaceApiName][ifaceProp]\n );\n}\n\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n rawObj: OntologyObjectV2,\n) {\n const newProps: Record<string, any> = {};\n for (\n const [sptProp, regularProp] of Object.entries(\n objectDef.interfaceMap[interfaceApiName],\n )\n ) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\n\nfunction isConforming(\n client: MinimalClient,\n def:\n | InterfaceMetadata\n | ObjectMetadata,\n obj: OntologyObjectV2,\n propsToCheck: readonly string[],\n) {\n for (const propName of propsToCheck) {\n if (\n propName in def.properties && def.properties[propName].nullable === false\n && obj[propName] == null\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n client.logger?.debug(\n {\n obj: {\n $apiName: obj[\"$apiName\"],\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n },\n `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`,\n );\n }\n return false;\n }\n }\n return true;\n}\n\nfunction invariantInterfacesAsViews(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n client: MinimalClient,\n): asserts objectDef is typeof objectDef & { interfaceMap: {} } {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning =\n \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n } else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\n\nfunction fixObjectPropertiesInPlace(\n objs: OntologyObjectV2[],\n forceRemoveRid: boolean,\n): asserts objs is SimpleOsdkProperties[] {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n\n if (obj.__score) {\n obj.$score = obj.__score;\n delete obj.__score;\n }\n\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName ??= obj.__apiName;\n\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.$apiName;\n\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey ??= obj.__primaryKey;\n obj.$title ??= obj.__title;\n\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\n }\n}\n\n/**\n * Converts interfaceToObjectTypeMappingsV2 format to the V1 format.\n * V2 format: { interfaceProp: { type: \"localPropertyImplementation\", propertyApiName: \"objectProp\" } }\n * V1 format: { interfaceProp: \"objectProp\" }\n */\nfunction convertInterfaceToObjectTypeMappingsV2ToV1(\n mappingsV2: Record<InterfaceTypeApiName, InterfaceToObjectTypeMappingsV2>,\n): Record<InterfaceTypeApiName, InterfaceToObjectTypeMappings> {\n return Object.fromEntries(\n Object.entries(mappingsV2).map((\n [interfaceApiName, objectTypeMappingsV2],\n ) => [\n interfaceApiName,\n Object.fromEntries(\n Object.entries(objectTypeMappingsV2).map((\n [objectTypeName, propertyMappings],\n ) => [\n objectTypeName,\n Object.fromEntries(\n Object.entries(propertyMappings)\n .filter(([, impl]) => impl.type === \"localPropertyImplementation\")\n .map((\n [interfaceProp, impl],\n ) => [\n interfaceProp,\n (impl as InterfacePropertyLocalPropertyImplementation)\n .propertyApiName,\n ]),\n ),\n ]),\n ),\n ]),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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CAAC,CAACjC,GAAG,CAAC,CACvC,CAACkC,cAAc,EAAEC,gBAAgB,CAAC,KAC/B,CACHD,cAAc,EACdvE,MAAM,CAACqE,WAAW,CAChBrE,MAAM,CAAC2C,OAAO,CAAC6B,gBAAgB,CAAC,CAC7BzC,MAAM,CAAC,CAAC,GAAG0C,IAAI,CAAC,KAAKA,IAAI,CAACC,IAAI,KAAK,6BAA6B,CAAC,CACjErC,GAAG,CAAC,CACH,CAACsC,aAAa,EAAEF,IAAI,CAAC,KAClB,CACHE,aAAa,EACZF,IAAI,CACFG,eAAe,CACnB,CACL,CAAC,CACF,CACH,CAAC,CACF,CACH,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","derivedPropertyTypesByName","propertySecurities","selectedProps","strictNonNull","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","process","env","NODE_ENV","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","convertWireToOsdkObjects2","derivedPropertyTypeByName","interfaceToObjectTypeMappings","interfaceToObjectTypeMappingsV2","effectiveMappings","length","convertInterfaceToObjectTypeMappingsV2ToV1","isInterfaceScoped","interfaceToObjMapping","filter","val","includes","values","primaryKeyApiName","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","$primaryKey","def","obj","propsToCheck","propName","nullable","logger","debug","$objectType","warning","warn","console","error","objs","__rid","$rid","__score","$score","__apiName","__primaryKey","$title","__title","mappingsV2","fromEntries","objectTypeMappingsV2","objectTypeName","propertyMappings","impl","type","interfaceProp","propertyApiName"],"sources":["convertWireToOsdkObjects.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n InterfaceMetadata,\n NullabilityAdherence,\n ObjectMetadata,\n} from \"@osdk/api\";\nimport type {\n InterfacePropertyLocalPropertyImplementation,\n InterfaceToObjectTypeMappings,\n InterfaceToObjectTypeMappingsV2,\n InterfaceTypeApiName,\n OntologyObjectV2,\n PropertySecurities,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n type FetchedObjectTypeDefinition,\n} from \"../ontology/OntologyProvider.js\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\nimport type { InterfaceHolder } from \"./convertWireToOsdkObjects/InterfaceHolder.js\";\nimport type { ObjectHolder } from \"./convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { SimpleOsdkProperties } from \"./SimpleOsdkProperties.js\";\n\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n forceRemoveRid: boolean = false,\n derivedPropertyTypesByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n // remove the __ prefixed properties and convert them to $ prefixed.\n // updates in place\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n rawObj.$apiName,\n );\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n\n objProps = convertInterfacePropNamesToObjectPropNames(\n objectDef,\n ifaceDef.apiName,\n ifaceSelected,\n );\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\",\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypesByName,\n propertySecurities,\n );\n if (interfaceApiName) osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n): Promise<Array<InterfaceHolder>>;\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n): Promise<Array<ObjectHolder>>;\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid?: boolean,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull?: NullabilityAdherence,\n interfaceToObjectTypeMappings?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n >,\n interfaceToObjectTypeMappingsV2?: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n >,\n): Promise<Array<ObjectHolder | InterfaceHolder>>;\n/**\n * @internal\n */\nexport async function convertWireToOsdkObjects2(\n client: MinimalClient,\n objects: OntologyObjectV2[],\n interfaceApiName: string | undefined,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n propertySecurities: PropertySecurities[] | undefined,\n forceRemoveRid: boolean = false,\n selectedProps?: ReadonlyArray<string>,\n strictNonNull: NullabilityAdherence = false,\n interfaceToObjectTypeMappings: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappings\n > = {},\n interfaceToObjectTypeMappingsV2: Record<\n InterfaceTypeApiName,\n InterfaceToObjectTypeMappingsV2\n > = {},\n): Promise<Array<ObjectHolder | InterfaceHolder>> {\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n\n // prefer V2 mappings if non-empty, otherwise fall back to V1\n const effectiveMappings =\n Object.keys(interfaceToObjectTypeMappingsV2).length > 0\n ? convertInterfaceToObjectTypeMappingsV2ToV1(\n interfaceToObjectTypeMappingsV2,\n )\n : interfaceToObjectTypeMappings;\n\n const isInterfaceScoped = Object.keys(effectiveMappings).length > 0;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(\n rawObj.$apiName,\n );\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n\n const interfaceToObjMapping = (interfaceApiName && isInterfaceScoped)\n ? effectiveMappings[interfaceApiName as InterfaceTypeApiName][\n rawObj.$apiName\n ]\n : undefined;\n\n const ifaceSelected = interfaceApiName && interfaceToObjMapping\n ? (selectedProps\n ? Object.keys(interfaceToObjMapping).filter(\n val => {\n selectedProps?.includes(interfaceToObjMapping[val]);\n },\n )\n : [\n ...Object.values(interfaceToObjMapping),\n objectDef.primaryKeyApiName,\n ])\n : undefined;\n\n // default value for when we are checking an object\n let objProps;\n\n let conforming = true;\n if (interfaceApiName && ifaceSelected) {\n invariantInterfacesAsViews(objectDef, interfaceApiName, client);\n\n objProps = ifaceSelected;\n } else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\n \"Unable to safely convert objects as some non nullable properties are null\",\n );\n } else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n\n let osdkObject: ObjectHolder | InterfaceHolder = createOsdkObject(\n client,\n objectDef,\n rawObj,\n derivedPropertyTypeByName,\n propertySecurities,\n );\n if (\n interfaceApiName && isInterfaceScoped\n ) osdkObject = osdkObject.$as(interfaceApiName);\n\n ret.push(osdkObject);\n }\n\n return ret;\n}\n\n/**\n * @internal\n *\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nexport function convertInterfacePropNamesToObjectPropNames(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n ifacePropsToMap: readonly string[],\n): string[] {\n return ifacePropsToMap.map((ifaceProp) =>\n objectDef.interfaceMap[interfaceApiName][ifaceProp]\n );\n}\n\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n rawObj: OntologyObjectV2,\n) {\n const newProps: Record<string, any> = {};\n for (\n const [sptProp, regularProp] of Object.entries(\n objectDef.interfaceMap[interfaceApiName],\n )\n ) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\n\nfunction isConforming(\n client: MinimalClient,\n def:\n | InterfaceMetadata\n | ObjectMetadata,\n obj: OntologyObjectV2,\n propsToCheck: readonly string[],\n) {\n for (const propName of propsToCheck) {\n if (\n propName in def.properties && def.properties[propName].nullable === false\n && obj[propName] == null\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n client.logger?.debug(\n {\n obj: {\n $apiName: obj[\"$apiName\"],\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n },\n `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`,\n );\n }\n return false;\n }\n }\n return true;\n}\n\nfunction invariantInterfacesAsViews(\n objectDef: FetchedObjectTypeDefinition,\n interfaceApiName: string,\n client: MinimalClient,\n): asserts objectDef is typeof objectDef & { interfaceMap: {} } {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning =\n \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n } else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\n\nfunction fixObjectPropertiesInPlace(\n objs: OntologyObjectV2[],\n forceRemoveRid: boolean,\n): asserts objs is SimpleOsdkProperties[] {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n\n if (obj.__score) {\n obj.$score = obj.__score;\n delete obj.__score;\n }\n\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName ??= obj.__apiName;\n\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.$apiName;\n\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey ??= obj.__primaryKey;\n obj.$title ??= obj.__title;\n\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\n }\n}\n\n/**\n * Converts interfaceToObjectTypeMappingsV2 format to the V1 format.\n * V2 format: { interfaceProp: { type: \"localPropertyImplementation\", propertyApiName: \"objectProp\" } }\n * V1 format: { interfaceProp: \"objectProp\" }\n */\nfunction convertInterfaceToObjectTypeMappingsV2ToV1(\n mappingsV2: Record<InterfaceTypeApiName, InterfaceToObjectTypeMappingsV2>,\n): Record<InterfaceTypeApiName, InterfaceToObjectTypeMappings> {\n return Object.fromEntries(\n Object.entries(mappingsV2).map((\n [interfaceApiName, objectTypeMappingsV2],\n ) => [\n interfaceApiName,\n Object.fromEntries(\n Object.entries(objectTypeMappingsV2).map((\n [objectTypeName, propertyMappings],\n ) => [\n objectTypeName,\n Object.fromEntries(\n Object.entries(propertyMappings)\n .filter(([, impl]) => impl.type === \"localPropertyImplementation\")\n .map((\n [interfaceProp, impl],\n ) => [\n interfaceProp,\n (impl as InterfacePropertyLocalPropertyImplementation)\n .propertyApiName,\n ]),\n ),\n ]),\n ),\n ]),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA,OAAOA,SAAS,MAAM,gBAAgB;AAMtC,SAASC,gBAAgB,QAAQ,gDAAgD;AAKjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAC5CC,MAAqB,EACrBC,OAA2B,EAC3BC,gBAAoC,EACpCC,cAAuB,GAAG,KAAK,EAC/BC,0BAA0D,EAC1DC,kBAAoD,EACpDC,aAAqC,EACrCC,aAAmC,GAAG,KAAK,EACK;EAChD;EACA;EACAC,0BAA0B,CAACP,OAAO,EAAEE,cAAc,CAAC;EAEnD,MAAMM,QAAQ,GAAGP,gBAAgB,GAC7B,MAAMF,MAAM,CAACU,gBAAgB,CAACC,sBAAsB,CAACT,gBAAgB,CAAC,GACtEU,SAAS;EACb,MAAMC,aAAa,GAAGJ,QAAQ,GACzBH,aAAa,IAAIQ,MAAM,CAACC,IAAI,CAACN,QAAQ,CAACO,UAAU,CAAC,GAClDJ,SAAS;EAEb,MAAMK,GAAG,GAAG,EAAE;EACd,KAAK,MAAMC,MAAM,IAAIjB,OAAO,EAAE;IAC5B,MAAMkB,SAAS,GAAG,MAAMnB,MAAM,CAACU,gBAAgB,CAACU,mBAAmB,CACjEF,MAAM,CAACG,QACT,CAAC;IACD,CAAUF,SAAS,GAAAG,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAnB3B,SAAS,QAAY,2BAA2BqB,MAAM,CAACG,QAAQ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