@osdk/client 2.6.0-beta.3 → 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 (251) hide show
  1. package/CHANGELOG.md +15 -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/objectSet/ObjectSetListenerWebsocket.js +17 -0
  26. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  27. package/build/browser/observable/ObservableClient.js.map +1 -1
  28. package/build/browser/observable/internal/BulkObjectLoader.js +12 -4
  29. package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
  30. package/build/browser/observable/internal/BulkObjectLoader.test.js +48 -0
  31. package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -1
  32. package/build/browser/observable/internal/CacheKeys.js +9 -3
  33. package/build/browser/observable/internal/CacheKeys.js.map +1 -1
  34. package/build/browser/observable/internal/Canonicalizer.js +51 -0
  35. package/build/browser/observable/internal/Canonicalizer.js.map +1 -0
  36. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  37. package/build/browser/observable/internal/OrderByCanonicalizer.js +1 -4
  38. package/build/browser/observable/internal/OrderByCanonicalizer.js.map +1 -1
  39. package/build/browser/observable/internal/RdpCanonicalizer.js +66 -0
  40. package/build/browser/observable/internal/RdpCanonicalizer.js.map +1 -0
  41. package/build/browser/observable/internal/RdpCanonicalizer.test.js +68 -0
  42. package/build/browser/observable/internal/RdpCanonicalizer.test.js.map +1 -0
  43. package/build/browser/observable/internal/SimpleWhereClause.js.map +1 -1
  44. package/build/browser/observable/internal/Store.js +160 -6
  45. package/build/browser/observable/internal/Store.js.map +1 -1
  46. package/build/browser/observable/internal/WhereClauseCanonicalizer.js +1 -1
  47. package/build/browser/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
  48. package/build/browser/observable/internal/actions/ActionApplication.js +1 -1
  49. package/build/browser/observable/internal/actions/ActionApplication.js.map +1 -1
  50. package/build/browser/observable/internal/actions/OptimisticJob.js +3 -3
  51. package/build/browser/observable/internal/actions/OptimisticJob.js.map +1 -1
  52. package/build/browser/observable/internal/base-list/BaseListQuery.js +12 -3
  53. package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
  54. package/build/browser/observable/internal/base-list/createCollectionConnectable.js +0 -5
  55. package/build/browser/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
  56. package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js +26 -13
  57. package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
  58. package/build/browser/observable/internal/evaluateFilter.js +61 -0
  59. package/build/browser/observable/internal/evaluateFilter.js.map +1 -0
  60. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js +33 -1
  61. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  62. package/build/browser/observable/internal/list/InterfaceListQuery.js +8 -3
  63. package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
  64. package/build/browser/observable/internal/list/ListCacheKey.js +22 -1
  65. package/build/browser/observable/internal/list/ListCacheKey.js.map +1 -1
  66. package/build/browser/observable/internal/list/ListQuery.js +19 -13
  67. package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
  68. package/build/browser/observable/internal/list/ListsHelper.js +12 -8
  69. package/build/browser/observable/internal/list/ListsHelper.js.map +1 -1
  70. package/build/browser/observable/internal/list/ObjectListQuery.js +10 -1
  71. package/build/browser/observable/internal/list/ObjectListQuery.js.map +1 -1
  72. package/build/browser/observable/internal/object/ObjectCacheKey.js +20 -1
  73. package/build/browser/observable/internal/object/ObjectCacheKey.js.map +1 -1
  74. package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.js +126 -0
  75. package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.js.map +1 -0
  76. package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.test.js +173 -0
  77. package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.test.js.map +1 -0
  78. package/build/browser/observable/internal/object/ObjectQuery.js +10 -58
  79. package/build/browser/observable/internal/object/ObjectQuery.js.map +1 -1
  80. package/build/browser/observable/internal/object/ObjectsHelper.js +65 -5
  81. package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -1
  82. package/build/browser/observable/internal/objectMatchesWhereClause.js +3 -37
  83. package/build/browser/observable/internal/objectMatchesWhereClause.js.map +1 -1
  84. package/build/browser/observable/internal/testUtils.js +3 -2
  85. package/build/browser/observable/internal/testUtils.js.map +1 -1
  86. package/build/browser/observable/internal/utils/rdpFieldOperations.js +83 -0
  87. package/build/browser/observable/internal/utils/rdpFieldOperations.js.map +1 -0
  88. package/build/browser/util/UserAgent.js +2 -2
  89. package/build/cjs/{chunk-BRYZR53E.cjs → chunk-7567LSZD.cjs} +54 -54
  90. package/build/cjs/{chunk-BRYZR53E.cjs.map → chunk-7567LSZD.cjs.map} +1 -1
  91. package/build/cjs/{chunk-6L3MX4LH.cjs → chunk-VNLY3YOJ.cjs} +241 -196
  92. package/build/cjs/chunk-VNLY3YOJ.cjs.map +1 -0
  93. package/build/cjs/index.cjs +8 -8
  94. package/build/cjs/index.d.cts +1 -1
  95. package/build/cjs/public/internal.cjs +8 -8
  96. package/build/cjs/public/unstable-do-not-use.cjs +633 -208
  97. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  98. package/build/cjs/public/unstable-do-not-use.d.cts +6 -5
  99. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +2 -1
  100. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  101. package/build/esm/index.js.map +1 -1
  102. package/build/esm/internal/conversions/extractNamespace.js +22 -0
  103. package/build/esm/internal/conversions/extractNamespace.js.map +1 -0
  104. package/build/esm/internal/conversions/fullyQualifyPropName.js +26 -0
  105. package/build/esm/internal/conversions/fullyQualifyPropName.js.map +1 -0
  106. package/build/esm/internal/conversions/makeGeoFilterBbox.js +41 -0
  107. package/build/esm/internal/conversions/makeGeoFilterBbox.js.map +1 -0
  108. package/build/esm/internal/conversions/makeGeoFilterIntersects.js +29 -0
  109. package/build/esm/internal/conversions/makeGeoFilterIntersects.js.map +1 -0
  110. package/build/esm/internal/conversions/makeGeoFilterPolygon.js +30 -0
  111. package/build/esm/internal/conversions/makeGeoFilterPolygon.js.map +1 -0
  112. package/build/esm/internal/conversions/makeGeoFilterWithin.js +48 -0
  113. package/build/esm/internal/conversions/makeGeoFilterWithin.js.map +1 -0
  114. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +30 -99
  115. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  116. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +139 -0
  117. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  118. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +1 -1
  119. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  120. package/build/esm/object/fetchPage.js +1 -1
  121. package/build/esm/object/fetchPage.js.map +1 -1
  122. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +17 -0
  123. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  124. package/build/esm/observable/ObservableClient.js.map +1 -1
  125. package/build/esm/observable/internal/BulkObjectLoader.js +12 -4
  126. package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
  127. package/build/esm/observable/internal/BulkObjectLoader.test.js +48 -0
  128. package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -1
  129. package/build/esm/observable/internal/CacheKeys.js +9 -3
  130. package/build/esm/observable/internal/CacheKeys.js.map +1 -1
  131. package/build/esm/observable/internal/Canonicalizer.js +51 -0
  132. package/build/esm/observable/internal/Canonicalizer.js.map +1 -0
  133. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  134. package/build/esm/observable/internal/OrderByCanonicalizer.js +1 -4
  135. package/build/esm/observable/internal/OrderByCanonicalizer.js.map +1 -1
  136. package/build/esm/observable/internal/RdpCanonicalizer.js +66 -0
  137. package/build/esm/observable/internal/RdpCanonicalizer.js.map +1 -0
  138. package/build/esm/observable/internal/RdpCanonicalizer.test.js +68 -0
  139. package/build/esm/observable/internal/RdpCanonicalizer.test.js.map +1 -0
  140. package/build/esm/observable/internal/SimpleWhereClause.js.map +1 -1
  141. package/build/esm/observable/internal/Store.js +160 -6
  142. package/build/esm/observable/internal/Store.js.map +1 -1
  143. package/build/esm/observable/internal/WhereClauseCanonicalizer.js +1 -1
  144. package/build/esm/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
  145. package/build/esm/observable/internal/actions/ActionApplication.js +1 -1
  146. package/build/esm/observable/internal/actions/ActionApplication.js.map +1 -1
  147. package/build/esm/observable/internal/actions/OptimisticJob.js +3 -3
  148. package/build/esm/observable/internal/actions/OptimisticJob.js.map +1 -1
  149. package/build/esm/observable/internal/base-list/BaseListQuery.js +12 -3
  150. package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
  151. package/build/esm/observable/internal/base-list/createCollectionConnectable.js +0 -5
  152. package/build/esm/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
  153. package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js +26 -13
  154. package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
  155. package/build/esm/observable/internal/evaluateFilter.js +61 -0
  156. package/build/esm/observable/internal/evaluateFilter.js.map +1 -0
  157. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js +33 -1
  158. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  159. package/build/esm/observable/internal/list/InterfaceListQuery.js +8 -3
  160. package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
  161. package/build/esm/observable/internal/list/ListCacheKey.js +22 -1
  162. package/build/esm/observable/internal/list/ListCacheKey.js.map +1 -1
  163. package/build/esm/observable/internal/list/ListQuery.js +19 -13
  164. package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
  165. package/build/esm/observable/internal/list/ListsHelper.js +12 -8
  166. package/build/esm/observable/internal/list/ListsHelper.js.map +1 -1
  167. package/build/esm/observable/internal/list/ObjectListQuery.js +10 -1
  168. package/build/esm/observable/internal/list/ObjectListQuery.js.map +1 -1
  169. package/build/esm/observable/internal/object/ObjectCacheKey.js +20 -1
  170. package/build/esm/observable/internal/object/ObjectCacheKey.js.map +1 -1
  171. package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.js +126 -0
  172. package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.js.map +1 -0
  173. package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.test.js +173 -0
  174. package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.test.js.map +1 -0
  175. package/build/esm/observable/internal/object/ObjectQuery.js +10 -58
  176. package/build/esm/observable/internal/object/ObjectQuery.js.map +1 -1
  177. package/build/esm/observable/internal/object/ObjectsHelper.js +65 -5
  178. package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -1
  179. package/build/esm/observable/internal/objectMatchesWhereClause.js +3 -37
  180. package/build/esm/observable/internal/objectMatchesWhereClause.js.map +1 -1
  181. package/build/esm/observable/internal/testUtils.js +3 -2
  182. package/build/esm/observable/internal/testUtils.js.map +1 -1
  183. package/build/esm/observable/internal/utils/rdpFieldOperations.js +83 -0
  184. package/build/esm/observable/internal/utils/rdpFieldOperations.js.map +1 -0
  185. package/build/esm/util/UserAgent.js +2 -2
  186. package/build/types/index.d.ts +1 -1
  187. package/build/types/index.d.ts.map +1 -1
  188. package/build/types/internal/conversions/extractNamespace.d.ts +1 -0
  189. package/build/types/internal/conversions/extractNamespace.d.ts.map +1 -0
  190. package/build/types/internal/conversions/fullyQualifyPropName.d.ts +2 -0
  191. package/build/types/internal/conversions/fullyQualifyPropName.d.ts.map +1 -0
  192. package/build/types/internal/conversions/makeGeoFilterBbox.d.ts +3 -0
  193. package/build/types/internal/conversions/makeGeoFilterBbox.d.ts.map +1 -0
  194. package/build/types/internal/conversions/makeGeoFilterIntersects.d.ts +3 -0
  195. package/build/types/internal/conversions/makeGeoFilterIntersects.d.ts.map +1 -0
  196. package/build/types/internal/conversions/makeGeoFilterPolygon.d.ts +3 -0
  197. package/build/types/internal/conversions/makeGeoFilterPolygon.d.ts.map +1 -0
  198. package/build/types/internal/conversions/makeGeoFilterWithin.d.ts +3 -0
  199. package/build/types/internal/conversions/makeGeoFilterWithin.d.ts.map +1 -0
  200. package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts +1 -1
  201. package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts.map +1 -1
  202. package/build/types/observable/ObservableClient.d.ts +15 -5
  203. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  204. package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
  205. package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
  206. package/build/types/observable/internal/Canonicalizer.d.ts +37 -0
  207. package/build/types/observable/internal/Canonicalizer.d.ts.map +1 -0
  208. package/build/types/observable/internal/OrderByCanonicalizer.d.ts.map +1 -1
  209. package/build/types/observable/internal/RdpCanonicalizer.d.ts +8 -0
  210. package/build/types/observable/internal/RdpCanonicalizer.d.ts.map +1 -0
  211. package/build/types/observable/internal/RdpCanonicalizer.test.d.ts +1 -0
  212. package/build/types/observable/internal/RdpCanonicalizer.test.d.ts.map +1 -0
  213. package/build/types/observable/internal/SimpleWhereClause.d.ts +6 -2
  214. package/build/types/observable/internal/SimpleWhereClause.d.ts.map +1 -1
  215. package/build/types/observable/internal/Store.d.ts +4 -0
  216. package/build/types/observable/internal/Store.d.ts.map +1 -1
  217. package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts +5 -2
  218. package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts.map +1 -1
  219. package/build/types/observable/internal/actions/ActionApplication.d.ts.map +1 -1
  220. package/build/types/observable/internal/base-list/BaseListQuery.d.ts +6 -0
  221. package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
  222. package/build/types/observable/internal/base-list/createCollectionConnectable.d.ts +1 -23
  223. package/build/types/observable/internal/base-list/createCollectionConnectable.d.ts.map +1 -1
  224. package/build/types/observable/internal/evaluateFilter.d.ts +6 -0
  225. package/build/types/observable/internal/evaluateFilter.d.ts.map +1 -0
  226. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts +5 -0
  227. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts.map +1 -1
  228. package/build/types/observable/internal/list/InterfaceListQuery.d.ts.map +1 -1
  229. package/build/types/observable/internal/list/ListCacheKey.d.ts +7 -1
  230. package/build/types/observable/internal/list/ListCacheKey.d.ts.map +1 -1
  231. package/build/types/observable/internal/list/ListQuery.d.ts +7 -7
  232. package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
  233. package/build/types/observable/internal/list/ListsHelper.d.ts +3 -1
  234. package/build/types/observable/internal/list/ListsHelper.d.ts.map +1 -1
  235. package/build/types/observable/internal/list/ObjectListQuery.d.ts.map +1 -1
  236. package/build/types/observable/internal/object/ObjectCacheKey.d.ts +6 -1
  237. package/build/types/observable/internal/object/ObjectCacheKey.d.ts.map +1 -1
  238. package/build/types/observable/internal/object/ObjectCacheKeyRegistry.d.ts +60 -0
  239. package/build/types/observable/internal/object/ObjectCacheKeyRegistry.d.ts.map +1 -0
  240. package/build/types/observable/internal/object/ObjectCacheKeyRegistry.test.d.ts +1 -0
  241. package/build/types/observable/internal/object/ObjectCacheKeyRegistry.test.d.ts.map +1 -0
  242. package/build/types/observable/internal/object/ObjectQuery.d.ts +1 -1
  243. package/build/types/observable/internal/object/ObjectQuery.d.ts.map +1 -1
  244. package/build/types/observable/internal/object/ObjectsHelper.d.ts +15 -1
  245. package/build/types/observable/internal/object/ObjectsHelper.d.ts.map +1 -1
  246. package/build/types/observable/internal/objectMatchesWhereClause.d.ts.map +1 -1
  247. package/build/types/observable/internal/testUtils.d.ts.map +1 -1
  248. package/build/types/observable/internal/utils/rdpFieldOperations.d.ts +5 -0
  249. package/build/types/observable/internal/utils/rdpFieldOperations.d.ts.map +1 -0
  250. package/package.json +9 -9
  251. package/build/cjs/chunk-6L3MX4LH.cjs.map +0 -1
