@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
|
@@ -3976,7 +3976,7 @@ function createResourceParamsImpl(config, configMetadata) {
|
|
|
3976
3976
|
}
|
|
3977
3977
|
return resourceParams;
|
|
3978
3978
|
}
|
|
3979
|
-
// engine version: 0.
|
|
3979
|
+
// engine version: 0.154.3-c6624f8e
|
|
3980
3980
|
|
|
3981
3981
|
/**
|
|
3982
3982
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4104,7 +4104,7 @@ function withDefaultLuvio(callback) {
|
|
|
4104
4104
|
}
|
|
4105
4105
|
callbacks.push(callback);
|
|
4106
4106
|
}
|
|
4107
|
-
// version: 1.
|
|
4107
|
+
// version: 1.256.0-ad6a66c18
|
|
4108
4108
|
|
|
4109
4109
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4110
4110
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15612,7 +15612,7 @@ function gql(literals, ...subs) {
|
|
|
15612
15612
|
}
|
|
15613
15613
|
return superResult;
|
|
15614
15614
|
}
|
|
15615
|
-
// version: 1.
|
|
15615
|
+
// version: 1.256.0-ad6a66c18
|
|
15616
15616
|
|
|
15617
15617
|
function unwrap(data) {
|
|
15618
15618
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16537,7 +16537,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
16537
16537
|
const { apiFamily, name } = metadata;
|
|
16538
16538
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16539
16539
|
}
|
|
16540
|
-
// version: 1.
|
|
16540
|
+
// version: 1.256.0-ad6a66c18
|
|
16541
16541
|
|
|
16542
16542
|
/**
|
|
16543
16543
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -16636,7 +16636,7 @@ var TypeCheckShapes;
|
|
|
16636
16636
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
16637
16637
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
16638
16638
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
16639
|
-
// engine version: 0.
|
|
16639
|
+
// engine version: 0.154.3-c6624f8e
|
|
16640
16640
|
|
|
16641
16641
|
const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
|
|
16642
16642
|
|
|
@@ -42765,7 +42765,7 @@ withDefaultLuvio((luvio) => {
|
|
|
42765
42765
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
|
|
42766
42766
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
|
|
42767
42767
|
});
|
|
42768
|
-
// version: 1.
|
|
42768
|
+
// version: 1.256.0-fb019fbad
|
|
42769
42769
|
|
|
42770
42770
|
var ldsIdempotencyWriteDisabled = {
|
|
42771
42771
|
isOpen: function (e) {
|
|
@@ -42776,6 +42776,15 @@ var ldsIdempotencyWriteDisabled = {
|
|
|
42776
42776
|
},
|
|
42777
42777
|
};
|
|
42778
42778
|
|
|
42779
|
+
var ldsBackdatingEnabled = {
|
|
42780
|
+
isOpen: function (e) {
|
|
42781
|
+
return e.fallback;
|
|
42782
|
+
},
|
|
42783
|
+
hasError: function () {
|
|
42784
|
+
return !0;
|
|
42785
|
+
},
|
|
42786
|
+
};
|
|
42787
|
+
|
|
42779
42788
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
42780
42789
|
|
|
42781
42790
|
function requestIdleDetectedCallback(_callback) { }
|
|
@@ -42799,6 +42808,24 @@ const idleDetector = {
|
|
|
42799
42808
|
declareNotifierTaskMulti,
|
|
42800
42809
|
declarePollableTaskMulti,
|
|
42801
42810
|
};
|
|
42811
|
+
function stop(_userSchemaOrText, _userData) { }
|
|
42812
|
+
function error(_error, _userSchemaOrText, _userData) { }
|
|
42813
|
+
const activity = {
|
|
42814
|
+
stop,
|
|
42815
|
+
error,
|
|
42816
|
+
};
|
|
42817
|
+
function startActivity(_name) {
|
|
42818
|
+
return activity;
|
|
42819
|
+
}
|
|
42820
|
+
const mockInstrumentation = {
|
|
42821
|
+
startActivity,
|
|
42822
|
+
error: () => { },
|
|
42823
|
+
trackValue: (_operation, _value, _hasError, _tags) => { },
|
|
42824
|
+
incrementCounter: (_operation, _increment, _hasError, _tags) => { },
|
|
42825
|
+
};
|
|
42826
|
+
const getInstrumentation = () => {
|
|
42827
|
+
return mockInstrumentation;
|
|
42828
|
+
};
|
|
42802
42829
|
|
|
42803
42830
|
var ldsUseShortUrlGate = {
|
|
42804
42831
|
isOpen: function (e) {
|
|
@@ -47226,8 +47253,9 @@ function rootRecordQuery(selection, input) {
|
|
|
47226
47253
|
// If there is no metadata for this query or it somehow lacks a timestamp
|
|
47227
47254
|
// skip setting the root timestamp
|
|
47228
47255
|
if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
|
|
47229
|
-
//
|
|
47230
|
-
|
|
47256
|
+
// adjust the timestamp to account for ingestion processing time
|
|
47257
|
+
// 30s is used because this is the default record TTL
|
|
47258
|
+
input.rootTimestamp = queryMetadata.ingestionTimestamp - 30000;
|
|
47231
47259
|
}
|
|
47232
47260
|
}
|
|
47233
47261
|
return recordQuery(selection, alias, apiName, [], input);
|
|
@@ -48896,6 +48924,8 @@ class DurableDraftStore {
|
|
|
48896
48924
|
}
|
|
48897
48925
|
}
|
|
48898
48926
|
|
|
48927
|
+
const DEFAULT_FIELD_LAST_MODIFIED_DATE$1 = 'LastModifiedDate';
|
|
48928
|
+
const DEFAULT_FIELD_CREATED_DATE$1 = 'CreatedDate';
|
|
48899
48929
|
class AbstractResourceRequestActionHandler {
|
|
48900
48930
|
constructor(draftQueue, networkAdapter, getLuvio) {
|
|
48901
48931
|
this.draftQueue = draftQueue;
|
|
@@ -48914,6 +48944,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
48914
48944
|
this.isLdsIdempotencyWriteDisabled = ldsIdempotencyWriteDisabled.isOpen({
|
|
48915
48945
|
fallback: false,
|
|
48916
48946
|
});
|
|
48947
|
+
this.isBackdatingEnabled = ldsBackdatingEnabled.isOpen({ fallback: false });
|
|
48917
48948
|
}
|
|
48918
48949
|
enqueue(data) {
|
|
48919
48950
|
return this.draftQueue.enqueue(this.handlerId, data);
|
|
@@ -48984,6 +49015,17 @@ class AbstractResourceRequestActionHandler {
|
|
|
48984
49015
|
}
|
|
48985
49016
|
}
|
|
48986
49017
|
}
|
|
49018
|
+
if (this.isBackdatingEnabled &&
|
|
49019
|
+
response.status === HttpStatusCode$1.BadRequest &&
|
|
49020
|
+
this.isBackdatingError(response.body, action)) {
|
|
49021
|
+
updatedAction.timestamp = Date.now();
|
|
49022
|
+
updatedAction.data.body.fields = {
|
|
49023
|
+
...updatedAction.data.body.fields,
|
|
49024
|
+
LastModifiedDate: new Date(updatedAction.timestamp).toISOString(),
|
|
49025
|
+
};
|
|
49026
|
+
shouldRetry = true;
|
|
49027
|
+
actionDataChanged = true;
|
|
49028
|
+
}
|
|
48987
49029
|
await actionErrored(shouldRetry
|
|
48988
49030
|
? updatedAction
|
|
48989
49031
|
: {
|
|
@@ -49017,7 +49059,21 @@ class AbstractResourceRequestActionHandler {
|
|
|
49017
49059
|
}
|
|
49018
49060
|
// 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.
|
|
49019
49061
|
isUiApiErrors(body) {
|
|
49020
|
-
return body !== undefined &&
|
|
49062
|
+
return body !== undefined && isArray$3$1(body) && body.length > 0 && body[0].errorCode;
|
|
49063
|
+
}
|
|
49064
|
+
isBackdatingError(body, action) {
|
|
49065
|
+
if (body.enhancedErrorType &&
|
|
49066
|
+
body.enhancedErrorType === 'RecordError' &&
|
|
49067
|
+
body.output &&
|
|
49068
|
+
body.output.errors &&
|
|
49069
|
+
isArray$3$1(body.output.errors) &&
|
|
49070
|
+
body.output.errors.length > 0 &&
|
|
49071
|
+
action.data.body &&
|
|
49072
|
+
action.data.body.fields &&
|
|
49073
|
+
action.data.body.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1]) {
|
|
49074
|
+
return body.output.errors.some((error) => error.errorCode === 'CollisionDetectedException');
|
|
49075
|
+
}
|
|
49076
|
+
return false;
|
|
49021
49077
|
}
|
|
49022
49078
|
async buildPendingAction(request, queue) {
|
|
49023
49079
|
const targetId = await this.getIdFromRequest(request);
|
|
@@ -49959,7 +50015,7 @@ function isArrayLike(x) {
|
|
|
49959
50015
|
|
|
49960
50016
|
const { create: create$4, keys: keys$4, values: values$2, entries: entries$3, assign: assign$4 } = Object;
|
|
49961
50017
|
const { stringify: stringify$4, parse: parse$4 } = JSON;
|
|
49962
|
-
const { isArray: isArray$2$1, from: from$
|
|
50018
|
+
const { isArray: isArray$2$1, from: from$2 } = Array;
|
|
49963
50019
|
|
|
49964
50020
|
function recordLoaderFactory(query) {
|
|
49965
50021
|
async function batchRecordQuery(ids) {
|
|
@@ -52173,8 +52229,9 @@ async function fetchIngestionTimeStampFromDatabase(apiName, info, args, query) {
|
|
|
52173
52229
|
const results = await query(sql, [key]);
|
|
52174
52230
|
const [timestamp] = results.rows.map((row) => row[0]);
|
|
52175
52231
|
if (timestamp !== null && typeof timestamp === 'number') {
|
|
52176
|
-
//
|
|
52177
|
-
|
|
52232
|
+
// adjust the timestamp to account for ingestion processing time
|
|
52233
|
+
// 30s is used because this is the default record TTL
|
|
52234
|
+
ingestionTimestamp = timestamp - 30000;
|
|
52178
52235
|
}
|
|
52179
52236
|
}
|
|
52180
52237
|
return ingestionTimestamp;
|
|
@@ -52330,7 +52387,7 @@ function generateRecordQueries(schema, objectInfoMap) {
|
|
|
52330
52387
|
recordQueries: extensionWrapper,
|
|
52331
52388
|
recordConnections,
|
|
52332
52389
|
recordExtensions,
|
|
52333
|
-
polyFieldTypeNameArr: from$
|
|
52390
|
+
polyFieldTypeNameArr: from$2(allPolymorphicFieldTypeNames),
|
|
52334
52391
|
};
|
|
52335
52392
|
}
|
|
52336
52393
|
/**
|
|
@@ -54304,7 +54361,7 @@ function referenceIdFieldForRelationship(relationshipName) {
|
|
|
54304
54361
|
const { keys: keys$3$1, values: values$1, create: create$3$1, assign: assign$3, freeze: freeze$3 } = Object;
|
|
54305
54362
|
const { stringify: stringify$3, parse: parse$3 } = JSON;
|
|
54306
54363
|
const { shift } = Array.prototype;
|
|
54307
|
-
const { isArray: isArray$1$1 } = Array;
|
|
54364
|
+
const { isArray: isArray$1$1, from: from$1 } = Array;
|
|
54308
54365
|
|
|
54309
54366
|
function isFieldLink(field) {
|
|
54310
54367
|
const { value } = field;
|
|
@@ -55098,7 +55155,7 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55098
55155
|
}
|
|
55099
55156
|
async buildPendingAction(request, queue) {
|
|
55100
55157
|
const resolvedRequest = this.resolveResourceRequest(request);
|
|
55101
|
-
|
|
55158
|
+
let pendingAction = (await super.buildPendingAction(resolvedRequest, queue));
|
|
55102
55159
|
const { tag, targetId } = pendingAction;
|
|
55103
55160
|
const targetApiName = await this.getApiNameForRecordId(targetId, tag, resolvedRequest);
|
|
55104
55161
|
pendingAction.metadata[LDS_ACTION_METADATA_API_NAME] = targetApiName;
|
|
@@ -55144,8 +55201,49 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55144
55201
|
this.fetchReferenceRecord(referenceFields);
|
|
55145
55202
|
}
|
|
55146
55203
|
}
|
|
55204
|
+
// handles backdating
|
|
55205
|
+
if (this.isBackdatingEnabled &&
|
|
55206
|
+
pendingAction.data &&
|
|
55207
|
+
pendingAction.data.method !== 'delete' && //'delete' action does not have fields
|
|
55208
|
+
metaDataResult.data &&
|
|
55209
|
+
metaDataResult.data.objectInfos) {
|
|
55210
|
+
const objectInfo = metaDataResult.data.objectInfos.get(targetApiName);
|
|
55211
|
+
if (objectInfo === undefined) {
|
|
55212
|
+
throw Error(`Could not generate draft. Object info is missing`);
|
|
55213
|
+
}
|
|
55214
|
+
const appendedFields = this.getBackdatingFields(objectInfo, resolvedRequest.method, pendingAction);
|
|
55215
|
+
if (keys$3$1(appendedFields).length > 0) {
|
|
55216
|
+
pendingAction.data.body = {
|
|
55217
|
+
...pendingAction.data.body,
|
|
55218
|
+
fields: {
|
|
55219
|
+
...pendingAction.data.body.fields,
|
|
55220
|
+
...appendedFields,
|
|
55221
|
+
},
|
|
55222
|
+
};
|
|
55223
|
+
}
|
|
55224
|
+
}
|
|
55147
55225
|
return pendingAction;
|
|
55148
55226
|
}
|
|
55227
|
+
getBackdatingFields(objectInfo, requestMethod, pendingAction) {
|
|
55228
|
+
const fields = {};
|
|
55229
|
+
const actionFieldNames = keys$3$1(pendingAction.data.body.fields);
|
|
55230
|
+
if (requestMethod === 'post') {
|
|
55231
|
+
// `CreateRecord` with `CreatedDate` field
|
|
55232
|
+
if (isBackdatingFieldEditable(objectInfo, DEFAULT_FIELD_CREATED_DATE$1, 'createable', actionFieldNames)) {
|
|
55233
|
+
fields[DEFAULT_FIELD_CREATED_DATE$1] = new Date(pendingAction.timestamp).toISOString();
|
|
55234
|
+
}
|
|
55235
|
+
// `CreateRecord` with `LastModifiedDate` field
|
|
55236
|
+
if (isBackdatingFieldEditable(objectInfo, DEFAULT_FIELD_LAST_MODIFIED_DATE$1, 'createable', actionFieldNames)) {
|
|
55237
|
+
fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1] = new Date(pendingAction.timestamp).toISOString();
|
|
55238
|
+
}
|
|
55239
|
+
}
|
|
55240
|
+
// `UpdateRecord` with `LastModifedDate` field
|
|
55241
|
+
if (requestMethod === 'patch' &&
|
|
55242
|
+
isBackdatingFieldEditable(objectInfo, DEFAULT_FIELD_LAST_MODIFIED_DATE$1, 'updateable', actionFieldNames)) {
|
|
55243
|
+
fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1] = new Date(pendingAction.timestamp).toISOString();
|
|
55244
|
+
}
|
|
55245
|
+
return fields;
|
|
55246
|
+
}
|
|
55149
55247
|
async fetchReferenceRecord(referenceFields) {
|
|
55150
55248
|
const promises = referenceFields.map(async (referenceFieldInfo) => {
|
|
55151
55249
|
const apiName = await this.identifyApiName(referenceFieldInfo.id, referenceFieldInfo.field);
|
|
@@ -55436,12 +55534,26 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55436
55534
|
mergeRequestBody(targetBody, sourceBody) {
|
|
55437
55535
|
// IMPORTANT: spread operator isn't deep clone so we have to individually
|
|
55438
55536
|
// spread nested objects (just "fields" for RecordInputReps)
|
|
55537
|
+
const targetInput = targetBody;
|
|
55538
|
+
const sourceInput = sourceBody;
|
|
55539
|
+
// choose the max if both source and target have the `LastModifiedDate` property.
|
|
55540
|
+
// there is no need to check 'CreatedDate` since source and target cannot be `create` action at the same time
|
|
55541
|
+
const lastModifiedFields = {};
|
|
55542
|
+
const targetLastModifiedField = targetInput.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1];
|
|
55543
|
+
const sourceLastModifiedField = sourceInput.fields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1];
|
|
55544
|
+
if (targetLastModifiedField && sourceLastModifiedField) {
|
|
55545
|
+
lastModifiedFields[DEFAULT_FIELD_LAST_MODIFIED_DATE$1] =
|
|
55546
|
+
targetLastModifiedField > sourceLastModifiedField
|
|
55547
|
+
? targetLastModifiedField
|
|
55548
|
+
: sourceLastModifiedField;
|
|
55549
|
+
}
|
|
55439
55550
|
return {
|
|
55440
55551
|
...targetBody,
|
|
55441
55552
|
...sourceBody,
|
|
55442
55553
|
fields: {
|
|
55443
55554
|
...targetBody.fields,
|
|
55444
55555
|
...sourceBody.fields,
|
|
55556
|
+
...lastModifiedFields,
|
|
55445
55557
|
},
|
|
55446
55558
|
};
|
|
55447
55559
|
}
|
|
@@ -55449,6 +55561,13 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55449
55561
|
function isField(key, data) {
|
|
55450
55562
|
return isStoreKeyRecordField(key);
|
|
55451
55563
|
}
|
|
55564
|
+
// true if `createable/updateable` property of backdating field is true and draft does not include that fields. If the customer specifies
|
|
55565
|
+
// `LastModifiedDate`, it is not overwritten.
|
|
55566
|
+
function isBackdatingFieldEditable(objectInfo, backdatingFieldName, attributeName, draftActionFieldNames) {
|
|
55567
|
+
return (objectInfo.fields[backdatingFieldName] &&
|
|
55568
|
+
objectInfo.fields[backdatingFieldName][attributeName] &&
|
|
55569
|
+
!draftActionFieldNames.includes(backdatingFieldName));
|
|
55570
|
+
}
|
|
55452
55571
|
|
|
55453
55572
|
/**
|
|
55454
55573
|
* Records are stored in the durable store with scalar fields denormalized. This function takes that denoramlized
|
|
@@ -56483,7 +56602,7 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
|
|
|
56483
56602
|
});
|
|
56484
56603
|
pendingAction.metadata[CONTENT_DOCUMENT_LINK_DRAFT_ID_KEY] = contentDocumentLinkId;
|
|
56485
56604
|
// assert that object infos and references exist
|
|
56486
|
-
const metaDataResult = await this.draftRecordService.getRecordDraftMetadata(
|
|
56605
|
+
const metaDataResult = await this.draftRecordService.getRecordDraftMetadata(contentVersionId, pendingAction);
|
|
56487
56606
|
if (metaDataResult === undefined) {
|
|
56488
56607
|
throw Error('No metadata for draft');
|
|
56489
56608
|
}
|
|
@@ -56497,8 +56616,30 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
|
|
|
56497
56616
|
throw new DraftSynthesisError(`unknown draft precondition failed, metaDataResult: ${JSON.stringify(metaDataResult)}`, 'UNKNOWN');
|
|
56498
56617
|
}
|
|
56499
56618
|
}
|
|
56619
|
+
else if (this.isBackdatingEnabled) {
|
|
56620
|
+
const contentVersionObjectInfo = metaDataResult.data.objectInfos.get(CONTENT_VERSION_API_NAME);
|
|
56621
|
+
if (contentVersionObjectInfo === undefined) {
|
|
56622
|
+
throw Error(`Could not generate draft. Object info is missing`);
|
|
56623
|
+
}
|
|
56624
|
+
// `ContentVersion` support back-dating. Ui-api team has WI @W-14219481 to support `CreatedDate` and `LastModifiedDate`.
|
|
56625
|
+
// right now, these two fields are ignored by server
|
|
56626
|
+
pendingAction.data.body.namedEntries = [
|
|
56627
|
+
...pendingAction.data.body.namedEntries,
|
|
56628
|
+
...this.getBackdatingNameEntries(contentVersionObjectInfo, pendingAction.timestamp),
|
|
56629
|
+
];
|
|
56630
|
+
}
|
|
56500
56631
|
return pendingAction;
|
|
56501
56632
|
}
|
|
56633
|
+
getBackdatingNameEntries(objectInfo, timestamp) {
|
|
56634
|
+
return [DEFAULT_FIELD_CREATED_DATE$1, DEFAULT_FIELD_LAST_MODIFIED_DATE$1]
|
|
56635
|
+
.filter((fieldName) => objectInfo.fields[fieldName] && objectInfo.fields[fieldName].createable)
|
|
56636
|
+
.map((fieldValue) => {
|
|
56637
|
+
return {
|
|
56638
|
+
name: fieldValue,
|
|
56639
|
+
value: new Date(timestamp).toISOString(),
|
|
56640
|
+
};
|
|
56641
|
+
});
|
|
56642
|
+
}
|
|
56502
56643
|
/* istanbul ignore next */
|
|
56503
56644
|
canHandlePublish(_key) {
|
|
56504
56645
|
// no need to touch publishing
|
|
@@ -60260,7 +60401,7 @@ register$1({
|
|
|
60260
60401
|
id: '@salesforce/lds-network-adapter',
|
|
60261
60402
|
instrument: instrument$2,
|
|
60262
60403
|
});
|
|
60263
|
-
// version: 1.
|
|
60404
|
+
// version: 1.256.0-ad6a66c18
|
|
60264
60405
|
|
|
60265
60406
|
const { create: create$3, keys: keys$3 } = Object;
|
|
60266
60407
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -78589,7 +78730,7 @@ register$1({
|
|
|
78589
78730
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
78590
78731
|
instrument: instrument$1,
|
|
78591
78732
|
});
|
|
78592
|
-
// version: 1.
|
|
78733
|
+
// version: 1.256.0-fb019fbad
|
|
78593
78734
|
|
|
78594
78735
|
// On core the unstable adapters are re-exported with different names,
|
|
78595
78736
|
// we want to match them here.
|
|
@@ -80839,7 +80980,7 @@ withDefaultLuvio((luvio) => {
|
|
|
80839
80980
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
80840
80981
|
graphQLImperative = ldsAdapter;
|
|
80841
80982
|
});
|
|
80842
|
-
// version: 1.
|
|
80983
|
+
// version: 1.256.0-fb019fbad
|
|
80843
80984
|
|
|
80844
80985
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
80845
80986
|
__proto__: null,
|
|
@@ -81537,7 +81678,7 @@ const callbacks$1 = [];
|
|
|
81537
81678
|
function register(r) {
|
|
81538
81679
|
callbacks$1.forEach((callback) => callback(r));
|
|
81539
81680
|
}
|
|
81540
|
-
// version: 1.
|
|
81681
|
+
// version: 1.256.0-ad6a66c18
|
|
81541
81682
|
|
|
81542
81683
|
/**
|
|
81543
81684
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -86187,15 +86328,11 @@ function removeEventHandler(session, handler) {
|
|
|
86187
86328
|
}
|
|
86188
86329
|
}
|
|
86189
86330
|
|
|
86190
|
-
|
|
86191
|
-
|
|
86192
|
-
|
|
86193
|
-
|
|
86194
|
-
|
|
86195
|
-
EvictStatus["Succeeded"] = "Succeeded";
|
|
86196
|
-
EvictStatus["Error"] = "Error";
|
|
86197
|
-
EvictStatus["Canceled"] = "Canceled";
|
|
86198
|
-
})(EvictStatus || (EvictStatus = {}));
|
|
86331
|
+
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"}}}}}}}}}};
|
|
86332
|
+
|
|
86333
|
+
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"}}}}}}}}}};
|
|
86334
|
+
|
|
86335
|
+
const ldsMobileInstrumentation = getInstrumentation();
|
|
86199
86336
|
const MessagingDurableSegmentName = 'MESSAGING';
|
|
86200
86337
|
const DEFAULT_MAX_ENTRIES_PER_OPERATION = 500;
|
|
86201
86338
|
const EVICTION_IN_PROGESS_MESSAGE = `Cache eviction in progress. Can't start another until it is finished or canceled.`;
|
|
@@ -86218,18 +86355,27 @@ function evictCacheRecordsByIds(recordIds, onProgressUpdate) {
|
|
|
86218
86355
|
// Send error back if an eviction is going on.
|
|
86219
86356
|
if (activeEvictionInProgress) {
|
|
86220
86357
|
return {
|
|
86221
|
-
status:
|
|
86358
|
+
status: 'Running',
|
|
86222
86359
|
message: EVICTION_IN_PROGESS_MESSAGE,
|
|
86223
86360
|
};
|
|
86224
86361
|
}
|
|
86225
86362
|
activeEvictionInProgress = true;
|
|
86226
86363
|
cancelCurrentEviction = false;
|
|
86364
|
+
const o11yActivity = ldsMobileInstrumentation.startActivity('evictCacheRecordsByIds');
|
|
86365
|
+
const stat = {
|
|
86366
|
+
idCount: recordIds.length,
|
|
86367
|
+
evictedCount: 0,
|
|
86368
|
+
skippedCount: 0,
|
|
86369
|
+
};
|
|
86227
86370
|
const evictAChunk = () => {
|
|
86228
|
-
evictChunksOfRecord(recordIds).then(
|
|
86371
|
+
evictChunksOfRecord(recordIds).then((progress) => {
|
|
86372
|
+
handleInstrumentation(o11yActivity, stat, progress);
|
|
86373
|
+
onEvicted(progress);
|
|
86374
|
+
});
|
|
86229
86375
|
};
|
|
86230
|
-
const onEvicted = getOnEvictedCallback(onProgressUpdate, evictAChunk);
|
|
86376
|
+
const onEvicted = getOnEvictedCallback(o11yActivity, onProgressUpdate, evictAChunk, stat);
|
|
86231
86377
|
evictAChunk();
|
|
86232
|
-
return { status:
|
|
86378
|
+
return { status: 'Started' };
|
|
86233
86379
|
}
|
|
86234
86380
|
/**
|
|
86235
86381
|
* Purging the db entries which passed expired time by specified days
|
|
@@ -86245,19 +86391,28 @@ function evictExpiredCacheEntries(expiredByDays, onProgressUpdate) {
|
|
|
86245
86391
|
// Send error back if an eviction is going on.
|
|
86246
86392
|
if (activeEvictionInProgress) {
|
|
86247
86393
|
return {
|
|
86248
|
-
status:
|
|
86394
|
+
status: 'Running',
|
|
86249
86395
|
message: EVICTION_IN_PROGESS_MESSAGE,
|
|
86250
86396
|
};
|
|
86251
86397
|
}
|
|
86252
86398
|
activeEvictionInProgress = true;
|
|
86253
86399
|
cancelCurrentEviction = false;
|
|
86400
|
+
const stat = {
|
|
86401
|
+
expiredInDays: expiredByDays,
|
|
86402
|
+
evictedCount: 0,
|
|
86403
|
+
skippedCount: 0,
|
|
86404
|
+
};
|
|
86405
|
+
const o11yActivity = ldsMobileInstrumentation.startActivity('evictExpiredCacheEntries');
|
|
86254
86406
|
const overdueExpirationTimeStamp = Date.now() - expiredByDays * 24 * 3600 * 1000;
|
|
86255
86407
|
const evictAChunk = () => {
|
|
86256
|
-
evictChunkOfOverdueEntries(overdueExpirationTimeStamp).then(
|
|
86408
|
+
evictChunkOfOverdueEntries(overdueExpirationTimeStamp).then((progress) => {
|
|
86409
|
+
handleInstrumentation(o11yActivity, stat, progress);
|
|
86410
|
+
onEvicted(progress);
|
|
86411
|
+
});
|
|
86257
86412
|
};
|
|
86258
|
-
const onEvicted = getOnEvictedCallback(onProgressUpdate, evictAChunk);
|
|
86413
|
+
const onEvicted = getOnEvictedCallback(o11yActivity, onProgressUpdate, evictAChunk, stat);
|
|
86259
86414
|
evictAChunk();
|
|
86260
|
-
return { status:
|
|
86415
|
+
return { status: 'Started' };
|
|
86261
86416
|
}
|
|
86262
86417
|
/**
|
|
86263
86418
|
* Signal to stop current eviction if there's an active eviction going on.
|
|
@@ -86273,17 +86428,19 @@ function stopEviction() {
|
|
|
86273
86428
|
* @param evictAChunk
|
|
86274
86429
|
* @returns a callback to call when a chunk of records or entries are removed.
|
|
86275
86430
|
*/
|
|
86276
|
-
function getOnEvictedCallback(onProgressUpdate, evictAChunk) {
|
|
86431
|
+
function getOnEvictedCallback(o11yActivity, onProgressUpdate, evictAChunk, stat) {
|
|
86277
86432
|
return (progress) => {
|
|
86278
86433
|
onProgressUpdate(progress);
|
|
86279
86434
|
const { status } = progress;
|
|
86280
|
-
if (status ===
|
|
86435
|
+
if (status === 'Succeeded' || status === 'Error') {
|
|
86281
86436
|
activeEvictionInProgress = false;
|
|
86282
86437
|
}
|
|
86283
|
-
if (status ===
|
|
86438
|
+
if (status === 'Evicted') {
|
|
86284
86439
|
if (cancelCurrentEviction) {
|
|
86285
86440
|
activeEvictionInProgress = false;
|
|
86286
|
-
|
|
86441
|
+
const canceledProgress = { status: 'Canceled' };
|
|
86442
|
+
onProgressUpdate(canceledProgress);
|
|
86443
|
+
handleInstrumentation(o11yActivity, stat, canceledProgress);
|
|
86287
86444
|
}
|
|
86288
86445
|
else {
|
|
86289
86446
|
evictAChunk();
|
|
@@ -86299,7 +86456,7 @@ function getOnEvictedCallback(onProgressUpdate, evictAChunk) {
|
|
|
86299
86456
|
function evictChunksOfRecord(ids) {
|
|
86300
86457
|
const chunk = ids.splice(0, DEFAULT_MAX_ENTRIES_PER_OPERATION);
|
|
86301
86458
|
if (chunk.length === 0) {
|
|
86302
|
-
return Promise.resolve({ status:
|
|
86459
|
+
return Promise.resolve({ status: 'Succeeded' });
|
|
86303
86460
|
}
|
|
86304
86461
|
return new Promise((resolve) => {
|
|
86305
86462
|
// evict the chunk
|
|
@@ -86320,22 +86477,22 @@ function evictChunksOfRecord(ids) {
|
|
|
86320
86477
|
nimbusSqliteStore.setEntries({ notifyStoreUpdateAvailable: { data: evictedEntries } }, MessagingDurableSegmentName);
|
|
86321
86478
|
}
|
|
86322
86479
|
resolve({
|
|
86323
|
-
status:
|
|
86480
|
+
status: 'Evicted',
|
|
86324
86481
|
evictedEntries,
|
|
86325
86482
|
skippedEntries,
|
|
86326
86483
|
});
|
|
86327
86484
|
})
|
|
86328
86485
|
.catch((reason) => {
|
|
86329
86486
|
resolve({
|
|
86330
|
-
status:
|
|
86331
|
-
message:
|
|
86487
|
+
status: 'Error',
|
|
86488
|
+
message: reason.toString(),
|
|
86332
86489
|
});
|
|
86333
86490
|
});
|
|
86334
86491
|
}
|
|
86335
86492
|
catch (reason) {
|
|
86336
86493
|
resolve({
|
|
86337
|
-
status:
|
|
86338
|
-
message:
|
|
86494
|
+
status: 'Error',
|
|
86495
|
+
message: reason.toString(),
|
|
86339
86496
|
});
|
|
86340
86497
|
}
|
|
86341
86498
|
});
|
|
@@ -86374,30 +86531,50 @@ function evictChunkOfOverdueEntries(overdueExpirationTimestamp) {
|
|
|
86374
86531
|
// broadcast entries evicted
|
|
86375
86532
|
nimbusSqliteStore.setEntries({ notifyStoreUpdateAvailable: { data: evictedEntries } }, MessagingDurableSegmentName);
|
|
86376
86533
|
resolve({
|
|
86377
|
-
status:
|
|
86534
|
+
status: 'Evicted',
|
|
86378
86535
|
evictedEntries,
|
|
86379
86536
|
skippedEntries: [],
|
|
86380
86537
|
});
|
|
86381
86538
|
}
|
|
86382
86539
|
else {
|
|
86383
|
-
resolve({ status:
|
|
86540
|
+
resolve({ status: 'Succeeded' });
|
|
86384
86541
|
}
|
|
86385
86542
|
})
|
|
86386
86543
|
.catch((reason) => {
|
|
86387
86544
|
resolve({
|
|
86388
|
-
status:
|
|
86389
|
-
message:
|
|
86545
|
+
status: 'Error',
|
|
86546
|
+
message: reason.toString(),
|
|
86390
86547
|
});
|
|
86391
86548
|
});
|
|
86392
86549
|
}
|
|
86393
86550
|
catch (reason) {
|
|
86394
86551
|
resolve({
|
|
86395
|
-
status:
|
|
86396
|
-
message:
|
|
86552
|
+
status: 'Error',
|
|
86553
|
+
message: reason.toString(),
|
|
86397
86554
|
});
|
|
86398
86555
|
}
|
|
86399
86556
|
});
|
|
86400
86557
|
}
|
|
86558
|
+
function handleInstrumentation(activity, stat, progress) {
|
|
86559
|
+
const status = progress.status;
|
|
86560
|
+
if (status === 'Evicted') {
|
|
86561
|
+
const evicted = progress;
|
|
86562
|
+
stat.evictedCount += evicted.evictedEntries.length;
|
|
86563
|
+
stat.skippedCount += evicted.skippedEntries.length;
|
|
86564
|
+
return;
|
|
86565
|
+
}
|
|
86566
|
+
const schema = 'idCount' in stat ? evict_cache_records_by_ids : evict_expired_entries;
|
|
86567
|
+
const userData = {
|
|
86568
|
+
...stat,
|
|
86569
|
+
isCanceled: status === 'Canceled',
|
|
86570
|
+
};
|
|
86571
|
+
if (status === 'Error') {
|
|
86572
|
+
activity.error(progress.message, schema, userData);
|
|
86573
|
+
}
|
|
86574
|
+
else if (status === 'Succeeded' || status === 'Canceled') {
|
|
86575
|
+
activity.stop(schema, userData);
|
|
86576
|
+
}
|
|
86577
|
+
}
|
|
86401
86578
|
|
|
86402
86579
|
// LWR has a "setupLDS" bootstrap service/loader hook, we simulate this in
|
|
86403
86580
|
// standalone bundle by mimicking what "setupLDS" does here and then exporting
|
|
@@ -86406,4 +86583,4 @@ const { luvio } = getRuntime();
|
|
|
86406
86583
|
setDefaultLuvio({ luvio });
|
|
86407
86584
|
|
|
86408
86585
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
86409
|
-
// version: 1.
|
|
86586
|
+
// 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;
|