@osdk/client 2.6.0-beta.2 → 2.6.0-beta.4

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 (267) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +2 -1
  3. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  4. package/build/browser/index.js.map +1 -1
  5. package/build/browser/internal/conversions/extractNamespace.js +22 -0
  6. package/build/browser/internal/conversions/extractNamespace.js.map +1 -0
  7. package/build/browser/internal/conversions/fullyQualifyPropName.js +26 -0
  8. package/build/browser/internal/conversions/fullyQualifyPropName.js.map +1 -0
  9. package/build/browser/internal/conversions/makeGeoFilterBbox.js +41 -0
  10. package/build/browser/internal/conversions/makeGeoFilterBbox.js.map +1 -0
  11. package/build/browser/internal/conversions/makeGeoFilterIntersects.js +29 -0
  12. package/build/browser/internal/conversions/makeGeoFilterIntersects.js.map +1 -0
  13. package/build/browser/internal/conversions/makeGeoFilterPolygon.js +30 -0
  14. package/build/browser/internal/conversions/makeGeoFilterPolygon.js.map +1 -0
  15. package/build/browser/internal/conversions/makeGeoFilterWithin.js +48 -0
  16. package/build/browser/internal/conversions/makeGeoFilterWithin.js.map +1 -0
  17. package/build/browser/internal/conversions/modernToLegacyWhereClause.js +30 -99
  18. package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  19. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +139 -0
  20. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  21. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +1 -1
  22. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  23. package/build/browser/object/fetchPage.js +1 -1
  24. package/build/browser/object/fetchPage.js.map +1 -1
  25. package/build/browser/object/formatting/applyPropertyFormatter.js +7 -1
  26. package/build/browser/object/formatting/applyPropertyFormatter.js.map +1 -1
  27. package/build/browser/object/formatting/applyPropertyFormatter.test.js +305 -2
  28. package/build/browser/object/formatting/applyPropertyFormatter.test.js.map +1 -1
  29. package/build/browser/object/formatting/formatDateTime.js +158 -0
  30. package/build/browser/object/formatting/formatDateTime.js.map +1 -0
  31. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +17 -0
  32. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  33. package/build/browser/observable/ObservableClient.js.map +1 -1
  34. package/build/browser/observable/internal/BulkObjectLoader.js +12 -4
  35. package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
  36. package/build/browser/observable/internal/BulkObjectLoader.test.js +48 -0
  37. package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -1
  38. package/build/browser/observable/internal/CacheKeys.js +9 -3
  39. package/build/browser/observable/internal/CacheKeys.js.map +1 -1
  40. package/build/browser/observable/internal/Canonicalizer.js +51 -0
  41. package/build/browser/observable/internal/Canonicalizer.js.map +1 -0
  42. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  43. package/build/browser/observable/internal/OrderByCanonicalizer.js +1 -4
  44. package/build/browser/observable/internal/OrderByCanonicalizer.js.map +1 -1
  45. package/build/browser/observable/internal/RdpCanonicalizer.js +66 -0
  46. package/build/browser/observable/internal/RdpCanonicalizer.js.map +1 -0
  47. package/build/browser/observable/internal/RdpCanonicalizer.test.js +68 -0
  48. package/build/browser/observable/internal/RdpCanonicalizer.test.js.map +1 -0
  49. package/build/browser/observable/internal/SimpleWhereClause.js.map +1 -1
  50. package/build/browser/observable/internal/Store.js +160 -6
  51. package/build/browser/observable/internal/Store.js.map +1 -1
  52. package/build/browser/observable/internal/WhereClauseCanonicalizer.js +1 -1
  53. package/build/browser/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
  54. package/build/browser/observable/internal/actions/ActionApplication.js +1 -1
  55. package/build/browser/observable/internal/actions/ActionApplication.js.map +1 -1
  56. package/build/browser/observable/internal/actions/OptimisticJob.js +3 -3
  57. package/build/browser/observable/internal/actions/OptimisticJob.js.map +1 -1
  58. package/build/browser/observable/internal/base-list/BaseListQuery.js +12 -3
  59. package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
  60. package/build/browser/observable/internal/base-list/createCollectionConnectable.js +0 -5
  61. package/build/browser/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
  62. package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js +26 -13
  63. package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
  64. package/build/browser/observable/internal/evaluateFilter.js +61 -0
  65. package/build/browser/observable/internal/evaluateFilter.js.map +1 -0
  66. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js +33 -1
  67. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  68. package/build/browser/observable/internal/list/InterfaceListQuery.js +8 -3
  69. package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
  70. package/build/browser/observable/internal/list/ListCacheKey.js +22 -1
  71. package/build/browser/observable/internal/list/ListCacheKey.js.map +1 -1
  72. package/build/browser/observable/internal/list/ListQuery.js +19 -13
  73. package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
  74. package/build/browser/observable/internal/list/ListsHelper.js +12 -8
  75. package/build/browser/observable/internal/list/ListsHelper.js.map +1 -1
  76. package/build/browser/observable/internal/list/ObjectListQuery.js +10 -1
  77. package/build/browser/observable/internal/list/ObjectListQuery.js.map +1 -1
  78. package/build/browser/observable/internal/object/ObjectCacheKey.js +20 -1
  79. package/build/browser/observable/internal/object/ObjectCacheKey.js.map +1 -1
  80. package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.js +126 -0
  81. package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.js.map +1 -0
  82. package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.test.js +173 -0
  83. package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.test.js.map +1 -0
  84. package/build/browser/observable/internal/object/ObjectQuery.js +10 -58
  85. package/build/browser/observable/internal/object/ObjectQuery.js.map +1 -1
  86. package/build/browser/observable/internal/object/ObjectsHelper.js +65 -5
  87. package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -1
  88. package/build/browser/observable/internal/objectMatchesWhereClause.js +3 -37
  89. package/build/browser/observable/internal/objectMatchesWhereClause.js.map +1 -1
  90. package/build/browser/observable/internal/testUtils.js +3 -2
  91. package/build/browser/observable/internal/testUtils.js.map +1 -1
  92. package/build/browser/observable/internal/utils/rdpFieldOperations.js +83 -0
  93. package/build/browser/observable/internal/utils/rdpFieldOperations.js.map +1 -0
  94. package/build/browser/util/UserAgent.js +2 -2
  95. package/build/cjs/{chunk-X7WMWKLM.cjs → chunk-7567LSZD.cjs} +192 -55
  96. package/build/cjs/chunk-7567LSZD.cjs.map +1 -0
  97. package/build/cjs/{chunk-6L3MX4LH.cjs → chunk-VNLY3YOJ.cjs} +241 -196
  98. package/build/cjs/chunk-VNLY3YOJ.cjs.map +1 -0
  99. package/build/cjs/index.cjs +8 -8
  100. package/build/cjs/index.d.cts +1 -1
  101. package/build/cjs/public/internal.cjs +8 -8
  102. package/build/cjs/public/unstable-do-not-use.cjs +633 -208
  103. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  104. package/build/cjs/public/unstable-do-not-use.d.cts +6 -5
  105. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +2 -1
  106. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  107. package/build/esm/index.js.map +1 -1
  108. package/build/esm/internal/conversions/extractNamespace.js +22 -0
  109. package/build/esm/internal/conversions/extractNamespace.js.map +1 -0
  110. package/build/esm/internal/conversions/fullyQualifyPropName.js +26 -0
  111. package/build/esm/internal/conversions/fullyQualifyPropName.js.map +1 -0
  112. package/build/esm/internal/conversions/makeGeoFilterBbox.js +41 -0
  113. package/build/esm/internal/conversions/makeGeoFilterBbox.js.map +1 -0
  114. package/build/esm/internal/conversions/makeGeoFilterIntersects.js +29 -0
  115. package/build/esm/internal/conversions/makeGeoFilterIntersects.js.map +1 -0
  116. package/build/esm/internal/conversions/makeGeoFilterPolygon.js +30 -0
  117. package/build/esm/internal/conversions/makeGeoFilterPolygon.js.map +1 -0
  118. package/build/esm/internal/conversions/makeGeoFilterWithin.js +48 -0
  119. package/build/esm/internal/conversions/makeGeoFilterWithin.js.map +1 -0
  120. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +30 -99
  121. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  122. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +139 -0
  123. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  124. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +1 -1
  125. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  126. package/build/esm/object/fetchPage.js +1 -1
  127. package/build/esm/object/fetchPage.js.map +1 -1
  128. package/build/esm/object/formatting/applyPropertyFormatter.js +7 -1
  129. package/build/esm/object/formatting/applyPropertyFormatter.js.map +1 -1
  130. package/build/esm/object/formatting/applyPropertyFormatter.test.js +305 -2
  131. package/build/esm/object/formatting/applyPropertyFormatter.test.js.map +1 -1
  132. package/build/esm/object/formatting/formatDateTime.js +158 -0
  133. package/build/esm/object/formatting/formatDateTime.js.map +1 -0
  134. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +17 -0
  135. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  136. package/build/esm/observable/ObservableClient.js.map +1 -1
  137. package/build/esm/observable/internal/BulkObjectLoader.js +12 -4
  138. package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
  139. package/build/esm/observable/internal/BulkObjectLoader.test.js +48 -0
  140. package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -1
  141. package/build/esm/observable/internal/CacheKeys.js +9 -3
  142. package/build/esm/observable/internal/CacheKeys.js.map +1 -1
  143. package/build/esm/observable/internal/Canonicalizer.js +51 -0
  144. package/build/esm/observable/internal/Canonicalizer.js.map +1 -0
  145. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  146. package/build/esm/observable/internal/OrderByCanonicalizer.js +1 -4
  147. package/build/esm/observable/internal/OrderByCanonicalizer.js.map +1 -1
  148. package/build/esm/observable/internal/RdpCanonicalizer.js +66 -0
  149. package/build/esm/observable/internal/RdpCanonicalizer.js.map +1 -0
  150. package/build/esm/observable/internal/RdpCanonicalizer.test.js +68 -0
  151. package/build/esm/observable/internal/RdpCanonicalizer.test.js.map +1 -0
  152. package/build/esm/observable/internal/SimpleWhereClause.js.map +1 -1
  153. package/build/esm/observable/internal/Store.js +160 -6
  154. package/build/esm/observable/internal/Store.js.map +1 -1
  155. package/build/esm/observable/internal/WhereClauseCanonicalizer.js +1 -1
  156. package/build/esm/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
  157. package/build/esm/observable/internal/actions/ActionApplication.js +1 -1
  158. package/build/esm/observable/internal/actions/ActionApplication.js.map +1 -1
  159. package/build/esm/observable/internal/actions/OptimisticJob.js +3 -3
  160. package/build/esm/observable/internal/actions/OptimisticJob.js.map +1 -1
  161. package/build/esm/observable/internal/base-list/BaseListQuery.js +12 -3
  162. package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
  163. package/build/esm/observable/internal/base-list/createCollectionConnectable.js +0 -5
  164. package/build/esm/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
  165. package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js +26 -13
  166. package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
  167. package/build/esm/observable/internal/evaluateFilter.js +61 -0
  168. package/build/esm/observable/internal/evaluateFilter.js.map +1 -0
  169. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js +33 -1
  170. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  171. package/build/esm/observable/internal/list/InterfaceListQuery.js +8 -3
  172. package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
  173. package/build/esm/observable/internal/list/ListCacheKey.js +22 -1
  174. package/build/esm/observable/internal/list/ListCacheKey.js.map +1 -1
  175. package/build/esm/observable/internal/list/ListQuery.js +19 -13
  176. package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
  177. package/build/esm/observable/internal/list/ListsHelper.js +12 -8
  178. package/build/esm/observable/internal/list/ListsHelper.js.map +1 -1
  179. package/build/esm/observable/internal/list/ObjectListQuery.js +10 -1
  180. package/build/esm/observable/internal/list/ObjectListQuery.js.map +1 -1
  181. package/build/esm/observable/internal/object/ObjectCacheKey.js +20 -1
  182. package/build/esm/observable/internal/object/ObjectCacheKey.js.map +1 -1
  183. package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.js +126 -0
  184. package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.js.map +1 -0
  185. package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.test.js +173 -0
  186. package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.test.js.map +1 -0
  187. package/build/esm/observable/internal/object/ObjectQuery.js +10 -58
  188. package/build/esm/observable/internal/object/ObjectQuery.js.map +1 -1
  189. package/build/esm/observable/internal/object/ObjectsHelper.js +65 -5
  190. package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -1
  191. package/build/esm/observable/internal/objectMatchesWhereClause.js +3 -37
  192. package/build/esm/observable/internal/objectMatchesWhereClause.js.map +1 -1
  193. package/build/esm/observable/internal/testUtils.js +3 -2
  194. package/build/esm/observable/internal/testUtils.js.map +1 -1
  195. package/build/esm/observable/internal/utils/rdpFieldOperations.js +83 -0
  196. package/build/esm/observable/internal/utils/rdpFieldOperations.js.map +1 -0
  197. package/build/esm/util/UserAgent.js +2 -2
  198. package/build/types/index.d.ts +1 -1
  199. package/build/types/index.d.ts.map +1 -1
  200. package/build/types/internal/conversions/extractNamespace.d.ts +1 -0
  201. package/build/types/internal/conversions/extractNamespace.d.ts.map +1 -0
  202. package/build/types/internal/conversions/fullyQualifyPropName.d.ts +2 -0
  203. package/build/types/internal/conversions/fullyQualifyPropName.d.ts.map +1 -0
  204. package/build/types/internal/conversions/makeGeoFilterBbox.d.ts +3 -0
  205. package/build/types/internal/conversions/makeGeoFilterBbox.d.ts.map +1 -0
  206. package/build/types/internal/conversions/makeGeoFilterIntersects.d.ts +3 -0
  207. package/build/types/internal/conversions/makeGeoFilterIntersects.d.ts.map +1 -0
  208. package/build/types/internal/conversions/makeGeoFilterPolygon.d.ts +3 -0
  209. package/build/types/internal/conversions/makeGeoFilterPolygon.d.ts.map +1 -0
  210. package/build/types/internal/conversions/makeGeoFilterWithin.d.ts +3 -0
  211. package/build/types/internal/conversions/makeGeoFilterWithin.d.ts.map +1 -0
  212. package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts +1 -1
  213. package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts.map +1 -1
  214. package/build/types/object/formatting/applyPropertyFormatter.d.ts.map +1 -1
  215. package/build/types/object/formatting/formatDateTime.d.ts +6 -0
  216. package/build/types/object/formatting/formatDateTime.d.ts.map +1 -0
  217. package/build/types/observable/ObservableClient.d.ts +15 -5
  218. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  219. package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
  220. package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
  221. package/build/types/observable/internal/Canonicalizer.d.ts +37 -0
  222. package/build/types/observable/internal/Canonicalizer.d.ts.map +1 -0
  223. package/build/types/observable/internal/OrderByCanonicalizer.d.ts.map +1 -1
  224. package/build/types/observable/internal/RdpCanonicalizer.d.ts +8 -0
  225. package/build/types/observable/internal/RdpCanonicalizer.d.ts.map +1 -0
  226. package/build/types/observable/internal/RdpCanonicalizer.test.d.ts +1 -0
  227. package/build/types/observable/internal/RdpCanonicalizer.test.d.ts.map +1 -0
  228. package/build/types/observable/internal/SimpleWhereClause.d.ts +6 -2
  229. package/build/types/observable/internal/SimpleWhereClause.d.ts.map +1 -1
  230. package/build/types/observable/internal/Store.d.ts +4 -0
  231. package/build/types/observable/internal/Store.d.ts.map +1 -1
  232. package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts +5 -2
  233. package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts.map +1 -1
  234. package/build/types/observable/internal/actions/ActionApplication.d.ts.map +1 -1
  235. package/build/types/observable/internal/base-list/BaseListQuery.d.ts +6 -0
  236. package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
  237. package/build/types/observable/internal/base-list/createCollectionConnectable.d.ts +1 -23
  238. package/build/types/observable/internal/base-list/createCollectionConnectable.d.ts.map +1 -1
  239. package/build/types/observable/internal/evaluateFilter.d.ts +6 -0
  240. package/build/types/observable/internal/evaluateFilter.d.ts.map +1 -0
  241. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts +5 -0
  242. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts.map +1 -1
  243. package/build/types/observable/internal/list/InterfaceListQuery.d.ts.map +1 -1
  244. package/build/types/observable/internal/list/ListCacheKey.d.ts +7 -1
  245. package/build/types/observable/internal/list/ListCacheKey.d.ts.map +1 -1
  246. package/build/types/observable/internal/list/ListQuery.d.ts +7 -7
  247. package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
  248. package/build/types/observable/internal/list/ListsHelper.d.ts +3 -1
  249. package/build/types/observable/internal/list/ListsHelper.d.ts.map +1 -1
  250. package/build/types/observable/internal/list/ObjectListQuery.d.ts.map +1 -1
  251. package/build/types/observable/internal/object/ObjectCacheKey.d.ts +6 -1
  252. package/build/types/observable/internal/object/ObjectCacheKey.d.ts.map +1 -1
  253. package/build/types/observable/internal/object/ObjectCacheKeyRegistry.d.ts +60 -0
  254. package/build/types/observable/internal/object/ObjectCacheKeyRegistry.d.ts.map +1 -0
  255. package/build/types/observable/internal/object/ObjectCacheKeyRegistry.test.d.ts +1 -0
  256. package/build/types/observable/internal/object/ObjectCacheKeyRegistry.test.d.ts.map +1 -0
  257. package/build/types/observable/internal/object/ObjectQuery.d.ts +1 -1
  258. package/build/types/observable/internal/object/ObjectQuery.d.ts.map +1 -1
  259. package/build/types/observable/internal/object/ObjectsHelper.d.ts +15 -1
  260. package/build/types/observable/internal/object/ObjectsHelper.d.ts.map +1 -1
  261. package/build/types/observable/internal/objectMatchesWhereClause.d.ts.map +1 -1
  262. package/build/types/observable/internal/testUtils.d.ts.map +1 -1
  263. package/build/types/observable/internal/utils/rdpFieldOperations.d.ts +5 -0
  264. package/build/types/observable/internal/utils/rdpFieldOperations.d.ts.map +1 -0
  265. package/package.json +9 -9
  266. package/build/cjs/chunk-6L3MX4LH.cjs.map +0 -1
  267. package/build/cjs/chunk-X7WMWKLM.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableClientImpl.js","names":["Subscription","UnsubscribableWrapper","ObservableClientImpl","constructor","store","__experimentalStore","applyAction","bind","validateAction","observeObject","apiName","pk","options","subFn","objects","observe","observeList","lists","observeLinks","linkName","objectsArray","Array","isArray","parentSub","obj","querySubscription","links","srcType","type","$apiName","$primaryKey","add","observeObjectSet","baseObjectSet","objectSets","invalidateAll","invalidateObjects","invalidateObjectType","undefined","canonicalizeWhereClause","where","whereCanonicalizer","canonicalize"],"sources":["ObservableClientImpl.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 ActionDefinition,\n ActionValidationResponse,\n CompileTimeMetadata,\n InterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { Subscription } from \"rxjs\";\nimport type { ActionSignatureFromDef } from \"../../actions/applyAction.js\";\nimport type { SpecificLinkPayload } from \"../LinkPayload.js\";\nimport type { ListPayload } from \"../ListPayload.js\";\nimport type { ObjectPayload } from \"../ObjectPayload.js\";\nimport type { ObjectSetPayload } from \"../ObjectSetPayload.js\";\nimport type {\n ObservableClient,\n ObserveListOptions,\n ObserveObjectArgs,\n ObserveObjectOptions,\n ObserveObjectsArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../ObservableClient.js\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { ObserveLinks } from \"../ObservableClient/ObserveLink.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./objectset/ObjectSetQueryOptions.js\";\nimport type { Store } from \"./Store.js\";\nimport { UnsubscribableWrapper } from \"./UnsubscribableWrapper.js\";\n\n/**\n * Implementation of the public ObservableClient interface.\n * - Delegates all operations to the Store for consistency\n * - Serves as the entry point for reactive data management\n * - Ensures proper method binding and API exposure\n *\n * @internal\n */\nexport class ObservableClientImpl implements ObservableClient {\n __experimentalStore: Store;\n\n constructor(store: Store) {\n this.__experimentalStore = store;\n\n this.applyAction = store.applyAction.bind(store);\n this.validateAction = store.validateAction.bind(store);\n }\n\n public observeObject: <T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: Omit<ObserveObjectOptions<T>, \"apiName\" | \"pk\">,\n subFn: Observer<ObserveObjectArgs<T>>,\n ) => Unsubscribable = (apiName, pk, options, subFn) => {\n return this.__experimentalStore.objects.observe(\n {\n ...options,\n apiName,\n pk,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectPayload>,\n );\n };\n\n public observeList: <T extends ObjectTypeDefinition | InterfaceDefinition>(\n options: ObserveListOptions<T>,\n subFn: Observer<ObserveObjectsArgs<T>>,\n ) => Unsubscribable = (options, subFn) => {\n return this.__experimentalStore.lists.observe(\n options,\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ListPayload>,\n );\n };\n\n public observeLinks: <\n T extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | Array<Osdk.Instance<T>>,\n linkName: L,\n options: ObserveLinks.Options<T, L>,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ) => Unsubscribable = (objects, linkName, options, subFn) => {\n // Convert to array if single object provided\n const objectsArray = Array.isArray(objects) ? objects : [objects];\n\n const parentSub = new Subscription();\n\n for (const obj of objectsArray) {\n const querySubscription = this.__experimentalStore.links\n .observe(\n {\n ...options,\n srcType: {\n type: \"object\",\n apiName: obj.$apiName,\n },\n linkName,\n pk: obj.$primaryKey,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<SpecificLinkPayload>,\n );\n\n parentSub.add(querySubscription);\n }\n\n return new UnsubscribableWrapper(parentSub);\n };\n\n public applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<unknown>;\n\n public validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n public observeObjectSet<\n T extends ObjectTypeDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable {\n return this.__experimentalStore.objectSets.observe(\n { baseObjectSet, ...options },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectSetPayload>,\n );\n }\n\n public invalidateAll(): Promise<void> {\n return this.__experimentalStore.invalidateAll();\n }\n\n public invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjects(objects);\n }\n\n public invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjectType(type, undefined);\n }\n\n public canonicalizeWhereClause<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n >(where: WhereClause<T>): Canonical<WhereClause<T>> {\n return this.__experimentalStore.whereCanonicalizer\n .canonicalize(where) as Canonical<WhereClause<T>>;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA,SAASA,YAAY,QAAQ,MAAM;AAoBnC,SAASC,qBAAqB,QAAQ,4BAA4B;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAA6B;EAG5DC,WAAWA,CAACC,KAAY,EAAE;IACxB,IAAI,CAACC,mBAAmB,GAAGD,KAAK;IAEhC,IAAI,CAACE,WAAW,GAAGF,KAAK,CAACE,WAAW,CAACC,IAAI,CAACH,KAAK,CAAC;IAChD,IAAI,CAACI,cAAc,GAAGJ,KAAK,CAACI,cAAc,CAACD,IAAI,CAACH,KAAK,CAAC;EACxD;EAEOK,aAAa,GAKEA,CAACC,OAAO,EAAEC,EAAE,EAAEC,OAAO,EAAEC,KAAK,KAAK;IACrD,OAAO,IAAI,CAACR,mBAAmB,CAACS,OAAO,CAACC,OAAO,CAC7C;MACE,GAAGH,OAAO;MACVF,OAAO;MACPC;IACF,CAAC;IACD;IACAE,KACF,CAAC;EACH,CAAC;EAEMG,WAAW,GAGIA,CAACJ,OAAO,EAAEC,KAAK,KAAK;IACxC,OAAO,IAAI,CAACR,mBAAmB,CAACY,KAAK,CAACF,OAAO,CAC3CH,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,CAAC;EACvE;EAEOC,uBAAuBA,CAE5BC,KAAqB,EAA6B;IAClD,OAAO,IAAI,CAACnC,mBAAmB,CAACoC,kBAAkB,CAC/CC,YAAY,CAACF,KAAK,CAAC;EACxB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ObservableClientImpl.js","names":["Subscription","UnsubscribableWrapper","ObservableClientImpl","constructor","store","__experimentalStore","applyAction","bind","validateAction","observeObject","apiName","pk","options","subFn","objects","observe","observeList","lists","observeLinks","linkName","objectsArray","Array","isArray","parentSub","obj","querySubscription","links","srcType","type","$apiName","$primaryKey","add","observeObjectSet","baseObjectSet","objectSets","invalidateAll","invalidateObjects","invalidateObjectType","undefined","canonicalizeWhereClause","where","whereCanonicalizer","canonicalize"],"sources":["ObservableClientImpl.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 ActionDefinition,\n ActionValidationResponse,\n CompileTimeMetadata,\n InterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n SimplePropertyDef,\n WhereClause,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport { Subscription } from \"rxjs\";\nimport type { ActionSignatureFromDef } from \"../../actions/applyAction.js\";\nimport type { SpecificLinkPayload } from \"../LinkPayload.js\";\nimport type { ListPayload } from \"../ListPayload.js\";\nimport type { ObjectPayload } from \"../ObjectPayload.js\";\nimport type { ObjectSetPayload } from \"../ObjectSetPayload.js\";\nimport type {\n ObservableClient,\n ObserveListOptions,\n ObserveObjectArgs,\n ObserveObjectOptions,\n ObserveObjectsArgs,\n ObserveObjectSetArgs,\n Unsubscribable,\n} from \"../ObservableClient.js\";\nimport type { Observer } from \"../ObservableClient/common.js\";\nimport type { ObserveLinks } from \"../ObservableClient/ObserveLink.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport type { ObserveObjectSetOptions } from \"./objectset/ObjectSetQueryOptions.js\";\nimport type { Store } from \"./Store.js\";\nimport { UnsubscribableWrapper } from \"./UnsubscribableWrapper.js\";\n\n/**\n * Implementation of the public ObservableClient interface.\n * - Delegates all operations to the Store for consistency\n * - Serves as the entry point for reactive data management\n * - Ensures proper method binding and API exposure\n *\n * @internal\n */\nexport class ObservableClientImpl implements ObservableClient {\n __experimentalStore: Store;\n\n constructor(store: Store) {\n this.__experimentalStore = store;\n\n this.applyAction = store.applyAction.bind(store);\n this.validateAction = store.validateAction.bind(store);\n }\n\n public observeObject: <T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n options: Omit<ObserveObjectOptions<T>, \"apiName\" | \"pk\">,\n subFn: Observer<ObserveObjectArgs<T>>,\n ) => Unsubscribable = (apiName, pk, options, subFn) => {\n return this.__experimentalStore.objects.observe(\n {\n ...options,\n apiName,\n pk,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectPayload>,\n );\n };\n\n public observeList: <\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(\n options: ObserveListOptions<T, RDPs>,\n subFn: Observer<ObserveObjectsArgs<T>>,\n ) => Unsubscribable = (options, subFn) => {\n return this.__experimentalStore.lists.observe(\n options,\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ListPayload>,\n );\n };\n\n public observeLinks: <\n T extends ObjectTypeDefinition | InterfaceDefinition,\n L extends keyof CompileTimeMetadata<T>[\"links\"] & string,\n >(\n objects: Osdk.Instance<T> | Array<Osdk.Instance<T>>,\n linkName: L,\n options: ObserveLinks.Options<T, L>,\n subFn: Observer<\n ObserveLinks.CallbackArgs<\n CompileTimeMetadata<T>[\"links\"][L][\"targetType\"]\n >\n >,\n ) => Unsubscribable = (objects, linkName, options, subFn) => {\n // Convert to array if single object provided\n const objectsArray = Array.isArray(objects) ? objects : [objects];\n\n const parentSub = new Subscription();\n\n for (const obj of objectsArray) {\n const querySubscription = this.__experimentalStore.links\n .observe(\n {\n ...options,\n srcType: {\n type: \"object\",\n apiName: obj.$apiName,\n },\n linkName,\n pk: obj.$primaryKey,\n },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<SpecificLinkPayload>,\n );\n\n parentSub.add(querySubscription);\n }\n\n return new UnsubscribableWrapper(parentSub);\n };\n\n public applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n opts?: ObservableClient.ApplyActionOptions,\n ) => Promise<unknown>;\n\n public validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse>;\n\n public observeObjectSet<\n T extends ObjectTypeDefinition,\n RDPs extends Record<\n string,\n WirePropertyTypes | undefined | Array<WirePropertyTypes>\n > = {},\n >(\n baseObjectSet: ObjectSet<T>,\n options: ObserveObjectSetOptions<T, RDPs>,\n subFn: Observer<ObserveObjectSetArgs<T, RDPs>>,\n ): Unsubscribable {\n return this.__experimentalStore.objectSets.observe(\n { baseObjectSet, ...options },\n // cast to cross typed to untyped barrier\n subFn as unknown as Observer<ObjectSetPayload>,\n );\n }\n\n public invalidateAll(): Promise<void> {\n return this.__experimentalStore.invalidateAll();\n }\n\n public invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjects(objects);\n }\n\n public invalidateObjectType<T extends ObjectTypeDefinition>(\n type: T | T[\"apiName\"],\n ): Promise<void> {\n return this.__experimentalStore.invalidateObjectType(type, undefined);\n }\n\n public canonicalizeWhereClause<\n T extends ObjectTypeDefinition | InterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n >(where: WhereClause<T, RDPs>): Canonical<WhereClause<T, RDPs>> {\n return this.__experimentalStore.whereCanonicalizer\n .canonicalize(where) as Canonical<WhereClause<T, RDPs>>;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA,SAASA,YAAY,QAAQ,MAAM;AAoBnC,SAASC,qBAAqB,QAAQ,4BAA4B;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAA6B;EAG5DC,WAAWA,CAACC,KAAY,EAAE;IACxB,IAAI,CAACC,mBAAmB,GAAGD,KAAK;IAEhC,IAAI,CAACE,WAAW,GAAGF,KAAK,CAACE,WAAW,CAACC,IAAI,CAACH,KAAK,CAAC;IAChD,IAAI,CAACI,cAAc,GAAGJ,KAAK,CAACI,cAAc,CAACD,IAAI,CAACH,KAAK,CAAC;EACxD;EAEOK,aAAa,GAKEA,CAACC,OAAO,EAAEC,EAAE,EAAEC,OAAO,EAAEC,KAAK,KAAK;IACrD,OAAO,IAAI,CAACR,mBAAmB,CAACS,OAAO,CAACC,OAAO,CAC7C;MACE,GAAGH,OAAO;MACVF,OAAO;MACPC;IACF,CAAC;IACD;IACAE,KACF,CAAC;EACH,CAAC;EAEMG,WAAW,GAMIA,CAACJ,OAAO,EAAEC,KAAK,KAAK;IACxC,OAAO,IAAI,CAACR,mBAAmB,CAACY,KAAK,CAACF,OAAO,CAC3CH,OAAO;IACP;IACAC,KACF,CAAC;EACH,CAAC;EAEMK,YAAY,GAYGA,CAACJ,OAAO,EAAEK,QAAQ,EAAEP,OAAO,EAAEC,KAAK,KAAK;IAC3D;IACA,MAAMO,YAAY,GAAGC,KAAK,CAACC,OAAO,CAACR,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@ export class OrderByCanonicalizer {
23
23
  }
