@salesforce/lds-worker-api 1.107.0 → 1.108.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/sfdc/es/ldsWorkerApi.js +1 -1
- package/dist/standalone/es/lds-worker-api.js +52 -16
- package/dist/standalone/umd/lds-worker-api.js +52 -16
- package/package.json +10 -10
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/User.network-mock.json +6604 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/polyquery-and-operator.adapter-testcase.json +28 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/polyquery-and-operator.server-response.network-mock.json +103 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/polyquery-and-operator.adapter-snapshot.result.json +23 -0
|
@@ -743,4 +743,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
743
743
|
}
|
|
744
744
|
|
|
745
745
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
746
|
-
// version: 1.
|
|
746
|
+
// version: 1.108.0-ae43b5312
|
|
@@ -3776,7 +3776,7 @@ function withDefaultLuvio(callback) {
|
|
|
3776
3776
|
}
|
|
3777
3777
|
callbacks.push(callback);
|
|
3778
3778
|
}
|
|
3779
|
-
// version: 1.
|
|
3779
|
+
// version: 1.108.0-ae43b5312
|
|
3780
3780
|
|
|
3781
3781
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3782
3782
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15200,7 +15200,7 @@ function parseAndVisit(source) {
|
|
|
15200
15200
|
updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
|
|
15201
15201
|
return luvioDocumentNode;
|
|
15202
15202
|
}
|
|
15203
|
-
// version: 1.
|
|
15203
|
+
// version: 1.108.0-ae43b5312
|
|
15204
15204
|
|
|
15205
15205
|
function unwrap(data) {
|
|
15206
15206
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16081,7 +16081,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
16081
16081
|
const { apiFamily, name } = metadata;
|
|
16082
16082
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16083
16083
|
}
|
|
16084
|
-
// version: 1.
|
|
16084
|
+
// version: 1.108.0-ae43b5312
|
|
16085
16085
|
|
|
16086
16086
|
/**
|
|
16087
16087
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44024,7 +44024,7 @@ withDefaultLuvio((luvio) => {
|
|
|
44024
44024
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44025
44025
|
});
|
|
44026
44026
|
});
|
|
44027
|
-
// version: 1.
|
|
44027
|
+
// version: 1.108.0-ae43b5312
|
|
44028
44028
|
|
|
44029
44029
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44030
44030
|
|
|
@@ -50800,18 +50800,51 @@ function filterToPredicates(where, recordType, alias, objectInfoMap, joins) {
|
|
|
50800
50800
|
rightPath: `$.id`,
|
|
50801
50801
|
};
|
|
50802
50802
|
const childAlias = `${alias}_${field}`;
|
|
50803
|
-
//
|
|
50804
|
-
// in 'Account' has the 'Owner' as the 'RelationshipName', the api name in 'referenceToInfos' is 'User'
|
|
50805
|
-
const childRecordType = fieldInfo.referenceToInfos[0].apiName;
|
|
50803
|
+
// Join can happen on polymorphic field too which has more than 1 `referenceToInfo`. If 'apiName' is undefined, it indicates a Join on polymorphic field.
|
|
50806
50804
|
const join = {
|
|
50807
50805
|
type: 'LEFT',
|
|
50808
50806
|
alias: childAlias,
|
|
50809
50807
|
to: alias,
|
|
50810
50808
|
conditions: [path],
|
|
50811
|
-
apiName:
|
|
50809
|
+
apiName: fieldInfo.referenceToInfos.length === 1
|
|
50810
|
+
? fieldInfo.referenceToInfos[0].apiName
|
|
50811
|
+
: undefined,
|
|
50812
50812
|
};
|
|
50813
50813
|
joins.push(join);
|
|
50814
|
-
|
|
50814
|
+
// 'RelationshipName' can be different from 'apiName'. For example, 'OwnerId' field
|
|
50815
|
+
// in 'Account' has the 'Owner' as the 'RelationshipName', the api name in 'referenceToInfos' is 'User'
|
|
50816
|
+
if (fieldInfo.referenceToInfos.length === 1) {
|
|
50817
|
+
const childRecordType = fieldInfo.referenceToInfos[0].apiName;
|
|
50818
|
+
predicates.push(...filterToPredicates(where[field], childRecordType, childAlias, objectInfoMap, joins));
|
|
50819
|
+
}
|
|
50820
|
+
else {
|
|
50821
|
+
// @W-12618378 polymorphic query sometimes does not work as expected on server. The GQL on certain entities could fail.
|
|
50822
|
+
const entityNames = keys$3(where[field]);
|
|
50823
|
+
const polyPredicatesGroups = entityNames
|
|
50824
|
+
.filter((entityName) => fieldInfo.referenceToInfos.some((referenceInfo) => referenceInfo.apiName === entityName))
|
|
50825
|
+
.map((entityName) => {
|
|
50826
|
+
return [
|
|
50827
|
+
{
|
|
50828
|
+
alias: childAlias,
|
|
50829
|
+
leftPath: '$.apiName',
|
|
50830
|
+
operator: '=',
|
|
50831
|
+
value: entityName,
|
|
50832
|
+
dataType: 'String',
|
|
50833
|
+
type: PredicateType.single,
|
|
50834
|
+
},
|
|
50835
|
+
...filterToPredicates(where[field][entityName], entityName, childAlias, objectInfoMap, joins),
|
|
50836
|
+
];
|
|
50837
|
+
});
|
|
50838
|
+
if (polyPredicatesGroups.length === 1) {
|
|
50839
|
+
predicates.push(...polyPredicatesGroups[0]);
|
|
50840
|
+
}
|
|
50841
|
+
else {
|
|
50842
|
+
// if polymorphic field has more than 1 entity like `{Owner: { User: {...} Group: {...}}}`, precidates for each entity(`User` and `Group`) should have
|
|
50843
|
+
// `and` operation. while at the base polymorphic field level (`Owner`), the group of compound predicates for each entity should have `or` operation.
|
|
50844
|
+
const polyCompoundPredicates = polyPredicatesGroups.map((polyEntityPredicates) => transformCompoundPredicate('and', polyEntityPredicates));
|
|
50845
|
+
predicates.push(transformCompoundPredicate('or', polyCompoundPredicates));
|
|
50846
|
+
}
|
|
50847
|
+
}
|
|
50815
50848
|
}
|
|
50816
50849
|
else {
|
|
50817
50850
|
for (const [op, value] of entries$2(where[field])) {
|
|
@@ -51115,16 +51148,19 @@ function processCompoundPredicate(operator, filters, recordType, alias, objectIn
|
|
|
51115
51148
|
const predicates = filters
|
|
51116
51149
|
.map((filter) => filterToPredicates(filter, recordType, alias, objectInfoMap, joins))
|
|
51117
51150
|
.reduce(flatten);
|
|
51118
|
-
|
|
51151
|
+
return transformCompoundPredicate(operator, predicates);
|
|
51152
|
+
}
|
|
51153
|
+
function transformCompoundPredicate(operator, childPredicates) {
|
|
51154
|
+
const diffCompoundPredicates = childPredicates
|
|
51119
51155
|
.filter(isCompoundPredicate)
|
|
51120
51156
|
.filter((compoundPredicate) => compoundPredicate.operator !== operator);
|
|
51121
51157
|
// flattens the child compound predicate if its operator is the same of its parent to improve the SQL efficiency.
|
|
51122
|
-
const sameCompoundPredicates =
|
|
51158
|
+
const sameCompoundPredicates = childPredicates
|
|
51123
51159
|
.filter(isCompoundPredicate)
|
|
51124
51160
|
.filter((compoundPredicate) => compoundPredicate.operator === operator)
|
|
51125
51161
|
.map((pred) => pred.children)
|
|
51126
51162
|
.reduce(flatten, []);
|
|
51127
|
-
const singlePredicates =
|
|
51163
|
+
const singlePredicates = childPredicates.filter((p) => isSinglePredicate(p) || isNotPredicate(p));
|
|
51128
51164
|
const children = [...diffCompoundPredicates, ...sameCompoundPredicates, ...singlePredicates];
|
|
51129
51165
|
if (children.length === 1) {
|
|
51130
51166
|
return children[0];
|
|
@@ -59242,7 +59278,7 @@ register({
|
|
|
59242
59278
|
id: '@salesforce/lds-network-adapter',
|
|
59243
59279
|
instrument: instrument$1,
|
|
59244
59280
|
});
|
|
59245
|
-
// version: 1.
|
|
59281
|
+
// version: 1.108.0-ae43b5312
|
|
59246
59282
|
|
|
59247
59283
|
const { create: create$2, keys: keys$2 } = Object;
|
|
59248
59284
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -76895,7 +76931,7 @@ register({
|
|
|
76895
76931
|
configuration: { ...configurationForGraphQLAdapters },
|
|
76896
76932
|
instrument,
|
|
76897
76933
|
});
|
|
76898
|
-
// version: 1.
|
|
76934
|
+
// version: 1.108.0-ae43b5312
|
|
76899
76935
|
|
|
76900
76936
|
// On core the unstable adapters are re-exported with different names,
|
|
76901
76937
|
|
|
@@ -79024,7 +79060,7 @@ withDefaultLuvio((luvio) => {
|
|
|
79024
79060
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
79025
79061
|
graphQLImperative = ldsAdapter;
|
|
79026
79062
|
});
|
|
79027
|
-
// version: 1.
|
|
79063
|
+
// version: 1.108.0-ae43b5312
|
|
79028
79064
|
|
|
79029
79065
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
79030
79066
|
__proto__: null,
|
|
@@ -79698,4 +79734,4 @@ const { luvio } = getRuntime();
|
|
|
79698
79734
|
setDefaultLuvio({ luvio });
|
|
79699
79735
|
|
|
79700
79736
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
79701
|
-
// version: 1.
|
|
79737
|
+
// version: 1.108.0-ae43b5312
|
|
@@ -3782,7 +3782,7 @@
|
|
|
3782
3782
|
}
|
|
3783
3783
|
callbacks.push(callback);
|
|
3784
3784
|
}
|
|
3785
|
-
// version: 1.
|
|
3785
|
+
// version: 1.108.0-ae43b5312
|
|
3786
3786
|
|
|
3787
3787
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3788
3788
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15206,7 +15206,7 @@
|
|
|
15206
15206
|
updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
|
|
15207
15207
|
return luvioDocumentNode;
|
|
15208
15208
|
}
|
|
15209
|
-
// version: 1.
|
|
15209
|
+
// version: 1.108.0-ae43b5312
|
|
15210
15210
|
|
|
15211
15211
|
function unwrap(data) {
|
|
15212
15212
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16087,7 +16087,7 @@
|
|
|
16087
16087
|
const { apiFamily, name } = metadata;
|
|
16088
16088
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16089
16089
|
}
|
|
16090
|
-
// version: 1.
|
|
16090
|
+
// version: 1.108.0-ae43b5312
|
|
16091
16091
|
|
|
16092
16092
|
/**
|
|
16093
16093
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44030,7 +44030,7 @@
|
|
|
44030
44030
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44031
44031
|
});
|
|
44032
44032
|
});
|
|
44033
|
-
// version: 1.
|
|
44033
|
+
// version: 1.108.0-ae43b5312
|
|
44034
44034
|
|
|
44035
44035
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44036
44036
|
|
|
@@ -50806,18 +50806,51 @@
|
|
|
50806
50806
|
rightPath: `$.id`,
|
|
50807
50807
|
};
|
|
50808
50808
|
const childAlias = `${alias}_${field}`;
|
|
50809
|
-
//
|
|
50810
|
-
// in 'Account' has the 'Owner' as the 'RelationshipName', the api name in 'referenceToInfos' is 'User'
|
|
50811
|
-
const childRecordType = fieldInfo.referenceToInfos[0].apiName;
|
|
50809
|
+
// Join can happen on polymorphic field too which has more than 1 `referenceToInfo`. If 'apiName' is undefined, it indicates a Join on polymorphic field.
|
|
50812
50810
|
const join = {
|
|
50813
50811
|
type: 'LEFT',
|
|
50814
50812
|
alias: childAlias,
|
|
50815
50813
|
to: alias,
|
|
50816
50814
|
conditions: [path],
|
|
50817
|
-
apiName:
|
|
50815
|
+
apiName: fieldInfo.referenceToInfos.length === 1
|
|
50816
|
+
? fieldInfo.referenceToInfos[0].apiName
|
|
50817
|
+
: undefined,
|
|
50818
50818
|
};
|
|
50819
50819
|
joins.push(join);
|
|
50820
|
-
|
|
50820
|
+
// 'RelationshipName' can be different from 'apiName'. For example, 'OwnerId' field
|
|
50821
|
+
// in 'Account' has the 'Owner' as the 'RelationshipName', the api name in 'referenceToInfos' is 'User'
|
|
50822
|
+
if (fieldInfo.referenceToInfos.length === 1) {
|
|
50823
|
+
const childRecordType = fieldInfo.referenceToInfos[0].apiName;
|
|
50824
|
+
predicates.push(...filterToPredicates(where[field], childRecordType, childAlias, objectInfoMap, joins));
|
|
50825
|
+
}
|
|
50826
|
+
else {
|
|
50827
|
+
// @W-12618378 polymorphic query sometimes does not work as expected on server. The GQL on certain entities could fail.
|
|
50828
|
+
const entityNames = keys$3(where[field]);
|
|
50829
|
+
const polyPredicatesGroups = entityNames
|
|
50830
|
+
.filter((entityName) => fieldInfo.referenceToInfos.some((referenceInfo) => referenceInfo.apiName === entityName))
|
|
50831
|
+
.map((entityName) => {
|
|
50832
|
+
return [
|
|
50833
|
+
{
|
|
50834
|
+
alias: childAlias,
|
|
50835
|
+
leftPath: '$.apiName',
|
|
50836
|
+
operator: '=',
|
|
50837
|
+
value: entityName,
|
|
50838
|
+
dataType: 'String',
|
|
50839
|
+
type: PredicateType.single,
|
|
50840
|
+
},
|
|
50841
|
+
...filterToPredicates(where[field][entityName], entityName, childAlias, objectInfoMap, joins),
|
|
50842
|
+
];
|
|
50843
|
+
});
|
|
50844
|
+
if (polyPredicatesGroups.length === 1) {
|
|
50845
|
+
predicates.push(...polyPredicatesGroups[0]);
|
|
50846
|
+
}
|
|
50847
|
+
else {
|
|
50848
|
+
// if polymorphic field has more than 1 entity like `{Owner: { User: {...} Group: {...}}}`, precidates for each entity(`User` and `Group`) should have
|
|
50849
|
+
// `and` operation. while at the base polymorphic field level (`Owner`), the group of compound predicates for each entity should have `or` operation.
|
|
50850
|
+
const polyCompoundPredicates = polyPredicatesGroups.map((polyEntityPredicates) => transformCompoundPredicate('and', polyEntityPredicates));
|
|
50851
|
+
predicates.push(transformCompoundPredicate('or', polyCompoundPredicates));
|
|
50852
|
+
}
|
|
50853
|
+
}
|
|
50821
50854
|
}
|
|
50822
50855
|
else {
|
|
50823
50856
|
for (const [op, value] of entries$2(where[field])) {
|
|
@@ -51121,16 +51154,19 @@
|
|
|
51121
51154
|
const predicates = filters
|
|
51122
51155
|
.map((filter) => filterToPredicates(filter, recordType, alias, objectInfoMap, joins))
|
|
51123
51156
|
.reduce(flatten);
|
|
51124
|
-
|
|
51157
|
+
return transformCompoundPredicate(operator, predicates);
|
|
51158
|
+
}
|
|
51159
|
+
function transformCompoundPredicate(operator, childPredicates) {
|
|
51160
|
+
const diffCompoundPredicates = childPredicates
|
|
51125
51161
|
.filter(isCompoundPredicate)
|
|
51126
51162
|
.filter((compoundPredicate) => compoundPredicate.operator !== operator);
|
|
51127
51163
|
// flattens the child compound predicate if its operator is the same of its parent to improve the SQL efficiency.
|
|
51128
|
-
const sameCompoundPredicates =
|
|
51164
|
+
const sameCompoundPredicates = childPredicates
|
|
51129
51165
|
.filter(isCompoundPredicate)
|
|
51130
51166
|
.filter((compoundPredicate) => compoundPredicate.operator === operator)
|
|
51131
51167
|
.map((pred) => pred.children)
|
|
51132
51168
|
.reduce(flatten, []);
|
|
51133
|
-
const singlePredicates =
|
|
51169
|
+
const singlePredicates = childPredicates.filter((p) => isSinglePredicate(p) || isNotPredicate(p));
|
|
51134
51170
|
const children = [...diffCompoundPredicates, ...sameCompoundPredicates, ...singlePredicates];
|
|
51135
51171
|
if (children.length === 1) {
|
|
51136
51172
|
return children[0];
|
|
@@ -59248,7 +59284,7 @@
|
|
|
59248
59284
|
id: '@salesforce/lds-network-adapter',
|
|
59249
59285
|
instrument: instrument$1,
|
|
59250
59286
|
});
|
|
59251
|
-
// version: 1.
|
|
59287
|
+
// version: 1.108.0-ae43b5312
|
|
59252
59288
|
|
|
59253
59289
|
const { create: create$2, keys: keys$2 } = Object;
|
|
59254
59290
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -76901,7 +76937,7 @@
|
|
|
76901
76937
|
configuration: { ...configurationForGraphQLAdapters },
|
|
76902
76938
|
instrument,
|
|
76903
76939
|
});
|
|
76904
|
-
// version: 1.
|
|
76940
|
+
// version: 1.108.0-ae43b5312
|
|
76905
76941
|
|
|
76906
76942
|
// On core the unstable adapters are re-exported with different names,
|
|
76907
76943
|
|
|
@@ -79030,7 +79066,7 @@
|
|
|
79030
79066
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
79031
79067
|
graphQLImperative = ldsAdapter;
|
|
79032
79068
|
});
|
|
79033
|
-
// version: 1.
|
|
79069
|
+
// version: 1.108.0-ae43b5312
|
|
79034
79070
|
|
|
79035
79071
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
79036
79072
|
__proto__: null,
|
|
@@ -79721,4 +79757,4 @@
|
|
|
79721
79757
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
79722
79758
|
|
|
79723
79759
|
}));
|
|
79724
|
-
// version: 1.
|
|
79760
|
+
// version: 1.108.0-ae43b5312
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.108.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/standalone/umd/lds-worker-api.js",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"@luvio/engine": "0.135.4",
|
|
38
38
|
"@luvio/environments": "0.135.4",
|
|
39
39
|
"@oat-sa/rollup-plugin-wildcard-external": "^0.1.0",
|
|
40
|
-
"@salesforce/lds-adapters-graphql": "^1.
|
|
41
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
42
|
-
"@salesforce/lds-default-luvio": "^1.
|
|
43
|
-
"@salesforce/lds-drafts": "^1.
|
|
44
|
-
"@salesforce/lds-graphql-parser": "^1.
|
|
45
|
-
"@salesforce/lds-luvio-engine": "^1.
|
|
46
|
-
"@salesforce/lds-priming": "^1.
|
|
47
|
-
"@salesforce/lds-runtime-mobile": "^1.
|
|
48
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
40
|
+
"@salesforce/lds-adapters-graphql": "^1.108.0",
|
|
41
|
+
"@salesforce/lds-adapters-uiapi": "^1.108.0",
|
|
42
|
+
"@salesforce/lds-default-luvio": "^1.108.0",
|
|
43
|
+
"@salesforce/lds-drafts": "^1.108.0",
|
|
44
|
+
"@salesforce/lds-graphql-parser": "^1.108.0",
|
|
45
|
+
"@salesforce/lds-luvio-engine": "^1.108.0",
|
|
46
|
+
"@salesforce/lds-priming": "^1.108.0",
|
|
47
|
+
"@salesforce/lds-runtime-mobile": "^1.108.0",
|
|
48
|
+
"@salesforce/nimbus-plugin-lds": "^1.108.0",
|
|
49
49
|
"ajv": "^8.11.0",
|
|
50
50
|
"glob": "^7.1.5",
|
|
51
51
|
"nimbus-types": "^2.0.0-alpha1",
|