@salesforce/lds-runtime-mobile 1.142.0 → 1.143.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/main.js +84 -13
  2. package/package.json +1 -1
  3. package/sfdc/main.js +84 -13
package/dist/main.js CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import { withRegistration, register } from '@salesforce/lds-default-luvio';
15
15
  import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from '@salesforce/lds-instrumentation';
16
- import { HttpStatusCode, buildStaleWhileRevalidateImplementation, StoreKeySet, serializeStructuredKey, Reader, deepFreeze, emitAdapterEvent, createCustomAdapterEventEmitter, StoreKeyMap, isFileReference, Environment, Luvio, InMemoryStore } from '@luvio/engine';
16
+ import { HttpStatusCode, StoreKeySet, serializeStructuredKey, Reader, deepFreeze, emitAdapterEvent, createCustomAdapterEventEmitter, StoreKeyMap, isFileReference, Environment, Luvio, InMemoryStore } from '@luvio/engine';
17
17
  import { parseAndVisit, Kind, visit, execute, buildSchema, isObjectType, defaultFieldResolver } from '@luvio/graphql-parser';
18
18
  import { getRecordId18, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, keyBuilderContentDocumentCompositeRepresentation, getResponseCacheKeysContentDocumentCompositeRepresentation, keyBuilderFromTypeContentDocumentCompositeRepresentation, ingestContentDocumentCompositeRepresentation, keyBuilderRecord, getTypeCacheKeysRecord, keyBuilderFromTypeRecordRepresentation, ingestRecord, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getRecordAdapterFactory, getObjectInfoAdapterFactory, getObjectInfosAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationTTL, RecordRepresentationVersion } from '@salesforce/lds-adapters-uiapi';
19
19
  import caseSensitiveUserId from '@salesforce/user/Id';
@@ -27,6 +27,9 @@ import shortTimeFormat from '@salesforce/i18n/dateTime.shortTimeFormat';
27
27
  import shortDateTimeFormat from '@salesforce/i18n/dateTime.shortDateTimeFormat';
28
28
  import { getDateTimeFormat, getDateTimeISO8601Parser, getNumberFormat } from 'lightning/i18nService';
29
29
  import formattingOptions from 'lightning/i18nCldrOptions';
30
+ import eagerEvalValidAt from '@salesforce/gate/lds.eagerEvalValidAt';
31
+ import eagerEvalStaleWhileRevalidate from '@salesforce/gate/lds.eagerEvalStaleWhileRevalidate';
32
+ import eagerEvalDefaultCachePolicy from '@salesforce/gate/lds.eagerEvalDefaultCachePolicy';
30
33
 
