@salesforce/lds-worker-api 1.433.0 → 1.434.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sfdc/es/ldsWorkerApi.js +5 -3
- package/dist/sfdc/es/types/customLuvioAdapter.d.ts +2 -1
- package/dist/sfdc/es/types/standalone-stubs/unwrap.d.ts +5 -5
- package/dist/standalone/es/lds-worker-api.js +727 -784
- package/dist/standalone/es/types/customLuvioAdapter.d.ts +2 -1
- package/dist/standalone/es/types/standalone-stubs/unwrap.d.ts +5 -5
- package/dist/standalone/umd/lds-worker-api.js +727 -784
- package/dist/standalone/umd/types/customLuvioAdapter.d.ts +2 -1
- package/dist/standalone/umd/types/standalone-stubs/unwrap.d.ts +5 -5
- package/package.json +9 -9
|
@@ -4280,7 +4280,7 @@
|
|
|
4280
4280
|
}
|
|
4281
4281
|
callbacks.push(callback);
|
|
4282
4282
|
}
|
|
4283
|
-
// version: 1.
|
|
4283
|
+
// version: 1.434.0-d8deb0d4ea
|
|
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.434.0-d8deb0d4ea
|
|
5328
5328
|
|
|
5329
5329
|
function isSupportedEntity(_objectApiName) {
|
|
5330
5330
|
return true;
|
|
@@ -5461,28 +5461,23 @@
|
|
|
5461
5461
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
5462
5462
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5463
5463
|
* be reached by following 1 relationship from the root record, etc.
|
|
5464
|
-
* @defaultValue '
|
|
5464
|
+
* @defaultValue '1'
|
|
5465
5465
|
*/
|
|
5466
|
-
let trackedFieldDepthOnCacheMiss$3 =
|
|
5466
|
+
let trackedFieldDepthOnCacheMiss$3 = 1;
|
|
5467
5467
|
/**
|
|
5468
5468
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
5469
5469
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5470
5470
|
* be reached by following 1 relationship from the root record, etc.
|
|
5471
|
-
* @defaultValue '
|
|
5471
|
+
* @defaultValue '1'
|
|
5472
5472
|
*/
|
|
5473
|
-
let trackedFieldDepthOnCacheMergeConflict$3 =
|
|
5473
|
+
let trackedFieldDepthOnCacheMergeConflict$3 = 1;
|
|
5474
5474
|
/**
|
|
5475
5475
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
5476
5476
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5477
5477
|
* be reached by following 1 relationship from the root record, etc.
|
|
5478
|
-
* @defaultValue '
|
|
5478
|
+
* @defaultValue '1'
|
|
5479
5479
|
*/
|
|
5480
|
-
let trackedFieldDepthOnNotifyChange$3 =
|
|
5481
|
-
/**
|
|
5482
|
-
* Determines if we will only fetch the 'Id' field for the leaf relationship record
|
|
5483
|
-
* @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
|
|
5484
|
-
*/
|
|
5485
|
-
let trackedFieldLeafNodeIdAndNameOnly$3 = false;
|
|
5480
|
+
let trackedFieldDepthOnNotifyChange$3 = 1;
|
|
5486
5481
|
/**
|
|
5487
5482
|
* One store enabled Get Object Info adapter
|
|
5488
5483
|
*/
|
|
@@ -5579,12 +5574,6 @@
|
|
|
5579
5574
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
5580
5575
|
return trackedFieldDepthOnNotifyChange$3;
|
|
5581
5576
|
},
|
|
5582
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
5583
|
-
trackedFieldLeafNodeIdAndNameOnly$3 = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
5584
|
-
},
|
|
5585
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
5586
|
-
return trackedFieldLeafNodeIdAndNameOnly$3;
|
|
5587
|
-
},
|
|
5588
5577
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
5589
5578
|
recordRepresentationIngestionOverride$3 = ingest;
|
|
5590
5579
|
},
|
|
@@ -5706,28 +5695,23 @@
|
|
|
5706
5695
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
5707
5696
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5708
5697
|
* be reached by following 1 relationship from the root record, etc.
|
|
5709
|
-
* @defaultValue '
|
|
5698
|
+
* @defaultValue '1'
|
|
5710
5699
|
*/
|
|
5711
|
-
let trackedFieldDepthOnCacheMiss$2 =
|
|
5700
|
+
let trackedFieldDepthOnCacheMiss$2 = 1;
|
|
5712
5701
|
/**
|
|
5713
5702
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
5714
5703
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5715
5704
|
* be reached by following 1 relationship from the root record, etc.
|
|
5716
|
-
* @defaultValue '
|
|
5705
|
+
* @defaultValue '1'
|
|
5717
5706
|
*/
|
|
5718
|
-
let trackedFieldDepthOnCacheMergeConflict$2 =
|
|
5707
|
+
let trackedFieldDepthOnCacheMergeConflict$2 = 1;
|
|
5719
5708
|
/**
|
|
5720
5709
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
5721
5710
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5722
5711
|
* be reached by following 1 relationship from the root record, etc.
|
|
5723
|
-
* @defaultValue '
|
|
5712
|
+
* @defaultValue '1'
|
|
5724
5713
|
*/
|
|
5725
|
-
let trackedFieldDepthOnNotifyChange$2 =
|
|
5726
|
-
/**
|
|
5727
|
-
* Determines if we will only fetch the 'Id' field for the leaf relationship record
|
|
5728
|
-
* @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
|
|
5729
|
-
*/
|
|
5730
|
-
let trackedFieldLeafNodeIdAndNameOnly$2 = false;
|
|
5714
|
+
let trackedFieldDepthOnNotifyChange$2 = 1;
|
|
5731
5715
|
/**
|
|
5732
5716
|
* One store enabled Get Object Info adapter
|
|
5733
5717
|
*/
|
|
@@ -5833,12 +5817,6 @@
|
|
|
5833
5817
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
5834
5818
|
return trackedFieldDepthOnNotifyChange$2;
|
|
5835
5819
|
},
|
|
5836
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
5837
|
-
trackedFieldLeafNodeIdAndNameOnly$2 = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
5838
|
-
},
|
|
5839
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
5840
|
-
return trackedFieldLeafNodeIdAndNameOnly$2;
|
|
5841
|
-
},
|
|
5842
5820
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
5843
5821
|
recordRepresentationIngestionOverride$2 = ingest;
|
|
5844
5822
|
},
|
|
@@ -7679,6 +7657,9 @@
|
|
|
7679
7657
|
return [...sel.selections, DRAFTS_SELECTION$1];
|
|
7680
7658
|
}
|
|
7681
7659
|
|
|
7660
|
+
// Unused suffixes, but leaving in as comments to avoid eslint errors
|
|
7661
|
+
// const CUSTOM_API_NAME_SUFFIX = '__c';
|
|
7662
|
+
// const DMO_API_NAME_SUFFIX = '__dlm';
|
|
7682
7663
|
const CUSTOM_EXTERNAL_OBJECT_FIELD_SUFFIX$1 = '__x';
|
|
7683
7664
|
const RECORD_REPRESENTATION_ERROR_VERSION$1 = 'RECORD_REPRESENTATION_ERROR_VERSION_1';
|
|
7684
7665
|
const RECORD_REPRESENTATION_ERROR_STORE_METADATA_PARAMS$1 = {
|
|
@@ -7742,13 +7723,11 @@
|
|
|
7742
7723
|
if (!isGraphNode$1(field)) {
|
|
7743
7724
|
continue;
|
|
7744
7725
|
}
|
|
7745
|
-
const { maxDepth
|
|
7726
|
+
const { maxDepth } = config;
|
|
7746
7727
|
if (field.isScalar('value') === false && !Array.isArray(field.data?.value)) {
|
|
7747
7728
|
if (depth + 1 > maxDepth) {
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
addScalarFieldName$1(current);
|
|
7751
|
-
}
|
|
7729
|
+
addScalarFieldId$1(current);
|
|
7730
|
+
addScalarFieldName$1(current);
|
|
7752
7731
|
continue;
|
|
7753
7732
|
}
|
|
7754
7733
|
const spanningLink = field.link('value');
|
|
@@ -7770,19 +7749,10 @@
|
|
|
7770
7749
|
current.children[key] = next;
|
|
7771
7750
|
}
|
|
7772
7751
|
else {
|
|
7773
|
-
// Skip the field, if its value is null at the max level depth.
|
|
7774
|
-
// Ideally, it should only skip relationship field. However,
|
|
7775
|
-
// on the client, there is not a reliable way to determine the
|
|
7776
|
-
// the field type.
|
|
7777
7752
|
if (depth === maxDepth) {
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
continue;
|
|
7782
|
-
}
|
|
7783
|
-
if (field.scalar('value') === null && !Array.isArray(field.data?.value)) {
|
|
7784
|
-
continue;
|
|
7785
|
-
}
|
|
7753
|
+
addScalarFieldId$1(current);
|
|
7754
|
+
addScalarFieldName$1(current);
|
|
7755
|
+
continue;
|
|
7786
7756
|
}
|
|
7787
7757
|
const state = fieldValueRep.linkData();
|
|
7788
7758
|
if (state !== undefined) {
|
|
@@ -8168,7 +8138,6 @@
|
|
|
8168
8138
|
};
|
|
8169
8139
|
const trackedFieldsConfig = {
|
|
8170
8140
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMergeConflict(),
|
|
8171
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
8172
8141
|
};
|
|
8173
8142
|
extractTrackedFieldsToTrie$1(recordKey, incomingNode, incomingTrackedFieldsTrieRoot, trackedFieldsConfig);
|
|
8174
8143
|
extractTrackedFieldsToTrie$1(recordKey, existingNode, existingTrackedFieldsTrieRoot, trackedFieldsConfig);
|
|
@@ -8612,7 +8581,6 @@
|
|
|
8612
8581
|
const key = keyBuilder$28(luvio, createResourceParams$12(config));
|
|
8613
8582
|
const allTrackedFields = getTrackedFields$1(key, luvio.getNode(key), {
|
|
8614
8583
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
8615
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
8616
8584
|
}, config.optionalFields);
|
|
8617
8585
|
const optionalFields = fields === undefined ? allTrackedFields : difference$1(allTrackedFields, fields);
|
|
8618
8586
|
const resourceParams = createResourceParams$12({
|
|
@@ -8739,7 +8707,6 @@
|
|
|
8739
8707
|
};
|
|
8740
8708
|
const childTrackedFields = getTrackedFields$1(childKey, luvio.getNode(childKey), {
|
|
8741
8709
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
8742
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
8743
8710
|
}, childResourceParams.queryParams.optionalFields);
|
|
8744
8711
|
const childSnapshot = ingestSuccess$S(luvio, {
|
|
8745
8712
|
recordId: childResourceParams.urlParams.recordId,
|
|
@@ -13912,7 +13879,6 @@
|
|
|
13912
13879
|
const node = luvio.wrapNormalizedGraphNode(record, key);
|
|
13913
13880
|
const optionalFields = getTrackedFields$1(key, node, {
|
|
13914
13881
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnNotifyChange(),
|
|
13915
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
13916
13882
|
});
|
|
13917
13883
|
const refreshRequest = createResourceRequestFromRepresentation(record, optionalFields);
|
|
13918
13884
|
const existingWeakEtag = record.weakEtag;
|
|
@@ -16501,7 +16467,6 @@
|
|
|
16501
16467
|
const key = keyBuilder$1w$2(luvio, config);
|
|
16502
16468
|
const trackedFieldsConfig = {
|
|
16503
16469
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
16504
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly()
|
|
16505
16470
|
};
|
|
16506
16471
|
const optionalFieldsTrie = convertFieldsToTrie$1(getTrackedFields$1(key, luvio.getNode(key), trackedFieldsConfig, config.optionalFields));
|
|
16507
16472
|
const fieldsTrie = BLANK_RECORD_FIELDS_TRIE$1;
|
|
@@ -30545,7 +30510,6 @@
|
|
|
30545
30510
|
...resourceRequest.queryParams,
|
|
30546
30511
|
optionalFields: getTrackedFields$1(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
30547
30512
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
30548
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
30549
30513
|
}, config.optionalFields),
|
|
30550
30514
|
},
|
|
30551
30515
|
});
|
|
@@ -31080,7 +31044,6 @@
|
|
|
31080
31044
|
...resourceRequest.queryParams,
|
|
31081
31045
|
optionalFields: getTrackedFields$1(recordTemplateKey, luvio.getNode(recordTemplateKey), {
|
|
31082
31046
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
31083
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
31084
31047
|
}, config.optionalFields),
|
|
31085
31048
|
},
|
|
31086
31049
|
});
|
|
@@ -31100,7 +31063,6 @@
|
|
|
31100
31063
|
});
|
|
31101
31064
|
const allTrackedFields = getTrackedFields$1(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
31102
31065
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
31103
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
31104
31066
|
}, optionalFields);
|
|
31105
31067
|
const allTrackedFieldsTrie = convertFieldsToTrie$1(allTrackedFields, true);
|
|
31106
31068
|
const ingest = createFieldsIngestSuccess$4({
|
|
@@ -32556,7 +32518,7 @@
|
|
|
32556
32518
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
32557
32519
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
32558
32520
|
});
|
|
32559
|
-
// version: 1.
|
|
32521
|
+
// version: 1.434.0-6aa2dd15e3
|
|
32560
32522
|
|
|
32561
32523
|
var allowUpdatesForNonCachedRecords = {
|
|
32562
32524
|
isOpen: function (e) {
|
|
@@ -44206,7 +44168,7 @@
|
|
|
44206
44168
|
const { hasOwnProperty: hasOwnProperty$3 } = Object.prototype;
|
|
44207
44169
|
const { isArray: isArray$7 } = Array;
|
|
44208
44170
|
const { stringify: stringify$9, parse: parse$9 } = JSON;
|
|
44209
|
-
let Ok$
|
|
44171
|
+
let Ok$3 = class Ok {
|
|
44210
44172
|
constructor(value) {
|
|
44211
44173
|
this.value = value;
|
|
44212
44174
|
}
|
|
@@ -44217,7 +44179,7 @@
|
|
|
44217
44179
|
return !this.isOk();
|
|
44218
44180
|
}
|
|
44219
44181
|
};
|
|
44220
|
-
let Err$
|
|
44182
|
+
let Err$3 = class Err {
|
|
44221
44183
|
constructor(error) {
|
|
44222
44184
|
this.error = error;
|
|
44223
44185
|
}
|
|
@@ -44228,8 +44190,8 @@
|
|
|
44228
44190
|
return !this.isOk();
|
|
44229
44191
|
}
|
|
44230
44192
|
};
|
|
44231
|
-
const ok$
|
|
44232
|
-
const err$
|
|
44193
|
+
const ok$3 = (value) => new Ok$3(value);
|
|
44194
|
+
const err$3 = (err2) => new Err$3(err2);
|
|
44233
44195
|
function resolvedPromiseLike$4(result) {
|
|
44234
44196
|
if (isPromiseLike$4(result)) {
|
|
44235
44197
|
return result.then((nextResult) => nextResult);
|
|
@@ -44372,6 +44334,15 @@
|
|
|
44372
44334
|
const requestedN = requested.split(".").map((s) => parseInt(s));
|
|
44373
44335
|
return providedN[0] === requestedN[0] && providedN[1] >= requestedN[1];
|
|
44374
44336
|
}
|
|
44337
|
+
function isUserVisibleError$3(error) {
|
|
44338
|
+
return error instanceof Error && "type" in error && error.type === "user-visible";
|
|
44339
|
+
}
|
|
44340
|
+
function logError$2(error) {
|
|
44341
|
+
if (isUserVisibleError$3(error)) {
|
|
44342
|
+
return;
|
|
44343
|
+
}
|
|
44344
|
+
console.error("OneStore Command threw an error that we did not expect", error);
|
|
44345
|
+
}
|
|
44375
44346
|
|
|
44376
44347
|
/*!
|
|
44377
44348
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44471,20 +44442,20 @@
|
|
|
44471
44442
|
const existingNormalizedData = (_a = cache.get(key)) == null ? void 0 : _a.value;
|
|
44472
44443
|
const normalized = this.normalizeData(cache, { ...input, existingNormalizedData });
|
|
44473
44444
|
if (normalized.isErr()) {
|
|
44474
|
-
return err$
|
|
44445
|
+
return err$3(normalized.error);
|
|
44475
44446
|
}
|
|
44476
44447
|
cache.set(key, {
|
|
44477
44448
|
value: normalized.value,
|
|
44478
44449
|
metadata: this.cacheMetadata
|
|
44479
44450
|
});
|
|
44480
|
-
return ok$
|
|
44451
|
+
return ok$3({
|
|
44481
44452
|
type: "link",
|
|
44482
44453
|
linkedKey: key
|
|
44483
44454
|
});
|
|
44484
44455
|
}
|
|
44485
44456
|
validateEntry(entry) {
|
|
44486
44457
|
if (!isCacheEntryForType(entry, this)) {
|
|
44487
|
-
return err$
|
|
44458
|
+
return err$3([
|
|
44488
44459
|
{
|
|
44489
44460
|
type: "incorrectType",
|
|
44490
44461
|
expectedType: this.typeName,
|
|
@@ -44492,7 +44463,7 @@
|
|
|
44492
44463
|
}
|
|
44493
44464
|
]);
|
|
44494
44465
|
}
|
|
44495
|
-
return ok$
|
|
44466
|
+
return ok$3(void 0);
|
|
44496
44467
|
}
|
|
44497
44468
|
query(cache, query) {
|
|
44498
44469
|
return this.read(cache, {
|
|
@@ -44510,12 +44481,12 @@
|
|
|
44510
44481
|
if (cacheEntry) {
|
|
44511
44482
|
const validationResult = this.validateEntry(cacheEntry);
|
|
44512
44483
|
if (validationResult.isErr()) {
|
|
44513
|
-
return err$
|
|
44484
|
+
return err$3([...validationResult.error]);
|
|
44514
44485
|
}
|
|
44515
44486
|
const normalizedData = cacheEntry.value;
|
|
44516
44487
|
return this.denormalizeData(cache, { ...input, normalizedData });
|
|
44517
44488
|
}
|
|
44518
|
-
return err$
|
|
44489
|
+
return err$3([this.buildMissingDataError()]);
|
|
44519
44490
|
}
|
|
44520
44491
|
equals(x, y) {
|
|
44521
44492
|
return deepEquals$2(x, y);
|
|
@@ -44538,9 +44509,375 @@
|
|
|
44538
44509
|
}
|
|
44539
44510
|
function buildReadWriteResult(data, errors) {
|
|
44540
44511
|
if (errors.length > 0) {
|
|
44541
|
-
return err$
|
|
44512
|
+
return err$3(errors);
|
|
44542
44513
|
}
|
|
44543
|
-
return ok$
|
|
44514
|
+
return ok$3(data);
|
|
44515
|
+
}
|
|
44516
|
+
|
|
44517
|
+
/*!
|
|
44518
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
44519
|
+
* All rights reserved.
|
|
44520
|
+
* For full license text, see the LICENSE.txt file
|
|
44521
|
+
*/
|
|
44522
|
+
let JsonSchemaViolationError$1 = class JsonSchemaViolationError extends Error {
|
|
44523
|
+
constructor(message, validationErrors) {
|
|
44524
|
+
super(message);
|
|
44525
|
+
this.validationErrors = [];
|
|
44526
|
+
this.validationErrors = validationErrors || [];
|
|
44527
|
+
}
|
|
44528
|
+
};
|
|
44529
|
+
let MinItemsViolationError$1 = class MinItemsViolationError extends JsonSchemaViolationError$1 {
|
|
44530
|
+
};
|
|
44531
|
+
let MaxItemsViolationError$1 = class MaxItemsViolationError extends JsonSchemaViolationError$1 {
|
|
44532
|
+
};
|
|
44533
|
+
let IncorrectTypeError$1 = class IncorrectTypeError extends JsonSchemaViolationError$1 {
|
|
44534
|
+
};
|
|
44535
|
+
let AdditionalPropertiesError$1 = class AdditionalPropertiesError extends JsonSchemaViolationError$1 {
|
|
44536
|
+
};
|
|
44537
|
+
let MissingRequiredPropertyError$1 = class MissingRequiredPropertyError extends JsonSchemaViolationError$1 {
|
|
44538
|
+
};
|
|
44539
|
+
let InvalidRefError$1 = class InvalidRefError extends JsonSchemaViolationError$1 {
|
|
44540
|
+
};
|
|
44541
|
+
let JsonSchemaErrorCollector$1 = class JsonSchemaErrorCollector {
|
|
44542
|
+
constructor() {
|
|
44543
|
+
this.errors = [];
|
|
44544
|
+
}
|
|
44545
|
+
add(error) {
|
|
44546
|
+
this.errors.push(error);
|
|
44547
|
+
}
|
|
44548
|
+
append(response) {
|
|
44549
|
+
if (response.isErr()) {
|
|
44550
|
+
this.errors.push(...response.error);
|
|
44551
|
+
}
|
|
44552
|
+
}
|
|
44553
|
+
hasErrors() {
|
|
44554
|
+
return this.errors.length > 0;
|
|
44555
|
+
}
|
|
44556
|
+
prepend(error) {
|
|
44557
|
+
this.errors.unshift(error);
|
|
44558
|
+
}
|
|
44559
|
+
toValidationResponse() {
|
|
44560
|
+
return !this.hasErrors() ? ok$3(true) : err$3(this.errors);
|
|
44561
|
+
}
|
|
44562
|
+
};
|
|
44563
|
+
function createThrowableError$1(errors) {
|
|
44564
|
+
if (errors[0] instanceof MinItemsViolationError$1) {
|
|
44565
|
+
return new MinItemsViolationError$1(errors[0].message, errors);
|
|
44566
|
+
}
|
|
44567
|
+
if (errors[0] instanceof MaxItemsViolationError$1) {
|
|
44568
|
+
return new MaxItemsViolationError$1(errors[0].message, errors);
|
|
44569
|
+
}
|
|
44570
|
+
if (errors[0] instanceof IncorrectTypeError$1) {
|
|
44571
|
+
return new IncorrectTypeError$1(errors[0].message, errors);
|
|
44572
|
+
}
|
|
44573
|
+
if (errors[0] instanceof AdditionalPropertiesError$1) {
|
|
44574
|
+
return new AdditionalPropertiesError$1(errors[0].message, errors);
|
|
44575
|
+
}
|
|
44576
|
+
if (errors[0] instanceof MissingRequiredPropertyError$1) {
|
|
44577
|
+
return new MissingRequiredPropertyError$1(errors[0].message, errors);
|
|
44578
|
+
}
|
|
44579
|
+
if (errors[0] instanceof InvalidRefError$1) {
|
|
44580
|
+
return new InvalidRefError$1(errors[0].message, errors);
|
|
44581
|
+
}
|
|
44582
|
+
return new JsonSchemaViolationError$1(errors[0].message, errors);
|
|
44583
|
+
}
|
|
44584
|
+
function assertIsValid$1(data, schema) {
|
|
44585
|
+
const validationResponse = validateJsonSchema$1(data, schema);
|
|
44586
|
+
if (validationResponse.isErr()) {
|
|
44587
|
+
throw createThrowableError$1(validationResponse.error);
|
|
44588
|
+
}
|
|
44589
|
+
}
|
|
44590
|
+
function incorrectTypeError$1(expected, actual, path) {
|
|
44591
|
+
return new IncorrectTypeError$1(
|
|
44592
|
+
`Expected type ${expected} at path '${path}', found type ${actual}.`
|
|
44593
|
+
);
|
|
44594
|
+
}
|
|
44595
|
+
function validSchemaResponse$1() {
|
|
44596
|
+
return ok$3(true);
|
|
44597
|
+
}
|
|
44598
|
+
function invalidSchemaResponseWithError$1(error) {
|
|
44599
|
+
return err$3([error]);
|
|
44600
|
+
}
|
|
44601
|
+
function validateJsonSchema$1(data, schema, path = "$", document = schema) {
|
|
44602
|
+
if (schema === true) return validSchemaResponse$1();
|
|
44603
|
+
if (schema === false)
|
|
44604
|
+
return invalidSchemaResponseWithError$1(
|
|
44605
|
+
new JsonSchemaViolationError$1(`Data at ${path} has schema 'false'`)
|
|
44606
|
+
);
|
|
44607
|
+
const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
|
|
44608
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44609
|
+
if ("anyOf" in schema) {
|
|
44610
|
+
errorCollector.append(validateAnyOf$1(data, schema, path, document));
|
|
44611
|
+
} else if ("oneOf" in schema) {
|
|
44612
|
+
errorCollector.append(validateOneOf$1(data, schema, path, document));
|
|
44613
|
+
} else if ("allOf" in schema) {
|
|
44614
|
+
errorCollector.append(validateAllOf$1(data, schema, path, document));
|
|
44615
|
+
} else if ("not" in schema) {
|
|
44616
|
+
errorCollector.append(validateNot$1(data, schema, path, document));
|
|
44617
|
+
} else if ("$ref" in schema) {
|
|
44618
|
+
errorCollector.append(validateRef$1(data, schema, path, document));
|
|
44619
|
+
} else if ("type" in schema) {
|
|
44620
|
+
if (schema.type === "object") {
|
|
44621
|
+
if (dataType !== "object") {
|
|
44622
|
+
errorCollector.add(incorrectTypeError$1("object", dataType, path));
|
|
44623
|
+
} else {
|
|
44624
|
+
errorCollector.append(
|
|
44625
|
+
validateObject$1(data, schema, path, document)
|
|
44626
|
+
);
|
|
44627
|
+
}
|
|
44628
|
+
} else if (schema.type === "array") {
|
|
44629
|
+
if (dataType !== "array") {
|
|
44630
|
+
errorCollector.add(incorrectTypeError$1("array", dataType, path));
|
|
44631
|
+
} else {
|
|
44632
|
+
errorCollector.append(
|
|
44633
|
+
validateArray$1(data, schema, path, document)
|
|
44634
|
+
);
|
|
44635
|
+
}
|
|
44636
|
+
} else {
|
|
44637
|
+
errorCollector.append(
|
|
44638
|
+
validateScalar$1(data, schema, path)
|
|
44639
|
+
);
|
|
44640
|
+
}
|
|
44641
|
+
}
|
|
44642
|
+
if (schema.enum) {
|
|
44643
|
+
errorCollector.append(validateEnum$1(data, schema.enum, path));
|
|
44644
|
+
}
|
|
44645
|
+
if (schema.const) {
|
|
44646
|
+
errorCollector.append(validateConst$1(data, schema.const, path));
|
|
44647
|
+
}
|
|
44648
|
+
return errorCollector.toValidationResponse();
|
|
44649
|
+
}
|
|
44650
|
+
function validateAnyOf$1(data, schema, path, document) {
|
|
44651
|
+
let isValid = false;
|
|
44652
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44653
|
+
for (let i = 0, { length } = schema.anyOf; i < length; i++) {
|
|
44654
|
+
const element = schema.anyOf[i];
|
|
44655
|
+
const validationResponse = validateJsonSchema$1(
|
|
44656
|
+
data,
|
|
44657
|
+
element,
|
|
44658
|
+
`${path}.anyOf[${i}]`,
|
|
44659
|
+
document
|
|
44660
|
+
);
|
|
44661
|
+
if (validationResponse.isOk()) {
|
|
44662
|
+
isValid = true;
|
|
44663
|
+
break;
|
|
44664
|
+
} else {
|
|
44665
|
+
errorCollector.append(validationResponse);
|
|
44666
|
+
}
|
|
44667
|
+
}
|
|
44668
|
+
if (!isValid) {
|
|
44669
|
+
errorCollector.prepend(
|
|
44670
|
+
new JsonSchemaViolationError$1(`Data at ${path} did not match any subschema in anyOf.`)
|
|
44671
|
+
);
|
|
44672
|
+
return errorCollector.toValidationResponse();
|
|
44673
|
+
}
|
|
44674
|
+
return validSchemaResponse$1();
|
|
44675
|
+
}
|
|
44676
|
+
function validateOneOf$1(data, schema, path, document) {
|
|
44677
|
+
let validSubShemaPaths = [];
|
|
44678
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44679
|
+
for (let i = 0, { length } = schema.oneOf; i < length; i++) {
|
|
44680
|
+
const element = schema.oneOf[i];
|
|
44681
|
+
const oneOfPath = `${path}.oneOf[${i}]`;
|
|
44682
|
+
const validationResponse = validateJsonSchema$1(data, element, oneOfPath, document);
|
|
44683
|
+
if (validationResponse.isOk()) {
|
|
44684
|
+
validSubShemaPaths.push(oneOfPath);
|
|
44685
|
+
} else {
|
|
44686
|
+
errorCollector.append(validationResponse);
|
|
44687
|
+
}
|
|
44688
|
+
}
|
|
44689
|
+
if (validSubShemaPaths.length === 0) {
|
|
44690
|
+
errorCollector.prepend(
|
|
44691
|
+
new JsonSchemaViolationError$1(`Data at ${path} did not match any subschema in oneOf.`)
|
|
44692
|
+
);
|
|
44693
|
+
return errorCollector.toValidationResponse();
|
|
44694
|
+
} else if (validSubShemaPaths.length > 1) {
|
|
44695
|
+
errorCollector.prepend(
|
|
44696
|
+
new JsonSchemaViolationError$1(
|
|
44697
|
+
`Data at ${path} matched multiple subschemas: [${validSubShemaPaths.join(", ")}].`
|
|
44698
|
+
)
|
|
44699
|
+
);
|
|
44700
|
+
return errorCollector.toValidationResponse();
|
|
44701
|
+
}
|
|
44702
|
+
return validSchemaResponse$1();
|
|
44703
|
+
}
|
|
44704
|
+
function validateAllOf$1(data, schema, path, document) {
|
|
44705
|
+
let isValid = true;
|
|
44706
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44707
|
+
for (let i = 0, { length } = schema.allOf; i < length; i++) {
|
|
44708
|
+
const element = schema.allOf[i];
|
|
44709
|
+
const validationResponse = validateJsonSchema$1(
|
|
44710
|
+
data,
|
|
44711
|
+
element,
|
|
44712
|
+
`${path}.allOf[${i}]`,
|
|
44713
|
+
document
|
|
44714
|
+
);
|
|
44715
|
+
if (!validationResponse.isOk()) {
|
|
44716
|
+
errorCollector.append(validationResponse);
|
|
44717
|
+
isValid = false;
|
|
44718
|
+
}
|
|
44719
|
+
}
|
|
44720
|
+
if (!isValid) {
|
|
44721
|
+
errorCollector.prepend(
|
|
44722
|
+
new JsonSchemaViolationError$1(`Data at ${path} did not match some subschemas in allOf.`)
|
|
44723
|
+
);
|
|
44724
|
+
}
|
|
44725
|
+
return errorCollector.toValidationResponse();
|
|
44726
|
+
}
|
|
44727
|
+
function validateNot$1(data, schema, path, document) {
|
|
44728
|
+
const validationResponse = validateJsonSchema$1(data, schema.not, path, document);
|
|
44729
|
+
if (validationResponse.isOk()) {
|
|
44730
|
+
return invalidSchemaResponseWithError$1(
|
|
44731
|
+
new JsonSchemaViolationError$1(
|
|
44732
|
+
`Data at ${path} validated against the schema of a not clause.`
|
|
44733
|
+
)
|
|
44734
|
+
);
|
|
44735
|
+
}
|
|
44736
|
+
return validSchemaResponse$1();
|
|
44737
|
+
}
|
|
44738
|
+
function validateObject$1(data, schema, path, document) {
|
|
44739
|
+
const schemaKeys = Object.keys(schema.properties);
|
|
44740
|
+
const requiredKeys = new Set(schema.required);
|
|
44741
|
+
const schemaKeySet = new Set(schemaKeys);
|
|
44742
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44743
|
+
Object.keys(data).forEach((key) => {
|
|
44744
|
+
if (!schemaKeySet.has(key)) {
|
|
44745
|
+
errorCollector.append(
|
|
44746
|
+
validateJsonSchema$1(
|
|
44747
|
+
data[key],
|
|
44748
|
+
schema.additionalProperties,
|
|
44749
|
+
`${path}.additionalProperties[${key}]`,
|
|
44750
|
+
document
|
|
44751
|
+
)
|
|
44752
|
+
);
|
|
44753
|
+
}
|
|
44754
|
+
});
|
|
44755
|
+
for (let i = 0, length = schemaKeys.length; i < length; i++) {
|
|
44756
|
+
const key = schemaKeys[i];
|
|
44757
|
+
const keyInData = key in data && data[key] !== void 0;
|
|
44758
|
+
if (requiredKeys.has(key) && !keyInData) {
|
|
44759
|
+
errorCollector.add(
|
|
44760
|
+
new MissingRequiredPropertyError$1(
|
|
44761
|
+
`Object at path '${path}' is missing required property '${key}'.`
|
|
44762
|
+
)
|
|
44763
|
+
);
|
|
44764
|
+
}
|
|
44765
|
+
if (keyInData) {
|
|
44766
|
+
errorCollector.append(
|
|
44767
|
+
validateJsonSchema$1(
|
|
44768
|
+
data[key],
|
|
44769
|
+
schema.properties[key],
|
|
44770
|
+
`${path}.${key}`,
|
|
44771
|
+
document
|
|
44772
|
+
)
|
|
44773
|
+
);
|
|
44774
|
+
}
|
|
44775
|
+
}
|
|
44776
|
+
return errorCollector.toValidationResponse();
|
|
44777
|
+
}
|
|
44778
|
+
function validateArray$1(data, schema, path, document) {
|
|
44779
|
+
if (schema.minItems !== void 0 && data.length < schema.minItems) {
|
|
44780
|
+
return invalidSchemaResponseWithError$1(
|
|
44781
|
+
new MinItemsViolationError$1(
|
|
44782
|
+
`Array at path '${path}' fails minItems constraint. Has ${data.length} items, needs at least ${schema.minItems}.`
|
|
44783
|
+
)
|
|
44784
|
+
);
|
|
44785
|
+
}
|
|
44786
|
+
if (schema.maxItems !== void 0 && data.length > schema.maxItems) {
|
|
44787
|
+
return invalidSchemaResponseWithError$1(
|
|
44788
|
+
new MaxItemsViolationError$1(
|
|
44789
|
+
`Array at path '${path}' fails maxItems constraint. Has ${data.length} items, needs at most ${schema.maxItems}.`
|
|
44790
|
+
)
|
|
44791
|
+
);
|
|
44792
|
+
}
|
|
44793
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44794
|
+
data.forEach(
|
|
44795
|
+
(element, index) => errorCollector.append(
|
|
44796
|
+
validateJsonSchema$1(element, schema.items, `${path}[${index}]`, document)
|
|
44797
|
+
)
|
|
44798
|
+
);
|
|
44799
|
+
return errorCollector.toValidationResponse();
|
|
44800
|
+
}
|
|
44801
|
+
function validateScalar$1(data, schema, path) {
|
|
44802
|
+
const schemaDataType = schema.type;
|
|
44803
|
+
const dataType = typeof data;
|
|
44804
|
+
if (schemaDataType === "integer") {
|
|
44805
|
+
if (dataType !== "number" || !Number.isInteger(data)) {
|
|
44806
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("integer", dataType, path));
|
|
44807
|
+
}
|
|
44808
|
+
} else if (schemaDataType === "number") {
|
|
44809
|
+
if (dataType !== "number") {
|
|
44810
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("number", dataType, path));
|
|
44811
|
+
}
|
|
44812
|
+
} else if (schemaDataType === "string") {
|
|
44813
|
+
if (dataType !== "string") {
|
|
44814
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("string", dataType, path));
|
|
44815
|
+
}
|
|
44816
|
+
} else if (schemaDataType === "boolean") {
|
|
44817
|
+
if (dataType !== "boolean") {
|
|
44818
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("boolean", dataType, path));
|
|
44819
|
+
}
|
|
44820
|
+
} else if (schemaDataType === "null") {
|
|
44821
|
+
if (data !== null) {
|
|
44822
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("null", dataType, path));
|
|
44823
|
+
}
|
|
44824
|
+
} else {
|
|
44825
|
+
return invalidSchemaResponseWithError$1(
|
|
44826
|
+
new IncorrectTypeError$1(`Unknown schema data type: ${schemaDataType}.`)
|
|
44827
|
+
);
|
|
44828
|
+
}
|
|
44829
|
+
return validSchemaResponse$1();
|
|
44830
|
+
}
|
|
44831
|
+
function validateRef$1(data, schema, path, document) {
|
|
44832
|
+
if (!schema.$ref.startsWith("#")) {
|
|
44833
|
+
return invalidSchemaResponseWithError$1(
|
|
44834
|
+
new InvalidRefError$1(
|
|
44835
|
+
`$ref values that do not refer to the current document are unsupported (must start with '#')`
|
|
44836
|
+
)
|
|
44837
|
+
);
|
|
44838
|
+
}
|
|
44839
|
+
try {
|
|
44840
|
+
const schemaToValidate = findSchemaAtPath$1(document, schema.$ref);
|
|
44841
|
+
return validateJsonSchema$1(data, schemaToValidate, path, document);
|
|
44842
|
+
} catch (e) {
|
|
44843
|
+
return invalidSchemaResponseWithError$1(e);
|
|
44844
|
+
}
|
|
44845
|
+
}
|
|
44846
|
+
function validateEnum$1(data, enumValue, path) {
|
|
44847
|
+
if (!enumValue.some((value) => deepEquals$2(value, data))) {
|
|
44848
|
+
return invalidSchemaResponseWithError$1(
|
|
44849
|
+
new JsonSchemaViolationError$1(
|
|
44850
|
+
`Data at ${path} did not match any values in enum. Expected value in: [${enumValue.map((value) => stringify$9(value)).join()}]`
|
|
44851
|
+
)
|
|
44852
|
+
);
|
|
44853
|
+
}
|
|
44854
|
+
return validSchemaResponse$1();
|
|
44855
|
+
}
|
|
44856
|
+
function validateConst$1(data, constValue, path) {
|
|
44857
|
+
if (!deepEquals$2(constValue, data)) {
|
|
44858
|
+
return invalidSchemaResponseWithError$1(
|
|
44859
|
+
new JsonSchemaViolationError$1(
|
|
44860
|
+
`Data at ${path} did not match const. Expected: ${stringify$9(constValue)}`
|
|
44861
|
+
)
|
|
44862
|
+
);
|
|
44863
|
+
}
|
|
44864
|
+
return validSchemaResponse$1();
|
|
44865
|
+
}
|
|
44866
|
+
function findSchemaAtPath$1(document, ref) {
|
|
44867
|
+
if (ref === "#") return document;
|
|
44868
|
+
const keys = ref.replace(/^#\//, "").split("/");
|
|
44869
|
+
let current = document;
|
|
44870
|
+
let path = "#";
|
|
44871
|
+
for (const key of keys) {
|
|
44872
|
+
path = `${path}/${key}`;
|
|
44873
|
+
if (current[key] === void 0) {
|
|
44874
|
+
throw new InvalidRefError$1(
|
|
44875
|
+
`Invalid $ref value '${ref}'. Cannot find target schema at '${path}'`
|
|
44876
|
+
);
|
|
44877
|
+
}
|
|
44878
|
+
current = current[key];
|
|
44879
|
+
}
|
|
44880
|
+
return current;
|
|
44544
44881
|
}
|
|
44545
44882
|
|
|
44546
44883
|
/*!
|
|
@@ -45387,35 +45724,6 @@
|
|
|
45387
45724
|
}
|
|
45388
45725
|
return referenceMap.get(astReference);
|
|
45389
45726
|
};
|
|
45390
|
-
/*!
|
|
45391
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
45392
|
-
* All rights reserved.
|
|
45393
|
-
* For full license text, see the LICENSE.txt file
|
|
45394
|
-
*/
|
|
45395
|
-
let Ok$3 = class Ok {
|
|
45396
|
-
constructor(value) {
|
|
45397
|
-
this.value = value;
|
|
45398
|
-
}
|
|
45399
|
-
isOk() {
|
|
45400
|
-
return true;
|
|
45401
|
-
}
|
|
45402
|
-
isErr() {
|
|
45403
|
-
return !this.isOk();
|
|
45404
|
-
}
|
|
45405
|
-
};
|
|
45406
|
-
let Err$3 = class Err {
|
|
45407
|
-
constructor(error) {
|
|
45408
|
-
this.error = error;
|
|
45409
|
-
}
|
|
45410
|
-
isOk() {
|
|
45411
|
-
return false;
|
|
45412
|
-
}
|
|
45413
|
-
isErr() {
|
|
45414
|
-
return !this.isOk();
|
|
45415
|
-
}
|
|
45416
|
-
};
|
|
45417
|
-
const ok$3 = (value) => new Ok$3(value);
|
|
45418
|
-
const err$3 = (err2) => new Err$3(err2);
|
|
45419
45727
|
function findExecutableOperation$2(document, operationName) {
|
|
45420
45728
|
const operations = document.definitions.filter(
|
|
45421
45729
|
(def) => def.kind === Kind$1.OPERATION_DEFINITION
|
|
@@ -45466,6 +45774,14 @@
|
|
|
45466
45774
|
query: result.value
|
|
45467
45775
|
});
|
|
45468
45776
|
}
|
|
45777
|
+
function toGraphQLErrorResponse(error) {
|
|
45778
|
+
logError$2(error);
|
|
45779
|
+
const message = error instanceof JsonSchemaViolationError$1 ? `Invalid GraphQL config: ${error.message}` : "Internal error in GraphQL adapter occurred";
|
|
45780
|
+
return {
|
|
45781
|
+
data: void 0,
|
|
45782
|
+
errors: [{ message, locations: [] }]
|
|
45783
|
+
};
|
|
45784
|
+
}
|
|
45469
45785
|
function resolveAndValidateGraphQLDocument(query, operationName, options) {
|
|
45470
45786
|
const resolved = resolveAst(query);
|
|
45471
45787
|
if (resolved === void 0) {
|
|
@@ -51204,7 +51520,6 @@
|
|
|
51204
51520
|
const key = keyBuilder$1M(luvio, createResourceParams$g(config));
|
|
51205
51521
|
const allTrackedFields = getTrackedFields(key, luvio.getNode(key), {
|
|
51206
51522
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
51207
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
51208
51523
|
}, config.optionalFields);
|
|
51209
51524
|
const optionalFields = fields === undefined ? allTrackedFields : difference(allTrackedFields, fields);
|
|
51210
51525
|
const resourceParams = createResourceParams$g({
|
|
@@ -51331,7 +51646,6 @@
|
|
|
51331
51646
|
};
|
|
51332
51647
|
const childTrackedFields = getTrackedFields(childKey, luvio.getNode(childKey), {
|
|
51333
51648
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
51334
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
51335
51649
|
}, childResourceParams.queryParams.optionalFields);
|
|
51336
51650
|
const childSnapshot = ingestSuccess$8(luvio, {
|
|
51337
51651
|
recordId: childResourceParams.urlParams.recordId,
|
|
@@ -56301,7 +56615,6 @@
|
|
|
56301
56615
|
const key = keyBuilder$1w$1(luvio, config);
|
|
56302
56616
|
const trackedFieldsConfig = {
|
|
56303
56617
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
56304
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
56305
56618
|
};
|
|
56306
56619
|
const optionalFieldsTrie = convertFieldsToTrie(getTrackedFields(key, luvio.getNode(key), trackedFieldsConfig, config.optionalFields));
|
|
56307
56620
|
const fieldsTrie = BLANK_RECORD_FIELDS_TRIE;
|
|
@@ -60173,7 +60486,6 @@
|
|
|
60173
60486
|
...resourceRequest.queryParams,
|
|
60174
60487
|
optionalFields: getTrackedFields(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
60175
60488
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
60176
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
60177
60489
|
}, config.optionalFields),
|
|
60178
60490
|
},
|
|
60179
60491
|
});
|
|
@@ -60725,7 +61037,6 @@
|
|
|
60725
61037
|
...resourceRequest.queryParams,
|
|
60726
61038
|
optionalFields: getTrackedFields(recordTemplateKey, luvio.getNode(recordTemplateKey), {
|
|
60727
61039
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
60728
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
60729
61040
|
}, config.optionalFields),
|
|
60730
61041
|
},
|
|
60731
61042
|
});
|
|
@@ -60745,7 +61056,6 @@
|
|
|
60745
61056
|
});
|
|
60746
61057
|
const allTrackedFields = getTrackedFields(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
60747
61058
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
60748
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
60749
61059
|
}, optionalFields);
|
|
60750
61060
|
const allTrackedFieldsTrie = convertFieldsToTrie(allTrackedFields, true);
|
|
60751
61061
|
const ingest = createFieldsIngestSuccess({
|
|
@@ -80509,6 +80819,7 @@
|
|
|
80509
80819
|
}
|
|
80510
80820
|
async buildPendingAction(request, queue) {
|
|
80511
80821
|
this.resolveResourceRequestBody(request.body);
|
|
80822
|
+
// eslint-disable-next-line no-return-await
|
|
80512
80823
|
return await super.buildPendingAction(request, queue);
|
|
80513
80824
|
}
|
|
80514
80825
|
resolveResourceRequestBody(body) {
|
|
@@ -80941,8 +81252,6 @@
|
|
|
80941
81252
|
return customEvent.namespace === CONTENT_DOCUMENT_AND_VERSION_NAMESPACE;
|
|
80942
81253
|
}
|
|
80943
81254
|
|
|
80944
|
-
// so eslint doesn't complain about nimbus
|
|
80945
|
-
/* global __nimbus */
|
|
80946
81255
|
function chunkToBase64(chunk) {
|
|
80947
81256
|
const bytes = new Uint8Array(chunk);
|
|
80948
81257
|
const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
|
|
@@ -87022,6 +87331,7 @@
|
|
|
87022
87331
|
const parentObjectInfo = objectInfos[parentObjectApiNames[0]];
|
|
87023
87332
|
// this should not be undefined, but lets catch it if we do end up in that state.
|
|
87024
87333
|
if (parentObjectInfo === undefined) {
|
|
87334
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
87025
87335
|
throw new Error(`ObjectInfo is missing for ${parentObjectApiNames[0]} for ${parentApiPath}`);
|
|
87026
87336
|
}
|
|
87027
87337
|
const relationshipField = referenceIdFieldForRelationship(lastSegment);
|
|
@@ -88394,6 +88704,7 @@
|
|
|
88394
88704
|
}
|
|
88395
88705
|
const query = data.uiapi.query;
|
|
88396
88706
|
// Check all entity types in the query for edges - using for...in to avoid array allocation
|
|
88707
|
+
// eslint-disable-next-line guard-for-in
|
|
88397
88708
|
for (const entityType in query) {
|
|
88398
88709
|
const entity = query[entityType];
|
|
88399
88710
|
if (entity && entity.edges && isArray$3$1(entity.edges) && entity.edges.length > 0) {
|
|
@@ -90315,7 +90626,9 @@
|
|
|
90315
90626
|
}
|
|
90316
90627
|
instrumentation$2$1.trackValue(GRAPHQL_QUERY_ROOT_METRIC_NAME, row[1].length);
|
|
90317
90628
|
}
|
|
90318
|
-
catch {
|
|
90629
|
+
catch {
|
|
90630
|
+
// intentionally do nothing
|
|
90631
|
+
}
|
|
90319
90632
|
}
|
|
90320
90633
|
}
|
|
90321
90634
|
|
|
@@ -91024,6 +91337,7 @@
|
|
|
91024
91337
|
const userData = {
|
|
91025
91338
|
...stats,
|
|
91026
91339
|
};
|
|
91340
|
+
// eslint-disable-next-line guard-for-in
|
|
91027
91341
|
for (const error in errors) {
|
|
91028
91342
|
activity.error(error);
|
|
91029
91343
|
}
|
|
@@ -91204,6 +91518,7 @@
|
|
|
91204
91518
|
let limitedResult = this.applyRetryLimits(result.additionalWork);
|
|
91205
91519
|
this.enqueue(limitedResult.additionalWork);
|
|
91206
91520
|
if (limitedResult.recordsNeedingRefetch.size > 0) {
|
|
91521
|
+
// eslint-disable-next-line guard-for-in
|
|
91207
91522
|
for (const key in keys$3(limitedResult.recordsNeedingRefetch)) {
|
|
91208
91523
|
const value = limitedResult.recordsNeedingRefetch.get(key);
|
|
91209
91524
|
if (result.recordsNeedingRefetch.has(key)) {
|
|
@@ -93469,6 +93784,7 @@
|
|
|
93469
93784
|
async exists(key) {
|
|
93470
93785
|
const result = await this.durableStore.query('SELECT EXISTS(SELECT 1 FROM lds_data WHERE key = ?)', [key]);
|
|
93471
93786
|
const exists = result.rows[0][0];
|
|
93787
|
+
// eslint-disable-next-line eqeqeq
|
|
93472
93788
|
return exists == true;
|
|
93473
93789
|
}
|
|
93474
93790
|
async getRecord(key) {
|
|
@@ -93683,7 +93999,7 @@
|
|
|
93683
93999
|
CounterResult["Error"] = "Error";
|
|
93684
94000
|
})(CounterResult || (CounterResult = {}));
|
|
93685
94001
|
function incrementCounter(name, result) {
|
|
93686
|
-
instrumentation$4.incrementCounter('SFSSideEffect', 1, result
|
|
94002
|
+
instrumentation$4.incrementCounter('SFSSideEffect', 1, result === CounterResult.Error, {
|
|
93687
94003
|
Name: name,
|
|
93688
94004
|
Result: result,
|
|
93689
94005
|
});
|
|
@@ -96255,7 +96571,7 @@
|
|
|
96255
96571
|
},
|
|
96256
96572
|
};
|
|
96257
96573
|
}
|
|
96258
|
-
// version: 1.
|
|
96574
|
+
// version: 1.434.0-6aa2dd15e3
|
|
96259
96575
|
|
|
96260
96576
|
/**
|
|
96261
96577
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -96281,7 +96597,7 @@
|
|
|
96281
96597
|
},
|
|
96282
96598
|
};
|
|
96283
96599
|
}
|
|
96284
|
-
// version: 1.
|
|
96600
|
+
// version: 1.434.0-6aa2dd15e3
|
|
96285
96601
|
|
|
96286
96602
|
/*!
|
|
96287
96603
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -96686,26 +97002,26 @@
|
|
|
96686
97002
|
* All rights reserved.
|
|
96687
97003
|
* For full license text, see the LICENSE.txt file
|
|
96688
97004
|
*/
|
|
96689
|
-
|
|
97005
|
+
class JsonSchemaViolationError extends Error {
|
|
96690
97006
|
constructor(message, validationErrors) {
|
|
96691
97007
|
super(message);
|
|
96692
97008
|
this.validationErrors = [];
|
|
96693
97009
|
this.validationErrors = validationErrors || [];
|
|
96694
97010
|
}
|
|
96695
|
-
}
|
|
96696
|
-
|
|
96697
|
-
}
|
|
96698
|
-
|
|
96699
|
-
}
|
|
96700
|
-
|
|
96701
|
-
}
|
|
96702
|
-
|
|
96703
|
-
}
|
|
96704
|
-
|
|
96705
|
-
}
|
|
96706
|
-
|
|
96707
|
-
}
|
|
96708
|
-
|
|
97011
|
+
}
|
|
97012
|
+
class MinItemsViolationError extends JsonSchemaViolationError {
|
|
97013
|
+
}
|
|
97014
|
+
class MaxItemsViolationError extends JsonSchemaViolationError {
|
|
97015
|
+
}
|
|
97016
|
+
class IncorrectTypeError extends JsonSchemaViolationError {
|
|
97017
|
+
}
|
|
97018
|
+
class AdditionalPropertiesError extends JsonSchemaViolationError {
|
|
97019
|
+
}
|
|
97020
|
+
class MissingRequiredPropertyError extends JsonSchemaViolationError {
|
|
97021
|
+
}
|
|
97022
|
+
class InvalidRefError extends JsonSchemaViolationError {
|
|
97023
|
+
}
|
|
97024
|
+
class JsonSchemaErrorCollector {
|
|
96709
97025
|
constructor() {
|
|
96710
97026
|
this.errors = [];
|
|
96711
97027
|
}
|
|
@@ -96726,100 +97042,100 @@
|
|
|
96726
97042
|
toValidationResponse() {
|
|
96727
97043
|
return !this.hasErrors() ? ok$1(true) : err$1(this.errors);
|
|
96728
97044
|
}
|
|
96729
|
-
}
|
|
96730
|
-
function createThrowableError
|
|
96731
|
-
if (errors[0] instanceof MinItemsViolationError
|
|
96732
|
-
return new MinItemsViolationError
|
|
97045
|
+
}
|
|
97046
|
+
function createThrowableError(errors) {
|
|
97047
|
+
if (errors[0] instanceof MinItemsViolationError) {
|
|
97048
|
+
return new MinItemsViolationError(errors[0].message, errors);
|
|
96733
97049
|
}
|
|
96734
|
-
if (errors[0] instanceof MaxItemsViolationError
|
|
96735
|
-
return new MaxItemsViolationError
|
|
97050
|
+
if (errors[0] instanceof MaxItemsViolationError) {
|
|
97051
|
+
return new MaxItemsViolationError(errors[0].message, errors);
|
|
96736
97052
|
}
|
|
96737
|
-
if (errors[0] instanceof IncorrectTypeError
|
|
96738
|
-
return new IncorrectTypeError
|
|
97053
|
+
if (errors[0] instanceof IncorrectTypeError) {
|
|
97054
|
+
return new IncorrectTypeError(errors[0].message, errors);
|
|
96739
97055
|
}
|
|
96740
|
-
if (errors[0] instanceof AdditionalPropertiesError
|
|
96741
|
-
return new AdditionalPropertiesError
|
|
97056
|
+
if (errors[0] instanceof AdditionalPropertiesError) {
|
|
97057
|
+
return new AdditionalPropertiesError(errors[0].message, errors);
|
|
96742
97058
|
}
|
|
96743
|
-
if (errors[0] instanceof MissingRequiredPropertyError
|
|
96744
|
-
return new MissingRequiredPropertyError
|
|
97059
|
+
if (errors[0] instanceof MissingRequiredPropertyError) {
|
|
97060
|
+
return new MissingRequiredPropertyError(errors[0].message, errors);
|
|
96745
97061
|
}
|
|
96746
|
-
if (errors[0] instanceof InvalidRefError
|
|
96747
|
-
return new InvalidRefError
|
|
97062
|
+
if (errors[0] instanceof InvalidRefError) {
|
|
97063
|
+
return new InvalidRefError(errors[0].message, errors);
|
|
96748
97064
|
}
|
|
96749
|
-
return new JsonSchemaViolationError
|
|
97065
|
+
return new JsonSchemaViolationError(errors[0].message, errors);
|
|
96750
97066
|
}
|
|
96751
|
-
function assertIsValid
|
|
96752
|
-
const validationResponse = validateJsonSchema
|
|
97067
|
+
function assertIsValid(data, schema) {
|
|
97068
|
+
const validationResponse = validateJsonSchema(data, schema);
|
|
96753
97069
|
if (validationResponse.isErr()) {
|
|
96754
|
-
throw createThrowableError
|
|
97070
|
+
throw createThrowableError(validationResponse.error);
|
|
96755
97071
|
}
|
|
96756
97072
|
}
|
|
96757
|
-
function incorrectTypeError
|
|
96758
|
-
return new IncorrectTypeError
|
|
97073
|
+
function incorrectTypeError(expected, actual, path) {
|
|
97074
|
+
return new IncorrectTypeError(
|
|
96759
97075
|
`Expected type ${expected} at path '${path}', found type ${actual}.`
|
|
96760
97076
|
);
|
|
96761
97077
|
}
|
|
96762
|
-
function validSchemaResponse
|
|
97078
|
+
function validSchemaResponse() {
|
|
96763
97079
|
return ok$1(true);
|
|
96764
97080
|
}
|
|
96765
|
-
function invalidSchemaResponseWithError
|
|
97081
|
+
function invalidSchemaResponseWithError(error) {
|
|
96766
97082
|
return err$1([error]);
|
|
96767
97083
|
}
|
|
96768
|
-
function validateJsonSchema
|
|
96769
|
-
if (schema === true) return validSchemaResponse
|
|
97084
|
+
function validateJsonSchema(data, schema, path = "$", document = schema) {
|
|
97085
|
+
if (schema === true) return validSchemaResponse();
|
|
96770
97086
|
if (schema === false)
|
|
96771
|
-
return invalidSchemaResponseWithError
|
|
96772
|
-
new JsonSchemaViolationError
|
|
97087
|
+
return invalidSchemaResponseWithError(
|
|
97088
|
+
new JsonSchemaViolationError(`Data at ${path} has schema 'false'`)
|
|
96773
97089
|
);
|
|
96774
97090
|
const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
|
|
96775
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97091
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96776
97092
|
if ("anyOf" in schema) {
|
|
96777
|
-
errorCollector.append(validateAnyOf
|
|
97093
|
+
errorCollector.append(validateAnyOf(data, schema, path, document));
|
|
96778
97094
|
} else if ("oneOf" in schema) {
|
|
96779
|
-
errorCollector.append(validateOneOf
|
|
97095
|
+
errorCollector.append(validateOneOf(data, schema, path, document));
|
|
96780
97096
|
} else if ("allOf" in schema) {
|
|
96781
|
-
errorCollector.append(validateAllOf
|
|
97097
|
+
errorCollector.append(validateAllOf(data, schema, path, document));
|
|
96782
97098
|
} else if ("not" in schema) {
|
|
96783
|
-
errorCollector.append(validateNot
|
|
97099
|
+
errorCollector.append(validateNot(data, schema, path, document));
|
|
96784
97100
|
} else if ("$ref" in schema) {
|
|
96785
|
-
errorCollector.append(validateRef
|
|
97101
|
+
errorCollector.append(validateRef(data, schema, path, document));
|
|
96786
97102
|
} else if ("type" in schema) {
|
|
96787
97103
|
if (schema.type === "object") {
|
|
96788
97104
|
if (dataType !== "object") {
|
|
96789
|
-
errorCollector.add(incorrectTypeError
|
|
97105
|
+
errorCollector.add(incorrectTypeError("object", dataType, path));
|
|
96790
97106
|
} else {
|
|
96791
97107
|
errorCollector.append(
|
|
96792
|
-
validateObject
|
|
97108
|
+
validateObject(data, schema, path, document)
|
|
96793
97109
|
);
|
|
96794
97110
|
}
|
|
96795
97111
|
} else if (schema.type === "array") {
|
|
96796
97112
|
if (dataType !== "array") {
|
|
96797
|
-
errorCollector.add(incorrectTypeError
|
|
97113
|
+
errorCollector.add(incorrectTypeError("array", dataType, path));
|
|
96798
97114
|
} else {
|
|
96799
97115
|
errorCollector.append(
|
|
96800
|
-
validateArray
|
|
97116
|
+
validateArray(data, schema, path, document)
|
|
96801
97117
|
);
|
|
96802
97118
|
}
|
|
96803
97119
|
} else {
|
|
96804
97120
|
errorCollector.append(
|
|
96805
|
-
validateScalar
|
|
97121
|
+
validateScalar(data, schema, path)
|
|
96806
97122
|
);
|
|
96807
97123
|
}
|
|
96808
97124
|
}
|
|
96809
97125
|
if (schema.enum) {
|
|
96810
|
-
errorCollector.append(validateEnum
|
|
97126
|
+
errorCollector.append(validateEnum(data, schema.enum, path));
|
|
96811
97127
|
}
|
|
96812
97128
|
if (schema.const) {
|
|
96813
|
-
errorCollector.append(validateConst
|
|
97129
|
+
errorCollector.append(validateConst(data, schema.const, path));
|
|
96814
97130
|
}
|
|
96815
97131
|
return errorCollector.toValidationResponse();
|
|
96816
97132
|
}
|
|
96817
|
-
function validateAnyOf
|
|
97133
|
+
function validateAnyOf(data, schema, path, document) {
|
|
96818
97134
|
let isValid = false;
|
|
96819
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97135
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96820
97136
|
for (let i = 0, { length } = schema.anyOf; i < length; i++) {
|
|
96821
97137
|
const element = schema.anyOf[i];
|
|
96822
|
-
const validationResponse = validateJsonSchema
|
|
97138
|
+
const validationResponse = validateJsonSchema(
|
|
96823
97139
|
data,
|
|
96824
97140
|
element,
|
|
96825
97141
|
`${path}.anyOf[${i}]`,
|
|
@@ -96834,19 +97150,19 @@
|
|
|
96834
97150
|
}
|
|
96835
97151
|
if (!isValid) {
|
|
96836
97152
|
errorCollector.prepend(
|
|
96837
|
-
new JsonSchemaViolationError
|
|
97153
|
+
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in anyOf.`)
|
|
96838
97154
|
);
|
|
96839
97155
|
return errorCollector.toValidationResponse();
|
|
96840
97156
|
}
|
|
96841
|
-
return validSchemaResponse
|
|
97157
|
+
return validSchemaResponse();
|
|
96842
97158
|
}
|
|
96843
|
-
function validateOneOf
|
|
97159
|
+
function validateOneOf(data, schema, path, document) {
|
|
96844
97160
|
let validSubShemaPaths = [];
|
|
96845
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97161
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96846
97162
|
for (let i = 0, { length } = schema.oneOf; i < length; i++) {
|
|
96847
97163
|
const element = schema.oneOf[i];
|
|
96848
97164
|
const oneOfPath = `${path}.oneOf[${i}]`;
|
|
96849
|
-
const validationResponse = validateJsonSchema
|
|
97165
|
+
const validationResponse = validateJsonSchema(data, element, oneOfPath, document);
|
|
96850
97166
|
if (validationResponse.isOk()) {
|
|
96851
97167
|
validSubShemaPaths.push(oneOfPath);
|
|
96852
97168
|
} else {
|
|
@@ -96855,25 +97171,25 @@
|
|
|
96855
97171
|
}
|
|
96856
97172
|
if (validSubShemaPaths.length === 0) {
|
|
96857
97173
|
errorCollector.prepend(
|
|
96858
|
-
new JsonSchemaViolationError
|
|
97174
|
+
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in oneOf.`)
|
|
96859
97175
|
);
|
|
96860
97176
|
return errorCollector.toValidationResponse();
|
|
96861
97177
|
} else if (validSubShemaPaths.length > 1) {
|
|
96862
97178
|
errorCollector.prepend(
|
|
96863
|
-
new JsonSchemaViolationError
|
|
97179
|
+
new JsonSchemaViolationError(
|
|
96864
97180
|
`Data at ${path} matched multiple subschemas: [${validSubShemaPaths.join(", ")}].`
|
|
96865
97181
|
)
|
|
96866
97182
|
);
|
|
96867
97183
|
return errorCollector.toValidationResponse();
|
|
96868
97184
|
}
|
|
96869
|
-
return validSchemaResponse
|
|
97185
|
+
return validSchemaResponse();
|
|
96870
97186
|
}
|
|
96871
|
-
function validateAllOf
|
|
97187
|
+
function validateAllOf(data, schema, path, document) {
|
|
96872
97188
|
let isValid = true;
|
|
96873
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97189
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96874
97190
|
for (let i = 0, { length } = schema.allOf; i < length; i++) {
|
|
96875
97191
|
const element = schema.allOf[i];
|
|
96876
|
-
const validationResponse = validateJsonSchema
|
|
97192
|
+
const validationResponse = validateJsonSchema(
|
|
96877
97193
|
data,
|
|
96878
97194
|
element,
|
|
96879
97195
|
`${path}.allOf[${i}]`,
|
|
@@ -96886,31 +97202,31 @@
|
|
|
96886
97202
|
}
|
|
96887
97203
|
if (!isValid) {
|
|
96888
97204
|
errorCollector.prepend(
|
|
96889
|
-
new JsonSchemaViolationError
|
|
97205
|
+
new JsonSchemaViolationError(`Data at ${path} did not match some subschemas in allOf.`)
|
|
96890
97206
|
);
|
|
96891
97207
|
}
|
|
96892
97208
|
return errorCollector.toValidationResponse();
|
|
96893
97209
|
}
|
|
96894
|
-
function validateNot
|
|
96895
|
-
const validationResponse = validateJsonSchema
|
|
97210
|
+
function validateNot(data, schema, path, document) {
|
|
97211
|
+
const validationResponse = validateJsonSchema(data, schema.not, path, document);
|
|
96896
97212
|
if (validationResponse.isOk()) {
|
|
96897
|
-
return invalidSchemaResponseWithError
|
|
96898
|
-
new JsonSchemaViolationError
|
|
97213
|
+
return invalidSchemaResponseWithError(
|
|
97214
|
+
new JsonSchemaViolationError(
|
|
96899
97215
|
`Data at ${path} validated against the schema of a not clause.`
|
|
96900
97216
|
)
|
|
96901
97217
|
);
|
|
96902
97218
|
}
|
|
96903
|
-
return validSchemaResponse
|
|
97219
|
+
return validSchemaResponse();
|
|
96904
97220
|
}
|
|
96905
|
-
function validateObject
|
|
97221
|
+
function validateObject(data, schema, path, document) {
|
|
96906
97222
|
const schemaKeys = Object.keys(schema.properties);
|
|
96907
97223
|
const requiredKeys = new Set(schema.required);
|
|
96908
97224
|
const schemaKeySet = new Set(schemaKeys);
|
|
96909
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97225
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96910
97226
|
Object.keys(data).forEach((key) => {
|
|
96911
97227
|
if (!schemaKeySet.has(key)) {
|
|
96912
97228
|
errorCollector.append(
|
|
96913
|
-
validateJsonSchema
|
|
97229
|
+
validateJsonSchema(
|
|
96914
97230
|
data[key],
|
|
96915
97231
|
schema.additionalProperties,
|
|
96916
97232
|
`${path}.additionalProperties[${key}]`,
|
|
@@ -96924,14 +97240,14 @@
|
|
|
96924
97240
|
const keyInData = key in data && data[key] !== void 0;
|
|
96925
97241
|
if (requiredKeys.has(key) && !keyInData) {
|
|
96926
97242
|
errorCollector.add(
|
|
96927
|
-
new MissingRequiredPropertyError
|
|
97243
|
+
new MissingRequiredPropertyError(
|
|
96928
97244
|
`Object at path '${path}' is missing required property '${key}'.`
|
|
96929
97245
|
)
|
|
96930
97246
|
);
|
|
96931
97247
|
}
|
|
96932
97248
|
if (keyInData) {
|
|
96933
97249
|
errorCollector.append(
|
|
96934
|
-
validateJsonSchema
|
|
97250
|
+
validateJsonSchema(
|
|
96935
97251
|
data[key],
|
|
96936
97252
|
schema.properties[key],
|
|
96937
97253
|
`${path}.${key}`,
|
|
@@ -96942,95 +97258,95 @@
|
|
|
96942
97258
|
}
|
|
96943
97259
|
return errorCollector.toValidationResponse();
|
|
96944
97260
|
}
|
|
96945
|
-
function validateArray
|
|
97261
|
+
function validateArray(data, schema, path, document) {
|
|
96946
97262
|
if (schema.minItems !== void 0 && data.length < schema.minItems) {
|
|
96947
|
-
return invalidSchemaResponseWithError
|
|
96948
|
-
new MinItemsViolationError
|
|
97263
|
+
return invalidSchemaResponseWithError(
|
|
97264
|
+
new MinItemsViolationError(
|
|
96949
97265
|
`Array at path '${path}' fails minItems constraint. Has ${data.length} items, needs at least ${schema.minItems}.`
|
|
96950
97266
|
)
|
|
96951
97267
|
);
|
|
96952
97268
|
}
|
|
96953
97269
|
if (schema.maxItems !== void 0 && data.length > schema.maxItems) {
|
|
96954
|
-
return invalidSchemaResponseWithError
|
|
96955
|
-
new MaxItemsViolationError
|
|
97270
|
+
return invalidSchemaResponseWithError(
|
|
97271
|
+
new MaxItemsViolationError(
|
|
96956
97272
|
`Array at path '${path}' fails maxItems constraint. Has ${data.length} items, needs at most ${schema.maxItems}.`
|
|
96957
97273
|
)
|
|
96958
97274
|
);
|
|
96959
97275
|
}
|
|
96960
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97276
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96961
97277
|
data.forEach(
|
|
96962
97278
|
(element, index) => errorCollector.append(
|
|
96963
|
-
validateJsonSchema
|
|
97279
|
+
validateJsonSchema(element, schema.items, `${path}[${index}]`, document)
|
|
96964
97280
|
)
|
|
96965
97281
|
);
|
|
96966
97282
|
return errorCollector.toValidationResponse();
|
|
96967
97283
|
}
|
|
96968
|
-
function validateScalar
|
|
97284
|
+
function validateScalar(data, schema, path) {
|
|
96969
97285
|
const schemaDataType = schema.type;
|
|
96970
97286
|
const dataType = typeof data;
|
|
96971
97287
|
if (schemaDataType === "integer") {
|
|
96972
97288
|
if (dataType !== "number" || !Number.isInteger(data)) {
|
|
96973
|
-
return invalidSchemaResponseWithError
|
|
97289
|
+
return invalidSchemaResponseWithError(incorrectTypeError("integer", dataType, path));
|
|
96974
97290
|
}
|
|
96975
97291
|
} else if (schemaDataType === "number") {
|
|
96976
97292
|
if (dataType !== "number") {
|
|
96977
|
-
return invalidSchemaResponseWithError
|
|
97293
|
+
return invalidSchemaResponseWithError(incorrectTypeError("number", dataType, path));
|
|
96978
97294
|
}
|
|
96979
97295
|
} else if (schemaDataType === "string") {
|
|
96980
97296
|
if (dataType !== "string") {
|
|
96981
|
-
return invalidSchemaResponseWithError
|
|
97297
|
+
return invalidSchemaResponseWithError(incorrectTypeError("string", dataType, path));
|
|
96982
97298
|
}
|
|
96983
97299
|
} else if (schemaDataType === "boolean") {
|
|
96984
97300
|
if (dataType !== "boolean") {
|
|
96985
|
-
return invalidSchemaResponseWithError
|
|
97301
|
+
return invalidSchemaResponseWithError(incorrectTypeError("boolean", dataType, path));
|
|
96986
97302
|
}
|
|
96987
97303
|
} else if (schemaDataType === "null") {
|
|
96988
97304
|
if (data !== null) {
|
|
96989
|
-
return invalidSchemaResponseWithError
|
|
97305
|
+
return invalidSchemaResponseWithError(incorrectTypeError("null", dataType, path));
|
|
96990
97306
|
}
|
|
96991
97307
|
} else {
|
|
96992
|
-
return invalidSchemaResponseWithError
|
|
96993
|
-
new IncorrectTypeError
|
|
97308
|
+
return invalidSchemaResponseWithError(
|
|
97309
|
+
new IncorrectTypeError(`Unknown schema data type: ${schemaDataType}.`)
|
|
96994
97310
|
);
|
|
96995
97311
|
}
|
|
96996
|
-
return validSchemaResponse
|
|
97312
|
+
return validSchemaResponse();
|
|
96997
97313
|
}
|
|
96998
|
-
function validateRef
|
|
97314
|
+
function validateRef(data, schema, path, document) {
|
|
96999
97315
|
if (!schema.$ref.startsWith("#")) {
|
|
97000
|
-
return invalidSchemaResponseWithError
|
|
97001
|
-
new InvalidRefError
|
|
97316
|
+
return invalidSchemaResponseWithError(
|
|
97317
|
+
new InvalidRefError(
|
|
97002
97318
|
`$ref values that do not refer to the current document are unsupported (must start with '#')`
|
|
97003
97319
|
)
|
|
97004
97320
|
);
|
|
97005
97321
|
}
|
|
97006
97322
|
try {
|
|
97007
|
-
const schemaToValidate = findSchemaAtPath
|
|
97008
|
-
return validateJsonSchema
|
|
97323
|
+
const schemaToValidate = findSchemaAtPath(document, schema.$ref);
|
|
97324
|
+
return validateJsonSchema(data, schemaToValidate, path, document);
|
|
97009
97325
|
} catch (e) {
|
|
97010
|
-
return invalidSchemaResponseWithError
|
|
97326
|
+
return invalidSchemaResponseWithError(e);
|
|
97011
97327
|
}
|
|
97012
97328
|
}
|
|
97013
|
-
function validateEnum
|
|
97329
|
+
function validateEnum(data, enumValue, path) {
|
|
97014
97330
|
if (!enumValue.some((value) => deepEquals$1(value, data))) {
|
|
97015
|
-
return invalidSchemaResponseWithError
|
|
97016
|
-
new JsonSchemaViolationError
|
|
97331
|
+
return invalidSchemaResponseWithError(
|
|
97332
|
+
new JsonSchemaViolationError(
|
|
97017
97333
|
`Data at ${path} did not match any values in enum. Expected value in: [${enumValue.map((value) => stringify$2(value)).join()}]`
|
|
97018
97334
|
)
|
|
97019
97335
|
);
|
|
97020
97336
|
}
|
|
97021
|
-
return validSchemaResponse
|
|
97337
|
+
return validSchemaResponse();
|
|
97022
97338
|
}
|
|
97023
|
-
function validateConst
|
|
97339
|
+
function validateConst(data, constValue, path) {
|
|
97024
97340
|
if (!deepEquals$1(constValue, data)) {
|
|
97025
|
-
return invalidSchemaResponseWithError
|
|
97026
|
-
new JsonSchemaViolationError
|
|
97341
|
+
return invalidSchemaResponseWithError(
|
|
97342
|
+
new JsonSchemaViolationError(
|
|
97027
97343
|
`Data at ${path} did not match const. Expected: ${stringify$2(constValue)}`
|
|
97028
97344
|
)
|
|
97029
97345
|
);
|
|
97030
97346
|
}
|
|
97031
|
-
return validSchemaResponse
|
|
97347
|
+
return validSchemaResponse();
|
|
97032
97348
|
}
|
|
97033
|
-
function findSchemaAtPath
|
|
97349
|
+
function findSchemaAtPath(document, ref) {
|
|
97034
97350
|
if (ref === "#") return document;
|
|
97035
97351
|
const keys = ref.replace(/^#\//, "").split("/");
|
|
97036
97352
|
let current = document;
|
|
@@ -97038,7 +97354,7 @@
|
|
|
97038
97354
|
for (const key of keys) {
|
|
97039
97355
|
path = `${path}/${key}`;
|
|
97040
97356
|
if (current[key] === void 0) {
|
|
97041
|
-
throw new InvalidRefError
|
|
97357
|
+
throw new InvalidRefError(
|
|
97042
97358
|
`Invalid $ref value '${ref}'. Cannot find target schema at '${path}'`
|
|
97043
97359
|
);
|
|
97044
97360
|
}
|
|
@@ -97083,7 +97399,7 @@
|
|
|
97083
97399
|
*/
|
|
97084
97400
|
function buildBaseImperativeInvoker(getCommand, transformResult) {
|
|
97085
97401
|
return async (...params) => {
|
|
97086
|
-
const command = getCommand({ params, assertIsValid
|
|
97402
|
+
const command = getCommand({ params, assertIsValid });
|
|
97087
97403
|
try {
|
|
97088
97404
|
return command.execute().then((result) => transformResult(result));
|
|
97089
97405
|
} catch (error) {
|
|
@@ -97223,7 +97539,7 @@
|
|
|
97223
97539
|
class LegacyImperativeBindingsService {
|
|
97224
97540
|
bind(getCommand) {
|
|
97225
97541
|
const invoke = async (config, requestContext, callback) => {
|
|
97226
|
-
const command = getCommand({ config, assertIsValid
|
|
97542
|
+
const command = getCommand({ config, assertIsValid });
|
|
97227
97543
|
try {
|
|
97228
97544
|
const overrides = getOverridesForLegacyRequestContext(requestContext);
|
|
97229
97545
|
const result = await command.execute(overrides);
|
|
@@ -97238,7 +97554,7 @@
|
|
|
97238
97554
|
}
|
|
97239
97555
|
};
|
|
97240
97556
|
const subscribe = (config, requestContext, callback) => {
|
|
97241
|
-
const command = getCommand({ config, assertIsValid
|
|
97557
|
+
const command = getCommand({ config, assertIsValid });
|
|
97242
97558
|
let unsubscribe = () => {
|
|
97243
97559
|
};
|
|
97244
97560
|
try {
|
|
@@ -97297,13 +97613,7 @@
|
|
|
97297
97613
|
}
|
|
97298
97614
|
return await buildBaseImperativeInvoker(getCommand, (result) => this.transformResult(result, exposeRefresh))(...params);
|
|
97299
97615
|
} catch (error) {
|
|
97300
|
-
|
|
97301
|
-
return {
|
|
97302
|
-
data: void 0,
|
|
97303
|
-
errors: [
|
|
97304
|
-
{ message: "Internal error in GraphQL adapter occurred", locations: [] }
|
|
97305
|
-
]
|
|
97306
|
-
};
|
|
97616
|
+
return toGraphQLErrorResponse(error);
|
|
97307
97617
|
}
|
|
97308
97618
|
};
|
|
97309
97619
|
}
|
|
@@ -97397,8 +97707,8 @@
|
|
|
97397
97707
|
config = result.value;
|
|
97398
97708
|
}
|
|
97399
97709
|
}
|
|
97400
|
-
const command = getCommand({ config, assertIsValid: assertIsValid$1 });
|
|
97401
97710
|
try {
|
|
97711
|
+
const command = getCommand({ config, assertIsValid });
|
|
97402
97712
|
const overrides = getOverridesForLegacyRequestContext(requestContext);
|
|
97403
97713
|
const result = await command.execute(overrides);
|
|
97404
97714
|
const consumerEmittedData = {
|
|
@@ -97415,13 +97725,7 @@
|
|
|
97415
97725
|
}
|
|
97416
97726
|
callback(consumerEmittedData);
|
|
97417
97727
|
} catch (error) {
|
|
97418
|
-
|
|
97419
|
-
callback({
|
|
97420
|
-
data: void 0,
|
|
97421
|
-
errors: [
|
|
97422
|
-
{ message: "Internal error in GraphQL adapter occurred", locations: [] }
|
|
97423
|
-
]
|
|
97424
|
-
});
|
|
97728
|
+
callback(toGraphQLErrorResponse(error));
|
|
97425
97729
|
}
|
|
97426
97730
|
};
|
|
97427
97731
|
const subscribe = (config, requestContext, callback) => {
|
|
@@ -97439,35 +97743,41 @@
|
|
|
97439
97743
|
config = result.value;
|
|
97440
97744
|
}
|
|
97441
97745
|
}
|
|
97442
|
-
const command = getCommand({ config, assertIsValid: assertIsValid$1 });
|
|
97443
97746
|
let unsubscribe = () => {
|
|
97444
97747
|
};
|
|
97445
|
-
|
|
97446
|
-
|
|
97447
|
-
const
|
|
97448
|
-
|
|
97449
|
-
|
|
97450
|
-
|
|
97451
|
-
|
|
97452
|
-
|
|
97453
|
-
|
|
97454
|
-
|
|
97455
|
-
|
|
97456
|
-
|
|
97457
|
-
|
|
97458
|
-
|
|
97459
|
-
|
|
97460
|
-
|
|
97461
|
-
|
|
97462
|
-
|
|
97463
|
-
|
|
97464
|
-
|
|
97465
|
-
|
|
97466
|
-
|
|
97467
|
-
|
|
97468
|
-
|
|
97469
|
-
|
|
97470
|
-
|
|
97748
|
+
try {
|
|
97749
|
+
const command = getCommand({ config, assertIsValid });
|
|
97750
|
+
const overrides = getOverridesForLegacyRequestContext(requestContext);
|
|
97751
|
+
command.execute(overrides).then((result) => {
|
|
97752
|
+
const consumerEmittedData = {
|
|
97753
|
+
data: void 0,
|
|
97754
|
+
errors: void 0
|
|
97755
|
+
};
|
|
97756
|
+
if (result.isOk()) {
|
|
97757
|
+
deepFreeze(result.value);
|
|
97758
|
+
consumerEmittedData.data = result.value.data.data;
|
|
97759
|
+
unsubscribe = result.value.subscribe(
|
|
97760
|
+
(res) => {
|
|
97761
|
+
handleEmit(res, callback);
|
|
97762
|
+
}
|
|
97763
|
+
);
|
|
97764
|
+
} else {
|
|
97765
|
+
const { data, errors } = toGraphQLResponseFromFailure$1(
|
|
97766
|
+
result.error.failure
|
|
97767
|
+
);
|
|
97768
|
+
consumerEmittedData.data = data;
|
|
97769
|
+
consumerEmittedData.errors = errors;
|
|
97770
|
+
unsubscribe = result.error.subscribe(
|
|
97771
|
+
(res) => {
|
|
97772
|
+
handleEmit(res, callback);
|
|
97773
|
+
}
|
|
97774
|
+
);
|
|
97775
|
+
}
|
|
97776
|
+
callback(consumerEmittedData);
|
|
97777
|
+
});
|
|
97778
|
+
} catch (error) {
|
|
97779
|
+
callback(toGraphQLErrorResponse(error));
|
|
97780
|
+
}
|
|
97471
97781
|
return () => {
|
|
97472
97782
|
unsubscribe();
|
|
97473
97783
|
};
|
|
@@ -97501,7 +97811,7 @@
|
|
|
97501
97811
|
params[0] = result2.value;
|
|
97502
97812
|
}
|
|
97503
97813
|
}
|
|
97504
|
-
const command = getCommand({ params, assertIsValid
|
|
97814
|
+
const command = getCommand({ params, assertIsValid });
|
|
97505
97815
|
const result = await command.execute({ cacheControlConfig: { type: "no-cache" } });
|
|
97506
97816
|
if (result.isOk()) {
|
|
97507
97817
|
deepFreeze(result.value);
|
|
@@ -97510,13 +97820,7 @@
|
|
|
97510
97820
|
return toGraphQLResponseFromFailure$1(result.error.failure);
|
|
97511
97821
|
}
|
|
97512
97822
|
} catch (error) {
|
|
97513
|
-
|
|
97514
|
-
return {
|
|
97515
|
-
data: void 0,
|
|
97516
|
-
errors: [
|
|
97517
|
-
{ message: "Internal error in GraphQL adapter occurred", locations: [] }
|
|
97518
|
-
]
|
|
97519
|
-
};
|
|
97823
|
+
return toGraphQLErrorResponse(error);
|
|
97520
97824
|
}
|
|
97521
97825
|
};
|
|
97522
97826
|
}
|
|
@@ -97584,8 +97888,8 @@
|
|
|
97584
97888
|
return new Sanitizer(obj).sanitize();
|
|
97585
97889
|
}
|
|
97586
97890
|
function isIncompleteConfigError(err) {
|
|
97587
|
-
return err instanceof MissingRequiredPropertyError
|
|
97588
|
-
(validationError) => validationError instanceof MissingRequiredPropertyError
|
|
97891
|
+
return err instanceof MissingRequiredPropertyError || err instanceof JsonSchemaViolationError && err.validationErrors.find(
|
|
97892
|
+
(validationError) => validationError instanceof MissingRequiredPropertyError
|
|
97589
97893
|
) !== void 0;
|
|
97590
97894
|
}
|
|
97591
97895
|
class CommandWireAdapterConstructor {
|
|
@@ -97671,11 +97975,15 @@
|
|
|
97671
97975
|
}
|
|
97672
97976
|
if (this.configSchema) {
|
|
97673
97977
|
try {
|
|
97674
|
-
assertIsValid
|
|
97978
|
+
assertIsValid(this.config, this.configSchema);
|
|
97675
97979
|
} catch (err) {
|
|
97676
97980
|
if (isIncompleteConfigError(err)) {
|
|
97677
97981
|
return;
|
|
97678
97982
|
}
|
|
97983
|
+
if (err instanceof JsonSchemaViolationError) {
|
|
97984
|
+
this.handleConfigSchemaViolation(err);
|
|
97985
|
+
return;
|
|
97986
|
+
}
|
|
97679
97987
|
throw err;
|
|
97680
97988
|
}
|
|
97681
97989
|
}
|
|
@@ -97728,6 +98036,16 @@
|
|
|
97728
98036
|
handleExecutionThrow(error) {
|
|
97729
98037
|
emitError(this.callback, error);
|
|
97730
98038
|
}
|
|
98039
|
+
/**
|
|
98040
|
+
* Hook for subclasses to handle a JsonSchemaViolationError from the config
|
|
98041
|
+
* schema assertion. The default re-throws so legacy non-GraphQL wire
|
|
98042
|
+
* adapters keep their existing throw behavior. Overrides are expected to
|
|
98043
|
+
* either emit an error result or re-throw — silently returning will
|
|
98044
|
+
* swallow the error.
|
|
98045
|
+
*/
|
|
98046
|
+
handleConfigSchemaViolation(error) {
|
|
98047
|
+
throw error;
|
|
98048
|
+
}
|
|
97731
98049
|
unsubscribe() {
|
|
97732
98050
|
if (this.unsubscriber) {
|
|
97733
98051
|
this.unsubscriber();
|
|
@@ -97820,16 +98138,14 @@
|
|
|
97820
98138
|
this.callback(consumerEmittedData);
|
|
97821
98139
|
}
|
|
97822
98140
|
} catch (e) {
|
|
97823
|
-
logError$1(e);
|
|
97824
98141
|
this.handleExecutionThrow(e);
|
|
97825
98142
|
}
|
|
97826
98143
|
}
|
|
97827
|
-
handleExecutionThrow(
|
|
97828
|
-
|
|
97829
|
-
|
|
97830
|
-
|
|
97831
|
-
|
|
97832
|
-
});
|
|
98144
|
+
handleExecutionThrow(error) {
|
|
98145
|
+
this.callback(toGraphQLErrorResponse(error));
|
|
98146
|
+
}
|
|
98147
|
+
handleConfigSchemaViolation(error) {
|
|
98148
|
+
this.handleExecutionThrow(error);
|
|
97833
98149
|
}
|
|
97834
98150
|
update(config, _context) {
|
|
97835
98151
|
this.unsubscribe();
|
|
@@ -98481,9 +98797,11 @@
|
|
|
98481
98797
|
return entries.length > 0 ? this.store.setEntries(entries) : Promise.resolve();
|
|
98482
98798
|
}
|
|
98483
98799
|
find(_query) {
|
|
98800
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
98484
98801
|
throw new Error('find not supported on the NimbusDurableCacheInclusionPolicy');
|
|
98485
98802
|
}
|
|
98486
98803
|
findAndModify(_query, _cacheUpdate) {
|
|
98804
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
98487
98805
|
throw new Error('findAndModify not supported on the NimbusDurableCacheInclusionPolicy');
|
|
98488
98806
|
}
|
|
98489
98807
|
registerListener() {
|
|
@@ -98509,7 +98827,7 @@
|
|
|
98509
98827
|
});
|
|
98510
98828
|
});
|
|
98511
98829
|
}
|
|
98512
|
-
// TODO: onestore doesnt support cache eviction yet
|
|
98830
|
+
// TODO [W-19368859]: onestore doesnt support cache eviction yet
|
|
98513
98831
|
// if (evictKeys.size > 0) {
|
|
98514
98832
|
// evictKeys.forEach((key) => {
|
|
98515
98833
|
// this.services.cache.evict(key);
|
|
@@ -98604,6 +98922,7 @@
|
|
|
98604
98922
|
batchQuery(operations) {
|
|
98605
98923
|
return new Promise((resolve, reject) => {
|
|
98606
98924
|
this.sqlStore.batchOperations(operations, (error) => {
|
|
98925
|
+
// eslint-disable-next-line no-unused-expressions
|
|
98607
98926
|
error ? reject(error) : resolve();
|
|
98608
98927
|
});
|
|
98609
98928
|
});
|
|
@@ -98679,7 +98998,7 @@
|
|
|
98679
98998
|
buildServiceDescriptor$7(),
|
|
98680
98999
|
buildServiceDescriptor$1$1(),
|
|
98681
99000
|
buildServiceDescriptor$2(),
|
|
98682
|
-
// TODO[
|
|
99001
|
+
// TODO [W-18753648]: See note above.
|
|
98683
99002
|
// buildStreamingCommandServiceDescriptor(),
|
|
98684
99003
|
// buildNdJsonServiceDescriptor(),
|
|
98685
99004
|
// buildSseCommandServiceDescriptor(),
|
|
@@ -98938,378 +99257,12 @@
|
|
|
98938
99257
|
id: '@salesforce/lds-network-adapter',
|
|
98939
99258
|
instrument: instrument$2,
|
|
98940
99259
|
});
|
|
98941
|
-
// version: 1.
|
|
99260
|
+
// version: 1.434.0-d8deb0d4ea
|
|
98942
99261
|
|
|
98943
99262
|
const { create: create$2, keys: keys$2 } = Object;
|
|
98944
99263
|
const { stringify, parse } = JSON;
|
|
98945
99264
|
const { isArray: isArray$3 } = Array;
|
|
98946
99265
|
|
|
98947
|
-
/*!
|
|
98948
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
98949
|
-
* All rights reserved.
|
|
98950
|
-
* For full license text, see the LICENSE.txt file
|
|
98951
|
-
*/
|
|
98952
|
-
class JsonSchemaViolationError extends Error {
|
|
98953
|
-
constructor(message, validationErrors) {
|
|
98954
|
-
super(message);
|
|
98955
|
-
this.validationErrors = [];
|
|
98956
|
-
this.validationErrors = validationErrors || [];
|
|
98957
|
-
}
|
|
98958
|
-
}
|
|
98959
|
-
class MinItemsViolationError extends JsonSchemaViolationError {
|
|
98960
|
-
}
|
|
98961
|
-
class MaxItemsViolationError extends JsonSchemaViolationError {
|
|
98962
|
-
}
|
|
98963
|
-
class IncorrectTypeError extends JsonSchemaViolationError {
|
|
98964
|
-
}
|
|
98965
|
-
class AdditionalPropertiesError extends JsonSchemaViolationError {
|
|
98966
|
-
}
|
|
98967
|
-
class MissingRequiredPropertyError extends JsonSchemaViolationError {
|
|
98968
|
-
}
|
|
98969
|
-
class InvalidRefError extends JsonSchemaViolationError {
|
|
98970
|
-
}
|
|
98971
|
-
class JsonSchemaErrorCollector {
|
|
98972
|
-
constructor() {
|
|
98973
|
-
this.errors = [];
|
|
98974
|
-
}
|
|
98975
|
-
add(error) {
|
|
98976
|
-
this.errors.push(error);
|
|
98977
|
-
}
|
|
98978
|
-
append(response) {
|
|
98979
|
-
if (response.isErr()) {
|
|
98980
|
-
this.errors.push(...response.error);
|
|
98981
|
-
}
|
|
98982
|
-
}
|
|
98983
|
-
hasErrors() {
|
|
98984
|
-
return this.errors.length > 0;
|
|
98985
|
-
}
|
|
98986
|
-
prepend(error) {
|
|
98987
|
-
this.errors.unshift(error);
|
|
98988
|
-
}
|
|
98989
|
-
toValidationResponse() {
|
|
98990
|
-
return !this.hasErrors() ? ok$4(true) : err$4(this.errors);
|
|
98991
|
-
}
|
|
98992
|
-
}
|
|
98993
|
-
function createThrowableError(errors) {
|
|
98994
|
-
if (errors[0] instanceof MinItemsViolationError) {
|
|
98995
|
-
return new MinItemsViolationError(errors[0].message, errors);
|
|
98996
|
-
}
|
|
98997
|
-
if (errors[0] instanceof MaxItemsViolationError) {
|
|
98998
|
-
return new MaxItemsViolationError(errors[0].message, errors);
|
|
98999
|
-
}
|
|
99000
|
-
if (errors[0] instanceof IncorrectTypeError) {
|
|
99001
|
-
return new IncorrectTypeError(errors[0].message, errors);
|
|
99002
|
-
}
|
|
99003
|
-
if (errors[0] instanceof AdditionalPropertiesError) {
|
|
99004
|
-
return new AdditionalPropertiesError(errors[0].message, errors);
|
|
99005
|
-
}
|
|
99006
|
-
if (errors[0] instanceof MissingRequiredPropertyError) {
|
|
99007
|
-
return new MissingRequiredPropertyError(errors[0].message, errors);
|
|
99008
|
-
}
|
|
99009
|
-
if (errors[0] instanceof InvalidRefError) {
|
|
99010
|
-
return new InvalidRefError(errors[0].message, errors);
|
|
99011
|
-
}
|
|
99012
|
-
return new JsonSchemaViolationError(errors[0].message, errors);
|
|
99013
|
-
}
|
|
99014
|
-
function assertIsValid(data, schema) {
|
|
99015
|
-
const validationResponse = validateJsonSchema(data, schema);
|
|
99016
|
-
if (validationResponse.isErr()) {
|
|
99017
|
-
throw createThrowableError(validationResponse.error);
|
|
99018
|
-
}
|
|
99019
|
-
}
|
|
99020
|
-
function incorrectTypeError(expected, actual, path) {
|
|
99021
|
-
return new IncorrectTypeError(
|
|
99022
|
-
`Expected type ${expected} at path '${path}', found type ${actual}.`
|
|
99023
|
-
);
|
|
99024
|
-
}
|
|
99025
|
-
function validSchemaResponse() {
|
|
99026
|
-
return ok$4(true);
|
|
99027
|
-
}
|
|
99028
|
-
function invalidSchemaResponseWithError(error) {
|
|
99029
|
-
return err$4([error]);
|
|
99030
|
-
}
|
|
99031
|
-
function validateJsonSchema(data, schema, path = "$", document = schema) {
|
|
99032
|
-
if (schema === true) return validSchemaResponse();
|
|
99033
|
-
if (schema === false)
|
|
99034
|
-
return invalidSchemaResponseWithError(
|
|
99035
|
-
new JsonSchemaViolationError(`Data at ${path} has schema 'false'`)
|
|
99036
|
-
);
|
|
99037
|
-
const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
|
|
99038
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99039
|
-
if ("anyOf" in schema) {
|
|
99040
|
-
errorCollector.append(validateAnyOf(data, schema, path, document));
|
|
99041
|
-
} else if ("oneOf" in schema) {
|
|
99042
|
-
errorCollector.append(validateOneOf(data, schema, path, document));
|
|
99043
|
-
} else if ("allOf" in schema) {
|
|
99044
|
-
errorCollector.append(validateAllOf(data, schema, path, document));
|
|
99045
|
-
} else if ("not" in schema) {
|
|
99046
|
-
errorCollector.append(validateNot(data, schema, path, document));
|
|
99047
|
-
} else if ("$ref" in schema) {
|
|
99048
|
-
errorCollector.append(validateRef(data, schema, path, document));
|
|
99049
|
-
} else if ("type" in schema) {
|
|
99050
|
-
if (schema.type === "object") {
|
|
99051
|
-
if (dataType !== "object") {
|
|
99052
|
-
errorCollector.add(incorrectTypeError("object", dataType, path));
|
|
99053
|
-
} else {
|
|
99054
|
-
errorCollector.append(
|
|
99055
|
-
validateObject(data, schema, path, document)
|
|
99056
|
-
);
|
|
99057
|
-
}
|
|
99058
|
-
} else if (schema.type === "array") {
|
|
99059
|
-
if (dataType !== "array") {
|
|
99060
|
-
errorCollector.add(incorrectTypeError("array", dataType, path));
|
|
99061
|
-
} else {
|
|
99062
|
-
errorCollector.append(
|
|
99063
|
-
validateArray(data, schema, path, document)
|
|
99064
|
-
);
|
|
99065
|
-
}
|
|
99066
|
-
} else {
|
|
99067
|
-
errorCollector.append(
|
|
99068
|
-
validateScalar(data, schema, path)
|
|
99069
|
-
);
|
|
99070
|
-
}
|
|
99071
|
-
}
|
|
99072
|
-
if (schema.enum) {
|
|
99073
|
-
errorCollector.append(validateEnum(data, schema.enum, path));
|
|
99074
|
-
}
|
|
99075
|
-
if (schema.const) {
|
|
99076
|
-
errorCollector.append(validateConst(data, schema.const, path));
|
|
99077
|
-
}
|
|
99078
|
-
return errorCollector.toValidationResponse();
|
|
99079
|
-
}
|
|
99080
|
-
function validateAnyOf(data, schema, path, document) {
|
|
99081
|
-
let isValid = false;
|
|
99082
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99083
|
-
for (let i = 0, { length } = schema.anyOf; i < length; i++) {
|
|
99084
|
-
const element = schema.anyOf[i];
|
|
99085
|
-
const validationResponse = validateJsonSchema(
|
|
99086
|
-
data,
|
|
99087
|
-
element,
|
|
99088
|
-
`${path}.anyOf[${i}]`,
|
|
99089
|
-
document
|
|
99090
|
-
);
|
|
99091
|
-
if (validationResponse.isOk()) {
|
|
99092
|
-
isValid = true;
|
|
99093
|
-
break;
|
|
99094
|
-
} else {
|
|
99095
|
-
errorCollector.append(validationResponse);
|
|
99096
|
-
}
|
|
99097
|
-
}
|
|
99098
|
-
if (!isValid) {
|
|
99099
|
-
errorCollector.prepend(
|
|
99100
|
-
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in anyOf.`)
|
|
99101
|
-
);
|
|
99102
|
-
return errorCollector.toValidationResponse();
|
|
99103
|
-
}
|
|
99104
|
-
return validSchemaResponse();
|
|
99105
|
-
}
|
|
99106
|
-
function validateOneOf(data, schema, path, document) {
|
|
99107
|
-
let validSubShemaPaths = [];
|
|
99108
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99109
|
-
for (let i = 0, { length } = schema.oneOf; i < length; i++) {
|
|
99110
|
-
const element = schema.oneOf[i];
|
|
99111
|
-
const oneOfPath = `${path}.oneOf[${i}]`;
|
|
99112
|
-
const validationResponse = validateJsonSchema(data, element, oneOfPath, document);
|
|
99113
|
-
if (validationResponse.isOk()) {
|
|
99114
|
-
validSubShemaPaths.push(oneOfPath);
|
|
99115
|
-
} else {
|
|
99116
|
-
errorCollector.append(validationResponse);
|
|
99117
|
-
}
|
|
99118
|
-
}
|
|
99119
|
-
if (validSubShemaPaths.length === 0) {
|
|
99120
|
-
errorCollector.prepend(
|
|
99121
|
-
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in oneOf.`)
|
|
99122
|
-
);
|
|
99123
|
-
return errorCollector.toValidationResponse();
|
|
99124
|
-
} else if (validSubShemaPaths.length > 1) {
|
|
99125
|
-
errorCollector.prepend(
|
|
99126
|
-
new JsonSchemaViolationError(
|
|
99127
|
-
`Data at ${path} matched multiple subschemas: [${validSubShemaPaths.join(", ")}].`
|
|
99128
|
-
)
|
|
99129
|
-
);
|
|
99130
|
-
return errorCollector.toValidationResponse();
|
|
99131
|
-
}
|
|
99132
|
-
return validSchemaResponse();
|
|
99133
|
-
}
|
|
99134
|
-
function validateAllOf(data, schema, path, document) {
|
|
99135
|
-
let isValid = true;
|
|
99136
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99137
|
-
for (let i = 0, { length } = schema.allOf; i < length; i++) {
|
|
99138
|
-
const element = schema.allOf[i];
|
|
99139
|
-
const validationResponse = validateJsonSchema(
|
|
99140
|
-
data,
|
|
99141
|
-
element,
|
|
99142
|
-
`${path}.allOf[${i}]`,
|
|
99143
|
-
document
|
|
99144
|
-
);
|
|
99145
|
-
if (!validationResponse.isOk()) {
|
|
99146
|
-
errorCollector.append(validationResponse);
|
|
99147
|
-
isValid = false;
|
|
99148
|
-
}
|
|
99149
|
-
}
|
|
99150
|
-
if (!isValid) {
|
|
99151
|
-
errorCollector.prepend(
|
|
99152
|
-
new JsonSchemaViolationError(`Data at ${path} did not match some subschemas in allOf.`)
|
|
99153
|
-
);
|
|
99154
|
-
}
|
|
99155
|
-
return errorCollector.toValidationResponse();
|
|
99156
|
-
}
|
|
99157
|
-
function validateNot(data, schema, path, document) {
|
|
99158
|
-
const validationResponse = validateJsonSchema(data, schema.not, path, document);
|
|
99159
|
-
if (validationResponse.isOk()) {
|
|
99160
|
-
return invalidSchemaResponseWithError(
|
|
99161
|
-
new JsonSchemaViolationError(
|
|
99162
|
-
`Data at ${path} validated against the schema of a not clause.`
|
|
99163
|
-
)
|
|
99164
|
-
);
|
|
99165
|
-
}
|
|
99166
|
-
return validSchemaResponse();
|
|
99167
|
-
}
|
|
99168
|
-
function validateObject(data, schema, path, document) {
|
|
99169
|
-
const schemaKeys = Object.keys(schema.properties);
|
|
99170
|
-
const requiredKeys = new Set(schema.required);
|
|
99171
|
-
const schemaKeySet = new Set(schemaKeys);
|
|
99172
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99173
|
-
Object.keys(data).forEach((key) => {
|
|
99174
|
-
if (!schemaKeySet.has(key)) {
|
|
99175
|
-
errorCollector.append(
|
|
99176
|
-
validateJsonSchema(
|
|
99177
|
-
data[key],
|
|
99178
|
-
schema.additionalProperties,
|
|
99179
|
-
`${path}.additionalProperties[${key}]`,
|
|
99180
|
-
document
|
|
99181
|
-
)
|
|
99182
|
-
);
|
|
99183
|
-
}
|
|
99184
|
-
});
|
|
99185
|
-
for (let i = 0, length = schemaKeys.length; i < length; i++) {
|
|
99186
|
-
const key = schemaKeys[i];
|
|
99187
|
-
const keyInData = key in data && data[key] !== void 0;
|
|
99188
|
-
if (requiredKeys.has(key) && !keyInData) {
|
|
99189
|
-
errorCollector.add(
|
|
99190
|
-
new MissingRequiredPropertyError(
|
|
99191
|
-
`Object at path '${path}' is missing required property '${key}'.`
|
|
99192
|
-
)
|
|
99193
|
-
);
|
|
99194
|
-
}
|
|
99195
|
-
if (keyInData) {
|
|
99196
|
-
errorCollector.append(
|
|
99197
|
-
validateJsonSchema(
|
|
99198
|
-
data[key],
|
|
99199
|
-
schema.properties[key],
|
|
99200
|
-
`${path}.${key}`,
|
|
99201
|
-
document
|
|
99202
|
-
)
|
|
99203
|
-
);
|
|
99204
|
-
}
|
|
99205
|
-
}
|
|
99206
|
-
return errorCollector.toValidationResponse();
|
|
99207
|
-
}
|
|
99208
|
-
function validateArray(data, schema, path, document) {
|
|
99209
|
-
if (schema.minItems !== void 0 && data.length < schema.minItems) {
|
|
99210
|
-
return invalidSchemaResponseWithError(
|
|
99211
|
-
new MinItemsViolationError(
|
|
99212
|
-
`Array at path '${path}' fails minItems constraint. Has ${data.length} items, needs at least ${schema.minItems}.`
|
|
99213
|
-
)
|
|
99214
|
-
);
|
|
99215
|
-
}
|
|
99216
|
-
if (schema.maxItems !== void 0 && data.length > schema.maxItems) {
|
|
99217
|
-
return invalidSchemaResponseWithError(
|
|
99218
|
-
new MaxItemsViolationError(
|
|
99219
|
-
`Array at path '${path}' fails maxItems constraint. Has ${data.length} items, needs at most ${schema.maxItems}.`
|
|
99220
|
-
)
|
|
99221
|
-
);
|
|
99222
|
-
}
|
|
99223
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99224
|
-
data.forEach(
|
|
99225
|
-
(element, index) => errorCollector.append(
|
|
99226
|
-
validateJsonSchema(element, schema.items, `${path}[${index}]`, document)
|
|
99227
|
-
)
|
|
99228
|
-
);
|
|
99229
|
-
return errorCollector.toValidationResponse();
|
|
99230
|
-
}
|
|
99231
|
-
function validateScalar(data, schema, path) {
|
|
99232
|
-
const schemaDataType = schema.type;
|
|
99233
|
-
const dataType = typeof data;
|
|
99234
|
-
if (schemaDataType === "integer") {
|
|
99235
|
-
if (dataType !== "number" || !Number.isInteger(data)) {
|
|
99236
|
-
return invalidSchemaResponseWithError(incorrectTypeError("integer", dataType, path));
|
|
99237
|
-
}
|
|
99238
|
-
} else if (schemaDataType === "number") {
|
|
99239
|
-
if (dataType !== "number") {
|
|
99240
|
-
return invalidSchemaResponseWithError(incorrectTypeError("number", dataType, path));
|
|
99241
|
-
}
|
|
99242
|
-
} else if (schemaDataType === "string") {
|
|
99243
|
-
if (dataType !== "string") {
|
|
99244
|
-
return invalidSchemaResponseWithError(incorrectTypeError("string", dataType, path));
|
|
99245
|
-
}
|
|
99246
|
-
} else if (schemaDataType === "boolean") {
|
|
99247
|
-
if (dataType !== "boolean") {
|
|
99248
|
-
return invalidSchemaResponseWithError(incorrectTypeError("boolean", dataType, path));
|
|
99249
|
-
}
|
|
99250
|
-
} else if (schemaDataType === "null") {
|
|
99251
|
-
if (data !== null) {
|
|
99252
|
-
return invalidSchemaResponseWithError(incorrectTypeError("null", dataType, path));
|
|
99253
|
-
}
|
|
99254
|
-
} else {
|
|
99255
|
-
return invalidSchemaResponseWithError(
|
|
99256
|
-
new IncorrectTypeError(`Unknown schema data type: ${schemaDataType}.`)
|
|
99257
|
-
);
|
|
99258
|
-
}
|
|
99259
|
-
return validSchemaResponse();
|
|
99260
|
-
}
|
|
99261
|
-
function validateRef(data, schema, path, document) {
|
|
99262
|
-
if (!schema.$ref.startsWith("#")) {
|
|
99263
|
-
return invalidSchemaResponseWithError(
|
|
99264
|
-
new InvalidRefError(
|
|
99265
|
-
`$ref values that do not refer to the current document are unsupported (must start with '#')`
|
|
99266
|
-
)
|
|
99267
|
-
);
|
|
99268
|
-
}
|
|
99269
|
-
try {
|
|
99270
|
-
const schemaToValidate = findSchemaAtPath(document, schema.$ref);
|
|
99271
|
-
return validateJsonSchema(data, schemaToValidate, path, document);
|
|
99272
|
-
} catch (e) {
|
|
99273
|
-
return invalidSchemaResponseWithError(e);
|
|
99274
|
-
}
|
|
99275
|
-
}
|
|
99276
|
-
function validateEnum(data, enumValue, path) {
|
|
99277
|
-
if (!enumValue.some((value) => deepEquals$2(value, data))) {
|
|
99278
|
-
return invalidSchemaResponseWithError(
|
|
99279
|
-
new JsonSchemaViolationError(
|
|
99280
|
-
`Data at ${path} did not match any values in enum. Expected value in: [${enumValue.map((value) => stringify$9(value)).join()}]`
|
|
99281
|
-
)
|
|
99282
|
-
);
|
|
99283
|
-
}
|
|
99284
|
-
return validSchemaResponse();
|
|
99285
|
-
}
|
|
99286
|
-
function validateConst(data, constValue, path) {
|
|
99287
|
-
if (!deepEquals$2(constValue, data)) {
|
|
99288
|
-
return invalidSchemaResponseWithError(
|
|
99289
|
-
new JsonSchemaViolationError(
|
|
99290
|
-
`Data at ${path} did not match const. Expected: ${stringify$9(constValue)}`
|
|
99291
|
-
)
|
|
99292
|
-
);
|
|
99293
|
-
}
|
|
99294
|
-
return validSchemaResponse();
|
|
99295
|
-
}
|
|
99296
|
-
function findSchemaAtPath(document, ref) {
|
|
99297
|
-
if (ref === "#") return document;
|
|
99298
|
-
const keys = ref.replace(/^#\//, "").split("/");
|
|
99299
|
-
let current = document;
|
|
99300
|
-
let path = "#";
|
|
99301
|
-
for (const key of keys) {
|
|
99302
|
-
path = `${path}/${key}`;
|
|
99303
|
-
if (current[key] === void 0) {
|
|
99304
|
-
throw new InvalidRefError(
|
|
99305
|
-
`Invalid $ref value '${ref}'. Cannot find target schema at '${path}'`
|
|
99306
|
-
);
|
|
99307
|
-
}
|
|
99308
|
-
current = current[key];
|
|
99309
|
-
}
|
|
99310
|
-
return current;
|
|
99311
|
-
}
|
|
99312
|
-
|
|
99313
99266
|
/*!
|
|
99314
99267
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
99315
99268
|
* All rights reserved.
|
|
@@ -99358,35 +99311,35 @@
|
|
|
99358
99311
|
function extractVariableValue(variableName, variableDefinitions) {
|
|
99359
99312
|
const variable = variableDefinitions[variableName];
|
|
99360
99313
|
if (!variable) {
|
|
99361
|
-
return err$
|
|
99314
|
+
return err$3(
|
|
99362
99315
|
new Error(`Variable '${variableName}' was used in the query but was not defined`)
|
|
99363
99316
|
);
|
|
99364
99317
|
}
|
|
99365
99318
|
if (variable.value !== void 0) {
|
|
99366
|
-
return ok$
|
|
99319
|
+
return ok$3(variable.value);
|
|
99367
99320
|
}
|
|
99368
99321
|
if (variable.definition.defaultValue) {
|
|
99369
99322
|
return extractValue(variable.definition.defaultValue, variableDefinitions);
|
|
99370
99323
|
}
|
|
99371
|
-
return ok$
|
|
99324
|
+
return ok$3(void 0);
|
|
99372
99325
|
}
|
|
99373
99326
|
function validateExpectedType(value, expectedType) {
|
|
99374
99327
|
if (!expectedType) {
|
|
99375
|
-
return ok$
|
|
99328
|
+
return ok$3(value);
|
|
99376
99329
|
}
|
|
99377
99330
|
if (value === null) {
|
|
99378
99331
|
if (expectedType.nullable) {
|
|
99379
|
-
return ok$
|
|
99332
|
+
return ok$3(value);
|
|
99380
99333
|
} else {
|
|
99381
|
-
return err$
|
|
99334
|
+
return err$3(new Error(`Expected ${expectedType.type}, but got null`));
|
|
99382
99335
|
}
|
|
99383
99336
|
}
|
|
99384
99337
|
const actualType = typeof value;
|
|
99385
99338
|
if (actualType === expectedType.type) {
|
|
99386
|
-
return ok$
|
|
99339
|
+
return ok$3(value);
|
|
99387
99340
|
}
|
|
99388
99341
|
const expectedTypeString = expectedType.nullable ? `${expectedType.type} | null` : expectedType.type;
|
|
99389
|
-
return err$
|
|
99342
|
+
return err$3(
|
|
99390
99343
|
new Error(`Expected ${expectedTypeString}, but got ${actualType}: ${JSON.stringify(value)}`)
|
|
99391
99344
|
);
|
|
99392
99345
|
}
|
|
@@ -99429,10 +99382,10 @@
|
|
|
99429
99382
|
(def) => def.kind === Kind$1.OPERATION_DEFINITION
|
|
99430
99383
|
);
|
|
99431
99384
|
if (operations.length === 0) {
|
|
99432
|
-
return err$
|
|
99385
|
+
return err$3(new Error("No operations found in query"));
|
|
99433
99386
|
}
|
|
99434
99387
|
if (operations.length === 1 && !input.operationName) {
|
|
99435
|
-
return ok$
|
|
99388
|
+
return ok$3(operations[0]);
|
|
99436
99389
|
}
|
|
99437
99390
|
if (input.operationName) {
|
|
99438
99391
|
const specifiedOperation = operations.find((op) => {
|
|
@@ -99440,16 +99393,16 @@
|
|
|
99440
99393
|
return ((_a = op.name) == null ? void 0 : _a.value) === input.operationName;
|
|
99441
99394
|
});
|
|
99442
99395
|
if (specifiedOperation) {
|
|
99443
|
-
return ok$
|
|
99396
|
+
return ok$3(specifiedOperation);
|
|
99444
99397
|
}
|
|
99445
|
-
return err$
|
|
99398
|
+
return err$3(new Error(`Operation "${input.operationName}" not found in query`));
|
|
99446
99399
|
}
|
|
99447
|
-
return err$
|
|
99400
|
+
return err$3(new Error("Multiple operations found in query, and no operation name provided"));
|
|
99448
99401
|
}
|
|
99449
99402
|
function buildGraphQLInputExtension(input) {
|
|
99450
99403
|
const operationResult = findExecutableOperation(input);
|
|
99451
99404
|
if (operationResult.isErr()) {
|
|
99452
|
-
return err$
|
|
99405
|
+
return err$3(operationResult.error);
|
|
99453
99406
|
}
|
|
99454
99407
|
const operation = operationResult.value;
|
|
99455
99408
|
const selections = operation.selectionSet.selections;
|
|
@@ -99466,7 +99419,7 @@
|
|
|
99466
99419
|
prev[fragment.name.value] = fragment;
|
|
99467
99420
|
return prev;
|
|
99468
99421
|
}, {});
|
|
99469
|
-
return ok$
|
|
99422
|
+
return ok$3({
|
|
99470
99423
|
selections,
|
|
99471
99424
|
request: { definitions: { variables, fragments } },
|
|
99472
99425
|
parentFieldSelection: void 0
|
|
@@ -99624,13 +99577,13 @@
|
|
|
99624
99577
|
}
|
|
99625
99578
|
function buildFieldKey(canonicalFieldName, fieldArguments, variables) {
|
|
99626
99579
|
if (fieldArguments === void 0 || fieldArguments.length === 0) {
|
|
99627
|
-
return ok$
|
|
99580
|
+
return ok$3(canonicalFieldName);
|
|
99628
99581
|
}
|
|
99629
99582
|
const formattedArguments = {};
|
|
99630
99583
|
for (const arg of fieldArguments) {
|
|
99631
99584
|
const result = extractValue(arg.value, variables);
|
|
99632
99585
|
if (result.isErr()) {
|
|
99633
|
-
return err$
|
|
99586
|
+
return err$3(
|
|
99634
99587
|
new Error(
|
|
99635
99588
|
`Failed to extract argument '${arg.name.value}' for field '${canonicalFieldName}': ${result.error.message}`
|
|
99636
99589
|
)
|
|
@@ -99638,7 +99591,7 @@
|
|
|
99638
99591
|
}
|
|
99639
99592
|
formattedArguments[arg.name.value] = result.value;
|
|
99640
99593
|
}
|
|
99641
|
-
return ok$
|
|
99594
|
+
return ok$3(`${canonicalFieldName}::${stableJSONStringify$3({ args: formattedArguments })}`);
|
|
99642
99595
|
}
|
|
99643
99596
|
({
|
|
99644
99597
|
kind: Kind$1.FIELD,
|
|
@@ -99663,17 +99616,17 @@
|
|
|
99663
99616
|
var _a;
|
|
99664
99617
|
const ifArg = (_a = directive.arguments) == null ? void 0 : _a.find((arg) => arg.name.value === "if");
|
|
99665
99618
|
if (!ifArg) {
|
|
99666
|
-
return err$
|
|
99619
|
+
return err$3(new Error(`@${directiveName} directive requires an 'if' argument`));
|
|
99667
99620
|
}
|
|
99668
99621
|
const result = extractValue(ifArg.value, variables, { type: "boolean", nullable: false });
|
|
99669
99622
|
if (result.isErr()) {
|
|
99670
|
-
return err$
|
|
99623
|
+
return err$3(result.error);
|
|
99671
99624
|
}
|
|
99672
|
-
return ok$
|
|
99625
|
+
return ok$3(result.value);
|
|
99673
99626
|
}
|
|
99674
99627
|
function shouldSkip(selection, variables) {
|
|
99675
99628
|
if (!selection.directives || selection.directives.length === 0) {
|
|
99676
|
-
return ok$
|
|
99629
|
+
return ok$3(false);
|
|
99677
99630
|
}
|
|
99678
99631
|
for (const directive of selection.directives) {
|
|
99679
99632
|
if (directive.name.value === "skip") {
|
|
@@ -99682,7 +99635,7 @@
|
|
|
99682
99635
|
return ifResult;
|
|
99683
99636
|
}
|
|
99684
99637
|
if (ifResult.value === true) {
|
|
99685
|
-
return ok$
|
|
99638
|
+
return ok$3(true);
|
|
99686
99639
|
}
|
|
99687
99640
|
}
|
|
99688
99641
|
if (directive.name.value === "include") {
|
|
@@ -99691,11 +99644,11 @@
|
|
|
99691
99644
|
return ifResult;
|
|
99692
99645
|
}
|
|
99693
99646
|
if (ifResult.value === false) {
|
|
99694
|
-
return ok$
|
|
99647
|
+
return ok$3(true);
|
|
99695
99648
|
}
|
|
99696
99649
|
}
|
|
99697
99650
|
}
|
|
99698
|
-
return ok$
|
|
99651
|
+
return ok$3(false);
|
|
99699
99652
|
}
|
|
99700
99653
|
class BaseScalarFieldDef {
|
|
99701
99654
|
constructor(nullable) {
|
|
@@ -99703,11 +99656,11 @@
|
|
|
99703
99656
|
}
|
|
99704
99657
|
write(_cache, input) {
|
|
99705
99658
|
if (input.data === void 0) {
|
|
99706
|
-
return ok$
|
|
99659
|
+
return ok$3({ type: "missing" });
|
|
99707
99660
|
}
|
|
99708
99661
|
if (input.data === null) {
|
|
99709
99662
|
if (!this.nullable) {
|
|
99710
|
-
return err$
|
|
99663
|
+
return err$3([
|
|
99711
99664
|
{
|
|
99712
99665
|
type: "unknown",
|
|
99713
99666
|
error: new Error(
|
|
@@ -99717,14 +99670,14 @@
|
|
|
99717
99670
|
]);
|
|
99718
99671
|
}
|
|
99719
99672
|
}
|
|
99720
|
-
return ok$
|
|
99673
|
+
return ok$3({ type: "data", data: input.data });
|
|
99721
99674
|
}
|
|
99722
99675
|
read(_cache, input) {
|
|
99723
99676
|
const normalizedData = input.normalizedData;
|
|
99724
99677
|
if (normalizedData.type === "missing") {
|
|
99725
|
-
return ok$
|
|
99678
|
+
return ok$3(void 0);
|
|
99726
99679
|
}
|
|
99727
|
-
return ok$
|
|
99680
|
+
return ok$3(normalizedData.data);
|
|
99728
99681
|
}
|
|
99729
99682
|
augmentSelections(input) {
|
|
99730
99683
|
return input;
|
|
@@ -99746,11 +99699,11 @@
|
|
|
99746
99699
|
}
|
|
99747
99700
|
write(cache, input) {
|
|
99748
99701
|
if (input.data === void 0) {
|
|
99749
|
-
return ok$
|
|
99702
|
+
return ok$3({ type: "missing" });
|
|
99750
99703
|
}
|
|
99751
99704
|
if (input.data === null) {
|
|
99752
99705
|
if (!this.nullable) {
|
|
99753
|
-
return err$
|
|
99706
|
+
return err$3([
|
|
99754
99707
|
{
|
|
99755
99708
|
type: "unknown",
|
|
99756
99709
|
error: new Error(
|
|
@@ -99759,10 +99712,10 @@
|
|
|
99759
99712
|
}
|
|
99760
99713
|
]);
|
|
99761
99714
|
}
|
|
99762
|
-
return ok$
|
|
99715
|
+
return ok$3({ type: "data", data: input.data });
|
|
99763
99716
|
}
|
|
99764
99717
|
if (!Array.isArray(input.data)) {
|
|
99765
|
-
return err$
|
|
99718
|
+
return err$3([
|
|
99766
99719
|
{
|
|
99767
99720
|
type: "unknown",
|
|
99768
99721
|
error: new Error(
|
|
@@ -99790,18 +99743,18 @@
|
|
|
99790
99743
|
}
|
|
99791
99744
|
});
|
|
99792
99745
|
if (arrayNormalizationErrors.length > 0) {
|
|
99793
|
-
return err$
|
|
99746
|
+
return err$3(arrayNormalizationErrors);
|
|
99794
99747
|
}
|
|
99795
|
-
return ok$
|
|
99748
|
+
return ok$3({ type: "data", data: normalizedArray });
|
|
99796
99749
|
}
|
|
99797
99750
|
read(cache, input) {
|
|
99798
99751
|
const normalizedData = input.normalizedData;
|
|
99799
99752
|
if (normalizedData.type === "missing") {
|
|
99800
|
-
return ok$
|
|
99753
|
+
return ok$3(void 0);
|
|
99801
99754
|
}
|
|
99802
99755
|
if (normalizedData.data === null) {
|
|
99803
99756
|
if (!this.nullable) {
|
|
99804
|
-
return err$
|
|
99757
|
+
return err$3([
|
|
99805
99758
|
{
|
|
99806
99759
|
type: "unknown",
|
|
99807
99760
|
error: new Error(
|
|
@@ -99810,10 +99763,10 @@
|
|
|
99810
99763
|
}
|
|
99811
99764
|
]);
|
|
99812
99765
|
}
|
|
99813
|
-
return ok$
|
|
99766
|
+
return ok$3({ type: "data", data: null });
|
|
99814
99767
|
}
|
|
99815
99768
|
if (!Array.isArray(normalizedData.data)) {
|
|
99816
|
-
return err$
|
|
99769
|
+
return err$3([
|
|
99817
99770
|
{
|
|
99818
99771
|
type: "unknown",
|
|
99819
99772
|
error: new Error(
|
|
@@ -99838,9 +99791,9 @@
|
|
|
99838
99791
|
}
|
|
99839
99792
|
});
|
|
99840
99793
|
if (arrayDenormalizationErrors.length > 0) {
|
|
99841
|
-
return err$
|
|
99794
|
+
return err$3(arrayDenormalizationErrors);
|
|
99842
99795
|
}
|
|
99843
|
-
return ok$
|
|
99796
|
+
return ok$3(denormalizedArray);
|
|
99844
99797
|
}
|
|
99845
99798
|
}
|
|
99846
99799
|
class BaseObjectFieldDef {
|
|
@@ -99857,7 +99810,7 @@
|
|
|
99857
99810
|
write(cache, input) {
|
|
99858
99811
|
var _a;
|
|
99859
99812
|
if (!input.selection.selectionSet) {
|
|
99860
|
-
return err$
|
|
99813
|
+
return err$3([
|
|
99861
99814
|
{
|
|
99862
99815
|
type: "unknown",
|
|
99863
99816
|
error: new Error(
|
|
@@ -99867,11 +99820,11 @@
|
|
|
99867
99820
|
]);
|
|
99868
99821
|
}
|
|
99869
99822
|
if (input.data === void 0) {
|
|
99870
|
-
return ok$
|
|
99823
|
+
return ok$3({ type: "missing" });
|
|
99871
99824
|
}
|
|
99872
99825
|
if (input.data === null) {
|
|
99873
99826
|
if (!this.nullable) {
|
|
99874
|
-
return err$
|
|
99827
|
+
return err$3([
|
|
99875
99828
|
{
|
|
99876
99829
|
type: "unknown",
|
|
99877
99830
|
error: new Error(
|
|
@@ -99880,7 +99833,7 @@
|
|
|
99880
99833
|
}
|
|
99881
99834
|
]);
|
|
99882
99835
|
}
|
|
99883
|
-
return ok$
|
|
99836
|
+
return ok$3({ type: "data", data: null });
|
|
99884
99837
|
}
|
|
99885
99838
|
const writeResult = this.repository.write(cache, {
|
|
99886
99839
|
...input,
|
|
@@ -99893,12 +99846,12 @@
|
|
|
99893
99846
|
if (writeResult.isErr()) {
|
|
99894
99847
|
return writeResult;
|
|
99895
99848
|
}
|
|
99896
|
-
return ok$
|
|
99849
|
+
return ok$3({ type: "data", data: writeResult.value });
|
|
99897
99850
|
}
|
|
99898
99851
|
read(cache, input) {
|
|
99899
99852
|
var _a;
|
|
99900
99853
|
if (!input.selection.selectionSet) {
|
|
99901
|
-
return err$
|
|
99854
|
+
return err$3([
|
|
99902
99855
|
{
|
|
99903
99856
|
type: "unknown",
|
|
99904
99857
|
error: new Error(
|
|
@@ -99909,11 +99862,11 @@
|
|
|
99909
99862
|
}
|
|
99910
99863
|
const normalizedData = input.normalizedData;
|
|
99911
99864
|
if (normalizedData.type === "missing") {
|
|
99912
|
-
return ok$
|
|
99865
|
+
return ok$3(void 0);
|
|
99913
99866
|
}
|
|
99914
99867
|
if (normalizedData.data === null) {
|
|
99915
99868
|
if (!this.nullable) {
|
|
99916
|
-
return err$
|
|
99869
|
+
return err$3([
|
|
99917
99870
|
{
|
|
99918
99871
|
type: "unknown",
|
|
99919
99872
|
error: new Error(
|
|
@@ -99922,7 +99875,7 @@
|
|
|
99922
99875
|
}
|
|
99923
99876
|
]);
|
|
99924
99877
|
}
|
|
99925
|
-
return ok$
|
|
99878
|
+
return ok$3(null);
|
|
99926
99879
|
}
|
|
99927
99880
|
return this.repository.read(cache, {
|
|
99928
99881
|
...input,
|
|
@@ -100205,7 +100158,7 @@
|
|
|
100205
100158
|
var _a;
|
|
100206
100159
|
const fieldDef = this.getFieldDef(input, selection);
|
|
100207
100160
|
if (!fieldDef) {
|
|
100208
|
-
return err$
|
|
100161
|
+
return err$3(
|
|
100209
100162
|
new Error(
|
|
100210
100163
|
`Unknown field "${selection.name.value}" on type "${this.typeName}". Expected one of fields ${Object.keys(this.fields)}.`
|
|
100211
100164
|
)
|
|
@@ -100216,10 +100169,10 @@
|
|
|
100216
100169
|
input.request.definitions.variables
|
|
100217
100170
|
);
|
|
100218
100171
|
if (cacheFieldKeyResult.isErr()) {
|
|
100219
|
-
return err$
|
|
100172
|
+
return err$3(cacheFieldKeyResult.error);
|
|
100220
100173
|
}
|
|
100221
100174
|
const cacheFieldKey = cacheFieldKeyResult.value;
|
|
100222
|
-
return ok$
|
|
100175
|
+
return ok$3((_a = input.existingNormalizedData || input.normalizedData) == null ? void 0 : _a[cacheFieldKey]);
|
|
100223
100176
|
}
|
|
100224
100177
|
denormalizeFieldSelection(cache, input, selection, errorCollector) {
|
|
100225
100178
|
var _a;
|
|
@@ -100325,22 +100278,22 @@
|
|
|
100325
100278
|
return shouldSkipResult;
|
|
100326
100279
|
}
|
|
100327
100280
|
if (shouldSkipResult.value) {
|
|
100328
|
-
return ok$
|
|
100281
|
+
return ok$3(false);
|
|
100329
100282
|
}
|
|
100330
100283
|
return this.satisfiesFragmentTypeCondition(input, fragment);
|
|
100331
100284
|
}
|
|
100332
100285
|
satisfiesFragmentTypeCondition(_input, fragment) {
|
|
100333
100286
|
if (!fragment.typeCondition) {
|
|
100334
|
-
return ok$
|
|
100287
|
+
return ok$3(true);
|
|
100335
100288
|
}
|
|
100336
100289
|
const conditionalTypeName = fragment.typeCondition.name.value;
|
|
100337
100290
|
if (conditionalTypeName === this.typeName) {
|
|
100338
|
-
return ok$
|
|
100291
|
+
return ok$3(true);
|
|
100339
100292
|
}
|
|
100340
100293
|
if (this.implementedInterfaces.includes(conditionalTypeName)) {
|
|
100341
|
-
return ok$
|
|
100294
|
+
return ok$3(true);
|
|
100342
100295
|
}
|
|
100343
|
-
return ok$
|
|
100296
|
+
return ok$3(false);
|
|
100344
100297
|
}
|
|
100345
100298
|
getCacheKeyFieldArguments(selection) {
|
|
100346
100299
|
return selection.arguments;
|
|
@@ -100399,7 +100352,7 @@
|
|
|
100399
100352
|
const key = this.buildKey(this.buildKeyParams(input));
|
|
100400
100353
|
const normalized = this.normalizeData(cache, input);
|
|
100401
100354
|
if (normalized.isErr()) {
|
|
100402
|
-
return err$
|
|
100355
|
+
return err$3(normalized.error);
|
|
100403
100356
|
}
|
|
100404
100357
|
const existing = cache.get(key);
|
|
100405
100358
|
if (!deepEquals$2(existing == null ? void 0 : existing.value, normalized.value)) {
|
|
@@ -100408,7 +100361,7 @@
|
|
|
100408
100361
|
metadata: this.cacheMetadata
|
|
100409
100362
|
});
|
|
100410
100363
|
}
|
|
100411
|
-
return ok$
|
|
100364
|
+
return ok$3({
|
|
100412
100365
|
type: "link",
|
|
100413
100366
|
linkedKey: key
|
|
100414
100367
|
});
|
|
@@ -100423,7 +100376,7 @@
|
|
|
100423
100376
|
if (normalizeDataResult.isErr()) {
|
|
100424
100377
|
return normalizeDataResult;
|
|
100425
100378
|
}
|
|
100426
|
-
return ok$
|
|
100379
|
+
return ok$3(
|
|
100427
100380
|
deepMerge$2(
|
|
100428
100381
|
{},
|
|
100429
100382
|
(existingNormalizedData == null ? void 0 : existingNormalizedData.value) || {},
|
|
@@ -100493,7 +100446,7 @@
|
|
|
100493
100446
|
if (result.isErr()) {
|
|
100494
100447
|
return result;
|
|
100495
100448
|
}
|
|
100496
|
-
return ok$
|
|
100449
|
+
return ok$3({
|
|
100497
100450
|
data: result.value
|
|
100498
100451
|
});
|
|
100499
100452
|
}
|
|
@@ -100501,7 +100454,7 @@
|
|
|
100501
100454
|
var _a;
|
|
100502
100455
|
const operationResult = findExecutableOperation(input);
|
|
100503
100456
|
if (operationResult.isErr()) {
|
|
100504
|
-
return err$
|
|
100457
|
+
return err$3(operationResult.error);
|
|
100505
100458
|
}
|
|
100506
100459
|
const operation = operationResult.value;
|
|
100507
100460
|
const fragmentDefinitions = input.query.definitions.filter(
|
|
@@ -100524,7 +100477,7 @@
|
|
|
100524
100477
|
...operation,
|
|
100525
100478
|
selectionSet: { kind: Kind$1.SELECTION_SET, selections: augmentedOperationSelections }
|
|
100526
100479
|
};
|
|
100527
|
-
return ok$
|
|
100480
|
+
return ok$3({
|
|
100528
100481
|
...input.query,
|
|
100529
100482
|
definitions: [
|
|
100530
100483
|
...input.query.definitions.filter((def) => def.kind !== Kind$1.FRAGMENT_DEFINITION).map((def) => {
|
|
@@ -100559,7 +100512,7 @@
|
|
|
100559
100512
|
}
|
|
100560
100513
|
write(cache, input) {
|
|
100561
100514
|
if (typeof input.data !== "object") {
|
|
100562
|
-
return err$
|
|
100515
|
+
return err$3([
|
|
100563
100516
|
{
|
|
100564
100517
|
type: "unknown",
|
|
100565
100518
|
error: new Error(`Got a non-object value for ${this.typeName} field"`)
|
|
@@ -100569,7 +100522,7 @@
|
|
|
100569
100522
|
const discriminator = this.getTypeDiscriminator(input.data, input.selections);
|
|
100570
100523
|
const concreteTypeRepository = this.possibleTypes[discriminator];
|
|
100571
100524
|
if (!concreteTypeRepository) {
|
|
100572
|
-
return err$
|
|
100525
|
+
return err$3([
|
|
100573
100526
|
{
|
|
100574
100527
|
type: "unknown",
|
|
100575
100528
|
error: new Error(
|
|
@@ -100580,7 +100533,7 @@
|
|
|
100580
100533
|
}
|
|
100581
100534
|
const selectionErr = this.verifyInterfaceFields(input.selections);
|
|
100582
100535
|
if (selectionErr) {
|
|
100583
|
-
return err$
|
|
100536
|
+
return err$3(selectionErr);
|
|
100584
100537
|
}
|
|
100585
100538
|
const normalizeInput = {
|
|
100586
100539
|
...input,
|
|
@@ -100592,14 +100545,14 @@
|
|
|
100592
100545
|
};
|
|
100593
100546
|
const result = concreteTypeRepository.write(cache, normalizeInput);
|
|
100594
100547
|
if (result.isOk()) {
|
|
100595
|
-
return ok$
|
|
100548
|
+
return ok$3({ discriminator, data: result.value });
|
|
100596
100549
|
}
|
|
100597
100550
|
return result;
|
|
100598
100551
|
}
|
|
100599
100552
|
read(cache, input) {
|
|
100600
100553
|
const unionRep = input.normalizedData;
|
|
100601
100554
|
if (typeof unionRep.data !== "object" || unionRep.data === null) {
|
|
100602
|
-
return err$
|
|
100555
|
+
return err$3([
|
|
100603
100556
|
{
|
|
100604
100557
|
type: "unknown",
|
|
100605
100558
|
error: new Error(`Got a non-object value for ${this.typeName} field.`)
|
|
@@ -100609,7 +100562,7 @@
|
|
|
100609
100562
|
const discriminator = unionRep.discriminator;
|
|
100610
100563
|
const concreteRepository = this.possibleTypes[discriminator];
|
|
100611
100564
|
if (!concreteRepository) {
|
|
100612
|
-
return err$
|
|
100565
|
+
return err$3([
|
|
100613
100566
|
{
|
|
100614
100567
|
type: "unknown",
|
|
100615
100568
|
error: new Error(
|
|
@@ -100620,7 +100573,7 @@
|
|
|
100620
100573
|
}
|
|
100621
100574
|
const selectionErr = this.verifyInterfaceFields(input.selections);
|
|
100622
100575
|
if (selectionErr) {
|
|
100623
|
-
return err$
|
|
100576
|
+
return err$3(selectionErr);
|
|
100624
100577
|
}
|
|
100625
100578
|
const denormalizeInput = {
|
|
100626
100579
|
...input,
|
|
@@ -100725,7 +100678,7 @@
|
|
|
100725
100678
|
}
|
|
100726
100679
|
write(cache, input) {
|
|
100727
100680
|
if (typeof input.data !== "object") {
|
|
100728
|
-
return err$
|
|
100681
|
+
return err$3([
|
|
100729
100682
|
{
|
|
100730
100683
|
type: "unknown",
|
|
100731
100684
|
error: new Error(`Got a non-object value for ${this.typeName} field"`)
|
|
@@ -100735,7 +100688,7 @@
|
|
|
100735
100688
|
const discriminator = this.getTypeDiscriminator(input.data, input.selections);
|
|
100736
100689
|
const concreteTypeRepository = this.possibleTypes[discriminator];
|
|
100737
100690
|
if (!concreteTypeRepository) {
|
|
100738
|
-
return err$
|
|
100691
|
+
return err$3([
|
|
100739
100692
|
{
|
|
100740
100693
|
type: "unknown",
|
|
100741
100694
|
error: new Error(
|
|
@@ -100746,7 +100699,7 @@
|
|
|
100746
100699
|
}
|
|
100747
100700
|
const selectionErr = this.verifyUnionFields(input.selections);
|
|
100748
100701
|
if (selectionErr) {
|
|
100749
|
-
return err$
|
|
100702
|
+
return err$3(selectionErr);
|
|
100750
100703
|
}
|
|
100751
100704
|
const normalizeInput = {
|
|
100752
100705
|
...input,
|
|
@@ -100758,14 +100711,14 @@
|
|
|
100758
100711
|
};
|
|
100759
100712
|
const result = concreteTypeRepository.write(cache, normalizeInput);
|
|
100760
100713
|
if (result.isOk()) {
|
|
100761
|
-
return ok$
|
|
100714
|
+
return ok$3({ discriminator, data: result.value });
|
|
100762
100715
|
}
|
|
100763
100716
|
return result;
|
|
100764
100717
|
}
|
|
100765
100718
|
read(cache, input) {
|
|
100766
100719
|
const unionRep = input.normalizedData;
|
|
100767
100720
|
if (typeof unionRep.data !== "object" || unionRep.data === null) {
|
|
100768
|
-
return err$
|
|
100721
|
+
return err$3([
|
|
100769
100722
|
{
|
|
100770
100723
|
type: "unknown",
|
|
100771
100724
|
error: new Error(`Got a non-object value for ${this.typeName} field.`)
|
|
@@ -100775,7 +100728,7 @@
|
|
|
100775
100728
|
const discriminator = unionRep.discriminator;
|
|
100776
100729
|
const concreteRepository = this.possibleTypes[discriminator];
|
|
100777
100730
|
if (!concreteRepository) {
|
|
100778
|
-
return err$
|
|
100731
|
+
return err$3([
|
|
100779
100732
|
{
|
|
100780
100733
|
type: "unknown",
|
|
100781
100734
|
error: new Error(
|
|
@@ -100786,7 +100739,7 @@
|
|
|
100786
100739
|
}
|
|
100787
100740
|
const selectionErr = this.verifyUnionFields(input.selections);
|
|
100788
100741
|
if (selectionErr) {
|
|
100789
|
-
return err$
|
|
100742
|
+
return err$3(selectionErr);
|
|
100790
100743
|
}
|
|
100791
100744
|
const denormalizeInput = {
|
|
100792
100745
|
...input,
|
|
@@ -105305,7 +105258,7 @@
|
|
|
105305
105258
|
* @param typeName - The repository type name for error messages
|
|
105306
105259
|
* @returns Result<boolean, Error> - true if the fragment type condition is satisfied
|
|
105307
105260
|
*/
|
|
105308
|
-
function genericSatisfiesFragmentTypeCondition(superSatisfiesFragmentTypeCondition, input, fragment,
|
|
105261
|
+
function genericSatisfiesFragmentTypeCondition(superSatisfiesFragmentTypeCondition, input, fragment, _typeName) {
|
|
105309
105262
|
// First try the base class implementation
|
|
105310
105263
|
const result = superSatisfiesFragmentTypeCondition(input, fragment);
|
|
105311
105264
|
if (result.isErr() || result.value) {
|
|
@@ -105773,7 +105726,7 @@
|
|
|
105773
105726
|
}
|
|
105774
105727
|
|
|
105775
105728
|
class PolymorphicParentRelationshipRepository extends PolymorphicParentRelationshipRepository$1 {
|
|
105776
|
-
getTypeDiscriminator(
|
|
105729
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105777
105730
|
// Hardcoded to record representation since that's the only type of parent
|
|
105778
105731
|
// relationship possible
|
|
105779
105732
|
return 'RecordRepresentation';
|
|
@@ -105813,7 +105766,7 @@
|
|
|
105813
105766
|
}
|
|
105814
105767
|
|
|
105815
105768
|
class PolymorphicAggregateParentRelationshipRepository extends PolymorphicAggregateParentRelationshipRepository$1 {
|
|
105816
|
-
getTypeDiscriminator(
|
|
105769
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105817
105770
|
// Hardcoded to record aggregate since that's the only type of parent
|
|
105818
105771
|
// relationship possible
|
|
105819
105772
|
return 'RecordAggregate';
|
|
@@ -105870,6 +105823,7 @@
|
|
|
105870
105823
|
let idFieldSelection = input.selections.find((selection) => selection.kind === 'Field' && selection.name.value === 'Id');
|
|
105871
105824
|
// If Id exists in data but wasn't asked for, synthesize the selection like RecordRepresentation does
|
|
105872
105825
|
if (input.data.Id !== undefined && !idFieldSelection) {
|
|
105826
|
+
// eslint-disable-next-line no-param-reassign
|
|
105873
105827
|
input = {
|
|
105874
105828
|
...input,
|
|
105875
105829
|
selections: [
|
|
@@ -105917,7 +105871,7 @@
|
|
|
105917
105871
|
}
|
|
105918
105872
|
|
|
105919
105873
|
class SetupPolymorphicAggregateParentRelationshipRepository extends Setup__SetupPolymorphicAggregateParentRelationshipRepository {
|
|
105920
|
-
getTypeDiscriminator(
|
|
105874
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105921
105875
|
// Hardcoded to Setup__SetupRecordAggregate since that's the only type of parent
|
|
105922
105876
|
// relationship possible
|
|
105923
105877
|
return 'Setup__SetupRecordAggregate';
|
|
@@ -105925,7 +105879,7 @@
|
|
|
105925
105879
|
}
|
|
105926
105880
|
|
|
105927
105881
|
class SetupPolymorphicParentRelationshipRepository extends Setup__SetupPolymorphicParentRelationshipRepository {
|
|
105928
|
-
getTypeDiscriminator(
|
|
105882
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105929
105883
|
// Hardcoded to Setup__EntityRepresentation since that's the only type of parent
|
|
105930
105884
|
// relationship possible
|
|
105931
105885
|
return 'Setup__EntityRepresentation';
|
|
@@ -106066,6 +106020,7 @@
|
|
|
106066
106020
|
const dataType = typeof data;
|
|
106067
106021
|
const extensionsType = typeof extensions;
|
|
106068
106022
|
if (dataType === 'function' || extensionsType === 'function') {
|
|
106023
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
106069
106024
|
throw new Error('Cannot merge functions');
|
|
106070
106025
|
}
|
|
106071
106026
|
if (dataType === 'undefined' || data === undefined) {
|
|
@@ -106406,7 +106361,9 @@
|
|
|
106406
106361
|
});
|
|
106407
106362
|
this.unsubscribers.push(unsubscribeFromLuvioSnapshot);
|
|
106408
106363
|
}
|
|
106409
|
-
catch (error) {
|
|
106364
|
+
catch (error) {
|
|
106365
|
+
// intentionally do nothing
|
|
106366
|
+
}
|
|
106410
106367
|
}
|
|
106411
106368
|
}
|
|
106412
106369
|
usedRecordsChanged() {
|
|
@@ -106512,6 +106469,7 @@
|
|
|
106512
106469
|
const invalidKeys = configKeys.filter((key) => !allowedKeysSet.includes(key));
|
|
106513
106470
|
if (invalidKeys.length > 0) {
|
|
106514
106471
|
// invalid keys, so set error state
|
|
106472
|
+
// eslint-disable-next-line no-throw-literal
|
|
106515
106473
|
throw {
|
|
106516
106474
|
error: `Invalid config keys: ${invalidKeys.join(', ')}`,
|
|
106517
106475
|
errorType: 'adapterError',
|
|
@@ -106876,7 +106834,7 @@
|
|
|
106876
106834
|
_(config, CONFIG_SCHEMA);
|
|
106877
106835
|
const baseCommand = new graphql_imperative_ctor(config, documentRootType, services);
|
|
106878
106836
|
return applyDecorators(baseCommand, [services.fetchNetworkCommandBaseClass.availableDecorators.abortable], options);
|
|
106879
|
-
},
|
|
106837
|
+
}, true);
|
|
106880
106838
|
graphql_imperative_legacy = services.graphQLLegacyImperativeBindings.bind(({ config, assertIsValid }) => {
|
|
106881
106839
|
const _ = assertIsValid;
|
|
106882
106840
|
_(config, CONFIG_SCHEMA);
|
|
@@ -106886,6 +106844,7 @@
|
|
|
106886
106844
|
services.graphQLLegacyImperativeBindings.bind(({ config, assertIsValid }) => {
|
|
106887
106845
|
const validatedConfig = validateNonQueryGraphQLConfig(config);
|
|
106888
106846
|
if (validatedConfig.isErr()) {
|
|
106847
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
106889
106848
|
throw new Error(`Invalid configuration passed to GraphQL: ${validatedConfig.error}`);
|
|
106890
106849
|
}
|
|
106891
106850
|
const _ = assertIsValid;
|
|
@@ -106897,11 +106856,12 @@
|
|
|
106897
106856
|
*/
|
|
106898
106857
|
const graphql_state_manager_ctor = services.instrumentCommand(buildCommandClass(services.auraGraphQLNormalizedCacheControlCommand), 'graphql_state_manager');
|
|
106899
106858
|
const factory = (config) => {
|
|
106900
|
-
assertIsValid(config, CONFIG_SCHEMA);
|
|
106859
|
+
assertIsValid$1(config, CONFIG_SCHEMA);
|
|
106901
106860
|
const validatedConfig = resolveAndValidateGraphQLConfig(config, {
|
|
106902
106861
|
acceptedOperations: ['query'],
|
|
106903
106862
|
});
|
|
106904
106863
|
if (validatedConfig === undefined || validatedConfig.isErr()) {
|
|
106864
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
106905
106865
|
throw new Error('Internal error in GraphQL adapter occurred: Unable to resolve query');
|
|
106906
106866
|
}
|
|
106907
106867
|
return new graphql_state_manager_ctor(validatedConfig.value, documentRootType, services);
|
|
@@ -106929,7 +106889,7 @@
|
|
|
106929
106889
|
cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
|
|
106930
106890
|
}
|
|
106931
106891
|
}
|
|
106932
|
-
// version: 1.
|
|
106892
|
+
// version: 1.434.0-6aa2dd15e3
|
|
106933
106893
|
|
|
106934
106894
|
function createFragmentMap(documentNode) {
|
|
106935
106895
|
const fragments = {};
|
|
@@ -134958,28 +134918,23 @@
|
|
|
134958
134918
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
134959
134919
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
134960
134920
|
* be reached by following 1 relationship from the root record, etc.
|
|
134961
|
-
* @defaultValue '
|
|
134921
|
+
* @defaultValue '1'
|
|
134962
134922
|
*/
|
|
134963
|
-
let trackedFieldDepthOnCacheMiss$1 =
|
|
134923
|
+
let trackedFieldDepthOnCacheMiss$1 = 1;
|
|
134964
134924
|
/**
|
|
134965
134925
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
134966
134926
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
134967
134927
|
* be reached by following 1 relationship from the root record, etc.
|
|
134968
|
-
* @defaultValue '
|
|
134928
|
+
* @defaultValue '1'
|
|
134969
134929
|
*/
|
|
134970
|
-
let trackedFieldDepthOnCacheMergeConflict$1 =
|
|
134930
|
+
let trackedFieldDepthOnCacheMergeConflict$1 = 1;
|
|
134971
134931
|
/**
|
|
134972
134932
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
134973
134933
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
134974
134934
|
* be reached by following 1 relationship from the root record, etc.
|
|
134975
|
-
* @defaultValue '
|
|
134935
|
+
* @defaultValue '1'
|
|
134976
134936
|
*/
|
|
134977
|
-
let trackedFieldDepthOnNotifyChange$1 =
|
|
134978
|
-
/**
|
|
134979
|
-
* Determines if we will only fetch the 'Id' field for the leaf relationship record
|
|
134980
|
-
* @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
|
|
134981
|
-
*/
|
|
134982
|
-
let trackedFieldLeafNodeIdAndNameOnly$1 = false;
|
|
134937
|
+
let trackedFieldDepthOnNotifyChange$1 = 1;
|
|
134983
134938
|
/**
|
|
134984
134939
|
* One store enabled Get Object Info adapter
|
|
134985
134940
|
*/
|
|
@@ -135076,12 +135031,6 @@
|
|
|
135076
135031
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
135077
135032
|
return trackedFieldDepthOnNotifyChange$1;
|
|
135078
135033
|
},
|
|
135079
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
135080
|
-
trackedFieldLeafNodeIdAndNameOnly$1 = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
135081
|
-
},
|
|
135082
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
135083
|
-
return trackedFieldLeafNodeIdAndNameOnly$1;
|
|
135084
|
-
},
|
|
135085
135034
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
135086
135035
|
recordRepresentationIngestionOverride$1 = ingest;
|
|
135087
135036
|
},
|
|
@@ -135638,6 +135587,7 @@
|
|
|
135638
135587
|
if (typeof data?.refresh === 'function') {
|
|
135639
135588
|
return data.refresh();
|
|
135640
135589
|
}
|
|
135590
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
135641
135591
|
throw new Error('Component attempted to refresh a GraphQL result that is not refreshable');
|
|
135642
135592
|
};
|
|
135643
135593
|
}
|
|
@@ -136146,7 +136096,7 @@
|
|
|
136146
136096
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
136147
136097
|
instrument: instrument$1,
|
|
136148
136098
|
});
|
|
136149
|
-
// version: 1.
|
|
136099
|
+
// version: 1.434.0-6aa2dd15e3
|
|
136150
136100
|
|
|
136151
136101
|
// On core the unstable adapters are re-exported with different names,
|
|
136152
136102
|
// we want to match them here.
|
|
@@ -136298,7 +136248,7 @@
|
|
|
136298
136248
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
136299
136249
|
graphQLImperative = ldsAdapter;
|
|
136300
136250
|
});
|
|
136301
|
-
// version: 1.
|
|
136251
|
+
// version: 1.434.0-6aa2dd15e3
|
|
136302
136252
|
|
|
136303
136253
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
136304
136254
|
__proto__: null,
|
|
@@ -137097,7 +137047,7 @@
|
|
|
137097
137047
|
function register(r) {
|
|
137098
137048
|
callbacks$1.forEach((callback) => callback(r));
|
|
137099
137049
|
}
|
|
137100
|
-
// version: 1.
|
|
137050
|
+
// version: 1.434.0-d8deb0d4ea
|
|
137101
137051
|
|
|
137102
137052
|
/**
|
|
137103
137053
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -137133,28 +137083,23 @@
|
|
|
137133
137083
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
137134
137084
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
137135
137085
|
* be reached by following 1 relationship from the root record, etc.
|
|
137136
|
-
* @defaultValue '
|
|
137086
|
+
* @defaultValue '1'
|
|
137137
137087
|
*/
|
|
137138
|
-
let trackedFieldDepthOnCacheMiss =
|
|
137088
|
+
let trackedFieldDepthOnCacheMiss = 1;
|
|
137139
137089
|
/**
|
|
137140
137090
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
137141
137091
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
137142
137092
|
* be reached by following 1 relationship from the root record, etc.
|
|
137143
|
-
* @defaultValue '
|
|
137093
|
+
* @defaultValue '1'
|
|
137144
137094
|
*/
|
|
137145
|
-
let trackedFieldDepthOnCacheMergeConflict =
|
|
137095
|
+
let trackedFieldDepthOnCacheMergeConflict = 1;
|
|
137146
137096
|
/**
|
|
137147
137097
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
137148
137098
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
137149
137099
|
* be reached by following 1 relationship from the root record, etc.
|
|
137150
|
-
* @defaultValue '
|
|
137151
|
-
*/
|
|
137152
|
-
let trackedFieldDepthOnNotifyChange = 5;
|
|
137153
|
-
/**
|
|
137154
|
-
* Determines if we will only fetch the 'Id' field for the leaf relationship record
|
|
137155
|
-
* @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
|
|
137100
|
+
* @defaultValue '1'
|
|
137156
137101
|
*/
|
|
137157
|
-
let
|
|
137102
|
+
let trackedFieldDepthOnNotifyChange = 1;
|
|
137158
137103
|
/**
|
|
137159
137104
|
* One store enabled Get Object Info adapter
|
|
137160
137105
|
*/
|
|
@@ -137251,12 +137196,6 @@
|
|
|
137251
137196
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
137252
137197
|
return trackedFieldDepthOnNotifyChange;
|
|
137253
137198
|
},
|
|
137254
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
137255
|
-
trackedFieldLeafNodeIdAndNameOnly = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
137256
|
-
},
|
|
137257
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
137258
|
-
return trackedFieldLeafNodeIdAndNameOnly;
|
|
137259
|
-
},
|
|
137260
137199
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
137261
137200
|
recordRepresentationIngestionOverride = ingest;
|
|
137262
137201
|
},
|
|
@@ -138151,6 +138090,7 @@
|
|
|
138151
138090
|
const LUVIO_ADAPTER_FAMILY = /^force\/ldsAdapters/;
|
|
138152
138091
|
async function importLuvioAdapterModule(specifier) {
|
|
138153
138092
|
if (!LUVIO_ADAPTER_FAMILY.test(specifier)) {
|
|
138093
|
+
// eslint-disable-next-line no-throw-literal
|
|
138154
138094
|
throw `${specifier} is not an allowed luvio adapter module`;
|
|
138155
138095
|
}
|
|
138156
138096
|
let module;
|
|
@@ -138158,6 +138098,7 @@
|
|
|
138158
138098
|
module = await import(specifier);
|
|
138159
138099
|
}
|
|
138160
138100
|
catch {
|
|
138101
|
+
// eslint-disable-next-line no-throw-literal
|
|
138161
138102
|
throw `module not found for specifier ${specifier}`;
|
|
138162
138103
|
}
|
|
138163
138104
|
return new LuvioAdapterModule(module);
|
|
@@ -138271,6 +138212,7 @@
|
|
|
138271
138212
|
}
|
|
138272
138213
|
async function importOneStoreAdapterModule(specifier) {
|
|
138273
138214
|
if (!ONESTORE_ADAPTER_FAMILY.test(specifier)) {
|
|
138215
|
+
// eslint-disable-next-line no-throw-literal
|
|
138274
138216
|
throw `${specifier} is not an allowed onestore adapter module`;
|
|
138275
138217
|
}
|
|
138276
138218
|
let module;
|
|
@@ -138278,6 +138220,7 @@
|
|
|
138278
138220
|
module = await import(specifier);
|
|
138279
138221
|
}
|
|
138280
138222
|
catch {
|
|
138223
|
+
// eslint-disable-next-line no-throw-literal
|
|
138281
138224
|
throw `module not found for specifier ${specifier}`;
|
|
138282
138225
|
}
|
|
138283
138226
|
return new OneStoreAdapterModule(module);
|
|
@@ -138414,4 +138357,4 @@
|
|
|
138414
138357
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
138415
138358
|
|
|
138416
138359
|
}));
|
|
138417
|
-
// version: 1.
|
|
138360
|
+
// version: 1.434.0-d8deb0d4ea
|