@salesforce/lds-worker-api 1.242.0 → 1.242.1
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.
|
@@ -3899,7 +3899,7 @@ function createResourceParamsImpl(config, configMetadata) {
|
|
|
3899
3899
|
}
|
|
3900
3900
|
return resourceParams;
|
|
3901
3901
|
}
|
|
3902
|
-
// engine version: 0.150.
|
|
3902
|
+
// engine version: 0.150.2-5dcb5d26
|
|
3903
3903
|
|
|
3904
3904
|
/**
|
|
3905
3905
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4027,7 +4027,7 @@ function withDefaultLuvio(callback) {
|
|
|
4027
4027
|
}
|
|
4028
4028
|
callbacks.push(callback);
|
|
4029
4029
|
}
|
|
4030
|
-
// version: 1.242.
|
|
4030
|
+
// version: 1.242.1-58f8f4bb1
|
|
4031
4031
|
|
|
4032
4032
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4033
4033
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15488,7 +15488,7 @@ function gql(literals, ...subs) {
|
|
|
15488
15488
|
}
|
|
15489
15489
|
return superResult;
|
|
15490
15490
|
}
|
|
15491
|
-
// version: 1.242.
|
|
15491
|
+
// version: 1.242.1-58f8f4bb1
|
|
15492
15492
|
|
|
15493
15493
|
function unwrap(data) {
|
|
15494
15494
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16413,7 +16413,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
16413
16413
|
const { apiFamily, name } = metadata;
|
|
16414
16414
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16415
16415
|
}
|
|
16416
|
-
// version: 1.242.
|
|
16416
|
+
// version: 1.242.1-58f8f4bb1
|
|
16417
16417
|
|
|
16418
16418
|
/**
|
|
16419
16419
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -16512,7 +16512,7 @@ var TypeCheckShapes;
|
|
|
16512
16512
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
16513
16513
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
16514
16514
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
16515
|
-
// engine version: 0.150.
|
|
16515
|
+
// engine version: 0.150.2-5dcb5d26
|
|
16516
16516
|
|
|
16517
16517
|
const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
|
|
16518
16518
|
|
|
@@ -34817,16 +34817,6 @@ function createResourceRequest$n(config) {
|
|
|
34817
34817
|
};
|
|
34818
34818
|
}
|
|
34819
34819
|
|
|
34820
|
-
const adapterName$k = 'updateRelatedListInfo';
|
|
34821
|
-
const updateRelatedListInfo_ConfigPropertyMetadata = [
|
|
34822
|
-
generateParamConfigMetadata$2('parentObjectApiName', true, 0 /* UrlParameter */, 0 /* String */, false, getObjectApiName$1$1),
|
|
34823
|
-
generateParamConfigMetadata$2('relatedListId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
34824
|
-
generateParamConfigMetadata$2('recordTypeId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
34825
|
-
generateParamConfigMetadata$2('orderedByInfo', true, 2 /* Body */, 4 /* Unsupported */, true),
|
|
34826
|
-
generateParamConfigMetadata$2('userPreferences', true, 2 /* Body */, 4 /* Unsupported */),
|
|
34827
|
-
];
|
|
34828
|
-
const updateRelatedListInfo_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig$2(adapterName$k, updateRelatedListInfo_ConfigPropertyMetadata);
|
|
34829
|
-
const createResourceParams$m = /*#__PURE__*/ createResourceParams$Z(updateRelatedListInfo_ConfigPropertyMetadata);
|
|
34830
34820
|
function typeCheckConfig$o(untrustedConfig) {
|
|
34831
34821
|
const config = {};
|
|
34832
34822
|
typeCheckConfig$12(untrustedConfig, config, updateRelatedListInfo_ConfigPropertyMetadata);
|
|
@@ -34847,8 +34837,22 @@ function typeCheckConfig$o(untrustedConfig) {
|
|
|
34847
34837
|
if (referenceListUserPreferenceInputRepresentationValidationError === null) {
|
|
34848
34838
|
config.userPreferences = untrustedConfig_userPreferences;
|
|
34849
34839
|
}
|
|
34840
|
+
else {
|
|
34841
|
+
throw referenceListUserPreferenceInputRepresentationValidationError;
|
|
34842
|
+
}
|
|
34850
34843
|
return config;
|
|
34851
34844
|
}
|
|
34845
|
+
|
|
34846
|
+
const adapterName$k = 'updateRelatedListInfo';
|
|
34847
|
+
const updateRelatedListInfo_ConfigPropertyMetadata = [
|
|
34848
|
+
generateParamConfigMetadata$2('parentObjectApiName', true, 0 /* UrlParameter */, 0 /* String */, false, getObjectApiName$1$1),
|
|
34849
|
+
generateParamConfigMetadata$2('relatedListId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
34850
|
+
generateParamConfigMetadata$2('recordTypeId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
34851
|
+
generateParamConfigMetadata$2('orderedByInfo', true, 2 /* Body */, 4 /* Unsupported */, true),
|
|
34852
|
+
generateParamConfigMetadata$2('userPreferences', true, 2 /* Body */, 4 /* Unsupported */),
|
|
34853
|
+
];
|
|
34854
|
+
const updateRelatedListInfo_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig$2(adapterName$k, updateRelatedListInfo_ConfigPropertyMetadata);
|
|
34855
|
+
const createResourceParams$m = /*#__PURE__*/ createResourceParams$Z(updateRelatedListInfo_ConfigPropertyMetadata);
|
|
34852
34856
|
function validateAdapterConfig$n(untrustedConfig, configPropertyNames) {
|
|
34853
34857
|
if (!untrustedIsObject$2(untrustedConfig)) {
|
|
34854
34858
|
return null;
|
|
@@ -41737,7 +41741,7 @@ withDefaultLuvio((luvio) => {
|
|
|
41737
41741
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
|
|
41738
41742
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
|
|
41739
41743
|
});
|
|
41740
|
-
// version: 1.242.
|
|
41744
|
+
// version: 1.242.1-5a8ee3f4c
|
|
41741
41745
|
|
|
41742
41746
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
41743
41747
|
|
|
@@ -42379,6 +42383,9 @@ function handleDurableStoreRejection(instrument) {
|
|
|
42379
42383
|
}
|
|
42380
42384
|
|
|
42381
42385
|
function isStoreEntryError(storeRecord) {
|
|
42386
|
+
if (!storeRecord || typeof storeRecord !== 'object') {
|
|
42387
|
+
return false;
|
|
42388
|
+
}
|
|
42382
42389
|
return storeRecord.__type === 'error';
|
|
42383
42390
|
}
|
|
42384
42391
|
|
|
@@ -49972,6 +49979,10 @@ function isOperationDefinitionNode(node) {
|
|
|
49972
49979
|
return node.kind === 'OperationDefinition';
|
|
49973
49980
|
}
|
|
49974
49981
|
|
|
49982
|
+
const POLYMORPHIC_PARENT_RELATIONSHIP = 'polymorphicParentRelationship';
|
|
49983
|
+
const PARENT_RELATIONSHIP = 'parentRelationship';
|
|
49984
|
+
const CHILD_RELATIONSHIP = 'childRelationship';
|
|
49985
|
+
const RECORD_QUERY = 'recordQuery';
|
|
49975
49986
|
function requestsDraftsField(recordFieldNode) {
|
|
49976
49987
|
if (!recordFieldNode.selectionSet)
|
|
49977
49988
|
return false;
|
|
@@ -49987,18 +49998,41 @@ function isRecordQuery(recordQueryField) {
|
|
|
49987
49998
|
directive.arguments
|
|
49988
49999
|
.map((argument) => argument.value)
|
|
49989
50000
|
.filter(isStringValueNode)
|
|
49990
|
-
.some((categoryName) => categoryName.value ===
|
|
50001
|
+
.some((categoryName) => categoryName.value === RECORD_QUERY));
|
|
49991
50002
|
});
|
|
49992
50003
|
}
|
|
49993
50004
|
return false;
|
|
49994
50005
|
}
|
|
49995
|
-
// finds field with 'recordQuery' and 'childRelationship' directive
|
|
49996
|
-
function
|
|
49997
|
-
const
|
|
49998
|
-
return
|
|
50006
|
+
// finds connection field with 'recordQuery' and 'childRelationship' directive.
|
|
50007
|
+
function findNearestConnection(ancestors) {
|
|
50008
|
+
const connectionAncestor = findNearestAncesterPath(ancestors, true).node;
|
|
50009
|
+
return connectionAncestor === undefined ? undefined : connectionAncestor;
|
|
50010
|
+
}
|
|
50011
|
+
// convinient method to find nearest connection with its path
|
|
50012
|
+
function findNearestConnectionWithPath(ancestors) {
|
|
50013
|
+
const closestAncestorPath = findNearestAncesterPath(ancestors, true);
|
|
50014
|
+
let connection = undefined;
|
|
50015
|
+
let connectionPath = undefined;
|
|
50016
|
+
if (closestAncestorPath.parentIndex > 0) {
|
|
50017
|
+
const connectionAncestor = closestAncestorPath.node;
|
|
50018
|
+
const connectionAncestors = ancestors.slice(0, closestAncestorPath.parentIndex);
|
|
50019
|
+
connection =
|
|
50020
|
+
connectionAncestor === undefined ? undefined : connectionAncestor;
|
|
50021
|
+
if (connection !== undefined) {
|
|
50022
|
+
const ancesterPath = findAncesterPath(connectionAncestors);
|
|
50023
|
+
connectionPath =
|
|
50024
|
+
ancesterPath === ''
|
|
50025
|
+
? connection.name.value
|
|
50026
|
+
: `${ancesterPath}#${connection.name.value}`;
|
|
50027
|
+
}
|
|
50028
|
+
}
|
|
50029
|
+
return {
|
|
50030
|
+
connection,
|
|
50031
|
+
path: connectionPath,
|
|
50032
|
+
};
|
|
49999
50033
|
}
|
|
50000
|
-
// finds
|
|
50001
|
-
function findNearestAncesterPath(ancestors,
|
|
50034
|
+
// finds closest ancestor. If node with 'parentRelationship' is the ancester, the end result could be 'InlineFragmentNode' since it inherits the 'parent' relationship. 'InlineFragmentNode' makes sure that only one 'apiName' returns when tree is traversed.
|
|
50035
|
+
function findNearestAncesterPath(ancestors, connectionOnly) {
|
|
50002
50036
|
let recordQueryPath = { node: undefined, parentIndex: -1 };
|
|
50003
50037
|
let relationship = '';
|
|
50004
50038
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
@@ -50012,9 +50046,11 @@ function findNearestAncesterPath(ancestors, recordQueryOnly) {
|
|
|
50012
50046
|
continue;
|
|
50013
50047
|
for (let arg of directive.arguments) {
|
|
50014
50048
|
if (arg.value &&
|
|
50015
|
-
(arg.value.value ===
|
|
50016
|
-
arg.value.value ===
|
|
50017
|
-
(!
|
|
50049
|
+
(arg.value.value === RECORD_QUERY ||
|
|
50050
|
+
arg.value.value === CHILD_RELATIONSHIP ||
|
|
50051
|
+
(!connectionOnly &&
|
|
50052
|
+
(arg.value.value === PARENT_RELATIONSHIP ||
|
|
50053
|
+
arg.value.value === POLYMORPHIC_PARENT_RELATIONSHIP)))) {
|
|
50018
50054
|
recordQueryPath = { node: node, parentIndex: i };
|
|
50019
50055
|
relationship = arg.value.value;
|
|
50020
50056
|
break;
|
|
@@ -50029,17 +50065,19 @@ function findNearestAncesterPath(ancestors, recordQueryOnly) {
|
|
|
50029
50065
|
//checks if nearest ancester could be an inline fragment
|
|
50030
50066
|
if (recordQueryPath.node !== undefined &&
|
|
50031
50067
|
recordQueryPath.node.selectionSet &&
|
|
50032
|
-
relationship ===
|
|
50033
|
-
//
|
|
50034
|
-
|
|
50035
|
-
|
|
50036
|
-
|
|
50037
|
-
if (
|
|
50068
|
+
(relationship === PARENT_RELATIONSHIP || relationship === POLYMORPHIC_PARENT_RELATIONSHIP)) {
|
|
50069
|
+
// InlineFragment is usually 3 steps aways from its FieldNode parent within ancester hierarchy if it exists. The below search
|
|
50070
|
+
// is applied to adapt to future AST structure change
|
|
50071
|
+
let parentIndex = recordQueryPath.parentIndex + 1;
|
|
50072
|
+
while (parentIndex < ancestors.length) {
|
|
50073
|
+
if (isInlineFragmentNode(ancestors[parentIndex])) {
|
|
50038
50074
|
recordQueryPath = {
|
|
50039
|
-
node: ancestors[
|
|
50040
|
-
parentIndex
|
|
50075
|
+
node: ancestors[parentIndex],
|
|
50076
|
+
parentIndex,
|
|
50041
50077
|
};
|
|
50078
|
+
break;
|
|
50042
50079
|
}
|
|
50080
|
+
parentIndex++;
|
|
50043
50081
|
}
|
|
50044
50082
|
}
|
|
50045
50083
|
return recordQueryPath;
|
|
@@ -50063,7 +50101,7 @@ function findAncesterPath(ancesters) {
|
|
|
50063
50101
|
? sectionPath
|
|
50064
50102
|
: sectionPath === ''
|
|
50065
50103
|
? path
|
|
50066
|
-
: `${sectionPath}
|
|
50104
|
+
: `${sectionPath}#${path}`;
|
|
50067
50105
|
}
|
|
50068
50106
|
}
|
|
50069
50107
|
boundaryIndex = parentIndex;
|
|
@@ -50121,9 +50159,9 @@ function getRelation(node) {
|
|
|
50121
50159
|
const relationships = args
|
|
50122
50160
|
.map((arg) => arg.value)
|
|
50123
50161
|
.filter(isStringValueNode)
|
|
50124
|
-
.filter((valueNode) => valueNode.value ===
|
|
50125
|
-
valueNode.value ===
|
|
50126
|
-
valueNode.value ===
|
|
50162
|
+
.filter((valueNode) => valueNode.value === CHILD_RELATIONSHIP ||
|
|
50163
|
+
valueNode.value === PARENT_RELATIONSHIP ||
|
|
50164
|
+
valueNode.value === POLYMORPHIC_PARENT_RELATIONSHIP)
|
|
50127
50165
|
.map((relationshipNode) => relationshipNode.value);
|
|
50128
50166
|
if (relationships.length > 0) {
|
|
50129
50167
|
return relationships[0];
|
|
@@ -50180,8 +50218,8 @@ function isFieldSpanning(node, parentNode) {
|
|
|
50180
50218
|
*/
|
|
50181
50219
|
function isParentRelationship(node) {
|
|
50182
50220
|
return (node &&
|
|
50183
|
-
(isRelationship(node,
|
|
50184
|
-
isRelationship(node,
|
|
50221
|
+
(isRelationship(node, PARENT_RELATIONSHIP) ||
|
|
50222
|
+
isRelationship(node, POLYMORPHIC_PARENT_RELATIONSHIP)));
|
|
50185
50223
|
}
|
|
50186
50224
|
/*
|
|
50187
50225
|
checks if the InlineFragment spans
|
|
@@ -51273,7 +51311,7 @@ const parentRelationshipDirective = {
|
|
|
51273
51311
|
},
|
|
51274
51312
|
value: {
|
|
51275
51313
|
kind: Kind$1.STRING,
|
|
51276
|
-
value:
|
|
51314
|
+
value: PARENT_RELATIONSHIP,
|
|
51277
51315
|
block: false,
|
|
51278
51316
|
},
|
|
51279
51317
|
},
|
|
@@ -51287,7 +51325,7 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51287
51325
|
// example 2 'ServiceAppointment' -> ['Owner']; 'Owner' -> ['User', 'Group']
|
|
51288
51326
|
const objectNodeInfoTree = {};
|
|
51289
51327
|
// save the field path to apiName map
|
|
51290
|
-
// example 1: 'ServiceAppointment' -> ['ServiceAppointment']; '
|
|
51328
|
+
// example 1: 'ServiceAppointment' -> ['ServiceAppointment']; 'ServiceAppointment#ccount' -> ['Account']; 'ServiceAppointment#Account#Owner' -> ['User']
|
|
51291
51329
|
const pathToObjectApiNamesMap = {};
|
|
51292
51330
|
let startNodes = new Set();
|
|
51293
51331
|
let totalNodes = new Set();
|
|
@@ -51302,11 +51340,11 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51302
51340
|
visit$1(originalAST, {
|
|
51303
51341
|
Argument: {
|
|
51304
51342
|
enter(node, key, parent, path, ancestors) {
|
|
51305
|
-
const
|
|
51306
|
-
if (!
|
|
51343
|
+
const { connection: recordConnectionNode, path: ancesterPath } = findNearestConnectionWithPath(ancestors);
|
|
51344
|
+
if (!recordConnectionNode || !ancesterPath)
|
|
51307
51345
|
return;
|
|
51308
|
-
if (!objectNodeInfoTree[
|
|
51309
|
-
objectNodeInfoTree[
|
|
51346
|
+
if (!objectNodeInfoTree[ancesterPath]) {
|
|
51347
|
+
objectNodeInfoTree[ancesterPath] = [];
|
|
51310
51348
|
}
|
|
51311
51349
|
switch (node.name.value) {
|
|
51312
51350
|
case 'orderBy':
|
|
@@ -51314,12 +51352,12 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51314
51352
|
if (node.value.kind !== 'ObjectValue') {
|
|
51315
51353
|
return;
|
|
51316
51354
|
}
|
|
51317
|
-
totalNodes.add(
|
|
51355
|
+
totalNodes.add(ancesterPath);
|
|
51318
51356
|
// 'childRelationship' node is not taken as the startNode of the 'NodeInfoTree' graph. The field scanning will construct the graph which lead here.
|
|
51319
|
-
if (isRecordQuery(
|
|
51320
|
-
startNodes.add(
|
|
51357
|
+
if (isRecordQuery(recordConnectionNode)) {
|
|
51358
|
+
startNodes.add(recordConnectionNode.name.value);
|
|
51321
51359
|
}
|
|
51322
|
-
growObjectFieldTree(objectNodeInfoTree,
|
|
51360
|
+
growObjectFieldTree(objectNodeInfoTree, ancesterPath, node.value, totalNodes, startNodes);
|
|
51323
51361
|
break;
|
|
51324
51362
|
case 'scope':
|
|
51325
51363
|
if (!isScopeArgumentNodeWithType(node, 'ASSIGNEDTOME', variables)) {
|
|
@@ -51334,17 +51372,16 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51334
51372
|
name: 'ServiceResources',
|
|
51335
51373
|
});
|
|
51336
51374
|
}
|
|
51337
|
-
if (objectNodeInfoTree['ServiceResources'] === undefined) {
|
|
51338
|
-
objectNodeInfoTree['ServiceResources'] = [
|
|
51339
|
-
|
|
51340
|
-
|
|
51341
|
-
|
|
51342
|
-
|
|
51343
|
-
|
|
51344
|
-
});
|
|
51375
|
+
if (objectNodeInfoTree['ServiceAppointment#ServiceResources'] === undefined) {
|
|
51376
|
+
objectNodeInfoTree['ServiceAppointment#ServiceResources'] = [
|
|
51377
|
+
{
|
|
51378
|
+
relation: 'parent',
|
|
51379
|
+
name: 'ServiceResource',
|
|
51380
|
+
},
|
|
51381
|
+
];
|
|
51345
51382
|
}
|
|
51346
|
-
if (objectNodeInfoTree['ServiceResource'] === undefined) {
|
|
51347
|
-
objectNodeInfoTree['ServiceResource'] = [];
|
|
51383
|
+
if (objectNodeInfoTree['ServiceAppointment#ServiceResources#ServiceResource'] === undefined) {
|
|
51384
|
+
objectNodeInfoTree['ServiceAppointment#ServiceResources#ServiceResource'] = [];
|
|
51348
51385
|
}
|
|
51349
51386
|
break;
|
|
51350
51387
|
default:
|
|
@@ -51358,7 +51395,7 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51358
51395
|
return;
|
|
51359
51396
|
if (!node.selectionSet)
|
|
51360
51397
|
return;
|
|
51361
|
-
const recordQueryField =
|
|
51398
|
+
const recordQueryField = findNearestConnection(ancestors);
|
|
51362
51399
|
//only injects fields for 'recordQuery' field. ignores the 'childRelationship' field since it will be traversed as the child of the 'recordQuery'
|
|
51363
51400
|
if (isRecordQuery(recordQueryField) && recordQueryField) {
|
|
51364
51401
|
totalNodes.add(recordQueryField.name.value);
|
|
@@ -51375,7 +51412,7 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51375
51412
|
visit$1(originalAST, {
|
|
51376
51413
|
Argument: {
|
|
51377
51414
|
leave(node, key, parent, path, ancestors) {
|
|
51378
|
-
const recordQueryField =
|
|
51415
|
+
const recordQueryField = findNearestConnection(ancestors);
|
|
51379
51416
|
if (!recordQueryField)
|
|
51380
51417
|
return;
|
|
51381
51418
|
const ancestorPath = findAncesterPath(ancestors);
|
|
@@ -51423,7 +51460,7 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51423
51460
|
case 'where': {
|
|
51424
51461
|
inlineFragmentSelections[ancestorPath] = [
|
|
51425
51462
|
...inlineFragmentSelections[ancestorPath],
|
|
51426
|
-
...injectFilter(node, idState, ancestorPath, objectInfos, pathToObjectApiNamesMap, draftFunctions, recordReferenceNode),
|
|
51463
|
+
...injectFilter(node, idState, ancestorPath, false, objectInfos, pathToObjectApiNamesMap, draftFunctions, recordReferenceNode),
|
|
51427
51464
|
];
|
|
51428
51465
|
break;
|
|
51429
51466
|
}
|
|
@@ -51439,7 +51476,7 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51439
51476
|
if (!node.selectionSet)
|
|
51440
51477
|
return;
|
|
51441
51478
|
// it could be 'recordQuery' or 'childRelationship'
|
|
51442
|
-
const recordQueryField =
|
|
51479
|
+
const recordQueryField = findNearestConnection(ancestors);
|
|
51443
51480
|
if (!recordQueryField)
|
|
51444
51481
|
return;
|
|
51445
51482
|
const ancestorPath = findAncesterPath(ancestors);
|
|
@@ -51451,7 +51488,7 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51451
51488
|
spanningSelections.push(selection);
|
|
51452
51489
|
}
|
|
51453
51490
|
}
|
|
51454
|
-
const injectedFields = injectFields(spanningSelections, node, ancestors, objectInfos, pathToObjectApiNamesMap);
|
|
51491
|
+
const injectedFields = injectFields(spanningSelections, node, ancestorPath, ancestors, objectInfos, pathToObjectApiNamesMap);
|
|
51455
51492
|
const mergedInjectedFields = mergeSelectionNodes$1(inlineFragmentSelections[ancestorPath], injectedFields);
|
|
51456
51493
|
inlineFragmentSelections[ancestorPath] = mergedInjectedFields;
|
|
51457
51494
|
},
|
|
@@ -51464,7 +51501,7 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51464
51501
|
// removes 'ServicesResources' query field node if 'assignedtome' scope shows up
|
|
51465
51502
|
if (assignedtomeQueryFieldNode !== undefined &&
|
|
51466
51503
|
node.name.value === 'ServiceResources') {
|
|
51467
|
-
const serviceResourcesAncestor =
|
|
51504
|
+
const serviceResourcesAncestor = findNearestConnection(ancestors);
|
|
51468
51505
|
if (serviceResourcesAncestor === assignedtomeQueryFieldNode) {
|
|
51469
51506
|
return null;
|
|
51470
51507
|
}
|
|
@@ -51473,7 +51510,7 @@ async function injectSyntheticFields(originalAST, objectInfoService, draftFuncti
|
|
|
51473
51510
|
return;
|
|
51474
51511
|
if (!node.selectionSet)
|
|
51475
51512
|
return;
|
|
51476
|
-
const recordQueryField =
|
|
51513
|
+
const recordQueryField = findNearestConnection(ancestors);
|
|
51477
51514
|
if (!recordQueryField)
|
|
51478
51515
|
return;
|
|
51479
51516
|
const ancestorPath = findAncesterPath(ancestors);
|
|
@@ -51676,15 +51713,16 @@ function growObjectFieldTree(tree, parentNode, entryNode, totalNodes, startNodes
|
|
|
51676
51713
|
}
|
|
51677
51714
|
// example: 'Account'
|
|
51678
51715
|
const childNode = objectFieldNode.name.value;
|
|
51716
|
+
const childNodepath = `${parentNode}#${childNode}`;
|
|
51679
51717
|
if (!tree[parentNode].some((child) => child.name === childNode)) {
|
|
51680
51718
|
tree[parentNode].push({
|
|
51681
51719
|
relation: 'parent',
|
|
51682
51720
|
name: childNode,
|
|
51683
51721
|
});
|
|
51684
|
-
totalNodes.add(
|
|
51722
|
+
totalNodes.add(childNodepath);
|
|
51685
51723
|
}
|
|
51686
51724
|
// recursively go to deeper level of filter.
|
|
51687
|
-
growObjectFieldTree(tree,
|
|
51725
|
+
growObjectFieldTree(tree, childNodepath, objectFieldNode.value, totalNodes, startNodes);
|
|
51688
51726
|
}
|
|
51689
51727
|
}
|
|
51690
51728
|
}
|
|
@@ -51719,19 +51757,20 @@ function growFieldTree(tree, parentSectionPath, entryNode, parentNode, totalNode
|
|
|
51719
51757
|
}
|
|
51720
51758
|
if (!tree[parentSectionPath].some((field) => field.name === fieldName)) {
|
|
51721
51759
|
tree[parentSectionPath].push({
|
|
51722
|
-
relation: relationType ===
|
|
51723
|
-
relationType ===
|
|
51760
|
+
relation: relationType === PARENT_RELATIONSHIP ||
|
|
51761
|
+
relationType === POLYMORPHIC_PARENT_RELATIONSHIP
|
|
51724
51762
|
? 'parent'
|
|
51725
51763
|
: 'child',
|
|
51726
51764
|
name: fieldName,
|
|
51727
51765
|
});
|
|
51728
|
-
totalNodes.add(fieldName);
|
|
51766
|
+
totalNodes.add(`${parentSectionPath}#${fieldName}`);
|
|
51729
51767
|
}
|
|
51730
51768
|
if (entryNode.selectionSet && entryNode.selectionSet.selections) {
|
|
51731
51769
|
const childNodes = entryNode.selectionSet.selections.filter(isFieldOrInlineFragmentNode);
|
|
51732
51770
|
// recursively build the traversal tree
|
|
51733
51771
|
for (const child of childNodes) {
|
|
51734
|
-
|
|
51772
|
+
const path = `${parentSectionPath}#${fieldName}`;
|
|
51773
|
+
growFieldTree(tree, path, child, entryNode, totalNodes, startNodes);
|
|
51735
51774
|
}
|
|
51736
51775
|
}
|
|
51737
51776
|
}
|
|
@@ -51761,23 +51800,23 @@ function growFieldTree(tree, parentSectionPath, entryNode, parentNode, totalNode
|
|
|
51761
51800
|
}
|
|
51762
51801
|
if (!tree[parentSectionPath].some((field) => field.name === conditionName)) {
|
|
51763
51802
|
tree[parentSectionPath].push({
|
|
51764
|
-
relation: relationType ===
|
|
51765
|
-
relationType ===
|
|
51803
|
+
relation: relationType === PARENT_RELATIONSHIP ||
|
|
51804
|
+
relationType === POLYMORPHIC_PARENT_RELATIONSHIP
|
|
51766
51805
|
? 'parent'
|
|
51767
51806
|
: 'child',
|
|
51768
51807
|
name: conditionName,
|
|
51769
51808
|
});
|
|
51770
|
-
|
|
51809
|
+
const path = `${parentSectionPath}#${conditionName}`;
|
|
51810
|
+
totalNodes.add(path);
|
|
51771
51811
|
}
|
|
51772
51812
|
}
|
|
51773
51813
|
}
|
|
51774
51814
|
// dive deep immediately for 'InlineFragment'
|
|
51775
51815
|
const childNodes = entryNode.selectionSet.selections.filter(isFieldOrInlineFragmentNode);
|
|
51816
|
+
const path = `${parentSectionPath}${entryNode.typeCondition ? '#' + entryNode.typeCondition.name.value : ''}`;
|
|
51776
51817
|
// Navigates into InLineFragment
|
|
51777
51818
|
for (const child of childNodes) {
|
|
51778
|
-
growFieldTree(tree, entryNode
|
|
51779
|
-
? entryNode.typeCondition.name.value
|
|
51780
|
-
: parentSectionPath, child, entryNode, totalNodes, startNodes);
|
|
51819
|
+
growFieldTree(tree, path, child, entryNode, totalNodes, startNodes);
|
|
51781
51820
|
}
|
|
51782
51821
|
}
|
|
51783
51822
|
}
|
|
@@ -51821,7 +51860,7 @@ async function fetchObjectInfos(objectInfotree, pathToObjectApiNamesMap, objectI
|
|
|
51821
51860
|
}
|
|
51822
51861
|
const validObjectInfoNodes = [];
|
|
51823
51862
|
let updatedObjectInfoMap = {};
|
|
51824
|
-
// InlineFragment and polymorphic field support fits into this scenario pathToObjectApiNamesMap Entry: '
|
|
51863
|
+
// InlineFragment and polymorphic field support fits into this scenario pathToObjectApiNamesMap Entry: 'ServiceAppointment#Owner' -> ['User', 'Group']; ServiceAppointment#Owner#User' -> ['User']
|
|
51825
51864
|
if (objectInfoApiNames.length > 0 &&
|
|
51826
51865
|
nodesAtSameLevel.length > 0 &&
|
|
51827
51866
|
objectInfoApiNames.includes(nodesAtSameLevel[0].name)) {
|
|
@@ -51833,7 +51872,7 @@ async function fetchObjectInfos(objectInfotree, pathToObjectApiNamesMap, objectI
|
|
|
51833
51872
|
// eslint-disable-next-line
|
|
51834
51873
|
throw new Error(`Condition ${field.name} does not exists for ${parentPath}`);
|
|
51835
51874
|
}
|
|
51836
|
-
const path = `${parentPath}
|
|
51875
|
+
const path = `${parentPath}#${field.name}`;
|
|
51837
51876
|
pathToObjectApiNamesMap[path] = [field.name];
|
|
51838
51877
|
}
|
|
51839
51878
|
validObjectInfoNodes.push(...nodesAtSameLevel);
|
|
@@ -51849,7 +51888,7 @@ async function fetchObjectInfos(objectInfotree, pathToObjectApiNamesMap, objectI
|
|
|
51849
51888
|
let apiNames = [];
|
|
51850
51889
|
for (const nodeInfo of nodesAtSameLevel) {
|
|
51851
51890
|
const field = nodeInfo.name;
|
|
51852
|
-
const path = `${parentPath}
|
|
51891
|
+
const path = `${parentPath}#${field}`;
|
|
51853
51892
|
// Handle 'parentRelationship'
|
|
51854
51893
|
if (nodeInfo.relation === 'parent') {
|
|
51855
51894
|
const relationshipId = referenceIdFieldForRelationship(field);
|
|
@@ -51867,12 +51906,12 @@ async function fetchObjectInfos(objectInfotree, pathToObjectApiNamesMap, objectI
|
|
|
51867
51906
|
}
|
|
51868
51907
|
}
|
|
51869
51908
|
// This is a polymorphic field
|
|
51870
|
-
if (fieldDefinition.referenceToInfos.length > 1 && objectInfotree[
|
|
51909
|
+
if (fieldDefinition.referenceToInfos.length > 1 && objectInfotree[path]) {
|
|
51871
51910
|
// Fields needs to expand and heterogenous entity ObjectInfo needs to be fetched
|
|
51872
|
-
const referencedNodeInfos = objectInfotree[
|
|
51911
|
+
const referencedNodeInfos = objectInfotree[path];
|
|
51873
51912
|
const requestedApiNames = referencedNodeInfos.map((referenceNodeInfo) => referenceNodeInfo.name);
|
|
51874
51913
|
// Fetches requested ObjectInfo only. Some entity's relation field could define more than 6 references. Only references show up in query need to be handled.
|
|
51875
|
-
if (requestedApiNames.length > 0 && objectInfotree[
|
|
51914
|
+
if (requestedApiNames.length > 0 && objectInfotree[path]) {
|
|
51876
51915
|
fieldDefinition.referenceToInfos
|
|
51877
51916
|
.filter((referenceToInfo) => requestedApiNames.includes(referenceToInfo.apiName))
|
|
51878
51917
|
.forEach((ref) => {
|
|
@@ -51932,8 +51971,8 @@ async function fetchObjectInfos(objectInfotree, pathToObjectApiNamesMap, objectI
|
|
|
51932
51971
|
}
|
|
51933
51972
|
for (const nodeInfo of validObjectInfoNodes) {
|
|
51934
51973
|
const field = nodeInfo.name;
|
|
51935
|
-
const
|
|
51936
|
-
const
|
|
51974
|
+
const path = `${parentPath}#${field}`;
|
|
51975
|
+
const subLevelFields = objectInfotree[path];
|
|
51937
51976
|
if (subLevelFields && subLevelFields.length > 0) {
|
|
51938
51977
|
const subObjectInfos = await fetchObjectInfos(objectInfotree, pathToObjectApiNamesMap, updatedObjectInfoMap, subLevelFields, path, objectInfoService);
|
|
51939
51978
|
updatedObjectInfoMap = { ...updatedObjectInfoMap, ...subObjectInfos };
|
|
@@ -51950,27 +51989,29 @@ async function fetchObjectInfos(objectInfotree, pathToObjectApiNamesMap, objectI
|
|
|
51950
51989
|
* 'path' and 'queryNode' is 1 level above the 'filterNode'
|
|
51951
51990
|
* @param filterNode filter node which needs to be injected. For example, 'State' ObjectFieldNode within filter 'where: { State: { eq: "Nova Scotia" }}'
|
|
51952
51991
|
* @param idState ID state will be updated to determine if the ID fields in AST need to be swapped. The swapping happens later.
|
|
51953
|
-
* @param
|
|
51992
|
+
* @param parentPath path to the current filterNode's parent. For example, path could be 'ServiceApointment' when filterNode is 'State'. If the path does not exist in 'pathToObjectApiNamesMap', parent node is not an field of relationship or recordQuery
|
|
51993
|
+
* @param isParentPolymorphic true if parent points to a polymorphic field.
|
|
51954
51994
|
* @param queryNode referece FieldNode which provides the information if 'filterNode' exist in it nor not.
|
|
51955
51995
|
* @param objectInfos ObjectInfo map used in injection. If ObjectInfo misses or field does not exist in ObjectInfo, the error will be thrown
|
|
51956
51996
|
* @param pathToObjectApiNamesMap map used to locate the ObjectInfo. The key is path to a field, value is the ObjectInfo's apiName array. In the case of polymorphic fields, the apiName array have 2 or more elements. For example, 'ServiceAppointment' -> ['ServiceAppointment']; 'ServiceAppointment_Account' -> ['Account'], 'ServiceAppointment_Owner' -> ['User', 'Group'].
|
|
51957
51997
|
* @param draftFunctions functions for working with record ids that may be draft-created ids
|
|
51958
51998
|
* @returns an array of nodes with injected fields
|
|
51959
51999
|
*/
|
|
51960
|
-
function injectFilter(filterNode, idState,
|
|
52000
|
+
function injectFilter(filterNode, idState, parentPath, isParentPolymorphic, objectInfos, pathToObjectApiNamesMap, draftFunctions, queryNode) {
|
|
51961
52001
|
const injectedSelections = [];
|
|
52002
|
+
let isPolymorphicField = false;
|
|
51962
52003
|
switch (filterNode.kind) {
|
|
51963
52004
|
case Kind$1.ARGUMENT:
|
|
51964
52005
|
if (filterNode.value.kind !== 'ObjectValue')
|
|
51965
52006
|
return [];
|
|
51966
52007
|
filterNode.value.fields.forEach((objectFieldNode) => {
|
|
51967
|
-
let subResults = injectFilter(objectFieldNode, idState,
|
|
52008
|
+
let subResults = injectFilter(objectFieldNode, idState, parentPath, isParentPolymorphic, objectInfos, pathToObjectApiNamesMap, draftFunctions, queryNode);
|
|
51968
52009
|
for (const subResult of subResults) {
|
|
51969
52010
|
mergeOrAddToGroup(injectedSelections, subResult);
|
|
51970
52011
|
}
|
|
51971
52012
|
// multiple Ids might need to be swapped. remember their paths for faster write.
|
|
51972
52013
|
if (idState.swapNeeded) {
|
|
51973
|
-
idState.paths.push(
|
|
52014
|
+
idState.paths.push(parentPath);
|
|
51974
52015
|
}
|
|
51975
52016
|
});
|
|
51976
52017
|
return injectedSelections;
|
|
@@ -51979,7 +52020,7 @@ function injectFilter(filterNode, idState, path, objectInfos, pathToObjectApiNam
|
|
|
51979
52020
|
case Kind$1.LIST: {
|
|
51980
52021
|
filterNode.value.values.filter(isObjectValueNode).forEach((objectValueNode) => {
|
|
51981
52022
|
objectValueNode.fields.forEach((objectFieldNode) => {
|
|
51982
|
-
const subResults = injectFilter(objectFieldNode, idState,
|
|
52023
|
+
const subResults = injectFilter(objectFieldNode, idState, parentPath, isParentPolymorphic, objectInfos, pathToObjectApiNamesMap, draftFunctions, queryNode);
|
|
51983
52024
|
for (const subResult of subResults) {
|
|
51984
52025
|
mergeOrAddToGroup(injectedSelections, subResult);
|
|
51985
52026
|
}
|
|
@@ -51990,7 +52031,7 @@ function injectFilter(filterNode, idState, path, objectInfos, pathToObjectApiNam
|
|
|
51990
52031
|
case Kind$1.OBJECT: {
|
|
51991
52032
|
if (filterNode.name.value === 'not') {
|
|
51992
52033
|
filterNode.value.fields.forEach((objectFieldNode) => {
|
|
51993
|
-
const subResults = injectFilter(objectFieldNode, idState,
|
|
52034
|
+
const subResults = injectFilter(objectFieldNode, idState, parentPath, isParentPolymorphic, objectInfos, pathToObjectApiNamesMap, draftFunctions, queryNode);
|
|
51994
52035
|
for (const subResult of subResults) {
|
|
51995
52036
|
mergeOrAddToGroup(injectedSelections, subResult);
|
|
51996
52037
|
}
|
|
@@ -52000,15 +52041,15 @@ function injectFilter(filterNode, idState, path, objectInfos, pathToObjectApiNam
|
|
|
52000
52041
|
let apiNames = [];
|
|
52001
52042
|
let isScalarField = false;
|
|
52002
52043
|
//It is possible that this is a polymorphic field
|
|
52003
|
-
apiNames = pathToObjectApiNamesMap[
|
|
52004
|
-
// example: path: '
|
|
52044
|
+
apiNames = pathToObjectApiNamesMap[parentPath];
|
|
52045
|
+
// example: path: 'ServiceAppointment#LastModifiedDate'; filterNode: '{eq: {literal: LAST_WEEK}}'. queryNode: 'LastModifedDate { value}' FilterNode's parent has been verifed as a valid node
|
|
52005
52046
|
if (apiNames === undefined) {
|
|
52006
52047
|
isScalarField = true;
|
|
52007
52048
|
}
|
|
52008
52049
|
else {
|
|
52009
52050
|
if (apiNames.some((apiName) => objectInfos[apiName] === undefined)) {
|
|
52010
52051
|
// eslint-disable-next-line
|
|
52011
|
-
throw new Error(`ObjectInfo is missing for ${
|
|
52052
|
+
throw new Error(`ObjectInfo is missing for ${parentPath}`);
|
|
52012
52053
|
}
|
|
52013
52054
|
}
|
|
52014
52055
|
if (isScalarField) {
|
|
@@ -52032,21 +52073,17 @@ function injectFilter(filterNode, idState, path, objectInfos, pathToObjectApiNam
|
|
|
52032
52073
|
let isSpanning = false;
|
|
52033
52074
|
// if true, current node is a polymorphic concrete type node. For example, field node `User` under `Owner`
|
|
52034
52075
|
let isInlineFragment = false;
|
|
52035
|
-
let isPolymorphicField = false;
|
|
52036
52076
|
let isTypeNameExisting = false;
|
|
52037
52077
|
let curPath;
|
|
52038
52078
|
let fieldName = filterNode.name.value;
|
|
52039
|
-
curPath = `${
|
|
52079
|
+
curPath = `${parentPath}#${fieldName}`;
|
|
52040
52080
|
if (pathToObjectApiNamesMap[curPath] &&
|
|
52041
52081
|
pathToObjectApiNamesMap[curPath].length > 0) {
|
|
52042
52082
|
isSpanning = true;
|
|
52043
|
-
|
|
52044
|
-
|
|
52045
|
-
|
|
52046
|
-
|
|
52047
|
-
isInlineFragment = isPolymorphicFieldPath(path, pathToObjectApiNamesMap);
|
|
52048
|
-
}
|
|
52049
|
-
isPolymorphicField = isPolymorphicFieldPath(curPath, pathToObjectApiNamesMap);
|
|
52083
|
+
isInlineFragment =
|
|
52084
|
+
isParentPolymorphic &&
|
|
52085
|
+
pathToObjectApiNamesMap[curPath].length === 1;
|
|
52086
|
+
isPolymorphicField = isPolymorphicFieldPath(curPath, pathToObjectApiNamesMap, objectInfos);
|
|
52050
52087
|
}
|
|
52051
52088
|
// When filter node is at InLineFragment Level(a concrete entity of polymorphic field), query node is one level up. For example, ObjectFieldNode is ...{User:{...}}, queryNode is Owner:[User]
|
|
52052
52089
|
if (isInlineFragment) {
|
|
@@ -52092,7 +52129,7 @@ function injectFilter(filterNode, idState, path, objectInfos, pathToObjectApiNam
|
|
|
52092
52129
|
}
|
|
52093
52130
|
const objectInfoName = pathToObjectApiNamesMap[curPath] !== undefined
|
|
52094
52131
|
? pathToObjectApiNamesMap[curPath][0]
|
|
52095
|
-
: pathToObjectApiNamesMap[
|
|
52132
|
+
: pathToObjectApiNamesMap[parentPath][0];
|
|
52096
52133
|
const isIdField = isFieldAnIdField(filterNode.name.value, objectInfos[objectInfoName]);
|
|
52097
52134
|
if (!isIdField) {
|
|
52098
52135
|
let subSelectionNodes = [];
|
|
@@ -52104,7 +52141,7 @@ function injectFilter(filterNode, idState, path, objectInfos, pathToObjectApiNam
|
|
|
52104
52141
|
updateIDInfo(subFieldNode, idState, draftFunctions);
|
|
52105
52142
|
}
|
|
52106
52143
|
// try injecting the fields within predicate no matter it has relation or not.
|
|
52107
|
-
let subResults = injectFilter(subFieldNode, idState, curPath, objectInfos, pathToObjectApiNamesMap, draftFunctions, existingFields ? existingFields[0] : undefined);
|
|
52144
|
+
let subResults = injectFilter(subFieldNode, idState, curPath, isPolymorphicField, objectInfos, pathToObjectApiNamesMap, draftFunctions, existingFields ? existingFields[0] : undefined);
|
|
52108
52145
|
subSelectionNodes = subSelectionNodes.concat(subResults);
|
|
52109
52146
|
});
|
|
52110
52147
|
if (!subFieldsHasId) {
|
|
@@ -52265,15 +52302,43 @@ function mergeOrAddToGroup(group, element) {
|
|
|
52265
52302
|
}
|
|
52266
52303
|
group.push(element);
|
|
52267
52304
|
}
|
|
52268
|
-
// checks if the path points to a polymorphic field.
|
|
52269
|
-
//
|
|
52270
|
-
//
|
|
52271
|
-
|
|
52272
|
-
|
|
52273
|
-
|
|
52274
|
-
|
|
52275
|
-
|
|
52276
|
-
|
|
52305
|
+
// checks if the path points to a polymorphic field. For example, for the below `pathToObjectApiNamesMap`
|
|
52306
|
+
// {
|
|
52307
|
+
// 'ServiceAppointment' -> ['ServiceAppointment']
|
|
52308
|
+
// 'ServiceAppointment#Owner' --> ['User'],
|
|
52309
|
+
// 'ServiceAppointment#Owner#User' --> ['User']
|
|
52310
|
+
// }
|
|
52311
|
+
// path `ServiceAppointment#Owner` points to a polymorphic field, but path `ServiceAppointment#Owner#User` does not.
|
|
52312
|
+
function isPolymorphicFieldPath(path, pathToObjectApiNamesMap, objectInfos) {
|
|
52313
|
+
const lastSegmentIndex = path.lastIndexOf('#');
|
|
52314
|
+
if (lastSegmentIndex < 0) {
|
|
52315
|
+
return false;
|
|
52316
|
+
}
|
|
52317
|
+
const lastSegment = path.slice(lastSegmentIndex + 1);
|
|
52318
|
+
const parentApiPath = path.slice(0, lastSegmentIndex);
|
|
52319
|
+
if (pathToObjectApiNamesMap[parentApiPath] === undefined) {
|
|
52320
|
+
return false;
|
|
52321
|
+
}
|
|
52322
|
+
const parentObjectApiNames = pathToObjectApiNamesMap[parentApiPath];
|
|
52323
|
+
// If the last segment is a Polymorphic field, its immediate parent is a concrete object entity, which has 1 objectApiName mapped to the parent path in `pathToObjectApiNamesMap`.
|
|
52324
|
+
// For example, we like to check if `ServiceAppointment#Owner` path is polymorphic. The last segment is `Owner` and its parent `ServiceAppointment` has one element (which is also `ServiceAppointment`) array as its value.
|
|
52325
|
+
// Below are the entries in `pathToObjectApiNamesMap`
|
|
52326
|
+
// {
|
|
52327
|
+
// `ServiceAppointmen`t: [`ServiceAppointment`],
|
|
52328
|
+
// `ServiceAppointment#Owner`: [`User`, `Group`],
|
|
52329
|
+
// `ServiceAppointment#Owner#User`: [`User`],
|
|
52330
|
+
// `ServiceAppointment#Owner#Group`: [`Group`],
|
|
52331
|
+
// }
|
|
52332
|
+
if (parentObjectApiNames.length !== 1) {
|
|
52333
|
+
return false;
|
|
52334
|
+
}
|
|
52335
|
+
const parentObjectInfo = objectInfos[parentObjectApiNames[0]];
|
|
52336
|
+
const relationshipField = referenceIdFieldForRelationship(lastSegment);
|
|
52337
|
+
let fieldDefinition = parentObjectInfo.fields[relationshipField];
|
|
52338
|
+
if (fieldDefinition === undefined) {
|
|
52339
|
+
return false;
|
|
52340
|
+
}
|
|
52341
|
+
return fieldDefinition.polymorphicForeignKey;
|
|
52277
52342
|
}
|
|
52278
52343
|
function isFieldAnIdField(fieldName, objectInfo) {
|
|
52279
52344
|
if (fieldName === 'Id')
|
|
@@ -52327,10 +52392,10 @@ function updateIDInfo(fieldNode, idState, draftFunctions) {
|
|
|
52327
52392
|
* @param parentNode parent node of param 1
|
|
52328
52393
|
* @param ancestors ancester of param 1
|
|
52329
52394
|
* @param objectInfos ObjectInfo map used in injection. If ObjectInfo misses or field does not exist in ObjectInfo, the error will be thrown
|
|
52330
|
-
* @param pathToObjectApiNamesMap map used to locate the ObjectInfo. The key is path to a field, value is the ObjectInfo's apiName array. In the case of polymorphic fields, the apiName array have 2 or more elements. For example, 'ServiceAppointment' -> ['ServiceAppointment']; '
|
|
52395
|
+
* @param pathToObjectApiNamesMap map used to locate the ObjectInfo. The key is path to a field, value is the ObjectInfo's apiName array. In the case of polymorphic fields, the apiName array have 2 or more elements. For example, 'ServiceAppointment' -> ['ServiceAppointment']; 'ServiceAppointment#Account' -> ['Account'], 'ServiceAppointment#Owner' -> ['User', 'Group'].
|
|
52331
52396
|
* @return injected SelectionNodes used to construct the InlineFragment.
|
|
52332
52397
|
*/
|
|
52333
|
-
function injectFields(selections, parentNode, ancestors, objectInfos, pathToObjectApiNamesMap) {
|
|
52398
|
+
function injectFields(selections, parentNode, parentPath, ancestors, objectInfos, pathToObjectApiNamesMap) {
|
|
52334
52399
|
/**
|
|
52335
52400
|
* 1 parentship can return 2 FieldNode which need to be flattened
|
|
52336
52401
|
* Concact: { ** Contact { ** ContactId {
|
|
@@ -52348,6 +52413,10 @@ function injectFields(selections, parentNode, ancestors, objectInfos, pathToObje
|
|
|
52348
52413
|
if (!selection.selectionSet) {
|
|
52349
52414
|
return selection;
|
|
52350
52415
|
}
|
|
52416
|
+
const segment = isFieldNode(selection)
|
|
52417
|
+
? selection.name.value
|
|
52418
|
+
: selection.typeCondition.name.value;
|
|
52419
|
+
const curPath = `${parentPath}#${segment}`;
|
|
52351
52420
|
const spanningSubSelections = [];
|
|
52352
52421
|
for (const subSelection of selection.selectionSet.selections) {
|
|
52353
52422
|
if (isFieldSpanning(subSelection, selection)) {
|
|
@@ -52355,7 +52424,7 @@ function injectFields(selections, parentNode, ancestors, objectInfos, pathToObje
|
|
|
52355
52424
|
}
|
|
52356
52425
|
}
|
|
52357
52426
|
// Handles multiple level field injection like 'ServiceAppointment' --> 'Account' --> 'Owner'
|
|
52358
|
-
const subInjectedSelections = injectFields(spanningSubSelections, selection, ancestors, objectInfos, pathToObjectApiNamesMap);
|
|
52427
|
+
const subInjectedSelections = injectFields(spanningSubSelections, selection, curPath, ancestors, objectInfos, pathToObjectApiNamesMap);
|
|
52359
52428
|
if (!selection.selectionSet) {
|
|
52360
52429
|
return selection;
|
|
52361
52430
|
}
|
|
@@ -52398,7 +52467,7 @@ function injectFields(selections, parentNode, ancestors, objectInfos, pathToObje
|
|
|
52398
52467
|
}
|
|
52399
52468
|
}
|
|
52400
52469
|
// For polymorphic fields, the Id field is excluded.
|
|
52401
|
-
const excludeId =
|
|
52470
|
+
const excludeId = isPolymorphicFieldPath(curPath, pathToObjectApiNamesMap, objectInfos);
|
|
52402
52471
|
const idSelection = [];
|
|
52403
52472
|
if (!excludeId && !hasIdAlready) {
|
|
52404
52473
|
idSelection.push({
|
|
@@ -52409,8 +52478,8 @@ function injectFields(selections, parentNode, ancestors, objectInfos, pathToObje
|
|
|
52409
52478
|
},
|
|
52410
52479
|
});
|
|
52411
52480
|
}
|
|
52412
|
-
// Inject '__typename' for
|
|
52413
|
-
// please reference 'removeSyntheticFields'.
|
|
52481
|
+
// Inject '__typename' for InlineFragment. '__typename' field acts as a reference to concrete type of a polymorphic field or a standard field in the returned GQL response, which equals to
|
|
52482
|
+
// `typedCondition` of the InlineFragment in the query AST. It is used to match JSON response with AST node. For more detail, please reference 'removeSyntheticFields'.
|
|
52414
52483
|
if (isInlineFragmentNode(selection) &&
|
|
52415
52484
|
!selection.selectionSet.selections.find((selection) => isFieldNode(selection) && selection.name.value === '__typename')) {
|
|
52416
52485
|
idSelection.push({
|
|
@@ -52444,7 +52513,7 @@ function injectFields(selections, parentNode, ancestors, objectInfos, pathToObje
|
|
|
52444
52513
|
if (isFieldNode(parentNode) && parentNode.selectionSet && parentNode.name.value === 'node') {
|
|
52445
52514
|
if (parentNode.selectionSet.selections
|
|
52446
52515
|
.filter(isFieldOrInlineFragmentNode)
|
|
52447
|
-
.some((selectionNode) => isRelationship(selectionNode,
|
|
52516
|
+
.some((selectionNode) => isRelationship(selectionNode, CHILD_RELATIONSHIP))) {
|
|
52448
52517
|
if (!parentNode.selectionSet.selections
|
|
52449
52518
|
.filter(isFieldNode)
|
|
52450
52519
|
.some((sibling) => sibling.name.value === 'Id')) {
|
|
@@ -52463,7 +52532,7 @@ function injectFields(selections, parentNode, ancestors, objectInfos, pathToObje
|
|
|
52463
52532
|
if (parentInfo.parentIndex >= 0) {
|
|
52464
52533
|
// example node { TimeSheetEntries { edges { node { Id }}}}
|
|
52465
52534
|
const parent = parentInfo.node;
|
|
52466
|
-
if (isRelationship(parent,
|
|
52535
|
+
if (isRelationship(parent, CHILD_RELATIONSHIP)) {
|
|
52467
52536
|
const unVisitedAncestors = ancestors.slice(0, parentInfo.parentIndex);
|
|
52468
52537
|
// path : "TimeSheet"
|
|
52469
52538
|
const grandParentPath = findAncesterPath(unVisitedAncestors);
|
|
@@ -52592,7 +52661,7 @@ const assignedToMeFragmentSelections = [
|
|
|
52592
52661
|
},
|
|
52593
52662
|
value: {
|
|
52594
52663
|
kind: 'StringValue',
|
|
52595
|
-
value:
|
|
52664
|
+
value: CHILD_RELATIONSHIP,
|
|
52596
52665
|
block: false,
|
|
52597
52666
|
},
|
|
52598
52667
|
},
|
|
@@ -52684,7 +52753,7 @@ const assignedToMeFragmentSelections = [
|
|
|
52684
52753
|
},
|
|
52685
52754
|
value: {
|
|
52686
52755
|
kind: 'StringValue',
|
|
52687
|
-
value:
|
|
52756
|
+
value: PARENT_RELATIONSHIP,
|
|
52688
52757
|
block: false,
|
|
52689
52758
|
},
|
|
52690
52759
|
},
|
|
@@ -52821,7 +52890,9 @@ function handleNonArrayJsonProperty(selection, fieldName, jsonInput, jsonOutput)
|
|
|
52821
52890
|
jsonOutput[fieldName] = null;
|
|
52822
52891
|
return;
|
|
52823
52892
|
}
|
|
52824
|
-
jsonOutput[fieldName]
|
|
52893
|
+
if (jsonOutput[fieldName] === undefined) {
|
|
52894
|
+
jsonOutput[fieldName] = {};
|
|
52895
|
+
}
|
|
52825
52896
|
createUserJsonOutput(selection, jsonInput[fieldName], jsonOutput[fieldName]);
|
|
52826
52897
|
}
|
|
52827
52898
|
else {
|
|
@@ -58711,7 +58782,7 @@ register$1({
|
|
|
58711
58782
|
id: '@salesforce/lds-network-adapter',
|
|
58712
58783
|
instrument: instrument$2,
|
|
58713
58784
|
});
|
|
58714
|
-
// version: 1.242.
|
|
58785
|
+
// version: 1.242.1-58f8f4bb1
|
|
58715
58786
|
|
|
58716
58787
|
const { create: create$3, keys: keys$3 } = Object;
|
|
58717
58788
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -77179,7 +77250,7 @@ register$1({
|
|
|
77179
77250
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
77180
77251
|
instrument: instrument$1,
|
|
77181
77252
|
});
|
|
77182
|
-
// version: 1.242.
|
|
77253
|
+
// version: 1.242.1-5a8ee3f4c
|
|
77183
77254
|
|
|
77184
77255
|
// On core the unstable adapters are re-exported with different names,
|
|
77185
77256
|
// we want to match them here.
|
|
@@ -79428,7 +79499,7 @@ withDefaultLuvio((luvio) => {
|
|
|
79428
79499
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
79429
79500
|
graphQLImperative = ldsAdapter;
|
|
79430
79501
|
});
|
|
79431
|
-
// version: 1.242.
|
|
79502
|
+
// version: 1.242.1-5a8ee3f4c
|
|
79432
79503
|
|
|
79433
79504
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
79434
79505
|
__proto__: null,
|
|
@@ -80126,7 +80197,7 @@ const callbacks$1 = [];
|
|
|
80126
80197
|
function register(r) {
|
|
80127
80198
|
callbacks$1.forEach((callback) => callback(r));
|
|
80128
80199
|
}
|
|
80129
|
-
// version: 1.242.
|
|
80200
|
+
// version: 1.242.1-58f8f4bb1
|
|
80130
80201
|
|
|
80131
80202
|
/**
|
|
80132
80203
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -84772,4 +84843,4 @@ const { luvio } = getRuntime();
|
|
|
84772
84843
|
setDefaultLuvio({ luvio });
|
|
84773
84844
|
|
|
84774
84845
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
84775
|
-
// version: 1.242.
|
|
84846
|
+
// version: 1.242.1-58f8f4bb1
|