@salesforce/lds-worker-api 1.228.0 → 1.229.0-dev1
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 +375 -171
- package/dist/standalone/umd/lds-worker-api.js +375 -171
- package/package.json +13 -10
|
@@ -3847,7 +3847,7 @@
|
|
|
3847
3847
|
}
|
|
3848
3848
|
return resourceParams;
|
|
3849
3849
|
}
|
|
3850
|
-
// engine version: 0.145.
|
|
3850
|
+
// engine version: 0.145.2-6a13677c
|
|
3851
3851
|
|
|
3852
3852
|
/**
|
|
3853
3853
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3974,7 +3974,7 @@
|
|
|
3974
3974
|
}
|
|
3975
3975
|
callbacks.push(callback);
|
|
3976
3976
|
}
|
|
3977
|
-
// version: 1.
|
|
3977
|
+
// version: 1.229.0-dev1-f69d054a9
|
|
3978
3978
|
|
|
3979
3979
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3980
3980
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15435,7 +15435,7 @@
|
|
|
15435
15435
|
}
|
|
15436
15436
|
return superResult;
|
|
15437
15437
|
}
|
|
15438
|
-
// version: 1.
|
|
15438
|
+
// version: 1.229.0-dev1-f69d054a9
|
|
15439
15439
|
|
|
15440
15440
|
function unwrap(data) {
|
|
15441
15441
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16358,7 +16358,7 @@
|
|
|
16358
16358
|
const { apiFamily, name } = metadata;
|
|
16359
16359
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16360
16360
|
}
|
|
16361
|
-
// version: 1.
|
|
16361
|
+
// version: 1.229.0-dev1-f69d054a9
|
|
16362
16362
|
|
|
16363
16363
|
/**
|
|
16364
16364
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -16457,7 +16457,7 @@
|
|
|
16457
16457
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
16458
16458
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
16459
16459
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
16460
|
-
// engine version: 0.145.
|
|
16460
|
+
// engine version: 0.145.2-6a13677c
|
|
16461
16461
|
|
|
16462
16462
|
const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
|
|
16463
16463
|
|
|
@@ -20461,7 +20461,7 @@
|
|
|
20461
20461
|
const batchRequestWithSingleRequest = isSingleBatchRecordRequest(existingUrlParams) &&
|
|
20462
20462
|
isSingleRecordRequest(urlParams) &&
|
|
20463
20463
|
incomingUrlRecords[0] === existingUrlRecords[0];
|
|
20464
|
-
if (!batchRequestWithSingleRequest) {
|
|
20464
|
+
if (!batchRequestWithSingleRequest || isRestrictedPathCondition(existingPath, path)) {
|
|
20465
20465
|
return false;
|
|
20466
20466
|
}
|
|
20467
20467
|
}
|
|
@@ -20504,6 +20504,12 @@
|
|
|
20504
20504
|
function isSingleRecordRequest(urlParams) {
|
|
20505
20505
|
return hasOwnProperty$1.call(urlParams, 'recordId');
|
|
20506
20506
|
}
|
|
20507
|
+
function isRestrictedPathCondition(existingPath, path) {
|
|
20508
|
+
// should not dedupe getRecordUi and getRecord as both of their representation is different
|
|
20509
|
+
// records call cannot digest response of getRecordUi
|
|
20510
|
+
return ((existingPath.includes('/record-ui') && path.includes('/records')) ||
|
|
20511
|
+
(existingPath.includes('/records') && path.includes('/record-ui')));
|
|
20512
|
+
}
|
|
20507
20513
|
|
|
20508
20514
|
const createResourceRequest$12 = function getUiApiRecordsByRecordIdCreateResourceRequest(config) {
|
|
20509
20515
|
return {
|
|
@@ -41158,7 +41164,7 @@
|
|
|
41158
41164
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
|
|
41159
41165
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
|
|
41160
41166
|
});
|
|
41161
|
-
// version: 1.
|
|
41167
|
+
// version: 1.229.0-dev1-5b6d3db67
|
|
41162
41168
|
|
|
41163
41169
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
41164
41170
|
|
|
@@ -42692,6 +42698,72 @@
|
|
|
42692
42698
|
});
|
|
42693
42699
|
}
|
|
42694
42700
|
|
|
42701
|
+
/**
|
|
42702
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
42703
|
+
* All rights reserved.
|
|
42704
|
+
* For full license text, see the LICENSE.txt file
|
|
42705
|
+
*/
|
|
42706
|
+
|
|
42707
|
+
const API_NAMESPACE$1 = 'UiApi';
|
|
42708
|
+
const RECORD_REPRESENTATION_NAME$2 = 'RecordRepresentation';
|
|
42709
|
+
const RECORD_VIEW_ENTITY_REPRESENTATION_NAME$1 = 'RecordViewEntityRepresentation';
|
|
42710
|
+
const RECORD_ID_PREFIX$1 = `${API_NAMESPACE$1}::${RECORD_REPRESENTATION_NAME$2}:`;
|
|
42711
|
+
const RECORD_VIEW_ENTITY_ID_PREFIX$1 = `${API_NAMESPACE$1}::${RECORD_VIEW_ENTITY_REPRESENTATION_NAME$1}:Name:`;
|
|
42712
|
+
const RECORD_FIELDS_KEY_JUNCTION$1 = '__fields__';
|
|
42713
|
+
function isStoreKeyRecordId(key) {
|
|
42714
|
+
return key.indexOf(RECORD_ID_PREFIX$1) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) === -1;
|
|
42715
|
+
}
|
|
42716
|
+
function isStoreKeyRecordViewEntity$1(key) {
|
|
42717
|
+
return (key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX$1) > -1 &&
|
|
42718
|
+
key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) === -1);
|
|
42719
|
+
}
|
|
42720
|
+
function isStoreKeyRecordField(key) {
|
|
42721
|
+
return key.indexOf(RECORD_ID_PREFIX$1) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) > -1;
|
|
42722
|
+
}
|
|
42723
|
+
function extractRecordIdFromStoreKey$1(key) {
|
|
42724
|
+
if (key === undefined ||
|
|
42725
|
+
(key.indexOf(RECORD_ID_PREFIX$1) === -1 && key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX$1) === -1)) {
|
|
42726
|
+
return undefined;
|
|
42727
|
+
}
|
|
42728
|
+
const parts = key.split(':');
|
|
42729
|
+
return parts[parts.length - 1].split('_')[0];
|
|
42730
|
+
}
|
|
42731
|
+
function buildRecordFieldStoreKey(recordKey, fieldName) {
|
|
42732
|
+
return `${recordKey}${RECORD_FIELDS_KEY_JUNCTION$1}${fieldName}`;
|
|
42733
|
+
}
|
|
42734
|
+
function objectsDeepEqual(lhs, rhs) {
|
|
42735
|
+
if (lhs === rhs)
|
|
42736
|
+
return true;
|
|
42737
|
+
if (typeof lhs !== 'object' || typeof rhs !== 'object' || lhs === null || rhs === null)
|
|
42738
|
+
return false;
|
|
42739
|
+
const lhsKeys = Object.keys(lhs);
|
|
42740
|
+
const rhsKeys = Object.keys(rhs);
|
|
42741
|
+
if (lhsKeys.length !== rhsKeys.length)
|
|
42742
|
+
return false;
|
|
42743
|
+
for (let key of lhsKeys) {
|
|
42744
|
+
if (!rhsKeys.includes(key))
|
|
42745
|
+
return false;
|
|
42746
|
+
if (typeof lhs[key] === 'function' || typeof rhs[key] === 'function') {
|
|
42747
|
+
if (lhs[key].toString() !== rhs[key].toString())
|
|
42748
|
+
return false;
|
|
42749
|
+
}
|
|
42750
|
+
else {
|
|
42751
|
+
if (!objectsDeepEqual(lhs[key], rhs[key]))
|
|
42752
|
+
return false;
|
|
42753
|
+
}
|
|
42754
|
+
}
|
|
42755
|
+
return true;
|
|
42756
|
+
}
|
|
42757
|
+
|
|
42758
|
+
function isStoreRecordError(storeRecord) {
|
|
42759
|
+
return storeRecord.__type === 'error';
|
|
42760
|
+
}
|
|
42761
|
+
function isEntryDurableRecordRepresentation(entry, key) {
|
|
42762
|
+
// Either a DurableRecordRepresentation or StoreRecordError can live at a record key
|
|
42763
|
+
return ((isStoreKeyRecordId(key) || isStoreKeyRecordViewEntity$1(key)) &&
|
|
42764
|
+
entry.data.__type === undefined);
|
|
42765
|
+
}
|
|
42766
|
+
|
|
42695
42767
|
/**
|
|
42696
42768
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
42697
42769
|
* All rights reserved.
|
|
@@ -45890,7 +45962,11 @@
|
|
|
45890
45962
|
try {
|
|
45891
45963
|
const { data, seenRecords } = await queryEvaluator(rootQuery, context, eventEmitter);
|
|
45892
45964
|
const rebuildWithStoreEval = ((originalSnapshot) => {
|
|
45893
|
-
return storeEval(config, originalSnapshot, observers, connectionKeyBuilder)
|
|
45965
|
+
return storeEval(config, originalSnapshot, observers, connectionKeyBuilder).then((rebuiltSnapshot) => {
|
|
45966
|
+
return objectsDeepEqual(originalSnapshot.data, rebuiltSnapshot.data)
|
|
45967
|
+
? originalSnapshot
|
|
45968
|
+
: rebuiltSnapshot;
|
|
45969
|
+
});
|
|
45894
45970
|
});
|
|
45895
45971
|
const recordId = generateUniqueRecordId$1();
|
|
45896
45972
|
// if the non-eval'ed snapshot was an error then we return a synthetic
|
|
@@ -47836,49 +47912,6 @@
|
|
|
47836
47912
|
});
|
|
47837
47913
|
}
|
|
47838
47914
|
|
|
47839
|
-
/**
|
|
47840
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
47841
|
-
* All rights reserved.
|
|
47842
|
-
* For full license text, see the LICENSE.txt file
|
|
47843
|
-
*/
|
|
47844
|
-
|
|
47845
|
-
const API_NAMESPACE$1 = 'UiApi';
|
|
47846
|
-
const RECORD_REPRESENTATION_NAME$2 = 'RecordRepresentation';
|
|
47847
|
-
const RECORD_VIEW_ENTITY_REPRESENTATION_NAME$1 = 'RecordViewEntityRepresentation';
|
|
47848
|
-
const RECORD_ID_PREFIX$1 = `${API_NAMESPACE$1}::${RECORD_REPRESENTATION_NAME$2}:`;
|
|
47849
|
-
const RECORD_VIEW_ENTITY_ID_PREFIX$1 = `${API_NAMESPACE$1}::${RECORD_VIEW_ENTITY_REPRESENTATION_NAME$1}:Name:`;
|
|
47850
|
-
const RECORD_FIELDS_KEY_JUNCTION$1 = '__fields__';
|
|
47851
|
-
function isStoreKeyRecordId(key) {
|
|
47852
|
-
return key.indexOf(RECORD_ID_PREFIX$1) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) === -1;
|
|
47853
|
-
}
|
|
47854
|
-
function isStoreKeyRecordViewEntity$1(key) {
|
|
47855
|
-
return (key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX$1) > -1 &&
|
|
47856
|
-
key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) === -1);
|
|
47857
|
-
}
|
|
47858
|
-
function isStoreKeyRecordField(key) {
|
|
47859
|
-
return key.indexOf(RECORD_ID_PREFIX$1) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) > -1;
|
|
47860
|
-
}
|
|
47861
|
-
function extractRecordIdFromStoreKey$1(key) {
|
|
47862
|
-
if (key === undefined ||
|
|
47863
|
-
(key.indexOf(RECORD_ID_PREFIX$1) === -1 && key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX$1) === -1)) {
|
|
47864
|
-
return undefined;
|
|
47865
|
-
}
|
|
47866
|
-
const parts = key.split(':');
|
|
47867
|
-
return parts[parts.length - 1].split('_')[0];
|
|
47868
|
-
}
|
|
47869
|
-
function buildRecordFieldStoreKey(recordKey, fieldName) {
|
|
47870
|
-
return `${recordKey}${RECORD_FIELDS_KEY_JUNCTION$1}${fieldName}`;
|
|
47871
|
-
}
|
|
47872
|
-
|
|
47873
|
-
function isStoreRecordError(storeRecord) {
|
|
47874
|
-
return storeRecord.__type === 'error';
|
|
47875
|
-
}
|
|
47876
|
-
function isEntryDurableRecordRepresentation(entry, key) {
|
|
47877
|
-
// Either a DurableRecordRepresentation or StoreRecordError can live at a record key
|
|
47878
|
-
return ((isStoreKeyRecordId(key) || isStoreKeyRecordViewEntity$1(key)) &&
|
|
47879
|
-
entry.data.__type === undefined);
|
|
47880
|
-
}
|
|
47881
|
-
|
|
47882
47915
|
function serializeFieldArguments$1(argumentNodes, variables) {
|
|
47883
47916
|
const mutableArgumentNodes = Object.assign([], argumentNodes);
|
|
47884
47917
|
return `args__(${mutableArgumentNodes
|
|
@@ -54049,6 +54082,9 @@
|
|
|
54049
54082
|
if (!rebuildResult.errors) {
|
|
54050
54083
|
rebuildResult = removeSyntheticFields(rebuildResult, config.query);
|
|
54051
54084
|
}
|
|
54085
|
+
if (objectsDeepEqual(rebuildResult, originalSnapshot.data)) {
|
|
54086
|
+
return originalSnapshot;
|
|
54087
|
+
}
|
|
54052
54088
|
// 'originalSnapshot' is the local eval snapshot subscribed. It is always in 'Fulfilled' state. This behavior would change once W-1273462(rebuild non-evaluated snapshot when the graphql local eval rebuild is triggered) is resolved.
|
|
54053
54089
|
return {
|
|
54054
54090
|
...originalSnapshot,
|
|
@@ -57816,7 +57852,7 @@
|
|
|
57816
57852
|
id: '@salesforce/lds-network-adapter',
|
|
57817
57853
|
instrument: instrument$1,
|
|
57818
57854
|
});
|
|
57819
|
-
// version: 1.
|
|
57855
|
+
// version: 1.229.0-dev1-f69d054a9
|
|
57820
57856
|
|
|
57821
57857
|
const { create: create$2, keys: keys$2 } = Object;
|
|
57822
57858
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -57831,6 +57867,21 @@
|
|
|
57831
57867
|
});
|
|
57832
57868
|
return fragments;
|
|
57833
57869
|
}
|
|
57870
|
+
function mergeFragmentWithExistingSelections(fragmentFieldSelection, existingSelections) {
|
|
57871
|
+
// Check if there is an existing selection for this field we can merge with
|
|
57872
|
+
const existingField = getRequestedField(fragmentFieldSelection.name.value, existingSelections);
|
|
57873
|
+
if (existingField === undefined) {
|
|
57874
|
+
existingSelections.push(fragmentFieldSelection);
|
|
57875
|
+
}
|
|
57876
|
+
else {
|
|
57877
|
+
if (existingField.selectionSet) {
|
|
57878
|
+
const mergedSelections = mergeSelectionSets(existingField.selectionSet, fragmentFieldSelection.selectionSet);
|
|
57879
|
+
existingField.selectionSet.selections = mergedSelections
|
|
57880
|
+
? mergedSelections.selections
|
|
57881
|
+
: [];
|
|
57882
|
+
}
|
|
57883
|
+
}
|
|
57884
|
+
}
|
|
57834
57885
|
|
|
57835
57886
|
function buildFieldState(state, fullPath, data) {
|
|
57836
57887
|
return {
|
|
@@ -57899,6 +57950,220 @@
|
|
|
57899
57950
|
}
|
|
57900
57951
|
}
|
|
57901
57952
|
}
|
|
57953
|
+
let selectionSetRequestedFieldsWeakMap = new WeakMap();
|
|
57954
|
+
function getRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
|
|
57955
|
+
let cachedRequestedFieldsConfigurations = selectionSetRequestedFieldsWeakMap.get(selectionSet);
|
|
57956
|
+
if (cachedRequestedFieldsConfigurations === undefined) {
|
|
57957
|
+
cachedRequestedFieldsConfigurations = new Map();
|
|
57958
|
+
selectionSetRequestedFieldsWeakMap.set(selectionSet, cachedRequestedFieldsConfigurations);
|
|
57959
|
+
}
|
|
57960
|
+
const cachedRequestedFieldsForType = cachedRequestedFieldsConfigurations.get(typename);
|
|
57961
|
+
if (cachedRequestedFieldsForType !== undefined) {
|
|
57962
|
+
return cachedRequestedFieldsForType;
|
|
57963
|
+
}
|
|
57964
|
+
const selections = calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable);
|
|
57965
|
+
cachedRequestedFieldsConfigurations.set(typename, selections);
|
|
57966
|
+
return selections;
|
|
57967
|
+
}
|
|
57968
|
+
function getRequestedField(responseDataFieldName, requestedFields) {
|
|
57969
|
+
return requestedFields.find((fieldNode) => (fieldNode.alias && fieldNode.alias.value === responseDataFieldName) ||
|
|
57970
|
+
(!fieldNode.alias && fieldNode.name.value === responseDataFieldName));
|
|
57971
|
+
}
|
|
57972
|
+
function calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
|
|
57973
|
+
const selections = [];
|
|
57974
|
+
selectionSet.selections.forEach((selection) => {
|
|
57975
|
+
if (selection.kind === 'Field') {
|
|
57976
|
+
selections.push(selection);
|
|
57977
|
+
}
|
|
57978
|
+
if (selection.kind === 'InlineFragment' && isFragmentApplicable(selection, typename)) {
|
|
57979
|
+
// loops over the map to get the values.
|
|
57980
|
+
getRequestedFieldsForType(typename, selection.selectionSet, namedFragmentsMap, isFragmentApplicable).forEach((fragmentFieldSelection) => {
|
|
57981
|
+
mergeFragmentWithExistingSelections(fragmentFieldSelection, selections);
|
|
57982
|
+
});
|
|
57983
|
+
}
|
|
57984
|
+
if (selection.kind === 'FragmentSpread') {
|
|
57985
|
+
const namedFragment = namedFragmentsMap[selection.name.value];
|
|
57986
|
+
if (namedFragment && isFragmentApplicable(namedFragment, typename)) {
|
|
57987
|
+
// loops over the map to get the values.
|
|
57988
|
+
getRequestedFieldsForType(typename, namedFragment.selectionSet, namedFragmentsMap, isFragmentApplicable).forEach((fragmentFieldSelection) => {
|
|
57989
|
+
mergeFragmentWithExistingSelections(fragmentFieldSelection, selections);
|
|
57990
|
+
});
|
|
57991
|
+
}
|
|
57992
|
+
}
|
|
57993
|
+
});
|
|
57994
|
+
// Needs to happen after the selections are merged.
|
|
57995
|
+
return selections.reduce((acc, fieldNode) => {
|
|
57996
|
+
const fieldName = fieldNode.alias ? fieldNode.alias.value : fieldNode.name.value;
|
|
57997
|
+
// TODO: W-13485835. Some fields are not being merged, and this logic reproduces the current behavior in which the first field with name is being used.
|
|
57998
|
+
if (!acc.has(fieldName)) {
|
|
57999
|
+
acc.set(fieldName, fieldNode);
|
|
58000
|
+
}
|
|
58001
|
+
else {
|
|
58002
|
+
const existingFieldNode = acc.get(fieldName);
|
|
58003
|
+
acc.set(fieldName, {
|
|
58004
|
+
...existingFieldNode,
|
|
58005
|
+
selectionSet: mergeSelectionSets(existingFieldNode === null || existingFieldNode === void 0 ? void 0 : existingFieldNode.selectionSet, fieldNode.selectionSet),
|
|
58006
|
+
});
|
|
58007
|
+
}
|
|
58008
|
+
return acc;
|
|
58009
|
+
}, new Map());
|
|
58010
|
+
}
|
|
58011
|
+
function mergeSelectionSets(set1, set2) {
|
|
58012
|
+
if (!set2) {
|
|
58013
|
+
return set1;
|
|
58014
|
+
}
|
|
58015
|
+
const set1Selections = !set1 ? [] : set1.selections;
|
|
58016
|
+
const mergedSelections = [...set1Selections];
|
|
58017
|
+
for (const selection of set2.selections) {
|
|
58018
|
+
if (selection.kind === 'Field') {
|
|
58019
|
+
const existingFieldIndex = mergedSelections.findIndex((sel) => {
|
|
58020
|
+
return sel.kind === 'Field' && isExactSameField(sel, selection);
|
|
58021
|
+
});
|
|
58022
|
+
if (existingFieldIndex > -1) {
|
|
58023
|
+
const existingField = mergedSelections[existingFieldIndex];
|
|
58024
|
+
const mergedSelectionSet = mergeSelectionSets(existingField.selectionSet, selection.selectionSet);
|
|
58025
|
+
if (mergedSelectionSet) {
|
|
58026
|
+
mergedSelections[existingFieldIndex] = {
|
|
58027
|
+
...existingField,
|
|
58028
|
+
selectionSet: mergedSelectionSet,
|
|
58029
|
+
};
|
|
58030
|
+
}
|
|
58031
|
+
}
|
|
58032
|
+
else {
|
|
58033
|
+
mergedSelections.push(selection);
|
|
58034
|
+
}
|
|
58035
|
+
}
|
|
58036
|
+
else if (selection.kind === 'FragmentSpread') {
|
|
58037
|
+
if (!mergedSelections.some((sel) => sel.kind === 'FragmentSpread' &&
|
|
58038
|
+
sel.name.value === selection.name.value &&
|
|
58039
|
+
areDirectivesEqual(sel.directives, selection.directives))) {
|
|
58040
|
+
mergedSelections.push(selection);
|
|
58041
|
+
}
|
|
58042
|
+
}
|
|
58043
|
+
else if (selection.kind === 'InlineFragment') {
|
|
58044
|
+
const existingFragmentIndex = mergedSelections.findIndex((sel) => {
|
|
58045
|
+
return (sel.kind === 'InlineFragment' &&
|
|
58046
|
+
areTypeConditionsEqual(sel.typeCondition, selection.typeCondition) &&
|
|
58047
|
+
areDirectivesEqual(sel.directives, selection.directives));
|
|
58048
|
+
});
|
|
58049
|
+
if (existingFragmentIndex > -1) {
|
|
58050
|
+
const existingFragment = mergedSelections[existingFragmentIndex];
|
|
58051
|
+
const mergedSelectionSet = mergeSelectionSets(existingFragment.selectionSet, selection.selectionSet);
|
|
58052
|
+
if (mergedSelectionSet) {
|
|
58053
|
+
mergedSelections[existingFragmentIndex] = {
|
|
58054
|
+
...existingFragment,
|
|
58055
|
+
selectionSet: mergedSelectionSet,
|
|
58056
|
+
};
|
|
58057
|
+
}
|
|
58058
|
+
}
|
|
58059
|
+
else {
|
|
58060
|
+
mergedSelections.push(selection);
|
|
58061
|
+
}
|
|
58062
|
+
}
|
|
58063
|
+
}
|
|
58064
|
+
return { kind: 'SelectionSet', selections: mergedSelections };
|
|
58065
|
+
}
|
|
58066
|
+
function areArgumentsEqual(args1, args2) {
|
|
58067
|
+
if (!args1 && !args2) {
|
|
58068
|
+
return true;
|
|
58069
|
+
}
|
|
58070
|
+
// length 0 arguments is semantically equivalent to falsy arguments.
|
|
58071
|
+
if ((!args1 || args1.length === 0) && (!args2 || args2.length === 0)) {
|
|
58072
|
+
return true;
|
|
58073
|
+
}
|
|
58074
|
+
if ((!args1 && args2) || (args1 && !args2)) {
|
|
58075
|
+
return false;
|
|
58076
|
+
}
|
|
58077
|
+
if (args1.length !== args2.length) {
|
|
58078
|
+
return false;
|
|
58079
|
+
}
|
|
58080
|
+
for (const arg of args1) {
|
|
58081
|
+
const matchingArg = args2.find((a) => a.name.value === arg.name.value && areValuesEqual(a.value, arg.value));
|
|
58082
|
+
if (!matchingArg) {
|
|
58083
|
+
return false;
|
|
58084
|
+
}
|
|
58085
|
+
}
|
|
58086
|
+
return true;
|
|
58087
|
+
}
|
|
58088
|
+
function areDirectivesEqual(dirs1, dirs2) {
|
|
58089
|
+
if (!dirs1 && !dirs2) {
|
|
58090
|
+
return true;
|
|
58091
|
+
}
|
|
58092
|
+
if ((!dirs1 || dirs1.length === 0) && (!dirs2 || dirs2.length === 0)) {
|
|
58093
|
+
return true;
|
|
58094
|
+
}
|
|
58095
|
+
if ((!dirs1 && dirs2) || (dirs1 && !dirs2)) {
|
|
58096
|
+
return false;
|
|
58097
|
+
}
|
|
58098
|
+
if (dirs1.length !== dirs2.length) {
|
|
58099
|
+
return false;
|
|
58100
|
+
}
|
|
58101
|
+
for (const dir of dirs1) {
|
|
58102
|
+
const matchingDir = dirs2.find((d) => d.name.value === dir.name.value && areArgumentsEqual(d.arguments, dir.arguments));
|
|
58103
|
+
if (!matchingDir) {
|
|
58104
|
+
return false;
|
|
58105
|
+
}
|
|
58106
|
+
}
|
|
58107
|
+
return true;
|
|
58108
|
+
}
|
|
58109
|
+
function areValuesEqual(valueNode1, valueNode2) {
|
|
58110
|
+
if (valueNode1.kind !== valueNode2.kind) {
|
|
58111
|
+
return false;
|
|
58112
|
+
}
|
|
58113
|
+
// Typescript doesn't understand that the above check means that the switch applies to both values. So there will be casts here.
|
|
58114
|
+
switch (valueNode1.kind) {
|
|
58115
|
+
case 'StringValue':
|
|
58116
|
+
case 'IntValue':
|
|
58117
|
+
case 'FloatValue':
|
|
58118
|
+
case 'BooleanValue':
|
|
58119
|
+
case 'EnumValue':
|
|
58120
|
+
return valueNode1.value === valueNode2.value;
|
|
58121
|
+
case 'NullValue':
|
|
58122
|
+
return true; // Both Null value nodes? Always true.
|
|
58123
|
+
case 'ListValue':
|
|
58124
|
+
if (valueNode1.values.length !== valueNode2.values.length) {
|
|
58125
|
+
return false;
|
|
58126
|
+
}
|
|
58127
|
+
for (let i = 0; i < valueNode1.values.length; i++) {
|
|
58128
|
+
if (!areValuesEqual(valueNode1.values[i], valueNode2.values[i])) {
|
|
58129
|
+
return false;
|
|
58130
|
+
}
|
|
58131
|
+
}
|
|
58132
|
+
return true;
|
|
58133
|
+
case 'ObjectValue':
|
|
58134
|
+
if (valueNode1.fields.length !== valueNode2.fields.length) {
|
|
58135
|
+
return false;
|
|
58136
|
+
}
|
|
58137
|
+
for (let i = 0; i < valueNode1.fields.length; i++) {
|
|
58138
|
+
const field1 = valueNode1.fields[i];
|
|
58139
|
+
const field2 = valueNode2.fields.find((f) => f.name.value === field1.name.value);
|
|
58140
|
+
if (!field2 || !areValuesEqual(field1.value, field2.value)) {
|
|
58141
|
+
return false;
|
|
58142
|
+
}
|
|
58143
|
+
}
|
|
58144
|
+
return true;
|
|
58145
|
+
case 'Variable':
|
|
58146
|
+
return valueNode1.name.value === valueNode2.name.value;
|
|
58147
|
+
default:
|
|
58148
|
+
return false;
|
|
58149
|
+
}
|
|
58150
|
+
}
|
|
58151
|
+
function areTypeConditionsEqual(typeCondition1, typeCondition2) {
|
|
58152
|
+
if (typeCondition1 === undefined && typeCondition2 === undefined) {
|
|
58153
|
+
return true;
|
|
58154
|
+
}
|
|
58155
|
+
if ((!typeCondition1 && typeCondition2) || (typeCondition1 && !typeCondition2)) {
|
|
58156
|
+
return false;
|
|
58157
|
+
}
|
|
58158
|
+
return typeCondition1.name.value === typeCondition2.name.value;
|
|
58159
|
+
}
|
|
58160
|
+
function isExactSameField(field1, field2) {
|
|
58161
|
+
var _a, _b;
|
|
58162
|
+
return (field1.name.value === field2.name.value &&
|
|
58163
|
+
((_a = field1.alias) === null || _a === void 0 ? void 0 : _a.value) === ((_b = field2.alias) === null || _b === void 0 ? void 0 : _b.value) &&
|
|
58164
|
+
areArgumentsEqual(field1.arguments, field2.arguments) &&
|
|
58165
|
+
areDirectivesEqual(field1.directives, field2.directives));
|
|
58166
|
+
}
|
|
57902
58167
|
|
|
57903
58168
|
function serializeOperationNode$1(operationNode, variables, fragmentMap) {
|
|
57904
58169
|
return `${serializeSelectionSet(operationNode.selectionSet, variables, fragmentMap)}`;
|
|
@@ -57955,6 +58220,53 @@
|
|
|
57955
58220
|
return operations[0]; // If a named operation is not provided, we return the first one
|
|
57956
58221
|
}
|
|
57957
58222
|
|
|
58223
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty$1 } = Object.prototype;
|
|
58224
|
+
// Deep merge that works on GraphQL data. It:
|
|
58225
|
+
// - recursively merges any Object properties that are present in both
|
|
58226
|
+
// - recursively merges arrays by deepMerging each Object item in the array (by index).
|
|
58227
|
+
function deepMerge(target, ...sources) {
|
|
58228
|
+
for (const source of sources) {
|
|
58229
|
+
for (const key in source) {
|
|
58230
|
+
if (ObjectPrototypeHasOwnProperty$1.call(source, key)) {
|
|
58231
|
+
const targetValue = target[key];
|
|
58232
|
+
const sourceValue = source[key];
|
|
58233
|
+
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
|
|
58234
|
+
const maxLength = Math.max(targetValue.length, sourceValue.length);
|
|
58235
|
+
target[key] = Array.from({ length: maxLength }, (_, index) => {
|
|
58236
|
+
const targetItem = targetValue[index];
|
|
58237
|
+
const sourceItem = sourceValue[index];
|
|
58238
|
+
if (targetItem === undefined) {
|
|
58239
|
+
return sourceItem;
|
|
58240
|
+
}
|
|
58241
|
+
else if (sourceItem === undefined) {
|
|
58242
|
+
return targetItem;
|
|
58243
|
+
}
|
|
58244
|
+
else if (targetItem instanceof Object &&
|
|
58245
|
+
!Array.isArray(targetItem) &&
|
|
58246
|
+
sourceItem instanceof Object &&
|
|
58247
|
+
!Array.isArray(sourceItem)) {
|
|
58248
|
+
return deepMerge({}, targetItem, sourceItem);
|
|
58249
|
+
}
|
|
58250
|
+
else {
|
|
58251
|
+
return sourceItem;
|
|
58252
|
+
}
|
|
58253
|
+
});
|
|
58254
|
+
}
|
|
58255
|
+
else if (targetValue instanceof Object &&
|
|
58256
|
+
!Array.isArray(targetValue) &&
|
|
58257
|
+
sourceValue instanceof Object &&
|
|
58258
|
+
!Array.isArray(sourceValue)) {
|
|
58259
|
+
deepMerge(targetValue, sourceValue);
|
|
58260
|
+
}
|
|
58261
|
+
else {
|
|
58262
|
+
target[key] = sourceValue;
|
|
58263
|
+
}
|
|
58264
|
+
}
|
|
58265
|
+
}
|
|
58266
|
+
}
|
|
58267
|
+
return target;
|
|
58268
|
+
}
|
|
58269
|
+
|
|
57958
58270
|
/**
|
|
57959
58271
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
57960
58272
|
* All rights reserved.
|
|
@@ -71678,13 +71990,12 @@
|
|
|
71678
71990
|
selectionSetNode === undefined) {
|
|
71679
71991
|
return;
|
|
71680
71992
|
}
|
|
71681
|
-
const
|
|
71682
|
-
|
|
71683
|
-
selections
|
|
71684
|
-
|
|
71685
|
-
|
|
71686
|
-
|
|
71687
|
-
mergedSelections.forEach(selection => {
|
|
71993
|
+
const minimumSelectionSet = {
|
|
71994
|
+
kind: 'SelectionSet',
|
|
71995
|
+
selections: queryTransformHelper.getMinimumSelections()
|
|
71996
|
+
};
|
|
71997
|
+
const mergedSelections = mergeSelectionSets(selectionSetNode, minimumSelectionSet);
|
|
71998
|
+
mergedSelections === null || mergedSelections === void 0 ? void 0 : mergedSelections.selections.forEach(selection => {
|
|
71688
71999
|
if (selection.kind === 'Field') {
|
|
71689
72000
|
const fieldType = queryTransformHelper.getFieldType(selection);
|
|
71690
72001
|
const fieldTransformHelper = fieldType === undefined ? undefined : getQueryTransformerForType(fieldType.typename);
|
|
@@ -71713,42 +72024,7 @@
|
|
|
71713
72024
|
}
|
|
71714
72025
|
}
|
|
71715
72026
|
});
|
|
71716
|
-
Object.assign(selectionSetNode,
|
|
71717
|
-
selections: mergedSelections.length > 0 ? mergedSelections : undefined
|
|
71718
|
-
});
|
|
71719
|
-
}
|
|
71720
|
-
function mergeSelections(minimumSelections, querySelections) {
|
|
71721
|
-
const mergedSelections = [...querySelections];
|
|
71722
|
-
for (let i = 0; i < minimumSelections.length; i++) {
|
|
71723
|
-
const minimumSelection = minimumSelections[i];
|
|
71724
|
-
if (minimumSelection.kind === 'Field') {
|
|
71725
|
-
const existingNode = mergedSelections.find(selection => {
|
|
71726
|
-
return selection.kind === 'Field' && selection.name.value === minimumSelection.name.value && (selection.directives === undefined || selection.directives.length === 0);
|
|
71727
|
-
});
|
|
71728
|
-
if (existingNode !== undefined && existingNode.kind === 'Field') { // Maybe do better type narrowing above
|
|
71729
|
-
const existingNodeHasSubselections = existingNode.selectionSet !== undefined && existingNode.selectionSet.selections.length > 0;
|
|
71730
|
-
const minimumFieldNodeHasSubselections = minimumSelection.selectionSet !== undefined && minimumSelection.selectionSet.selections.length > 0;
|
|
71731
|
-
// TODO(correctness enhancement): this doesn't handle arugments. Add alias if arguments disagree?
|
|
71732
|
-
if (existingNodeHasSubselections && minimumFieldNodeHasSubselections) {
|
|
71733
|
-
const mergedChildSelections = mergeSelections(minimumSelection.selectionSet.selections, existingNode.selectionSet.selections);
|
|
71734
|
-
Object.assign(existingNode.selectionSet, {
|
|
71735
|
-
selections: mergedChildSelections
|
|
71736
|
-
});
|
|
71737
|
-
}
|
|
71738
|
-
}
|
|
71739
|
-
else {
|
|
71740
|
-
mergedSelections.push(minimumSelection);
|
|
71741
|
-
}
|
|
71742
|
-
}
|
|
71743
|
-
if (minimumSelection.kind === 'InlineFragment') {
|
|
71744
|
-
mergedSelections.push(minimumSelection);
|
|
71745
|
-
}
|
|
71746
|
-
if (minimumSelection.kind === 'FragmentSpread') ;
|
|
71747
|
-
}
|
|
71748
|
-
return mergedSelections;
|
|
71749
|
-
}
|
|
71750
|
-
function getRequestedField(responseDataFieldName, requestedFields) {
|
|
71751
|
-
return requestedFields.find(fieldNode => (fieldNode.alias && fieldNode.alias.value === responseDataFieldName) || (!fieldNode.alias && fieldNode.name.value === responseDataFieldName));
|
|
72027
|
+
Object.assign(selectionSetNode, mergedSelections);
|
|
71752
72028
|
}
|
|
71753
72029
|
function getPageMetadata(paginationMetadata, paginationParams) {
|
|
71754
72030
|
const metadataProperties = {};
|
|
@@ -71794,67 +72070,6 @@
|
|
|
71794
72070
|
const argumentString = mutableArgumentNodes.length > 0 ? '__' + serializeFieldArguments(mutableArgumentNodes, variables) : '';
|
|
71795
72071
|
return field.name.value + argumentString; // It should be safe to always use the fieldName - If an alias is meaningful, there will be arguments on the key also.
|
|
71796
72072
|
}
|
|
71797
|
-
function mergeFragmentWithExistingSelections(fragmentFieldSelection, existingSelections) {
|
|
71798
|
-
// Check if there is an existing selection for this field we can merge with
|
|
71799
|
-
// If this isn't done, we will see issues such as W-12293630 & W-12236456 as examples
|
|
71800
|
-
const existingField = getRequestedField(fragmentFieldSelection.name.value, existingSelections);
|
|
71801
|
-
if (existingField === undefined) {
|
|
71802
|
-
existingSelections.push(fragmentFieldSelection);
|
|
71803
|
-
}
|
|
71804
|
-
else {
|
|
71805
|
-
if (existingField.selectionSet === undefined) {
|
|
71806
|
-
existingField.selectionSet === fragmentFieldSelection.selectionSet;
|
|
71807
|
-
}
|
|
71808
|
-
else if (fragmentFieldSelection.selectionSet !== undefined) {
|
|
71809
|
-
existingField.selectionSet.selections = mergeSelections(fragmentFieldSelection.selectionSet.selections, existingField.selectionSet.selections);
|
|
71810
|
-
}
|
|
71811
|
-
}
|
|
71812
|
-
}
|
|
71813
|
-
function calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
|
|
71814
|
-
const selections = [];
|
|
71815
|
-
selectionSet.selections.forEach(selection => {
|
|
71816
|
-
if (selection.kind === "Field") {
|
|
71817
|
-
selections.push(selection);
|
|
71818
|
-
}
|
|
71819
|
-
if (selection.kind === "InlineFragment" && isFragmentApplicable(selection, typename)) {
|
|
71820
|
-
// loops over the map to get the values.
|
|
71821
|
-
getRequestedFieldsForType(typename, selection.selectionSet, namedFragmentsMap, isFragmentApplicable)
|
|
71822
|
-
.forEach(fragmentFieldSelection => { mergeFragmentWithExistingSelections(fragmentFieldSelection, selections); });
|
|
71823
|
-
}
|
|
71824
|
-
if (selection.kind === "FragmentSpread") {
|
|
71825
|
-
const namedFragment = namedFragmentsMap[selection.name.value];
|
|
71826
|
-
if (namedFragment && isFragmentApplicable(namedFragment, typename)) {
|
|
71827
|
-
// loops over the map to get the values.
|
|
71828
|
-
getRequestedFieldsForType(typename, namedFragment.selectionSet, namedFragmentsMap, isFragmentApplicable)
|
|
71829
|
-
.forEach(fragmentFieldSelection => { mergeFragmentWithExistingSelections(fragmentFieldSelection, selections); });
|
|
71830
|
-
}
|
|
71831
|
-
}
|
|
71832
|
-
});
|
|
71833
|
-
// Needs to happen after the selections are merged.
|
|
71834
|
-
return selections.reduce((acc, fieldNode) => {
|
|
71835
|
-
const fieldName = fieldNode.alias ? fieldNode.alias.value : fieldNode.name.value;
|
|
71836
|
-
// TODO: W-13485835. Some fields are not being merged, and this logic reproduces the current behavior in which the first field with name is being used.
|
|
71837
|
-
if (!acc.has(fieldName)) {
|
|
71838
|
-
acc.set(fieldName, fieldNode);
|
|
71839
|
-
}
|
|
71840
|
-
return acc;
|
|
71841
|
-
}, new Map());
|
|
71842
|
-
}
|
|
71843
|
-
let selectionSetRequestedFieldsWeakMap = new WeakMap();
|
|
71844
|
-
function getRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
|
|
71845
|
-
let cachedRequestedFieldsConfigurations = selectionSetRequestedFieldsWeakMap.get(selectionSet);
|
|
71846
|
-
if (cachedRequestedFieldsConfigurations === undefined) {
|
|
71847
|
-
cachedRequestedFieldsConfigurations = new Map();
|
|
71848
|
-
selectionSetRequestedFieldsWeakMap.set(selectionSet, cachedRequestedFieldsConfigurations);
|
|
71849
|
-
}
|
|
71850
|
-
const cachedRequestedFieldsForType = cachedRequestedFieldsConfigurations.get(typename);
|
|
71851
|
-
if (cachedRequestedFieldsForType !== undefined) {
|
|
71852
|
-
return cachedRequestedFieldsForType;
|
|
71853
|
-
}
|
|
71854
|
-
const selections = calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable);
|
|
71855
|
-
cachedRequestedFieldsConfigurations.set(typename, selections);
|
|
71856
|
-
return selections;
|
|
71857
|
-
}
|
|
71858
72073
|
function getQueryTransformerForType(typename, fragmentMap) {
|
|
71859
72074
|
switch (typename) {
|
|
71860
72075
|
case "PercentAggregate": return {
|
|
@@ -72473,18 +72688,7 @@
|
|
|
72473
72688
|
(_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
|
|
72474
72689
|
const builtSelection = buildSelectionForNodeFn(source, reader, field, sel, variables, fragments, parentRecordId);
|
|
72475
72690
|
if (builtSelection !== undefined) {
|
|
72476
|
-
|
|
72477
|
-
Object.keys(builtSelection).forEach((key, value) => {
|
|
72478
|
-
// We only assign a field selection in the fragment if it doesn't already exist in sink
|
|
72479
|
-
// The non-fragment selection already got the merged selections in getRequestedFieldsForType
|
|
72480
|
-
if (sink[key] === undefined) {
|
|
72481
|
-
sink[key] = builtSelection[key];
|
|
72482
|
-
}
|
|
72483
|
-
});
|
|
72484
|
-
}
|
|
72485
|
-
else {
|
|
72486
|
-
Object.assign(sink, builtSelection);
|
|
72487
|
-
}
|
|
72691
|
+
deepMerge(sink, builtSelection);
|
|
72488
72692
|
}
|
|
72489
72693
|
});
|
|
72490
72694
|
return sink;
|
|
@@ -76094,7 +76298,7 @@
|
|
|
76094
76298
|
configuration: { ...configurationForGraphQLAdapters },
|
|
76095
76299
|
instrument,
|
|
76096
76300
|
});
|
|
76097
|
-
// version: 1.
|
|
76301
|
+
// version: 1.229.0-dev1-5b6d3db67
|
|
76098
76302
|
|
|
76099
76303
|
// On core the unstable adapters are re-exported with different names,
|
|
76100
76304
|
|
|
@@ -78341,7 +78545,7 @@
|
|
|
78341
78545
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
78342
78546
|
graphQLImperative = ldsAdapter;
|
|
78343
78547
|
});
|
|
78344
|
-
// version: 1.
|
|
78548
|
+
// version: 1.229.0-dev1-5b6d3db67
|
|
78345
78549
|
|
|
78346
78550
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
78347
78551
|
__proto__: null,
|
|
@@ -79072,4 +79276,4 @@
|
|
|
79072
79276
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
79073
79277
|
|
|
79074
79278
|
}));
|
|
79075
|
-
// version: 1.
|
|
79279
|
+
// version: 1.229.0-dev1-f69d054a9
|