@osdk/client 2.5.0-beta.1 → 2.5.0-beta.3
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 +43 -0
- package/build/browser/Client.js +1 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/createClient.js +4 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +11 -0
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/intellisense.test.helpers/orderBySuggestionIsRight.js +8 -1
- package/build/browser/intellisense.test.helpers/orderBySuggestionIsRight.js.map +1 -1
- package/build/browser/intellisense.test.js +14 -4
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/object/Cache.js +1 -1
- package/build/browser/object/Cache.js.map +1 -1
- package/build/browser/object/SimpleCache.js +1 -1
- package/build/browser/object/SimpleCache.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +4 -0
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +12 -0
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +30 -4
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/geotimeseriesreference.test.js +0 -2
- package/build/browser/object/geotimeseriesreference.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +6 -0
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +3 -1
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/observable/LinkPayload.js +2 -0
- package/build/browser/observable/LinkPayload.js.map +1 -0
- package/build/browser/observable/ObjectPayload.js.map +1 -1
- package/build/browser/observable/ObservableClient/ObserveLink.js +17 -0
- package/build/browser/observable/ObservableClient/ObserveLink.js.map +1 -0
- package/build/browser/observable/ObservableClient/common.js +2 -0
- package/build/browser/observable/ObservableClient/common.js.map +1 -0
- package/build/browser/observable/ObservableClient.js +20 -0
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/Unsubscribable.js +2 -0
- package/build/browser/observable/Unsubscribable.js.map +1 -0
- package/build/browser/observable/internal/AbstractHelper.js +50 -0
- package/build/browser/observable/internal/AbstractHelper.js.map +1 -0
- package/build/browser/observable/internal/BaseCollectionQuery.js +2 -0
- package/build/browser/observable/internal/BaseCollectionQuery.js.map +1 -0
- package/build/browser/observable/internal/BulkObjectLoader.js +3 -3
- package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/browser/observable/internal/CacheKeys.js +17 -2
- package/build/browser/observable/internal/CacheKeys.js.map +1 -1
- package/build/browser/observable/internal/Changes.js +6 -0
- package/build/browser/observable/internal/Changes.js.map +1 -1
- package/build/browser/observable/internal/KnownCacheKey.js +2 -0
- package/build/browser/observable/internal/KnownCacheKey.js.map +1 -0
- package/build/browser/observable/internal/Layer.js.map +1 -1
- package/build/browser/observable/internal/ListCacheKey.js +2 -0
- package/build/browser/observable/internal/ListCacheKey.js.map +1 -0
- package/build/browser/observable/internal/ListQuery.js +399 -161
- package/build/browser/observable/internal/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/ObjectQuery.js +27 -2
- package/build/browser/observable/internal/ObjectQuery.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js +42 -2
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/OptimisticJob.js +12 -3
- package/build/browser/observable/internal/OptimisticJob.js.map +1 -1
- package/build/browser/observable/internal/Query.js +17 -3
- package/build/browser/observable/internal/Query.js.map +1 -1
- package/build/browser/observable/internal/QuerySubscription.js +41 -0
- package/build/browser/observable/internal/QuerySubscription.js.map +1 -0
- package/build/browser/observable/internal/Store.invalidation.test.js +481 -0
- package/build/browser/observable/internal/Store.invalidation.test.js.map +1 -0
- package/build/browser/observable/internal/Store.js +38 -91
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +318 -63
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/UnsubscribableWrapper.js +30 -0
- package/build/browser/observable/internal/UnsubscribableWrapper.js.map +1 -0
- package/build/browser/observable/internal/createCollectionConnectable.js +50 -0
- package/build/browser/observable/internal/createCollectionConnectable.js.map +1 -0
- package/build/browser/observable/internal/createCollectionConnectable.test.js +599 -0
- package/build/browser/observable/internal/createCollectionConnectable.test.js.map +1 -0
- package/build/browser/observable/internal/getObjectTypesThatInvalidate.js +216 -0
- package/build/browser/observable/internal/getObjectTypesThatInvalidate.js.map +1 -0
- package/build/browser/observable/internal/getObjectTypesThatInvalidate.test.js +382 -0
- package/build/browser/observable/internal/getObjectTypesThatInvalidate.test.js.map +1 -0
- package/build/browser/observable/internal/isObjectInstance.js +23 -0
- package/build/browser/observable/internal/isObjectInstance.js.map +1 -0
- package/build/browser/observable/internal/links/LinksHelper.js +37 -0
- package/build/browser/observable/internal/links/LinksHelper.js.map +1 -0
- package/build/browser/observable/internal/links/SpecificLinkCacheKey.js +2 -0
- package/build/browser/observable/internal/links/SpecificLinkCacheKey.js.map +1 -0
- package/build/browser/observable/internal/links/SpecificLinkQuery.js +185 -0
- package/build/browser/observable/internal/links/SpecificLinkQuery.js.map +1 -0
- package/build/browser/observable/internal/list/ListsHelper.js +49 -0
- package/build/browser/observable/internal/list/ListsHelper.js.map +1 -0
- package/build/browser/observable/internal/object/ObjectsHelper.js +34 -0
- package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -0
- package/build/browser/observable/internal/removeDuplicates.js +36 -0
- package/build/browser/observable/internal/removeDuplicates.js.map +1 -0
- package/build/browser/observable/internal/sorting/SortingStrategy.js +78 -0
- package/build/browser/observable/internal/sorting/SortingStrategy.js.map +1 -0
- package/build/browser/observable/internal/testUtils/invalidateList.js +23 -0
- package/build/browser/observable/internal/testUtils/invalidateList.js.map +1 -0
- package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +69 -0
- package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -0
- package/build/browser/observable/internal/testUtils/observeObject/expectStandardObserveObject.js +56 -0
- package/build/browser/observable/internal/testUtils/observeObject/expectStandardObserveObject.js.map +1 -0
- package/build/browser/observable/internal/testUtils.js +70 -7
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/browser/util/streamutils.js +1 -1
- package/build/browser/util/streamutils.js.map +1 -1
- package/build/cjs/{chunk-URDXPIRU.cjs → chunk-AOGMSVFN.cjs} +61 -54
- package/build/cjs/chunk-AOGMSVFN.cjs.map +1 -0
- package/build/cjs/{chunk-BJYCRD5Y.cjs → chunk-BL56QBYG.cjs} +44 -19
- package/build/cjs/chunk-BL56QBYG.cjs.map +1 -0
- package/build/cjs/index.cjs +7 -7
- package/build/cjs/public/internal.cjs +8 -8
- package/build/cjs/public/unstable-do-not-use.cjs +779 -268
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +161 -12
- package/build/esm/Client.js +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/createClient.js +4 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +11 -0
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/intellisense.test.helpers/orderBySuggestionIsRight.js +8 -1
- package/build/esm/intellisense.test.helpers/orderBySuggestionIsRight.js.map +1 -1
- package/build/esm/intellisense.test.js +14 -4
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/object/Cache.js +1 -1
- package/build/esm/object/Cache.js.map +1 -1
- package/build/esm/object/SimpleCache.js +1 -1
- package/build/esm/object/SimpleCache.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +4 -0
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +12 -0
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +30 -4
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/geotimeseriesreference.test.js +0 -2
- package/build/esm/object/geotimeseriesreference.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +6 -0
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +3 -1
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/observable/LinkPayload.js +2 -0
- package/build/esm/observable/LinkPayload.js.map +1 -0
- package/build/esm/observable/ObjectPayload.js.map +1 -1
- package/build/esm/observable/ObservableClient/ObserveLink.js +17 -0
- package/build/esm/observable/ObservableClient/ObserveLink.js.map +1 -0
- package/build/esm/observable/ObservableClient/common.js +2 -0
- package/build/esm/observable/ObservableClient/common.js.map +1 -0
- package/build/esm/observable/ObservableClient.js +20 -0
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/Unsubscribable.js +2 -0
- package/build/esm/observable/Unsubscribable.js.map +1 -0
- package/build/esm/observable/internal/AbstractHelper.js +50 -0
- package/build/esm/observable/internal/AbstractHelper.js.map +1 -0
- package/build/esm/observable/internal/BaseCollectionQuery.js +2 -0
- package/build/esm/observable/internal/BaseCollectionQuery.js.map +1 -0
- package/build/esm/observable/internal/BulkObjectLoader.js +3 -3
- package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
- package/build/esm/observable/internal/CacheKeys.js +17 -2
- package/build/esm/observable/internal/CacheKeys.js.map +1 -1
- package/build/esm/observable/internal/Changes.js +6 -0
- package/build/esm/observable/internal/Changes.js.map +1 -1
- package/build/esm/observable/internal/KnownCacheKey.js +2 -0
- package/build/esm/observable/internal/KnownCacheKey.js.map +1 -0
- package/build/esm/observable/internal/Layer.js.map +1 -1
- package/build/esm/observable/internal/ListCacheKey.js +2 -0
- package/build/esm/observable/internal/ListCacheKey.js.map +1 -0
- package/build/esm/observable/internal/ListQuery.js +399 -161
- package/build/esm/observable/internal/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/ObjectQuery.js +27 -2
- package/build/esm/observable/internal/ObjectQuery.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js +42 -2
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/OptimisticJob.js +12 -3
- package/build/esm/observable/internal/OptimisticJob.js.map +1 -1
- package/build/esm/observable/internal/Query.js +17 -3
- package/build/esm/observable/internal/Query.js.map +1 -1
- package/build/esm/observable/internal/QuerySubscription.js +41 -0
- package/build/esm/observable/internal/QuerySubscription.js.map +1 -0
- package/build/esm/observable/internal/Store.invalidation.test.js +481 -0
- package/build/esm/observable/internal/Store.invalidation.test.js.map +1 -0
- package/build/esm/observable/internal/Store.js +38 -91
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +318 -63
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/UnsubscribableWrapper.js +30 -0
- package/build/esm/observable/internal/UnsubscribableWrapper.js.map +1 -0
- package/build/esm/observable/internal/createCollectionConnectable.js +50 -0
- package/build/esm/observable/internal/createCollectionConnectable.js.map +1 -0
- package/build/esm/observable/internal/createCollectionConnectable.test.js +599 -0
- package/build/esm/observable/internal/createCollectionConnectable.test.js.map +1 -0
- package/build/esm/observable/internal/getObjectTypesThatInvalidate.js +216 -0
- package/build/esm/observable/internal/getObjectTypesThatInvalidate.js.map +1 -0
- package/build/esm/observable/internal/getObjectTypesThatInvalidate.test.js +382 -0
- package/build/esm/observable/internal/getObjectTypesThatInvalidate.test.js.map +1 -0
- package/build/esm/observable/internal/isObjectInstance.js +23 -0
- package/build/esm/observable/internal/isObjectInstance.js.map +1 -0
- package/build/esm/observable/internal/links/LinksHelper.js +37 -0
- package/build/esm/observable/internal/links/LinksHelper.js.map +1 -0
- package/build/esm/observable/internal/links/SpecificLinkCacheKey.js +2 -0
- package/build/esm/observable/internal/links/SpecificLinkCacheKey.js.map +1 -0
- package/build/esm/observable/internal/links/SpecificLinkQuery.js +185 -0
- package/build/esm/observable/internal/links/SpecificLinkQuery.js.map +1 -0
- package/build/esm/observable/internal/list/ListsHelper.js +49 -0
- package/build/esm/observable/internal/list/ListsHelper.js.map +1 -0
- package/build/esm/observable/internal/object/ObjectsHelper.js +34 -0
- package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -0
- package/build/esm/observable/internal/removeDuplicates.js +36 -0
- package/build/esm/observable/internal/removeDuplicates.js.map +1 -0
- package/build/esm/observable/internal/sorting/SortingStrategy.js +78 -0
- package/build/esm/observable/internal/sorting/SortingStrategy.js.map +1 -0
- package/build/esm/observable/internal/testUtils/invalidateList.js +23 -0
- package/build/esm/observable/internal/testUtils/invalidateList.js.map +1 -0
- package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +69 -0
- package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -0
- package/build/esm/observable/internal/testUtils/observeObject/expectStandardObserveObject.js +56 -0
- package/build/esm/observable/internal/testUtils/observeObject/expectStandardObserveObject.js.map +1 -0
- package/build/esm/observable/internal/testUtils.js +70 -7
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/esm/util/streamutils.js +1 -1
- package/build/esm/util/streamutils.js.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/object/fetchPage.d.ts.map +1 -1
- package/build/types/observable/LinkPayload.d.ts +9 -0
- package/build/types/observable/LinkPayload.d.ts.map +1 -0
- package/build/types/observable/ObjectPayload.d.ts +4 -0
- package/build/types/observable/ObjectPayload.d.ts.map +1 -1
- package/build/types/observable/ObservableClient/ObserveLink.d.ts +32 -0
- package/build/types/observable/ObservableClient/ObserveLink.d.ts.map +1 -0
- package/build/types/observable/ObservableClient/common.d.ts +67 -0
- package/build/types/observable/ObservableClient/common.d.ts.map +1 -0
- package/build/types/observable/ObservableClient.d.ts +82 -15
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/Unsubscribable.d.ts +3 -0
- package/build/types/observable/Unsubscribable.d.ts.map +1 -0
- package/build/types/observable/internal/AbstractHelper.d.ts +15 -0
- package/build/types/observable/internal/AbstractHelper.d.ts.map +1 -0
- package/build/types/observable/internal/BaseCollectionQuery.d.ts +64 -0
- package/build/types/observable/internal/BaseCollectionQuery.d.ts.map +1 -0
- package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
- package/build/types/observable/internal/CacheKeys.d.ts +10 -4
- package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
- package/build/types/observable/internal/Changes.d.ts +7 -4
- package/build/types/observable/internal/Changes.d.ts.map +1 -1
- package/build/types/observable/internal/KnownCacheKey.d.ts +4 -0
- package/build/types/observable/internal/KnownCacheKey.d.ts.map +1 -0
- package/build/types/observable/internal/Layer.d.ts +7 -7
- package/build/types/observable/internal/Layer.d.ts.map +1 -1
- package/build/types/observable/internal/ListCacheKey.d.ts +7 -0
- package/build/types/observable/internal/ListCacheKey.d.ts.map +1 -0
- package/build/types/observable/internal/ListQuery.d.ts +160 -21
- package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/ObjectQuery.d.ts +3 -1
- package/build/types/observable/internal/ObjectQuery.d.ts.map +1 -1
- package/build/types/observable/internal/OptimisticJob.d.ts.map +1 -1
- package/build/types/observable/internal/Query.d.ts +6 -5
- package/build/types/observable/internal/Query.d.ts.map +1 -1
- package/build/types/observable/internal/QuerySubscription.d.ts +1 -0
- package/build/types/observable/internal/QuerySubscription.d.ts.map +1 -0
- package/build/types/observable/internal/Store.d.ts +34 -31
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/Store.invalidation.test.d.ts +1 -0
- package/build/types/observable/internal/Store.invalidation.test.d.ts.map +1 -0
- package/build/types/observable/internal/Store.test.d.ts +4 -1
- package/build/types/observable/internal/Store.test.d.ts.map +1 -1
- package/build/types/observable/internal/UnsubscribableWrapper.d.ts +1 -0
- package/build/types/observable/internal/UnsubscribableWrapper.d.ts.map +1 -0
- package/build/types/observable/internal/createCollectionConnectable.d.ts +38 -0
- package/build/types/observable/internal/createCollectionConnectable.d.ts.map +1 -0
- package/build/types/observable/internal/createCollectionConnectable.test.d.ts +1 -0
- package/build/types/observable/internal/createCollectionConnectable.test.d.ts.map +1 -0
- package/build/types/observable/internal/getObjectTypesThatInvalidate.d.ts +9 -0
- package/build/types/observable/internal/getObjectTypesThatInvalidate.d.ts.map +1 -0
- package/build/types/observable/internal/getObjectTypesThatInvalidate.test.d.ts +1 -0
- package/build/types/observable/internal/getObjectTypesThatInvalidate.test.d.ts.map +1 -0
- package/build/types/observable/internal/isObjectInstance.d.ts +5 -0
- package/build/types/observable/internal/isObjectInstance.d.ts.map +1 -0
- package/build/types/observable/internal/links/LinksHelper.d.ts +29 -0
- package/build/types/observable/internal/links/LinksHelper.d.ts.map +1 -0
- package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts +17 -0
- package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts.map +1 -0
- package/build/types/observable/internal/links/SpecificLinkQuery.d.ts +45 -0
- package/build/types/observable/internal/links/SpecificLinkQuery.d.ts.map +1 -0
- package/build/types/observable/internal/list/ListsHelper.d.ts +17 -0
- package/build/types/observable/internal/list/ListsHelper.d.ts.map +1 -0
- package/build/types/observable/internal/object/ObjectsHelper.d.ts +11 -0
- package/build/types/observable/internal/object/ObjectsHelper.d.ts.map +1 -0
- package/build/types/observable/internal/removeDuplicates.d.ts +11 -0
- package/build/types/observable/internal/removeDuplicates.d.ts.map +1 -0
- package/build/types/observable/internal/sorting/SortingStrategy.d.ts +41 -0
- package/build/types/observable/internal/sorting/SortingStrategy.d.ts.map +1 -0
- package/build/types/observable/internal/testUtils/invalidateList.d.ts +9 -0
- package/build/types/observable/internal/testUtils/invalidateList.d.ts.map +1 -0
- package/build/types/observable/internal/testUtils/observeLink/expectStandardObserveLink.d.ts +46 -0
- package/build/types/observable/internal/testUtils/observeLink/expectStandardObserveLink.d.ts.map +1 -0
- package/build/types/observable/internal/testUtils/observeObject/expectStandardObserveObject.d.ts +26 -0
- package/build/types/observable/internal/testUtils/observeObject/expectStandardObserveObject.d.ts.map +1 -0
- package/build/types/observable/internal/testUtils.d.ts +25 -3
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/public/unstable-do-not-use.d.ts +4 -2
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/package.json +10 -10
- package/build/cjs/chunk-BJYCRD5Y.cjs.map +0 -1
- package/build/cjs/chunk-URDXPIRU.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkAOGMSVFN_cjs = require('../chunk-AOGMSVFN.cjs');
|
|
4
|
+
var chunkBL56QBYG_cjs = require('../chunk-BL56QBYG.cjs');
|
|
5
5
|
require('../chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var shared_net_fetch = require('@osdk/shared.net.fetch');
|
|
7
7
|
var rxjs = require('rxjs');
|
|
@@ -18,16 +18,64 @@ var invariant2__default = /*#__PURE__*/_interopDefault(invariant2);
|
|
|
18
18
|
var deepEqual2__default = /*#__PURE__*/_interopDefault(deepEqual2);
|
|
19
19
|
var groupBy__default = /*#__PURE__*/_interopDefault(groupBy);
|
|
20
20
|
|
|
21
|
+
// src/observable/internal/UnsubscribableWrapper.ts
|
|
22
|
+
var UnsubscribableWrapper = class {
|
|
23
|
+
#subscription;
|
|
24
|
+
constructor(subscription) {
|
|
25
|
+
this.#subscription = subscription;
|
|
26
|
+
}
|
|
27
|
+
unsubscribe() {
|
|
28
|
+
this.#subscription?.unsubscribe();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
21
32
|
// src/observable/internal/ObservableClientImpl.ts
|
|
22
33
|
var ObservableClientImpl = class {
|
|
23
34
|
constructor(store) {
|
|
24
35
|
this.__experimentalStore = store;
|
|
25
|
-
this.observeObject = store.observeObject.bind(store);
|
|
26
|
-
this.observeList = store.observeList.bind(store);
|
|
27
36
|
this.applyAction = store.applyAction.bind(store);
|
|
28
37
|
this.validateAction = store.validateAction.bind(store);
|
|
29
38
|
this.canonicalizeWhereClause = store.canonicalizeWhereClause.bind(store);
|
|
30
39
|
}
|
|
40
|
+
observeObject = (apiName, pk, options, subFn) => {
|
|
41
|
+
return this.__experimentalStore.objects.observe(
|
|
42
|
+
{
|
|
43
|
+
...options,
|
|
44
|
+
apiName,
|
|
45
|
+
pk
|
|
46
|
+
},
|
|
47
|
+
// cast to cross typed to untyped barrier
|
|
48
|
+
subFn
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
observeList = (options, subFn) => {
|
|
52
|
+
return this.__experimentalStore.lists.observe(
|
|
53
|
+
options,
|
|
54
|
+
// cast to cross typed to untyped barrier
|
|
55
|
+
subFn
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
observeLinks = (objects, linkName, options, subFn) => {
|
|
59
|
+
const objectsArray = Array.isArray(objects) ? objects : [objects];
|
|
60
|
+
const parentSub = new rxjs.Subscription();
|
|
61
|
+
for (const obj of objectsArray) {
|
|
62
|
+
const querySubscription = this.__experimentalStore.links.observe(
|
|
63
|
+
{
|
|
64
|
+
...options,
|
|
65
|
+
srcType: {
|
|
66
|
+
type: "object",
|
|
67
|
+
apiName: obj.$apiName
|
|
68
|
+
},
|
|
69
|
+
linkName,
|
|
70
|
+
pk: obj.$primaryKey
|
|
71
|
+
},
|
|
72
|
+
// cast to cross typed to untyped barrier
|
|
73
|
+
subFn
|
|
74
|
+
);
|
|
75
|
+
parentSub.add(querySubscription);
|
|
76
|
+
}
|
|
77
|
+
return new UnsubscribableWrapper(parentSub);
|
|
78
|
+
};
|
|
31
79
|
};
|
|
32
80
|
|
|
33
81
|
// src/observable/DebugFlags.ts
|
|
@@ -64,16 +112,25 @@ var OptimisticJob = class {
|
|
|
64
112
|
}, (batch) => {
|
|
65
113
|
for (const obj of addedObjects) {
|
|
66
114
|
if (obj.status === "fulfilled") {
|
|
67
|
-
store.
|
|
115
|
+
store.objects.getQuery({
|
|
116
|
+
apiName: obj.value.$objectType,
|
|
117
|
+
pk: obj.value.$primaryKey
|
|
118
|
+
}).writeToStore(obj.value, "loading", batch);
|
|
68
119
|
} else {
|
|
69
120
|
throw obj;
|
|
70
121
|
}
|
|
71
122
|
}
|
|
72
123
|
for (const obj of updatedObjects) {
|
|
73
|
-
store.
|
|
124
|
+
store.objects.getQuery({
|
|
125
|
+
apiName: obj.$objectType,
|
|
126
|
+
pk: obj.$primaryKey
|
|
127
|
+
}).writeToStore(obj, "loading", batch);
|
|
74
128
|
}
|
|
75
129
|
for (const obj of deletedObjects) {
|
|
76
|
-
store.
|
|
130
|
+
store.objects.getQuery({
|
|
131
|
+
apiName: obj.$objectType,
|
|
132
|
+
pk: obj.$primaryKey
|
|
133
|
+
}).deleteFromStore("loading", batch);
|
|
77
134
|
}
|
|
78
135
|
});
|
|
79
136
|
return batchResult.changes;
|
|
@@ -85,7 +142,7 @@ var OptimisticJob = class {
|
|
|
85
142
|
return this;
|
|
86
143
|
},
|
|
87
144
|
createObject(type, pk, properties) {
|
|
88
|
-
const create = store.client[
|
|
145
|
+
const create = store.client[chunkBL56QBYG_cjs.additionalContext].objectFactory2(store.client[chunkBL56QBYG_cjs.additionalContext], [{
|
|
89
146
|
$primaryKey: pk,
|
|
90
147
|
$apiName: type.apiName,
|
|
91
148
|
$objectType: type.apiName,
|
|
@@ -221,8 +278,14 @@ var CacheKeys = class {
|
|
|
221
278
|
return this.#cacheKeys.lookupArray(["object", apiName, pk]);
|
|
222
279
|
});
|
|
223
280
|
this.#registerCacheKeyFactory("list", (type, apiName, where, orderBy) => {
|
|
281
|
+
const cacheKeyArgs = ["list", type, apiName, whereCanonicalizer.canonicalize(where), orderByCanonicalizer.canonicalize(orderBy)];
|
|
224
282
|
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS) ;
|
|
225
|
-
return this.#cacheKeys.lookupArray(
|
|
283
|
+
return this.#cacheKeys.lookupArray(cacheKeyArgs);
|
|
284
|
+
});
|
|
285
|
+
this.#registerCacheKeyFactory("specificLink", (sourceObjectType, sourcePk, linkName, where, orderBy) => {
|
|
286
|
+
const cacheKeyArgs = ["specificLink", sourceObjectType, sourcePk, linkName, whereCanonicalizer.canonicalize(where), orderByCanonicalizer.canonicalize(orderBy)];
|
|
287
|
+
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS) ;
|
|
288
|
+
return this.#cacheKeys.lookupArray(cacheKeyArgs);
|
|
226
289
|
});
|
|
227
290
|
}
|
|
228
291
|
#registerCacheKeyFactory(type, factory) {
|
|
@@ -271,6 +334,12 @@ var Changes = class {
|
|
|
271
334
|
registerList = (key) => {
|
|
272
335
|
this.modified.add(key);
|
|
273
336
|
};
|
|
337
|
+
registerLink = (cacheKey) => {
|
|
338
|
+
this.modified.add(cacheKey);
|
|
339
|
+
};
|
|
340
|
+
deleteLink = (cacheKey) => {
|
|
341
|
+
this.deleted.add(cacheKey);
|
|
342
|
+
};
|
|
274
343
|
isEmpty() {
|
|
275
344
|
return this.modifiedObjects.size === 0 && this.addedObjects.size === 0 && this.added.size === 0 && this.modified.size === 0 && this.deleted.size === 0;
|
|
276
345
|
}
|
|
@@ -454,6 +523,78 @@ var Entry = class {
|
|
|
454
523
|
this.status = status;
|
|
455
524
|
}
|
|
456
525
|
};
|
|
526
|
+
|
|
527
|
+
// src/observable/internal/QuerySubscription.ts
|
|
528
|
+
var QuerySubscription = class extends UnsubscribableWrapper {
|
|
529
|
+
/** @internal */
|
|
530
|
+
/** @internal */
|
|
531
|
+
constructor(query, subscription) {
|
|
532
|
+
super(subscription);
|
|
533
|
+
this.query = query;
|
|
534
|
+
this.subscription = subscription;
|
|
535
|
+
Object.defineProperties(this, {
|
|
536
|
+
query: {
|
|
537
|
+
enumerable: false
|
|
538
|
+
},
|
|
539
|
+
subscription: {
|
|
540
|
+
enumerable: false
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
// src/observable/internal/AbstractHelper.ts
|
|
547
|
+
var AbstractHelper = class {
|
|
548
|
+
constructor(store) {
|
|
549
|
+
this.store = store;
|
|
550
|
+
}
|
|
551
|
+
observe(options, subFn) {
|
|
552
|
+
const query = this.getQuery(options);
|
|
553
|
+
return this._subscribe(query, options, subFn);
|
|
554
|
+
}
|
|
555
|
+
_subscribe(query, options, subFn) {
|
|
556
|
+
this.store.retain(query.cacheKey);
|
|
557
|
+
if (options.mode !== "offline") {
|
|
558
|
+
query.revalidate(options.mode === "force").catch((e) => {
|
|
559
|
+
subFn.error(e);
|
|
560
|
+
if (this.store.logger) {
|
|
561
|
+
this.store.logger.error("Unhandled error in observeObject", e);
|
|
562
|
+
} else {
|
|
563
|
+
throw e;
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
const sub = query.subscribe(subFn);
|
|
568
|
+
sub.add(() => {
|
|
569
|
+
this.store.release(query.cacheKey);
|
|
570
|
+
});
|
|
571
|
+
return new QuerySubscription(query, sub);
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
function createCollectionConnectable(subject, store, createPayload) {
|
|
575
|
+
return rxjs.connectable(subject.pipe(rxjs.switchMap((listEntry) => {
|
|
576
|
+
const resolvedData = listEntry?.value?.data == null || listEntry.value.data.length === 0 ? rxjs.of([]) : rxjs.combineLatest(listEntry.value.data.map((cacheKey) => store.getSubject(cacheKey).pipe(rxjs.map((objectEntry) => objectEntry?.value), rxjs.distinctUntilChanged())));
|
|
577
|
+
return rxjs.scheduled(rxjs.combineLatest({
|
|
578
|
+
resolvedData,
|
|
579
|
+
isOptimistic: rxjs.of(listEntry.isOptimistic),
|
|
580
|
+
status: rxjs.of(listEntry.status),
|
|
581
|
+
lastUpdated: rxjs.of(listEntry.lastUpdated)
|
|
582
|
+
}).pipe(rxjs.map((params) => createPayload({
|
|
583
|
+
resolvedData: Array.isArray(params.resolvedData) ? params.resolvedData : [],
|
|
584
|
+
isOptimistic: params.isOptimistic,
|
|
585
|
+
status: params.status,
|
|
586
|
+
lastUpdated: params.lastUpdated
|
|
587
|
+
}))), rxjs.asapScheduler);
|
|
588
|
+
})), {
|
|
589
|
+
resetOnDisconnect: false,
|
|
590
|
+
connector: () => new rxjs.ReplaySubject(1)
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// src/observable/internal/isObjectInstance.ts
|
|
595
|
+
function isObjectInstance(item) {
|
|
596
|
+
return item != null && typeof item === "object" && "$primaryKey" in item;
|
|
597
|
+
}
|
|
457
598
|
function is$and(whereClause) {
|
|
458
599
|
if (process.env.NODE_ENV !== "production") {
|
|
459
600
|
if ("$and" in whereClause) {
|
|
@@ -566,11 +707,11 @@ var BulkObjectLoader = class {
|
|
|
566
707
|
#maxEntries;
|
|
567
708
|
constructor(client, maxWait = 25, maxEntries = 100) {
|
|
568
709
|
this.#client = client;
|
|
569
|
-
this.#logger = client[
|
|
710
|
+
this.#logger = client[chunkBL56QBYG_cjs.additionalContext].logger;
|
|
570
711
|
this.#maxWait = maxWait;
|
|
571
712
|
this.#maxEntries = maxEntries;
|
|
572
713
|
}
|
|
573
|
-
fetch(apiName, primaryKey) {
|
|
714
|
+
async fetch(apiName, primaryKey) {
|
|
574
715
|
const deferred = pDefer();
|
|
575
716
|
const entry = this.#m.get(apiName);
|
|
576
717
|
entry.data.push({
|
|
@@ -586,7 +727,7 @@ var BulkObjectLoader = class {
|
|
|
586
727
|
clearTimeout(entry.timer);
|
|
587
728
|
this.#loadObjects(apiName, entry.data);
|
|
588
729
|
}
|
|
589
|
-
return deferred.promise;
|
|
730
|
+
return await deferred.promise;
|
|
590
731
|
}
|
|
591
732
|
#loadObjects(apiName, arr) {
|
|
592
733
|
this.#m.delete(apiName);
|
|
@@ -618,7 +759,7 @@ var BulkObjectLoader = class {
|
|
|
618
759
|
if (object) {
|
|
619
760
|
deferred.resolve(object);
|
|
620
761
|
} else {
|
|
621
|
-
deferred.reject(new shared_net_errors.PalantirApiError(
|
|
762
|
+
deferred.reject(new shared_net_errors.PalantirApiError(`Object not found: ${primaryKey}`));
|
|
622
763
|
}
|
|
623
764
|
}
|
|
624
765
|
}
|
|
@@ -636,7 +777,7 @@ var Query = class {
|
|
|
636
777
|
this.cacheKey = cacheKey;
|
|
637
778
|
this.store = store;
|
|
638
779
|
this.#subject = observable;
|
|
639
|
-
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[
|
|
780
|
+
this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkBL56QBYG_cjs.additionalContext].logger : store.client[chunkBL56QBYG_cjs.additionalContext].logger?.child({}, {
|
|
640
781
|
msgPrefix: process.env.NODE_ENV !== "production" ? `Query<${cacheKey.type}, ${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>` : "Query"
|
|
641
782
|
}));
|
|
642
783
|
}
|
|
@@ -685,7 +826,7 @@ var Query = class {
|
|
|
685
826
|
logger?.debug("calling _fetchAndStore()");
|
|
686
827
|
}
|
|
687
828
|
this.pendingFetch = this._fetchAndStore().finally(() => {
|
|
688
|
-
logger?.debug("finally _fetchAndStore()");
|
|
829
|
+
logger?.debug("promise's finally for _fetchAndStore()");
|
|
689
830
|
this.pendingFetch = void 0;
|
|
690
831
|
});
|
|
691
832
|
await this.pendingFetch;
|
|
@@ -704,10 +845,22 @@ var Query = class {
|
|
|
704
845
|
if (process.env.NODE_ENV !== "production") {
|
|
705
846
|
this.logger?.child({
|
|
706
847
|
methodName: "setStatus"
|
|
707
|
-
}).debug(status);
|
|
848
|
+
}).debug(`Attempting to set status to '${status}'`);
|
|
708
849
|
}
|
|
709
850
|
const existing = batch.read(this.cacheKey);
|
|
710
|
-
if (existing?.status === status)
|
|
851
|
+
if (existing?.status === status) {
|
|
852
|
+
if (process.env.NODE_ENV !== "production") {
|
|
853
|
+
this.logger?.child({
|
|
854
|
+
methodName: "setStatus"
|
|
855
|
+
}).debug(`Status is already set to '${status}'; aborting`);
|
|
856
|
+
}
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
if (process.env.NODE_ENV !== "production") {
|
|
860
|
+
this.logger?.child({
|
|
861
|
+
methodName: "setStatus"
|
|
862
|
+
}).debug(`Writing status '${status}' to cache`);
|
|
863
|
+
}
|
|
711
864
|
batch.write(this.cacheKey, existing?.value, status);
|
|
712
865
|
}
|
|
713
866
|
dispose() {
|
|
@@ -746,7 +899,7 @@ var ObjectQuery = class extends Query {
|
|
|
746
899
|
#apiName;
|
|
747
900
|
#pk;
|
|
748
901
|
constructor(store, subject, type, pk, cacheKey, opts) {
|
|
749
|
-
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[
|
|
902
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkBL56QBYG_cjs.additionalContext].logger?.child({}, {
|
|
750
903
|
msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
751
904
|
}) : void 0);
|
|
752
905
|
this.#apiName = type;
|
|
@@ -783,10 +936,18 @@ var ObjectQuery = class extends Query {
|
|
|
783
936
|
writeToStore(data, status, batch) {
|
|
784
937
|
const entry = batch.read(this.cacheKey);
|
|
785
938
|
if (entry && deepEqual2__default.default(data, entry.value)) {
|
|
939
|
+
if (entry.status === status) {
|
|
940
|
+
if (process.env.NODE_ENV !== "production") {
|
|
941
|
+
this.logger?.child({
|
|
942
|
+
methodName: "writeToStore"
|
|
943
|
+
}).debug(`Object was deep equal and status unchanged (${status}), skipping update`);
|
|
944
|
+
}
|
|
945
|
+
return entry;
|
|
946
|
+
}
|
|
786
947
|
if (process.env.NODE_ENV !== "production") {
|
|
787
948
|
this.logger?.child({
|
|
788
949
|
methodName: "writeToStore"
|
|
789
|
-
}).debug(`Object was deep equal, just setting status`);
|
|
950
|
+
}).debug(`Object was deep equal, just setting status (old status: ${entry.status}, new status: ${status})`);
|
|
790
951
|
}
|
|
791
952
|
return batch.write(this.cacheKey, entry.value, status);
|
|
792
953
|
}
|
|
@@ -830,38 +991,127 @@ var ObjectQuery = class extends Query {
|
|
|
830
991
|
batch.changes.deleteObject(this.cacheKey);
|
|
831
992
|
return ret;
|
|
832
993
|
}
|
|
994
|
+
invalidateObjectType = (objectType, changes) => {
|
|
995
|
+
if (this.#apiName === objectType) {
|
|
996
|
+
changes?.modified.add(this.cacheKey);
|
|
997
|
+
return this.revalidate(true);
|
|
998
|
+
}
|
|
999
|
+
return Promise.resolve();
|
|
1000
|
+
};
|
|
833
1001
|
};
|
|
834
1002
|
function storeOsdkInstances(store, values, batch) {
|
|
835
1003
|
return values.map((v) => {
|
|
836
|
-
return store.
|
|
1004
|
+
return store.objects.getQuery({
|
|
1005
|
+
apiName: v.$apiName,
|
|
1006
|
+
pk: v.$primaryKey
|
|
1007
|
+
}).writeToStore(v, "loaded", batch).cacheKey;
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// src/observable/internal/removeDuplicates.ts
|
|
1012
|
+
function removeDuplicates(objectCacheKeys, batch) {
|
|
1013
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1014
|
+
return objectCacheKeys.filter((key) => {
|
|
1015
|
+
batch.read(key);
|
|
1016
|
+
if (visited.has(key)) {
|
|
1017
|
+
return false;
|
|
1018
|
+
}
|
|
1019
|
+
visited.add(key);
|
|
1020
|
+
return true;
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// src/observable/internal/sorting/SortingStrategy.ts
|
|
1025
|
+
var NoOpSortingStrategy = class {
|
|
1026
|
+
sortCacheKeys(objectCacheKeys, _batch) {
|
|
1027
|
+
return objectCacheKeys;
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
var OrderBySortingStrategy = class {
|
|
1031
|
+
constructor(apiName, orderBy) {
|
|
1032
|
+
this.apiName = apiName;
|
|
1033
|
+
this.orderBy = orderBy;
|
|
1034
|
+
this.sortFns = createOrderBySortFns(orderBy);
|
|
1035
|
+
}
|
|
1036
|
+
sortCacheKeys(objectCacheKeys, batch) {
|
|
1037
|
+
if (Object.keys(this.orderBy).length === 0) {
|
|
1038
|
+
return objectCacheKeys;
|
|
1039
|
+
}
|
|
1040
|
+
return objectCacheKeys.sort((a, b) => {
|
|
1041
|
+
for (const sortFn of this.sortFns) {
|
|
1042
|
+
const ret = sortFn(batch.read(a)?.value?.$as(this.apiName), batch.read(b)?.value?.$as(this.apiName));
|
|
1043
|
+
if (ret !== 0) {
|
|
1044
|
+
return ret;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
return 0;
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
function createOrderBySortFns(orderBy) {
|
|
1052
|
+
return Object.entries(orderBy).map(([key, order]) => {
|
|
1053
|
+
return (a, b) => {
|
|
1054
|
+
const aValue = a?.[key];
|
|
1055
|
+
const bValue = b?.[key];
|
|
1056
|
+
if (aValue == null && bValue == null) {
|
|
1057
|
+
return 0;
|
|
1058
|
+
}
|
|
1059
|
+
if (aValue == null) {
|
|
1060
|
+
return 1;
|
|
1061
|
+
}
|
|
1062
|
+
if (bValue == null) {
|
|
1063
|
+
return -1;
|
|
1064
|
+
}
|
|
1065
|
+
const m = order === "asc" ? -1 : 1;
|
|
1066
|
+
return aValue < bValue ? m : aValue > bValue ? -m : 0;
|
|
1067
|
+
};
|
|
837
1068
|
});
|
|
838
1069
|
}
|
|
839
1070
|
|
|
840
1071
|
// src/observable/internal/ListQuery.ts
|
|
841
1072
|
var API_NAME_IDX = 1;
|
|
842
1073
|
var BaseListQuery = class extends Query {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1074
|
+
/**
|
|
1075
|
+
* The sorting strategy to use for this collection
|
|
1076
|
+
* @protected
|
|
1077
|
+
*/
|
|
1078
|
+
sortingStrategy = new NoOpSortingStrategy();
|
|
1079
|
+
// Collection-specific behavior is implemented by subclasses
|
|
1080
|
+
/**
|
|
1081
|
+
* Token for the next page of results
|
|
1082
|
+
* @protected
|
|
1083
|
+
*/
|
|
1084
|
+
/**
|
|
1085
|
+
* Promise tracking an in-progress page fetch
|
|
1086
|
+
* @protected
|
|
1087
|
+
*/
|
|
846
1088
|
//
|
|
847
1089
|
// Shared Implementations
|
|
848
1090
|
//
|
|
849
1091
|
/**
|
|
850
|
-
*
|
|
851
|
-
*
|
|
1092
|
+
* Standard method to update a list of objects
|
|
1093
|
+
* Handles common list update patterns for both ListQuery and SpecificLinkQuery
|
|
852
1094
|
*
|
|
853
|
-
* @param
|
|
854
|
-
* @param
|
|
855
|
-
* @param
|
|
856
|
-
* @param
|
|
857
|
-
* @returns
|
|
1095
|
+
* @param items Objects or cache keys to add to the list
|
|
1096
|
+
* @param status Status to set for the list
|
|
1097
|
+
* @param batch Batch context to use
|
|
1098
|
+
* @param append Whether to append to the existing list or replace it
|
|
1099
|
+
* @returns The updated entry
|
|
858
1100
|
*/
|
|
859
|
-
_updateList(
|
|
1101
|
+
_updateList(items, status, batch, append = false) {
|
|
860
1102
|
if (process.env.NODE_ENV !== "production") {
|
|
861
1103
|
const logger = process.env.NODE_ENV !== "production" ? this.logger?.child({
|
|
862
1104
|
methodName: "updateList"
|
|
863
1105
|
}) : this.logger;
|
|
864
|
-
logger?.debug(`{status: ${status}}`, JSON.stringify(
|
|
1106
|
+
logger?.debug(`{status: ${status}, append: ${append}}`, JSON.stringify(items, null, 2));
|
|
1107
|
+
}
|
|
1108
|
+
let objectCacheKeys;
|
|
1109
|
+
if (items.length === 0) {
|
|
1110
|
+
objectCacheKeys = [];
|
|
1111
|
+
} else if (isObjectInstance(items[0])) {
|
|
1112
|
+
objectCacheKeys = this.storeObjects(items, batch);
|
|
1113
|
+
} else {
|
|
1114
|
+
objectCacheKeys = items;
|
|
865
1115
|
}
|
|
866
1116
|
objectCacheKeys = this.#retainReleaseAppend(batch, append, objectCacheKeys);
|
|
867
1117
|
objectCacheKeys = this._sortCacheKeys(objectCacheKeys, batch);
|
|
@@ -870,13 +1120,27 @@ var BaseListQuery = class extends Query {
|
|
|
870
1120
|
data: objectCacheKeys
|
|
871
1121
|
}, status, batch);
|
|
872
1122
|
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Common implementation for writing to store for collection-based queries
|
|
1125
|
+
* @param data The collection data to write to the store
|
|
1126
|
+
* @param status The status to set
|
|
1127
|
+
* @param batch The batch context
|
|
1128
|
+
*/
|
|
873
1129
|
writeToStore(data, status, batch) {
|
|
874
1130
|
const entry = batch.read(this.cacheKey);
|
|
875
1131
|
if (entry && deepEqual2__default.default(data, entry.value)) {
|
|
1132
|
+
if (entry.status === status) {
|
|
1133
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1134
|
+
this.logger?.child({
|
|
1135
|
+
methodName: "writeToStore"
|
|
1136
|
+
}).debug(`Collection data was deep equal and status unchanged (${status}), skipping update`);
|
|
1137
|
+
}
|
|
1138
|
+
return entry;
|
|
1139
|
+
}
|
|
876
1140
|
if (process.env.NODE_ENV !== "production") {
|
|
877
1141
|
this.logger?.child({
|
|
878
1142
|
methodName: "writeToStore"
|
|
879
|
-
}).debug(`
|
|
1143
|
+
}).debug(`Collection data was deep equal, just updating status from ${entry.status} to ${status}`);
|
|
880
1144
|
}
|
|
881
1145
|
return batch.write(this.cacheKey, entry.value, status);
|
|
882
1146
|
}
|
|
@@ -886,9 +1150,33 @@ var BaseListQuery = class extends Query {
|
|
|
886
1150
|
}).debug(`{status: ${status}},`, DEBUG_ONLY__cacheKeysToString(data.data));
|
|
887
1151
|
}
|
|
888
1152
|
const ret = batch.write(this.cacheKey, data, status);
|
|
889
|
-
|
|
1153
|
+
this.registerCacheChanges(batch);
|
|
890
1154
|
return ret;
|
|
891
1155
|
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Register changes to the cache based on the specific collection type
|
|
1158
|
+
* Implemented by subclasses to handle specific change registration
|
|
1159
|
+
*/
|
|
1160
|
+
/**
|
|
1161
|
+
* Common method to store objects in the cache and return their cache keys
|
|
1162
|
+
* Used by collection queries when storing object references
|
|
1163
|
+
*
|
|
1164
|
+
* @param objects Array of objects to store
|
|
1165
|
+
* @param batch The batch context to use
|
|
1166
|
+
* @returns Array of cache keys for the stored objects
|
|
1167
|
+
*/
|
|
1168
|
+
storeObjects(objects, batch) {
|
|
1169
|
+
return objects.length > 0 ? storeOsdkInstances(this.store, objects, batch) : [];
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Common method for managing object reference counting and appending results
|
|
1173
|
+
* Used by collection queries when updating object references
|
|
1174
|
+
*
|
|
1175
|
+
* @param batch The batch context to use
|
|
1176
|
+
* @param append Whether to append to existing objects or replace them
|
|
1177
|
+
* @param objectCacheKeys Array of object cache keys to process
|
|
1178
|
+
* @returns The final array of object cache keys after retain/release/append
|
|
1179
|
+
*/
|
|
892
1180
|
#retainReleaseAppend(batch, append, objectCacheKeys) {
|
|
893
1181
|
const existingList = batch.read(this.cacheKey);
|
|
894
1182
|
if (!batch.optimisticWrite) {
|
|
@@ -917,58 +1205,78 @@ var BaseListQuery = class extends Query {
|
|
|
917
1205
|
}
|
|
918
1206
|
});
|
|
919
1207
|
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
}
|
|
937
|
-
this.#type = apiType;
|
|
938
|
-
this.#apiName = apiName;
|
|
939
|
-
this.#whereClause = whereClause;
|
|
940
|
-
this.#orderBy = orderBy;
|
|
941
|
-
this.#objectSet = store.client({
|
|
942
|
-
type: this.#type,
|
|
943
|
-
apiName: this.#apiName
|
|
944
|
-
}).where(this.#whereClause);
|
|
945
|
-
this.#sortFns = createOrderBySortFns(this.#orderBy);
|
|
946
|
-
}
|
|
947
|
-
get canonicalWhere() {
|
|
948
|
-
return this.#whereClause;
|
|
1208
|
+
/**
|
|
1209
|
+
* Creates a payload from collection parameters
|
|
1210
|
+
* Default implementation that covers common fields for all collection types
|
|
1211
|
+
* Subclasses may override to add type-specific fields if needed
|
|
1212
|
+
*
|
|
1213
|
+
* @param params Common collection parameters
|
|
1214
|
+
* @returns A typed payload for the specific collection type
|
|
1215
|
+
*/
|
|
1216
|
+
createPayload(params) {
|
|
1217
|
+
return {
|
|
1218
|
+
resolvedList: params.resolvedData,
|
|
1219
|
+
isOptimistic: params.isOptimistic,
|
|
1220
|
+
fetchMore: this.fetchMore,
|
|
1221
|
+
hasMore: this.nextPageToken != null,
|
|
1222
|
+
status: params.status,
|
|
1223
|
+
lastUpdated: params.lastUpdated
|
|
1224
|
+
};
|
|
949
1225
|
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Creates a connectable observable for this collection
|
|
1228
|
+
* Common implementation shared by all collection types
|
|
1229
|
+
*
|
|
1230
|
+
* @param subject The subject to connect to
|
|
1231
|
+
* @returns A connectable observable of the collection's payload type
|
|
1232
|
+
*/
|
|
950
1233
|
_createConnectable(subject) {
|
|
951
|
-
return
|
|
952
|
-
rxjs.switchMap((listEntry) => {
|
|
953
|
-
return rxjs.combineLatest({
|
|
954
|
-
resolvedList: listEntry?.value?.data == null || listEntry.value.data.length === 0 ? rxjs.of([]) : rxjs.combineLatest(listEntry.value.data.map((cacheKey) => this.store.getSubject(cacheKey).pipe(rxjs.map((objectEntry) => objectEntry?.value)))),
|
|
955
|
-
isOptimistic: rxjs.of(listEntry.isOptimistic),
|
|
956
|
-
fetchMore: rxjs.of(this.fetchMore),
|
|
957
|
-
hasMore: rxjs.of(this.#nextPageToken != null),
|
|
958
|
-
status: rxjs.of(listEntry.status),
|
|
959
|
-
lastUpdated: rxjs.of(listEntry.lastUpdated)
|
|
960
|
-
});
|
|
961
|
-
}),
|
|
962
|
-
// like throttle but returns the tail
|
|
963
|
-
rxjs.auditTime(0)
|
|
964
|
-
), {
|
|
965
|
-
resetOnDisconnect: false,
|
|
966
|
-
connector: () => new rxjs.ReplaySubject(1)
|
|
967
|
-
});
|
|
1234
|
+
return createCollectionConnectable(subject, this.store, (params) => this.createPayload(params));
|
|
968
1235
|
}
|
|
1236
|
+
/**
|
|
1237
|
+
* @override Reset pagination state before a fetch
|
|
1238
|
+
*/
|
|
969
1239
|
_preFetch() {
|
|
970
|
-
this
|
|
1240
|
+
this.nextPageToken = void 0;
|
|
1241
|
+
super._preFetch();
|
|
971
1242
|
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Common fetchMore implementation for pagination
|
|
1245
|
+
* Handles pending request management and loading states
|
|
1246
|
+
*/
|
|
1247
|
+
fetchMore = () => {
|
|
1248
|
+
if (this.pendingPageFetch) {
|
|
1249
|
+
return this.pendingPageFetch;
|
|
1250
|
+
}
|
|
1251
|
+
if (this.pendingFetch) {
|
|
1252
|
+
this.pendingPageFetch = new Promise(async (res) => {
|
|
1253
|
+
await this.pendingFetch;
|
|
1254
|
+
res(this.fetchMore());
|
|
1255
|
+
});
|
|
1256
|
+
return this.pendingPageFetch;
|
|
1257
|
+
}
|
|
1258
|
+
if (this.nextPageToken == null) {
|
|
1259
|
+
return Promise.resolve(void 0);
|
|
1260
|
+
}
|
|
1261
|
+
this.store.batch({}, (batch) => {
|
|
1262
|
+
this.setStatus("loading", batch);
|
|
1263
|
+
});
|
|
1264
|
+
this.pendingFetch = this.fetchPageAndUpdate("loaded", this.abortController?.signal).then(() => void 0).finally(() => {
|
|
1265
|
+
this.pendingPageFetch = void 0;
|
|
1266
|
+
});
|
|
1267
|
+
return this.pendingFetch;
|
|
1268
|
+
};
|
|
1269
|
+
/**
|
|
1270
|
+
* Minimum number of results to load initially
|
|
1271
|
+
* May be overridden by subclasses for specific collection types
|
|
1272
|
+
* @protected
|
|
1273
|
+
*/
|
|
1274
|
+
minResultsToLoad = 0;
|
|
1275
|
+
/**
|
|
1276
|
+
* Common _fetchAndStore implementation for pagination
|
|
1277
|
+
* Uses fetchPageAndUpdate to load the initial set of data
|
|
1278
|
+
* Will load multiple pages if necessary to reach minResultsToLoad
|
|
1279
|
+
*/
|
|
972
1280
|
async _fetchAndStore() {
|
|
973
1281
|
if (process.env.NODE_ENV !== "production") {
|
|
974
1282
|
this.logger?.child({
|
|
@@ -976,13 +1284,12 @@ var ListQuery = class extends BaseListQuery {
|
|
|
976
1284
|
}).debug("fetching pages");
|
|
977
1285
|
}
|
|
978
1286
|
while (true) {
|
|
979
|
-
const entry = await this
|
|
1287
|
+
const entry = await this.fetchPageAndUpdate("loading", this.abortController?.signal);
|
|
980
1288
|
if (!entry) {
|
|
981
1289
|
return;
|
|
982
1290
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
if (count > this.#minNumResults || this.#nextPageToken == null) {
|
|
1291
|
+
const count = entry.value?.data.length || 0;
|
|
1292
|
+
if (count >= this.minResultsToLoad || this.nextPageToken == null) {
|
|
986
1293
|
break;
|
|
987
1294
|
}
|
|
988
1295
|
}
|
|
@@ -991,61 +1298,183 @@ var ListQuery = class extends BaseListQuery {
|
|
|
991
1298
|
});
|
|
992
1299
|
return Promise.resolve();
|
|
993
1300
|
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1301
|
+
/**
|
|
1302
|
+
* Template method for fetching a page of data and updating the store
|
|
1303
|
+
* Provides common error handling and abort signal checking
|
|
1304
|
+
*
|
|
1305
|
+
* @param status The status to set for the entry
|
|
1306
|
+
* @param signal Optional AbortSignal for cancellation
|
|
1307
|
+
* @returns A promise that resolves to the updated entry or undefined if aborted
|
|
1308
|
+
*/
|
|
1309
|
+
async fetchPageAndUpdate(status, signal) {
|
|
1310
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1311
|
+
this.logger?.child({
|
|
1312
|
+
methodName: "fetchPageAndUpdate"
|
|
1313
|
+
}).debug(`Fetching data with status: ${status}`);
|
|
1004
1314
|
}
|
|
1005
|
-
if (
|
|
1006
|
-
return
|
|
1315
|
+
if (signal?.aborted) {
|
|
1316
|
+
return void 0;
|
|
1007
1317
|
}
|
|
1008
|
-
this.store.batch({}, (batch) => {
|
|
1009
|
-
this.setStatus("loading", batch);
|
|
1010
|
-
});
|
|
1011
|
-
this.pendingFetch = this.#fetchPageAndUpdate(this.#objectSet, "loaded", this.abortController?.signal).finally(() => {
|
|
1012
|
-
this.#pendingPageFetch = void 0;
|
|
1013
|
-
});
|
|
1014
|
-
return this.pendingFetch;
|
|
1015
|
-
};
|
|
1016
|
-
async #fetchPageAndUpdate(objectSet, status, signal) {
|
|
1017
|
-
const append = this.#nextPageToken != null;
|
|
1018
1318
|
try {
|
|
1019
|
-
|
|
1020
|
-
data,
|
|
1021
|
-
nextPageToken
|
|
1022
|
-
} = await objectSet.fetchPage({
|
|
1023
|
-
$nextPageToken: this.#nextPageToken,
|
|
1024
|
-
$pageSize: this.options.pageSize,
|
|
1025
|
-
// For now this keeps the shared test code from falling apart
|
|
1026
|
-
// but shouldn't be needed ideally
|
|
1027
|
-
...Object.keys(this.#orderBy).length > 0 ? {
|
|
1028
|
-
$orderBy: this.#orderBy
|
|
1029
|
-
} : {}
|
|
1030
|
-
});
|
|
1319
|
+
const result = await this.fetchPageData(signal);
|
|
1031
1320
|
if (signal?.aborted) {
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
this.#nextPageToken = nextPageToken;
|
|
1035
|
-
if (this.#type === "interface") {
|
|
1036
|
-
data = await reloadDataAsFullObjects(this.store.client, data);
|
|
1321
|
+
return void 0;
|
|
1037
1322
|
}
|
|
1038
1323
|
const {
|
|
1039
1324
|
retVal
|
|
1040
1325
|
} = this.store.batch({}, (batch) => {
|
|
1041
|
-
|
|
1326
|
+
const append = this.nextPageToken != null;
|
|
1327
|
+
const finalStatus = result.nextPageToken ? status : "loaded";
|
|
1328
|
+
return this._updateList(this.storeObjects(result.data, batch), finalStatus, batch, append);
|
|
1042
1329
|
});
|
|
1043
1330
|
return retVal;
|
|
1044
|
-
} catch (
|
|
1045
|
-
|
|
1046
|
-
|
|
1331
|
+
} catch (error) {
|
|
1332
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1333
|
+
this.logger?.child({
|
|
1334
|
+
methodName: "fetchPageAndUpdate"
|
|
1335
|
+
}).error("Error fetching data", error);
|
|
1336
|
+
}
|
|
1337
|
+
if (!signal?.aborted) {
|
|
1338
|
+
const {
|
|
1339
|
+
retVal
|
|
1340
|
+
} = this.store.batch({}, (batch) => {
|
|
1341
|
+
return this.handleFetchError(error, status, batch);
|
|
1342
|
+
});
|
|
1343
|
+
return retVal;
|
|
1344
|
+
}
|
|
1345
|
+
return void 0;
|
|
1047
1346
|
}
|
|
1048
1347
|
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Abstract method that subclasses implement for their specific data fetching logic
|
|
1350
|
+
*
|
|
1351
|
+
* @param signal Optional AbortSignal for cancellation
|
|
1352
|
+
* @returns A promise that resolves to the fetched data
|
|
1353
|
+
*/
|
|
1354
|
+
/**
|
|
1355
|
+
* Handle fetch errors by setting appropriate error state
|
|
1356
|
+
* Default implementation that subclasses can override
|
|
1357
|
+
*
|
|
1358
|
+
* @param error The error that occurred
|
|
1359
|
+
* @param status The intended status if successful
|
|
1360
|
+
* @param batch The batch context to use
|
|
1361
|
+
* @returns The updated entry with error status
|
|
1362
|
+
*/
|
|
1363
|
+
handleFetchError(_error, _status, batch) {
|
|
1364
|
+
return this.writeToStore({
|
|
1365
|
+
data: []
|
|
1366
|
+
}, "error", batch);
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Sort the collection items using the configured sorting strategy
|
|
1370
|
+
* @param objectCacheKeys - The cache keys to sort
|
|
1371
|
+
* @param batch - The batch context
|
|
1372
|
+
* @returns Sorted array of cache keys
|
|
1373
|
+
*/
|
|
1374
|
+
_sortCacheKeys(objectCacheKeys, batch) {
|
|
1375
|
+
return this.sortingStrategy.sortCacheKeys(objectCacheKeys, batch);
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Unified method for updating collection data in the store
|
|
1379
|
+
* Handles storing, sorting, deduplication, and reference counting
|
|
1380
|
+
*
|
|
1381
|
+
* @param items - Either object cache keys or object instances to update
|
|
1382
|
+
* @param options - Configuration options for the update
|
|
1383
|
+
* @param batch - The batch context to use
|
|
1384
|
+
* @returns The updated entry
|
|
1385
|
+
*/
|
|
1386
|
+
updateCollection(items, options, batch) {
|
|
1387
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1388
|
+
const logger = process.env.NODE_ENV !== "production" ? this.logger?.child({
|
|
1389
|
+
methodName: "updateCollection"
|
|
1390
|
+
}) : this.logger;
|
|
1391
|
+
logger?.debug(`{status: ${options.status}, append: ${options.append}}`, JSON.stringify(items, null, 2));
|
|
1392
|
+
}
|
|
1393
|
+
let objectCacheKeys;
|
|
1394
|
+
if (items.length === 0) {
|
|
1395
|
+
objectCacheKeys = [];
|
|
1396
|
+
} else if (isObjectInstance(items[0])) {
|
|
1397
|
+
objectCacheKeys = this.storeObjects(items, batch);
|
|
1398
|
+
} else {
|
|
1399
|
+
objectCacheKeys = items;
|
|
1400
|
+
}
|
|
1401
|
+
objectCacheKeys = this.#retainReleaseAppend(batch, options.append ?? false, objectCacheKeys);
|
|
1402
|
+
objectCacheKeys = this._sortCacheKeys(objectCacheKeys, batch);
|
|
1403
|
+
objectCacheKeys = removeDuplicates(objectCacheKeys, batch);
|
|
1404
|
+
return this.writeToStore({
|
|
1405
|
+
data: objectCacheKeys
|
|
1406
|
+
}, options.status, batch);
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
var ListQuery = class extends BaseListQuery {
|
|
1410
|
+
// pageSize?: number; // this is the internal page size. we need to track this properly
|
|
1411
|
+
#type;
|
|
1412
|
+
#apiName;
|
|
1413
|
+
#whereClause;
|
|
1414
|
+
// Using base class minResultsToLoad instead of a private property
|
|
1415
|
+
#orderBy;
|
|
1416
|
+
#objectSet;
|
|
1417
|
+
/**
|
|
1418
|
+
* Register changes to the cache specific to ListQuery
|
|
1419
|
+
*/
|
|
1420
|
+
registerCacheChanges(batch) {
|
|
1421
|
+
batch.changes.registerList(this.cacheKey);
|
|
1422
|
+
}
|
|
1423
|
+
constructor(store, subject, apiType, apiName, whereClause, orderBy, cacheKey, opts) {
|
|
1424
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkBL56QBYG_cjs.additionalContext].logger?.child({}, {
|
|
1425
|
+
msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
1426
|
+
}) : void 0);
|
|
1427
|
+
this.#type = apiType;
|
|
1428
|
+
this.#apiName = apiName;
|
|
1429
|
+
this.#whereClause = whereClause;
|
|
1430
|
+
this.#orderBy = orderBy;
|
|
1431
|
+
this.#objectSet = store.client({
|
|
1432
|
+
type: this.#type,
|
|
1433
|
+
apiName: this.#apiName
|
|
1434
|
+
}).where(this.#whereClause);
|
|
1435
|
+
this.sortingStrategy = new OrderBySortingStrategy(this.#apiName, this.#orderBy);
|
|
1436
|
+
this.minResultsToLoad = 0;
|
|
1437
|
+
}
|
|
1438
|
+
get canonicalWhere() {
|
|
1439
|
+
return this.#whereClause;
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Implements fetchPageData from BaseCollectionQuery template method
|
|
1443
|
+
* Fetches a page of data
|
|
1444
|
+
*/
|
|
1445
|
+
async fetchPageData(signal) {
|
|
1446
|
+
const resp = await this.#objectSet.fetchPage({
|
|
1447
|
+
$nextPageToken: this.nextPageToken,
|
|
1448
|
+
$pageSize: this.options.pageSize,
|
|
1449
|
+
// For now this keeps the shared test code from falling apart
|
|
1450
|
+
// but shouldn't be needed ideally
|
|
1451
|
+
...Object.keys(this.#orderBy).length > 0 ? {
|
|
1452
|
+
$orderBy: this.#orderBy
|
|
1453
|
+
} : {}
|
|
1454
|
+
});
|
|
1455
|
+
if (signal?.aborted) {
|
|
1456
|
+
throw new Error("Aborted");
|
|
1457
|
+
}
|
|
1458
|
+
this.nextPageToken = resp.nextPageToken;
|
|
1459
|
+
let fetchedData = resp.data;
|
|
1460
|
+
if (this.#type === "interface") {
|
|
1461
|
+
fetchedData = await reloadDataAsFullObjects(this.store.client, fetchedData);
|
|
1462
|
+
}
|
|
1463
|
+
return {
|
|
1464
|
+
...resp,
|
|
1465
|
+
data: fetchedData
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Handle fetch errors by setting appropriate error state and notifying subscribers
|
|
1470
|
+
*/
|
|
1471
|
+
handleFetchError(error, _status, batch) {
|
|
1472
|
+
this.logger?.error("error", error);
|
|
1473
|
+
this.store.getSubject(this.cacheKey).error(error);
|
|
1474
|
+
return this.writeToStore({
|
|
1475
|
+
data: []
|
|
1476
|
+
}, "error", batch);
|
|
1477
|
+
}
|
|
1049
1478
|
/**
|
|
1050
1479
|
* Will revalidate the list if its query is affected by invalidating the
|
|
1051
1480
|
* apiName of the object type passed in.
|
|
@@ -1077,6 +1506,12 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1077
1506
|
return;
|
|
1078
1507
|
}
|
|
1079
1508
|
};
|
|
1509
|
+
invalidateObjectType = async (objectType, changes) => {
|
|
1510
|
+
if (this.cacheKey.otherKeys[1] === objectType) {
|
|
1511
|
+
changes?.modified.add(this.cacheKey);
|
|
1512
|
+
return this.revalidate(true);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1080
1515
|
/**
|
|
1081
1516
|
* Note: This method is not async because I want it to return right after it
|
|
1082
1517
|
* finishes the synchronous updates. The promise that is returned
|
|
@@ -1091,6 +1526,9 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1091
1526
|
this.logger?.child({
|
|
1092
1527
|
methodName: "maybeUpdateAndRevalidate"
|
|
1093
1528
|
}).debug(DEBUG_ONLY__changesToString(changes));
|
|
1529
|
+
this.logger?.child({
|
|
1530
|
+
methodName: "maybeUpdateAndRevalidate"
|
|
1531
|
+
}).debug(`Already in changes? ${changes.modified.has(this.cacheKey)}`);
|
|
1094
1532
|
}
|
|
1095
1533
|
if (changes.modified.has(this.cacheKey)) return;
|
|
1096
1534
|
changes.modified.add(this.cacheKey);
|
|
@@ -1135,10 +1573,10 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1135
1573
|
}
|
|
1136
1574
|
this._updateList(
|
|
1137
1575
|
newList,
|
|
1138
|
-
/* append */
|
|
1139
|
-
false,
|
|
1140
1576
|
status,
|
|
1141
|
-
batch
|
|
1577
|
+
batch,
|
|
1578
|
+
/* append */
|
|
1579
|
+
false
|
|
1142
1580
|
);
|
|
1143
1581
|
});
|
|
1144
1582
|
if (needsRevalidation) {
|
|
@@ -1176,7 +1614,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1176
1614
|
}
|
|
1177
1615
|
#extractRelevantObjectsForTypeInterface(changes) {
|
|
1178
1616
|
const matchesApiName = ([, object]) => {
|
|
1179
|
-
return this.#apiName in object[
|
|
1617
|
+
return this.#apiName in object[chunkAOGMSVFN_cjs.ObjectDefRef].interfaceMap;
|
|
1180
1618
|
};
|
|
1181
1619
|
const added = Array.from(changes.addedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.#apiName));
|
|
1182
1620
|
const modified = Array.from(changes.modifiedObjects).filter(matchesApiName).map(([, object]) => object.$as(this.#apiName));
|
|
@@ -1207,20 +1645,6 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1207
1645
|
}
|
|
1208
1646
|
};
|
|
1209
1647
|
}
|
|
1210
|
-
_sortCacheKeys(objectCacheKeys, batch) {
|
|
1211
|
-
if (Object.keys(this.#orderBy).length > 0) {
|
|
1212
|
-
objectCacheKeys = objectCacheKeys.sort((a, b) => {
|
|
1213
|
-
for (const sortFn of this.#sortFns) {
|
|
1214
|
-
const ret = sortFn(batch.read(a)?.value?.$as(this.#apiName), batch.read(b)?.value?.$as(this.#apiName));
|
|
1215
|
-
if (ret !== 0) {
|
|
1216
|
-
return ret;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
return 0;
|
|
1220
|
-
});
|
|
1221
|
-
}
|
|
1222
|
-
return objectCacheKeys;
|
|
1223
|
-
}
|
|
1224
1648
|
registerStreamUpdates(sub) {
|
|
1225
1649
|
const logger = process.env.NODE_ENV !== "production" ? this.logger?.child({
|
|
1226
1650
|
methodName: "registerStreamUpdates"
|
|
@@ -1281,7 +1705,7 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1281
1705
|
if (state === "ADDED_OR_UPDATED") {
|
|
1282
1706
|
const object = objOrIface.$apiName !== objOrIface.$objectType ? objOrIface.$as(objOrIface.$objectType) : objOrIface;
|
|
1283
1707
|
this.store.batch({}, (batch) => {
|
|
1284
|
-
|
|
1708
|
+
this.storeObjects([object], batch);
|
|
1285
1709
|
});
|
|
1286
1710
|
} else if (state === "REMOVED") {
|
|
1287
1711
|
this.#onOswRemoved(objOrIface, logger);
|
|
@@ -1318,41 +1742,10 @@ var ListQuery = class extends BaseListQuery {
|
|
|
1318
1742
|
});
|
|
1319
1743
|
}
|
|
1320
1744
|
};
|
|
1321
|
-
function removeDuplicates(objectCacheKeys, batch) {
|
|
1322
|
-
const visited = /* @__PURE__ */ new Set();
|
|
1323
|
-
objectCacheKeys = objectCacheKeys.filter((key) => {
|
|
1324
|
-
batch.read(key);
|
|
1325
|
-
if (visited.has(key)) {
|
|
1326
|
-
return false;
|
|
1327
|
-
}
|
|
1328
|
-
visited.add(key);
|
|
1329
|
-
return true;
|
|
1330
|
-
});
|
|
1331
|
-
return objectCacheKeys;
|
|
1332
|
-
}
|
|
1333
|
-
function createOrderBySortFns(orderBy) {
|
|
1334
|
-
return Object.entries(orderBy).map(([key, order]) => {
|
|
1335
|
-
return (a, b) => {
|
|
1336
|
-
const aValue = a?.[key];
|
|
1337
|
-
const bValue = b?.[key];
|
|
1338
|
-
if (aValue == null && bValue == null) {
|
|
1339
|
-
return 0;
|
|
1340
|
-
}
|
|
1341
|
-
if (aValue == null) {
|
|
1342
|
-
return 1;
|
|
1343
|
-
}
|
|
1344
|
-
if (bValue == null) {
|
|
1345
|
-
return -1;
|
|
1346
|
-
}
|
|
1347
|
-
const m = order === "asc" ? -1 : 1;
|
|
1348
|
-
return aValue < bValue ? m : aValue > bValue ? -m : 0;
|
|
1349
|
-
};
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
1745
|
async function reloadDataAsFullObjects(client, data) {
|
|
1353
1746
|
const groups = groupBy__default.default(data, (x) => x.$objectType);
|
|
1354
1747
|
const objectTypeToPrimaryKeyToObject = Object.fromEntries(await Promise.all(Object.entries(groups).map(async ([apiName, objects]) => {
|
|
1355
|
-
const objectDef = objects[0][
|
|
1748
|
+
const objectDef = objects[0][chunkAOGMSVFN_cjs.UnderlyingOsdkObject][chunkAOGMSVFN_cjs.ObjectDefRef];
|
|
1356
1749
|
const where = {
|
|
1357
1750
|
[objectDef.primaryKeyApiName]: {
|
|
1358
1751
|
$in: objects.map((x) => x.$primaryKey)
|
|
@@ -1367,9 +1760,181 @@ async function reloadDataAsFullObjects(client, data) {
|
|
|
1367
1760
|
});
|
|
1368
1761
|
return data;
|
|
1369
1762
|
}
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1763
|
+
|
|
1764
|
+
// src/observable/internal/links/SpecificLinkQuery.ts
|
|
1765
|
+
var SpecificLinkQuery = class extends BaseListQuery {
|
|
1766
|
+
#sourceApiName;
|
|
1767
|
+
#sourcePk;
|
|
1768
|
+
#linkName;
|
|
1769
|
+
#whereClause;
|
|
1770
|
+
#orderBy;
|
|
1771
|
+
/**
|
|
1772
|
+
* Register changes to the cache specific to SpecificLinkQuery
|
|
1773
|
+
*/
|
|
1774
|
+
registerCacheChanges(batch) {
|
|
1775
|
+
batch.changes.modified.add(this.cacheKey);
|
|
1776
|
+
}
|
|
1777
|
+
constructor(store, subject, cacheKey, opts) {
|
|
1778
|
+
super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkBL56QBYG_cjs.additionalContext].logger?.child({}, {
|
|
1779
|
+
msgPrefix: `SpecificLinkQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
|
|
1780
|
+
}) : void 0);
|
|
1781
|
+
[this.#sourceApiName, this.#sourcePk, this.#linkName, this.#whereClause, this.#orderBy] = cacheKey.otherKeys;
|
|
1782
|
+
this.sortingStrategy = new OrderBySortingStrategy(this.#linkName, this.#orderBy);
|
|
1783
|
+
}
|
|
1784
|
+
// _fetchAndStore is now implemented in BaseCollectionQuery
|
|
1785
|
+
/**
|
|
1786
|
+
* Implements fetchPageData from the BaseCollectionQuery template method pattern
|
|
1787
|
+
* Fetches a page of linked objects
|
|
1788
|
+
*/
|
|
1789
|
+
async fetchPageData(signal) {
|
|
1790
|
+
const client = this.store.client;
|
|
1791
|
+
const sourceObjectDef = {
|
|
1792
|
+
type: "object",
|
|
1793
|
+
apiName: this.#sourceApiName
|
|
1794
|
+
};
|
|
1795
|
+
const sourceMetadata = await client[chunkBL56QBYG_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
|
|
1796
|
+
const sourceQuery = client(sourceObjectDef).where({
|
|
1797
|
+
[sourceMetadata.primaryKeyApiName]: this.#sourcePk
|
|
1798
|
+
});
|
|
1799
|
+
const linkQuery = sourceQuery.pivotTo(this.#linkName);
|
|
1800
|
+
if (signal?.aborted) {
|
|
1801
|
+
throw new Error("Aborted");
|
|
1802
|
+
}
|
|
1803
|
+
const queryParams = {
|
|
1804
|
+
$pageSize: this.options.pageSize || 100,
|
|
1805
|
+
$nextPageToken: this.nextPageToken
|
|
1806
|
+
};
|
|
1807
|
+
if (this.#orderBy && Object.keys(this.#orderBy).length > 0) {
|
|
1808
|
+
queryParams.$orderBy = this.#orderBy;
|
|
1809
|
+
}
|
|
1810
|
+
if (this.#whereClause && Object.keys(this.#whereClause).length > 0) {
|
|
1811
|
+
queryParams.$where = this.#whereClause;
|
|
1812
|
+
}
|
|
1813
|
+
const response = await linkQuery.fetchPage(queryParams);
|
|
1814
|
+
this.nextPageToken = response.nextPageToken;
|
|
1815
|
+
return response;
|
|
1816
|
+
}
|
|
1817
|
+
/**
|
|
1818
|
+
* Removes a link query from the store
|
|
1819
|
+
*/
|
|
1820
|
+
deleteFromStore(status, batch) {
|
|
1821
|
+
const entry = batch.read(this.cacheKey);
|
|
1822
|
+
if (entry && deepEqual2__default.default(tombstone, entry.value)) {
|
|
1823
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1824
|
+
this.logger?.child({
|
|
1825
|
+
methodName: "deleteFromStore"
|
|
1826
|
+
}).debug(`Links were already deleted, just setting status`);
|
|
1827
|
+
}
|
|
1828
|
+
return batch.write(this.cacheKey, entry.value, status);
|
|
1829
|
+
}
|
|
1830
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1831
|
+
this.logger?.child({
|
|
1832
|
+
methodName: "deleteFromStore"
|
|
1833
|
+
}).debug(JSON.stringify({
|
|
1834
|
+
status
|
|
1835
|
+
}));
|
|
1836
|
+
}
|
|
1837
|
+
if (!entry || !entry.value) {
|
|
1838
|
+
return;
|
|
1839
|
+
}
|
|
1840
|
+
const ret = batch.delete(this.cacheKey, status);
|
|
1841
|
+
batch.changes.deleted.add(this.cacheKey);
|
|
1842
|
+
return ret;
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Implements Query.maybeUpdateAndRevalidate to handle cache invalidation
|
|
1846
|
+
*/
|
|
1847
|
+
maybeUpdateAndRevalidate = async (changes, _optimisticId) => {
|
|
1848
|
+
if (changes.modified.has(this.cacheKey)) {
|
|
1849
|
+
return this.revalidate(true);
|
|
1850
|
+
}
|
|
1851
|
+
return Promise.resolve();
|
|
1852
|
+
};
|
|
1853
|
+
invalidateObjectType = (objectType, changes) => {
|
|
1854
|
+
if (this.#sourceApiName === objectType) {
|
|
1855
|
+
changes?.modified.add(this.cacheKey);
|
|
1856
|
+
return this.revalidate(true);
|
|
1857
|
+
} else {
|
|
1858
|
+
return (async () => {
|
|
1859
|
+
const sourceMetadata = await this.store.client[chunkBL56QBYG_cjs.additionalContext].ontologyProvider.getObjectDefinition(this.#sourceApiName);
|
|
1860
|
+
const linkDef = sourceMetadata.links?.[this.#linkName];
|
|
1861
|
+
if (!linkDef || linkDef.targetType !== objectType) return;
|
|
1862
|
+
const promise = this.revalidate(true);
|
|
1863
|
+
changes?.modified.add(this.cacheKey);
|
|
1864
|
+
return promise;
|
|
1865
|
+
})();
|
|
1866
|
+
}
|
|
1867
|
+
};
|
|
1868
|
+
};
|
|
1869
|
+
|
|
1870
|
+
// src/observable/internal/links/LinksHelper.ts
|
|
1871
|
+
var LinksHelper = class extends AbstractHelper {
|
|
1872
|
+
constructor(store, whereCanonicalizer, orderByCanonicalizer) {
|
|
1873
|
+
super(store);
|
|
1874
|
+
this.whereCanonicalizer = whereCanonicalizer;
|
|
1875
|
+
this.orderByCanonicalizer = orderByCanonicalizer;
|
|
1876
|
+
}
|
|
1877
|
+
getQuery(options) {
|
|
1878
|
+
const {
|
|
1879
|
+
apiName
|
|
1880
|
+
} = options.srcType;
|
|
1881
|
+
const canonWhere = this.whereCanonicalizer.canonicalize(options.where ?? {});
|
|
1882
|
+
const canonOrderBy = this.orderByCanonicalizer.canonicalize(options.orderBy ?? {});
|
|
1883
|
+
const linkCacheKey = this.store.getCacheKey("specificLink", apiName, options.pk, options.linkName, canonWhere, canonOrderBy);
|
|
1884
|
+
return this.store.getQuery(linkCacheKey, () => {
|
|
1885
|
+
return new SpecificLinkQuery(this.store, this.store.getSubject(linkCacheKey), linkCacheKey, options);
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1890
|
+
// src/observable/internal/list/ListsHelper.ts
|
|
1891
|
+
var ListsHelper = class extends AbstractHelper {
|
|
1892
|
+
constructor(store, whereCanonicalizer, orderByCanonicalizer) {
|
|
1893
|
+
super(store);
|
|
1894
|
+
this.whereCanonicalizer = whereCanonicalizer;
|
|
1895
|
+
this.orderByCanonicalizer = orderByCanonicalizer;
|
|
1896
|
+
}
|
|
1897
|
+
observe(options, subFn) {
|
|
1898
|
+
const ret = super.observe(options, subFn);
|
|
1899
|
+
if (options.streamUpdates) {
|
|
1900
|
+
ret.query.registerStreamUpdates(ret.subscription);
|
|
1901
|
+
}
|
|
1902
|
+
return ret;
|
|
1903
|
+
}
|
|
1904
|
+
getQuery(options) {
|
|
1905
|
+
const {
|
|
1906
|
+
type: {
|
|
1907
|
+
apiName,
|
|
1908
|
+
type
|
|
1909
|
+
},
|
|
1910
|
+
where,
|
|
1911
|
+
orderBy
|
|
1912
|
+
} = options;
|
|
1913
|
+
const canonWhere = this.whereCanonicalizer.canonicalize(where ?? {});
|
|
1914
|
+
const canonOrderBy = this.orderByCanonicalizer.canonicalize(orderBy ?? {});
|
|
1915
|
+
const listCacheKey = this.store.getCacheKey("list", type, apiName, canonWhere, canonOrderBy);
|
|
1916
|
+
return this.store.getQuery(listCacheKey, () => {
|
|
1917
|
+
return new ListQuery(this.store, this.store.getSubject(listCacheKey), type, apiName, canonWhere, canonOrderBy, listCacheKey, options);
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1921
|
+
|
|
1922
|
+
// src/observable/internal/object/ObjectsHelper.ts
|
|
1923
|
+
var ObjectsHelper = class extends AbstractHelper {
|
|
1924
|
+
observe(options, subFn) {
|
|
1925
|
+
return super.observe(options, subFn);
|
|
1926
|
+
}
|
|
1927
|
+
getQuery(options) {
|
|
1928
|
+
const apiName = typeof options.apiName === "string" ? options.apiName : options.apiName.apiName;
|
|
1929
|
+
const {
|
|
1930
|
+
pk
|
|
1931
|
+
} = options;
|
|
1932
|
+
const objectCacheKey = this.store.getCacheKey("object", apiName, pk);
|
|
1933
|
+
return this.store.getQuery(objectCacheKey, () => new ObjectQuery(this.store, this.store.getSubject(objectCacheKey), apiName, pk, objectCacheKey, {
|
|
1934
|
+
dedupeInterval: 0
|
|
1935
|
+
}));
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1373
1938
|
var defaultMakeData = () => /* @__PURE__ */ Object.create(null);
|
|
1374
1939
|
var WeakRefTrie = class {
|
|
1375
1940
|
#finalizer = new FinalizationRegistry((orderBy) => {
|
|
@@ -1558,11 +2123,15 @@ var Store = class {
|
|
|
1558
2123
|
// we are currently only using this for debug logging and should just remove it in the future if that
|
|
1559
2124
|
// continues to be true
|
|
1560
2125
|
#finalizationRegistry;
|
|
2126
|
+
// these are hopefully temporary
|
|
1561
2127
|
constructor(client) {
|
|
1562
2128
|
this.client = client;
|
|
1563
|
-
this.logger = client[
|
|
2129
|
+
this.logger = client[chunkBL56QBYG_cjs.additionalContext].logger?.child({}, {
|
|
1564
2130
|
msgPrefix: "Store"
|
|
1565
2131
|
});
|
|
2132
|
+
this.lists = new ListsHelper(this, this.whereCanonicalizer, this.orderByCanonicalizer);
|
|
2133
|
+
this.objects = new ObjectsHelper(this);
|
|
2134
|
+
this.links = new LinksHelper(this, this.whereCanonicalizer, this.orderByCanonicalizer);
|
|
1566
2135
|
this.#topLayer = this.#truthLayer;
|
|
1567
2136
|
this.#cacheKeys = new CacheKeys(this.whereCanonicalizer, this.orderByCanonicalizer, (k) => {
|
|
1568
2137
|
this.#refCounts.register(k);
|
|
@@ -1652,53 +2221,10 @@ var Store = class {
|
|
|
1652
2221
|
canonicalizeWhereClause(where) {
|
|
1653
2222
|
return this.whereCanonicalizer.canonicalize(where);
|
|
1654
2223
|
}
|
|
1655
|
-
observeObject(apiName, pk, options, subFn) {
|
|
1656
|
-
if (typeof apiName !== "string") {
|
|
1657
|
-
apiName = apiName.apiName;
|
|
1658
|
-
}
|
|
1659
|
-
const query = this.getObjectQuery(apiName, pk);
|
|
1660
|
-
this.retain(query.cacheKey);
|
|
1661
|
-
if (options.mode !== "offline") {
|
|
1662
|
-
query.revalidate(options.mode === "force").catch((e) => {
|
|
1663
|
-
subFn.error(e);
|
|
1664
|
-
if (this.logger) {
|
|
1665
|
-
this.logger.error("Unhandled error in observeObject", e);
|
|
1666
|
-
} else {
|
|
1667
|
-
throw e;
|
|
1668
|
-
}
|
|
1669
|
-
});
|
|
1670
|
-
}
|
|
1671
|
-
const sub = query.subscribe(subFn);
|
|
1672
|
-
return {
|
|
1673
|
-
unsubscribe: () => {
|
|
1674
|
-
sub.unsubscribe();
|
|
1675
|
-
this.release(query.cacheKey);
|
|
1676
|
-
}
|
|
1677
|
-
};
|
|
1678
|
-
}
|
|
1679
|
-
observeList(options, subFn) {
|
|
1680
|
-
const query = this.getListQuery(options.type, options.where ?? {}, options.orderBy ?? {}, options);
|
|
1681
|
-
this.retain(query.cacheKey);
|
|
1682
|
-
if (options.mode !== "offline") {
|
|
1683
|
-
query.revalidate(options.mode === "force").catch((x) => {
|
|
1684
|
-
subFn.error(x);
|
|
1685
|
-
});
|
|
1686
|
-
}
|
|
1687
|
-
const sub = query.subscribe(subFn);
|
|
1688
|
-
if (options.streamUpdates) {
|
|
1689
|
-
query.registerStreamUpdates(sub);
|
|
1690
|
-
}
|
|
1691
|
-
return {
|
|
1692
|
-
unsubscribe: () => {
|
|
1693
|
-
sub.unsubscribe();
|
|
1694
|
-
this.release(query.cacheKey);
|
|
1695
|
-
}
|
|
1696
|
-
};
|
|
1697
|
-
}
|
|
1698
2224
|
peekQuery(cacheKey) {
|
|
1699
2225
|
return this.#queries.get(cacheKey);
|
|
1700
2226
|
}
|
|
1701
|
-
|
|
2227
|
+
getQuery(cacheKey, createQuery) {
|
|
1702
2228
|
let query = this.peekQuery(cacheKey);
|
|
1703
2229
|
if (!query) {
|
|
1704
2230
|
query = createQuery();
|
|
@@ -1706,27 +2232,6 @@ var Store = class {
|
|
|
1706
2232
|
}
|
|
1707
2233
|
return query;
|
|
1708
2234
|
}
|
|
1709
|
-
getListQuery(def, where, orderBy, opts) {
|
|
1710
|
-
const {
|
|
1711
|
-
apiName,
|
|
1712
|
-
type
|
|
1713
|
-
} = def;
|
|
1714
|
-
const canonWhere = this.whereCanonicalizer.canonicalize(where);
|
|
1715
|
-
const canonOrderBy = this.orderByCanonicalizer.canonicalize(orderBy);
|
|
1716
|
-
const listCacheKey = this.getCacheKey("list", type, apiName, canonWhere, canonOrderBy);
|
|
1717
|
-
return this.#getQuery(listCacheKey, () => {
|
|
1718
|
-
return new ListQuery(this, this.getSubject(listCacheKey), type, apiName, canonWhere, canonOrderBy, listCacheKey, opts);
|
|
1719
|
-
});
|
|
1720
|
-
}
|
|
1721
|
-
getObjectQuery(apiName, pk) {
|
|
1722
|
-
if (typeof apiName !== "string") {
|
|
1723
|
-
apiName = apiName.apiName;
|
|
1724
|
-
}
|
|
1725
|
-
const objectCacheKey = this.getCacheKey("object", apiName, pk);
|
|
1726
|
-
return this.#getQuery(objectCacheKey, () => new ObjectQuery(this, this.getSubject(objectCacheKey), apiName, pk, objectCacheKey, {
|
|
1727
|
-
dedupeInterval: 0
|
|
1728
|
-
}));
|
|
1729
|
-
}
|
|
1730
2235
|
getValue(cacheKey) {
|
|
1731
2236
|
return this.#topLayer.get(cacheKey);
|
|
1732
2237
|
}
|
|
@@ -1753,7 +2258,7 @@ var Store = class {
|
|
|
1753
2258
|
writeLayer.set(cacheKey, newValue);
|
|
1754
2259
|
const newTopValue = this.#topLayer.get(cacheKey);
|
|
1755
2260
|
if (oldTopValue !== newTopValue) {
|
|
1756
|
-
this
|
|
2261
|
+
this.getSubject(cacheKey)?.next({
|
|
1757
2262
|
// eslint-disable-next-line @typescript-eslint/no-misused-spread
|
|
1758
2263
|
...newValue,
|
|
1759
2264
|
isOptimistic: newTopValue?.value !== this.#truthLayer.get(cacheKey)?.value
|
|
@@ -1787,7 +2292,10 @@ var Store = class {
|
|
|
1787
2292
|
if (typeof apiName !== "string") {
|
|
1788
2293
|
apiName = apiName.apiName;
|
|
1789
2294
|
}
|
|
1790
|
-
return this.
|
|
2295
|
+
return this.objects.getQuery({
|
|
2296
|
+
apiName,
|
|
2297
|
+
pk
|
|
2298
|
+
}).revalidate(
|
|
1791
2299
|
/* force */
|
|
1792
2300
|
true
|
|
1793
2301
|
);
|
|
@@ -1824,9 +2332,15 @@ var Store = class {
|
|
|
1824
2332
|
}
|
|
1825
2333
|
}
|
|
1826
2334
|
/**
|
|
1827
|
-
*
|
|
1828
|
-
*
|
|
1829
|
-
*
|
|
2335
|
+
* Invalidates all cache entries for a specific object type.
|
|
2336
|
+
* This will revalidate:
|
|
2337
|
+
* 1. All objects of the specified type
|
|
2338
|
+
* 2. All lists of the specified type
|
|
2339
|
+
* 3. All links where the source object is of the specified type
|
|
2340
|
+
*
|
|
2341
|
+
* @param apiName - The API name of the object type to invalidate
|
|
2342
|
+
* @param changes - Optional changes object to track what has been modified
|
|
2343
|
+
* @returns Promise that resolves when all invalidations are complete
|
|
1830
2344
|
*/
|
|
1831
2345
|
invalidateObjectType(apiName, changes) {
|
|
1832
2346
|
if (typeof apiName !== "string") {
|
|
@@ -1839,17 +2353,14 @@ var Store = class {
|
|
|
1839
2353
|
}
|
|
1840
2354
|
const promises = [];
|
|
1841
2355
|
for (const cacheKey of this.#truthLayer.keys()) {
|
|
1842
|
-
if (
|
|
1843
|
-
|
|
1844
|
-
const promise = this.peekQuery(cacheKey)?.revalidate(true);
|
|
1845
|
-
if (promise) {
|
|
1846
|
-
promises.push(promise);
|
|
1847
|
-
changes?.modified.add(cacheKey);
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
2356
|
+
if (changes && changes.modified.has(cacheKey)) {
|
|
2357
|
+
continue;
|
|
1850
2358
|
}
|
|
2359
|
+
const query = this.peekQuery(cacheKey);
|
|
2360
|
+
if (!query) continue;
|
|
2361
|
+
promises.push(query.invalidateObjectType(apiName, changes));
|
|
1851
2362
|
}
|
|
1852
|
-
return Promise.
|
|
2363
|
+
return Promise.allSettled(promises).then(() => void 0);
|
|
1853
2364
|
}
|
|
1854
2365
|
retain(cacheKey) {
|
|
1855
2366
|
this.#refCounts.retain(cacheKey);
|
|
@@ -1861,10 +2372,10 @@ var Store = class {
|
|
|
1861
2372
|
|
|
1862
2373
|
// src/observable/ObservableClient.ts
|
|
1863
2374
|
function createObservableClient(client) {
|
|
1864
|
-
const tweakedClient =
|
|
1865
|
-
...client[
|
|
1866
|
-
fetch: shared_net_fetch.createFetchHeaderMutator(client[
|
|
1867
|
-
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"),
|
|
2375
|
+
const tweakedClient = chunkAOGMSVFN_cjs.createClientFromContext({
|
|
2376
|
+
...client[chunkBL56QBYG_cjs.additionalContext],
|
|
2377
|
+
fetch: shared_net_fetch.createFetchHeaderMutator(client[chunkBL56QBYG_cjs.additionalContext].fetch, (headers) => {
|
|
2378
|
+
headers.set("Fetch-User-Agent", [headers.get("Fetch-User-Agent"), chunkAOGMSVFN_cjs.OBSERVABLE_USER_AGENT].filter((x) => x && x?.length > 0).join(" "));
|
|
1868
2379
|
return headers;
|
|
1869
2380
|
})
|
|
1870
2381
|
});
|
|
@@ -1907,11 +2418,11 @@ function getOsdkConfig(ontologyRid) {
|
|
|
1907
2418
|
|
|
1908
2419
|
Object.defineProperty(exports, "createClientWithTransaction", {
|
|
1909
2420
|
enumerable: true,
|
|
1910
|
-
get: function () { return
|
|
2421
|
+
get: function () { return chunkAOGMSVFN_cjs.createClientWithTransaction; }
|
|
1911
2422
|
});
|
|
1912
2423
|
Object.defineProperty(exports, "augment", {
|
|
1913
2424
|
enumerable: true,
|
|
1914
|
-
get: function () { return
|
|
2425
|
+
get: function () { return chunkBL56QBYG_cjs.augment; }
|
|
1915
2426
|
});
|
|
1916
2427
|
exports.createObservableClient = createObservableClient;
|
|
1917
2428
|
exports.getMetaTagContent = getMetaTagContent;
|