@salesforce/lds-worker-api 1.377.1 → 1.378.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4280,7 +4280,7 @@
|
|
|
4280
4280
|
}
|
|
4281
4281
|
callbacks.push(callback);
|
|
4282
4282
|
}
|
|
4283
|
-
// version: 1.
|
|
4283
|
+
// version: 1.378.0-0ab3d40d29
|
|
4284
4284
|
|
|
4285
4285
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4286
4286
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5324,7 +5324,7 @@
|
|
|
5324
5324
|
const { apiFamily, name } = metadata;
|
|
5325
5325
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5326
5326
|
}
|
|
5327
|
-
// version: 1.
|
|
5327
|
+
// version: 1.378.0-0ab3d40d29
|
|
5328
5328
|
|
|
5329
5329
|
/**
|
|
5330
5330
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -34160,7 +34160,7 @@
|
|
|
34160
34160
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
34161
34161
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
34162
34162
|
});
|
|
34163
|
-
// version: 1.
|
|
34163
|
+
// version: 1.378.0-63d7c07562
|
|
34164
34164
|
|
|
34165
34165
|
function requestIdleDetectedCallback(_callback) { }
|
|
34166
34166
|
function declareNotifierTaskSingle(_name) {
|
|
@@ -87035,9 +87035,9 @@
|
|
|
87035
87035
|
}
|
|
87036
87036
|
// spanning field needs to have the directive with 'parentRelationship'
|
|
87037
87037
|
const directives = isSpanning && !isInlineFragment ? [parentRelationshipDirective] : [];
|
|
87038
|
-
let idField = isSpanning && !isPolymorphicField ? [createFieldNode
|
|
87038
|
+
let idField = isSpanning && !isPolymorphicField ? [createFieldNode('Id')] : [];
|
|
87039
87039
|
// This variable change to InlineFragment if 'isInlineFragment' is true
|
|
87040
|
-
let sel = createFieldNode
|
|
87040
|
+
let sel = createFieldNode(fieldName);
|
|
87041
87041
|
// Check if fields is valid
|
|
87042
87042
|
if (apiNames.length === 1 && !isInlineFragment) {
|
|
87043
87043
|
const objectInfo = objectInfos[apiNames[0]];
|
|
@@ -87083,7 +87083,7 @@
|
|
|
87083
87083
|
idField = [];
|
|
87084
87084
|
}
|
|
87085
87085
|
if (isInlineFragment && !isTypeNameExisting) {
|
|
87086
|
-
idField.push(createFieldNode
|
|
87086
|
+
idField.push(createFieldNode('__typename'));
|
|
87087
87087
|
}
|
|
87088
87088
|
//Inject Conditions: 1. Same field does not exist 2. Same fields has different children. 3. Filter spanning field does not have Id. 4. InLineFragment does not have the '__typename' field
|
|
87089
87089
|
if (!existingFields ||
|
|
@@ -87150,7 +87150,7 @@
|
|
|
87150
87150
|
.filter(isFieldNode)
|
|
87151
87151
|
.filter((subNode) => subNode.name.value === relationField);
|
|
87152
87152
|
if (!existingRelationFields || existingRelationFields.length === 0) {
|
|
87153
|
-
injectedSelections.push(createFieldNode
|
|
87153
|
+
injectedSelections.push(createFieldNode(relationField, FieldValueNodeSelectionSet));
|
|
87154
87154
|
}
|
|
87155
87155
|
}
|
|
87156
87156
|
}
|
|
@@ -87241,7 +87241,7 @@
|
|
|
87241
87241
|
.filter(isFieldNode)
|
|
87242
87242
|
.filter((subNode) => subNode.name.value === 'value');
|
|
87243
87243
|
return !existingValueFields || existingValueFields.length === 0
|
|
87244
|
-
? [createFieldNode
|
|
87244
|
+
? [createFieldNode('value')]
|
|
87245
87245
|
: [];
|
|
87246
87246
|
}
|
|
87247
87247
|
function updateIDInfo(fieldNode, idState, draftFunctions) {
|
|
@@ -87322,20 +87322,20 @@
|
|
|
87322
87322
|
.filter(isFieldNode)
|
|
87323
87323
|
.filter((subNode) => subNode.name.value === relationshipId);
|
|
87324
87324
|
if (existingRelationFields.length === 0) {
|
|
87325
|
-
parentInjectedNodes.push(createFieldNode
|
|
87325
|
+
parentInjectedNodes.push(createFieldNode(relationshipId, FieldValueNodeSelectionSet));
|
|
87326
87326
|
}
|
|
87327
87327
|
}
|
|
87328
87328
|
// For polymorphic fields, the Id field is excluded.
|
|
87329
87329
|
const excludeId = isPolymorphicFieldPath(curPath, pathToObjectApiNamesMap, objectInfos);
|
|
87330
87330
|
const idSelection = [];
|
|
87331
87331
|
if (!excludeId && hasIdNode === false) {
|
|
87332
|
-
idSelection.push(createFieldNode
|
|
87332
|
+
idSelection.push(createFieldNode('Id'));
|
|
87333
87333
|
}
|
|
87334
87334
|
// 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
|
|
87335
87335
|
// `typedCondition` of the InlineFragment in the query AST. It is used to match JSON response with AST node. For more detail, please reference 'removeSyntheticFields'.
|
|
87336
87336
|
if (isInlineFragmentNode(selection) &&
|
|
87337
87337
|
!selection.selectionSet.selections.find((selection) => isFieldNode(selection) && selection.name.value === '__typename')) {
|
|
87338
|
-
idSelection.push(createFieldNode
|
|
87338
|
+
idSelection.push(createFieldNode('__typename'));
|
|
87339
87339
|
}
|
|
87340
87340
|
// 'ServiceAppointment' --> 'Contact' --> 'Id', Inject 'Contact' with Id. 'Id' field is at the sub level.
|
|
87341
87341
|
if (idSelection.length > 0 || subInjectedSelections.length > 0) {
|
|
@@ -87379,7 +87379,7 @@
|
|
|
87379
87379
|
objectInfo.nameFields !== undefined &&
|
|
87380
87380
|
objectInfo.nameFields.length > 0) {
|
|
87381
87381
|
displayValueNameFields = objectInfo.nameFields.map((fieldName) => {
|
|
87382
|
-
return createFieldNode
|
|
87382
|
+
return createFieldNode(fieldName, FieldValueNodeSelectionSet);
|
|
87383
87383
|
});
|
|
87384
87384
|
}
|
|
87385
87385
|
}
|
|
@@ -87410,7 +87410,7 @@
|
|
|
87410
87410
|
if (parentNode.name.value === 'node') {
|
|
87411
87411
|
const idNode = findIdFieldNode(parentNode);
|
|
87412
87412
|
if (idNode === false) {
|
|
87413
|
-
rootQueryIdField.push(createFieldNode
|
|
87413
|
+
rootQueryIdField.push(createFieldNode('Id'));
|
|
87414
87414
|
}
|
|
87415
87415
|
}
|
|
87416
87416
|
// example { node { Id } }. The operation happens at the 'edges' -> 'node' level of the 'childRelationship' field
|
|
@@ -87438,7 +87438,7 @@
|
|
|
87438
87438
|
.filter(isFieldNode)
|
|
87439
87439
|
.some((sibling) => sibling.name.value === injectedParentFieldName)) {
|
|
87440
87440
|
// example: TimeSheetId { value }
|
|
87441
|
-
relatedIdForChildRelationship.push(createFieldNode
|
|
87441
|
+
relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
|
|
87442
87442
|
}
|
|
87443
87443
|
displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, targetRelationship.childObjectApiName, objectInfos));
|
|
87444
87444
|
}
|
|
@@ -87890,7 +87890,7 @@
|
|
|
87890
87890
|
* @param selectionSet
|
|
87891
87891
|
* @returns
|
|
87892
87892
|
*/
|
|
87893
|
-
function createFieldNode
|
|
87893
|
+
function createFieldNode(nameValue, selectionSet) {
|
|
87894
87894
|
return {
|
|
87895
87895
|
kind: Kind$3.FIELD,
|
|
87896
87896
|
name: {
|
|
@@ -95887,7 +95887,7 @@
|
|
|
95887
95887
|
},
|
|
95888
95888
|
};
|
|
95889
95889
|
}
|
|
95890
|
-
// version: 1.
|
|
95890
|
+
// version: 1.378.0-63d7c07562
|
|
95891
95891
|
|
|
95892
95892
|
/**
|
|
95893
95893
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -95913,7 +95913,7 @@
|
|
|
95913
95913
|
},
|
|
95914
95914
|
};
|
|
95915
95915
|
}
|
|
95916
|
-
// version: 1.
|
|
95916
|
+
// version: 1.378.0-63d7c07562
|
|
95917
95917
|
|
|
95918
95918
|
/*!
|
|
95919
95919
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -98029,7 +98029,7 @@
|
|
|
98029
98029
|
id: '@salesforce/lds-network-adapter',
|
|
98030
98030
|
instrument: instrument$2,
|
|
98031
98031
|
});
|
|
98032
|
-
// version: 1.
|
|
98032
|
+
// version: 1.378.0-0ab3d40d29
|
|
98033
98033
|
|
|
98034
98034
|
const { create: create$3, keys: keys$3 } = Object;
|
|
98035
98035
|
const { stringify: stringify$1, parse } = JSON;
|
|
@@ -98893,11 +98893,7 @@
|
|
|
98893
98893
|
if (variable.definition.defaultValue) {
|
|
98894
98894
|
return extractValue(variable.definition.defaultValue, variableDefinitions);
|
|
98895
98895
|
}
|
|
98896
|
-
return
|
|
98897
|
-
new Error(
|
|
98898
|
-
`Variable '${variableName}' was defined but no value was provided and no default value exists`
|
|
98899
|
-
)
|
|
98900
|
-
);
|
|
98896
|
+
return ok$4(void 0);
|
|
98901
98897
|
}
|
|
98902
98898
|
function validateExpectedType(value, expectedType) {
|
|
98903
98899
|
if (!expectedType) {
|
|
@@ -99107,6 +99103,243 @@
|
|
|
99107
99103
|
}
|
|
99108
99104
|
return ok$4(false);
|
|
99109
99105
|
}
|
|
99106
|
+
class BaseScalarFieldDef {
|
|
99107
|
+
constructor(nullable) {
|
|
99108
|
+
this.nullable = nullable;
|
|
99109
|
+
}
|
|
99110
|
+
write(_cache, input) {
|
|
99111
|
+
if (input.data === void 0) {
|
|
99112
|
+
return ok$4({ type: "missing" });
|
|
99113
|
+
}
|
|
99114
|
+
if (input.data === null) {
|
|
99115
|
+
if (!this.nullable) {
|
|
99116
|
+
return err$4([
|
|
99117
|
+
{
|
|
99118
|
+
type: "unknown",
|
|
99119
|
+
error: new Error(
|
|
99120
|
+
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
99121
|
+
)
|
|
99122
|
+
}
|
|
99123
|
+
]);
|
|
99124
|
+
}
|
|
99125
|
+
}
|
|
99126
|
+
return ok$4({ type: "data", data: input.data });
|
|
99127
|
+
}
|
|
99128
|
+
read(_cache, input) {
|
|
99129
|
+
const normalizedData = input.normalizedData;
|
|
99130
|
+
if (normalizedData.type === "missing") {
|
|
99131
|
+
return ok$4(void 0);
|
|
99132
|
+
}
|
|
99133
|
+
return ok$4(normalizedData.data);
|
|
99134
|
+
}
|
|
99135
|
+
augmentSelections(input) {
|
|
99136
|
+
return input;
|
|
99137
|
+
}
|
|
99138
|
+
buildFieldKey(selection, variables) {
|
|
99139
|
+
return buildFieldKey(selection.name.value, selection.arguments, variables);
|
|
99140
|
+
}
|
|
99141
|
+
}
|
|
99142
|
+
class BaseArrayFieldDef {
|
|
99143
|
+
constructor(items, nullable) {
|
|
99144
|
+
this.items = items;
|
|
99145
|
+
this.nullable = nullable;
|
|
99146
|
+
}
|
|
99147
|
+
augmentSelections(input) {
|
|
99148
|
+
return this.items.augmentSelections(input);
|
|
99149
|
+
}
|
|
99150
|
+
buildFieldKey(selection, variables) {
|
|
99151
|
+
return this.items.buildFieldKey(selection, variables);
|
|
99152
|
+
}
|
|
99153
|
+
write(cache, input) {
|
|
99154
|
+
if (input.data === void 0) {
|
|
99155
|
+
return ok$4({ type: "missing" });
|
|
99156
|
+
}
|
|
99157
|
+
if (input.data === null) {
|
|
99158
|
+
if (!this.nullable) {
|
|
99159
|
+
return err$4([
|
|
99160
|
+
{
|
|
99161
|
+
type: "unknown",
|
|
99162
|
+
error: new Error(
|
|
99163
|
+
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
99164
|
+
)
|
|
99165
|
+
}
|
|
99166
|
+
]);
|
|
99167
|
+
}
|
|
99168
|
+
return ok$4({ type: "data", data: input.data });
|
|
99169
|
+
}
|
|
99170
|
+
if (!Array.isArray(input.data)) {
|
|
99171
|
+
return err$4([
|
|
99172
|
+
{
|
|
99173
|
+
type: "unknown",
|
|
99174
|
+
error: new Error(
|
|
99175
|
+
`Got a non array value for array field "${input.selection.name.value}"`
|
|
99176
|
+
)
|
|
99177
|
+
}
|
|
99178
|
+
]);
|
|
99179
|
+
}
|
|
99180
|
+
const arrayNormalizationErrors = [];
|
|
99181
|
+
const normalizedArray = [];
|
|
99182
|
+
input.data.forEach((item, index) => {
|
|
99183
|
+
var _a;
|
|
99184
|
+
const existingItemData = (_a = input.existingNormalizedData) == null ? void 0 : _a[index];
|
|
99185
|
+
const normalizedItemResult = this.items.write(cache, {
|
|
99186
|
+
...input,
|
|
99187
|
+
data: item,
|
|
99188
|
+
existingNormalizedData: existingItemData,
|
|
99189
|
+
request: input.request,
|
|
99190
|
+
selection: input.selection
|
|
99191
|
+
});
|
|
99192
|
+
if (normalizedItemResult.isOk()) {
|
|
99193
|
+
normalizedArray.push(normalizedItemResult.value);
|
|
99194
|
+
} else {
|
|
99195
|
+
arrayNormalizationErrors.push(...normalizedItemResult.error);
|
|
99196
|
+
}
|
|
99197
|
+
});
|
|
99198
|
+
if (arrayNormalizationErrors.length > 0) {
|
|
99199
|
+
return err$4(arrayNormalizationErrors);
|
|
99200
|
+
}
|
|
99201
|
+
return ok$4({ type: "data", data: normalizedArray });
|
|
99202
|
+
}
|
|
99203
|
+
read(cache, input) {
|
|
99204
|
+
const normalizedData = input.normalizedData;
|
|
99205
|
+
if (normalizedData.type === "missing") {
|
|
99206
|
+
return ok$4(void 0);
|
|
99207
|
+
}
|
|
99208
|
+
if (normalizedData.data === null) {
|
|
99209
|
+
if (!this.nullable) {
|
|
99210
|
+
return err$4([
|
|
99211
|
+
{
|
|
99212
|
+
type: "unknown",
|
|
99213
|
+
error: new Error(
|
|
99214
|
+
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
99215
|
+
)
|
|
99216
|
+
}
|
|
99217
|
+
]);
|
|
99218
|
+
}
|
|
99219
|
+
return ok$4({ type: "data", data: null });
|
|
99220
|
+
}
|
|
99221
|
+
if (!Array.isArray(normalizedData.data)) {
|
|
99222
|
+
return err$4([
|
|
99223
|
+
{
|
|
99224
|
+
type: "unknown",
|
|
99225
|
+
error: new Error(
|
|
99226
|
+
`Got a non array value for array field "${input.selection.name.value}"`
|
|
99227
|
+
)
|
|
99228
|
+
}
|
|
99229
|
+
]);
|
|
99230
|
+
}
|
|
99231
|
+
const arrayDenormalizationErrors = [];
|
|
99232
|
+
const denormalizedArray = [];
|
|
99233
|
+
normalizedData.data.forEach((item) => {
|
|
99234
|
+
const denormalizedItemResult = this.items.read(cache, {
|
|
99235
|
+
...input,
|
|
99236
|
+
normalizedData: item,
|
|
99237
|
+
request: input.request,
|
|
99238
|
+
selection: input.selection
|
|
99239
|
+
});
|
|
99240
|
+
if (denormalizedItemResult.isOk()) {
|
|
99241
|
+
denormalizedArray.push(denormalizedItemResult.value);
|
|
99242
|
+
} else {
|
|
99243
|
+
arrayDenormalizationErrors.push(...denormalizedItemResult.error);
|
|
99244
|
+
}
|
|
99245
|
+
});
|
|
99246
|
+
if (arrayDenormalizationErrors.length > 0) {
|
|
99247
|
+
return err$4(arrayDenormalizationErrors);
|
|
99248
|
+
}
|
|
99249
|
+
return ok$4(denormalizedArray);
|
|
99250
|
+
}
|
|
99251
|
+
}
|
|
99252
|
+
class BaseObjectFieldDef {
|
|
99253
|
+
constructor(repository, nullable) {
|
|
99254
|
+
this.repository = repository;
|
|
99255
|
+
this.nullable = nullable;
|
|
99256
|
+
}
|
|
99257
|
+
augmentSelections(input) {
|
|
99258
|
+
return this.repository.augmentSelections(input);
|
|
99259
|
+
}
|
|
99260
|
+
buildFieldKey(selection, variables) {
|
|
99261
|
+
return this.repository.buildFieldKey(selection, variables);
|
|
99262
|
+
}
|
|
99263
|
+
write(cache, input) {
|
|
99264
|
+
var _a;
|
|
99265
|
+
if (!input.selection.selectionSet) {
|
|
99266
|
+
return err$4([
|
|
99267
|
+
{
|
|
99268
|
+
type: "unknown",
|
|
99269
|
+
error: new Error(
|
|
99270
|
+
`Selection set required for object type found on field "${input.selection.name.value}" in type ${this.repository.typeName}`
|
|
99271
|
+
)
|
|
99272
|
+
}
|
|
99273
|
+
]);
|
|
99274
|
+
}
|
|
99275
|
+
if (input.data === void 0) {
|
|
99276
|
+
return ok$4({ type: "missing" });
|
|
99277
|
+
}
|
|
99278
|
+
if (input.data === null) {
|
|
99279
|
+
if (!this.nullable) {
|
|
99280
|
+
return err$4([
|
|
99281
|
+
{
|
|
99282
|
+
type: "unknown",
|
|
99283
|
+
error: new Error(
|
|
99284
|
+
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
99285
|
+
)
|
|
99286
|
+
}
|
|
99287
|
+
]);
|
|
99288
|
+
}
|
|
99289
|
+
return ok$4({ type: "data", data: null });
|
|
99290
|
+
}
|
|
99291
|
+
const writeResult = this.repository.write(cache, {
|
|
99292
|
+
...input,
|
|
99293
|
+
data: input.data,
|
|
99294
|
+
existingNormalizedData: (_a = input.existingNormalizedData) == null ? void 0 : _a.data,
|
|
99295
|
+
request: input.request,
|
|
99296
|
+
selections: input.selection.selectionSet.selections,
|
|
99297
|
+
parentFieldSelection: input.selection
|
|
99298
|
+
});
|
|
99299
|
+
if (writeResult.isErr()) {
|
|
99300
|
+
return writeResult;
|
|
99301
|
+
}
|
|
99302
|
+
return ok$4({ type: "data", data: writeResult.value });
|
|
99303
|
+
}
|
|
99304
|
+
read(cache, input) {
|
|
99305
|
+
var _a;
|
|
99306
|
+
if (!input.selection.selectionSet) {
|
|
99307
|
+
return err$4([
|
|
99308
|
+
{
|
|
99309
|
+
type: "unknown",
|
|
99310
|
+
error: new Error(
|
|
99311
|
+
`Selection set required for object type found on field "${input.selection.name.value}" in type ${this.repository.typeName}`
|
|
99312
|
+
)
|
|
99313
|
+
}
|
|
99314
|
+
]);
|
|
99315
|
+
}
|
|
99316
|
+
const normalizedData = input.normalizedData;
|
|
99317
|
+
if (normalizedData.type === "missing") {
|
|
99318
|
+
return ok$4(void 0);
|
|
99319
|
+
}
|
|
99320
|
+
if (normalizedData.data === null) {
|
|
99321
|
+
if (!this.nullable) {
|
|
99322
|
+
return err$4([
|
|
99323
|
+
{
|
|
99324
|
+
type: "unknown",
|
|
99325
|
+
error: new Error(
|
|
99326
|
+
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
99327
|
+
)
|
|
99328
|
+
}
|
|
99329
|
+
]);
|
|
99330
|
+
}
|
|
99331
|
+
return ok$4(null);
|
|
99332
|
+
}
|
|
99333
|
+
return this.repository.read(cache, {
|
|
99334
|
+
...input,
|
|
99335
|
+
normalizedData: normalizedData.data,
|
|
99336
|
+
request: input.request,
|
|
99337
|
+
selections: (_a = input.selection.selectionSet) == null ? void 0 : _a.selections,
|
|
99338
|
+
parentFieldSelection: input.selection
|
|
99339
|
+
});
|
|
99340
|
+
}
|
|
99341
|
+
}
|
|
99342
|
+
const missingFieldDef = new BaseScalarFieldDef(false);
|
|
99110
99343
|
class BaseGraphQLTypeRepository {
|
|
99111
99344
|
equals(x, y) {
|
|
99112
99345
|
return deepEquals$2(x, y);
|
|
@@ -99471,9 +99704,23 @@
|
|
|
99471
99704
|
}
|
|
99472
99705
|
return {};
|
|
99473
99706
|
}
|
|
99474
|
-
getFieldDef(
|
|
99707
|
+
getFieldDef(input, selection) {
|
|
99708
|
+
var _a, _b, _c;
|
|
99475
99709
|
const canonicalFieldName = selection.name.value;
|
|
99476
|
-
|
|
99710
|
+
const fieldDef = this.fields[canonicalFieldName];
|
|
99711
|
+
if (fieldDef) {
|
|
99712
|
+
return fieldDef;
|
|
99713
|
+
}
|
|
99714
|
+
const dataInstanceFieldName = ((_a = selection.alias) == null ? void 0 : _a.value) ?? selection.name.value;
|
|
99715
|
+
if (input === void 0) {
|
|
99716
|
+
return void 0;
|
|
99717
|
+
}
|
|
99718
|
+
if ("data" in input && input.data[dataInstanceFieldName] === void 0) {
|
|
99719
|
+
return missingFieldDef;
|
|
99720
|
+
} else if ("normalizedData" in input && ((_c = (_b = input.normalizedData) == null ? void 0 : _b[dataInstanceFieldName]) == null ? void 0 : _c.type) === "missing") {
|
|
99721
|
+
return missingFieldDef;
|
|
99722
|
+
}
|
|
99723
|
+
return void 0;
|
|
99477
99724
|
}
|
|
99478
99725
|
shouldProcessFragment(fragment, variables) {
|
|
99479
99726
|
const shouldSkipResult = shouldSkip(fragment, variables);
|
|
@@ -99855,245 +100102,6 @@
|
|
|
99855
100102
|
});
|
|
99856
100103
|
return { selections: augmentedSelections, fragments: augmentedFragments };
|
|
99857
100104
|
}
|
|
99858
|
-
class BaseScalarFieldDef {
|
|
99859
|
-
constructor(nullable) {
|
|
99860
|
-
this.nullable = nullable;
|
|
99861
|
-
this.type = "scalar";
|
|
99862
|
-
}
|
|
99863
|
-
write(_cache, input) {
|
|
99864
|
-
if (input.data === void 0) {
|
|
99865
|
-
return ok$4({ type: "missing" });
|
|
99866
|
-
}
|
|
99867
|
-
if (input.data === null) {
|
|
99868
|
-
if (!this.nullable) {
|
|
99869
|
-
return err$4([
|
|
99870
|
-
{
|
|
99871
|
-
type: "unknown",
|
|
99872
|
-
error: new Error(
|
|
99873
|
-
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
99874
|
-
)
|
|
99875
|
-
}
|
|
99876
|
-
]);
|
|
99877
|
-
}
|
|
99878
|
-
}
|
|
99879
|
-
return ok$4({ type: "data", data: input.data });
|
|
99880
|
-
}
|
|
99881
|
-
read(_cache, input) {
|
|
99882
|
-
const normalizedData = input.normalizedData;
|
|
99883
|
-
if (normalizedData.type === "missing") {
|
|
99884
|
-
return ok$4(void 0);
|
|
99885
|
-
}
|
|
99886
|
-
return ok$4(normalizedData.data);
|
|
99887
|
-
}
|
|
99888
|
-
augmentSelections(input) {
|
|
99889
|
-
return input;
|
|
99890
|
-
}
|
|
99891
|
-
buildFieldKey(selection, variables) {
|
|
99892
|
-
return buildFieldKey(selection.name.value, selection.arguments, variables);
|
|
99893
|
-
}
|
|
99894
|
-
}
|
|
99895
|
-
class BaseArrayFieldDef {
|
|
99896
|
-
constructor(items, nullable) {
|
|
99897
|
-
this.items = items;
|
|
99898
|
-
this.nullable = nullable;
|
|
99899
|
-
this.type = "array";
|
|
99900
|
-
}
|
|
99901
|
-
augmentSelections(input) {
|
|
99902
|
-
return this.items.augmentSelections(input);
|
|
99903
|
-
}
|
|
99904
|
-
buildFieldKey(selection, variables) {
|
|
99905
|
-
return this.items.buildFieldKey(selection, variables);
|
|
99906
|
-
}
|
|
99907
|
-
write(cache, input) {
|
|
99908
|
-
if (input.data === void 0) {
|
|
99909
|
-
return ok$4({ type: "missing" });
|
|
99910
|
-
}
|
|
99911
|
-
if (input.data === null) {
|
|
99912
|
-
if (!this.nullable) {
|
|
99913
|
-
return err$4([
|
|
99914
|
-
{
|
|
99915
|
-
type: "unknown",
|
|
99916
|
-
error: new Error(
|
|
99917
|
-
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
99918
|
-
)
|
|
99919
|
-
}
|
|
99920
|
-
]);
|
|
99921
|
-
}
|
|
99922
|
-
return ok$4({ type: "data", data: input.data });
|
|
99923
|
-
}
|
|
99924
|
-
if (!Array.isArray(input.data)) {
|
|
99925
|
-
return err$4([
|
|
99926
|
-
{
|
|
99927
|
-
type: "unknown",
|
|
99928
|
-
error: new Error(
|
|
99929
|
-
`Got a non array value for array field "${input.selection.name.value}"`
|
|
99930
|
-
)
|
|
99931
|
-
}
|
|
99932
|
-
]);
|
|
99933
|
-
}
|
|
99934
|
-
const arrayNormalizationErrors = [];
|
|
99935
|
-
const normalizedArray = [];
|
|
99936
|
-
input.data.forEach((item, index) => {
|
|
99937
|
-
var _a;
|
|
99938
|
-
const existingItemData = (_a = input.existingNormalizedData) == null ? void 0 : _a[index];
|
|
99939
|
-
const normalizedItemResult = this.items.write(cache, {
|
|
99940
|
-
...input,
|
|
99941
|
-
data: item,
|
|
99942
|
-
existingNormalizedData: existingItemData,
|
|
99943
|
-
request: input.request,
|
|
99944
|
-
selection: input.selection
|
|
99945
|
-
});
|
|
99946
|
-
if (normalizedItemResult.isOk()) {
|
|
99947
|
-
normalizedArray.push(normalizedItemResult.value);
|
|
99948
|
-
} else {
|
|
99949
|
-
arrayNormalizationErrors.push(...normalizedItemResult.error);
|
|
99950
|
-
}
|
|
99951
|
-
});
|
|
99952
|
-
if (arrayNormalizationErrors.length > 0) {
|
|
99953
|
-
return err$4(arrayNormalizationErrors);
|
|
99954
|
-
}
|
|
99955
|
-
return ok$4({ type: "data", data: normalizedArray });
|
|
99956
|
-
}
|
|
99957
|
-
read(cache, input) {
|
|
99958
|
-
const normalizedData = input.normalizedData;
|
|
99959
|
-
if (normalizedData.type === "missing") {
|
|
99960
|
-
return ok$4(void 0);
|
|
99961
|
-
}
|
|
99962
|
-
if (normalizedData.data === null) {
|
|
99963
|
-
if (!this.nullable) {
|
|
99964
|
-
return err$4([
|
|
99965
|
-
{
|
|
99966
|
-
type: "unknown",
|
|
99967
|
-
error: new Error(
|
|
99968
|
-
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
99969
|
-
)
|
|
99970
|
-
}
|
|
99971
|
-
]);
|
|
99972
|
-
}
|
|
99973
|
-
return ok$4({ type: "data", data: null });
|
|
99974
|
-
}
|
|
99975
|
-
if (!Array.isArray(normalizedData.data)) {
|
|
99976
|
-
return err$4([
|
|
99977
|
-
{
|
|
99978
|
-
type: "unknown",
|
|
99979
|
-
error: new Error(
|
|
99980
|
-
`Got a non array value for array field "${input.selection.name.value}"`
|
|
99981
|
-
)
|
|
99982
|
-
}
|
|
99983
|
-
]);
|
|
99984
|
-
}
|
|
99985
|
-
const arrayDenormalizationErrors = [];
|
|
99986
|
-
const denormalizedArray = [];
|
|
99987
|
-
normalizedData.data.forEach((item) => {
|
|
99988
|
-
const denormalizedItemResult = this.items.read(cache, {
|
|
99989
|
-
...input,
|
|
99990
|
-
normalizedData: item,
|
|
99991
|
-
request: input.request,
|
|
99992
|
-
selection: input.selection
|
|
99993
|
-
});
|
|
99994
|
-
if (denormalizedItemResult.isOk()) {
|
|
99995
|
-
denormalizedArray.push(denormalizedItemResult.value);
|
|
99996
|
-
} else {
|
|
99997
|
-
arrayDenormalizationErrors.push(...denormalizedItemResult.error);
|
|
99998
|
-
}
|
|
99999
|
-
});
|
|
100000
|
-
if (arrayDenormalizationErrors.length > 0) {
|
|
100001
|
-
return err$4(arrayDenormalizationErrors);
|
|
100002
|
-
}
|
|
100003
|
-
return ok$4(denormalizedArray);
|
|
100004
|
-
}
|
|
100005
|
-
}
|
|
100006
|
-
class BaseObjectFieldDef {
|
|
100007
|
-
constructor(repository, nullable) {
|
|
100008
|
-
this.repository = repository;
|
|
100009
|
-
this.nullable = nullable;
|
|
100010
|
-
this.type = "object";
|
|
100011
|
-
}
|
|
100012
|
-
augmentSelections(input) {
|
|
100013
|
-
return this.repository.augmentSelections(input);
|
|
100014
|
-
}
|
|
100015
|
-
buildFieldKey(selection, variables) {
|
|
100016
|
-
return this.repository.buildFieldKey(selection, variables);
|
|
100017
|
-
}
|
|
100018
|
-
write(cache, input) {
|
|
100019
|
-
var _a;
|
|
100020
|
-
if (!input.selection.selectionSet) {
|
|
100021
|
-
return err$4([
|
|
100022
|
-
{
|
|
100023
|
-
type: "unknown",
|
|
100024
|
-
error: new Error(
|
|
100025
|
-
`Selection set required for object type found on field "${input.selection.name.value}" in type ${this.repository.typeName}`
|
|
100026
|
-
)
|
|
100027
|
-
}
|
|
100028
|
-
]);
|
|
100029
|
-
}
|
|
100030
|
-
if (input.data === void 0) {
|
|
100031
|
-
return ok$4({ type: "missing" });
|
|
100032
|
-
}
|
|
100033
|
-
if (input.data === null) {
|
|
100034
|
-
if (!this.nullable) {
|
|
100035
|
-
return err$4([
|
|
100036
|
-
{
|
|
100037
|
-
type: "unknown",
|
|
100038
|
-
error: new Error(
|
|
100039
|
-
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
100040
|
-
)
|
|
100041
|
-
}
|
|
100042
|
-
]);
|
|
100043
|
-
}
|
|
100044
|
-
return ok$4({ type: "data", data: null });
|
|
100045
|
-
}
|
|
100046
|
-
const writeResult = this.repository.write(cache, {
|
|
100047
|
-
...input,
|
|
100048
|
-
data: input.data,
|
|
100049
|
-
existingNormalizedData: (_a = input.existingNormalizedData) == null ? void 0 : _a.data,
|
|
100050
|
-
request: input.request,
|
|
100051
|
-
selections: input.selection.selectionSet.selections,
|
|
100052
|
-
parentFieldSelection: input.selection
|
|
100053
|
-
});
|
|
100054
|
-
if (writeResult.isErr()) {
|
|
100055
|
-
return writeResult;
|
|
100056
|
-
}
|
|
100057
|
-
return ok$4({ type: "data", data: writeResult.value });
|
|
100058
|
-
}
|
|
100059
|
-
read(cache, input) {
|
|
100060
|
-
var _a;
|
|
100061
|
-
if (!input.selection.selectionSet) {
|
|
100062
|
-
return err$4([
|
|
100063
|
-
{
|
|
100064
|
-
type: "unknown",
|
|
100065
|
-
error: new Error(
|
|
100066
|
-
`Selection set required for object type found on field "${input.selection.name.value}" in type ${this.repository.typeName}`
|
|
100067
|
-
)
|
|
100068
|
-
}
|
|
100069
|
-
]);
|
|
100070
|
-
}
|
|
100071
|
-
const normalizedData = input.normalizedData;
|
|
100072
|
-
if (normalizedData.type === "missing") {
|
|
100073
|
-
return ok$4(void 0);
|
|
100074
|
-
}
|
|
100075
|
-
if (normalizedData.data === null) {
|
|
100076
|
-
if (!this.nullable) {
|
|
100077
|
-
return err$4([
|
|
100078
|
-
{
|
|
100079
|
-
type: "unknown",
|
|
100080
|
-
error: new Error(
|
|
100081
|
-
`Got a null value for non-nullable field "${input.selection.name.value}"`
|
|
100082
|
-
)
|
|
100083
|
-
}
|
|
100084
|
-
]);
|
|
100085
|
-
}
|
|
100086
|
-
return ok$4(null);
|
|
100087
|
-
}
|
|
100088
|
-
return this.repository.read(cache, {
|
|
100089
|
-
...input,
|
|
100090
|
-
normalizedData: normalizedData.data,
|
|
100091
|
-
request: input.request,
|
|
100092
|
-
selections: (_a = input.selection.selectionSet) == null ? void 0 : _a.selections,
|
|
100093
|
-
parentFieldSelection: input.selection
|
|
100094
|
-
});
|
|
100095
|
-
}
|
|
100096
|
-
}
|
|
100097
100105
|
const GraphQLQueryJsonSchema = {
|
|
100098
100106
|
type: "object",
|
|
100099
100107
|
properties: {
|
|
@@ -100394,10 +100402,10 @@
|
|
|
100394
100402
|
return;
|
|
100395
100403
|
}
|
|
100396
100404
|
if ("subscribe" in result.value) {
|
|
100397
|
-
callback(result.value.data);
|
|
100405
|
+
callback(formatGraphQLData(result.value.data));
|
|
100398
100406
|
return;
|
|
100399
100407
|
}
|
|
100400
|
-
callback(result.value);
|
|
100408
|
+
callback(formatGraphQLData(result.value));
|
|
100401
100409
|
}
|
|
100402
100410
|
function resolveAst(ast) {
|
|
100403
100411
|
const result = astResolver(ast);
|
|
@@ -100406,6 +100414,18 @@
|
|
|
100406
100414
|
}
|
|
100407
100415
|
return result;
|
|
100408
100416
|
}
|
|
100417
|
+
function formatGraphQLData(data) {
|
|
100418
|
+
if (data.errors === void 0 || data.errors.length === 0) {
|
|
100419
|
+
return {
|
|
100420
|
+
data: data.data,
|
|
100421
|
+
errors: void 0
|
|
100422
|
+
};
|
|
100423
|
+
}
|
|
100424
|
+
return {
|
|
100425
|
+
data: data.data,
|
|
100426
|
+
errors: data.errors
|
|
100427
|
+
};
|
|
100428
|
+
}
|
|
100409
100429
|
class GraphQLCommandWireAdapterConstructor extends CommandWireAdapterConstructor {
|
|
100410
100430
|
emit(result) {
|
|
100411
100431
|
try {
|
|
@@ -100484,7 +100504,7 @@
|
|
|
100484
100504
|
};
|
|
100485
100505
|
return { invoke, subscribe };
|
|
100486
100506
|
}
|
|
100487
|
-
// version: 1.
|
|
100507
|
+
// version: 1.378.0-63d7c07562
|
|
100488
100508
|
|
|
100489
100509
|
class Analytics__AnalyticsBrowseRepository extends UnidentifiableGraphQLTypeRepository {
|
|
100490
100510
|
constructor(services, typeRegistry) {
|
|
@@ -101660,7 +101680,7 @@
|
|
|
101660
101680
|
}
|
|
101661
101681
|
}
|
|
101662
101682
|
|
|
101663
|
-
class PolymorphicParentRelationshipRepository extends BaseUnionRepository {
|
|
101683
|
+
let PolymorphicParentRelationshipRepository$1 = class PolymorphicParentRelationshipRepository extends BaseUnionRepository {
|
|
101664
101684
|
constructor(services, typeRegistry) {
|
|
101665
101685
|
super(services);
|
|
101666
101686
|
this.services = services;
|
|
@@ -101677,7 +101697,7 @@
|
|
|
101677
101697
|
__typename: new BaseScalarFieldDef(false),
|
|
101678
101698
|
};
|
|
101679
101699
|
}
|
|
101680
|
-
}
|
|
101700
|
+
};
|
|
101681
101701
|
|
|
101682
101702
|
class QueryRepository extends GraphQLDocumentRootTypeRepository {
|
|
101683
101703
|
constructor(services, typeRegistry) {
|
|
@@ -102715,7 +102735,7 @@
|
|
|
102715
102735
|
this._Base64Value = new Base64ValueRepository(this.services, this);
|
|
102716
102736
|
this._JSONValue = new JSONValueRepository(this.services, this);
|
|
102717
102737
|
this._PolymorphicParentRelationship =
|
|
102718
|
-
new PolymorphicParentRelationshipRepository(this.services, this);
|
|
102738
|
+
new PolymorphicParentRelationshipRepository$1(this.services, this);
|
|
102719
102739
|
this._CompoundField = new CompoundFieldRepository$1(this.services, this);
|
|
102720
102740
|
this._AnyType = new AnyTypeRepository(this.services, this);
|
|
102721
102741
|
this._RecordRepresentation =
|
|
@@ -103219,8 +103239,6 @@
|
|
|
103219
103239
|
return fields[selection.name.value];
|
|
103220
103240
|
}
|
|
103221
103241
|
return {
|
|
103222
|
-
type: 'object',
|
|
103223
|
-
nullable: true,
|
|
103224
103242
|
read: (cache, input) => {
|
|
103225
103243
|
if (!input.selection.selectionSet) {
|
|
103226
103244
|
return err([
|
|
@@ -103234,6 +103252,9 @@
|
|
|
103234
103252
|
if (normalizedData.type === 'missing') {
|
|
103235
103253
|
return ok(undefined);
|
|
103236
103254
|
}
|
|
103255
|
+
if (normalizedData.data === null) {
|
|
103256
|
+
return ok(null);
|
|
103257
|
+
}
|
|
103237
103258
|
const fieldCategory = normalizedData.fieldCategory;
|
|
103238
103259
|
const fieldDef = fields[fieldCategory];
|
|
103239
103260
|
if (!fieldDef) {
|
|
@@ -103258,6 +103279,9 @@
|
|
|
103258
103279
|
if (input.data === undefined) {
|
|
103259
103280
|
return ok({ type: 'missing' });
|
|
103260
103281
|
}
|
|
103282
|
+
if (input.data === null) {
|
|
103283
|
+
return ok({ type: 'data', data: null });
|
|
103284
|
+
}
|
|
103261
103285
|
const fieldCategory = getFieldCategoryFromData(input.data);
|
|
103262
103286
|
const fieldDef = fields[fieldCategory];
|
|
103263
103287
|
if (!fieldDef) {
|
|
@@ -103276,7 +103300,6 @@
|
|
|
103276
103300
|
},
|
|
103277
103301
|
buildFieldKey: (selection, variables) => buildFieldKey(selection.name.value, selection.arguments, variables),
|
|
103278
103302
|
augmentSelections: (input) => input,
|
|
103279
|
-
repository: {}, // This shouldn't be part of the interface
|
|
103280
103303
|
};
|
|
103281
103304
|
}
|
|
103282
103305
|
function getFieldCategoryFromData(data) {
|
|
@@ -103328,7 +103351,19 @@
|
|
|
103328
103351
|
return this._graphqlRepositoryOverride;
|
|
103329
103352
|
}
|
|
103330
103353
|
write(cache, input) {
|
|
103331
|
-
|
|
103354
|
+
let overridenInput = input;
|
|
103355
|
+
// If ID exists in the data but wasn't asked for, its from the extensions, and we should normalize it
|
|
103356
|
+
if (input.data.Id !== undefined &&
|
|
103357
|
+
input.selections.find((selection) => selection.kind === 'Field' && selection.name.value === 'Id')) {
|
|
103358
|
+
overridenInput = {
|
|
103359
|
+
...input,
|
|
103360
|
+
selections: [
|
|
103361
|
+
...input.selections,
|
|
103362
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'Id' } },
|
|
103363
|
+
],
|
|
103364
|
+
};
|
|
103365
|
+
}
|
|
103366
|
+
const result = super.write(cache, overridenInput);
|
|
103332
103367
|
const recordId = input.data.Id;
|
|
103333
103368
|
const luvioRecord = input.getNormalizedLuvioRecord(recordId, input.reader);
|
|
103334
103369
|
if (luvioRecord?.weakEtag &&
|
|
@@ -103475,8 +103510,6 @@
|
|
|
103475
103510
|
}
|
|
103476
103511
|
|
|
103477
103512
|
const blobTypeDef = {
|
|
103478
|
-
type: 'scalar',
|
|
103479
|
-
nullable: true,
|
|
103480
103513
|
read: (_cache, input) => {
|
|
103481
103514
|
return ok({
|
|
103482
103515
|
data: input.data,
|
|
@@ -103586,6 +103619,14 @@
|
|
|
103586
103619
|
}
|
|
103587
103620
|
}
|
|
103588
103621
|
|
|
103622
|
+
class PolymorphicParentRelationshipRepository extends PolymorphicParentRelationshipRepository$1 {
|
|
103623
|
+
getTypeDiscriminator(data, _selections) {
|
|
103624
|
+
// Hardcoded to record representation since that's the only type of parent
|
|
103625
|
+
// relationship possible
|
|
103626
|
+
return 'RecordRepresentation';
|
|
103627
|
+
}
|
|
103628
|
+
}
|
|
103629
|
+
|
|
103589
103630
|
class CustomGraphQLTypeRegistry extends GraphQLTypeRegistry {
|
|
103590
103631
|
constructor(services) {
|
|
103591
103632
|
super(services);
|
|
@@ -103598,6 +103639,7 @@
|
|
|
103598
103639
|
this._SetupQueryAggregate = new SetupQueryAggregateRepository(services, this);
|
|
103599
103640
|
this._SetupQuery = new SetupQueryRepository(services, this);
|
|
103600
103641
|
this._SetupRecordAggregate = new SetupRecordAggregateRepository(services, this);
|
|
103642
|
+
this._PolymorphicParentRelationship = new PolymorphicParentRelationshipRepository(services, this);
|
|
103601
103643
|
}
|
|
103602
103644
|
get CompoundField() {
|
|
103603
103645
|
return this._CompoundField;
|
|
@@ -103626,155 +103668,75 @@
|
|
|
103626
103668
|
get SetupRecordAggregate() {
|
|
103627
103669
|
return this._SetupRecordAggregate;
|
|
103628
103670
|
}
|
|
103671
|
+
get PolymorphicParentRelationship() {
|
|
103672
|
+
return this._PolymorphicParentRelationship;
|
|
103673
|
+
}
|
|
103629
103674
|
}
|
|
103630
103675
|
|
|
103631
103676
|
const CONFIG_SCHEMA = GraphQLQueryJsonSchema;
|
|
103632
103677
|
|
|
103633
|
-
|
|
103634
|
-
|
|
103635
|
-
|
|
103636
|
-
|
|
103637
|
-
|
|
103638
|
-
|
|
103639
|
-
|
|
103640
|
-
|
|
103641
|
-
|
|
103642
|
-
|
|
103643
|
-
|
|
103644
|
-
|
|
103645
|
-
|
|
103646
|
-
|
|
103647
|
-
|
|
103648
|
-
|
|
103649
|
-
|
|
103650
|
-
|
|
103651
|
-
|
|
103652
|
-
|
|
103653
|
-
|
|
103654
|
-
|
|
103655
|
-
|
|
103656
|
-
|
|
103657
|
-
|
|
103658
|
-
|
|
103659
|
-
|
|
103660
|
-
|
|
103661
|
-
|
|
103662
|
-
|
|
103663
|
-
|
|
103664
|
-
|
|
103665
|
-
|
|
103666
|
-
|
|
103667
|
-
|
|
103668
|
-
|
|
103669
|
-
|
|
103670
|
-
|
|
103671
|
-
|
|
103672
|
-
|
|
103673
|
-
|
|
103674
|
-
|
|
103675
|
-
|
|
103676
|
-
|
|
103677
|
-
|
|
103678
|
-
|
|
103679
|
-
|
|
103680
|
-
|
|
103681
|
-
|
|
103682
|
-
|
|
103683
|
-
|
|
103684
|
-
|
|
103685
|
-
|
|
103686
|
-
|
|
103687
|
-
|
|
103688
|
-
|
|
103689
|
-
|
|
103690
|
-
|
|
103691
|
-
|
|
103692
|
-
|
|
103693
|
-
|
|
103694
|
-
|
|
103695
|
-
name: {
|
|
103696
|
-
kind: Kind$1.NAME,
|
|
103697
|
-
value: name,
|
|
103698
|
-
},
|
|
103699
|
-
};
|
|
103700
|
-
if (typeof data === 'object' && data !== null && data !== undefined) {
|
|
103701
|
-
if (Array.isArray(data)) {
|
|
103702
|
-
// For arrays, we need to merge the structure from all non-null elements
|
|
103703
|
-
// to capture the full schema, not just the first element
|
|
103704
|
-
let mergedStructure = {};
|
|
103705
|
-
for (const item of data) {
|
|
103706
|
-
if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
|
|
103707
|
-
mergedStructure = deepMerge$1(mergedStructure, item);
|
|
103708
|
-
}
|
|
103709
|
-
}
|
|
103710
|
-
if (Object.keys(mergedStructure).length > 0) {
|
|
103711
|
-
baseField.selectionSet = {
|
|
103712
|
-
kind: Kind$1.SELECTION_SET,
|
|
103713
|
-
selections: Object.entries(mergedStructure)
|
|
103714
|
-
.map(([key, value]) => createFieldNode(key, value))
|
|
103715
|
-
.filter((node) => node !== undefined),
|
|
103716
|
-
};
|
|
103717
|
-
}
|
|
103718
|
-
}
|
|
103719
|
-
else {
|
|
103720
|
-
baseField.selectionSet = {
|
|
103721
|
-
kind: Kind$1.SELECTION_SET,
|
|
103722
|
-
selections: Object.entries(data)
|
|
103723
|
-
.map(([key, value]) => createFieldNode(key, value))
|
|
103724
|
-
.filter((node) => node !== undefined),
|
|
103725
|
-
};
|
|
103726
|
-
}
|
|
103727
|
-
}
|
|
103728
|
-
return baseField;
|
|
103729
|
-
}
|
|
103730
|
-
function createASTFromExtensions(extensions) {
|
|
103731
|
-
const fieldNodes = Object.entries(extensions)
|
|
103732
|
-
.map(([field, value]) => createFieldNode(field, value))
|
|
103733
|
-
.filter((node) => node !== undefined);
|
|
103734
|
-
return {
|
|
103735
|
-
kind: Kind$1.SELECTION_SET,
|
|
103736
|
-
selections: fieldNodes,
|
|
103737
|
-
};
|
|
103738
|
-
}
|
|
103739
|
-
function mergeASTs(query, extensionsAST) {
|
|
103740
|
-
return {
|
|
103741
|
-
...query,
|
|
103742
|
-
definitions: query.definitions.map((def) => {
|
|
103743
|
-
if (def.kind === Kind$1.OPERATION_DEFINITION) {
|
|
103744
|
-
return {
|
|
103745
|
-
...def,
|
|
103746
|
-
selectionSet: {
|
|
103747
|
-
kind: Kind$1.SELECTION_SET,
|
|
103748
|
-
selections: [...def.selectionSet.selections, ...extensionsAST.selections],
|
|
103749
|
-
},
|
|
103750
|
-
};
|
|
103751
|
-
}
|
|
103752
|
-
return def;
|
|
103753
|
-
}),
|
|
103754
|
-
};
|
|
103755
|
-
}
|
|
103756
|
-
/**
|
|
103757
|
-
* Augments a query with the extensions from a response. The general algorithm is:
|
|
103758
|
-
* 1. Create an AST from just the extensions.
|
|
103759
|
-
* 2. Deep merge the extensions AST into the query AST.
|
|
103760
|
-
* 3. Deep merge the extensions into the response data.
|
|
103761
|
-
* 4. Return the augmented query and response.
|
|
103762
|
-
* @param query - The query to augment.
|
|
103763
|
-
* @param response - The response to augment the query with.
|
|
103764
|
-
* @returns The augmented query and response.
|
|
103765
|
-
*/
|
|
103766
|
-
function augmentQueryByResponse(query, response) {
|
|
103767
|
-
const extensions = response.extensions?.lds || {};
|
|
103768
|
-
const extensionsAST = createASTFromExtensions(extensions);
|
|
103769
|
-
const augmentedQuery = mergeASTs(query, extensionsAST);
|
|
103770
|
-
// Deep merge extensions into data, removing extensions key from result
|
|
103771
|
-
const mergedData = deepMerge$1(response.data, extensions);
|
|
103772
|
-
return {
|
|
103773
|
-
query: augmentedQuery,
|
|
103774
|
-
response: {
|
|
103775
|
-
data: mergedData,
|
|
103776
|
-
...(response.errors && { errors: response.errors }),
|
|
103777
|
-
},
|
|
103678
|
+
function mergeResponseWithExtensions(response) {
|
|
103679
|
+
return {
|
|
103680
|
+
data: deepMerge$1(response.data, response.extensions?.lds || {}),
|
|
103681
|
+
...(response.errors && { errors: response.errors }),
|
|
103682
|
+
};
|
|
103683
|
+
}
|
|
103684
|
+
function deepMerge$1(data, extensions) {
|
|
103685
|
+
const dataType = typeof data;
|
|
103686
|
+
const extensionsType = typeof extensions;
|
|
103687
|
+
if (dataType === 'function' || extensionsType === 'function') {
|
|
103688
|
+
throw new Error('Cannot merge functions');
|
|
103689
|
+
}
|
|
103690
|
+
if (dataType === 'undefined' || data === undefined) {
|
|
103691
|
+
return extensions;
|
|
103692
|
+
}
|
|
103693
|
+
if (extensionsType === 'undefined' || extensions === undefined) {
|
|
103694
|
+
return data;
|
|
103695
|
+
}
|
|
103696
|
+
if (dataType === 'string' ||
|
|
103697
|
+
dataType === 'number' ||
|
|
103698
|
+
dataType === 'boolean' ||
|
|
103699
|
+
dataType === 'bigint' ||
|
|
103700
|
+
dataType === 'symbol' ||
|
|
103701
|
+
extensionsType === 'string' ||
|
|
103702
|
+
extensionsType === 'number' ||
|
|
103703
|
+
extensionsType === 'boolean' ||
|
|
103704
|
+
extensionsType === 'bigint' ||
|
|
103705
|
+
extensionsType === 'symbol' ||
|
|
103706
|
+
data === null ||
|
|
103707
|
+
extensions === null) {
|
|
103708
|
+
// if either is a scalar, prefer data
|
|
103709
|
+
return data;
|
|
103710
|
+
}
|
|
103711
|
+
// data and extensions are both objects or arrays
|
|
103712
|
+
// if data is an array but extensions is not, prefer data
|
|
103713
|
+
const dataIsArray = Array.isArray(data);
|
|
103714
|
+
const extensionsIsArray = Array.isArray(extensions);
|
|
103715
|
+
// if one is an array and the other is not, prefer data
|
|
103716
|
+
if ((dataIsArray && !extensionsIsArray) || (!dataIsArray && extensionsIsArray)) {
|
|
103717
|
+
return data;
|
|
103718
|
+
}
|
|
103719
|
+
// if both are arrays, merge them, maintaining the length of data
|
|
103720
|
+
if (dataIsArray && extensionsIsArray) {
|
|
103721
|
+
return data.map((item, index) => deepMerge$1(item, extensions[index]));
|
|
103722
|
+
}
|
|
103723
|
+
// if both are objects, merge them
|
|
103724
|
+
// get the keys of both objects
|
|
103725
|
+
const dataKeys = Object.keys(data);
|
|
103726
|
+
const extensionsKeys = Object.keys(extensions);
|
|
103727
|
+
// get the keys that are in both objects
|
|
103728
|
+
const commonKeys = dataKeys.filter((key) => extensionsKeys.includes(key));
|
|
103729
|
+
// get the keys that are in data but not in extensions
|
|
103730
|
+
const dataKeysNotInExtensions = dataKeys.filter((key) => !extensionsKeys.includes(key));
|
|
103731
|
+
// get the keys that are in extensions but not in data
|
|
103732
|
+
const extensionsKeysNotInData = extensionsKeys.filter((key) => !dataKeys.includes(key));
|
|
103733
|
+
return {
|
|
103734
|
+
...Object.fromEntries(commonKeys.map((key) => [
|
|
103735
|
+
key,
|
|
103736
|
+
deepMerge$1(data[key], extensions[key]),
|
|
103737
|
+
])),
|
|
103738
|
+
...Object.fromEntries(dataKeysNotInExtensions.map((key) => [key, data[key]])),
|
|
103739
|
+
...Object.fromEntries(extensionsKeysNotInData.map((key) => [key, extensions[key]])),
|
|
103778
103740
|
};
|
|
103779
103741
|
}
|
|
103780
103742
|
|
|
@@ -103832,17 +103794,16 @@
|
|
|
103832
103794
|
}
|
|
103833
103795
|
buildWriteInput(data) {
|
|
103834
103796
|
this.latestLuvioRecordIdsToInvalidate = [];
|
|
103835
|
-
const
|
|
103836
|
-
const { query: augmentedQuery, response: augmentedData } = augmentQueryByResponse(baseQuery, data);
|
|
103797
|
+
const augmentedResponse = mergeResponseWithExtensions(data);
|
|
103837
103798
|
const extensionResult = buildGraphQLInputExtension({
|
|
103838
103799
|
...this.config,
|
|
103839
|
-
query:
|
|
103800
|
+
query: this.buildRequestQuery(),
|
|
103840
103801
|
});
|
|
103841
103802
|
if (extensionResult.isErr()) {
|
|
103842
103803
|
throw new InternalError(extensionResult.error);
|
|
103843
103804
|
}
|
|
103844
103805
|
return {
|
|
103845
|
-
data:
|
|
103806
|
+
data: augmentedResponse.data,
|
|
103846
103807
|
...extensionResult.value,
|
|
103847
103808
|
luvioRecordIdsToInvalidate: this.latestLuvioRecordIdsToInvalidate,
|
|
103848
103809
|
};
|
|
@@ -103898,7 +103859,7 @@
|
|
|
103898
103859
|
synthetic: true,
|
|
103899
103860
|
read: (reader) => {
|
|
103900
103861
|
if (networkResult.isOk()) {
|
|
103901
|
-
|
|
103862
|
+
return this.buildResultType().write(cache.buildFixedTimeWritableCache(Date.now() / 1000), {
|
|
103902
103863
|
...this.buildWriteInput(networkResult.value),
|
|
103903
103864
|
reader,
|
|
103904
103865
|
getNormalizedLuvioRecord: this.services.luvioUiapiRecords
|
|
@@ -103912,7 +103873,6 @@
|
|
|
103912
103873
|
}
|
|
103913
103874
|
catch (error) {
|
|
103914
103875
|
// swallow error
|
|
103915
|
-
console.error(error);
|
|
103916
103876
|
}
|
|
103917
103877
|
return resolvedPromiseLike(undefined);
|
|
103918
103878
|
}
|
|
@@ -104030,7 +103990,7 @@
|
|
|
104030
103990
|
cb(graphql$1, graphql_imperative$1, useOneStoreGraphQL);
|
|
104031
103991
|
}
|
|
104032
103992
|
}
|
|
104033
|
-
// version: 1.
|
|
103993
|
+
// version: 1.378.0-63d7c07562
|
|
104034
103994
|
|
|
104035
103995
|
function createFragmentMap(documentNode) {
|
|
104036
103996
|
const fragments = {};
|
|
@@ -130525,7 +130485,7 @@
|
|
|
130525
130485
|
}
|
|
130526
130486
|
return refresh$3(data, 'refreshUiApi');
|
|
130527
130487
|
}
|
|
130528
|
-
// version: 1.
|
|
130488
|
+
// version: 1.378.0-63d7c07562
|
|
130529
130489
|
|
|
130530
130490
|
// On core the unstable adapters are re-exported with different names,
|
|
130531
130491
|
// we want to match them here.
|
|
@@ -130677,7 +130637,7 @@
|
|
|
130677
130637
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
130678
130638
|
graphQLImperative = ldsAdapter;
|
|
130679
130639
|
});
|
|
130680
|
-
// version: 1.
|
|
130640
|
+
// version: 1.378.0-63d7c07562
|
|
130681
130641
|
|
|
130682
130642
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
130683
130643
|
__proto__: null,
|
|
@@ -131476,7 +131436,7 @@
|
|
|
131476
131436
|
function register(r) {
|
|
131477
131437
|
callbacks$1.forEach((callback) => callback(r));
|
|
131478
131438
|
}
|
|
131479
|
-
// version: 1.
|
|
131439
|
+
// version: 1.378.0-0ab3d40d29
|
|
131480
131440
|
|
|
131481
131441
|
/**
|
|
131482
131442
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -132813,4 +132773,4 @@
|
|
|
132813
132773
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
132814
132774
|
|
|
132815
132775
|
}));
|
|
132816
|
-
// version: 1.
|
|
132776
|
+
// version: 1.378.0-0ab3d40d29
|