@salesforce/lds-worker-api 1.130.10 → 1.131.0-dev10
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/dist/sfdc/es/executeAdapter.d.ts +7 -1
- package/dist/sfdc/es/ldsWorkerApi.js +11 -14
- package/dist/standalone/es/executeAdapter.d.ts +7 -1
- package/dist/standalone/es/lds-worker-api.js +1137 -458
- package/dist/standalone/umd/executeAdapter.d.ts +7 -1
- package/dist/standalone/umd/lds-worker-api.js +1137 -458
- package/package.json +10 -10
|
@@ -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
|
|
@@ -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
|
};
|
|
@@ -643,24 +643,21 @@ const allowList = ['enqueue', 'getQueueActions'];
|
|
|
643
643
|
* to the instance of the lds-drafts' DraftQueue implementation
|
|
644
644
|
*/
|
|
645
645
|
const nimbusDraftQueue = {
|
|
646
|
-
callProxyMethod(methodName, serializedArgsArray, resultCallback,
|
|
646
|
+
callProxyMethod(methodName, serializedArgsArray, resultCallback,
|
|
647
|
+
// NOTE: the other side of the proxy is expecting an error message string
|
|
648
|
+
// (not a JSON serialized Error object)
|
|
649
|
+
errorCallback) {
|
|
647
650
|
const method = draftQueue[methodName];
|
|
648
651
|
if (method === undefined) {
|
|
649
|
-
return errorCallback(
|
|
650
|
-
message: 'Method does not exist on the draft queue',
|
|
651
|
-
}));
|
|
652
|
+
return errorCallback('Method does not exist on the draft queue');
|
|
652
653
|
}
|
|
653
654
|
if (allowList.includes(methodName) === false) {
|
|
654
|
-
return errorCallback(
|
|
655
|
-
message: `Method ${methodName} is not available for proxy invocation`,
|
|
656
|
-
}));
|
|
655
|
+
return errorCallback(`Method ${methodName} is not available for proxy invocation`);
|
|
657
656
|
}
|
|
658
657
|
const parsedArgs = parse(serializedArgsArray);
|
|
659
658
|
// TODO [W-9933226]: we should validate the argument list based on which method is being called
|
|
660
659
|
if (isArray(parsedArgs) === false) {
|
|
661
|
-
return errorCallback(
|
|
662
|
-
message: 'expected array argument list',
|
|
663
|
-
}));
|
|
660
|
+
return errorCallback('expected array argument list');
|
|
664
661
|
}
|
|
665
662
|
let methodResult = undefined;
|
|
666
663
|
try {
|
|
@@ -672,7 +669,7 @@ const nimbusDraftQueue = {
|
|
|
672
669
|
}
|
|
673
670
|
}
|
|
674
671
|
catch (err) {
|
|
675
|
-
return errorCallback(
|
|
672
|
+
return errorCallback(normalizeError(err).message);
|
|
676
673
|
}
|
|
677
674
|
if (methodResult.then === undefined) {
|
|
678
675
|
return resultCallback(stringify(methodResult));
|
|
@@ -682,7 +679,7 @@ const nimbusDraftQueue = {
|
|
|
682
679
|
resultCallback(stringify(result));
|
|
683
680
|
})
|
|
684
681
|
.catch((err) => {
|
|
685
|
-
errorCallback(
|
|
682
|
+
errorCallback(normalizeError(err).message);
|
|
686
683
|
});
|
|
687
684
|
},
|
|
688
685
|
};
|
|
@@ -761,4 +758,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
761
758
|
}
|
|
762
759
|
|
|
763
760
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
764
|
-
// version: 1.
|
|
761
|
+
// version: 1.131.0-dev10-b950ecbb3
|
|
@@ -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
|