@salesforce/lds-worker-api 1.433.0 → 1.435.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 +913 -805
- 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 +913 -805
- 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.435.0-5818ce3c48
|
|
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.435.0-5818ce3c48
|
|
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,
|
|
@@ -12971,17 +12938,15 @@
|
|
|
12971
12938
|
return objectInfo.fields[fieldApiName].relationshipName;
|
|
12972
12939
|
}
|
|
12973
12940
|
function getNameField$1(objectInfo, fieldApiName) {
|
|
12974
|
-
// eslint-disable-next-line @salesforce/lds/no-invalid-todo
|
|
12975
|
-
// TODO - this logic is adopted from lds222. It searches
|
|
12976
|
-
// ObjectInfoRep.ReferenceToInfoRep[].nameFields[]:
|
|
12977
|
-
// 1. If any of the arrays are empty returns `Name`
|
|
12978
|
-
// 2. If `Name` is found in any array position then returns it
|
|
12979
|
-
// 3. If the field has more than 1 references(polymorphic), return `Name`
|
|
12980
|
-
// 4. Else returns ObjectInfoRep.ReferenceToInfoRep[0].nameFields[0]
|
|
12981
|
-
// Rationale for this is unclear and needs clarification.
|
|
12982
12941
|
const referenceToInfos = objectInfo.fields[fieldApiName].referenceToInfos;
|
|
12983
12942
|
if (referenceToInfos.length !== 1) {
|
|
12984
|
-
return
|
|
12943
|
+
// For polymorphic fields, return "Name" only if at least one referenced entity has it.
|
|
12944
|
+
// If no entity in the domain set has a Name field (e.g. ContextTag uses "Title"),
|
|
12945
|
+
// sending "Name" to getRecordWithFields causes INVALID_FIELD at the DB layer (W-22253765).
|
|
12946
|
+
// We stay permissive for mixed cases (some have Name, some don't) — those are handled
|
|
12947
|
+
// server-side once W-22253765's companion fix lands in QueryValidatorImpl.
|
|
12948
|
+
const anyHaveName = referenceToInfos.some((ref) => ref.nameFields.includes(FIELD_NAME$1));
|
|
12949
|
+
return anyHaveName ? FIELD_NAME$1 : undefined;
|
|
12985
12950
|
}
|
|
12986
12951
|
const firstReferenceNameFields = referenceToInfos[0].nameFields;
|
|
12987
12952
|
if (firstReferenceNameFields.length < 1) {
|
|
@@ -13016,8 +12981,11 @@
|
|
|
13016
12981
|
// By default, include the "Id" field on spanning records that are on the layout.
|
|
13017
12982
|
qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID$1}`);
|
|
13018
12983
|
const nameField = getNameField$1(objectInfo, apiName);
|
|
13019
|
-
// W-15692973: Name field of referenced
|
|
13020
|
-
|
|
12984
|
+
// W-15692973: Name field of referenced entities are moved to optionalFields since the Name field may not exist for few entities.
|
|
12985
|
+
// W-22253765: For polymorphic FKs where not all entities have "Name", nameField is undefined — skip the optional field entirely.
|
|
12986
|
+
if (nameField !== undefined) {
|
|
12987
|
+
qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
|
|
12988
|
+
}
|
|
13021
12989
|
}
|
|
13022
12990
|
qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
|
|
13023
12991
|
}
|
|
@@ -13051,8 +13019,11 @@
|
|
|
13051
13019
|
// Include the Id field. Ex: Opportunity.Account.Id, Opportunity.relation1__r.Id
|
|
13052
13020
|
const idFieldName = `${apiName}.${relationshipName}.Id`;
|
|
13053
13021
|
lookupFields[idFieldName] = true;
|
|
13054
|
-
const
|
|
13055
|
-
|
|
13022
|
+
const resolvedNameField = getNameField$1(objectInfo, fieldName);
|
|
13023
|
+
// W-22253765: skip the name field for polymorphic FKs where not all entities have "Name"
|
|
13024
|
+
if (resolvedNameField !== undefined) {
|
|
13025
|
+
lookupFields[`${apiName}.${relationshipName}.${resolvedNameField}`] = true;
|
|
13026
|
+
}
|
|
13056
13027
|
}
|
|
13057
13028
|
return keys$9(lookupFields);
|
|
13058
13029
|
}
|
|
@@ -13912,7 +13883,6 @@
|
|
|
13912
13883
|
const node = luvio.wrapNormalizedGraphNode(record, key);
|
|
13913
13884
|
const optionalFields = getTrackedFields$1(key, node, {
|
|
13914
13885
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnNotifyChange(),
|
|
13915
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
13916
13886
|
});
|
|
13917
13887
|
const refreshRequest = createResourceRequestFromRepresentation(record, optionalFields);
|
|
13918
13888
|
const existingWeakEtag = record.weakEtag;
|
|
@@ -16501,7 +16471,6 @@
|
|
|
16501
16471
|
const key = keyBuilder$1w$2(luvio, config);
|
|
16502
16472
|
const trackedFieldsConfig = {
|
|
16503
16473
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
16504
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly()
|
|
16505
16474
|
};
|
|
16506
16475
|
const optionalFieldsTrie = convertFieldsToTrie$1(getTrackedFields$1(key, luvio.getNode(key), trackedFieldsConfig, config.optionalFields));
|
|
16507
16476
|
const fieldsTrie = BLANK_RECORD_FIELDS_TRIE$1;
|
|
@@ -30545,7 +30514,6 @@
|
|
|
30545
30514
|
...resourceRequest.queryParams,
|
|
30546
30515
|
optionalFields: getTrackedFields$1(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
30547
30516
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
30548
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
30549
30517
|
}, config.optionalFields),
|
|
30550
30518
|
},
|
|
30551
30519
|
});
|
|
@@ -31080,7 +31048,6 @@
|
|
|
31080
31048
|
...resourceRequest.queryParams,
|
|
31081
31049
|
optionalFields: getTrackedFields$1(recordTemplateKey, luvio.getNode(recordTemplateKey), {
|
|
31082
31050
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
31083
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
31084
31051
|
}, config.optionalFields),
|
|
31085
31052
|
},
|
|
31086
31053
|
});
|
|
@@ -31100,7 +31067,6 @@
|
|
|
31100
31067
|
});
|
|
31101
31068
|
const allTrackedFields = getTrackedFields$1(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
31102
31069
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
31103
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
31104
31070
|
}, optionalFields);
|
|
31105
31071
|
const allTrackedFieldsTrie = convertFieldsToTrie$1(allTrackedFields, true);
|
|
31106
31072
|
const ingest = createFieldsIngestSuccess$4({
|
|
@@ -32556,7 +32522,7 @@
|
|
|
32556
32522
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
32557
32523
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
32558
32524
|
});
|
|
32559
|
-
// version: 1.
|
|
32525
|
+
// version: 1.435.0-615ebb9bbd
|
|
32560
32526
|
|
|
32561
32527
|
var allowUpdatesForNonCachedRecords = {
|
|
32562
32528
|
isOpen: function (e) {
|
|
@@ -44206,7 +44172,7 @@
|
|
|
44206
44172
|
const { hasOwnProperty: hasOwnProperty$3 } = Object.prototype;
|
|
44207
44173
|
const { isArray: isArray$7 } = Array;
|
|
44208
44174
|
const { stringify: stringify$9, parse: parse$9 } = JSON;
|
|
44209
|
-
let Ok$
|
|
44175
|
+
let Ok$3 = class Ok {
|
|
44210
44176
|
constructor(value) {
|
|
44211
44177
|
this.value = value;
|
|
44212
44178
|
}
|
|
@@ -44217,7 +44183,7 @@
|
|
|
44217
44183
|
return !this.isOk();
|
|
44218
44184
|
}
|
|
44219
44185
|
};
|
|
44220
|
-
let Err$
|
|
44186
|
+
let Err$3 = class Err {
|
|
44221
44187
|
constructor(error) {
|
|
44222
44188
|
this.error = error;
|
|
44223
44189
|
}
|
|
@@ -44228,8 +44194,8 @@
|
|
|
44228
44194
|
return !this.isOk();
|
|
44229
44195
|
}
|
|
44230
44196
|
};
|
|
44231
|
-
const ok$
|
|
44232
|
-
const err$
|
|
44197
|
+
const ok$3 = (value) => new Ok$3(value);
|
|
44198
|
+
const err$3 = (err2) => new Err$3(err2);
|
|
44233
44199
|
function resolvedPromiseLike$4(result) {
|
|
44234
44200
|
if (isPromiseLike$4(result)) {
|
|
44235
44201
|
return result.then((nextResult) => nextResult);
|
|
@@ -44372,6 +44338,15 @@
|
|
|
44372
44338
|
const requestedN = requested.split(".").map((s) => parseInt(s));
|
|
44373
44339
|
return providedN[0] === requestedN[0] && providedN[1] >= requestedN[1];
|
|
44374
44340
|
}
|
|
44341
|
+
function isUserVisibleError$3(error) {
|
|
44342
|
+
return error instanceof Error && "type" in error && error.type === "user-visible";
|
|
44343
|
+
}
|
|
44344
|
+
function logError$2(error) {
|
|
44345
|
+
if (isUserVisibleError$3(error)) {
|
|
44346
|
+
return;
|
|
44347
|
+
}
|
|
44348
|
+
console.error("OneStore Command threw an error that we did not expect", error);
|
|
44349
|
+
}
|
|
44375
44350
|
|
|
44376
44351
|
/*!
|
|
44377
44352
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44471,20 +44446,20 @@
|
|
|
44471
44446
|
const existingNormalizedData = (_a = cache.get(key)) == null ? void 0 : _a.value;
|
|
44472
44447
|
const normalized = this.normalizeData(cache, { ...input, existingNormalizedData });
|
|
44473
44448
|
if (normalized.isErr()) {
|
|
44474
|
-
return err$
|
|
44449
|
+
return err$3(normalized.error);
|
|
44475
44450
|
}
|
|
44476
44451
|
cache.set(key, {
|
|
44477
44452
|
value: normalized.value,
|
|
44478
44453
|
metadata: this.cacheMetadata
|
|
44479
44454
|
});
|
|
44480
|
-
return ok$
|
|
44455
|
+
return ok$3({
|
|
44481
44456
|
type: "link",
|
|
44482
44457
|
linkedKey: key
|
|
44483
44458
|
});
|
|
44484
44459
|
}
|
|
44485
44460
|
validateEntry(entry) {
|
|
44486
44461
|
if (!isCacheEntryForType(entry, this)) {
|
|
44487
|
-
return err$
|
|
44462
|
+
return err$3([
|
|
44488
44463
|
{
|
|
44489
44464
|
type: "incorrectType",
|
|
44490
44465
|
expectedType: this.typeName,
|
|
@@ -44492,7 +44467,7 @@
|
|
|
44492
44467
|
}
|
|
44493
44468
|
]);
|
|
44494
44469
|
}
|
|
44495
|
-
return ok$
|
|
44470
|
+
return ok$3(void 0);
|
|
44496
44471
|
}
|
|
44497
44472
|
query(cache, query) {
|
|
44498
44473
|
return this.read(cache, {
|
|
@@ -44510,12 +44485,12 @@
|
|
|
44510
44485
|
if (cacheEntry) {
|
|
44511
44486
|
const validationResult = this.validateEntry(cacheEntry);
|
|
44512
44487
|
if (validationResult.isErr()) {
|
|
44513
|
-
return err$
|
|
44488
|
+
return err$3([...validationResult.error]);
|
|
44514
44489
|
}
|
|
44515
44490
|
const normalizedData = cacheEntry.value;
|
|
44516
44491
|
return this.denormalizeData(cache, { ...input, normalizedData });
|
|
44517
44492
|
}
|
|
44518
|
-
return err$
|
|
44493
|
+
return err$3([this.buildMissingDataError()]);
|
|
44519
44494
|
}
|
|
44520
44495
|
equals(x, y) {
|
|
44521
44496
|
return deepEquals$2(x, y);
|
|
@@ -44538,9 +44513,443 @@
|
|
|
44538
44513
|
}
|
|
44539
44514
|
function buildReadWriteResult(data, errors) {
|
|
44540
44515
|
if (errors.length > 0) {
|
|
44541
|
-
return err$
|
|
44516
|
+
return err$3(errors);
|
|
44517
|
+
}
|
|
44518
|
+
return ok$3(data);
|
|
44519
|
+
}
|
|
44520
|
+
|
|
44521
|
+
/*!
|
|
44522
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
44523
|
+
* All rights reserved.
|
|
44524
|
+
* For full license text, see the LICENSE.txt file
|
|
44525
|
+
*/
|
|
44526
|
+
let JsonSchemaViolationError$1 = class JsonSchemaViolationError extends Error {
|
|
44527
|
+
constructor(message, validationErrors) {
|
|
44528
|
+
super(message);
|
|
44529
|
+
this.validationErrors = [];
|
|
44530
|
+
this.validationErrors = validationErrors || [];
|
|
44531
|
+
}
|
|
44532
|
+
};
|
|
44533
|
+
let MinItemsViolationError$1 = class MinItemsViolationError extends JsonSchemaViolationError$1 {
|
|
44534
|
+
};
|
|
44535
|
+
let MaxItemsViolationError$1 = class MaxItemsViolationError extends JsonSchemaViolationError$1 {
|
|
44536
|
+
};
|
|
44537
|
+
let IncorrectTypeError$1 = class IncorrectTypeError extends JsonSchemaViolationError$1 {
|
|
44538
|
+
};
|
|
44539
|
+
let AdditionalPropertiesError$1 = class AdditionalPropertiesError extends JsonSchemaViolationError$1 {
|
|
44540
|
+
};
|
|
44541
|
+
let MissingRequiredPropertyError$1 = class MissingRequiredPropertyError extends JsonSchemaViolationError$1 {
|
|
44542
|
+
};
|
|
44543
|
+
let InvalidRefError$1 = class InvalidRefError extends JsonSchemaViolationError$1 {
|
|
44544
|
+
};
|
|
44545
|
+
let JsonSchemaErrorCollector$1 = class JsonSchemaErrorCollector {
|
|
44546
|
+
constructor() {
|
|
44547
|
+
this.errors = [];
|
|
44548
|
+
}
|
|
44549
|
+
add(error) {
|
|
44550
|
+
this.errors.push(error);
|
|
44551
|
+
}
|
|
44552
|
+
append(response) {
|
|
44553
|
+
if (response.isErr()) {
|
|
44554
|
+
this.errors.push(...response.error);
|
|
44555
|
+
}
|
|
44556
|
+
}
|
|
44557
|
+
hasErrors() {
|
|
44558
|
+
return this.errors.length > 0;
|
|
44559
|
+
}
|
|
44560
|
+
prepend(error) {
|
|
44561
|
+
this.errors.unshift(error);
|
|
44562
|
+
}
|
|
44563
|
+
toValidationResponse() {
|
|
44564
|
+
return !this.hasErrors() ? ok$3(true) : err$3(this.errors);
|
|
44565
|
+
}
|
|
44566
|
+
};
|
|
44567
|
+
function createThrowableError$1(errors) {
|
|
44568
|
+
if (errors[0] instanceof MinItemsViolationError$1) {
|
|
44569
|
+
return new MinItemsViolationError$1(errors[0].message, errors);
|
|
44570
|
+
}
|
|
44571
|
+
if (errors[0] instanceof MaxItemsViolationError$1) {
|
|
44572
|
+
return new MaxItemsViolationError$1(errors[0].message, errors);
|
|
44573
|
+
}
|
|
44574
|
+
if (errors[0] instanceof IncorrectTypeError$1) {
|
|
44575
|
+
return new IncorrectTypeError$1(errors[0].message, errors);
|
|
44576
|
+
}
|
|
44577
|
+
if (errors[0] instanceof AdditionalPropertiesError$1) {
|
|
44578
|
+
return new AdditionalPropertiesError$1(errors[0].message, errors);
|
|
44579
|
+
}
|
|
44580
|
+
if (errors[0] instanceof MissingRequiredPropertyError$1) {
|
|
44581
|
+
return new MissingRequiredPropertyError$1(errors[0].message, errors);
|
|
44582
|
+
}
|
|
44583
|
+
if (errors[0] instanceof InvalidRefError$1) {
|
|
44584
|
+
return new InvalidRefError$1(errors[0].message, errors);
|
|
44585
|
+
}
|
|
44586
|
+
return new JsonSchemaViolationError$1(errors[0].message, errors);
|
|
44587
|
+
}
|
|
44588
|
+
function assertIsValid$1(data, schema) {
|
|
44589
|
+
const validationResponse = validateJsonSchema$1(data, schema);
|
|
44590
|
+
if (validationResponse.isErr()) {
|
|
44591
|
+
throw createThrowableError$1(validationResponse.error);
|
|
44592
|
+
}
|
|
44593
|
+
}
|
|
44594
|
+
function incorrectTypeError$1(expected, actual, path) {
|
|
44595
|
+
return new IncorrectTypeError$1(
|
|
44596
|
+
`Expected type ${expected} at path '${path}', found type ${actual}.`
|
|
44597
|
+
);
|
|
44598
|
+
}
|
|
44599
|
+
function validSchemaResponse$1() {
|
|
44600
|
+
return ok$3(true);
|
|
44601
|
+
}
|
|
44602
|
+
function invalidSchemaResponseWithError$1(error) {
|
|
44603
|
+
return err$3([error]);
|
|
44604
|
+
}
|
|
44605
|
+
function validateJsonSchema$1(data, schema, path = "$", document = schema) {
|
|
44606
|
+
return validateJsonSchemaInternal$1(data, schema, path, document, /* @__PURE__ */ new Map());
|
|
44607
|
+
}
|
|
44608
|
+
function validateJsonSchemaInternal$1(data, schema, path, document, visited) {
|
|
44609
|
+
if (schema === true) return validSchemaResponse$1();
|
|
44610
|
+
if (schema === false)
|
|
44611
|
+
return invalidSchemaResponseWithError$1(
|
|
44612
|
+
new JsonSchemaViolationError$1(`Data at ${path} has schema 'false'`)
|
|
44613
|
+
);
|
|
44614
|
+
const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
|
|
44615
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44616
|
+
if ("anyOf" in schema) {
|
|
44617
|
+
errorCollector.append(validateAnyOf$1(data, schema, path, document, visited));
|
|
44618
|
+
} else if ("oneOf" in schema) {
|
|
44619
|
+
errorCollector.append(validateOneOf$1(data, schema, path, document, visited));
|
|
44620
|
+
} else if ("allOf" in schema) {
|
|
44621
|
+
errorCollector.append(validateAllOf$1(data, schema, path, document, visited));
|
|
44622
|
+
} else if ("not" in schema) {
|
|
44623
|
+
errorCollector.append(validateNot$1(data, schema, path, document, visited));
|
|
44624
|
+
} else if ("$ref" in schema) {
|
|
44625
|
+
errorCollector.append(validateRef$1(data, schema, path, document, visited));
|
|
44626
|
+
} else if ("type" in schema) {
|
|
44627
|
+
if (schema.type === "object") {
|
|
44628
|
+
if (dataType !== "object") {
|
|
44629
|
+
errorCollector.add(incorrectTypeError$1("object", dataType, path));
|
|
44630
|
+
} else {
|
|
44631
|
+
errorCollector.append(
|
|
44632
|
+
validateObject$1(data, schema, path, document, visited)
|
|
44633
|
+
);
|
|
44634
|
+
}
|
|
44635
|
+
} else if (schema.type === "array") {
|
|
44636
|
+
if (dataType !== "array") {
|
|
44637
|
+
errorCollector.add(incorrectTypeError$1("array", dataType, path));
|
|
44638
|
+
} else {
|
|
44639
|
+
errorCollector.append(
|
|
44640
|
+
validateArray$1(data, schema, path, document, visited)
|
|
44641
|
+
);
|
|
44642
|
+
}
|
|
44643
|
+
} else {
|
|
44644
|
+
errorCollector.append(
|
|
44645
|
+
validateScalar$1(data, schema, path)
|
|
44646
|
+
);
|
|
44647
|
+
}
|
|
44648
|
+
}
|
|
44649
|
+
if (schema.enum) {
|
|
44650
|
+
errorCollector.append(validateEnum$1(data, schema.enum, path));
|
|
44651
|
+
}
|
|
44652
|
+
if (schema.const) {
|
|
44653
|
+
errorCollector.append(validateConst$1(data, schema.const, path));
|
|
44654
|
+
}
|
|
44655
|
+
return errorCollector.toValidationResponse();
|
|
44656
|
+
}
|
|
44657
|
+
function validateAnyOf$1(data, schema, path, document, visited) {
|
|
44658
|
+
let isValid = false;
|
|
44659
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44660
|
+
for (let i = 0, { length } = schema.anyOf; i < length; i++) {
|
|
44661
|
+
const element = schema.anyOf[i];
|
|
44662
|
+
const validationResponse = validateJsonSchemaInternal$1(
|
|
44663
|
+
data,
|
|
44664
|
+
element,
|
|
44665
|
+
`${path}.anyOf[${i}]`,
|
|
44666
|
+
document,
|
|
44667
|
+
visited
|
|
44668
|
+
);
|
|
44669
|
+
if (validationResponse.isOk()) {
|
|
44670
|
+
isValid = true;
|
|
44671
|
+
break;
|
|
44672
|
+
} else {
|
|
44673
|
+
errorCollector.append(validationResponse);
|
|
44674
|
+
}
|
|
44675
|
+
}
|
|
44676
|
+
if (!isValid) {
|
|
44677
|
+
errorCollector.prepend(
|
|
44678
|
+
new JsonSchemaViolationError$1(`Data at ${path} did not match any subschema in anyOf.`)
|
|
44679
|
+
);
|
|
44680
|
+
return errorCollector.toValidationResponse();
|
|
44681
|
+
}
|
|
44682
|
+
return validSchemaResponse$1();
|
|
44683
|
+
}
|
|
44684
|
+
function validateOneOf$1(data, schema, path, document, visited) {
|
|
44685
|
+
if (schema.discriminator !== void 0) {
|
|
44686
|
+
return validateDiscriminatedOneOf$1(data, schema.discriminator, path, document, visited);
|
|
44687
|
+
}
|
|
44688
|
+
let validSubShemaPaths = [];
|
|
44689
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44690
|
+
for (let i = 0, { length } = schema.oneOf; i < length; i++) {
|
|
44691
|
+
const element = schema.oneOf[i];
|
|
44692
|
+
const oneOfPath = `${path}.oneOf[${i}]`;
|
|
44693
|
+
const validationResponse = validateJsonSchemaInternal$1(
|
|
44694
|
+
data,
|
|
44695
|
+
element,
|
|
44696
|
+
oneOfPath,
|
|
44697
|
+
document,
|
|
44698
|
+
visited
|
|
44699
|
+
);
|
|
44700
|
+
if (validationResponse.isOk()) {
|
|
44701
|
+
validSubShemaPaths.push(oneOfPath);
|
|
44702
|
+
} else {
|
|
44703
|
+
errorCollector.append(validationResponse);
|
|
44704
|
+
}
|
|
44705
|
+
}
|
|
44706
|
+
if (validSubShemaPaths.length === 0) {
|
|
44707
|
+
errorCollector.prepend(
|
|
44708
|
+
new JsonSchemaViolationError$1(`Data at ${path} did not match any subschema in oneOf.`)
|
|
44709
|
+
);
|
|
44710
|
+
return errorCollector.toValidationResponse();
|
|
44711
|
+
} else if (validSubShemaPaths.length > 1) {
|
|
44712
|
+
errorCollector.prepend(
|
|
44713
|
+
new JsonSchemaViolationError$1(
|
|
44714
|
+
`Data at ${path} matched multiple subschemas: [${validSubShemaPaths.join(", ")}].`
|
|
44715
|
+
)
|
|
44716
|
+
);
|
|
44717
|
+
return errorCollector.toValidationResponse();
|
|
44718
|
+
}
|
|
44719
|
+
return validSchemaResponse$1();
|
|
44720
|
+
}
|
|
44721
|
+
function validateDiscriminatedOneOf$1(data, discriminator, path, document, visited) {
|
|
44722
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
44723
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("object", typeof data, path));
|
|
44542
44724
|
}
|
|
44543
|
-
|
|
44725
|
+
const { propertyName, mapping } = discriminator;
|
|
44726
|
+
const discriminatorValue = data[propertyName];
|
|
44727
|
+
if (discriminatorValue === void 0) {
|
|
44728
|
+
return invalidSchemaResponseWithError$1(
|
|
44729
|
+
new MissingRequiredPropertyError$1(
|
|
44730
|
+
`Object at path '${path}' is missing required discriminator property '${propertyName}'.`
|
|
44731
|
+
)
|
|
44732
|
+
);
|
|
44733
|
+
}
|
|
44734
|
+
if (typeof discriminatorValue !== "string") {
|
|
44735
|
+
return invalidSchemaResponseWithError$1(
|
|
44736
|
+
incorrectTypeError$1("string", typeof discriminatorValue, `${path}.${propertyName}`)
|
|
44737
|
+
);
|
|
44738
|
+
}
|
|
44739
|
+
const targetRef = mapping[discriminatorValue];
|
|
44740
|
+
if (targetRef === void 0) {
|
|
44741
|
+
return invalidSchemaResponseWithError$1(
|
|
44742
|
+
new JsonSchemaViolationError$1(
|
|
44743
|
+
`Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
|
|
44744
|
+
)
|
|
44745
|
+
);
|
|
44746
|
+
}
|
|
44747
|
+
return validateJsonSchemaInternal$1(data, { $ref: targetRef }, path, document, visited);
|
|
44748
|
+
}
|
|
44749
|
+
function validateAllOf$1(data, schema, path, document, visited) {
|
|
44750
|
+
let isValid = true;
|
|
44751
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44752
|
+
for (let i = 0, { length } = schema.allOf; i < length; i++) {
|
|
44753
|
+
const element = schema.allOf[i];
|
|
44754
|
+
const validationResponse = validateJsonSchemaInternal$1(
|
|
44755
|
+
data,
|
|
44756
|
+
element,
|
|
44757
|
+
`${path}.allOf[${i}]`,
|
|
44758
|
+
document,
|
|
44759
|
+
visited
|
|
44760
|
+
);
|
|
44761
|
+
if (!validationResponse.isOk()) {
|
|
44762
|
+
errorCollector.append(validationResponse);
|
|
44763
|
+
isValid = false;
|
|
44764
|
+
}
|
|
44765
|
+
}
|
|
44766
|
+
if (!isValid) {
|
|
44767
|
+
errorCollector.prepend(
|
|
44768
|
+
new JsonSchemaViolationError$1(`Data at ${path} did not match some subschemas in allOf.`)
|
|
44769
|
+
);
|
|
44770
|
+
}
|
|
44771
|
+
return errorCollector.toValidationResponse();
|
|
44772
|
+
}
|
|
44773
|
+
function validateNot$1(data, schema, path, document, visited) {
|
|
44774
|
+
const validationResponse = validateJsonSchemaInternal$1(
|
|
44775
|
+
data,
|
|
44776
|
+
schema.not,
|
|
44777
|
+
path,
|
|
44778
|
+
document,
|
|
44779
|
+
visited
|
|
44780
|
+
);
|
|
44781
|
+
if (validationResponse.isOk()) {
|
|
44782
|
+
return invalidSchemaResponseWithError$1(
|
|
44783
|
+
new JsonSchemaViolationError$1(
|
|
44784
|
+
`Data at ${path} validated against the schema of a not clause.`
|
|
44785
|
+
)
|
|
44786
|
+
);
|
|
44787
|
+
}
|
|
44788
|
+
return validSchemaResponse$1();
|
|
44789
|
+
}
|
|
44790
|
+
function validateObject$1(data, schema, path, document, visited) {
|
|
44791
|
+
const schemaKeys = Object.keys(schema.properties);
|
|
44792
|
+
const requiredKeys = new Set(schema.required);
|
|
44793
|
+
const schemaKeySet = new Set(schemaKeys);
|
|
44794
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44795
|
+
Object.keys(data).forEach((key) => {
|
|
44796
|
+
if (!schemaKeySet.has(key)) {
|
|
44797
|
+
errorCollector.append(
|
|
44798
|
+
validateJsonSchemaInternal$1(
|
|
44799
|
+
data[key],
|
|
44800
|
+
schema.additionalProperties,
|
|
44801
|
+
`${path}.additionalProperties[${key}]`,
|
|
44802
|
+
document,
|
|
44803
|
+
visited
|
|
44804
|
+
)
|
|
44805
|
+
);
|
|
44806
|
+
}
|
|
44807
|
+
});
|
|
44808
|
+
for (let i = 0, length = schemaKeys.length; i < length; i++) {
|
|
44809
|
+
const key = schemaKeys[i];
|
|
44810
|
+
const keyInData = key in data && data[key] !== void 0;
|
|
44811
|
+
if (requiredKeys.has(key) && !keyInData) {
|
|
44812
|
+
errorCollector.add(
|
|
44813
|
+
new MissingRequiredPropertyError$1(
|
|
44814
|
+
`Object at path '${path}' is missing required property '${key}'.`
|
|
44815
|
+
)
|
|
44816
|
+
);
|
|
44817
|
+
}
|
|
44818
|
+
if (keyInData) {
|
|
44819
|
+
errorCollector.append(
|
|
44820
|
+
validateJsonSchemaInternal$1(
|
|
44821
|
+
data[key],
|
|
44822
|
+
schema.properties[key],
|
|
44823
|
+
`${path}.${key}`,
|
|
44824
|
+
document,
|
|
44825
|
+
visited
|
|
44826
|
+
)
|
|
44827
|
+
);
|
|
44828
|
+
}
|
|
44829
|
+
}
|
|
44830
|
+
return errorCollector.toValidationResponse();
|
|
44831
|
+
}
|
|
44832
|
+
function validateArray$1(data, schema, path, document, visited) {
|
|
44833
|
+
if (schema.minItems !== void 0 && data.length < schema.minItems) {
|
|
44834
|
+
return invalidSchemaResponseWithError$1(
|
|
44835
|
+
new MinItemsViolationError$1(
|
|
44836
|
+
`Array at path '${path}' fails minItems constraint. Has ${data.length} items, needs at least ${schema.minItems}.`
|
|
44837
|
+
)
|
|
44838
|
+
);
|
|
44839
|
+
}
|
|
44840
|
+
if (schema.maxItems !== void 0 && data.length > schema.maxItems) {
|
|
44841
|
+
return invalidSchemaResponseWithError$1(
|
|
44842
|
+
new MaxItemsViolationError$1(
|
|
44843
|
+
`Array at path '${path}' fails maxItems constraint. Has ${data.length} items, needs at most ${schema.maxItems}.`
|
|
44844
|
+
)
|
|
44845
|
+
);
|
|
44846
|
+
}
|
|
44847
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44848
|
+
data.forEach(
|
|
44849
|
+
(element, index) => errorCollector.append(
|
|
44850
|
+
validateJsonSchemaInternal$1(
|
|
44851
|
+
element,
|
|
44852
|
+
schema.items,
|
|
44853
|
+
`${path}[${index}]`,
|
|
44854
|
+
document,
|
|
44855
|
+
visited
|
|
44856
|
+
)
|
|
44857
|
+
)
|
|
44858
|
+
);
|
|
44859
|
+
return errorCollector.toValidationResponse();
|
|
44860
|
+
}
|
|
44861
|
+
function validateScalar$1(data, schema, path) {
|
|
44862
|
+
const schemaDataType = schema.type;
|
|
44863
|
+
const dataType = typeof data;
|
|
44864
|
+
if (schemaDataType === "integer") {
|
|
44865
|
+
if (dataType !== "number" || !Number.isInteger(data)) {
|
|
44866
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("integer", dataType, path));
|
|
44867
|
+
}
|
|
44868
|
+
} else if (schemaDataType === "number") {
|
|
44869
|
+
if (dataType !== "number") {
|
|
44870
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("number", dataType, path));
|
|
44871
|
+
}
|
|
44872
|
+
} else if (schemaDataType === "string") {
|
|
44873
|
+
if (dataType !== "string") {
|
|
44874
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("string", dataType, path));
|
|
44875
|
+
}
|
|
44876
|
+
} else if (schemaDataType === "boolean") {
|
|
44877
|
+
if (dataType !== "boolean") {
|
|
44878
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("boolean", dataType, path));
|
|
44879
|
+
}
|
|
44880
|
+
} else if (schemaDataType === "null") {
|
|
44881
|
+
if (data !== null) {
|
|
44882
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("null", dataType, path));
|
|
44883
|
+
}
|
|
44884
|
+
} else {
|
|
44885
|
+
return invalidSchemaResponseWithError$1(
|
|
44886
|
+
new IncorrectTypeError$1(`Unknown schema data type: ${schemaDataType}.`)
|
|
44887
|
+
);
|
|
44888
|
+
}
|
|
44889
|
+
return validSchemaResponse$1();
|
|
44890
|
+
}
|
|
44891
|
+
function validateRef$1(data, schema, path, document, visited) {
|
|
44892
|
+
if (!schema.$ref.startsWith("#")) {
|
|
44893
|
+
return invalidSchemaResponseWithError$1(
|
|
44894
|
+
new InvalidRefError$1(
|
|
44895
|
+
`$ref values that do not refer to the current document are unsupported (must start with '#')`
|
|
44896
|
+
)
|
|
44897
|
+
);
|
|
44898
|
+
}
|
|
44899
|
+
let refsForData = visited.get(data);
|
|
44900
|
+
if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
|
|
44901
|
+
return validSchemaResponse$1();
|
|
44902
|
+
}
|
|
44903
|
+
if (refsForData === void 0) {
|
|
44904
|
+
refsForData = /* @__PURE__ */ new Set();
|
|
44905
|
+
visited.set(data, refsForData);
|
|
44906
|
+
}
|
|
44907
|
+
refsForData.add(schema.$ref);
|
|
44908
|
+
try {
|
|
44909
|
+
const schemaToValidate = findSchemaAtPath$1(document, schema.$ref);
|
|
44910
|
+
return validateJsonSchemaInternal$1(data, schemaToValidate, path, document, visited);
|
|
44911
|
+
} catch (e) {
|
|
44912
|
+
return invalidSchemaResponseWithError$1(e);
|
|
44913
|
+
} finally {
|
|
44914
|
+
refsForData.delete(schema.$ref);
|
|
44915
|
+
if (refsForData.size === 0) visited.delete(data);
|
|
44916
|
+
}
|
|
44917
|
+
}
|
|
44918
|
+
function validateEnum$1(data, enumValue, path) {
|
|
44919
|
+
if (!enumValue.some((value) => deepEquals$2(value, data))) {
|
|
44920
|
+
return invalidSchemaResponseWithError$1(
|
|
44921
|
+
new JsonSchemaViolationError$1(
|
|
44922
|
+
`Data at ${path} did not match any values in enum. Expected value in: [${enumValue.map((value) => stringify$9(value)).join()}]`
|
|
44923
|
+
)
|
|
44924
|
+
);
|
|
44925
|
+
}
|
|
44926
|
+
return validSchemaResponse$1();
|
|
44927
|
+
}
|
|
44928
|
+
function validateConst$1(data, constValue, path) {
|
|
44929
|
+
if (!deepEquals$2(constValue, data)) {
|
|
44930
|
+
return invalidSchemaResponseWithError$1(
|
|
44931
|
+
new JsonSchemaViolationError$1(
|
|
44932
|
+
`Data at ${path} did not match const. Expected: ${stringify$9(constValue)}`
|
|
44933
|
+
)
|
|
44934
|
+
);
|
|
44935
|
+
}
|
|
44936
|
+
return validSchemaResponse$1();
|
|
44937
|
+
}
|
|
44938
|
+
function findSchemaAtPath$1(document, ref) {
|
|
44939
|
+
if (ref === "#") return document;
|
|
44940
|
+
const keys = ref.replace(/^#\//, "").split("/");
|
|
44941
|
+
let current = document;
|
|
44942
|
+
let path = "#";
|
|
44943
|
+
for (const key of keys) {
|
|
44944
|
+
path = `${path}/${key}`;
|
|
44945
|
+
if (current[key] === void 0) {
|
|
44946
|
+
throw new InvalidRefError$1(
|
|
44947
|
+
`Invalid $ref value '${ref}'. Cannot find target schema at '${path}'`
|
|
44948
|
+
);
|
|
44949
|
+
}
|
|
44950
|
+
current = current[key];
|
|
44951
|
+
}
|
|
44952
|
+
return current;
|
|
44544
44953
|
}
|
|
44545
44954
|
|
|
44546
44955
|
/*!
|
|
@@ -45387,35 +45796,6 @@
|
|
|
45387
45796
|
}
|
|
45388
45797
|
return referenceMap.get(astReference);
|
|
45389
45798
|
};
|
|
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
45799
|
function findExecutableOperation$2(document, operationName) {
|
|
45420
45800
|
const operations = document.definitions.filter(
|
|
45421
45801
|
(def) => def.kind === Kind$1.OPERATION_DEFINITION
|
|
@@ -45466,6 +45846,14 @@
|
|
|
45466
45846
|
query: result.value
|
|
45467
45847
|
});
|
|
45468
45848
|
}
|
|
45849
|
+
function toGraphQLErrorResponse(error) {
|
|
45850
|
+
logError$2(error);
|
|
45851
|
+
const message = error instanceof JsonSchemaViolationError$1 ? `Invalid GraphQL config: ${error.message}` : "Internal error in GraphQL adapter occurred";
|
|
45852
|
+
return {
|
|
45853
|
+
data: void 0,
|
|
45854
|
+
errors: [{ message, locations: [] }]
|
|
45855
|
+
};
|
|
45856
|
+
}
|
|
45469
45857
|
function resolveAndValidateGraphQLDocument(query, operationName, options) {
|
|
45470
45858
|
const resolved = resolveAst(query);
|
|
45471
45859
|
if (resolved === void 0) {
|
|
@@ -45731,7 +46119,11 @@
|
|
|
45731
46119
|
queryParams: {},
|
|
45732
46120
|
headers: {},
|
|
45733
46121
|
};
|
|
45734
|
-
|
|
46122
|
+
// Re-enter the composed adapter (when registered) so routing and interceptors
|
|
46123
|
+
// apply to the synthesized aggregate-ui sub-request. Fall back to the base
|
|
46124
|
+
// adapter when unregistered (e.g. in lds-network-adapter unit tests).
|
|
46125
|
+
const subRequestAdapter = networkAdapter;
|
|
46126
|
+
return dispatchSplitRecordAggregateUiAction(recordId, subRequestAdapter, aggregateUiResourceRequest, resourceRequestContext);
|
|
45735
46127
|
}
|
|
45736
46128
|
const getRecordDispatcher = (req) => {
|
|
45737
46129
|
const { resourceRequest, networkAdapter, resourceRequestContext } = req;
|
|
@@ -45787,7 +46179,6 @@
|
|
|
45787
46179
|
}
|
|
45788
46180
|
return null;
|
|
45789
46181
|
}
|
|
45790
|
-
|
|
45791
46182
|
const defaultDispatcher = (req) => {
|
|
45792
46183
|
const { networkAdapter, resourceRequest, resourceRequestContext } = req;
|
|
45793
46184
|
return networkAdapter(resourceRequest, resourceRequestContext);
|
|
@@ -51204,7 +51595,6 @@
|
|
|
51204
51595
|
const key = keyBuilder$1M(luvio, createResourceParams$g(config));
|
|
51205
51596
|
const allTrackedFields = getTrackedFields(key, luvio.getNode(key), {
|
|
51206
51597
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
51207
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
51208
51598
|
}, config.optionalFields);
|
|
51209
51599
|
const optionalFields = fields === undefined ? allTrackedFields : difference(allTrackedFields, fields);
|
|
51210
51600
|
const resourceParams = createResourceParams$g({
|
|
@@ -51331,7 +51721,6 @@
|
|
|
51331
51721
|
};
|
|
51332
51722
|
const childTrackedFields = getTrackedFields(childKey, luvio.getNode(childKey), {
|
|
51333
51723
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
51334
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
51335
51724
|
}, childResourceParams.queryParams.optionalFields);
|
|
51336
51725
|
const childSnapshot = ingestSuccess$8(luvio, {
|
|
51337
51726
|
recordId: childResourceParams.urlParams.recordId,
|
|
@@ -56301,7 +56690,6 @@
|
|
|
56301
56690
|
const key = keyBuilder$1w$1(luvio, config);
|
|
56302
56691
|
const trackedFieldsConfig = {
|
|
56303
56692
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
56304
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
56305
56693
|
};
|
|
56306
56694
|
const optionalFieldsTrie = convertFieldsToTrie(getTrackedFields(key, luvio.getNode(key), trackedFieldsConfig, config.optionalFields));
|
|
56307
56695
|
const fieldsTrie = BLANK_RECORD_FIELDS_TRIE;
|
|
@@ -60173,7 +60561,6 @@
|
|
|
60173
60561
|
...resourceRequest.queryParams,
|
|
60174
60562
|
optionalFields: getTrackedFields(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
60175
60563
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
60176
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
60177
60564
|
}, config.optionalFields),
|
|
60178
60565
|
},
|
|
60179
60566
|
});
|
|
@@ -60725,7 +61112,6 @@
|
|
|
60725
61112
|
...resourceRequest.queryParams,
|
|
60726
61113
|
optionalFields: getTrackedFields(recordTemplateKey, luvio.getNode(recordTemplateKey), {
|
|
60727
61114
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
60728
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
60729
61115
|
}, config.optionalFields),
|
|
60730
61116
|
},
|
|
60731
61117
|
});
|
|
@@ -60745,7 +61131,6 @@
|
|
|
60745
61131
|
});
|
|
60746
61132
|
const allTrackedFields = getTrackedFields(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
60747
61133
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
60748
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
60749
61134
|
}, optionalFields);
|
|
60750
61135
|
const allTrackedFieldsTrie = convertFieldsToTrie(allTrackedFields, true);
|
|
60751
61136
|
const ingest = createFieldsIngestSuccess({
|
|
@@ -80509,6 +80894,7 @@
|
|
|
80509
80894
|
}
|
|
80510
80895
|
async buildPendingAction(request, queue) {
|
|
80511
80896
|
this.resolveResourceRequestBody(request.body);
|
|
80897
|
+
// eslint-disable-next-line no-return-await
|
|
80512
80898
|
return await super.buildPendingAction(request, queue);
|
|
80513
80899
|
}
|
|
80514
80900
|
resolveResourceRequestBody(body) {
|
|
@@ -80941,8 +81327,6 @@
|
|
|
80941
81327
|
return customEvent.namespace === CONTENT_DOCUMENT_AND_VERSION_NAMESPACE;
|
|
80942
81328
|
}
|
|
80943
81329
|
|
|
80944
|
-
// so eslint doesn't complain about nimbus
|
|
80945
|
-
/* global __nimbus */
|
|
80946
81330
|
function chunkToBase64(chunk) {
|
|
80947
81331
|
const bytes = new Uint8Array(chunk);
|
|
80948
81332
|
const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
|
|
@@ -87022,6 +87406,7 @@
|
|
|
87022
87406
|
const parentObjectInfo = objectInfos[parentObjectApiNames[0]];
|
|
87023
87407
|
// this should not be undefined, but lets catch it if we do end up in that state.
|
|
87024
87408
|
if (parentObjectInfo === undefined) {
|
|
87409
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
87025
87410
|
throw new Error(`ObjectInfo is missing for ${parentObjectApiNames[0]} for ${parentApiPath}`);
|
|
87026
87411
|
}
|
|
87027
87412
|
const relationshipField = referenceIdFieldForRelationship(lastSegment);
|
|
@@ -88394,6 +88779,7 @@
|
|
|
88394
88779
|
}
|
|
88395
88780
|
const query = data.uiapi.query;
|
|
88396
88781
|
// Check all entity types in the query for edges - using for...in to avoid array allocation
|
|
88782
|
+
// eslint-disable-next-line guard-for-in
|
|
88397
88783
|
for (const entityType in query) {
|
|
88398
88784
|
const entity = query[entityType];
|
|
88399
88785
|
if (entity && entity.edges && isArray$3$1(entity.edges) && entity.edges.length > 0) {
|
|
@@ -90315,7 +90701,9 @@
|
|
|
90315
90701
|
}
|
|
90316
90702
|
instrumentation$2$1.trackValue(GRAPHQL_QUERY_ROOT_METRIC_NAME, row[1].length);
|
|
90317
90703
|
}
|
|
90318
|
-
catch {
|
|
90704
|
+
catch {
|
|
90705
|
+
// intentionally do nothing
|
|
90706
|
+
}
|
|
90319
90707
|
}
|
|
90320
90708
|
}
|
|
90321
90709
|
|
|
@@ -91024,6 +91412,7 @@
|
|
|
91024
91412
|
const userData = {
|
|
91025
91413
|
...stats,
|
|
91026
91414
|
};
|
|
91415
|
+
// eslint-disable-next-line guard-for-in
|
|
91027
91416
|
for (const error in errors) {
|
|
91028
91417
|
activity.error(error);
|
|
91029
91418
|
}
|
|
@@ -91204,6 +91593,7 @@
|
|
|
91204
91593
|
let limitedResult = this.applyRetryLimits(result.additionalWork);
|
|
91205
91594
|
this.enqueue(limitedResult.additionalWork);
|
|
91206
91595
|
if (limitedResult.recordsNeedingRefetch.size > 0) {
|
|
91596
|
+
// eslint-disable-next-line guard-for-in
|
|
91207
91597
|
for (const key in keys$3(limitedResult.recordsNeedingRefetch)) {
|
|
91208
91598
|
const value = limitedResult.recordsNeedingRefetch.get(key);
|
|
91209
91599
|
if (result.recordsNeedingRefetch.has(key)) {
|
|
@@ -93469,6 +93859,7 @@
|
|
|
93469
93859
|
async exists(key) {
|
|
93470
93860
|
const result = await this.durableStore.query('SELECT EXISTS(SELECT 1 FROM lds_data WHERE key = ?)', [key]);
|
|
93471
93861
|
const exists = result.rows[0][0];
|
|
93862
|
+
// eslint-disable-next-line eqeqeq
|
|
93472
93863
|
return exists == true;
|
|
93473
93864
|
}
|
|
93474
93865
|
async getRecord(key) {
|
|
@@ -93683,7 +94074,7 @@
|
|
|
93683
94074
|
CounterResult["Error"] = "Error";
|
|
93684
94075
|
})(CounterResult || (CounterResult = {}));
|
|
93685
94076
|
function incrementCounter(name, result) {
|
|
93686
|
-
instrumentation$4.incrementCounter('SFSSideEffect', 1, result
|
|
94077
|
+
instrumentation$4.incrementCounter('SFSSideEffect', 1, result === CounterResult.Error, {
|
|
93687
94078
|
Name: name,
|
|
93688
94079
|
Result: result,
|
|
93689
94080
|
});
|
|
@@ -96255,7 +96646,7 @@
|
|
|
96255
96646
|
},
|
|
96256
96647
|
};
|
|
96257
96648
|
}
|
|
96258
|
-
// version: 1.
|
|
96649
|
+
// version: 1.435.0-5818ce3c48
|
|
96259
96650
|
|
|
96260
96651
|
/**
|
|
96261
96652
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -96281,7 +96672,7 @@
|
|
|
96281
96672
|
},
|
|
96282
96673
|
};
|
|
96283
96674
|
}
|
|
96284
|
-
// version: 1.
|
|
96675
|
+
// version: 1.435.0-5818ce3c48
|
|
96285
96676
|
|
|
96286
96677
|
/*!
|
|
96287
96678
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -96686,26 +97077,26 @@
|
|
|
96686
97077
|
* All rights reserved.
|
|
96687
97078
|
* For full license text, see the LICENSE.txt file
|
|
96688
97079
|
*/
|
|
96689
|
-
|
|
97080
|
+
class JsonSchemaViolationError extends Error {
|
|
96690
97081
|
constructor(message, validationErrors) {
|
|
96691
97082
|
super(message);
|
|
96692
97083
|
this.validationErrors = [];
|
|
96693
97084
|
this.validationErrors = validationErrors || [];
|
|
96694
97085
|
}
|
|
96695
|
-
}
|
|
96696
|
-
|
|
96697
|
-
}
|
|
96698
|
-
|
|
96699
|
-
}
|
|
96700
|
-
|
|
96701
|
-
}
|
|
96702
|
-
|
|
96703
|
-
}
|
|
96704
|
-
|
|
96705
|
-
}
|
|
96706
|
-
|
|
96707
|
-
}
|
|
96708
|
-
|
|
97086
|
+
}
|
|
97087
|
+
class MinItemsViolationError extends JsonSchemaViolationError {
|
|
97088
|
+
}
|
|
97089
|
+
class MaxItemsViolationError extends JsonSchemaViolationError {
|
|
97090
|
+
}
|
|
97091
|
+
class IncorrectTypeError extends JsonSchemaViolationError {
|
|
97092
|
+
}
|
|
97093
|
+
class AdditionalPropertiesError extends JsonSchemaViolationError {
|
|
97094
|
+
}
|
|
97095
|
+
class MissingRequiredPropertyError extends JsonSchemaViolationError {
|
|
97096
|
+
}
|
|
97097
|
+
class InvalidRefError extends JsonSchemaViolationError {
|
|
97098
|
+
}
|
|
97099
|
+
class JsonSchemaErrorCollector {
|
|
96709
97100
|
constructor() {
|
|
96710
97101
|
this.errors = [];
|
|
96711
97102
|
}
|
|
@@ -96726,104 +97117,108 @@
|
|
|
96726
97117
|
toValidationResponse() {
|
|
96727
97118
|
return !this.hasErrors() ? ok$1(true) : err$1(this.errors);
|
|
96728
97119
|
}
|
|
96729
|
-
}
|
|
96730
|
-
function createThrowableError
|
|
96731
|
-
if (errors[0] instanceof MinItemsViolationError
|
|
96732
|
-
return new MinItemsViolationError
|
|
97120
|
+
}
|
|
97121
|
+
function createThrowableError(errors) {
|
|
97122
|
+
if (errors[0] instanceof MinItemsViolationError) {
|
|
97123
|
+
return new MinItemsViolationError(errors[0].message, errors);
|
|
96733
97124
|
}
|
|
96734
|
-
if (errors[0] instanceof MaxItemsViolationError
|
|
96735
|
-
return new MaxItemsViolationError
|
|
97125
|
+
if (errors[0] instanceof MaxItemsViolationError) {
|
|
97126
|
+
return new MaxItemsViolationError(errors[0].message, errors);
|
|
96736
97127
|
}
|
|
96737
|
-
if (errors[0] instanceof IncorrectTypeError
|
|
96738
|
-
return new IncorrectTypeError
|
|
97128
|
+
if (errors[0] instanceof IncorrectTypeError) {
|
|
97129
|
+
return new IncorrectTypeError(errors[0].message, errors);
|
|
96739
97130
|
}
|
|
96740
|
-
if (errors[0] instanceof AdditionalPropertiesError
|
|
96741
|
-
return new AdditionalPropertiesError
|
|
97131
|
+
if (errors[0] instanceof AdditionalPropertiesError) {
|
|
97132
|
+
return new AdditionalPropertiesError(errors[0].message, errors);
|
|
96742
97133
|
}
|
|
96743
|
-
if (errors[0] instanceof MissingRequiredPropertyError
|
|
96744
|
-
return new MissingRequiredPropertyError
|
|
97134
|
+
if (errors[0] instanceof MissingRequiredPropertyError) {
|
|
97135
|
+
return new MissingRequiredPropertyError(errors[0].message, errors);
|
|
96745
97136
|
}
|
|
96746
|
-
if (errors[0] instanceof InvalidRefError
|
|
96747
|
-
return new InvalidRefError
|
|
97137
|
+
if (errors[0] instanceof InvalidRefError) {
|
|
97138
|
+
return new InvalidRefError(errors[0].message, errors);
|
|
96748
97139
|
}
|
|
96749
|
-
return new JsonSchemaViolationError
|
|
97140
|
+
return new JsonSchemaViolationError(errors[0].message, errors);
|
|
96750
97141
|
}
|
|
96751
|
-
function assertIsValid
|
|
96752
|
-
const validationResponse = validateJsonSchema
|
|
97142
|
+
function assertIsValid(data, schema) {
|
|
97143
|
+
const validationResponse = validateJsonSchema(data, schema);
|
|
96753
97144
|
if (validationResponse.isErr()) {
|
|
96754
|
-
throw createThrowableError
|
|
97145
|
+
throw createThrowableError(validationResponse.error);
|
|
96755
97146
|
}
|
|
96756
97147
|
}
|
|
96757
|
-
function incorrectTypeError
|
|
96758
|
-
return new IncorrectTypeError
|
|
97148
|
+
function incorrectTypeError(expected, actual, path) {
|
|
97149
|
+
return new IncorrectTypeError(
|
|
96759
97150
|
`Expected type ${expected} at path '${path}', found type ${actual}.`
|
|
96760
97151
|
);
|
|
96761
97152
|
}
|
|
96762
|
-
function validSchemaResponse
|
|
97153
|
+
function validSchemaResponse() {
|
|
96763
97154
|
return ok$1(true);
|
|
96764
97155
|
}
|
|
96765
|
-
function invalidSchemaResponseWithError
|
|
97156
|
+
function invalidSchemaResponseWithError(error) {
|
|
96766
97157
|
return err$1([error]);
|
|
96767
97158
|
}
|
|
96768
|
-
function validateJsonSchema
|
|
96769
|
-
|
|
97159
|
+
function validateJsonSchema(data, schema, path = "$", document = schema) {
|
|
97160
|
+
return validateJsonSchemaInternal(data, schema, path, document, /* @__PURE__ */ new Map());
|
|
97161
|
+
}
|
|
97162
|
+
function validateJsonSchemaInternal(data, schema, path, document, visited) {
|
|
97163
|
+
if (schema === true) return validSchemaResponse();
|
|
96770
97164
|
if (schema === false)
|
|
96771
|
-
return invalidSchemaResponseWithError
|
|
96772
|
-
new JsonSchemaViolationError
|
|
97165
|
+
return invalidSchemaResponseWithError(
|
|
97166
|
+
new JsonSchemaViolationError(`Data at ${path} has schema 'false'`)
|
|
96773
97167
|
);
|
|
96774
97168
|
const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
|
|
96775
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97169
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96776
97170
|
if ("anyOf" in schema) {
|
|
96777
|
-
errorCollector.append(validateAnyOf
|
|
97171
|
+
errorCollector.append(validateAnyOf(data, schema, path, document, visited));
|
|
96778
97172
|
} else if ("oneOf" in schema) {
|
|
96779
|
-
errorCollector.append(validateOneOf
|
|
97173
|
+
errorCollector.append(validateOneOf(data, schema, path, document, visited));
|
|
96780
97174
|
} else if ("allOf" in schema) {
|
|
96781
|
-
errorCollector.append(validateAllOf
|
|
97175
|
+
errorCollector.append(validateAllOf(data, schema, path, document, visited));
|
|
96782
97176
|
} else if ("not" in schema) {
|
|
96783
|
-
errorCollector.append(validateNot
|
|
97177
|
+
errorCollector.append(validateNot(data, schema, path, document, visited));
|
|
96784
97178
|
} else if ("$ref" in schema) {
|
|
96785
|
-
errorCollector.append(validateRef
|
|
97179
|
+
errorCollector.append(validateRef(data, schema, path, document, visited));
|
|
96786
97180
|
} else if ("type" in schema) {
|
|
96787
97181
|
if (schema.type === "object") {
|
|
96788
97182
|
if (dataType !== "object") {
|
|
96789
|
-
errorCollector.add(incorrectTypeError
|
|
97183
|
+
errorCollector.add(incorrectTypeError("object", dataType, path));
|
|
96790
97184
|
} else {
|
|
96791
97185
|
errorCollector.append(
|
|
96792
|
-
validateObject
|
|
97186
|
+
validateObject(data, schema, path, document, visited)
|
|
96793
97187
|
);
|
|
96794
97188
|
}
|
|
96795
97189
|
} else if (schema.type === "array") {
|
|
96796
97190
|
if (dataType !== "array") {
|
|
96797
|
-
errorCollector.add(incorrectTypeError
|
|
97191
|
+
errorCollector.add(incorrectTypeError("array", dataType, path));
|
|
96798
97192
|
} else {
|
|
96799
97193
|
errorCollector.append(
|
|
96800
|
-
validateArray
|
|
97194
|
+
validateArray(data, schema, path, document, visited)
|
|
96801
97195
|
);
|
|
96802
97196
|
}
|
|
96803
97197
|
} else {
|
|
96804
97198
|
errorCollector.append(
|
|
96805
|
-
validateScalar
|
|
97199
|
+
validateScalar(data, schema, path)
|
|
96806
97200
|
);
|
|
96807
97201
|
}
|
|
96808
97202
|
}
|
|
96809
97203
|
if (schema.enum) {
|
|
96810
|
-
errorCollector.append(validateEnum
|
|
97204
|
+
errorCollector.append(validateEnum(data, schema.enum, path));
|
|
96811
97205
|
}
|
|
96812
97206
|
if (schema.const) {
|
|
96813
|
-
errorCollector.append(validateConst
|
|
97207
|
+
errorCollector.append(validateConst(data, schema.const, path));
|
|
96814
97208
|
}
|
|
96815
97209
|
return errorCollector.toValidationResponse();
|
|
96816
97210
|
}
|
|
96817
|
-
function validateAnyOf
|
|
97211
|
+
function validateAnyOf(data, schema, path, document, visited) {
|
|
96818
97212
|
let isValid = false;
|
|
96819
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97213
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96820
97214
|
for (let i = 0, { length } = schema.anyOf; i < length; i++) {
|
|
96821
97215
|
const element = schema.anyOf[i];
|
|
96822
|
-
const validationResponse =
|
|
97216
|
+
const validationResponse = validateJsonSchemaInternal(
|
|
96823
97217
|
data,
|
|
96824
97218
|
element,
|
|
96825
97219
|
`${path}.anyOf[${i}]`,
|
|
96826
|
-
document
|
|
97220
|
+
document,
|
|
97221
|
+
visited
|
|
96827
97222
|
);
|
|
96828
97223
|
if (validationResponse.isOk()) {
|
|
96829
97224
|
isValid = true;
|
|
@@ -96834,19 +97229,28 @@
|
|
|
96834
97229
|
}
|
|
96835
97230
|
if (!isValid) {
|
|
96836
97231
|
errorCollector.prepend(
|
|
96837
|
-
new JsonSchemaViolationError
|
|
97232
|
+
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in anyOf.`)
|
|
96838
97233
|
);
|
|
96839
97234
|
return errorCollector.toValidationResponse();
|
|
96840
97235
|
}
|
|
96841
|
-
return validSchemaResponse
|
|
97236
|
+
return validSchemaResponse();
|
|
96842
97237
|
}
|
|
96843
|
-
function validateOneOf
|
|
97238
|
+
function validateOneOf(data, schema, path, document, visited) {
|
|
97239
|
+
if (schema.discriminator !== void 0) {
|
|
97240
|
+
return validateDiscriminatedOneOf(data, schema.discriminator, path, document, visited);
|
|
97241
|
+
}
|
|
96844
97242
|
let validSubShemaPaths = [];
|
|
96845
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97243
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96846
97244
|
for (let i = 0, { length } = schema.oneOf; i < length; i++) {
|
|
96847
97245
|
const element = schema.oneOf[i];
|
|
96848
97246
|
const oneOfPath = `${path}.oneOf[${i}]`;
|
|
96849
|
-
const validationResponse =
|
|
97247
|
+
const validationResponse = validateJsonSchemaInternal(
|
|
97248
|
+
data,
|
|
97249
|
+
element,
|
|
97250
|
+
oneOfPath,
|
|
97251
|
+
document,
|
|
97252
|
+
visited
|
|
97253
|
+
);
|
|
96850
97254
|
if (validationResponse.isOk()) {
|
|
96851
97255
|
validSubShemaPaths.push(oneOfPath);
|
|
96852
97256
|
} else {
|
|
@@ -96855,29 +97259,58 @@
|
|
|
96855
97259
|
}
|
|
96856
97260
|
if (validSubShemaPaths.length === 0) {
|
|
96857
97261
|
errorCollector.prepend(
|
|
96858
|
-
new JsonSchemaViolationError
|
|
97262
|
+
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in oneOf.`)
|
|
96859
97263
|
);
|
|
96860
97264
|
return errorCollector.toValidationResponse();
|
|
96861
97265
|
} else if (validSubShemaPaths.length > 1) {
|
|
96862
97266
|
errorCollector.prepend(
|
|
96863
|
-
new JsonSchemaViolationError
|
|
97267
|
+
new JsonSchemaViolationError(
|
|
96864
97268
|
`Data at ${path} matched multiple subschemas: [${validSubShemaPaths.join(", ")}].`
|
|
96865
97269
|
)
|
|
96866
97270
|
);
|
|
96867
97271
|
return errorCollector.toValidationResponse();
|
|
96868
97272
|
}
|
|
96869
|
-
return validSchemaResponse
|
|
97273
|
+
return validSchemaResponse();
|
|
97274
|
+
}
|
|
97275
|
+
function validateDiscriminatedOneOf(data, discriminator, path, document, visited) {
|
|
97276
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
97277
|
+
return invalidSchemaResponseWithError(incorrectTypeError("object", typeof data, path));
|
|
97278
|
+
}
|
|
97279
|
+
const { propertyName, mapping } = discriminator;
|
|
97280
|
+
const discriminatorValue = data[propertyName];
|
|
97281
|
+
if (discriminatorValue === void 0) {
|
|
97282
|
+
return invalidSchemaResponseWithError(
|
|
97283
|
+
new MissingRequiredPropertyError(
|
|
97284
|
+
`Object at path '${path}' is missing required discriminator property '${propertyName}'.`
|
|
97285
|
+
)
|
|
97286
|
+
);
|
|
97287
|
+
}
|
|
97288
|
+
if (typeof discriminatorValue !== "string") {
|
|
97289
|
+
return invalidSchemaResponseWithError(
|
|
97290
|
+
incorrectTypeError("string", typeof discriminatorValue, `${path}.${propertyName}`)
|
|
97291
|
+
);
|
|
97292
|
+
}
|
|
97293
|
+
const targetRef = mapping[discriminatorValue];
|
|
97294
|
+
if (targetRef === void 0) {
|
|
97295
|
+
return invalidSchemaResponseWithError(
|
|
97296
|
+
new JsonSchemaViolationError(
|
|
97297
|
+
`Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
|
|
97298
|
+
)
|
|
97299
|
+
);
|
|
97300
|
+
}
|
|
97301
|
+
return validateJsonSchemaInternal(data, { $ref: targetRef }, path, document, visited);
|
|
96870
97302
|
}
|
|
96871
|
-
function validateAllOf
|
|
97303
|
+
function validateAllOf(data, schema, path, document, visited) {
|
|
96872
97304
|
let isValid = true;
|
|
96873
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97305
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96874
97306
|
for (let i = 0, { length } = schema.allOf; i < length; i++) {
|
|
96875
97307
|
const element = schema.allOf[i];
|
|
96876
|
-
const validationResponse =
|
|
97308
|
+
const validationResponse = validateJsonSchemaInternal(
|
|
96877
97309
|
data,
|
|
96878
97310
|
element,
|
|
96879
97311
|
`${path}.allOf[${i}]`,
|
|
96880
|
-
document
|
|
97312
|
+
document,
|
|
97313
|
+
visited
|
|
96881
97314
|
);
|
|
96882
97315
|
if (!validationResponse.isOk()) {
|
|
96883
97316
|
errorCollector.append(validationResponse);
|
|
@@ -96886,35 +97319,42 @@
|
|
|
96886
97319
|
}
|
|
96887
97320
|
if (!isValid) {
|
|
96888
97321
|
errorCollector.prepend(
|
|
96889
|
-
new JsonSchemaViolationError
|
|
97322
|
+
new JsonSchemaViolationError(`Data at ${path} did not match some subschemas in allOf.`)
|
|
96890
97323
|
);
|
|
96891
97324
|
}
|
|
96892
97325
|
return errorCollector.toValidationResponse();
|
|
96893
97326
|
}
|
|
96894
|
-
function validateNot
|
|
96895
|
-
const validationResponse =
|
|
97327
|
+
function validateNot(data, schema, path, document, visited) {
|
|
97328
|
+
const validationResponse = validateJsonSchemaInternal(
|
|
97329
|
+
data,
|
|
97330
|
+
schema.not,
|
|
97331
|
+
path,
|
|
97332
|
+
document,
|
|
97333
|
+
visited
|
|
97334
|
+
);
|
|
96896
97335
|
if (validationResponse.isOk()) {
|
|
96897
|
-
return invalidSchemaResponseWithError
|
|
96898
|
-
new JsonSchemaViolationError
|
|
97336
|
+
return invalidSchemaResponseWithError(
|
|
97337
|
+
new JsonSchemaViolationError(
|
|
96899
97338
|
`Data at ${path} validated against the schema of a not clause.`
|
|
96900
97339
|
)
|
|
96901
97340
|
);
|
|
96902
97341
|
}
|
|
96903
|
-
return validSchemaResponse
|
|
97342
|
+
return validSchemaResponse();
|
|
96904
97343
|
}
|
|
96905
|
-
function validateObject
|
|
97344
|
+
function validateObject(data, schema, path, document, visited) {
|
|
96906
97345
|
const schemaKeys = Object.keys(schema.properties);
|
|
96907
97346
|
const requiredKeys = new Set(schema.required);
|
|
96908
97347
|
const schemaKeySet = new Set(schemaKeys);
|
|
96909
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97348
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96910
97349
|
Object.keys(data).forEach((key) => {
|
|
96911
97350
|
if (!schemaKeySet.has(key)) {
|
|
96912
97351
|
errorCollector.append(
|
|
96913
|
-
|
|
97352
|
+
validateJsonSchemaInternal(
|
|
96914
97353
|
data[key],
|
|
96915
97354
|
schema.additionalProperties,
|
|
96916
97355
|
`${path}.additionalProperties[${key}]`,
|
|
96917
|
-
document
|
|
97356
|
+
document,
|
|
97357
|
+
visited
|
|
96918
97358
|
)
|
|
96919
97359
|
);
|
|
96920
97360
|
}
|
|
@@ -96924,113 +97364,132 @@
|
|
|
96924
97364
|
const keyInData = key in data && data[key] !== void 0;
|
|
96925
97365
|
if (requiredKeys.has(key) && !keyInData) {
|
|
96926
97366
|
errorCollector.add(
|
|
96927
|
-
new MissingRequiredPropertyError
|
|
97367
|
+
new MissingRequiredPropertyError(
|
|
96928
97368
|
`Object at path '${path}' is missing required property '${key}'.`
|
|
96929
97369
|
)
|
|
96930
97370
|
);
|
|
96931
97371
|
}
|
|
96932
97372
|
if (keyInData) {
|
|
96933
97373
|
errorCollector.append(
|
|
96934
|
-
|
|
97374
|
+
validateJsonSchemaInternal(
|
|
96935
97375
|
data[key],
|
|
96936
97376
|
schema.properties[key],
|
|
96937
97377
|
`${path}.${key}`,
|
|
96938
|
-
document
|
|
97378
|
+
document,
|
|
97379
|
+
visited
|
|
96939
97380
|
)
|
|
96940
97381
|
);
|
|
96941
97382
|
}
|
|
96942
97383
|
}
|
|
96943
97384
|
return errorCollector.toValidationResponse();
|
|
96944
97385
|
}
|
|
96945
|
-
function validateArray
|
|
97386
|
+
function validateArray(data, schema, path, document, visited) {
|
|
96946
97387
|
if (schema.minItems !== void 0 && data.length < schema.minItems) {
|
|
96947
|
-
return invalidSchemaResponseWithError
|
|
96948
|
-
new MinItemsViolationError
|
|
97388
|
+
return invalidSchemaResponseWithError(
|
|
97389
|
+
new MinItemsViolationError(
|
|
96949
97390
|
`Array at path '${path}' fails minItems constraint. Has ${data.length} items, needs at least ${schema.minItems}.`
|
|
96950
97391
|
)
|
|
96951
97392
|
);
|
|
96952
97393
|
}
|
|
96953
97394
|
if (schema.maxItems !== void 0 && data.length > schema.maxItems) {
|
|
96954
|
-
return invalidSchemaResponseWithError
|
|
96955
|
-
new MaxItemsViolationError
|
|
97395
|
+
return invalidSchemaResponseWithError(
|
|
97396
|
+
new MaxItemsViolationError(
|
|
96956
97397
|
`Array at path '${path}' fails maxItems constraint. Has ${data.length} items, needs at most ${schema.maxItems}.`
|
|
96957
97398
|
)
|
|
96958
97399
|
);
|
|
96959
97400
|
}
|
|
96960
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97401
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96961
97402
|
data.forEach(
|
|
96962
97403
|
(element, index) => errorCollector.append(
|
|
96963
|
-
|
|
97404
|
+
validateJsonSchemaInternal(
|
|
97405
|
+
element,
|
|
97406
|
+
schema.items,
|
|
97407
|
+
`${path}[${index}]`,
|
|
97408
|
+
document,
|
|
97409
|
+
visited
|
|
97410
|
+
)
|
|
96964
97411
|
)
|
|
96965
97412
|
);
|
|
96966
97413
|
return errorCollector.toValidationResponse();
|
|
96967
97414
|
}
|
|
96968
|
-
function validateScalar
|
|
97415
|
+
function validateScalar(data, schema, path) {
|
|
96969
97416
|
const schemaDataType = schema.type;
|
|
96970
97417
|
const dataType = typeof data;
|
|
96971
97418
|
if (schemaDataType === "integer") {
|
|
96972
97419
|
if (dataType !== "number" || !Number.isInteger(data)) {
|
|
96973
|
-
return invalidSchemaResponseWithError
|
|
97420
|
+
return invalidSchemaResponseWithError(incorrectTypeError("integer", dataType, path));
|
|
96974
97421
|
}
|
|
96975
97422
|
} else if (schemaDataType === "number") {
|
|
96976
97423
|
if (dataType !== "number") {
|
|
96977
|
-
return invalidSchemaResponseWithError
|
|
97424
|
+
return invalidSchemaResponseWithError(incorrectTypeError("number", dataType, path));
|
|
96978
97425
|
}
|
|
96979
97426
|
} else if (schemaDataType === "string") {
|
|
96980
97427
|
if (dataType !== "string") {
|
|
96981
|
-
return invalidSchemaResponseWithError
|
|
97428
|
+
return invalidSchemaResponseWithError(incorrectTypeError("string", dataType, path));
|
|
96982
97429
|
}
|
|
96983
97430
|
} else if (schemaDataType === "boolean") {
|
|
96984
97431
|
if (dataType !== "boolean") {
|
|
96985
|
-
return invalidSchemaResponseWithError
|
|
97432
|
+
return invalidSchemaResponseWithError(incorrectTypeError("boolean", dataType, path));
|
|
96986
97433
|
}
|
|
96987
97434
|
} else if (schemaDataType === "null") {
|
|
96988
97435
|
if (data !== null) {
|
|
96989
|
-
return invalidSchemaResponseWithError
|
|
97436
|
+
return invalidSchemaResponseWithError(incorrectTypeError("null", dataType, path));
|
|
96990
97437
|
}
|
|
96991
97438
|
} else {
|
|
96992
|
-
return invalidSchemaResponseWithError
|
|
96993
|
-
new IncorrectTypeError
|
|
97439
|
+
return invalidSchemaResponseWithError(
|
|
97440
|
+
new IncorrectTypeError(`Unknown schema data type: ${schemaDataType}.`)
|
|
96994
97441
|
);
|
|
96995
97442
|
}
|
|
96996
|
-
return validSchemaResponse
|
|
97443
|
+
return validSchemaResponse();
|
|
96997
97444
|
}
|
|
96998
|
-
function validateRef
|
|
97445
|
+
function validateRef(data, schema, path, document, visited) {
|
|
96999
97446
|
if (!schema.$ref.startsWith("#")) {
|
|
97000
|
-
return invalidSchemaResponseWithError
|
|
97001
|
-
new InvalidRefError
|
|
97447
|
+
return invalidSchemaResponseWithError(
|
|
97448
|
+
new InvalidRefError(
|
|
97002
97449
|
`$ref values that do not refer to the current document are unsupported (must start with '#')`
|
|
97003
97450
|
)
|
|
97004
97451
|
);
|
|
97005
97452
|
}
|
|
97453
|
+
let refsForData = visited.get(data);
|
|
97454
|
+
if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
|
|
97455
|
+
return validSchemaResponse();
|
|
97456
|
+
}
|
|
97457
|
+
if (refsForData === void 0) {
|
|
97458
|
+
refsForData = /* @__PURE__ */ new Set();
|
|
97459
|
+
visited.set(data, refsForData);
|
|
97460
|
+
}
|
|
97461
|
+
refsForData.add(schema.$ref);
|
|
97006
97462
|
try {
|
|
97007
|
-
const schemaToValidate = findSchemaAtPath
|
|
97008
|
-
return
|
|
97463
|
+
const schemaToValidate = findSchemaAtPath(document, schema.$ref);
|
|
97464
|
+
return validateJsonSchemaInternal(data, schemaToValidate, path, document, visited);
|
|
97009
97465
|
} catch (e) {
|
|
97010
|
-
return invalidSchemaResponseWithError
|
|
97466
|
+
return invalidSchemaResponseWithError(e);
|
|
97467
|
+
} finally {
|
|
97468
|
+
refsForData.delete(schema.$ref);
|
|
97469
|
+
if (refsForData.size === 0) visited.delete(data);
|
|
97011
97470
|
}
|
|
97012
97471
|
}
|
|
97013
|
-
function validateEnum
|
|
97472
|
+
function validateEnum(data, enumValue, path) {
|
|
97014
97473
|
if (!enumValue.some((value) => deepEquals$1(value, data))) {
|
|
97015
|
-
return invalidSchemaResponseWithError
|
|
97016
|
-
new JsonSchemaViolationError
|
|
97474
|
+
return invalidSchemaResponseWithError(
|
|
97475
|
+
new JsonSchemaViolationError(
|
|
97017
97476
|
`Data at ${path} did not match any values in enum. Expected value in: [${enumValue.map((value) => stringify$2(value)).join()}]`
|
|
97018
97477
|
)
|
|
97019
97478
|
);
|
|
97020
97479
|
}
|
|
97021
|
-
return validSchemaResponse
|
|
97480
|
+
return validSchemaResponse();
|
|
97022
97481
|
}
|
|
97023
|
-
function validateConst
|
|
97482
|
+
function validateConst(data, constValue, path) {
|
|
97024
97483
|
if (!deepEquals$1(constValue, data)) {
|
|
97025
|
-
return invalidSchemaResponseWithError
|
|
97026
|
-
new JsonSchemaViolationError
|
|
97484
|
+
return invalidSchemaResponseWithError(
|
|
97485
|
+
new JsonSchemaViolationError(
|
|
97027
97486
|
`Data at ${path} did not match const. Expected: ${stringify$2(constValue)}`
|
|
97028
97487
|
)
|
|
97029
97488
|
);
|
|
97030
97489
|
}
|
|
97031
|
-
return validSchemaResponse
|
|
97490
|
+
return validSchemaResponse();
|
|
97032
97491
|
}
|
|
97033
|
-
function findSchemaAtPath
|
|
97492
|
+
function findSchemaAtPath(document, ref) {
|
|
97034
97493
|
if (ref === "#") return document;
|
|
97035
97494
|
const keys = ref.replace(/^#\//, "").split("/");
|
|
97036
97495
|
let current = document;
|
|
@@ -97038,7 +97497,7 @@
|
|
|
97038
97497
|
for (const key of keys) {
|
|
97039
97498
|
path = `${path}/${key}`;
|
|
97040
97499
|
if (current[key] === void 0) {
|
|
97041
|
-
throw new InvalidRefError
|
|
97500
|
+
throw new InvalidRefError(
|
|
97042
97501
|
`Invalid $ref value '${ref}'. Cannot find target schema at '${path}'`
|
|
97043
97502
|
);
|
|
97044
97503
|
}
|
|
@@ -97083,7 +97542,7 @@
|
|
|
97083
97542
|
*/
|
|
97084
97543
|
function buildBaseImperativeInvoker(getCommand, transformResult) {
|
|
97085
97544
|
return async (...params) => {
|
|
97086
|
-
const command = getCommand({ params, assertIsValid
|
|
97545
|
+
const command = getCommand({ params, assertIsValid });
|
|
97087
97546
|
try {
|
|
97088
97547
|
return command.execute().then((result) => transformResult(result));
|
|
97089
97548
|
} catch (error) {
|
|
@@ -97223,7 +97682,7 @@
|
|
|
97223
97682
|
class LegacyImperativeBindingsService {
|
|
97224
97683
|
bind(getCommand) {
|
|
97225
97684
|
const invoke = async (config, requestContext, callback) => {
|
|
97226
|
-
const command = getCommand({ config, assertIsValid
|
|
97685
|
+
const command = getCommand({ config, assertIsValid });
|
|
97227
97686
|
try {
|
|
97228
97687
|
const overrides = getOverridesForLegacyRequestContext(requestContext);
|
|
97229
97688
|
const result = await command.execute(overrides);
|
|
@@ -97238,7 +97697,7 @@
|
|
|
97238
97697
|
}
|
|
97239
97698
|
};
|
|
97240
97699
|
const subscribe = (config, requestContext, callback) => {
|
|
97241
|
-
const command = getCommand({ config, assertIsValid
|
|
97700
|
+
const command = getCommand({ config, assertIsValid });
|
|
97242
97701
|
let unsubscribe = () => {
|
|
97243
97702
|
};
|
|
97244
97703
|
try {
|
|
@@ -97297,13 +97756,7 @@
|
|
|
97297
97756
|
}
|
|
97298
97757
|
return await buildBaseImperativeInvoker(getCommand, (result) => this.transformResult(result, exposeRefresh))(...params);
|
|
97299
97758
|
} catch (error) {
|
|
97300
|
-
|
|
97301
|
-
return {
|
|
97302
|
-
data: void 0,
|
|
97303
|
-
errors: [
|
|
97304
|
-
{ message: "Internal error in GraphQL adapter occurred", locations: [] }
|
|
97305
|
-
]
|
|
97306
|
-
};
|
|
97759
|
+
return toGraphQLErrorResponse(error);
|
|
97307
97760
|
}
|
|
97308
97761
|
};
|
|
97309
97762
|
}
|
|
@@ -97397,8 +97850,8 @@
|
|
|
97397
97850
|
config = result.value;
|
|
97398
97851
|
}
|
|
97399
97852
|
}
|
|
97400
|
-
const command = getCommand({ config, assertIsValid: assertIsValid$1 });
|
|
97401
97853
|
try {
|
|
97854
|
+
const command = getCommand({ config, assertIsValid });
|
|
97402
97855
|
const overrides = getOverridesForLegacyRequestContext(requestContext);
|
|
97403
97856
|
const result = await command.execute(overrides);
|
|
97404
97857
|
const consumerEmittedData = {
|
|
@@ -97415,13 +97868,7 @@
|
|
|
97415
97868
|
}
|
|
97416
97869
|
callback(consumerEmittedData);
|
|
97417
97870
|
} catch (error) {
|
|
97418
|
-
|
|
97419
|
-
callback({
|
|
97420
|
-
data: void 0,
|
|
97421
|
-
errors: [
|
|
97422
|
-
{ message: "Internal error in GraphQL adapter occurred", locations: [] }
|
|
97423
|
-
]
|
|
97424
|
-
});
|
|
97871
|
+
callback(toGraphQLErrorResponse(error));
|
|
97425
97872
|
}
|
|
97426
97873
|
};
|
|
97427
97874
|
const subscribe = (config, requestContext, callback) => {
|
|
@@ -97439,35 +97886,41 @@
|
|
|
97439
97886
|
config = result.value;
|
|
97440
97887
|
}
|
|
97441
97888
|
}
|
|
97442
|
-
const command = getCommand({ config, assertIsValid: assertIsValid$1 });
|
|
97443
97889
|
let unsubscribe = () => {
|
|
97444
97890
|
};
|
|
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
|
-
|
|
97891
|
+
try {
|
|
97892
|
+
const command = getCommand({ config, assertIsValid });
|
|
97893
|
+
const overrides = getOverridesForLegacyRequestContext(requestContext);
|
|
97894
|
+
command.execute(overrides).then((result) => {
|
|
97895
|
+
const consumerEmittedData = {
|
|
97896
|
+
data: void 0,
|
|
97897
|
+
errors: void 0
|
|
97898
|
+
};
|
|
97899
|
+
if (result.isOk()) {
|
|
97900
|
+
deepFreeze(result.value);
|
|
97901
|
+
consumerEmittedData.data = result.value.data.data;
|
|
97902
|
+
unsubscribe = result.value.subscribe(
|
|
97903
|
+
(res) => {
|
|
97904
|
+
handleEmit(res, callback);
|
|
97905
|
+
}
|
|
97906
|
+
);
|
|
97907
|
+
} else {
|
|
97908
|
+
const { data, errors } = toGraphQLResponseFromFailure$1(
|
|
97909
|
+
result.error.failure
|
|
97910
|
+
);
|
|
97911
|
+
consumerEmittedData.data = data;
|
|
97912
|
+
consumerEmittedData.errors = errors;
|
|
97913
|
+
unsubscribe = result.error.subscribe(
|
|
97914
|
+
(res) => {
|
|
97915
|
+
handleEmit(res, callback);
|
|
97916
|
+
}
|
|
97917
|
+
);
|
|
97918
|
+
}
|
|
97919
|
+
callback(consumerEmittedData);
|
|
97920
|
+
});
|
|
97921
|
+
} catch (error) {
|
|
97922
|
+
callback(toGraphQLErrorResponse(error));
|
|
97923
|
+
}
|
|
97471
97924
|
return () => {
|
|
97472
97925
|
unsubscribe();
|
|
97473
97926
|
};
|
|
@@ -97501,7 +97954,7 @@
|
|
|
97501
97954
|
params[0] = result2.value;
|
|
97502
97955
|
}
|
|
97503
97956
|
}
|
|
97504
|
-
const command = getCommand({ params, assertIsValid
|
|
97957
|
+
const command = getCommand({ params, assertIsValid });
|
|
97505
97958
|
const result = await command.execute({ cacheControlConfig: { type: "no-cache" } });
|
|
97506
97959
|
if (result.isOk()) {
|
|
97507
97960
|
deepFreeze(result.value);
|
|
@@ -97510,13 +97963,7 @@
|
|
|
97510
97963
|
return toGraphQLResponseFromFailure$1(result.error.failure);
|
|
97511
97964
|
}
|
|
97512
97965
|
} catch (error) {
|
|
97513
|
-
|
|
97514
|
-
return {
|
|
97515
|
-
data: void 0,
|
|
97516
|
-
errors: [
|
|
97517
|
-
{ message: "Internal error in GraphQL adapter occurred", locations: [] }
|
|
97518
|
-
]
|
|
97519
|
-
};
|
|
97966
|
+
return toGraphQLErrorResponse(error);
|
|
97520
97967
|
}
|
|
97521
97968
|
};
|
|
97522
97969
|
}
|
|
@@ -97584,8 +98031,8 @@
|
|
|
97584
98031
|
return new Sanitizer(obj).sanitize();
|
|
97585
98032
|
}
|
|
97586
98033
|
function isIncompleteConfigError(err) {
|
|
97587
|
-
return err instanceof MissingRequiredPropertyError
|
|
97588
|
-
(validationError) => validationError instanceof MissingRequiredPropertyError
|
|
98034
|
+
return err instanceof MissingRequiredPropertyError || err instanceof JsonSchemaViolationError && err.validationErrors.find(
|
|
98035
|
+
(validationError) => validationError instanceof MissingRequiredPropertyError
|
|
97589
98036
|
) !== void 0;
|
|
97590
98037
|
}
|
|
97591
98038
|
class CommandWireAdapterConstructor {
|
|
@@ -97671,11 +98118,15 @@
|
|
|
97671
98118
|
}
|
|
97672
98119
|
if (this.configSchema) {
|
|
97673
98120
|
try {
|
|
97674
|
-
assertIsValid
|
|
98121
|
+
assertIsValid(this.config, this.configSchema);
|
|
97675
98122
|
} catch (err) {
|
|
97676
98123
|
if (isIncompleteConfigError(err)) {
|
|
97677
98124
|
return;
|
|
97678
98125
|
}
|
|
98126
|
+
if (err instanceof JsonSchemaViolationError) {
|
|
98127
|
+
this.handleConfigSchemaViolation(err);
|
|
98128
|
+
return;
|
|
98129
|
+
}
|
|
97679
98130
|
throw err;
|
|
97680
98131
|
}
|
|
97681
98132
|
}
|
|
@@ -97728,6 +98179,16 @@
|
|
|
97728
98179
|
handleExecutionThrow(error) {
|
|
97729
98180
|
emitError(this.callback, error);
|
|
97730
98181
|
}
|
|
98182
|
+
/**
|
|
98183
|
+
* Hook for subclasses to handle a JsonSchemaViolationError from the config
|
|
98184
|
+
* schema assertion. The default re-throws so legacy non-GraphQL wire
|
|
98185
|
+
* adapters keep their existing throw behavior. Overrides are expected to
|
|
98186
|
+
* either emit an error result or re-throw — silently returning will
|
|
98187
|
+
* swallow the error.
|
|
98188
|
+
*/
|
|
98189
|
+
handleConfigSchemaViolation(error) {
|
|
98190
|
+
throw error;
|
|
98191
|
+
}
|
|
97731
98192
|
unsubscribe() {
|
|
97732
98193
|
if (this.unsubscriber) {
|
|
97733
98194
|
this.unsubscriber();
|
|
@@ -97820,16 +98281,14 @@
|
|
|
97820
98281
|
this.callback(consumerEmittedData);
|
|
97821
98282
|
}
|
|
97822
98283
|
} catch (e) {
|
|
97823
|
-
logError$1(e);
|
|
97824
98284
|
this.handleExecutionThrow(e);
|
|
97825
98285
|
}
|
|
97826
98286
|
}
|
|
97827
|
-
handleExecutionThrow(
|
|
97828
|
-
|
|
97829
|
-
|
|
97830
|
-
|
|
97831
|
-
|
|
97832
|
-
});
|
|
98287
|
+
handleExecutionThrow(error) {
|
|
98288
|
+
this.callback(toGraphQLErrorResponse(error));
|
|
98289
|
+
}
|
|
98290
|
+
handleConfigSchemaViolation(error) {
|
|
98291
|
+
this.handleExecutionThrow(error);
|
|
97833
98292
|
}
|
|
97834
98293
|
update(config, _context) {
|
|
97835
98294
|
this.unsubscribe();
|
|
@@ -98481,9 +98940,11 @@
|
|
|
98481
98940
|
return entries.length > 0 ? this.store.setEntries(entries) : Promise.resolve();
|
|
98482
98941
|
}
|
|
98483
98942
|
find(_query) {
|
|
98943
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
98484
98944
|
throw new Error('find not supported on the NimbusDurableCacheInclusionPolicy');
|
|
98485
98945
|
}
|
|
98486
98946
|
findAndModify(_query, _cacheUpdate) {
|
|
98947
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
98487
98948
|
throw new Error('findAndModify not supported on the NimbusDurableCacheInclusionPolicy');
|
|
98488
98949
|
}
|
|
98489
98950
|
registerListener() {
|
|
@@ -98509,7 +98970,7 @@
|
|
|
98509
98970
|
});
|
|
98510
98971
|
});
|
|
98511
98972
|
}
|
|
98512
|
-
// TODO: onestore doesnt support cache eviction yet
|
|
98973
|
+
// TODO [W-19368859]: onestore doesnt support cache eviction yet
|
|
98513
98974
|
// if (evictKeys.size > 0) {
|
|
98514
98975
|
// evictKeys.forEach((key) => {
|
|
98515
98976
|
// this.services.cache.evict(key);
|
|
@@ -98604,6 +99065,7 @@
|
|
|
98604
99065
|
batchQuery(operations) {
|
|
98605
99066
|
return new Promise((resolve, reject) => {
|
|
98606
99067
|
this.sqlStore.batchOperations(operations, (error) => {
|
|
99068
|
+
// eslint-disable-next-line no-unused-expressions
|
|
98607
99069
|
error ? reject(error) : resolve();
|
|
98608
99070
|
});
|
|
98609
99071
|
});
|
|
@@ -98679,7 +99141,7 @@
|
|
|
98679
99141
|
buildServiceDescriptor$7(),
|
|
98680
99142
|
buildServiceDescriptor$1$1(),
|
|
98681
99143
|
buildServiceDescriptor$2(),
|
|
98682
|
-
// TODO[
|
|
99144
|
+
// TODO [W-18753648]: See note above.
|
|
98683
99145
|
// buildStreamingCommandServiceDescriptor(),
|
|
98684
99146
|
// buildNdJsonServiceDescriptor(),
|
|
98685
99147
|
// buildSseCommandServiceDescriptor(),
|
|
@@ -98938,378 +99400,12 @@
|
|
|
98938
99400
|
id: '@salesforce/lds-network-adapter',
|
|
98939
99401
|
instrument: instrument$2,
|
|
98940
99402
|
});
|
|
98941
|
-
// version: 1.
|
|
99403
|
+
// version: 1.435.0-5818ce3c48
|
|
98942
99404
|
|
|
98943
99405
|
const { create: create$2, keys: keys$2 } = Object;
|
|
98944
99406
|
const { stringify, parse } = JSON;
|
|
98945
99407
|
const { isArray: isArray$3 } = Array;
|
|
98946
99408
|
|
|
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
99409
|
/*!
|
|
99314
99410
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
99315
99411
|
* All rights reserved.
|
|
@@ -99358,35 +99454,35 @@
|
|
|
99358
99454
|
function extractVariableValue(variableName, variableDefinitions) {
|
|
99359
99455
|
const variable = variableDefinitions[variableName];
|
|
99360
99456
|
if (!variable) {
|
|
99361
|
-
return err$
|
|
99457
|
+
return err$3(
|
|
99362
99458
|
new Error(`Variable '${variableName}' was used in the query but was not defined`)
|
|
99363
99459
|
);
|
|
99364
99460
|
}
|
|
99365
99461
|
if (variable.value !== void 0) {
|
|
99366
|
-
return ok$
|
|
99462
|
+
return ok$3(variable.value);
|
|
99367
99463
|
}
|
|
99368
99464
|
if (variable.definition.defaultValue) {
|
|
99369
99465
|
return extractValue(variable.definition.defaultValue, variableDefinitions);
|
|
99370
99466
|
}
|
|
99371
|
-
return ok$
|
|
99467
|
+
return ok$3(void 0);
|
|
99372
99468
|
}
|
|
99373
99469
|
function validateExpectedType(value, expectedType) {
|
|
99374
99470
|
if (!expectedType) {
|
|
99375
|
-
return ok$
|
|
99471
|
+
return ok$3(value);
|
|
99376
99472
|
}
|
|
99377
99473
|
if (value === null) {
|
|
99378
99474
|
if (expectedType.nullable) {
|
|
99379
|
-
return ok$
|
|
99475
|
+
return ok$3(value);
|
|
99380
99476
|
} else {
|
|
99381
|
-
return err$
|
|
99477
|
+
return err$3(new Error(`Expected ${expectedType.type}, but got null`));
|
|
99382
99478
|
}
|
|
99383
99479
|
}
|
|
99384
99480
|
const actualType = typeof value;
|
|
99385
99481
|
if (actualType === expectedType.type) {
|
|
99386
|
-
return ok$
|
|
99482
|
+
return ok$3(value);
|
|
99387
99483
|
}
|
|
99388
99484
|
const expectedTypeString = expectedType.nullable ? `${expectedType.type} | null` : expectedType.type;
|
|
99389
|
-
return err$
|
|
99485
|
+
return err$3(
|
|
99390
99486
|
new Error(`Expected ${expectedTypeString}, but got ${actualType}: ${JSON.stringify(value)}`)
|
|
99391
99487
|
);
|
|
99392
99488
|
}
|
|
@@ -99429,10 +99525,10 @@
|
|
|
99429
99525
|
(def) => def.kind === Kind$1.OPERATION_DEFINITION
|
|
99430
99526
|
);
|
|
99431
99527
|
if (operations.length === 0) {
|
|
99432
|
-
return err$
|
|
99528
|
+
return err$3(new Error("No operations found in query"));
|
|
99433
99529
|
}
|
|
99434
99530
|
if (operations.length === 1 && !input.operationName) {
|
|
99435
|
-
return ok$
|
|
99531
|
+
return ok$3(operations[0]);
|
|
99436
99532
|
}
|
|
99437
99533
|
if (input.operationName) {
|
|
99438
99534
|
const specifiedOperation = operations.find((op) => {
|
|
@@ -99440,16 +99536,16 @@
|
|
|
99440
99536
|
return ((_a = op.name) == null ? void 0 : _a.value) === input.operationName;
|
|
99441
99537
|
});
|
|
99442
99538
|
if (specifiedOperation) {
|
|
99443
|
-
return ok$
|
|
99539
|
+
return ok$3(specifiedOperation);
|
|
99444
99540
|
}
|
|
99445
|
-
return err$
|
|
99541
|
+
return err$3(new Error(`Operation "${input.operationName}" not found in query`));
|
|
99446
99542
|
}
|
|
99447
|
-
return err$
|
|
99543
|
+
return err$3(new Error("Multiple operations found in query, and no operation name provided"));
|
|
99448
99544
|
}
|
|
99449
99545
|
function buildGraphQLInputExtension(input) {
|
|
99450
99546
|
const operationResult = findExecutableOperation(input);
|
|
99451
99547
|
if (operationResult.isErr()) {
|
|
99452
|
-
return err$
|
|
99548
|
+
return err$3(operationResult.error);
|
|
99453
99549
|
}
|
|
99454
99550
|
const operation = operationResult.value;
|
|
99455
99551
|
const selections = operation.selectionSet.selections;
|
|
@@ -99466,7 +99562,7 @@
|
|
|
99466
99562
|
prev[fragment.name.value] = fragment;
|
|
99467
99563
|
return prev;
|
|
99468
99564
|
}, {});
|
|
99469
|
-
return ok$
|
|
99565
|
+
return ok$3({
|
|
99470
99566
|
selections,
|
|
99471
99567
|
request: { definitions: { variables, fragments } },
|
|
99472
99568
|
parentFieldSelection: void 0
|
|
@@ -99624,13 +99720,13 @@
|
|
|
99624
99720
|
}
|
|
99625
99721
|
function buildFieldKey(canonicalFieldName, fieldArguments, variables) {
|
|
99626
99722
|
if (fieldArguments === void 0 || fieldArguments.length === 0) {
|
|
99627
|
-
return ok$
|
|
99723
|
+
return ok$3(canonicalFieldName);
|
|
99628
99724
|
}
|
|
99629
99725
|
const formattedArguments = {};
|
|
99630
99726
|
for (const arg of fieldArguments) {
|
|
99631
99727
|
const result = extractValue(arg.value, variables);
|
|
99632
99728
|
if (result.isErr()) {
|
|
99633
|
-
return err$
|
|
99729
|
+
return err$3(
|
|
99634
99730
|
new Error(
|
|
99635
99731
|
`Failed to extract argument '${arg.name.value}' for field '${canonicalFieldName}': ${result.error.message}`
|
|
99636
99732
|
)
|
|
@@ -99638,7 +99734,7 @@
|
|
|
99638
99734
|
}
|
|
99639
99735
|
formattedArguments[arg.name.value] = result.value;
|
|
99640
99736
|
}
|
|
99641
|
-
return ok$
|
|
99737
|
+
return ok$3(`${canonicalFieldName}::${stableJSONStringify$3({ args: formattedArguments })}`);
|
|
99642
99738
|
}
|
|
99643
99739
|
({
|
|
99644
99740
|
kind: Kind$1.FIELD,
|
|
@@ -99663,17 +99759,17 @@
|
|
|
99663
99759
|
var _a;
|
|
99664
99760
|
const ifArg = (_a = directive.arguments) == null ? void 0 : _a.find((arg) => arg.name.value === "if");
|
|
99665
99761
|
if (!ifArg) {
|
|
99666
|
-
return err$
|
|
99762
|
+
return err$3(new Error(`@${directiveName} directive requires an 'if' argument`));
|
|
99667
99763
|
}
|
|
99668
99764
|
const result = extractValue(ifArg.value, variables, { type: "boolean", nullable: false });
|
|
99669
99765
|
if (result.isErr()) {
|
|
99670
|
-
return err$
|
|
99766
|
+
return err$3(result.error);
|
|
99671
99767
|
}
|
|
99672
|
-
return ok$
|
|
99768
|
+
return ok$3(result.value);
|
|
99673
99769
|
}
|
|
99674
99770
|
function shouldSkip(selection, variables) {
|
|
99675
99771
|
if (!selection.directives || selection.directives.length === 0) {
|
|
99676
|
-
return ok$
|
|
99772
|
+
return ok$3(false);
|
|
99677
99773
|
}
|
|
99678
99774
|
for (const directive of selection.directives) {
|
|
99679
99775
|
if (directive.name.value === "skip") {
|
|
@@ -99682,7 +99778,7 @@
|
|
|
99682
99778
|
return ifResult;
|
|
99683
99779
|
}
|
|
99684
99780
|
if (ifResult.value === true) {
|
|
99685
|
-
return ok$
|
|
99781
|
+
return ok$3(true);
|
|
99686
99782
|
}
|
|
99687
99783
|
}
|
|
99688
99784
|
if (directive.name.value === "include") {
|
|
@@ -99691,11 +99787,11 @@
|
|
|
99691
99787
|
return ifResult;
|
|
99692
99788
|
}
|
|
99693
99789
|
if (ifResult.value === false) {
|
|
99694
|
-
return ok$
|
|
99790
|
+
return ok$3(true);
|
|
99695
99791
|
}
|
|
99696
99792
|
}
|
|
99697
99793
|
}
|
|
99698
|
-
return ok$
|
|
99794
|
+
return ok$3(false);
|
|
99699
99795
|
}
|
|
99700
99796
|
class BaseScalarFieldDef {
|
|
99701
99797
|
constructor(nullable) {
|
|
@@ -99703,11 +99799,11 @@
|
|
|
99703
99799
|
}
|
|
99704
99800
|
write(_cache, input) {
|
|
99705
99801
|
if (input.data === void 0) {
|
|
99706
|
-
return ok$
|
|
99802
|
+
return ok$3({ type: "missing" });
|
|
99707
99803
|
}
|
|
99708
99804
|
if (input.data === null) {
|
|
99709
99805
|
if (!this.nullable) {
|
|
99710
|
-
return err$
|
|
99806
|
+
return err$3([
|
|
99711
99807
|
{
|
|
99712
99808
|
type: "unknown",
|
|
99713
99809
|
error: new Error(
|
|
@@ -99717,14 +99813,14 @@
|
|
|
99717
99813
|
]);
|
|
99718
99814
|
}
|
|
99719
99815
|
}
|
|
99720
|
-
return ok$
|
|
99816
|
+
return ok$3({ type: "data", data: input.data });
|
|
99721
99817
|
}
|
|
99722
99818
|
read(_cache, input) {
|
|
99723
99819
|
const normalizedData = input.normalizedData;
|
|
99724
99820
|
if (normalizedData.type === "missing") {
|
|
99725
|
-
return ok$
|
|
99821
|
+
return ok$3(void 0);
|
|
99726
99822
|
}
|
|
99727
|
-
return ok$
|
|
99823
|
+
return ok$3(normalizedData.data);
|
|
99728
99824
|
}
|
|
99729
99825
|
augmentSelections(input) {
|
|
99730
99826
|
return input;
|
|
@@ -99746,11 +99842,11 @@
|
|
|
99746
99842
|
}
|
|
99747
99843
|
write(cache, input) {
|
|
99748
99844
|
if (input.data === void 0) {
|
|
99749
|
-
return ok$
|
|
99845
|
+
return ok$3({ type: "missing" });
|
|
99750
99846
|
}
|
|
99751
99847
|
if (input.data === null) {
|
|
99752
99848
|
if (!this.nullable) {
|
|
99753
|
-
return err$
|
|
99849
|
+
return err$3([
|
|
99754
99850
|
{
|
|
99755
99851
|
type: "unknown",
|
|
99756
99852
|
error: new Error(
|
|
@@ -99759,10 +99855,10 @@
|
|
|
99759
99855
|
}
|
|
99760
99856
|
]);
|
|
99761
99857
|
}
|
|
99762
|
-
return ok$
|
|
99858
|
+
return ok$3({ type: "data", data: input.data });
|
|
99763
99859
|
}
|
|
99764
99860
|
if (!Array.isArray(input.data)) {
|
|
99765
|
-
return err$
|
|
99861
|
+
return err$3([
|
|
99766
99862
|
{
|
|
99767
99863
|
type: "unknown",
|
|
99768
99864
|
error: new Error(
|
|
@@ -99790,18 +99886,18 @@
|
|
|
99790
99886
|
}
|
|
99791
99887
|
});
|
|
99792
99888
|
if (arrayNormalizationErrors.length > 0) {
|
|
99793
|
-
return err$
|
|
99889
|
+
return err$3(arrayNormalizationErrors);
|
|
99794
99890
|
}
|
|
99795
|
-
return ok$
|
|
99891
|
+
return ok$3({ type: "data", data: normalizedArray });
|
|
99796
99892
|
}
|
|
99797
99893
|
read(cache, input) {
|
|
99798
99894
|
const normalizedData = input.normalizedData;
|
|
99799
99895
|
if (normalizedData.type === "missing") {
|
|
99800
|
-
return ok$
|
|
99896
|
+
return ok$3(void 0);
|
|
99801
99897
|
}
|
|
99802
99898
|
if (normalizedData.data === null) {
|
|
99803
99899
|
if (!this.nullable) {
|
|
99804
|
-
return err$
|
|
99900
|
+
return err$3([
|
|
99805
99901
|
{
|
|
99806
99902
|
type: "unknown",
|
|
99807
99903
|
error: new Error(
|
|
@@ -99810,10 +99906,10 @@
|
|
|
99810
99906
|
}
|
|
99811
99907
|
]);
|
|
99812
99908
|
}
|
|
99813
|
-
return ok$
|
|
99909
|
+
return ok$3({ type: "data", data: null });
|
|
99814
99910
|
}
|
|
99815
99911
|
if (!Array.isArray(normalizedData.data)) {
|
|
99816
|
-
return err$
|
|
99912
|
+
return err$3([
|
|
99817
99913
|
{
|
|
99818
99914
|
type: "unknown",
|
|
99819
99915
|
error: new Error(
|
|
@@ -99838,9 +99934,9 @@
|
|
|
99838
99934
|
}
|
|
99839
99935
|
});
|
|
99840
99936
|
if (arrayDenormalizationErrors.length > 0) {
|
|
99841
|
-
return err$
|
|
99937
|
+
return err$3(arrayDenormalizationErrors);
|
|
99842
99938
|
}
|
|
99843
|
-
return ok$
|
|
99939
|
+
return ok$3(denormalizedArray);
|
|
99844
99940
|
}
|
|
99845
99941
|
}
|
|
99846
99942
|
class BaseObjectFieldDef {
|
|
@@ -99857,7 +99953,7 @@
|
|
|
99857
99953
|
write(cache, input) {
|
|
99858
99954
|
var _a;
|
|
99859
99955
|
if (!input.selection.selectionSet) {
|
|
99860
|
-
return err$
|
|
99956
|
+
return err$3([
|
|
99861
99957
|
{
|
|
99862
99958
|
type: "unknown",
|
|
99863
99959
|
error: new Error(
|
|
@@ -99867,11 +99963,11 @@
|
|
|
99867
99963
|
]);
|
|
99868
99964
|
}
|
|
99869
99965
|
if (input.data === void 0) {
|
|
99870
|
-
return ok$
|
|
99966
|
+
return ok$3({ type: "missing" });
|
|
99871
99967
|
}
|
|
99872
99968
|
if (input.data === null) {
|
|
99873
99969
|
if (!this.nullable) {
|
|
99874
|
-
return err$
|
|
99970
|
+
return err$3([
|
|
99875
99971
|
{
|
|
99876
99972
|
type: "unknown",
|
|
99877
99973
|
error: new Error(
|
|
@@ -99880,7 +99976,7 @@
|
|
|
99880
99976
|
}
|
|
99881
99977
|
]);
|
|
99882
99978
|
}
|
|
99883
|
-
return ok$
|
|
99979
|
+
return ok$3({ type: "data", data: null });
|
|
99884
99980
|
}
|
|
99885
99981
|
const writeResult = this.repository.write(cache, {
|
|
99886
99982
|
...input,
|
|
@@ -99893,12 +99989,12 @@
|
|
|
99893
99989
|
if (writeResult.isErr()) {
|
|
99894
99990
|
return writeResult;
|
|
99895
99991
|
}
|
|
99896
|
-
return ok$
|
|
99992
|
+
return ok$3({ type: "data", data: writeResult.value });
|
|
99897
99993
|
}
|
|
99898
99994
|
read(cache, input) {
|
|
99899
99995
|
var _a;
|
|
99900
99996
|
if (!input.selection.selectionSet) {
|
|
99901
|
-
return err$
|
|
99997
|
+
return err$3([
|
|
99902
99998
|
{
|
|
99903
99999
|
type: "unknown",
|
|
99904
100000
|
error: new Error(
|
|
@@ -99909,11 +100005,11 @@
|
|
|
99909
100005
|
}
|
|
99910
100006
|
const normalizedData = input.normalizedData;
|
|
99911
100007
|
if (normalizedData.type === "missing") {
|
|
99912
|
-
return ok$
|
|
100008
|
+
return ok$3(void 0);
|
|
99913
100009
|
}
|
|
99914
100010
|
if (normalizedData.data === null) {
|
|
99915
100011
|
if (!this.nullable) {
|
|
99916
|
-
return err$
|
|
100012
|
+
return err$3([
|
|
99917
100013
|
{
|
|
99918
100014
|
type: "unknown",
|
|
99919
100015
|
error: new Error(
|
|
@@ -99922,7 +100018,7 @@
|
|
|
99922
100018
|
}
|
|
99923
100019
|
]);
|
|
99924
100020
|
}
|
|
99925
|
-
return ok$
|
|
100021
|
+
return ok$3(null);
|
|
99926
100022
|
}
|
|
99927
100023
|
return this.repository.read(cache, {
|
|
99928
100024
|
...input,
|
|
@@ -100205,7 +100301,7 @@
|
|
|
100205
100301
|
var _a;
|
|
100206
100302
|
const fieldDef = this.getFieldDef(input, selection);
|
|
100207
100303
|
if (!fieldDef) {
|
|
100208
|
-
return err$
|
|
100304
|
+
return err$3(
|
|
100209
100305
|
new Error(
|
|
100210
100306
|
`Unknown field "${selection.name.value}" on type "${this.typeName}". Expected one of fields ${Object.keys(this.fields)}.`
|
|
100211
100307
|
)
|
|
@@ -100216,10 +100312,10 @@
|
|
|
100216
100312
|
input.request.definitions.variables
|
|
100217
100313
|
);
|
|
100218
100314
|
if (cacheFieldKeyResult.isErr()) {
|
|
100219
|
-
return err$
|
|
100315
|
+
return err$3(cacheFieldKeyResult.error);
|
|
100220
100316
|
}
|
|
100221
100317
|
const cacheFieldKey = cacheFieldKeyResult.value;
|
|
100222
|
-
return ok$
|
|
100318
|
+
return ok$3((_a = input.existingNormalizedData || input.normalizedData) == null ? void 0 : _a[cacheFieldKey]);
|
|
100223
100319
|
}
|
|
100224
100320
|
denormalizeFieldSelection(cache, input, selection, errorCollector) {
|
|
100225
100321
|
var _a;
|
|
@@ -100325,22 +100421,22 @@
|
|
|
100325
100421
|
return shouldSkipResult;
|
|
100326
100422
|
}
|
|
100327
100423
|
if (shouldSkipResult.value) {
|
|
100328
|
-
return ok$
|
|
100424
|
+
return ok$3(false);
|
|
100329
100425
|
}
|
|
100330
100426
|
return this.satisfiesFragmentTypeCondition(input, fragment);
|
|
100331
100427
|
}
|
|
100332
100428
|
satisfiesFragmentTypeCondition(_input, fragment) {
|
|
100333
100429
|
if (!fragment.typeCondition) {
|
|
100334
|
-
return ok$
|
|
100430
|
+
return ok$3(true);
|
|
100335
100431
|
}
|
|
100336
100432
|
const conditionalTypeName = fragment.typeCondition.name.value;
|
|
100337
100433
|
if (conditionalTypeName === this.typeName) {
|
|
100338
|
-
return ok$
|
|
100434
|
+
return ok$3(true);
|
|
100339
100435
|
}
|
|
100340
100436
|
if (this.implementedInterfaces.includes(conditionalTypeName)) {
|
|
100341
|
-
return ok$
|
|
100437
|
+
return ok$3(true);
|
|
100342
100438
|
}
|
|
100343
|
-
return ok$
|
|
100439
|
+
return ok$3(false);
|
|
100344
100440
|
}
|
|
100345
100441
|
getCacheKeyFieldArguments(selection) {
|
|
100346
100442
|
return selection.arguments;
|
|
@@ -100399,7 +100495,7 @@
|
|
|
100399
100495
|
const key = this.buildKey(this.buildKeyParams(input));
|
|
100400
100496
|
const normalized = this.normalizeData(cache, input);
|
|
100401
100497
|
if (normalized.isErr()) {
|
|
100402
|
-
return err$
|
|
100498
|
+
return err$3(normalized.error);
|
|
100403
100499
|
}
|
|
100404
100500
|
const existing = cache.get(key);
|
|
100405
100501
|
if (!deepEquals$2(existing == null ? void 0 : existing.value, normalized.value)) {
|
|
@@ -100408,7 +100504,7 @@
|
|
|
100408
100504
|
metadata: this.cacheMetadata
|
|
100409
100505
|
});
|
|
100410
100506
|
}
|
|
100411
|
-
return ok$
|
|
100507
|
+
return ok$3({
|
|
100412
100508
|
type: "link",
|
|
100413
100509
|
linkedKey: key
|
|
100414
100510
|
});
|
|
@@ -100423,7 +100519,7 @@
|
|
|
100423
100519
|
if (normalizeDataResult.isErr()) {
|
|
100424
100520
|
return normalizeDataResult;
|
|
100425
100521
|
}
|
|
100426
|
-
return ok$
|
|
100522
|
+
return ok$3(
|
|
100427
100523
|
deepMerge$2(
|
|
100428
100524
|
{},
|
|
100429
100525
|
(existingNormalizedData == null ? void 0 : existingNormalizedData.value) || {},
|
|
@@ -100493,7 +100589,7 @@
|
|
|
100493
100589
|
if (result.isErr()) {
|
|
100494
100590
|
return result;
|
|
100495
100591
|
}
|
|
100496
|
-
return ok$
|
|
100592
|
+
return ok$3({
|
|
100497
100593
|
data: result.value
|
|
100498
100594
|
});
|
|
100499
100595
|
}
|
|
@@ -100501,7 +100597,7 @@
|
|
|
100501
100597
|
var _a;
|
|
100502
100598
|
const operationResult = findExecutableOperation(input);
|
|
100503
100599
|
if (operationResult.isErr()) {
|
|
100504
|
-
return err$
|
|
100600
|
+
return err$3(operationResult.error);
|
|
100505
100601
|
}
|
|
100506
100602
|
const operation = operationResult.value;
|
|
100507
100603
|
const fragmentDefinitions = input.query.definitions.filter(
|
|
@@ -100524,7 +100620,7 @@
|
|
|
100524
100620
|
...operation,
|
|
100525
100621
|
selectionSet: { kind: Kind$1.SELECTION_SET, selections: augmentedOperationSelections }
|
|
100526
100622
|
};
|
|
100527
|
-
return ok$
|
|
100623
|
+
return ok$3({
|
|
100528
100624
|
...input.query,
|
|
100529
100625
|
definitions: [
|
|
100530
100626
|
...input.query.definitions.filter((def) => def.kind !== Kind$1.FRAGMENT_DEFINITION).map((def) => {
|
|
@@ -100559,7 +100655,7 @@
|
|
|
100559
100655
|
}
|
|
100560
100656
|
write(cache, input) {
|
|
100561
100657
|
if (typeof input.data !== "object") {
|
|
100562
|
-
return err$
|
|
100658
|
+
return err$3([
|
|
100563
100659
|
{
|
|
100564
100660
|
type: "unknown",
|
|
100565
100661
|
error: new Error(`Got a non-object value for ${this.typeName} field"`)
|
|
@@ -100569,7 +100665,7 @@
|
|
|
100569
100665
|
const discriminator = this.getTypeDiscriminator(input.data, input.selections);
|
|
100570
100666
|
const concreteTypeRepository = this.possibleTypes[discriminator];
|
|
100571
100667
|
if (!concreteTypeRepository) {
|
|
100572
|
-
return err$
|
|
100668
|
+
return err$3([
|
|
100573
100669
|
{
|
|
100574
100670
|
type: "unknown",
|
|
100575
100671
|
error: new Error(
|
|
@@ -100580,7 +100676,7 @@
|
|
|
100580
100676
|
}
|
|
100581
100677
|
const selectionErr = this.verifyInterfaceFields(input.selections);
|
|
100582
100678
|
if (selectionErr) {
|
|
100583
|
-
return err$
|
|
100679
|
+
return err$3(selectionErr);
|
|
100584
100680
|
}
|
|
100585
100681
|
const normalizeInput = {
|
|
100586
100682
|
...input,
|
|
@@ -100592,14 +100688,14 @@
|
|
|
100592
100688
|
};
|
|
100593
100689
|
const result = concreteTypeRepository.write(cache, normalizeInput);
|
|
100594
100690
|
if (result.isOk()) {
|
|
100595
|
-
return ok$
|
|
100691
|
+
return ok$3({ discriminator, data: result.value });
|
|
100596
100692
|
}
|
|
100597
100693
|
return result;
|
|
100598
100694
|
}
|
|
100599
100695
|
read(cache, input) {
|
|
100600
100696
|
const unionRep = input.normalizedData;
|
|
100601
100697
|
if (typeof unionRep.data !== "object" || unionRep.data === null) {
|
|
100602
|
-
return err$
|
|
100698
|
+
return err$3([
|
|
100603
100699
|
{
|
|
100604
100700
|
type: "unknown",
|
|
100605
100701
|
error: new Error(`Got a non-object value for ${this.typeName} field.`)
|
|
@@ -100609,7 +100705,7 @@
|
|
|
100609
100705
|
const discriminator = unionRep.discriminator;
|
|
100610
100706
|
const concreteRepository = this.possibleTypes[discriminator];
|
|
100611
100707
|
if (!concreteRepository) {
|
|
100612
|
-
return err$
|
|
100708
|
+
return err$3([
|
|
100613
100709
|
{
|
|
100614
100710
|
type: "unknown",
|
|
100615
100711
|
error: new Error(
|
|
@@ -100620,7 +100716,7 @@
|
|
|
100620
100716
|
}
|
|
100621
100717
|
const selectionErr = this.verifyInterfaceFields(input.selections);
|
|
100622
100718
|
if (selectionErr) {
|
|
100623
|
-
return err$
|
|
100719
|
+
return err$3(selectionErr);
|
|
100624
100720
|
}
|
|
100625
100721
|
const denormalizeInput = {
|
|
100626
100722
|
...input,
|
|
@@ -100725,7 +100821,7 @@
|
|
|
100725
100821
|
}
|
|
100726
100822
|
write(cache, input) {
|
|
100727
100823
|
if (typeof input.data !== "object") {
|
|
100728
|
-
return err$
|
|
100824
|
+
return err$3([
|
|
100729
100825
|
{
|
|
100730
100826
|
type: "unknown",
|
|
100731
100827
|
error: new Error(`Got a non-object value for ${this.typeName} field"`)
|
|
@@ -100735,7 +100831,7 @@
|
|
|
100735
100831
|
const discriminator = this.getTypeDiscriminator(input.data, input.selections);
|
|
100736
100832
|
const concreteTypeRepository = this.possibleTypes[discriminator];
|
|
100737
100833
|
if (!concreteTypeRepository) {
|
|
100738
|
-
return err$
|
|
100834
|
+
return err$3([
|
|
100739
100835
|
{
|
|
100740
100836
|
type: "unknown",
|
|
100741
100837
|
error: new Error(
|
|
@@ -100746,7 +100842,7 @@
|
|
|
100746
100842
|
}
|
|
100747
100843
|
const selectionErr = this.verifyUnionFields(input.selections);
|
|
100748
100844
|
if (selectionErr) {
|
|
100749
|
-
return err$
|
|
100845
|
+
return err$3(selectionErr);
|
|
100750
100846
|
}
|
|
100751
100847
|
const normalizeInput = {
|
|
100752
100848
|
...input,
|
|
@@ -100758,14 +100854,14 @@
|
|
|
100758
100854
|
};
|
|
100759
100855
|
const result = concreteTypeRepository.write(cache, normalizeInput);
|
|
100760
100856
|
if (result.isOk()) {
|
|
100761
|
-
return ok$
|
|
100857
|
+
return ok$3({ discriminator, data: result.value });
|
|
100762
100858
|
}
|
|
100763
100859
|
return result;
|
|
100764
100860
|
}
|
|
100765
100861
|
read(cache, input) {
|
|
100766
100862
|
const unionRep = input.normalizedData;
|
|
100767
100863
|
if (typeof unionRep.data !== "object" || unionRep.data === null) {
|
|
100768
|
-
return err$
|
|
100864
|
+
return err$3([
|
|
100769
100865
|
{
|
|
100770
100866
|
type: "unknown",
|
|
100771
100867
|
error: new Error(`Got a non-object value for ${this.typeName} field.`)
|
|
@@ -100775,7 +100871,7 @@
|
|
|
100775
100871
|
const discriminator = unionRep.discriminator;
|
|
100776
100872
|
const concreteRepository = this.possibleTypes[discriminator];
|
|
100777
100873
|
if (!concreteRepository) {
|
|
100778
|
-
return err$
|
|
100874
|
+
return err$3([
|
|
100779
100875
|
{
|
|
100780
100876
|
type: "unknown",
|
|
100781
100877
|
error: new Error(
|
|
@@ -100786,7 +100882,7 @@
|
|
|
100786
100882
|
}
|
|
100787
100883
|
const selectionErr = this.verifyUnionFields(input.selections);
|
|
100788
100884
|
if (selectionErr) {
|
|
100789
|
-
return err$
|
|
100885
|
+
return err$3(selectionErr);
|
|
100790
100886
|
}
|
|
100791
100887
|
const denormalizeInput = {
|
|
100792
100888
|
...input,
|
|
@@ -105305,7 +105401,7 @@
|
|
|
105305
105401
|
* @param typeName - The repository type name for error messages
|
|
105306
105402
|
* @returns Result<boolean, Error> - true if the fragment type condition is satisfied
|
|
105307
105403
|
*/
|
|
105308
|
-
function genericSatisfiesFragmentTypeCondition(superSatisfiesFragmentTypeCondition, input, fragment,
|
|
105404
|
+
function genericSatisfiesFragmentTypeCondition(superSatisfiesFragmentTypeCondition, input, fragment, _typeName) {
|
|
105309
105405
|
// First try the base class implementation
|
|
105310
105406
|
const result = superSatisfiesFragmentTypeCondition(input, fragment);
|
|
105311
105407
|
if (result.isErr() || result.value) {
|
|
@@ -105773,7 +105869,7 @@
|
|
|
105773
105869
|
}
|
|
105774
105870
|
|
|
105775
105871
|
class PolymorphicParentRelationshipRepository extends PolymorphicParentRelationshipRepository$1 {
|
|
105776
|
-
getTypeDiscriminator(
|
|
105872
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105777
105873
|
// Hardcoded to record representation since that's the only type of parent
|
|
105778
105874
|
// relationship possible
|
|
105779
105875
|
return 'RecordRepresentation';
|
|
@@ -105813,7 +105909,7 @@
|
|
|
105813
105909
|
}
|
|
105814
105910
|
|
|
105815
105911
|
class PolymorphicAggregateParentRelationshipRepository extends PolymorphicAggregateParentRelationshipRepository$1 {
|
|
105816
|
-
getTypeDiscriminator(
|
|
105912
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105817
105913
|
// Hardcoded to record aggregate since that's the only type of parent
|
|
105818
105914
|
// relationship possible
|
|
105819
105915
|
return 'RecordAggregate';
|
|
@@ -105870,6 +105966,7 @@
|
|
|
105870
105966
|
let idFieldSelection = input.selections.find((selection) => selection.kind === 'Field' && selection.name.value === 'Id');
|
|
105871
105967
|
// If Id exists in data but wasn't asked for, synthesize the selection like RecordRepresentation does
|
|
105872
105968
|
if (input.data.Id !== undefined && !idFieldSelection) {
|
|
105969
|
+
// eslint-disable-next-line no-param-reassign
|
|
105873
105970
|
input = {
|
|
105874
105971
|
...input,
|
|
105875
105972
|
selections: [
|
|
@@ -105917,7 +106014,7 @@
|
|
|
105917
106014
|
}
|
|
105918
106015
|
|
|
105919
106016
|
class SetupPolymorphicAggregateParentRelationshipRepository extends Setup__SetupPolymorphicAggregateParentRelationshipRepository {
|
|
105920
|
-
getTypeDiscriminator(
|
|
106017
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105921
106018
|
// Hardcoded to Setup__SetupRecordAggregate since that's the only type of parent
|
|
105922
106019
|
// relationship possible
|
|
105923
106020
|
return 'Setup__SetupRecordAggregate';
|
|
@@ -105925,7 +106022,7 @@
|
|
|
105925
106022
|
}
|
|
105926
106023
|
|
|
105927
106024
|
class SetupPolymorphicParentRelationshipRepository extends Setup__SetupPolymorphicParentRelationshipRepository {
|
|
105928
|
-
getTypeDiscriminator(
|
|
106025
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105929
106026
|
// Hardcoded to Setup__EntityRepresentation since that's the only type of parent
|
|
105930
106027
|
// relationship possible
|
|
105931
106028
|
return 'Setup__EntityRepresentation';
|
|
@@ -106066,6 +106163,7 @@
|
|
|
106066
106163
|
const dataType = typeof data;
|
|
106067
106164
|
const extensionsType = typeof extensions;
|
|
106068
106165
|
if (dataType === 'function' || extensionsType === 'function') {
|
|
106166
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
106069
106167
|
throw new Error('Cannot merge functions');
|
|
106070
106168
|
}
|
|
106071
106169
|
if (dataType === 'undefined' || data === undefined) {
|
|
@@ -106406,7 +106504,9 @@
|
|
|
106406
106504
|
});
|
|
106407
106505
|
this.unsubscribers.push(unsubscribeFromLuvioSnapshot);
|
|
106408
106506
|
}
|
|
106409
|
-
catch (error) {
|
|
106507
|
+
catch (error) {
|
|
106508
|
+
// intentionally do nothing
|
|
106509
|
+
}
|
|
106410
106510
|
}
|
|
106411
106511
|
}
|
|
106412
106512
|
usedRecordsChanged() {
|
|
@@ -106446,6 +106546,7 @@
|
|
|
106446
106546
|
};
|
|
106447
106547
|
}
|
|
106448
106548
|
|
|
106549
|
+
const REFRESH_FAILED_MESSAGE = 'Failed to refresh GraphQL data';
|
|
106449
106550
|
function validateNonQueryGraphQLConfig(config) {
|
|
106450
106551
|
if (config !== null && typeof config === 'object') {
|
|
106451
106552
|
if (hasOwnProperty$1.call(config, 'operationName') &&
|
|
@@ -106512,6 +106613,7 @@
|
|
|
106512
106613
|
const invalidKeys = configKeys.filter((key) => !allowedKeysSet.includes(key));
|
|
106513
106614
|
if (invalidKeys.length > 0) {
|
|
106514
106615
|
// invalid keys, so set error state
|
|
106616
|
+
// eslint-disable-next-line no-throw-literal
|
|
106515
106617
|
throw {
|
|
106516
106618
|
error: `Invalid config keys: ${invalidKeys.join(', ')}`,
|
|
106517
106619
|
errorType: 'adapterError',
|
|
@@ -106561,6 +106663,7 @@
|
|
|
106561
106663
|
let processScheduled = false;
|
|
106562
106664
|
let processingInitialConfig = false;
|
|
106563
106665
|
let unsubscribe;
|
|
106666
|
+
let currentResultRefresh;
|
|
106564
106667
|
const statusAtom = atom('unconfigured');
|
|
106565
106668
|
const errorsAtom = atom(undefined);
|
|
106566
106669
|
const dataAtom = atom(undefined);
|
|
@@ -106570,7 +106673,7 @@
|
|
|
106570
106673
|
setAtom(errorsAtom, errors);
|
|
106571
106674
|
setAtom(dataAtom, data);
|
|
106572
106675
|
};
|
|
106573
|
-
const
|
|
106676
|
+
const subscribeCallback = (refreshResult) => {
|
|
106574
106677
|
if (refreshResult.isOk()) {
|
|
106575
106678
|
resultCallback({
|
|
106576
106679
|
ok: true,
|
|
@@ -106599,12 +106702,13 @@
|
|
|
106599
106702
|
.then((result) => {
|
|
106600
106703
|
// handle the initial result
|
|
106601
106704
|
if (result.isOk()) {
|
|
106705
|
+
currentResultRefresh = result.value.refresh.bind(result.value);
|
|
106602
106706
|
resultCallback({
|
|
106603
106707
|
ok: true,
|
|
106604
106708
|
data: result.value.data.data,
|
|
106605
106709
|
errors: undefined,
|
|
106606
106710
|
});
|
|
106607
|
-
unsubscribe = createWeakSubscription((cb) => result.value.subscribe(cb), new WeakRef(
|
|
106711
|
+
unsubscribe = createWeakSubscription((cb) => result.value.subscribe(cb), new WeakRef(subscribeCallback));
|
|
106608
106712
|
}
|
|
106609
106713
|
else {
|
|
106610
106714
|
const resp = toGraphQLResponseFromFailure(result.error.failure);
|
|
@@ -106617,6 +106721,7 @@
|
|
|
106617
106721
|
});
|
|
106618
106722
|
};
|
|
106619
106723
|
const queueConfigUpdate = (config) => {
|
|
106724
|
+
currentResultRefresh = undefined;
|
|
106620
106725
|
try {
|
|
106621
106726
|
const configIsGood = _checkConfig(config);
|
|
106622
106727
|
queuedConfig = configIsGood ? config : undefined;
|
|
@@ -106643,6 +106748,23 @@
|
|
|
106643
106748
|
}
|
|
106644
106749
|
};
|
|
106645
106750
|
const setters = createSetters(allowedKeys, queueConfigUpdate);
|
|
106751
|
+
const refresh = () => {
|
|
106752
|
+
const status = statusAtom.value;
|
|
106753
|
+
if (status === 'unconfigured' || status === 'error' || status === 'loading') {
|
|
106754
|
+
return Promise.reject(new Error(REFRESH_FAILED_MESSAGE));
|
|
106755
|
+
}
|
|
106756
|
+
// status === 'loaded'
|
|
106757
|
+
return new Promise((resolve, reject) => {
|
|
106758
|
+
currentResultRefresh().then((res) => {
|
|
106759
|
+
if (res.isOk()) {
|
|
106760
|
+
resolve();
|
|
106761
|
+
}
|
|
106762
|
+
else {
|
|
106763
|
+
reject(new Error(REFRESH_FAILED_MESSAGE));
|
|
106764
|
+
}
|
|
106765
|
+
}, reject);
|
|
106766
|
+
});
|
|
106767
|
+
};
|
|
106646
106768
|
if (initialConfig) {
|
|
106647
106769
|
try {
|
|
106648
106770
|
processingInitialConfig = true;
|
|
@@ -106656,6 +106778,7 @@
|
|
|
106656
106778
|
status: statusAtom,
|
|
106657
106779
|
errors: errorsAtom,
|
|
106658
106780
|
data: dataAtom,
|
|
106781
|
+
refresh,
|
|
106659
106782
|
...setters,
|
|
106660
106783
|
};
|
|
106661
106784
|
}, {
|
|
@@ -106876,7 +106999,7 @@
|
|
|
106876
106999
|
_(config, CONFIG_SCHEMA);
|
|
106877
107000
|
const baseCommand = new graphql_imperative_ctor(config, documentRootType, services);
|
|
106878
107001
|
return applyDecorators(baseCommand, [services.fetchNetworkCommandBaseClass.availableDecorators.abortable], options);
|
|
106879
|
-
},
|
|
107002
|
+
}, true);
|
|
106880
107003
|
graphql_imperative_legacy = services.graphQLLegacyImperativeBindings.bind(({ config, assertIsValid }) => {
|
|
106881
107004
|
const _ = assertIsValid;
|
|
106882
107005
|
_(config, CONFIG_SCHEMA);
|
|
@@ -106886,6 +107009,7 @@
|
|
|
106886
107009
|
services.graphQLLegacyImperativeBindings.bind(({ config, assertIsValid }) => {
|
|
106887
107010
|
const validatedConfig = validateNonQueryGraphQLConfig(config);
|
|
106888
107011
|
if (validatedConfig.isErr()) {
|
|
107012
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
106889
107013
|
throw new Error(`Invalid configuration passed to GraphQL: ${validatedConfig.error}`);
|
|
106890
107014
|
}
|
|
106891
107015
|
const _ = assertIsValid;
|
|
@@ -106897,11 +107021,12 @@
|
|
|
106897
107021
|
*/
|
|
106898
107022
|
const graphql_state_manager_ctor = services.instrumentCommand(buildCommandClass(services.auraGraphQLNormalizedCacheControlCommand), 'graphql_state_manager');
|
|
106899
107023
|
const factory = (config) => {
|
|
106900
|
-
assertIsValid(config, CONFIG_SCHEMA);
|
|
107024
|
+
assertIsValid$1(config, CONFIG_SCHEMA);
|
|
106901
107025
|
const validatedConfig = resolveAndValidateGraphQLConfig(config, {
|
|
106902
107026
|
acceptedOperations: ['query'],
|
|
106903
107027
|
});
|
|
106904
107028
|
if (validatedConfig === undefined || validatedConfig.isErr()) {
|
|
107029
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
106905
107030
|
throw new Error('Internal error in GraphQL adapter occurred: Unable to resolve query');
|
|
106906
107031
|
}
|
|
106907
107032
|
return new graphql_state_manager_ctor(validatedConfig.value, documentRootType, services);
|
|
@@ -106929,7 +107054,7 @@
|
|
|
106929
107054
|
cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
|
|
106930
107055
|
}
|
|
106931
107056
|
}
|
|
106932
|
-
// version: 1.
|
|
107057
|
+
// version: 1.435.0-615ebb9bbd
|
|
106933
107058
|
|
|
106934
107059
|
function createFragmentMap(documentNode) {
|
|
106935
107060
|
const fragments = {};
|
|
@@ -134958,28 +135083,23 @@
|
|
|
134958
135083
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
134959
135084
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
134960
135085
|
* be reached by following 1 relationship from the root record, etc.
|
|
134961
|
-
* @defaultValue '
|
|
135086
|
+
* @defaultValue '1'
|
|
134962
135087
|
*/
|
|
134963
|
-
let trackedFieldDepthOnCacheMiss$1 =
|
|
135088
|
+
let trackedFieldDepthOnCacheMiss$1 = 1;
|
|
134964
135089
|
/**
|
|
134965
135090
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
134966
135091
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
134967
135092
|
* be reached by following 1 relationship from the root record, etc.
|
|
134968
|
-
* @defaultValue '
|
|
135093
|
+
* @defaultValue '1'
|
|
134969
135094
|
*/
|
|
134970
|
-
let trackedFieldDepthOnCacheMergeConflict$1 =
|
|
135095
|
+
let trackedFieldDepthOnCacheMergeConflict$1 = 1;
|
|
134971
135096
|
/**
|
|
134972
135097
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
134973
135098
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
134974
135099
|
* be reached by following 1 relationship from the root record, etc.
|
|
134975
|
-
* @defaultValue '
|
|
135100
|
+
* @defaultValue '1'
|
|
134976
135101
|
*/
|
|
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;
|
|
135102
|
+
let trackedFieldDepthOnNotifyChange$1 = 1;
|
|
134983
135103
|
/**
|
|
134984
135104
|
* One store enabled Get Object Info adapter
|
|
134985
135105
|
*/
|
|
@@ -135076,12 +135196,6 @@
|
|
|
135076
135196
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
135077
135197
|
return trackedFieldDepthOnNotifyChange$1;
|
|
135078
135198
|
},
|
|
135079
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
135080
|
-
trackedFieldLeafNodeIdAndNameOnly$1 = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
135081
|
-
},
|
|
135082
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
135083
|
-
return trackedFieldLeafNodeIdAndNameOnly$1;
|
|
135084
|
-
},
|
|
135085
135199
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
135086
135200
|
recordRepresentationIngestionOverride$1 = ingest;
|
|
135087
135201
|
},
|
|
@@ -135638,6 +135752,7 @@
|
|
|
135638
135752
|
if (typeof data?.refresh === 'function') {
|
|
135639
135753
|
return data.refresh();
|
|
135640
135754
|
}
|
|
135755
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
135641
135756
|
throw new Error('Component attempted to refresh a GraphQL result that is not refreshable');
|
|
135642
135757
|
};
|
|
135643
135758
|
}
|
|
@@ -136146,7 +136261,7 @@
|
|
|
136146
136261
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
136147
136262
|
instrument: instrument$1,
|
|
136148
136263
|
});
|
|
136149
|
-
// version: 1.
|
|
136264
|
+
// version: 1.435.0-615ebb9bbd
|
|
136150
136265
|
|
|
136151
136266
|
// On core the unstable adapters are re-exported with different names,
|
|
136152
136267
|
// we want to match them here.
|
|
@@ -136298,7 +136413,7 @@
|
|
|
136298
136413
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
136299
136414
|
graphQLImperative = ldsAdapter;
|
|
136300
136415
|
});
|
|
136301
|
-
// version: 1.
|
|
136416
|
+
// version: 1.435.0-615ebb9bbd
|
|
136302
136417
|
|
|
136303
136418
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
136304
136419
|
__proto__: null,
|
|
@@ -137097,7 +137212,7 @@
|
|
|
137097
137212
|
function register(r) {
|
|
137098
137213
|
callbacks$1.forEach((callback) => callback(r));
|
|
137099
137214
|
}
|
|
137100
|
-
// version: 1.
|
|
137215
|
+
// version: 1.435.0-5818ce3c48
|
|
137101
137216
|
|
|
137102
137217
|
/**
|
|
137103
137218
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -137133,28 +137248,23 @@
|
|
|
137133
137248
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
137134
137249
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
137135
137250
|
* be reached by following 1 relationship from the root record, etc.
|
|
137136
|
-
* @defaultValue '
|
|
137251
|
+
* @defaultValue '1'
|
|
137137
137252
|
*/
|
|
137138
|
-
let trackedFieldDepthOnCacheMiss =
|
|
137253
|
+
let trackedFieldDepthOnCacheMiss = 1;
|
|
137139
137254
|
/**
|
|
137140
137255
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
137141
137256
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
137142
137257
|
* be reached by following 1 relationship from the root record, etc.
|
|
137143
|
-
* @defaultValue '
|
|
137258
|
+
* @defaultValue '1'
|
|
137144
137259
|
*/
|
|
137145
|
-
let trackedFieldDepthOnCacheMergeConflict =
|
|
137260
|
+
let trackedFieldDepthOnCacheMergeConflict = 1;
|
|
137146
137261
|
/**
|
|
137147
137262
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
137148
137263
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
137149
137264
|
* 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
|
|
137265
|
+
* @defaultValue '1'
|
|
137156
137266
|
*/
|
|
137157
|
-
let
|
|
137267
|
+
let trackedFieldDepthOnNotifyChange = 1;
|
|
137158
137268
|
/**
|
|
137159
137269
|
* One store enabled Get Object Info adapter
|
|
137160
137270
|
*/
|
|
@@ -137251,12 +137361,6 @@
|
|
|
137251
137361
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
137252
137362
|
return trackedFieldDepthOnNotifyChange;
|
|
137253
137363
|
},
|
|
137254
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
137255
|
-
trackedFieldLeafNodeIdAndNameOnly = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
137256
|
-
},
|
|
137257
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
137258
|
-
return trackedFieldLeafNodeIdAndNameOnly;
|
|
137259
|
-
},
|
|
137260
137364
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
137261
137365
|
recordRepresentationIngestionOverride = ingest;
|
|
137262
137366
|
},
|
|
@@ -138151,6 +138255,7 @@
|
|
|
138151
138255
|
const LUVIO_ADAPTER_FAMILY = /^force\/ldsAdapters/;
|
|
138152
138256
|
async function importLuvioAdapterModule(specifier) {
|
|
138153
138257
|
if (!LUVIO_ADAPTER_FAMILY.test(specifier)) {
|
|
138258
|
+
// eslint-disable-next-line no-throw-literal
|
|
138154
138259
|
throw `${specifier} is not an allowed luvio adapter module`;
|
|
138155
138260
|
}
|
|
138156
138261
|
let module;
|
|
@@ -138158,6 +138263,7 @@
|
|
|
138158
138263
|
module = await import(specifier);
|
|
138159
138264
|
}
|
|
138160
138265
|
catch {
|
|
138266
|
+
// eslint-disable-next-line no-throw-literal
|
|
138161
138267
|
throw `module not found for specifier ${specifier}`;
|
|
138162
138268
|
}
|
|
138163
138269
|
return new LuvioAdapterModule(module);
|
|
@@ -138271,6 +138377,7 @@
|
|
|
138271
138377
|
}
|
|
138272
138378
|
async function importOneStoreAdapterModule(specifier) {
|
|
138273
138379
|
if (!ONESTORE_ADAPTER_FAMILY.test(specifier)) {
|
|
138380
|
+
// eslint-disable-next-line no-throw-literal
|
|
138274
138381
|
throw `${specifier} is not an allowed onestore adapter module`;
|
|
138275
138382
|
}
|
|
138276
138383
|
let module;
|
|
@@ -138278,6 +138385,7 @@
|
|
|
138278
138385
|
module = await import(specifier);
|
|
138279
138386
|
}
|
|
138280
138387
|
catch {
|
|
138388
|
+
// eslint-disable-next-line no-throw-literal
|
|
138281
138389
|
throw `module not found for specifier ${specifier}`;
|
|
138282
138390
|
}
|
|
138283
138391
|
return new OneStoreAdapterModule(module);
|
|
@@ -138414,4 +138522,4 @@
|
|
|
138414
138522
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
138415
138523
|
|
|
138416
138524
|
}));
|
|
138417
|
-
// version: 1.
|
|
138525
|
+
// version: 1.435.0-5818ce3c48
|