@osdk/client 2.8.0-beta.1 → 2.8.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/build/browser/Client.js +1 -1
  3. package/build/browser/Client.js.map +1 -1
  4. package/build/browser/actions/applyAction.js +2 -1
  5. package/build/browser/actions/applyAction.js.map +1 -1
  6. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +101 -0
  7. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  8. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +1 -1
  9. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -1
  10. package/build/browser/internal/conversions/modernToLegacyWhereClause.js +1 -1
  11. package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  12. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +2 -2
  13. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  14. package/build/browser/objectSet/createObjectSet.js +0 -4
  15. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  16. package/build/browser/observable/ObservableClient/ObserveLink.js.map +1 -1
  17. package/build/browser/observable/ObservableClient.js +11 -0
  18. package/build/browser/observable/ObservableClient.js.map +1 -1
  19. package/build/browser/observable/internal/AbstractHelper.js +56 -3
  20. package/build/browser/observable/internal/AbstractHelper.js.map +1 -1
  21. package/build/browser/observable/internal/AbstractHelper.test.js +114 -0
  22. package/build/browser/observable/internal/AbstractHelper.test.js.map +1 -0
  23. package/build/browser/observable/internal/BulkObjectLoader.js +71 -9
  24. package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
  25. package/build/browser/observable/internal/BulkObjectLoader.test.js +79 -0
  26. package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -1
  27. package/build/browser/observable/internal/CacheKeys.js +19 -8
  28. package/build/browser/observable/internal/CacheKeys.js.map +1 -1
  29. package/build/browser/observable/internal/ListQueryView.js +120 -0
  30. package/build/browser/observable/internal/ListQueryView.js.map +1 -0
  31. package/build/browser/observable/internal/ObservableClientImpl.js +136 -24
  32. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  33. package/build/browser/observable/internal/PivotCanonicalizer.js +4 -4
  34. package/build/browser/observable/internal/PivotCanonicalizer.js.map +1 -1
  35. package/build/browser/observable/internal/Query.js +7 -5
  36. package/build/browser/observable/internal/Query.js.map +1 -1
  37. package/build/browser/observable/internal/RdpCanonicalizer.test.js +23 -7
  38. package/build/browser/observable/internal/RdpCanonicalizer.test.js.map +1 -1
  39. package/build/browser/observable/internal/Store.js +19 -2
  40. package/build/browser/observable/internal/Store.js.map +1 -1
  41. package/build/browser/observable/internal/Store.test.js +327 -1
  42. package/build/browser/observable/internal/Store.test.js.map +1 -1
  43. package/build/browser/observable/internal/actions/ActionApplication.js +8 -6
  44. package/build/browser/observable/internal/actions/ActionApplication.js.map +1 -1
  45. package/build/browser/observable/internal/aggregation/AggregationCacheKey.js +5 -3
  46. package/build/browser/observable/internal/aggregation/AggregationCacheKey.js.map +1 -1
  47. package/build/browser/observable/internal/aggregation/AggregationQuery.js +28 -2
  48. package/build/browser/observable/internal/aggregation/AggregationQuery.js.map +1 -1
  49. package/build/browser/observable/internal/aggregation/AggregationsHelper.js +18 -2
  50. package/build/browser/observable/internal/aggregation/AggregationsHelper.js.map +1 -1
  51. package/build/browser/observable/internal/aggregation/AggregationsHelper.test.js +103 -0
  52. package/build/browser/observable/internal/aggregation/AggregationsHelper.test.js.map +1 -0
  53. package/build/browser/observable/internal/aggregation/ObjectAggregationQuery.js +22 -3
  54. package/build/browser/observable/internal/aggregation/ObjectAggregationQuery.js.map +1 -1
  55. package/build/browser/observable/internal/base-list/BaseListQuery.js +73 -6
  56. package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
  57. package/build/browser/observable/internal/function/FunctionQuery.js +27 -1
  58. package/build/browser/observable/internal/function/FunctionQuery.js.map +1 -1
  59. package/build/browser/observable/internal/function/FunctionsHelper.js +2 -1
  60. package/build/browser/observable/internal/function/FunctionsHelper.js.map +1 -1
  61. package/build/browser/observable/internal/getObjectTypesThatInvalidate.js +2 -2
  62. package/build/browser/observable/internal/getObjectTypesThatInvalidate.js.map +1 -1
  63. package/build/browser/observable/internal/links/LinksHelper.js +3 -2
  64. package/build/browser/observable/internal/links/LinksHelper.js.map +1 -1
  65. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js +7 -5
  66. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  67. package/build/browser/observable/internal/links/SpecificLinkQuery.js +97 -62
  68. package/build/browser/observable/internal/links/SpecificLinkQuery.js.map +1 -1
  69. package/build/browser/observable/internal/list/InterfaceListQuery.js +19 -1
  70. package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
  71. package/build/browser/observable/internal/list/ListQuery.js +30 -10
  72. package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
  73. package/build/browser/observable/internal/list/ListQuery.test.js +262 -1
  74. package/build/browser/observable/internal/list/ListQuery.test.js.map +1 -1
  75. package/build/browser/observable/internal/list/ListsHelper.js +1 -1
  76. package/build/browser/observable/internal/list/ListsHelper.js.map +1 -1
  77. package/build/browser/observable/internal/list/ObjectListQuery.js +22 -21
  78. package/build/browser/observable/internal/list/ObjectListQuery.js.map +1 -1
  79. package/build/browser/observable/internal/object/ObjectQuery.js +23 -6
  80. package/build/browser/observable/internal/object/ObjectQuery.js.map +1 -1
  81. package/build/browser/observable/internal/object/ObjectsHelper.js +12 -3
  82. package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -1
  83. package/build/browser/observable/internal/object/ObjectsHelper.test.js +200 -0
  84. package/build/browser/observable/internal/object/ObjectsHelper.test.js.map +1 -0
  85. package/build/browser/observable/internal/objectset/ObjectSetCacheKey.js.map +1 -1
  86. package/build/browser/observable/internal/objectset/ObjectSetHelper.js +3 -2
  87. package/build/browser/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
  88. package/build/browser/observable/internal/objectset/ObjectSetHelper.test.js +94 -0
  89. package/build/browser/observable/internal/objectset/ObjectSetHelper.test.js.map +1 -0
  90. package/build/browser/observable/internal/objectset/ObjectSetQuery.js +4 -1
  91. package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
  92. package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -0
  93. package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
  94. package/build/browser/observable/internal/testUtils.js.map +1 -1
  95. package/build/browser/observable/internal/utils/rdpFieldOperations.js +7 -2
  96. package/build/browser/observable/internal/utils/rdpFieldOperations.js.map +1 -1
  97. package/build/browser/observable/internal/utils/rdpFieldOperations.test.js +55 -0
  98. package/build/browser/observable/internal/utils/rdpFieldOperations.test.js.map +1 -1
  99. package/build/browser/public/unstable-do-not-use.js +1 -0
  100. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  101. package/build/browser/util/UserAgent.js +2 -2
  102. package/build/browser/util/UserAgent.js.map +1 -1
  103. package/build/browser/util/interfaceUtils.js +7 -0
  104. package/build/browser/util/interfaceUtils.js.map +1 -1
  105. package/build/cjs/{chunk-7543GRIE.cjs → chunk-6VOFZIIJ.cjs} +79 -69
  106. package/build/cjs/chunk-6VOFZIIJ.cjs.map +1 -0
  107. package/build/cjs/{chunk-VVKEXIIO.cjs → chunk-YVZM2JPW.cjs} +164 -155
  108. package/build/cjs/chunk-YVZM2JPW.cjs.map +1 -0
  109. package/build/cjs/index.cjs +8 -8
  110. package/build/cjs/public/internal.cjs +8 -8
  111. package/build/cjs/public/unstable-do-not-use.cjs +928 -361
  112. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  113. package/build/cjs/public/unstable-do-not-use.d.cts +64 -26
  114. package/build/esm/Client.js +1 -1
  115. package/build/esm/Client.js.map +1 -1
  116. package/build/esm/actions/applyAction.js +2 -1
  117. package/build/esm/actions/applyAction.js.map +1 -1
  118. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +101 -0
  119. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  120. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +1 -1
  121. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -1
  122. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +1 -1
  123. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  124. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +2 -2
  125. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  126. package/build/esm/objectSet/createObjectSet.js +0 -4
  127. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  128. package/build/esm/observable/ObservableClient/ObserveLink.js.map +1 -1
  129. package/build/esm/observable/ObservableClient.js +11 -0
  130. package/build/esm/observable/ObservableClient.js.map +1 -1
  131. package/build/esm/observable/internal/AbstractHelper.js +56 -3
  132. package/build/esm/observable/internal/AbstractHelper.js.map +1 -1
  133. package/build/esm/observable/internal/AbstractHelper.test.js +114 -0
  134. package/build/esm/observable/internal/AbstractHelper.test.js.map +1 -0
  135. package/build/esm/observable/internal/BulkObjectLoader.js +71 -9
  136. package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
  137. package/build/esm/observable/internal/BulkObjectLoader.test.js +79 -0
  138. package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -1
  139. package/build/esm/observable/internal/CacheKeys.js +19 -8
  140. package/build/esm/observable/internal/CacheKeys.js.map +1 -1
  141. package/build/esm/observable/internal/ListQueryView.js +120 -0
  142. package/build/esm/observable/internal/ListQueryView.js.map +1 -0
  143. package/build/esm/observable/internal/ObservableClientImpl.js +136 -24
  144. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  145. package/build/esm/observable/internal/PivotCanonicalizer.js +4 -4
  146. package/build/esm/observable/internal/PivotCanonicalizer.js.map +1 -1
  147. package/build/esm/observable/internal/Query.js +7 -5
  148. package/build/esm/observable/internal/Query.js.map +1 -1
  149. package/build/esm/observable/internal/RdpCanonicalizer.test.js +23 -7
  150. package/build/esm/observable/internal/RdpCanonicalizer.test.js.map +1 -1
  151. package/build/esm/observable/internal/Store.js +19 -2
  152. package/build/esm/observable/internal/Store.js.map +1 -1
  153. package/build/esm/observable/internal/Store.test.js +327 -1
  154. package/build/esm/observable/internal/Store.test.js.map +1 -1
  155. package/build/esm/observable/internal/actions/ActionApplication.js +8 -6
  156. package/build/esm/observable/internal/actions/ActionApplication.js.map +1 -1
  157. package/build/esm/observable/internal/aggregation/AggregationCacheKey.js +5 -3
  158. package/build/esm/observable/internal/aggregation/AggregationCacheKey.js.map +1 -1
  159. package/build/esm/observable/internal/aggregation/AggregationQuery.js +28 -2
  160. package/build/esm/observable/internal/aggregation/AggregationQuery.js.map +1 -1
  161. package/build/esm/observable/internal/aggregation/AggregationsHelper.js +18 -2
  162. package/build/esm/observable/internal/aggregation/AggregationsHelper.js.map +1 -1
  163. package/build/esm/observable/internal/aggregation/AggregationsHelper.test.js +103 -0
  164. package/build/esm/observable/internal/aggregation/AggregationsHelper.test.js.map +1 -0
  165. package/build/esm/observable/internal/aggregation/ObjectAggregationQuery.js +22 -3
  166. package/build/esm/observable/internal/aggregation/ObjectAggregationQuery.js.map +1 -1
  167. package/build/esm/observable/internal/base-list/BaseListQuery.js +73 -6
  168. package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
  169. package/build/esm/observable/internal/function/FunctionQuery.js +27 -1
  170. package/build/esm/observable/internal/function/FunctionQuery.js.map +1 -1
  171. package/build/esm/observable/internal/function/FunctionsHelper.js +2 -1
  172. package/build/esm/observable/internal/function/FunctionsHelper.js.map +1 -1
  173. package/build/esm/observable/internal/getObjectTypesThatInvalidate.js +2 -2
  174. package/build/esm/observable/internal/getObjectTypesThatInvalidate.js.map +1 -1
  175. package/build/esm/observable/internal/links/LinksHelper.js +3 -2
  176. package/build/esm/observable/internal/links/LinksHelper.js.map +1 -1
  177. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js +7 -5
  178. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  179. package/build/esm/observable/internal/links/SpecificLinkQuery.js +97 -62
  180. package/build/esm/observable/internal/links/SpecificLinkQuery.js.map +1 -1
  181. package/build/esm/observable/internal/list/InterfaceListQuery.js +19 -1
  182. package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
  183. package/build/esm/observable/internal/list/ListQuery.js +30 -10
  184. package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
  185. package/build/esm/observable/internal/list/ListQuery.test.js +262 -1
  186. package/build/esm/observable/internal/list/ListQuery.test.js.map +1 -1
  187. package/build/esm/observable/internal/list/ListsHelper.js +1 -1
  188. package/build/esm/observable/internal/list/ListsHelper.js.map +1 -1
  189. package/build/esm/observable/internal/list/ObjectListQuery.js +22 -21
  190. package/build/esm/observable/internal/list/ObjectListQuery.js.map +1 -1
  191. package/build/esm/observable/internal/object/ObjectQuery.js +23 -6
  192. package/build/esm/observable/internal/object/ObjectQuery.js.map +1 -1
  193. package/build/esm/observable/internal/object/ObjectsHelper.js +12 -3
  194. package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -1
  195. package/build/esm/observable/internal/object/ObjectsHelper.test.js +200 -0
  196. package/build/esm/observable/internal/object/ObjectsHelper.test.js.map +1 -0
  197. package/build/esm/observable/internal/objectset/ObjectSetCacheKey.js.map +1 -1
  198. package/build/esm/observable/internal/objectset/ObjectSetHelper.js +3 -2
  199. package/build/esm/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
  200. package/build/esm/observable/internal/objectset/ObjectSetHelper.test.js +94 -0
  201. package/build/esm/observable/internal/objectset/ObjectSetHelper.test.js.map +1 -0
  202. package/build/esm/observable/internal/objectset/ObjectSetQuery.js +4 -1
  203. package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
  204. package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -0
  205. package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
  206. package/build/esm/observable/internal/testUtils.js.map +1 -1
  207. package/build/esm/observable/internal/utils/rdpFieldOperations.js +7 -2
  208. package/build/esm/observable/internal/utils/rdpFieldOperations.js.map +1 -1
  209. package/build/esm/observable/internal/utils/rdpFieldOperations.test.js +55 -0
  210. package/build/esm/observable/internal/utils/rdpFieldOperations.test.js.map +1 -1
  211. package/build/esm/public/unstable-do-not-use.js +1 -0
  212. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  213. package/build/esm/util/UserAgent.js +2 -2
  214. package/build/esm/util/UserAgent.js.map +1 -1
  215. package/build/esm/util/interfaceUtils.js +7 -0
  216. package/build/esm/util/interfaceUtils.js.map +1 -1
  217. package/build/types/Client.d.ts +1 -1
  218. package/build/types/objectSet/createObjectSet.d.ts +5 -1
  219. package/build/types/objectSet/createObjectSet.d.ts.map +1 -1
  220. package/build/types/observable/ObservableClient/ObserveLink.d.ts +2 -1
  221. package/build/types/observable/ObservableClient/ObserveLink.d.ts.map +1 -1
  222. package/build/types/observable/ObservableClient.d.ts +71 -25
  223. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  224. package/build/types/observable/internal/AbstractHelper.d.ts +1 -1
  225. package/build/types/observable/internal/AbstractHelper.d.ts.map +1 -1
  226. package/build/types/observable/internal/AbstractHelper.test.d.ts +1 -0
  227. package/build/types/observable/internal/AbstractHelper.test.d.ts.map +1 -0
  228. package/build/types/observable/internal/BulkObjectLoader.d.ts +2 -1
  229. package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
  230. package/build/types/observable/internal/CacheKeys.d.ts +5 -0
  231. package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
  232. package/build/types/observable/internal/ListQueryView.d.ts +21 -0
  233. package/build/types/observable/internal/ListQueryView.d.ts.map +1 -0
  234. package/build/types/observable/internal/PivotCanonicalizer.d.ts +2 -2
  235. package/build/types/observable/internal/PivotCanonicalizer.d.ts.map +1 -1
  236. package/build/types/observable/internal/Query.d.ts.map +1 -1
  237. package/build/types/observable/internal/Store.d.ts.map +1 -1
  238. package/build/types/observable/internal/Store.test.d.ts.map +1 -1
  239. package/build/types/observable/internal/actions/ActionApplication.d.ts.map +1 -1
  240. package/build/types/observable/internal/aggregation/AggregationCacheKey.d.ts +6 -4
  241. package/build/types/observable/internal/aggregation/AggregationCacheKey.d.ts.map +1 -1
  242. package/build/types/observable/internal/aggregation/AggregationQuery.d.ts +8 -3
  243. package/build/types/observable/internal/aggregation/AggregationQuery.d.ts.map +1 -1
  244. package/build/types/observable/internal/aggregation/AggregationsHelper.d.ts +19 -14
  245. package/build/types/observable/internal/aggregation/AggregationsHelper.d.ts.map +1 -1
  246. package/build/types/observable/internal/aggregation/AggregationsHelper.test.d.ts +1 -0
  247. package/build/types/observable/internal/aggregation/AggregationsHelper.test.d.ts.map +1 -0
  248. package/build/types/observable/internal/aggregation/ObjectAggregationQuery.d.ts.map +1 -1
  249. package/build/types/observable/internal/base-list/BaseListQuery.d.ts +47 -2
  250. package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
  251. package/build/types/observable/internal/function/FunctionQuery.d.ts +1 -1
  252. package/build/types/observable/internal/function/FunctionQuery.d.ts.map +1 -1
  253. package/build/types/observable/internal/function/FunctionsHelper.d.ts +1 -0
  254. package/build/types/observable/internal/function/FunctionsHelper.d.ts.map +1 -1
  255. package/build/types/observable/internal/links/LinksHelper.d.ts +5 -5
  256. package/build/types/observable/internal/links/LinksHelper.d.ts.map +1 -1
  257. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts +8 -6
  258. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts.map +1 -1
  259. package/build/types/observable/internal/links/SpecificLinkQuery.d.ts +3 -4
  260. package/build/types/observable/internal/links/SpecificLinkQuery.d.ts.map +1 -1
  261. package/build/types/observable/internal/list/InterfaceListQuery.d.ts.map +1 -1
  262. package/build/types/observable/internal/list/ListQuery.d.ts +0 -3
  263. package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
  264. package/build/types/observable/internal/list/ListsHelper.d.ts +4 -4
  265. package/build/types/observable/internal/list/ListsHelper.d.ts.map +1 -1
  266. package/build/types/observable/internal/list/ObjectListQuery.d.ts.map +1 -1
  267. package/build/types/observable/internal/object/ObjectQuery.d.ts +2 -1
  268. package/build/types/observable/internal/object/ObjectQuery.d.ts.map +1 -1
  269. package/build/types/observable/internal/object/ObjectsHelper.d.ts +8 -4
  270. package/build/types/observable/internal/object/ObjectsHelper.d.ts.map +1 -1
  271. package/build/types/observable/internal/object/ObjectsHelper.test.d.ts +1 -0
  272. package/build/types/observable/internal/object/ObjectsHelper.test.d.ts.map +1 -0
  273. package/build/types/observable/internal/objectset/ObjectSetCacheKey.d.ts +2 -1
  274. package/build/types/observable/internal/objectset/ObjectSetCacheKey.d.ts.map +1 -1
  275. package/build/types/observable/internal/objectset/ObjectSetHelper.d.ts +3 -1
  276. package/build/types/observable/internal/objectset/ObjectSetHelper.d.ts.map +1 -1
  277. package/build/types/observable/internal/objectset/ObjectSetHelper.test.d.ts +1 -0
  278. package/build/types/observable/internal/objectset/ObjectSetHelper.test.d.ts.map +1 -0
  279. package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts +2 -0
  280. package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
  281. package/build/types/observable/internal/testUtils.d.ts +2 -2
  282. package/build/types/observable/internal/testUtils.d.ts.map +1 -1
  283. package/build/types/public/unstable-do-not-use.d.ts +1 -0
  284. package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
  285. package/build/types/util/interfaceUtils.d.ts +2 -1
  286. package/build/types/util/interfaceUtils.d.ts.map +1 -1
  287. package/package.json +12 -12
  288. package/build/cjs/chunk-7543GRIE.cjs.map +0 -1
  289. package/build/cjs/chunk-VVKEXIIO.cjs.map +0 -1
  290. package/build/cjs/delay-W2TSML2P.cjs +0 -75
  291. package/build/cjs/delay-W2TSML2P.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk7543GRIE_cjs = require('../chunk-7543GRIE.cjs');
