@osdk/client 2.6.0-beta.2 → 2.6.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +2 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/internal/conversions/extractNamespace.js +22 -0
- package/build/browser/internal/conversions/extractNamespace.js.map +1 -0
- package/build/browser/internal/conversions/fullyQualifyPropName.js +26 -0
- package/build/browser/internal/conversions/fullyQualifyPropName.js.map +1 -0
- package/build/browser/internal/conversions/makeGeoFilterBbox.js +41 -0
- package/build/browser/internal/conversions/makeGeoFilterBbox.js.map +1 -0
- package/build/browser/internal/conversions/makeGeoFilterIntersects.js +29 -0
- package/build/browser/internal/conversions/makeGeoFilterIntersects.js.map +1 -0
- package/build/browser/internal/conversions/makeGeoFilterPolygon.js +30 -0
- package/build/browser/internal/conversions/makeGeoFilterPolygon.js.map +1 -0
- package/build/browser/internal/conversions/makeGeoFilterWithin.js +48 -0
- package/build/browser/internal/conversions/makeGeoFilterWithin.js.map +1 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +30 -99
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +139 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/fetchPage.js +1 -1
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/formatting/applyPropertyFormatter.js +7 -1
- package/build/browser/object/formatting/applyPropertyFormatter.js.map +1 -1
- package/build/browser/object/formatting/applyPropertyFormatter.test.js +305 -2
- package/build/browser/object/formatting/applyPropertyFormatter.test.js.map +1 -1
- package/build/browser/object/formatting/formatDateTime.js +158 -0
- package/build/browser/object/formatting/formatDateTime.js.map +1 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +17 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/internal/BulkObjectLoader.js +12 -4
- package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/browser/observable/internal/BulkObjectLoader.test.js +48 -0
- package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -1
- package/build/browser/observable/internal/CacheKeys.js +9 -3
- package/build/browser/observable/internal/CacheKeys.js.map +1 -1
- package/build/browser/observable/internal/Canonicalizer.js +51 -0
- package/build/browser/observable/internal/Canonicalizer.js.map +1 -0
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/OrderByCanonicalizer.js +1 -4
- package/build/browser/observable/internal/OrderByCanonicalizer.js.map +1 -1
- package/build/browser/observable/internal/RdpCanonicalizer.js +66 -0
- package/build/browser/observable/internal/RdpCanonicalizer.js.map +1 -0
- package/build/browser/observable/internal/RdpCanonicalizer.test.js +68 -0
- package/build/browser/observable/internal/RdpCanonicalizer.test.js.map +1 -0
- package/build/browser/observable/internal/SimpleWhereClause.js.map +1 -1
- package/build/browser/observable/internal/Store.js +160 -6
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/WhereClauseCanonicalizer.js +1 -1
- package/build/browser/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
- package/build/browser/observable/internal/actions/ActionApplication.js +1 -1
- package/build/browser/observable/internal/actions/ActionApplication.js.map +1 -1
- package/build/browser/observable/internal/actions/OptimisticJob.js +3 -3
- package/build/browser/observable/internal/actions/OptimisticJob.js.map +1 -1
- package/build/browser/observable/internal/base-list/BaseListQuery.js +12 -3
- package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/browser/observable/internal/base-list/createCollectionConnectable.js +0 -5
- package/build/browser/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
- package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js +26 -13
- package/build/browser/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
- package/build/browser/observable/internal/evaluateFilter.js +61 -0
- package/build/browser/observable/internal/evaluateFilter.js.map +1 -0
- package/build/browser/observable/internal/links/SpecificLinkCacheKey.js +33 -1
- package/build/browser/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
- package/build/browser/observable/internal/list/InterfaceListQuery.js +8 -3
- package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
- package/build/browser/observable/internal/list/ListCacheKey.js +22 -1
- package/build/browser/observable/internal/list/ListCacheKey.js.map +1 -1
- package/build/browser/observable/internal/list/ListQuery.js +19 -13
- package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/list/ListsHelper.js +12 -8
- package/build/browser/observable/internal/list/ListsHelper.js.map +1 -1
- package/build/browser/observable/internal/list/ObjectListQuery.js +10 -1
- package/build/browser/observable/internal/list/ObjectListQuery.js.map +1 -1
- package/build/browser/observable/internal/object/ObjectCacheKey.js +20 -1
- package/build/browser/observable/internal/object/ObjectCacheKey.js.map +1 -1
- package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.js +126 -0
- package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.js.map +1 -0
- package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.test.js +173 -0
- package/build/browser/observable/internal/object/ObjectCacheKeyRegistry.test.js.map +1 -0
- package/build/browser/observable/internal/object/ObjectQuery.js +10 -58
- package/build/browser/observable/internal/object/ObjectQuery.js.map +1 -1
- package/build/browser/observable/internal/object/ObjectsHelper.js +65 -5
- package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -1
- package/build/browser/observable/internal/objectMatchesWhereClause.js +3 -37
- package/build/browser/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js +3 -2
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/observable/internal/utils/rdpFieldOperations.js +83 -0
- package/build/browser/observable/internal/utils/rdpFieldOperations.js.map +1 -0
- package/build/browser/util/UserAgent.js +2 -2
- package/build/cjs/{chunk-X7WMWKLM.cjs → chunk-7567LSZD.cjs} +192 -55
- package/build/cjs/chunk-7567LSZD.cjs.map +1 -0
- package/build/cjs/{chunk-6L3MX4LH.cjs → chunk-VNLY3YOJ.cjs} +241 -196
- package/build/cjs/chunk-VNLY3YOJ.cjs.map +1 -0
- package/build/cjs/index.cjs +8 -8
- package/build/cjs/index.d.cts +1 -1
- package/build/cjs/public/internal.cjs +8 -8
- package/build/cjs/public/unstable-do-not-use.cjs +633 -208
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +6 -5
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +2 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/internal/conversions/extractNamespace.js +22 -0
- package/build/esm/internal/conversions/extractNamespace.js.map +1 -0
- package/build/esm/internal/conversions/fullyQualifyPropName.js +26 -0
- package/build/esm/internal/conversions/fullyQualifyPropName.js.map +1 -0
- package/build/esm/internal/conversions/makeGeoFilterBbox.js +41 -0
- package/build/esm/internal/conversions/makeGeoFilterBbox.js.map +1 -0
- package/build/esm/internal/conversions/makeGeoFilterIntersects.js +29 -0
- package/build/esm/internal/conversions/makeGeoFilterIntersects.js.map +1 -0
- package/build/esm/internal/conversions/makeGeoFilterPolygon.js +30 -0
- package/build/esm/internal/conversions/makeGeoFilterPolygon.js.map +1 -0
- package/build/esm/internal/conversions/makeGeoFilterWithin.js +48 -0
- package/build/esm/internal/conversions/makeGeoFilterWithin.js.map +1 -0
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +30 -99
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +139 -0
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/fetchPage.js +1 -1
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/formatting/applyPropertyFormatter.js +7 -1
- package/build/esm/object/formatting/applyPropertyFormatter.js.map +1 -1
- package/build/esm/object/formatting/applyPropertyFormatter.test.js +305 -2
- package/build/esm/object/formatting/applyPropertyFormatter.test.js.map +1 -1
- package/build/esm/object/formatting/formatDateTime.js +158 -0
- package/build/esm/object/formatting/formatDateTime.js.map +1 -0
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +17 -0
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/internal/BulkObjectLoader.js +12 -4
- package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/esm/observable/internal/BulkObjectLoader.test.js +48 -0
- package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -1
- package/build/esm/observable/internal/CacheKeys.js +9 -3
- package/build/esm/observable/internal/CacheKeys.js.map +1 -1
- package/build/esm/observable/internal/Canonicalizer.js +51 -0
- package/build/esm/observable/internal/Canonicalizer.js.map +1 -0
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/OrderByCanonicalizer.js +1 -4
- package/build/esm/observable/internal/OrderByCanonicalizer.js.map +1 -1
- package/build/esm/observable/internal/RdpCanonicalizer.js +66 -0
- package/build/esm/observable/internal/RdpCanonicalizer.js.map +1 -0
- package/build/esm/observable/internal/RdpCanonicalizer.test.js +68 -0
- package/build/esm/observable/internal/RdpCanonicalizer.test.js.map +1 -0
- package/build/esm/observable/internal/SimpleWhereClause.js.map +1 -1
- package/build/esm/observable/internal/Store.js +160 -6
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/WhereClauseCanonicalizer.js +1 -1
- package/build/esm/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
- package/build/esm/observable/internal/actions/ActionApplication.js +1 -1
- package/build/esm/observable/internal/actions/ActionApplication.js.map +1 -1
- package/build/esm/observable/internal/actions/OptimisticJob.js +3 -3
- package/build/esm/observable/internal/actions/OptimisticJob.js.map +1 -1
- package/build/esm/observable/internal/base-list/BaseListQuery.js +12 -3
- package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
- package/build/esm/observable/internal/base-list/createCollectionConnectable.js +0 -5
- package/build/esm/observable/internal/base-list/createCollectionConnectable.js.map +1 -1
- package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js +26 -13
- package/build/esm/observable/internal/base-list/createCollectionConnectable.test.js.map +1 -1
- package/build/esm/observable/internal/evaluateFilter.js +61 -0
- package/build/esm/observable/internal/evaluateFilter.js.map +1 -0
- package/build/esm/observable/internal/links/SpecificLinkCacheKey.js +33 -1
- package/build/esm/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
- package/build/esm/observable/internal/list/InterfaceListQuery.js +8 -3
- package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
- package/build/esm/observable/internal/list/ListCacheKey.js +22 -1
- package/build/esm/observable/internal/list/ListCacheKey.js.map +1 -1
- package/build/esm/observable/internal/list/ListQuery.js +19 -13
- package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/list/ListsHelper.js +12 -8
- package/build/esm/observable/internal/list/ListsHelper.js.map +1 -1
- package/build/esm/observable/internal/list/ObjectListQuery.js +10 -1
- package/build/esm/observable/internal/list/ObjectListQuery.js.map +1 -1
- package/build/esm/observable/internal/object/ObjectCacheKey.js +20 -1
- package/build/esm/observable/internal/object/ObjectCacheKey.js.map +1 -1
- package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.js +126 -0
- package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.js.map +1 -0
- package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.test.js +173 -0
- package/build/esm/observable/internal/object/ObjectCacheKeyRegistry.test.js.map +1 -0
- package/build/esm/observable/internal/object/ObjectQuery.js +10 -58
- package/build/esm/observable/internal/object/ObjectQuery.js.map +1 -1
- package/build/esm/observable/internal/object/ObjectsHelper.js +65 -5
- package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -1
- package/build/esm/observable/internal/objectMatchesWhereClause.js +3 -37
- package/build/esm/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js +3 -2
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/observable/internal/utils/rdpFieldOperations.js +83 -0
- package/build/esm/observable/internal/utils/rdpFieldOperations.js.map +1 -0
- package/build/esm/util/UserAgent.js +2 -2
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/internal/conversions/extractNamespace.d.ts +1 -0
- package/build/types/internal/conversions/extractNamespace.d.ts.map +1 -0
- package/build/types/internal/conversions/fullyQualifyPropName.d.ts +2 -0
- package/build/types/internal/conversions/fullyQualifyPropName.d.ts.map +1 -0
- package/build/types/internal/conversions/makeGeoFilterBbox.d.ts +3 -0
- package/build/types/internal/conversions/makeGeoFilterBbox.d.ts.map +1 -0
- package/build/types/internal/conversions/makeGeoFilterIntersects.d.ts +3 -0
- package/build/types/internal/conversions/makeGeoFilterIntersects.d.ts.map +1 -0
- package/build/types/internal/conversions/makeGeoFilterPolygon.d.ts +3 -0
- package/build/types/internal/conversions/makeGeoFilterPolygon.d.ts.map +1 -0
- package/build/types/internal/conversions/makeGeoFilterWithin.d.ts +3 -0
- package/build/types/internal/conversions/makeGeoFilterWithin.d.ts.map +1 -0
- package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts +1 -1
- package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts.map +1 -1
- package/build/types/object/formatting/applyPropertyFormatter.d.ts.map +1 -1
- package/build/types/object/formatting/formatDateTime.d.ts +6 -0
- package/build/types/object/formatting/formatDateTime.d.ts.map +1 -0
- package/build/types/observable/ObservableClient.d.ts +15 -5
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
- package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
- package/build/types/observable/internal/Canonicalizer.d.ts +37 -0
- package/build/types/observable/internal/Canonicalizer.d.ts.map +1 -0
- package/build/types/observable/internal/OrderByCanonicalizer.d.ts.map +1 -1
- package/build/types/observable/internal/RdpCanonicalizer.d.ts +8 -0
- package/build/types/observable/internal/RdpCanonicalizer.d.ts.map +1 -0
- package/build/types/observable/internal/RdpCanonicalizer.test.d.ts +1 -0
- package/build/types/observable/internal/RdpCanonicalizer.test.d.ts.map +1 -0
- package/build/types/observable/internal/SimpleWhereClause.d.ts +6 -2
- package/build/types/observable/internal/SimpleWhereClause.d.ts.map +1 -1
- package/build/types/observable/internal/Store.d.ts +4 -0
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts +5 -2
- package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts.map +1 -1
- package/build/types/observable/internal/actions/ActionApplication.d.ts.map +1 -1
- package/build/types/observable/internal/base-list/BaseListQuery.d.ts +6 -0
- package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/base-list/createCollectionConnectable.d.ts +1 -23
- package/build/types/observable/internal/base-list/createCollectionConnectable.d.ts.map +1 -1
- package/build/types/observable/internal/evaluateFilter.d.ts +6 -0
- package/build/types/observable/internal/evaluateFilter.d.ts.map +1 -0
- package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts +5 -0
- package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts.map +1 -1
- package/build/types/observable/internal/list/InterfaceListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListCacheKey.d.ts +7 -1
- package/build/types/observable/internal/list/ListCacheKey.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListQuery.d.ts +7 -7
- package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/list/ListsHelper.d.ts +3 -1
- package/build/types/observable/internal/list/ListsHelper.d.ts.map +1 -1
- package/build/types/observable/internal/list/ObjectListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/object/ObjectCacheKey.d.ts +6 -1
- package/build/types/observable/internal/object/ObjectCacheKey.d.ts.map +1 -1
- package/build/types/observable/internal/object/ObjectCacheKeyRegistry.d.ts +60 -0
- package/build/types/observable/internal/object/ObjectCacheKeyRegistry.d.ts.map +1 -0
- package/build/types/observable/internal/object/ObjectCacheKeyRegistry.test.d.ts +1 -0
- package/build/types/observable/internal/object/ObjectCacheKeyRegistry.test.d.ts.map +1 -0
- package/build/types/observable/internal/object/ObjectQuery.d.ts +1 -1
- package/build/types/observable/internal/object/ObjectQuery.d.ts.map +1 -1
- package/build/types/observable/internal/object/ObjectsHelper.d.ts +15 -1
- package/build/types/observable/internal/object/ObjectsHelper.d.ts.map +1 -1
- package/build/types/observable/internal/objectMatchesWhereClause.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/observable/internal/utils/rdpFieldOperations.d.ts +5 -0
- package/build/types/observable/internal/utils/rdpFieldOperations.d.ts.map +1 -0
- package/package.json +9 -9
- package/build/cjs/chunk-6L3MX4LH.cjs.map +0 -1
- package/build/cjs/chunk-X7WMWKLM.cjs.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk7567LSZD_cjs = require('../chunk-7567LSZD.cjs');
|
|
4
|
+
var chunkVNLY3YOJ_cjs = require('../chunk-VNLY3YOJ.cjs');
|
|
5
5
|
require('../chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var trie = require('@wry/trie');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var deepEqual = require('fast-deep-equal');
|
|
8
|
+
var invariant4 = require('tiny-invariant');
|
|
9
9
|
var shared_net_fetch = require('@osdk/shared.net.fetch');
|
|
10
10
|
var rxjs = require('rxjs');
|
|
11
11
|
var mnemonist = require('mnemonist');
|
|
@@ -14,8 +14,8 @@ var shared_net_errors = require('@osdk/shared.net.errors');
|
|
|
14
14
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
|
|
17
|
-
var
|
|
18
|
-
var
|
|
17
|
+
var deepEqual__default = /*#__PURE__*/_interopDefault(deepEqual);
|
|
18
|
+
var invariant4__default = /*#__PURE__*/_interopDefault(invariant4);
|
|
19
19
|
var groupBy__default = /*#__PURE__*/_interopDefault(groupBy);
|
|
20
20
|
|
|
21
21
|
var defaultMakeData = () => /* @__PURE__ */ Object.create(null);
|
|
@@ -62,10 +62,7 @@ var OrderByCanonicalizer = class {
|
|
|
62
62
|
}
|
|
63
63
|
return result;
|
|
64
64
|
}, []);
|
|
65
|
-
|
|
66
|
-
if (process.env.NODE_ENV !== "production") {
|
|
67
|
-
data = Object.freeze(data);
|
|
68
|
-
}
|
|
65
|
+
const data = Object.fromEntries(pairs);
|
|
69
66
|
return data;
|
|
70
67
|
});
|
|
71
68
|
canonicalize = (orderBy) => {
|
|
@@ -105,7 +102,7 @@ var WhereClauseCanonicalizer = class {
|
|
|
105
102
|
options: []
|
|
106
103
|
};
|
|
107
104
|
this.#existingOptions.set(cacheKey, lookupEntry);
|
|
108
|
-
const canon = lookupEntry.options.find((ref) =>
|
|
105
|
+
const canon = lookupEntry.options.find((ref) => deepEqual__default.default(ref.deref(), calculatedCanon))?.deref() ?? calculatedCanon;
|
|
109
106
|
if (canon === calculatedCanon) {
|
|
110
107
|
lookupEntry.options.push(new WeakRef(canon));
|
|
111
108
|
}
|
|
@@ -115,8 +112,8 @@ var WhereClauseCanonicalizer = class {
|
|
|
115
112
|
#toCanon = (where, set = /* @__PURE__ */ new Set()) => {
|
|
116
113
|
if ("$and" in where) {
|
|
117
114
|
if (process.env.NODE_ENV !== "production") {
|
|
118
|
-
!Array.isArray(where.$and) ? process.env.NODE_ENV !== "production" ?
|
|
119
|
-
!(Object.keys(where).length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
115
|
+
!Array.isArray(where.$and) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "expected $and to be an array") : invariant4__default.default(false) : void 0;
|
|
116
|
+
!(Object.keys(where).length === 1) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "expected only $and to be present") : invariant4__default.default(false) : void 0;
|
|
120
117
|
}
|
|
121
118
|
if (where.$and.length === 0) {
|
|
122
119
|
return {};
|
|
@@ -130,7 +127,7 @@ var WhereClauseCanonicalizer = class {
|
|
|
130
127
|
if (k === "$and" || k === "$or") {
|
|
131
128
|
return [k, v.map((x) => this.#toCanon(x, set))];
|
|
132
129
|
}
|
|
133
|
-
if (k !== "$not" && typeof v === "object" && "$eq" in v) {
|
|
130
|
+
if (k !== "$not" && typeof v === "object" && v != null && "$eq" in v) {
|
|
134
131
|
return [k, v["$eq"]];
|
|
135
132
|
}
|
|
136
133
|
return [k, v];
|
|
@@ -142,7 +139,7 @@ var WhereClauseCanonicalizer = class {
|
|
|
142
139
|
var whereCanonicalizer = new WhereClauseCanonicalizer();
|
|
143
140
|
var orderByCanonicalizer = new OrderByCanonicalizer();
|
|
144
141
|
function computeObjectSetCacheKey(objectSet, options) {
|
|
145
|
-
const keyParts = ["objectSet",
|
|
142
|
+
const keyParts = ["objectSet", chunkVNLY3YOJ_cjs.getWireObjectSet(objectSet)];
|
|
146
143
|
if (!options) {
|
|
147
144
|
return JSON.stringify(keyParts);
|
|
148
145
|
}
|
|
@@ -154,13 +151,13 @@ function computeObjectSetCacheKey(objectSet, options) {
|
|
|
154
151
|
keyParts.push("props", propKeys);
|
|
155
152
|
}
|
|
156
153
|
if (options.union && options.union.length > 0) {
|
|
157
|
-
keyParts.push("union", options.union.map((os) =>
|
|
154
|
+
keyParts.push("union", options.union.map((os) => chunkVNLY3YOJ_cjs.getWireObjectSet(os)));
|
|
158
155
|
}
|
|
159
156
|
if (options.intersect && options.intersect.length > 0) {
|
|
160
|
-
keyParts.push("intersect", options.intersect.map((os) =>
|
|
157
|
+
keyParts.push("intersect", options.intersect.map((os) => chunkVNLY3YOJ_cjs.getWireObjectSet(os)));
|
|
161
158
|
}
|
|
162
159
|
if (options.subtract && options.subtract.length > 0) {
|
|
163
|
-
keyParts.push("subtract", options.subtract.map((os) =>
|
|
160
|
+
keyParts.push("subtract", options.subtract.map((os) => chunkVNLY3YOJ_cjs.getWireObjectSet(os)));
|
|
164
161
|
}
|
|
165
162
|
if (options.pivotTo) {
|
|
166
163
|
keyParts.push("pivotTo", options.pivotTo);
|
|
@@ -292,7 +289,7 @@ var OptimisticJob = class {
|
|
|
292
289
|
store.objects.getQuery({
|
|
293
290
|
apiName: obj.value.$objectType,
|
|
294
291
|
pk: obj.value.$primaryKey
|
|
295
|
-
}).writeToStore(obj.value, "loading", batch);
|
|
292
|
+
}, void 0).writeToStore(obj.value, "loading", batch);
|
|
296
293
|
} else {
|
|
297
294
|
throw obj;
|
|
298
295
|
}
|
|
@@ -301,13 +298,13 @@ var OptimisticJob = class {
|
|
|
301
298
|
store.objects.getQuery({
|
|
302
299
|
apiName: obj.$objectType,
|
|
303
300
|
pk: obj.$primaryKey
|
|
304
|
-
}).writeToStore(obj, "loading", batch);
|
|
301
|
+
}, void 0).writeToStore(obj, "loading", batch);
|
|
305
302
|
}
|
|
306
303
|
for (const obj of deletedObjects) {
|
|
307
304
|
store.objects.getQuery({
|
|
308
305
|
apiName: obj.$objectType,
|
|
309
306
|
pk: obj.$primaryKey
|
|
310
|
-
}).deleteFromStore("loading", batch);
|
|
307
|
+
}, void 0).deleteFromStore("loading", batch);
|
|
311
308
|
}
|
|
312
309
|
});
|
|
313
310
|
return batchResult.changes;
|
|
@@ -319,7 +316,7 @@ var OptimisticJob = class {
|
|
|
319
316
|
return this;
|
|
320
317
|
},
|
|
321
318
|
createObject(type, pk, properties) {
|
|
322
|
-
const create = store.client[
|
|
319
|
+
const create = store.client[chunkVNLY3YOJ_cjs.additionalContext].objectFactory2(store.client[chunkVNLY3YOJ_cjs.additionalContext], [{
|
|
323
320
|
$primaryKey: pk,
|
|
324
321
|
$apiName: type.apiName,
|
|
325
322
|
$objectType: type.apiName,
|
|
@@ -421,7 +418,13 @@ var ActionApplication = class {
|
|
|
421
418
|
objectType,
|
|
422
419
|
primaryKey
|
|
423
420
|
} of deletedObjects ?? []) {
|
|
424
|
-
const cacheKey = this.store.cacheKeys.get(
|
|
421
|
+
const cacheKey = this.store.cacheKeys.get(
|
|
422
|
+
"object",
|
|
423
|
+
objectType,
|
|
424
|
+
primaryKey,
|
|
425
|
+
/* rdpConfig */
|
|
426
|
+
void 0
|
|
427
|
+
);
|
|
425
428
|
this.store.queries.peek(cacheKey)?.deleteFromStore(
|
|
426
429
|
"loaded",
|
|
427
430
|
// this is probably not the best value to use
|
|
@@ -438,6 +441,22 @@ var ActionApplication = class {
|
|
|
438
441
|
};
|
|
439
442
|
};
|
|
440
443
|
|
|
444
|
+
// src/observable/internal/CacheKey.ts
|
|
445
|
+
function DEBUG_ONLY__cacheKeyToString(x) {
|
|
446
|
+
if (process.env.NODE_ENV !== "production") {
|
|
447
|
+
return `${x.type}CacheKey<${x.otherKeys.map((xx) => JSON.stringify(xx)).join(", ")}>`.replaceAll('"', "'");
|
|
448
|
+
} else {
|
|
449
|
+
throw new Error("not implemented");
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
function DEBUG_ONLY__cacheKeysToString(x) {
|
|
453
|
+
if (process.env.NODE_ENV !== "production") {
|
|
454
|
+
return "\n - " + x.map(DEBUG_ONLY__cacheKeyToString).join("\n - ");
|
|
455
|
+
} else {
|
|
456
|
+
throw new Error("not implemented");
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
441
460
|
// src/observable/internal/RefCounts.ts
|
|
442
461
|
var RefCounts = class {
|
|
443
462
|
refCounts = /* @__PURE__ */ new Map();
|
|
@@ -518,7 +537,11 @@ var CacheKeys = class {
|
|
|
518
537
|
});
|
|
519
538
|
}
|
|
520
539
|
get(type, ...args) {
|
|
521
|
-
const
|
|
540
|
+
const normalizedArgs = [...args];
|
|
541
|
+
while (normalizedArgs.length > 0 && normalizedArgs[normalizedArgs.length - 1] === void 0) {
|
|
542
|
+
normalizedArgs.pop();
|
|
543
|
+
}
|
|
544
|
+
const cacheKeyArgs = [type, ...normalizedArgs];
|
|
522
545
|
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS) ;
|
|
523
546
|
const cacheKey = this.#cacheKeys.lookupArray(cacheKeyArgs);
|
|
524
547
|
this.#refCounts.register(cacheKey);
|
|
@@ -542,24 +565,6 @@ var CacheKeys = class {
|
|
|
542
565
|
this.#remove(key);
|
|
543
566
|
};
|
|
544
567
|
};
|
|
545
|
-
|
|
546
|
-
// src/observable/internal/CacheKey.ts
|
|
547
|
-
function DEBUG_ONLY__cacheKeyToString(x) {
|
|
548
|
-
if (process.env.NODE_ENV !== "production") {
|
|
549
|
-
return `${x.type}CacheKey<${x.otherKeys.map((xx) => JSON.stringify(xx)).join(", ")}>`.replaceAll('"', "'");
|
|
550
|
-
} else {
|
|
551
|
-
throw new Error("not implemented");
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
function DEBUG_ONLY__cacheKeysToString(x) {
|
|
555
|
-
if (process.env.NODE_ENV !== "production") {
|
|
556
|
-
return "\n - " + x.map(DEBUG_ONLY__cacheKeyToString).join("\n - ");
|
|
557
|
-
} else {
|
|
558
|
-
throw new Error("not implemented");
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// src/observable/internal/Changes.ts
|
|
563
568
|
var Changes = class {
|
|
564
569
|
modifiedObjects = new mnemonist.MultiMap();
|
|
565
570
|
addedObjects = new mnemonist.MultiMap();
|
|
@@ -833,7 +838,7 @@ var Layers = class {
|
|
|
833
838
|
return this.#truthLayer;
|
|
834
839
|
}
|
|
835
840
|
remove(layerId) {
|
|
836
|
-
!(layerId != null) ? process.env.NODE_ENV !== "production" ?
|
|
841
|
+
!(layerId != null) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "undefined is the reserved layerId for the truth layer") : invariant4__default.default(false) : void 0;
|
|
837
842
|
let currentLayer = this.#topLayer;
|
|
838
843
|
const cacheKeys = /* @__PURE__ */ new Map();
|
|
839
844
|
while (currentLayer != null && currentLayer.parentLayer != null) {
|
|
@@ -861,7 +866,7 @@ var Layers = class {
|
|
|
861
866
|
optimisticId,
|
|
862
867
|
changes
|
|
863
868
|
}, batchFn) {
|
|
864
|
-
!(optimisticId === void 0 || !!optimisticId) ? process.env.NODE_ENV !== "production" ?
|
|
869
|
+
!(optimisticId === void 0 || !!optimisticId) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "optimistic must be undefined or not falsy") : invariant4__default.default(false) : void 0;
|
|
865
870
|
const batchContext = this.#createBatchContext({
|
|
866
871
|
optimisticId,
|
|
867
872
|
changes
|
|
@@ -989,6 +994,12 @@ function isObjectInstance(item) {
|
|
|
989
994
|
return item != null && typeof item === "object" && "$primaryKey" in item;
|
|
990
995
|
}
|
|
991
996
|
|
|
997
|
+
// src/observable/internal/list/ListCacheKey.ts
|
|
998
|
+
var API_NAME_IDX = 1;
|
|
999
|
+
var WHERE_IDX = 2;
|
|
1000
|
+
var ORDER_BY_IDX = 3;
|
|
1001
|
+
var RDP_IDX = 4;
|
|
1002
|
+
|
|
992
1003
|
// src/observable/internal/Query.ts
|
|
993
1004
|
var Query = class {
|
|
994
1005
|
retainCount = 0;
|
|
@@ -1003,7 +1014,7 @@ var Query = class {
|
|
|
1003
1014
|
this.store = store;
|
|
1004
1015
|
this.cacheKeys = store.cacheKeys;
|
|
1005
1016
|
this.#subject = observable;
|
|
1006
|
-
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[
|
|
1017
|
+
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkVNLY3YOJ_cjs.additionalContext].logger : store.client[chunkVNLY3YOJ_cjs.additionalContext].logger?.child({}, {
|
|
1007
1018
|
msgPrefix: process.env.NODE_ENV !== "production" ? `Query<${cacheKey.type}, ${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>` : "Query"
|
|
1008
1019
|
}));
|
|
1009
1020
|
}
|
|
@@ -1244,6 +1255,12 @@ var BaseListQuery = class extends Query {
|
|
|
1244
1255
|
* @protected
|
|
1245
1256
|
*/
|
|
1246
1257
|
sortingStrategy = new NoOpSortingStrategy();
|
|
1258
|
+
/**
|
|
1259
|
+
* Get RDP configuration from the cache key
|
|
1260
|
+
*/
|
|
1261
|
+
get rdpConfig() {
|
|
1262
|
+
return this.cacheKey.otherKeys[RDP_IDX];
|
|
1263
|
+
}
|
|
1247
1264
|
// Collection-specific behavior is implemented by subclasses
|
|
1248
1265
|
/**
|
|
1249
1266
|
* Token for the next page of results
|
|
@@ -1276,7 +1293,7 @@ var BaseListQuery = class extends Query {
|
|
|
1276
1293
|
if (items.length === 0) {
|
|
1277
1294
|
objectCacheKeys = [];
|
|
1278
1295
|
} else if (isObjectInstance(items[0])) {
|
|
1279
|
-
objectCacheKeys = this.store.objects.storeOsdkInstances(items, batch);
|
|
1296
|
+
objectCacheKeys = this.store.objects.storeOsdkInstances(items, batch, this.rdpConfig);
|
|
1280
1297
|
} else {
|
|
1281
1298
|
objectCacheKeys = items;
|
|
1282
1299
|
}
|
|
@@ -1295,7 +1312,7 @@ var BaseListQuery = class extends Query {
|
|
|
1295
1312
|
*/
|
|
1296
1313
|
writeToStore(data, status, batch) {
|
|
1297
1314
|
const entry = batch.read(this.cacheKey);
|
|
1298
|
-
if (entry &&
|
|
1315
|
+
if (entry && deepEqual__default.default(data, entry.value)) {
|
|
1299
1316
|
if (entry.status === status) {
|
|
1300
1317
|
if (process.env.NODE_ENV !== "production") {
|
|
1301
1318
|
this.logger?.child({
|
|
@@ -1480,7 +1497,8 @@ var BaseListQuery = class extends Query {
|
|
|
1480
1497
|
} = this.store.batch({}, (batch) => {
|
|
1481
1498
|
const append = this.nextPageToken != null;
|
|
1482
1499
|
const finalStatus = result.nextPageToken ? status : "loaded";
|
|
1483
|
-
|
|
1500
|
+
const objectKeys = this.store.objects.storeOsdkInstances(result.data, batch, this.rdpConfig);
|
|
1501
|
+
return this._updateList(objectKeys, finalStatus, batch, append);
|
|
1484
1502
|
});
|
|
1485
1503
|
return retVal;
|
|
1486
1504
|
} catch (error) {
|
|
@@ -1549,7 +1567,7 @@ var BaseListQuery = class extends Query {
|
|
|
1549
1567
|
if (items.length === 0) {
|
|
1550
1568
|
objectCacheKeys = [];
|
|
1551
1569
|
} else if (isObjectInstance(items[0])) {
|
|
1552
|
-
objectCacheKeys = this.store.objects.storeOsdkInstances(items, batch);
|
|
1570
|
+
objectCacheKeys = this.store.objects.storeOsdkInstances(items, batch, this.rdpConfig);
|
|
1553
1571
|
} else {
|
|
1554
1572
|
objectCacheKeys = items;
|
|
1555
1573
|
}
|
|
@@ -1576,7 +1594,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
1576
1594
|
batch.changes.modified.add(this.cacheKey);
|
|
1577
1595
|
}
|
|
1578
1596
|
constructor(store, subject, cacheKey, opts) {
|
|
1579
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
1597
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVNLY3YOJ_cjs.additionalContext].logger?.child({}, {
|
|
1580
1598
|
msgPrefix: `SpecificLinkQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
1581
1599
|
}) : void 0);
|
|
1582
1600
|
[this.#sourceApiName, this.#sourcePk, this.#linkName, this.#whereClause, this.#orderBy] = cacheKey.otherKeys;
|
|
@@ -1593,7 +1611,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
1593
1611
|
type: "object",
|
|
1594
1612
|
apiName: this.#sourceApiName
|
|
1595
1613
|
};
|
|
1596
|
-
const sourceMetadata = await client[
|
|
1614
|
+
const sourceMetadata = await client[chunkVNLY3YOJ_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
|
|
1597
1615
|
const sourceQuery = client(sourceObjectDef).where({
|
|
1598
1616
|
[sourceMetadata.primaryKeyApiName]: this.#sourcePk
|
|
1599
1617
|
});
|
|
@@ -1620,7 +1638,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
1620
1638
|
*/
|
|
1621
1639
|
deleteFromStore(status, batch) {
|
|
1622
1640
|
const entry = batch.read(this.cacheKey);
|
|
1623
|
-
if (entry &&
|
|
1641
|
+
if (entry && deepEqual__default.default(tombstone, entry.value)) {
|
|
1624
1642
|
if (process.env.NODE_ENV !== "production") {
|
|
1625
1643
|
this.logger?.child({
|
|
1626
1644
|
methodName: "deleteFromStore"
|
|
@@ -1657,7 +1675,7 @@ var SpecificLinkQuery = class extends BaseListQuery {
|
|
|
1657
1675
|
return this.revalidate(true);
|
|
1658
1676
|
} else {
|
|
1659
1677
|
return (async () => {
|
|
1660
|
-
const sourceMetadata = await this.store.client[
|
|
1678
|
+
const sourceMetadata = await this.store.client[chunkVNLY3YOJ_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
|
|
1661
1679
|
const linkDef = sourceMetadata.links?.[this.#linkName];
|
|
1662
1680
|
if (!linkDef || linkDef.targetType !== objectType) return;
|
|
1663
1681
|
const promise = this.revalidate(true);
|
|
@@ -1687,11 +1705,47 @@ var LinksHelper = class extends AbstractHelper {
|
|
|
1687
1705
|
});
|
|
1688
1706
|
}
|
|
1689
1707
|
};
|
|
1708
|
+
function evaluateFilter(f, realValue, expected, strict) {
|
|
1709
|
+
switch (f) {
|
|
1710
|
+
case "$eq":
|
|
1711
|
+
return realValue === expected;
|
|
1712
|
+
case "$gt":
|
|
1713
|
+
return realValue > expected;
|
|
1714
|
+
case "$lt":
|
|
1715
|
+
return realValue < expected;
|
|
1716
|
+
case "$gte":
|
|
1717
|
+
return realValue >= expected;
|
|
1718
|
+
case "$lte":
|
|
1719
|
+
return realValue <= expected;
|
|
1720
|
+
case "$ne":
|
|
1721
|
+
return realValue !== expected;
|
|
1722
|
+
case "$in":
|
|
1723
|
+
return expected.$in.includes(realValue);
|
|
1724
|
+
case "$isNull":
|
|
1725
|
+
return realValue == null;
|
|
1726
|
+
case "$startsWith":
|
|
1727
|
+
return realValue.startsWith(expected);
|
|
1728
|
+
case "$contains":
|
|
1729
|
+
case "$containsAllTerms":
|
|
1730
|
+
case "$containsAllTermsInOrder":
|
|
1731
|
+
case "$containsAnyTerm":
|
|
1732
|
+
case "$intersects":
|
|
1733
|
+
case "$within":
|
|
1734
|
+
return !strict;
|
|
1735
|
+
default:
|
|
1736
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1737
|
+
process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Unknown where filter ${f}`) : invariant4__default.default(false) ;
|
|
1738
|
+
}
|
|
1739
|
+
return !strict;
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
// src/observable/internal/objectMatchesWhereClause.ts
|
|
1690
1744
|
function is$and(whereClause) {
|
|
1691
1745
|
if (process.env.NODE_ENV !== "production") {
|
|
1692
1746
|
if ("$and" in whereClause) {
|
|
1693
|
-
!Array.isArray(whereClause.$and) ? process.env.NODE_ENV !== "production" ?
|
|
1694
|
-
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
1747
|
+
!Array.isArray(whereClause.$and) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "expected $and to be an array") : invariant4__default.default(false) : void 0;
|
|
1748
|
+
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "expected only $and to be present") : invariant4__default.default(false) : void 0;
|
|
1695
1749
|
}
|
|
1696
1750
|
}
|
|
1697
1751
|
return "$and" in whereClause;
|
|
@@ -1699,8 +1753,8 @@ function is$and(whereClause) {
|
|
|
1699
1753
|
function is$or(whereClause) {
|
|
1700
1754
|
if (process.env.NODE_ENV !== "production") {
|
|
1701
1755
|
if ("$or" in whereClause) {
|
|
1702
|
-
!Array.isArray(whereClause.$or) ? process.env.NODE_ENV !== "production" ?
|
|
1703
|
-
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
1756
|
+
!Array.isArray(whereClause.$or) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "expected $or to be an array") : invariant4__default.default(false) : void 0;
|
|
1757
|
+
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "expected only $or to be present") : invariant4__default.default(false) : void 0;
|
|
1704
1758
|
}
|
|
1705
1759
|
}
|
|
1706
1760
|
return "$or" in whereClause;
|
|
@@ -1708,13 +1762,13 @@ function is$or(whereClause) {
|
|
|
1708
1762
|
function is$not(whereClause) {
|
|
1709
1763
|
if (process.env.NODE_ENV !== "production") {
|
|
1710
1764
|
if ("$not" in whereClause) {
|
|
1711
|
-
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ?
|
|
1765
|
+
!(Object.keys(whereClause).length === 1) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "expected only $not to be present") : invariant4__default.default(false) : void 0;
|
|
1712
1766
|
}
|
|
1713
1767
|
}
|
|
1714
1768
|
return "$not" in whereClause;
|
|
1715
1769
|
}
|
|
1716
1770
|
function objectSortaMatchesWhereClause(o, whereClause, strict) {
|
|
1717
|
-
if (
|
|
1771
|
+
if (deepEqual__default.default({}, whereClause)) {
|
|
1718
1772
|
return true;
|
|
1719
1773
|
}
|
|
1720
1774
|
if (is$and(whereClause)) {
|
|
@@ -1727,42 +1781,11 @@ function objectSortaMatchesWhereClause(o, whereClause, strict) {
|
|
|
1727
1781
|
return !objectSortaMatchesWhereClause(o, whereClause.$not, strict);
|
|
1728
1782
|
}
|
|
1729
1783
|
return Object.entries(whereClause).every(([key, filter]) => {
|
|
1730
|
-
if (typeof filter === "object") {
|
|
1784
|
+
if (typeof filter === "object" && filter != null) {
|
|
1731
1785
|
const realValue = o[key];
|
|
1732
1786
|
const [f] = Object.keys(filter);
|
|
1733
1787
|
const expected = filter[f];
|
|
1734
|
-
|
|
1735
|
-
case "$eq":
|
|
1736
|
-
return realValue === expected;
|
|
1737
|
-
case "$gt":
|
|
1738
|
-
return realValue > expected;
|
|
1739
|
-
case "$lt":
|
|
1740
|
-
return realValue < expected;
|
|
1741
|
-
case "$gte":
|
|
1742
|
-
return realValue >= expected;
|
|
1743
|
-
case "$lte":
|
|
1744
|
-
return realValue <= expected;
|
|
1745
|
-
case "$ne":
|
|
1746
|
-
return realValue !== expected;
|
|
1747
|
-
case "$in":
|
|
1748
|
-
return expected.$in.includes(realValue);
|
|
1749
|
-
case "$isNull":
|
|
1750
|
-
return realValue == null;
|
|
1751
|
-
case "$startsWith":
|
|
1752
|
-
return realValue.startsWith(expected);
|
|
1753
|
-
case "$contains":
|
|
1754
|
-
case "$containsAllTerms":
|
|
1755
|
-
case "$containsAllTermsInOrder":
|
|
1756
|
-
case "$containsAnyTerm":
|
|
1757
|
-
case "$intersects":
|
|
1758
|
-
case "$within":
|
|
1759
|
-
return !strict;
|
|
1760
|
-
default:
|
|
1761
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1762
|
-
process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Unknown where filter ${f}`) : invariant3__default.default(false) ;
|
|
1763
|
-
}
|
|
1764
|
-
return !strict;
|
|
1765
|
-
}
|
|
1788
|
+
return evaluateFilter(f, realValue, expected, strict);
|
|
1766
1789
|
}
|
|
1767
1790
|
if (key in o) {
|
|
1768
1791
|
if (o[key] === filter) {
|
|
@@ -1774,7 +1797,6 @@ function objectSortaMatchesWhereClause(o, whereClause, strict) {
|
|
|
1774
1797
|
}
|
|
1775
1798
|
|
|
1776
1799
|
// src/observable/internal/list/ListQuery.ts
|
|
1777
|
-
var API_NAME_IDX = 1;
|
|
1778
1800
|
var ListQuery = class extends BaseListQuery {
|
|
1779
1801
|
// pageSize?: number; // this is the internal page size. we need to track this properly
|
|
1780
1802
|
#whereClause;
|
|
@@ -1787,13 +1809,13 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1787
1809
|
registerCacheChanges(batch) {
|
|
1788
1810
|
batch.changes.registerList(this.cacheKey);
|
|
1789
1811
|
}
|
|
1790
|
-
constructor(store, subject, apiName,
|
|
1791
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
1812
|
+
constructor(store, subject, apiName, cacheKey, opts) {
|
|
1813
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVNLY3YOJ_cjs.additionalContext].logger?.child({}, {
|
|
1792
1814
|
msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
1793
1815
|
}) : void 0);
|
|
1794
1816
|
this.apiName = apiName;
|
|
1795
|
-
this.#whereClause =
|
|
1796
|
-
this.#orderBy =
|
|
1817
|
+
this.#whereClause = cacheKey.otherKeys[WHERE_IDX];
|
|
1818
|
+
this.#orderBy = cacheKey.otherKeys[ORDER_BY_IDX];
|
|
1797
1819
|
this.#objectSet = this.createObjectSet(store);
|
|
1798
1820
|
this.sortingStrategy = new OrderBySortingStrategy(this.apiName, this.#orderBy);
|
|
1799
1821
|
this.minResultsToLoad = 0;
|
|
@@ -1849,7 +1871,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1849
1871
|
* Postprocess fetched data.
|
|
1850
1872
|
*/
|
|
1851
1873
|
invalidateObjectType = async (objectType, changes) => {
|
|
1852
|
-
if (this.
|
|
1874
|
+
if (this.apiName === objectType) {
|
|
1853
1875
|
changes?.modified.add(this.cacheKey);
|
|
1854
1876
|
return this.revalidate(true);
|
|
1855
1877
|
}
|
|
@@ -1891,7 +1913,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1891
1913
|
const toRemove = new Set(changes.deleted);
|
|
1892
1914
|
for (const obj of relevantObjects.modified.all) {
|
|
1893
1915
|
if (relevantObjects.modified.strictMatches.has(obj)) {
|
|
1894
|
-
const objectCacheKey = this.
|
|
1916
|
+
const objectCacheKey = this.getObjectCacheKey(obj);
|
|
1895
1917
|
if (!existingList.has(objectCacheKey)) {
|
|
1896
1918
|
toAdd.add(obj);
|
|
1897
1919
|
}
|
|
@@ -1899,7 +1921,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1899
1921
|
} else if (batch.optimisticWrite) {
|
|
1900
1922
|
continue;
|
|
1901
1923
|
} else {
|
|
1902
|
-
const existingObjectCacheKey = this.
|
|
1924
|
+
const existingObjectCacheKey = this.getObjectCacheKey(obj);
|
|
1903
1925
|
toRemove.add(existingObjectCacheKey);
|
|
1904
1926
|
if (relevantObjects.modified.sortaMatches.has(obj)) {
|
|
1905
1927
|
needsRevalidation = true;
|
|
@@ -1911,7 +1933,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1911
1933
|
newList.push(key);
|
|
1912
1934
|
}
|
|
1913
1935
|
for (const obj of toAdd) {
|
|
1914
|
-
newList.push(this.
|
|
1936
|
+
newList.push(this.getObjectCacheKey(obj));
|
|
1915
1937
|
}
|
|
1916
1938
|
this._updateList(
|
|
1917
1939
|
newList,
|
|
@@ -2017,7 +2039,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2017
2039
|
if (state === "ADDED_OR_UPDATED") {
|
|
2018
2040
|
const object = objOrIface.$apiName !== objOrIface.$objectType ? objOrIface.$as(objOrIface.$objectType) : objOrIface;
|
|
2019
2041
|
this.store.batch({}, (batch) => {
|
|
2020
|
-
this.store.objects.storeOsdkInstances([object], batch);
|
|
2042
|
+
this.store.objects.storeOsdkInstances([object], batch, this.rdpConfig);
|
|
2021
2043
|
});
|
|
2022
2044
|
} else if (state === "REMOVED") {
|
|
2023
2045
|
this.onOswRemoved(objOrIface, logger);
|
|
@@ -2026,9 +2048,9 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2026
2048
|
onOswRemoved(objOrIface, logger) {
|
|
2027
2049
|
this.store.batch({}, (batch) => {
|
|
2028
2050
|
const existing = batch.read(this.cacheKey);
|
|
2029
|
-
!existing ? process.env.NODE_ENV !== "production" ?
|
|
2051
|
+
!existing ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, "the truth value for our list should exist as we already subscribed") : invariant4__default.default(false) : void 0;
|
|
2030
2052
|
if (existing.status === "loaded") {
|
|
2031
|
-
const objectCacheKey = this.
|
|
2053
|
+
const objectCacheKey = this.getObjectCacheKey(objOrIface);
|
|
2032
2054
|
const newObjects = existing.value?.data.filter((o) => o !== objectCacheKey);
|
|
2033
2055
|
if (newObjects?.length !== existing.value?.data.length) {
|
|
2034
2056
|
batch.changes.registerList(this.cacheKey);
|
|
@@ -2053,15 +2075,28 @@ var ListQuery = class extends BaseListQuery {
|
|
|
2053
2075
|
});
|
|
2054
2076
|
});
|
|
2055
2077
|
}
|
|
2078
|
+
/**
|
|
2079
|
+
* Get cache key for object.
|
|
2080
|
+
*/
|
|
2081
|
+
getObjectCacheKey(obj) {
|
|
2082
|
+
const pk = obj.$primaryKey;
|
|
2083
|
+
return this.cacheKeys.get("object", obj.$objectType, pk, this.rdpConfig ?? void 0);
|
|
2084
|
+
}
|
|
2056
2085
|
};
|
|
2057
2086
|
|
|
2058
2087
|
// src/observable/internal/list/InterfaceListQuery.ts
|
|
2059
2088
|
var InterfaceListQuery = class extends ListQuery {
|
|
2060
2089
|
createObjectSet(store) {
|
|
2061
|
-
|
|
2062
|
-
|
|
2090
|
+
const rdpConfig = this.cacheKey.otherKeys[RDP_IDX];
|
|
2091
|
+
const type = "interface";
|
|
2092
|
+
const objectTypeDef = {
|
|
2093
|
+
type,
|
|
2063
2094
|
apiName: this.apiName
|
|
2064
|
-
}
|
|
2095
|
+
};
|
|
2096
|
+
if (rdpConfig != null) {
|
|
2097
|
+
return store.client(objectTypeDef).withProperties(rdpConfig).where(this.canonicalWhere);
|
|
2098
|
+
}
|
|
2099
|
+
return store.client(objectTypeDef).where(this.canonicalWhere);
|
|
2065
2100
|
}
|
|
2066
2101
|
async revalidateObjectType(apiName) {
|
|
2067
2102
|
const objectMetadata = await this.store.client.fetchMetadata({
|
|
@@ -2080,7 +2115,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
2080
2115
|
}
|
|
2081
2116
|
extractRelevantObjects(changes) {
|
|
2082
2117
|
const matchesApiName = ([, object]) => {
|
|
2083
|
-
return this.apiName in object[
|
|
2118
|
+
return this.apiName in object[chunk7567LSZD_cjs.ObjectDefRef].interfaceMap;
|
|
2084
2119
|
};
|
|
2085
2120
|
const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
2086
2121
|
const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.apiName));
|
|
@@ -2101,7 +2136,7 @@ var InterfaceListQuery = class extends ListQuery {
|
|
|
2101
2136
|
async function reloadDataAsFullObjects(client, data) {
|
|
2102
2137
|
const groups = groupBy__default.default(data, (x) => x.$objectType);
|
|
2103
2138
|
const objectTypeToPrimaryKeyToObject = Object.fromEntries(await Promise.all(Object.entries(groups).map(async ([apiName, objects]) => {
|
|
2104
|
-
const objectDef = objects[0][
|
|
2139
|
+
const objectDef = objects[0][chunk7567LSZD_cjs.UnderlyingOsdkObject][chunk7567LSZD_cjs.ObjectDefRef];
|
|
2105
2140
|
const where = {
|
|
2106
2141
|
[objectDef.primaryKeyApiName]: {
|
|
2107
2142
|
$in: objects.map((x) => x.$primaryKey)
|
|
@@ -2111,7 +2146,7 @@ async function reloadDataAsFullObjects(client, data) {
|
|
|
2111
2146
|
return [apiName, Object.fromEntries(result.data.map((x) => [x.$primaryKey, x]))];
|
|
2112
2147
|
})));
|
|
2113
2148
|
data = data.map((obj) => {
|
|
2114
|
-
!objectTypeToPrimaryKeyToObject[obj.$objectType][obj.$primaryKey] ? process.env.NODE_ENV !== "production" ?
|
|
2149
|
+
!objectTypeToPrimaryKeyToObject[obj.$objectType][obj.$primaryKey] ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Could not find object ${obj.$objectType} ${obj.$primaryKey}`) : invariant4__default.default(false) : void 0;
|
|
2115
2150
|
return objectTypeToPrimaryKeyToObject[obj.$objectType][obj.$primaryKey];
|
|
2116
2151
|
});
|
|
2117
2152
|
return data;
|
|
@@ -2120,6 +2155,13 @@ async function reloadDataAsFullObjects(client, data) {
|
|
|
2120
2155
|
// src/observable/internal/list/ObjectListQuery.ts
|
|
2121
2156
|
var ObjectListQuery = class extends ListQuery {
|
|
2122
2157
|
createObjectSet(store) {
|
|
2158
|
+
const rdpConfig = this.cacheKey.otherKeys[RDP_IDX];
|
|
2159
|
+
if (rdpConfig != null) {
|
|
2160
|
+
return store.client({
|
|
2161
|
+
type: "object",
|
|
2162
|
+
apiName: this.apiName
|
|
2163
|
+
}).withProperties(rdpConfig).where(this.canonicalWhere);
|
|
2164
|
+
}
|
|
2123
2165
|
return store.client({
|
|
2124
2166
|
type: "object",
|
|
2125
2167
|
apiName: this.apiName
|
|
@@ -2154,10 +2196,11 @@ var ObjectListQuery = class extends ListQuery {
|
|
|
2154
2196
|
|
|
2155
2197
|
// src/observable/internal/list/ListsHelper.ts
|
|
2156
2198
|
var ListsHelper = class extends AbstractHelper {
|
|
2157
|
-
constructor(store, cacheKeys, whereCanonicalizer2, orderByCanonicalizer2) {
|
|
2199
|
+
constructor(store, cacheKeys, whereCanonicalizer2, orderByCanonicalizer2, rdpCanonicalizer) {
|
|
2158
2200
|
super(store, cacheKeys);
|
|
2159
2201
|
this.whereCanonicalizer = whereCanonicalizer2;
|
|
2160
2202
|
this.orderByCanonicalizer = orderByCanonicalizer2;
|
|
2203
|
+
this.rdpCanonicalizer = rdpCanonicalizer;
|
|
2161
2204
|
}
|
|
2162
2205
|
observe(options, subFn) {
|
|
2163
2206
|
const ret = super.observe(options, subFn);
|
|
@@ -2168,23 +2211,197 @@ var ListsHelper = class extends AbstractHelper {
|
|
|
2168
2211
|
}
|
|
2169
2212
|
getQuery(options) {
|
|
2170
2213
|
const {
|
|
2171
|
-
type:
|
|
2172
|
-
apiName,
|
|
2173
|
-
type
|
|
2174
|
-
},
|
|
2214
|
+
type: typeDefinition,
|
|
2175
2215
|
where,
|
|
2176
|
-
orderBy
|
|
2216
|
+
orderBy,
|
|
2217
|
+
withProperties
|
|
2177
2218
|
} = options;
|
|
2219
|
+
const {
|
|
2220
|
+
apiName,
|
|
2221
|
+
type
|
|
2222
|
+
} = typeDefinition;
|
|
2178
2223
|
const canonWhere = this.whereCanonicalizer.canonicalize(where ?? {});
|
|
2179
2224
|
const canonOrderBy = this.orderByCanonicalizer.canonicalize(orderBy ?? {});
|
|
2180
|
-
const
|
|
2225
|
+
const canonRdp = withProperties ? this.rdpCanonicalizer.canonicalize(withProperties) : void 0;
|
|
2226
|
+
const listCacheKey = this.cacheKeys.get("list", type, apiName, canonWhere, canonOrderBy, canonRdp);
|
|
2181
2227
|
return this.store.queries.get(listCacheKey, () => {
|
|
2182
2228
|
const QueryClass = type === "object" ? ObjectListQuery : InterfaceListQuery;
|
|
2183
|
-
return new QueryClass(this.store, this.store.subjects.get(listCacheKey), apiName,
|
|
2229
|
+
return new QueryClass(this.store, this.store.subjects.get(listCacheKey), apiName, listCacheKey, options);
|
|
2184
2230
|
});
|
|
2185
2231
|
}
|
|
2186
2232
|
};
|
|
2187
2233
|
|
|
2234
|
+
// src/observable/internal/object/ObjectCacheKey.ts
|
|
2235
|
+
var API_NAME_IDX2 = 0;
|
|
2236
|
+
var RDP_CONFIG_IDX = 2;
|
|
2237
|
+
|
|
2238
|
+
// src/observable/internal/utils/rdpFieldOperations.ts
|
|
2239
|
+
function extractRdpFieldNames(rdpConfig) {
|
|
2240
|
+
if (!rdpConfig) {
|
|
2241
|
+
return /* @__PURE__ */ new Set();
|
|
2242
|
+
}
|
|
2243
|
+
return new Set(Object.keys(rdpConfig));
|
|
2244
|
+
}
|
|
2245
|
+
function deleteField(obj, field) {
|
|
2246
|
+
const mutableObj = obj;
|
|
2247
|
+
delete mutableObj[field];
|
|
2248
|
+
}
|
|
2249
|
+
function setField(obj, field, value) {
|
|
2250
|
+
const mutableObj = obj;
|
|
2251
|
+
mutableObj[field] = value;
|
|
2252
|
+
}
|
|
2253
|
+
function stripRdpFields(value, rdpFields) {
|
|
2254
|
+
if (rdpFields.size === 0) {
|
|
2255
|
+
return value;
|
|
2256
|
+
}
|
|
2257
|
+
const result = {
|
|
2258
|
+
...value
|
|
2259
|
+
};
|
|
2260
|
+
for (const field of rdpFields) {
|
|
2261
|
+
deleteField(result, field);
|
|
2262
|
+
}
|
|
2263
|
+
return result;
|
|
2264
|
+
}
|
|
2265
|
+
function isSuperset(superset, subset) {
|
|
2266
|
+
for (const field of subset) {
|
|
2267
|
+
if (!superset.has(field)) {
|
|
2268
|
+
return false;
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
return true;
|
|
2272
|
+
}
|
|
2273
|
+
function filterToFields(value, allowedFields) {
|
|
2274
|
+
const result = {
|
|
2275
|
+
...value
|
|
2276
|
+
};
|
|
2277
|
+
const allFields = Object.keys(result);
|
|
2278
|
+
for (const field of allFields) {
|
|
2279
|
+
if (!allowedFields.has(field)) {
|
|
2280
|
+
deleteField(result, field);
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
return result;
|
|
2284
|
+
}
|
|
2285
|
+
function mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, targetCurrentValue) {
|
|
2286
|
+
if (targetRdpFields.size === 0) {
|
|
2287
|
+
return stripRdpFields(sourceValue, sourceRdpFields);
|
|
2288
|
+
}
|
|
2289
|
+
if (isSuperset(sourceRdpFields, targetRdpFields)) {
|
|
2290
|
+
if (sourceRdpFields.size === targetRdpFields.size) {
|
|
2291
|
+
return sourceValue;
|
|
2292
|
+
}
|
|
2293
|
+
return filterToFields(sourceValue, targetRdpFields);
|
|
2294
|
+
}
|
|
2295
|
+
const merged = {
|
|
2296
|
+
...sourceValue
|
|
2297
|
+
};
|
|
2298
|
+
if (targetCurrentValue) {
|
|
2299
|
+
const targetAsRecord = targetCurrentValue;
|
|
2300
|
+
for (const field of targetRdpFields) {
|
|
2301
|
+
if (!sourceRdpFields.has(field) && field in targetCurrentValue) {
|
|
2302
|
+
setField(merged, field, targetAsRecord[field]);
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
return merged;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
// src/observable/internal/object/ObjectCacheKeyRegistry.ts
|
|
2310
|
+
var ObjectCacheKeyRegistry = class {
|
|
2311
|
+
/**
|
|
2312
|
+
* Map from base key (apiName:primaryKey) to all related cache key variants and metadata
|
|
2313
|
+
*/
|
|
2314
|
+
baseToVariants = /* @__PURE__ */ new Map();
|
|
2315
|
+
/**
|
|
2316
|
+
* Metadata for each cache key (apiName, primaryKey, rdpConfig)
|
|
2317
|
+
*/
|
|
2318
|
+
keyMetadata = /* @__PURE__ */ new WeakMap();
|
|
2319
|
+
/**
|
|
2320
|
+
* Register a cache key variant for an object
|
|
2321
|
+
*/
|
|
2322
|
+
register(cacheKey, apiName, primaryKey, rdpConfig) {
|
|
2323
|
+
const baseKey = this.makeBaseKey(apiName, primaryKey);
|
|
2324
|
+
const primaryKeyStr = String(primaryKey);
|
|
2325
|
+
this.keyMetadata.set(cacheKey, {
|
|
2326
|
+
apiName,
|
|
2327
|
+
primaryKey: primaryKeyStr,
|
|
2328
|
+
rdpConfig,
|
|
2329
|
+
rdpFieldSet: rdpConfig ? extractRdpFieldNames(rdpConfig) : void 0
|
|
2330
|
+
});
|
|
2331
|
+
let entry = this.baseToVariants.get(baseKey);
|
|
2332
|
+
if (!entry) {
|
|
2333
|
+
entry = {
|
|
2334
|
+
variants: /* @__PURE__ */ new Set(),
|
|
2335
|
+
apiName,
|
|
2336
|
+
primaryKey: primaryKeyStr
|
|
2337
|
+
};
|
|
2338
|
+
this.baseToVariants.set(baseKey, entry);
|
|
2339
|
+
}
|
|
2340
|
+
entry.variants.add(cacheKey);
|
|
2341
|
+
}
|
|
2342
|
+
/**
|
|
2343
|
+
* Get all variant cache keys for a specific object
|
|
2344
|
+
*/
|
|
2345
|
+
getVariants(apiName, primaryKey) {
|
|
2346
|
+
const baseKey = this.makeBaseKey(apiName, primaryKey);
|
|
2347
|
+
const entry = this.baseToVariants.get(baseKey);
|
|
2348
|
+
return new Set(entry?.variants ?? []);
|
|
2349
|
+
}
|
|
2350
|
+
/**
|
|
2351
|
+
* Unregister a cache key when it's being cleaned up
|
|
2352
|
+
*/
|
|
2353
|
+
unregister(cacheKey) {
|
|
2354
|
+
const metadata = this.keyMetadata.get(cacheKey);
|
|
2355
|
+
if (!metadata) return;
|
|
2356
|
+
const baseKey = this.makeBaseKey(metadata.apiName, metadata.primaryKey);
|
|
2357
|
+
const entry = this.baseToVariants.get(baseKey);
|
|
2358
|
+
if (entry) {
|
|
2359
|
+
entry.variants.delete(cacheKey);
|
|
2360
|
+
if (entry.variants.size === 0) {
|
|
2361
|
+
this.baseToVariants.delete(baseKey);
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
this.keyMetadata.delete(cacheKey);
|
|
2365
|
+
}
|
|
2366
|
+
/**
|
|
2367
|
+
* Get metadata for a cache key
|
|
2368
|
+
*/
|
|
2369
|
+
getMetadata(cacheKey) {
|
|
2370
|
+
return this.keyMetadata.get(cacheKey);
|
|
2371
|
+
}
|
|
2372
|
+
/**
|
|
2373
|
+
* Get the count of variants for a specific object
|
|
2374
|
+
*/
|
|
2375
|
+
getVariantCount(apiName, primaryKey) {
|
|
2376
|
+
const baseKey = this.makeBaseKey(apiName, primaryKey);
|
|
2377
|
+
return this.baseToVariants.get(baseKey)?.variants.size ?? 0;
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2380
|
+
* Generate a base key from apiName and primaryKey
|
|
2381
|
+
*/
|
|
2382
|
+
makeBaseKey(apiName, primaryKey) {
|
|
2383
|
+
return `${apiName}:${primaryKey}`;
|
|
2384
|
+
}
|
|
2385
|
+
/**
|
|
2386
|
+
* Check if a cache key has RDP configuration
|
|
2387
|
+
*/
|
|
2388
|
+
hasRdpConfig(cacheKey) {
|
|
2389
|
+
return this.keyMetadata.get(cacheKey)?.rdpConfig != null;
|
|
2390
|
+
}
|
|
2391
|
+
/**
|
|
2392
|
+
* Get the RDP configuration for a cache key
|
|
2393
|
+
*/
|
|
2394
|
+
getRdpConfig(cacheKey) {
|
|
2395
|
+
return this.keyMetadata.get(cacheKey)?.rdpConfig;
|
|
2396
|
+
}
|
|
2397
|
+
/**
|
|
2398
|
+
* Get the cached RDP field set for a cache key
|
|
2399
|
+
*/
|
|
2400
|
+
getRdpFieldSet(cacheKey) {
|
|
2401
|
+
return this.keyMetadata.get(cacheKey)?.rdpFieldSet ?? /* @__PURE__ */ new Set();
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
|
|
2188
2405
|
// ../../node_modules/.pnpm/p-defer@4.0.1/node_modules/p-defer/index.js
|
|
2189
2406
|
function pDefer() {
|
|
2190
2407
|
const deferred = {};
|
|
@@ -2211,7 +2428,7 @@ var BulkObjectLoader = class {
|
|
|
2211
2428
|
#maxEntries;
|
|
2212
2429
|
constructor(client, maxWait = 25, maxEntries = 100) {
|
|
2213
2430
|
this.#client = client;
|
|
2214
|
-
this.#logger = client[
|
|
2431
|
+
this.#logger = client[chunkVNLY3YOJ_cjs.additionalContext].logger;
|
|
2215
2432
|
this.#maxWait = maxWait;
|
|
2216
2433
|
this.#maxEntries = maxEntries;
|
|
2217
2434
|
}
|
|
@@ -2246,13 +2463,18 @@ var BulkObjectLoader = class {
|
|
|
2246
2463
|
};
|
|
2247
2464
|
const objMetadata = await this.#client.fetchMetadata(miniDef);
|
|
2248
2465
|
const pks = arr.map((x) => x.primaryKey);
|
|
2249
|
-
const {
|
|
2250
|
-
|
|
2251
|
-
|
|
2466
|
+
const whereClause = pks.length === 1 ? {
|
|
2467
|
+
[objMetadata.primaryKeyApiName]: {
|
|
2468
|
+
$eq: pks[0]
|
|
2469
|
+
}
|
|
2470
|
+
} : {
|
|
2252
2471
|
[objMetadata.primaryKeyApiName]: {
|
|
2253
2472
|
$in: pks
|
|
2254
2473
|
}
|
|
2255
|
-
}
|
|
2474
|
+
};
|
|
2475
|
+
const {
|
|
2476
|
+
data
|
|
2477
|
+
} = await this.#client(miniDef).where(whereClause).fetchPage({
|
|
2256
2478
|
$pageSize: pks.length
|
|
2257
2479
|
});
|
|
2258
2480
|
for (const {
|
|
@@ -2274,7 +2496,7 @@ var ObjectQuery = class extends Query {
|
|
|
2274
2496
|
#apiName;
|
|
2275
2497
|
#pk;
|
|
2276
2498
|
constructor(store, subject, type, pk, cacheKey, opts) {
|
|
2277
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
2499
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVNLY3YOJ_cjs.additionalContext].logger?.child({}, {
|
|
2278
2500
|
msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
2279
2501
|
}) : void 0);
|
|
2280
2502
|
this.#apiName = type;
|
|
@@ -2309,62 +2531,17 @@ var ObjectQuery = class extends Query {
|
|
|
2309
2531
|
});
|
|
2310
2532
|
}
|
|
2311
2533
|
writeToStore(data, status, batch) {
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
methodName: "writeToStore"
|
|
2318
|
-
}).debug(`Object was deep equal and status unchanged (${status}), skipping update`);
|
|
2319
|
-
}
|
|
2320
|
-
return entry;
|
|
2321
|
-
}
|
|
2322
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2323
|
-
this.logger?.child({
|
|
2324
|
-
methodName: "writeToStore"
|
|
2325
|
-
}).debug(`Object was deep equal, just setting status (old status: ${entry.status}, new status: ${status})`);
|
|
2326
|
-
}
|
|
2327
|
-
return batch.write(this.cacheKey, entry.value, status);
|
|
2328
|
-
}
|
|
2329
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2330
|
-
this.logger?.child({
|
|
2331
|
-
methodName: "writeToStore"
|
|
2332
|
-
}).debug(JSON.stringify({
|
|
2333
|
-
status
|
|
2334
|
-
}), data);
|
|
2335
|
-
}
|
|
2336
|
-
const ret = batch.write(this.cacheKey, data, status);
|
|
2337
|
-
batch.changes.registerObject(
|
|
2338
|
-
this.cacheKey,
|
|
2339
|
-
data,
|
|
2340
|
-
/* isNew */
|
|
2341
|
-
!entry
|
|
2342
|
-
);
|
|
2343
|
-
return ret;
|
|
2534
|
+
batch.read(this.cacheKey);
|
|
2535
|
+
const rdpConfig = this.cacheKey.otherKeys[RDP_CONFIG_IDX];
|
|
2536
|
+
this.store.objectCacheKeyRegistry.register(this.cacheKey, this.#apiName, this.#pk, rdpConfig);
|
|
2537
|
+
this.store.objects.propagateWrite(this.cacheKey, data, status, batch);
|
|
2538
|
+
return batch.read(this.cacheKey);
|
|
2344
2539
|
}
|
|
2345
2540
|
deleteFromStore(status, batch) {
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
methodName: "deleteFromStore"
|
|
2351
|
-
}).debug(`Object was deep equal, just setting status`);
|
|
2352
|
-
}
|
|
2353
|
-
return batch.write(this.cacheKey, entry.value, status);
|
|
2354
|
-
}
|
|
2355
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2356
|
-
this.logger?.child({
|
|
2357
|
-
methodName: "deleteFromStore"
|
|
2358
|
-
}).debug(JSON.stringify({
|
|
2359
|
-
status
|
|
2360
|
-
}));
|
|
2361
|
-
}
|
|
2362
|
-
if (!entry || !entry.value) {
|
|
2363
|
-
return;
|
|
2364
|
-
}
|
|
2365
|
-
const ret = batch.delete(this.cacheKey, status);
|
|
2366
|
-
batch.changes.deleteObject(this.cacheKey);
|
|
2367
|
-
return ret;
|
|
2541
|
+
const rdpConfig = this.cacheKey.otherKeys[RDP_CONFIG_IDX];
|
|
2542
|
+
this.store.objectCacheKeyRegistry.register(this.cacheKey, this.#apiName, this.#pk, rdpConfig);
|
|
2543
|
+
this.store.objects.propagateWrite(this.cacheKey, tombstone, status, batch);
|
|
2544
|
+
return batch.read(this.cacheKey);
|
|
2368
2545
|
}
|
|
2369
2546
|
invalidateObjectType = (objectType, changes) => {
|
|
2370
2547
|
if (this.#apiName === objectType) {
|
|
@@ -2380,26 +2557,79 @@ var ObjectsHelper = class extends AbstractHelper {
|
|
|
2380
2557
|
observe(options, subFn) {
|
|
2381
2558
|
return super.observe(options, subFn);
|
|
2382
2559
|
}
|
|
2383
|
-
getQuery(options) {
|
|
2560
|
+
getQuery(options, rdpConfig) {
|
|
2384
2561
|
const apiName = typeof options.apiName === "string" ? options.apiName : options.apiName.apiName;
|
|
2385
2562
|
const {
|
|
2386
2563
|
pk
|
|
2387
2564
|
} = options;
|
|
2388
|
-
const objectCacheKey = this.cacheKeys.get("object", apiName, pk);
|
|
2565
|
+
const objectCacheKey = this.cacheKeys.get("object", apiName, pk, rdpConfig ?? void 0);
|
|
2389
2566
|
return this.store.queries.get(objectCacheKey, () => new ObjectQuery(this.store, this.store.subjects.get(objectCacheKey), apiName, pk, objectCacheKey, {
|
|
2390
2567
|
dedupeInterval: 0
|
|
2391
2568
|
}));
|
|
2392
2569
|
}
|
|
2393
2570
|
/**
|
|
2394
2571
|
* Internal helper method for writing objects to the store and returning their
|
|
2395
|
-
* object keys
|
|
2572
|
+
* object keys. For list queries with RDPs, the rdpConfig is included in the
|
|
2573
|
+
* cache key to ensure proper data isolation.
|
|
2396
2574
|
* @internal
|
|
2397
2575
|
*/
|
|
2398
|
-
storeOsdkInstances(values, batch) {
|
|
2576
|
+
storeOsdkInstances(values, batch, rdpConfig) {
|
|
2399
2577
|
return values.map((v) => this.getQuery({
|
|
2400
2578
|
apiName: v.$apiName,
|
|
2401
2579
|
pk: v.$primaryKey
|
|
2402
|
-
}).writeToStore(v, "loaded", batch).cacheKey);
|
|
2580
|
+
}, rdpConfig).writeToStore(v, "loaded", batch).cacheKey);
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Write an object to cache and propagate to all related cache keys
|
|
2584
|
+
* @internal
|
|
2585
|
+
*/
|
|
2586
|
+
propagateWrite(sourceCacheKey, value, status, batch) {
|
|
2587
|
+
const existing = batch.read(sourceCacheKey);
|
|
2588
|
+
const dataChanged = !existing || existing.value === void 0 || value === tombstone || !deepEqual__default.default(existing.value, value);
|
|
2589
|
+
const statusChanged = !existing || existing.status !== status;
|
|
2590
|
+
if (!dataChanged && !statusChanged) {
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
const valueToWrite = !dataChanged && existing ? existing.value : value;
|
|
2594
|
+
batch.write(sourceCacheKey, valueToWrite, status);
|
|
2595
|
+
if (value !== tombstone) {
|
|
2596
|
+
batch.changes.registerObject(sourceCacheKey, value, !existing);
|
|
2597
|
+
}
|
|
2598
|
+
const metadata = this.store.objectCacheKeyRegistry.getMetadata(sourceCacheKey);
|
|
2599
|
+
const relatedKeys = metadata ? this.store.objectCacheKeyRegistry.getVariants(metadata.apiName, metadata.primaryKey) : /* @__PURE__ */ new Set([sourceCacheKey]);
|
|
2600
|
+
for (const targetKey of relatedKeys) {
|
|
2601
|
+
if (targetKey === sourceCacheKey || !this.isKeyActive(targetKey)) {
|
|
2602
|
+
continue;
|
|
2603
|
+
}
|
|
2604
|
+
if (value === tombstone) {
|
|
2605
|
+
batch.write(targetKey, tombstone, status);
|
|
2606
|
+
continue;
|
|
2607
|
+
}
|
|
2608
|
+
const targetCurrentValue = batch.read(targetKey)?.value;
|
|
2609
|
+
const merged = this.mergeForTarget(value, targetCurrentValue && this.isObjectHolder(targetCurrentValue) ? targetCurrentValue : void 0, sourceCacheKey, targetKey);
|
|
2610
|
+
batch.write(targetKey, merged, status);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
/**
|
|
2614
|
+
* Check if a cache key is actively observed
|
|
2615
|
+
*/
|
|
2616
|
+
isKeyActive(key) {
|
|
2617
|
+
const subject = this.store.subjects.peek(key);
|
|
2618
|
+
return subject?.observed === true;
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
* Type guard to check if a value is an ObjectHolder
|
|
2622
|
+
*/
|
|
2623
|
+
isObjectHolder(value) {
|
|
2624
|
+
return value != null && typeof value === "object" && "$apiName" in value && "$primaryKey" in value;
|
|
2625
|
+
}
|
|
2626
|
+
/**
|
|
2627
|
+
* Merge object data for a specific target cache key, preserving RDP fields
|
|
2628
|
+
*/
|
|
2629
|
+
mergeForTarget(sourceValue, targetCurrentValue, sourceCacheKey, targetCacheKey) {
|
|
2630
|
+
const sourceRdpFields = this.store.objectCacheKeyRegistry.getRdpFieldSet(sourceCacheKey);
|
|
2631
|
+
const targetRdpFields = this.store.objectCacheKeyRegistry.getRdpFieldSet(targetCacheKey);
|
|
2632
|
+
return mergeObjectFields(sourceValue, sourceRdpFields, targetRdpFields, targetCurrentValue);
|
|
2403
2633
|
}
|
|
2404
2634
|
};
|
|
2405
2635
|
|
|
@@ -2410,7 +2640,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
2410
2640
|
#composedObjectSet;
|
|
2411
2641
|
#objectTypes;
|
|
2412
2642
|
constructor(store, subject, baseObjectSetWire, operations, cacheKey, opts) {
|
|
2413
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
2643
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkVNLY3YOJ_cjs.additionalContext].logger?.child({}, {
|
|
2414
2644
|
msgPrefix: `ObjectSetQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
2415
2645
|
}) : void 0);
|
|
2416
2646
|
this.#baseObjectSetWire = baseObjectSetWire;
|
|
@@ -2453,7 +2683,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
2453
2683
|
}
|
|
2454
2684
|
if (opts.union) {
|
|
2455
2685
|
for (const os of opts.union) {
|
|
2456
|
-
const wire =
|
|
2686
|
+
const wire = chunkVNLY3YOJ_cjs.getWireObjectSet(os);
|
|
2457
2687
|
if (wire.type) {
|
|
2458
2688
|
types.add(wire.type);
|
|
2459
2689
|
}
|
|
@@ -2461,7 +2691,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
2461
2691
|
}
|
|
2462
2692
|
if (opts.intersect) {
|
|
2463
2693
|
for (const os of opts.intersect) {
|
|
2464
|
-
const wire =
|
|
2694
|
+
const wire = chunkVNLY3YOJ_cjs.getWireObjectSet(os);
|
|
2465
2695
|
if (wire.type) {
|
|
2466
2696
|
types.add(wire.type);
|
|
2467
2697
|
}
|
|
@@ -2469,7 +2699,7 @@ var ObjectSetQuery = class extends BaseListQuery {
|
|
|
2469
2699
|
}
|
|
2470
2700
|
if (opts.subtract) {
|
|
2471
2701
|
for (const os of opts.subtract) {
|
|
2472
|
-
const wire =
|
|
2702
|
+
const wire = chunkVNLY3YOJ_cjs.getWireObjectSet(os);
|
|
2473
2703
|
if (wire.type) {
|
|
2474
2704
|
types.add(wire.type);
|
|
2475
2705
|
}
|
|
@@ -2543,7 +2773,7 @@ var ObjectSetHelper = class extends AbstractHelper {
|
|
|
2543
2773
|
const {
|
|
2544
2774
|
baseObjectSet
|
|
2545
2775
|
} = options;
|
|
2546
|
-
const baseObjectSetWire = JSON.stringify(
|
|
2776
|
+
const baseObjectSetWire = JSON.stringify(chunkVNLY3YOJ_cjs.getWireObjectSet(baseObjectSet));
|
|
2547
2777
|
const operations = this.buildCanonicalizedOperations(options);
|
|
2548
2778
|
const objectSetCacheKey = this.cacheKeys.get("objectSet", baseObjectSetWire, operations);
|
|
2549
2779
|
return this.store.queries.get(objectSetCacheKey, () => {
|
|
@@ -2559,13 +2789,13 @@ var ObjectSetHelper = class extends AbstractHelper {
|
|
|
2559
2789
|
operations.withProperties = Object.keys(options.withProperties).sort();
|
|
2560
2790
|
}
|
|
2561
2791
|
if (options.union && options.union.length > 0) {
|
|
2562
|
-
operations.union = options.union.map((os) => JSON.stringify(
|
|
2792
|
+
operations.union = options.union.map((os) => JSON.stringify(chunkVNLY3YOJ_cjs.getWireObjectSet(os)));
|
|
2563
2793
|
}
|
|
2564
2794
|
if (options.intersect && options.intersect.length > 0) {
|
|
2565
|
-
operations.intersect = options.intersect.map((os) => JSON.stringify(
|
|
2795
|
+
operations.intersect = options.intersect.map((os) => JSON.stringify(chunkVNLY3YOJ_cjs.getWireObjectSet(os)));
|
|
2566
2796
|
}
|
|
2567
2797
|
if (options.subtract && options.subtract.length > 0) {
|
|
2568
|
-
operations.subtract = options.subtract.map((os) => JSON.stringify(
|
|
2798
|
+
operations.subtract = options.subtract.map((os) => JSON.stringify(chunkVNLY3YOJ_cjs.getWireObjectSet(os)));
|
|
2569
2799
|
}
|
|
2570
2800
|
if (options.pivotTo) {
|
|
2571
2801
|
operations.pivotTo = options.pivotTo;
|
|
@@ -2605,12 +2835,85 @@ var Queries = class {
|
|
|
2605
2835
|
}
|
|
2606
2836
|
};
|
|
2607
2837
|
|
|
2838
|
+
// src/observable/internal/Canonicalizer.ts
|
|
2839
|
+
var CachingCanonicalizer = class {
|
|
2840
|
+
/**
|
|
2841
|
+
* Cache for input object identity.
|
|
2842
|
+
*/
|
|
2843
|
+
inputCache = /* @__PURE__ */ new WeakMap();
|
|
2844
|
+
/**
|
|
2845
|
+
* Look up or create a canonical form for the given input.
|
|
2846
|
+
* This method handles the structural deduplication logic.
|
|
2847
|
+
*
|
|
2848
|
+
* @param input The input to canonicalize
|
|
2849
|
+
* @returns The canonical form
|
|
2850
|
+
*/
|
|
2851
|
+
canonicalize(input) {
|
|
2852
|
+
if (!input) {
|
|
2853
|
+
return void 0;
|
|
2854
|
+
}
|
|
2855
|
+
if (this.inputCache.has(input)) {
|
|
2856
|
+
return this.inputCache.get(input);
|
|
2857
|
+
}
|
|
2858
|
+
const canonical = this.lookupOrCreate(input);
|
|
2859
|
+
this.inputCache.set(input, canonical);
|
|
2860
|
+
return canonical;
|
|
2861
|
+
}
|
|
2862
|
+
};
|
|
2863
|
+
|
|
2864
|
+
// src/observable/internal/RdpCanonicalizer.ts
|
|
2865
|
+
var RdpCanonicalizer = class extends CachingCanonicalizer {
|
|
2866
|
+
structuralCache = /* @__PURE__ */ new Map();
|
|
2867
|
+
lookupOrCreate(rdp) {
|
|
2868
|
+
const definitionMap = /* @__PURE__ */ new Map();
|
|
2869
|
+
const computedProperties = {};
|
|
2870
|
+
const objectTypeHolder = {
|
|
2871
|
+
type: "object",
|
|
2872
|
+
apiName: "__rdp_canonicalizer_holder__"
|
|
2873
|
+
};
|
|
2874
|
+
for (const [key, rdpFunction] of Object.entries(rdp)) {
|
|
2875
|
+
const builder = chunkVNLY3YOJ_cjs.createWithPropertiesObjectSet(
|
|
2876
|
+
objectTypeHolder,
|
|
2877
|
+
{
|
|
2878
|
+
type: "methodInput"
|
|
2879
|
+
},
|
|
2880
|
+
definitionMap,
|
|
2881
|
+
/* fromBaseObjectSet */
|
|
2882
|
+
true
|
|
2883
|
+
);
|
|
2884
|
+
const result = rdpFunction(builder);
|
|
2885
|
+
const definition = definitionMap.get(result);
|
|
2886
|
+
if (definition) {
|
|
2887
|
+
computedProperties[key] = definition;
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
const sortedKeys = Object.keys(computedProperties).sort();
|
|
2891
|
+
const sortedDefinitions = {};
|
|
2892
|
+
for (const key of sortedKeys) {
|
|
2893
|
+
sortedDefinitions[key] = computedProperties[key];
|
|
2894
|
+
}
|
|
2895
|
+
const definitionsKey = JSON.stringify(sortedDefinitions);
|
|
2896
|
+
let canonical = this.structuralCache.get(definitionsKey);
|
|
2897
|
+
if (!canonical) {
|
|
2898
|
+
const sortedRdp = {};
|
|
2899
|
+
for (const key of Object.keys(rdp).sort()) {
|
|
2900
|
+
sortedRdp[key] = rdp[key];
|
|
2901
|
+
}
|
|
2902
|
+
canonical = sortedRdp;
|
|
2903
|
+
this.structuralCache.set(definitionsKey, canonical);
|
|
2904
|
+
}
|
|
2905
|
+
return canonical;
|
|
2906
|
+
}
|
|
2907
|
+
};
|
|
2908
|
+
|
|
2608
2909
|
// src/observable/internal/Store.ts
|
|
2609
2910
|
var Store = class {
|
|
2610
2911
|
whereCanonicalizer = new WhereClauseCanonicalizer();
|
|
2611
2912
|
orderByCanonicalizer = new OrderByCanonicalizer();
|
|
2913
|
+
rdpCanonicalizer = new RdpCanonicalizer();
|
|
2612
2914
|
/** @internal */
|
|
2613
2915
|
queries = new Queries();
|
|
2916
|
+
objectCacheKeyRegistry = new ObjectCacheKeyRegistry();
|
|
2614
2917
|
layers = new Layers({
|
|
2615
2918
|
logger: this.logger,
|
|
2616
2919
|
onRevalidate: this.#maybeRevalidateQueries.bind(this)
|
|
@@ -2618,14 +2921,14 @@ var Store = class {
|
|
|
2618
2921
|
subjects = this.layers.subjects;
|
|
2619
2922
|
// these are hopefully temporary
|
|
2620
2923
|
constructor(client) {
|
|
2621
|
-
this.logger = client[
|
|
2924
|
+
this.logger = client[chunkVNLY3YOJ_cjs.additionalContext].logger?.child({}, {
|
|
2622
2925
|
msgPrefix: "Store"
|
|
2623
2926
|
});
|
|
2624
2927
|
this.client = client;
|
|
2625
2928
|
this.cacheKeys = new CacheKeys({
|
|
2626
2929
|
onDestroy: this.#cleanupCacheKey
|
|
2627
2930
|
});
|
|
2628
|
-
this.lists = new ListsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer);
|
|
2931
|
+
this.lists = new ListsHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer, this.rdpCanonicalizer);
|
|
2629
2932
|
this.objects = new ObjectsHelper(this, this.cacheKeys);
|
|
2630
2933
|
this.links = new LinksHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer);
|
|
2631
2934
|
this.objectSets = new ObjectSetHelper(this, this.cacheKeys, this.whereCanonicalizer, this.orderByCanonicalizer);
|
|
@@ -2637,7 +2940,7 @@ var Store = class {
|
|
|
2637
2940
|
#cleanupCacheKey = (key) => {
|
|
2638
2941
|
const subject = this.subjects.peek(key);
|
|
2639
2942
|
if (process.env.NODE_ENV !== "production") {
|
|
2640
|
-
!subject ? process.env.NODE_ENV !== "production" ?
|
|
2943
|
+
!subject ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false) : invariant4__default.default(false) : void 0;
|
|
2641
2944
|
}
|
|
2642
2945
|
this.subjects.delete(key);
|
|
2643
2946
|
this.queries.delete(key);
|
|
@@ -2668,13 +2971,28 @@ var Store = class {
|
|
|
2668
2971
|
if (typeof apiName !== "string") {
|
|
2669
2972
|
apiName = apiName.apiName;
|
|
2670
2973
|
}
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2974
|
+
const variants = this.objectCacheKeyRegistry.getVariants(apiName, pk);
|
|
2975
|
+
const promises = [];
|
|
2976
|
+
if (variants.size === 0) {
|
|
2977
|
+
promises.push(this.objects.getQuery({
|
|
2978
|
+
apiName,
|
|
2979
|
+
pk
|
|
2980
|
+
}, void 0).revalidate(
|
|
2981
|
+
/* force */
|
|
2982
|
+
true
|
|
2983
|
+
));
|
|
2984
|
+
} else {
|
|
2985
|
+
for (const key of variants) {
|
|
2986
|
+
const query = this.queries.peek(key);
|
|
2987
|
+
if (query) {
|
|
2988
|
+
promises.push(query.revalidate(
|
|
2989
|
+
/* force */
|
|
2990
|
+
true
|
|
2991
|
+
));
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
return Promise.allSettled(promises);
|
|
2678
2996
|
}
|
|
2679
2997
|
async #maybeRevalidateQueries(changes, optimisticId) {
|
|
2680
2998
|
const logger = process.env.NODE_ENV !== "production" ? this.logger?.child({
|
|
@@ -2694,7 +3012,17 @@ var Store = class {
|
|
|
2694
3012
|
try {
|
|
2695
3013
|
const promises = [];
|
|
2696
3014
|
for (const cacheKey of this.queries.keys()) {
|
|
2697
|
-
const
|
|
3015
|
+
const query = this.queries.peek(cacheKey);
|
|
3016
|
+
if (!query?.maybeUpdateAndRevalidate) {
|
|
3017
|
+
continue;
|
|
3018
|
+
}
|
|
3019
|
+
if (!this.#shouldPropagateToQuery({
|
|
3020
|
+
cacheKey,
|
|
3021
|
+
maybeUpdateAndRevalidate: query.maybeUpdateAndRevalidate
|
|
3022
|
+
}, changes, optimisticId)) {
|
|
3023
|
+
continue;
|
|
3024
|
+
}
|
|
3025
|
+
const promise = query.maybeUpdateAndRevalidate(changes, optimisticId);
|
|
2698
3026
|
if (promise) promises.push(promise);
|
|
2699
3027
|
}
|
|
2700
3028
|
await Promise.all(promises);
|
|
@@ -2704,6 +3032,103 @@ var Store = class {
|
|
|
2704
3032
|
}
|
|
2705
3033
|
}
|
|
2706
3034
|
}
|
|
3035
|
+
/**
|
|
3036
|
+
* Determines whether changes should propagate to a specific query.
|
|
3037
|
+
* Prevents unnecessary observable pipeline execution for cross-propagation.
|
|
3038
|
+
*
|
|
3039
|
+
* @param query - The query to check
|
|
3040
|
+
* @param changes - The changes that occurred
|
|
3041
|
+
* @param optimisticId - Optional optimistic update ID
|
|
3042
|
+
* @returns true if the query should be notified of these changes
|
|
3043
|
+
*/
|
|
3044
|
+
#shouldPropagateToQuery(query, changes, optimisticId) {
|
|
3045
|
+
if (optimisticId) {
|
|
3046
|
+
return true;
|
|
3047
|
+
}
|
|
3048
|
+
if (changes.modified.has(query.cacheKey)) {
|
|
3049
|
+
return true;
|
|
3050
|
+
}
|
|
3051
|
+
if (this.#shouldPropagateForObjectTypeChanges(query.cacheKey, changes)) {
|
|
3052
|
+
return true;
|
|
3053
|
+
}
|
|
3054
|
+
const queryRdpConfig = this.#getQueryRdpConfig(query.cacheKey);
|
|
3055
|
+
return queryRdpConfig != null;
|
|
3056
|
+
}
|
|
3057
|
+
/**
|
|
3058
|
+
* Checks if changes to an object type should propagate to a query.
|
|
3059
|
+
* This ensures queries receive updates when objects of their type are added/modified.
|
|
3060
|
+
*
|
|
3061
|
+
* @param cacheKey - The cache key of the query
|
|
3062
|
+
* @param changes - The changes that occurred
|
|
3063
|
+
* @returns true if the query should be notified based on object type changes
|
|
3064
|
+
*/
|
|
3065
|
+
#shouldPropagateForObjectTypeChanges(cacheKey, changes) {
|
|
3066
|
+
const queryObjectType = this.#getQueryObjectType(cacheKey);
|
|
3067
|
+
if (!queryObjectType) {
|
|
3068
|
+
return false;
|
|
3069
|
+
}
|
|
3070
|
+
const affected = this.#changesAffectObjectType(changes, queryObjectType);
|
|
3071
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3072
|
+
this.logger?.child({
|
|
3073
|
+
methodName: "shouldPropagateToQuery"
|
|
3074
|
+
}).debug(`Query type: ${queryObjectType}, affected: ${affected}`, {
|
|
3075
|
+
queryKey: DEBUG_ONLY__cacheKeyToString(cacheKey),
|
|
3076
|
+
addedCount: changes.addedObjects.get(queryObjectType)?.length ?? 0,
|
|
3077
|
+
modifiedCount: changes.modifiedObjects.get(queryObjectType)?.length ?? 0
|
|
3078
|
+
});
|
|
3079
|
+
}
|
|
3080
|
+
return affected;
|
|
3081
|
+
}
|
|
3082
|
+
/**
|
|
3083
|
+
* Extracts RDP configuration from a cache key if present.
|
|
3084
|
+
*
|
|
3085
|
+
* @param cacheKey - The cache key to check
|
|
3086
|
+
* @returns The RDP configuration, or undefined if not present
|
|
3087
|
+
*/
|
|
3088
|
+
#getQueryRdpConfig(cacheKey) {
|
|
3089
|
+
if ("otherKeys" in cacheKey && Array.isArray(cacheKey.otherKeys)) {
|
|
3090
|
+
if (cacheKey.type === "object") {
|
|
3091
|
+
return cacheKey.otherKeys[RDP_CONFIG_IDX];
|
|
3092
|
+
} else if (cacheKey.type === "list") {
|
|
3093
|
+
return cacheKey.otherKeys[RDP_IDX];
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
return void 0;
|
|
3097
|
+
}
|
|
3098
|
+
/**
|
|
3099
|
+
* Extracts the object type (apiName) from a cache key.
|
|
3100
|
+
*
|
|
3101
|
+
* @param cacheKey - The cache key to check
|
|
3102
|
+
* @returns The object type/apiName, or undefined if not applicable
|
|
3103
|
+
*/
|
|
3104
|
+
#getQueryObjectType(cacheKey) {
|
|
3105
|
+
if ("otherKeys" in cacheKey && Array.isArray(cacheKey.otherKeys)) {
|
|
3106
|
+
if (cacheKey.type === "object") {
|
|
3107
|
+
return cacheKey.otherKeys[API_NAME_IDX2];
|
|
3108
|
+
} else if (cacheKey.type === "list") {
|
|
3109
|
+
return cacheKey.otherKeys[API_NAME_IDX];
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
return void 0;
|
|
3113
|
+
}
|
|
3114
|
+
/**
|
|
3115
|
+
* Checks if changes affect a specific object type.
|
|
3116
|
+
*
|
|
3117
|
+
* @param changes - The changes to check
|
|
3118
|
+
* @param objectType - The object type to check for
|
|
3119
|
+
* @returns true if the changes include added or modified objects of this type
|
|
3120
|
+
*/
|
|
3121
|
+
#changesAffectObjectType(changes, objectType) {
|
|
3122
|
+
const addedForType = changes.addedObjects.get(objectType);
|
|
3123
|
+
if (addedForType && addedForType.length > 0) {
|
|
3124
|
+
return true;
|
|
3125
|
+
}
|
|
3126
|
+
const modifiedForType = changes.modifiedObjects.get(objectType);
|
|
3127
|
+
if (modifiedForType && modifiedForType.length > 0) {
|
|
3128
|
+
return true;
|
|
3129
|
+
}
|
|
3130
|
+
return false;
|
|
3131
|
+
}
|
|
2707
3132
|
/**
|
|
2708
3133
|
* Invalidates all cache entries for a specific object type.
|
|
2709
3134
|
* This will revalidate:
|
|
@@ -2757,10 +3182,10 @@ var Store = class {
|
|
|
2757
3182
|
|
|
2758
3183
|
// src/observable/ObservableClient.ts
|
|
2759
3184
|
function createObservableClient(client) {
|
|
2760
|
-
const tweakedClient =
|
|
2761
|
-
...client[
|
|
2762
|
-
fetch: shared_net_fetch.createFetchHeaderMutator(client[
|
|
2763
|
-
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"),
|
|
3185
|
+
const tweakedClient = chunk7567LSZD_cjs.createClientFromContext({
|
|
3186
|
+
...client[chunkVNLY3YOJ_cjs.additionalContext],
|
|
3187
|
+
fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkVNLY3YOJ_cjs.additionalContext].fetch, (headers) => {
|
|
3188
|
+
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunk7567LSZD_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
|
|
2764
3189
|
return headers;
|
|
2765
3190
|
})
|
|
2766
3191
|
});
|
|
@@ -2803,11 +3228,11 @@ function getOsdkConfig(ontologyRid) {
|
|
|
2803
3228
|
|
|
2804
3229
|
Object.defineProperty(exports, "createClientWithTransaction", {
|
|
2805
3230
|
enumerable: true,
|
|
2806
|
-
get: function () { return
|
|
3231
|
+
get: function () { return chunk7567LSZD_cjs.createClientWithTransaction; }
|
|
2807
3232
|
});
|
|
2808
3233
|
Object.defineProperty(exports, "augment", {
|
|
2809
3234
|
enumerable: true,
|
|
2810
|
-
get: function () { return
|
|
3235
|
+
get: function () { return chunkVNLY3YOJ_cjs.augment; }
|
|
2811
3236
|
});
|
|
2812
3237
|
exports.computeObjectSetCacheKey = computeObjectSetCacheKey;
|
|
2813
3238
|
exports.createObservableClient = createObservableClient;
|