@@ -0,0 +1,51 @@
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
+ /**
18
+ * Interface for canonicalizing objects.
19
+ */
20
+
21
+ /**
22
+ * Base class for canonicalizers that provides common caching infrastructure.
23
+ * Subclasses control how structural deduplication is performed.
24
+ */
25
+ export class CachingCanonicalizer {
26
+ /**
27
+ * Cache for input object identity.
28
+ */
29
+ inputCache = new WeakMap();
30
+
31
+ /**
32
+ * Look up or create a canonical form for the given input.
33
+ * This method handles the structural deduplication logic.
34
+ *
35
+ * @param input The input to canonicalize
36
+ * @returns The canonical form
37
+ */
38
+
39
+ canonicalize(input) {
40
+ if (!input) {
41
+ return undefined;
42
+ }
43
+ if (this.inputCache.has(input)) {
44
+ return this.inputCache.get(input);
45
+ }
46
+ const canonical = this.lookupOrCreate(input);
47
+ this.inputCache.set(input, canonical);
48
+ return canonical;
49
+ }
50
+ }
51
+ //# sourceMappingURL=Canonicalizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Canonicalizer.js","names":["CachingCanonicalizer","inputCache","WeakMap","canonicalize","input","undefined","has","get","canonical","lookupOrCreate","set"],"sources":["Canonicalizer.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 { Canonical } from \"./Canonical.js\";\n\n/**\n * Interface for canonicalizing objects.\n */\nexport interface Canonicalizer<TInput, TCanonical> {\n /**\n * Canonicalizes the input object. Returns the same reference for\n * structurally identical inputs.\n */\n canonicalize(input: TInput | undefined): Canonical<TCanonical> | undefined;\n}\n\n/**\n * Base class for canonicalizers that provides common caching infrastructure.\n * Subclasses control how structural deduplication is performed.\n */\nexport abstract class CachingCanonicalizer<TInput extends object, TCanonical>\n implements Canonicalizer<TInput, TCanonical>\n{\n /**\n * Cache for input object identity.\n */\n protected inputCache: WeakMap<TInput, Canonical<TCanonical>> = new WeakMap<\n TInput,\n Canonical<TCanonical>\n >();\n\n /**\n * Look up or create a canonical form for the given input.\n * This method handles the structural deduplication logic.\n *\n * @param input The input to canonicalize\n * @returns The canonical form\n */\n protected abstract lookupOrCreate(input: TInput): Canonical<TCanonical>;\n\n canonicalize(input: TInput): Canonical<TCanonical>;\n canonicalize(input: TInput | undefined): Canonical<TCanonical> | undefined;\n canonicalize(input: TInput | undefined): Canonical<TCanonical> | undefined {\n if (!input) {\n return undefined;\n }\n if (this.inputCache.has(input)) {\n return this.inputCache.get(input)!;\n }\n\n const canonical = this.lookupOrCreate(input);\n this.inputCache.set(input, canonical);\n\n return canonical;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA,OAAO,MAAeA,oBAAoB,CAE1C;EACE;AACF;AACA;EACYC,UAAU,GAA2C,IAAIC,OAAO,CAGxE,CAAC;;EAEH;AACF;AACA;AACA;AACA;AACA;AACA;;EAKEC,YAAYA,CAACC,KAAyB,EAAqC;IACzE,IAAI,CAACA,KAAK,EAAE;MACV,OAAOC,SAAS;IAClB;IACA,IAAI,IAAI,CAACJ,UAAU,CAACK,GAAG,CAACF,KAAK,CAAC,EAAE;MAC9B,OAAO,IAAI,CAACH,UAAU,CAACM,GAAG,CAACH,KAAK,CAAC;IACnC;IAEA,MAAMI,SAAS,GAAG,IAAI,CAACC,cAAc,CAACL,KAAK,CAAC;IAC5C,IAAI,CAACH,UAAU,CAACS,GAAG,CAACN,KAAK,EAAEI,SAAS,CAAC;IAErC,OAAOA,SAAS;EAClB;AACF","ignoreList":[]}
@@ -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,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,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC;IAEjE,MAAMS,SAAS,GAAG,IAAIvB,YAAY,CAAC,CAAC;IAEpC,KAAK,MAAMwB,GAAG,IAAIJ,YAAY,EAAE;MAC9B,MAAMK,iBAAiB,GAAG,IAAI,CAACpB,mBAAmB,CAACqB,KAAK,CACrDX,OAAO,CACN;QACE,GAAGH,OAAO;QACVe,OAAO,EAAE;UACPC,IAAI,EAAE,QAAQ;UACdlB,OAAO,EAAEc,GAAG,CAACK;QACf,CAAC;QACDV,QAAQ;QACRR,EAAE,EAAEa,GAAG,CAACM;MACV,CAAC;MACD;MACAjB,KACF,CAAC;MAEHU,SAAS,CAACQ,GAAG,CAACN,iBAAiB,CAAC;IAClC;IAEA,OAAO,IAAIxB,qBAAqB,CAACsB,SAAS,CAAC;EAC7C,CAAC;EAaMS,gBAAgBA,CAOrBC,aAA2B,EAC3BrB,OAAyC,EACzCC,KAA8C,EAC9B;IAChB,OAAO,IAAI,CAACR,mBAAmB,CAAC6B,UAAU,CAACnB,OAAO,CAChD;MAAEkB,aAAa;MAAE,GAAGrB;IAAQ,CAAC;IAC7B;IACAC,KACF,CAAC;EACH;EAEOsB,aAAaA,CAAA,EAAkB;IACpC,OAAO,IAAI,CAAC9B,mBAAmB,CAAC8B,aAAa,CAAC,CAAC;EACjD;EAEOC,iBAAiBA,CACtBtB,OAEsD,EACvC;IACf,OAAO,IAAI,CAACT,mBAAmB,CAAC+B,iBAAiB,CAACtB,OAAO,CAAC;EAC5D;EAEOuB,oBAAoBA,CACzBT,IAAsB,EACP;IACf,OAAO,IAAI,CAACvB,mBAAmB,CAACgC,oBAAoB,CAACT,IAAI,EAAEU,SAAS,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,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC;IAEjE,MAAMS,SAAS,GAAG,IAAIvB,YAAY,CAAC,CAAC;IAEpC,KAAK,MAAMwB,GAAG,IAAIJ,YAAY,EAAE;MAC9B,MAAMK,iBAAiB,GAAG,IAAI,CAACpB,mBAAmB,CAACqB,KAAK,CACrDX,OAAO,CACN;QACE,GAAGH,OAAO;QACVe,OAAO,EAAE;UACPC,IAAI,EAAE,QAAQ;UACdlB,OAAO,EAAEc,GAAG,CAACK;QACf,CAAC;QACDV,QAAQ;QACRR,EAAE,EAAEa,GAAG,CAACM;MACV,CAAC;MACD;MACAjB,KACF,CAAC;MAEHU,SAAS,CAACQ,GAAG,CAACN,iBAAiB,CAAC;IAClC;IAEA,OAAO,IAAIxB,qBAAqB,CAACsB,SAAS,CAAC;EAC7C,CAAC;EAaMS,gBAAgBA,CAOrBC,aAA2B,EAC3BrB,OAAyC,EACzCC,KAA8C,EAC9B;IAChB,OAAO,IAAI,CAACR,mBAAmB,CAAC6B,UAAU,CAACnB,OAAO,CAChD;MAAEkB,aAAa;MAAE,GAAGrB;IAAQ,CAAC;IAC7B;IACAC,KACF,CAAC;EACH;EAEOsB,aAAaA,CAAA,EAAkB;IACpC,OAAO,IAAI,CAAC9B,mBAAmB,CAAC8B,aAAa,CAAC,CAAC;EACjD;EAEOC,iBAAiBA,CACtBtB,OAEsD,EACvC;IACf,OAAO,IAAI,CAACT,mBAAmB,CAAC+B,iBAAiB,CAACtB,OAAO,CAAC;EAC5D;EAEOuB,oBAAoBA,CACzBT,IAAsB,EACP;IACf,OAAO,IAAI,CAACvB,mBAAmB,CAACgC,oBAAoB,CAACT,IAAI,EAAEU,SAAS,CAAC;EACvE;EAEOC,uBAAuBA,CAG5BC,KAA2B,EAAmC;IAC9D,OAAO,IAAI,CAACnC,mBAAmB,CAACoC,kBAAkB,CAC/CC,YAAY,CAACF,KAAK,CAAC;EACxB;AACF","ignoreList":[]}
@@ -23,10 +23,7 @@ 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,IAA6C,GAAG;MACpDL,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;IACAR,MAAM,CAACI,IAAI,CAACC,cAAc,CAAC,CAACM,GAAG,CAACC,IAAI,CAACF,IAAI,CAACL,cAAc,CAAC;IACzDL,MAAM,CAACI,IAAI,CAACK,WAAW,CAAC,CAACE,GAAG,CAACC,IAAI,CAACF,IAAI,CAACD,WAAW,CAAC;;IAEnD;IACA,MAAMI,UAAU,GAAGV,aAAa,CAACW,YAAY,CAACV,IAAI,CAAC;IACnD,MAAMW,UAAU,GAAGZ,aAAa,CAACW,YAAY,CAACJ,IAAI,CAAC;IAEnDV,MAAM,CAACa,UAAU,CAAC,CAACD,IAAI,CAACG,UAAU,CAAC;EACrC,CAAC,CAAC;EAEFd,EAAE,CAAC,uCAAuC,EAAE,MAAM;IAChD,MAAME,aAAa,GAAG,IAAID,gBAAgB,CAAC,CAAC;IAY5C,MAAMW,UAAU,GAAGV,aAAa,CAACW,YAAY,CAVS;MACpDE,UAAU,EAAGV,IAAI,IAAKA,IAAI,CAACC,OAAO,CAAC,OAAO,CAAC,CAACU,SAAS,CAAC,QAAQ,CAAC;MAC/DC,QAAQ,EAAGZ,IAAI,IAAKA,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,CAAC,UAAU;IACpE,CAOkD,CAAC;IACnD,MAAMO,UAAU,GAAGZ,aAAa,CAACW,YAAY,CANS;MACpDE,UAAU,EAAGV,IAAI,IAAKA,IAAI,CAACC,OAAO,CAAC,OAAO,CAAC,CAACU,SAAS,CAAC,QAAQ,CAAC;MAC/DC,QAAQ,EAAGZ,IAAI,IAAKA,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,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: