@salesforce/lds-worker-api 1.163.0 → 1.163.2
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.
|
@@ -770,4 +770,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
770
770
|
}
|
|
771
771
|
|
|
772
772
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
773
|
-
// version: 1.163.
|
|
773
|
+
// version: 1.163.2-1950176a9
|
|
@@ -3799,7 +3799,7 @@ function withDefaultLuvio(callback) {
|
|
|
3799
3799
|
}
|
|
3800
3800
|
callbacks.push(callback);
|
|
3801
3801
|
}
|
|
3802
|
-
// version: 1.163.
|
|
3802
|
+
// version: 1.163.2-1950176a9
|
|
3803
3803
|
|
|
3804
3804
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3805
3805
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15232,7 +15232,7 @@ function parseAndVisit(source) {
|
|
|
15232
15232
|
updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
|
|
15233
15233
|
return luvioDocumentNode;
|
|
15234
15234
|
}
|
|
15235
|
-
// version: 1.163.
|
|
15235
|
+
// version: 1.163.2-1950176a9
|
|
15236
15236
|
|
|
15237
15237
|
function unwrap(data) {
|
|
15238
15238
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16145,7 +16145,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
16145
16145
|
const { apiFamily, name } = metadata;
|
|
16146
16146
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16147
16147
|
}
|
|
16148
|
-
// version: 1.163.
|
|
16148
|
+
// version: 1.163.2-1950176a9
|
|
16149
16149
|
|
|
16150
16150
|
/**
|
|
16151
16151
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44016,7 +44016,7 @@ withDefaultLuvio((luvio) => {
|
|
|
44016
44016
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44017
44017
|
});
|
|
44018
44018
|
});
|
|
44019
|
-
// version: 1.163.
|
|
44019
|
+
// version: 1.163.2-2fcc92bea
|
|
44020
44020
|
|
|
44021
44021
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44022
44022
|
|
|
@@ -44042,6 +44042,15 @@ const idleDetector = {
|
|
|
44042
44042
|
declarePollableTaskMulti,
|
|
44043
44043
|
};
|
|
44044
44044
|
|
|
44045
|
+
var ldsUseShortUrlGate = {
|
|
44046
|
+
isOpen: function (e) {
|
|
44047
|
+
return e.fallback;
|
|
44048
|
+
},
|
|
44049
|
+
hasError: function () {
|
|
44050
|
+
return !0;
|
|
44051
|
+
},
|
|
44052
|
+
};
|
|
44053
|
+
|
|
44045
44054
|
var LOCALE = 'en-US';
|
|
44046
44055
|
|
|
44047
44056
|
var CURRENCY = 'USD';
|
|
@@ -54868,6 +54877,14 @@ function getRecordKeyFromRecordRequest(luvio, resourceRequest) {
|
|
|
54868
54877
|
function getRecordKeyForId(luvio, recordId) {
|
|
54869
54878
|
return keyBuilder$1R(luvio, { recordId });
|
|
54870
54879
|
}
|
|
54880
|
+
/**
|
|
54881
|
+
* Drafts are stored with denormalized fields and normalized field links. This method
|
|
54882
|
+
* filters out the field links and returns a flattened record representation.
|
|
54883
|
+
*
|
|
54884
|
+
* Note that reference field links get re-applied during draft record ingestion
|
|
54885
|
+
* @param record draft record representation
|
|
54886
|
+
* @returns flattened record representation
|
|
54887
|
+
*/
|
|
54871
54888
|
function filterOutReferenceFieldsAndLinks(record) {
|
|
54872
54889
|
const filteredFields = {};
|
|
54873
54890
|
const fieldNames = keys$2$1(record.fields);
|
|
@@ -54886,32 +54903,6 @@ function filterOutReferenceFieldsAndLinks(record) {
|
|
|
54886
54903
|
delete filteredRecords.links;
|
|
54887
54904
|
return filteredRecords;
|
|
54888
54905
|
}
|
|
54889
|
-
async function resolveReferencesOneLevelDeep(record, getRecordFromKey) {
|
|
54890
|
-
const fieldNames = keys$2$1(record.fields);
|
|
54891
|
-
const resolvedFields = {};
|
|
54892
|
-
for (const fieldName of fieldNames) {
|
|
54893
|
-
const field = record.fields[fieldName];
|
|
54894
|
-
if (isFieldLink(field)) {
|
|
54895
|
-
const denormalizedRecord = await getRecordFromKey(field.value.__ref);
|
|
54896
|
-
if (denormalizedRecord !== undefined) {
|
|
54897
|
-
resolvedFields[fieldName] = {
|
|
54898
|
-
value: filterOutReferenceFieldsAndLinks(denormalizedRecord),
|
|
54899
|
-
displayValue: null,
|
|
54900
|
-
};
|
|
54901
|
-
}
|
|
54902
|
-
else {
|
|
54903
|
-
resolvedFields[fieldName] = {
|
|
54904
|
-
value: null,
|
|
54905
|
-
displayValue: null,
|
|
54906
|
-
};
|
|
54907
|
-
}
|
|
54908
|
-
}
|
|
54909
|
-
else {
|
|
54910
|
-
resolvedFields[fieldName] = field;
|
|
54911
|
-
}
|
|
54912
|
-
}
|
|
54913
|
-
return { ...record, fields: resolvedFields };
|
|
54914
|
-
}
|
|
54915
54906
|
|
|
54916
54907
|
/**
|
|
54917
54908
|
* Checks if a resource request is a GET method on the record endpoint
|
|
@@ -55208,11 +55199,15 @@ const DEFAULT_FIELD_RECORD_TYPE_ID = 'RecordTypeId';
|
|
|
55208
55199
|
*/
|
|
55209
55200
|
function replayDraftsOnRecord(record, draftMetadata) {
|
|
55210
55201
|
let objectInfo;
|
|
55202
|
+
let luvio;
|
|
55211
55203
|
if (record && draftMetadata) {
|
|
55212
55204
|
objectInfo = draftMetadata.objectInfos.get(record.apiName);
|
|
55213
55205
|
}
|
|
55206
|
+
if (draftMetadata) {
|
|
55207
|
+
luvio = draftMetadata.luvio;
|
|
55208
|
+
}
|
|
55214
55209
|
// remove drafts before reapply
|
|
55215
|
-
const baseRecord = record === undefined ? undefined : removeDrafts(record, objectInfo);
|
|
55210
|
+
const baseRecord = record === undefined ? undefined : removeDrafts(record, luvio, objectInfo);
|
|
55216
55211
|
// record is a draft create
|
|
55217
55212
|
if (baseRecord === undefined) {
|
|
55218
55213
|
if (draftMetadata === undefined) {
|
|
@@ -55335,7 +55330,7 @@ function recursivelyApplyDraftsToRecord(record, draftMetadata, recordOperations)
|
|
|
55335
55330
|
* @param record record with drafts applied
|
|
55336
55331
|
* @returns
|
|
55337
55332
|
*/
|
|
55338
|
-
function removeDrafts(record, objectInfo) {
|
|
55333
|
+
function removeDrafts(record, luvio, objectInfo) {
|
|
55339
55334
|
const { drafts, fields } = record;
|
|
55340
55335
|
if (drafts === undefined) {
|
|
55341
55336
|
return record;
|
|
@@ -55351,6 +55346,12 @@ function removeDrafts(record, objectInfo) {
|
|
|
55351
55346
|
const originalField = drafts.serverValues[fieldName];
|
|
55352
55347
|
if (originalField !== undefined) {
|
|
55353
55348
|
updatedFields[fieldName] = originalField;
|
|
55349
|
+
if (objectInfo && luvio) {
|
|
55350
|
+
const reference = getReferenceInfoForKey(fieldName, originalField, luvio, objectInfo);
|
|
55351
|
+
if (reference) {
|
|
55352
|
+
updatedFields[reference.referenceFieldName] = reference.field;
|
|
55353
|
+
}
|
|
55354
|
+
}
|
|
55354
55355
|
// restore the record type id on the root of the record
|
|
55355
55356
|
if (fieldName === DEFAULT_FIELD_RECORD_TYPE_ID) {
|
|
55356
55357
|
const originalRecordTypeId = originalField.value;
|
|
@@ -55388,7 +55389,6 @@ function removeDrafts(record, objectInfo) {
|
|
|
55388
55389
|
* @param fields List of draft record fields
|
|
55389
55390
|
*/
|
|
55390
55391
|
function buildRecordFieldValueRepresentationsFromDraftFields(luvio, apiName, fields, objectInfos, referencedRecords, formatDisplayValue) {
|
|
55391
|
-
var _a;
|
|
55392
55392
|
const fieldNames = keys$2$1(fields);
|
|
55393
55393
|
const recordFields = {};
|
|
55394
55394
|
const objectInfo = objectInfos.get(apiName);
|
|
@@ -55402,7 +55402,7 @@ function buildRecordFieldValueRepresentationsFromDraftFields(luvio, apiName, fie
|
|
|
55402
55402
|
if (objectInfo !== undefined) {
|
|
55403
55403
|
const fieldInfo = objectInfo.fields[fieldName];
|
|
55404
55404
|
if (fieldInfo !== undefined) {
|
|
55405
|
-
const { dataType
|
|
55405
|
+
const { dataType } = fieldInfo;
|
|
55406
55406
|
recordFields[fieldName].displayValue = formatDisplayValue(draftField, dataType);
|
|
55407
55407
|
if (dataType === 'DateTime' &&
|
|
55408
55408
|
draftField !== null &&
|
|
@@ -55414,46 +55414,6 @@ function buildRecordFieldValueRepresentationsFromDraftFields(luvio, apiName, fie
|
|
|
55414
55414
|
throw Error('date field value not valid');
|
|
55415
55415
|
}
|
|
55416
55416
|
}
|
|
55417
|
-
if (dataType === 'Reference' && relationshipName !== null && draftField !== null) {
|
|
55418
|
-
if (typeof draftField !== 'string') {
|
|
55419
|
-
throw Error('reference field value is not a string');
|
|
55420
|
-
}
|
|
55421
|
-
const key = getRecordKeyForId(luvio, draftField);
|
|
55422
|
-
const referencedRecord = referencedRecords.get(key);
|
|
55423
|
-
if (referencedRecord) {
|
|
55424
|
-
recordFields[relationshipName] = {
|
|
55425
|
-
displayValue: null,
|
|
55426
|
-
value: createLink$2(key),
|
|
55427
|
-
};
|
|
55428
|
-
}
|
|
55429
|
-
else {
|
|
55430
|
-
recordFields[relationshipName] = {
|
|
55431
|
-
displayValue: null,
|
|
55432
|
-
value: null,
|
|
55433
|
-
};
|
|
55434
|
-
}
|
|
55435
|
-
// for custom objects, we select the 'Name' field
|
|
55436
|
-
// otherwise we check the object info for name fields.
|
|
55437
|
-
//if there are multiple we select 'Name' if it exists, otherwise the first one
|
|
55438
|
-
if (referencedRecord !== undefined && referenceToInfos.length > 0) {
|
|
55439
|
-
let nameField;
|
|
55440
|
-
const referenceToInfo = referenceToInfos[0];
|
|
55441
|
-
const nameFields = referenceToInfo.nameFields;
|
|
55442
|
-
if (nameFields.length !== 0) {
|
|
55443
|
-
nameField = nameFields.find((x) => x === 'Name');
|
|
55444
|
-
if (nameField === undefined) {
|
|
55445
|
-
nameField = nameFields[0];
|
|
55446
|
-
}
|
|
55447
|
-
}
|
|
55448
|
-
if (nameField !== undefined) {
|
|
55449
|
-
const nameFieldRef = referencedRecord.fields[nameField];
|
|
55450
|
-
if (nameFieldRef) {
|
|
55451
|
-
recordFields[relationshipName].displayValue =
|
|
55452
|
-
(_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
|
|
55453
|
-
}
|
|
55454
|
-
}
|
|
55455
|
-
}
|
|
55456
|
-
}
|
|
55457
55417
|
}
|
|
55458
55418
|
}
|
|
55459
55419
|
}
|
|
@@ -55527,9 +55487,78 @@ function buildSyntheticRecordRepresentation(luvio, createOperation, userId, obje
|
|
|
55527
55487
|
},
|
|
55528
55488
|
};
|
|
55529
55489
|
}
|
|
55490
|
+
function applyReferenceLinksToDraft(record, draftMetadata) {
|
|
55491
|
+
var _a;
|
|
55492
|
+
const { objectInfos, referencedRecords, luvio } = draftMetadata;
|
|
55493
|
+
const objectInfo = objectInfos.get(record.apiName);
|
|
55494
|
+
if (objectInfo === undefined) {
|
|
55495
|
+
return record;
|
|
55496
|
+
}
|
|
55497
|
+
let fieldNames = Object.keys(record.fields);
|
|
55498
|
+
const recordFields = { ...record.fields };
|
|
55499
|
+
for (const draftField of fieldNames) {
|
|
55500
|
+
const fieldInfo = objectInfo.fields[draftField];
|
|
55501
|
+
if (fieldInfo === undefined) {
|
|
55502
|
+
continue;
|
|
55503
|
+
}
|
|
55504
|
+
const { dataType, relationshipName, referenceToInfos } = fieldInfo;
|
|
55505
|
+
const draftFieldValue = record.fields[draftField].value;
|
|
55506
|
+
if (dataType === 'Reference' && relationshipName !== null && draftFieldValue !== null) {
|
|
55507
|
+
if (typeof draftFieldValue !== 'string') {
|
|
55508
|
+
throw Error('reference field value is not a string');
|
|
55509
|
+
}
|
|
55510
|
+
const key = getRecordKeyForId(luvio, draftFieldValue);
|
|
55511
|
+
const referencedRecord = referencedRecords.get(key);
|
|
55512
|
+
recordFields[relationshipName] = {
|
|
55513
|
+
displayValue: null,
|
|
55514
|
+
value: createLink$2(key),
|
|
55515
|
+
};
|
|
55516
|
+
// for custom objects, we select the 'Name' field
|
|
55517
|
+
// otherwise we check the object info for name fields.
|
|
55518
|
+
//if there are multiple we select 'Name' if it exists, otherwise the first one
|
|
55519
|
+
if (referencedRecord !== undefined && referenceToInfos.length > 0) {
|
|
55520
|
+
let nameField;
|
|
55521
|
+
const referenceToInfo = referenceToInfos[0];
|
|
55522
|
+
const nameFields = referenceToInfo.nameFields;
|
|
55523
|
+
if (nameFields.length !== 0) {
|
|
55524
|
+
nameField = nameFields.find((x) => x === 'Name');
|
|
55525
|
+
if (nameField === undefined) {
|
|
55526
|
+
nameField = nameFields[0];
|
|
55527
|
+
}
|
|
55528
|
+
}
|
|
55529
|
+
if (nameField !== undefined) {
|
|
55530
|
+
const nameFieldRef = referencedRecord.fields[nameField];
|
|
55531
|
+
if (nameFieldRef) {
|
|
55532
|
+
recordFields[relationshipName].displayValue =
|
|
55533
|
+
(_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
|
|
55534
|
+
}
|
|
55535
|
+
}
|
|
55536
|
+
}
|
|
55537
|
+
}
|
|
55538
|
+
}
|
|
55539
|
+
return { ...record, fields: recordFields };
|
|
55540
|
+
}
|
|
55530
55541
|
function createLink$2(key) {
|
|
55531
55542
|
return { __ref: key };
|
|
55532
55543
|
}
|
|
55544
|
+
function getReferenceInfoForKey(fieldName, field, luvio, objectInfo) {
|
|
55545
|
+
const { dataType, relationshipName } = objectInfo.fields[fieldName];
|
|
55546
|
+
const draftFieldValue = field.value;
|
|
55547
|
+
if (dataType === 'Reference' && relationshipName !== null && draftFieldValue !== null) {
|
|
55548
|
+
if (typeof draftFieldValue !== 'string') {
|
|
55549
|
+
throw Error('reference field value is not a string');
|
|
55550
|
+
}
|
|
55551
|
+
const key = getRecordKeyForId(luvio, draftFieldValue);
|
|
55552
|
+
return {
|
|
55553
|
+
referenceFieldName: relationshipName,
|
|
55554
|
+
field: {
|
|
55555
|
+
displayValue: null,
|
|
55556
|
+
value: createLink$2(key),
|
|
55557
|
+
},
|
|
55558
|
+
};
|
|
55559
|
+
}
|
|
55560
|
+
return undefined;
|
|
55561
|
+
}
|
|
55533
55562
|
|
|
55534
55563
|
async function getAdapterData(adapter, config) {
|
|
55535
55564
|
const snapshot = await adapter(config);
|
|
@@ -55721,8 +55750,7 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55721
55750
|
*
|
|
55722
55751
|
* @param action The draft action related to this record
|
|
55723
55752
|
* @param _queue The draft queue
|
|
55724
|
-
* @returns The record with the updated draft queue applied.
|
|
55725
|
-
* deep to ensure that reference links are properly established during ingestion to it
|
|
55753
|
+
* @returns The record with the updated draft queue applied. References are not included and must be applied at ingest.
|
|
55726
55754
|
*
|
|
55727
55755
|
* or
|
|
55728
55756
|
*
|
|
@@ -55746,7 +55774,7 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55746
55774
|
if (recordWithDrafts === undefined) {
|
|
55747
55775
|
return undefined;
|
|
55748
55776
|
}
|
|
55749
|
-
return
|
|
55777
|
+
return filterOutReferenceFieldsAndLinks(recordWithDrafts);
|
|
55750
55778
|
}
|
|
55751
55779
|
const record = await this.durableStore.getDenormalizedRecord(key);
|
|
55752
55780
|
if (record === undefined) {
|
|
@@ -55757,7 +55785,7 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55757
55785
|
if (recordWithDrafts === undefined) {
|
|
55758
55786
|
return recordWithDrafts;
|
|
55759
55787
|
}
|
|
55760
|
-
return
|
|
55788
|
+
return filterOutReferenceFieldsAndLinks(recordWithDrafts);
|
|
55761
55789
|
}
|
|
55762
55790
|
applyDraftsToIncomingData(key, data, draftMetadata, publishData) {
|
|
55763
55791
|
if (isField(key)) {
|
|
@@ -55784,19 +55812,26 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55784
55812
|
}
|
|
55785
55813
|
}
|
|
55786
55814
|
const recordWithDrafts = replayDraftsOnRecord(partialRecord, draftMetadata);
|
|
55815
|
+
const recordWithSpanningRefLinks = applyReferenceLinksToDraft(recordWithDrafts, draftMetadata);
|
|
55787
55816
|
// publish the normalized fields
|
|
55788
55817
|
const normalizedRecord = {
|
|
55789
|
-
...
|
|
55818
|
+
...recordWithSpanningRefLinks,
|
|
55790
55819
|
...data,
|
|
55791
55820
|
fields: { ...data.fields },
|
|
55792
55821
|
};
|
|
55793
|
-
for (const fieldName of
|
|
55822
|
+
for (const fieldName of keys$2$1(recordWithSpanningRefLinks.fields)) {
|
|
55794
55823
|
const fieldKey = buildRecordFieldStoreKey(key, fieldName);
|
|
55795
55824
|
if (this.collectedFields[fieldKey] !== undefined) {
|
|
55796
|
-
const fieldData =
|
|
55825
|
+
const fieldData = recordWithSpanningRefLinks.fields[fieldName];
|
|
55797
55826
|
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55798
55827
|
publishData(fieldKey, fieldData);
|
|
55799
55828
|
}
|
|
55829
|
+
else if (recordWithSpanningRefLinks.fields[fieldName] &&
|
|
55830
|
+
recordWithSpanningRefLinks.fields[fieldName].value &&
|
|
55831
|
+
recordWithSpanningRefLinks.fields[fieldName].value.__ref !== undefined) {
|
|
55832
|
+
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55833
|
+
publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
|
|
55834
|
+
}
|
|
55800
55835
|
}
|
|
55801
55836
|
// publish the normalized record
|
|
55802
55837
|
publishData(key, normalizedRecord);
|
|
@@ -56974,27 +57009,10 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
|
|
|
56974
57009
|
if (contentVersion === undefined) {
|
|
56975
57010
|
return undefined;
|
|
56976
57011
|
}
|
|
56977
|
-
// this lambda can be shared across the calls to resolveReferencesOneLevelDeep
|
|
56978
|
-
const luvio = this.getLuvio();
|
|
56979
|
-
const contentDocumentKey = getRecordKeyForId(luvio, contentDocumentId);
|
|
56980
|
-
const contentDocumentLinkKey = getRecordKeyForId(luvio, contentDocumentLinkId);
|
|
56981
|
-
const contentVersionKey = getRecordKeyForId(luvio, contentVersionId);
|
|
56982
|
-
const getRecordFromKey = async (key) => {
|
|
56983
|
-
if (key === contentDocumentKey) {
|
|
56984
|
-
return contentDocRecord;
|
|
56985
|
-
}
|
|
56986
|
-
if (key === contentDocumentLinkKey) {
|
|
56987
|
-
return contentDocLink;
|
|
56988
|
-
}
|
|
56989
|
-
if (key === contentVersionKey) {
|
|
56990
|
-
return contentVersion;
|
|
56991
|
-
}
|
|
56992
|
-
return this.durableStore.getDenormalizedRecord(key);
|
|
56993
|
-
};
|
|
56994
57012
|
// finally we resolve all references for each record
|
|
56995
|
-
const contentDocResolved = await
|
|
56996
|
-
const contentDocLinkResolved = await
|
|
56997
|
-
const contentVersionResolved = await
|
|
57013
|
+
const contentDocResolved = await filterOutReferenceFieldsAndLinks(contentDocRecord);
|
|
57014
|
+
const contentDocLinkResolved = await filterOutReferenceFieldsAndLinks(contentDocLink);
|
|
57015
|
+
const contentVersionResolved = await filterOutReferenceFieldsAndLinks(contentVersion);
|
|
56998
57016
|
return {
|
|
56999
57017
|
contentDocument: contentDocResolved,
|
|
57000
57018
|
contentDocumentLinks: [contentDocLinkResolved],
|
|
@@ -57773,6 +57791,10 @@ class ScopedFieldsCollection {
|
|
|
57773
57791
|
}
|
|
57774
57792
|
|
|
57775
57793
|
const MAX_STRING_LENGTH_PER_CHUNK = 10000;
|
|
57794
|
+
//Salesforce/Akamai cdn uri max size is 8898 bytes, short than normal. Per
|
|
57795
|
+
//https://help.salesforce.com/s/articleView?id=sf.community_builder_cdn_considerations.htm&type=5
|
|
57796
|
+
//Due to we don't know the domain ResourceRequest, here we give 8000
|
|
57797
|
+
const MAX_URL_LENGTH = 8000;
|
|
57776
57798
|
const PARSE_ERROR = 'PARSE_AGGREGATE_UI_RESPONSE_ERROR';
|
|
57777
57799
|
function isErrorResponse(response) {
|
|
57778
57800
|
return response.httpStatusCode >= 400;
|
|
@@ -57851,8 +57873,8 @@ function buildAggregateUiUrl(params, resourceRequest) {
|
|
|
57851
57873
|
}
|
|
57852
57874
|
return `${resourceRequest.baseUri}${resourceRequest.basePath}?${join$1.call(queryString, '&')}`;
|
|
57853
57875
|
}
|
|
57854
|
-
function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray) {
|
|
57855
|
-
return fieldsArray.length + optionalFieldsArray.length >=
|
|
57876
|
+
function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray, maxLengthPerChunk) {
|
|
57877
|
+
return fieldsArray.length + optionalFieldsArray.length >= maxLengthPerChunk;
|
|
57856
57878
|
}
|
|
57857
57879
|
function isSpanningRecord(fieldValue) {
|
|
57858
57880
|
return fieldValue !== null && typeof fieldValue === 'object';
|
|
@@ -57915,14 +57937,15 @@ function createAggregateBatchRequestInfo(resourceRequest, endpoint) {
|
|
|
57915
57937
|
if (fieldsArray.length === 0 && optionalFieldsArray.length === 0) {
|
|
57916
57938
|
return undefined;
|
|
57917
57939
|
}
|
|
57940
|
+
const allowedMaxStringLengthPerChunk = getMaxLengthPerChunkAllowed(resourceRequest);
|
|
57918
57941
|
const fieldsString = fieldsArray.join(',');
|
|
57919
57942
|
const optionalFieldsString = optionalFieldsArray.join(',');
|
|
57920
|
-
const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString);
|
|
57943
|
+
const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString, allowedMaxStringLengthPerChunk);
|
|
57921
57944
|
if (!shouldUseAggregate) {
|
|
57922
57945
|
return undefined;
|
|
57923
57946
|
}
|
|
57924
|
-
const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(
|
|
57925
|
-
const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(
|
|
57947
|
+
const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(allowedMaxStringLengthPerChunk);
|
|
57948
|
+
const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(allowedMaxStringLengthPerChunk);
|
|
57926
57949
|
return {
|
|
57927
57950
|
fieldCollection,
|
|
57928
57951
|
optionalFieldCollection,
|
|
@@ -57995,6 +58018,25 @@ function isGetRequestForEndpoint(endpoint, request) {
|
|
|
57995
58018
|
function arrayOrEmpty(array) {
|
|
57996
58019
|
return array !== undefined && isArray$6(array) ? array : [];
|
|
57997
58020
|
}
|
|
58021
|
+
/**
|
|
58022
|
+
* Calculate the max lengh per chunk.
|
|
58023
|
+
* If useShortUrlGate is open, allow max chunk size is MAX_URL_LENGTH - the url without fields and optional fields in url.
|
|
58024
|
+
* Otherwise MAX_STRING_LENGTH_PER_CHUNK
|
|
58025
|
+
* @param resourceRequest
|
|
58026
|
+
* @returns
|
|
58027
|
+
*/
|
|
58028
|
+
function getMaxLengthPerChunkAllowed(request) {
|
|
58029
|
+
if (!ldsUseShortUrlGate.isOpen({ fallback: false })) {
|
|
58030
|
+
return MAX_STRING_LENGTH_PER_CHUNK;
|
|
58031
|
+
}
|
|
58032
|
+
// Too much work to get exact length of the final url, so use stringified json to get the rough length.
|
|
58033
|
+
const roughUrlLengthWithoutFieldsAndOptionFields = request.basePath.length +
|
|
58034
|
+
request.baseUri.length +
|
|
58035
|
+
(request.urlParams ? stringify$1$1(request.urlParams).length : 0) +
|
|
58036
|
+
stringify$1$1({ ...request.queryParams, fields: {}, optionalFields: {} }).length;
|
|
58037
|
+
// MAX_URL_LENGTH - full lenght without fields, optionalFields
|
|
58038
|
+
return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
|
|
58039
|
+
}
|
|
57998
58040
|
|
|
57999
58041
|
const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
|
|
58000
58042
|
const referenceId$3 = 'LDS_Records_AggregateUi';
|
|
@@ -60073,7 +60115,7 @@ register({
|
|
|
60073
60115
|
id: '@salesforce/lds-network-adapter',
|
|
60074
60116
|
instrument: instrument$1,
|
|
60075
60117
|
});
|
|
60076
|
-
// version: 1.163.
|
|
60118
|
+
// version: 1.163.2-1950176a9
|
|
60077
60119
|
|
|
60078
60120
|
const { create: create$2, keys: keys$2 } = Object;
|
|
60079
60121
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -77555,7 +77597,7 @@ register({
|
|
|
77555
77597
|
configuration: { ...configurationForGraphQLAdapters },
|
|
77556
77598
|
instrument,
|
|
77557
77599
|
});
|
|
77558
|
-
// version: 1.163.
|
|
77600
|
+
// version: 1.163.2-2fcc92bea
|
|
77559
77601
|
|
|
77560
77602
|
// On core the unstable adapters are re-exported with different names,
|
|
77561
77603
|
|
|
@@ -79802,7 +79844,7 @@ withDefaultLuvio((luvio) => {
|
|
|
79802
79844
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
79803
79845
|
graphQLImperative = ldsAdapter;
|
|
79804
79846
|
});
|
|
79805
|
-
// version: 1.163.
|
|
79847
|
+
// version: 1.163.2-2fcc92bea
|
|
79806
79848
|
|
|
79807
79849
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
79808
79850
|
__proto__: null,
|
|
@@ -80491,4 +80533,4 @@ const { luvio } = getRuntime();
|
|
|
80491
80533
|
setDefaultLuvio({ luvio });
|
|
80492
80534
|
|
|
80493
80535
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
80494
|
-
// version: 1.163.
|
|
80536
|
+
// version: 1.163.2-1950176a9
|
|
@@ -3805,7 +3805,7 @@
|
|
|
3805
3805
|
}
|
|
3806
3806
|
callbacks.push(callback);
|
|
3807
3807
|
}
|
|
3808
|
-
// version: 1.163.
|
|
3808
|
+
// version: 1.163.2-1950176a9
|
|
3809
3809
|
|
|
3810
3810
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
3811
3811
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15238,7 +15238,7 @@
|
|
|
15238
15238
|
updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
|
|
15239
15239
|
return luvioDocumentNode;
|
|
15240
15240
|
}
|
|
15241
|
-
// version: 1.163.
|
|
15241
|
+
// version: 1.163.2-1950176a9
|
|
15242
15242
|
|
|
15243
15243
|
function unwrap(data) {
|
|
15244
15244
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16151,7 +16151,7 @@
|
|
|
16151
16151
|
const { apiFamily, name } = metadata;
|
|
16152
16152
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16153
16153
|
}
|
|
16154
|
-
// version: 1.163.
|
|
16154
|
+
// version: 1.163.2-1950176a9
|
|
16155
16155
|
|
|
16156
16156
|
/**
|
|
16157
16157
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -44022,7 +44022,7 @@
|
|
|
44022
44022
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44023
44023
|
});
|
|
44024
44024
|
});
|
|
44025
|
-
// version: 1.163.
|
|
44025
|
+
// version: 1.163.2-2fcc92bea
|
|
44026
44026
|
|
|
44027
44027
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44028
44028
|
|
|
@@ -44048,6 +44048,15 @@
|
|
|
44048
44048
|
declarePollableTaskMulti,
|
|
44049
44049
|
};
|
|
44050
44050
|
|
|
44051
|
+
var ldsUseShortUrlGate = {
|
|
44052
|
+
isOpen: function (e) {
|
|
44053
|
+
return e.fallback;
|
|
44054
|
+
},
|
|
44055
|
+
hasError: function () {
|
|
44056
|
+
return !0;
|
|
44057
|
+
},
|
|
44058
|
+
};
|
|
44059
|
+
|
|
44051
44060
|
var LOCALE = 'en-US';
|
|
44052
44061
|
|
|
44053
44062
|
var CURRENCY = 'USD';
|
|
@@ -54874,6 +54883,14 @@
|
|
|
54874
54883
|
function getRecordKeyForId(luvio, recordId) {
|
|
54875
54884
|
return keyBuilder$1R(luvio, { recordId });
|
|
54876
54885
|
}
|
|
54886
|
+
/**
|
|
54887
|
+
* Drafts are stored with denormalized fields and normalized field links. This method
|
|
54888
|
+
* filters out the field links and returns a flattened record representation.
|
|
54889
|
+
*
|
|
54890
|
+
* Note that reference field links get re-applied during draft record ingestion
|
|
54891
|
+
* @param record draft record representation
|
|
54892
|
+
* @returns flattened record representation
|
|
54893
|
+
*/
|
|
54877
54894
|
function filterOutReferenceFieldsAndLinks(record) {
|
|
54878
54895
|
const filteredFields = {};
|
|
54879
54896
|
const fieldNames = keys$2$1(record.fields);
|
|
@@ -54892,32 +54909,6 @@
|
|
|
54892
54909
|
delete filteredRecords.links;
|
|
54893
54910
|
return filteredRecords;
|
|
54894
54911
|
}
|
|
54895
|
-
async function resolveReferencesOneLevelDeep(record, getRecordFromKey) {
|
|
54896
|
-
const fieldNames = keys$2$1(record.fields);
|
|
54897
|
-
const resolvedFields = {};
|
|
54898
|
-
for (const fieldName of fieldNames) {
|
|
54899
|
-
const field = record.fields[fieldName];
|
|
54900
|
-
if (isFieldLink(field)) {
|
|
54901
|
-
const denormalizedRecord = await getRecordFromKey(field.value.__ref);
|
|
54902
|
-
if (denormalizedRecord !== undefined) {
|
|
54903
|
-
resolvedFields[fieldName] = {
|
|
54904
|
-
value: filterOutReferenceFieldsAndLinks(denormalizedRecord),
|
|
54905
|
-
displayValue: null,
|
|
54906
|
-
};
|
|
54907
|
-
}
|
|
54908
|
-
else {
|
|
54909
|
-
resolvedFields[fieldName] = {
|
|
54910
|
-
value: null,
|
|
54911
|
-
displayValue: null,
|
|
54912
|
-
};
|
|
54913
|
-
}
|
|
54914
|
-
}
|
|
54915
|
-
else {
|
|
54916
|
-
resolvedFields[fieldName] = field;
|
|
54917
|
-
}
|
|
54918
|
-
}
|
|
54919
|
-
return { ...record, fields: resolvedFields };
|
|
54920
|
-
}
|
|
54921
54912
|
|
|
54922
54913
|
/**
|
|
54923
54914
|
* Checks if a resource request is a GET method on the record endpoint
|
|
@@ -55214,11 +55205,15 @@
|
|
|
55214
55205
|
*/
|
|
55215
55206
|
function replayDraftsOnRecord(record, draftMetadata) {
|
|
55216
55207
|
let objectInfo;
|
|
55208
|
+
let luvio;
|
|
55217
55209
|
if (record && draftMetadata) {
|
|
55218
55210
|
objectInfo = draftMetadata.objectInfos.get(record.apiName);
|
|
55219
55211
|
}
|
|
55212
|
+
if (draftMetadata) {
|
|
55213
|
+
luvio = draftMetadata.luvio;
|
|
55214
|
+
}
|
|
55220
55215
|
// remove drafts before reapply
|
|
55221
|
-
const baseRecord = record === undefined ? undefined : removeDrafts(record, objectInfo);
|
|
55216
|
+
const baseRecord = record === undefined ? undefined : removeDrafts(record, luvio, objectInfo);
|
|
55222
55217
|
// record is a draft create
|
|
55223
55218
|
if (baseRecord === undefined) {
|
|
55224
55219
|
if (draftMetadata === undefined) {
|
|
@@ -55341,7 +55336,7 @@
|
|
|
55341
55336
|
* @param record record with drafts applied
|
|
55342
55337
|
* @returns
|
|
55343
55338
|
*/
|
|
55344
|
-
function removeDrafts(record, objectInfo) {
|
|
55339
|
+
function removeDrafts(record, luvio, objectInfo) {
|
|
55345
55340
|
const { drafts, fields } = record;
|
|
55346
55341
|
if (drafts === undefined) {
|
|
55347
55342
|
return record;
|
|
@@ -55357,6 +55352,12 @@
|
|
|
55357
55352
|
const originalField = drafts.serverValues[fieldName];
|
|
55358
55353
|
if (originalField !== undefined) {
|
|
55359
55354
|
updatedFields[fieldName] = originalField;
|
|
55355
|
+
if (objectInfo && luvio) {
|
|
55356
|
+
const reference = getReferenceInfoForKey(fieldName, originalField, luvio, objectInfo);
|
|
55357
|
+
if (reference) {
|
|
55358
|
+
updatedFields[reference.referenceFieldName] = reference.field;
|
|
55359
|
+
}
|
|
55360
|
+
}
|
|
55360
55361
|
// restore the record type id on the root of the record
|
|
55361
55362
|
if (fieldName === DEFAULT_FIELD_RECORD_TYPE_ID) {
|
|
55362
55363
|
const originalRecordTypeId = originalField.value;
|
|
@@ -55394,7 +55395,6 @@
|
|
|
55394
55395
|
* @param fields List of draft record fields
|
|
55395
55396
|
*/
|
|
55396
55397
|
function buildRecordFieldValueRepresentationsFromDraftFields(luvio, apiName, fields, objectInfos, referencedRecords, formatDisplayValue) {
|
|
55397
|
-
var _a;
|
|
55398
55398
|
const fieldNames = keys$2$1(fields);
|
|
55399
55399
|
const recordFields = {};
|
|
55400
55400
|
const objectInfo = objectInfos.get(apiName);
|
|
@@ -55408,7 +55408,7 @@
|
|
|
55408
55408
|
if (objectInfo !== undefined) {
|
|
55409
55409
|
const fieldInfo = objectInfo.fields[fieldName];
|
|
55410
55410
|
if (fieldInfo !== undefined) {
|
|
55411
|
-
const { dataType
|
|
55411
|
+
const { dataType } = fieldInfo;
|
|
55412
55412
|
recordFields[fieldName].displayValue = formatDisplayValue(draftField, dataType);
|
|
55413
55413
|
if (dataType === 'DateTime' &&
|
|
55414
55414
|
draftField !== null &&
|
|
@@ -55420,46 +55420,6 @@
|
|
|
55420
55420
|
throw Error('date field value not valid');
|
|
55421
55421
|
}
|
|
55422
55422
|
}
|
|
55423
|
-
if (dataType === 'Reference' && relationshipName !== null && draftField !== null) {
|
|
55424
|
-
if (typeof draftField !== 'string') {
|
|
55425
|
-
throw Error('reference field value is not a string');
|
|
55426
|
-
}
|
|
55427
|
-
const key = getRecordKeyForId(luvio, draftField);
|
|
55428
|
-
const referencedRecord = referencedRecords.get(key);
|
|
55429
|
-
if (referencedRecord) {
|
|
55430
|
-
recordFields[relationshipName] = {
|
|
55431
|
-
displayValue: null,
|
|
55432
|
-
value: createLink$2(key),
|
|
55433
|
-
};
|
|
55434
|
-
}
|
|
55435
|
-
else {
|
|
55436
|
-
recordFields[relationshipName] = {
|
|
55437
|
-
displayValue: null,
|
|
55438
|
-
value: null,
|
|
55439
|
-
};
|
|
55440
|
-
}
|
|
55441
|
-
// for custom objects, we select the 'Name' field
|
|
55442
|
-
// otherwise we check the object info for name fields.
|
|
55443
|
-
//if there are multiple we select 'Name' if it exists, otherwise the first one
|
|
55444
|
-
if (referencedRecord !== undefined && referenceToInfos.length > 0) {
|
|
55445
|
-
let nameField;
|
|
55446
|
-
const referenceToInfo = referenceToInfos[0];
|
|
55447
|
-
const nameFields = referenceToInfo.nameFields;
|
|
55448
|
-
if (nameFields.length !== 0) {
|
|
55449
|
-
nameField = nameFields.find((x) => x === 'Name');
|
|
55450
|
-
if (nameField === undefined) {
|
|
55451
|
-
nameField = nameFields[0];
|
|
55452
|
-
}
|
|
55453
|
-
}
|
|
55454
|
-
if (nameField !== undefined) {
|
|
55455
|
-
const nameFieldRef = referencedRecord.fields[nameField];
|
|
55456
|
-
if (nameFieldRef) {
|
|
55457
|
-
recordFields[relationshipName].displayValue =
|
|
55458
|
-
(_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
|
|
55459
|
-
}
|
|
55460
|
-
}
|
|
55461
|
-
}
|
|
55462
|
-
}
|
|
55463
55423
|
}
|
|
55464
55424
|
}
|
|
55465
55425
|
}
|
|
@@ -55533,9 +55493,78 @@
|
|
|
55533
55493
|
},
|
|
55534
55494
|
};
|
|
55535
55495
|
}
|
|
55496
|
+
function applyReferenceLinksToDraft(record, draftMetadata) {
|
|
55497
|
+
var _a;
|
|
55498
|
+
const { objectInfos, referencedRecords, luvio } = draftMetadata;
|
|
55499
|
+
const objectInfo = objectInfos.get(record.apiName);
|
|
55500
|
+
if (objectInfo === undefined) {
|
|
55501
|
+
return record;
|
|
55502
|
+
}
|
|
55503
|
+
let fieldNames = Object.keys(record.fields);
|
|
55504
|
+
const recordFields = { ...record.fields };
|
|
55505
|
+
for (const draftField of fieldNames) {
|
|
55506
|
+
const fieldInfo = objectInfo.fields[draftField];
|
|
55507
|
+
if (fieldInfo === undefined) {
|
|
55508
|
+
continue;
|
|
55509
|
+
}
|
|
55510
|
+
const { dataType, relationshipName, referenceToInfos } = fieldInfo;
|
|
55511
|
+
const draftFieldValue = record.fields[draftField].value;
|
|
55512
|
+
if (dataType === 'Reference' && relationshipName !== null && draftFieldValue !== null) {
|
|
55513
|
+
if (typeof draftFieldValue !== 'string') {
|
|
55514
|
+
throw Error('reference field value is not a string');
|
|
55515
|
+
}
|
|
55516
|
+
const key = getRecordKeyForId(luvio, draftFieldValue);
|
|
55517
|
+
const referencedRecord = referencedRecords.get(key);
|
|
55518
|
+
recordFields[relationshipName] = {
|
|
55519
|
+
displayValue: null,
|
|
55520
|
+
value: createLink$2(key),
|
|
55521
|
+
};
|
|
55522
|
+
// for custom objects, we select the 'Name' field
|
|
55523
|
+
// otherwise we check the object info for name fields.
|
|
55524
|
+
//if there are multiple we select 'Name' if it exists, otherwise the first one
|
|
55525
|
+
if (referencedRecord !== undefined && referenceToInfos.length > 0) {
|
|
55526
|
+
let nameField;
|
|
55527
|
+
const referenceToInfo = referenceToInfos[0];
|
|
55528
|
+
const nameFields = referenceToInfo.nameFields;
|
|
55529
|
+
if (nameFields.length !== 0) {
|
|
55530
|
+
nameField = nameFields.find((x) => x === 'Name');
|
|
55531
|
+
if (nameField === undefined) {
|
|
55532
|
+
nameField = nameFields[0];
|
|
55533
|
+
}
|
|
55534
|
+
}
|
|
55535
|
+
if (nameField !== undefined) {
|
|
55536
|
+
const nameFieldRef = referencedRecord.fields[nameField];
|
|
55537
|
+
if (nameFieldRef) {
|
|
55538
|
+
recordFields[relationshipName].displayValue =
|
|
55539
|
+
(_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
|
|
55540
|
+
}
|
|
55541
|
+
}
|
|
55542
|
+
}
|
|
55543
|
+
}
|
|
55544
|
+
}
|
|
55545
|
+
return { ...record, fields: recordFields };
|
|
55546
|
+
}
|
|
55536
55547
|
function createLink$2(key) {
|
|
55537
55548
|
return { __ref: key };
|
|
55538
55549
|
}
|
|
55550
|
+
function getReferenceInfoForKey(fieldName, field, luvio, objectInfo) {
|
|
55551
|
+
const { dataType, relationshipName } = objectInfo.fields[fieldName];
|
|
55552
|
+
const draftFieldValue = field.value;
|
|
55553
|
+
if (dataType === 'Reference' && relationshipName !== null && draftFieldValue !== null) {
|
|
55554
|
+
if (typeof draftFieldValue !== 'string') {
|
|
55555
|
+
throw Error('reference field value is not a string');
|
|
55556
|
+
}
|
|
55557
|
+
const key = getRecordKeyForId(luvio, draftFieldValue);
|
|
55558
|
+
return {
|
|
55559
|
+
referenceFieldName: relationshipName,
|
|
55560
|
+
field: {
|
|
55561
|
+
displayValue: null,
|
|
55562
|
+
value: createLink$2(key),
|
|
55563
|
+
},
|
|
55564
|
+
};
|
|
55565
|
+
}
|
|
55566
|
+
return undefined;
|
|
55567
|
+
}
|
|
55539
55568
|
|
|
55540
55569
|
async function getAdapterData(adapter, config) {
|
|
55541
55570
|
const snapshot = await adapter(config);
|
|
@@ -55727,8 +55756,7 @@
|
|
|
55727
55756
|
*
|
|
55728
55757
|
* @param action The draft action related to this record
|
|
55729
55758
|
* @param _queue The draft queue
|
|
55730
|
-
* @returns The record with the updated draft queue applied.
|
|
55731
|
-
* deep to ensure that reference links are properly established during ingestion to it
|
|
55759
|
+
* @returns The record with the updated draft queue applied. References are not included and must be applied at ingest.
|
|
55732
55760
|
*
|
|
55733
55761
|
* or
|
|
55734
55762
|
*
|
|
@@ -55752,7 +55780,7 @@
|
|
|
55752
55780
|
if (recordWithDrafts === undefined) {
|
|
55753
55781
|
return undefined;
|
|
55754
55782
|
}
|
|
55755
|
-
return
|
|
55783
|
+
return filterOutReferenceFieldsAndLinks(recordWithDrafts);
|
|
55756
55784
|
}
|
|
55757
55785
|
const record = await this.durableStore.getDenormalizedRecord(key);
|
|
55758
55786
|
if (record === undefined) {
|
|
@@ -55763,7 +55791,7 @@
|
|
|
55763
55791
|
if (recordWithDrafts === undefined) {
|
|
55764
55792
|
return recordWithDrafts;
|
|
55765
55793
|
}
|
|
55766
|
-
return
|
|
55794
|
+
return filterOutReferenceFieldsAndLinks(recordWithDrafts);
|
|
55767
55795
|
}
|
|
55768
55796
|
applyDraftsToIncomingData(key, data, draftMetadata, publishData) {
|
|
55769
55797
|
if (isField(key)) {
|
|
@@ -55790,19 +55818,26 @@
|
|
|
55790
55818
|
}
|
|
55791
55819
|
}
|
|
55792
55820
|
const recordWithDrafts = replayDraftsOnRecord(partialRecord, draftMetadata);
|
|
55821
|
+
const recordWithSpanningRefLinks = applyReferenceLinksToDraft(recordWithDrafts, draftMetadata);
|
|
55793
55822
|
// publish the normalized fields
|
|
55794
55823
|
const normalizedRecord = {
|
|
55795
|
-
...
|
|
55824
|
+
...recordWithSpanningRefLinks,
|
|
55796
55825
|
...data,
|
|
55797
55826
|
fields: { ...data.fields },
|
|
55798
55827
|
};
|
|
55799
|
-
for (const fieldName of
|
|
55828
|
+
for (const fieldName of keys$2$1(recordWithSpanningRefLinks.fields)) {
|
|
55800
55829
|
const fieldKey = buildRecordFieldStoreKey(key, fieldName);
|
|
55801
55830
|
if (this.collectedFields[fieldKey] !== undefined) {
|
|
55802
|
-
const fieldData =
|
|
55831
|
+
const fieldData = recordWithSpanningRefLinks.fields[fieldName];
|
|
55803
55832
|
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55804
55833
|
publishData(fieldKey, fieldData);
|
|
55805
55834
|
}
|
|
55835
|
+
else if (recordWithSpanningRefLinks.fields[fieldName] &&
|
|
55836
|
+
recordWithSpanningRefLinks.fields[fieldName].value &&
|
|
55837
|
+
recordWithSpanningRefLinks.fields[fieldName].value.__ref !== undefined) {
|
|
55838
|
+
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55839
|
+
publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
|
|
55840
|
+
}
|
|
55806
55841
|
}
|
|
55807
55842
|
// publish the normalized record
|
|
55808
55843
|
publishData(key, normalizedRecord);
|
|
@@ -56980,27 +57015,10 @@
|
|
|
56980
57015
|
if (contentVersion === undefined) {
|
|
56981
57016
|
return undefined;
|
|
56982
57017
|
}
|
|
56983
|
-
// this lambda can be shared across the calls to resolveReferencesOneLevelDeep
|
|
56984
|
-
const luvio = this.getLuvio();
|
|
56985
|
-
const contentDocumentKey = getRecordKeyForId(luvio, contentDocumentId);
|
|
56986
|
-
const contentDocumentLinkKey = getRecordKeyForId(luvio, contentDocumentLinkId);
|
|
56987
|
-
const contentVersionKey = getRecordKeyForId(luvio, contentVersionId);
|
|
56988
|
-
const getRecordFromKey = async (key) => {
|
|
56989
|
-
if (key === contentDocumentKey) {
|
|
56990
|
-
return contentDocRecord;
|
|
56991
|
-
}
|
|
56992
|
-
if (key === contentDocumentLinkKey) {
|
|
56993
|
-
return contentDocLink;
|
|
56994
|
-
}
|
|
56995
|
-
if (key === contentVersionKey) {
|
|
56996
|
-
return contentVersion;
|
|
56997
|
-
}
|
|
56998
|
-
return this.durableStore.getDenormalizedRecord(key);
|
|
56999
|
-
};
|
|
57000
57018
|
// finally we resolve all references for each record
|
|
57001
|
-
const contentDocResolved = await
|
|
57002
|
-
const contentDocLinkResolved = await
|
|
57003
|
-
const contentVersionResolved = await
|
|
57019
|
+
const contentDocResolved = await filterOutReferenceFieldsAndLinks(contentDocRecord);
|
|
57020
|
+
const contentDocLinkResolved = await filterOutReferenceFieldsAndLinks(contentDocLink);
|
|
57021
|
+
const contentVersionResolved = await filterOutReferenceFieldsAndLinks(contentVersion);
|
|
57004
57022
|
return {
|
|
57005
57023
|
contentDocument: contentDocResolved,
|
|
57006
57024
|
contentDocumentLinks: [contentDocLinkResolved],
|
|
@@ -57779,6 +57797,10 @@
|
|
|
57779
57797
|
}
|
|
57780
57798
|
|
|
57781
57799
|
const MAX_STRING_LENGTH_PER_CHUNK = 10000;
|
|
57800
|
+
//Salesforce/Akamai cdn uri max size is 8898 bytes, short than normal. Per
|
|
57801
|
+
//https://help.salesforce.com/s/articleView?id=sf.community_builder_cdn_considerations.htm&type=5
|
|
57802
|
+
//Due to we don't know the domain ResourceRequest, here we give 8000
|
|
57803
|
+
const MAX_URL_LENGTH = 8000;
|
|
57782
57804
|
const PARSE_ERROR = 'PARSE_AGGREGATE_UI_RESPONSE_ERROR';
|
|
57783
57805
|
function isErrorResponse(response) {
|
|
57784
57806
|
return response.httpStatusCode >= 400;
|
|
@@ -57857,8 +57879,8 @@
|
|
|
57857
57879
|
}
|
|
57858
57880
|
return `${resourceRequest.baseUri}${resourceRequest.basePath}?${join$1.call(queryString, '&')}`;
|
|
57859
57881
|
}
|
|
57860
|
-
function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray) {
|
|
57861
|
-
return fieldsArray.length + optionalFieldsArray.length >=
|
|
57882
|
+
function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray, maxLengthPerChunk) {
|
|
57883
|
+
return fieldsArray.length + optionalFieldsArray.length >= maxLengthPerChunk;
|
|
57862
57884
|
}
|
|
57863
57885
|
function isSpanningRecord(fieldValue) {
|
|
57864
57886
|
return fieldValue !== null && typeof fieldValue === 'object';
|
|
@@ -57921,14 +57943,15 @@
|
|
|
57921
57943
|
if (fieldsArray.length === 0 && optionalFieldsArray.length === 0) {
|
|
57922
57944
|
return undefined;
|
|
57923
57945
|
}
|
|
57946
|
+
const allowedMaxStringLengthPerChunk = getMaxLengthPerChunkAllowed(resourceRequest);
|
|
57924
57947
|
const fieldsString = fieldsArray.join(',');
|
|
57925
57948
|
const optionalFieldsString = optionalFieldsArray.join(',');
|
|
57926
|
-
const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString);
|
|
57949
|
+
const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString, allowedMaxStringLengthPerChunk);
|
|
57927
57950
|
if (!shouldUseAggregate) {
|
|
57928
57951
|
return undefined;
|
|
57929
57952
|
}
|
|
57930
|
-
const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(
|
|
57931
|
-
const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(
|
|
57953
|
+
const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(allowedMaxStringLengthPerChunk);
|
|
57954
|
+
const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(allowedMaxStringLengthPerChunk);
|
|
57932
57955
|
return {
|
|
57933
57956
|
fieldCollection,
|
|
57934
57957
|
optionalFieldCollection,
|
|
@@ -58001,6 +58024,25 @@
|
|
|
58001
58024
|
function arrayOrEmpty(array) {
|
|
58002
58025
|
return array !== undefined && isArray$6(array) ? array : [];
|
|
58003
58026
|
}
|
|
58027
|
+
/**
|
|
58028
|
+
* Calculate the max lengh per chunk.
|
|
58029
|
+
* If useShortUrlGate is open, allow max chunk size is MAX_URL_LENGTH - the url without fields and optional fields in url.
|
|
58030
|
+
* Otherwise MAX_STRING_LENGTH_PER_CHUNK
|
|
58031
|
+
* @param resourceRequest
|
|
58032
|
+
* @returns
|
|
58033
|
+
*/
|
|
58034
|
+
function getMaxLengthPerChunkAllowed(request) {
|
|
58035
|
+
if (!ldsUseShortUrlGate.isOpen({ fallback: false })) {
|
|
58036
|
+
return MAX_STRING_LENGTH_PER_CHUNK;
|
|
58037
|
+
}
|
|
58038
|
+
// Too much work to get exact length of the final url, so use stringified json to get the rough length.
|
|
58039
|
+
const roughUrlLengthWithoutFieldsAndOptionFields = request.basePath.length +
|
|
58040
|
+
request.baseUri.length +
|
|
58041
|
+
(request.urlParams ? stringify$1$1(request.urlParams).length : 0) +
|
|
58042
|
+
stringify$1$1({ ...request.queryParams, fields: {}, optionalFields: {} }).length;
|
|
58043
|
+
// MAX_URL_LENGTH - full lenght without fields, optionalFields
|
|
58044
|
+
return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
|
|
58045
|
+
}
|
|
58004
58046
|
|
|
58005
58047
|
const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
|
|
58006
58048
|
const referenceId$3 = 'LDS_Records_AggregateUi';
|
|
@@ -60079,7 +60121,7 @@
|
|
|
60079
60121
|
id: '@salesforce/lds-network-adapter',
|
|
60080
60122
|
instrument: instrument$1,
|
|
60081
60123
|
});
|
|
60082
|
-
// version: 1.163.
|
|
60124
|
+
// version: 1.163.2-1950176a9
|
|
60083
60125
|
|
|
60084
60126
|
const { create: create$2, keys: keys$2 } = Object;
|
|
60085
60127
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -77561,7 +77603,7 @@
|
|
|
77561
77603
|
configuration: { ...configurationForGraphQLAdapters },
|
|
77562
77604
|
instrument,
|
|
77563
77605
|
});
|
|
77564
|
-
// version: 1.163.
|
|
77606
|
+
// version: 1.163.2-2fcc92bea
|
|
77565
77607
|
|
|
77566
77608
|
// On core the unstable adapters are re-exported with different names,
|
|
77567
77609
|
|
|
@@ -79808,7 +79850,7 @@
|
|
|
79808
79850
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
79809
79851
|
graphQLImperative = ldsAdapter;
|
|
79810
79852
|
});
|
|
79811
|
-
// version: 1.163.
|
|
79853
|
+
// version: 1.163.2-2fcc92bea
|
|
79812
79854
|
|
|
79813
79855
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
79814
79856
|
__proto__: null,
|
|
@@ -80514,4 +80556,4 @@
|
|
|
80514
80556
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
80515
80557
|
|
|
80516
80558
|
}));
|
|
80517
|
-
// version: 1.163.
|
|
80559
|
+
// version: 1.163.2-1950176a9
|