31
34
  /**
32
35
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -758,7 +761,7 @@ class DurableTTLStore {
758
761
  }
759
762
  }
760
763
 
761
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
764
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations = []) {
762
765
  const durableRecords = create$5(null);
763
766
  const evictedRecords = create$5(null);
764
767
  const { records, metadata: storeMetadata, visitedIds, refreshedIds, } = store.fallbackStringKeyInMemoryStore;
@@ -785,7 +788,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
785
788
  };
786
789
  }
787
790
  }
788
- const durableStoreOperations = [];
791
+ const durableStoreOperations = additionalDurableStoreOperations;
789
792
  // publishes
790
793
  const recordKeys = keys$6(durableRecords);
791
794
  if (recordKeys.length > 0) {
@@ -877,7 +880,7 @@ async function reviveOrCreateContext(adapterId, durableStore, durableStoreErrorH
877
880
  }
878
881
  return contextReturn();
879
882
  }
880
- function isUnfulfilledSnapshot(cachedSnapshotResult) {
883
+ function isUnfulfilledSnapshot$1(cachedSnapshotResult) {
881
884
  if (cachedSnapshotResult === undefined) {
882
885
  return false;
883
886
  }
@@ -888,7 +891,8 @@ function isUnfulfilledSnapshot(cachedSnapshotResult) {
888
891
  }
889
892
  /**
890
893
  * Configures the environment to persist data into a durable store and attempt to resolve
891
- * data from the persistent store before hitting the network.
894
+ * data from the persistent store before hitting the network. Sets the default
895
+ * cache policy to stale-while-revalidate with infinite staleDuration.
892
896
  *
893
897
  * @param environment The base environment
894
898
  * @param durableStore A DurableStore implementation
@@ -1028,12 +1032,12 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1028
1032
  // call the base storeBroadcast
1029
1033
  return publishChangesToDurableStore();
1030
1034
  };
1031
- const publishChangesToDurableStore = function () {
1035
+ const publishChangesToDurableStore = function (additionalDurableStoreOperations) {
1032
1036
  validateNotDisposed();
1033
1037
  if (ingestStagingStore === null) {
1034
1038
  return Promise.resolve();
1035
1039
  }
1036
- const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
1040
+ const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations);
1037
1041
  ingestStagingStore = null;
1038
1042
  return promise;
1039
1043
  };
@@ -1160,7 +1164,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1160
1164
  const snapshot = buildCachedSnapshot(injectedBuildSnapshotContext, injectedStoreLookup, luvio);
1161
1165
  // if the adapter attempted to do an L1 lookup and it was unfulfilled
1162
1166
  // then we can attempt an L2 lookup
1163
- if (isUnfulfilledSnapshot(snapshot)) {
1167
+ if (isUnfulfilledSnapshot$1(snapshot)) {
1164
1168
  const start = Date.now();
1165
1169
  emitDurableEnvironmentAdapterEvent({ type: 'l2-revive-start' }, adapterRequestContext.eventObservers);
1166
1170
  const revivedSnapshot = reviveSnapshot(environment, durableStore, snapshot, durableStoreErrorHandler, () => injectedStoreLookup(snapshot.select, snapshot.refresh)).then((result) => {
@@ -1313,10 +1317,11 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1313
1317
  return entries;
1314
1318
  });
1315
1319
  };
1316
- environment.defaultCachePolicy = {
1320
+ // set the default cache policy of the base environment
1321
+ environment.setDefaultCachePolicy({
1317
1322
  type: 'stale-while-revalidate',
1318
- implementation: buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER),
1319
- };
1323
+ staleDurationSeconds: Number.MAX_SAFE_INTEGER,
1324
+ });
1320
1325
  return create$5(environment, {
1321
1326
  publishStoreMetadata: { value: publishStoreMetadata },
1322
1327
  storeIngest: { value: storeIngest },
@@ -12531,6 +12536,7 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
12531
12536
  query: injectedAST,
12532
12537
  },
12533
12538
  luvio,
12539
+ gqlEval: true,
12534
12540
  }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
12535
12541
  if (isErrorSnapshotThatShouldGetReturnedToCaller(nonEvaluatedSnapshot)) {
12536
12542
  return nonEvaluatedSnapshot;
@@ -15112,8 +15118,17 @@ function formatDisplayValue(value, datatype) {
15112
15118
  }
15113
15119
  }
15114
15120
 
15115
- //TODO: [W-12734162] - rebuild non-evaluated snapshot when graph rebuild is triggered. The dependency work on luvio needs to be done.
15121
+ function isUnfulfilledSnapshot(cachedSnapshotResult) {
15122
+ if (cachedSnapshotResult === undefined) {
15123
+ return false;
15124
+ }
15125
+ if ('then' in cachedSnapshotResult) {
15126
+ return false;
15127
+ }
15128
+ return cachedSnapshotResult.state === 'Unfulfilled';
15129
+ }
15116
15130
  function makeEnvironmentGraphqlAware(environment) {
15131
+ //TODO: [W-12734162] - rebuild non-evaluated snapshot when graph rebuild is triggered. The dependency work on luvio needs to be done.
15117
15132
  const rebuildSnapshot = function (snapshot, onRebuild) {
15118
15133
  if (isStoreEvalSnapshot(snapshot)) {
15119
15134
  snapshot.rebuildWithStoreEval(snapshot).then((rebuilt) => {
@@ -15129,8 +15144,64 @@ function makeEnvironmentGraphqlAware(environment) {
15129
15144
  }
15130
15145
  return environment.rebuildSnapshot(snapshot, onRebuild);
15131
15146
  };
15147
+ const applyCachePolicy = function (luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot) {
15148
+ // Early exit for non-evaluating adapters
15149
+ let graphqlBuildSnapshotContext = buildSnapshotContext;
15150
+ if (graphqlBuildSnapshotContext.gqlEval !== true) {
15151
+ return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot);
15152
+ }
15153
+ var localBuildCachedSnapshot = buildCachedSnapshot;
15154
+ const hoistUnfulfilledToStale = (context, storeLookup, luvio) => {
15155
+ const upstream = buildCachedSnapshot(context, storeLookup, luvio);
15156
+ if (upstream === undefined)
15157
+ return upstream;
15158
+ if (isUnfulfilledSnapshot(upstream)) {
15159
+ return {
15160
+ ...upstream,
15161
+ data: upstream.data || {},
15162
+ state: 'Stale',
15163
+ };
15164
+ }
15165
+ else if ('then' in upstream) {
15166
+ return upstream.then((snapshot) => {
15167
+ if (snapshot === undefined)
15168
+ return snapshot;
15169
+ if (isUnfulfilledSnapshot(snapshot)) {
15170
+ return {
15171
+ ...snapshot,
15172
+ data: snapshot.data || {},
15173
+ state: 'Stale',
15174
+ };
15175
+ }
15176
+ return snapshot;
15177
+ });
15178
+ }
15179
+ return upstream;
15180
+ };
15181
+ const { cachePolicy } = adapterRequestContext;
15182
+ if (eagerEvalValidAt.isOpen({ fallback: false }) &&
15183
+ cachePolicy &&
15184
+ cachePolicy.type === 'valid-at' &&
15185
+ cachePolicy.timestamp === 0 &&
15186
+ cachePolicy.basePolicy &&
15187
+ cachePolicy.basePolicy.type === 'stale-while-revalidate') {
15188
+ localBuildCachedSnapshot = hoistUnfulfilledToStale;
15189
+ }
15190
+ if (eagerEvalStaleWhileRevalidate.isOpen({ fallback: false }) &&
15191
+ cachePolicy &&
15192
+ cachePolicy.type === 'stale-while-revalidate' &&
15193
+ cachePolicy.staleDurationSeconds === Number.MAX_SAFE_INTEGER) {
15194
+ localBuildCachedSnapshot = hoistUnfulfilledToStale;
15195
+ }
15196
+ if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) && cachePolicy === undefined) {
15197
+ localBuildCachedSnapshot = hoistUnfulfilledToStale;
15198
+ }
15199
+ return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, localBuildCachedSnapshot, buildNetworkSnapshot);
15200
+ };
15132
15201
  return create(environment, {
15133
15202
  rebuildSnapshot: { value: rebuildSnapshot },
15203
+ applyCachePolicy: { value: applyCachePolicy },
15204
+ setDefaultCachePolicy: { value: environment.setDefaultCachePolicy.bind(environment) },
15134
15205
  });
15135
15206
  }
15136
15207
 
@@ -15883,4 +15954,4 @@ register({
15883
15954
  });
15884
15955
 
15885
15956
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
15886
- // version: 1.142.0-7730e2a14
15957
+ // version: 1.143.0-a6d2a998d
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.142.0",
3
+ "version": "1.143.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
package/sfdc/main.js CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import { withRegistration, register } from 'native/ldsEngineMobile';
15
15
  import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from 'force/ldsInstrumentation';
16
- import { HttpStatusCode, buildStaleWhileRevalidateImplementation, StoreKeySet, serializeStructuredKey, Reader, deepFreeze, emitAdapterEvent, createCustomAdapterEventEmitter, StoreKeyMap, isFileReference, Environment, Luvio, InMemoryStore } from 'force/luvioEngine';
16
+ import { HttpStatusCode, StoreKeySet, serializeStructuredKey, Reader, deepFreeze, emitAdapterEvent, createCustomAdapterEventEmitter, StoreKeyMap, isFileReference, Environment, Luvio, InMemoryStore } from 'force/luvioEngine';
17
17
  import { parseAndVisit, Kind, visit, execute, buildSchema, isObjectType, defaultFieldResolver } from 'force/ldsGraphqlParser';
18
18
  import { getRecordId18, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, keyBuilderContentDocumentCompositeRepresentation, getResponseCacheKeysContentDocumentCompositeRepresentation, keyBuilderFromTypeContentDocumentCompositeRepresentation, ingestContentDocumentCompositeRepresentation, keyBuilderRecord, getTypeCacheKeysRecord, keyBuilderFromTypeRecordRepresentation, ingestRecord, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getRecordAdapterFactory, getObjectInfoAdapterFactory, getObjectInfosAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationTTL, RecordRepresentationVersion } from 'force/ldsAdaptersUiapi';
19
19
  import caseSensitiveUserId from '@salesforce/user/Id';
@@ -27,6 +27,9 @@ import shortTimeFormat from '@salesforce/i18n/dateTime.shortTimeFormat';
27
27
  import shortDateTimeFormat from '@salesforce/i18n/dateTime.shortDateTimeFormat';
28
28
  import { getDateTimeFormat, getDateTimeISO8601Parser, getNumberFormat } from 'lightning/i18nService';
29
29
  import formattingOptions from 'lightning/i18nCldrOptions';
30
+ import eagerEvalValidAt from '@salesforce/gate/lds.eagerEvalValidAt';
31
+ import eagerEvalStaleWhileRevalidate from '@salesforce/gate/lds.eagerEvalStaleWhileRevalidate';
32
+ import eagerEvalDefaultCachePolicy from '@salesforce/gate/lds.eagerEvalDefaultCachePolicy';
30
33
 
31
34
  /**
32
35
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -758,7 +761,7 @@ class DurableTTLStore {
758
761
  }
759
762
  }
760
763
 
761
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
764
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations = []) {
762
765
  const durableRecords = create$5(null);
763
766
  const evictedRecords = create$5(null);
764
767
  const { records, metadata: storeMetadata, visitedIds, refreshedIds, } = store.fallbackStringKeyInMemoryStore;
@@ -785,7 +788,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
785
788
  };
786
789
  }
787
790
  }
788
- const durableStoreOperations = [];
791
+ const durableStoreOperations = additionalDurableStoreOperations;
789
792
  // publishes
790
793
  const recordKeys = keys$6(durableRecords);
791
794
  if (recordKeys.length > 0) {
@@ -877,7 +880,7 @@ async function reviveOrCreateContext(adapterId, durableStore, durableStoreErrorH
877
880
  }
878
881
  return contextReturn();
879
882
  }
880
- function isUnfulfilledSnapshot(cachedSnapshotResult) {
883
+ function isUnfulfilledSnapshot$1(cachedSnapshotResult) {
881
884
  if (cachedSnapshotResult === undefined) {
882
885
  return false;
883
886
  }
@@ -888,7 +891,8 @@ function isUnfulfilledSnapshot(cachedSnapshotResult) {
888
891
  }
889
892
  /**
890
893
  * Configures the environment to persist data into a durable store and attempt to resolve
891
- * data from the persistent store before hitting the network.
894
+ * data from the persistent store before hitting the network. Sets the default
895
+ * cache policy to stale-while-revalidate with infinite staleDuration.
892
896
  *
893
897
  * @param environment The base environment
894
898
  * @param durableStore A DurableStore implementation
@@ -1028,12 +1032,12 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1028
1032
  // call the base storeBroadcast
1029
1033
  return publishChangesToDurableStore();
1030
1034
  };
1031
- const publishChangesToDurableStore = function () {
1035
+ const publishChangesToDurableStore = function (additionalDurableStoreOperations) {
1032
1036
  validateNotDisposed();
1033
1037
  if (ingestStagingStore === null) {
1034
1038
  return Promise.resolve();
1035
1039
  }
1036
- const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
1040
+ const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations);
1037
1041
  ingestStagingStore = null;
1038
1042
  return promise;
1039
1043
  };
@@ -1160,7 +1164,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1160
1164
  const snapshot = buildCachedSnapshot(injectedBuildSnapshotContext, injectedStoreLookup, luvio);
1161
1165
  // if the adapter attempted to do an L1 lookup and it was unfulfilled
1162
1166
  // then we can attempt an L2 lookup
1163
- if (isUnfulfilledSnapshot(snapshot)) {
1167
+ if (isUnfulfilledSnapshot$1(snapshot)) {
1164
1168
  const start = Date.now();
1165
1169
  emitDurableEnvironmentAdapterEvent({ type: 'l2-revive-start' }, adapterRequestContext.eventObservers);
1166
1170
  const revivedSnapshot = reviveSnapshot(environment, durableStore, snapshot, durableStoreErrorHandler, () => injectedStoreLookup(snapshot.select, snapshot.refresh)).then((result) => {
@@ -1313,10 +1317,11 @@ function makeDurable(environment, { durableStore, instrumentation }) {
1313
1317
  return entries;
1314
1318
  });
1315
1319
  };
1316
- environment.defaultCachePolicy = {
1320
+ // set the default cache policy of the base environment
1321
+ environment.setDefaultCachePolicy({
1317
1322
  type: 'stale-while-revalidate',
1318
- implementation: buildStaleWhileRevalidateImplementation(Number.MAX_SAFE_INTEGER),
1319
- };
1323
+ staleDurationSeconds: Number.MAX_SAFE_INTEGER,
1324
+ });
1320
1325
  return create$5(environment, {
1321
1326
  publishStoreMetadata: { value: publishStoreMetadata },
1322
1327
  storeIngest: { value: storeIngest },
@@ -12531,6 +12536,7 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
12531
12536
  query: injectedAST,
12532
12537
  },
12533
12538
  luvio,
12539
+ gqlEval: true,
12534
12540
  }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
12535
12541
  if (isErrorSnapshotThatShouldGetReturnedToCaller(nonEvaluatedSnapshot)) {
12536
12542
  return nonEvaluatedSnapshot;
@@ -15112,8 +15118,17 @@ function formatDisplayValue(value, datatype) {
15112
15118
  }
15113
15119
  }
15114
15120
 
15115
- //TODO: [W-12734162] - rebuild non-evaluated snapshot when graph rebuild is triggered. The dependency work on luvio needs to be done.
15121
+ function isUnfulfilledSnapshot(cachedSnapshotResult) {
15122
+ if (cachedSnapshotResult === undefined) {
15123
+ return false;
15124
+ }
15125
+ if ('then' in cachedSnapshotResult) {
15126
+ return false;
15127
+ }
15128
+ return cachedSnapshotResult.state === 'Unfulfilled';
15129
+ }
15116
15130
  function makeEnvironmentGraphqlAware(environment) {
15131
+ //TODO: [W-12734162] - rebuild non-evaluated snapshot when graph rebuild is triggered. The dependency work on luvio needs to be done.
15117
15132
  const rebuildSnapshot = function (snapshot, onRebuild) {
15118
15133
  if (isStoreEvalSnapshot(snapshot)) {
15119
15134
  snapshot.rebuildWithStoreEval(snapshot).then((rebuilt) => {
@@ -15129,8 +15144,64 @@ function makeEnvironmentGraphqlAware(environment) {
15129
15144
  }
15130
15145
  return environment.rebuildSnapshot(snapshot, onRebuild);
15131
15146
  };
15147
+ const applyCachePolicy = function (luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot) {
15148
+ // Early exit for non-evaluating adapters
15149
+ let graphqlBuildSnapshotContext = buildSnapshotContext;
15150
+ if (graphqlBuildSnapshotContext.gqlEval !== true) {
15151
+ return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot);
15152
+ }
15153
+ var localBuildCachedSnapshot = buildCachedSnapshot;
15154
+ const hoistUnfulfilledToStale = (context, storeLookup, luvio) => {
15155
+ const upstream = buildCachedSnapshot(context, storeLookup, luvio);
15156
+ if (upstream === undefined)
15157
+ return upstream;
15158
+ if (isUnfulfilledSnapshot(upstream)) {
15159
+ return {
15160
+ ...upstream,
15161
+ data: upstream.data || {},
15162
+ state: 'Stale',
15163
+ };
15164
+ }
15165
+ else if ('then' in upstream) {
15166
+ return upstream.then((snapshot) => {
15167
+ if (snapshot === undefined)
15168
+ return snapshot;
15169
+ if (isUnfulfilledSnapshot(snapshot)) {
15170
+ return {
15171
+ ...snapshot,
15172
+ data: snapshot.data || {},
15173
+ state: 'Stale',
15174
+ };
15175
+ }
15176
+ return snapshot;
15177
+ });
15178
+ }
15179
+ return upstream;
15180
+ };
15181
+ const { cachePolicy } = adapterRequestContext;
15182
+ if (eagerEvalValidAt.isOpen({ fallback: false }) &&
15183
+ cachePolicy &&
15184
+ cachePolicy.type === 'valid-at' &&
15185
+ cachePolicy.timestamp === 0 &&
15186
+ cachePolicy.basePolicy &&
15187
+ cachePolicy.basePolicy.type === 'stale-while-revalidate') {
15188
+ localBuildCachedSnapshot = hoistUnfulfilledToStale;
15189
+ }
15190
+ if (eagerEvalStaleWhileRevalidate.isOpen({ fallback: false }) &&
15191
+ cachePolicy &&
15192
+ cachePolicy.type === 'stale-while-revalidate' &&
15193
+ cachePolicy.staleDurationSeconds === Number.MAX_SAFE_INTEGER) {
15194
+ localBuildCachedSnapshot = hoistUnfulfilledToStale;
15195
+ }
15196
+ if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) && cachePolicy === undefined) {
15197
+ localBuildCachedSnapshot = hoistUnfulfilledToStale;
15198
+ }
15199
+ return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, localBuildCachedSnapshot, buildNetworkSnapshot);
15200
+ };
15132
15201
  return create(environment, {
15133
15202
  rebuildSnapshot: { value: rebuildSnapshot },
15203
+ applyCachePolicy: { value: applyCachePolicy },
15204
+ setDefaultCachePolicy: { value: environment.setDefaultCachePolicy.bind(environment) },
15134
15205
  });
15135
15206
  }
15136
15207
 
@@ -15883,4 +15954,4 @@ register({
15883
15954
  });
15884
15955
 
15885
15956
  export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
15886
- // version: 1.142.0-7730e2a14
15957
+ // version: 1.143.0-a6d2a998d