@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
|
@@ -4274,7 +4274,7 @@ function withDefaultLuvio(callback) {
|
|
|
4274
4274
|
}
|
|
4275
4275
|
callbacks.push(callback);
|
|
4276
4276
|
}
|
|
4277
|
-
// version: 1.
|
|
4277
|
+
// version: 1.435.0-5818ce3c48
|
|
4278
4278
|
|
|
4279
4279
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4280
4280
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5318,7 +5318,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
5318
5318
|
const { apiFamily, name } = metadata;
|
|
5319
5319
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5320
5320
|
}
|
|
5321
|
-
// version: 1.
|
|
5321
|
+
// version: 1.435.0-5818ce3c48
|
|
5322
5322
|
|
|
5323
5323
|
function isSupportedEntity(_objectApiName) {
|
|
5324
5324
|
return true;
|
|
@@ -5455,28 +5455,23 @@ let configurableCreateContentVersion$3 = new Configurable$3();
|
|
|
5455
5455
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
5456
5456
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5457
5457
|
* be reached by following 1 relationship from the root record, etc.
|
|
5458
|
-
* @defaultValue '
|
|
5458
|
+
* @defaultValue '1'
|
|
5459
5459
|
*/
|
|
5460
|
-
let trackedFieldDepthOnCacheMiss$3 =
|
|
5460
|
+
let trackedFieldDepthOnCacheMiss$3 = 1;
|
|
5461
5461
|
/**
|
|
5462
5462
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
5463
5463
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5464
5464
|
* be reached by following 1 relationship from the root record, etc.
|
|
5465
|
-
* @defaultValue '
|
|
5465
|
+
* @defaultValue '1'
|
|
5466
5466
|
*/
|
|
5467
|
-
let trackedFieldDepthOnCacheMergeConflict$3 =
|
|
5467
|
+
let trackedFieldDepthOnCacheMergeConflict$3 = 1;
|
|
5468
5468
|
/**
|
|
5469
5469
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
5470
5470
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5471
5471
|
* be reached by following 1 relationship from the root record, etc.
|
|
5472
|
-
* @defaultValue '
|
|
5472
|
+
* @defaultValue '1'
|
|
5473
5473
|
*/
|
|
5474
|
-
let trackedFieldDepthOnNotifyChange$3 =
|
|
5475
|
-
/**
|
|
5476
|
-
* Determines if we will only fetch the 'Id' field for the leaf relationship record
|
|
5477
|
-
* @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
|
|
5478
|
-
*/
|
|
5479
|
-
let trackedFieldLeafNodeIdAndNameOnly$3 = false;
|
|
5474
|
+
let trackedFieldDepthOnNotifyChange$3 = 1;
|
|
5480
5475
|
/**
|
|
5481
5476
|
* One store enabled Get Object Info adapter
|
|
5482
5477
|
*/
|
|
@@ -5573,12 +5568,6 @@ const configurationForEnvironmentFactoryOverrides$3 = {
|
|
|
5573
5568
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
5574
5569
|
return trackedFieldDepthOnNotifyChange$3;
|
|
5575
5570
|
},
|
|
5576
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
5577
|
-
trackedFieldLeafNodeIdAndNameOnly$3 = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
5578
|
-
},
|
|
5579
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
5580
|
-
return trackedFieldLeafNodeIdAndNameOnly$3;
|
|
5581
|
-
},
|
|
5582
5571
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
5583
5572
|
recordRepresentationIngestionOverride$3 = ingest;
|
|
5584
5573
|
},
|
|
@@ -5700,28 +5689,23 @@ let configurableCreateContentVersion$2 = new Configurable$2();
|
|
|
5700
5689
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
5701
5690
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5702
5691
|
* be reached by following 1 relationship from the root record, etc.
|
|
5703
|
-
* @defaultValue '
|
|
5692
|
+
* @defaultValue '1'
|
|
5704
5693
|
*/
|
|
5705
|
-
let trackedFieldDepthOnCacheMiss$2 =
|
|
5694
|
+
let trackedFieldDepthOnCacheMiss$2 = 1;
|
|
5706
5695
|
/**
|
|
5707
5696
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
5708
5697
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5709
5698
|
* be reached by following 1 relationship from the root record, etc.
|
|
5710
|
-
* @defaultValue '
|
|
5699
|
+
* @defaultValue '1'
|
|
5711
5700
|
*/
|
|
5712
|
-
let trackedFieldDepthOnCacheMergeConflict$2 =
|
|
5701
|
+
let trackedFieldDepthOnCacheMergeConflict$2 = 1;
|
|
5713
5702
|
/**
|
|
5714
5703
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
5715
5704
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
5716
5705
|
* be reached by following 1 relationship from the root record, etc.
|
|
5717
|
-
* @defaultValue '
|
|
5706
|
+
* @defaultValue '1'
|
|
5718
5707
|
*/
|
|
5719
|
-
let trackedFieldDepthOnNotifyChange$2 =
|
|
5720
|
-
/**
|
|
5721
|
-
* Determines if we will only fetch the 'Id' field for the leaf relationship record
|
|
5722
|
-
* @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
|
|
5723
|
-
*/
|
|
5724
|
-
let trackedFieldLeafNodeIdAndNameOnly$2 = false;
|
|
5708
|
+
let trackedFieldDepthOnNotifyChange$2 = 1;
|
|
5725
5709
|
/**
|
|
5726
5710
|
* One store enabled Get Object Info adapter
|
|
5727
5711
|
*/
|
|
@@ -5827,12 +5811,6 @@ const configurationForRestAdapters$2 = {
|
|
|
5827
5811
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
5828
5812
|
return trackedFieldDepthOnNotifyChange$2;
|
|
5829
5813
|
},
|
|
5830
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
5831
|
-
trackedFieldLeafNodeIdAndNameOnly$2 = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
5832
|
-
},
|
|
5833
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
5834
|
-
return trackedFieldLeafNodeIdAndNameOnly$2;
|
|
5835
|
-
},
|
|
5836
5814
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
5837
5815
|
recordRepresentationIngestionOverride$2 = ingest;
|
|
5838
5816
|
},
|
|
@@ -7673,6 +7651,9 @@ function buildSelectionFromRecord$1(record) {
|
|
|
7673
7651
|
return [...sel.selections, DRAFTS_SELECTION$1];
|
|
7674
7652
|
}
|
|
7675
7653
|
|
|
7654
|
+
// Unused suffixes, but leaving in as comments to avoid eslint errors
|
|
7655
|
+
// const CUSTOM_API_NAME_SUFFIX = '__c';
|
|
7656
|
+
// const DMO_API_NAME_SUFFIX = '__dlm';
|
|
7676
7657
|
const CUSTOM_EXTERNAL_OBJECT_FIELD_SUFFIX$1 = '__x';
|
|
7677
7658
|
const RECORD_REPRESENTATION_ERROR_VERSION$1 = 'RECORD_REPRESENTATION_ERROR_VERSION_1';
|
|
7678
7659
|
const RECORD_REPRESENTATION_ERROR_STORE_METADATA_PARAMS$1 = {
|
|
@@ -7736,13 +7717,11 @@ function extractTrackedFieldsToTrie$1(recordId, node, root, config, visitedRecor
|
|
|
7736
7717
|
if (!isGraphNode$1(field)) {
|
|
7737
7718
|
continue;
|
|
7738
7719
|
}
|
|
7739
|
-
const { maxDepth
|
|
7720
|
+
const { maxDepth } = config;
|
|
7740
7721
|
if (field.isScalar('value') === false && !Array.isArray(field.data?.value)) {
|
|
7741
7722
|
if (depth + 1 > maxDepth) {
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
addScalarFieldName$1(current);
|
|
7745
|
-
}
|
|
7723
|
+
addScalarFieldId$1(current);
|
|
7724
|
+
addScalarFieldName$1(current);
|
|
7746
7725
|
continue;
|
|
7747
7726
|
}
|
|
7748
7727
|
const spanningLink = field.link('value');
|
|
@@ -7764,19 +7743,10 @@ function extractTrackedFieldsToTrie$1(recordId, node, root, config, visitedRecor
|
|
|
7764
7743
|
current.children[key] = next;
|
|
7765
7744
|
}
|
|
7766
7745
|
else {
|
|
7767
|
-
// Skip the field, if its value is null at the max level depth.
|
|
7768
|
-
// Ideally, it should only skip relationship field. However,
|
|
7769
|
-
// on the client, there is not a reliable way to determine the
|
|
7770
|
-
// the field type.
|
|
7771
7746
|
if (depth === maxDepth) {
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
continue;
|
|
7776
|
-
}
|
|
7777
|
-
if (field.scalar('value') === null && !Array.isArray(field.data?.value)) {
|
|
7778
|
-
continue;
|
|
7779
|
-
}
|
|
7747
|
+
addScalarFieldId$1(current);
|
|
7748
|
+
addScalarFieldName$1(current);
|
|
7749
|
+
continue;
|
|
7780
7750
|
}
|
|
7781
7751
|
const state = fieldValueRep.linkData();
|
|
7782
7752
|
if (state !== undefined) {
|
|
@@ -8162,7 +8132,6 @@ function mergeRecordConflict$1(luvio, incoming, existing, recordConflictMap) {
|
|
|
8162
8132
|
};
|
|
8163
8133
|
const trackedFieldsConfig = {
|
|
8164
8134
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMergeConflict(),
|
|
8165
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
8166
8135
|
};
|
|
8167
8136
|
extractTrackedFieldsToTrie$1(recordKey, incomingNode, incomingTrackedFieldsTrieRoot, trackedFieldsConfig);
|
|
8168
8137
|
extractTrackedFieldsToTrie$1(recordKey, existingNode, existingTrackedFieldsTrieRoot, trackedFieldsConfig);
|
|
@@ -8606,7 +8575,6 @@ function prepareRequest$7(luvio, config) {
|
|
|
8606
8575
|
const key = keyBuilder$28(luvio, createResourceParams$12(config));
|
|
8607
8576
|
const allTrackedFields = getTrackedFields$1(key, luvio.getNode(key), {
|
|
8608
8577
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
8609
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
8610
8578
|
}, config.optionalFields);
|
|
8611
8579
|
const optionalFields = fields === undefined ? allTrackedFields : difference$1(allTrackedFields, fields);
|
|
8612
8580
|
const resourceParams = createResourceParams$12({
|
|
@@ -8733,7 +8701,6 @@ function ingestSuccessChildResourceParams$8(luvio, childResourceParamsArray, chi
|
|
|
8733
8701
|
};
|
|
8734
8702
|
const childTrackedFields = getTrackedFields$1(childKey, luvio.getNode(childKey), {
|
|
8735
8703
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
8736
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
8737
8704
|
}, childResourceParams.queryParams.optionalFields);
|
|
8738
8705
|
const childSnapshot = ingestSuccess$S(luvio, {
|
|
8739
8706
|
recordId: childResourceParams.urlParams.recordId,
|
|
@@ -12965,17 +12932,15 @@ function getRelationshipName$1(objectInfo, fieldApiName) {
|
|
|
12965
12932
|
return objectInfo.fields[fieldApiName].relationshipName;
|
|
12966
12933
|
}
|
|
12967
12934
|
function getNameField$1(objectInfo, fieldApiName) {
|
|
12968
|
-
// eslint-disable-next-line @salesforce/lds/no-invalid-todo
|
|
12969
|
-
// TODO - this logic is adopted from lds222. It searches
|
|
12970
|
-
// ObjectInfoRep.ReferenceToInfoRep[].nameFields[]:
|
|
12971
|
-
// 1. If any of the arrays are empty returns `Name`
|
|
12972
|
-
// 2. If `Name` is found in any array position then returns it
|
|
12973
|
-
// 3. If the field has more than 1 references(polymorphic), return `Name`
|
|
12974
|
-
// 4. Else returns ObjectInfoRep.ReferenceToInfoRep[0].nameFields[0]
|
|
12975
|
-
// Rationale for this is unclear and needs clarification.
|
|
12976
12935
|
const referenceToInfos = objectInfo.fields[fieldApiName].referenceToInfos;
|
|
12977
12936
|
if (referenceToInfos.length !== 1) {
|
|
12978
|
-
return
|
|
12937
|
+
// For polymorphic fields, return "Name" only if at least one referenced entity has it.
|
|
12938
|
+
// If no entity in the domain set has a Name field (e.g. ContextTag uses "Title"),
|
|
12939
|
+
// sending "Name" to getRecordWithFields causes INVALID_FIELD at the DB layer (W-22253765).
|
|
12940
|
+
// We stay permissive for mixed cases (some have Name, some don't) — those are handled
|
|
12941
|
+
// server-side once W-22253765's companion fix lands in QueryValidatorImpl.
|
|
12942
|
+
const anyHaveName = referenceToInfos.some((ref) => ref.nameFields.includes(FIELD_NAME$1));
|
|
12943
|
+
return anyHaveName ? FIELD_NAME$1 : undefined;
|
|
12979
12944
|
}
|
|
12980
12945
|
const firstReferenceNameFields = referenceToInfos[0].nameFields;
|
|
12981
12946
|
if (firstReferenceNameFields.length < 1) {
|
|
@@ -13010,8 +12975,11 @@ function getQualifiedFieldApiNamesFromLayout$1(layout, objectInfo) {
|
|
|
13010
12975
|
// By default, include the "Id" field on spanning records that are on the layout.
|
|
13011
12976
|
qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID$1}`);
|
|
13012
12977
|
const nameField = getNameField$1(objectInfo, apiName);
|
|
13013
|
-
// W-15692973: Name field of referenced
|
|
13014
|
-
|
|
12978
|
+
// W-15692973: Name field of referenced entities are moved to optionalFields since the Name field may not exist for few entities.
|
|
12979
|
+
// W-22253765: For polymorphic FKs where not all entities have "Name", nameField is undefined — skip the optional field entirely.
|
|
12980
|
+
if (nameField !== undefined) {
|
|
12981
|
+
qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
|
|
12982
|
+
}
|
|
13015
12983
|
}
|
|
13016
12984
|
qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
|
|
13017
12985
|
}
|
|
@@ -13045,8 +13013,11 @@ function getMissingRecordLookupFields$1(record, objectInfo) {
|
|
|
13045
13013
|
// Include the Id field. Ex: Opportunity.Account.Id, Opportunity.relation1__r.Id
|
|
13046
13014
|
const idFieldName = `${apiName}.${relationshipName}.Id`;
|
|
13047
13015
|
lookupFields[idFieldName] = true;
|
|
13048
|
-
const
|
|
13049
|
-
|
|
13016
|
+
const resolvedNameField = getNameField$1(objectInfo, fieldName);
|
|
13017
|
+
// W-22253765: skip the name field for polymorphic FKs where not all entities have "Name"
|
|
13018
|
+
if (resolvedNameField !== undefined) {
|
|
13019
|
+
lookupFields[`${apiName}.${relationshipName}.${resolvedNameField}`] = true;
|
|
13020
|
+
}
|
|
13050
13021
|
}
|
|
13051
13022
|
return keys$9(lookupFields);
|
|
13052
13023
|
}
|
|
@@ -13906,7 +13877,6 @@ const notifyChangeFactory = (luvio) => {
|
|
|
13906
13877
|
const node = luvio.wrapNormalizedGraphNode(record, key);
|
|
13907
13878
|
const optionalFields = getTrackedFields$1(key, node, {
|
|
13908
13879
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnNotifyChange(),
|
|
13909
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
13910
13880
|
});
|
|
13911
13881
|
const refreshRequest = createResourceRequestFromRepresentation(record, optionalFields);
|
|
13912
13882
|
const existingWeakEtag = record.weakEtag;
|
|
@@ -16495,7 +16465,6 @@ function buildNetworkSnapshot$V(luvio, config, options) {
|
|
|
16495
16465
|
const key = keyBuilder$1w$2(luvio, config);
|
|
16496
16466
|
const trackedFieldsConfig = {
|
|
16497
16467
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
16498
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly()
|
|
16499
16468
|
};
|
|
16500
16469
|
const optionalFieldsTrie = convertFieldsToTrie$1(getTrackedFields$1(key, luvio.getNode(key), trackedFieldsConfig, config.optionalFields));
|
|
16501
16470
|
const fieldsTrie = BLANK_RECORD_FIELDS_TRIE$1;
|
|
@@ -30539,7 +30508,6 @@ const buildNetworkSnapshot$6$1 = (luvio, context, config, options) => {
|
|
|
30539
30508
|
...resourceRequest.queryParams,
|
|
30540
30509
|
optionalFields: getTrackedFields$1(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
30541
30510
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
30542
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
30543
30511
|
}, config.optionalFields),
|
|
30544
30512
|
},
|
|
30545
30513
|
});
|
|
@@ -31074,7 +31042,6 @@ function prepareRequest$8(luvio, context, config) {
|
|
|
31074
31042
|
...resourceRequest.queryParams,
|
|
31075
31043
|
optionalFields: getTrackedFields$1(recordTemplateKey, luvio.getNode(recordTemplateKey), {
|
|
31076
31044
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
31077
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
31078
31045
|
}, config.optionalFields),
|
|
31079
31046
|
},
|
|
31080
31047
|
});
|
|
@@ -31094,7 +31061,6 @@ function onFetchResponseSuccess$O(luvio, context, config, request, response, res
|
|
|
31094
31061
|
});
|
|
31095
31062
|
const allTrackedFields = getTrackedFields$1(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
31096
31063
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
31097
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
31098
31064
|
}, optionalFields);
|
|
31099
31065
|
const allTrackedFieldsTrie = convertFieldsToTrie$1(allTrackedFields, true);
|
|
31100
31066
|
const ingest = createFieldsIngestSuccess$4({
|
|
@@ -32550,7 +32516,7 @@ withDefaultLuvio((luvio) => {
|
|
|
32550
32516
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
32551
32517
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
32552
32518
|
});
|
|
32553
|
-
// version: 1.
|
|
32519
|
+
// version: 1.435.0-615ebb9bbd
|
|
32554
32520
|
|
|
32555
32521
|
var allowUpdatesForNonCachedRecords = {
|
|
32556
32522
|
isOpen: function (e) {
|
|
@@ -44200,7 +44166,7 @@ const { create: create$7, freeze: freeze$4, keys: keys$8, entries: entries$5 } =
|
|
|
44200
44166
|
const { hasOwnProperty: hasOwnProperty$3 } = Object.prototype;
|
|
44201
44167
|
const { isArray: isArray$7 } = Array;
|
|
44202
44168
|
const { stringify: stringify$9, parse: parse$9 } = JSON;
|
|
44203
|
-
let Ok$
|
|
44169
|
+
let Ok$3 = class Ok {
|
|
44204
44170
|
constructor(value) {
|
|
44205
44171
|
this.value = value;
|
|
44206
44172
|
}
|
|
@@ -44211,7 +44177,7 @@ let Ok$4 = class Ok {
|
|
|
44211
44177
|
return !this.isOk();
|
|
44212
44178
|
}
|
|
44213
44179
|
};
|
|
44214
|
-
let Err$
|
|
44180
|
+
let Err$3 = class Err {
|
|
44215
44181
|
constructor(error) {
|
|
44216
44182
|
this.error = error;
|
|
44217
44183
|
}
|
|
@@ -44222,8 +44188,8 @@ let Err$4 = class Err {
|
|
|
44222
44188
|
return !this.isOk();
|
|
44223
44189
|
}
|
|
44224
44190
|
};
|
|
44225
|
-
const ok$
|
|
44226
|
-
const err$
|
|
44191
|
+
const ok$3 = (value) => new Ok$3(value);
|
|
44192
|
+
const err$3 = (err2) => new Err$3(err2);
|
|
44227
44193
|
function resolvedPromiseLike$4(result) {
|
|
44228
44194
|
if (isPromiseLike$4(result)) {
|
|
44229
44195
|
return result.then((nextResult) => nextResult);
|
|
@@ -44366,6 +44332,15 @@ function satisfies(provided, requested) {
|
|
|
44366
44332
|
const requestedN = requested.split(".").map((s) => parseInt(s));
|
|
44367
44333
|
return providedN[0] === requestedN[0] && providedN[1] >= requestedN[1];
|
|
44368
44334
|
}
|
|
44335
|
+
function isUserVisibleError$3(error) {
|
|
44336
|
+
return error instanceof Error && "type" in error && error.type === "user-visible";
|
|
44337
|
+
}
|
|
44338
|
+
function logError$2(error) {
|
|
44339
|
+
if (isUserVisibleError$3(error)) {
|
|
44340
|
+
return;
|
|
44341
|
+
}
|
|
44342
|
+
console.error("OneStore Command threw an error that we did not expect", error);
|
|
44343
|
+
}
|
|
44369
44344
|
|
|
44370
44345
|
/*!
|
|
44371
44346
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44465,20 +44440,20 @@ class IdentifiableTypeRepository {
|
|
|
44465
44440
|
const existingNormalizedData = (_a = cache.get(key)) == null ? void 0 : _a.value;
|
|
44466
44441
|
const normalized = this.normalizeData(cache, { ...input, existingNormalizedData });
|
|
44467
44442
|
if (normalized.isErr()) {
|
|
44468
|
-
return err$
|
|
44443
|
+
return err$3(normalized.error);
|
|
44469
44444
|
}
|
|
44470
44445
|
cache.set(key, {
|
|
44471
44446
|
value: normalized.value,
|
|
44472
44447
|
metadata: this.cacheMetadata
|
|
44473
44448
|
});
|
|
44474
|
-
return ok$
|
|
44449
|
+
return ok$3({
|
|
44475
44450
|
type: "link",
|
|
44476
44451
|
linkedKey: key
|
|
44477
44452
|
});
|
|
44478
44453
|
}
|
|
44479
44454
|
validateEntry(entry) {
|
|
44480
44455
|
if (!isCacheEntryForType(entry, this)) {
|
|
44481
|
-
return err$
|
|
44456
|
+
return err$3([
|
|
44482
44457
|
{
|
|
44483
44458
|
type: "incorrectType",
|
|
44484
44459
|
expectedType: this.typeName,
|
|
@@ -44486,7 +44461,7 @@ class IdentifiableTypeRepository {
|
|
|
44486
44461
|
}
|
|
44487
44462
|
]);
|
|
44488
44463
|
}
|
|
44489
|
-
return ok$
|
|
44464
|
+
return ok$3(void 0);
|
|
44490
44465
|
}
|
|
44491
44466
|
query(cache, query) {
|
|
44492
44467
|
return this.read(cache, {
|
|
@@ -44504,12 +44479,12 @@ class IdentifiableTypeRepository {
|
|
|
44504
44479
|
if (cacheEntry) {
|
|
44505
44480
|
const validationResult = this.validateEntry(cacheEntry);
|
|
44506
44481
|
if (validationResult.isErr()) {
|
|
44507
|
-
return err$
|
|
44482
|
+
return err$3([...validationResult.error]);
|
|
44508
44483
|
}
|
|
44509
44484
|
const normalizedData = cacheEntry.value;
|
|
44510
44485
|
return this.denormalizeData(cache, { ...input, normalizedData });
|
|
44511
44486
|
}
|
|
44512
|
-
return err$
|
|
44487
|
+
return err$3([this.buildMissingDataError()]);
|
|
44513
44488
|
}
|
|
44514
44489
|
equals(x, y) {
|
|
44515
44490
|
return deepEquals$2(x, y);
|
|
@@ -44532,9 +44507,443 @@ function extractReadWriteData(result, errorCollector) {
|
|
|
44532
44507
|
}
|
|
44533
44508
|
function buildReadWriteResult(data, errors) {
|
|
44534
44509
|
if (errors.length > 0) {
|
|
44535
|
-
return err$
|
|
44510
|
+
return err$3(errors);
|
|
44511
|
+
}
|
|
44512
|
+
return ok$3(data);
|
|
44513
|
+
}
|
|
44514
|
+
|
|
44515
|
+
/*!
|
|
44516
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
44517
|
+
* All rights reserved.
|
|
44518
|
+
* For full license text, see the LICENSE.txt file
|
|
44519
|
+
*/
|
|
44520
|
+
let JsonSchemaViolationError$1 = class JsonSchemaViolationError extends Error {
|
|
44521
|
+
constructor(message, validationErrors) {
|
|
44522
|
+
super(message);
|
|
44523
|
+
this.validationErrors = [];
|
|
44524
|
+
this.validationErrors = validationErrors || [];
|
|
44525
|
+
}
|
|
44526
|
+
};
|
|
44527
|
+
let MinItemsViolationError$1 = class MinItemsViolationError extends JsonSchemaViolationError$1 {
|
|
44528
|
+
};
|
|
44529
|
+
let MaxItemsViolationError$1 = class MaxItemsViolationError extends JsonSchemaViolationError$1 {
|
|
44530
|
+
};
|
|
44531
|
+
let IncorrectTypeError$1 = class IncorrectTypeError extends JsonSchemaViolationError$1 {
|
|
44532
|
+
};
|
|
44533
|
+
let AdditionalPropertiesError$1 = class AdditionalPropertiesError extends JsonSchemaViolationError$1 {
|
|
44534
|
+
};
|
|
44535
|
+
let MissingRequiredPropertyError$1 = class MissingRequiredPropertyError extends JsonSchemaViolationError$1 {
|
|
44536
|
+
};
|
|
44537
|
+
let InvalidRefError$1 = class InvalidRefError extends JsonSchemaViolationError$1 {
|
|
44538
|
+
};
|
|
44539
|
+
let JsonSchemaErrorCollector$1 = class JsonSchemaErrorCollector {
|
|
44540
|
+
constructor() {
|
|
44541
|
+
this.errors = [];
|
|
44542
|
+
}
|
|
44543
|
+
add(error) {
|
|
44544
|
+
this.errors.push(error);
|
|
44545
|
+
}
|
|
44546
|
+
append(response) {
|
|
44547
|
+
if (response.isErr()) {
|
|
44548
|
+
this.errors.push(...response.error);
|
|
44549
|
+
}
|
|
44550
|
+
}
|
|
44551
|
+
hasErrors() {
|
|
44552
|
+
return this.errors.length > 0;
|
|
44553
|
+
}
|
|
44554
|
+
prepend(error) {
|
|
44555
|
+
this.errors.unshift(error);
|
|
44556
|
+
}
|
|
44557
|
+
toValidationResponse() {
|
|
44558
|
+
return !this.hasErrors() ? ok$3(true) : err$3(this.errors);
|
|
44559
|
+
}
|
|
44560
|
+
};
|
|
44561
|
+
function createThrowableError$1(errors) {
|
|
44562
|
+
if (errors[0] instanceof MinItemsViolationError$1) {
|
|
44563
|
+
return new MinItemsViolationError$1(errors[0].message, errors);
|
|
44564
|
+
}
|
|
44565
|
+
if (errors[0] instanceof MaxItemsViolationError$1) {
|
|
44566
|
+
return new MaxItemsViolationError$1(errors[0].message, errors);
|
|
44567
|
+
}
|
|
44568
|
+
if (errors[0] instanceof IncorrectTypeError$1) {
|
|
44569
|
+
return new IncorrectTypeError$1(errors[0].message, errors);
|
|
44570
|
+
}
|
|
44571
|
+
if (errors[0] instanceof AdditionalPropertiesError$1) {
|
|
44572
|
+
return new AdditionalPropertiesError$1(errors[0].message, errors);
|
|
44573
|
+
}
|
|
44574
|
+
if (errors[0] instanceof MissingRequiredPropertyError$1) {
|
|
44575
|
+
return new MissingRequiredPropertyError$1(errors[0].message, errors);
|
|
44576
|
+
}
|
|
44577
|
+
if (errors[0] instanceof InvalidRefError$1) {
|
|
44578
|
+
return new InvalidRefError$1(errors[0].message, errors);
|
|
44579
|
+
}
|
|
44580
|
+
return new JsonSchemaViolationError$1(errors[0].message, errors);
|
|
44581
|
+
}
|
|
44582
|
+
function assertIsValid$1(data, schema) {
|
|
44583
|
+
const validationResponse = validateJsonSchema$1(data, schema);
|
|
44584
|
+
if (validationResponse.isErr()) {
|
|
44585
|
+
throw createThrowableError$1(validationResponse.error);
|
|
44586
|
+
}
|
|
44587
|
+
}
|
|
44588
|
+
function incorrectTypeError$1(expected, actual, path) {
|
|
44589
|
+
return new IncorrectTypeError$1(
|
|
44590
|
+
`Expected type ${expected} at path '${path}', found type ${actual}.`
|
|
44591
|
+
);
|
|
44592
|
+
}
|
|
44593
|
+
function validSchemaResponse$1() {
|
|
44594
|
+
return ok$3(true);
|
|
44595
|
+
}
|
|
44596
|
+
function invalidSchemaResponseWithError$1(error) {
|
|
44597
|
+
return err$3([error]);
|
|
44598
|
+
}
|
|
44599
|
+
function validateJsonSchema$1(data, schema, path = "$", document = schema) {
|
|
44600
|
+
return validateJsonSchemaInternal$1(data, schema, path, document, /* @__PURE__ */ new Map());
|
|
44601
|
+
}
|
|
44602
|
+
function validateJsonSchemaInternal$1(data, schema, path, document, visited) {
|
|
44603
|
+
if (schema === true) return validSchemaResponse$1();
|
|
44604
|
+
if (schema === false)
|
|
44605
|
+
return invalidSchemaResponseWithError$1(
|
|
44606
|
+
new JsonSchemaViolationError$1(`Data at ${path} has schema 'false'`)
|
|
44607
|
+
);
|
|
44608
|
+
const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
|
|
44609
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44610
|
+
if ("anyOf" in schema) {
|
|
44611
|
+
errorCollector.append(validateAnyOf$1(data, schema, path, document, visited));
|
|
44612
|
+
} else if ("oneOf" in schema) {
|
|
44613
|
+
errorCollector.append(validateOneOf$1(data, schema, path, document, visited));
|
|
44614
|
+
} else if ("allOf" in schema) {
|
|
44615
|
+
errorCollector.append(validateAllOf$1(data, schema, path, document, visited));
|
|
44616
|
+
} else if ("not" in schema) {
|
|
44617
|
+
errorCollector.append(validateNot$1(data, schema, path, document, visited));
|
|
44618
|
+
} else if ("$ref" in schema) {
|
|
44619
|
+
errorCollector.append(validateRef$1(data, schema, path, document, visited));
|
|
44620
|
+
} else if ("type" in schema) {
|
|
44621
|
+
if (schema.type === "object") {
|
|
44622
|
+
if (dataType !== "object") {
|
|
44623
|
+
errorCollector.add(incorrectTypeError$1("object", dataType, path));
|
|
44624
|
+
} else {
|
|
44625
|
+
errorCollector.append(
|
|
44626
|
+
validateObject$1(data, schema, path, document, visited)
|
|
44627
|
+
);
|
|
44628
|
+
}
|
|
44629
|
+
} else if (schema.type === "array") {
|
|
44630
|
+
if (dataType !== "array") {
|
|
44631
|
+
errorCollector.add(incorrectTypeError$1("array", dataType, path));
|
|
44632
|
+
} else {
|
|
44633
|
+
errorCollector.append(
|
|
44634
|
+
validateArray$1(data, schema, path, document, visited)
|
|
44635
|
+
);
|
|
44636
|
+
}
|
|
44637
|
+
} else {
|
|
44638
|
+
errorCollector.append(
|
|
44639
|
+
validateScalar$1(data, schema, path)
|
|
44640
|
+
);
|
|
44641
|
+
}
|
|
44642
|
+
}
|
|
44643
|
+
if (schema.enum) {
|
|
44644
|
+
errorCollector.append(validateEnum$1(data, schema.enum, path));
|
|
44645
|
+
}
|
|
44646
|
+
if (schema.const) {
|
|
44647
|
+
errorCollector.append(validateConst$1(data, schema.const, path));
|
|
44648
|
+
}
|
|
44649
|
+
return errorCollector.toValidationResponse();
|
|
44650
|
+
}
|
|
44651
|
+
function validateAnyOf$1(data, schema, path, document, visited) {
|
|
44652
|
+
let isValid = false;
|
|
44653
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44654
|
+
for (let i = 0, { length } = schema.anyOf; i < length; i++) {
|
|
44655
|
+
const element = schema.anyOf[i];
|
|
44656
|
+
const validationResponse = validateJsonSchemaInternal$1(
|
|
44657
|
+
data,
|
|
44658
|
+
element,
|
|
44659
|
+
`${path}.anyOf[${i}]`,
|
|
44660
|
+
document,
|
|
44661
|
+
visited
|
|
44662
|
+
);
|
|
44663
|
+
if (validationResponse.isOk()) {
|
|
44664
|
+
isValid = true;
|
|
44665
|
+
break;
|
|
44666
|
+
} else {
|
|
44667
|
+
errorCollector.append(validationResponse);
|
|
44668
|
+
}
|
|
44669
|
+
}
|
|
44670
|
+
if (!isValid) {
|
|
44671
|
+
errorCollector.prepend(
|
|
44672
|
+
new JsonSchemaViolationError$1(`Data at ${path} did not match any subschema in anyOf.`)
|
|
44673
|
+
);
|
|
44674
|
+
return errorCollector.toValidationResponse();
|
|
44675
|
+
}
|
|
44676
|
+
return validSchemaResponse$1();
|
|
44677
|
+
}
|
|
44678
|
+
function validateOneOf$1(data, schema, path, document, visited) {
|
|
44679
|
+
if (schema.discriminator !== void 0) {
|
|
44680
|
+
return validateDiscriminatedOneOf$1(data, schema.discriminator, path, document, visited);
|
|
44681
|
+
}
|
|
44682
|
+
let validSubShemaPaths = [];
|
|
44683
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44684
|
+
for (let i = 0, { length } = schema.oneOf; i < length; i++) {
|
|
44685
|
+
const element = schema.oneOf[i];
|
|
44686
|
+
const oneOfPath = `${path}.oneOf[${i}]`;
|
|
44687
|
+
const validationResponse = validateJsonSchemaInternal$1(
|
|
44688
|
+
data,
|
|
44689
|
+
element,
|
|
44690
|
+
oneOfPath,
|
|
44691
|
+
document,
|
|
44692
|
+
visited
|
|
44693
|
+
);
|
|
44694
|
+
if (validationResponse.isOk()) {
|
|
44695
|
+
validSubShemaPaths.push(oneOfPath);
|
|
44696
|
+
} else {
|
|
44697
|
+
errorCollector.append(validationResponse);
|
|
44698
|
+
}
|
|
44699
|
+
}
|
|
44700
|
+
if (validSubShemaPaths.length === 0) {
|
|
44701
|
+
errorCollector.prepend(
|
|
44702
|
+
new JsonSchemaViolationError$1(`Data at ${path} did not match any subschema in oneOf.`)
|
|
44703
|
+
);
|
|
44704
|
+
return errorCollector.toValidationResponse();
|
|
44705
|
+
} else if (validSubShemaPaths.length > 1) {
|
|
44706
|
+
errorCollector.prepend(
|
|
44707
|
+
new JsonSchemaViolationError$1(
|
|
44708
|
+
`Data at ${path} matched multiple subschemas: [${validSubShemaPaths.join(", ")}].`
|
|
44709
|
+
)
|
|
44710
|
+
);
|
|
44711
|
+
return errorCollector.toValidationResponse();
|
|
44712
|
+
}
|
|
44713
|
+
return validSchemaResponse$1();
|
|
44714
|
+
}
|
|
44715
|
+
function validateDiscriminatedOneOf$1(data, discriminator, path, document, visited) {
|
|
44716
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
44717
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("object", typeof data, path));
|
|
44536
44718
|
}
|
|
44537
|
-
|
|
44719
|
+
const { propertyName, mapping } = discriminator;
|
|
44720
|
+
const discriminatorValue = data[propertyName];
|
|
44721
|
+
if (discriminatorValue === void 0) {
|
|
44722
|
+
return invalidSchemaResponseWithError$1(
|
|
44723
|
+
new MissingRequiredPropertyError$1(
|
|
44724
|
+
`Object at path '${path}' is missing required discriminator property '${propertyName}'.`
|
|
44725
|
+
)
|
|
44726
|
+
);
|
|
44727
|
+
}
|
|
44728
|
+
if (typeof discriminatorValue !== "string") {
|
|
44729
|
+
return invalidSchemaResponseWithError$1(
|
|
44730
|
+
incorrectTypeError$1("string", typeof discriminatorValue, `${path}.${propertyName}`)
|
|
44731
|
+
);
|
|
44732
|
+
}
|
|
44733
|
+
const targetRef = mapping[discriminatorValue];
|
|
44734
|
+
if (targetRef === void 0) {
|
|
44735
|
+
return invalidSchemaResponseWithError$1(
|
|
44736
|
+
new JsonSchemaViolationError$1(
|
|
44737
|
+
`Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
|
|
44738
|
+
)
|
|
44739
|
+
);
|
|
44740
|
+
}
|
|
44741
|
+
return validateJsonSchemaInternal$1(data, { $ref: targetRef }, path, document, visited);
|
|
44742
|
+
}
|
|
44743
|
+
function validateAllOf$1(data, schema, path, document, visited) {
|
|
44744
|
+
let isValid = true;
|
|
44745
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44746
|
+
for (let i = 0, { length } = schema.allOf; i < length; i++) {
|
|
44747
|
+
const element = schema.allOf[i];
|
|
44748
|
+
const validationResponse = validateJsonSchemaInternal$1(
|
|
44749
|
+
data,
|
|
44750
|
+
element,
|
|
44751
|
+
`${path}.allOf[${i}]`,
|
|
44752
|
+
document,
|
|
44753
|
+
visited
|
|
44754
|
+
);
|
|
44755
|
+
if (!validationResponse.isOk()) {
|
|
44756
|
+
errorCollector.append(validationResponse);
|
|
44757
|
+
isValid = false;
|
|
44758
|
+
}
|
|
44759
|
+
}
|
|
44760
|
+
if (!isValid) {
|
|
44761
|
+
errorCollector.prepend(
|
|
44762
|
+
new JsonSchemaViolationError$1(`Data at ${path} did not match some subschemas in allOf.`)
|
|
44763
|
+
);
|
|
44764
|
+
}
|
|
44765
|
+
return errorCollector.toValidationResponse();
|
|
44766
|
+
}
|
|
44767
|
+
function validateNot$1(data, schema, path, document, visited) {
|
|
44768
|
+
const validationResponse = validateJsonSchemaInternal$1(
|
|
44769
|
+
data,
|
|
44770
|
+
schema.not,
|
|
44771
|
+
path,
|
|
44772
|
+
document,
|
|
44773
|
+
visited
|
|
44774
|
+
);
|
|
44775
|
+
if (validationResponse.isOk()) {
|
|
44776
|
+
return invalidSchemaResponseWithError$1(
|
|
44777
|
+
new JsonSchemaViolationError$1(
|
|
44778
|
+
`Data at ${path} validated against the schema of a not clause.`
|
|
44779
|
+
)
|
|
44780
|
+
);
|
|
44781
|
+
}
|
|
44782
|
+
return validSchemaResponse$1();
|
|
44783
|
+
}
|
|
44784
|
+
function validateObject$1(data, schema, path, document, visited) {
|
|
44785
|
+
const schemaKeys = Object.keys(schema.properties);
|
|
44786
|
+
const requiredKeys = new Set(schema.required);
|
|
44787
|
+
const schemaKeySet = new Set(schemaKeys);
|
|
44788
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44789
|
+
Object.keys(data).forEach((key) => {
|
|
44790
|
+
if (!schemaKeySet.has(key)) {
|
|
44791
|
+
errorCollector.append(
|
|
44792
|
+
validateJsonSchemaInternal$1(
|
|
44793
|
+
data[key],
|
|
44794
|
+
schema.additionalProperties,
|
|
44795
|
+
`${path}.additionalProperties[${key}]`,
|
|
44796
|
+
document,
|
|
44797
|
+
visited
|
|
44798
|
+
)
|
|
44799
|
+
);
|
|
44800
|
+
}
|
|
44801
|
+
});
|
|
44802
|
+
for (let i = 0, length = schemaKeys.length; i < length; i++) {
|
|
44803
|
+
const key = schemaKeys[i];
|
|
44804
|
+
const keyInData = key in data && data[key] !== void 0;
|
|
44805
|
+
if (requiredKeys.has(key) && !keyInData) {
|
|
44806
|
+
errorCollector.add(
|
|
44807
|
+
new MissingRequiredPropertyError$1(
|
|
44808
|
+
`Object at path '${path}' is missing required property '${key}'.`
|
|
44809
|
+
)
|
|
44810
|
+
);
|
|
44811
|
+
}
|
|
44812
|
+
if (keyInData) {
|
|
44813
|
+
errorCollector.append(
|
|
44814
|
+
validateJsonSchemaInternal$1(
|
|
44815
|
+
data[key],
|
|
44816
|
+
schema.properties[key],
|
|
44817
|
+
`${path}.${key}`,
|
|
44818
|
+
document,
|
|
44819
|
+
visited
|
|
44820
|
+
)
|
|
44821
|
+
);
|
|
44822
|
+
}
|
|
44823
|
+
}
|
|
44824
|
+
return errorCollector.toValidationResponse();
|
|
44825
|
+
}
|
|
44826
|
+
function validateArray$1(data, schema, path, document, visited) {
|
|
44827
|
+
if (schema.minItems !== void 0 && data.length < schema.minItems) {
|
|
44828
|
+
return invalidSchemaResponseWithError$1(
|
|
44829
|
+
new MinItemsViolationError$1(
|
|
44830
|
+
`Array at path '${path}' fails minItems constraint. Has ${data.length} items, needs at least ${schema.minItems}.`
|
|
44831
|
+
)
|
|
44832
|
+
);
|
|
44833
|
+
}
|
|
44834
|
+
if (schema.maxItems !== void 0 && data.length > schema.maxItems) {
|
|
44835
|
+
return invalidSchemaResponseWithError$1(
|
|
44836
|
+
new MaxItemsViolationError$1(
|
|
44837
|
+
`Array at path '${path}' fails maxItems constraint. Has ${data.length} items, needs at most ${schema.maxItems}.`
|
|
44838
|
+
)
|
|
44839
|
+
);
|
|
44840
|
+
}
|
|
44841
|
+
const errorCollector = new JsonSchemaErrorCollector$1();
|
|
44842
|
+
data.forEach(
|
|
44843
|
+
(element, index) => errorCollector.append(
|
|
44844
|
+
validateJsonSchemaInternal$1(
|
|
44845
|
+
element,
|
|
44846
|
+
schema.items,
|
|
44847
|
+
`${path}[${index}]`,
|
|
44848
|
+
document,
|
|
44849
|
+
visited
|
|
44850
|
+
)
|
|
44851
|
+
)
|
|
44852
|
+
);
|
|
44853
|
+
return errorCollector.toValidationResponse();
|
|
44854
|
+
}
|
|
44855
|
+
function validateScalar$1(data, schema, path) {
|
|
44856
|
+
const schemaDataType = schema.type;
|
|
44857
|
+
const dataType = typeof data;
|
|
44858
|
+
if (schemaDataType === "integer") {
|
|
44859
|
+
if (dataType !== "number" || !Number.isInteger(data)) {
|
|
44860
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("integer", dataType, path));
|
|
44861
|
+
}
|
|
44862
|
+
} else if (schemaDataType === "number") {
|
|
44863
|
+
if (dataType !== "number") {
|
|
44864
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("number", dataType, path));
|
|
44865
|
+
}
|
|
44866
|
+
} else if (schemaDataType === "string") {
|
|
44867
|
+
if (dataType !== "string") {
|
|
44868
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("string", dataType, path));
|
|
44869
|
+
}
|
|
44870
|
+
} else if (schemaDataType === "boolean") {
|
|
44871
|
+
if (dataType !== "boolean") {
|
|
44872
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("boolean", dataType, path));
|
|
44873
|
+
}
|
|
44874
|
+
} else if (schemaDataType === "null") {
|
|
44875
|
+
if (data !== null) {
|
|
44876
|
+
return invalidSchemaResponseWithError$1(incorrectTypeError$1("null", dataType, path));
|
|
44877
|
+
}
|
|
44878
|
+
} else {
|
|
44879
|
+
return invalidSchemaResponseWithError$1(
|
|
44880
|
+
new IncorrectTypeError$1(`Unknown schema data type: ${schemaDataType}.`)
|
|
44881
|
+
);
|
|
44882
|
+
}
|
|
44883
|
+
return validSchemaResponse$1();
|
|
44884
|
+
}
|
|
44885
|
+
function validateRef$1(data, schema, path, document, visited) {
|
|
44886
|
+
if (!schema.$ref.startsWith("#")) {
|
|
44887
|
+
return invalidSchemaResponseWithError$1(
|
|
44888
|
+
new InvalidRefError$1(
|
|
44889
|
+
`$ref values that do not refer to the current document are unsupported (must start with '#')`
|
|
44890
|
+
)
|
|
44891
|
+
);
|
|
44892
|
+
}
|
|
44893
|
+
let refsForData = visited.get(data);
|
|
44894
|
+
if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
|
|
44895
|
+
return validSchemaResponse$1();
|
|
44896
|
+
}
|
|
44897
|
+
if (refsForData === void 0) {
|
|
44898
|
+
refsForData = /* @__PURE__ */ new Set();
|
|
44899
|
+
visited.set(data, refsForData);
|
|
44900
|
+
}
|
|
44901
|
+
refsForData.add(schema.$ref);
|
|
44902
|
+
try {
|
|
44903
|
+
const schemaToValidate = findSchemaAtPath$1(document, schema.$ref);
|
|
44904
|
+
return validateJsonSchemaInternal$1(data, schemaToValidate, path, document, visited);
|
|
44905
|
+
} catch (e) {
|
|
44906
|
+
return invalidSchemaResponseWithError$1(e);
|
|
44907
|
+
} finally {
|
|
44908
|
+
refsForData.delete(schema.$ref);
|
|
44909
|
+
if (refsForData.size === 0) visited.delete(data);
|
|
44910
|
+
}
|
|
44911
|
+
}
|
|
44912
|
+
function validateEnum$1(data, enumValue, path) {
|
|
44913
|
+
if (!enumValue.some((value) => deepEquals$2(value, data))) {
|
|
44914
|
+
return invalidSchemaResponseWithError$1(
|
|
44915
|
+
new JsonSchemaViolationError$1(
|
|
44916
|
+
`Data at ${path} did not match any values in enum. Expected value in: [${enumValue.map((value) => stringify$9(value)).join()}]`
|
|
44917
|
+
)
|
|
44918
|
+
);
|
|
44919
|
+
}
|
|
44920
|
+
return validSchemaResponse$1();
|
|
44921
|
+
}
|
|
44922
|
+
function validateConst$1(data, constValue, path) {
|
|
44923
|
+
if (!deepEquals$2(constValue, data)) {
|
|
44924
|
+
return invalidSchemaResponseWithError$1(
|
|
44925
|
+
new JsonSchemaViolationError$1(
|
|
44926
|
+
`Data at ${path} did not match const. Expected: ${stringify$9(constValue)}`
|
|
44927
|
+
)
|
|
44928
|
+
);
|
|
44929
|
+
}
|
|
44930
|
+
return validSchemaResponse$1();
|
|
44931
|
+
}
|
|
44932
|
+
function findSchemaAtPath$1(document, ref) {
|
|
44933
|
+
if (ref === "#") return document;
|
|
44934
|
+
const keys = ref.replace(/^#\//, "").split("/");
|
|
44935
|
+
let current = document;
|
|
44936
|
+
let path = "#";
|
|
44937
|
+
for (const key of keys) {
|
|
44938
|
+
path = `${path}/${key}`;
|
|
44939
|
+
if (current[key] === void 0) {
|
|
44940
|
+
throw new InvalidRefError$1(
|
|
44941
|
+
`Invalid $ref value '${ref}'. Cannot find target schema at '${path}'`
|
|
44942
|
+
);
|
|
44943
|
+
}
|
|
44944
|
+
current = current[key];
|
|
44945
|
+
}
|
|
44946
|
+
return current;
|
|
44538
44947
|
}
|
|
44539
44948
|
|
|
44540
44949
|
/*!
|
|
@@ -45381,35 +45790,6 @@ const astResolver = function(astReference) {
|
|
|
45381
45790
|
}
|
|
45382
45791
|
return referenceMap.get(astReference);
|
|
45383
45792
|
};
|
|
45384
|
-
/*!
|
|
45385
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
45386
|
-
* All rights reserved.
|
|
45387
|
-
* For full license text, see the LICENSE.txt file
|
|
45388
|
-
*/
|
|
45389
|
-
let Ok$3 = class Ok {
|
|
45390
|
-
constructor(value) {
|
|
45391
|
-
this.value = value;
|
|
45392
|
-
}
|
|
45393
|
-
isOk() {
|
|
45394
|
-
return true;
|
|
45395
|
-
}
|
|
45396
|
-
isErr() {
|
|
45397
|
-
return !this.isOk();
|
|
45398
|
-
}
|
|
45399
|
-
};
|
|
45400
|
-
let Err$3 = class Err {
|
|
45401
|
-
constructor(error) {
|
|
45402
|
-
this.error = error;
|
|
45403
|
-
}
|
|
45404
|
-
isOk() {
|
|
45405
|
-
return false;
|
|
45406
|
-
}
|
|
45407
|
-
isErr() {
|
|
45408
|
-
return !this.isOk();
|
|
45409
|
-
}
|
|
45410
|
-
};
|
|
45411
|
-
const ok$3 = (value) => new Ok$3(value);
|
|
45412
|
-
const err$3 = (err2) => new Err$3(err2);
|
|
45413
45793
|
function findExecutableOperation$2(document, operationName) {
|
|
45414
45794
|
const operations = document.definitions.filter(
|
|
45415
45795
|
(def) => def.kind === Kind$1.OPERATION_DEFINITION
|
|
@@ -45460,6 +45840,14 @@ function resolveAndValidateGraphQLConfig(config, options) {
|
|
|
45460
45840
|
query: result.value
|
|
45461
45841
|
});
|
|
45462
45842
|
}
|
|
45843
|
+
function toGraphQLErrorResponse(error) {
|
|
45844
|
+
logError$2(error);
|
|
45845
|
+
const message = error instanceof JsonSchemaViolationError$1 ? `Invalid GraphQL config: ${error.message}` : "Internal error in GraphQL adapter occurred";
|
|
45846
|
+
return {
|
|
45847
|
+
data: void 0,
|
|
45848
|
+
errors: [{ message, locations: [] }]
|
|
45849
|
+
};
|
|
45850
|
+
}
|
|
45463
45851
|
function resolveAndValidateGraphQLDocument(query, operationName, options) {
|
|
45464
45852
|
const resolved = resolveAst(query);
|
|
45465
45853
|
if (resolved === void 0) {
|
|
@@ -45725,7 +46113,11 @@ function buildAndDispatchGetRecordAggregateUi(recordId, req, params) {
|
|
|
45725
46113
|
queryParams: {},
|
|
45726
46114
|
headers: {},
|
|
45727
46115
|
};
|
|
45728
|
-
|
|
46116
|
+
// Re-enter the composed adapter (when registered) so routing and interceptors
|
|
46117
|
+
// apply to the synthesized aggregate-ui sub-request. Fall back to the base
|
|
46118
|
+
// adapter when unregistered (e.g. in lds-network-adapter unit tests).
|
|
46119
|
+
const subRequestAdapter = networkAdapter;
|
|
46120
|
+
return dispatchSplitRecordAggregateUiAction(recordId, subRequestAdapter, aggregateUiResourceRequest, resourceRequestContext);
|
|
45729
46121
|
}
|
|
45730
46122
|
const getRecordDispatcher = (req) => {
|
|
45731
46123
|
const { resourceRequest, networkAdapter, resourceRequestContext } = req;
|
|
@@ -45781,7 +46173,6 @@ function matchRecordsHandlers(path, resourceRequest) {
|
|
|
45781
46173
|
}
|
|
45782
46174
|
return null;
|
|
45783
46175
|
}
|
|
45784
|
-
|
|
45785
46176
|
const defaultDispatcher = (req) => {
|
|
45786
46177
|
const { networkAdapter, resourceRequest, resourceRequestContext } = req;
|
|
45787
46178
|
return networkAdapter(resourceRequest, resourceRequestContext);
|
|
@@ -51198,7 +51589,6 @@ function prepareRequest$5(luvio, config) {
|
|
|
51198
51589
|
const key = keyBuilder$1M(luvio, createResourceParams$g(config));
|
|
51199
51590
|
const allTrackedFields = getTrackedFields(key, luvio.getNode(key), {
|
|
51200
51591
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
51201
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
51202
51592
|
}, config.optionalFields);
|
|
51203
51593
|
const optionalFields = fields === undefined ? allTrackedFields : difference(allTrackedFields, fields);
|
|
51204
51594
|
const resourceParams = createResourceParams$g({
|
|
@@ -51325,7 +51715,6 @@ function ingestSuccessChildResourceParams$2(luvio, childResourceParamsArray, chi
|
|
|
51325
51715
|
};
|
|
51326
51716
|
const childTrackedFields = getTrackedFields(childKey, luvio.getNode(childKey), {
|
|
51327
51717
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
51328
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
51329
51718
|
}, childResourceParams.queryParams.optionalFields);
|
|
51330
51719
|
const childSnapshot = ingestSuccess$8(luvio, {
|
|
51331
51720
|
recordId: childResourceParams.urlParams.recordId,
|
|
@@ -56295,7 +56684,6 @@ function buildNetworkSnapshot$c(luvio, config, options) {
|
|
|
56295
56684
|
const key = keyBuilder$1w$1(luvio, config);
|
|
56296
56685
|
const trackedFieldsConfig = {
|
|
56297
56686
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
56298
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
56299
56687
|
};
|
|
56300
56688
|
const optionalFieldsTrie = convertFieldsToTrie(getTrackedFields(key, luvio.getNode(key), trackedFieldsConfig, config.optionalFields));
|
|
56301
56689
|
const fieldsTrie = BLANK_RECORD_FIELDS_TRIE;
|
|
@@ -60167,7 +60555,6 @@ const buildNetworkSnapshot$3 = (luvio, context, config, options) => {
|
|
|
60167
60555
|
...resourceRequest.queryParams,
|
|
60168
60556
|
optionalFields: getTrackedFields(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
60169
60557
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
60170
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
60171
60558
|
}, config.optionalFields),
|
|
60172
60559
|
},
|
|
60173
60560
|
});
|
|
@@ -60719,7 +61106,6 @@ function prepareRequest(luvio, context, config) {
|
|
|
60719
61106
|
...resourceRequest.queryParams,
|
|
60720
61107
|
optionalFields: getTrackedFields(recordTemplateKey, luvio.getNode(recordTemplateKey), {
|
|
60721
61108
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
60722
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
60723
61109
|
}, config.optionalFields),
|
|
60724
61110
|
},
|
|
60725
61111
|
});
|
|
@@ -60739,7 +61125,6 @@ function onFetchResponseSuccess$2(luvio, context, config, request, response, res
|
|
|
60739
61125
|
});
|
|
60740
61126
|
const allTrackedFields = getTrackedFields(templateRecordKey, luvio.getNode(templateRecordKey), {
|
|
60741
61127
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMiss(),
|
|
60742
|
-
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
60743
61128
|
}, optionalFields);
|
|
60744
61129
|
const allTrackedFieldsTrie = convertFieldsToTrie(allTrackedFields, true);
|
|
60745
61130
|
const ingest = createFieldsIngestSuccess({
|
|
@@ -80503,6 +80888,7 @@ class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
80503
80888
|
}
|
|
80504
80889
|
async buildPendingAction(request, queue) {
|
|
80505
80890
|
this.resolveResourceRequestBody(request.body);
|
|
80891
|
+
// eslint-disable-next-line no-return-await
|
|
80506
80892
|
return await super.buildPendingAction(request, queue);
|
|
80507
80893
|
}
|
|
80508
80894
|
resolveResourceRequestBody(body) {
|
|
@@ -80935,8 +81321,6 @@ function isCreateContentDocumentAndVersionDraftAdapterEvent(customEvent) {
|
|
|
80935
81321
|
return customEvent.namespace === CONTENT_DOCUMENT_AND_VERSION_NAMESPACE;
|
|
80936
81322
|
}
|
|
80937
81323
|
|
|
80938
|
-
// so eslint doesn't complain about nimbus
|
|
80939
|
-
/* global __nimbus */
|
|
80940
81324
|
function chunkToBase64(chunk) {
|
|
80941
81325
|
const bytes = new Uint8Array(chunk);
|
|
80942
81326
|
const CHUNK_SIZE = 64 * 1024; // 64kb, any bigger and fromCharCode() can error out with an overflow.
|
|
@@ -87016,6 +87400,7 @@ function isPolymorphicFieldPath(path, pathToObjectApiNamesMap, objectInfos) {
|
|
|
87016
87400
|
const parentObjectInfo = objectInfos[parentObjectApiNames[0]];
|
|
87017
87401
|
// this should not be undefined, but lets catch it if we do end up in that state.
|
|
87018
87402
|
if (parentObjectInfo === undefined) {
|
|
87403
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
87019
87404
|
throw new Error(`ObjectInfo is missing for ${parentObjectApiNames[0]} for ${parentApiPath}`);
|
|
87020
87405
|
}
|
|
87021
87406
|
const relationshipField = referenceIdFieldForRelationship(lastSegment);
|
|
@@ -88388,6 +88773,7 @@ function checkForEmptyData(gqlResult) {
|
|
|
88388
88773
|
}
|
|
88389
88774
|
const query = data.uiapi.query;
|
|
88390
88775
|
// Check all entity types in the query for edges - using for...in to avoid array allocation
|
|
88776
|
+
// eslint-disable-next-line guard-for-in
|
|
88391
88777
|
for (const entityType in query) {
|
|
88392
88778
|
const entity = query[entityType];
|
|
88393
88779
|
if (entity && entity.edges && isArray$3$1(entity.edges) && entity.edges.length > 0) {
|
|
@@ -90309,7 +90695,9 @@ class NimbusSqliteStore {
|
|
|
90309
90695
|
}
|
|
90310
90696
|
instrumentation$2$1.trackValue(GRAPHQL_QUERY_ROOT_METRIC_NAME, row[1].length);
|
|
90311
90697
|
}
|
|
90312
|
-
catch {
|
|
90698
|
+
catch {
|
|
90699
|
+
// intentionally do nothing
|
|
90700
|
+
}
|
|
90313
90701
|
}
|
|
90314
90702
|
}
|
|
90315
90703
|
|
|
@@ -91018,6 +91406,7 @@ class PrimingSession extends EventEmitter {
|
|
|
91018
91406
|
const userData = {
|
|
91019
91407
|
...stats,
|
|
91020
91408
|
};
|
|
91409
|
+
// eslint-disable-next-line guard-for-in
|
|
91021
91410
|
for (const error in errors) {
|
|
91022
91411
|
activity.error(error);
|
|
91023
91412
|
}
|
|
@@ -91198,6 +91587,7 @@ class PrimingSession extends EventEmitter {
|
|
|
91198
91587
|
let limitedResult = this.applyRetryLimits(result.additionalWork);
|
|
91199
91588
|
this.enqueue(limitedResult.additionalWork);
|
|
91200
91589
|
if (limitedResult.recordsNeedingRefetch.size > 0) {
|
|
91590
|
+
// eslint-disable-next-line guard-for-in
|
|
91201
91591
|
for (const key in keys$3(limitedResult.recordsNeedingRefetch)) {
|
|
91202
91592
|
const value = limitedResult.recordsNeedingRefetch.get(key);
|
|
91203
91593
|
if (result.recordsNeedingRefetch.has(key)) {
|
|
@@ -93463,6 +93853,7 @@ class DurableRecordStore {
|
|
|
93463
93853
|
async exists(key) {
|
|
93464
93854
|
const result = await this.durableStore.query('SELECT EXISTS(SELECT 1 FROM lds_data WHERE key = ?)', [key]);
|
|
93465
93855
|
const exists = result.rows[0][0];
|
|
93856
|
+
// eslint-disable-next-line eqeqeq
|
|
93466
93857
|
return exists == true;
|
|
93467
93858
|
}
|
|
93468
93859
|
async getRecord(key) {
|
|
@@ -93677,7 +94068,7 @@ var CounterResult;
|
|
|
93677
94068
|
CounterResult["Error"] = "Error";
|
|
93678
94069
|
})(CounterResult || (CounterResult = {}));
|
|
93679
94070
|
function incrementCounter(name, result) {
|
|
93680
|
-
instrumentation$4.incrementCounter('SFSSideEffect', 1, result
|
|
94071
|
+
instrumentation$4.incrementCounter('SFSSideEffect', 1, result === CounterResult.Error, {
|
|
93681
94072
|
Name: name,
|
|
93682
94073
|
Result: result,
|
|
93683
94074
|
});
|
|
@@ -96249,7 +96640,7 @@ function buildServiceDescriptor$b(luvio) {
|
|
|
96249
96640
|
},
|
|
96250
96641
|
};
|
|
96251
96642
|
}
|
|
96252
|
-
// version: 1.
|
|
96643
|
+
// version: 1.435.0-5818ce3c48
|
|
96253
96644
|
|
|
96254
96645
|
/**
|
|
96255
96646
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -96275,7 +96666,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
96275
96666
|
},
|
|
96276
96667
|
};
|
|
96277
96668
|
}
|
|
96278
|
-
// version: 1.
|
|
96669
|
+
// version: 1.435.0-5818ce3c48
|
|
96279
96670
|
|
|
96280
96671
|
/*!
|
|
96281
96672
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -96680,26 +97071,26 @@ function buildServiceDescriptor$8() {
|
|
|
96680
97071
|
* All rights reserved.
|
|
96681
97072
|
* For full license text, see the LICENSE.txt file
|
|
96682
97073
|
*/
|
|
96683
|
-
|
|
97074
|
+
class JsonSchemaViolationError extends Error {
|
|
96684
97075
|
constructor(message, validationErrors) {
|
|
96685
97076
|
super(message);
|
|
96686
97077
|
this.validationErrors = [];
|
|
96687
97078
|
this.validationErrors = validationErrors || [];
|
|
96688
97079
|
}
|
|
96689
|
-
}
|
|
96690
|
-
|
|
96691
|
-
}
|
|
96692
|
-
|
|
96693
|
-
}
|
|
96694
|
-
|
|
96695
|
-
}
|
|
96696
|
-
|
|
96697
|
-
}
|
|
96698
|
-
|
|
96699
|
-
}
|
|
96700
|
-
|
|
96701
|
-
}
|
|
96702
|
-
|
|
97080
|
+
}
|
|
97081
|
+
class MinItemsViolationError extends JsonSchemaViolationError {
|
|
97082
|
+
}
|
|
97083
|
+
class MaxItemsViolationError extends JsonSchemaViolationError {
|
|
97084
|
+
}
|
|
97085
|
+
class IncorrectTypeError extends JsonSchemaViolationError {
|
|
97086
|
+
}
|
|
97087
|
+
class AdditionalPropertiesError extends JsonSchemaViolationError {
|
|
97088
|
+
}
|
|
97089
|
+
class MissingRequiredPropertyError extends JsonSchemaViolationError {
|
|
97090
|
+
}
|
|
97091
|
+
class InvalidRefError extends JsonSchemaViolationError {
|
|
97092
|
+
}
|
|
97093
|
+
class JsonSchemaErrorCollector {
|
|
96703
97094
|
constructor() {
|
|
96704
97095
|
this.errors = [];
|
|
96705
97096
|
}
|
|
@@ -96720,104 +97111,108 @@ let JsonSchemaErrorCollector$1 = class JsonSchemaErrorCollector {
|
|
|
96720
97111
|
toValidationResponse() {
|
|
96721
97112
|
return !this.hasErrors() ? ok$1(true) : err$1(this.errors);
|
|
96722
97113
|
}
|
|
96723
|
-
}
|
|
96724
|
-
function createThrowableError
|
|
96725
|
-
if (errors[0] instanceof MinItemsViolationError
|
|
96726
|
-
return new MinItemsViolationError
|
|
97114
|
+
}
|
|
97115
|
+
function createThrowableError(errors) {
|
|
97116
|
+
if (errors[0] instanceof MinItemsViolationError) {
|
|
97117
|
+
return new MinItemsViolationError(errors[0].message, errors);
|
|
96727
97118
|
}
|
|
96728
|
-
if (errors[0] instanceof MaxItemsViolationError
|
|
96729
|
-
return new MaxItemsViolationError
|
|
97119
|
+
if (errors[0] instanceof MaxItemsViolationError) {
|
|
97120
|
+
return new MaxItemsViolationError(errors[0].message, errors);
|
|
96730
97121
|
}
|
|
96731
|
-
if (errors[0] instanceof IncorrectTypeError
|
|
96732
|
-
return new IncorrectTypeError
|
|
97122
|
+
if (errors[0] instanceof IncorrectTypeError) {
|
|
97123
|
+
return new IncorrectTypeError(errors[0].message, errors);
|
|
96733
97124
|
}
|
|
96734
|
-
if (errors[0] instanceof AdditionalPropertiesError
|
|
96735
|
-
return new AdditionalPropertiesError
|
|
97125
|
+
if (errors[0] instanceof AdditionalPropertiesError) {
|
|
97126
|
+
return new AdditionalPropertiesError(errors[0].message, errors);
|
|
96736
97127
|
}
|
|
96737
|
-
if (errors[0] instanceof MissingRequiredPropertyError
|
|
96738
|
-
return new MissingRequiredPropertyError
|
|
97128
|
+
if (errors[0] instanceof MissingRequiredPropertyError) {
|
|
97129
|
+
return new MissingRequiredPropertyError(errors[0].message, errors);
|
|
96739
97130
|
}
|
|
96740
|
-
if (errors[0] instanceof InvalidRefError
|
|
96741
|
-
return new InvalidRefError
|
|
97131
|
+
if (errors[0] instanceof InvalidRefError) {
|
|
97132
|
+
return new InvalidRefError(errors[0].message, errors);
|
|
96742
97133
|
}
|
|
96743
|
-
return new JsonSchemaViolationError
|
|
97134
|
+
return new JsonSchemaViolationError(errors[0].message, errors);
|
|
96744
97135
|
}
|
|
96745
|
-
function assertIsValid
|
|
96746
|
-
const validationResponse = validateJsonSchema
|
|
97136
|
+
function assertIsValid(data, schema) {
|
|
97137
|
+
const validationResponse = validateJsonSchema(data, schema);
|
|
96747
97138
|
if (validationResponse.isErr()) {
|
|
96748
|
-
throw createThrowableError
|
|
97139
|
+
throw createThrowableError(validationResponse.error);
|
|
96749
97140
|
}
|
|
96750
97141
|
}
|
|
96751
|
-
function incorrectTypeError
|
|
96752
|
-
return new IncorrectTypeError
|
|
97142
|
+
function incorrectTypeError(expected, actual, path) {
|
|
97143
|
+
return new IncorrectTypeError(
|
|
96753
97144
|
`Expected type ${expected} at path '${path}', found type ${actual}.`
|
|
96754
97145
|
);
|
|
96755
97146
|
}
|
|
96756
|
-
function validSchemaResponse
|
|
97147
|
+
function validSchemaResponse() {
|
|
96757
97148
|
return ok$1(true);
|
|
96758
97149
|
}
|
|
96759
|
-
function invalidSchemaResponseWithError
|
|
97150
|
+
function invalidSchemaResponseWithError(error) {
|
|
96760
97151
|
return err$1([error]);
|
|
96761
97152
|
}
|
|
96762
|
-
function validateJsonSchema
|
|
96763
|
-
|
|
97153
|
+
function validateJsonSchema(data, schema, path = "$", document = schema) {
|
|
97154
|
+
return validateJsonSchemaInternal(data, schema, path, document, /* @__PURE__ */ new Map());
|
|
97155
|
+
}
|
|
97156
|
+
function validateJsonSchemaInternal(data, schema, path, document, visited) {
|
|
97157
|
+
if (schema === true) return validSchemaResponse();
|
|
96764
97158
|
if (schema === false)
|
|
96765
|
-
return invalidSchemaResponseWithError
|
|
96766
|
-
new JsonSchemaViolationError
|
|
97159
|
+
return invalidSchemaResponseWithError(
|
|
97160
|
+
new JsonSchemaViolationError(`Data at ${path} has schema 'false'`)
|
|
96767
97161
|
);
|
|
96768
97162
|
const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
|
|
96769
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97163
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96770
97164
|
if ("anyOf" in schema) {
|
|
96771
|
-
errorCollector.append(validateAnyOf
|
|
97165
|
+
errorCollector.append(validateAnyOf(data, schema, path, document, visited));
|
|
96772
97166
|
} else if ("oneOf" in schema) {
|
|
96773
|
-
errorCollector.append(validateOneOf
|
|
97167
|
+
errorCollector.append(validateOneOf(data, schema, path, document, visited));
|
|
96774
97168
|
} else if ("allOf" in schema) {
|
|
96775
|
-
errorCollector.append(validateAllOf
|
|
97169
|
+
errorCollector.append(validateAllOf(data, schema, path, document, visited));
|
|
96776
97170
|
} else if ("not" in schema) {
|
|
96777
|
-
errorCollector.append(validateNot
|
|
97171
|
+
errorCollector.append(validateNot(data, schema, path, document, visited));
|
|
96778
97172
|
} else if ("$ref" in schema) {
|
|
96779
|
-
errorCollector.append(validateRef
|
|
97173
|
+
errorCollector.append(validateRef(data, schema, path, document, visited));
|
|
96780
97174
|
} else if ("type" in schema) {
|
|
96781
97175
|
if (schema.type === "object") {
|
|
96782
97176
|
if (dataType !== "object") {
|
|
96783
|
-
errorCollector.add(incorrectTypeError
|
|
97177
|
+
errorCollector.add(incorrectTypeError("object", dataType, path));
|
|
96784
97178
|
} else {
|
|
96785
97179
|
errorCollector.append(
|
|
96786
|
-
validateObject
|
|
97180
|
+
validateObject(data, schema, path, document, visited)
|
|
96787
97181
|
);
|
|
96788
97182
|
}
|
|
96789
97183
|
} else if (schema.type === "array") {
|
|
96790
97184
|
if (dataType !== "array") {
|
|
96791
|
-
errorCollector.add(incorrectTypeError
|
|
97185
|
+
errorCollector.add(incorrectTypeError("array", dataType, path));
|
|
96792
97186
|
} else {
|
|
96793
97187
|
errorCollector.append(
|
|
96794
|
-
validateArray
|
|
97188
|
+
validateArray(data, schema, path, document, visited)
|
|
96795
97189
|
);
|
|
96796
97190
|
}
|
|
96797
97191
|
} else {
|
|
96798
97192
|
errorCollector.append(
|
|
96799
|
-
validateScalar
|
|
97193
|
+
validateScalar(data, schema, path)
|
|
96800
97194
|
);
|
|
96801
97195
|
}
|
|
96802
97196
|
}
|
|
96803
97197
|
if (schema.enum) {
|
|
96804
|
-
errorCollector.append(validateEnum
|
|
97198
|
+
errorCollector.append(validateEnum(data, schema.enum, path));
|
|
96805
97199
|
}
|
|
96806
97200
|
if (schema.const) {
|
|
96807
|
-
errorCollector.append(validateConst
|
|
97201
|
+
errorCollector.append(validateConst(data, schema.const, path));
|
|
96808
97202
|
}
|
|
96809
97203
|
return errorCollector.toValidationResponse();
|
|
96810
97204
|
}
|
|
96811
|
-
function validateAnyOf
|
|
97205
|
+
function validateAnyOf(data, schema, path, document, visited) {
|
|
96812
97206
|
let isValid = false;
|
|
96813
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97207
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96814
97208
|
for (let i = 0, { length } = schema.anyOf; i < length; i++) {
|
|
96815
97209
|
const element = schema.anyOf[i];
|
|
96816
|
-
const validationResponse =
|
|
97210
|
+
const validationResponse = validateJsonSchemaInternal(
|
|
96817
97211
|
data,
|
|
96818
97212
|
element,
|
|
96819
97213
|
`${path}.anyOf[${i}]`,
|
|
96820
|
-
document
|
|
97214
|
+
document,
|
|
97215
|
+
visited
|
|
96821
97216
|
);
|
|
96822
97217
|
if (validationResponse.isOk()) {
|
|
96823
97218
|
isValid = true;
|
|
@@ -96828,19 +97223,28 @@ function validateAnyOf$1(data, schema, path, document) {
|
|
|
96828
97223
|
}
|
|
96829
97224
|
if (!isValid) {
|
|
96830
97225
|
errorCollector.prepend(
|
|
96831
|
-
new JsonSchemaViolationError
|
|
97226
|
+
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in anyOf.`)
|
|
96832
97227
|
);
|
|
96833
97228
|
return errorCollector.toValidationResponse();
|
|
96834
97229
|
}
|
|
96835
|
-
return validSchemaResponse
|
|
97230
|
+
return validSchemaResponse();
|
|
96836
97231
|
}
|
|
96837
|
-
function validateOneOf
|
|
97232
|
+
function validateOneOf(data, schema, path, document, visited) {
|
|
97233
|
+
if (schema.discriminator !== void 0) {
|
|
97234
|
+
return validateDiscriminatedOneOf(data, schema.discriminator, path, document, visited);
|
|
97235
|
+
}
|
|
96838
97236
|
let validSubShemaPaths = [];
|
|
96839
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97237
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96840
97238
|
for (let i = 0, { length } = schema.oneOf; i < length; i++) {
|
|
96841
97239
|
const element = schema.oneOf[i];
|
|
96842
97240
|
const oneOfPath = `${path}.oneOf[${i}]`;
|
|
96843
|
-
const validationResponse =
|
|
97241
|
+
const validationResponse = validateJsonSchemaInternal(
|
|
97242
|
+
data,
|
|
97243
|
+
element,
|
|
97244
|
+
oneOfPath,
|
|
97245
|
+
document,
|
|
97246
|
+
visited
|
|
97247
|
+
);
|
|
96844
97248
|
if (validationResponse.isOk()) {
|
|
96845
97249
|
validSubShemaPaths.push(oneOfPath);
|
|
96846
97250
|
} else {
|
|
@@ -96849,29 +97253,58 @@ function validateOneOf$1(data, schema, path, document) {
|
|
|
96849
97253
|
}
|
|
96850
97254
|
if (validSubShemaPaths.length === 0) {
|
|
96851
97255
|
errorCollector.prepend(
|
|
96852
|
-
new JsonSchemaViolationError
|
|
97256
|
+
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in oneOf.`)
|
|
96853
97257
|
);
|
|
96854
97258
|
return errorCollector.toValidationResponse();
|
|
96855
97259
|
} else if (validSubShemaPaths.length > 1) {
|
|
96856
97260
|
errorCollector.prepend(
|
|
96857
|
-
new JsonSchemaViolationError
|
|
97261
|
+
new JsonSchemaViolationError(
|
|
96858
97262
|
`Data at ${path} matched multiple subschemas: [${validSubShemaPaths.join(", ")}].`
|
|
96859
97263
|
)
|
|
96860
97264
|
);
|
|
96861
97265
|
return errorCollector.toValidationResponse();
|
|
96862
97266
|
}
|
|
96863
|
-
return validSchemaResponse
|
|
97267
|
+
return validSchemaResponse();
|
|
97268
|
+
}
|
|
97269
|
+
function validateDiscriminatedOneOf(data, discriminator, path, document, visited) {
|
|
97270
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
97271
|
+
return invalidSchemaResponseWithError(incorrectTypeError("object", typeof data, path));
|
|
97272
|
+
}
|
|
97273
|
+
const { propertyName, mapping } = discriminator;
|
|
97274
|
+
const discriminatorValue = data[propertyName];
|
|
97275
|
+
if (discriminatorValue === void 0) {
|
|
97276
|
+
return invalidSchemaResponseWithError(
|
|
97277
|
+
new MissingRequiredPropertyError(
|
|
97278
|
+
`Object at path '${path}' is missing required discriminator property '${propertyName}'.`
|
|
97279
|
+
)
|
|
97280
|
+
);
|
|
97281
|
+
}
|
|
97282
|
+
if (typeof discriminatorValue !== "string") {
|
|
97283
|
+
return invalidSchemaResponseWithError(
|
|
97284
|
+
incorrectTypeError("string", typeof discriminatorValue, `${path}.${propertyName}`)
|
|
97285
|
+
);
|
|
97286
|
+
}
|
|
97287
|
+
const targetRef = mapping[discriminatorValue];
|
|
97288
|
+
if (targetRef === void 0) {
|
|
97289
|
+
return invalidSchemaResponseWithError(
|
|
97290
|
+
new JsonSchemaViolationError(
|
|
97291
|
+
`Discriminator value '${discriminatorValue}' at '${path}.${propertyName}' is not in the mapping. Expected one of: [${Object.keys(mapping).join(", ")}].`
|
|
97292
|
+
)
|
|
97293
|
+
);
|
|
97294
|
+
}
|
|
97295
|
+
return validateJsonSchemaInternal(data, { $ref: targetRef }, path, document, visited);
|
|
96864
97296
|
}
|
|
96865
|
-
function validateAllOf
|
|
97297
|
+
function validateAllOf(data, schema, path, document, visited) {
|
|
96866
97298
|
let isValid = true;
|
|
96867
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97299
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96868
97300
|
for (let i = 0, { length } = schema.allOf; i < length; i++) {
|
|
96869
97301
|
const element = schema.allOf[i];
|
|
96870
|
-
const validationResponse =
|
|
97302
|
+
const validationResponse = validateJsonSchemaInternal(
|
|
96871
97303
|
data,
|
|
96872
97304
|
element,
|
|
96873
97305
|
`${path}.allOf[${i}]`,
|
|
96874
|
-
document
|
|
97306
|
+
document,
|
|
97307
|
+
visited
|
|
96875
97308
|
);
|
|
96876
97309
|
if (!validationResponse.isOk()) {
|
|
96877
97310
|
errorCollector.append(validationResponse);
|
|
@@ -96880,35 +97313,42 @@ function validateAllOf$1(data, schema, path, document) {
|
|
|
96880
97313
|
}
|
|
96881
97314
|
if (!isValid) {
|
|
96882
97315
|
errorCollector.prepend(
|
|
96883
|
-
new JsonSchemaViolationError
|
|
97316
|
+
new JsonSchemaViolationError(`Data at ${path} did not match some subschemas in allOf.`)
|
|
96884
97317
|
);
|
|
96885
97318
|
}
|
|
96886
97319
|
return errorCollector.toValidationResponse();
|
|
96887
97320
|
}
|
|
96888
|
-
function validateNot
|
|
96889
|
-
const validationResponse =
|
|
97321
|
+
function validateNot(data, schema, path, document, visited) {
|
|
97322
|
+
const validationResponse = validateJsonSchemaInternal(
|
|
97323
|
+
data,
|
|
97324
|
+
schema.not,
|
|
97325
|
+
path,
|
|
97326
|
+
document,
|
|
97327
|
+
visited
|
|
97328
|
+
);
|
|
96890
97329
|
if (validationResponse.isOk()) {
|
|
96891
|
-
return invalidSchemaResponseWithError
|
|
96892
|
-
new JsonSchemaViolationError
|
|
97330
|
+
return invalidSchemaResponseWithError(
|
|
97331
|
+
new JsonSchemaViolationError(
|
|
96893
97332
|
`Data at ${path} validated against the schema of a not clause.`
|
|
96894
97333
|
)
|
|
96895
97334
|
);
|
|
96896
97335
|
}
|
|
96897
|
-
return validSchemaResponse
|
|
97336
|
+
return validSchemaResponse();
|
|
96898
97337
|
}
|
|
96899
|
-
function validateObject
|
|
97338
|
+
function validateObject(data, schema, path, document, visited) {
|
|
96900
97339
|
const schemaKeys = Object.keys(schema.properties);
|
|
96901
97340
|
const requiredKeys = new Set(schema.required);
|
|
96902
97341
|
const schemaKeySet = new Set(schemaKeys);
|
|
96903
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97342
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96904
97343
|
Object.keys(data).forEach((key) => {
|
|
96905
97344
|
if (!schemaKeySet.has(key)) {
|
|
96906
97345
|
errorCollector.append(
|
|
96907
|
-
|
|
97346
|
+
validateJsonSchemaInternal(
|
|
96908
97347
|
data[key],
|
|
96909
97348
|
schema.additionalProperties,
|
|
96910
97349
|
`${path}.additionalProperties[${key}]`,
|
|
96911
|
-
document
|
|
97350
|
+
document,
|
|
97351
|
+
visited
|
|
96912
97352
|
)
|
|
96913
97353
|
);
|
|
96914
97354
|
}
|
|
@@ -96918,113 +97358,132 @@ function validateObject$1(data, schema, path, document) {
|
|
|
96918
97358
|
const keyInData = key in data && data[key] !== void 0;
|
|
96919
97359
|
if (requiredKeys.has(key) && !keyInData) {
|
|
96920
97360
|
errorCollector.add(
|
|
96921
|
-
new MissingRequiredPropertyError
|
|
97361
|
+
new MissingRequiredPropertyError(
|
|
96922
97362
|
`Object at path '${path}' is missing required property '${key}'.`
|
|
96923
97363
|
)
|
|
96924
97364
|
);
|
|
96925
97365
|
}
|
|
96926
97366
|
if (keyInData) {
|
|
96927
97367
|
errorCollector.append(
|
|
96928
|
-
|
|
97368
|
+
validateJsonSchemaInternal(
|
|
96929
97369
|
data[key],
|
|
96930
97370
|
schema.properties[key],
|
|
96931
97371
|
`${path}.${key}`,
|
|
96932
|
-
document
|
|
97372
|
+
document,
|
|
97373
|
+
visited
|
|
96933
97374
|
)
|
|
96934
97375
|
);
|
|
96935
97376
|
}
|
|
96936
97377
|
}
|
|
96937
97378
|
return errorCollector.toValidationResponse();
|
|
96938
97379
|
}
|
|
96939
|
-
function validateArray
|
|
97380
|
+
function validateArray(data, schema, path, document, visited) {
|
|
96940
97381
|
if (schema.minItems !== void 0 && data.length < schema.minItems) {
|
|
96941
|
-
return invalidSchemaResponseWithError
|
|
96942
|
-
new MinItemsViolationError
|
|
97382
|
+
return invalidSchemaResponseWithError(
|
|
97383
|
+
new MinItemsViolationError(
|
|
96943
97384
|
`Array at path '${path}' fails minItems constraint. Has ${data.length} items, needs at least ${schema.minItems}.`
|
|
96944
97385
|
)
|
|
96945
97386
|
);
|
|
96946
97387
|
}
|
|
96947
97388
|
if (schema.maxItems !== void 0 && data.length > schema.maxItems) {
|
|
96948
|
-
return invalidSchemaResponseWithError
|
|
96949
|
-
new MaxItemsViolationError
|
|
97389
|
+
return invalidSchemaResponseWithError(
|
|
97390
|
+
new MaxItemsViolationError(
|
|
96950
97391
|
`Array at path '${path}' fails maxItems constraint. Has ${data.length} items, needs at most ${schema.maxItems}.`
|
|
96951
97392
|
)
|
|
96952
97393
|
);
|
|
96953
97394
|
}
|
|
96954
|
-
const errorCollector = new JsonSchemaErrorCollector
|
|
97395
|
+
const errorCollector = new JsonSchemaErrorCollector();
|
|
96955
97396
|
data.forEach(
|
|
96956
97397
|
(element, index) => errorCollector.append(
|
|
96957
|
-
|
|
97398
|
+
validateJsonSchemaInternal(
|
|
97399
|
+
element,
|
|
97400
|
+
schema.items,
|
|
97401
|
+
`${path}[${index}]`,
|
|
97402
|
+
document,
|
|
97403
|
+
visited
|
|
97404
|
+
)
|
|
96958
97405
|
)
|
|
96959
97406
|
);
|
|
96960
97407
|
return errorCollector.toValidationResponse();
|
|
96961
97408
|
}
|
|
96962
|
-
function validateScalar
|
|
97409
|
+
function validateScalar(data, schema, path) {
|
|
96963
97410
|
const schemaDataType = schema.type;
|
|
96964
97411
|
const dataType = typeof data;
|
|
96965
97412
|
if (schemaDataType === "integer") {
|
|
96966
97413
|
if (dataType !== "number" || !Number.isInteger(data)) {
|
|
96967
|
-
return invalidSchemaResponseWithError
|
|
97414
|
+
return invalidSchemaResponseWithError(incorrectTypeError("integer", dataType, path));
|
|
96968
97415
|
}
|
|
96969
97416
|
} else if (schemaDataType === "number") {
|
|
96970
97417
|
if (dataType !== "number") {
|
|
96971
|
-
return invalidSchemaResponseWithError
|
|
97418
|
+
return invalidSchemaResponseWithError(incorrectTypeError("number", dataType, path));
|
|
96972
97419
|
}
|
|
96973
97420
|
} else if (schemaDataType === "string") {
|
|
96974
97421
|
if (dataType !== "string") {
|
|
96975
|
-
return invalidSchemaResponseWithError
|
|
97422
|
+
return invalidSchemaResponseWithError(incorrectTypeError("string", dataType, path));
|
|
96976
97423
|
}
|
|
96977
97424
|
} else if (schemaDataType === "boolean") {
|
|
96978
97425
|
if (dataType !== "boolean") {
|
|
96979
|
-
return invalidSchemaResponseWithError
|
|
97426
|
+
return invalidSchemaResponseWithError(incorrectTypeError("boolean", dataType, path));
|
|
96980
97427
|
}
|
|
96981
97428
|
} else if (schemaDataType === "null") {
|
|
96982
97429
|
if (data !== null) {
|
|
96983
|
-
return invalidSchemaResponseWithError
|
|
97430
|
+
return invalidSchemaResponseWithError(incorrectTypeError("null", dataType, path));
|
|
96984
97431
|
}
|
|
96985
97432
|
} else {
|
|
96986
|
-
return invalidSchemaResponseWithError
|
|
96987
|
-
new IncorrectTypeError
|
|
97433
|
+
return invalidSchemaResponseWithError(
|
|
97434
|
+
new IncorrectTypeError(`Unknown schema data type: ${schemaDataType}.`)
|
|
96988
97435
|
);
|
|
96989
97436
|
}
|
|
96990
|
-
return validSchemaResponse
|
|
97437
|
+
return validSchemaResponse();
|
|
96991
97438
|
}
|
|
96992
|
-
function validateRef
|
|
97439
|
+
function validateRef(data, schema, path, document, visited) {
|
|
96993
97440
|
if (!schema.$ref.startsWith("#")) {
|
|
96994
|
-
return invalidSchemaResponseWithError
|
|
96995
|
-
new InvalidRefError
|
|
97441
|
+
return invalidSchemaResponseWithError(
|
|
97442
|
+
new InvalidRefError(
|
|
96996
97443
|
`$ref values that do not refer to the current document are unsupported (must start with '#')`
|
|
96997
97444
|
)
|
|
96998
97445
|
);
|
|
96999
97446
|
}
|
|
97447
|
+
let refsForData = visited.get(data);
|
|
97448
|
+
if (refsForData !== void 0 && refsForData.has(schema.$ref)) {
|
|
97449
|
+
return validSchemaResponse();
|
|
97450
|
+
}
|
|
97451
|
+
if (refsForData === void 0) {
|
|
97452
|
+
refsForData = /* @__PURE__ */ new Set();
|
|
97453
|
+
visited.set(data, refsForData);
|
|
97454
|
+
}
|
|
97455
|
+
refsForData.add(schema.$ref);
|
|
97000
97456
|
try {
|
|
97001
|
-
const schemaToValidate = findSchemaAtPath
|
|
97002
|
-
return
|
|
97457
|
+
const schemaToValidate = findSchemaAtPath(document, schema.$ref);
|
|
97458
|
+
return validateJsonSchemaInternal(data, schemaToValidate, path, document, visited);
|
|
97003
97459
|
} catch (e) {
|
|
97004
|
-
return invalidSchemaResponseWithError
|
|
97460
|
+
return invalidSchemaResponseWithError(e);
|
|
97461
|
+
} finally {
|
|
97462
|
+
refsForData.delete(schema.$ref);
|
|
97463
|
+
if (refsForData.size === 0) visited.delete(data);
|
|
97005
97464
|
}
|
|
97006
97465
|
}
|
|
97007
|
-
function validateEnum
|
|
97466
|
+
function validateEnum(data, enumValue, path) {
|
|
97008
97467
|
if (!enumValue.some((value) => deepEquals$1(value, data))) {
|
|
97009
|
-
return invalidSchemaResponseWithError
|
|
97010
|
-
new JsonSchemaViolationError
|
|
97468
|
+
return invalidSchemaResponseWithError(
|
|
97469
|
+
new JsonSchemaViolationError(
|
|
97011
97470
|
`Data at ${path} did not match any values in enum. Expected value in: [${enumValue.map((value) => stringify$2(value)).join()}]`
|
|
97012
97471
|
)
|
|
97013
97472
|
);
|
|
97014
97473
|
}
|
|
97015
|
-
return validSchemaResponse
|
|
97474
|
+
return validSchemaResponse();
|
|
97016
97475
|
}
|
|
97017
|
-
function validateConst
|
|
97476
|
+
function validateConst(data, constValue, path) {
|
|
97018
97477
|
if (!deepEquals$1(constValue, data)) {
|
|
97019
|
-
return invalidSchemaResponseWithError
|
|
97020
|
-
new JsonSchemaViolationError
|
|
97478
|
+
return invalidSchemaResponseWithError(
|
|
97479
|
+
new JsonSchemaViolationError(
|
|
97021
97480
|
`Data at ${path} did not match const. Expected: ${stringify$2(constValue)}`
|
|
97022
97481
|
)
|
|
97023
97482
|
);
|
|
97024
97483
|
}
|
|
97025
|
-
return validSchemaResponse
|
|
97484
|
+
return validSchemaResponse();
|
|
97026
97485
|
}
|
|
97027
|
-
function findSchemaAtPath
|
|
97486
|
+
function findSchemaAtPath(document, ref) {
|
|
97028
97487
|
if (ref === "#") return document;
|
|
97029
97488
|
const keys = ref.replace(/^#\//, "").split("/");
|
|
97030
97489
|
let current = document;
|
|
@@ -97032,7 +97491,7 @@ function findSchemaAtPath$1(document, ref) {
|
|
|
97032
97491
|
for (const key of keys) {
|
|
97033
97492
|
path = `${path}/${key}`;
|
|
97034
97493
|
if (current[key] === void 0) {
|
|
97035
|
-
throw new InvalidRefError
|
|
97494
|
+
throw new InvalidRefError(
|
|
97036
97495
|
`Invalid $ref value '${ref}'. Cannot find target schema at '${path}'`
|
|
97037
97496
|
);
|
|
97038
97497
|
}
|
|
@@ -97077,7 +97536,7 @@ function logError(error) {
|
|
|
97077
97536
|
*/
|
|
97078
97537
|
function buildBaseImperativeInvoker(getCommand, transformResult) {
|
|
97079
97538
|
return async (...params) => {
|
|
97080
|
-
const command = getCommand({ params, assertIsValid
|
|
97539
|
+
const command = getCommand({ params, assertIsValid });
|
|
97081
97540
|
try {
|
|
97082
97541
|
return command.execute().then((result) => transformResult(result));
|
|
97083
97542
|
} catch (error) {
|
|
@@ -97217,7 +97676,7 @@ function buildServiceDescriptor$4() {
|
|
|
97217
97676
|
class LegacyImperativeBindingsService {
|
|
97218
97677
|
bind(getCommand) {
|
|
97219
97678
|
const invoke = async (config, requestContext, callback) => {
|
|
97220
|
-
const command = getCommand({ config, assertIsValid
|
|
97679
|
+
const command = getCommand({ config, assertIsValid });
|
|
97221
97680
|
try {
|
|
97222
97681
|
const overrides = getOverridesForLegacyRequestContext(requestContext);
|
|
97223
97682
|
const result = await command.execute(overrides);
|
|
@@ -97232,7 +97691,7 @@ class LegacyImperativeBindingsService {
|
|
|
97232
97691
|
}
|
|
97233
97692
|
};
|
|
97234
97693
|
const subscribe = (config, requestContext, callback) => {
|
|
97235
|
-
const command = getCommand({ config, assertIsValid
|
|
97694
|
+
const command = getCommand({ config, assertIsValid });
|
|
97236
97695
|
let unsubscribe = () => {
|
|
97237
97696
|
};
|
|
97238
97697
|
try {
|
|
@@ -97291,13 +97750,7 @@ class GraphQLImperativeBindingsService {
|
|
|
97291
97750
|
}
|
|
97292
97751
|
return await buildBaseImperativeInvoker(getCommand, (result) => this.transformResult(result, exposeRefresh))(...params);
|
|
97293
97752
|
} catch (error) {
|
|
97294
|
-
|
|
97295
|
-
return {
|
|
97296
|
-
data: void 0,
|
|
97297
|
-
errors: [
|
|
97298
|
-
{ message: "Internal error in GraphQL adapter occurred", locations: [] }
|
|
97299
|
-
]
|
|
97300
|
-
};
|
|
97753
|
+
return toGraphQLErrorResponse(error);
|
|
97301
97754
|
}
|
|
97302
97755
|
};
|
|
97303
97756
|
}
|
|
@@ -97391,8 +97844,8 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
97391
97844
|
config = result.value;
|
|
97392
97845
|
}
|
|
97393
97846
|
}
|
|
97394
|
-
const command = getCommand({ config, assertIsValid: assertIsValid$1 });
|
|
97395
97847
|
try {
|
|
97848
|
+
const command = getCommand({ config, assertIsValid });
|
|
97396
97849
|
const overrides = getOverridesForLegacyRequestContext(requestContext);
|
|
97397
97850
|
const result = await command.execute(overrides);
|
|
97398
97851
|
const consumerEmittedData = {
|
|
@@ -97409,13 +97862,7 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
97409
97862
|
}
|
|
97410
97863
|
callback(consumerEmittedData);
|
|
97411
97864
|
} catch (error) {
|
|
97412
|
-
|
|
97413
|
-
callback({
|
|
97414
|
-
data: void 0,
|
|
97415
|
-
errors: [
|
|
97416
|
-
{ message: "Internal error in GraphQL adapter occurred", locations: [] }
|
|
97417
|
-
]
|
|
97418
|
-
});
|
|
97865
|
+
callback(toGraphQLErrorResponse(error));
|
|
97419
97866
|
}
|
|
97420
97867
|
};
|
|
97421
97868
|
const subscribe = (config, requestContext, callback) => {
|
|
@@ -97433,35 +97880,41 @@ class GraphQLLegacyImperativeBindingsService {
|
|
|
97433
97880
|
config = result.value;
|
|
97434
97881
|
}
|
|
97435
97882
|
}
|
|
97436
|
-
const command = getCommand({ config, assertIsValid: assertIsValid$1 });
|
|
97437
97883
|
let unsubscribe = () => {
|
|
97438
97884
|
};
|
|
97439
|
-
|
|
97440
|
-
|
|
97441
|
-
const
|
|
97442
|
-
|
|
97443
|
-
|
|
97444
|
-
|
|
97445
|
-
|
|
97446
|
-
|
|
97447
|
-
|
|
97448
|
-
|
|
97449
|
-
|
|
97450
|
-
|
|
97451
|
-
|
|
97452
|
-
|
|
97453
|
-
|
|
97454
|
-
|
|
97455
|
-
|
|
97456
|
-
|
|
97457
|
-
|
|
97458
|
-
|
|
97459
|
-
|
|
97460
|
-
|
|
97461
|
-
|
|
97462
|
-
|
|
97463
|
-
|
|
97464
|
-
|
|
97885
|
+
try {
|
|
97886
|
+
const command = getCommand({ config, assertIsValid });
|
|
97887
|
+
const overrides = getOverridesForLegacyRequestContext(requestContext);
|
|
97888
|
+
command.execute(overrides).then((result) => {
|
|
97889
|
+
const consumerEmittedData = {
|
|
97890
|
+
data: void 0,
|
|
97891
|
+
errors: void 0
|
|
97892
|
+
};
|
|
97893
|
+
if (result.isOk()) {
|
|
97894
|
+
deepFreeze(result.value);
|
|
97895
|
+
consumerEmittedData.data = result.value.data.data;
|
|
97896
|
+
unsubscribe = result.value.subscribe(
|
|
97897
|
+
(res) => {
|
|
97898
|
+
handleEmit(res, callback);
|
|
97899
|
+
}
|
|
97900
|
+
);
|
|
97901
|
+
} else {
|
|
97902
|
+
const { data, errors } = toGraphQLResponseFromFailure$1(
|
|
97903
|
+
result.error.failure
|
|
97904
|
+
);
|
|
97905
|
+
consumerEmittedData.data = data;
|
|
97906
|
+
consumerEmittedData.errors = errors;
|
|
97907
|
+
unsubscribe = result.error.subscribe(
|
|
97908
|
+
(res) => {
|
|
97909
|
+
handleEmit(res, callback);
|
|
97910
|
+
}
|
|
97911
|
+
);
|
|
97912
|
+
}
|
|
97913
|
+
callback(consumerEmittedData);
|
|
97914
|
+
});
|
|
97915
|
+
} catch (error) {
|
|
97916
|
+
callback(toGraphQLErrorResponse(error));
|
|
97917
|
+
}
|
|
97465
97918
|
return () => {
|
|
97466
97919
|
unsubscribe();
|
|
97467
97920
|
};
|
|
@@ -97495,7 +97948,7 @@ class GraphQLMutationBindingsService {
|
|
|
97495
97948
|
params[0] = result2.value;
|
|
97496
97949
|
}
|
|
97497
97950
|
}
|
|
97498
|
-
const command = getCommand({ params, assertIsValid
|
|
97951
|
+
const command = getCommand({ params, assertIsValid });
|
|
97499
97952
|
const result = await command.execute({ cacheControlConfig: { type: "no-cache" } });
|
|
97500
97953
|
if (result.isOk()) {
|
|
97501
97954
|
deepFreeze(result.value);
|
|
@@ -97504,13 +97957,7 @@ class GraphQLMutationBindingsService {
|
|
|
97504
97957
|
return toGraphQLResponseFromFailure$1(result.error.failure);
|
|
97505
97958
|
}
|
|
97506
97959
|
} catch (error) {
|
|
97507
|
-
|
|
97508
|
-
return {
|
|
97509
|
-
data: void 0,
|
|
97510
|
-
errors: [
|
|
97511
|
-
{ message: "Internal error in GraphQL adapter occurred", locations: [] }
|
|
97512
|
-
]
|
|
97513
|
-
};
|
|
97960
|
+
return toGraphQLErrorResponse(error);
|
|
97514
97961
|
}
|
|
97515
97962
|
};
|
|
97516
97963
|
}
|
|
@@ -97578,8 +98025,8 @@ function sanitize(obj) {
|
|
|
97578
98025
|
return new Sanitizer(obj).sanitize();
|
|
97579
98026
|
}
|
|
97580
98027
|
function isIncompleteConfigError(err) {
|
|
97581
|
-
return err instanceof MissingRequiredPropertyError
|
|
97582
|
-
(validationError) => validationError instanceof MissingRequiredPropertyError
|
|
98028
|
+
return err instanceof MissingRequiredPropertyError || err instanceof JsonSchemaViolationError && err.validationErrors.find(
|
|
98029
|
+
(validationError) => validationError instanceof MissingRequiredPropertyError
|
|
97583
98030
|
) !== void 0;
|
|
97584
98031
|
}
|
|
97585
98032
|
class CommandWireAdapterConstructor {
|
|
@@ -97665,11 +98112,15 @@ class CommandWireAdapterConstructor {
|
|
|
97665
98112
|
}
|
|
97666
98113
|
if (this.configSchema) {
|
|
97667
98114
|
try {
|
|
97668
|
-
assertIsValid
|
|
98115
|
+
assertIsValid(this.config, this.configSchema);
|
|
97669
98116
|
} catch (err) {
|
|
97670
98117
|
if (isIncompleteConfigError(err)) {
|
|
97671
98118
|
return;
|
|
97672
98119
|
}
|
|
98120
|
+
if (err instanceof JsonSchemaViolationError) {
|
|
98121
|
+
this.handleConfigSchemaViolation(err);
|
|
98122
|
+
return;
|
|
98123
|
+
}
|
|
97673
98124
|
throw err;
|
|
97674
98125
|
}
|
|
97675
98126
|
}
|
|
@@ -97722,6 +98173,16 @@ class CommandWireAdapterConstructor {
|
|
|
97722
98173
|
handleExecutionThrow(error) {
|
|
97723
98174
|
emitError(this.callback, error);
|
|
97724
98175
|
}
|
|
98176
|
+
/**
|
|
98177
|
+
* Hook for subclasses to handle a JsonSchemaViolationError from the config
|
|
98178
|
+
* schema assertion. The default re-throws so legacy non-GraphQL wire
|
|
98179
|
+
* adapters keep their existing throw behavior. Overrides are expected to
|
|
98180
|
+
* either emit an error result or re-throw — silently returning will
|
|
98181
|
+
* swallow the error.
|
|
98182
|
+
*/
|
|
98183
|
+
handleConfigSchemaViolation(error) {
|
|
98184
|
+
throw error;
|
|
98185
|
+
}
|
|
97725
98186
|
unsubscribe() {
|
|
97726
98187
|
if (this.unsubscriber) {
|
|
97727
98188
|
this.unsubscriber();
|
|
@@ -97814,16 +98275,14 @@ class GraphQLCommandWireAdapterConstructor extends CommandWireAdapterConstructor
|
|
|
97814
98275
|
this.callback(consumerEmittedData);
|
|
97815
98276
|
}
|
|
97816
98277
|
} catch (e) {
|
|
97817
|
-
logError$1(e);
|
|
97818
98278
|
this.handleExecutionThrow(e);
|
|
97819
98279
|
}
|
|
97820
98280
|
}
|
|
97821
|
-
handleExecutionThrow(
|
|
97822
|
-
|
|
97823
|
-
|
|
97824
|
-
|
|
97825
|
-
|
|
97826
|
-
});
|
|
98281
|
+
handleExecutionThrow(error) {
|
|
98282
|
+
this.callback(toGraphQLErrorResponse(error));
|
|
98283
|
+
}
|
|
98284
|
+
handleConfigSchemaViolation(error) {
|
|
98285
|
+
this.handleExecutionThrow(error);
|
|
97827
98286
|
}
|
|
97828
98287
|
update(config, _context) {
|
|
97829
98288
|
this.unsubscribe();
|
|
@@ -98475,9 +98934,11 @@ class NimbusDurableCacheInclusionPolicy extends DurableCacheInclusionPolicy {
|
|
|
98475
98934
|
return entries.length > 0 ? this.store.setEntries(entries) : Promise.resolve();
|
|
98476
98935
|
}
|
|
98477
98936
|
find(_query) {
|
|
98937
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
98478
98938
|
throw new Error('find not supported on the NimbusDurableCacheInclusionPolicy');
|
|
98479
98939
|
}
|
|
98480
98940
|
findAndModify(_query, _cacheUpdate) {
|
|
98941
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
98481
98942
|
throw new Error('findAndModify not supported on the NimbusDurableCacheInclusionPolicy');
|
|
98482
98943
|
}
|
|
98483
98944
|
registerListener() {
|
|
@@ -98503,7 +98964,7 @@ class NimbusDurableCacheInclusionPolicy extends DurableCacheInclusionPolicy {
|
|
|
98503
98964
|
});
|
|
98504
98965
|
});
|
|
98505
98966
|
}
|
|
98506
|
-
// TODO: onestore doesnt support cache eviction yet
|
|
98967
|
+
// TODO [W-19368859]: onestore doesnt support cache eviction yet
|
|
98507
98968
|
// if (evictKeys.size > 0) {
|
|
98508
98969
|
// evictKeys.forEach((key) => {
|
|
98509
98970
|
// this.services.cache.evict(key);
|
|
@@ -98598,6 +99059,7 @@ class NimbusSqliteOneStoreCache {
|
|
|
98598
99059
|
batchQuery(operations) {
|
|
98599
99060
|
return new Promise((resolve, reject) => {
|
|
98600
99061
|
this.sqlStore.batchOperations(operations, (error) => {
|
|
99062
|
+
// eslint-disable-next-line no-unused-expressions
|
|
98601
99063
|
error ? reject(error) : resolve();
|
|
98602
99064
|
});
|
|
98603
99065
|
});
|
|
@@ -98673,7 +99135,7 @@ function initializeOneStore(sqliteStore, luvio) {
|
|
|
98673
99135
|
buildServiceDescriptor$7(),
|
|
98674
99136
|
buildServiceDescriptor$1$1(),
|
|
98675
99137
|
buildServiceDescriptor$2(),
|
|
98676
|
-
// TODO[
|
|
99138
|
+
// TODO [W-18753648]: See note above.
|
|
98677
99139
|
// buildStreamingCommandServiceDescriptor(),
|
|
98678
99140
|
// buildNdJsonServiceDescriptor(),
|
|
98679
99141
|
// buildSseCommandServiceDescriptor(),
|
|
@@ -98932,378 +99394,12 @@ register$1({
|
|
|
98932
99394
|
id: '@salesforce/lds-network-adapter',
|
|
98933
99395
|
instrument: instrument$2,
|
|
98934
99396
|
});
|
|
98935
|
-
// version: 1.
|
|
99397
|
+
// version: 1.435.0-5818ce3c48
|
|
98936
99398
|
|
|
98937
99399
|
const { create: create$2, keys: keys$2 } = Object;
|
|
98938
99400
|
const { stringify, parse } = JSON;
|
|
98939
99401
|
const { isArray: isArray$3 } = Array;
|
|
98940
99402
|
|
|
98941
|
-
/*!
|
|
98942
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
98943
|
-
* All rights reserved.
|
|
98944
|
-
* For full license text, see the LICENSE.txt file
|
|
98945
|
-
*/
|
|
98946
|
-
class JsonSchemaViolationError extends Error {
|
|
98947
|
-
constructor(message, validationErrors) {
|
|
98948
|
-
super(message);
|
|
98949
|
-
this.validationErrors = [];
|
|
98950
|
-
this.validationErrors = validationErrors || [];
|
|
98951
|
-
}
|
|
98952
|
-
}
|
|
98953
|
-
class MinItemsViolationError extends JsonSchemaViolationError {
|
|
98954
|
-
}
|
|
98955
|
-
class MaxItemsViolationError extends JsonSchemaViolationError {
|
|
98956
|
-
}
|
|
98957
|
-
class IncorrectTypeError extends JsonSchemaViolationError {
|
|
98958
|
-
}
|
|
98959
|
-
class AdditionalPropertiesError extends JsonSchemaViolationError {
|
|
98960
|
-
}
|
|
98961
|
-
class MissingRequiredPropertyError extends JsonSchemaViolationError {
|
|
98962
|
-
}
|
|
98963
|
-
class InvalidRefError extends JsonSchemaViolationError {
|
|
98964
|
-
}
|
|
98965
|
-
class JsonSchemaErrorCollector {
|
|
98966
|
-
constructor() {
|
|
98967
|
-
this.errors = [];
|
|
98968
|
-
}
|
|
98969
|
-
add(error) {
|
|
98970
|
-
this.errors.push(error);
|
|
98971
|
-
}
|
|
98972
|
-
append(response) {
|
|
98973
|
-
if (response.isErr()) {
|
|
98974
|
-
this.errors.push(...response.error);
|
|
98975
|
-
}
|
|
98976
|
-
}
|
|
98977
|
-
hasErrors() {
|
|
98978
|
-
return this.errors.length > 0;
|
|
98979
|
-
}
|
|
98980
|
-
prepend(error) {
|
|
98981
|
-
this.errors.unshift(error);
|
|
98982
|
-
}
|
|
98983
|
-
toValidationResponse() {
|
|
98984
|
-
return !this.hasErrors() ? ok$4(true) : err$4(this.errors);
|
|
98985
|
-
}
|
|
98986
|
-
}
|
|
98987
|
-
function createThrowableError(errors) {
|
|
98988
|
-
if (errors[0] instanceof MinItemsViolationError) {
|
|
98989
|
-
return new MinItemsViolationError(errors[0].message, errors);
|
|
98990
|
-
}
|
|
98991
|
-
if (errors[0] instanceof MaxItemsViolationError) {
|
|
98992
|
-
return new MaxItemsViolationError(errors[0].message, errors);
|
|
98993
|
-
}
|
|
98994
|
-
if (errors[0] instanceof IncorrectTypeError) {
|
|
98995
|
-
return new IncorrectTypeError(errors[0].message, errors);
|
|
98996
|
-
}
|
|
98997
|
-
if (errors[0] instanceof AdditionalPropertiesError) {
|
|
98998
|
-
return new AdditionalPropertiesError(errors[0].message, errors);
|
|
98999
|
-
}
|
|
99000
|
-
if (errors[0] instanceof MissingRequiredPropertyError) {
|
|
99001
|
-
return new MissingRequiredPropertyError(errors[0].message, errors);
|
|
99002
|
-
}
|
|
99003
|
-
if (errors[0] instanceof InvalidRefError) {
|
|
99004
|
-
return new InvalidRefError(errors[0].message, errors);
|
|
99005
|
-
}
|
|
99006
|
-
return new JsonSchemaViolationError(errors[0].message, errors);
|
|
99007
|
-
}
|
|
99008
|
-
function assertIsValid(data, schema) {
|
|
99009
|
-
const validationResponse = validateJsonSchema(data, schema);
|
|
99010
|
-
if (validationResponse.isErr()) {
|
|
99011
|
-
throw createThrowableError(validationResponse.error);
|
|
99012
|
-
}
|
|
99013
|
-
}
|
|
99014
|
-
function incorrectTypeError(expected, actual, path) {
|
|
99015
|
-
return new IncorrectTypeError(
|
|
99016
|
-
`Expected type ${expected} at path '${path}', found type ${actual}.`
|
|
99017
|
-
);
|
|
99018
|
-
}
|
|
99019
|
-
function validSchemaResponse() {
|
|
99020
|
-
return ok$4(true);
|
|
99021
|
-
}
|
|
99022
|
-
function invalidSchemaResponseWithError(error) {
|
|
99023
|
-
return err$4([error]);
|
|
99024
|
-
}
|
|
99025
|
-
function validateJsonSchema(data, schema, path = "$", document = schema) {
|
|
99026
|
-
if (schema === true) return validSchemaResponse();
|
|
99027
|
-
if (schema === false)
|
|
99028
|
-
return invalidSchemaResponseWithError(
|
|
99029
|
-
new JsonSchemaViolationError(`Data at ${path} has schema 'false'`)
|
|
99030
|
-
);
|
|
99031
|
-
const dataType = data === null ? "null" : Array.isArray(data) ? "array" : typeof data;
|
|
99032
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99033
|
-
if ("anyOf" in schema) {
|
|
99034
|
-
errorCollector.append(validateAnyOf(data, schema, path, document));
|
|
99035
|
-
} else if ("oneOf" in schema) {
|
|
99036
|
-
errorCollector.append(validateOneOf(data, schema, path, document));
|
|
99037
|
-
} else if ("allOf" in schema) {
|
|
99038
|
-
errorCollector.append(validateAllOf(data, schema, path, document));
|
|
99039
|
-
} else if ("not" in schema) {
|
|
99040
|
-
errorCollector.append(validateNot(data, schema, path, document));
|
|
99041
|
-
} else if ("$ref" in schema) {
|
|
99042
|
-
errorCollector.append(validateRef(data, schema, path, document));
|
|
99043
|
-
} else if ("type" in schema) {
|
|
99044
|
-
if (schema.type === "object") {
|
|
99045
|
-
if (dataType !== "object") {
|
|
99046
|
-
errorCollector.add(incorrectTypeError("object", dataType, path));
|
|
99047
|
-
} else {
|
|
99048
|
-
errorCollector.append(
|
|
99049
|
-
validateObject(data, schema, path, document)
|
|
99050
|
-
);
|
|
99051
|
-
}
|
|
99052
|
-
} else if (schema.type === "array") {
|
|
99053
|
-
if (dataType !== "array") {
|
|
99054
|
-
errorCollector.add(incorrectTypeError("array", dataType, path));
|
|
99055
|
-
} else {
|
|
99056
|
-
errorCollector.append(
|
|
99057
|
-
validateArray(data, schema, path, document)
|
|
99058
|
-
);
|
|
99059
|
-
}
|
|
99060
|
-
} else {
|
|
99061
|
-
errorCollector.append(
|
|
99062
|
-
validateScalar(data, schema, path)
|
|
99063
|
-
);
|
|
99064
|
-
}
|
|
99065
|
-
}
|
|
99066
|
-
if (schema.enum) {
|
|
99067
|
-
errorCollector.append(validateEnum(data, schema.enum, path));
|
|
99068
|
-
}
|
|
99069
|
-
if (schema.const) {
|
|
99070
|
-
errorCollector.append(validateConst(data, schema.const, path));
|
|
99071
|
-
}
|
|
99072
|
-
return errorCollector.toValidationResponse();
|
|
99073
|
-
}
|
|
99074
|
-
function validateAnyOf(data, schema, path, document) {
|
|
99075
|
-
let isValid = false;
|
|
99076
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99077
|
-
for (let i = 0, { length } = schema.anyOf; i < length; i++) {
|
|
99078
|
-
const element = schema.anyOf[i];
|
|
99079
|
-
const validationResponse = validateJsonSchema(
|
|
99080
|
-
data,
|
|
99081
|
-
element,
|
|
99082
|
-
`${path}.anyOf[${i}]`,
|
|
99083
|
-
document
|
|
99084
|
-
);
|
|
99085
|
-
if (validationResponse.isOk()) {
|
|
99086
|
-
isValid = true;
|
|
99087
|
-
break;
|
|
99088
|
-
} else {
|
|
99089
|
-
errorCollector.append(validationResponse);
|
|
99090
|
-
}
|
|
99091
|
-
}
|
|
99092
|
-
if (!isValid) {
|
|
99093
|
-
errorCollector.prepend(
|
|
99094
|
-
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in anyOf.`)
|
|
99095
|
-
);
|
|
99096
|
-
return errorCollector.toValidationResponse();
|
|
99097
|
-
}
|
|
99098
|
-
return validSchemaResponse();
|
|
99099
|
-
}
|
|
99100
|
-
function validateOneOf(data, schema, path, document) {
|
|
99101
|
-
let validSubShemaPaths = [];
|
|
99102
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99103
|
-
for (let i = 0, { length } = schema.oneOf; i < length; i++) {
|
|
99104
|
-
const element = schema.oneOf[i];
|
|
99105
|
-
const oneOfPath = `${path}.oneOf[${i}]`;
|
|
99106
|
-
const validationResponse = validateJsonSchema(data, element, oneOfPath, document);
|
|
99107
|
-
if (validationResponse.isOk()) {
|
|
99108
|
-
validSubShemaPaths.push(oneOfPath);
|
|
99109
|
-
} else {
|
|
99110
|
-
errorCollector.append(validationResponse);
|
|
99111
|
-
}
|
|
99112
|
-
}
|
|
99113
|
-
if (validSubShemaPaths.length === 0) {
|
|
99114
|
-
errorCollector.prepend(
|
|
99115
|
-
new JsonSchemaViolationError(`Data at ${path} did not match any subschema in oneOf.`)
|
|
99116
|
-
);
|
|
99117
|
-
return errorCollector.toValidationResponse();
|
|
99118
|
-
} else if (validSubShemaPaths.length > 1) {
|
|
99119
|
-
errorCollector.prepend(
|
|
99120
|
-
new JsonSchemaViolationError(
|
|
99121
|
-
`Data at ${path} matched multiple subschemas: [${validSubShemaPaths.join(", ")}].`
|
|
99122
|
-
)
|
|
99123
|
-
);
|
|
99124
|
-
return errorCollector.toValidationResponse();
|
|
99125
|
-
}
|
|
99126
|
-
return validSchemaResponse();
|
|
99127
|
-
}
|
|
99128
|
-
function validateAllOf(data, schema, path, document) {
|
|
99129
|
-
let isValid = true;
|
|
99130
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99131
|
-
for (let i = 0, { length } = schema.allOf; i < length; i++) {
|
|
99132
|
-
const element = schema.allOf[i];
|
|
99133
|
-
const validationResponse = validateJsonSchema(
|
|
99134
|
-
data,
|
|
99135
|
-
element,
|
|
99136
|
-
`${path}.allOf[${i}]`,
|
|
99137
|
-
document
|
|
99138
|
-
);
|
|
99139
|
-
if (!validationResponse.isOk()) {
|
|
99140
|
-
errorCollector.append(validationResponse);
|
|
99141
|
-
isValid = false;
|
|
99142
|
-
}
|
|
99143
|
-
}
|
|
99144
|
-
if (!isValid) {
|
|
99145
|
-
errorCollector.prepend(
|
|
99146
|
-
new JsonSchemaViolationError(`Data at ${path} did not match some subschemas in allOf.`)
|
|
99147
|
-
);
|
|
99148
|
-
}
|
|
99149
|
-
return errorCollector.toValidationResponse();
|
|
99150
|
-
}
|
|
99151
|
-
function validateNot(data, schema, path, document) {
|
|
99152
|
-
const validationResponse = validateJsonSchema(data, schema.not, path, document);
|
|
99153
|
-
if (validationResponse.isOk()) {
|
|
99154
|
-
return invalidSchemaResponseWithError(
|
|
99155
|
-
new JsonSchemaViolationError(
|
|
99156
|
-
`Data at ${path} validated against the schema of a not clause.`
|
|
99157
|
-
)
|
|
99158
|
-
);
|
|
99159
|
-
}
|
|
99160
|
-
return validSchemaResponse();
|
|
99161
|
-
}
|
|
99162
|
-
function validateObject(data, schema, path, document) {
|
|
99163
|
-
const schemaKeys = Object.keys(schema.properties);
|
|
99164
|
-
const requiredKeys = new Set(schema.required);
|
|
99165
|
-
const schemaKeySet = new Set(schemaKeys);
|
|
99166
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99167
|
-
Object.keys(data).forEach((key) => {
|
|
99168
|
-
if (!schemaKeySet.has(key)) {
|
|
99169
|
-
errorCollector.append(
|
|
99170
|
-
validateJsonSchema(
|
|
99171
|
-
data[key],
|
|
99172
|
-
schema.additionalProperties,
|
|
99173
|
-
`${path}.additionalProperties[${key}]`,
|
|
99174
|
-
document
|
|
99175
|
-
)
|
|
99176
|
-
);
|
|
99177
|
-
}
|
|
99178
|
-
});
|
|
99179
|
-
for (let i = 0, length = schemaKeys.length; i < length; i++) {
|
|
99180
|
-
const key = schemaKeys[i];
|
|
99181
|
-
const keyInData = key in data && data[key] !== void 0;
|
|
99182
|
-
if (requiredKeys.has(key) && !keyInData) {
|
|
99183
|
-
errorCollector.add(
|
|
99184
|
-
new MissingRequiredPropertyError(
|
|
99185
|
-
`Object at path '${path}' is missing required property '${key}'.`
|
|
99186
|
-
)
|
|
99187
|
-
);
|
|
99188
|
-
}
|
|
99189
|
-
if (keyInData) {
|
|
99190
|
-
errorCollector.append(
|
|
99191
|
-
validateJsonSchema(
|
|
99192
|
-
data[key],
|
|
99193
|
-
schema.properties[key],
|
|
99194
|
-
`${path}.${key}`,
|
|
99195
|
-
document
|
|
99196
|
-
)
|
|
99197
|
-
);
|
|
99198
|
-
}
|
|
99199
|
-
}
|
|
99200
|
-
return errorCollector.toValidationResponse();
|
|
99201
|
-
}
|
|
99202
|
-
function validateArray(data, schema, path, document) {
|
|
99203
|
-
if (schema.minItems !== void 0 && data.length < schema.minItems) {
|
|
99204
|
-
return invalidSchemaResponseWithError(
|
|
99205
|
-
new MinItemsViolationError(
|
|
99206
|
-
`Array at path '${path}' fails minItems constraint. Has ${data.length} items, needs at least ${schema.minItems}.`
|
|
99207
|
-
)
|
|
99208
|
-
);
|
|
99209
|
-
}
|
|
99210
|
-
if (schema.maxItems !== void 0 && data.length > schema.maxItems) {
|
|
99211
|
-
return invalidSchemaResponseWithError(
|
|
99212
|
-
new MaxItemsViolationError(
|
|
99213
|
-
`Array at path '${path}' fails maxItems constraint. Has ${data.length} items, needs at most ${schema.maxItems}.`
|
|
99214
|
-
)
|
|
99215
|
-
);
|
|
99216
|
-
}
|
|
99217
|
-
const errorCollector = new JsonSchemaErrorCollector();
|
|
99218
|
-
data.forEach(
|
|
99219
|
-
(element, index) => errorCollector.append(
|
|
99220
|
-
validateJsonSchema(element, schema.items, `${path}[${index}]`, document)
|
|
99221
|
-
)
|
|
99222
|
-
);
|
|
99223
|
-
return errorCollector.toValidationResponse();
|
|
99224
|
-
}
|
|
99225
|
-
function validateScalar(data, schema, path) {
|
|
99226
|
-
const schemaDataType = schema.type;
|
|
99227
|
-
const dataType = typeof data;
|
|
99228
|
-
if (schemaDataType === "integer") {
|
|
99229
|
-
if (dataType !== "number" || !Number.isInteger(data)) {
|
|
99230
|
-
return invalidSchemaResponseWithError(incorrectTypeError("integer", dataType, path));
|
|
99231
|
-
}
|
|
99232
|
-
} else if (schemaDataType === "number") {
|
|
99233
|
-
if (dataType !== "number") {
|
|
99234
|
-
return invalidSchemaResponseWithError(incorrectTypeError("number", dataType, path));
|
|
99235
|
-
}
|
|
99236
|
-
} else if (schemaDataType === "string") {
|
|
99237
|
-
if (dataType !== "string") {
|
|
99238
|
-
return invalidSchemaResponseWithError(incorrectTypeError("string", dataType, path));
|
|
99239
|
-
}
|
|
99240
|
-
} else if (schemaDataType === "boolean") {
|
|
99241
|
-
if (dataType !== "boolean") {
|
|
99242
|
-
return invalidSchemaResponseWithError(incorrectTypeError("boolean", dataType, path));
|
|
99243
|
-
}
|
|
99244
|
-
} else if (schemaDataType === "null") {
|
|
99245
|
-
if (data !== null) {
|
|
99246
|
-
return invalidSchemaResponseWithError(incorrectTypeError("null", dataType, path));
|
|
99247
|
-
}
|
|
99248
|
-
} else {
|
|
99249
|
-
return invalidSchemaResponseWithError(
|
|
99250
|
-
new IncorrectTypeError(`Unknown schema data type: ${schemaDataType}.`)
|
|
99251
|
-
);
|
|
99252
|
-
}
|
|
99253
|
-
return validSchemaResponse();
|
|
99254
|
-
}
|
|
99255
|
-
function validateRef(data, schema, path, document) {
|
|
99256
|
-
if (!schema.$ref.startsWith("#")) {
|
|
99257
|
-
return invalidSchemaResponseWithError(
|
|
99258
|
-
new InvalidRefError(
|
|
99259
|
-
`$ref values that do not refer to the current document are unsupported (must start with '#')`
|
|
99260
|
-
)
|
|
99261
|
-
);
|
|
99262
|
-
}
|
|
99263
|
-
try {
|
|
99264
|
-
const schemaToValidate = findSchemaAtPath(document, schema.$ref);
|
|
99265
|
-
return validateJsonSchema(data, schemaToValidate, path, document);
|
|
99266
|
-
} catch (e) {
|
|
99267
|
-
return invalidSchemaResponseWithError(e);
|
|
99268
|
-
}
|
|
99269
|
-
}
|
|
99270
|
-
function validateEnum(data, enumValue, path) {
|
|
99271
|
-
if (!enumValue.some((value) => deepEquals$2(value, data))) {
|
|
99272
|
-
return invalidSchemaResponseWithError(
|
|
99273
|
-
new JsonSchemaViolationError(
|
|
99274
|
-
`Data at ${path} did not match any values in enum. Expected value in: [${enumValue.map((value) => stringify$9(value)).join()}]`
|
|
99275
|
-
)
|
|
99276
|
-
);
|
|
99277
|
-
}
|
|
99278
|
-
return validSchemaResponse();
|
|
99279
|
-
}
|
|
99280
|
-
function validateConst(data, constValue, path) {
|
|
99281
|
-
if (!deepEquals$2(constValue, data)) {
|
|
99282
|
-
return invalidSchemaResponseWithError(
|
|
99283
|
-
new JsonSchemaViolationError(
|
|
99284
|
-
`Data at ${path} did not match const. Expected: ${stringify$9(constValue)}`
|
|
99285
|
-
)
|
|
99286
|
-
);
|
|
99287
|
-
}
|
|
99288
|
-
return validSchemaResponse();
|
|
99289
|
-
}
|
|
99290
|
-
function findSchemaAtPath(document, ref) {
|
|
99291
|
-
if (ref === "#") return document;
|
|
99292
|
-
const keys = ref.replace(/^#\//, "").split("/");
|
|
99293
|
-
let current = document;
|
|
99294
|
-
let path = "#";
|
|
99295
|
-
for (const key of keys) {
|
|
99296
|
-
path = `${path}/${key}`;
|
|
99297
|
-
if (current[key] === void 0) {
|
|
99298
|
-
throw new InvalidRefError(
|
|
99299
|
-
`Invalid $ref value '${ref}'. Cannot find target schema at '${path}'`
|
|
99300
|
-
);
|
|
99301
|
-
}
|
|
99302
|
-
current = current[key];
|
|
99303
|
-
}
|
|
99304
|
-
return current;
|
|
99305
|
-
}
|
|
99306
|
-
|
|
99307
99403
|
/*!
|
|
99308
99404
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
99309
99405
|
* All rights reserved.
|
|
@@ -99352,35 +99448,35 @@ function extractValue(valueNode, variableDefinitions, expectedType) {
|
|
|
99352
99448
|
function extractVariableValue(variableName, variableDefinitions) {
|
|
99353
99449
|
const variable = variableDefinitions[variableName];
|
|
99354
99450
|
if (!variable) {
|
|
99355
|
-
return err$
|
|
99451
|
+
return err$3(
|
|
99356
99452
|
new Error(`Variable '${variableName}' was used in the query but was not defined`)
|
|
99357
99453
|
);
|
|
99358
99454
|
}
|
|
99359
99455
|
if (variable.value !== void 0) {
|
|
99360
|
-
return ok$
|
|
99456
|
+
return ok$3(variable.value);
|
|
99361
99457
|
}
|
|
99362
99458
|
if (variable.definition.defaultValue) {
|
|
99363
99459
|
return extractValue(variable.definition.defaultValue, variableDefinitions);
|
|
99364
99460
|
}
|
|
99365
|
-
return ok$
|
|
99461
|
+
return ok$3(void 0);
|
|
99366
99462
|
}
|
|
99367
99463
|
function validateExpectedType(value, expectedType) {
|
|
99368
99464
|
if (!expectedType) {
|
|
99369
|
-
return ok$
|
|
99465
|
+
return ok$3(value);
|
|
99370
99466
|
}
|
|
99371
99467
|
if (value === null) {
|
|
99372
99468
|
if (expectedType.nullable) {
|
|
99373
|
-
return ok$
|
|
99469
|
+
return ok$3(value);
|
|
99374
99470
|
} else {
|
|
99375
|
-
return err$
|
|
99471
|
+
return err$3(new Error(`Expected ${expectedType.type}, but got null`));
|
|
99376
99472
|
}
|
|
99377
99473
|
}
|
|
99378
99474
|
const actualType = typeof value;
|
|
99379
99475
|
if (actualType === expectedType.type) {
|
|
99380
|
-
return ok$
|
|
99476
|
+
return ok$3(value);
|
|
99381
99477
|
}
|
|
99382
99478
|
const expectedTypeString = expectedType.nullable ? `${expectedType.type} | null` : expectedType.type;
|
|
99383
|
-
return err$
|
|
99479
|
+
return err$3(
|
|
99384
99480
|
new Error(`Expected ${expectedTypeString}, but got ${actualType}: ${JSON.stringify(value)}`)
|
|
99385
99481
|
);
|
|
99386
99482
|
}
|
|
@@ -99423,10 +99519,10 @@ function findExecutableOperation(input) {
|
|
|
99423
99519
|
(def) => def.kind === Kind$1.OPERATION_DEFINITION
|
|
99424
99520
|
);
|
|
99425
99521
|
if (operations.length === 0) {
|
|
99426
|
-
return err$
|
|
99522
|
+
return err$3(new Error("No operations found in query"));
|
|
99427
99523
|
}
|
|
99428
99524
|
if (operations.length === 1 && !input.operationName) {
|
|
99429
|
-
return ok$
|
|
99525
|
+
return ok$3(operations[0]);
|
|
99430
99526
|
}
|
|
99431
99527
|
if (input.operationName) {
|
|
99432
99528
|
const specifiedOperation = operations.find((op) => {
|
|
@@ -99434,16 +99530,16 @@ function findExecutableOperation(input) {
|
|
|
99434
99530
|
return ((_a = op.name) == null ? void 0 : _a.value) === input.operationName;
|
|
99435
99531
|
});
|
|
99436
99532
|
if (specifiedOperation) {
|
|
99437
|
-
return ok$
|
|
99533
|
+
return ok$3(specifiedOperation);
|
|
99438
99534
|
}
|
|
99439
|
-
return err$
|
|
99535
|
+
return err$3(new Error(`Operation "${input.operationName}" not found in query`));
|
|
99440
99536
|
}
|
|
99441
|
-
return err$
|
|
99537
|
+
return err$3(new Error("Multiple operations found in query, and no operation name provided"));
|
|
99442
99538
|
}
|
|
99443
99539
|
function buildGraphQLInputExtension(input) {
|
|
99444
99540
|
const operationResult = findExecutableOperation(input);
|
|
99445
99541
|
if (operationResult.isErr()) {
|
|
99446
|
-
return err$
|
|
99542
|
+
return err$3(operationResult.error);
|
|
99447
99543
|
}
|
|
99448
99544
|
const operation = operationResult.value;
|
|
99449
99545
|
const selections = operation.selectionSet.selections;
|
|
@@ -99460,7 +99556,7 @@ function buildGraphQLInputExtension(input) {
|
|
|
99460
99556
|
prev[fragment.name.value] = fragment;
|
|
99461
99557
|
return prev;
|
|
99462
99558
|
}, {});
|
|
99463
|
-
return ok$
|
|
99559
|
+
return ok$3({
|
|
99464
99560
|
selections,
|
|
99465
99561
|
request: { definitions: { variables, fragments } },
|
|
99466
99562
|
parentFieldSelection: void 0
|
|
@@ -99618,13 +99714,13 @@ function collectFieldNames(selections, fragments) {
|
|
|
99618
99714
|
}
|
|
99619
99715
|
function buildFieldKey(canonicalFieldName, fieldArguments, variables) {
|
|
99620
99716
|
if (fieldArguments === void 0 || fieldArguments.length === 0) {
|
|
99621
|
-
return ok$
|
|
99717
|
+
return ok$3(canonicalFieldName);
|
|
99622
99718
|
}
|
|
99623
99719
|
const formattedArguments = {};
|
|
99624
99720
|
for (const arg of fieldArguments) {
|
|
99625
99721
|
const result = extractValue(arg.value, variables);
|
|
99626
99722
|
if (result.isErr()) {
|
|
99627
|
-
return err$
|
|
99723
|
+
return err$3(
|
|
99628
99724
|
new Error(
|
|
99629
99725
|
`Failed to extract argument '${arg.name.value}' for field '${canonicalFieldName}': ${result.error.message}`
|
|
99630
99726
|
)
|
|
@@ -99632,7 +99728,7 @@ function buildFieldKey(canonicalFieldName, fieldArguments, variables) {
|
|
|
99632
99728
|
}
|
|
99633
99729
|
formattedArguments[arg.name.value] = result.value;
|
|
99634
99730
|
}
|
|
99635
|
-
return ok$
|
|
99731
|
+
return ok$3(`${canonicalFieldName}::${stableJSONStringify$3({ args: formattedArguments })}`);
|
|
99636
99732
|
}
|
|
99637
99733
|
({
|
|
99638
99734
|
kind: Kind$1.FIELD,
|
|
@@ -99657,17 +99753,17 @@ function extractIfArgument(directive, variables, directiveName) {
|
|
|
99657
99753
|
var _a;
|
|
99658
99754
|
const ifArg = (_a = directive.arguments) == null ? void 0 : _a.find((arg) => arg.name.value === "if");
|
|
99659
99755
|
if (!ifArg) {
|
|
99660
|
-
return err$
|
|
99756
|
+
return err$3(new Error(`@${directiveName} directive requires an 'if' argument`));
|
|
99661
99757
|
}
|
|
99662
99758
|
const result = extractValue(ifArg.value, variables, { type: "boolean", nullable: false });
|
|
99663
99759
|
if (result.isErr()) {
|
|
99664
|
-
return err$
|
|
99760
|
+
return err$3(result.error);
|
|
99665
99761
|
}
|
|
99666
|
-
return ok$
|
|
99762
|
+
return ok$3(result.value);
|
|
99667
99763
|
}
|
|
99668
99764
|
function shouldSkip(selection, variables) {
|
|
99669
99765
|
if (!selection.directives || selection.directives.length === 0) {
|
|
99670
|
-
return ok$
|
|
99766
|
+
return ok$3(false);
|
|
99671
99767
|
}
|
|
99672
99768
|
for (const directive of selection.directives) {
|
|
99673
99769
|
if (directive.name.value === "skip") {
|
|
@@ -99676,7 +99772,7 @@ function shouldSkip(selection, variables) {
|
|
|
99676
99772
|
return ifResult;
|
|
99677
99773
|
}
|
|
99678
99774
|
if (ifResult.value === true) {
|
|
99679
|
-
return ok$
|
|
99775
|
+
return ok$3(true);
|
|
99680
99776
|
}
|
|
99681
99777
|
}
|
|
99682
99778
|
if (directive.name.value === "include") {
|
|
@@ -99685,11 +99781,11 @@ function shouldSkip(selection, variables) {
|
|
|
99685
99781
|
return ifResult;
|
|
99686
99782
|
}
|
|
99687
99783
|
if (ifResult.value === false) {
|
|
99688
|
-
return ok$
|
|
99784
|
+
return ok$3(true);
|
|
99689
99785
|
}
|
|
99690
99786
|
}
|
|
99691
99787
|
}
|
|
99692
|
-
return ok$
|
|
99788
|
+
return ok$3(false);
|
|
99693
99789
|
}
|
|
99694
99790
|
class BaseScalarFieldDef {
|
|
99695
99791
|
constructor(nullable) {
|
|
@@ -99697,11 +99793,11 @@ class BaseScalarFieldDef {
|
|
|
99697
99793
|
}
|
|
99698
99794
|
write(_cache, input) {
|
|
99699
99795
|
if (input.data === void 0) {
|
|
99700
|
-
return ok$
|
|
99796
|
+
return ok$3({ type: "missing" });
|
|
99701
99797
|
}
|
|
99702
99798
|
if (input.data === null) {
|
|
99703
99799
|
if (!this.nullable) {
|
|
99704
|
-
return err$
|
|
99800
|
+
return err$3([
|
|
99705
99801
|
{
|
|
99706
99802
|
type: "unknown",
|
|
99707
99803
|
error: new Error(
|
|
@@ -99711,14 +99807,14 @@ class BaseScalarFieldDef {
|
|
|
99711
99807
|
]);
|
|
99712
99808
|
}
|
|
99713
99809
|
}
|
|
99714
|
-
return ok$
|
|
99810
|
+
return ok$3({ type: "data", data: input.data });
|
|
99715
99811
|
}
|
|
99716
99812
|
read(_cache, input) {
|
|
99717
99813
|
const normalizedData = input.normalizedData;
|
|
99718
99814
|
if (normalizedData.type === "missing") {
|
|
99719
|
-
return ok$
|
|
99815
|
+
return ok$3(void 0);
|
|
99720
99816
|
}
|
|
99721
|
-
return ok$
|
|
99817
|
+
return ok$3(normalizedData.data);
|
|
99722
99818
|
}
|
|
99723
99819
|
augmentSelections(input) {
|
|
99724
99820
|
return input;
|
|
@@ -99740,11 +99836,11 @@ class BaseArrayFieldDef {
|
|
|
99740
99836
|
}
|
|
99741
99837
|
write(cache, input) {
|
|
99742
99838
|
if (input.data === void 0) {
|
|
99743
|
-
return ok$
|
|
99839
|
+
return ok$3({ type: "missing" });
|
|
99744
99840
|
}
|
|
99745
99841
|
if (input.data === null) {
|
|
99746
99842
|
if (!this.nullable) {
|
|
99747
|
-
return err$
|
|
99843
|
+
return err$3([
|
|
99748
99844
|
{
|
|
99749
99845
|
type: "unknown",
|
|
99750
99846
|
error: new Error(
|
|
@@ -99753,10 +99849,10 @@ class BaseArrayFieldDef {
|
|
|
99753
99849
|
}
|
|
99754
99850
|
]);
|
|
99755
99851
|
}
|
|
99756
|
-
return ok$
|
|
99852
|
+
return ok$3({ type: "data", data: input.data });
|
|
99757
99853
|
}
|
|
99758
99854
|
if (!Array.isArray(input.data)) {
|
|
99759
|
-
return err$
|
|
99855
|
+
return err$3([
|
|
99760
99856
|
{
|
|
99761
99857
|
type: "unknown",
|
|
99762
99858
|
error: new Error(
|
|
@@ -99784,18 +99880,18 @@ class BaseArrayFieldDef {
|
|
|
99784
99880
|
}
|
|
99785
99881
|
});
|
|
99786
99882
|
if (arrayNormalizationErrors.length > 0) {
|
|
99787
|
-
return err$
|
|
99883
|
+
return err$3(arrayNormalizationErrors);
|
|
99788
99884
|
}
|
|
99789
|
-
return ok$
|
|
99885
|
+
return ok$3({ type: "data", data: normalizedArray });
|
|
99790
99886
|
}
|
|
99791
99887
|
read(cache, input) {
|
|
99792
99888
|
const normalizedData = input.normalizedData;
|
|
99793
99889
|
if (normalizedData.type === "missing") {
|
|
99794
|
-
return ok$
|
|
99890
|
+
return ok$3(void 0);
|
|
99795
99891
|
}
|
|
99796
99892
|
if (normalizedData.data === null) {
|
|
99797
99893
|
if (!this.nullable) {
|
|
99798
|
-
return err$
|
|
99894
|
+
return err$3([
|
|
99799
99895
|
{
|
|
99800
99896
|
type: "unknown",
|
|
99801
99897
|
error: new Error(
|
|
@@ -99804,10 +99900,10 @@ class BaseArrayFieldDef {
|
|
|
99804
99900
|
}
|
|
99805
99901
|
]);
|
|
99806
99902
|
}
|
|
99807
|
-
return ok$
|
|
99903
|
+
return ok$3({ type: "data", data: null });
|
|
99808
99904
|
}
|
|
99809
99905
|
if (!Array.isArray(normalizedData.data)) {
|
|
99810
|
-
return err$
|
|
99906
|
+
return err$3([
|
|
99811
99907
|
{
|
|
99812
99908
|
type: "unknown",
|
|
99813
99909
|
error: new Error(
|
|
@@ -99832,9 +99928,9 @@ class BaseArrayFieldDef {
|
|
|
99832
99928
|
}
|
|
99833
99929
|
});
|
|
99834
99930
|
if (arrayDenormalizationErrors.length > 0) {
|
|
99835
|
-
return err$
|
|
99931
|
+
return err$3(arrayDenormalizationErrors);
|
|
99836
99932
|
}
|
|
99837
|
-
return ok$
|
|
99933
|
+
return ok$3(denormalizedArray);
|
|
99838
99934
|
}
|
|
99839
99935
|
}
|
|
99840
99936
|
class BaseObjectFieldDef {
|
|
@@ -99851,7 +99947,7 @@ class BaseObjectFieldDef {
|
|
|
99851
99947
|
write(cache, input) {
|
|
99852
99948
|
var _a;
|
|
99853
99949
|
if (!input.selection.selectionSet) {
|
|
99854
|
-
return err$
|
|
99950
|
+
return err$3([
|
|
99855
99951
|
{
|
|
99856
99952
|
type: "unknown",
|
|
99857
99953
|
error: new Error(
|
|
@@ -99861,11 +99957,11 @@ class BaseObjectFieldDef {
|
|
|
99861
99957
|
]);
|
|
99862
99958
|
}
|
|
99863
99959
|
if (input.data === void 0) {
|
|
99864
|
-
return ok$
|
|
99960
|
+
return ok$3({ type: "missing" });
|
|
99865
99961
|
}
|
|
99866
99962
|
if (input.data === null) {
|
|
99867
99963
|
if (!this.nullable) {
|
|
99868
|
-
return err$
|
|
99964
|
+
return err$3([
|
|
99869
99965
|
{
|
|
99870
99966
|
type: "unknown",
|
|
99871
99967
|
error: new Error(
|
|
@@ -99874,7 +99970,7 @@ class BaseObjectFieldDef {
|
|
|
99874
99970
|
}
|
|
99875
99971
|
]);
|
|
99876
99972
|
}
|
|
99877
|
-
return ok$
|
|
99973
|
+
return ok$3({ type: "data", data: null });
|
|
99878
99974
|
}
|
|
99879
99975
|
const writeResult = this.repository.write(cache, {
|
|
99880
99976
|
...input,
|
|
@@ -99887,12 +99983,12 @@ class BaseObjectFieldDef {
|
|
|
99887
99983
|
if (writeResult.isErr()) {
|
|
99888
99984
|
return writeResult;
|
|
99889
99985
|
}
|
|
99890
|
-
return ok$
|
|
99986
|
+
return ok$3({ type: "data", data: writeResult.value });
|
|
99891
99987
|
}
|
|
99892
99988
|
read(cache, input) {
|
|
99893
99989
|
var _a;
|
|
99894
99990
|
if (!input.selection.selectionSet) {
|
|
99895
|
-
return err$
|
|
99991
|
+
return err$3([
|
|
99896
99992
|
{
|
|
99897
99993
|
type: "unknown",
|
|
99898
99994
|
error: new Error(
|
|
@@ -99903,11 +99999,11 @@ class BaseObjectFieldDef {
|
|
|
99903
99999
|
}
|
|
99904
100000
|
const normalizedData = input.normalizedData;
|
|
99905
100001
|
if (normalizedData.type === "missing") {
|
|
99906
|
-
return ok$
|
|
100002
|
+
return ok$3(void 0);
|
|
99907
100003
|
}
|
|
99908
100004
|
if (normalizedData.data === null) {
|
|
99909
100005
|
if (!this.nullable) {
|
|
99910
|
-
return err$
|
|
100006
|
+
return err$3([
|
|
99911
100007
|
{
|
|
99912
100008
|
type: "unknown",
|
|
99913
100009
|
error: new Error(
|
|
@@ -99916,7 +100012,7 @@ class BaseObjectFieldDef {
|
|
|
99916
100012
|
}
|
|
99917
100013
|
]);
|
|
99918
100014
|
}
|
|
99919
|
-
return ok$
|
|
100015
|
+
return ok$3(null);
|
|
99920
100016
|
}
|
|
99921
100017
|
return this.repository.read(cache, {
|
|
99922
100018
|
...input,
|
|
@@ -100199,7 +100295,7 @@ class BaseGraphQLTypeRepository {
|
|
|
100199
100295
|
var _a;
|
|
100200
100296
|
const fieldDef = this.getFieldDef(input, selection);
|
|
100201
100297
|
if (!fieldDef) {
|
|
100202
|
-
return err$
|
|
100298
|
+
return err$3(
|
|
100203
100299
|
new Error(
|
|
100204
100300
|
`Unknown field "${selection.name.value}" on type "${this.typeName}". Expected one of fields ${Object.keys(this.fields)}.`
|
|
100205
100301
|
)
|
|
@@ -100210,10 +100306,10 @@ class BaseGraphQLTypeRepository {
|
|
|
100210
100306
|
input.request.definitions.variables
|
|
100211
100307
|
);
|
|
100212
100308
|
if (cacheFieldKeyResult.isErr()) {
|
|
100213
|
-
return err$
|
|
100309
|
+
return err$3(cacheFieldKeyResult.error);
|
|
100214
100310
|
}
|
|
100215
100311
|
const cacheFieldKey = cacheFieldKeyResult.value;
|
|
100216
|
-
return ok$
|
|
100312
|
+
return ok$3((_a = input.existingNormalizedData || input.normalizedData) == null ? void 0 : _a[cacheFieldKey]);
|
|
100217
100313
|
}
|
|
100218
100314
|
denormalizeFieldSelection(cache, input, selection, errorCollector) {
|
|
100219
100315
|
var _a;
|
|
@@ -100319,22 +100415,22 @@ class BaseGraphQLTypeRepository {
|
|
|
100319
100415
|
return shouldSkipResult;
|
|
100320
100416
|
}
|
|
100321
100417
|
if (shouldSkipResult.value) {
|
|
100322
|
-
return ok$
|
|
100418
|
+
return ok$3(false);
|
|
100323
100419
|
}
|
|
100324
100420
|
return this.satisfiesFragmentTypeCondition(input, fragment);
|
|
100325
100421
|
}
|
|
100326
100422
|
satisfiesFragmentTypeCondition(_input, fragment) {
|
|
100327
100423
|
if (!fragment.typeCondition) {
|
|
100328
|
-
return ok$
|
|
100424
|
+
return ok$3(true);
|
|
100329
100425
|
}
|
|
100330
100426
|
const conditionalTypeName = fragment.typeCondition.name.value;
|
|
100331
100427
|
if (conditionalTypeName === this.typeName) {
|
|
100332
|
-
return ok$
|
|
100428
|
+
return ok$3(true);
|
|
100333
100429
|
}
|
|
100334
100430
|
if (this.implementedInterfaces.includes(conditionalTypeName)) {
|
|
100335
|
-
return ok$
|
|
100431
|
+
return ok$3(true);
|
|
100336
100432
|
}
|
|
100337
|
-
return ok$
|
|
100433
|
+
return ok$3(false);
|
|
100338
100434
|
}
|
|
100339
100435
|
getCacheKeyFieldArguments(selection) {
|
|
100340
100436
|
return selection.arguments;
|
|
@@ -100393,7 +100489,7 @@ class IdentifiableGraphQLTypeRepository extends IdentifiableTypeRepository {
|
|
|
100393
100489
|
const key = this.buildKey(this.buildKeyParams(input));
|
|
100394
100490
|
const normalized = this.normalizeData(cache, input);
|
|
100395
100491
|
if (normalized.isErr()) {
|
|
100396
|
-
return err$
|
|
100492
|
+
return err$3(normalized.error);
|
|
100397
100493
|
}
|
|
100398
100494
|
const existing = cache.get(key);
|
|
100399
100495
|
if (!deepEquals$2(existing == null ? void 0 : existing.value, normalized.value)) {
|
|
@@ -100402,7 +100498,7 @@ class IdentifiableGraphQLTypeRepository extends IdentifiableTypeRepository {
|
|
|
100402
100498
|
metadata: this.cacheMetadata
|
|
100403
100499
|
});
|
|
100404
100500
|
}
|
|
100405
|
-
return ok$
|
|
100501
|
+
return ok$3({
|
|
100406
100502
|
type: "link",
|
|
100407
100503
|
linkedKey: key
|
|
100408
100504
|
});
|
|
@@ -100417,7 +100513,7 @@ class IdentifiableGraphQLTypeRepository extends IdentifiableTypeRepository {
|
|
|
100417
100513
|
if (normalizeDataResult.isErr()) {
|
|
100418
100514
|
return normalizeDataResult;
|
|
100419
100515
|
}
|
|
100420
|
-
return ok$
|
|
100516
|
+
return ok$3(
|
|
100421
100517
|
deepMerge$2(
|
|
100422
100518
|
{},
|
|
100423
100519
|
(existingNormalizedData == null ? void 0 : existingNormalizedData.value) || {},
|
|
@@ -100487,7 +100583,7 @@ class GraphQLDocumentRootTypeRepository extends IdentifiableGraphQLTypeRepositor
|
|
|
100487
100583
|
if (result.isErr()) {
|
|
100488
100584
|
return result;
|
|
100489
100585
|
}
|
|
100490
|
-
return ok$
|
|
100586
|
+
return ok$3({
|
|
100491
100587
|
data: result.value
|
|
100492
100588
|
});
|
|
100493
100589
|
}
|
|
@@ -100495,7 +100591,7 @@ class GraphQLDocumentRootTypeRepository extends IdentifiableGraphQLTypeRepositor
|
|
|
100495
100591
|
var _a;
|
|
100496
100592
|
const operationResult = findExecutableOperation(input);
|
|
100497
100593
|
if (operationResult.isErr()) {
|
|
100498
|
-
return err$
|
|
100594
|
+
return err$3(operationResult.error);
|
|
100499
100595
|
}
|
|
100500
100596
|
const operation = operationResult.value;
|
|
100501
100597
|
const fragmentDefinitions = input.query.definitions.filter(
|
|
@@ -100518,7 +100614,7 @@ class GraphQLDocumentRootTypeRepository extends IdentifiableGraphQLTypeRepositor
|
|
|
100518
100614
|
...operation,
|
|
100519
100615
|
selectionSet: { kind: Kind$1.SELECTION_SET, selections: augmentedOperationSelections }
|
|
100520
100616
|
};
|
|
100521
|
-
return ok$
|
|
100617
|
+
return ok$3({
|
|
100522
100618
|
...input.query,
|
|
100523
100619
|
definitions: [
|
|
100524
100620
|
...input.query.definitions.filter((def) => def.kind !== Kind$1.FRAGMENT_DEFINITION).map((def) => {
|
|
@@ -100553,7 +100649,7 @@ class BaseInterfaceRepository {
|
|
|
100553
100649
|
}
|
|
100554
100650
|
write(cache, input) {
|
|
100555
100651
|
if (typeof input.data !== "object") {
|
|
100556
|
-
return err$
|
|
100652
|
+
return err$3([
|
|
100557
100653
|
{
|
|
100558
100654
|
type: "unknown",
|
|
100559
100655
|
error: new Error(`Got a non-object value for ${this.typeName} field"`)
|
|
@@ -100563,7 +100659,7 @@ class BaseInterfaceRepository {
|
|
|
100563
100659
|
const discriminator = this.getTypeDiscriminator(input.data, input.selections);
|
|
100564
100660
|
const concreteTypeRepository = this.possibleTypes[discriminator];
|
|
100565
100661
|
if (!concreteTypeRepository) {
|
|
100566
|
-
return err$
|
|
100662
|
+
return err$3([
|
|
100567
100663
|
{
|
|
100568
100664
|
type: "unknown",
|
|
100569
100665
|
error: new Error(
|
|
@@ -100574,7 +100670,7 @@ class BaseInterfaceRepository {
|
|
|
100574
100670
|
}
|
|
100575
100671
|
const selectionErr = this.verifyInterfaceFields(input.selections);
|
|
100576
100672
|
if (selectionErr) {
|
|
100577
|
-
return err$
|
|
100673
|
+
return err$3(selectionErr);
|
|
100578
100674
|
}
|
|
100579
100675
|
const normalizeInput = {
|
|
100580
100676
|
...input,
|
|
@@ -100586,14 +100682,14 @@ class BaseInterfaceRepository {
|
|
|
100586
100682
|
};
|
|
100587
100683
|
const result = concreteTypeRepository.write(cache, normalizeInput);
|
|
100588
100684
|
if (result.isOk()) {
|
|
100589
|
-
return ok$
|
|
100685
|
+
return ok$3({ discriminator, data: result.value });
|
|
100590
100686
|
}
|
|
100591
100687
|
return result;
|
|
100592
100688
|
}
|
|
100593
100689
|
read(cache, input) {
|
|
100594
100690
|
const unionRep = input.normalizedData;
|
|
100595
100691
|
if (typeof unionRep.data !== "object" || unionRep.data === null) {
|
|
100596
|
-
return err$
|
|
100692
|
+
return err$3([
|
|
100597
100693
|
{
|
|
100598
100694
|
type: "unknown",
|
|
100599
100695
|
error: new Error(`Got a non-object value for ${this.typeName} field.`)
|
|
@@ -100603,7 +100699,7 @@ class BaseInterfaceRepository {
|
|
|
100603
100699
|
const discriminator = unionRep.discriminator;
|
|
100604
100700
|
const concreteRepository = this.possibleTypes[discriminator];
|
|
100605
100701
|
if (!concreteRepository) {
|
|
100606
|
-
return err$
|
|
100702
|
+
return err$3([
|
|
100607
100703
|
{
|
|
100608
100704
|
type: "unknown",
|
|
100609
100705
|
error: new Error(
|
|
@@ -100614,7 +100710,7 @@ class BaseInterfaceRepository {
|
|
|
100614
100710
|
}
|
|
100615
100711
|
const selectionErr = this.verifyInterfaceFields(input.selections);
|
|
100616
100712
|
if (selectionErr) {
|
|
100617
|
-
return err$
|
|
100713
|
+
return err$3(selectionErr);
|
|
100618
100714
|
}
|
|
100619
100715
|
const denormalizeInput = {
|
|
100620
100716
|
...input,
|
|
@@ -100719,7 +100815,7 @@ class BaseUnionRepository {
|
|
|
100719
100815
|
}
|
|
100720
100816
|
write(cache, input) {
|
|
100721
100817
|
if (typeof input.data !== "object") {
|
|
100722
|
-
return err$
|
|
100818
|
+
return err$3([
|
|
100723
100819
|
{
|
|
100724
100820
|
type: "unknown",
|
|
100725
100821
|
error: new Error(`Got a non-object value for ${this.typeName} field"`)
|
|
@@ -100729,7 +100825,7 @@ class BaseUnionRepository {
|
|
|
100729
100825
|
const discriminator = this.getTypeDiscriminator(input.data, input.selections);
|
|
100730
100826
|
const concreteTypeRepository = this.possibleTypes[discriminator];
|
|
100731
100827
|
if (!concreteTypeRepository) {
|
|
100732
|
-
return err$
|
|
100828
|
+
return err$3([
|
|
100733
100829
|
{
|
|
100734
100830
|
type: "unknown",
|
|
100735
100831
|
error: new Error(
|
|
@@ -100740,7 +100836,7 @@ class BaseUnionRepository {
|
|
|
100740
100836
|
}
|
|
100741
100837
|
const selectionErr = this.verifyUnionFields(input.selections);
|
|
100742
100838
|
if (selectionErr) {
|
|
100743
|
-
return err$
|
|
100839
|
+
return err$3(selectionErr);
|
|
100744
100840
|
}
|
|
100745
100841
|
const normalizeInput = {
|
|
100746
100842
|
...input,
|
|
@@ -100752,14 +100848,14 @@ class BaseUnionRepository {
|
|
|
100752
100848
|
};
|
|
100753
100849
|
const result = concreteTypeRepository.write(cache, normalizeInput);
|
|
100754
100850
|
if (result.isOk()) {
|
|
100755
|
-
return ok$
|
|
100851
|
+
return ok$3({ discriminator, data: result.value });
|
|
100756
100852
|
}
|
|
100757
100853
|
return result;
|
|
100758
100854
|
}
|
|
100759
100855
|
read(cache, input) {
|
|
100760
100856
|
const unionRep = input.normalizedData;
|
|
100761
100857
|
if (typeof unionRep.data !== "object" || unionRep.data === null) {
|
|
100762
|
-
return err$
|
|
100858
|
+
return err$3([
|
|
100763
100859
|
{
|
|
100764
100860
|
type: "unknown",
|
|
100765
100861
|
error: new Error(`Got a non-object value for ${this.typeName} field.`)
|
|
@@ -100769,7 +100865,7 @@ class BaseUnionRepository {
|
|
|
100769
100865
|
const discriminator = unionRep.discriminator;
|
|
100770
100866
|
const concreteRepository = this.possibleTypes[discriminator];
|
|
100771
100867
|
if (!concreteRepository) {
|
|
100772
|
-
return err$
|
|
100868
|
+
return err$3([
|
|
100773
100869
|
{
|
|
100774
100870
|
type: "unknown",
|
|
100775
100871
|
error: new Error(
|
|
@@ -100780,7 +100876,7 @@ class BaseUnionRepository {
|
|
|
100780
100876
|
}
|
|
100781
100877
|
const selectionErr = this.verifyUnionFields(input.selections);
|
|
100782
100878
|
if (selectionErr) {
|
|
100783
|
-
return err$
|
|
100879
|
+
return err$3(selectionErr);
|
|
100784
100880
|
}
|
|
100785
100881
|
const denormalizeInput = {
|
|
100786
100882
|
...input,
|
|
@@ -105299,7 +105395,7 @@ function dataSatisfiesFragmentTypeCondition(input, fragment) {
|
|
|
105299
105395
|
* @param typeName - The repository type name for error messages
|
|
105300
105396
|
* @returns Result<boolean, Error> - true if the fragment type condition is satisfied
|
|
105301
105397
|
*/
|
|
105302
|
-
function genericSatisfiesFragmentTypeCondition(superSatisfiesFragmentTypeCondition, input, fragment,
|
|
105398
|
+
function genericSatisfiesFragmentTypeCondition(superSatisfiesFragmentTypeCondition, input, fragment, _typeName) {
|
|
105303
105399
|
// First try the base class implementation
|
|
105304
105400
|
const result = superSatisfiesFragmentTypeCondition(input, fragment);
|
|
105305
105401
|
if (result.isErr() || result.value) {
|
|
@@ -105767,7 +105863,7 @@ class SetupRecordAggregateRepository extends Setup__SetupRecordAggregateReposito
|
|
|
105767
105863
|
}
|
|
105768
105864
|
|
|
105769
105865
|
class PolymorphicParentRelationshipRepository extends PolymorphicParentRelationshipRepository$1 {
|
|
105770
|
-
getTypeDiscriminator(
|
|
105866
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105771
105867
|
// Hardcoded to record representation since that's the only type of parent
|
|
105772
105868
|
// relationship possible
|
|
105773
105869
|
return 'RecordRepresentation';
|
|
@@ -105807,7 +105903,7 @@ class SetupEdgeRepository extends Setup__SetupEdgeRepository {
|
|
|
105807
105903
|
}
|
|
105808
105904
|
|
|
105809
105905
|
class PolymorphicAggregateParentRelationshipRepository extends PolymorphicAggregateParentRelationshipRepository$1 {
|
|
105810
|
-
getTypeDiscriminator(
|
|
105906
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105811
105907
|
// Hardcoded to record aggregate since that's the only type of parent
|
|
105812
105908
|
// relationship possible
|
|
105813
105909
|
return 'RecordAggregate';
|
|
@@ -105864,6 +105960,7 @@ class RecordDeletePayloadRepository extends RecordDeletePayloadRepository$1 {
|
|
|
105864
105960
|
let idFieldSelection = input.selections.find((selection) => selection.kind === 'Field' && selection.name.value === 'Id');
|
|
105865
105961
|
// If Id exists in data but wasn't asked for, synthesize the selection like RecordRepresentation does
|
|
105866
105962
|
if (input.data.Id !== undefined && !idFieldSelection) {
|
|
105963
|
+
// eslint-disable-next-line no-param-reassign
|
|
105867
105964
|
input = {
|
|
105868
105965
|
...input,
|
|
105869
105966
|
selections: [
|
|
@@ -105911,7 +106008,7 @@ class SetupConnectionRepository extends Setup__SetupConnectionRepository {
|
|
|
105911
106008
|
}
|
|
105912
106009
|
|
|
105913
106010
|
class SetupPolymorphicAggregateParentRelationshipRepository extends Setup__SetupPolymorphicAggregateParentRelationshipRepository {
|
|
105914
|
-
getTypeDiscriminator(
|
|
106011
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105915
106012
|
// Hardcoded to Setup__SetupRecordAggregate since that's the only type of parent
|
|
105916
106013
|
// relationship possible
|
|
105917
106014
|
return 'Setup__SetupRecordAggregate';
|
|
@@ -105919,7 +106016,7 @@ class SetupPolymorphicAggregateParentRelationshipRepository extends Setup__Setup
|
|
|
105919
106016
|
}
|
|
105920
106017
|
|
|
105921
106018
|
class SetupPolymorphicParentRelationshipRepository extends Setup__SetupPolymorphicParentRelationshipRepository {
|
|
105922
|
-
getTypeDiscriminator(
|
|
106019
|
+
getTypeDiscriminator(_data, _selections) {
|
|
105923
106020
|
// Hardcoded to Setup__EntityRepresentation since that's the only type of parent
|
|
105924
106021
|
// relationship possible
|
|
105925
106022
|
return 'Setup__EntityRepresentation';
|
|
@@ -106060,6 +106157,7 @@ function deepMerge$1(data, extensions) {
|
|
|
106060
106157
|
const dataType = typeof data;
|
|
106061
106158
|
const extensionsType = typeof extensions;
|
|
106062
106159
|
if (dataType === 'function' || extensionsType === 'function') {
|
|
106160
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
106063
106161
|
throw new Error('Cannot merge functions');
|
|
106064
106162
|
}
|
|
106065
106163
|
if (dataType === 'undefined' || data === undefined) {
|
|
@@ -106400,7 +106498,9 @@ function buildCommandClass(baseClass) {
|
|
|
106400
106498
|
});
|
|
106401
106499
|
this.unsubscribers.push(unsubscribeFromLuvioSnapshot);
|
|
106402
106500
|
}
|
|
106403
|
-
catch (error) {
|
|
106501
|
+
catch (error) {
|
|
106502
|
+
// intentionally do nothing
|
|
106503
|
+
}
|
|
106404
106504
|
}
|
|
106405
106505
|
}
|
|
106406
106506
|
usedRecordsChanged() {
|
|
@@ -106440,6 +106540,7 @@ function buildCommandClass(baseClass) {
|
|
|
106440
106540
|
};
|
|
106441
106541
|
}
|
|
106442
106542
|
|
|
106543
|
+
const REFRESH_FAILED_MESSAGE = 'Failed to refresh GraphQL data';
|
|
106443
106544
|
function validateNonQueryGraphQLConfig(config) {
|
|
106444
106545
|
if (config !== null && typeof config === 'object') {
|
|
106445
106546
|
if (hasOwnProperty$1.call(config, 'operationName') &&
|
|
@@ -106506,6 +106607,7 @@ function defaultCheckConfig(config, requiredKeys, optionalKeys) {
|
|
|
106506
106607
|
const invalidKeys = configKeys.filter((key) => !allowedKeysSet.includes(key));
|
|
106507
106608
|
if (invalidKeys.length > 0) {
|
|
106508
106609
|
// invalid keys, so set error state
|
|
106610
|
+
// eslint-disable-next-line no-throw-literal
|
|
106509
106611
|
throw {
|
|
106510
106612
|
error: `Invalid config keys: ${invalidKeys.join(', ')}`,
|
|
106511
106613
|
errorType: 'adapterError',
|
|
@@ -106555,6 +106657,7 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
|
|
|
106555
106657
|
let processScheduled = false;
|
|
106556
106658
|
let processingInitialConfig = false;
|
|
106557
106659
|
let unsubscribe;
|
|
106660
|
+
let currentResultRefresh;
|
|
106558
106661
|
const statusAtom = atom('unconfigured');
|
|
106559
106662
|
const errorsAtom = atom(undefined);
|
|
106560
106663
|
const dataAtom = atom(undefined);
|
|
@@ -106564,7 +106667,7 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
|
|
|
106564
106667
|
setAtom(errorsAtom, errors);
|
|
106565
106668
|
setAtom(dataAtom, data);
|
|
106566
106669
|
};
|
|
106567
|
-
const
|
|
106670
|
+
const subscribeCallback = (refreshResult) => {
|
|
106568
106671
|
if (refreshResult.isOk()) {
|
|
106569
106672
|
resultCallback({
|
|
106570
106673
|
ok: true,
|
|
@@ -106593,12 +106696,13 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
|
|
|
106593
106696
|
.then((result) => {
|
|
106594
106697
|
// handle the initial result
|
|
106595
106698
|
if (result.isOk()) {
|
|
106699
|
+
currentResultRefresh = result.value.refresh.bind(result.value);
|
|
106596
106700
|
resultCallback({
|
|
106597
106701
|
ok: true,
|
|
106598
106702
|
data: result.value.data.data,
|
|
106599
106703
|
errors: undefined,
|
|
106600
106704
|
});
|
|
106601
|
-
unsubscribe = createWeakSubscription((cb) => result.value.subscribe(cb), new WeakRef(
|
|
106705
|
+
unsubscribe = createWeakSubscription((cb) => result.value.subscribe(cb), new WeakRef(subscribeCallback));
|
|
106602
106706
|
}
|
|
106603
106707
|
else {
|
|
106604
106708
|
const resp = toGraphQLResponseFromFailure(result.error.failure);
|
|
@@ -106611,6 +106715,7 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
|
|
|
106611
106715
|
});
|
|
106612
106716
|
};
|
|
106613
106717
|
const queueConfigUpdate = (config) => {
|
|
106718
|
+
currentResultRefresh = undefined;
|
|
106614
106719
|
try {
|
|
106615
106720
|
const configIsGood = _checkConfig(config);
|
|
106616
106721
|
queuedConfig = configIsGood ? config : undefined;
|
|
@@ -106637,6 +106742,23 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
|
|
|
106637
106742
|
}
|
|
106638
106743
|
};
|
|
106639
106744
|
const setters = createSetters(allowedKeys, queueConfigUpdate);
|
|
106745
|
+
const refresh = () => {
|
|
106746
|
+
const status = statusAtom.value;
|
|
106747
|
+
if (status === 'unconfigured' || status === 'error' || status === 'loading') {
|
|
106748
|
+
return Promise.reject(new Error(REFRESH_FAILED_MESSAGE));
|
|
106749
|
+
}
|
|
106750
|
+
// status === 'loaded'
|
|
106751
|
+
return new Promise((resolve, reject) => {
|
|
106752
|
+
currentResultRefresh().then((res) => {
|
|
106753
|
+
if (res.isOk()) {
|
|
106754
|
+
resolve();
|
|
106755
|
+
}
|
|
106756
|
+
else {
|
|
106757
|
+
reject(new Error(REFRESH_FAILED_MESSAGE));
|
|
106758
|
+
}
|
|
106759
|
+
}, reject);
|
|
106760
|
+
});
|
|
106761
|
+
};
|
|
106640
106762
|
if (initialConfig) {
|
|
106641
106763
|
try {
|
|
106642
106764
|
processingInitialConfig = true;
|
|
@@ -106650,6 +106772,7 @@ function createStateManager(getCommand, requiredConfigKeys, optionalConfigKeys =
|
|
|
106650
106772
|
status: statusAtom,
|
|
106651
106773
|
errors: errorsAtom,
|
|
106652
106774
|
data: dataAtom,
|
|
106775
|
+
refresh,
|
|
106653
106776
|
...setters,
|
|
106654
106777
|
};
|
|
106655
106778
|
}, {
|
|
@@ -106870,7 +106993,7 @@ getServices(serviceRequirements).then((services) => {
|
|
|
106870
106993
|
_(config, CONFIG_SCHEMA);
|
|
106871
106994
|
const baseCommand = new graphql_imperative_ctor(config, documentRootType, services);
|
|
106872
106995
|
return applyDecorators(baseCommand, [services.fetchNetworkCommandBaseClass.availableDecorators.abortable], options);
|
|
106873
|
-
},
|
|
106996
|
+
}, true);
|
|
106874
106997
|
graphql_imperative_legacy = services.graphQLLegacyImperativeBindings.bind(({ config, assertIsValid }) => {
|
|
106875
106998
|
const _ = assertIsValid;
|
|
106876
106999
|
_(config, CONFIG_SCHEMA);
|
|
@@ -106880,6 +107003,7 @@ getServices(serviceRequirements).then((services) => {
|
|
|
106880
107003
|
services.graphQLLegacyImperativeBindings.bind(({ config, assertIsValid }) => {
|
|
106881
107004
|
const validatedConfig = validateNonQueryGraphQLConfig(config);
|
|
106882
107005
|
if (validatedConfig.isErr()) {
|
|
107006
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
106883
107007
|
throw new Error(`Invalid configuration passed to GraphQL: ${validatedConfig.error}`);
|
|
106884
107008
|
}
|
|
106885
107009
|
const _ = assertIsValid;
|
|
@@ -106891,11 +107015,12 @@ getServices(serviceRequirements).then((services) => {
|
|
|
106891
107015
|
*/
|
|
106892
107016
|
const graphql_state_manager_ctor = services.instrumentCommand(buildCommandClass(services.auraGraphQLNormalizedCacheControlCommand), 'graphql_state_manager');
|
|
106893
107017
|
const factory = (config) => {
|
|
106894
|
-
assertIsValid(config, CONFIG_SCHEMA);
|
|
107018
|
+
assertIsValid$1(config, CONFIG_SCHEMA);
|
|
106895
107019
|
const validatedConfig = resolveAndValidateGraphQLConfig(config, {
|
|
106896
107020
|
acceptedOperations: ['query'],
|
|
106897
107021
|
});
|
|
106898
107022
|
if (validatedConfig === undefined || validatedConfig.isErr()) {
|
|
107023
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
106899
107024
|
throw new Error('Internal error in GraphQL adapter occurred: Unable to resolve query');
|
|
106900
107025
|
}
|
|
106901
107026
|
return new graphql_state_manager_ctor(validatedConfig.value, documentRootType, services);
|
|
@@ -106923,7 +107048,7 @@ function registerCallback(cb) {
|
|
|
106923
107048
|
cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
|
|
106924
107049
|
}
|
|
106925
107050
|
}
|
|
106926
|
-
// version: 1.
|
|
107051
|
+
// version: 1.435.0-615ebb9bbd
|
|
106927
107052
|
|
|
106928
107053
|
function createFragmentMap(documentNode) {
|
|
106929
107054
|
const fragments = {};
|
|
@@ -134952,28 +135077,23 @@ let configurableCreateContentVersion$1 = new Configurable$1();
|
|
|
134952
135077
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
134953
135078
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
134954
135079
|
* be reached by following 1 relationship from the root record, etc.
|
|
134955
|
-
* @defaultValue '
|
|
135080
|
+
* @defaultValue '1'
|
|
134956
135081
|
*/
|
|
134957
|
-
let trackedFieldDepthOnCacheMiss$1 =
|
|
135082
|
+
let trackedFieldDepthOnCacheMiss$1 = 1;
|
|
134958
135083
|
/**
|
|
134959
135084
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
134960
135085
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
134961
135086
|
* be reached by following 1 relationship from the root record, etc.
|
|
134962
|
-
* @defaultValue '
|
|
135087
|
+
* @defaultValue '1'
|
|
134963
135088
|
*/
|
|
134964
|
-
let trackedFieldDepthOnCacheMergeConflict$1 =
|
|
135089
|
+
let trackedFieldDepthOnCacheMergeConflict$1 = 1;
|
|
134965
135090
|
/**
|
|
134966
135091
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
134967
135092
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
134968
135093
|
* be reached by following 1 relationship from the root record, etc.
|
|
134969
|
-
* @defaultValue '
|
|
135094
|
+
* @defaultValue '1'
|
|
134970
135095
|
*/
|
|
134971
|
-
let trackedFieldDepthOnNotifyChange$1 =
|
|
134972
|
-
/**
|
|
134973
|
-
* Determines if we will only fetch the 'Id' field for the leaf relationship record
|
|
134974
|
-
* @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
|
|
134975
|
-
*/
|
|
134976
|
-
let trackedFieldLeafNodeIdAndNameOnly$1 = false;
|
|
135096
|
+
let trackedFieldDepthOnNotifyChange$1 = 1;
|
|
134977
135097
|
/**
|
|
134978
135098
|
* One store enabled Get Object Info adapter
|
|
134979
135099
|
*/
|
|
@@ -135070,12 +135190,6 @@ const configurationForRestAdapters$1 = {
|
|
|
135070
135190
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
135071
135191
|
return trackedFieldDepthOnNotifyChange$1;
|
|
135072
135192
|
},
|
|
135073
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
135074
|
-
trackedFieldLeafNodeIdAndNameOnly$1 = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
135075
|
-
},
|
|
135076
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
135077
|
-
return trackedFieldLeafNodeIdAndNameOnly$1;
|
|
135078
|
-
},
|
|
135079
135193
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
135080
135194
|
recordRepresentationIngestionOverride$1 = ingest;
|
|
135081
135195
|
},
|
|
@@ -135632,6 +135746,7 @@ withDefaultLuvio((luvio) => {
|
|
|
135632
135746
|
if (typeof data?.refresh === 'function') {
|
|
135633
135747
|
return data.refresh();
|
|
135634
135748
|
}
|
|
135749
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
135635
135750
|
throw new Error('Component attempted to refresh a GraphQL result that is not refreshable');
|
|
135636
135751
|
};
|
|
135637
135752
|
}
|
|
@@ -136140,7 +136255,7 @@ register$1({
|
|
|
136140
136255
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
136141
136256
|
instrument: instrument$1,
|
|
136142
136257
|
});
|
|
136143
|
-
// version: 1.
|
|
136258
|
+
// version: 1.435.0-615ebb9bbd
|
|
136144
136259
|
|
|
136145
136260
|
// On core the unstable adapters are re-exported with different names,
|
|
136146
136261
|
// we want to match them here.
|
|
@@ -136292,7 +136407,7 @@ withDefaultLuvio((luvio) => {
|
|
|
136292
136407
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
136293
136408
|
graphQLImperative = ldsAdapter;
|
|
136294
136409
|
});
|
|
136295
|
-
// version: 1.
|
|
136410
|
+
// version: 1.435.0-615ebb9bbd
|
|
136296
136411
|
|
|
136297
136412
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
136298
136413
|
__proto__: null,
|
|
@@ -137091,7 +137206,7 @@ const callbacks$1 = [];
|
|
|
137091
137206
|
function register(r) {
|
|
137092
137207
|
callbacks$1.forEach((callback) => callback(r));
|
|
137093
137208
|
}
|
|
137094
|
-
// version: 1.
|
|
137209
|
+
// version: 1.435.0-5818ce3c48
|
|
137095
137210
|
|
|
137096
137211
|
/**
|
|
137097
137212
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -137127,28 +137242,23 @@ let configurableCreateContentVersion = new Configurable();
|
|
|
137127
137242
|
* Depth to which tracked fields will be added to a request that results from a cache miss.
|
|
137128
137243
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
137129
137244
|
* be reached by following 1 relationship from the root record, etc.
|
|
137130
|
-
* @defaultValue '
|
|
137245
|
+
* @defaultValue '1'
|
|
137131
137246
|
*/
|
|
137132
|
-
let trackedFieldDepthOnCacheMiss =
|
|
137247
|
+
let trackedFieldDepthOnCacheMiss = 1;
|
|
137133
137248
|
/**
|
|
137134
137249
|
* Depth to which tracked fields will be added to a request that results from a merge conflict
|
|
137135
137250
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
137136
137251
|
* be reached by following 1 relationship from the root record, etc.
|
|
137137
|
-
* @defaultValue '
|
|
137252
|
+
* @defaultValue '1'
|
|
137138
137253
|
*/
|
|
137139
|
-
let trackedFieldDepthOnCacheMergeConflict =
|
|
137254
|
+
let trackedFieldDepthOnCacheMergeConflict = 1;
|
|
137140
137255
|
/**
|
|
137141
137256
|
* Depth to which tracked fields will be added to a request that results from a notify change invocation by the consumer
|
|
137142
137257
|
* A value of 0 inhibits the addition of tracked fields, 1 will add tracked fields that can
|
|
137143
137258
|
* be reached by following 1 relationship from the root record, etc.
|
|
137144
|
-
* @defaultValue '
|
|
137145
|
-
*/
|
|
137146
|
-
let trackedFieldDepthOnNotifyChange = 5;
|
|
137147
|
-
/**
|
|
137148
|
-
* Determines if we will only fetch the 'Id' field for the leaf relationship record
|
|
137149
|
-
* @defaultValue 'false', replicates the current behavior and fetches all fields in the store for the leaf relationship record
|
|
137259
|
+
* @defaultValue '1'
|
|
137150
137260
|
*/
|
|
137151
|
-
let
|
|
137261
|
+
let trackedFieldDepthOnNotifyChange = 1;
|
|
137152
137262
|
/**
|
|
137153
137263
|
* One store enabled Get Object Info adapter
|
|
137154
137264
|
*/
|
|
@@ -137245,12 +137355,6 @@ const configurationForRestAdapters = {
|
|
|
137245
137355
|
getTrackedFieldDepthOnNotifyChange: function () {
|
|
137246
137356
|
return trackedFieldDepthOnNotifyChange;
|
|
137247
137357
|
},
|
|
137248
|
-
setTrackedFieldLeafNodeIdAndNameOnly: function (trackedFieldLeafNodeIdAndNameOnlyParam) {
|
|
137249
|
-
trackedFieldLeafNodeIdAndNameOnly = trackedFieldLeafNodeIdAndNameOnlyParam;
|
|
137250
|
-
},
|
|
137251
|
-
getTrackedFieldLeafNodeIdAndNameOnly: function () {
|
|
137252
|
-
return trackedFieldLeafNodeIdAndNameOnly;
|
|
137253
|
-
},
|
|
137254
137358
|
setRecordRepresentationIngestionOverride: function (ingest) {
|
|
137255
137359
|
recordRepresentationIngestionOverride = ingest;
|
|
137256
137360
|
},
|
|
@@ -138145,6 +138249,7 @@ function handleInstrumentation(activity, stat, progress) {
|
|
|
138145
138249
|
const LUVIO_ADAPTER_FAMILY = /^force\/ldsAdapters/;
|
|
138146
138250
|
async function importLuvioAdapterModule(specifier) {
|
|
138147
138251
|
if (!LUVIO_ADAPTER_FAMILY.test(specifier)) {
|
|
138252
|
+
// eslint-disable-next-line no-throw-literal
|
|
138148
138253
|
throw `${specifier} is not an allowed luvio adapter module`;
|
|
138149
138254
|
}
|
|
138150
138255
|
let module;
|
|
@@ -138152,6 +138257,7 @@ async function importLuvioAdapterModule(specifier) {
|
|
|
138152
138257
|
module = await import(specifier);
|
|
138153
138258
|
}
|
|
138154
138259
|
catch {
|
|
138260
|
+
// eslint-disable-next-line no-throw-literal
|
|
138155
138261
|
throw `module not found for specifier ${specifier}`;
|
|
138156
138262
|
}
|
|
138157
138263
|
return new LuvioAdapterModule(module);
|
|
@@ -138265,6 +138371,7 @@ function buildNativeResponse(response) {
|
|
|
138265
138371
|
}
|
|
138266
138372
|
async function importOneStoreAdapterModule(specifier) {
|
|
138267
138373
|
if (!ONESTORE_ADAPTER_FAMILY.test(specifier)) {
|
|
138374
|
+
// eslint-disable-next-line no-throw-literal
|
|
138268
138375
|
throw `${specifier} is not an allowed onestore adapter module`;
|
|
138269
138376
|
}
|
|
138270
138377
|
let module;
|
|
@@ -138272,6 +138379,7 @@ async function importOneStoreAdapterModule(specifier) {
|
|
|
138272
138379
|
module = await import(specifier);
|
|
138273
138380
|
}
|
|
138274
138381
|
catch {
|
|
138382
|
+
// eslint-disable-next-line no-throw-literal
|
|
138275
138383
|
throw `module not found for specifier ${specifier}`;
|
|
138276
138384
|
}
|
|
138277
138385
|
return new OneStoreAdapterModule(module);
|
|
@@ -138387,4 +138495,4 @@ const { luvio } = getRuntime();
|
|
|
138387
138495
|
setDefaultLuvio({ luvio });
|
|
138388
138496
|
|
|
138389
138497
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
138390
|
-
// version: 1.
|
|
138498
|
+
// version: 1.435.0-5818ce3c48
|