@salesforce/lds-bindings 1.371.0 → 1.372.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.
package/dist/ldsBindings.js
CHANGED
|
@@ -849,6 +849,24 @@ function snapshotToTuple(snapshot) {
|
|
|
849
849
|
}
|
|
850
850
|
return payload;
|
|
851
851
|
}
|
|
852
|
+
/**
|
|
853
|
+
* The graphql batch snapshot should be treated the same as a regular imperative adapter snapshot.
|
|
854
|
+
* @param snapshot - The snapshot to convert to a tuple
|
|
855
|
+
* @returns The tuple representation of the snapshot
|
|
856
|
+
*/
|
|
857
|
+
function batchSnapshotToTuple(snapshot) {
|
|
858
|
+
if (isErrorSnapshot(snapshot)) {
|
|
859
|
+
return {
|
|
860
|
+
data: undefined,
|
|
861
|
+
error: snapshot.error,
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
// We might still get pending snapshot here from invoke calls here
|
|
865
|
+
return {
|
|
866
|
+
data: snapshot.data,
|
|
867
|
+
error: undefined,
|
|
868
|
+
};
|
|
869
|
+
}
|
|
852
870
|
function createInvalidConfigError() {
|
|
853
871
|
return {
|
|
854
872
|
data: undefined,
|
|
@@ -876,7 +894,9 @@ function createGraphQLImperativeAdapter(luvio, adapter, metadata, astResolver) {
|
|
|
876
894
|
const { name } = metadata;
|
|
877
895
|
const imperativeAdapterInvoke = (config, requestContext, callback) => {
|
|
878
896
|
let coercedConfig = null;
|
|
897
|
+
let isBatch = false;
|
|
879
898
|
if ('batchQuery' in config) {
|
|
899
|
+
isBatch = true;
|
|
880
900
|
coercedConfig = {
|
|
881
901
|
batchQuery: config.batchQuery.map((individualConfig) => ({
|
|
882
902
|
...individualConfig,
|
|
@@ -906,7 +926,9 @@ function createGraphQLImperativeAdapter(luvio, adapter, metadata, astResolver) {
|
|
|
906
926
|
return;
|
|
907
927
|
}
|
|
908
928
|
if (!isPromise(snapshotOrPromise)) {
|
|
909
|
-
callback(
|
|
929
|
+
callback(isBatch
|
|
930
|
+
? batchSnapshotToTuple(snapshotOrPromise)
|
|
931
|
+
: snapshotToTuple(snapshotOrPromise));
|
|
910
932
|
return;
|
|
911
933
|
}
|
|
912
934
|
snapshotOrPromise
|
|
@@ -915,7 +937,7 @@ function createGraphQLImperativeAdapter(luvio, adapter, metadata, astResolver) {
|
|
|
915
937
|
callback(createInvalidConfigError());
|
|
916
938
|
return;
|
|
917
939
|
}
|
|
918
|
-
callback(snapshotToTuple(snapshot));
|
|
940
|
+
callback(isBatch ? batchSnapshotToTuple(snapshot) : snapshotToTuple(snapshot));
|
|
919
941
|
})
|
|
920
942
|
.finally(() => {
|
|
921
943
|
luvio.storeCleanup();
|
|
@@ -930,7 +952,9 @@ function createGraphQLImperativeAdapter(luvio, adapter, metadata, astResolver) {
|
|
|
930
952
|
let subscriberCallback = callback;
|
|
931
953
|
let unsub;
|
|
932
954
|
let coercedConfig = null;
|
|
955
|
+
let isBatch = false;
|
|
933
956
|
if ('batchQuery' in config) {
|
|
957
|
+
isBatch = true;
|
|
934
958
|
coercedConfig = {
|
|
935
959
|
batchQuery: config.batchQuery.map((individualConfig) => ({
|
|
936
960
|
...individualConfig,
|
|
@@ -963,7 +987,9 @@ function createGraphQLImperativeAdapter(luvio, adapter, metadata, astResolver) {
|
|
|
963
987
|
const luvioStoreSubscribe = (snapshot) => {
|
|
964
988
|
unsub = luvio.storeSubscribe(snapshot, (snapshotFromRebuild) => {
|
|
965
989
|
if (subscriberCallback !== null && !isPendingSnapshot(snapshotFromRebuild)) {
|
|
966
|
-
subscriberCallback(
|
|
990
|
+
subscriberCallback(isBatch
|
|
991
|
+
? batchSnapshotToTuple(snapshotFromRebuild)
|
|
992
|
+
: snapshotToTuple(snapshotFromRebuild));
|
|
967
993
|
}
|
|
968
994
|
});
|
|
969
995
|
};
|
|
@@ -971,7 +997,9 @@ function createGraphQLImperativeAdapter(luvio, adapter, metadata, astResolver) {
|
|
|
971
997
|
// We don't want to return pending snapshots to user-land
|
|
972
998
|
// Instead we just subscribe to it
|
|
973
999
|
if (!isPendingSnapshot(snapshotOrPromise)) {
|
|
974
|
-
subscriberCallback(
|
|
1000
|
+
subscriberCallback(isBatch
|
|
1001
|
+
? batchSnapshotToTuple(snapshotOrPromise)
|
|
1002
|
+
: snapshotToTuple(snapshotOrPromise));
|
|
975
1003
|
}
|
|
976
1004
|
luvioStoreSubscribe(snapshotOrPromise);
|
|
977
1005
|
}
|
|
@@ -986,7 +1014,7 @@ function createGraphQLImperativeAdapter(luvio, adapter, metadata, astResolver) {
|
|
|
986
1014
|
// We don't want to return pending snapshots to user-land
|
|
987
1015
|
// Instead we just subscribe to it
|
|
988
1016
|
if (!isPendingSnapshot(snapshot)) {
|
|
989
|
-
subscriberCallback(snapshotToTuple(snapshot));
|
|
1017
|
+
subscriberCallback(isBatch ? batchSnapshotToTuple(snapshot) : snapshotToTuple(snapshot));
|
|
990
1018
|
}
|
|
991
1019
|
luvioStoreSubscribe(snapshot);
|
|
992
1020
|
}
|
|
@@ -1023,4 +1051,4 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
1023
1051
|
}
|
|
1024
1052
|
|
|
1025
1053
|
export { ADAPTER_UNFULFILLED_ERROR, REFRESH_ADAPTER_EVENT, bindWireRefresh, createGraphQLImperativeAdapter, createGraphQLWireAdapterConstructor, createImperativeAdapter, createInfiniteScrollingWireAdapterConstructor, createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, instrument, refresh };
|
|
1026
|
-
// version: 1.
|
|
1054
|
+
// version: 1.372.0-5866fad2db
|
|
@@ -10,7 +10,15 @@ interface ErrorResponse {
|
|
|
10
10
|
data: undefined;
|
|
11
11
|
errors: LuvioErrorResponse[];
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
interface BatchDataResponse {
|
|
14
|
+
data: any;
|
|
15
|
+
error?: undefined;
|
|
16
|
+
}
|
|
17
|
+
interface BatchErrorResponse {
|
|
18
|
+
data: undefined;
|
|
19
|
+
error: LuvioErrorResponse;
|
|
20
|
+
}
|
|
21
|
+
type DataCallbackTuple = DataResponse | ErrorResponse | BatchDataResponse | BatchErrorResponse;
|
|
14
22
|
interface DataCallback {
|
|
15
23
|
(response: DataCallbackTuple): void;
|
|
16
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-bindings",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.372.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS Bindings for SFDC",
|
|
6
6
|
"main": "dist/ldsBindings.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-bindings"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@salesforce/lds-graphql-parser": "^1.
|
|
34
|
+
"@salesforce/lds-graphql-parser": "^1.372.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@lwc/engine-core": "2.42.0"
|