@salesforce/lds-worker-api 1.253.0 → 1.256.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sfdc/es/ldsWorkerApi.js +69 -35
- package/dist/sfdc/es/types/cachePurging.d.ts +8 -16
- package/dist/standalone/es/lds-worker-api.js +231 -54
- package/dist/standalone/es/types/cachePurging.d.ts +8 -16
- package/dist/standalone/umd/lds-worker-api.js +231 -54
- package/dist/standalone/umd/types/cachePurging.d.ts +8 -16
- package/package.json +14 -13
|
@@ -3982,7 +3982,7 @@
|
|
|
3982
3982
|
}
|
|
3983
3983
|
return resourceParams;
|
|
3984
3984
|
}
|
|
3985
|
-
// engine version: 0.
|
|
3985
|
+
// engine version: 0.154.3-c6624f8e
|
|
3986
3986
|
|
|
3987
3987
|
/**
|
|
3988
3988
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4110,7 +4110,7 @@
|
|
|
4110
4110
|
}
|
|
4111
4111
|
callbacks.push(callback);
|
|
4112
4112
|
}
|
|
4113
|
-
// version: 1.
|
|
4113
|
+
// version: 1.256.0-ad6a66c18
|
|
4114
4114
|
|
|
4115
4115
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4116
4116
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15618,7 +15618,7 @@
|
|
|
15618
15618
|
}
|
|
15619
15619
|
return superResult;
|
|
15620
15620
|
}
|
|
15621
|
-
// version: 1.
|
|
15621
|
+
// version: 1.256.0-ad6a66c18
|
|
15622
15622
|
|
|
15623
15623
|
function unwrap(data) {
|
|
15624
15624
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16543,7 +16543,7 @@
|
|
|
16543
16543
|
const { apiFamily, name } = metadata;
|
|
16544
16544
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16545
16545
|
}
|
|
16546
|
-
// version: 1.
|
|
16546
|
+
// version: 1.256.0-ad6a66c18
|
|
16547
16547
|
|
|
16548
16548
|
/**
|
|
16549
16549
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -16642,7 +16642,7 @@
|
|
|
16642
16642
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
16643
16643
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
16644
16644
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
16645
|
-
// engine version: 0.
|
|
16645
|
+
// engine version: 0.154.3-c6624f8e
|
|
16646
16646
|
|
|
16647
16647
|
const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
|
|
16648
16648
|
|
|
@@ -42771,7 +42771,7 @@
|
|
|
42771
42771
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
|
|
42772
42772
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
|
|
42773
42773
|
});
|
|
42774
|
-
// version: 1.
|
|
42774
|
+
// version: 1.256.0-fb019fbad
|
|
42775
42775
|
|
|
42776
42776
|
var ldsIdempotencyWriteDisabled = {
|
|
42777
42777
|
isOpen: function (e) {
|
|
@@ -42782,6 +42782,15 @@
|
|
|
42782
42782
|
},
|
|
42783
42783
|
};
|
|
42784
42784
|
|
|
42785
|
+
var ldsBackdatingEnabled = {
|
|
42786
|
+
isOpen: function (e) {
|
|
42787
|
+
return e.fallback;
|
|
42788
|
+
},
|
|
42789
|
+
hasError: function () {
|
|
42790
|
+
return !0;
|
|
42791
|
+
},
|
|
42792
|
+
};
|
|
42793
|
+
|
|
42785
42794
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
42786
42795
|
|
|
42787
42796
|
function requestIdleDetectedCallback(_callback) { }
|
|
@@ -42805,6 +42814,24 @@
|
|
|
42805
42814
|
declareNotifierTaskMulti,
|
|
42806
42815
|
declarePollableTaskMulti,
|
|
42807
42816
|
};
|
|
42817
|
+
function stop(_userSchemaOrText, _userData) { }
|
|
42818
|
+
function error(_error, _userSchemaOrText, _userData) { }
|
|
42819
|
+
const activity = {
|
|
42820
|
+
stop,
|
|
42821
|
+
error,
|
|
42822
|
+
};
|
|
42823
|
+
function startActivity(_name) {
|
|
42824
|
+
return activity;
|
|
42825
|
+
}
|
|
42826
|
+
const mockInstrumentation = {
|
|
42827
|
+
startActivity,
|
|
42828
|
+
error: () => { },
|
|
42829
|
+
trackValue: (_operation, _value, _hasError, _tags) => { },
|
|
42830
|
+
incrementCounter: (_operation, _increment, _hasError, _tags) => { },
|
|
42831
|
+
};
|
|
42832
|
+
const getInstrumentation = () => {
|
|
42833
|
+
return mockInstrumentation;
|
|
42834
|
+
};
|
|
42808
42835
|
|
|
42809
42836
|
var ldsUseShortUrlGate = {
|
|
42810
42837
|
isOpen: function (e) {
|
|
@@ -47232,8 +47259,9 @@
|
|
|
47232
47259
|
// If there is no metadata for this query or it somehow lacks a timestamp
|
|
47233
47260
|
// skip setting the root timestamp
|
|
47234
47261
|
if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
|
|
47235
|
-
//
|
|
47236
|
-
|
|
47262
|
+
// adjust the timestamp to account for ingestion processing time
|
|
47263
|
+
// 30s is used because this is the default record TTL
|
|
47264
|
+
input.rootTimestamp = queryMetadata.ingestionTimestamp - 30000;
|
|
47237
47265
|
}
|
|
47238
47266
|
}
|
|
47239
47267
|
return recordQuery(selection, alias, apiName, [], input);
|
|
@@ -48902,6 +48930,8 @@
|
|
|
48902
48930
|
}
|
|
48903
48931
|
}
|
|
48904
48932
|
|
|
48933
|
+
const DEFAULT_FIELD_LAST_MODIFIED_DATE$1 = 'LastModifiedDate';
|
|
48934
|
+
const DEFAULT_FIELD_CREATED_DATE$1 = 'CreatedDate';
|
|
48905
48935
|
class AbstractResourceRequestActionHandler {
|
|
48906
48936
|
constructor(draftQueue, networkAdapter, getLuvio) {
|
|
48907
48937
|
this.draftQueue = draftQueue;
|
|
@@ -48920,6 +48950,7 @@
|
|
|
48920
48950
|
this.isLdsIdempotencyWriteDisabled = ldsIdempotencyWriteDisabled.isOpen({
|
|
48921
48951
|
fallback: false,
|
|
48922
48952
|
});
|
|
48953
|
+
this.isBackdatingEnabled = ldsBackdatingEnabled.isOpen({ fallback: false });
|
|
48923
48954
|
}
|
|
48924
48955
|
enqueue(data) {
|
|
48925
48956
|
return this.draftQueue.enqueue(this.handlerId, data);
|
|
@@ -48990,6 +49021,17 @@
|
|
|
48990
49021
|
}
|
|
48991
49022
|
}
|
|
48992
49023
|
}
|
|
49024
|
+
if (this.isBackdatingEnabled &&
|
|
49025
|
+
response.status === HttpStatusCode$1.BadRequest &&
|
|
49026
|
+
this.isBackdatingError(response.body, action)) {
|
|
49027
|
+
updatedAction.timestamp = Date.now();
|
|
49028
|
+
updatedAction.data.body.fields = {
|
|
49029
|
+
...updatedAction.data.body.fields,
|
|
49030
|
+
LastModifiedDate: new Date(updatedAction.timestamp).toISOString(),
|
|
49031
|
+
};
|
|
49032
|
+
shouldRetry = true;
|
|
49033
|
+
actionDataChanged = true;
|
|
49034
|
+
}
|
|
48993
49035
|
await actionErrored(shouldRetry
|
|
48994
49036
|
? updatedAction
|
|
48995
49037
|
: {
|
|
@@ -49023,7 +49065,21 @@
|
|
|
49023
49065
|
}
|
|
49024
49066
|
// checks if the body is an array of UiApiError. Sometimes the body has `enhancedErrorType` field as an error indicator(one example is the field validation failure). In such case Action being processed updates to an Error Action.
|
|
49025
49067
|
isUiApiErrors(body) {
|
|
49026
|
-
return body !== undefined &&
|
|
49068
|
+
return body !== undefined && isArray$3$1(body) && body.length > 0 && body[0].errorCode;
|
|
49069
|
+
}
|
|
49070
|
+
isBackdatingError(body, action) {
|
|
49071
|
+
if (body.enhancedErrorType &&
|
|
49072
|
+
body.enhancedErrorType === 'RecordError' &&
|
|
49073
|
+
body.output &&
|
|
49074
|
+
body.output.errors &&
|
|
49075
|
+
isArray$3$1(body.output.errors) &&
|
|
49076
|
+
body.output.errors.length > 0 &&
|
|
49077
|
+
action.data.body &&
|
|
49078
|
+
action.data.body.fields &&
|
|
49079
|
+
action.data.body.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1]) {
|
|
49080
|
+
return body.output.errors.some((error) => error.errorCode === 'CollisionDetectedException');
|
|
49081
|
+
}
|
|
49082
|
+
return false;
|
|
49027
49083
|
}
|
|
49028
49084
|
async buildPendingAction(request, queue) {
|
|
49029
49085
|
const targetId = await this.getIdFromRequest(request);
|
|
@@ -49965,7 +50021,7 @@
|
|
|
49965
50021
|
|
|
49966
50022
|
const { create: create$4, keys: keys$4, values: values$2, entries: entries$3, assign: assign$4 } = Object;
|
|
49967
50023
|
const { stringify: stringify$4, parse: parse$4 } = JSON;
|
|
49968
|
-
const { isArray: isArray$2$1, from: from$
|
|
50024
|
+
const { isArray: isArray$2$1, from: from$2 } = Array;
|
|
49969
50025
|
|
|
49970
50026
|
function recordLoaderFactory(query) {
|
|
49971
50027
|
async function batchRecordQuery(ids) {
|
|
@@ -52179,8 +52235,9 @@
|
|
|
52179
52235
|
const results = await query(sql, [key]);
|
|
52180
52236
|
const [timestamp] = results.rows.map((row) => row[0]);
|
|
52181
52237
|
if (timestamp !== null && typeof timestamp === 'number') {
|
|
52182
|
-
//
|
|
52183
|
-
|
|
52238
|
+
// adjust the timestamp to account for ingestion processing time
|
|
52239
|
+
// 30s is used because this is the default record TTL
|
|
52240
|
+
ingestionTimestamp = timestamp - 30000;
|
|
52184
52241
|
}
|
|
52185
52242
|
}
|
|
52186
52243
|
return ingestionTimestamp;
|
|
@@ -52336,7 +52393,7 @@
|
|
|
52336
52393
|
recordQueries: extensionWrapper,
|
|
52337
52394
|
recordConnections,
|
|
52338
52395
|
recordExtensions,
|
|
52339
|
-
polyFieldTypeNameArr: from$
|
|
52396
|
+
polyFieldTypeNameArr: from$2(allPolymorphicFieldTypeNames),
|
|
52340
52397
|
};
|
|
52341
52398
|
}
|
|
52342
52399
|
/**
|
|
@@ -54310,7 +54367,7 @@
|
|
|
54310
54367
|
const { keys: keys$3$1, values: values$1, create: create$3$1, assign: assign$3, freeze: freeze$3 } = Object;
|
|
54311
54368
|
const { stringify: stringify$3, parse: parse$3 } = JSON;
|
|
54312
54369
|
const { shift } = Array.prototype;
|
|
54313
|
-
const { isArray: isArray$1$1 } = Array;
|
|
54370
|
+
const { isArray: isArray$1$1, from: from$1 } = Array;
|
|
54314
54371
|
|
|
54315
54372
|
function isFieldLink(field) {
|
|
54316
54373
|
const { value } = field;
|
|
@@ -55104,7 +55161,7 @@
|
|
|
55104
55161
|
}
|
|
55105
55162
|
async buildPendingAction(request, queue) {
|
|
55106
55163
|
const resolvedRequest = this.resolveResourceRequest(request);
|
|
55107
|
-
|
|
55164
|
+
let pendingAction = (await super.buildPendingAction(resolvedRequest, queue));
|
|
55108
55165
|
const { tag, targetId } = pendingAction;
|
|
55109
55166
|
const targetApiName = await this.getApiNameForRecordId(targetId, tag, resolvedRequest);
|
|
55110
55167
|
pendingAction.metadata[LDS_ACTION_METADATA_API_NAME] = targetApiName;
|
|
@@ -55150,8 +55207,49 @@
|
|
|
55150
55207
|
this.fetchReferenceRecord(referenceFields);
|
|
55151
55208
|
}
|
|
55152
55209
|
}
|
|
55210
|
+
// handles backdating
|
|
55211
|
+
if (this.isBackdatingEnabled &&
|
|
55212
|
+
pendingAction.data &&
|
|
55213
|
+
pendingAction.data.method !== 'delete' && //'delete' action does not have fields
|
|
55214
|
+
metaDataResult.data &&
|
|
55215
|
+
metaDataResult.data.objectInfos) {
|
|
55216
|
+
const objectInfo = metaDataResult.data.objectInfos.get(targetApiName);
|
|
55217
|
+
if (objectInfo === undefined) {
|
|
55218
|
+
throw Error(`Could not generate draft. Object info is missing`);
|
|
55219
|
+
}
|
|
55220
|
+
const appendedFields = this.getBackdatingFields(objectInfo, resolvedRequest.method, pendingAction);
|
|
55221
|
+
if (keys$3$1(appendedFields).length > 0) {
|
|
55222
|
+
pendingAction.data.body = {
|
|
55223
|
+
...pendingAction.data.body,
|
|
55224
|
+
fields: {
|
|
55225
|
+
...pendingAction.data.body.fields,
|
|
55226
|
+
...appendedFields,
|
|
55227
|
+
},
|
|
55228
|
+
};
|
|
55229
|
+
}
|
|
55230
|
+
}
|
|
55153
55231
|
return pendingAction;
|
|
55154
55232
|
}
|
|
55233
|
+
getBackdatingFields(objectInfo, requestMethod, pendingAction) {
|
|
55234
|
+
const fields = {};
|
|
55235
|
+
const actionFieldNames = keys$3$1(pendingAction.data.body.fields);
|
|
55236
|
+
if (requestMethod === 'post') {
|
|
55237
|
+
// `CreateRecord` with `CreatedDate` field
|
|
55238
|
+
if (isBackdatingFieldEditable(objectInfo, DEFAULT_FIELD_CREATED_DATE$1, 'createable', actionFieldNames)) {
|
|
55239
|
+
fields[DEFAULT_FIELD_CREATED_DATE$1] = new Date(pendingAction.timestamp).toISOString();
|
|
55240
|
+
}
|
|
55241
|
+
// `CreateRecord` with `LastModifiedDate` field
|
|
55242
|
+
if (isBackdatingFieldEditable(objectInfo, DEFAULT_FIELD_LAST_MODIFIED_DATE$1, 'createable', actionFieldNames)) {
|
|
55243
|
+
fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1] = new Date(pendingAction.timestamp).toISOString();
|
|
55244
|
+
}
|
|
55245
|
+
}
|
|
55246
|
+
// `UpdateRecord` with `LastModifedDate` field
|
|
55247
|
+
if (requestMethod === 'patch' &&
|
|
55248
|
+
isBackdatingFieldEditable(objectInfo, DEFAULT_FIELD_LAST_MODIFIED_DATE$1, 'updateable', actionFieldNames)) {
|
|
55249
|
+
fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1] = new Date(pendingAction.timestamp).toISOString();
|
|
55250
|
+
}
|
|
55251
|
+
return fields;
|
|
55252
|
+
}
|
|
55155
55253
|
async fetchReferenceRecord(referenceFields) {
|
|
55156
55254
|
const promises = referenceFields.map(async (referenceFieldInfo) => {
|
|
55157
55255
|
const apiName = await this.identifyApiName(referenceFieldInfo.id, referenceFieldInfo.field);
|
|
@@ -55442,12 +55540,26 @@
|
|
|
55442
55540
|
mergeRequestBody(targetBody, sourceBody) {
|
|
55443
55541
|
// IMPORTANT: spread operator isn't deep clone so we have to individually
|
|
55444
55542
|
// spread nested objects (just "fields" for RecordInputReps)
|
|
55543
|
+
const targetInput = targetBody;
|
|
55544
|
+
const sourceInput = sourceBody;
|
|
55545
|
+
// choose the max if both source and target have the `LastModifiedDate` property.
|
|
55546
|
+
// there is no need to check 'CreatedDate` since source and target cannot be `create` action at the same time
|
|
55547
|
+
const lastModifiedFields = {};
|
|
55548
|
+
const targetLastModifiedField = targetInput.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1];
|
|
55549
|
+
const sourceLastModifiedField = sourceInput.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1];
|
|
55550
|
+
if (targetLastModifiedField && sourceLastModifiedField) {
|
|
55551
|
+
lastModifiedFields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1] =
|
|
55552
|
+
targetLastModifiedField > sourceLastModifiedField
|
|
55553
|
+
? targetLastModifiedField
|
|
55554
|
+
: sourceLastModifiedField;
|
|
55555
|
+
}
|
|
55445
55556
|
return {
|
|
55446
55557
|
...targetBody,
|
|
55447
55558
|
...sourceBody,
|
|
55448
55559
|
fields: {
|
|
55449
55560
|
...targetBody.fields,
|
|
55450
55561
|
...sourceBody.fields,
|
|
55562
|
+
...lastModifiedFields,
|
|
55451
55563
|
},
|
|
55452
55564
|
};
|
|
55453
55565
|
}
|
|
@@ -55455,6 +55567,13 @@
|
|
|
55455
55567
|
function isField(key, data) {
|
|
55456
55568
|
return isStoreKeyRecordField(key);
|
|
55457
55569
|
}
|
|
55570
|
+
// true if `createable/updateable` property of backdating field is true and draft does not include that fields. If the customer specifies
|
|
55571
|
+
// `LastModifiedDate`, it is not overwritten.
|
|
55572
|
+
function isBackdatingFieldEditable(objectInfo, backdatingFieldName, attributeName, draftActionFieldNames) {
|
|
55573
|
+
return (objectInfo.fields[backdatingFieldName] &&
|
|
55574
|
+
objectInfo.fields[backdatingFieldName][attributeName] &&
|
|
55575
|
+
!draftActionFieldNames.includes(backdatingFieldName));
|
|
55576
|
+
}
|
|
55458
55577
|
|
|
55459
55578
|
/**
|
|
55460
55579
|
* Records are stored in the durable store with scalar fields denormalized. This function takes that denoramlized
|
|
@@ -56489,7 +56608,7 @@
|
|
|
56489
56608
|
});
|
|
56490
56609
|
pendingAction.metadata[CONTENT_DOCUMENT_LINK_DRAFT_ID_KEY] = contentDocumentLinkId;
|
|
56491
56610
|
// assert that object infos and references exist
|
|
56492
|
-
const metaDataResult = await this.draftRecordService.getRecordDraftMetadata(
|
|
56611
|
+
const metaDataResult = await this.draftRecordService.getRecordDraftMetadata(contentVersionId, pendingAction);
|
|
56493
56612
|
if (metaDataResult === undefined) {
|
|
56494
56613
|
throw Error('No metadata for draft');
|
|
56495
56614
|
}
|
|
@@ -56503,8 +56622,30 @@
|
|
|
56503
56622
|
throw new DraftSynthesisError(`unknown draft precondition failed, metaDataResult: ${JSON.stringify(metaDataResult)}`, 'UNKNOWN');
|
|
56504
56623
|
}
|
|
56505
56624
|
}
|
|
56625
|
+
else if (this.isBackdatingEnabled) {
|
|
56626
|
+
const contentVersionObjectInfo = metaDataResult.data.objectInfos.get(CONTENT_VERSION_API_NAME);
|
|
56627
|
+
if (contentVersionObjectInfo === undefined) {
|
|
56628
|
+
throw Error(`Could not generate draft. Object info is missing`);
|
|
56629
|
+
}
|
|
56630
|
+
// `ContentVersion` support back-dating. Ui-api team has WI @W-14219481 to support `CreatedDate` and `LastModifiedDate`.
|
|
56631
|
+
// right now, these two fields are ignored by server
|
|
56632
|
+
pendingAction.data.body.namedEntries = [
|
|
56633
|
+
...pendingAction.data.body.namedEntries,
|
|
56634
|
+
...this.getBackdatingNameEntries(contentVersionObjectInfo, pendingAction.timestamp),
|
|
56635
|
+
];
|
|
56636
|
+
}
|
|
56506
56637
|
return pendingAction;
|
|
56507
56638
|
}
|
|
56639
|
+
getBackdatingNameEntries(objectInfo, timestamp) {
|
|
56640
|
+
return [DEFAULT_FIELD_CREATED_DATE$1, DEFAULT_FIELD_LAST_MODIFIED_DATE$1]
|
|
56641
|
+
.filter((fieldName) => objectInfo.fields[fieldName] && objectInfo.fields[fieldName].createable)
|
|
56642
|
+
.map((fieldValue) => {
|
|
56643
|
+
return {
|
|
56644
|
+
name: fieldValue,
|
|
56645
|
+
value: new Date(timestamp).toISOString(),
|
|
56646
|
+
};
|
|
56647
|
+
});
|
|
56648
|
+
}
|
|
56508
56649
|
/* istanbul ignore next */
|
|
56509
56650
|
canHandlePublish(_key) {
|
|
56510
56651
|
// no need to touch publishing
|
|
@@ -60266,7 +60407,7 @@
|
|
|
60266
60407
|
id: '@salesforce/lds-network-adapter',
|
|
60267
60408
|
instrument: instrument$2,
|
|
60268
60409
|
});
|
|
60269
|
-
// version: 1.
|
|
60410
|
+
// version: 1.256.0-ad6a66c18
|
|
60270
60411
|
|
|
60271
60412
|
const { create: create$3, keys: keys$3 } = Object;
|
|
60272
60413
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -78595,7 +78736,7 @@
|
|
|
78595
78736
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
78596
78737
|
instrument: instrument$1,
|
|
78597
78738
|
});
|
|
78598
|
-
// version: 1.
|
|
78739
|
+
// version: 1.256.0-fb019fbad
|
|
78599
78740
|
|
|
78600
78741
|
// On core the unstable adapters are re-exported with different names,
|
|
78601
78742
|
// we want to match them here.
|
|
@@ -80845,7 +80986,7 @@
|
|
|
80845
80986
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
80846
80987
|
graphQLImperative = ldsAdapter;
|
|
80847
80988
|
});
|
|
80848
|
-
// version: 1.
|
|
80989
|
+
// version: 1.256.0-fb019fbad
|
|
80849
80990
|
|
|
80850
80991
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
80851
80992
|
__proto__: null,
|
|
@@ -81543,7 +81684,7 @@
|
|
|
81543
81684
|
function register(r) {
|
|
81544
81685
|
callbacks$1.forEach((callback) => callback(r));
|
|
81545
81686
|
}
|
|
81546
|
-
// version: 1.
|
|
81687
|
+
// version: 1.256.0-ad6a66c18
|
|
81547
81688
|
|
|
81548
81689
|
/**
|
|
81549
81690
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -86193,15 +86334,11 @@
|
|
|
86193
86334
|
}
|
|
86194
86335
|
}
|
|
86195
86336
|
|
|
86196
|
-
|
|
86197
|
-
|
|
86198
|
-
|
|
86199
|
-
|
|
86200
|
-
|
|
86201
|
-
EvictStatus["Succeeded"] = "Succeeded";
|
|
86202
|
-
EvictStatus["Error"] = "Error";
|
|
86203
|
-
EvictStatus["Canceled"] = "Canceled";
|
|
86204
|
-
})(EvictStatus || (EvictStatus = {}));
|
|
86337
|
+
const evict_cache_records_by_ids={namespace:"sf.lds",name:"EvictCacheRecordsByIds",pbjsSchema:{"nested":{"sf":{"nested":{"lds":{"nested":{"EvictCacheRecordsByIds":{"fields":{"idCount":{"id":1,"type":"uint32"},"isCanceled":{"id":4,"type":"bool"},"evictedCount":{"id":2,"type":"uint32"},"skippedCount":{"id":3,"type":"uint32"}}}}}}}}}};
|
|
86338
|
+
|
|
86339
|
+
const evict_expired_entries={namespace:"sf.lds",name:"EvictExpiredEntries",pbjsSchema:{"nested":{"sf":{"nested":{"lds":{"nested":{"EvictExpiredEntries":{"fields":{"isCanceled":{"id":3,"type":"bool"},"expiredInDays":{"id":1,"type":"uint32"},"evictedCount":{"id":2,"type":"uint32"}}}}}}}}}};
|
|
86340
|
+
|
|
86341
|
+
const ldsMobileInstrumentation = getInstrumentation();
|
|
86205
86342
|
const MessagingDurableSegmentName = 'MESSAGING';
|
|
86206
86343
|
const DEFAULT_MAX_ENTRIES_PER_OPERATION = 500;
|
|
86207
86344
|
const EVICTION_IN_PROGESS_MESSAGE = `Cache eviction in progress. Can't start another until it is finished or canceled.`;
|
|
@@ -86224,18 +86361,27 @@
|
|
|
86224
86361
|
// Send error back if an eviction is going on.
|
|
86225
86362
|
if (activeEvictionInProgress) {
|
|
86226
86363
|
return {
|
|
86227
|
-
status:
|
|
86364
|
+
status: 'Running',
|
|
86228
86365
|
message: EVICTION_IN_PROGESS_MESSAGE,
|
|
86229
86366
|
};
|
|
86230
86367
|
}
|
|
86231
86368
|
activeEvictionInProgress = true;
|
|
86232
86369
|
cancelCurrentEviction = false;
|
|
86370
|
+
const o11yActivity = ldsMobileInstrumentation.startActivity('evictCacheRecordsByIds');
|
|
86371
|
+
const stat = {
|
|
86372
|
+
idCount: recordIds.length,
|
|
86373
|
+
evictedCount: 0,
|
|
86374
|
+
skippedCount: 0,
|
|
86375
|
+
};
|
|
86233
86376
|
const evictAChunk = () => {
|
|
86234
|
-
evictChunksOfRecord(recordIds).then(
|
|
86377
|
+
evictChunksOfRecord(recordIds).then((progress) => {
|
|
86378
|
+
handleInstrumentation(o11yActivity, stat, progress);
|
|
86379
|
+
onEvicted(progress);
|
|
86380
|
+
});
|
|
86235
86381
|
};
|
|
86236
|
-
const onEvicted = getOnEvictedCallback(onProgressUpdate, evictAChunk);
|
|
86382
|
+
const onEvicted = getOnEvictedCallback(o11yActivity, onProgressUpdate, evictAChunk, stat);
|
|
86237
86383
|
evictAChunk();
|
|
86238
|
-
return { status:
|
|
86384
|
+
return { status: 'Started' };
|
|
86239
86385
|
}
|
|
86240
86386
|
/**
|
|
86241
86387
|
* Purging the db entries which passed expired time by specified days
|
|
@@ -86251,19 +86397,28 @@
|
|
|
86251
86397
|
// Send error back if an eviction is going on.
|
|
86252
86398
|
if (activeEvictionInProgress) {
|
|
86253
86399
|
return {
|
|
86254
|
-
status:
|
|
86400
|
+
status: 'Running',
|
|
86255
86401
|
message: EVICTION_IN_PROGESS_MESSAGE,
|
|
86256
86402
|
};
|
|
86257
86403
|
}
|
|
86258
86404
|
activeEvictionInProgress = true;
|
|
86259
86405
|
cancelCurrentEviction = false;
|
|
86406
|
+
const stat = {
|
|
86407
|
+
expiredInDays: expiredByDays,
|
|
86408
|
+
evictedCount: 0,
|
|
86409
|
+
skippedCount: 0,
|
|
86410
|
+
};
|
|
86411
|
+
const o11yActivity = ldsMobileInstrumentation.startActivity('evictExpiredCacheEntries');
|
|
86260
86412
|
const overdueExpirationTimeStamp = Date.now() - expiredByDays * 24 * 3600 * 1000;
|
|
86261
86413
|
const evictAChunk = () => {
|
|
86262
|
-
evictChunkOfOverdueEntries(overdueExpirationTimeStamp).then(
|
|
86414
|
+
evictChunkOfOverdueEntries(overdueExpirationTimeStamp).then((progress) => {
|
|
86415
|
+
handleInstrumentation(o11yActivity, stat, progress);
|
|
86416
|
+
onEvicted(progress);
|
|
86417
|
+
});
|
|
86263
86418
|
};
|
|
86264
|
-
const onEvicted = getOnEvictedCallback(onProgressUpdate, evictAChunk);
|
|
86419
|
+
const onEvicted = getOnEvictedCallback(o11yActivity, onProgressUpdate, evictAChunk, stat);
|
|
86265
86420
|
evictAChunk();
|
|
86266
|
-
return { status:
|
|
86421
|
+
return { status: 'Started' };
|
|
86267
86422
|
}
|
|
86268
86423
|
/**
|
|
86269
86424
|
* Signal to stop current eviction if there's an active eviction going on.
|
|
@@ -86279,17 +86434,19 @@
|
|
|
86279
86434
|
* @param evictAChunk
|
|
86280
86435
|
* @returns a callback to call when a chunk of records or entries are removed.
|
|
86281
86436
|
*/
|
|
86282
|
-
function getOnEvictedCallback(onProgressUpdate, evictAChunk) {
|
|
86437
|
+
function getOnEvictedCallback(o11yActivity, onProgressUpdate, evictAChunk, stat) {
|
|
86283
86438
|
return (progress) => {
|
|
86284
86439
|
onProgressUpdate(progress);
|
|
86285
86440
|
const { status } = progress;
|
|
86286
|
-
if (status ===
|
|
86441
|
+
if (status === 'Succeeded' || status === 'Error') {
|
|
86287
86442
|
activeEvictionInProgress = false;
|
|
86288
86443
|
}
|
|
86289
|
-
if (status ===
|
|
86444
|
+
if (status === 'Evicted') {
|
|
86290
86445
|
if (cancelCurrentEviction) {
|
|
86291
86446
|
activeEvictionInProgress = false;
|
|
86292
|
-
|
|
86447
|
+
const canceledProgress = { status: 'Canceled' };
|
|
86448
|
+
onProgressUpdate(canceledProgress);
|
|
86449
|
+
handleInstrumentation(o11yActivity, stat, canceledProgress);
|
|
86293
86450
|
}
|
|
86294
86451
|
else {
|
|
86295
86452
|
evictAChunk();
|
|
@@ -86305,7 +86462,7 @@
|
|
|
86305
86462
|
function evictChunksOfRecord(ids) {
|
|
86306
86463
|
const chunk = ids.splice(0, DEFAULT_MAX_ENTRIES_PER_OPERATION);
|
|
86307
86464
|
if (chunk.length === 0) {
|
|
86308
|
-
return Promise.resolve({ status:
|
|
86465
|
+
return Promise.resolve({ status: 'Succeeded' });
|
|
86309
86466
|
}
|
|
86310
86467
|
return new Promise((resolve) => {
|
|
86311
86468
|
// evict the chunk
|
|
@@ -86326,22 +86483,22 @@
|
|
|
86326
86483
|
nimbusSqliteStore.setEntries({ notifyStoreUpdateAvailable: { data: evictedEntries } }, MessagingDurableSegmentName);
|
|
86327
86484
|
}
|
|
86328
86485
|
resolve({
|
|
86329
|
-
status:
|
|
86486
|
+
status: 'Evicted',
|
|
86330
86487
|
evictedEntries,
|
|
86331
86488
|
skippedEntries,
|
|
86332
86489
|
});
|
|
86333
86490
|
})
|
|
86334
86491
|
.catch((reason) => {
|
|
86335
86492
|
resolve({
|
|
86336
|
-
status:
|
|
86337
|
-
message:
|
|
86493
|
+
status: 'Error',
|
|
86494
|
+
message: reason.toString(),
|
|
86338
86495
|
});
|
|
86339
86496
|
});
|
|
86340
86497
|
}
|
|
86341
86498
|
catch (reason) {
|
|
86342
86499
|
resolve({
|
|
86343
|
-
status:
|
|
86344
|
-
message:
|
|
86500
|
+
status: 'Error',
|
|
86501
|
+
message: reason.toString(),
|
|
86345
86502
|
});
|
|
86346
86503
|
}
|
|
86347
86504
|
});
|
|
@@ -86380,30 +86537,50 @@
|
|
|
86380
86537
|
// broadcast entries evicted
|
|
86381
86538
|
nimbusSqliteStore.setEntries({ notifyStoreUpdateAvailable: { data: evictedEntries } }, MessagingDurableSegmentName);
|
|
86382
86539
|
resolve({
|
|
86383
|
-
status:
|
|
86540
|
+
status: 'Evicted',
|
|
86384
86541
|
evictedEntries,
|
|
86385
86542
|
skippedEntries: [],
|
|
86386
86543
|
});
|
|
86387
86544
|
}
|
|
86388
86545
|
else {
|
|
86389
|
-
resolve({ status:
|
|
86546
|
+
resolve({ status: 'Succeeded' });
|
|
86390
86547
|
}
|
|
86391
86548
|
})
|
|
86392
86549
|
.catch((reason) => {
|
|
86393
86550
|
resolve({
|
|
86394
|
-
status:
|
|
86395
|
-
message:
|
|
86551
|
+
status: 'Error',
|
|
86552
|
+
message: reason.toString(),
|
|
86396
86553
|
});
|
|
86397
86554
|
});
|
|
86398
86555
|
}
|
|
86399
86556
|
catch (reason) {
|
|
86400
86557
|
resolve({
|
|
86401
|
-
status:
|
|
86402
|
-
message:
|
|
86558
|
+
status: 'Error',
|
|
86559
|
+
message: reason.toString(),
|
|
86403
86560
|
});
|
|
86404
86561
|
}
|
|
86405
86562
|
});
|
|
86406
86563
|
}
|
|
86564
|
+
function handleInstrumentation(activity, stat, progress) {
|
|
86565
|
+
const status = progress.status;
|
|
86566
|
+
if (status === 'Evicted') {
|
|
86567
|
+
const evicted = progress;
|
|
86568
|
+
stat.evictedCount += evicted.evictedEntries.length;
|
|
86569
|
+
stat.skippedCount += evicted.skippedEntries.length;
|
|
86570
|
+
return;
|
|
86571
|
+
}
|
|
86572
|
+
const schema = 'idCount' in stat ? evict_cache_records_by_ids : evict_expired_entries;
|
|
86573
|
+
const userData = {
|
|
86574
|
+
...stat,
|
|
86575
|
+
isCanceled: status === 'Canceled',
|
|
86576
|
+
};
|
|
86577
|
+
if (status === 'Error') {
|
|
86578
|
+
activity.error(progress.message, schema, userData);
|
|
86579
|
+
}
|
|
86580
|
+
else if (status === 'Succeeded' || status === 'Canceled') {
|
|
86581
|
+
activity.stop(schema, userData);
|
|
86582
|
+
}
|
|
86583
|
+
}
|
|
86407
86584
|
|
|
86408
86585
|
// LWR has a "setupLDS" bootstrap service/loader hook, we simulate this in
|
|
86409
86586
|
// standalone bundle by mimicking what "setupLDS" does here and then exporting
|
|
@@ -86430,4 +86607,4 @@
|
|
|
86430
86607
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
86431
86608
|
|
|
86432
86609
|
}));
|
|
86433
|
-
// version: 1.
|
|
86610
|
+
// version: 1.256.0-ad6a66c18
|
|
@@ -1,32 +1,24 @@
|
|
|
1
|
-
declare enum EvictStatus {
|
|
2
|
-
Started = "Started",
|
|
3
|
-
Running = "Running",
|
|
4
|
-
Evicted = "Evicted",
|
|
5
|
-
Succeeded = "Succeeded",
|
|
6
|
-
Error = "Error",
|
|
7
|
-
Canceled = "Canceled"
|
|
8
|
-
}
|
|
9
1
|
interface EvictStarted {
|
|
10
|
-
status:
|
|
2
|
+
status: 'Started';
|
|
11
3
|
}
|
|
12
4
|
interface EvictRunning {
|
|
13
|
-
status:
|
|
5
|
+
status: 'Running';
|
|
14
6
|
message: string;
|
|
15
7
|
}
|
|
16
8
|
interface BatchEvicted {
|
|
17
|
-
status:
|
|
18
|
-
skippedEntries
|
|
19
|
-
evictedEntries
|
|
9
|
+
status: 'Evicted';
|
|
10
|
+
skippedEntries: string[];
|
|
11
|
+
evictedEntries: string[];
|
|
20
12
|
}
|
|
21
13
|
interface EvictSucceeded {
|
|
22
|
-
status:
|
|
14
|
+
status: 'Succeeded';
|
|
23
15
|
}
|
|
24
16
|
interface EvictError {
|
|
25
|
-
status:
|
|
17
|
+
status: 'Error';
|
|
26
18
|
message: string;
|
|
27
19
|
}
|
|
28
20
|
interface EvictCancelled {
|
|
29
|
-
status:
|
|
21
|
+
status: 'Canceled';
|
|
30
22
|
}
|
|
31
23
|
export type EvictProgress = BatchEvicted | EvictSucceeded | EvictError | EvictCancelled;
|
|
32
24
|
export type ProgressUpdateCallback = (progess: EvictProgress) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.256.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/standalone/es/lds-worker-api.js",
|
|
@@ -35,28 +35,29 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
|
|
38
|
-
"@salesforce/lds-adapters-graphql": "
|
|
39
|
-
"@salesforce/lds-adapters-uiapi": "
|
|
40
|
-
"@salesforce/lds-default-luvio": "
|
|
41
|
-
"@salesforce/lds-drafts": "
|
|
42
|
-
"@salesforce/lds-graphql-parser": "
|
|
43
|
-
"@salesforce/lds-luvio-engine": "
|
|
44
|
-
"@salesforce/lds-priming": "
|
|
45
|
-
"@salesforce/lds-runtime-mobile": "
|
|
46
|
-
"@salesforce/nimbus-plugin-lds": "
|
|
38
|
+
"@salesforce/lds-adapters-graphql": "^1.256.0",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.256.0",
|
|
40
|
+
"@salesforce/lds-default-luvio": "^1.256.0",
|
|
41
|
+
"@salesforce/lds-drafts": "^1.256.0",
|
|
42
|
+
"@salesforce/lds-graphql-parser": "^1.256.0",
|
|
43
|
+
"@salesforce/lds-luvio-engine": "^1.256.0",
|
|
44
|
+
"@salesforce/lds-priming": "^1.256.0",
|
|
45
|
+
"@salesforce/lds-runtime-mobile": "^1.256.0",
|
|
46
|
+
"@salesforce/nimbus-plugin-lds": "^1.256.0",
|
|
47
47
|
"ajv": "^8.11.0",
|
|
48
48
|
"glob": "^7.1.5",
|
|
49
49
|
"nimbus-types": "^2.0.0-alpha1",
|
|
50
50
|
"o11y": "244.0.0",
|
|
51
|
+
"o11y_schema": "248.40.0",
|
|
51
52
|
"wait-for-expect": "^3.0.2"
|
|
52
53
|
},
|
|
53
54
|
"luvioBundlesize": [
|
|
54
55
|
{
|
|
55
56
|
"path": "./dist/sfdc/es/ldsWorkerApi.js",
|
|
56
57
|
"maxSize": {
|
|
57
|
-
"none": "
|
|
58
|
-
"min": "17.
|
|
59
|
-
"compressed": "7.
|
|
58
|
+
"none": "41.8 kB",
|
|
59
|
+
"min": "17.7 kB",
|
|
60
|
+
"compressed": "7.4 kB"
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
],
|