24
24
  return result;
25
25
  }, []);
26
- let data = Object.fromEntries(pairs);
27
- if (process.env.NODE_ENV !== "production") {
28
- data = Object.freeze(data);
29
- }
26
+ const data = Object.fromEntries(pairs);
30
27
  return data;
31
28
  });
32
29
  canonicalize = orderBy => {
@@ -1 +1 @@
1
- {"version":3,"file":"OrderByCanonicalizer.js","names":["WeakRefTrie","OrderByCanonicalizer","trie","array","pairs","reduce","result","_","index","push","slice","data","Object","fromEntries","process","env","NODE_ENV","freeze","canonicalize","orderBy","strings","entries","flat","lookupArray"],"sources":["OrderByCanonicalizer.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 { ObjectTypeDefinition } from \"@osdk/api\";\nimport type { OrderBy } from \"../ObservableClient.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport { WeakRefTrie } from \"./WeakRefTrie.js\";\n\nexport class OrderByCanonicalizer {\n #trie = new WeakRefTrie(\n (array: Array<string>) => {\n const pairs = array.reduce<Array<[string, \"asc\" | \"desc\"]>>(\n function(result, _, index, array) {\n if (index % 2 === 0 && array[index] != null) {\n result.push(\n array.slice(index, index + 2) as [string, \"asc\" | \"desc\"],\n );\n }\n return result;\n },\n [],\n );\n let data = Object.fromEntries(pairs) satisfies Record<\n string,\n \"asc\" | \"desc\"\n > as Canonical<OrderBy<ObjectTypeDefinition>>;\n\n if (process.env.NODE_ENV !== \"production\") {\n data = Object.freeze(data);\n }\n return data;\n },\n );\n\n canonicalize: (\n orderBy: Record<string, \"asc\" | \"desc\" | undefined>,\n ) => Canonical<Record<string, \"asc\" | \"desc\" | undefined>> = (\n orderBy,\n ) => {\n const strings = Object.entries(orderBy).flat();\n return this.#trie.lookupArray(strings);\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASA,WAAW,QAAQ,kBAAkB;AAE9C,OAAO,MAAMC,oBAAoB,CAAC;EAChC,CAACC,IAAI,GAAG,IAAIF,WAAW,CACpBG,KAAoB,IAAK;IACxB,MAAMC,KAAK,GAAGD,KAAK,CAACE,MAAM,CACxB,UAASC,MAAM,EAAEC,CAAC,EAAEC,KAAK,EAAEL,KAAK,EAAE;MAChC,IAAIK,KAAK,GAAG,CAAC,KAAK,CAAC,IAAIL,KAAK,CAACK,KAAK,CAAC,IAAI,IAAI,EAAE;QAC3CF,MAAM,CAACG,IAAI,CACTN,KAAK,CAACO,KAAK,CAACF,KAAK,EAAEA,KAAK,GAAG,CAAC,CAC9B,CAAC;MACH;MACA,OAAOF,MAAM;IACf,CAAC,EACD,EACF,CAAC;IACD,IAAIK,IAAI,GAAGC,MAAM,CAACC,WAAW,CAACT,KAAK,CAGU;IAE7C,IAAIU,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;MACzCL,IAAI,GAAGC,MAAM,CAACK,MAAM,CAACN,IAAI,CAAC;IAC5B;IACA,OAAOA,IAAI;EACb,CACF,CAAC;EAEDO,YAAY,GAGVC,OAAO,IACJ;IACH,MAAMC,OAAO,GAAGR,MAAM,CAACS,OAAO,CAACF,OAAO,CAAC,CAACG,IAAI,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,CAACpB,IAAI,CAACqB,WAAW,CAACH,OAAO,CAAC;EACxC,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"OrderByCanonicalizer.js","names":["WeakRefTrie","OrderByCanonicalizer","trie","array","pairs","reduce","result","_","index","push","slice","data","Object","fromEntries","canonicalize","orderBy","strings","entries","flat","lookupArray"],"sources":["OrderByCanonicalizer.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 { ObjectTypeDefinition } from \"@osdk/api\";\nimport type { OrderBy } from \"../ObservableClient.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport { WeakRefTrie } from \"./WeakRefTrie.js\";\n\nexport class OrderByCanonicalizer {\n #trie = new WeakRefTrie(\n (array: Array<string>) => {\n const pairs = array.reduce<Array<[string, \"asc\" | \"desc\"]>>(\n function(result, _, index, array) {\n if (index % 2 === 0 && array[index] != null) {\n result.push(\n array.slice(index, index + 2) as [string, \"asc\" | \"desc\"],\n );\n }\n return result;\n },\n [],\n );\n const data = Object.fromEntries(pairs) satisfies Record<\n string,\n \"asc\" | \"desc\"\n > as Canonical<OrderBy<ObjectTypeDefinition>>;\n return data;\n },\n );\n\n canonicalize: (\n orderBy: Record<string, \"asc\" | \"desc\" | undefined>,\n ) => Canonical<Record<string, \"asc\" | \"desc\" | undefined>> = (\n orderBy,\n ) => {\n const strings = Object.entries(orderBy).flat();\n return this.#trie.lookupArray(strings);\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASA,WAAW,QAAQ,kBAAkB;AAE9C,OAAO,MAAMC,oBAAoB,CAAC;EAChC,CAACC,IAAI,GAAG,IAAIF,WAAW,CACpBG,KAAoB,IAAK;IACxB,MAAMC,KAAK,GAAGD,KAAK,CAACE,MAAM,CACxB,UAASC,MAAM,EAAEC,CAAC,EAAEC,KAAK,EAAEL,KAAK,EAAE;MAChC,IAAIK,KAAK,GAAG,CAAC,KAAK,CAAC,IAAIL,KAAK,CAACK,KAAK,CAAC,IAAI,IAAI,EAAE;QAC3CF,MAAM,CAACG,IAAI,CACTN,KAAK,CAACO,KAAK,CAACF,KAAK,EAAEA,KAAK,GAAG,CAAC,CAC9B,CAAC;MACH;MACA,OAAOF,MAAM;IACf,CAAC,EACD,EACF,CAAC;IACD,MAAMK,IAAI,GAAGC,MAAM,CAACC,WAAW,CAACT,KAAK,CAGQ;IAC7C,OAAOO,IAAI;EACb,CACF,CAAC;EAEDG,YAAY,GAGVC,OAAO,IACJ;IACH,MAAMC,OAAO,GAAGJ,MAAM,CAACK,OAAO,CAACF,OAAO,CAAC,CAACG,IAAI,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,CAAChB,IAAI,CAACiB,WAAW,CAACH,OAAO,CAAC;EACxC,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { createWithPropertiesObjectSet } from "../../derivedProperties/createWithPropertiesObjectSet.js";
18
+ import { CachingCanonicalizer } from "./Canonicalizer.js";
19
+ export class RdpCanonicalizer extends CachingCanonicalizer {
20
+ structuralCache = new Map();
21
+ lookupOrCreate(rdp) {
22
+ // Map from builder result symbols to their definitions
23
+ const definitionMap = new Map();
24
+ const computedProperties = {};
25
+
26
+ // Create a wrapper holding object type for the builder to let us extract the definition structure
27
+ const objectTypeHolder = {
28
+ type: "object",
29
+ apiName: "__rdp_canonicalizer_holder__"
30
+ };
31
+ for (const [key, rdpFunction] of Object.entries(rdp)) {
32
+ const builder = createWithPropertiesObjectSet(objectTypeHolder, {
33
+ type: "methodInput"
34
+ }, definitionMap, /* fromBaseObjectSet */true);
35
+ const result = rdpFunction(builder);
36
+ const definition = definitionMap.get(result);
37
+ if (definition) {
38
+ computedProperties[key] = definition;
39
+ }
40
+ }
41
+
42
+ // Sort entries by key for consistent ordering
43
+ const sortedKeys = Object.keys(computedProperties).sort();
44
+
45
+ // Create a serialized key for the computed definitions
46
+ const sortedDefinitions = {};
47
+ for (const key of sortedKeys) {
48
+ sortedDefinitions[key] = computedProperties[key];
49
+ }
50
+ const definitionsKey = JSON.stringify(sortedDefinitions);
51
+
52
+ // Check if we already have a canonical RDP for these definitions
53
+ let canonical = this.structuralCache.get(definitionsKey);
54
+ if (!canonical) {
55
+ // Create a canonical RDP object with sorted keys
56
+ const sortedRdp = {};
57
+ for (const key of Object.keys(rdp).sort()) {
58
+ sortedRdp[key] = rdp[key];
59
+ }
60
+ canonical = sortedRdp;
61
+ this.structuralCache.set(definitionsKey, canonical);
62
+ }
63
+ return canonical;
64
+ }
65
+ }
66
+ //# sourceMappingURL=RdpCanonicalizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RdpCanonicalizer.js","names":["createWithPropertiesObjectSet","CachingCanonicalizer","RdpCanonicalizer","structuralCache","Map","lookupOrCreate","rdp","definitionMap","computedProperties","objectTypeHolder","type","apiName","key","rdpFunction","Object","entries","builder","result","definition","get","sortedKeys","keys","sort","sortedDefinitions","definitionsKey","JSON","stringify","canonical","sortedRdp","set"],"sources":["RdpCanonicalizer.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 DerivedProperty,\n ObjectOrInterfaceDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport { createWithPropertiesObjectSet } from \"../../derivedProperties/createWithPropertiesObjectSet.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport { CachingCanonicalizer } from \"./Canonicalizer.js\";\n\nexport type Rdp = DerivedProperty.Clause<ObjectOrInterfaceDefinition>;\n\nexport class RdpCanonicalizer extends CachingCanonicalizer<Rdp, Rdp> {\n private structuralCache = new Map<string, Canonical<Rdp>>();\n\n protected lookupOrCreate(rdp: Rdp): Canonical<Rdp> {\n // Map from builder result symbols to their definitions\n const definitionMap = new Map<\n DerivedProperty.Definition<\n SimplePropertyDef,\n ObjectOrInterfaceDefinition\n >,\n DerivedPropertyDefinition\n >();\n const computedProperties: Record<string, DerivedPropertyDefinition> = {};\n\n // Create a wrapper holding object type for the builder to let us extract the definition structure\n const objectTypeHolder = {\n type: \"object\" as const,\n apiName: \"__rdp_canonicalizer_holder__\",\n } as ObjectOrInterfaceDefinition;\n\n for (const [key, rdpFunction] of Object.entries(rdp)) {\n const builder = createWithPropertiesObjectSet(\n objectTypeHolder,\n { type: \"methodInput\" },\n definitionMap,\n /* fromBaseObjectSet */ true,\n );\n\n const result = rdpFunction(builder);\n const definition = definitionMap.get(result);\n\n if (definition) {\n computedProperties[key] = definition;\n }\n }\n\n // Sort entries by key for consistent ordering\n const sortedKeys = Object.keys(computedProperties).sort();\n\n // Create a serialized key for the computed definitions\n const sortedDefinitions: Record<string, DerivedPropertyDefinition> = {};\n for (const key of sortedKeys) {\n sortedDefinitions[key] = computedProperties[key];\n }\n const definitionsKey = JSON.stringify(sortedDefinitions);\n\n // Check if we already have a canonical RDP for these definitions\n let canonical = this.structuralCache.get(definitionsKey);\n\n if (!canonical) {\n // Create a canonical RDP object with sorted keys\n const sortedRdp: Rdp = {};\n for (const key of Object.keys(rdp).sort()) {\n sortedRdp[key] = rdp[key];\n }\n canonical = sortedRdp as Canonical<Rdp>;\n this.structuralCache.set(definitionsKey, canonical);\n }\n\n return canonical;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,6BAA6B,QAAQ,0DAA0D;AAExG,SAASC,oBAAoB,QAAQ,oBAAoB;AAIzD,OAAO,MAAMC,gBAAgB,SAASD,oBAAoB,CAAW;EAC3DE,eAAe,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAEjDC,cAAcA,CAACC,GAAQ,EAAkB;IACjD;IACA,MAAMC,aAAa,GAAG,IAAIH,GAAG,CAM3B,CAAC;IACH,MAAMI,kBAA6D,GAAG,CAAC,CAAC;;IAExE;IACA,MAAMC,gBAAgB,GAAG;MACvBC,IAAI,EAAE,QAAiB;MACvBC,OAAO,EAAE;IACX,CAAgC;IAEhC,KAAK,MAAM,CAACC,GAAG,EAAEC,WAAW,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACT,GAAG,CAAC,EAAE;MACpD,MAAMU,OAAO,GAAGhB,6BAA6B,CAC3CS,gBAAgB,EAChB;QAAEC,IAAI,EAAE;MAAc,CAAC,EACvBH,aAAa,EACb,uBAAwB,IAC1B,CAAC;MAED,MAAMU,MAAM,GAAGJ,WAAW,CAACG,OAAO,CAAC;MACnC,MAAME,UAAU,GAAGX,aAAa,CAACY,GAAG,CAACF,MAAM,CAAC;MAE5C,IAAIC,UAAU,EAAE;QACdV,kBAAkB,CAACI,GAAG,CAAC,GAAGM,UAAU;MACtC;IACF;;IAEA;IACA,MAAME,UAAU,GAAGN,MAAM,CAACO,IAAI,CAACb,kBAAkB,CAAC,CAACc,IAAI,CAAC,CAAC;;IAEzD;IACA,MAAMC,iBAA4D,GAAG,CAAC,CAAC;IACvE,KAAK,MAAMX,GAAG,IAAIQ,UAAU,EAAE;MAC5BG,iBAAiB,CAACX,GAAG,CAAC,GAAGJ,kBAAkB,CAACI,GAAG,CAAC;IAClD;IACA,MAAMY,cAAc,GAAGC,IAAI,CAACC,SAAS,CAACH,iBAAiB,CAAC;;IAExD;IACA,IAAII,SAAS,GAAG,IAAI,CAACxB,eAAe,CAACgB,GAAG,CAACK,cAAc,CAAC;IAExD,IAAI,CAACG,SAAS,EAAE;MACd;MACA,MAAMC,SAAc,GAAG,CAAC,CAAC;MACzB,KAAK,MAAMhB,GAAG,IAAIE,MAAM,CAACO,IAAI,CAACf,GAAG,CAAC,CAACgB,IAAI,CAAC,CAAC,EAAE;QACzCM,SAAS,CAAChB,GAAG,CAAC,GAAGN,GAAG,CAACM,GAAG,CAAC;MAC3B;MACAe,SAAS,GAAGC,SAA2B;MACvC,IAAI,CAACzB,eAAe,CAAC0B,GAAG,CAACL,cAAc,EAAEG,SAAS,CAAC;IACrD;IAEA,OAAOA,SAAS;EAClB;AACF","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { describe, expect, it } from "vitest";
18
+ import { RdpCanonicalizer } from "./RdpCanonicalizer.js";
19
+ describe("RdpCanonicalizer", () => {
20
+ it("returns same canonical object for functionally identical RDPs with different function references", () => {
21
+ const canonicalizer = new RdpCanonicalizer();
22
+
23
+ // Create first RDP with a function
24
+ const rdp1 = {
25
+ derivedAddress: base => base.pivotTo("lead").selectProperty("employeeId"),
26
+ derivedName: base => base.pivotTo("lead").selectProperty("fullName")
27
+ };
28
+
29
+ // Create second RDP with new function references but same logic
30
+ const rdp2 = {
31
+ derivedAddress: base => base.pivotTo("lead").selectProperty("employeeId"),
32
+ derivedName: base => base.pivotTo("lead").selectProperty("fullName")
33
+ };
34
+
35
+ // The functions should have different references
36
+ expect(rdp1.derivedAddress).not.toBe(rdp2.derivedAddress);
37
+ expect(rdp1.derivedName).not.toBe(rdp2.derivedName);
38
+
39
+ // But canonicalization should return the same object
40
+ const canonical1 = canonicalizer.canonicalize(rdp1);
41
+ const canonical2 = canonicalizer.canonicalize(rdp2);
42
+ expect(canonical1).toBe(canonical2);
43
+ });
44
+ it("handles complex RDP with aggregations", () => {
45
+ const canonicalizer = new RdpCanonicalizer();
46
+ const canonical1 = canonicalizer.canonicalize({
47
+ peepsCount: base => base.pivotTo("peeps").aggregate("$count"),
48
+ leadName: base => base.pivotTo("lead").selectProperty("fullName")
49
+ });
50
+ const canonical2 = canonicalizer.canonicalize({
51
+ peepsCount: base => base.pivotTo("peeps").aggregate("$count"),
52
+ leadName: base => base.pivotTo("lead").selectProperty("fullName")
53
+ });
54
+ expect(canonical1).toBe(canonical2);
55
+ });
56
+ it("caches results for the same input object", () => {
57
+ const canonicalizer = new RdpCanonicalizer();
58
+ const rdp = {
59
+ derivedProp: base => base.pivotTo("lead").selectProperty("employeeId")
60
+ };
61
+ const canonical1 = canonicalizer.canonicalize(rdp);
62
+ const canonical2 = canonicalizer.canonicalize(rdp);
63
+
64
+ // Same input object should return cached result
65
+ expect(canonical1).toBe(canonical2);
66
+ });
67
+ });
68
+ //# sourceMappingURL=RdpCanonicalizer.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RdpCanonicalizer.test.js","names":["describe","expect","it","RdpCanonicalizer","canonicalizer","rdp1","derivedAddress","base","pivotTo","selectProperty","derivedName","rdp2","not","toBe","canonical1","canonicalize","canonical2","peepsCount","aggregate","leadName","rdp","derivedProp"],"sources":["RdpCanonicalizer.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport type { Employee } from \"@osdk/client.test.ontology\";\nimport { describe, expect, it } from \"vitest\";\nimport { RdpCanonicalizer } from \"./RdpCanonicalizer.js\";\n\ndescribe(\"RdpCanonicalizer\", () => {\n it(\"returns same canonical object for functionally identical RDPs with different function references\", () => {\n const canonicalizer = new RdpCanonicalizer();\n\n // Create first RDP with a function\n const rdp1: DerivedProperty.Clause<typeof Employee> = {\n derivedAddress: (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n derivedName: (base) => base.pivotTo(\"lead\").selectProperty(\"fullName\"),\n };\n\n // Create second RDP with new function references but same logic\n const rdp2: DerivedProperty.Clause<typeof Employee> = {\n derivedAddress: (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n derivedName: (base) => base.pivotTo(\"lead\").selectProperty(\"fullName\"),\n };\n\n // The functions should have different references\n expect(rdp1.derivedAddress).not.toBe(rdp2.derivedAddress);\n expect(rdp1.derivedName).not.toBe(rdp2.derivedName);\n\n // But canonicalization should return the same object\n const canonical1 = canonicalizer.canonicalize(rdp1);\n const canonical2 = canonicalizer.canonicalize(rdp2);\n\n expect(canonical1).toBe(canonical2);\n });\n\n it(\"handles complex RDP with aggregations\", () => {\n const canonicalizer = new RdpCanonicalizer();\n\n const rdp1: DerivedProperty.Clause<typeof Employee> = {\n peepsCount: (base) => base.pivotTo(\"peeps\").aggregate(\"$count\"),\n leadName: (base) => base.pivotTo(\"lead\").selectProperty(\"fullName\"),\n };\n\n const rdp2: DerivedProperty.Clause<typeof Employee> = {\n peepsCount: (base) => base.pivotTo(\"peeps\").aggregate(\"$count\"),\n leadName: (base) => base.pivotTo(\"lead\").selectProperty(\"fullName\"),\n };\n\n const canonical1 = canonicalizer.canonicalize(rdp1);\n const canonical2 = canonicalizer.canonicalize(rdp2);\n\n expect(canonical1).toBe(canonical2);\n });\n\n it(\"caches results for the same input object\", () => {\n const canonicalizer = new RdpCanonicalizer();\n\n const rdp: DerivedProperty.Clause<typeof Employee> = {\n derivedProp: (base) => base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n };\n\n const canonical1 = canonicalizer.canonicalize(rdp);\n const canonical2 = canonicalizer.canonicalize(rdp);\n\n // Same input object should return cached result\n expect(canonical1).toBe(canonical2);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,gBAAgB,QAAQ,uBAAuB;AAExDH,QAAQ,CAAC,kBAAkB,EAAE,MAAM;EACjCE,EAAE,CAAC,kGAAkG,EAAE,MAAM;IAC3G,MAAME,aAAa,GAAG,IAAID,gBAAgB,CAAC,CAAC;;IAE5C;IACA,MAAME,IAA6C,GAAG;MACpDC,cAAc,EAAGC,IAAI,IACnBA,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,CAAC,YAAY,CAAC;MACnDC,WAAW,EAAGH,IAAI,IAAKA,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,CAAC,UAAU;IACvE,CAAC;;IAED;IACA,MAAME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CAAC,UAAU;IACpE,CAGkD,CAAC;IAEnDR,MAAM,CAACa,UAAU,CAAC,CAACD,IAAI,CAACG,UAAU,CAAC;EACrC,CAAC,CAAC;EAEFd,EAAE,CAAC,0CAA0C,EAAE,MAAM;IACnD,MAAME,aAAa,GAAG,IAAID,gBAAgB,CAAC,CAAC;IAE5C,MAAMiB,GAA4C,GAAG;MACnDC,WAAW,EAAGd,IAAI,IAAKA,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,CAAC,YAAY;IACzE,CAAC;IAED,MAAMK,UAAU,GAAGV,aAAa,CAACW,YAAY,CAACK,GAAG,CAAC;IAClD,MAAMJ,UAAU,GAAGZ,aAAa,CAACW,YAAY,CAACK,GAAG,CAAC;;IAElD;IACAnB,MAAM,CAACa,UAAU,CAAC,CAACD,IAAI,CAACG,UAAU,CAAC;EACrC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleWhereClause.js","names":[],"sources":["SimpleWhereClause.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 { WhereClause } from \"@osdk/api\";\n\nexport type SimpleWhereClause = WhereClause<\n any\n>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"SimpleWhereClause.js","names":[],"sources":["SimpleWhereClause.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 ObjectOrInterfaceDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\n\n/**\n * A where clause without specific type information - used for runtime matching logic.\n * This accepts any WhereClause<T, RDPs> by using the base types.\n */\nexport type SimpleWhereClause = WhereClause<\n ObjectOrInterfaceDefinition,\n Record<string, SimplePropertyDef>\n>;\n"],"mappings":"","ignoreList":[]}
@@ -18,15 +18,20 @@ import invariant from "tiny-invariant";
18
18
  import { additionalContext } from "../../Client.js";
19
19
  import { DEBUG_REFCOUNTS } from "../DebugFlags.js";
20
20
  import { ActionApplication } from "./actions/ActionApplication.js";
21
+ import { DEBUG_ONLY__cacheKeyToString } from "./CacheKey.js";
21
22
  import { CacheKeys } from "./CacheKeys.js";
22
23
  import { createChangedObjects, DEBUG_ONLY__changesToString } from "./Changes.js";
23
24
  import { Layers } from "./Layers.js";
24
25
  import { LinksHelper } from "./links/LinksHelper.js";
26
+ import { API_NAME_IDX as LIST_API_NAME_IDX, RDP_IDX as LIST_RDP_IDX } from "./list/ListCacheKey.js";
25
27
  import { ListsHelper } from "./list/ListsHelper.js";
28
+ import { API_NAME_IDX as OBJECT_API_NAME_IDX, RDP_CONFIG_IDX as OBJECT_RDP_CONFIG_IDX } from "./object/ObjectCacheKey.js";
29
+ import { ObjectCacheKeyRegistry } from "./object/ObjectCacheKeyRegistry.js";
26
30
  import { ObjectsHelper } from "./object/ObjectsHelper.js";
27
31
  import { ObjectSetHelper } from "./objectset/ObjectSetHelper.js";
28
32
  import { OrderByCanonicalizer } from "./OrderByCanonicalizer.js";
29
33
  import { Queries } from "./Queries.js";
34
+ import { RdpCanonicalizer } from "./RdpCanonicalizer.js";
30
35
  import { WhereClauseCanonicalizer } from "./WhereClauseCanonicalizer.js";
31
36
  /*
32
37
  Notes:
@@ -43,10 +48,12 @@ import { WhereClauseCanonicalizer } from "./WhereClauseCanonicalizer.js";
43
48
  export class Store {
44
49
  whereCanonicalizer = new WhereClauseCanonicalizer();
45
50
  orderByCanonicalizer = new OrderByCanonicalizer();
51
+ rdpCanonicalizer = new RdpCanonicalizer();
46
52
 
47
53
  /** @internal */
48
54
 
49
55
  queries = new Queries();
56
+ objectCacheKeyRegistry = new ObjectCacheKeyRegistry();
50
57
  layers = new Layers({
51
58
  logger: this.logger,
52
59
  onRevalidate: this.#maybeRevalidateQueries.bind(this)
@@ -63,7 +70,7 @@ export class Store {
63
70
  this.cacheKeys = new CacheKeys({
64
71
  onDestroy: this.#cleanupCacheKey
65
72
  });
66
- this.lists = new ListsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer);
73
+ this.lists = new ListsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer, this.rdpCanonicalizer);
67
74
  this.objects = new ObjectsHelper(this, this.cacheKeys);
68
75
  this.links = new LinksHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer);
69
76
  this.objectSets = new ObjectSetHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer);
@@ -114,10 +121,28 @@ export class Store {
114
121
  if (typeof apiName !== "string") {
115
122
  apiName = apiName.apiName;
116
123
  }
117
- return this.objects.getQuery({
118
- apiName,
119
- pk
120
- }).revalidate(/* force */true);
124
+ const variants = this.objectCacheKeyRegistry.getVariants(apiName, pk);
125
+
126
+ // Invalidate all variant cache entries
127
+ // Using Promise.allSettled to ensure if one invalidation fails, others will still complete.
128
+ // This prevents a single failing query from blocking invalidation of other cache variants for the same object.
129
+ const promises = [];
130
+ if (variants.size === 0) {
131
+ // No registered variants - create and revalidate the base variant (no RDP)
132
+ promises.push(this.objects.getQuery({
133
+ apiName,
134
+ pk
135
+ }, undefined).revalidate(/* force */true));
136
+ } else {
137
+ // Revalidate all registered variants
138
+ for (const key of variants) {
139
+ const query = this.queries.peek(key);
140
+ if (query) {
141
+ promises.push(query.revalidate(/* force */true));
142
+ }
143
+ }
144
+ }
145
+ return Promise.allSettled(promises);
121
146
  }
122
147
  async #maybeRevalidateQueries(changes, optimisticId) {
123
148
  const logger = process.env.NODE_ENV !== "production" ? this.logger?.child({
@@ -137,7 +162,19 @@ export class Store {
137
162
  try {
138
163
  const promises = [];
139
164
  for (const cacheKey of this.queries.keys()) {
140
- const promise = this.queries.peek(cacheKey)?.maybeUpdateAndRevalidate?.(changes, optimisticId);
165
+ const query = this.queries.peek(cacheKey);
166
+ if (!query?.maybeUpdateAndRevalidate) {
167
+ continue;
168
+ }
169
+
170
+ // Only propagate to queries that should receive these changes
171
+ if (!this.#shouldPropagateToQuery({
172
+ cacheKey,
173
+ maybeUpdateAndRevalidate: query.maybeUpdateAndRevalidate
174
+ }, changes, optimisticId)) {
175
+ continue;
176
+ }
177
+ const promise = query.maybeUpdateAndRevalidate(changes, optimisticId);
141
178
  if (promise) promises.push(promise);
142
179
  }
143
180
  await Promise.all(promises);
@@ -148,6 +185,123 @@ export class Store {
148
185
  }
149
186
  }
150
187
 
188
+ /**
189
+ * Determines whether changes should propagate to a specific query.
190
+ * Prevents unnecessary observable pipeline execution for cross-propagation.
191
+ *
192
+ * @param query - The query to check
193
+ * @param changes - The changes that occurred
194
+ * @param optimisticId - Optional optimistic update ID
195
+ * @returns true if the query should be notified of these changes
196
+ */
197
+ #shouldPropagateToQuery(query, changes, optimisticId) {
198
+ // Always propagate optimistic updates (user-initiated actions need immediate feedback)
199
+ if (optimisticId) {
200
+ return true;
201
+ }
202
+
203
+ // If the query's own cache key was modified (direct fetch), always propagate
204
+ if (changes.modified.has(query.cacheKey)) {
205
+ return true;
206
+ }
207
+
208
+ // Check if the query's object type is affected by the changes
209
+ if (this.#shouldPropagateForObjectTypeChanges(query.cacheKey, changes)) {
210
+ return true;
211
+ }
212
+
213
+ // For other cross-propagation (e.g., RDP field updates from unrelated object types):
214
+ // Only propagate to queries WITH RDP configurations
215
+ const queryRdpConfig = this.#getQueryRdpConfig(query.cacheKey);
216
+
217
+ // If query has no RDP, don't propagate unrelated object changes to it
218
+ // (it will get updates from its own direct fetches only)
219
+ return queryRdpConfig != null;
220
+ }
221
+
222
+ /**
223
+ * Checks if changes to an object type should propagate to a query.
224
+ * This ensures queries receive updates when objects of their type are added/modified.
225
+ *
226
+ * @param cacheKey - The cache key of the query
227
+ * @param changes - The changes that occurred
228
+ * @returns true if the query should be notified based on object type changes
229
+ */
230
+ #shouldPropagateForObjectTypeChanges(cacheKey, changes) {
231
+ const queryObjectType = this.#getQueryObjectType(cacheKey);
232
+ if (!queryObjectType) {
233
+ return false;
234
+ }
235
+ const affected = this.#changesAffectObjectType(changes, queryObjectType);
236
+ if (process.env.NODE_ENV !== "production") {
237
+ this.logger?.child({
238
+ methodName: "shouldPropagateToQuery"
239
+ }).debug(`Query type: ${queryObjectType}, affected: ${affected}`, {
240
+ queryKey: DEBUG_ONLY__cacheKeyToString(cacheKey),
241
+ addedCount: changes.addedObjects.get(queryObjectType)?.length ?? 0,
242
+ modifiedCount: changes.modifiedObjects.get(queryObjectType)?.length ?? 0
243
+ });
244
+ }
245
+ return affected;
246
+ }
247
+
248
+ /**
249
+ * Extracts RDP configuration from a cache key if present.
250
+ *
251
+ * @param cacheKey - The cache key to check
252
+ * @returns The RDP configuration, or undefined if not present
253
+ */
254
+ #getQueryRdpConfig(cacheKey) {
255
+ if ("otherKeys" in cacheKey && Array.isArray(cacheKey.otherKeys)) {
256
+ if (cacheKey.type === "object") {
257
+ return cacheKey.otherKeys[OBJECT_RDP_CONFIG_IDX];
258
+ } else if (cacheKey.type === "list") {
259
+ return cacheKey.otherKeys[LIST_RDP_IDX];
260
+ }
261
+ }
262
+ return undefined;
263
+ }
264
+
265
+ /**
266
+ * Extracts the object type (apiName) from a cache key.
267
+ *
268
+ * @param cacheKey - The cache key to check
269
+ * @returns The object type/apiName, or undefined if not applicable
270
+ */
271
+ #getQueryObjectType(cacheKey) {
272
+ if ("otherKeys" in cacheKey && Array.isArray(cacheKey.otherKeys)) {
273
+ if (cacheKey.type === "object") {
274
+ return cacheKey.otherKeys[OBJECT_API_NAME_IDX];
275
+ } else if (cacheKey.type === "list") {
276
+ return cacheKey.otherKeys[LIST_API_NAME_IDX];
277
+ }
278
+ // Links would have apiName at a different position
279
+ }
280
+ return undefined;
281
+ }
282
+
283
+ /**
284
+ * Checks if changes affect a specific object type.
285
+ *
286
+ * @param changes - The changes to check
287
+ * @param objectType - The object type to check for
288
+ * @returns true if the changes include added or modified objects of this type
289
+ */
290
+ #changesAffectObjectType(changes, objectType) {
291
+ // Check added objects (MultiMap.get returns an array)
292
+ const addedForType = changes.addedObjects.get(objectType);
293
+ if (addedForType && addedForType.length > 0) {
294
+ return true;
295
+ }
296
+
297
+ // Check modified objects (MultiMap.get returns an array)
298
+ const modifiedForType = changes.modifiedObjects.get(objectType);
299
+ if (modifiedForType && modifiedForType.length > 0) {
300
+ return true;
301
+ }
302
+ return false;
303
+ }
304
+
151
305
  /**
152
306
  * Invalidates all cache entries for a specific object type.
153
307
  * This will revalidate:
@@ -1 +1 @@
1
- {"version":3,"file":"Store.js","names":["invariant","additionalContext","DEBUG_REFCOUNTS","ActionApplication","CacheKeys","createChangedObjects","DEBUG_ONLY__changesToString","Layers","LinksHelper","ListsHelper","ObjectsHelper","ObjectSetHelper","OrderByCanonicalizer","Queries","WhereClauseCanonicalizer","Store","whereCanonicalizer","orderByCanonicalizer","queries","layers","logger","onRevalidate","maybeRevalidateQueries","bind","subjects","constructor","client","child","msgPrefix","cacheKeys","onDestroy","cleanupCacheKey","lists","objects","links","objectSets","key","subject","peek","console","log","JSON","stringify","closed","observed","type","otherKeys","process","env","NODE_ENV","delete","applyAction","action","args","opts","validateAction","result","$validateOnly","$returnEdits","getValue","cacheKey","top","get","batch","optimisticId","changes","batchFn","invalidateObject","apiName","pk","getQuery","revalidate","#maybeRevalidateQueries","methodName","undefined","isEmpty","debug","promises","keys","promise","maybeUpdateAndRevalidate","push","Promise","all","invalidateObjectType","info","truth","modified","has","query","allSettled","then","invalidateAll","invalidateObjects","objectsArray","Array","isArray","obj","$objectType","$primaryKey"],"sources":["Store.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 ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n Logger,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n} from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\nimport type { ActionSignatureFromDef } from \"../../actions/applyAction.js\";\nimport { additionalContext, type Client } from \"../../Client.js\";\nimport { DEBUG_REFCOUNTS } from \"../DebugFlags.js\";\nimport type { OptimisticBuilder } from \"../OptimisticBuilder.js\";\nimport { ActionApplication } from \"./actions/ActionApplication.js\";\nimport type { BatchContext } from \"./BatchContext.js\";\nimport { CacheKeys } from \"./CacheKeys.js\";\nimport {\n type Changes,\n createChangedObjects,\n DEBUG_ONLY__changesToString,\n} from \"./Changes.js\";\nimport type { KnownCacheKey } from \"./KnownCacheKey.js\";\nimport type { Entry } from \"./Layer.js\";\nimport { Layers } from \"./Layers.js\";\nimport { LinksHelper } from \"./links/LinksHelper.js\";\nimport { ListsHelper } from \"./list/ListsHelper.js\";\nimport { ObjectsHelper } from \"./object/ObjectsHelper.js\";\nimport { ObjectSetHelper } from \"./objectset/ObjectSetHelper.js\";\nimport { type OptimisticId } from \"./OptimisticId.js\";\nimport { OrderByCanonicalizer } from \"./OrderByCanonicalizer.js\";\nimport { Queries } from \"./Queries.js\";\nimport type { Subjects } from \"./Subjects.js\";\nimport { WhereClauseCanonicalizer } from \"./WhereClauseCanonicalizer.js\";\n\nexport namespace Store {\n export interface ApplyActionOptions {\n optimisticUpdate?: (ctx: OptimisticBuilder) => void;\n }\n}\n\n/*\n Notes:\n - Subjects are one per type per store (by cache key)\n - Data is one per layer per cache key\n*/\n\n/**\n * Central data store with layered cache architecture.\n * - Truth layer: server state | Optimistic layers: pending changes\n * - Reference counting prevents memory leaks\n * - Batch operations ensure consistency\n */\nexport class Store {\n readonly whereCanonicalizer: WhereClauseCanonicalizer =\n new WhereClauseCanonicalizer();\n readonly orderByCanonicalizer: OrderByCanonicalizer =\n new OrderByCanonicalizer();\n\n readonly client: Client;\n\n /** @internal */\n readonly logger?: Logger;\n\n readonly cacheKeys: CacheKeys<KnownCacheKey>;\n readonly queries: Queries = new Queries();\n\n readonly layers: Layers = new Layers({\n logger: this.logger,\n onRevalidate: this.#maybeRevalidateQueries.bind(this),\n });\n readonly subjects: Subjects = this.layers.subjects;\n\n // these are hopefully temporary\n readonly lists: ListsHelper;\n readonly objects: ObjectsHelper;\n readonly links: LinksHelper;\n readonly objectSets: ObjectSetHelper;\n\n constructor(client: Client) {\n this.logger = client[additionalContext].logger?.child({}, {\n msgPrefix: \"Store\",\n });\n this.client = client;\n\n this.cacheKeys = new CacheKeys<KnownCacheKey>({\n onDestroy: this.#cleanupCacheKey,\n });\n\n this.lists = new ListsHelper(\n this,\n this.cacheKeys,\n this.whereCanonicalizer,\n this.orderByCanonicalizer,\n );\n this.objects = new ObjectsHelper(this, this.cacheKeys);\n this.links = new LinksHelper(\n this,\n this.cacheKeys,\n this.whereCanonicalizer,\n this.orderByCanonicalizer,\n );\n this.objectSets = new ObjectSetHelper(\n this,\n this.cacheKeys,\n this.whereCanonicalizer,\n this.orderByCanonicalizer,\n );\n }\n\n /**\n * Called after a key is no longer retained and the timeout has elapsed\n * @param key\n */\n #cleanupCacheKey = (key: KnownCacheKey) => {\n const subject = this.subjects.peek(key);\n\n if (DEBUG_REFCOUNTS) {\n // eslint-disable-next-line no-console\n console.log(\n `CacheKey cleaning up (${\n JSON.stringify({\n closed: subject?.closed,\n observed: subject?.observed,\n })\n })`,\n JSON.stringify([key.type, ...key.otherKeys], null, 2),\n );\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n invariant(subject);\n }\n\n this.subjects.delete(key);\n this.queries.delete(key);\n };\n\n applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args:\n | Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n | Array<Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]>,\n opts?: Store.ApplyActionOptions,\n ) => Promise<ActionEditResponse> = async (action, args, opts) => {\n return await new ActionApplication(this).applyAction(action, args, opts);\n };\n\n validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse> = async (action, args) => {\n const result = await this.client(action).applyAction(args as any, {\n $validateOnly: true,\n $returnEdits: false,\n });\n return result as ActionValidationResponse;\n };\n\n public getValue<K extends KnownCacheKey>(\n cacheKey: K,\n ): Entry<K> | undefined {\n return this.layers.top.get(cacheKey);\n }\n\n batch<X>(\n { optimisticId, changes = createChangedObjects() }: {\n optimisticId?: OptimisticId;\n changes?: Changes;\n },\n batchFn: (batchContext: BatchContext) => X,\n ): {\n batchResult: BatchContext;\n retVal: X;\n changes: Changes;\n } {\n return this.layers.batch({ optimisticId, changes }, batchFn);\n }\n\n public invalidateObject<T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n ): Promise<unknown> {\n if (typeof apiName !== \"string\") {\n apiName = apiName.apiName;\n }\n\n return this.objects.getQuery({\n apiName,\n pk,\n }).revalidate(/* force */ true);\n }\n\n async #maybeRevalidateQueries(\n changes: Changes,\n optimisticId?: OptimisticId | undefined,\n ): Promise<void> {\n const logger = process.env.NODE_ENV !== \"production\"\n ? this.logger?.child({ methodName: \"maybeRevalidateQueries\" })\n : undefined;\n\n if (changes.isEmpty()) {\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"No changes, aborting\");\n }\n return;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(DEBUG_ONLY__changesToString(changes), { optimisticId });\n }\n\n try {\n const promises: Array<Promise<unknown>> = [];\n for (const cacheKey of this.queries.keys()) {\n const promise = this.queries.peek(cacheKey)?.maybeUpdateAndRevalidate?.(\n changes,\n optimisticId,\n );\n if (promise) promises.push(promise);\n }\n await Promise.all(promises);\n } finally {\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"in finally\", DEBUG_ONLY__changesToString(changes));\n }\n }\n }\n\n /**\n * Invalidates all cache entries for a specific object type.\n * This will revalidate:\n * 1. All objects of the specified type\n * 2. All lists of the specified type\n * 3. All links where the source object is of the specified type\n *\n * @param apiName - The API name of the object type to invalidate\n * @param changes - Optional changes object to track what has been modified\n * @returns Promise that resolves when all invalidations are complete\n */\n public invalidateObjectType<T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n changes: Changes | undefined,\n ): Promise<void> {\n if (typeof apiName !== \"string\") {\n apiName = apiName.apiName;\n }\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.child({ methodName: \"invalidateObjectType\" }).info(\n changes ? DEBUG_ONLY__changesToString(changes) : void 0,\n );\n }\n\n const promises: Array<Promise<void>> = [];\n\n for (const cacheKey of this.layers.truth.keys()) {\n if (changes && changes.modified.has(cacheKey)) {\n continue;\n }\n const query = this.queries.peek(cacheKey);\n if (!query) continue;\n\n promises.push(query.invalidateObjectType(apiName, changes));\n }\n\n // we use allSettled here because we don't care if it succeeds or fails, just that they all complete.\n return Promise.allSettled(promises).then(() => void 0);\n }\n\n public async invalidateAll(): Promise<void> {\n const promises: Array<Promise<unknown>> = [];\n for (const cacheKey of this.queries.keys()) {\n const query = this.queries.peek(cacheKey);\n if (query) {\n promises.push(query.revalidate(true));\n }\n }\n // we use allSettled here because we don't care if it succeeds or fails, just that they all complete.\n return Promise.allSettled(promises).then(() => void 0);\n }\n\n public async invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void> {\n const objectsArray = Array.isArray(objects) ? objects : [objects];\n const promises: Array<Promise<unknown>> = [];\n\n for (const obj of objectsArray) {\n promises.push(this.invalidateObject(obj.$objectType, obj.$primaryKey));\n }\n\n // we use allSettled here because we don't care if it succeeds or fails, just that they all complete.\n return Promise.allSettled(promises).then(() => void 0);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,OAAOA,SAAS,MAAM,gBAAgB;AAEtC,SAASC,iBAAiB,QAAqB,iBAAiB;AAChE,SAASC,eAAe,QAAQ,kBAAkB;AAElD,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAEEC,oBAAoB,EACpBC,2BAA2B,QACtB,cAAc;AAGrB,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,aAAa,QAAQ,2BAA2B;AACzD,SAASC,eAAe,QAAQ,gCAAgC;AAEhE,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,OAAO,QAAQ,cAAc;AAEtC,SAASC,wBAAwB,QAAQ,+BAA+B;AAQxE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,KAAK,CAAC;EACRC,kBAAkB,GACzB,IAAIF,wBAAwB,CAAC,CAAC;EACvBG,oBAAoB,GAC3B,IAAIL,oBAAoB,CAAC,CAAC;;EAI5B;;EAISM,OA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,OAAO,CAACQ,UAAU,CAACb,QAAQ,CAAC,CAACc,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;EACxD;EAEA,MAAaC,aAAaA,CAAA,EAAkB;IAC1C,MAAMf,QAAiC,GAAG,EAAE;IAC5C,KAAK,MAAMjB,QAAQ,IAAI,IAAI,CAAC1C,OAAO,CAAC4D,IAAI,CAAC,CAAC,EAAE;MAC1C,MAAMW,KAAK,GAAG,IAAI,CAACvE,OAAO,CAACoB,IAAI,CAACsB,QAAQ,CAAC;MACzC,IAAI6B,KAAK,EAAE;QACTZ,QAAQ,CAACI,IAAI,CAACQ,KAAK,CAAClB,UAAU,CAAC,IAAI,CAAC,CAAC;MACvC;IACF;IACA;IACA,OAAOW,OAAO,CAACQ,UAAU,CAACb,QAAQ,CAAC,CAACc,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;EACxD;EAEA,MAAaE,iBAAiBA,CAC5B5D,OAEsD,EACvC;IACf,MAAM6D,YAAY,GAAGC,KAAK,CAACC,OAAO,CAAC/D,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC;IACjE,MAAM4C,QAAiC,GAAG,EAAE;IAE5C,KAAK,MAAMoB,GAAG,IAAIH,YAAY,EAAE;MAC9BjB,QAAQ,CAACI,IAAI,CAAC,IAAI,CAACd,gBAAgB,CAAC8B,GAAG,CAACC,WAAW,EAAED,GAAG,CAACE,WAAW,CAAC,CAAC;IACxE;;IAEA;IACA,OAAOjB,OAAO,CAACQ,UAAU,CAACb,QAAQ,CAAC,CAACc,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;EACxD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"Store.js","names":["invariant","additionalContext","DEBUG_REFCOUNTS","ActionApplication","DEBUG_ONLY__cacheKeyToString","CacheKeys","createChangedObjects","DEBUG_ONLY__changesToString","Layers","LinksHelper","API_NAME_IDX","LIST_API_NAME_IDX","RDP_IDX","LIST_RDP_IDX","ListsHelper","OBJECT_API_NAME_IDX","RDP_CONFIG_IDX","OBJECT_RDP_CONFIG_IDX","ObjectCacheKeyRegistry","ObjectsHelper","ObjectSetHelper","OrderByCanonicalizer","Queries","RdpCanonicalizer","WhereClauseCanonicalizer","Store","whereCanonicalizer","orderByCanonicalizer","rdpCanonicalizer","queries","objectCacheKeyRegistry","layers","logger","onRevalidate","maybeRevalidateQueries","bind","subjects","constructor","client","child","msgPrefix","cacheKeys","onDestroy","cleanupCacheKey","lists","objects","links","objectSets","key","subject","peek","console","log","JSON","stringify","closed","observed","type","otherKeys","process","env","NODE_ENV","delete","applyAction","action","args","opts","validateAction","result","$validateOnly","$returnEdits","getValue","cacheKey","top","get","batch","optimisticId","changes","batchFn","invalidateObject","apiName","pk","variants","getVariants","promises","size","push","getQuery","undefined","revalidate","query","Promise","allSettled","#maybeRevalidateQueries","methodName","isEmpty","debug","keys","maybeUpdateAndRevalidate","shouldPropagateToQuery","promise","all","#shouldPropagateToQuery","modified","has","shouldPropagateForObjectTypeChanges","queryRdpConfig","getQueryRdpConfig","#shouldPropagateForObjectTypeChanges","queryObjectType","getQueryObjectType","affected","changesAffectObjectType","queryKey","addedCount","addedObjects","length","modifiedCount","modifiedObjects","#getQueryRdpConfig","Array","isArray","#getQueryObjectType","#changesAffectObjectType","objectType","addedForType","modifiedForType","invalidateObjectType","info","truth","then","invalidateAll","invalidateObjects","objectsArray","obj","$objectType","$primaryKey"],"sources":["Store.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 ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n Logger,\n ObjectTypeDefinition,\n Osdk,\n PrimaryKeyType,\n} from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\nimport type { ActionSignatureFromDef } from \"../../actions/applyAction.js\";\nimport { additionalContext, type Client } from \"../../Client.js\";\nimport { DEBUG_REFCOUNTS } from \"../DebugFlags.js\";\nimport type { OptimisticBuilder } from \"../OptimisticBuilder.js\";\nimport { ActionApplication } from \"./actions/ActionApplication.js\";\nimport type { BatchContext } from \"./BatchContext.js\";\nimport { DEBUG_ONLY__cacheKeyToString } from \"./CacheKey.js\";\nimport { CacheKeys } from \"./CacheKeys.js\";\nimport type { Canonical } from \"./Canonical.js\";\nimport {\n type Changes,\n createChangedObjects,\n DEBUG_ONLY__changesToString,\n} from \"./Changes.js\";\nimport type { KnownCacheKey } from \"./KnownCacheKey.js\";\nimport type { Entry } from \"./Layer.js\";\nimport { Layers } from \"./Layers.js\";\nimport { LinksHelper } from \"./links/LinksHelper.js\";\nimport {\n API_NAME_IDX as LIST_API_NAME_IDX,\n RDP_IDX as LIST_RDP_IDX,\n} from \"./list/ListCacheKey.js\";\nimport { ListsHelper } from \"./list/ListsHelper.js\";\nimport {\n API_NAME_IDX as OBJECT_API_NAME_IDX,\n RDP_CONFIG_IDX as OBJECT_RDP_CONFIG_IDX,\n} from \"./object/ObjectCacheKey.js\";\nimport { ObjectCacheKeyRegistry } from \"./object/ObjectCacheKeyRegistry.js\";\nimport { ObjectsHelper } from \"./object/ObjectsHelper.js\";\nimport { ObjectSetHelper } from \"./objectset/ObjectSetHelper.js\";\nimport { type OptimisticId } from \"./OptimisticId.js\";\nimport { OrderByCanonicalizer } from \"./OrderByCanonicalizer.js\";\nimport { Queries } from \"./Queries.js\";\nimport { type Rdp, RdpCanonicalizer } from \"./RdpCanonicalizer.js\";\nimport type { Subjects } from \"./Subjects.js\";\nimport { WhereClauseCanonicalizer } from \"./WhereClauseCanonicalizer.js\";\n\nexport namespace Store {\n export interface ApplyActionOptions {\n optimisticUpdate?: (ctx: OptimisticBuilder) => void;\n }\n}\n\n/*\n Notes:\n - Subjects are one per type per store (by cache key)\n - Data is one per layer per cache key\n*/\n\n/**\n * Central data store with layered cache architecture.\n * - Truth layer: server state | Optimistic layers: pending changes\n * - Reference counting prevents memory leaks\n * - Batch operations ensure consistency\n */\nexport class Store {\n readonly whereCanonicalizer: WhereClauseCanonicalizer =\n new WhereClauseCanonicalizer();\n readonly orderByCanonicalizer: OrderByCanonicalizer =\n new OrderByCanonicalizer();\n readonly rdpCanonicalizer: RdpCanonicalizer = new RdpCanonicalizer();\n\n readonly client: Client;\n\n /** @internal */\n readonly logger?: Logger;\n\n readonly cacheKeys: CacheKeys<KnownCacheKey>;\n readonly queries: Queries = new Queries();\n readonly objectCacheKeyRegistry: ObjectCacheKeyRegistry =\n new ObjectCacheKeyRegistry();\n\n readonly layers: Layers = new Layers({\n logger: this.logger,\n onRevalidate: this.#maybeRevalidateQueries.bind(this),\n });\n readonly subjects: Subjects = this.layers.subjects;\n\n // these are hopefully temporary\n readonly lists: ListsHelper;\n readonly objects: ObjectsHelper;\n readonly links: LinksHelper;\n readonly objectSets: ObjectSetHelper;\n\n constructor(client: Client) {\n this.logger = client[additionalContext].logger?.child({}, {\n msgPrefix: \"Store\",\n });\n this.client = client;\n\n this.cacheKeys = new CacheKeys<KnownCacheKey>({\n onDestroy: this.#cleanupCacheKey,\n });\n\n this.lists = new ListsHelper(\n this,\n this.cacheKeys,\n this.whereCanonicalizer,\n this.orderByCanonicalizer,\n this.rdpCanonicalizer,\n );\n this.objects = new ObjectsHelper(this, this.cacheKeys);\n this.links = new LinksHelper(\n this,\n this.cacheKeys,\n this.whereCanonicalizer,\n this.orderByCanonicalizer,\n );\n this.objectSets = new ObjectSetHelper(\n this,\n this.cacheKeys,\n this.whereCanonicalizer,\n this.orderByCanonicalizer,\n );\n }\n\n /**\n * Called after a key is no longer retained and the timeout has elapsed\n * @param key\n */\n #cleanupCacheKey = (key: KnownCacheKey) => {\n const subject = this.subjects.peek(key);\n\n if (DEBUG_REFCOUNTS) {\n // eslint-disable-next-line no-console\n console.log(\n `CacheKey cleaning up (${\n JSON.stringify({\n closed: subject?.closed,\n observed: subject?.observed,\n })\n })`,\n JSON.stringify([key.type, ...key.otherKeys], null, 2),\n );\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n invariant(subject);\n }\n\n this.subjects.delete(key);\n this.queries.delete(key);\n };\n\n applyAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args:\n | Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n | Array<Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]>,\n opts?: Store.ApplyActionOptions,\n ) => Promise<ActionEditResponse> = async (action, args, opts) => {\n return await new ActionApplication(this).applyAction(action, args, opts);\n };\n\n validateAction: <Q extends ActionDefinition<any>>(\n action: Q,\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse> = async (action, args) => {\n const result = await this.client(action).applyAction(args as any, {\n $validateOnly: true,\n $returnEdits: false,\n });\n return result as ActionValidationResponse;\n };\n\n public getValue<K extends KnownCacheKey>(\n cacheKey: K,\n ): Entry<K> | undefined {\n return this.layers.top.get(cacheKey);\n }\n\n batch<X>(\n { optimisticId, changes = createChangedObjects() }: {\n optimisticId?: OptimisticId;\n changes?: Changes;\n },\n batchFn: (batchContext: BatchContext) => X,\n ): {\n batchResult: BatchContext;\n retVal: X;\n changes: Changes;\n } {\n return this.layers.batch({ optimisticId, changes }, batchFn);\n }\n\n public invalidateObject<T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n pk: PrimaryKeyType<T>,\n ): Promise<unknown> {\n if (typeof apiName !== \"string\") {\n apiName = apiName.apiName;\n }\n const variants = this.objectCacheKeyRegistry.getVariants(apiName, pk);\n\n // Invalidate all variant cache entries\n // Using Promise.allSettled to ensure if one invalidation fails, others will still complete.\n // This prevents a single failing query from blocking invalidation of other cache variants for the same object.\n const promises: Promise<void>[] = [];\n\n if (variants.size === 0) {\n // No registered variants - create and revalidate the base variant (no RDP)\n promises.push(\n this.objects.getQuery({\n apiName,\n pk,\n }, undefined).revalidate(/* force */ true),\n );\n } else {\n // Revalidate all registered variants\n for (const key of variants) {\n const query = this.queries.peek(key);\n if (query) {\n promises.push(query.revalidate(/* force */ true));\n }\n }\n }\n\n return Promise.allSettled(promises);\n }\n\n async #maybeRevalidateQueries(\n changes: Changes,\n optimisticId?: OptimisticId | undefined,\n ): Promise<void> {\n const logger = process.env.NODE_ENV !== \"production\"\n ? this.logger?.child({ methodName: \"maybeRevalidateQueries\" })\n : undefined;\n\n if (changes.isEmpty()) {\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"No changes, aborting\");\n }\n return;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(DEBUG_ONLY__changesToString(changes), { optimisticId });\n }\n\n try {\n const promises: Array<Promise<unknown>> = [];\n for (const cacheKey of this.queries.keys()) {\n const query = this.queries.peek(cacheKey);\n if (!query?.maybeUpdateAndRevalidate) {\n continue;\n }\n\n // Only propagate to queries that should receive these changes\n if (\n !this.#shouldPropagateToQuery(\n {\n cacheKey,\n maybeUpdateAndRevalidate: query.maybeUpdateAndRevalidate,\n },\n changes,\n optimisticId,\n )\n ) {\n continue;\n }\n\n const promise = query.maybeUpdateAndRevalidate(changes, optimisticId);\n if (promise) promises.push(promise);\n }\n await Promise.all(promises);\n } finally {\n if (process.env.NODE_ENV !== \"production\") {\n logger?.debug(\"in finally\", DEBUG_ONLY__changesToString(changes));\n }\n }\n }\n\n /**\n * Determines whether changes should propagate to a specific query.\n * Prevents unnecessary observable pipeline execution for cross-propagation.\n *\n * @param query - The query to check\n * @param changes - The changes that occurred\n * @param optimisticId - Optional optimistic update ID\n * @returns true if the query should be notified of these changes\n */\n #shouldPropagateToQuery(\n query: {\n cacheKey: KnownCacheKey;\n maybeUpdateAndRevalidate?: (\n changes: Changes,\n optimisticId: OptimisticId | undefined,\n ) => Promise<void> | undefined;\n },\n changes: Changes,\n optimisticId?: OptimisticId,\n ): boolean {\n // Always propagate optimistic updates (user-initiated actions need immediate feedback)\n if (optimisticId) {\n return true;\n }\n\n // If the query's own cache key was modified (direct fetch), always propagate\n if (changes.modified.has(query.cacheKey)) {\n return true;\n }\n\n // Check if the query's object type is affected by the changes\n if (this.#shouldPropagateForObjectTypeChanges(query.cacheKey, changes)) {\n return true;\n }\n\n // For other cross-propagation (e.g., RDP field updates from unrelated object types):\n // Only propagate to queries WITH RDP configurations\n const queryRdpConfig = this.#getQueryRdpConfig(query.cacheKey);\n\n // If query has no RDP, don't propagate unrelated object changes to it\n // (it will get updates from its own direct fetches only)\n return queryRdpConfig != null;\n }\n\n /**\n * Checks if changes to an object type should propagate to a query.\n * This ensures queries receive updates when objects of their type are added/modified.\n *\n * @param cacheKey - The cache key of the query\n * @param changes - The changes that occurred\n * @returns true if the query should be notified based on object type changes\n */\n #shouldPropagateForObjectTypeChanges(\n cacheKey: KnownCacheKey,\n changes: Changes,\n ): boolean {\n const queryObjectType = this.#getQueryObjectType(cacheKey);\n if (!queryObjectType) {\n return false;\n }\n\n const affected = this.#changesAffectObjectType(changes, queryObjectType);\n\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.child({ methodName: \"shouldPropagateToQuery\" }).debug(\n `Query type: ${queryObjectType}, affected: ${affected}`,\n {\n queryKey: DEBUG_ONLY__cacheKeyToString(cacheKey),\n addedCount: changes.addedObjects.get(queryObjectType)?.length ?? 0,\n modifiedCount: changes.modifiedObjects.get(queryObjectType)?.length\n ?? 0,\n },\n );\n }\n\n return affected;\n }\n\n /**\n * Extracts RDP configuration from a cache key if present.\n *\n * @param cacheKey - The cache key to check\n * @returns The RDP configuration, or undefined if not present\n */\n #getQueryRdpConfig(\n cacheKey: KnownCacheKey,\n ): Canonical<Rdp> | undefined {\n if (\"otherKeys\" in cacheKey && Array.isArray(cacheKey.otherKeys)) {\n if (cacheKey.type === \"object\") {\n return cacheKey.otherKeys[OBJECT_RDP_CONFIG_IDX];\n } else if (cacheKey.type === \"list\") {\n return cacheKey.otherKeys[LIST_RDP_IDX];\n }\n }\n return undefined;\n }\n\n /**\n * Extracts the object type (apiName) from a cache key.\n *\n * @param cacheKey - The cache key to check\n * @returns The object type/apiName, or undefined if not applicable\n */\n #getQueryObjectType(cacheKey: KnownCacheKey): string | undefined {\n if (\"otherKeys\" in cacheKey && Array.isArray(cacheKey.otherKeys)) {\n if (cacheKey.type === \"object\") {\n return cacheKey.otherKeys[OBJECT_API_NAME_IDX];\n } else if (cacheKey.type === \"list\") {\n return cacheKey.otherKeys[LIST_API_NAME_IDX];\n }\n // Links would have apiName at a different position\n }\n return undefined;\n }\n\n /**\n * Checks if changes affect a specific object type.\n *\n * @param changes - The changes to check\n * @param objectType - The object type to check for\n * @returns true if the changes include added or modified objects of this type\n */\n #changesAffectObjectType(changes: Changes, objectType: string): boolean {\n // Check added objects (MultiMap.get returns an array)\n const addedForType = changes.addedObjects.get(objectType);\n if (addedForType && addedForType.length > 0) {\n return true;\n }\n\n // Check modified objects (MultiMap.get returns an array)\n const modifiedForType = changes.modifiedObjects.get(objectType);\n if (modifiedForType && modifiedForType.length > 0) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Invalidates all cache entries for a specific object type.\n * This will revalidate:\n * 1. All objects of the specified type\n * 2. All lists of the specified type\n * 3. All links where the source object is of the specified type\n *\n * @param apiName - The API name of the object type to invalidate\n * @param changes - Optional changes object to track what has been modified\n * @returns Promise that resolves when all invalidations are complete\n */\n public invalidateObjectType<T extends ObjectTypeDefinition>(\n apiName: T[\"apiName\"] | T,\n changes: Changes | undefined,\n ): Promise<void> {\n if (typeof apiName !== \"string\") {\n apiName = apiName.apiName;\n }\n if (process.env.NODE_ENV !== \"production\") {\n this.logger?.child({ methodName: \"invalidateObjectType\" }).info(\n changes ? DEBUG_ONLY__changesToString(changes) : void 0,\n );\n }\n\n const promises: Array<Promise<void>> = [];\n\n for (const cacheKey of this.layers.truth.keys()) {\n if (changes && changes.modified.has(cacheKey)) {\n continue;\n }\n const query = this.queries.peek(cacheKey);\n if (!query) continue;\n\n promises.push(query.invalidateObjectType(apiName, changes));\n }\n\n // we use allSettled here because we don't care if it succeeds or fails, just that they all complete.\n return Promise.allSettled(promises).then(() => void 0);\n }\n\n public async invalidateAll(): Promise<void> {\n const promises: Array<Promise<unknown>> = [];\n for (const cacheKey of this.queries.keys()) {\n const query = this.queries.peek(cacheKey);\n if (query) {\n promises.push(query.revalidate(true));\n }\n }\n // we use allSettled here because we don't care if it succeeds or fails, just that they all complete.\n return Promise.allSettled(promises).then(() => void 0);\n }\n\n public async invalidateObjects(\n objects:\n | Osdk.Instance<ObjectTypeDefinition>\n | ReadonlyArray<Osdk.Instance<ObjectTypeDefinition>>,\n ): Promise<void> {\n const objectsArray = Array.isArray(objects) ? objects : [objects];\n const promises: Array<Promise<unknown>> = [];\n\n for (const obj of objectsArray) {\n promises.push(this.invalidateObject(obj.$objectType, obj.$primaryKey));\n }\n\n // we use allSettled here because we don't care if it succeeds or fails, just that they all complete.\n return Promise.allSettled(promises).then(() => void 0);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,OAAOA,SAAS,MAAM,gBAAgB;AAEtC,SAASC,iBAAiB,QAAqB,iBAAiB;AAChE,SAASC,eAAe,QAAQ,kBAAkB;AAElD,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,4BAA4B,QAAQ,eAAe;AAC5D,SAASC,SAAS,QAAQ,gBAAgB;AAE1C,SAEEC,oBAAoB,EACpBC,2BAA2B,QACtB,cAAc;AAGrB,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SACEC,YAAY,IAAIC,iBAAiB,EACjCC,OAAO,IAAIC,YAAY,QAClB,wBAAwB;AAC/B,SAASC,WAAW,QAAQ,uBAAuB;AACnD,S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EAAE;MAC9BjD,QAAQ,CAACE,IAAI,CAAC,IAAI,CAACP,gBAAgB,CAACuD,GAAG,CAACC,WAAW,EAAED,GAAG,CAACE,WAAW,CAAC,CAAC;IACxE;;IAEA;IACA,OAAO7C,OAAO,CAACC,UAAU,CAACR,QAAQ,CAAC,CAAC8C,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;EACxD;AACF","ignoreList":[]}
@@ -81,7 +81,7 @@ export class WhereClauseCanonicalizer {
81
81
  if (k === "$and" || k === "$or") {
82
82
  return [k, v.map(x => this.#toCanon(x, set))];
83
83
  }
84
- if (k !== "$not" && typeof v === "object" && "$eq" in v) {
84
+ if (k !== "$not" && typeof v === "object" && v != null && "$eq" in v) {
85
85
  return [k, v["$eq"]];
86
86
  }
87
87
  return [k, v];