4
- var chunkVVKEXIIO_cjs = require('../chunk-VVKEXIIO.cjs');
3
+ var chunk6VOFZIIJ_cjs = require('../chunk-6VOFZIIJ.cjs');
4
+ var chunkYVZM2JPW_cjs = require('../chunk-YVZM2JPW.cjs');
5
5
  var chunkLDTMSHUZ_cjs = require('../chunk-LDTMSHUZ.cjs');
6
6
  var trie = require('@wry/trie');
7
7
  var deepEqual = require('fast-deep-equal');
@@ -153,7 +153,7 @@ var WhereClauseCanonicalizer = class {
153
153
  var whereCanonicalizer = new WhereClauseCanonicalizer();
154
154
  var orderByCanonicalizer = new OrderByCanonicalizer();
155
155
  function computeObjectSetCacheKey(objectSet, options) {
156
- const keyParts = ["objectSet", chunkVVKEXIIO_cjs.getWireObjectSet(objectSet)];
156
+ const keyParts = ["objectSet", chunkYVZM2JPW_cjs.getWireObjectSet(objectSet)];
157
157
  if (!options) {
158
158
  return JSON.stringify(keyParts);
159
159
  }
@@ -165,13 +165,13 @@ function computeObjectSetCacheKey(objectSet, options) {
165
165
  keyParts.push("props", propKeys);
166
166
  }
167
167
  if (options.union && options.union.length > 0) {
168
- keyParts.push("union", options.union.map((os) => chunkVVKEXIIO_cjs.getWireObjectSet(os)));
168
+ keyParts.push("union", options.union.map((os) => chunkYVZM2JPW_cjs.getWireObjectSet(os)));
169
169
  }
170
170
  if (options.intersect && options.intersect.length > 0) {
171
- keyParts.push("intersect", options.intersect.map((os) => chunkVVKEXIIO_cjs.getWireObjectSet(os)));
171
+ keyParts.push("intersect", options.intersect.map((os) => chunkYVZM2JPW_cjs.getWireObjectSet(os)));
172
172
  }
173
173
  if (options.subtract && options.subtract.length > 0) {
174
- keyParts.push("subtract", options.subtract.map((os) => chunkVVKEXIIO_cjs.getWireObjectSet(os)));
174
+ keyParts.push("subtract", options.subtract.map((os) => chunkYVZM2JPW_cjs.getWireObjectSet(os)));
175
175
  }
176
176
  if (options.pivotTo) {
177
177
  keyParts.push("pivotTo", options.pivotTo);
@@ -228,43 +228,40 @@ var ObservableClientImpl = class {
228
228
  subFn
229
229
  );
230
230
  };
231
- observeAggregation = (options, subFn) => {
231
+ observeAggregation(options, subFn) {
232
+ if (options.objectSet) {
233
+ return this.__experimentalStore.aggregations.observeAsync(options, subFn);
234
+ }
232
235
  return this.__experimentalStore.aggregations.observe(options, subFn);
233
- };
236
+ }
234
237
  observeFunction = (queryDef, params, options, subFn) => {
235
238
  const dependsOn = options.dependsOn?.map((dep) => typeof dep === "string" ? dep : dep.apiName);
236
- const dependsOnObjects = options.dependsOnObjects?.map((obj) => ({
237
- $apiName: obj.$objectType ?? obj.$apiName,
238
- $primaryKey: obj.$primaryKey
239
- }));
239
+ const instances = [];
240
+ const objectSetWires = [];
241
+ for (const item of options.dependsOnObjects ?? []) {
242
+ if (chunkYVZM2JPW_cjs.isObjectSet(item)) {
243
+ objectSetWires.push(chunkYVZM2JPW_cjs.getWireObjectSet(item));
244
+ } else {
245
+ instances.push({
246
+ $apiName: item.$objectType ?? item.$apiName,
247
+ $primaryKey: item.$primaryKey
248
+ });
249
+ }
250
+ }
251
+ const objectSetTypesPromise = objectSetWires.length > 0 ? Promise.all(objectSetWires.map((wire) => chunkYVZM2JPW_cjs.extractObjectOrInterfaceType(this.__experimentalStore.client[chunkYVZM2JPW_cjs.additionalContext], wire))).then((types) => types.filter((t) => t != null).map((t) => t.apiName)) : void 0;
240
252
  return this.__experimentalStore.functions.observe({
241
253
  ...options,
242
254
  queryDef,
243
255
  params,
244
256
  dependsOn,
245
- dependsOnObjects
257
+ dependsOnObjects: instances,
258
+ objectSetTypesPromise
246
259
  }, subFn);
247
260
  };
248
261
  observeLinks = (objects, linkName, options, subFn) => {
249
262
  const objectsArray = Array.isArray(objects) ? objects : [objects];
250
- const parentSub = new rxjs.Subscription();
251
- for (const obj of objectsArray) {
252
- const querySubscription = this.__experimentalStore.links.observe(
253
- {
254
- ...options,
255
- srcType: {
256
- type: "object",
257
- apiName: obj.$objectType ?? obj.$apiName
258
- },
259
- linkName,
260
- pk: obj.$primaryKey
261
- },
262
- // cast to cross typed to untyped barrier
263
- subFn
264
- );
265
- parentSub.add(querySubscription);
266
- }
267
- return new UnsubscribableWrapper(parentSub);
263
+ const observer = subFn;
264
+ return objectsArray.length <= 1 ? observeSingleLink(this.__experimentalStore, objectsArray, linkName, options, observer) : observeMultiLinks(this.__experimentalStore, objectsArray, linkName, options, observer);
268
265
  };
269
266
  observeObjectSet(baseObjectSet, options, subFn) {
270
267
  return this.__experimentalStore.objectSets.observe(
@@ -295,6 +292,114 @@ var ObservableClientImpl = class {
295
292
  return this.__experimentalStore.whereCanonicalizer.canonicalize(where);
296
293
  }
297
294
  };
295
+ function observeSingleLink(store, objectsArray, linkName, options, observer) {
296
+ if (objectsArray.length === 0) {
297
+ observer.next({
298
+ resolvedList: [],
299
+ isOptimistic: false,
300
+ lastUpdated: 0,
301
+ fetchMore: () => Promise.resolve(),
302
+ hasMore: false,
303
+ status: "loaded",
304
+ totalCount: "0"
305
+ });
306
+ return new UnsubscribableWrapper(new rxjs.Subscription());
307
+ }
308
+ const parentSub = new rxjs.Subscription();
309
+ for (const obj of objectsArray) {
310
+ const sourceType = obj.$apiName === obj.$objectType ? "object" : "interface";
311
+ parentSub.add(store.links.observe({
312
+ ...options,
313
+ srcType: {
314
+ type: sourceType,
315
+ apiName: obj.$apiName
316
+ },
317
+ sourceUnderlyingObjectType: obj.$objectType,
318
+ linkName,
319
+ pk: obj.$primaryKey
320
+ }, observer));
321
+ }
322
+ return new UnsubscribableWrapper(parentSub);
323
+ }
324
+ function observeMultiLinks(store, objectsArray, linkName, options, observer) {
325
+ const parentSub = new rxjs.Subscription();
326
+ const totalExpected = objectsArray.length;
327
+ const perObjectResults = /* @__PURE__ */ new Map();
328
+ let errored = false;
329
+ function mergeAndEmit() {
330
+ if (errored) {
331
+ return;
332
+ }
333
+ const seen = /* @__PURE__ */ new Map();
334
+ const fetchMores = [];
335
+ let latestUpdated = 0;
336
+ let hasMore = false;
337
+ let isOptimistic = false;
338
+ for (const payload of perObjectResults.values()) {
339
+ for (const obj of payload.resolvedList) {
340
+ seen.set(`${obj.$objectType}:${obj.$primaryKey}`, obj);
341
+ }
342
+ if (payload.lastUpdated > latestUpdated) {
343
+ latestUpdated = payload.lastUpdated;
344
+ }
345
+ if (payload.isOptimistic) {
346
+ isOptimistic = true;
347
+ }
348
+ if (payload.hasMore) {
349
+ hasMore = true;
350
+ fetchMores.push(payload.fetchMore);
351
+ }
352
+ }
353
+ const payloads = [...perObjectResults.values()];
354
+ const loading = perObjectResults.size < totalExpected || payloads.some((p) => p.status === "init" || p.status === "loading");
355
+ observer.next({
356
+ resolvedList: Array.from(seen.values()),
357
+ isOptimistic,
358
+ lastUpdated: latestUpdated,
359
+ fetchMore: hasMore ? () => Promise.all(fetchMores.map((fn) => fn())).then(() => {
360
+ }) : () => Promise.resolve(),
361
+ hasMore,
362
+ status: loading ? "loading" : payloads.some((p) => p.status === "error") ? "error" : "loaded",
363
+ ...!hasMore ? {
364
+ totalCount: String(seen.size)
365
+ } : {}
366
+ });
367
+ }
368
+ for (const obj of objectsArray) {
369
+ const objKey = `${obj.$objectType ?? obj.$apiName}:${obj.$primaryKey}`;
370
+ const sourceType = obj.$apiName === obj.$objectType ? "object" : "interface";
371
+ parentSub.add(store.links.observe({
372
+ ...options,
373
+ srcType: {
374
+ type: sourceType,
375
+ apiName: obj.$apiName
376
+ },
377
+ sourceUnderlyingObjectType: obj.$objectType,
378
+ linkName,
379
+ pk: obj.$primaryKey
380
+ }, {
381
+ next: (payload) => {
382
+ if (errored) {
383
+ return;
384
+ }
385
+ perObjectResults.set(objKey, payload);
386
+ mergeAndEmit();
387
+ },
388
+ error: (err) => {
389
+ if (errored) {
390
+ return;
391
+ }
392
+ errored = true;
393
+ parentSub.unsubscribe();
394
+ observer.error(err);
395
+ },
396
+ // store link queries are long-lived and do not complete
397
+ complete: () => {
398
+ }
399
+ }));
400
+ }
401
+ return new UnsubscribableWrapper(parentSub);
402
+ }
298
403
 
299
404
  // src/observable/internal/Store.ts
300
405
  chunkLDTMSHUZ_cjs.init_cjs_shims();
@@ -371,7 +476,7 @@ var OptimisticJob = class {
371
476
  return this;
372
477
  },
373
478
  createObject(type, pk, properties) {
374
- const create = store.client[chunkVVKEXIIO_cjs.additionalContext].objectFactory2(store.client[chunkVVKEXIIO_cjs.additionalContext], [{
479
+ const create = store.client[chunkYVZM2JPW_cjs.additionalContext].objectFactory2(store.client[chunkYVZM2JPW_cjs.additionalContext], [{
375
480
  $primaryKey: pk,
376
481
  $apiName: type.apiName,
377
482
  $objectType: type.apiName,
@@ -438,8 +543,7 @@ var ActionApplication = class {
438
543
  if (process.env.NODE_ENV !== "production") {
439
544
  if (ACTION_DELAY > 0) {
440
545
  logger?.debug("action done, pausing", actionResults);
441
- const delay = (await import('../delay-W2TSML2P.cjs')).default;
442
- await delay(ACTION_DELAY);
546
+ await new Promise((resolve) => setTimeout(resolve, ACTION_DELAY));
443
547
  logger?.debug("action done, pausing done");
444
548
  }
445
549
  }
@@ -477,18 +581,13 @@ var ActionApplication = class {
477
581
  objectType,
478
582
  primaryKey
479
583
  } of deletedObjects ?? []) {
480
- const cacheKey = this.store.cacheKeys.get(
481
- "object",
482
- objectType,
483
- primaryKey,
484
- /* rdpConfig */
485
- void 0
486
- );
487
- this.store.queries.peek(cacheKey)?.deleteFromStore(
488
- "loaded",
489
- // this is probably not the best value to use
490
- batch
491
- );
584
+ for (const cacheKey of this.store.objectCacheKeyRegistry.getVariants(objectType, primaryKey)) {
585
+ this.store.queries.peek(cacheKey)?.deleteFromStore(
586
+ "loaded",
587
+ // this is probably not the best value to use
588
+ batch
589
+ );
590
+ }
492
591
  }
493
592
  });
494
593
  await Promise.all(promisesToWait);
@@ -503,9 +602,11 @@ var ActionApplication = class {
503
602
  // src/observable/internal/aggregation/AggregationCacheKey.ts
504
603
  chunkLDTMSHUZ_cjs.init_cjs_shims();
505
604
  var API_NAME_IDX = 1;
506
- var WHERE_IDX = 2;
507
- var RDP_IDX = 3;
508
- var AGGREGATE_IDX = 4;
605
+ var WIRE_OBJECT_SET_IDX = 2;
606
+ var WHERE_IDX = 3;
607
+ var RDP_IDX = 4;
608
+ var INTERSECT_IDX = 5;
609
+ var AGGREGATE_IDX = 6;
509
610
 
510
611
  // src/observable/internal/aggregation/AggregationsHelper.ts
511
612
  chunkLDTMSHUZ_cjs.init_cjs_shims();
@@ -513,6 +614,83 @@ chunkLDTMSHUZ_cjs.init_cjs_shims();
513
614
  // src/observable/internal/AbstractHelper.ts
514
615
  chunkLDTMSHUZ_cjs.init_cjs_shims();
515
616
 
617
+ // src/observable/internal/ListQueryView.ts
618
+ chunkLDTMSHUZ_cjs.init_cjs_shims();
619
+ var viewIdCounter = 0;
620
+ var ListQueryView = class {
621
+ #query;
622
+ #viewLimit;
623
+ #pageSize;
624
+ #viewId;
625
+ #hasAutoFetch;
626
+ #fetchMore;
627
+ #pendingFetchMore;
628
+ #lastPayload;
629
+ #observer;
630
+ constructor(query, pageSize, autoFetchMore) {
631
+ this.#query = query;
632
+ this.#pageSize = pageSize;
633
+ this.#viewId = `view_${++viewIdCounter}`;
634
+ this.#hasAutoFetch = autoFetchMore === true || typeof autoFetchMore === "number" && autoFetchMore > 0;
635
+ this.#viewLimit = this.#hasAutoFetch ? Number.MAX_SAFE_INTEGER : pageSize;
636
+ this.#fetchMore = this.#createFetchMore();
637
+ query.registerFetchPageSize(this.#viewId, pageSize);
638
+ }
639
+ subscribe(observer) {
640
+ this.#observer = observer;
641
+ const sub = this.#query.subscribe({
642
+ next: (payload) => {
643
+ this.#lastPayload = payload;
644
+ observer.next?.(this.#transformPayload(payload));
645
+ if (!this.#hasAutoFetch && payload.status === "loaded" && payload.resolvedList.length < this.#viewLimit && this.#query.hasMorePages()) {
646
+ void this.#query.fetchMore();
647
+ }
648
+ },
649
+ error: (err) => observer.error?.(err),
650
+ complete: () => observer.complete?.()
651
+ });
652
+ sub.add(() => {
653
+ this.#query.unregisterFetchPageSize(this.#viewId);
654
+ this.#observer = void 0;
655
+ this.#lastPayload = void 0;
656
+ });
657
+ return sub;
658
+ }
659
+ #reEmitWithNewViewLimit() {
660
+ if (this.#lastPayload && this.#observer) {
661
+ this.#observer.next?.(this.#transformPayload(this.#lastPayload));
662
+ }
663
+ }
664
+ #transformPayload(payload) {
665
+ const loadedCount = payload.resolvedList.length;
666
+ return {
667
+ ...payload,
668
+ resolvedList: payload.resolvedList.slice(0, this.#viewLimit),
669
+ hasMore: this.#viewLimit < loadedCount || payload.hasMore,
670
+ fetchMore: this.#fetchMore,
671
+ status: loadedCount >= this.#viewLimit && payload.status === "loading" ? "loaded" : payload.status
672
+ };
673
+ }
674
+ #createFetchMore() {
675
+ return () => {
676
+ if (this.#pendingFetchMore) {
677
+ return this.#pendingFetchMore;
678
+ }
679
+ this.#viewLimit += this.#pageSize;
680
+ const loadedCount = this.#query.getLoadedCount();
681
+ const hasMoreOnServer = this.#query.hasMorePages();
682
+ if (this.#viewLimit > loadedCount && hasMoreOnServer) {
683
+ this.#pendingFetchMore = this.#query.fetchMore().finally(() => {
684
+ this.#pendingFetchMore = void 0;
685
+ });
686
+ return this.#pendingFetchMore;
687
+ }
688
+ this.#reEmitWithNewViewLimit();
689
+ return Promise.resolve();
690
+ };
691
+ }
692
+ };
693
+
516
694
  // src/observable/internal/QuerySubscription.ts
517
695
  chunkLDTMSHUZ_cjs.init_cjs_shims();
518
696
  var subscriptionIdCounter = 0;
@@ -540,6 +718,9 @@ var QuerySubscription = class extends UnsubscribableWrapper {
540
718
  };
541
719
 
542
720
  // src/observable/internal/AbstractHelper.ts
721
+ function supportsViews(query) {
722
+ return query != null && typeof query.registerFetchPageSize === "function" && typeof query.getLoadedCount === "function" && typeof query.hasMorePages === "function" && typeof query.notifySubscribers === "function" && typeof query.fetchMore === "function";
723
+ }
543
724
  var AbstractHelper = class {
544
725
  constructor(store, cacheKeys) {
545
726
  this.store = store;
@@ -550,7 +731,16 @@ var AbstractHelper = class {
550
731
  return this._subscribe(query, options, subFn);
551
732
  }
552
733
  _subscribe(query, options, subFn) {
553
- this.store.cacheKeys.retain(query.cacheKey);
734
+ const pendingCleanupCount = this.store.pendingCleanup.get(query.cacheKey) ?? 0;
735
+ if (pendingCleanupCount > 0) {
736
+ if (pendingCleanupCount === 1) {
737
+ this.store.pendingCleanup.delete(query.cacheKey);
738
+ } else {
739
+ this.store.pendingCleanup.set(query.cacheKey, pendingCleanupCount - 1);
740
+ }
741
+ } else {
742
+ this.store.cacheKeys.retain(query.cacheKey);
743
+ }
554
744
  if (options.mode !== "offline") {
555
745
  query.revalidate(options.mode === "force").catch((e) => {
556
746
  subFn.error(e);
@@ -561,12 +751,25 @@ var AbstractHelper = class {
561
751
  }
562
752
  });
563
753
  }
564
- const sub = query.subscribe(subFn);
754
+ const listOptions = options;
755
+ const useView = supportsViews(query) && (listOptions.pageSize !== void 0 || listOptions.autoFetchMore !== void 0);
756
+ const sub = useView ? new ListQueryView(query, listOptions.pageSize ?? 100, listOptions.autoFetchMore).subscribe(subFn) : query.subscribe(subFn);
565
757
  const querySub = new QuerySubscription(query, sub);
566
758
  query.registerSubscriptionDedupeInterval(querySub.subscriptionId, options.dedupeInterval);
567
759
  sub.add(() => {
568
760
  query.unregisterSubscriptionDedupeInterval(querySub.subscriptionId);
569
- this.store.cacheKeys.release(query.cacheKey);
761
+ this.store.pendingCleanup.set(query.cacheKey, (this.store.pendingCleanup.get(query.cacheKey) ?? 0) + 1);
762
+ queueMicrotask(() => {
763
+ const currentPending = this.store.pendingCleanup.get(query.cacheKey) ?? 0;
764
+ if (currentPending > 0) {
765
+ if (currentPending === 1) {
766
+ this.store.pendingCleanup.delete(query.cacheKey);
767
+ } else {
768
+ this.store.pendingCleanup.set(query.cacheKey, currentPending - 1);
769
+ }
770
+ this.store.cacheKeys.release(query.cacheKey);
771
+ }
772
+ });
570
773
  });
571
774
  return querySub;
572
775
  }
@@ -578,6 +781,162 @@ chunkLDTMSHUZ_cjs.init_cjs_shims();
578
781
  // src/observable/internal/aggregation/AggregationQuery.ts
579
782
  chunkLDTMSHUZ_cjs.init_cjs_shims();
580
783
 
784
+ // src/observable/internal/getObjectTypesThatInvalidate.ts
785
+ chunkLDTMSHUZ_cjs.init_cjs_shims();
786
+ async function getObjectTypesThatInvalidate(mc, objectSet) {
787
+ const counts = {};
788
+ const resultType = await calcObjectSet(objectSet, {
789
+ counts,
790
+ methodInput: void 0,
791
+ ontologyProvider: mc.ontologyProvider
792
+ });
793
+ const tweaked = {
794
+ ...counts,
795
+ [resultType.apiName]: counts[resultType.apiName] - 1
796
+ };
797
+ return {
798
+ resultType,
799
+ counts,
800
+ invalidationSet: new Set(Object.entries(tweaked).filter(([, v]) => v > 0).map(([k]) => k))
801
+ };
802
+ }
803
+ async function calcObjectSet(os, ctx) {
804
+ const op = ctx.ontologyProvider;
805
+ async function bumpObject(apiName) {
806
+ const objectType = await op.getObjectDefinition(apiName);
807
+ ctx.counts[apiName] = (ctx.counts[apiName] ?? 0) + 1;
808
+ return objectType;
809
+ }
810
+ async function bumpInterface(apiName) {
811
+ const interfaceDef = await op.getInterfaceDefinition(apiName);
812
+ for (const s of interfaceDef.implementedBy ?? []) {
813
+ ctx.counts[s] = (ctx.counts[s] ?? 0) + 1;
814
+ }
815
+ return interfaceDef;
816
+ }
817
+ switch (os.type) {
818
+ case "base":
819
+ return await bumpObject(os.objectType);
820
+ case "interfaceBase":
821
+ return await bumpInterface(os.interfaceType);
822
+ case "interfaceLinkSearchAround": {
823
+ const srcDef = await calcObjectSet(os.objectSet, ctx);
824
+ !(srcDef.type === "interface") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false) : invariant5__default.default(false) : void 0;
825
+ for (const [k, v] of Object.entries(srcDef.links)) {
826
+ if (k === os.interfaceLink) {
827
+ if (v.targetType === "object") {
828
+ return await bumpObject(v.targetTypeApiName);
829
+ }
830
+ return await bumpInterface(v.targetTypeApiName);
831
+ }
832
+ }
833
+ throw new Error(`Could not find link ${os.interfaceLink} in object set ${JSON.stringify(os.objectSet)}`);
834
+ }
835
+ case "searchAround": {
836
+ const contextDef = await calcObjectSet(os.objectSet, ctx);
837
+ !(contextDef.type === "object") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false) : invariant5__default.default(false) : void 0;
838
+ for (const [k, v] of Object.entries(contextDef.links)) {
839
+ if (k === os.link) {
840
+ return await bumpObject(v.targetType);
841
+ }
842
+ }
843
+ throw new Error(`Could not find link ${os.link} in object set ${JSON.stringify(os.objectSet)}`);
844
+ }
845
+ case "filter":
846
+ return calcObjectSet(os.objectSet, ctx);
847
+ case "union":
848
+ case "subtract":
849
+ case "intersect":
850
+ const returnTypes = await Promise.all(os.objectSets.map(async (os2) => {
851
+ const counts = {};
852
+ const r = await calcObjectSet(os2, {
853
+ ...ctx,
854
+ counts
855
+ });
856
+ return {
857
+ r,
858
+ counts
859
+ };
860
+ }));
861
+ for (const {
862
+ counts
863
+ } of returnTypes) {
864
+ for (const [k, v] of Object.entries(counts)) {
865
+ ctx.counts[k] = Math.max(ctx.counts[k] ?? 0, v);
866
+ }
867
+ }
868
+ if (returnTypes.length === 0) {
869
+ throw new Error(`Could not find any context types for set operation`);
870
+ }
871
+ const allMatch = returnTypes.every(({
872
+ r
873
+ }) => r.apiName === returnTypes[0].r.apiName);
874
+ if (!allMatch) {
875
+ throw new Error(`Incompatible context types found for set operation`);
876
+ }
877
+ return returnTypes[0].r;
878
+ case "withProperties":
879
+ for (const [, v] of Object.entries(os.derivedProperties)) {
880
+ await calcRdp(v, {
881
+ ...ctx,
882
+ methodInput: os.objectSet
883
+ });
884
+ }
885
+ return calcObjectSet(os.objectSet, {
886
+ ...ctx,
887
+ methodInput: os.objectSet
888
+ });
889
+ // used by rdps
890
+ case "methodInput":
891
+ !ctx.methodInput ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "methodInput must be provided") : invariant5__default.default(false) : void 0;
892
+ return await calcObjectSet(ctx.methodInput, {
893
+ ...ctx,
894
+ counts: {}
895
+ });
896
+ case "asType":
897
+ // we don't currently support this anywhere.
898
+ case "asBaseObjectTypes":
899
+ // We don't currently support this because it could return multiple object types conceptually
900
+ // internally, we actually use it this way but we shouldn't be finding that object sets.
901
+ case "reference":
902
+ // reference is particularly problematic because we cannot answer the question about
903
+ // which types without loading the object set definition (and it can change).
904
+ case "static":
905
+ throw new Error(`Unsupported ObjectSet type ${os.type}`);
906
+ case "nearestNeighbors":
907
+ return calcObjectSet(os.objectSet, ctx);
908
+ default:
909
+ throw new Error(`Unhandled ObjectSet type ${os.type}`);
910
+ }
911
+ }
912
+ async function calcRdp(dpd, ctx) {
913
+ switch (dpd.type) {
914
+ // Operates on object sets
915
+ case "selection":
916
+ return await calcObjectSet(dpd.objectSet, ctx);
917
+ // Operates on single property
918
+ case "negate":
919
+ case "extract":
920
+ case "absoluteValue":
921
+ return await calcRdp(dpd.property, ctx);
922
+ // Operates on many (unordered) properties
923
+ case "least":
924
+ case "greatest":
925
+ case "add":
926
+ case "multiply":
927
+ return await Promise.all(dpd.properties.map((innerDpd) => calcRdp(innerDpd, ctx)));
928
+ // Operates on 2 ordered properties
929
+ case "subtract":
930
+ case "divide":
931
+ return await Promise.all([calcRdp(dpd.left, ctx), calcRdp(dpd.right, ctx)]);
932
+ // Operates on a single property name
933
+ case "property":
934
+ return;
935
+ default:
936
+ throw new Error(`Unhandled DerivedPropertyDefinition type ${dpd.type}`);
937
+ }
938
+ }
939
+
581
940
  // src/observable/internal/Query.ts
582
941
  chunkLDTMSHUZ_cjs.init_cjs_shims();
583
942
  var Query = class {
@@ -593,7 +952,7 @@ var Query = class {
593
952
  this.store = store;
594
953
  this.cacheKeys = store.cacheKeys;
595
954
  this.#subject = observable;
596
- this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkVVKEXIIO_cjs.additionalContext].logger : store.client[chunkVVKEXIIO_cjs.additionalContext].logger?.child({}, {
955
+ this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkYVZM2JPW_cjs.additionalContext].logger : store.client[chunkYVZM2JPW_cjs.additionalContext].logger?.child({}, {
597
956
  msgPrefix: process.env.NODE_ENV !== "production" ? `Query<${cacheKey.type}, ${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>` : "Query"
598
957
  }));
599
958
  }
@@ -664,12 +1023,14 @@ var Query = class {
664
1023
  await this.pendingFetch;
665
1024
  return;
666
1025
  }
667
- const minDedupeInterval = this.getMinimumDedupeInterval();
668
- if (minDedupeInterval > 0 && this.lastFetchStarted != null && Date.now() - this.lastFetchStarted < minDedupeInterval) {
669
- if (process.env.NODE_ENV !== "production") {
670
- logger?.debug("Within dupeInterval, aborting revalidate");
1026
+ if (!force) {
1027
+ const minDedupeInterval = this.getMinimumDedupeInterval();
1028
+ if (minDedupeInterval > 0 && this.lastFetchStarted != null && Date.now() - this.lastFetchStarted < minDedupeInterval) {
1029
+ if (process.env.NODE_ENV !== "production") {
1030
+ logger?.debug("Within dupeInterval, aborting revalidate");
1031
+ }
1032
+ return Promise.resolve();
671
1033
  }
672
- return Promise.resolve();
673
1034
  }
674
1035
  if (process.env.NODE_ENV !== "production") {
675
1036
  logger?.debug("Starting actual revalidate");
@@ -750,14 +1111,39 @@ var Query = class {
750
1111
 
751
1112
  // src/observable/internal/aggregation/AggregationQuery.ts
752
1113
  var AggregationQuery = class extends Query {
1114
+ #invalidationTypes;
1115
+ #invalidationTypesPromise;
753
1116
  constructor(store, subject, cacheKey, opts) {
754
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVVKEXIIO_cjs.additionalContext].logger?.child({}, {
1117
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkYVZM2JPW_cjs.additionalContext].logger?.child({}, {
755
1118
  msgPrefix: `AggregationQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
756
1119
  }) : void 0);
757
1120
  this.apiName = cacheKey.otherKeys[API_NAME_IDX];
758
1121
  this.canonicalWhere = cacheKey.otherKeys[WHERE_IDX];
759
1122
  this.rdpConfig = cacheKey.otherKeys[RDP_IDX];
760
1123
  this.canonicalAggregate = cacheKey.otherKeys[AGGREGATE_IDX];
1124
+ const serializedObjectSet = cacheKey.otherKeys[WIRE_OBJECT_SET_IDX];
1125
+ this.#invalidationTypes = /* @__PURE__ */ new Set([this.apiName]);
1126
+ if (serializedObjectSet) {
1127
+ this.parsedWireObjectSet = JSON.parse(serializedObjectSet);
1128
+ this.#invalidationTypesPromise = this.#computeInvalidationTypes(this.parsedWireObjectSet);
1129
+ }
1130
+ }
1131
+ async #computeInvalidationTypes(wireObjectSet) {
1132
+ try {
1133
+ const {
1134
+ invalidationSet
1135
+ } = await getObjectTypesThatInvalidate(this.store.client[chunkYVZM2JPW_cjs.additionalContext], wireObjectSet);
1136
+ return /* @__PURE__ */ new Set([this.apiName, ...invalidationSet]);
1137
+ } catch (error) {
1138
+ this.store.logger?.error("Failed to compute invalidation types for aggregation, falling back to base type only", error);
1139
+ return /* @__PURE__ */ new Set([this.apiName]);
1140
+ }
1141
+ }
1142
+ async ensureInvalidationTypesReady() {
1143
+ if (this.#invalidationTypesPromise) {
1144
+ this.#invalidationTypes = await this.#invalidationTypesPromise;
1145
+ this.#invalidationTypesPromise = void 0;
1146
+ }
761
1147
  }
762
1148
  _createConnectable(subject) {
763
1149
  return rxjs.connectable(subject.pipe(rxjs.map((x) => {
@@ -798,7 +1184,7 @@ var AggregationQuery = class extends Query {
798
1184
  return batch.read(this.cacheKey);
799
1185
  }
800
1186
  invalidateObjectType = (objectType, changes) => {
801
- if (this.apiName === objectType) {
1187
+ if (this.#invalidationTypes.has(objectType)) {
802
1188
  changes?.modified.add(this.cacheKey);
803
1189
  return this.revalidate(true);
804
1190
  }
@@ -810,33 +1196,64 @@ var AggregationQuery = class extends Query {
810
1196
  var ObjectAggregationQuery = class extends AggregationQuery {
811
1197
  async _fetchAggregation() {
812
1198
  const type = this.cacheKey.otherKeys[API_NAME_IDX];
813
- let objectSet = this.store.client({
1199
+ const intersectWith = this.cacheKey.otherKeys[INTERSECT_IDX];
1200
+ const objectTypeDef = {
814
1201
  type: "object",
815
1202
  apiName: type
816
- });
1203
+ };
1204
+ let objectSet;
1205
+ if (this.parsedWireObjectSet) {
1206
+ objectSet = chunkYVZM2JPW_cjs.createObjectSet(objectTypeDef, this.store.client[chunkYVZM2JPW_cjs.additionalContext], this.parsedWireObjectSet);
1207
+ } else {
1208
+ objectSet = this.store.client(objectTypeDef);
1209
+ }
817
1210
  if (this.rdpConfig) {
818
1211
  objectSet = objectSet.withProperties(this.rdpConfig);
819
1212
  }
820
1213
  objectSet = objectSet.where(this.canonicalWhere);
1214
+ if (intersectWith != null && intersectWith.length > 0) {
1215
+ const intersectSets = intersectWith.map((whereClause) => {
1216
+ let intersectSet = this.store.client(objectTypeDef);
1217
+ if (this.rdpConfig) {
1218
+ intersectSet = intersectSet.withProperties(this.rdpConfig);
1219
+ }
1220
+ return intersectSet.where(whereClause);
1221
+ });
1222
+ objectSet = objectSet.intersect(...intersectSets);
1223
+ }
821
1224
  return await objectSet.aggregate(this.canonicalAggregate);
822
1225
  }
823
1226
  };
824
1227
 
825
1228
  // src/observable/internal/aggregation/AggregationsHelper.ts
826
1229
  var AggregationsHelper = class extends AbstractHelper {
827
- constructor(store, cacheKeys, whereCanonicalizer2, rdpCanonicalizer) {
1230
+ constructor(store, cacheKeys, whereCanonicalizer2, rdpCanonicalizer, intersectCanonicalizer) {
828
1231
  super(store, cacheKeys);
829
1232
  this.whereCanonicalizer = whereCanonicalizer2;
830
1233
  this.rdpCanonicalizer = rdpCanonicalizer;
1234
+ this.intersectCanonicalizer = intersectCanonicalizer;
831
1235
  }
832
1236
  observe(options, subFn) {
833
1237
  return super.observe(options, subFn);
834
1238
  }
1239
+ async observeAsync(options, subFn) {
1240
+ const query = this.getQueryWithObjectSet(options);
1241
+ await query.ensureInvalidationTypesReady();
1242
+ return this._subscribe(query, options, subFn);
1243
+ }
835
1244
  getQuery(options) {
1245
+ return this.getOrCreateQuery(options, void 0);
1246
+ }
1247
+ getQueryWithObjectSet(options) {
1248
+ const serializedObjectSet = JSON.stringify(chunkYVZM2JPW_cjs.getWireObjectSet(options.objectSet));
1249
+ return this.getOrCreateQuery(options, serializedObjectSet);
1250
+ }
1251
+ getOrCreateQuery(options, serializedObjectSet) {
836
1252
  const {
837
1253
  type,
838
1254
  where,
839
1255
  withProperties,
1256
+ intersectWith,
840
1257
  aggregate
841
1258
  } = options;
842
1259
  const {
@@ -845,8 +1262,9 @@ var AggregationsHelper = class extends AbstractHelper {
845
1262
  const typeKind = "type" in type ? type.type : "interface";
846
1263
  const canonWhere = this.whereCanonicalizer.canonicalize(where ?? {});
847
1264
  const canonRdp = withProperties ? this.rdpCanonicalizer.canonicalize(withProperties) : void 0;
1265
+ const canonIntersect = intersectWith && intersectWith.length > 0 ? this.intersectCanonicalizer.canonicalize(intersectWith) : void 0;
848
1266
  const canonAggregate = this.canonicalizeAggregate(aggregate);
849
- const aggregationCacheKey = this.cacheKeys.get("aggregation", typeKind, apiName, canonWhere, canonRdp, canonAggregate);
1267
+ const aggregationCacheKey = this.cacheKeys.get("aggregation", typeKind, apiName, serializedObjectSet, canonWhere, canonRdp, canonIntersect, canonAggregate);
850
1268
  return this.store.queries.get(aggregationCacheKey, () => {
851
1269
  if (typeKind !== "object") {
852
1270
  throw new Error("Only ObjectTypeDefinition is currently supported for aggregations");
@@ -960,16 +1378,26 @@ var CacheKeys = class {
960
1378
  });
961
1379
  }
962
1380
  get(type, ...args) {
963
- const normalizedArgs = [...args];
964
- while (normalizedArgs.length > 0 && normalizedArgs[normalizedArgs.length - 1] === void 0) {
965
- normalizedArgs.pop();
966
- }
967
- const cacheKeyArgs = [type, ...normalizedArgs];
1381
+ const cacheKeyArgs = this.#normalizeArgs(type, args);
968
1382
  if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS) ;
969
1383
  const cacheKey = this.#cacheKeys.lookupArray(cacheKeyArgs);
970
1384
  this.#refCounts.register(cacheKey);
971
1385
  return cacheKey;
972
1386
  }
1387
+ /**
1388
+ * Look up an existing cache key without creating or registering it.
1389
+ * Returns undefined if the key does not exist in the trie.
1390
+ */
1391
+ peek(type, ...args) {
1392
+ return this.#cacheKeys.peekArray(this.#normalizeArgs(type, args));
1393
+ }
1394
+ #normalizeArgs(type, args) {
1395
+ const normalizedArgs = [...args];
1396
+ while (normalizedArgs.length > 0 && normalizedArgs[normalizedArgs.length - 1] === void 0) {
1397
+ normalizedArgs.pop();
1398
+ }
1399
+ return [type, ...normalizedArgs];
1400
+ }
973
1401
  retain(cacheKey) {
974
1402
  this.#refCounts.retain(cacheKey);
975
1403
  }
@@ -1122,7 +1550,7 @@ var FunctionParamsCanonicalizer = class {
1122
1550
  path.push("$:map_end");
1123
1551
  return arr;
1124
1552
  }
1125
- if (chunk7543GRIE_cjs.isObjectSpecifiersObject(value)) {
1553
+ if (chunk6VOFZIIJ_cjs.isObjectSpecifiersObject(value)) {
1126
1554
  const objectType = value.$objectType ?? value.$apiName;
1127
1555
  path.push("$:osdk", objectType, value.$primaryKey);
1128
1556
  return {
@@ -1130,8 +1558,8 @@ var FunctionParamsCanonicalizer = class {
1130
1558
  $primaryKey: value.$primaryKey
1131
1559
  };
1132
1560
  }
1133
- if (chunkVVKEXIIO_cjs.isObjectSet(value)) {
1134
- const wire = chunkVVKEXIIO_cjs.getWireObjectSet(value);
1561
+ if (chunkYVZM2JPW_cjs.isObjectSet(value)) {
1562
+ const wire = chunkYVZM2JPW_cjs.getWireObjectSet(value);
1135
1563
  path.push("$:objectset", wire);
1136
1564
  return wire;
1137
1565
  }
@@ -1193,8 +1621,8 @@ var FunctionQuery = class extends Query {
1193
1621
  #dependsOn;
1194
1622
  #dependsOnObjects;
1195
1623
  #queryDef;
1196
- constructor(store, subject, queryDef, params, cacheKey, opts) {
1197
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVVKEXIIO_cjs.additionalContext].logger?.child({}, {
1624
+ constructor(store, subject, queryDef, params, cacheKey, opts, objectSetTypesPromise) {
1625
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkYVZM2JPW_cjs.additionalContext].logger?.child({}, {
1198
1626
  msgPrefix: `FunctionQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
1199
1627
  }) : void 0);
1200
1628
  this.#apiName = queryDef.apiName;
@@ -1203,6 +1631,29 @@ var FunctionQuery = class extends Query {
1203
1631
  this.#dependsOn = opts.dependsOn;
1204
1632
  this.#dependsOnObjects = opts.dependsOnObjects;
1205
1633
  this.#queryDef = queryDef;
1634
+ if (objectSetTypesPromise) {
1635
+ objectSetTypesPromise.then((types) => {
1636
+ if (this.abortController?.signal.aborted) return;
1637
+ let addedNewTypes = false;
1638
+ for (const type of types) {
1639
+ if (!this.#dependsOn) {
1640
+ this.#dependsOn = [];
1641
+ }
1642
+ if (!this.#dependsOn.includes(type)) {
1643
+ this.#dependsOn.push(type);
1644
+ addedNewTypes = true;
1645
+ }
1646
+ }
1647
+ if (addedNewTypes) {
1648
+ void this.revalidate(true);
1649
+ }
1650
+ }).catch((error) => {
1651
+ if (this.abortController?.signal.aborted) return;
1652
+ if (process.env.NODE_ENV !== "production") {
1653
+ this.logger?.error("Failed to extract ObjectSet types", error);
1654
+ }
1655
+ });
1656
+ }
1206
1657
  }
1207
1658
  _createConnectable(subject) {
1208
1659
  return rxjs.connectable(subject.pipe(rxjs.map((x) => {
@@ -1228,7 +1679,7 @@ var FunctionQuery = class extends Query {
1228
1679
  }).debug("calling _fetchAndStore");
1229
1680
  }
1230
1681
  try {
1231
- const result = await chunk7543GRIE_cjs.applyQuery(this.store.client[chunkVVKEXIIO_cjs.additionalContext], this.#queryDef, this.#params);
1682
+ const result = await chunk6VOFZIIJ_cjs.applyQuery(this.store.client[chunkYVZM2JPW_cjs.additionalContext], this.#queryDef, this.#params);
1232
1683
  const executedAt = Date.now();
1233
1684
  this.store.batch({}, (batch) => {
1234
1685
  this.writeToStore({
@@ -1311,13 +1762,14 @@ var FunctionsHelper = class extends AbstractHelper {
1311
1762
  const {
1312
1763
  queryDef,
1313
1764
  params,
1765
+ objectSetTypesPromise,
1314
1766
  ...observeOpts
1315
1767
  } = options;
1316
1768
  const apiName = queryDef.apiName;
1317
1769
  const version = queryDef.isFixedVersion ? queryDef.version : void 0;
1318
1770
  const canonicalParams = this.paramsCanonicalizer.canonicalize(params);
1319
1771
  const functionCacheKey = this.cacheKeys.get("function", apiName, version, canonicalParams);
1320
- return this.store.queries.get(functionCacheKey, () => new FunctionQuery(this.store, this.store.subjects.get(functionCacheKey), queryDef, params, functionCacheKey, observeOpts));
1772
+ return this.store.queries.get(functionCacheKey, () => new FunctionQuery(this.store, this.store.subjects.get(functionCacheKey), queryDef, params, functionCacheKey, observeOpts, objectSetTypesPromise));
1321
1773
  }
1322
1774
  async invalidateFunction(apiName, params) {
1323
1775
  const functionApiName = typeof apiName === "string" ? apiName : apiName.apiName;
@@ -1761,7 +2213,7 @@ var API_NAME_IDX2 = 1;
1761
2213
  var WHERE_IDX2 = 2;
1762
2214
  var ORDER_BY_IDX = 3;
1763
2215
  var RDP_IDX2 = 4;
1764
- var INTERSECT_IDX = 5;
2216
+ var INTERSECT_IDX2 = 5;
1765
2217
  var PIVOT_IDX = 6;
1766
2218
  var RIDS_IDX = 7;
1767
2219
 
@@ -1873,6 +2325,7 @@ var BaseListQuery = class extends Query {
1873
2325
  * Promise tracking an in-progress page fetch
1874
2326
  * @protected
1875
2327
  */
2328
+ #subscriberPageSizes = /* @__PURE__ */ new Map();
1876
2329
  //
1877
2330
  // Shared Implementations
1878
2331
  //
@@ -2027,11 +2480,9 @@ var BaseListQuery = class extends Query {
2027
2480
  return this.pendingPageFetch;
2028
2481
  }
2029
2482
  if (this.pendingFetch) {
2030
- this.pendingPageFetch = (async () => {
2031
- await this.pendingFetch;
2032
- await this.fetchMore();
2033
- })().finally(() => {
2483
+ this.pendingPageFetch = this.pendingFetch.then(() => {
2034
2484
  this.pendingPageFetch = void 0;
2485
+ return this.fetchMore();
2035
2486
  });
2036
2487
  return this.pendingPageFetch;
2037
2488
  }
@@ -2046,6 +2497,56 @@ var BaseListQuery = class extends Query {
2046
2497
  });
2047
2498
  return this.pendingFetch;
2048
2499
  };
2500
+ /**
2501
+ * Register a subscriber's pageSize for fetch optimization.
2502
+ * The query will fetch with the max pageSize across all subscribers.
2503
+ */
2504
+ registerFetchPageSize(viewId, pageSize) {
2505
+ this.#subscriberPageSizes.set(viewId, pageSize);
2506
+ }
2507
+ /**
2508
+ * Unregister a subscriber's pageSize when they unsubscribe.
2509
+ * Allows the effective pageSize to decrease when high-pageSize subscribers leave.
2510
+ */
2511
+ unregisterFetchPageSize(viewId) {
2512
+ this.#subscriberPageSizes.delete(viewId);
2513
+ }
2514
+ /**
2515
+ * Get the effective fetch pageSize (max across all subscribers).
2516
+ * Falls back to options.pageSize or 100 if no subscribers have registered.
2517
+ */
2518
+ getEffectiveFetchPageSize() {
2519
+ if (this.#subscriberPageSizes.size > 0) {
2520
+ return Math.max(...this.#subscriberPageSizes.values());
2521
+ }
2522
+ return this.options.pageSize ?? 100;
2523
+ }
2524
+ /**
2525
+ * Get the current number of loaded items in the cache.
2526
+ */
2527
+ getLoadedCount() {
2528
+ const {
2529
+ retVal
2530
+ } = this.store.batch({}, (batch) => {
2531
+ return batch.read(this.cacheKey)?.value?.data.length ?? 0;
2532
+ });
2533
+ return retVal;
2534
+ }
2535
+ /**
2536
+ * Check if there are more pages available on the server.
2537
+ */
2538
+ hasMorePages() {
2539
+ return this.nextPageToken != null;
2540
+ }
2541
+ /**
2542
+ * Notify all subscribers of a change (used when view limits change
2543
+ * but no new data needs to be fetched).
2544
+ */
2545
+ notifySubscribers() {
2546
+ this.store.batch({}, (batch) => {
2547
+ this.registerCacheChanges(batch);
2548
+ });
2549
+ }
2049
2550
  /**
2050
2551
  * Minimum number of results to load initially
2051
2552
  * May be overridden by subclasses for specific collection types
@@ -2315,8 +2816,9 @@ var BaseListQuery = class extends Query {
2315
2816
  }).debug("Removing object", object);
2316
2817
  }
2317
2818
  this.store.batch({}, (batch) => {
2318
- const objectCacheKey = this.store.cacheKeys.get("object", object.$objectType ?? object.$apiName, object.$primaryKey);
2319
- batch.delete(objectCacheKey, "loaded");
2819
+ for (const objectCacheKey of this.store.objectCacheKeyRegistry.getVariants(object.$objectType ?? object.$apiName, object.$primaryKey)) {
2820
+ batch.delete(objectCacheKey, "loaded");
2821
+ }
2320
2822
  });
2321
2823
  }
2322
2824
  };
@@ -2324,6 +2826,8 @@ var BaseListQuery = class extends Query {
2324
2826
  // src/observable/internal/links/SpecificLinkQuery.ts
2325
2827
  var SpecificLinkQuery = class extends BaseListQuery {
2326
2828
  #sourceApiName;
2829
+ #sourceTypeKind;
2830
+ #sourceUnderlyingObjectType;
2327
2831
  #sourcePk;
2328
2832
  #linkName;
2329
2833
  #whereClause;
@@ -2335,39 +2839,68 @@ var SpecificLinkQuery = class extends BaseListQuery {
2335
2839
  batch.changes.modified.add(this.cacheKey);
2336
2840
  }
2337
2841
  constructor(store, subject, cacheKey, opts) {
2338
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVVKEXIIO_cjs.additionalContext].logger?.child({}, {
2842
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkYVZM2JPW_cjs.additionalContext].logger?.child({}, {
2339
2843
  msgPrefix: `SpecificLinkQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
2340
2844
  }) : void 0);
2341
- [this.#sourceApiName, this.#sourcePk, this.#linkName, this.#whereClause, this.#orderBy] = cacheKey.otherKeys;
2845
+ [this.#sourceApiName, this.#sourceTypeKind, this.#sourceUnderlyingObjectType, this.#sourcePk, this.#linkName, this.#whereClause, this.#orderBy] = cacheKey.otherKeys;
2342
2846
  }
2343
- // _fetchAndStore is now implemented in BaseCollectionQuery
2344
2847
  /**
2345
2848
  * Implements fetchPageData from the BaseCollectionQuery template method pattern
2346
- * Fetches a page of linked objects
2347
2849
  */
2348
2850
  async fetchPageData(signal) {
2349
2851
  const client = this.store.client;
2350
- const sourceObjectDef = {
2351
- type: "object",
2352
- apiName: this.#sourceApiName
2353
- };
2354
- const sourceMetadata = await client[chunkVVKEXIIO_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
2852
+ const ontologyProvider = client[chunkYVZM2JPW_cjs.additionalContext].ontologyProvider;
2853
+ const isInterface = this.#sourceTypeKind === "interface";
2355
2854
  if (this.#orderBy && Object.keys(this.#orderBy).length > 0) {
2356
- const linkDef = sourceMetadata.links?.[this.#linkName];
2357
- if (!linkDef?.targetType) {
2358
- throw new Error(`Missing link definition or targetType for link '${this.#linkName}' on object type '${this.#sourceApiName}'`);
2855
+ let targetTypeApiName;
2856
+ if (isInterface) {
2857
+ const interfaceMetadata = await ontologyProvider.getInterfaceDefinition(this.#sourceApiName);
2858
+ const linkDef = interfaceMetadata.links?.[this.#linkName];
2859
+ if (!linkDef) {
2860
+ throw new Error(`Missing link definition for link '${this.#linkName}' on interface '${this.#sourceApiName}'`);
2861
+ }
2862
+ targetTypeApiName = linkDef.targetTypeApiName;
2863
+ } else {
2864
+ const objectMetadata = await ontologyProvider.getObjectDefinition(this.#sourceApiName);
2865
+ const linkDef = objectMetadata.links?.[this.#linkName];
2866
+ if (!linkDef?.targetType) {
2867
+ throw new Error(`Missing link definition or targetType for link '${this.#linkName}' on object type '${this.#sourceApiName}'`);
2868
+ }
2869
+ targetTypeApiName = linkDef.targetType;
2359
2870
  }
2360
- this.sortingStrategy = new OrderBySortingStrategy(linkDef.targetType, this.#orderBy);
2871
+ this.sortingStrategy = new OrderBySortingStrategy(targetTypeApiName, this.#orderBy);
2872
+ }
2873
+ let linkQuery;
2874
+ if (isInterface) {
2875
+ const objectMetadata = await ontologyProvider.getObjectDefinition(this.#sourceUnderlyingObjectType);
2876
+ const interfaceSet = client({
2877
+ type: "interface",
2878
+ apiName: this.#sourceApiName
2879
+ });
2880
+ const objectFilteredByPk = client({
2881
+ type: "object",
2882
+ apiName: this.#sourceUnderlyingObjectType
2883
+ }).where({
2884
+ [objectMetadata.primaryKeyApiName]: this.#sourcePk
2885
+ });
2886
+ const filteredSource = interfaceSet.intersect(objectFilteredByPk);
2887
+ linkQuery = filteredSource.pivotTo(this.#linkName);
2888
+ } else {
2889
+ const objectMetadata = await ontologyProvider.getObjectDefinition(this.#sourceApiName);
2890
+ const sourceSet = client({
2891
+ type: "object",
2892
+ apiName: this.#sourceApiName
2893
+ });
2894
+ const sourceQuery = sourceSet.where({
2895
+ [objectMetadata.primaryKeyApiName]: this.#sourcePk
2896
+ });
2897
+ linkQuery = sourceQuery.pivotTo(this.#linkName);
2361
2898
  }
2362
- const sourceQuery = client(sourceObjectDef).where({
2363
- [sourceMetadata.primaryKeyApiName]: this.#sourcePk
2364
- });
2365
- const linkQuery = sourceQuery.pivotTo(this.#linkName);
2366
2899
  if (signal?.aborted) {
2367
2900
  throw new Error("Aborted");
2368
2901
  }
2369
2902
  const queryParams = {
2370
- $pageSize: this.options.pageSize || 100,
2903
+ $pageSize: this.getEffectiveFetchPageSize(),
2371
2904
  $nextPageToken: this.nextPageToken,
2372
2905
  $includeRid: true
2373
2906
  };
@@ -2418,19 +2951,53 @@ var SpecificLinkQuery = class extends BaseListQuery {
2418
2951
  return Promise.resolve();
2419
2952
  };
2420
2953
  invalidateObjectType = (objectType, changes) => {
2421
- if (this.#sourceApiName === objectType) {
2954
+ if (this.#sourceTypeKind === "object" && this.#sourceApiName === objectType) {
2422
2955
  changes?.modified.add(this.cacheKey);
2423
2956
  return this.revalidate(true);
2424
- } else {
2425
- return (async () => {
2426
- const sourceMetadata = await this.store.client[chunkVVKEXIIO_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
2427
- const linkDef = sourceMetadata.links?.[this.#linkName];
2428
- if (!linkDef || linkDef.targetType !== objectType) return;
2429
- const promise = this.revalidate(true);
2957
+ }
2958
+ return (async () => {
2959
+ try {
2960
+ const ontologyProvider = this.store.client[chunkYVZM2JPW_cjs.additionalContext].ontologyProvider;
2961
+ if (this.#sourceTypeKind === "interface") {
2962
+ const objectMetadata = await ontologyProvider.getObjectDefinition(objectType);
2963
+ if (this.#sourceApiName in objectMetadata.interfaceMap) {
2964
+ changes?.modified.add(this.cacheKey);
2965
+ return void await this.revalidate(true);
2966
+ }
2967
+ }
2968
+ let targetTypeApiName;
2969
+ let targetTypeKind;
2970
+ if (this.#sourceTypeKind === "interface") {
2971
+ const interfaceMetadata = await ontologyProvider.getInterfaceDefinition(this.#sourceApiName);
2972
+ const linkDef = interfaceMetadata.links?.[this.#linkName];
2973
+ targetTypeApiName = linkDef?.targetTypeApiName;
2974
+ targetTypeKind = linkDef?.targetType;
2975
+ } else {
2976
+ const objectMetadata = await ontologyProvider.getObjectDefinition(this.#sourceApiName);
2977
+ const linkDef = objectMetadata.links?.[this.#linkName];
2978
+ targetTypeApiName = linkDef?.targetType;
2979
+ targetTypeKind = "object";
2980
+ }
2981
+ if (!targetTypeApiName) return;
2982
+ if (targetTypeApiName === objectType) {
2983
+ changes?.modified.add(this.cacheKey);
2984
+ return void await this.revalidate(true);
2985
+ }
2986
+ if (targetTypeKind === "interface") {
2987
+ const objectMetadata = await ontologyProvider.getObjectDefinition(objectType);
2988
+ if (targetTypeApiName in objectMetadata.interfaceMap) {
2989
+ changes?.modified.add(this.cacheKey);
2990
+ return void await this.revalidate(true);
2991
+ }
2992
+ }
2993
+ } catch (e) {
2994
+ if (process.env.NODE_ENV !== "production") {
2995
+ this.logger?.error("Failed to resolve metadata during invalidation", e);
2996
+ }
2430
2997
  changes?.modified.add(this.cacheKey);
2431
- return promise;
2432
- })();
2433
- }
2998
+ return void await this.revalidate(true);
2999
+ }
3000
+ })();
2434
3001
  };
2435
3002
  };
2436
3003
 
@@ -2443,11 +3010,12 @@ var LinksHelper = class extends AbstractHelper {
2443
3010
  }
2444
3011
  getQuery(options) {
2445
3012
  const {
2446
- apiName
3013
+ apiName,
3014
+ type: sourceTypeKind
2447
3015
  } = options.srcType;
2448
3016
  const canonWhere = this.whereCanonicalizer.canonicalize(options.where ?? {});
2449
3017
  const canonOrderBy = this.orderByCanonicalizer.canonicalize(options.orderBy ?? {});
2450
- const linkCacheKey = this.cacheKeys.get("specificLink", apiName, options.pk, options.linkName, canonWhere, canonOrderBy);
3018
+ const linkCacheKey = this.cacheKeys.get("specificLink", apiName, sourceTypeKind, options.sourceUnderlyingObjectType, options.pk, options.linkName, canonWhere, canonOrderBy);
2451
3019
  return this.store.queries.get(linkCacheKey, () => {
2452
3020
  return new SpecificLinkQuery(this.store, this.store.subjects.get(linkCacheKey), linkCacheKey, options);
2453
3021
  });
@@ -2463,162 +3031,6 @@ chunkLDTMSHUZ_cjs.init_cjs_shims();
2463
3031
  // src/observable/internal/list/ListQuery.ts
2464
3032
  chunkLDTMSHUZ_cjs.init_cjs_shims();
2465
3033
 
2466
- // src/observable/internal/getObjectTypesThatInvalidate.ts
2467
- chunkLDTMSHUZ_cjs.init_cjs_shims();
2468
- async function getObjectTypesThatInvalidate(mc, objectSet) {
2469
- const counts = {};
2470
- const resultType = await calcObjectSet(objectSet, {
2471
- counts,
2472
- methodInput: void 0,
2473
- ontologyProvider: mc.ontologyProvider
2474
- });
2475
- const tweaked = {
2476
- ...counts,
2477
- [resultType.apiName]: counts[resultType.apiName] - 1
2478
- };
2479
- return {
2480
- resultType,
2481
- counts,
2482
- invalidationSet: new Set(Object.entries(tweaked).filter(([, v]) => v > 0).map(([k]) => k))
2483
- };
2484
- }
2485
- async function calcObjectSet(os, ctx) {
2486
- const op = ctx.ontologyProvider;
2487
- async function bumpObject(apiName) {
2488
- const objectType = await op.getObjectDefinition(apiName);
2489
- ctx.counts[apiName] = (ctx.counts[apiName] ?? 0) + 1;
2490
- return objectType;
2491
- }
2492
- async function bumpInterface(apiName) {
2493
- const interfaceDef = await op.getInterfaceDefinition(apiName);
2494
- for (const s of interfaceDef.implementedBy ?? []) {
2495
- ctx.counts[s] = (ctx.counts[s] ?? 0) + 1;
2496
- }
2497
- return interfaceDef;
2498
- }
2499
- switch (os.type) {
2500
- case "base":
2501
- return await bumpObject(os.objectType);
2502
- case "interfaceBase":
2503
- return await bumpInterface(os.interfaceType);
2504
- case "interfaceLinkSearchAround": {
2505
- const srcDef = await calcObjectSet(os.objectSet, ctx);
2506
- !(srcDef.type === "interface") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false) : invariant5__default.default(false) : void 0;
2507
- for (const [k, v] of Object.entries(srcDef.links)) {
2508
- if (k === os.interfaceLink) {
2509
- if (v.targetType === "object") {
2510
- return await bumpObject(v.targetType);
2511
- }
2512
- return await bumpInterface(v.targetType);
2513
- }
2514
- }
2515
- throw new Error(`Could not find link ${os.interfaceLink} in object set ${JSON.stringify(os.objectSet)}`);
2516
- }
2517
- case "searchAround": {
2518
- const contextDef = await calcObjectSet(os.objectSet, ctx);
2519
- !(contextDef.type === "object") ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false) : invariant5__default.default(false) : void 0;
2520
- for (const [k, v] of Object.entries(contextDef.links)) {
2521
- if (k === os.link) {
2522
- return await bumpObject(v.targetType);
2523
- }
2524
- }
2525
- throw new Error(`Could not find link ${os.link} in object set ${JSON.stringify(os.objectSet)}`);
2526
- }
2527
- case "filter":
2528
- return calcObjectSet(os.objectSet, ctx);
2529
- case "union":
2530
- case "subtract":
2531
- case "intersect":
2532
- const returnTypes = await Promise.all(os.objectSets.map(async (os2) => {
2533
- const counts = {};
2534
- const r = await calcObjectSet(os2, {
2535
- ...ctx,
2536
- counts
2537
- });
2538
- return {
2539
- r,
2540
- counts
2541
- };
2542
- }));
2543
- for (const {
2544
- counts
2545
- } of returnTypes) {
2546
- for (const [k, v] of Object.entries(counts)) {
2547
- ctx.counts[k] = Math.max(ctx.counts[k] ?? 0, v);
2548
- }
2549
- }
2550
- if (returnTypes.length === 0) {
2551
- throw new Error(`Could not find any context types for set operation`);
2552
- }
2553
- const allMatch = returnTypes.every(({
2554
- r
2555
- }) => r.apiName === returnTypes[0].r.apiName);
2556
- if (!allMatch) {
2557
- throw new Error(`Incompatible context types found for set operation`);
2558
- }
2559
- return returnTypes[0].r;
2560
- case "withProperties":
2561
- for (const [, v] of Object.entries(os.derivedProperties)) {
2562
- await calcRdp(v, {
2563
- ...ctx,
2564
- methodInput: os.objectSet
2565
- });
2566
- }
2567
- return calcObjectSet(os.objectSet, {
2568
- ...ctx,
2569
- methodInput: os.objectSet
2570
- });
2571
- // used by rdps
2572
- case "methodInput":
2573
- !ctx.methodInput ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, "methodInput must be provided") : invariant5__default.default(false) : void 0;
2574
- return await calcObjectSet(ctx.methodInput, {
2575
- ...ctx,
2576
- counts: {}
2577
- });
2578
- case "asType":
2579
- // we don't currently support this anywhere.
2580
- case "asBaseObjectTypes":
2581
- // We don't currently support this because it could return multiple object types conceptually
2582
- // internally, we actually use it this way but we shouldn't be finding that object sets.
2583
- case "reference":
2584
- // reference is particularly problematic because we cannot answer the question about
2585
- // which types without loading the object set definition (and it can change).
2586
- case "static":
2587
- throw new Error(`Unsupported ObjectSet type ${os.type}`);
2588
- case "nearestNeighbors":
2589
- return calcObjectSet(os.objectSet, ctx);
2590
- default:
2591
- throw new Error(`Unhandled ObjectSet type ${os.type}`);
2592
- }
2593
- }
2594
- async function calcRdp(dpd, ctx) {
2595
- switch (dpd.type) {
2596
- // Operates on object sets
2597
- case "selection":
2598
- return await calcObjectSet(dpd.objectSet, ctx);
2599
- // Operates on single property
2600
- case "negate":
2601
- case "extract":
2602
- case "absoluteValue":
2603
- return await calcRdp(dpd.property, ctx);
2604
- // Operates on many (unordered) properties
2605
- case "least":
2606
- case "greatest":
2607
- case "add":
2608
- case "multiply":
2609
- return await Promise.all(dpd.properties.map((innerDpd) => calcRdp(innerDpd, ctx)));
2610
- // Operates on 2 ordered properties
2611
- case "subtract":
2612
- case "divide":
2613
- return await Promise.all([calcRdp(dpd.left, ctx), calcRdp(dpd.right, ctx)]);
2614
- // Operates on a single property name
2615
- case "property":
2616
- return;
2617
- default:
2618
- throw new Error(`Unhandled DerivedPropertyDefinition type ${dpd.type}`);
2619
- }
2620
- }
2621
-
2622
3034
  // src/observable/internal/objectMatchesWhereClause.ts
2623
3035
  chunkLDTMSHUZ_cjs.init_cjs_shims();
2624
3036
 
@@ -2724,6 +3136,7 @@ var ListQuery = class extends BaseListQuery {
2724
3136
  #intersectWith;
2725
3137
  #pivotInfo;
2726
3138
  #objectSet;
3139
+ #pivotIntersectApplied = false;
2727
3140
  /**
2728
3141
  * Register changes to the cache specific to ListQuery
2729
3142
  */
@@ -2731,13 +3144,13 @@ var ListQuery = class extends BaseListQuery {
2731
3144
  batch.changes.registerList(this.cacheKey);
2732
3145
  }
2733
3146
  constructor(store, subject, apiName, cacheKey, opts) {
2734
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVVKEXIIO_cjs.additionalContext].logger?.child({}, {
3147
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkYVZM2JPW_cjs.additionalContext].logger?.child({}, {
2735
3148
  msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
2736
3149
  }) : void 0);
2737
3150
  this.apiName = apiName;
2738
3151
  this.#whereClause = cacheKey.otherKeys[WHERE_IDX2];
2739
3152
  this.#orderBy = cacheKey.otherKeys[ORDER_BY_IDX];
2740
- this.#intersectWith = cacheKey.otherKeys[INTERSECT_IDX];
3153
+ this.#intersectWith = cacheKey.otherKeys[INTERSECT_IDX2];
2741
3154
  this.#pivotInfo = cacheKey.otherKeys[PIVOT_IDX];
2742
3155
  this.#objectSet = this.createObjectSet(store);
2743
3156
  if (!this.#pivotInfo) {
@@ -2760,24 +3173,45 @@ var ListQuery = class extends BaseListQuery {
2760
3173
  get canonicalPivotInfo() {
2761
3174
  return this.#pivotInfo;
2762
3175
  }
2763
- /**
2764
- * Create the ObjectSet for this query.
2765
- */
2766
3176
  /**
2767
3177
  * Implements fetchPageData from BaseCollectionQuery template method
2768
3178
  * Fetches a page of data
2769
3179
  */
2770
3180
  async fetchPageData(signal) {
2771
- if (Object.keys(this.#orderBy).length > 0 && !(this.sortingStrategy instanceof OrderBySortingStrategy)) {
2772
- const wireObjectSet = chunkVVKEXIIO_cjs.getWireObjectSet(this.#objectSet);
3181
+ const needsResultType = Object.keys(this.#orderBy).length > 0 && !(this.sortingStrategy instanceof OrderBySortingStrategy) || this.#pivotInfo != null && this.#intersectWith != null && this.#intersectWith.length > 0 && !this.#pivotIntersectApplied;
3182
+ if (needsResultType) {
3183
+ const wireObjectSet = chunkYVZM2JPW_cjs.getWireObjectSet(this.#objectSet);
2773
3184
  const {
2774
3185
  resultType
2775
- } = await getObjectTypesThatInvalidate(this.store.client[chunkVVKEXIIO_cjs.additionalContext], wireObjectSet);
2776
- this.sortingStrategy = new OrderBySortingStrategy(resultType.apiName, this.#orderBy);
3186
+ } = await getObjectTypesThatInvalidate(this.store.client[chunkYVZM2JPW_cjs.additionalContext], wireObjectSet);
3187
+ if (Object.keys(this.#orderBy).length > 0 && !(this.sortingStrategy instanceof OrderBySortingStrategy)) {
3188
+ this.sortingStrategy = new OrderBySortingStrategy(resultType.apiName, this.#orderBy);
3189
+ }
3190
+ if (this.#pivotInfo != null && this.#intersectWith != null && this.#intersectWith.length > 0 && !this.#pivotIntersectApplied) {
3191
+ const rdpConfig = this.cacheKey.otherKeys[RDP_IDX2];
3192
+ const intersectSets = this.#intersectWith.map((whereClause) => {
3193
+ if (resultType.type === "object") {
3194
+ let objectSet = this.store.client({
3195
+ type: "object",
3196
+ apiName: resultType.apiName
3197
+ });
3198
+ if (rdpConfig != null) {
3199
+ objectSet = objectSet.withProperties(rdpConfig);
3200
+ }
3201
+ return objectSet.where(whereClause);
3202
+ }
3203
+ return this.store.client({
3204
+ type: "interface",
3205
+ apiName: resultType.apiName
3206
+ }).where(whereClause);
3207
+ });
3208
+ this.#objectSet = this.#objectSet.intersect(...intersectSets);
3209
+ this.#pivotIntersectApplied = true;
3210
+ }
2777
3211
  }
2778
3212
  const resp = await this.#objectSet.fetchPage({
2779
3213
  $nextPageToken: this.nextPageToken,
2780
- $pageSize: this.options.pageSize,
3214
+ $pageSize: this.getEffectiveFetchPageSize(),
2781
3215
  $includeRid: true,
2782
3216
  // For now this keeps the shared test code from falling apart
2783
3217
  // but shouldn't be needed ideally
@@ -3000,6 +3434,21 @@ var ListQuery = class extends BaseListQuery {
3000
3434
  var InterfaceListQuery = class extends ListQuery {
3001
3435
  createObjectSet(store) {
3002
3436
  const rdpConfig = this.cacheKey.otherKeys[RDP_IDX2];
3437
+ const pivotInfo = this.cacheKey.otherKeys[PIVOT_IDX];
3438
+ if (pivotInfo != null) {
3439
+ const sourceSet = pivotInfo.sourceTypeKind === "interface" ? store.client({
3440
+ type: "interface",
3441
+ apiName: pivotInfo.sourceType
3442
+ }) : store.client({
3443
+ type: "object",
3444
+ apiName: pivotInfo.sourceType
3445
+ });
3446
+ let objectSet = sourceSet.where(this.canonicalWhere).pivotTo(pivotInfo.linkName);
3447
+ if (rdpConfig != null) {
3448
+ objectSet = objectSet.withProperties(rdpConfig);
3449
+ }
3450
+ return objectSet;
3451
+ }
3003
3452
  const type = "interface";
3004
3453
  const objectTypeDef = {
3005
3454
  type,
@@ -3038,7 +3487,7 @@ var InterfaceListQuery = class extends ListQuery {
3038
3487
  }
3039
3488
  extractRelevantObjects(changes) {
3040
3489
  const matchesApiName = ([, object]) => {
3041
- return this.apiName in object[chunk7543GRIE_cjs.ObjectDefRef].interfaceMap;
3490
+ return this.apiName in object[chunk6VOFZIIJ_cjs.ObjectDefRef].interfaceMap;
3042
3491
  };
3043
3492
  const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
3044
3493
  const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
@@ -3088,37 +3537,37 @@ chunkLDTMSHUZ_cjs.init_cjs_shims();
3088
3537
  var ObjectListQuery = class extends ListQuery {
3089
3538
  createObjectSet(store) {
3090
3539
  const rdpConfig = this.cacheKey.otherKeys[RDP_IDX2];
3091
- const intersectWith = this.cacheKey.otherKeys[INTERSECT_IDX];
3540
+ const intersectWith = this.cacheKey.otherKeys[INTERSECT_IDX2];
3092
3541
  const pivotInfo = this.cacheKey.otherKeys[PIVOT_IDX];
3093
3542
  const rids = this.cacheKey.otherKeys[RIDS_IDX];
3094
- const clientCtx = store.client[chunkVVKEXIIO_cjs.additionalContext];
3543
+ const clientCtx = store.client[chunkYVZM2JPW_cjs.additionalContext];
3095
3544
  const typeDefinition = {
3096
3545
  type: "object",
3097
3546
  apiName: this.apiName
3098
3547
  };
3099
3548
  if (pivotInfo != null) {
3100
- let sourceSet = store.client({
3101
- type: "object",
3102
- apiName: pivotInfo.sourceType
3103
- });
3104
- sourceSet = sourceSet.where(this.canonicalWhere);
3105
- let objectSet2 = sourceSet.pivotTo(pivotInfo.linkName);
3549
+ let sourceSet;
3550
+ if (rids != null) {
3551
+ sourceSet = clientCtx.objectSetFactory({
3552
+ type: "object",
3553
+ apiName: pivotInfo.sourceType
3554
+ }, clientCtx, {
3555
+ type: "static",
3556
+ objects: [...rids]
3557
+ });
3558
+ } else {
3559
+ sourceSet = pivotInfo.sourceTypeKind === "interface" ? store.client({
3560
+ type: "interface",
3561
+ apiName: pivotInfo.sourceType
3562
+ }) : store.client({
3563
+ type: "object",
3564
+ apiName: pivotInfo.sourceType
3565
+ });
3566
+ }
3567
+ let objectSet2 = sourceSet.where(this.canonicalWhere).pivotTo(pivotInfo.linkName);
3106
3568
  if (rdpConfig != null) {
3107
3569
  objectSet2 = objectSet2.withProperties(rdpConfig);
3108
3570
  }
3109
- if (intersectWith != null && intersectWith.length > 0) {
3110
- const intersectSets = intersectWith.map((whereClause) => {
3111
- let intersectSet = store.client({
3112
- type: "object",
3113
- apiName: pivotInfo.targetType
3114
- });
3115
- if (rdpConfig != null) {
3116
- intersectSet = intersectSet.withProperties(rdpConfig);
3117
- }
3118
- return intersectSet.where(whereClause);
3119
- });
3120
- objectSet2 = objectSet2.intersect(...intersectSets);
3121
- }
3122
3571
  return objectSet2;
3123
3572
  }
3124
3573
  let objectSet;
@@ -3212,7 +3661,7 @@ var ListsHelper = class extends AbstractHelper {
3212
3661
  const canonOrderBy = this.orderByCanonicalizer.canonicalize(orderBy ?? {});
3213
3662
  const canonRdp = withProperties ? this.rdpCanonicalizer.canonicalize(withProperties) : void 0;
3214
3663
  const canonIntersect = intersectWith && intersectWith.length > 0 ? this.intersectCanonicalizer.canonicalize(intersectWith) : void 0;
3215
- const canonPivot = pivotTo ? this.pivotCanonicalizer.canonicalize(apiName, pivotTo) : void 0;
3664
+ const canonPivot = pivotTo ? this.pivotCanonicalizer.canonicalize(apiName, type, pivotTo) : void 0;
3216
3665
  const canonRids = rids != null ? this.ridListCanonicalizer.canonicalize(rids) : void 0;
3217
3666
  const listCacheKey = this.cacheKeys.get("list", type, apiName, canonWhere, canonOrderBy, canonRdp, canonIntersect, canonPivot, canonRids);
3218
3667
  return this.store.queries.get(listCacheKey, () => {
@@ -3242,8 +3691,8 @@ function stripRdpFields(value, rdpFields) {
3242
3691
  if (rdpFields.size === 0) {
3243
3692
  return value;
3244
3693
  }
3245
- const underlying = value[chunk7543GRIE_cjs.UnderlyingOsdkObject];
3246
- const objectDef = value[chunk7543GRIE_cjs.ObjectDefRef];
3694
+ const underlying = value[chunk6VOFZIIJ_cjs.UnderlyingOsdkObject];
3695
+ const objectDef = value[chunk6VOFZIIJ_cjs.ObjectDefRef];
3247
3696
  const newProps = {
3248
3697
  $apiName: underlying.$apiName,
3249
3698
  $objectType: underlying.$objectType,
@@ -3256,7 +3705,7 @@ function stripRdpFields(value, rdpFields) {
3256
3705
  newProps[key] = underlying[key];
3257
3706
  }
3258
3707
  }
3259
- return chunk7543GRIE_cjs.createOsdkObject(value[chunk7543GRIE_cjs.ClientRef], objectDef, newProps);
3708
+ return chunk6VOFZIIJ_cjs.createOsdkObject(value[chunk6VOFZIIJ_cjs.ClientRef], objectDef, newProps);
3260
3709
  }
3261
3710
  function isSuperset(superset, subset) {
3262
3711
  for (const field of subset) {
@@ -3267,8 +3716,8 @@ function isSuperset(superset, subset) {
3267
3716
  return true;
3268
3717
  }
3269
3718
  function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
3270
- const underlying = value[chunk7543GRIE_cjs.UnderlyingOsdkObject];
3271
- const objectDef = value[chunk7543GRIE_cjs.ObjectDefRef];
3719
+ const underlying = value[chunk6VOFZIIJ_cjs.UnderlyingOsdkObject];
3720
+ const objectDef = value[chunk6VOFZIIJ_cjs.ObjectDefRef];
3272
3721
  const newProps = {
3273
3722
  $apiName: underlying.$apiName,
3274
3723
  $objectType: underlying.$objectType,
@@ -3284,7 +3733,7 @@ function filterToRdpFields(value, rdpFieldsToKeep, sourceRdpFields) {
3284
3733
  }
3285
3734
  }
3286
3735
  }
3287
- return chunk7543GRIE_cjs.createOsdkObject(value[chunk7543GRIE_cjs.ClientRef], objectDef, newProps);
3736
+ return chunk6VOFZIIJ_cjs.createOsdkObject(value[chunk6VOFZIIJ_cjs.ClientRef], objectDef, newProps);
3288
3737
  }
3289
3738
  function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, targetCurrentValue) {
3290
3739
  if (targetRdpFields.size === 0) {
@@ -3296,8 +3745,8 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
3296
3745
  }
3297
3746
  return filterToRdpFields(sourceValue, targetRdpFields, sourceRdpFields);
3298
3747
  }
3299
- const sourceUnderlying = sourceValue[chunk7543GRIE_cjs.UnderlyingOsdkObject];
3300
- const objectDef = sourceValue[chunk7543GRIE_cjs.ObjectDefRef];
3748
+ const sourceUnderlying = sourceValue[chunk6VOFZIIJ_cjs.UnderlyingOsdkObject];
3749
+ const objectDef = sourceValue[chunk6VOFZIIJ_cjs.ObjectDefRef];
3301
3750
  const newProps = {
3302
3751
  $apiName: sourceUnderlying.$apiName,
3303
3752
  $objectType: sourceUnderlying.$objectType,
@@ -3311,14 +3760,16 @@ function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, target
3311
3760
  }
3312
3761
  }
3313
3762
  if (targetCurrentValue) {
3314
- const targetUnderlying = targetCurrentValue[chunk7543GRIE_cjs.UnderlyingOsdkObject];
3763
+ const targetUnderlying = targetCurrentValue[chunk6VOFZIIJ_cjs.UnderlyingOsdkObject];
3315
3764
  for (const field of targetRdpFields) {
3316
- if (!sourceRdpFields.has(field) && field in targetUnderlying) {
3317
- newProps[field] = targetUnderlying[field];
3765
+ if (field in targetUnderlying) {
3766
+ if (!sourceRdpFields.has(field) || newProps[field] === void 0) {
3767
+ newProps[field] = targetUnderlying[field];
3768
+ }
3318
3769
  }
3319
3770
  }
3320
3771
  }
3321
- return chunk7543GRIE_cjs.createOsdkObject(sourceValue[chunk7543GRIE_cjs.ClientRef], objectDef, newProps);
3772
+ return chunk6VOFZIIJ_cjs.createOsdkObject(sourceValue[chunk6VOFZIIJ_cjs.ClientRef], objectDef, newProps);
3322
3773
  }
3323
3774
 
3324
3775
  // src/observable/internal/object/ObjectCacheKeyRegistry.ts
@@ -3453,40 +3904,54 @@ var BulkObjectLoader = class {
3453
3904
  #maxEntries;
3454
3905
  constructor(client, maxWait = 25, maxEntries = 100) {
3455
3906
  this.#client = client;
3456
- this.#logger = client[chunkVVKEXIIO_cjs.additionalContext].logger;
3907
+ this.#logger = client[chunkYVZM2JPW_cjs.additionalContext].logger;
3457
3908
  this.#maxWait = maxWait;
3458
3909
  this.#maxEntries = maxEntries;
3459
3910
  }
3460
- async fetch(apiName, primaryKey) {
3911
+ async fetch(apiName, primaryKey, defType = "object") {
3461
3912
  const deferred = pDefer();
3462
3913
  const entry = this.#m.get(apiName);
3463
3914
  entry.data.push({
3464
3915
  primaryKey,
3465
3916
  deferred
3466
3917
  });
3918
+ if (entry.defType === void 0) {
3919
+ entry.defType = defType;
3920
+ } else if (entry.defType !== defType) {
3921
+ deferred.reject(new shared_net_errors.PalantirApiError(`Conflicting defType for ${apiName}: existing=${entry.defType}, new=${defType}`));
3922
+ return deferred.promise;
3923
+ }
3467
3924
  if (!entry.timer) {
3468
3925
  entry.timer = setTimeout(() => {
3469
- this.#loadObjects(apiName, entry.data);
3926
+ this.#loadObjects(apiName, entry.data, entry.defType ?? "object");
3470
3927
  }, this.#maxWait);
3471
3928
  }
3472
3929
  if (entry.data.length >= this.#maxEntries) {
3473
3930
  clearTimeout(entry.timer);
3474
- this.#loadObjects(apiName, entry.data);
3931
+ this.#loadObjects(apiName, entry.data, entry.defType ?? "object");
3475
3932
  }
3476
3933
  return await deferred.promise;
3477
3934
  }
3478
- #loadObjects(apiName, arr) {
3935
+ #loadObjects(apiName, arr, defType) {
3479
3936
  this.#m.delete(apiName);
3480
- this.#reallyLoadObjects(apiName, arr).catch((e) => {
3937
+ const loadFn = defType === "interface" ? this.#loadInterfaceObjects(apiName, arr) : this.#loadObjectTypeObjects(apiName, arr);
3938
+ loadFn.catch((e) => {
3481
3939
  this.#logger?.error("Unhandled exception", e);
3940
+ for (const {
3941
+ primaryKey,
3942
+ deferred
3943
+ } of arr) {
3944
+ const errorMessage = e instanceof Error ? e.message : String(e);
3945
+ deferred.reject(new shared_net_errors.PalantirApiError(`Failed to load ${apiName} with pk ${primaryKey}: ${errorMessage}`));
3946
+ }
3482
3947
  });
3483
3948
  }
3484
- async #reallyLoadObjects(apiName, arr) {
3485
- const miniDef = {
3949
+ async #loadObjectTypeObjects(apiName, arr) {
3950
+ const objectDef = {
3486
3951
  type: "object",
3487
3952
  apiName
3488
3953
  };
3489
- const objMetadata = await this.#client.fetchMetadata(miniDef);
3954
+ const objMetadata = await this.#client.fetchMetadata(objectDef);
3490
3955
  const pks = arr.map((x) => x.primaryKey);
3491
3956
  const whereClause = pks.length === 1 ? {
3492
3957
  [objMetadata.primaryKeyApiName]: {
@@ -3499,7 +3964,7 @@ var BulkObjectLoader = class {
3499
3964
  };
3500
3965
  const {
3501
3966
  data
3502
- } = await this.#client(miniDef).where(whereClause).fetchPage({
3967
+ } = await this.#client(objectDef).where(whereClause).fetchPage({
3503
3968
  $pageSize: pks.length,
3504
3969
  $includeRid: true
3505
3970
  });
@@ -3515,18 +3980,70 @@ var BulkObjectLoader = class {
3515
3980
  }
3516
3981
  }
3517
3982
  }
3983
+ async #loadInterfaceObjects(apiName, arr) {
3984
+ const pks = arr.map((x) => x.primaryKey);
3985
+ const interfaceDef = {
3986
+ type: "interface",
3987
+ apiName
3988
+ };
3989
+ const interfaceMetadata = await this.#client.fetchMetadata(interfaceDef);
3990
+ const implementingTypes = interfaceMetadata.implementedBy ?? [];
3991
+ const foundObjects = /* @__PURE__ */ new Map();
3992
+ for (const objectTypeName of implementingTypes) {
3993
+ const objectDef = {
3994
+ type: "object",
3995
+ apiName: objectTypeName
3996
+ };
3997
+ const objMetadata = await this.#client.fetchMetadata(objectDef);
3998
+ const remainingPks = pks.filter((pk) => !foundObjects.has(pk));
3999
+ if (remainingPks.length === 0) {
4000
+ break;
4001
+ }
4002
+ const whereClause = remainingPks.length === 1 ? {
4003
+ [objMetadata.primaryKeyApiName]: {
4004
+ $eq: remainingPks[0]
4005
+ }
4006
+ } : {
4007
+ [objMetadata.primaryKeyApiName]: {
4008
+ $in: remainingPks
4009
+ }
4010
+ };
4011
+ const {
4012
+ data
4013
+ } = await this.#client(objectDef).where(whereClause).fetchPage({
4014
+ $pageSize: remainingPks.length
4015
+ });
4016
+ for (const obj of data) {
4017
+ foundObjects.set(obj.$primaryKey, obj);
4018
+ }
4019
+ }
4020
+ for (const {
4021
+ primaryKey,
4022
+ deferred
4023
+ } of arr) {
4024
+ const object = foundObjects.get(primaryKey);
4025
+ if (object) {
4026
+ deferred.resolve(object);
4027
+ } else {
4028
+ deferred.reject(new shared_net_errors.PalantirApiError(`Interface ${apiName} object not found: ${primaryKey}`));
4029
+ }
4030
+ }
4031
+ }
3518
4032
  };
3519
4033
 
3520
4034
  // src/observable/internal/object/ObjectQuery.ts
3521
4035
  var ObjectQuery = class extends Query {
3522
4036
  #apiName;
3523
4037
  #pk;
3524
- constructor(store, subject, type, pk, cacheKey, opts) {
3525
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVVKEXIIO_cjs.additionalContext].logger?.child({}, {
4038
+ #defType;
4039
+ #implementingTypes;
4040
+ constructor(store, subject, type, pk, cacheKey, opts, defType = "object") {
4041
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkYVZM2JPW_cjs.additionalContext].logger?.child({}, {
3526
4042
  msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
3527
4043
  }) : void 0);
3528
4044
  this.#apiName = type;
3529
4045
  this.#pk = pk;
4046
+ this.#defType = defType;
3530
4047
  }
3531
4048
  _createConnectable(subject) {
3532
4049
  return rxjs.connectable(subject.pipe(rxjs.map((x) => {
@@ -3555,7 +4072,7 @@ var ObjectQuery = class extends Query {
3555
4072
  let obj;
3556
4073
  if (rdpConfig) {
3557
4074
  const miniDef = {
3558
- type: "object",
4075
+ type: this.#defType,
3559
4076
  apiName: this.#apiName
3560
4077
  };
3561
4078
  const fetched = await this.store.client(miniDef).withProperties(rdpConfig).fetchOne(this.#pk, {
@@ -3563,7 +4080,7 @@ var ObjectQuery = class extends Query {
3563
4080
  });
3564
4081
  obj = fetched;
3565
4082
  } else {
3566
- obj = await getBulkObjectLoader(this.store.client).fetch(this.#apiName, this.#pk);
4083
+ obj = await getBulkObjectLoader(this.store.client).fetch(this.#apiName, this.#pk, this.#defType);
3567
4084
  }
3568
4085
  this.store.batch({}, (batch) => {
3569
4086
  this.writeToStore(obj, "loaded", batch);
@@ -3582,12 +4099,26 @@ var ObjectQuery = class extends Query {
3582
4099
  this.store.objects.propagateWrite(this.cacheKey, tombstone, status, batch);
3583
4100
  return batch.read(this.cacheKey);
3584
4101
  }
3585
- invalidateObjectType = (objectType, changes) => {
3586
- if (this.#apiName === objectType) {
4102
+ invalidateObjectType = async (objectType, changes) => {
4103
+ if (this.#defType === "object") {
4104
+ if (this.#apiName === objectType) {
4105
+ changes?.modified.add(this.cacheKey);
4106
+ return this.revalidate(true);
4107
+ }
4108
+ return;
4109
+ }
4110
+ if (!this.#implementingTypes) {
4111
+ const interfaceDef = {
4112
+ type: "interface",
4113
+ apiName: this.#apiName
4114
+ };
4115
+ const metadata = await this.store.client.fetchMetadata(interfaceDef);
4116
+ this.#implementingTypes = new Set(metadata.implementedBy ?? []);
4117
+ }
4118
+ if (this.#implementingTypes.has(objectType)) {
3587
4119
  changes?.modified.add(this.cacheKey);
3588
4120
  return this.revalidate(true);
3589
4121
  }
3590
- return Promise.resolve();
3591
4122
  };
3592
4123
  };
3593
4124
 
@@ -3601,10 +4132,11 @@ var ObjectsHelper = class extends AbstractHelper {
3601
4132
  const {
3602
4133
  pk
3603
4134
  } = options;
4135
+ const defType = chunk6VOFZIIJ_cjs.getDefType(options.apiName);
3604
4136
  const objectCacheKey = this.cacheKeys.get("object", apiName, pk, rdpConfig ?? void 0);
3605
4137
  return this.store.queries.get(objectCacheKey, () => new ObjectQuery(this.store, this.store.subjects.get(objectCacheKey), apiName, pk, objectCacheKey, {
3606
4138
  dedupeInterval: 0
3607
- }));
4139
+ }, defType));
3608
4140
  }
3609
4141
  /**
3610
4142
  * Internal helper method for writing objects to the store and returning their
@@ -3650,11 +4182,18 @@ var ObjectsHelper = class extends AbstractHelper {
3650
4182
  }
3651
4183
  }
3652
4184
  /**
3653
- * Check if a cache key is actively observed
4185
+ * Check if a cache key is actively observed or pending cleanup.
4186
+ * During React unmount-remount cycles, a key may be momentarily
4187
+ * unobserved while its cleanup is deferred to a microtask.
4188
+ * We still propagate to such keys to prevent stale data when
4189
+ * the subscription is re-established.
3654
4190
  */
3655
4191
  isKeyActive(key) {
3656
4192
  const subject = this.store.subjects.peek(key);
3657
- return subject?.observed === true;
4193
+ if (subject?.observed === true) {
4194
+ return true;
4195
+ }
4196
+ return (this.store.pendingCleanup.get(key) ?? 0) > 0;
3658
4197
  }
3659
4198
  /**
3660
4199
  * Type guard to check if a value is an ObjectHolder
@@ -3683,7 +4222,7 @@ var ObjectSetQuery = class extends BaseListQuery {
3683
4222
  #composedObjectSet;
3684
4223
  #objectTypes;
3685
4224
  constructor(store, subject, baseObjectSetWire, operations, cacheKey, opts) {
3686
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVVKEXIIO_cjs.additionalContext].logger?.child({}, {
4225
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkYVZM2JPW_cjs.additionalContext].logger?.child({}, {
3687
4226
  msgPrefix: `ObjectSetQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
3688
4227
  }) : void 0);
3689
4228
  this.#baseObjectSetWire = baseObjectSetWire;
@@ -3698,6 +4237,9 @@ var ObjectSetQuery = class extends BaseListQuery {
3698
4237
  this.minResultsToLoad = opts.pageSize || 0;
3699
4238
  }
3700
4239
  }
4240
+ get rdpConfig() {
4241
+ return this.#operations.withProperties ?? null;
4242
+ }
3701
4243
  #composeObjectSet(opts) {
3702
4244
  let result = opts.baseObjectSet;
3703
4245
  if (opts.withProperties) {
@@ -3728,7 +4270,7 @@ var ObjectSetQuery = class extends BaseListQuery {
3728
4270
  }
3729
4271
  if (opts.union) {
3730
4272
  for (const os of opts.union) {
3731
- const wire = chunkVVKEXIIO_cjs.getWireObjectSet(os);
4273
+ const wire = chunkYVZM2JPW_cjs.getWireObjectSet(os);
3732
4274
  if (wire.type) {
3733
4275
  types.add(wire.type);
3734
4276
  }
@@ -3736,7 +4278,7 @@ var ObjectSetQuery = class extends BaseListQuery {
3736
4278
  }
3737
4279
  if (opts.intersect) {
3738
4280
  for (const os of opts.intersect) {
3739
- const wire = chunkVVKEXIIO_cjs.getWireObjectSet(os);
4281
+ const wire = chunkYVZM2JPW_cjs.getWireObjectSet(os);
3740
4282
  if (wire.type) {
3741
4283
  types.add(wire.type);
3742
4284
  }
@@ -3744,7 +4286,7 @@ var ObjectSetQuery = class extends BaseListQuery {
3744
4286
  }
3745
4287
  if (opts.subtract) {
3746
4288
  for (const os of opts.subtract) {
3747
- const wire = chunkVVKEXIIO_cjs.getWireObjectSet(os);
4289
+ const wire = chunkYVZM2JPW_cjs.getWireObjectSet(os);
3748
4290
  if (wire.type) {
3749
4291
  types.add(wire.type);
3750
4292
  }
@@ -3764,15 +4306,15 @@ var ObjectSetQuery = class extends BaseListQuery {
3764
4306
  */
3765
4307
  async fetchPageData(signal) {
3766
4308
  if (this.#operations.orderBy && Object.keys(this.#operations.orderBy).length > 0 && !(this.sortingStrategy instanceof OrderBySortingStrategy)) {
3767
- const wireObjectSet = chunkVVKEXIIO_cjs.getWireObjectSet(this.#composedObjectSet);
4309
+ const wireObjectSet = chunkYVZM2JPW_cjs.getWireObjectSet(this.#composedObjectSet);
3768
4310
  const {
3769
4311
  resultType
3770
- } = await getObjectTypesThatInvalidate(this.store.client[chunkVVKEXIIO_cjs.additionalContext], wireObjectSet);
4312
+ } = await getObjectTypesThatInvalidate(this.store.client[chunkYVZM2JPW_cjs.additionalContext], wireObjectSet);
3771
4313
  this.sortingStrategy = new OrderBySortingStrategy(resultType.apiName, this.#operations.orderBy);
3772
4314
  }
3773
4315
  const resp = await this.#composedObjectSet.fetchPage({
3774
4316
  $nextPageToken: this.nextPageToken,
3775
- $pageSize: this.options.pageSize,
4317
+ $pageSize: this.getEffectiveFetchPageSize(),
3776
4318
  $includeRid: true,
3777
4319
  // OrderBy is already applied in the composed ObjectSet
3778
4320
  ...this.#operations.orderBy && Object.keys(this.#operations.orderBy).length > 0 ? {
@@ -3820,10 +4362,11 @@ var ObjectSetQuery = class extends BaseListQuery {
3820
4362
 
3821
4363
  // src/observable/internal/objectset/ObjectSetHelper.ts
3822
4364
  var ObjectSetHelper = class extends AbstractHelper {
3823
- constructor(store, cacheKeys, whereCanonicalizer2, orderByCanonicalizer2) {
4365
+ constructor(store, cacheKeys, whereCanonicalizer2, orderByCanonicalizer2, rdpCanonicalizer) {
3824
4366
  super(store, cacheKeys);
3825
4367
  this.whereCanonicalizer = whereCanonicalizer2;
3826
4368
  this.orderByCanonicalizer = orderByCanonicalizer2;
4369
+ this.rdpCanonicalizer = rdpCanonicalizer;
3827
4370
  }
3828
4371
  observe(options, subFn) {
3829
4372
  const ret = super.observe(options, subFn);
@@ -3836,7 +4379,7 @@ var ObjectSetHelper = class extends AbstractHelper {
3836
4379
  const {
3837
4380
  baseObjectSet
3838
4381
  } = options;
3839
- const baseObjectSetWire = JSON.stringify(chunkVVKEXIIO_cjs.getWireObjectSet(baseObjectSet));
4382
+ const baseObjectSetWire = JSON.stringify(chunkYVZM2JPW_cjs.getWireObjectSet(baseObjectSet));
3840
4383
  const operations = this.buildCanonicalizedOperations(options);
3841
4384
  const objectSetCacheKey = this.cacheKeys.get("objectSet", baseObjectSetWire, operations);
3842
4385
  return this.store.queries.get(objectSetCacheKey, () => {
@@ -3849,16 +4392,16 @@ var ObjectSetHelper = class extends AbstractHelper {
3849
4392
  operations.where = this.whereCanonicalizer.canonicalize(options.where);
3850
4393
  }
3851
4394
  if (options.withProperties) {
3852
- operations.withProperties = Object.keys(options.withProperties).sort();
4395
+ operations.withProperties = this.rdpCanonicalizer.canonicalize(options.withProperties);
3853
4396
  }
3854
4397
  if (options.union && options.union.length > 0) {
3855
- operations.union = options.union.map((os) => JSON.stringify(chunkVVKEXIIO_cjs.getWireObjectSet(os)));
4398
+ operations.union = options.union.map((os) => JSON.stringify(chunkYVZM2JPW_cjs.getWireObjectSet(os)));
3856
4399
  }
3857
4400
  if (options.intersect && options.intersect.length > 0) {
3858
- operations.intersect = options.intersect.map((os) => JSON.stringify(chunkVVKEXIIO_cjs.getWireObjectSet(os)));
4401
+ operations.intersect = options.intersect.map((os) => JSON.stringify(chunkYVZM2JPW_cjs.getWireObjectSet(os)));
3859
4402
  }
3860
4403
  if (options.subtract && options.subtract.length > 0) {
3861
- operations.subtract = options.subtract.map((os) => JSON.stringify(chunkVVKEXIIO_cjs.getWireObjectSet(os)));
4404
+ operations.subtract = options.subtract.map((os) => JSON.stringify(chunkYVZM2JPW_cjs.getWireObjectSet(os)));
3862
4405
  }
3863
4406
  if (options.pivotTo) {
3864
4407
  operations.pivotTo = options.pivotTo;
@@ -3877,14 +4420,14 @@ var ObjectSetHelper = class extends AbstractHelper {
3877
4420
  chunkLDTMSHUZ_cjs.init_cjs_shims();
3878
4421
  var PivotCanonicalizer = class {
3879
4422
  #cache = /* @__PURE__ */ new Map();
3880
- canonicalize(sourceType, linkName) {
3881
- const key = `${sourceType}::${linkName}`;
4423
+ canonicalize(sourceType, sourceTypeKind, linkName) {
4424
+ const key = `${sourceTypeKind}:${sourceType}::${linkName}`;
3882
4425
  let canonical = this.#cache.get(key);
3883
4426
  if (!canonical) {
3884
4427
  canonical = {
3885
4428
  sourceType,
3886
- linkName,
3887
- targetType: "<targetType>"
4429
+ sourceTypeKind,
4430
+ linkName
3888
4431
  };
3889
4432
  this.#cache.set(key, canonical);
3890
4433
  }
@@ -3930,7 +4473,7 @@ var RdpCanonicalizer = class extends CachingCanonicalizer {
3930
4473
  apiName: "__rdp_canonicalizer_holder__"
3931
4474
  };
3932
4475
  for (const [key, rdpFunction] of Object.entries(rdp)) {
3933
- const builder = chunkVVKEXIIO_cjs.createWithPropertiesObjectSet(
4476
+ const builder = chunkYVZM2JPW_cjs.createWithPropertiesObjectSet(
3934
4477
  objectTypeHolder,
3935
4478
  {
3936
4479
  type: "methodInput"
@@ -3990,6 +4533,17 @@ var Store = class {
3990
4533
  ridListCanonicalizer = new RidListCanonicalizer();
3991
4534
  /** @internal */
3992
4535
  queries = new Queries();
4536
+ /**
4537
+ * Tracks cache keys with deferred cleanup. During React unmount-remount
4538
+ * cycles, a subscription may be cleaned up and immediately re-created.
4539
+ * By deferring cleanup to a microtask, we prevent propagateWrite from
4540
+ * skipping keys that are momentarily between subscriptions.
4541
+ *
4542
+ * The value is a count (not a boolean) so multiple unsubscribes within the
4543
+ * same tick schedule the correct number of releases.
4544
+ * @internal
4545
+ */
4546
+ pendingCleanup = /* @__PURE__ */ new Map();
3993
4547
  objectCacheKeyRegistry = new ObjectCacheKeyRegistry();
3994
4548
  layers = new Layers({
3995
4549
  logger: this.logger,
@@ -3998,19 +4552,19 @@ var Store = class {
3998
4552
  subjects = this.layers.subjects;
3999
4553
  // these are hopefully temporary
4000
4554
  constructor(client) {
4001
- this.logger = client[chunkVVKEXIIO_cjs.additionalContext].logger?.child({}, {
4555
+ this.logger = client[chunkYVZM2JPW_cjs.additionalContext].logger?.child({}, {
4002
4556
  msgPrefix: "Store"
4003
4557
  });
4004
4558
  this.client = client;
4005
4559
  this.cacheKeys = new CacheKeys({
4006
4560
  onDestroy: this.#cleanupCacheKey
4007
4561
  });
4008
- this.aggregations = new AggregationsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.rdpCanonicalizer);
4562
+ this.aggregations = new AggregationsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.rdpCanonicalizer, this.intersectCanonicalizer);
4009
4563
  this.functions = new FunctionsHelper(this, this.cacheKeys);
4010
4564
  this.lists = new ListsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer, this.rdpCanonicalizer, this.intersectCanonicalizer, this.pivotCanonicalizer, this.ridListCanonicalizer);
4011
4565
  this.objects = new ObjectsHelper(this, this.cacheKeys);
4012
4566
  this.links = new LinksHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer);
4013
- this.objectSets = new ObjectSetHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer);
4567
+ this.objectSets = new ObjectSetHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer, this.rdpCanonicalizer);
4014
4568
  }
4015
4569
  /**
4016
4570
  * Called after a key is no longer retained and the timeout has elapsed
@@ -4172,6 +4726,11 @@ var Store = class {
4172
4726
  return cacheKey.otherKeys[RDP_IDX2];
4173
4727
  } else if (cacheKey.type === "aggregation") {
4174
4728
  return cacheKey.otherKeys[RDP_IDX];
4729
+ } else if (cacheKey.type === "objectSet") {
4730
+ const query = this.queries.peek(cacheKey);
4731
+ if (query) {
4732
+ return query.rdpConfig;
4733
+ }
4175
4734
  }
4176
4735
  }
4177
4736
  return void 0;
@@ -4271,10 +4830,10 @@ var Store = class {
4271
4830
 
4272
4831
  // src/observable/ObservableClient.ts
4273
4832
  function createObservableClient(client) {
4274
- const tweakedClient = chunk7543GRIE_cjs.createClientFromContext({
4275
- ...client[chunkVVKEXIIO_cjs.additionalContext],
4276
- fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkVVKEXIIO_cjs.additionalContext].fetch, (headers) => {
4277
- headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunk7543GRIE_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
4833
+ const tweakedClient = chunk6VOFZIIJ_cjs.createClientFromContext({
4834
+ ...client[chunkYVZM2JPW_cjs.additionalContext],
4835
+ fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkYVZM2JPW_cjs.additionalContext].fetch, (headers) => {
4836
+ headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunk6VOFZIIJ_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
4278
4837
  return headers;
4279
4838
  })
4280
4839
  });
@@ -4318,11 +4877,19 @@ function getOsdkConfig(ontologyRid) {
4318
4877
 
4319
4878
  Object.defineProperty(exports, "createClientWithTransaction", {
4320
4879
  enumerable: true,
4321
- get: function () { return chunk7543GRIE_cjs.createClientWithTransaction; }
4880
+ get: function () { return chunk6VOFZIIJ_cjs.createClientWithTransaction; }
4322
4881
  });
4323
4882
  Object.defineProperty(exports, "augment", {
4324
4883
  enumerable: true,
4325
- get: function () { return chunkVVKEXIIO_cjs.augment; }
4884
+ get: function () { return chunkYVZM2JPW_cjs.augment; }
4885
+ });
4886
+ Object.defineProperty(exports, "getWireObjectSet", {
4887
+ enumerable: true,
4888
+ get: function () { return chunkYVZM2JPW_cjs.getWireObjectSet; }
4889
+ });
4890
+ Object.defineProperty(exports, "isObjectSet", {
4891
+ enumerable: true,
4892
+ get: function () { return chunkYVZM2JPW_cjs.isObjectSet; }
4326
4893
  });
4327
4894
  exports.computeObjectSetCacheKey = computeObjectSetCacheKey;
4328
4895
  exports.createObservableClient = createObservableClient;