@salesforce/lds-worker-api 1.181.1 → 1.182.1
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.
|
|
773
|
+
// version: 1.182.1-d7f385c5a
|
|
@@ -3799,7 +3799,7 @@ function withDefaultLuvio(callback) {
|
|
|
3799
3799
|
}
|
|
3800
3800
|
callbacks.push(callback);
|
|
3801
3801
|
}
|
|
3802
|
-
// version: 1.
|
|
3802
|
+
// version: 1.182.1-d7f385c5a
|
|
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.
|
|
15235
|
+
// version: 1.182.1-d7f385c5a
|
|
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.
|
|
16148
|
+
// version: 1.182.1-d7f385c5a
|
|
16149
16149
|
|
|
16150
16150
|
/**
|
|
16151
16151
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -20298,6 +20298,8 @@ function toSortedStringArray(value) {
|
|
|
20298
20298
|
}
|
|
20299
20299
|
return undefined;
|
|
20300
20300
|
}
|
|
20301
|
+
|
|
20302
|
+
const adapterName$K = 'getRecord';
|
|
20301
20303
|
function createResourceParams$U(config) {
|
|
20302
20304
|
const resourceParams = {
|
|
20303
20305
|
urlParams: {
|
|
@@ -23427,7 +23429,7 @@ const factory$h = (luvio) => function getMruListUi(untrustedConfig, requestConte
|
|
|
23427
23429
|
: processListInfo(listInfoPromiseOrSnapshot);
|
|
23428
23430
|
};
|
|
23429
23431
|
|
|
23430
|
-
const contextId$
|
|
23432
|
+
const contextId$5 = `${keyPrefix$1}__getListUi`;
|
|
23431
23433
|
// eslint-disable-next-line @salesforce/lds/no-invalid-todo
|
|
23432
23434
|
// TODO RAML - this more properly goes in the generated resource files
|
|
23433
23435
|
const DEFAULT_PAGE_SIZE = 50;
|
|
@@ -23856,7 +23858,7 @@ const factory$g = (luvio) => {
|
|
|
23856
23858
|
return listUiAdapter(untrustedConfig, adapterContext, requestContext);
|
|
23857
23859
|
}
|
|
23858
23860
|
return null;
|
|
23859
|
-
}, { contextId: contextId$
|
|
23861
|
+
}, { contextId: contextId$5 });
|
|
23860
23862
|
};
|
|
23861
23863
|
|
|
23862
23864
|
const TTL$t = 900000;
|
|
@@ -25258,6 +25260,10 @@ function buildSnapshotRefresh$3(luvio, config) {
|
|
|
25258
25260
|
resolve: () => refresh$1(luvio, config),
|
|
25259
25261
|
};
|
|
25260
25262
|
}
|
|
25263
|
+
function buildObjectInfoSelectorKey(luvio, objectInfo) {
|
|
25264
|
+
const key = keyBuilderFromType$s(luvio, objectInfo);
|
|
25265
|
+
return `${key}__implicit__fields__selector`;
|
|
25266
|
+
}
|
|
25261
25267
|
function refresh$1(luvio, config) {
|
|
25262
25268
|
const { recordId, layoutTypes, modes: configModes, optionalFields: configOptionalFields, } = config;
|
|
25263
25269
|
const modes = configModes === undefined ? [DEFAULT_MODE] : configModes;
|
|
@@ -25307,7 +25313,13 @@ function getLayoutMapAndObjectInfo(recordId, data) {
|
|
|
25307
25313
|
objectInfo,
|
|
25308
25314
|
};
|
|
25309
25315
|
}
|
|
25310
|
-
function
|
|
25316
|
+
function getFields(recordId, data) {
|
|
25317
|
+
const { records } = data;
|
|
25318
|
+
const record = records[recordId];
|
|
25319
|
+
const { fields } = record;
|
|
25320
|
+
return fields;
|
|
25321
|
+
}
|
|
25322
|
+
function processRecordUiRepresentation(luvio, refresh, recordId, modes, snapshot, adapterContext, optionalFields) {
|
|
25311
25323
|
if (isErrorSnapshot(snapshot)) {
|
|
25312
25324
|
return luvio.errorSnapshot(snapshot.error, refresh);
|
|
25313
25325
|
}
|
|
@@ -25318,7 +25330,12 @@ function processRecordUiRepresentation(luvio, refresh, recordId, modes, snapshot
|
|
|
25318
25330
|
throw new Error(`RecordUi adapter resolved with a ${snapshot.state} snapshot with undefined data`);
|
|
25319
25331
|
}
|
|
25320
25332
|
const { layoutMap, objectInfo } = getLayoutMapAndObjectInfo(recordId, data);
|
|
25321
|
-
|
|
25333
|
+
if (objectInfo.layoutable) {
|
|
25334
|
+
return getRecordForLayoutableEntities(luvio, refresh, recordId, layoutMap, objectInfo, optionalFields);
|
|
25335
|
+
}
|
|
25336
|
+
else {
|
|
25337
|
+
return getRecordForNonLayoutableEntities(luvio, adapterContext, refresh, recordId, objectInfo, optionalFields, getFields(recordId, data));
|
|
25338
|
+
}
|
|
25322
25339
|
}
|
|
25323
25340
|
const recordLayoutFragmentSelector = [
|
|
25324
25341
|
{
|
|
@@ -25345,8 +25362,20 @@ function getFieldsFromLayoutMap(layoutMap, objectInfo) {
|
|
|
25345
25362
|
}
|
|
25346
25363
|
return dedupe(fields).sort();
|
|
25347
25364
|
}
|
|
25348
|
-
function
|
|
25365
|
+
function getRecordForLayoutableEntities(luvio, refresh, recordId, layoutMap, objectInfo, configOptionalFields) {
|
|
25349
25366
|
const fields = getFieldsFromLayoutMap(layoutMap, objectInfo);
|
|
25367
|
+
return getRecord$1(luvio, refresh, recordId, fields, configOptionalFields);
|
|
25368
|
+
}
|
|
25369
|
+
function getRecordForNonLayoutableEntities(luvio, adapterContext, refresh, recordId, objectInfo, configOptionalFields, configFields) {
|
|
25370
|
+
const fields = keys$9(configFields ? configFields : {}).map((key) => `${objectInfo.apiName}.${key}`);
|
|
25371
|
+
// W-12697744
|
|
25372
|
+
// Set the implicit fields received from the server in adapter context
|
|
25373
|
+
// This ensures that the implicit fields are available when data is read locally or from durable store
|
|
25374
|
+
const selectorKey = buildObjectInfoSelectorKey(luvio, objectInfo);
|
|
25375
|
+
adapterContext.set(selectorKey, fields);
|
|
25376
|
+
return getRecord$1(luvio, refresh, recordId, fields, configOptionalFields);
|
|
25377
|
+
}
|
|
25378
|
+
function getRecord$1(luvio, refresh, recordId, fields, configOptionalFields) {
|
|
25350
25379
|
const optionalFields = configOptionalFields === undefined ? [] : dedupe(configOptionalFields).sort();
|
|
25351
25380
|
// We know what fields we need so delegate to getRecordByFields
|
|
25352
25381
|
// This should be a cache hit because we just fetched the record-ui
|
|
@@ -25368,7 +25397,7 @@ function getRecord$1(luvio, refresh, recordId, layoutMap, objectInfo, configOpti
|
|
|
25368
25397
|
return recordSnapshotOrPromise;
|
|
25369
25398
|
}
|
|
25370
25399
|
function buildNetworkSnapshot$S(context, coercedAdapterRequestContext) {
|
|
25371
|
-
const { config, luvio } = context;
|
|
25400
|
+
const { config, luvio, adapterContext } = context;
|
|
25372
25401
|
const { recordId } = config;
|
|
25373
25402
|
const optionalFields = config.optionalFields === undefined ? [] : dedupe(config.optionalFields).sort();
|
|
25374
25403
|
const refresh = buildSnapshotRefresh$3(luvio, config);
|
|
@@ -25405,7 +25434,7 @@ function buildNetworkSnapshot$S(context, coercedAdapterRequestContext) {
|
|
|
25405
25434
|
modes,
|
|
25406
25435
|
optionalFields,
|
|
25407
25436
|
};
|
|
25408
|
-
return buildNetworkSnapshot$T(luvio, recordUiConfig, dispatchOptions).then((snapshot) => processRecordUiRepresentation(luvio, refresh, recordId, modes, snapshot, optionalFields));
|
|
25437
|
+
return buildNetworkSnapshot$T(luvio, recordUiConfig, dispatchOptions).then((snapshot) => processRecordUiRepresentation(luvio, refresh, recordId, modes, snapshot, adapterContext, optionalFields));
|
|
25409
25438
|
}
|
|
25410
25439
|
function buildRecordLayoutCachedSnapshot(context, storeLookup) {
|
|
25411
25440
|
const { config, luvio } = context;
|
|
@@ -25457,13 +25486,13 @@ const buildLayoutModeCacheSnapshot = (apiName, recordTypeId, layoutType, mode) =
|
|
|
25457
25486
|
* @param {GetRecordLayoutTypeConfig} config
|
|
25458
25487
|
* @param {BuildCachedSnapshot<BuildSnapshotContext} cachedSnapshot
|
|
25459
25488
|
*/
|
|
25460
|
-
function makeCacheOnlySnapshot(luvio, config, cachedSnapshot) {
|
|
25489
|
+
function makeCacheOnlySnapshot(luvio, config, adapterContext, cachedSnapshot) {
|
|
25461
25490
|
return luvio.applyCachePolicy({
|
|
25462
25491
|
cachePolicy: {
|
|
25463
25492
|
// only looking in the cache so we can check for L2 data offline
|
|
25464
25493
|
type: 'only-if-cached',
|
|
25465
25494
|
},
|
|
25466
|
-
}, { config, luvio }, cachedSnapshot,
|
|
25495
|
+
}, { config, luvio, adapterContext }, cachedSnapshot,
|
|
25467
25496
|
// this won't be invoked since we're requesting only-if-cached
|
|
25468
25497
|
() => {
|
|
25469
25498
|
throw Error('buildNetworkSnapshot should not be called for only-if-cached policy');
|
|
@@ -25476,37 +25505,50 @@ function makeCacheOnlySnapshot(luvio, config, cachedSnapshot) {
|
|
|
25476
25505
|
* @param {GetRecordLayoutTypeConfig} config
|
|
25477
25506
|
* @param {AdapterRequestContext} requestContext?
|
|
25478
25507
|
*/
|
|
25479
|
-
function makeNetworkOnlySnapshot(luvio, config, requestContext) {
|
|
25480
|
-
return luvio.applyCachePolicy(requestContext || {}, { config, luvio }, () => {
|
|
25508
|
+
function makeNetworkOnlySnapshot(luvio, config, adapterContext, requestContext) {
|
|
25509
|
+
return luvio.applyCachePolicy(requestContext || {}, { config, luvio, adapterContext }, () => {
|
|
25481
25510
|
return undefined;
|
|
25482
25511
|
}, buildNetworkSnapshot$S);
|
|
25483
25512
|
}
|
|
25484
|
-
function getRecordLayoutType(luvio, config, requestContext) {
|
|
25513
|
+
function getRecordLayoutType(luvio, config, adapterContext, requestContext) {
|
|
25485
25514
|
// lookup record layout
|
|
25486
|
-
const recordLayoutSnapshotOrPromise = makeCacheOnlySnapshot(luvio, config, buildRecordLayoutCachedSnapshot);
|
|
25515
|
+
const recordLayoutSnapshotOrPromise = makeCacheOnlySnapshot(luvio, config, adapterContext, buildRecordLayoutCachedSnapshot);
|
|
25487
25516
|
return runSnapshotOrPromise(recordLayoutSnapshotOrPromise, (recordLayoutSnapshot) => {
|
|
25488
25517
|
// if record layout is not fulfulled or data is undefined send to the network
|
|
25489
25518
|
if (recordLayoutSnapshot.state === 'Unfulfilled' ||
|
|
25490
25519
|
recordLayoutSnapshot.state === 'Error' ||
|
|
25491
25520
|
recordLayoutSnapshot.data === undefined) {
|
|
25492
|
-
return makeNetworkOnlySnapshot(luvio, config, requestContext);
|
|
25521
|
+
return makeNetworkOnlySnapshot(luvio, config, adapterContext, requestContext);
|
|
25493
25522
|
}
|
|
25494
25523
|
// lookup object info
|
|
25495
|
-
const objectInfoSnapshotOrPromise = makeCacheOnlySnapshot(luvio, config, buildObjectInfoCacheSnapshot(recordLayoutSnapshot));
|
|
25524
|
+
const objectInfoSnapshotOrPromise = makeCacheOnlySnapshot(luvio, config, adapterContext, buildObjectInfoCacheSnapshot(recordLayoutSnapshot));
|
|
25496
25525
|
return runSnapshotOrPromise(objectInfoSnapshotOrPromise, (objectInfoSnapshot) => {
|
|
25497
25526
|
const { layoutTypes } = config;
|
|
25498
25527
|
// if not fulfilled or missing data send to the network
|
|
25499
25528
|
if (objectInfoSnapshot.state === 'Unfulfilled' ||
|
|
25500
25529
|
objectInfoSnapshot.state === 'Error' ||
|
|
25501
25530
|
objectInfoSnapshot.data === undefined) {
|
|
25502
|
-
return makeNetworkOnlySnapshot(luvio, config, requestContext);
|
|
25531
|
+
return makeNetworkOnlySnapshot(luvio, config, adapterContext, requestContext);
|
|
25503
25532
|
}
|
|
25504
25533
|
const { data: record } = recordLayoutSnapshot;
|
|
25505
25534
|
// try to load all the requested layouts from cache
|
|
25506
25535
|
const recordTypeId = getRecordTypeId$2(record);
|
|
25507
25536
|
const modes = config.modes === undefined ? [DEFAULT_MODE] : config.modes;
|
|
25508
|
-
|
|
25509
|
-
|
|
25537
|
+
// W-12697744
|
|
25538
|
+
// For non-layoutable entities, use the implicit fields as the fields are not available in layout
|
|
25539
|
+
// Fields can be fetched from adapter context if the server request was already made at some point in the past
|
|
25540
|
+
// If fields are not available in adapter context, make a network request to get the data
|
|
25541
|
+
// and store implicit fields in adapter context.
|
|
25542
|
+
if (!objectInfoSnapshot.data.layoutable) {
|
|
25543
|
+
const selectorKey = buildObjectInfoSelectorKey(luvio, objectInfoSnapshot.data);
|
|
25544
|
+
const fields = adapterContext.get(selectorKey);
|
|
25545
|
+
if (!fields) {
|
|
25546
|
+
return makeNetworkOnlySnapshot(luvio, config, adapterContext, requestContext);
|
|
25547
|
+
}
|
|
25548
|
+
return luvio.applyCachePolicy(requestContext || {}, { config, luvio, adapterContext }, buildRecordSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields), buildNetworkSnapshot$S);
|
|
25549
|
+
}
|
|
25550
|
+
return makeRecordLayoutMap(luvio, config, objectInfoSnapshot.data.apiName, recordTypeId, layoutTypes, modes, adapterContext).then((recordLayoutMap) => {
|
|
25551
|
+
return luvio.applyCachePolicy(requestContext || {}, { config, luvio, adapterContext }, buildRecordLayoutSnapshot(recordLayoutMap, luvio, config, recordLayoutSnapshot, objectInfoSnapshot), buildNetworkSnapshot$S);
|
|
25510
25552
|
});
|
|
25511
25553
|
});
|
|
25512
25554
|
});
|
|
@@ -25521,13 +25563,13 @@ function getRecordLayoutType(luvio, config, requestContext) {
|
|
|
25521
25563
|
* @param {LayoutType[]} layoutTypes
|
|
25522
25564
|
* @param {LayoutMode[]} modes
|
|
25523
25565
|
*/
|
|
25524
|
-
function makeRecordLayoutMap(luvio, config, apiName, recordTypeId, layoutTypes, modes) {
|
|
25566
|
+
function makeRecordLayoutMap(luvio, config, apiName, recordTypeId, layoutTypes, modes, adapterContext) {
|
|
25525
25567
|
let promises = [];
|
|
25526
25568
|
for (let i = 0; i < layoutTypes.length; i++) {
|
|
25527
25569
|
const layoutType = layoutTypes[i];
|
|
25528
25570
|
for (let m = 0; m < modes.length; m++) {
|
|
25529
25571
|
const mode = modes[m];
|
|
25530
|
-
promises.push(Promise.resolve(makeCacheOnlySnapshot(luvio, config, buildLayoutModeCacheSnapshot(apiName, recordTypeId, layoutType, mode))).then((snapshot) => {
|
|
25572
|
+
promises.push(Promise.resolve(makeCacheOnlySnapshot(luvio, config, adapterContext, buildLayoutModeCacheSnapshot(apiName, recordTypeId, layoutType, mode))).then((snapshot) => {
|
|
25531
25573
|
return {
|
|
25532
25574
|
layoutType,
|
|
25533
25575
|
mode,
|
|
@@ -25567,34 +25609,46 @@ function makeRecordLayoutMap(luvio, config, apiName, recordTypeId, layoutTypes,
|
|
|
25567
25609
|
}
|
|
25568
25610
|
function buildRecordLayoutSnapshot(recordLayout, luvio, config, recordLayoutSnapshot, objectInfoSnapshot) {
|
|
25569
25611
|
return (context, storeLookup) => {
|
|
25570
|
-
const { layoutMap, isStale } = recordLayout;
|
|
25612
|
+
const { layoutMap, isStale: isRecordLayoutStale } = recordLayout;
|
|
25571
25613
|
if (layoutMap === undefined || objectInfoSnapshot.data === undefined) {
|
|
25572
25614
|
return;
|
|
25573
25615
|
}
|
|
25574
25616
|
// transform the layouts & object info into a set of fields
|
|
25575
25617
|
const fields = getFieldsFromLayoutMap(layoutMap, objectInfoSnapshot.data);
|
|
25576
|
-
|
|
25577
|
-
const { recordId } = config;
|
|
25578
|
-
// borrow GetRecordFields' logic to construct the RecordRepresentation with the necessary fields
|
|
25579
|
-
const sel = buildRecordSelector(luvio, recordId, fields, optionalFields);
|
|
25580
|
-
const recordRepSnapshot = storeLookup(sel, buildSnapshotRefresh$3(luvio, config));
|
|
25581
|
-
if (isFulfilledSnapshot(recordRepSnapshot)) {
|
|
25582
|
-
// mark snapshot as stale if any of the information used to construct it was stale
|
|
25583
|
-
if (isStaleSnapshot(recordLayoutSnapshot) ||
|
|
25584
|
-
isStaleSnapshot(objectInfoSnapshot) ||
|
|
25585
|
-
isStale) {
|
|
25586
|
-
recordRepSnapshot.state = 'Stale';
|
|
25587
|
-
}
|
|
25588
|
-
}
|
|
25589
|
-
// allow buildNetworkSnapshot() to use GetRecordFields if we were just missing some fields in L1
|
|
25590
|
-
else if (isUnfulfilledSnapshot$2(recordRepSnapshot)) {
|
|
25591
|
-
context.fields = fields;
|
|
25592
|
-
}
|
|
25593
|
-
// return however much of the record we were able to find in L1; cache policy decides if we
|
|
25594
|
-
// should consult L2 or go to network
|
|
25595
|
-
return recordRepSnapshot;
|
|
25618
|
+
return getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields, isRecordLayoutStale, context, storeLookup);
|
|
25596
25619
|
};
|
|
25597
25620
|
}
|
|
25621
|
+
function buildRecordSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields) {
|
|
25622
|
+
return (context, storeLookup) => {
|
|
25623
|
+
return getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields, false, context, storeLookup);
|
|
25624
|
+
};
|
|
25625
|
+
}
|
|
25626
|
+
function getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields, isRecordLayoutStale, context, storeLookup) {
|
|
25627
|
+
if (objectInfoSnapshot.data === undefined) {
|
|
25628
|
+
return;
|
|
25629
|
+
}
|
|
25630
|
+
// transform the layouts & object info into a set of fields
|
|
25631
|
+
const optionalFields = config.optionalFields === undefined ? [] : dedupe(config.optionalFields).sort();
|
|
25632
|
+
const { recordId } = config;
|
|
25633
|
+
// borrow GetRecordFields' logic to construct the RecordRepresentation with the necessary fields
|
|
25634
|
+
const sel = buildRecordSelector(luvio, recordId, fields, optionalFields);
|
|
25635
|
+
const recordRepSnapshot = storeLookup(sel, buildSnapshotRefresh$3(luvio, config));
|
|
25636
|
+
if (isFulfilledSnapshot(recordRepSnapshot)) {
|
|
25637
|
+
// mark snapshot as stale if any of the information used to construct it was stale
|
|
25638
|
+
if (isStaleSnapshot(objectInfoSnapshot) ||
|
|
25639
|
+
isStaleSnapshot(recordLayoutSnapshot) ||
|
|
25640
|
+
isRecordLayoutStale) {
|
|
25641
|
+
recordRepSnapshot.state = 'Stale';
|
|
25642
|
+
}
|
|
25643
|
+
}
|
|
25644
|
+
// allow buildNetworkSnapshot() to use GetRecordFields if we were just missing some fields in L1
|
|
25645
|
+
else if (isUnfulfilledSnapshot$2(recordRepSnapshot)) {
|
|
25646
|
+
context.fields = fields;
|
|
25647
|
+
}
|
|
25648
|
+
// return however much of the record we were able to find in L1; cache policy decides if we
|
|
25649
|
+
// should consult L2 or go to network
|
|
25650
|
+
return recordRepSnapshot;
|
|
25651
|
+
}
|
|
25598
25652
|
function runSnapshotOrPromise(promiseOrSnapshot, next) {
|
|
25599
25653
|
if (isPromise(promiseOrSnapshot)) {
|
|
25600
25654
|
return promiseOrSnapshot.then(next);
|
|
@@ -25604,6 +25658,7 @@ function runSnapshotOrPromise(promiseOrSnapshot, next) {
|
|
|
25604
25658
|
}
|
|
25605
25659
|
}
|
|
25606
25660
|
|
|
25661
|
+
const contextId$4 = `${keyPrefix$1}__${adapterName$K}`;
|
|
25607
25662
|
// Custom adapter config due to `unsupported` items
|
|
25608
25663
|
const GET_RECORD_ADAPTER_CONFIG = {
|
|
25609
25664
|
displayName: 'getRecord',
|
|
@@ -25694,19 +25749,21 @@ const notifyChangeFactory = (luvio) => {
|
|
|
25694
25749
|
});
|
|
25695
25750
|
};
|
|
25696
25751
|
};
|
|
25697
|
-
const factory$e = (luvio) =>
|
|
25698
|
-
|
|
25699
|
-
|
|
25700
|
-
|
|
25752
|
+
const factory$e = (luvio) => {
|
|
25753
|
+
return luvio.withContext(function getRecord(untrustedConfig, adapterContext, requestContext) {
|
|
25754
|
+
// standard config validation and coercion
|
|
25755
|
+
const config = validateAdapterConfig$$(untrustedConfig, GET_RECORD_ADAPTER_CONFIG);
|
|
25756
|
+
if (config === null) {
|
|
25757
|
+
return null;
|
|
25758
|
+
}
|
|
25759
|
+
if (hasLayoutTypes(config)) {
|
|
25760
|
+
return getRecordLayoutType(luvio, config, adapterContext, requestContext);
|
|
25761
|
+
}
|
|
25762
|
+
else if (hasFieldsOrOptionalFields(config)) {
|
|
25763
|
+
return getRecordByFields(luvio, config, requestContext);
|
|
25764
|
+
}
|
|
25701
25765
|
return null;
|
|
25702
|
-
}
|
|
25703
|
-
if (hasLayoutTypes(config)) {
|
|
25704
|
-
return getRecordLayoutType(luvio, config, requestContext);
|
|
25705
|
-
}
|
|
25706
|
-
else if (hasFieldsOrOptionalFields(config)) {
|
|
25707
|
-
return getRecordByFields(luvio, config, requestContext);
|
|
25708
|
-
}
|
|
25709
|
-
return null;
|
|
25766
|
+
}, { contextId: contextId$4 });
|
|
25710
25767
|
};
|
|
25711
25768
|
|
|
25712
25769
|
const VERSION$W$1 = "7e00c51105cbf56a79ab8fcddf462c1e";
|
|
@@ -43191,7 +43248,7 @@ function createResourceRequest$3(config) {
|
|
|
43191
43248
|
};
|
|
43192
43249
|
}
|
|
43193
43250
|
|
|
43194
|
-
const adapterName$
|
|
43251
|
+
const adapterName$L = 'deleteRecord';
|
|
43195
43252
|
const deleteRecord_ConfigPropertyNames = {
|
|
43196
43253
|
displayName: 'deleteRecord',
|
|
43197
43254
|
parameters: {
|
|
@@ -43257,7 +43314,7 @@ const deleteRecordAdapterFactory = (luvio) => {
|
|
|
43257
43314
|
const config = validateAdapterConfig$3(untrustedConfig, deleteRecord_ConfigPropertyNames);
|
|
43258
43315
|
// Invalid or incomplete config
|
|
43259
43316
|
if (config === null) {
|
|
43260
|
-
throw new Error(`Invalid config for "${adapterName$
|
|
43317
|
+
throw new Error(`Invalid config for "${adapterName$L}"`);
|
|
43261
43318
|
}
|
|
43262
43319
|
return buildNetworkSnapshot$3(luvio, config);
|
|
43263
43320
|
};
|
|
@@ -44444,7 +44501,7 @@ withDefaultLuvio((luvio) => {
|
|
|
44444
44501
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44445
44502
|
});
|
|
44446
44503
|
});
|
|
44447
|
-
// version: 1.
|
|
44504
|
+
// version: 1.182.1-cf10900c2
|
|
44448
44505
|
|
|
44449
44506
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44450
44507
|
|
|
@@ -60664,7 +60721,7 @@ register({
|
|
|
60664
60721
|
id: '@salesforce/lds-network-adapter',
|
|
60665
60722
|
instrument: instrument$1,
|
|
60666
60723
|
});
|
|
60667
|
-
// version: 1.
|
|
60724
|
+
// version: 1.182.1-d7f385c5a
|
|
60668
60725
|
|
|
60669
60726
|
const { create: create$2, keys: keys$2 } = Object;
|
|
60670
60727
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -78007,7 +78064,7 @@ register({
|
|
|
78007
78064
|
configuration: { ...configurationForGraphQLAdapters },
|
|
78008
78065
|
instrument,
|
|
78009
78066
|
});
|
|
78010
|
-
// version: 1.
|
|
78067
|
+
// version: 1.182.1-cf10900c2
|
|
78011
78068
|
|
|
78012
78069
|
// On core the unstable adapters are re-exported with different names,
|
|
78013
78070
|
|
|
@@ -80254,7 +80311,7 @@ withDefaultLuvio((luvio) => {
|
|
|
80254
80311
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
80255
80312
|
graphQLImperative = ldsAdapter;
|
|
80256
80313
|
});
|
|
80257
|
-
// version: 1.
|
|
80314
|
+
// version: 1.182.1-cf10900c2
|
|
80258
80315
|
|
|
80259
80316
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
80260
80317
|
__proto__: null,
|
|
@@ -80943,4 +81000,4 @@ const { luvio } = getRuntime();
|
|
|
80943
81000
|
setDefaultLuvio({ luvio });
|
|
80944
81001
|
|
|
80945
81002
|
export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
|
|
80946
|
-
// version: 1.
|
|
81003
|
+
// version: 1.182.1-d7f385c5a
|
|
@@ -3805,7 +3805,7 @@
|
|
|
3805
3805
|
}
|
|
3806
3806
|
callbacks.push(callback);
|
|
3807
3807
|
}
|
|
3808
|
-
// version: 1.
|
|
3808
|
+
// version: 1.182.1-d7f385c5a
|
|
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.
|
|
15241
|
+
// version: 1.182.1-d7f385c5a
|
|
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.
|
|
16154
|
+
// version: 1.182.1-d7f385c5a
|
|
16155
16155
|
|
|
16156
16156
|
/**
|
|
16157
16157
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -20304,6 +20304,8 @@
|
|
|
20304
20304
|
}
|
|
20305
20305
|
return undefined;
|
|
20306
20306
|
}
|
|
20307
|
+
|
|
20308
|
+
const adapterName$K = 'getRecord';
|
|
20307
20309
|
function createResourceParams$U(config) {
|
|
20308
20310
|
const resourceParams = {
|
|
20309
20311
|
urlParams: {
|
|
@@ -23433,7 +23435,7 @@
|
|
|
23433
23435
|
: processListInfo(listInfoPromiseOrSnapshot);
|
|
23434
23436
|
};
|
|
23435
23437
|
|
|
23436
|
-
const contextId$
|
|
23438
|
+
const contextId$5 = `${keyPrefix$1}__getListUi`;
|
|
23437
23439
|
// eslint-disable-next-line @salesforce/lds/no-invalid-todo
|
|
23438
23440
|
// TODO RAML - this more properly goes in the generated resource files
|
|
23439
23441
|
const DEFAULT_PAGE_SIZE = 50;
|
|
@@ -23862,7 +23864,7 @@
|
|
|
23862
23864
|
return listUiAdapter(untrustedConfig, adapterContext, requestContext);
|
|
23863
23865
|
}
|
|
23864
23866
|
return null;
|
|
23865
|
-
}, { contextId: contextId$
|
|
23867
|
+
}, { contextId: contextId$5 });
|
|
23866
23868
|
};
|
|
23867
23869
|
|
|
23868
23870
|
const TTL$t = 900000;
|
|
@@ -25264,6 +25266,10 @@
|
|
|
25264
25266
|
resolve: () => refresh$1(luvio, config),
|
|
25265
25267
|
};
|
|
25266
25268
|
}
|
|
25269
|
+
function buildObjectInfoSelectorKey(luvio, objectInfo) {
|
|
25270
|
+
const key = keyBuilderFromType$s(luvio, objectInfo);
|
|
25271
|
+
return `${key}__implicit__fields__selector`;
|
|
25272
|
+
}
|
|
25267
25273
|
function refresh$1(luvio, config) {
|
|
25268
25274
|
const { recordId, layoutTypes, modes: configModes, optionalFields: configOptionalFields, } = config;
|
|
25269
25275
|
const modes = configModes === undefined ? [DEFAULT_MODE] : configModes;
|
|
@@ -25313,7 +25319,13 @@
|
|
|
25313
25319
|
objectInfo,
|
|
25314
25320
|
};
|
|
25315
25321
|
}
|
|
25316
|
-
function
|
|
25322
|
+
function getFields(recordId, data) {
|
|
25323
|
+
const { records } = data;
|
|
25324
|
+
const record = records[recordId];
|
|
25325
|
+
const { fields } = record;
|
|
25326
|
+
return fields;
|
|
25327
|
+
}
|
|
25328
|
+
function processRecordUiRepresentation(luvio, refresh, recordId, modes, snapshot, adapterContext, optionalFields) {
|
|
25317
25329
|
if (isErrorSnapshot(snapshot)) {
|
|
25318
25330
|
return luvio.errorSnapshot(snapshot.error, refresh);
|
|
25319
25331
|
}
|
|
@@ -25324,7 +25336,12 @@
|
|
|
25324
25336
|
throw new Error(`RecordUi adapter resolved with a ${snapshot.state} snapshot with undefined data`);
|
|
25325
25337
|
}
|
|
25326
25338
|
const { layoutMap, objectInfo } = getLayoutMapAndObjectInfo(recordId, data);
|
|
25327
|
-
|
|
25339
|
+
if (objectInfo.layoutable) {
|
|
25340
|
+
return getRecordForLayoutableEntities(luvio, refresh, recordId, layoutMap, objectInfo, optionalFields);
|
|
25341
|
+
}
|
|
25342
|
+
else {
|
|
25343
|
+
return getRecordForNonLayoutableEntities(luvio, adapterContext, refresh, recordId, objectInfo, optionalFields, getFields(recordId, data));
|
|
25344
|
+
}
|
|
25328
25345
|
}
|
|
25329
25346
|
const recordLayoutFragmentSelector = [
|
|
25330
25347
|
{
|
|
@@ -25351,8 +25368,20 @@
|
|
|
25351
25368
|
}
|
|
25352
25369
|
return dedupe(fields).sort();
|
|
25353
25370
|
}
|
|
25354
|
-
function
|
|
25371
|
+
function getRecordForLayoutableEntities(luvio, refresh, recordId, layoutMap, objectInfo, configOptionalFields) {
|
|
25355
25372
|
const fields = getFieldsFromLayoutMap(layoutMap, objectInfo);
|
|
25373
|
+
return getRecord$1(luvio, refresh, recordId, fields, configOptionalFields);
|
|
25374
|
+
}
|
|
25375
|
+
function getRecordForNonLayoutableEntities(luvio, adapterContext, refresh, recordId, objectInfo, configOptionalFields, configFields) {
|
|
25376
|
+
const fields = keys$9(configFields ? configFields : {}).map((key) => `${objectInfo.apiName}.${key}`);
|
|
25377
|
+
// W-12697744
|
|
25378
|
+
// Set the implicit fields received from the server in adapter context
|
|
25379
|
+
// This ensures that the implicit fields are available when data is read locally or from durable store
|
|
25380
|
+
const selectorKey = buildObjectInfoSelectorKey(luvio, objectInfo);
|
|
25381
|
+
adapterContext.set(selectorKey, fields);
|
|
25382
|
+
return getRecord$1(luvio, refresh, recordId, fields, configOptionalFields);
|
|
25383
|
+
}
|
|
25384
|
+
function getRecord$1(luvio, refresh, recordId, fields, configOptionalFields) {
|
|
25356
25385
|
const optionalFields = configOptionalFields === undefined ? [] : dedupe(configOptionalFields).sort();
|
|
25357
25386
|
// We know what fields we need so delegate to getRecordByFields
|
|
25358
25387
|
// This should be a cache hit because we just fetched the record-ui
|
|
@@ -25374,7 +25403,7 @@
|
|
|
25374
25403
|
return recordSnapshotOrPromise;
|
|
25375
25404
|
}
|
|
25376
25405
|
function buildNetworkSnapshot$S(context, coercedAdapterRequestContext) {
|
|
25377
|
-
const { config, luvio } = context;
|
|
25406
|
+
const { config, luvio, adapterContext } = context;
|
|
25378
25407
|
const { recordId } = config;
|
|
25379
25408
|
const optionalFields = config.optionalFields === undefined ? [] : dedupe(config.optionalFields).sort();
|
|
25380
25409
|
const refresh = buildSnapshotRefresh$3(luvio, config);
|
|
@@ -25411,7 +25440,7 @@
|
|
|
25411
25440
|
modes,
|
|
25412
25441
|
optionalFields,
|
|
25413
25442
|
};
|
|
25414
|
-
return buildNetworkSnapshot$T(luvio, recordUiConfig, dispatchOptions).then((snapshot) => processRecordUiRepresentation(luvio, refresh, recordId, modes, snapshot, optionalFields));
|
|
25443
|
+
return buildNetworkSnapshot$T(luvio, recordUiConfig, dispatchOptions).then((snapshot) => processRecordUiRepresentation(luvio, refresh, recordId, modes, snapshot, adapterContext, optionalFields));
|
|
25415
25444
|
}
|
|
25416
25445
|
function buildRecordLayoutCachedSnapshot(context, storeLookup) {
|
|
25417
25446
|
const { config, luvio } = context;
|
|
@@ -25463,13 +25492,13 @@
|
|
|
25463
25492
|
* @param {GetRecordLayoutTypeConfig} config
|
|
25464
25493
|
* @param {BuildCachedSnapshot<BuildSnapshotContext} cachedSnapshot
|
|
25465
25494
|
*/
|
|
25466
|
-
function makeCacheOnlySnapshot(luvio, config, cachedSnapshot) {
|
|
25495
|
+
function makeCacheOnlySnapshot(luvio, config, adapterContext, cachedSnapshot) {
|
|
25467
25496
|
return luvio.applyCachePolicy({
|
|
25468
25497
|
cachePolicy: {
|
|
25469
25498
|
// only looking in the cache so we can check for L2 data offline
|
|
25470
25499
|
type: 'only-if-cached',
|
|
25471
25500
|
},
|
|
25472
|
-
}, { config, luvio }, cachedSnapshot,
|
|
25501
|
+
}, { config, luvio, adapterContext }, cachedSnapshot,
|
|
25473
25502
|
// this won't be invoked since we're requesting only-if-cached
|
|
25474
25503
|
() => {
|
|
25475
25504
|
throw Error('buildNetworkSnapshot should not be called for only-if-cached policy');
|
|
@@ -25482,37 +25511,50 @@
|
|
|
25482
25511
|
* @param {GetRecordLayoutTypeConfig} config
|
|
25483
25512
|
* @param {AdapterRequestContext} requestContext?
|
|
25484
25513
|
*/
|
|
25485
|
-
function makeNetworkOnlySnapshot(luvio, config, requestContext) {
|
|
25486
|
-
return luvio.applyCachePolicy(requestContext || {}, { config, luvio }, () => {
|
|
25514
|
+
function makeNetworkOnlySnapshot(luvio, config, adapterContext, requestContext) {
|
|
25515
|
+
return luvio.applyCachePolicy(requestContext || {}, { config, luvio, adapterContext }, () => {
|
|
25487
25516
|
return undefined;
|
|
25488
25517
|
}, buildNetworkSnapshot$S);
|
|
25489
25518
|
}
|
|
25490
|
-
function getRecordLayoutType(luvio, config, requestContext) {
|
|
25519
|
+
function getRecordLayoutType(luvio, config, adapterContext, requestContext) {
|
|
25491
25520
|
// lookup record layout
|
|
25492
|
-
const recordLayoutSnapshotOrPromise = makeCacheOnlySnapshot(luvio, config, buildRecordLayoutCachedSnapshot);
|
|
25521
|
+
const recordLayoutSnapshotOrPromise = makeCacheOnlySnapshot(luvio, config, adapterContext, buildRecordLayoutCachedSnapshot);
|
|
25493
25522
|
return runSnapshotOrPromise(recordLayoutSnapshotOrPromise, (recordLayoutSnapshot) => {
|
|
25494
25523
|
// if record layout is not fulfulled or data is undefined send to the network
|
|
25495
25524
|
if (recordLayoutSnapshot.state === 'Unfulfilled' ||
|
|
25496
25525
|
recordLayoutSnapshot.state === 'Error' ||
|
|
25497
25526
|
recordLayoutSnapshot.data === undefined) {
|
|
25498
|
-
return makeNetworkOnlySnapshot(luvio, config, requestContext);
|
|
25527
|
+
return makeNetworkOnlySnapshot(luvio, config, adapterContext, requestContext);
|
|
25499
25528
|
}
|
|
25500
25529
|
// lookup object info
|
|
25501
|
-
const objectInfoSnapshotOrPromise = makeCacheOnlySnapshot(luvio, config, buildObjectInfoCacheSnapshot(recordLayoutSnapshot));
|
|
25530
|
+
const objectInfoSnapshotOrPromise = makeCacheOnlySnapshot(luvio, config, adapterContext, buildObjectInfoCacheSnapshot(recordLayoutSnapshot));
|
|
25502
25531
|
return runSnapshotOrPromise(objectInfoSnapshotOrPromise, (objectInfoSnapshot) => {
|
|
25503
25532
|
const { layoutTypes } = config;
|
|
25504
25533
|
// if not fulfilled or missing data send to the network
|
|
25505
25534
|
if (objectInfoSnapshot.state === 'Unfulfilled' ||
|
|
25506
25535
|
objectInfoSnapshot.state === 'Error' ||
|
|
25507
25536
|
objectInfoSnapshot.data === undefined) {
|
|
25508
|
-
return makeNetworkOnlySnapshot(luvio, config, requestContext);
|
|
25537
|
+
return makeNetworkOnlySnapshot(luvio, config, adapterContext, requestContext);
|
|
25509
25538
|
}
|
|
25510
25539
|
const { data: record } = recordLayoutSnapshot;
|
|
25511
25540
|
// try to load all the requested layouts from cache
|
|
25512
25541
|
const recordTypeId = getRecordTypeId$2(record);
|
|
25513
25542
|
const modes = config.modes === undefined ? [DEFAULT_MODE] : config.modes;
|
|
25514
|
-
|
|
25515
|
-
|
|
25543
|
+
// W-12697744
|
|
25544
|
+
// For non-layoutable entities, use the implicit fields as the fields are not available in layout
|
|
25545
|
+
// Fields can be fetched from adapter context if the server request was already made at some point in the past
|
|
25546
|
+
// If fields are not available in adapter context, make a network request to get the data
|
|
25547
|
+
// and store implicit fields in adapter context.
|
|
25548
|
+
if (!objectInfoSnapshot.data.layoutable) {
|
|
25549
|
+
const selectorKey = buildObjectInfoSelectorKey(luvio, objectInfoSnapshot.data);
|
|
25550
|
+
const fields = adapterContext.get(selectorKey);
|
|
25551
|
+
if (!fields) {
|
|
25552
|
+
return makeNetworkOnlySnapshot(luvio, config, adapterContext, requestContext);
|
|
25553
|
+
}
|
|
25554
|
+
return luvio.applyCachePolicy(requestContext || {}, { config, luvio, adapterContext }, buildRecordSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields), buildNetworkSnapshot$S);
|
|
25555
|
+
}
|
|
25556
|
+
return makeRecordLayoutMap(luvio, config, objectInfoSnapshot.data.apiName, recordTypeId, layoutTypes, modes, adapterContext).then((recordLayoutMap) => {
|
|
25557
|
+
return luvio.applyCachePolicy(requestContext || {}, { config, luvio, adapterContext }, buildRecordLayoutSnapshot(recordLayoutMap, luvio, config, recordLayoutSnapshot, objectInfoSnapshot), buildNetworkSnapshot$S);
|
|
25516
25558
|
});
|
|
25517
25559
|
});
|
|
25518
25560
|
});
|
|
@@ -25527,13 +25569,13 @@
|
|
|
25527
25569
|
* @param {LayoutType[]} layoutTypes
|
|
25528
25570
|
* @param {LayoutMode[]} modes
|
|
25529
25571
|
*/
|
|
25530
|
-
function makeRecordLayoutMap(luvio, config, apiName, recordTypeId, layoutTypes, modes) {
|
|
25572
|
+
function makeRecordLayoutMap(luvio, config, apiName, recordTypeId, layoutTypes, modes, adapterContext) {
|
|
25531
25573
|
let promises = [];
|
|
25532
25574
|
for (let i = 0; i < layoutTypes.length; i++) {
|
|
25533
25575
|
const layoutType = layoutTypes[i];
|
|
25534
25576
|
for (let m = 0; m < modes.length; m++) {
|
|
25535
25577
|
const mode = modes[m];
|
|
25536
|
-
promises.push(Promise.resolve(makeCacheOnlySnapshot(luvio, config, buildLayoutModeCacheSnapshot(apiName, recordTypeId, layoutType, mode))).then((snapshot) => {
|
|
25578
|
+
promises.push(Promise.resolve(makeCacheOnlySnapshot(luvio, config, adapterContext, buildLayoutModeCacheSnapshot(apiName, recordTypeId, layoutType, mode))).then((snapshot) => {
|
|
25537
25579
|
return {
|
|
25538
25580
|
layoutType,
|
|
25539
25581
|
mode,
|
|
@@ -25573,34 +25615,46 @@
|
|
|
25573
25615
|
}
|
|
25574
25616
|
function buildRecordLayoutSnapshot(recordLayout, luvio, config, recordLayoutSnapshot, objectInfoSnapshot) {
|
|
25575
25617
|
return (context, storeLookup) => {
|
|
25576
|
-
const { layoutMap, isStale } = recordLayout;
|
|
25618
|
+
const { layoutMap, isStale: isRecordLayoutStale } = recordLayout;
|
|
25577
25619
|
if (layoutMap === undefined || objectInfoSnapshot.data === undefined) {
|
|
25578
25620
|
return;
|
|
25579
25621
|
}
|
|
25580
25622
|
// transform the layouts & object info into a set of fields
|
|
25581
25623
|
const fields = getFieldsFromLayoutMap(layoutMap, objectInfoSnapshot.data);
|
|
25582
|
-
|
|
25583
|
-
const { recordId } = config;
|
|
25584
|
-
// borrow GetRecordFields' logic to construct the RecordRepresentation with the necessary fields
|
|
25585
|
-
const sel = buildRecordSelector(luvio, recordId, fields, optionalFields);
|
|
25586
|
-
const recordRepSnapshot = storeLookup(sel, buildSnapshotRefresh$3(luvio, config));
|
|
25587
|
-
if (isFulfilledSnapshot(recordRepSnapshot)) {
|
|
25588
|
-
// mark snapshot as stale if any of the information used to construct it was stale
|
|
25589
|
-
if (isStaleSnapshot(recordLayoutSnapshot) ||
|
|
25590
|
-
isStaleSnapshot(objectInfoSnapshot) ||
|
|
25591
|
-
isStale) {
|
|
25592
|
-
recordRepSnapshot.state = 'Stale';
|
|
25593
|
-
}
|
|
25594
|
-
}
|
|
25595
|
-
// allow buildNetworkSnapshot() to use GetRecordFields if we were just missing some fields in L1
|
|
25596
|
-
else if (isUnfulfilledSnapshot$2(recordRepSnapshot)) {
|
|
25597
|
-
context.fields = fields;
|
|
25598
|
-
}
|
|
25599
|
-
// return however much of the record we were able to find in L1; cache policy decides if we
|
|
25600
|
-
// should consult L2 or go to network
|
|
25601
|
-
return recordRepSnapshot;
|
|
25624
|
+
return getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields, isRecordLayoutStale, context, storeLookup);
|
|
25602
25625
|
};
|
|
25603
25626
|
}
|
|
25627
|
+
function buildRecordSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields) {
|
|
25628
|
+
return (context, storeLookup) => {
|
|
25629
|
+
return getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields, false, context, storeLookup);
|
|
25630
|
+
};
|
|
25631
|
+
}
|
|
25632
|
+
function getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields, isRecordLayoutStale, context, storeLookup) {
|
|
25633
|
+
if (objectInfoSnapshot.data === undefined) {
|
|
25634
|
+
return;
|
|
25635
|
+
}
|
|
25636
|
+
// transform the layouts & object info into a set of fields
|
|
25637
|
+
const optionalFields = config.optionalFields === undefined ? [] : dedupe(config.optionalFields).sort();
|
|
25638
|
+
const { recordId } = config;
|
|
25639
|
+
// borrow GetRecordFields' logic to construct the RecordRepresentation with the necessary fields
|
|
25640
|
+
const sel = buildRecordSelector(luvio, recordId, fields, optionalFields);
|
|
25641
|
+
const recordRepSnapshot = storeLookup(sel, buildSnapshotRefresh$3(luvio, config));
|
|
25642
|
+
if (isFulfilledSnapshot(recordRepSnapshot)) {
|
|
25643
|
+
// mark snapshot as stale if any of the information used to construct it was stale
|
|
25644
|
+
if (isStaleSnapshot(objectInfoSnapshot) ||
|
|
25645
|
+
isStaleSnapshot(recordLayoutSnapshot) ||
|
|
25646
|
+
isRecordLayoutStale) {
|
|
25647
|
+
recordRepSnapshot.state = 'Stale';
|
|
25648
|
+
}
|
|
25649
|
+
}
|
|
25650
|
+
// allow buildNetworkSnapshot() to use GetRecordFields if we were just missing some fields in L1
|
|
25651
|
+
else if (isUnfulfilledSnapshot$2(recordRepSnapshot)) {
|
|
25652
|
+
context.fields = fields;
|
|
25653
|
+
}
|
|
25654
|
+
// return however much of the record we were able to find in L1; cache policy decides if we
|
|
25655
|
+
// should consult L2 or go to network
|
|
25656
|
+
return recordRepSnapshot;
|
|
25657
|
+
}
|
|
25604
25658
|
function runSnapshotOrPromise(promiseOrSnapshot, next) {
|
|
25605
25659
|
if (isPromise(promiseOrSnapshot)) {
|
|
25606
25660
|
return promiseOrSnapshot.then(next);
|
|
@@ -25610,6 +25664,7 @@
|
|
|
25610
25664
|
}
|
|
25611
25665
|
}
|
|
25612
25666
|
|
|
25667
|
+
const contextId$4 = `${keyPrefix$1}__${adapterName$K}`;
|
|
25613
25668
|
// Custom adapter config due to `unsupported` items
|
|
25614
25669
|
const GET_RECORD_ADAPTER_CONFIG = {
|
|
25615
25670
|
displayName: 'getRecord',
|
|
@@ -25700,19 +25755,21 @@
|
|
|
25700
25755
|
});
|
|
25701
25756
|
};
|
|
25702
25757
|
};
|
|
25703
|
-
const factory$e = (luvio) =>
|
|
25704
|
-
|
|
25705
|
-
|
|
25706
|
-
|
|
25758
|
+
const factory$e = (luvio) => {
|
|
25759
|
+
return luvio.withContext(function getRecord(untrustedConfig, adapterContext, requestContext) {
|
|
25760
|
+
// standard config validation and coercion
|
|
25761
|
+
const config = validateAdapterConfig$$(untrustedConfig, GET_RECORD_ADAPTER_CONFIG);
|
|
25762
|
+
if (config === null) {
|
|
25763
|
+
return null;
|
|
25764
|
+
}
|
|
25765
|
+
if (hasLayoutTypes(config)) {
|
|
25766
|
+
return getRecordLayoutType(luvio, config, adapterContext, requestContext);
|
|
25767
|
+
}
|
|
25768
|
+
else if (hasFieldsOrOptionalFields(config)) {
|
|
25769
|
+
return getRecordByFields(luvio, config, requestContext);
|
|
25770
|
+
}
|
|
25707
25771
|
return null;
|
|
25708
|
-
}
|
|
25709
|
-
if (hasLayoutTypes(config)) {
|
|
25710
|
-
return getRecordLayoutType(luvio, config, requestContext);
|
|
25711
|
-
}
|
|
25712
|
-
else if (hasFieldsOrOptionalFields(config)) {
|
|
25713
|
-
return getRecordByFields(luvio, config, requestContext);
|
|
25714
|
-
}
|
|
25715
|
-
return null;
|
|
25772
|
+
}, { contextId: contextId$4 });
|
|
25716
25773
|
};
|
|
25717
25774
|
|
|
25718
25775
|
const VERSION$W$1 = "7e00c51105cbf56a79ab8fcddf462c1e";
|
|
@@ -43197,7 +43254,7 @@
|
|
|
43197
43254
|
};
|
|
43198
43255
|
}
|
|
43199
43256
|
|
|
43200
|
-
const adapterName$
|
|
43257
|
+
const adapterName$L = 'deleteRecord';
|
|
43201
43258
|
const deleteRecord_ConfigPropertyNames = {
|
|
43202
43259
|
displayName: 'deleteRecord',
|
|
43203
43260
|
parameters: {
|
|
@@ -43263,7 +43320,7 @@
|
|
|
43263
43320
|
const config = validateAdapterConfig$3(untrustedConfig, deleteRecord_ConfigPropertyNames);
|
|
43264
43321
|
// Invalid or incomplete config
|
|
43265
43322
|
if (config === null) {
|
|
43266
|
-
throw new Error(`Invalid config for "${adapterName$
|
|
43323
|
+
throw new Error(`Invalid config for "${adapterName$L}"`);
|
|
43267
43324
|
}
|
|
43268
43325
|
return buildNetworkSnapshot$3(luvio, config);
|
|
43269
43326
|
};
|
|
@@ -44450,7 +44507,7 @@
|
|
|
44450
44507
|
dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
|
|
44451
44508
|
});
|
|
44452
44509
|
});
|
|
44453
|
-
// version: 1.
|
|
44510
|
+
// version: 1.182.1-cf10900c2
|
|
44454
44511
|
|
|
44455
44512
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
44456
44513
|
|
|
@@ -60670,7 +60727,7 @@
|
|
|
60670
60727
|
id: '@salesforce/lds-network-adapter',
|
|
60671
60728
|
instrument: instrument$1,
|
|
60672
60729
|
});
|
|
60673
|
-
// version: 1.
|
|
60730
|
+
// version: 1.182.1-d7f385c5a
|
|
60674
60731
|
|
|
60675
60732
|
const { create: create$2, keys: keys$2 } = Object;
|
|
60676
60733
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -78013,7 +78070,7 @@
|
|
|
78013
78070
|
configuration: { ...configurationForGraphQLAdapters },
|
|
78014
78071
|
instrument,
|
|
78015
78072
|
});
|
|
78016
|
-
// version: 1.
|
|
78073
|
+
// version: 1.182.1-cf10900c2
|
|
78017
78074
|
|
|
78018
78075
|
// On core the unstable adapters are re-exported with different names,
|
|
78019
78076
|
|
|
@@ -80260,7 +80317,7 @@
|
|
|
80260
80317
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
80261
80318
|
graphQLImperative = ldsAdapter;
|
|
80262
80319
|
});
|
|
80263
|
-
// version: 1.
|
|
80320
|
+
// version: 1.182.1-cf10900c2
|
|
80264
80321
|
|
|
80265
80322
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
80266
80323
|
__proto__: null,
|
|
@@ -80966,4 +81023,4 @@
|
|
|
80966
81023
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
80967
81024
|
|
|
80968
81025
|
}));
|
|
80969
|
-
// version: 1.
|
|
81026
|
+
// version: 1.182.1-d7f385c5a
|