@salesforce/lds-worker-api 1.146.0 → 1.147.1

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.
@@ -185,7 +185,7 @@ function buildAdapterRequestContext(nativeRequestContext) {
185
185
  cachePolicy: buildCachePolicy(cachePolicy),
186
186
  priority,
187
187
  };
188
- if (observabilityContext !== undefined) {
188
+ if (observabilityContext !== undefined && observabilityContext !== null) {
189
189
  requestContext.requestCorrelator = {
190
190
  observabilityContext,
191
191
  };
@@ -694,10 +694,12 @@ const API_NAMESPACE = 'UiApi';
694
694
  const RECORD_REPRESENTATION_NAME = 'RecordRepresentation';
695
695
 
696
696
  let luvio = undefined;
697
+ let internalLuvio = undefined;
697
698
  let uiApiRecordTTL;
698
699
  let metadataTTL;
699
700
  withDefaultLuvio((_luvio) => {
700
701
  luvio = _luvio;
702
+ internalLuvio = getRuntime().internalLuvio;
701
703
  if (uiApiRecordTTL !== undefined) {
702
704
  // Note: This should rarely get hit and the durable store implementation
703
705
  // should have read write synchronization to protect against race conditions
@@ -716,14 +718,24 @@ function setUiApiRecordTTL(ttl) {
716
718
  if (luvio === undefined) {
717
719
  return Promise.resolve();
718
720
  }
719
- return luvio.storeSetTTLOverride(API_NAMESPACE, RECORD_REPRESENTATION_NAME, ttl);
721
+ return luvio.storeSetTTLOverride(API_NAMESPACE, RECORD_REPRESENTATION_NAME, ttl).then(() => {
722
+ if (internalLuvio === undefined) {
723
+ return Promise.resolve();
724
+ }
725
+ internalLuvio.storeSetTTLOverride(API_NAMESPACE, RECORD_REPRESENTATION_NAME, ttl);
726
+ });
720
727
  }
721
728
  function setMetadataTTL(ttl) {
722
729
  metadataTTL = ttl;
723
730
  if (luvio === undefined) {
724
731
  return Promise.resolve();
725
732
  }
726
- return luvio.storeSetDefaultTTLOverride(ttl);
733
+ return luvio.storeSetDefaultTTLOverride(ttl).then(() => {
734
+ if (internalLuvio === undefined) {
735
+ return Promise.resolve();
736
+ }
737
+ internalLuvio.storeSetDefaultTTLOverride(ttl);
738
+ });
727
739
  }
728
740
 
729
741
  function createPrimingSession(config) {
@@ -758,4 +770,4 @@ if (process.env.NODE_ENV !== 'production') {
758
770
  }
759
771
 
760
772
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
761
- // version: 1.146.0-6ca270a7a
773
+ // version: 1.147.1-855bb4b87
@@ -1,4 +1,4 @@
1
- import type { CachePolicy, LuvioAdapterEventObserver } from '@luvio/engine';
1
+ import type { AdapterRequestContext, CachePolicy, LuvioAdapterEventObserver } from '@luvio/engine';
2
2
  import type { DraftQueueItemMetadata } from '@salesforce/lds-drafts';
3
3
  import type { NativeErrorResponse } from './responses';
4
4
  import type { ObservabilityContext } from '@salesforce/lds-runtime-mobile';
@@ -31,6 +31,12 @@ interface NativeAdapterRequestContext {
31
31
  observabilityContext?: NativeObservabilityContext;
32
32
  luvioEventObserver?: NativeLuvioEventObserver;
33
33
  }
34
+ /**
35
+ * Coerces a request context passed in from native to a luvio request context
36
+ * @param nativeRequestContext request context passed in from native
37
+ * @returns Coerced luvio request context
38
+ */
39
+ export declare function buildAdapterRequestContext(nativeRequestContext: NativeAdapterRequestContext | undefined): AdapterRequestContext | undefined;
34
40
  /**
35
41
  * Executes the adapter with the given adapterId and config. Will call onSnapshot
36
42
  * callback with data or error. Returns an unsubscribe function that should