@salesforce/lds-worker-api 1.332.0-dev20 → 1.332.0-dev21
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.
|
@@ -1128,4 +1128,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
|
|
1130
1130
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
1131
|
-
// version: 1.332.0-
|
|
1131
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
@@ -4265,7 +4265,7 @@ function withDefaultLuvio(callback) {
|
|
|
4265
4265
|
}
|
|
4266
4266
|
callbacks.push(callback);
|
|
4267
4267
|
}
|
|
4268
|
-
// version: 1.332.0-
|
|
4268
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
4269
4269
|
|
|
4270
4270
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4271
4271
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5213,7 +5213,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
5213
5213
|
const { apiFamily, name } = metadata;
|
|
5214
5214
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5215
5215
|
}
|
|
5216
|
-
// version: 1.332.0-
|
|
5216
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
5217
5217
|
|
|
5218
5218
|
/**
|
|
5219
5219
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -29711,6 +29711,7 @@ const getKeywordSearchResults_ConfigPropertyMetadata$1 = [
|
|
|
29711
29711
|
generateParamConfigMetadata$3('objectApiName', true, 1 /* QueryParameter */, 0 /* String */),
|
|
29712
29712
|
generateParamConfigMetadata$3('q', true, 1 /* QueryParameter */, 0 /* String */),
|
|
29713
29713
|
generateParamConfigMetadata$3('configurationName', false, 2 /* Body */, 0 /* String */),
|
|
29714
|
+
generateParamConfigMetadata$3('dataCategories', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
29714
29715
|
generateParamConfigMetadata$3('filters', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
29715
29716
|
generateParamConfigMetadata$3('pageSize', false, 2 /* Body */, 3 /* Integer */),
|
|
29716
29717
|
generateParamConfigMetadata$3('pageToken', false, 2 /* Body */, 0 /* String */),
|
|
@@ -29725,6 +29726,18 @@ function keyBuilder$a$2(luvio, config) {
|
|
|
29725
29726
|
function typeCheckConfig$c$1(untrustedConfig) {
|
|
29726
29727
|
const config = {};
|
|
29727
29728
|
typeCheckConfig$18(untrustedConfig, config, getKeywordSearchResults_ConfigPropertyMetadata$1);
|
|
29729
|
+
const untrustedConfig_dataCategories = untrustedConfig.dataCategories;
|
|
29730
|
+
if (ArrayIsArray$1$1(untrustedConfig_dataCategories)) {
|
|
29731
|
+
const untrustedConfig_dataCategories_array = [];
|
|
29732
|
+
for (let i = 0, arrayLength = untrustedConfig_dataCategories.length; i < arrayLength; i++) {
|
|
29733
|
+
const untrustedConfig_dataCategories_item = untrustedConfig_dataCategories[i];
|
|
29734
|
+
const referenceSearchDataCategoryInputRepresentationValidationError = validate$n(untrustedConfig_dataCategories_item);
|
|
29735
|
+
if (referenceSearchDataCategoryInputRepresentationValidationError === null) {
|
|
29736
|
+
untrustedConfig_dataCategories_array.push(untrustedConfig_dataCategories_item);
|
|
29737
|
+
}
|
|
29738
|
+
}
|
|
29739
|
+
config.dataCategories = untrustedConfig_dataCategories_array;
|
|
29740
|
+
}
|
|
29728
29741
|
const untrustedConfig_filters = untrustedConfig.filters;
|
|
29729
29742
|
if (ArrayIsArray$1$1(untrustedConfig_filters)) {
|
|
29730
29743
|
const untrustedConfig_filters_array = [];
|
|
@@ -33856,7 +33869,7 @@ withDefaultLuvio((luvio) => {
|
|
|
33856
33869
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
33857
33870
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
33858
33871
|
});
|
|
33859
|
-
// version: 1.332.0-
|
|
33872
|
+
// version: 1.332.0-dev21-cc02503f9d
|
|
33860
33873
|
|
|
33861
33874
|
/**
|
|
33862
33875
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -90059,6 +90072,12 @@ function buildFieldUnionArray(existingRecord, incomingRecord, objectInfo) {
|
|
|
90059
90072
|
fieldUnion.push(`${fieldName}.Id`);
|
|
90060
90073
|
includesSpanningFields = true;
|
|
90061
90074
|
}
|
|
90075
|
+
else {
|
|
90076
|
+
// Field exists on record but not in object info.
|
|
90077
|
+
// Fall back to getRecords resolver in this case.
|
|
90078
|
+
fieldUnion.push(fieldName);
|
|
90079
|
+
includesSpanningFields = true;
|
|
90080
|
+
}
|
|
90062
90081
|
}
|
|
90063
90082
|
else {
|
|
90064
90083
|
fieldUnion.push(fieldName);
|
|
@@ -90286,6 +90305,7 @@ class ConflictPool {
|
|
|
90286
90305
|
|
|
90287
90306
|
const DEFAULT_BATCH_SIZE = 500;
|
|
90288
90307
|
const DEFAULT_CONCURRENCY = 6;
|
|
90308
|
+
const MAX_RETRY_COUNT = 2;
|
|
90289
90309
|
class PrimingSession extends EventEmitter {
|
|
90290
90310
|
constructor(config) {
|
|
90291
90311
|
super();
|
|
@@ -90297,6 +90317,7 @@ class PrimingSession extends EventEmitter {
|
|
|
90297
90317
|
this.ldsRecordRefresher = config.ldsRecordRefresher;
|
|
90298
90318
|
this.networkWorkerPool = new AsyncWorkerPool(this.concurrency);
|
|
90299
90319
|
this.conflictPool = new ConflictPool(config.store, this.objectInfoLoader);
|
|
90320
|
+
this.retryTracker = new Map();
|
|
90300
90321
|
}
|
|
90301
90322
|
// function that enqueues priming work
|
|
90302
90323
|
async enqueue(work) {
|
|
@@ -90315,6 +90336,9 @@ class PrimingSession extends EventEmitter {
|
|
|
90315
90336
|
unavailableTypes,
|
|
90316
90337
|
});
|
|
90317
90338
|
if (unavailableIds.length > 0) {
|
|
90339
|
+
for (const id of unavailableIds) {
|
|
90340
|
+
this.retryTracker.delete(id);
|
|
90341
|
+
}
|
|
90318
90342
|
this.emit('error', {
|
|
90319
90343
|
ids: unavailableIds,
|
|
90320
90344
|
code: 'precondition-error',
|
|
@@ -90339,6 +90363,9 @@ class PrimingSession extends EventEmitter {
|
|
|
90339
90363
|
.fetchRecordData(batch, abortController)
|
|
90340
90364
|
.then(async (results) => {
|
|
90341
90365
|
if (abortController.aborted) {
|
|
90366
|
+
for (const id of batch.ids) {
|
|
90367
|
+
this.retryTracker.delete(id);
|
|
90368
|
+
}
|
|
90342
90369
|
return;
|
|
90343
90370
|
}
|
|
90344
90371
|
this.emit('batch-fetched', {
|
|
@@ -90375,6 +90402,9 @@ class PrimingSession extends EventEmitter {
|
|
|
90375
90402
|
code: primingError,
|
|
90376
90403
|
message: `${result.messages.join(',')}`,
|
|
90377
90404
|
});
|
|
90405
|
+
for (const id of result.missingIds) {
|
|
90406
|
+
this.retryTracker.delete(id);
|
|
90407
|
+
}
|
|
90378
90408
|
return;
|
|
90379
90409
|
}
|
|
90380
90410
|
const { missingIds } = result;
|
|
@@ -90398,6 +90428,17 @@ class PrimingSession extends EventEmitter {
|
|
|
90398
90428
|
duration: Date.now() - beforeWrite,
|
|
90399
90429
|
});
|
|
90400
90430
|
if (abortController.aborted) {
|
|
90431
|
+
for (const id of written) {
|
|
90432
|
+
this.retryTracker.delete(id);
|
|
90433
|
+
}
|
|
90434
|
+
for (const id of conflicted) {
|
|
90435
|
+
this.retryTracker.delete(id);
|
|
90436
|
+
}
|
|
90437
|
+
for (const error of errors) {
|
|
90438
|
+
for (const id of error.ids) {
|
|
90439
|
+
this.retryTracker.delete(id);
|
|
90440
|
+
}
|
|
90441
|
+
}
|
|
90401
90442
|
return;
|
|
90402
90443
|
}
|
|
90403
90444
|
if (errors.length > 0) {
|
|
@@ -90407,11 +90448,17 @@ class PrimingSession extends EventEmitter {
|
|
|
90407
90448
|
code: 'unknown',
|
|
90408
90449
|
message: message,
|
|
90409
90450
|
});
|
|
90451
|
+
for (const id of ids) {
|
|
90452
|
+
this.retryTracker.delete(id);
|
|
90453
|
+
}
|
|
90410
90454
|
});
|
|
90411
90455
|
}
|
|
90412
90456
|
// now that the records are persisted, emit the primed event
|
|
90413
90457
|
if (written.length > 0) {
|
|
90414
90458
|
this.emit('primed', Array.from(written));
|
|
90459
|
+
for (const id of written) {
|
|
90460
|
+
this.retryTracker.delete(id);
|
|
90461
|
+
}
|
|
90415
90462
|
}
|
|
90416
90463
|
// if any records could not be written to the store because there were conflicts, handle the conflicts
|
|
90417
90464
|
if (conflicted.length > 0) {
|
|
@@ -90422,14 +90469,39 @@ class PrimingSession extends EventEmitter {
|
|
|
90422
90469
|
async handleWriteConflicts(records, conflicted, abortController) {
|
|
90423
90470
|
const result = await this.conflictPool.enqueueConflictedRecords(records.filter((x) => conflicted.includes(x.id)), abortController);
|
|
90424
90471
|
if (abortController.aborted) {
|
|
90472
|
+
for (const id of conflicted) {
|
|
90473
|
+
this.retryTracker.delete(id);
|
|
90474
|
+
}
|
|
90425
90475
|
return;
|
|
90426
90476
|
}
|
|
90427
|
-
if (
|
|
90477
|
+
if (keys$3(result.additionalWork.records).length > 0) {
|
|
90428
90478
|
this.emit('conflict', {
|
|
90429
90479
|
ids: Object.values(result.additionalWork.records).flatMap((record) => record.ids),
|
|
90430
90480
|
resolution: 'priming-refresh',
|
|
90431
90481
|
});
|
|
90432
|
-
|
|
90482
|
+
// we're re-enqueuing here, so apply retry limits which may change the batches
|
|
90483
|
+
let limitedResult = this.applyRetryLimits(result.additionalWork);
|
|
90484
|
+
this.enqueue(limitedResult.additionalWork);
|
|
90485
|
+
if (limitedResult.recordsNeedingRefetch.size > 0) {
|
|
90486
|
+
for (const key in keys$3(limitedResult.recordsNeedingRefetch)) {
|
|
90487
|
+
const value = limitedResult.recordsNeedingRefetch.get(key);
|
|
90488
|
+
if (result.recordsNeedingRefetch.has(key)) {
|
|
90489
|
+
let existing = result.recordsNeedingRefetch.get(key);
|
|
90490
|
+
existing = {
|
|
90491
|
+
// merge the ids
|
|
90492
|
+
ids: [...existing.ids, ...value.ids],
|
|
90493
|
+
// This is safe because they derive from the same
|
|
90494
|
+
// input, no chance of getting a new field in the
|
|
90495
|
+
// limited result
|
|
90496
|
+
fields: existing.fields,
|
|
90497
|
+
};
|
|
90498
|
+
result.recordsNeedingRefetch.set(key, existing);
|
|
90499
|
+
}
|
|
90500
|
+
else {
|
|
90501
|
+
result.recordsNeedingRefetch.set(key, value);
|
|
90502
|
+
}
|
|
90503
|
+
}
|
|
90504
|
+
}
|
|
90433
90505
|
}
|
|
90434
90506
|
if (result.resolvedRecords.length > 0) {
|
|
90435
90507
|
this.emit('conflict', {
|
|
@@ -90437,8 +90509,14 @@ class PrimingSession extends EventEmitter {
|
|
|
90437
90509
|
resolution: 'priming-merge',
|
|
90438
90510
|
});
|
|
90439
90511
|
this.emit('primed', result.resolvedRecords);
|
|
90512
|
+
for (const id of result.resolvedRecords) {
|
|
90513
|
+
this.retryTracker.delete(id);
|
|
90514
|
+
}
|
|
90440
90515
|
}
|
|
90441
90516
|
if (result.recordsToWrite.length > 0) {
|
|
90517
|
+
for (const record of result.recordsToWrite) {
|
|
90518
|
+
this.retryTracker.delete(record.id);
|
|
90519
|
+
}
|
|
90442
90520
|
const { written, errors, conflicted } = await this.recordIngestor.insertRecords(result.recordsToWrite, true);
|
|
90443
90521
|
if (written.length > 0) {
|
|
90444
90522
|
const ids = Array.from(written);
|
|
@@ -90465,10 +90543,16 @@ class PrimingSession extends EventEmitter {
|
|
|
90465
90543
|
if (result.recordsNeedingRefetch.size > 0) {
|
|
90466
90544
|
const { loaded, errored } = await this.ldsRecordRefresher.loadRecords(result.recordsNeedingRefetch);
|
|
90467
90545
|
if (loaded.length > 0) {
|
|
90546
|
+
for (const id of loaded) {
|
|
90547
|
+
this.retryTracker.delete(id);
|
|
90548
|
+
}
|
|
90468
90549
|
this.emit('conflict', { resolution: 'lds-refresh', ids: loaded });
|
|
90469
90550
|
this.emit('primed', loaded);
|
|
90470
90551
|
}
|
|
90471
90552
|
if (errored.length > 0) {
|
|
90553
|
+
for (const id of errored) {
|
|
90554
|
+
this.retryTracker.delete(id);
|
|
90555
|
+
}
|
|
90472
90556
|
this.emit('error', {
|
|
90473
90557
|
ids: errored,
|
|
90474
90558
|
code: 'unknown',
|
|
@@ -90477,6 +90561,50 @@ class PrimingSession extends EventEmitter {
|
|
|
90477
90561
|
}
|
|
90478
90562
|
}
|
|
90479
90563
|
}
|
|
90564
|
+
applyRetryLimits(primingWork) {
|
|
90565
|
+
// retryable work goes back into priming session
|
|
90566
|
+
let retryableWork = {
|
|
90567
|
+
type: 'record-fields',
|
|
90568
|
+
records: {},
|
|
90569
|
+
};
|
|
90570
|
+
// refetchable work gets delegated to getRecords
|
|
90571
|
+
let refetchableWork = new Map();
|
|
90572
|
+
for (const key of keys$3(primingWork.records)) {
|
|
90573
|
+
let work = primingWork.records[key];
|
|
90574
|
+
let limitedIds = [];
|
|
90575
|
+
for (const id of work.ids) {
|
|
90576
|
+
let retryCount = this.retryTracker.get(id) || 0;
|
|
90577
|
+
retryCount += 1;
|
|
90578
|
+
if (retryCount > MAX_RETRY_COUNT) {
|
|
90579
|
+
limitedIds.push(id);
|
|
90580
|
+
this.retryTracker.delete(id);
|
|
90581
|
+
}
|
|
90582
|
+
else {
|
|
90583
|
+
this.retryTracker.set(id, retryCount);
|
|
90584
|
+
}
|
|
90585
|
+
}
|
|
90586
|
+
if (limitedIds.length < work.ids.length) {
|
|
90587
|
+
retryableWork.records[key] = {
|
|
90588
|
+
ids: work.ids.filter((id) => limitedIds.indexOf(id) === -1),
|
|
90589
|
+
fields: work.fields,
|
|
90590
|
+
};
|
|
90591
|
+
}
|
|
90592
|
+
if (limitedIds.length > 0) {
|
|
90593
|
+
this.emit('retry-limit-reached', { ids: limitedIds });
|
|
90594
|
+
refetchableWork.set(key, {
|
|
90595
|
+
ids: limitedIds,
|
|
90596
|
+
fields: work.fields,
|
|
90597
|
+
});
|
|
90598
|
+
}
|
|
90599
|
+
}
|
|
90600
|
+
return {
|
|
90601
|
+
additionalWork: retryableWork,
|
|
90602
|
+
recordsNeedingRefetch: refetchableWork,
|
|
90603
|
+
resolvedRecords: [],
|
|
90604
|
+
recordsToWrite: [],
|
|
90605
|
+
errors: [],
|
|
90606
|
+
};
|
|
90607
|
+
}
|
|
90480
90608
|
async fetchMetadata(batches) {
|
|
90481
90609
|
const apiNames = Array.from(batches.reduce((acc, x) => {
|
|
90482
90610
|
return acc.add(x.type);
|
|
@@ -90715,7 +90843,9 @@ class RecordLoaderGraphQL extends NetworkRecordLoader {
|
|
|
90715
90843
|
return acc;
|
|
90716
90844
|
}, {});
|
|
90717
90845
|
fields['Id'] = { value: id, displayValue: null };
|
|
90718
|
-
fields['RecordTypeId']
|
|
90846
|
+
if (objectInfo.fields['RecordTypeId'] !== undefined) {
|
|
90847
|
+
fields['RecordTypeId'] = { value: recordTypeId, displayValue: null };
|
|
90848
|
+
}
|
|
90719
90849
|
let recordTypeInfo = null;
|
|
90720
90850
|
if (recordTypeId !== null &&
|
|
90721
90851
|
objectInfo.recordTypeInfos &&
|
|
@@ -92888,7 +93018,7 @@ register$1({
|
|
|
92888
93018
|
id: '@salesforce/lds-network-adapter',
|
|
92889
93019
|
instrument: instrument$2,
|
|
92890
93020
|
});
|
|
92891
|
-
// version: 1.332.0-
|
|
93021
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
92892
93022
|
|
|
92893
93023
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92894
93024
|
const { stringify, parse } = JSON;
|
|
@@ -116761,7 +116891,7 @@ register$1({
|
|
|
116761
116891
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
116762
116892
|
instrument: instrument$1,
|
|
116763
116893
|
});
|
|
116764
|
-
// version: 1.332.0-
|
|
116894
|
+
// version: 1.332.0-dev21-cc02503f9d
|
|
116765
116895
|
|
|
116766
116896
|
// On core the unstable adapters are re-exported with different names,
|
|
116767
116897
|
// we want to match them here.
|
|
@@ -116913,7 +117043,7 @@ withDefaultLuvio((luvio) => {
|
|
|
116913
117043
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
116914
117044
|
graphQLImperative = ldsAdapter;
|
|
116915
117045
|
});
|
|
116916
|
-
// version: 1.332.0-
|
|
117046
|
+
// version: 1.332.0-dev21-cc02503f9d
|
|
116917
117047
|
|
|
116918
117048
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
116919
117049
|
__proto__: null,
|
|
@@ -117705,7 +117835,7 @@ const callbacks$1 = [];
|
|
|
117705
117835
|
function register(r) {
|
|
117706
117836
|
callbacks$1.forEach((callback) => callback(r));
|
|
117707
117837
|
}
|
|
117708
|
-
// version: 1.332.0-
|
|
117838
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
117709
117839
|
|
|
117710
117840
|
/**
|
|
117711
117841
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -118768,4 +118898,4 @@ const { luvio } = getRuntime();
|
|
|
118768
118898
|
setDefaultLuvio({ luvio });
|
|
118769
118899
|
|
|
118770
118900
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
118771
|
-
// version: 1.332.0-
|
|
118901
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
@@ -4271,7 +4271,7 @@
|
|
|
4271
4271
|
}
|
|
4272
4272
|
callbacks.push(callback);
|
|
4273
4273
|
}
|
|
4274
|
-
// version: 1.332.0-
|
|
4274
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
4275
4275
|
|
|
4276
4276
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4277
4277
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5219,7 +5219,7 @@
|
|
|
5219
5219
|
const { apiFamily, name } = metadata;
|
|
5220
5220
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5221
5221
|
}
|
|
5222
|
-
// version: 1.332.0-
|
|
5222
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
5223
5223
|
|
|
5224
5224
|
/**
|
|
5225
5225
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -29717,6 +29717,7 @@
|
|
|
29717
29717
|
generateParamConfigMetadata$3('objectApiName', true, 1 /* QueryParameter */, 0 /* String */),
|
|
29718
29718
|
generateParamConfigMetadata$3('q', true, 1 /* QueryParameter */, 0 /* String */),
|
|
29719
29719
|
generateParamConfigMetadata$3('configurationName', false, 2 /* Body */, 0 /* String */),
|
|
29720
|
+
generateParamConfigMetadata$3('dataCategories', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
29720
29721
|
generateParamConfigMetadata$3('filters', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
29721
29722
|
generateParamConfigMetadata$3('pageSize', false, 2 /* Body */, 3 /* Integer */),
|
|
29722
29723
|
generateParamConfigMetadata$3('pageToken', false, 2 /* Body */, 0 /* String */),
|
|
@@ -29731,6 +29732,18 @@
|
|
|
29731
29732
|
function typeCheckConfig$c$1(untrustedConfig) {
|
|
29732
29733
|
const config = {};
|
|
29733
29734
|
typeCheckConfig$18(untrustedConfig, config, getKeywordSearchResults_ConfigPropertyMetadata$1);
|
|
29735
|
+
const untrustedConfig_dataCategories = untrustedConfig.dataCategories;
|
|
29736
|
+
if (ArrayIsArray$1$1(untrustedConfig_dataCategories)) {
|
|
29737
|
+
const untrustedConfig_dataCategories_array = [];
|
|
29738
|
+
for (let i = 0, arrayLength = untrustedConfig_dataCategories.length; i < arrayLength; i++) {
|
|
29739
|
+
const untrustedConfig_dataCategories_item = untrustedConfig_dataCategories[i];
|
|
29740
|
+
const referenceSearchDataCategoryInputRepresentationValidationError = validate$n(untrustedConfig_dataCategories_item);
|
|
29741
|
+
if (referenceSearchDataCategoryInputRepresentationValidationError === null) {
|
|
29742
|
+
untrustedConfig_dataCategories_array.push(untrustedConfig_dataCategories_item);
|
|
29743
|
+
}
|
|
29744
|
+
}
|
|
29745
|
+
config.dataCategories = untrustedConfig_dataCategories_array;
|
|
29746
|
+
}
|
|
29734
29747
|
const untrustedConfig_filters = untrustedConfig.filters;
|
|
29735
29748
|
if (ArrayIsArray$1$1(untrustedConfig_filters)) {
|
|
29736
29749
|
const untrustedConfig_filters_array = [];
|
|
@@ -33862,7 +33875,7 @@
|
|
|
33862
33875
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
33863
33876
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
33864
33877
|
});
|
|
33865
|
-
// version: 1.332.0-
|
|
33878
|
+
// version: 1.332.0-dev21-cc02503f9d
|
|
33866
33879
|
|
|
33867
33880
|
/**
|
|
33868
33881
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -90065,6 +90078,12 @@
|
|
|
90065
90078
|
fieldUnion.push(`${fieldName}.Id`);
|
|
90066
90079
|
includesSpanningFields = true;
|
|
90067
90080
|
}
|
|
90081
|
+
else {
|
|
90082
|
+
// Field exists on record but not in object info.
|
|
90083
|
+
// Fall back to getRecords resolver in this case.
|
|
90084
|
+
fieldUnion.push(fieldName);
|
|
90085
|
+
includesSpanningFields = true;
|
|
90086
|
+
}
|
|
90068
90087
|
}
|
|
90069
90088
|
else {
|
|
90070
90089
|
fieldUnion.push(fieldName);
|
|
@@ -90292,6 +90311,7 @@
|
|
|
90292
90311
|
|
|
90293
90312
|
const DEFAULT_BATCH_SIZE = 500;
|
|
90294
90313
|
const DEFAULT_CONCURRENCY = 6;
|
|
90314
|
+
const MAX_RETRY_COUNT = 2;
|
|
90295
90315
|
class PrimingSession extends EventEmitter {
|
|
90296
90316
|
constructor(config) {
|
|
90297
90317
|
super();
|
|
@@ -90303,6 +90323,7 @@
|
|
|
90303
90323
|
this.ldsRecordRefresher = config.ldsRecordRefresher;
|
|
90304
90324
|
this.networkWorkerPool = new AsyncWorkerPool(this.concurrency);
|
|
90305
90325
|
this.conflictPool = new ConflictPool(config.store, this.objectInfoLoader);
|
|
90326
|
+
this.retryTracker = new Map();
|
|
90306
90327
|
}
|
|
90307
90328
|
// function that enqueues priming work
|
|
90308
90329
|
async enqueue(work) {
|
|
@@ -90321,6 +90342,9 @@
|
|
|
90321
90342
|
unavailableTypes,
|
|
90322
90343
|
});
|
|
90323
90344
|
if (unavailableIds.length > 0) {
|
|
90345
|
+
for (const id of unavailableIds) {
|
|
90346
|
+
this.retryTracker.delete(id);
|
|
90347
|
+
}
|
|
90324
90348
|
this.emit('error', {
|
|
90325
90349
|
ids: unavailableIds,
|
|
90326
90350
|
code: 'precondition-error',
|
|
@@ -90345,6 +90369,9 @@
|
|
|
90345
90369
|
.fetchRecordData(batch, abortController)
|
|
90346
90370
|
.then(async (results) => {
|
|
90347
90371
|
if (abortController.aborted) {
|
|
90372
|
+
for (const id of batch.ids) {
|
|
90373
|
+
this.retryTracker.delete(id);
|
|
90374
|
+
}
|
|
90348
90375
|
return;
|
|
90349
90376
|
}
|
|
90350
90377
|
this.emit('batch-fetched', {
|
|
@@ -90381,6 +90408,9 @@
|
|
|
90381
90408
|
code: primingError,
|
|
90382
90409
|
message: `${result.messages.join(',')}`,
|
|
90383
90410
|
});
|
|
90411
|
+
for (const id of result.missingIds) {
|
|
90412
|
+
this.retryTracker.delete(id);
|
|
90413
|
+
}
|
|
90384
90414
|
return;
|
|
90385
90415
|
}
|
|
90386
90416
|
const { missingIds } = result;
|
|
@@ -90404,6 +90434,17 @@
|
|
|
90404
90434
|
duration: Date.now() - beforeWrite,
|
|
90405
90435
|
});
|
|
90406
90436
|
if (abortController.aborted) {
|
|
90437
|
+
for (const id of written) {
|
|
90438
|
+
this.retryTracker.delete(id);
|
|
90439
|
+
}
|
|
90440
|
+
for (const id of conflicted) {
|
|
90441
|
+
this.retryTracker.delete(id);
|
|
90442
|
+
}
|
|
90443
|
+
for (const error of errors) {
|
|
90444
|
+
for (const id of error.ids) {
|
|
90445
|
+
this.retryTracker.delete(id);
|
|
90446
|
+
}
|
|
90447
|
+
}
|
|
90407
90448
|
return;
|
|
90408
90449
|
}
|
|
90409
90450
|
if (errors.length > 0) {
|
|
@@ -90413,11 +90454,17 @@
|
|
|
90413
90454
|
code: 'unknown',
|
|
90414
90455
|
message: message,
|
|
90415
90456
|
});
|
|
90457
|
+
for (const id of ids) {
|
|
90458
|
+
this.retryTracker.delete(id);
|
|
90459
|
+
}
|
|
90416
90460
|
});
|
|
90417
90461
|
}
|
|
90418
90462
|
// now that the records are persisted, emit the primed event
|
|
90419
90463
|
if (written.length > 0) {
|
|
90420
90464
|
this.emit('primed', Array.from(written));
|
|
90465
|
+
for (const id of written) {
|
|
90466
|
+
this.retryTracker.delete(id);
|
|
90467
|
+
}
|
|
90421
90468
|
}
|
|
90422
90469
|
// if any records could not be written to the store because there were conflicts, handle the conflicts
|
|
90423
90470
|
if (conflicted.length > 0) {
|
|
@@ -90428,14 +90475,39 @@
|
|
|
90428
90475
|
async handleWriteConflicts(records, conflicted, abortController) {
|
|
90429
90476
|
const result = await this.conflictPool.enqueueConflictedRecords(records.filter((x) => conflicted.includes(x.id)), abortController);
|
|
90430
90477
|
if (abortController.aborted) {
|
|
90478
|
+
for (const id of conflicted) {
|
|
90479
|
+
this.retryTracker.delete(id);
|
|
90480
|
+
}
|
|
90431
90481
|
return;
|
|
90432
90482
|
}
|
|
90433
|
-
if (
|
|
90483
|
+
if (keys$3(result.additionalWork.records).length > 0) {
|
|
90434
90484
|
this.emit('conflict', {
|
|
90435
90485
|
ids: Object.values(result.additionalWork.records).flatMap((record) => record.ids),
|
|
90436
90486
|
resolution: 'priming-refresh',
|
|
90437
90487
|
});
|
|
90438
|
-
|
|
90488
|
+
// we're re-enqueuing here, so apply retry limits which may change the batches
|
|
90489
|
+
let limitedResult = this.applyRetryLimits(result.additionalWork);
|
|
90490
|
+
this.enqueue(limitedResult.additionalWork);
|
|
90491
|
+
if (limitedResult.recordsNeedingRefetch.size > 0) {
|
|
90492
|
+
for (const key in keys$3(limitedResult.recordsNeedingRefetch)) {
|
|
90493
|
+
const value = limitedResult.recordsNeedingRefetch.get(key);
|
|
90494
|
+
if (result.recordsNeedingRefetch.has(key)) {
|
|
90495
|
+
let existing = result.recordsNeedingRefetch.get(key);
|
|
90496
|
+
existing = {
|
|
90497
|
+
// merge the ids
|
|
90498
|
+
ids: [...existing.ids, ...value.ids],
|
|
90499
|
+
// This is safe because they derive from the same
|
|
90500
|
+
// input, no chance of getting a new field in the
|
|
90501
|
+
// limited result
|
|
90502
|
+
fields: existing.fields,
|
|
90503
|
+
};
|
|
90504
|
+
result.recordsNeedingRefetch.set(key, existing);
|
|
90505
|
+
}
|
|
90506
|
+
else {
|
|
90507
|
+
result.recordsNeedingRefetch.set(key, value);
|
|
90508
|
+
}
|
|
90509
|
+
}
|
|
90510
|
+
}
|
|
90439
90511
|
}
|
|
90440
90512
|
if (result.resolvedRecords.length > 0) {
|
|
90441
90513
|
this.emit('conflict', {
|
|
@@ -90443,8 +90515,14 @@
|
|
|
90443
90515
|
resolution: 'priming-merge',
|
|
90444
90516
|
});
|
|
90445
90517
|
this.emit('primed', result.resolvedRecords);
|
|
90518
|
+
for (const id of result.resolvedRecords) {
|
|
90519
|
+
this.retryTracker.delete(id);
|
|
90520
|
+
}
|
|
90446
90521
|
}
|
|
90447
90522
|
if (result.recordsToWrite.length > 0) {
|
|
90523
|
+
for (const record of result.recordsToWrite) {
|
|
90524
|
+
this.retryTracker.delete(record.id);
|
|
90525
|
+
}
|
|
90448
90526
|
const { written, errors, conflicted } = await this.recordIngestor.insertRecords(result.recordsToWrite, true);
|
|
90449
90527
|
if (written.length > 0) {
|
|
90450
90528
|
const ids = Array.from(written);
|
|
@@ -90471,10 +90549,16 @@
|
|
|
90471
90549
|
if (result.recordsNeedingRefetch.size > 0) {
|
|
90472
90550
|
const { loaded, errored } = await this.ldsRecordRefresher.loadRecords(result.recordsNeedingRefetch);
|
|
90473
90551
|
if (loaded.length > 0) {
|
|
90552
|
+
for (const id of loaded) {
|
|
90553
|
+
this.retryTracker.delete(id);
|
|
90554
|
+
}
|
|
90474
90555
|
this.emit('conflict', { resolution: 'lds-refresh', ids: loaded });
|
|
90475
90556
|
this.emit('primed', loaded);
|
|
90476
90557
|
}
|
|
90477
90558
|
if (errored.length > 0) {
|
|
90559
|
+
for (const id of errored) {
|
|
90560
|
+
this.retryTracker.delete(id);
|
|
90561
|
+
}
|
|
90478
90562
|
this.emit('error', {
|
|
90479
90563
|
ids: errored,
|
|
90480
90564
|
code: 'unknown',
|
|
@@ -90483,6 +90567,50 @@
|
|
|
90483
90567
|
}
|
|
90484
90568
|
}
|
|
90485
90569
|
}
|
|
90570
|
+
applyRetryLimits(primingWork) {
|
|
90571
|
+
// retryable work goes back into priming session
|
|
90572
|
+
let retryableWork = {
|
|
90573
|
+
type: 'record-fields',
|
|
90574
|
+
records: {},
|
|
90575
|
+
};
|
|
90576
|
+
// refetchable work gets delegated to getRecords
|
|
90577
|
+
let refetchableWork = new Map();
|
|
90578
|
+
for (const key of keys$3(primingWork.records)) {
|
|
90579
|
+
let work = primingWork.records[key];
|
|
90580
|
+
let limitedIds = [];
|
|
90581
|
+
for (const id of work.ids) {
|
|
90582
|
+
let retryCount = this.retryTracker.get(id) || 0;
|
|
90583
|
+
retryCount += 1;
|
|
90584
|
+
if (retryCount > MAX_RETRY_COUNT) {
|
|
90585
|
+
limitedIds.push(id);
|
|
90586
|
+
this.retryTracker.delete(id);
|
|
90587
|
+
}
|
|
90588
|
+
else {
|
|
90589
|
+
this.retryTracker.set(id, retryCount);
|
|
90590
|
+
}
|
|
90591
|
+
}
|
|
90592
|
+
if (limitedIds.length < work.ids.length) {
|
|
90593
|
+
retryableWork.records[key] = {
|
|
90594
|
+
ids: work.ids.filter((id) => limitedIds.indexOf(id) === -1),
|
|
90595
|
+
fields: work.fields,
|
|
90596
|
+
};
|
|
90597
|
+
}
|
|
90598
|
+
if (limitedIds.length > 0) {
|
|
90599
|
+
this.emit('retry-limit-reached', { ids: limitedIds });
|
|
90600
|
+
refetchableWork.set(key, {
|
|
90601
|
+
ids: limitedIds,
|
|
90602
|
+
fields: work.fields,
|
|
90603
|
+
});
|
|
90604
|
+
}
|
|
90605
|
+
}
|
|
90606
|
+
return {
|
|
90607
|
+
additionalWork: retryableWork,
|
|
90608
|
+
recordsNeedingRefetch: refetchableWork,
|
|
90609
|
+
resolvedRecords: [],
|
|
90610
|
+
recordsToWrite: [],
|
|
90611
|
+
errors: [],
|
|
90612
|
+
};
|
|
90613
|
+
}
|
|
90486
90614
|
async fetchMetadata(batches) {
|
|
90487
90615
|
const apiNames = Array.from(batches.reduce((acc, x) => {
|
|
90488
90616
|
return acc.add(x.type);
|
|
@@ -90721,7 +90849,9 @@
|
|
|
90721
90849
|
return acc;
|
|
90722
90850
|
}, {});
|
|
90723
90851
|
fields['Id'] = { value: id, displayValue: null };
|
|
90724
|
-
fields['RecordTypeId']
|
|
90852
|
+
if (objectInfo.fields['RecordTypeId'] !== undefined) {
|
|
90853
|
+
fields['RecordTypeId'] = { value: recordTypeId, displayValue: null };
|
|
90854
|
+
}
|
|
90725
90855
|
let recordTypeInfo = null;
|
|
90726
90856
|
if (recordTypeId !== null &&
|
|
90727
90857
|
objectInfo.recordTypeInfos &&
|
|
@@ -92894,7 +93024,7 @@
|
|
|
92894
93024
|
id: '@salesforce/lds-network-adapter',
|
|
92895
93025
|
instrument: instrument$2,
|
|
92896
93026
|
});
|
|
92897
|
-
// version: 1.332.0-
|
|
93027
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
92898
93028
|
|
|
92899
93029
|
const { create: create$2, keys: keys$2 } = Object;
|
|
92900
93030
|
const { stringify, parse } = JSON;
|
|
@@ -116767,7 +116897,7 @@
|
|
|
116767
116897
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
116768
116898
|
instrument: instrument$1,
|
|
116769
116899
|
});
|
|
116770
|
-
// version: 1.332.0-
|
|
116900
|
+
// version: 1.332.0-dev21-cc02503f9d
|
|
116771
116901
|
|
|
116772
116902
|
// On core the unstable adapters are re-exported with different names,
|
|
116773
116903
|
// we want to match them here.
|
|
@@ -116919,7 +117049,7 @@
|
|
|
116919
117049
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
116920
117050
|
graphQLImperative = ldsAdapter;
|
|
116921
117051
|
});
|
|
116922
|
-
// version: 1.332.0-
|
|
117052
|
+
// version: 1.332.0-dev21-cc02503f9d
|
|
116923
117053
|
|
|
116924
117054
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
116925
117055
|
__proto__: null,
|
|
@@ -117711,7 +117841,7 @@
|
|
|
117711
117841
|
function register(r) {
|
|
117712
117842
|
callbacks$1.forEach((callback) => callback(r));
|
|
117713
117843
|
}
|
|
117714
|
-
// version: 1.332.0-
|
|
117844
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
|
117715
117845
|
|
|
117716
117846
|
/**
|
|
117717
117847
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -118793,4 +118923,4 @@
|
|
|
118793
118923
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
118794
118924
|
|
|
118795
118925
|
}));
|
|
118796
|
-
// version: 1.332.0-
|
|
118926
|
+
// version: 1.332.0-dev21-0ddc3ca21c
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.332.0-
|
|
3
|
+
"version": "1.332.0-dev21",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/standalone/es/lds-worker-api.js",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
|
|
38
|
-
"@salesforce/lds-adapters-graphql": "^1.332.0-
|
|
39
|
-
"@salesforce/lds-adapters-uiapi": "^1.332.0-
|
|
40
|
-
"@salesforce/lds-default-luvio": "^1.332.0-
|
|
41
|
-
"@salesforce/lds-drafts": "^1.332.0-
|
|
42
|
-
"@salesforce/lds-graphql-parser": "^1.332.0-
|
|
43
|
-
"@salesforce/lds-luvio-engine": "^1.332.0-
|
|
44
|
-
"@salesforce/lds-runtime-mobile": "^1.332.0-
|
|
45
|
-
"@salesforce/nimbus-plugin-lds": "^1.332.0-
|
|
38
|
+
"@salesforce/lds-adapters-graphql": "^1.332.0-dev21",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.332.0-dev21",
|
|
40
|
+
"@salesforce/lds-default-luvio": "^1.332.0-dev21",
|
|
41
|
+
"@salesforce/lds-drafts": "^1.332.0-dev21",
|
|
42
|
+
"@salesforce/lds-graphql-parser": "^1.332.0-dev21",
|
|
43
|
+
"@salesforce/lds-luvio-engine": "^1.332.0-dev21",
|
|
44
|
+
"@salesforce/lds-runtime-mobile": "^1.332.0-dev21",
|
|
45
|
+
"@salesforce/nimbus-plugin-lds": "^1.332.0-dev21",
|
|
46
46
|
"ajv": "^8.11.0",
|
|
47
47
|
"glob": "^7.1.5",
|
|
48
48
|
"nimbus-types": "^2.0.0-alpha1",
|