@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
|
@@ -3841,7 +3841,7 @@ function createResourceParamsImpl(config, configMetadata) {
|
|
|
3841
3841
|
}
|
|
3842
3842
|
return resourceParams;
|
|
3843
3843
|
}
|
|
3844
|
-
// engine version: 0.145.
|
|
3844
|
+
// engine version: 0.145.2-6a13677c
|
|
3845
3845
|
|
|
3846
3846
|
/**
|
|
3847
3847
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3968,7 +3968,7 @@ function withDefaultLuvio(callback) {
|
|
|
3968
3968
|
}
|
|
3969
3969
|
callbacks.push(callback);
|
|
3970
3970
|
}
|
|
3971
|
-
// version: 1.
|
|
3971
|
+
// version: 1.229.0-dev1-f69d054a9
|
|
3972
3972
|
|
|
3973
3973
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3974
3974
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15429,7 +15429,7 @@ function gql(literals, ...subs) {
|
|
|
15429
15429
|
}
|
|
15430
15430
|
return superResult;
|
|
15431
15431
|
}
|
|
15432
|
-
// version: 1.
|
|
15432
|
+
// version: 1.229.0-dev1-f69d054a9
|
|
15433
15433
|
|
|
15434
15434
|
function unwrap(data) {
|
|
15435
15435
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16352,7 +16352,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
16352
16352
|
const { apiFamily, name } = metadata;
|
|
16353
16353
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16354
16354
|
}
|
|
16355
|
-
// version: 1.
|
|
16355
|
+
// version: 1.229.0-dev1-f69d054a9
|
|
16356
16356
|
|
|
16357
16357
|
/**
|
|
16358
16358
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -16451,7 +16451,7 @@ var TypeCheckShapes;
|
|
|
16451
16451
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
16452
16452
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
16453
16453
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
16454
|
-
// engine version: 0.145.
|
|
16454
|
+
// engine version: 0.145.2-6a13677c
|
|
16455
16455
|
|
|
16456
16456
|
const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
|
|
16457
16457
|
|
|
@@ -20455,7 +20455,7 @@ function fulfill(existing, incoming) {
|
|
|
20455
20455
|
const batchRequestWithSingleRequest = isSingleBatchRecordRequest(existingUrlParams) &&
|
|
20456
20456
|
isSingleRecordRequest(urlParams) &&
|
|
20457
20457
|
incomingUrlRecords[0] === existingUrlRecords[0];
|
|
20458
|
-
if (!batchRequestWithSingleRequest) {
|
|
20458
|
+
if (!batchRequestWithSingleRequest || isRestrictedPathCondition(existingPath, path)) {
|
|
20459
20459
|
return false;
|
|
20460
20460
|
}
|
|
20461
20461
|
}
|
|
@@ -20498,6 +20498,12 @@ function isSingleBatchRecordRequest(urlParams) {
|
|
|
20498
20498
|
function isSingleRecordRequest(urlParams) {
|
|
20499
20499
|
return hasOwnProperty$1.call(urlParams, 'recordId');
|
|
20500
20500
|
}
|
|
20501
|
+
function isRestrictedPathCondition(existingPath, path) {
|
|
20502
|
+
// should not dedupe getRecordUi and getRecord as both of their representation is different
|
|
20503
|
+
// records call cannot digest response of getRecordUi
|
|
20504
|
+
return ((existingPath.includes('/record-ui') && path.includes('/records')) ||
|
|
20505
|
+
(existingPath.includes('/records') && path.includes('/record-ui')));
|
|
20506
|
+
}
|
|
20501
20507
|
|
|
20502
20508
|
const createResourceRequest$12 = function getUiApiRecordsByRecordIdCreateResourceRequest(config) {
|
|
20503
20509
|
return {
|
|
@@ -41152,7 +41158,7 @@ withDefaultLuvio((luvio) => {
|
|
|
41152
41158
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
|
|
41153
41159
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
|
|
41154
41160
|
});
|
|
41155
|
-
// version: 1.
|
|
41161
|
+
// version: 1.229.0-dev1-5b6d3db67
|
|
41156
41162
|
|
|
41157
41163
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
41158
41164
|
|
|
@@ -42686,6 +42692,72 @@ function makeDurable(environment, { durableStore, instrumentation }) {
|
|
|
42686
42692
|
});
|
|
42687
42693
|
}
|
|
42688
42694
|
|
|
42695
|
+
/**
|
|
42696
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
42697
|
+
* All rights reserved.
|
|
42698
|
+
* For full license text, see the LICENSE.txt file
|
|
42699
|
+
*/
|
|
42700
|
+
|
|
42701
|
+
const API_NAMESPACE$1 = 'UiApi';
|
|
42702
|
+
const RECORD_REPRESENTATION_NAME$2 = 'RecordRepresentation';
|
|
42703
|
+
const RECORD_VIEW_ENTITY_REPRESENTATION_NAME$1 = 'RecordViewEntityRepresentation';
|
|
42704
|
+
const RECORD_ID_PREFIX$1 = `${API_NAMESPACE$1}::${RECORD_REPRESENTATION_NAME$2}:`;
|
|
42705
|
+
const RECORD_VIEW_ENTITY_ID_PREFIX$1 = `${API_NAMESPACE$1}::${RECORD_VIEW_ENTITY_REPRESENTATION_NAME$1}:Name:`;
|
|
42706
|
+
const RECORD_FIELDS_KEY_JUNCTION$1 = '__fields__';
|
|
42707
|
+
function isStoreKeyRecordId(key) {
|
|
42708
|
+
return key.indexOf(RECORD_ID_PREFIX$1) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) === -1;
|
|
42709
|
+
}
|
|
42710
|
+
function isStoreKeyRecordViewEntity$1(key) {
|
|
42711
|
+
return (key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX$1) > -1 &&
|
|
42712
|
+
key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) === -1);
|
|
42713
|
+
}
|
|
42714
|
+
function isStoreKeyRecordField(key) {
|
|
42715
|
+
return key.indexOf(RECORD_ID_PREFIX$1) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) > -1;
|
|
42716
|
+
}
|
|
42717
|
+
function extractRecordIdFromStoreKey$1(key) {
|
|
42718
|
+
if (key === undefined ||
|
|
42719
|
+
(key.indexOf(RECORD_ID_PREFIX$1) === -1 && key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX$1) === -1)) {
|
|
42720
|
+
return undefined;
|
|
42721
|
+
}
|
|
42722
|
+
const parts = key.split(':');
|
|
42723
|
+
return parts[parts.length - 1].split('_')[0];
|
|
42724
|
+
}
|
|
42725
|
+
function buildRecordFieldStoreKey(recordKey, fieldName) {
|
|
42726
|
+
return `${recordKey}${RECORD_FIELDS_KEY_JUNCTION$1}${fieldName}`;
|
|
42727
|
+
}
|
|
42728
|
+
function objectsDeepEqual(lhs, rhs) {
|
|
42729
|
+
if (lhs === rhs)
|
|
42730
|
+
return true;
|
|
42731
|
+
if (typeof lhs !== 'object' || typeof rhs !== 'object' || lhs === null || rhs === null)
|
|
42732
|
+
return false;
|
|
42733
|
+
const lhsKeys = Object.keys(lhs);
|
|
42734
|
+
const rhsKeys = Object.keys(rhs);
|
|
42735
|
+
if (lhsKeys.length !== rhsKeys.length)
|
|
42736
|
+
return false;
|
|
42737
|
+
for (let key of lhsKeys) {
|
|
42738
|
+
if (!rhsKeys.includes(key))
|
|
42739
|
+
return false;
|
|
42740
|
+
if (typeof lhs[key] === 'function' || typeof rhs[key] === 'function') {
|
|
42741
|
+
if (lhs[key].toString() !== rhs[key].toString())
|
|
42742
|
+
return false;
|
|
42743
|
+
}
|
|
42744
|
+
else {
|
|
42745
|
+
if (!objectsDeepEqual(lhs[key], rhs[key]))
|
|
42746
|
+
return false;
|
|
42747
|
+
}
|
|
42748
|
+
}
|
|
42749
|
+
return true;
|
|
42750
|
+
}
|
|
42751
|
+
|
|
42752
|
+
function isStoreRecordError(storeRecord) {
|
|
42753
|
+
return storeRecord.__type === 'error';
|
|
42754
|
+
}
|
|
42755
|
+
function isEntryDurableRecordRepresentation(entry, key) {
|
|
42756
|
+
// Either a DurableRecordRepresentation or StoreRecordError can live at a record key
|
|
42757
|
+
return ((isStoreKeyRecordId(key) || isStoreKeyRecordViewEntity$1(key)) &&
|
|
42758
|
+
entry.data.__type === undefined);
|
|
42759
|
+
}
|
|
42760
|
+
|
|
42689
42761
|
/**
|
|
42690
42762
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
42691
42763
|
* All rights reserved.
|
|
@@ -45884,7 +45956,11 @@ function makeStoreEval(preconditioner, objectInfoService, userId, contextProvide
|
|
|
45884
45956
|
try {
|
|
45885
45957
|
const { data, seenRecords } = await queryEvaluator(rootQuery, context, eventEmitter);
|
|
45886
45958
|
const rebuildWithStoreEval = ((originalSnapshot) => {
|
|
45887
|
-
return storeEval(config, originalSnapshot, observers, connectionKeyBuilder)
|
|
45959
|
+
return storeEval(config, originalSnapshot, observers, connectionKeyBuilder).then((rebuiltSnapshot) => {
|
|
45960
|
+
return objectsDeepEqual(originalSnapshot.data, rebuiltSnapshot.data)
|
|
45961
|
+
? originalSnapshot
|
|
45962
|
+
: rebuiltSnapshot;
|
|
45963
|
+
});
|
|
45888
45964
|
});
|
|
45889
45965
|
const recordId = generateUniqueRecordId$1();
|
|
45890
45966
|
// if the non-eval'ed snapshot was an error then we return a synthetic
|
|
@@ -47830,49 +47906,6 @@ function makeEnvironmentDraftAware(luvio, env, durableStore, handlers, draftQueu
|
|
|
47830
47906
|
});
|
|
47831
47907
|
}
|
|
47832
47908
|
|
|
47833
|
-
/**
|
|
47834
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
47835
|
-
* All rights reserved.
|
|
47836
|
-
* For full license text, see the LICENSE.txt file
|
|
47837
|
-
*/
|
|
47838
|
-
|
|
47839
|
-
const API_NAMESPACE$1 = 'UiApi';
|
|
47840
|
-
const RECORD_REPRESENTATION_NAME$2 = 'RecordRepresentation';
|
|
47841
|
-
const RECORD_VIEW_ENTITY_REPRESENTATION_NAME$1 = 'RecordViewEntityRepresentation';
|
|
47842
|
-
const RECORD_ID_PREFIX$1 = `${API_NAMESPACE$1}::${RECORD_REPRESENTATION_NAME$2}:`;
|
|
47843
|
-
const RECORD_VIEW_ENTITY_ID_PREFIX$1 = `${API_NAMESPACE$1}::${RECORD_VIEW_ENTITY_REPRESENTATION_NAME$1}:Name:`;
|
|
47844
|
-
const RECORD_FIELDS_KEY_JUNCTION$1 = '__fields__';
|
|
47845
|
-
function isStoreKeyRecordId(key) {
|
|
47846
|
-
return key.indexOf(RECORD_ID_PREFIX$1) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) === -1;
|
|
47847
|
-
}
|
|
47848
|
-
function isStoreKeyRecordViewEntity$1(key) {
|
|
47849
|
-
return (key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX$1) > -1 &&
|
|
47850
|
-
key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) === -1);
|
|
47851
|
-
}
|
|
47852
|
-
function isStoreKeyRecordField(key) {
|
|
47853
|
-
return key.indexOf(RECORD_ID_PREFIX$1) > -1 && key.indexOf(RECORD_FIELDS_KEY_JUNCTION$1) > -1;
|
|
47854
|
-
}
|
|
47855
|
-
function extractRecordIdFromStoreKey$1(key) {
|
|
47856
|
-
if (key === undefined ||
|
|
47857
|
-
(key.indexOf(RECORD_ID_PREFIX$1) === -1 && key.indexOf(RECORD_VIEW_ENTITY_ID_PREFIX$1) === -1)) {
|
|
47858
|
-
return undefined;
|
|
47859
|
-
}
|
|
47860
|
-
const parts = key.split(':');
|
|
47861
|
-
return parts[parts.length - 1].split('_')[0];
|
|
47862
|
-
}
|
|
47863
|
-
function buildRecordFieldStoreKey(recordKey, fieldName) {
|
|
47864
|
-
return `${recordKey}${RECORD_FIELDS_KEY_JUNCTION$1}${fieldName}`;
|
|
47865
|
-
}
|
|
47866
|
-
|
|
47867
|
-
function isStoreRecordError(storeRecord) {
|
|
47868
|
-
return storeRecord.__type === 'error';
|
|
47869
|
-
}
|
|
47870
|
-
function isEntryDurableRecordRepresentation(entry, key) {
|
|
47871
|
-
// Either a DurableRecordRepresentation or StoreRecordError can live at a record key
|
|
47872
|
-
return ((isStoreKeyRecordId(key) || isStoreKeyRecordViewEntity$1(key)) &&
|
|
47873
|
-
entry.data.__type === undefined);
|
|
47874
|
-
}
|
|
47875
|
-
|
|
47876
47909
|
function serializeFieldArguments$1(argumentNodes, variables) {
|
|
47877
47910
|
const mutableArgumentNodes = Object.assign([], argumentNodes);
|
|
47878
47911
|
return `args__(${mutableArgumentNodes
|
|
@@ -54043,6 +54076,9 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
54043
54076
|
if (!rebuildResult.errors) {
|
|
54044
54077
|
rebuildResult = removeSyntheticFields(rebuildResult, config.query);
|
|
54045
54078
|
}
|
|
54079
|
+
if (objectsDeepEqual(rebuildResult, originalSnapshot.data)) {
|
|
54080
|
+
return originalSnapshot;
|
|
54081
|
+
}
|
|
54046
54082
|
// '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.
|
|
54047
54083
|
return {
|
|
54048
54084
|
...originalSnapshot,
|
|
@@ -57810,7 +57846,7 @@ register({
|
|
|
57810
57846
|
id: '@salesforce/lds-network-adapter',
|
|
57811
57847
|
instrument: instrument$1,
|
|
57812
57848
|
});
|
|
57813
|
-
// version: 1.
|
|
57849
|
+
// version: 1.229.0-dev1-f69d054a9
|
|
57814
57850
|
|
|
57815
57851
|
const { create: create$2, keys: keys$2 } = Object;
|
|
57816
57852
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -57825,6 +57861,21 @@ function createFragmentMap(documentNode) {
|
|
|
57825
57861
|
});
|
|
57826
57862
|
return fragments;
|
|
57827
57863
|
}
|
|
57864
|
+
function mergeFragmentWithExistingSelections(fragmentFieldSelection, existingSelections) {
|
|
57865
|
+
// Check if there is an existing selection for this field we can merge with
|
|
57866
|
+
const existingField = getRequestedField(fragmentFieldSelection.name.value, existingSelections);
|
|
57867
|
+
if (existingField === undefined) {
|
|
57868
|
+
existingSelections.push(fragmentFieldSelection);
|
|
57869
|
+
}
|
|
57870
|
+
else {
|
|
57871
|
+
if (existingField.selectionSet) {
|
|
57872
|
+
const mergedSelections = mergeSelectionSets(existingField.selectionSet, fragmentFieldSelection.selectionSet);
|
|
57873
|
+
existingField.selectionSet.selections = mergedSelections
|
|
57874
|
+
? mergedSelections.selections
|
|
57875
|
+
: [];
|
|
57876
|
+
}
|
|
57877
|
+
}
|
|
57878
|
+
}
|
|
57828
57879
|
|
|
57829
57880
|
function buildFieldState(state, fullPath, data) {
|
|
57830
57881
|
return {
|
|
@@ -57893,6 +57944,220 @@ function serializeValueNode$1(valueNode, variables) {
|
|
|
57893
57944
|
}
|
|
57894
57945
|
}
|
|
57895
57946
|
}
|
|
57947
|
+
let selectionSetRequestedFieldsWeakMap = new WeakMap();
|
|
57948
|
+
function getRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
|
|
57949
|
+
let cachedRequestedFieldsConfigurations = selectionSetRequestedFieldsWeakMap.get(selectionSet);
|
|
57950
|
+
if (cachedRequestedFieldsConfigurations === undefined) {
|
|
57951
|
+
cachedRequestedFieldsConfigurations = new Map();
|
|
57952
|
+
selectionSetRequestedFieldsWeakMap.set(selectionSet, cachedRequestedFieldsConfigurations);
|
|
57953
|
+
}
|
|
57954
|
+
const cachedRequestedFieldsForType = cachedRequestedFieldsConfigurations.get(typename);
|
|
57955
|
+
if (cachedRequestedFieldsForType !== undefined) {
|
|
57956
|
+
return cachedRequestedFieldsForType;
|
|
57957
|
+
}
|
|
57958
|
+
const selections = calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable);
|
|
57959
|
+
cachedRequestedFieldsConfigurations.set(typename, selections);
|
|
57960
|
+
return selections;
|
|
57961
|
+
}
|
|
57962
|
+
function getRequestedField(responseDataFieldName, requestedFields) {
|
|
57963
|
+
return requestedFields.find((fieldNode) => (fieldNode.alias && fieldNode.alias.value === responseDataFieldName) ||
|
|
57964
|
+
(!fieldNode.alias && fieldNode.name.value === responseDataFieldName));
|
|
57965
|
+
}
|
|
57966
|
+
function calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
|
|
57967
|
+
const selections = [];
|
|
57968
|
+
selectionSet.selections.forEach((selection) => {
|
|
57969
|
+
if (selection.kind === 'Field') {
|
|
57970
|
+
selections.push(selection);
|
|
57971
|
+
}
|
|
57972
|
+
if (selection.kind === 'InlineFragment' && isFragmentApplicable(selection, typename)) {
|
|
57973
|
+
// loops over the map to get the values.
|
|
57974
|
+
getRequestedFieldsForType(typename, selection.selectionSet, namedFragmentsMap, isFragmentApplicable).forEach((fragmentFieldSelection) => {
|
|
57975
|
+
mergeFragmentWithExistingSelections(fragmentFieldSelection, selections);
|
|
57976
|
+
});
|
|
57977
|
+
}
|
|
57978
|
+
if (selection.kind === 'FragmentSpread') {
|
|
57979
|
+
const namedFragment = namedFragmentsMap[selection.name.value];
|
|
57980
|
+
if (namedFragment && isFragmentApplicable(namedFragment, typename)) {
|
|
57981
|
+
// loops over the map to get the values.
|
|
57982
|
+
getRequestedFieldsForType(typename, namedFragment.selectionSet, namedFragmentsMap, isFragmentApplicable).forEach((fragmentFieldSelection) => {
|
|
57983
|
+
mergeFragmentWithExistingSelections(fragmentFieldSelection, selections);
|
|
57984
|
+
});
|
|
57985
|
+
}
|
|
57986
|
+
}
|
|
57987
|
+
});
|
|
57988
|
+
// Needs to happen after the selections are merged.
|
|
57989
|
+
return selections.reduce((acc, fieldNode) => {
|
|
57990
|
+
const fieldName = fieldNode.alias ? fieldNode.alias.value : fieldNode.name.value;
|
|
57991
|
+
// 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.
|
|
57992
|
+
if (!acc.has(fieldName)) {
|
|
57993
|
+
acc.set(fieldName, fieldNode);
|
|
57994
|
+
}
|
|
57995
|
+
else {
|
|
57996
|
+
const existingFieldNode = acc.get(fieldName);
|
|
57997
|
+
acc.set(fieldName, {
|
|
57998
|
+
...existingFieldNode,
|
|
57999
|
+
selectionSet: mergeSelectionSets(existingFieldNode === null || existingFieldNode === void 0 ? void 0 : existingFieldNode.selectionSet, fieldNode.selectionSet),
|
|
58000
|
+
});
|
|
58001
|
+
}
|
|
58002
|
+
return acc;
|
|
58003
|
+
}, new Map());
|
|
58004
|
+
}
|
|
58005
|
+
function mergeSelectionSets(set1, set2) {
|
|
58006
|
+
if (!set2) {
|
|
58007
|
+
return set1;
|
|
58008
|
+
}
|
|
58009
|
+
const set1Selections = !set1 ? [] : set1.selections;
|
|
58010
|
+
const mergedSelections = [...set1Selections];
|
|
58011
|
+
for (const selection of set2.selections) {
|
|
58012
|
+
if (selection.kind === 'Field') {
|
|
58013
|
+
const existingFieldIndex = mergedSelections.findIndex((sel) => {
|
|
58014
|
+
return sel.kind === 'Field' && isExactSameField(sel, selection);
|
|
58015
|
+
});
|
|
58016
|
+
if (existingFieldIndex > -1) {
|
|
58017
|
+
const existingField = mergedSelections[existingFieldIndex];
|
|
58018
|
+
const mergedSelectionSet = mergeSelectionSets(existingField.selectionSet, selection.selectionSet);
|
|
58019
|
+
if (mergedSelectionSet) {
|
|
58020
|
+
mergedSelections[existingFieldIndex] = {
|
|
58021
|
+
...existingField,
|
|
58022
|
+
selectionSet: mergedSelectionSet,
|
|
58023
|
+
};
|
|
58024
|
+
}
|
|
58025
|
+
}
|
|
58026
|
+
else {
|
|
58027
|
+
mergedSelections.push(selection);
|
|
58028
|
+
}
|
|
58029
|
+
}
|
|
58030
|
+
else if (selection.kind === 'FragmentSpread') {
|
|
58031
|
+
if (!mergedSelections.some((sel) => sel.kind === 'FragmentSpread' &&
|
|
58032
|
+
sel.name.value === selection.name.value &&
|
|
58033
|
+
areDirectivesEqual(sel.directives, selection.directives))) {
|
|
58034
|
+
mergedSelections.push(selection);
|
|
58035
|
+
}
|
|
58036
|
+
}
|
|
58037
|
+
else if (selection.kind === 'InlineFragment') {
|
|
58038
|
+
const existingFragmentIndex = mergedSelections.findIndex((sel) => {
|
|
58039
|
+
return (sel.kind === 'InlineFragment' &&
|
|
58040
|
+
areTypeConditionsEqual(sel.typeCondition, selection.typeCondition) &&
|
|
58041
|
+
areDirectivesEqual(sel.directives, selection.directives));
|
|
58042
|
+
});
|
|
58043
|
+
if (existingFragmentIndex > -1) {
|
|
58044
|
+
const existingFragment = mergedSelections[existingFragmentIndex];
|
|
58045
|
+
const mergedSelectionSet = mergeSelectionSets(existingFragment.selectionSet, selection.selectionSet);
|
|
58046
|
+
if (mergedSelectionSet) {
|
|
58047
|
+
mergedSelections[existingFragmentIndex] = {
|
|
58048
|
+
...existingFragment,
|
|
58049
|
+
selectionSet: mergedSelectionSet,
|
|
58050
|
+
};
|
|
58051
|
+
}
|
|
58052
|
+
}
|
|
58053
|
+
else {
|
|
58054
|
+
mergedSelections.push(selection);
|
|
58055
|
+
}
|
|
58056
|
+
}
|
|
58057
|
+
}
|
|
58058
|
+
return { kind: 'SelectionSet', selections: mergedSelections };
|
|
58059
|
+
}
|
|
58060
|
+
function areArgumentsEqual(args1, args2) {
|
|
58061
|
+
if (!args1 && !args2) {
|
|
58062
|
+
return true;
|
|
58063
|
+
}
|
|
58064
|
+
// length 0 arguments is semantically equivalent to falsy arguments.
|
|
58065
|
+
if ((!args1 || args1.length === 0) && (!args2 || args2.length === 0)) {
|
|
58066
|
+
return true;
|
|
58067
|
+
}
|
|
58068
|
+
if ((!args1 && args2) || (args1 && !args2)) {
|
|
58069
|
+
return false;
|
|
58070
|
+
}
|
|
58071
|
+
if (args1.length !== args2.length) {
|
|
58072
|
+
return false;
|
|
58073
|
+
}
|
|
58074
|
+
for (const arg of args1) {
|
|
58075
|
+
const matchingArg = args2.find((a) => a.name.value === arg.name.value && areValuesEqual(a.value, arg.value));
|
|
58076
|
+
if (!matchingArg) {
|
|
58077
|
+
return false;
|
|
58078
|
+
}
|
|
58079
|
+
}
|
|
58080
|
+
return true;
|
|
58081
|
+
}
|
|
58082
|
+
function areDirectivesEqual(dirs1, dirs2) {
|
|
58083
|
+
if (!dirs1 && !dirs2) {
|
|
58084
|
+
return true;
|
|
58085
|
+
}
|
|
58086
|
+
if ((!dirs1 || dirs1.length === 0) && (!dirs2 || dirs2.length === 0)) {
|
|
58087
|
+
return true;
|
|
58088
|
+
}
|
|
58089
|
+
if ((!dirs1 && dirs2) || (dirs1 && !dirs2)) {
|
|
58090
|
+
return false;
|
|
58091
|
+
}
|
|
58092
|
+
if (dirs1.length !== dirs2.length) {
|
|
58093
|
+
return false;
|
|
58094
|
+
}
|
|
58095
|
+
for (const dir of dirs1) {
|
|
58096
|
+
const matchingDir = dirs2.find((d) => d.name.value === dir.name.value && areArgumentsEqual(d.arguments, dir.arguments));
|
|
58097
|
+
if (!matchingDir) {
|
|
58098
|
+
return false;
|
|
58099
|
+
}
|
|
58100
|
+
}
|
|
58101
|
+
return true;
|
|
58102
|
+
}
|
|
58103
|
+
function areValuesEqual(valueNode1, valueNode2) {
|
|
58104
|
+
if (valueNode1.kind !== valueNode2.kind) {
|
|
58105
|
+
return false;
|
|
58106
|
+
}
|
|
58107
|
+
// Typescript doesn't understand that the above check means that the switch applies to both values. So there will be casts here.
|
|
58108
|
+
switch (valueNode1.kind) {
|
|
58109
|
+
case 'StringValue':
|
|
58110
|
+
case 'IntValue':
|
|
58111
|
+
case 'FloatValue':
|
|
58112
|
+
case 'BooleanValue':
|
|
58113
|
+
case 'EnumValue':
|
|
58114
|
+
return valueNode1.value === valueNode2.value;
|
|
58115
|
+
case 'NullValue':
|
|
58116
|
+
return true; // Both Null value nodes? Always true.
|
|
58117
|
+
case 'ListValue':
|
|
58118
|
+
if (valueNode1.values.length !== valueNode2.values.length) {
|
|
58119
|
+
return false;
|
|
58120
|
+
}
|
|
58121
|
+
for (let i = 0; i < valueNode1.values.length; i++) {
|
|
58122
|
+
if (!areValuesEqual(valueNode1.values[i], valueNode2.values[i])) {
|
|
58123
|
+
return false;
|
|
58124
|
+
}
|
|
58125
|
+
}
|
|
58126
|
+
return true;
|
|
58127
|
+
case 'ObjectValue':
|
|
58128
|
+
if (valueNode1.fields.length !== valueNode2.fields.length) {
|
|
58129
|
+
return false;
|
|
58130
|
+
}
|
|
58131
|
+
for (let i = 0; i < valueNode1.fields.length; i++) {
|
|
58132
|
+
const field1 = valueNode1.fields[i];
|
|
58133
|
+
const field2 = valueNode2.fields.find((f) => f.name.value === field1.name.value);
|
|
58134
|
+
if (!field2 || !areValuesEqual(field1.value, field2.value)) {
|
|
58135
|
+
return false;
|
|
58136
|
+
}
|
|
58137
|
+
}
|
|
58138
|
+
return true;
|
|
58139
|
+
case 'Variable':
|
|
58140
|
+
return valueNode1.name.value === valueNode2.name.value;
|
|
58141
|
+
default:
|
|
58142
|
+
return false;
|
|
58143
|
+
}
|
|
58144
|
+
}
|
|
58145
|
+
function areTypeConditionsEqual(typeCondition1, typeCondition2) {
|
|
58146
|
+
if (typeCondition1 === undefined && typeCondition2 === undefined) {
|
|
58147
|
+
return true;
|
|
58148
|
+
}
|
|
58149
|
+
if ((!typeCondition1 && typeCondition2) || (typeCondition1 && !typeCondition2)) {
|
|
58150
|
+
return false;
|
|
58151
|
+
}
|
|
58152
|
+
return typeCondition1.name.value === typeCondition2.name.value;
|
|
58153
|
+
}
|
|
58154
|
+
function isExactSameField(field1, field2) {
|
|
58155
|
+
var _a, _b;
|
|
58156
|
+
return (field1.name.value === field2.name.value &&
|
|
58157
|
+
((_a = field1.alias) === null || _a === void 0 ? void 0 : _a.value) === ((_b = field2.alias) === null || _b === void 0 ? void 0 : _b.value) &&
|
|
58158
|
+
areArgumentsEqual(field1.arguments, field2.arguments) &&
|
|
58159
|
+
areDirectivesEqual(field1.directives, field2.directives));
|
|
58160
|
+
}
|
|
57896
58161
|
|
|
57897
58162
|
function serializeOperationNode$1(operationNode, variables, fragmentMap) {
|
|
57898
58163
|
return `${serializeSelectionSet(operationNode.selectionSet, variables, fragmentMap)}`;
|
|
@@ -57949,6 +58214,53 @@ function getOperationFromDocument(document, operationName) {
|
|
|
57949
58214
|
return operations[0]; // If a named operation is not provided, we return the first one
|
|
57950
58215
|
}
|
|
57951
58216
|
|
|
58217
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty$1 } = Object.prototype;
|
|
58218
|
+
// Deep merge that works on GraphQL data. It:
|
|
58219
|
+
// - recursively merges any Object properties that are present in both
|
|
58220
|
+
// - recursively merges arrays by deepMerging each Object item in the array (by index).
|
|
58221
|
+
function deepMerge(target, ...sources) {
|
|
58222
|
+
for (const source of sources) {
|
|
58223
|
+
for (const key in source) {
|
|
58224
|
+
if (ObjectPrototypeHasOwnProperty$1.call(source, key)) {
|
|
58225
|
+
const targetValue = target[key];
|
|
58226
|
+
const sourceValue = source[key];
|
|
58227
|
+
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
|
|
58228
|
+
const maxLength = Math.max(targetValue.length, sourceValue.length);
|
|
58229
|
+
target[key] = Array.from({ length: maxLength }, (_, index) => {
|
|
58230
|
+
const targetItem = targetValue[index];
|
|
58231
|
+
const sourceItem = sourceValue[index];
|
|
58232
|
+
if (targetItem === undefined) {
|
|
58233
|
+
return sourceItem;
|
|
58234
|
+
}
|
|
58235
|
+
else if (sourceItem === undefined) {
|
|
58236
|
+
return targetItem;
|
|
58237
|
+
}
|
|
58238
|
+
else if (targetItem instanceof Object &&
|
|
58239
|
+
!Array.isArray(targetItem) &&
|
|
58240
|
+
sourceItem instanceof Object &&
|
|
58241
|
+
!Array.isArray(sourceItem)) {
|
|
58242
|
+
return deepMerge({}, targetItem, sourceItem);
|
|
58243
|
+
}
|
|
58244
|
+
else {
|
|
58245
|
+
return sourceItem;
|
|
58246
|
+
}
|
|
58247
|
+
});
|
|
58248
|
+
}
|
|
58249
|
+
else if (targetValue instanceof Object &&
|
|
58250
|
+
!Array.isArray(targetValue) &&
|
|
58251
|
+
sourceValue instanceof Object &&
|
|
58252
|
+
!Array.isArray(sourceValue)) {
|
|
58253
|
+
deepMerge(targetValue, sourceValue);
|
|
58254
|
+
}
|
|
58255
|
+
else {
|
|
58256
|
+
target[key] = sourceValue;
|
|
58257
|
+
}
|
|
58258
|
+
}
|
|
58259
|
+
}
|
|
58260
|
+
}
|
|
58261
|
+
return target;
|
|
58262
|
+
}
|
|
58263
|
+
|
|
57952
58264
|
/**
|
|
57953
58265
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
57954
58266
|
* All rights reserved.
|
|
@@ -71672,13 +71984,12 @@ function injectSelectionSet(selectionSetNode, queryTransformHelper, fragmentMap)
|
|
|
71672
71984
|
selectionSetNode === undefined) {
|
|
71673
71985
|
return;
|
|
71674
71986
|
}
|
|
71675
|
-
const
|
|
71676
|
-
|
|
71677
|
-
selections
|
|
71678
|
-
|
|
71679
|
-
|
|
71680
|
-
|
|
71681
|
-
mergedSelections.forEach(selection => {
|
|
71987
|
+
const minimumSelectionSet = {
|
|
71988
|
+
kind: 'SelectionSet',
|
|
71989
|
+
selections: queryTransformHelper.getMinimumSelections()
|
|
71990
|
+
};
|
|
71991
|
+
const mergedSelections = mergeSelectionSets(selectionSetNode, minimumSelectionSet);
|
|
71992
|
+
mergedSelections === null || mergedSelections === void 0 ? void 0 : mergedSelections.selections.forEach(selection => {
|
|
71682
71993
|
if (selection.kind === 'Field') {
|
|
71683
71994
|
const fieldType = queryTransformHelper.getFieldType(selection);
|
|
71684
71995
|
const fieldTransformHelper = fieldType === undefined ? undefined : getQueryTransformerForType(fieldType.typename);
|
|
@@ -71707,42 +72018,7 @@ function injectSelectionSet(selectionSetNode, queryTransformHelper, fragmentMap)
|
|
|
71707
72018
|
}
|
|
71708
72019
|
}
|
|
71709
72020
|
});
|
|
71710
|
-
Object.assign(selectionSetNode,
|
|
71711
|
-
selections: mergedSelections.length > 0 ? mergedSelections : undefined
|
|
71712
|
-
});
|
|
71713
|
-
}
|
|
71714
|
-
function mergeSelections(minimumSelections, querySelections) {
|
|
71715
|
-
const mergedSelections = [...querySelections];
|
|
71716
|
-
for (let i = 0; i < minimumSelections.length; i++) {
|
|
71717
|
-
const minimumSelection = minimumSelections[i];
|
|
71718
|
-
if (minimumSelection.kind === 'Field') {
|
|
71719
|
-
const existingNode = mergedSelections.find(selection => {
|
|
71720
|
-
return selection.kind === 'Field' && selection.name.value === minimumSelection.name.value && (selection.directives === undefined || selection.directives.length === 0);
|
|
71721
|
-
});
|
|
71722
|
-
if (existingNode !== undefined && existingNode.kind === 'Field') { // Maybe do better type narrowing above
|
|
71723
|
-
const existingNodeHasSubselections = existingNode.selectionSet !== undefined && existingNode.selectionSet.selections.length > 0;
|
|
71724
|
-
const minimumFieldNodeHasSubselections = minimumSelection.selectionSet !== undefined && minimumSelection.selectionSet.selections.length > 0;
|
|
71725
|
-
// TODO(correctness enhancement): this doesn't handle arugments. Add alias if arguments disagree?
|
|
71726
|
-
if (existingNodeHasSubselections && minimumFieldNodeHasSubselections) {
|
|
71727
|
-
const mergedChildSelections = mergeSelections(minimumSelection.selectionSet.selections, existingNode.selectionSet.selections);
|
|
71728
|
-
Object.assign(existingNode.selectionSet, {
|
|
71729
|
-
selections: mergedChildSelections
|
|
71730
|
-
});
|
|
71731
|
-
}
|
|
71732
|
-
}
|
|
71733
|
-
else {
|
|
71734
|
-
mergedSelections.push(minimumSelection);
|
|
71735
|
-
}
|
|
71736
|
-
}
|
|
71737
|
-
if (minimumSelection.kind === 'InlineFragment') {
|
|
71738
|
-
mergedSelections.push(minimumSelection);
|
|
71739
|
-
}
|
|
71740
|
-
if (minimumSelection.kind === 'FragmentSpread') ;
|
|
71741
|
-
}
|
|
71742
|
-
return mergedSelections;
|
|
71743
|
-
}
|
|
71744
|
-
function getRequestedField(responseDataFieldName, requestedFields) {
|
|
71745
|
-
return requestedFields.find(fieldNode => (fieldNode.alias && fieldNode.alias.value === responseDataFieldName) || (!fieldNode.alias && fieldNode.name.value === responseDataFieldName));
|
|
72021
|
+
Object.assign(selectionSetNode, mergedSelections);
|
|
71746
72022
|
}
|
|
71747
72023
|
function getPageMetadata(paginationMetadata, paginationParams) {
|
|
71748
72024
|
const metadataProperties = {};
|
|
@@ -71788,67 +72064,6 @@ function getSerializedKeyForField(field, variables, fieldType) {
|
|
|
71788
72064
|
const argumentString = mutableArgumentNodes.length > 0 ? '__' + serializeFieldArguments(mutableArgumentNodes, variables) : '';
|
|
71789
72065
|
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.
|
|
71790
72066
|
}
|
|
71791
|
-
function mergeFragmentWithExistingSelections(fragmentFieldSelection, existingSelections) {
|
|
71792
|
-
// Check if there is an existing selection for this field we can merge with
|
|
71793
|
-
// If this isn't done, we will see issues such as W-12293630 & W-12236456 as examples
|
|
71794
|
-
const existingField = getRequestedField(fragmentFieldSelection.name.value, existingSelections);
|
|
71795
|
-
if (existingField === undefined) {
|
|
71796
|
-
existingSelections.push(fragmentFieldSelection);
|
|
71797
|
-
}
|
|
71798
|
-
else {
|
|
71799
|
-
if (existingField.selectionSet === undefined) {
|
|
71800
|
-
existingField.selectionSet === fragmentFieldSelection.selectionSet;
|
|
71801
|
-
}
|
|
71802
|
-
else if (fragmentFieldSelection.selectionSet !== undefined) {
|
|
71803
|
-
existingField.selectionSet.selections = mergeSelections(fragmentFieldSelection.selectionSet.selections, existingField.selectionSet.selections);
|
|
71804
|
-
}
|
|
71805
|
-
}
|
|
71806
|
-
}
|
|
71807
|
-
function calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
|
|
71808
|
-
const selections = [];
|
|
71809
|
-
selectionSet.selections.forEach(selection => {
|
|
71810
|
-
if (selection.kind === "Field") {
|
|
71811
|
-
selections.push(selection);
|
|
71812
|
-
}
|
|
71813
|
-
if (selection.kind === "InlineFragment" && isFragmentApplicable(selection, typename)) {
|
|
71814
|
-
// loops over the map to get the values.
|
|
71815
|
-
getRequestedFieldsForType(typename, selection.selectionSet, namedFragmentsMap, isFragmentApplicable)
|
|
71816
|
-
.forEach(fragmentFieldSelection => { mergeFragmentWithExistingSelections(fragmentFieldSelection, selections); });
|
|
71817
|
-
}
|
|
71818
|
-
if (selection.kind === "FragmentSpread") {
|
|
71819
|
-
const namedFragment = namedFragmentsMap[selection.name.value];
|
|
71820
|
-
if (namedFragment && isFragmentApplicable(namedFragment, typename)) {
|
|
71821
|
-
// loops over the map to get the values.
|
|
71822
|
-
getRequestedFieldsForType(typename, namedFragment.selectionSet, namedFragmentsMap, isFragmentApplicable)
|
|
71823
|
-
.forEach(fragmentFieldSelection => { mergeFragmentWithExistingSelections(fragmentFieldSelection, selections); });
|
|
71824
|
-
}
|
|
71825
|
-
}
|
|
71826
|
-
});
|
|
71827
|
-
// Needs to happen after the selections are merged.
|
|
71828
|
-
return selections.reduce((acc, fieldNode) => {
|
|
71829
|
-
const fieldName = fieldNode.alias ? fieldNode.alias.value : fieldNode.name.value;
|
|
71830
|
-
// 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.
|
|
71831
|
-
if (!acc.has(fieldName)) {
|
|
71832
|
-
acc.set(fieldName, fieldNode);
|
|
71833
|
-
}
|
|
71834
|
-
return acc;
|
|
71835
|
-
}, new Map());
|
|
71836
|
-
}
|
|
71837
|
-
let selectionSetRequestedFieldsWeakMap = new WeakMap();
|
|
71838
|
-
function getRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable) {
|
|
71839
|
-
let cachedRequestedFieldsConfigurations = selectionSetRequestedFieldsWeakMap.get(selectionSet);
|
|
71840
|
-
if (cachedRequestedFieldsConfigurations === undefined) {
|
|
71841
|
-
cachedRequestedFieldsConfigurations = new Map();
|
|
71842
|
-
selectionSetRequestedFieldsWeakMap.set(selectionSet, cachedRequestedFieldsConfigurations);
|
|
71843
|
-
}
|
|
71844
|
-
const cachedRequestedFieldsForType = cachedRequestedFieldsConfigurations.get(typename);
|
|
71845
|
-
if (cachedRequestedFieldsForType !== undefined) {
|
|
71846
|
-
return cachedRequestedFieldsForType;
|
|
71847
|
-
}
|
|
71848
|
-
const selections = calculateRequestedFieldsForType(typename, selectionSet, namedFragmentsMap, isFragmentApplicable);
|
|
71849
|
-
cachedRequestedFieldsConfigurations.set(typename, selections);
|
|
71850
|
-
return selections;
|
|
71851
|
-
}
|
|
71852
72067
|
function getQueryTransformerForType(typename, fragmentMap) {
|
|
71853
72068
|
switch (typename) {
|
|
71854
72069
|
case "PercentAggregate": return {
|
|
@@ -72467,18 +72682,7 @@ function selectCalculateSink(sink, field, buildSelectionForNodeFn, source, reade
|
|
|
72467
72682
|
(_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
|
|
72468
72683
|
const builtSelection = buildSelectionForNodeFn(source, reader, field, sel, variables, fragments, parentRecordId);
|
|
72469
72684
|
if (builtSelection !== undefined) {
|
|
72470
|
-
|
|
72471
|
-
Object.keys(builtSelection).forEach((key, value) => {
|
|
72472
|
-
// We only assign a field selection in the fragment if it doesn't already exist in sink
|
|
72473
|
-
// The non-fragment selection already got the merged selections in getRequestedFieldsForType
|
|
72474
|
-
if (sink[key] === undefined) {
|
|
72475
|
-
sink[key] = builtSelection[key];
|
|
72476
|
-
}
|
|
72477
|
-
});
|
|
72478
|
-
}
|
|
72479
|
-
else {
|
|
72480
|
-
Object.assign(sink, builtSelection);
|
|
72481
|
-
}
|
|
72685
|
+
deepMerge(sink, builtSelection);
|
|
72482
72686
|
}
|
|
72483
72687
|
});
|
|
72484
72688
|
return sink;
|
|
@@ -76088,7 +76292,7 @@ register({
|
|
|
76088
76292
|
configuration: { ...configurationForGraphQLAdapters },
|
|
76089
76293
|
instrument,
|
|
76090
76294
|
});
|
|
76091
|
-
// version: 1.
|
|
76295
|
+
// version: 1.229.0-dev1-5b6d3db67
|
|
76092
76296
|
|
|
76093
76297
|
// On core the unstable adapters are re-exported with different names,
|
|
76094
76298
|
|
|
@@ -78335,7 +78539,7 @@ withDefaultLuvio((luvio) => {
|
|
|
78335
78539
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
78336
78540
|
graphQLImperative = ldsAdapter;
|
|
78337
78541
|
});
|
|
78338
|
-
// version: 1.
|
|
78542
|
+
// version: 1.229.0-dev1-5b6d3db67
|
|
78339
78543
|
|
|
78340
78544
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
78341
78545
|
__proto__: null,
|
|
@@ -79049,4 +79253,4 @@ const { luvio } = getRuntime();
|
|
|
79049
79253
|
setDefaultLuvio({ luvio });
|
|
79050
79254
|
|
|
79051
79255
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
79052
|
-
// version: 1.
|
|
79256
|
+
// version: 1.229.0-dev1-f69d054a9
|