@salesforce/lds-worker-api 1.287.0-dev5 → 1.287.0-dev7
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.
|
@@ -1074,4 +1074,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
|
|
1076
1076
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
1077
|
-
// version: 1.287.0-
|
|
1077
|
+
// version: 1.287.0-dev7-60e10f218
|
|
@@ -898,6 +898,9 @@ class StringKeyInMemoryStore {
|
|
|
898
898
|
delete this.records[canonicalKey];
|
|
899
899
|
this.markVisited(canonicalKey);
|
|
900
900
|
}
|
|
901
|
+
cleanup() {
|
|
902
|
+
this.scheduleTrim();
|
|
903
|
+
}
|
|
901
904
|
/**
|
|
902
905
|
* Deallocates data at the canonical key location for in-memory (L1) cache
|
|
903
906
|
* @param key key to deallocate
|
|
@@ -1600,6 +1603,11 @@ class InMemoryStore {
|
|
|
1600
1603
|
this.recordsMap.delete(canonicalKey);
|
|
1601
1604
|
this.markVisited(canonicalKey);
|
|
1602
1605
|
}
|
|
1606
|
+
cleanup() {
|
|
1607
|
+
if (this.fallbackStringKeyInMemoryStore.pendingTrimKeys.size > 0) {
|
|
1608
|
+
this.fallbackStringKeyInMemoryStore.cleanup();
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1603
1611
|
/**
|
|
1604
1612
|
* Deallocates data at the canonical key location for in-memory (L1) cache
|
|
1605
1613
|
* @param key key to deallocate
|
|
@@ -2087,7 +2095,7 @@ const onlyIfCachedImplementation = function (args) {
|
|
|
2087
2095
|
headers: {},
|
|
2088
2096
|
ok: false,
|
|
2089
2097
|
status: HttpStatusCode$1.GatewayTimeout,
|
|
2090
|
-
statusText: '
|
|
2098
|
+
statusText: 'Data requested with only-if-cached policy and not found in the cache.',
|
|
2091
2099
|
errorType: 'fetchResponse',
|
|
2092
2100
|
}, refresh);
|
|
2093
2101
|
});
|
|
@@ -3405,6 +3413,9 @@ class Environment {
|
|
|
3405
3413
|
storeLookup(sel, createSnapshot, refresh, ttlStrategy) {
|
|
3406
3414
|
return this.store.lookup(sel, createSnapshot, refresh, ttlStrategy);
|
|
3407
3415
|
}
|
|
3416
|
+
storeCleanup() {
|
|
3417
|
+
this.store.cleanup();
|
|
3418
|
+
}
|
|
3408
3419
|
storeEvict(key) {
|
|
3409
3420
|
this.store.evict(key);
|
|
3410
3421
|
}
|
|
@@ -3674,6 +3685,9 @@ class Luvio {
|
|
|
3674
3685
|
storeEvict(key) {
|
|
3675
3686
|
this.environment.storeEvict(key);
|
|
3676
3687
|
}
|
|
3688
|
+
storeCleanup() {
|
|
3689
|
+
this.environment.storeCleanup();
|
|
3690
|
+
}
|
|
3677
3691
|
createSnapshot(selector, refresh) {
|
|
3678
3692
|
return this.environment.createSnapshot(selector, refresh);
|
|
3679
3693
|
}
|
|
@@ -4062,7 +4076,7 @@ function createResourceParamsImpl(config, configMetadata) {
|
|
|
4062
4076
|
}
|
|
4063
4077
|
return resourceParams;
|
|
4064
4078
|
}
|
|
4065
|
-
// engine version: 0.154.
|
|
4079
|
+
// engine version: 0.154.17-dev2-5c176528
|
|
4066
4080
|
|
|
4067
4081
|
/**
|
|
4068
4082
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4190,7 +4204,7 @@ function withDefaultLuvio(callback) {
|
|
|
4190
4204
|
}
|
|
4191
4205
|
callbacks.push(callback);
|
|
4192
4206
|
}
|
|
4193
|
-
// version: 1.287.0-
|
|
4207
|
+
// version: 1.287.0-dev7-60e10f218
|
|
4194
4208
|
|
|
4195
4209
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4196
4210
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15698,7 +15712,7 @@ function gql(literals, ...subs) {
|
|
|
15698
15712
|
}
|
|
15699
15713
|
return superResult;
|
|
15700
15714
|
}
|
|
15701
|
-
// version: 1.287.0-
|
|
15715
|
+
// version: 1.287.0-dev7-60e10f218
|
|
15702
15716
|
|
|
15703
15717
|
function unwrap(data) {
|
|
15704
15718
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16356,12 +16370,16 @@ function createImperativeAdapter(luvio, adapter, metadata) {
|
|
|
16356
16370
|
callback(snapshotToTuple$1(snapshotOrPromise));
|
|
16357
16371
|
return;
|
|
16358
16372
|
}
|
|
16359
|
-
snapshotOrPromise
|
|
16373
|
+
snapshotOrPromise
|
|
16374
|
+
.then((snapshot) => {
|
|
16360
16375
|
if (snapshot === null) {
|
|
16361
16376
|
callback(createInvalidConfigError$1());
|
|
16362
16377
|
return;
|
|
16363
16378
|
}
|
|
16364
16379
|
callback(snapshotToTuple$1(snapshot));
|
|
16380
|
+
})
|
|
16381
|
+
.finally(() => {
|
|
16382
|
+
luvio.storeCleanup();
|
|
16365
16383
|
});
|
|
16366
16384
|
};
|
|
16367
16385
|
defineProperty(imperativeAdapterInvoke, 'name', {
|
|
@@ -16623,7 +16641,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
16623
16641
|
const { apiFamily, name } = metadata;
|
|
16624
16642
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16625
16643
|
}
|
|
16626
|
-
// version: 1.287.0-
|
|
16644
|
+
// version: 1.287.0-dev7-60e10f218
|
|
16627
16645
|
|
|
16628
16646
|
/**
|
|
16629
16647
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -16722,7 +16740,7 @@ var TypeCheckShapes;
|
|
|
16722
16740
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
16723
16741
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
16724
16742
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
16725
|
-
// engine version: 0.154.
|
|
16743
|
+
// engine version: 0.154.17-dev2-5c176528
|
|
16726
16744
|
|
|
16727
16745
|
const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
|
|
16728
16746
|
|
|
@@ -44184,7 +44202,7 @@ withDefaultLuvio((luvio) => {
|
|
|
44184
44202
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
44185
44203
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
44186
44204
|
});
|
|
44187
|
-
// version: 1.287.0-
|
|
44205
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
44188
44206
|
|
|
44189
44207
|
var ldsIdempotencyWriteDisabled = {
|
|
44190
44208
|
isOpen: function (e) {
|
|
@@ -44343,6 +44361,15 @@ var ldsPrimingGraphqlBatch = {
|
|
|
44343
44361
|
},
|
|
44344
44362
|
};
|
|
44345
44363
|
|
|
44364
|
+
var aggressiveTrimLowLimitGate = {
|
|
44365
|
+
isOpen: function (e) {
|
|
44366
|
+
return e.fallback;
|
|
44367
|
+
},
|
|
44368
|
+
hasError: function () {
|
|
44369
|
+
return !0;
|
|
44370
|
+
},
|
|
44371
|
+
};
|
|
44372
|
+
|
|
44346
44373
|
var ldsMetadataRefreshEnabled = {
|
|
44347
44374
|
isOpen: function (e) {
|
|
44348
44375
|
return e.fallback;
|
|
@@ -45493,7 +45520,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
|
|
|
45493
45520
|
// because we do not want some other code attempting to use the
|
|
45494
45521
|
// in-memory values before the durable store onChanged handler
|
|
45495
45522
|
// calls back and revives the values to in-memory
|
|
45496
|
-
environment.
|
|
45523
|
+
environment.storeDealloc(key);
|
|
45497
45524
|
};
|
|
45498
45525
|
const publishStoreMetadata = function (recordId, storeMetadata) {
|
|
45499
45526
|
validateNotDisposed();
|
|
@@ -56867,7 +56894,7 @@ function applyReferenceLinksToDraft(record, draftMetadata) {
|
|
|
56867
56894
|
const referencedRecord = referencedRecords.get(key);
|
|
56868
56895
|
recordFields[relationshipName] = {
|
|
56869
56896
|
displayValue: null,
|
|
56870
|
-
value: createLink$
|
|
56897
|
+
value: createLink$1$1(key),
|
|
56871
56898
|
};
|
|
56872
56899
|
// for custom objects, we select the 'Name' field
|
|
56873
56900
|
// otherwise we check the object info for name fields.
|
|
@@ -56895,7 +56922,7 @@ function applyReferenceLinksToDraft(record, draftMetadata) {
|
|
|
56895
56922
|
}
|
|
56896
56923
|
return { ...record, fields: recordFields };
|
|
56897
56924
|
}
|
|
56898
|
-
function createLink$
|
|
56925
|
+
function createLink$1$1(key) {
|
|
56899
56926
|
return { __ref: key };
|
|
56900
56927
|
}
|
|
56901
56928
|
function getReferenceInfoForKey(fieldName, field, luvio, objectInfo) {
|
|
@@ -56910,7 +56937,7 @@ function getReferenceInfoForKey(fieldName, field, luvio, objectInfo) {
|
|
|
56910
56937
|
referenceFieldName: relationshipName,
|
|
56911
56938
|
field: {
|
|
56912
56939
|
displayValue: null,
|
|
56913
|
-
value: createLink$
|
|
56940
|
+
value: createLink$1$1(key),
|
|
56914
56941
|
},
|
|
56915
56942
|
};
|
|
56916
56943
|
}
|
|
@@ -57373,6 +57400,9 @@ function isBackdatingFieldEditable(objectInfo, backdatingFieldName, attributeNam
|
|
|
57373
57400
|
!draftActionFieldNames.includes(backdatingFieldName));
|
|
57374
57401
|
}
|
|
57375
57402
|
|
|
57403
|
+
function createLink$2(key) {
|
|
57404
|
+
return { __ref: key };
|
|
57405
|
+
}
|
|
57376
57406
|
/**
|
|
57377
57407
|
* Records are stored in the durable store with scalar fields denormalized. This function takes that denoramlized
|
|
57378
57408
|
* durable store record representation and normalizes it back out into the format the the luvio store expects it
|
|
@@ -57383,26 +57413,25 @@ function isBackdatingFieldEditable(objectInfo, backdatingFieldName, attributeNam
|
|
|
57383
57413
|
function normalizeRecordFields(key, entry) {
|
|
57384
57414
|
const { data: record } = entry;
|
|
57385
57415
|
const { fields, links } = record;
|
|
57386
|
-
const
|
|
57416
|
+
const missingFieldLinks = keys$3$1(links);
|
|
57417
|
+
const fieldNames = keys$3$1(fields);
|
|
57387
57418
|
const normalizedFields = {};
|
|
57388
57419
|
const returnEntries = {};
|
|
57389
|
-
|
|
57390
|
-
|
|
57420
|
+
// restore fields
|
|
57421
|
+
for (let i = 0, len = fieldNames.length; i < len; i++) {
|
|
57422
|
+
const fieldName = fieldNames[i];
|
|
57391
57423
|
const field = fields[fieldName];
|
|
57424
|
+
const fieldKey = buildRecordFieldStoreKey(key, fieldName);
|
|
57425
|
+
returnEntries[fieldKey] = { data: field };
|
|
57426
|
+
normalizedFields[fieldName] = createLink$2(fieldKey);
|
|
57427
|
+
}
|
|
57428
|
+
// restore missing fields
|
|
57429
|
+
for (let i = 0, len = missingFieldLinks.length; i < len; i++) {
|
|
57430
|
+
const fieldName = missingFieldLinks[i];
|
|
57392
57431
|
const link = links[fieldName];
|
|
57393
|
-
// field is undefined for missing links
|
|
57394
|
-
if (field !== undefined) {
|
|
57395
|
-
const fieldKey = buildRecordFieldStoreKey(key, fieldName);
|
|
57396
|
-
returnEntries[fieldKey] = { data: field };
|
|
57397
|
-
}
|
|
57398
|
-
// we need to restore the undefined __ref node as it is
|
|
57399
|
-
// lost during serialization
|
|
57400
57432
|
if (link.isMissing === true) {
|
|
57401
57433
|
normalizedFields[fieldName] = { ...link, __ref: undefined };
|
|
57402
57434
|
}
|
|
57403
|
-
else {
|
|
57404
|
-
normalizedFields[fieldName] = link;
|
|
57405
|
-
}
|
|
57406
57435
|
}
|
|
57407
57436
|
returnEntries[key] = {
|
|
57408
57437
|
data: assign$3(record, { fields: normalizedFields }),
|
|
@@ -57464,7 +57493,7 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
|
|
|
57464
57493
|
}
|
|
57465
57494
|
}
|
|
57466
57495
|
// we want to preserve fields that are missing nodes
|
|
57467
|
-
if (
|
|
57496
|
+
if (field.isMissing === true) {
|
|
57468
57497
|
links[fieldName] = field;
|
|
57469
57498
|
}
|
|
57470
57499
|
}
|
|
@@ -57483,7 +57512,7 @@ function getDenormalizedKey(originalKey, recordId, luvio) {
|
|
|
57483
57512
|
}
|
|
57484
57513
|
return keyBuilder$26(luvio, { recordId });
|
|
57485
57514
|
}
|
|
57486
|
-
function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore) {
|
|
57515
|
+
function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore, sqlStore) {
|
|
57487
57516
|
const getEntries = function (entries, segment) {
|
|
57488
57517
|
// this HOF only inspects records in the default segment
|
|
57489
57518
|
if (segment !== DefaultDurableSegment) {
|
|
@@ -57545,7 +57574,10 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57545
57574
|
});
|
|
57546
57575
|
};
|
|
57547
57576
|
const denormalizeEntries = function (entries) {
|
|
57577
|
+
let hasEntries = false;
|
|
57578
|
+
let hasMetadata = false;
|
|
57548
57579
|
const putEntries = create$3$1(null);
|
|
57580
|
+
const putMetadata = create$3$1(null);
|
|
57549
57581
|
const keys$1 = keys$3$1(entries);
|
|
57550
57582
|
const putRecords = {};
|
|
57551
57583
|
const putRecordViews = {};
|
|
@@ -57588,6 +57620,7 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57588
57620
|
putRecords[recordId] = true;
|
|
57589
57621
|
}
|
|
57590
57622
|
if (isStoreRecordError(record)) {
|
|
57623
|
+
hasEntries = true;
|
|
57591
57624
|
putEntries[recordKey] = value;
|
|
57592
57625
|
continue;
|
|
57593
57626
|
}
|
|
@@ -57600,24 +57633,43 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57600
57633
|
}
|
|
57601
57634
|
const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
|
|
57602
57635
|
if (denormalizedRecord !== undefined) {
|
|
57636
|
+
hasEntries = true;
|
|
57603
57637
|
putEntries[recordKey] = {
|
|
57604
57638
|
data: denormalizedRecord,
|
|
57605
57639
|
metadata,
|
|
57606
57640
|
};
|
|
57641
|
+
// if undefined then it is pending
|
|
57642
|
+
// we should still update metadata on pending records
|
|
57643
|
+
}
|
|
57644
|
+
else {
|
|
57645
|
+
hasMetadata = true;
|
|
57646
|
+
metadata.expirationTimestamp = metadata.ingestionTimestamp;
|
|
57647
|
+
putMetadata[recordKey] = {
|
|
57648
|
+
metadata,
|
|
57649
|
+
};
|
|
57607
57650
|
}
|
|
57608
57651
|
}
|
|
57609
57652
|
else {
|
|
57653
|
+
hasEntries = true;
|
|
57610
57654
|
putEntries[key] = value;
|
|
57611
57655
|
}
|
|
57612
57656
|
}
|
|
57613
|
-
return putEntries;
|
|
57657
|
+
return { putEntries, putMetadata, hasEntries, hasMetadata };
|
|
57614
57658
|
};
|
|
57615
57659
|
const setEntries = function (entries, segment) {
|
|
57616
57660
|
if (segment !== DefaultDurableSegment) {
|
|
57617
57661
|
return durableStore.setEntries(entries, segment);
|
|
57618
57662
|
}
|
|
57619
|
-
const putEntries = denormalizeEntries(entries);
|
|
57620
|
-
|
|
57663
|
+
const { putEntries, putMetadata, hasEntries, hasMetadata } = denormalizeEntries(entries);
|
|
57664
|
+
const promises = [
|
|
57665
|
+
hasEntries ? durableStore.setEntries(putEntries, segment) : undefined,
|
|
57666
|
+
];
|
|
57667
|
+
if (sqlStore !== undefined && sqlStore.isBatchUpdateSupported()) {
|
|
57668
|
+
promises.push(hasMetadata && sqlStore !== undefined
|
|
57669
|
+
? durableStore.setMetadata(putMetadata, segment)
|
|
57670
|
+
: undefined);
|
|
57671
|
+
}
|
|
57672
|
+
return Promise.all(promises).then(() => { });
|
|
57621
57673
|
};
|
|
57622
57674
|
const batchOperations = function (operations) {
|
|
57623
57675
|
const operationsWithDenormedRecords = [];
|
|
@@ -57634,10 +57686,20 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57634
57686
|
// this is determined by the plugin supporting update batch calls before it gets to this HOF.
|
|
57635
57687
|
// so we only need to check one entry to confirm this for performance
|
|
57636
57688
|
if (firstEntry.data !== undefined) {
|
|
57689
|
+
const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
|
|
57637
57690
|
operationsWithDenormedRecords.push({
|
|
57638
57691
|
...operation,
|
|
57639
|
-
entries:
|
|
57692
|
+
entries: putEntries,
|
|
57640
57693
|
});
|
|
57694
|
+
if (hasMetadata &&
|
|
57695
|
+
sqlStore !== undefined &&
|
|
57696
|
+
sqlStore.isBatchUpdateSupported() === true) {
|
|
57697
|
+
operationsWithDenormedRecords.push({
|
|
57698
|
+
...operation,
|
|
57699
|
+
entries: putMetadata,
|
|
57700
|
+
type: 'setMetadata',
|
|
57701
|
+
});
|
|
57702
|
+
}
|
|
57641
57703
|
}
|
|
57642
57704
|
else {
|
|
57643
57705
|
operationsWithDenormedRecords.push(operation);
|
|
@@ -57649,10 +57711,20 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57649
57711
|
operationsWithDenormedRecords.push(operation);
|
|
57650
57712
|
continue;
|
|
57651
57713
|
}
|
|
57714
|
+
const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
|
|
57652
57715
|
operationsWithDenormedRecords.push({
|
|
57653
57716
|
...operation,
|
|
57654
|
-
entries:
|
|
57717
|
+
entries: putEntries,
|
|
57655
57718
|
});
|
|
57719
|
+
if (hasMetadata &&
|
|
57720
|
+
sqlStore !== undefined &&
|
|
57721
|
+
sqlStore.isBatchUpdateSupported() === true) {
|
|
57722
|
+
operationsWithDenormedRecords.push({
|
|
57723
|
+
...operation,
|
|
57724
|
+
entries: putMetadata,
|
|
57725
|
+
type: 'setMetadata',
|
|
57726
|
+
});
|
|
57727
|
+
}
|
|
57656
57728
|
}
|
|
57657
57729
|
return durableStore.batchOperations(operationsWithDenormedRecords);
|
|
57658
57730
|
};
|
|
@@ -60119,9 +60191,11 @@ function enableObjectInfoCaching(env, ensureObjectInfoCached) {
|
|
|
60119
60191
|
let apiName = null;
|
|
60120
60192
|
let objectInfo;
|
|
60121
60193
|
if (dataIsRecord(key)) {
|
|
60194
|
+
incomingRecords.delete(key);
|
|
60122
60195
|
apiName = data.apiName;
|
|
60123
60196
|
}
|
|
60124
60197
|
else if (dataIsObjectInfo(key)) {
|
|
60198
|
+
incomingObjectInfos.delete(key);
|
|
60125
60199
|
apiName = data.apiName;
|
|
60126
60200
|
objectInfo = data;
|
|
60127
60201
|
}
|
|
@@ -60632,6 +60706,9 @@ class NimbusSqliteStore {
|
|
|
60632
60706
|
isEvalSupported() {
|
|
60633
60707
|
return true;
|
|
60634
60708
|
}
|
|
60709
|
+
isBatchUpdateSupported() {
|
|
60710
|
+
return this.supportsBatchUpdates;
|
|
60711
|
+
}
|
|
60635
60712
|
query(sql, params) {
|
|
60636
60713
|
return new Promise((resolve, reject) => {
|
|
60637
60714
|
this.plugin.query(sql, params, (result) => {
|
|
@@ -61796,7 +61873,6 @@ class RecordLoaderGraphQL {
|
|
|
61796
61873
|
}, {});
|
|
61797
61874
|
fields['Id'] = { value: id, displayValue: null };
|
|
61798
61875
|
fields['RecordTypeId'] = { value: recordTypeId, displayValue: null };
|
|
61799
|
-
const links = this.generateFieldLinks(id, [...requestedFields, 'Id', 'RecordTypeId']);
|
|
61800
61876
|
return {
|
|
61801
61877
|
apiName: node[`${requiredPrefix}ApiName`],
|
|
61802
61878
|
childRelationships: {},
|
|
@@ -61818,18 +61894,9 @@ class RecordLoaderGraphQL {
|
|
|
61818
61894
|
: null,
|
|
61819
61895
|
weakEtag: node[`${requiredPrefix}WeakEtag`],
|
|
61820
61896
|
fields,
|
|
61821
|
-
links,
|
|
61897
|
+
links: {},
|
|
61822
61898
|
};
|
|
61823
61899
|
}
|
|
61824
|
-
generateFieldLinks(id, fields) {
|
|
61825
|
-
const links = {};
|
|
61826
|
-
for (const field of fields) {
|
|
61827
|
-
links[field] = {
|
|
61828
|
-
__ref: `UiApi::RecordRepresentation:${id}__fields__${field}`,
|
|
61829
|
-
};
|
|
61830
|
-
}
|
|
61831
|
-
return links;
|
|
61832
|
-
}
|
|
61833
61900
|
}
|
|
61834
61901
|
|
|
61835
61902
|
class RecordIngestor {
|
|
@@ -62058,6 +62125,20 @@ class SqlitePrimingStore {
|
|
|
62058
62125
|
async writeBatch(records, overwrite) {
|
|
62059
62126
|
const idsToPrime = new Set();
|
|
62060
62127
|
const written = [];
|
|
62128
|
+
if (overwrite === true) {
|
|
62129
|
+
// if overwrite is true we need to raise change notifications so use the batchOperations
|
|
62130
|
+
const operations = {};
|
|
62131
|
+
for (const { record, metadata } of records) {
|
|
62132
|
+
const key = keyBuilder$26(this.getLuvio(), { recordId: record.id });
|
|
62133
|
+
idsToPrime.add(record.id);
|
|
62134
|
+
operations[key] = {
|
|
62135
|
+
data: record,
|
|
62136
|
+
metadata: { ...metadata, metadataVersion: DURABLE_METADATA_VERSION },
|
|
62137
|
+
};
|
|
62138
|
+
}
|
|
62139
|
+
await this.store.setEntries(operations, DefaultDurableSegment);
|
|
62140
|
+
return { written: Array.from(idsToPrime), conflicted: [], errors: [] };
|
|
62141
|
+
}
|
|
62061
62142
|
const statement = `${overwrite ? 'REPLACE' : 'INSERT or IGNORE'} INTO lds_data (key, data, metadata) VALUES ${records
|
|
62062
62143
|
.map((_) => `(?,?,?)`)
|
|
62063
62144
|
.join(',')} returning key;`;
|
|
@@ -62173,7 +62254,9 @@ function primingSessionFactory(config) {
|
|
|
62173
62254
|
return instrumentPrimingSession(session);
|
|
62174
62255
|
}
|
|
62175
62256
|
|
|
62176
|
-
const DEFAULT_MAX_RECORD_COUNT =
|
|
62257
|
+
const DEFAULT_MAX_RECORD_COUNT = aggressiveTrimLowLimitGate.isOpen({ fallback: false })
|
|
62258
|
+
? 20000
|
|
62259
|
+
: 200000;
|
|
62177
62260
|
const DEFAULT_MAX_BATCH_SIZE = 200;
|
|
62178
62261
|
async function aggressiveTrim(data, deallocateFn, options = {}) {
|
|
62179
62262
|
const maxStoreRecords = options.maxStoreRecords !== undefined ? options.maxStoreRecords : DEFAULT_MAX_RECORD_COUNT;
|
|
@@ -62284,9 +62367,11 @@ function getRuntime() {
|
|
|
62284
62367
|
// user id centric record ID generator
|
|
62285
62368
|
const { newRecordId, isGenerated } = recordIdGenerator(userId);
|
|
62286
62369
|
// non-draft-aware base services
|
|
62287
|
-
|
|
62288
|
-
|
|
62289
|
-
|
|
62370
|
+
let storeOptions = {};
|
|
62371
|
+
{
|
|
62372
|
+
storeOptions.customTrimPolicy = aggressiveTrim;
|
|
62373
|
+
}
|
|
62374
|
+
const store = new InMemoryStore(storeOptions);
|
|
62290
62375
|
lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter, {
|
|
62291
62376
|
reportChunkCandidateUrlLength: reportChunkCandidateUrlLength,
|
|
62292
62377
|
}));
|
|
@@ -62313,7 +62398,7 @@ function getRuntime() {
|
|
|
62313
62398
|
let getIngestRecords;
|
|
62314
62399
|
let getIngestMetadata;
|
|
62315
62400
|
let getIngestStore;
|
|
62316
|
-
const recordDenormingStore = makeRecordDenormalizingDurableStore(lazyLuvio, lazyBaseDurableStore, () => (getIngestRecords !== undefined ? getIngestRecords() : {}), () => (getIngestMetadata !== undefined ? getIngestMetadata() : {}), () => (getIngestStore !== undefined ? getIngestStore() : undefined));
|
|
62401
|
+
const recordDenormingStore = makeRecordDenormalizingDurableStore(lazyLuvio, lazyBaseDurableStore, () => (getIngestRecords !== undefined ? getIngestRecords() : {}), () => (getIngestMetadata !== undefined ? getIngestMetadata() : {}), () => (getIngestStore !== undefined ? getIngestStore() : undefined), lazyBaseDurableStore);
|
|
62317
62402
|
const baseEnv = new Environment(store, lazyNetworkAdapter);
|
|
62318
62403
|
const gqlEnv = makeEnvironmentGraphqlAware(baseEnv);
|
|
62319
62404
|
const durableEnv = makeDurable(gqlEnv, {
|
|
@@ -62423,7 +62508,7 @@ register$1({
|
|
|
62423
62508
|
id: '@salesforce/lds-network-adapter',
|
|
62424
62509
|
instrument: instrument$2,
|
|
62425
62510
|
});
|
|
62426
|
-
// version: 1.287.0-
|
|
62511
|
+
// version: 1.287.0-dev7-60e10f218
|
|
62427
62512
|
|
|
62428
62513
|
const { create: create$3, keys: keys$3 } = Object;
|
|
62429
62514
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -82487,7 +82572,7 @@ register$1({
|
|
|
82487
82572
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
82488
82573
|
instrument: instrument$1,
|
|
82489
82574
|
});
|
|
82490
|
-
// version: 1.287.0-
|
|
82575
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
82491
82576
|
|
|
82492
82577
|
// On core the unstable adapters are re-exported with different names,
|
|
82493
82578
|
// we want to match them here.
|
|
@@ -84743,7 +84828,7 @@ withDefaultLuvio((luvio) => {
|
|
|
84743
84828
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
84744
84829
|
graphQLImperative = ldsAdapter;
|
|
84745
84830
|
});
|
|
84746
|
-
// version: 1.287.0-
|
|
84831
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
84747
84832
|
|
|
84748
84833
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
84749
84834
|
__proto__: null,
|
|
@@ -85481,7 +85566,7 @@ const callbacks$1 = [];
|
|
|
85481
85566
|
function register(r) {
|
|
85482
85567
|
callbacks$1.forEach((callback) => callback(r));
|
|
85483
85568
|
}
|
|
85484
|
-
// version: 1.287.0-
|
|
85569
|
+
// version: 1.287.0-dev7-60e10f218
|
|
85485
85570
|
|
|
85486
85571
|
/**
|
|
85487
85572
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -90443,4 +90528,4 @@ const { luvio } = getRuntime();
|
|
|
90443
90528
|
setDefaultLuvio({ luvio });
|
|
90444
90529
|
|
|
90445
90530
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
90446
|
-
// version: 1.287.0-
|
|
90531
|
+
// version: 1.287.0-dev7-60e10f218
|
|
@@ -904,6 +904,9 @@
|
|
|
904
904
|
delete this.records[canonicalKey];
|
|
905
905
|
this.markVisited(canonicalKey);
|
|
906
906
|
}
|
|
907
|
+
cleanup() {
|
|
908
|
+
this.scheduleTrim();
|
|
909
|
+
}
|
|
907
910
|
/**
|
|
908
911
|
* Deallocates data at the canonical key location for in-memory (L1) cache
|
|
909
912
|
* @param key key to deallocate
|
|
@@ -1606,6 +1609,11 @@
|
|
|
1606
1609
|
this.recordsMap.delete(canonicalKey);
|
|
1607
1610
|
this.markVisited(canonicalKey);
|
|
1608
1611
|
}
|
|
1612
|
+
cleanup() {
|
|
1613
|
+
if (this.fallbackStringKeyInMemoryStore.pendingTrimKeys.size > 0) {
|
|
1614
|
+
this.fallbackStringKeyInMemoryStore.cleanup();
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1609
1617
|
/**
|
|
1610
1618
|
* Deallocates data at the canonical key location for in-memory (L1) cache
|
|
1611
1619
|
* @param key key to deallocate
|
|
@@ -2093,7 +2101,7 @@
|
|
|
2093
2101
|
headers: {},
|
|
2094
2102
|
ok: false,
|
|
2095
2103
|
status: HttpStatusCode$1.GatewayTimeout,
|
|
2096
|
-
statusText: '
|
|
2104
|
+
statusText: 'Data requested with only-if-cached policy and not found in the cache.',
|
|
2097
2105
|
errorType: 'fetchResponse',
|
|
2098
2106
|
}, refresh);
|
|
2099
2107
|
});
|
|
@@ -3411,6 +3419,9 @@
|
|
|
3411
3419
|
storeLookup(sel, createSnapshot, refresh, ttlStrategy) {
|
|
3412
3420
|
return this.store.lookup(sel, createSnapshot, refresh, ttlStrategy);
|
|
3413
3421
|
}
|
|
3422
|
+
storeCleanup() {
|
|
3423
|
+
this.store.cleanup();
|
|
3424
|
+
}
|
|
3414
3425
|
storeEvict(key) {
|
|
3415
3426
|
this.store.evict(key);
|
|
3416
3427
|
}
|
|
@@ -3680,6 +3691,9 @@
|
|
|
3680
3691
|
storeEvict(key) {
|
|
3681
3692
|
this.environment.storeEvict(key);
|
|
3682
3693
|
}
|
|
3694
|
+
storeCleanup() {
|
|
3695
|
+
this.environment.storeCleanup();
|
|
3696
|
+
}
|
|
3683
3697
|
createSnapshot(selector, refresh) {
|
|
3684
3698
|
return this.environment.createSnapshot(selector, refresh);
|
|
3685
3699
|
}
|
|
@@ -4068,7 +4082,7 @@
|
|
|
4068
4082
|
}
|
|
4069
4083
|
return resourceParams;
|
|
4070
4084
|
}
|
|
4071
|
-
// engine version: 0.154.
|
|
4085
|
+
// engine version: 0.154.17-dev2-5c176528
|
|
4072
4086
|
|
|
4073
4087
|
/**
|
|
4074
4088
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4196,7 +4210,7 @@
|
|
|
4196
4210
|
}
|
|
4197
4211
|
callbacks.push(callback);
|
|
4198
4212
|
}
|
|
4199
|
-
// version: 1.287.0-
|
|
4213
|
+
// version: 1.287.0-dev7-60e10f218
|
|
4200
4214
|
|
|
4201
4215
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4202
4216
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15704,7 +15718,7 @@
|
|
|
15704
15718
|
}
|
|
15705
15719
|
return superResult;
|
|
15706
15720
|
}
|
|
15707
|
-
// version: 1.287.0-
|
|
15721
|
+
// version: 1.287.0-dev7-60e10f218
|
|
15708
15722
|
|
|
15709
15723
|
function unwrap(data) {
|
|
15710
15724
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16362,12 +16376,16 @@
|
|
|
16362
16376
|
callback(snapshotToTuple$1(snapshotOrPromise));
|
|
16363
16377
|
return;
|
|
16364
16378
|
}
|
|
16365
|
-
snapshotOrPromise
|
|
16379
|
+
snapshotOrPromise
|
|
16380
|
+
.then((snapshot) => {
|
|
16366
16381
|
if (snapshot === null) {
|
|
16367
16382
|
callback(createInvalidConfigError$1());
|
|
16368
16383
|
return;
|
|
16369
16384
|
}
|
|
16370
16385
|
callback(snapshotToTuple$1(snapshot));
|
|
16386
|
+
})
|
|
16387
|
+
.finally(() => {
|
|
16388
|
+
luvio.storeCleanup();
|
|
16371
16389
|
});
|
|
16372
16390
|
};
|
|
16373
16391
|
defineProperty(imperativeAdapterInvoke, 'name', {
|
|
@@ -16629,7 +16647,7 @@
|
|
|
16629
16647
|
const { apiFamily, name } = metadata;
|
|
16630
16648
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16631
16649
|
}
|
|
16632
|
-
// version: 1.287.0-
|
|
16650
|
+
// version: 1.287.0-dev7-60e10f218
|
|
16633
16651
|
|
|
16634
16652
|
/**
|
|
16635
16653
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -16728,7 +16746,7 @@
|
|
|
16728
16746
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
16729
16747
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
16730
16748
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
16731
|
-
// engine version: 0.154.
|
|
16749
|
+
// engine version: 0.154.17-dev2-5c176528
|
|
16732
16750
|
|
|
16733
16751
|
const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
|
|
16734
16752
|
|
|
@@ -44190,7 +44208,7 @@
|
|
|
44190
44208
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
44191
44209
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
44192
44210
|
});
|
|
44193
|
-
// version: 1.287.0-
|
|
44211
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
44194
44212
|
|
|
44195
44213
|
var ldsIdempotencyWriteDisabled = {
|
|
44196
44214
|
isOpen: function (e) {
|
|
@@ -44349,6 +44367,15 @@
|
|
|
44349
44367
|
},
|
|
44350
44368
|
};
|
|
44351
44369
|
|
|
44370
|
+
var aggressiveTrimLowLimitGate = {
|
|
44371
|
+
isOpen: function (e) {
|
|
44372
|
+
return e.fallback;
|
|
44373
|
+
},
|
|
44374
|
+
hasError: function () {
|
|
44375
|
+
return !0;
|
|
44376
|
+
},
|
|
44377
|
+
};
|
|
44378
|
+
|
|
44352
44379
|
var ldsMetadataRefreshEnabled = {
|
|
44353
44380
|
isOpen: function (e) {
|
|
44354
44381
|
return e.fallback;
|
|
@@ -45499,7 +45526,7 @@
|
|
|
45499
45526
|
// because we do not want some other code attempting to use the
|
|
45500
45527
|
// in-memory values before the durable store onChanged handler
|
|
45501
45528
|
// calls back and revives the values to in-memory
|
|
45502
|
-
environment.
|
|
45529
|
+
environment.storeDealloc(key);
|
|
45503
45530
|
};
|
|
45504
45531
|
const publishStoreMetadata = function (recordId, storeMetadata) {
|
|
45505
45532
|
validateNotDisposed();
|
|
@@ -56873,7 +56900,7 @@
|
|
|
56873
56900
|
const referencedRecord = referencedRecords.get(key);
|
|
56874
56901
|
recordFields[relationshipName] = {
|
|
56875
56902
|
displayValue: null,
|
|
56876
|
-
value: createLink$
|
|
56903
|
+
value: createLink$1$1(key),
|
|
56877
56904
|
};
|
|
56878
56905
|
// for custom objects, we select the 'Name' field
|
|
56879
56906
|
// otherwise we check the object info for name fields.
|
|
@@ -56901,7 +56928,7 @@
|
|
|
56901
56928
|
}
|
|
56902
56929
|
return { ...record, fields: recordFields };
|
|
56903
56930
|
}
|
|
56904
|
-
function createLink$
|
|
56931
|
+
function createLink$1$1(key) {
|
|
56905
56932
|
return { __ref: key };
|
|
56906
56933
|
}
|
|
56907
56934
|
function getReferenceInfoForKey(fieldName, field, luvio, objectInfo) {
|
|
@@ -56916,7 +56943,7 @@
|
|
|
56916
56943
|
referenceFieldName: relationshipName,
|
|
56917
56944
|
field: {
|
|
56918
56945
|
displayValue: null,
|
|
56919
|
-
value: createLink$
|
|
56946
|
+
value: createLink$1$1(key),
|
|
56920
56947
|
},
|
|
56921
56948
|
};
|
|
56922
56949
|
}
|
|
@@ -57379,6 +57406,9 @@
|
|
|
57379
57406
|
!draftActionFieldNames.includes(backdatingFieldName));
|
|
57380
57407
|
}
|
|
57381
57408
|
|
|
57409
|
+
function createLink$2(key) {
|
|
57410
|
+
return { __ref: key };
|
|
57411
|
+
}
|
|
57382
57412
|
/**
|
|
57383
57413
|
* Records are stored in the durable store with scalar fields denormalized. This function takes that denoramlized
|
|
57384
57414
|
* durable store record representation and normalizes it back out into the format the the luvio store expects it
|
|
@@ -57389,26 +57419,25 @@
|
|
|
57389
57419
|
function normalizeRecordFields(key, entry) {
|
|
57390
57420
|
const { data: record } = entry;
|
|
57391
57421
|
const { fields, links } = record;
|
|
57392
|
-
const
|
|
57422
|
+
const missingFieldLinks = keys$3$1(links);
|
|
57423
|
+
const fieldNames = keys$3$1(fields);
|
|
57393
57424
|
const normalizedFields = {};
|
|
57394
57425
|
const returnEntries = {};
|
|
57395
|
-
|
|
57396
|
-
|
|
57426
|
+
// restore fields
|
|
57427
|
+
for (let i = 0, len = fieldNames.length; i < len; i++) {
|
|
57428
|
+
const fieldName = fieldNames[i];
|
|
57397
57429
|
const field = fields[fieldName];
|
|
57430
|
+
const fieldKey = buildRecordFieldStoreKey(key, fieldName);
|
|
57431
|
+
returnEntries[fieldKey] = { data: field };
|
|
57432
|
+
normalizedFields[fieldName] = createLink$2(fieldKey);
|
|
57433
|
+
}
|
|
57434
|
+
// restore missing fields
|
|
57435
|
+
for (let i = 0, len = missingFieldLinks.length; i < len; i++) {
|
|
57436
|
+
const fieldName = missingFieldLinks[i];
|
|
57398
57437
|
const link = links[fieldName];
|
|
57399
|
-
// field is undefined for missing links
|
|
57400
|
-
if (field !== undefined) {
|
|
57401
|
-
const fieldKey = buildRecordFieldStoreKey(key, fieldName);
|
|
57402
|
-
returnEntries[fieldKey] = { data: field };
|
|
57403
|
-
}
|
|
57404
|
-
// we need to restore the undefined __ref node as it is
|
|
57405
|
-
// lost during serialization
|
|
57406
57438
|
if (link.isMissing === true) {
|
|
57407
57439
|
normalizedFields[fieldName] = { ...link, __ref: undefined };
|
|
57408
57440
|
}
|
|
57409
|
-
else {
|
|
57410
|
-
normalizedFields[fieldName] = link;
|
|
57411
|
-
}
|
|
57412
57441
|
}
|
|
57413
57442
|
returnEntries[key] = {
|
|
57414
57443
|
data: assign$3(record, { fields: normalizedFields }),
|
|
@@ -57470,7 +57499,7 @@
|
|
|
57470
57499
|
}
|
|
57471
57500
|
}
|
|
57472
57501
|
// we want to preserve fields that are missing nodes
|
|
57473
|
-
if (
|
|
57502
|
+
if (field.isMissing === true) {
|
|
57474
57503
|
links[fieldName] = field;
|
|
57475
57504
|
}
|
|
57476
57505
|
}
|
|
@@ -57489,7 +57518,7 @@
|
|
|
57489
57518
|
}
|
|
57490
57519
|
return keyBuilder$26(luvio, { recordId });
|
|
57491
57520
|
}
|
|
57492
|
-
function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore) {
|
|
57521
|
+
function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore, sqlStore) {
|
|
57493
57522
|
const getEntries = function (entries, segment) {
|
|
57494
57523
|
// this HOF only inspects records in the default segment
|
|
57495
57524
|
if (segment !== DefaultDurableSegment) {
|
|
@@ -57551,7 +57580,10 @@
|
|
|
57551
57580
|
});
|
|
57552
57581
|
};
|
|
57553
57582
|
const denormalizeEntries = function (entries) {
|
|
57583
|
+
let hasEntries = false;
|
|
57584
|
+
let hasMetadata = false;
|
|
57554
57585
|
const putEntries = create$3$1(null);
|
|
57586
|
+
const putMetadata = create$3$1(null);
|
|
57555
57587
|
const keys$1 = keys$3$1(entries);
|
|
57556
57588
|
const putRecords = {};
|
|
57557
57589
|
const putRecordViews = {};
|
|
@@ -57594,6 +57626,7 @@
|
|
|
57594
57626
|
putRecords[recordId] = true;
|
|
57595
57627
|
}
|
|
57596
57628
|
if (isStoreRecordError(record)) {
|
|
57629
|
+
hasEntries = true;
|
|
57597
57630
|
putEntries[recordKey] = value;
|
|
57598
57631
|
continue;
|
|
57599
57632
|
}
|
|
@@ -57606,24 +57639,43 @@
|
|
|
57606
57639
|
}
|
|
57607
57640
|
const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
|
|
57608
57641
|
if (denormalizedRecord !== undefined) {
|
|
57642
|
+
hasEntries = true;
|
|
57609
57643
|
putEntries[recordKey] = {
|
|
57610
57644
|
data: denormalizedRecord,
|
|
57611
57645
|
metadata,
|
|
57612
57646
|
};
|
|
57647
|
+
// if undefined then it is pending
|
|
57648
|
+
// we should still update metadata on pending records
|
|
57649
|
+
}
|
|
57650
|
+
else {
|
|
57651
|
+
hasMetadata = true;
|
|
57652
|
+
metadata.expirationTimestamp = metadata.ingestionTimestamp;
|
|
57653
|
+
putMetadata[recordKey] = {
|
|
57654
|
+
metadata,
|
|
57655
|
+
};
|
|
57613
57656
|
}
|
|
57614
57657
|
}
|
|
57615
57658
|
else {
|
|
57659
|
+
hasEntries = true;
|
|
57616
57660
|
putEntries[key] = value;
|
|
57617
57661
|
}
|
|
57618
57662
|
}
|
|
57619
|
-
return putEntries;
|
|
57663
|
+
return { putEntries, putMetadata, hasEntries, hasMetadata };
|
|
57620
57664
|
};
|
|
57621
57665
|
const setEntries = function (entries, segment) {
|
|
57622
57666
|
if (segment !== DefaultDurableSegment) {
|
|
57623
57667
|
return durableStore.setEntries(entries, segment);
|
|
57624
57668
|
}
|
|
57625
|
-
const putEntries = denormalizeEntries(entries);
|
|
57626
|
-
|
|
57669
|
+
const { putEntries, putMetadata, hasEntries, hasMetadata } = denormalizeEntries(entries);
|
|
57670
|
+
const promises = [
|
|
57671
|
+
hasEntries ? durableStore.setEntries(putEntries, segment) : undefined,
|
|
57672
|
+
];
|
|
57673
|
+
if (sqlStore !== undefined && sqlStore.isBatchUpdateSupported()) {
|
|
57674
|
+
promises.push(hasMetadata && sqlStore !== undefined
|
|
57675
|
+
? durableStore.setMetadata(putMetadata, segment)
|
|
57676
|
+
: undefined);
|
|
57677
|
+
}
|
|
57678
|
+
return Promise.all(promises).then(() => { });
|
|
57627
57679
|
};
|
|
57628
57680
|
const batchOperations = function (operations) {
|
|
57629
57681
|
const operationsWithDenormedRecords = [];
|
|
@@ -57640,10 +57692,20 @@
|
|
|
57640
57692
|
// this is determined by the plugin supporting update batch calls before it gets to this HOF.
|
|
57641
57693
|
// so we only need to check one entry to confirm this for performance
|
|
57642
57694
|
if (firstEntry.data !== undefined) {
|
|
57695
|
+
const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
|
|
57643
57696
|
operationsWithDenormedRecords.push({
|
|
57644
57697
|
...operation,
|
|
57645
|
-
entries:
|
|
57698
|
+
entries: putEntries,
|
|
57646
57699
|
});
|
|
57700
|
+
if (hasMetadata &&
|
|
57701
|
+
sqlStore !== undefined &&
|
|
57702
|
+
sqlStore.isBatchUpdateSupported() === true) {
|
|
57703
|
+
operationsWithDenormedRecords.push({
|
|
57704
|
+
...operation,
|
|
57705
|
+
entries: putMetadata,
|
|
57706
|
+
type: 'setMetadata',
|
|
57707
|
+
});
|
|
57708
|
+
}
|
|
57647
57709
|
}
|
|
57648
57710
|
else {
|
|
57649
57711
|
operationsWithDenormedRecords.push(operation);
|
|
@@ -57655,10 +57717,20 @@
|
|
|
57655
57717
|
operationsWithDenormedRecords.push(operation);
|
|
57656
57718
|
continue;
|
|
57657
57719
|
}
|
|
57720
|
+
const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
|
|
57658
57721
|
operationsWithDenormedRecords.push({
|
|
57659
57722
|
...operation,
|
|
57660
|
-
entries:
|
|
57723
|
+
entries: putEntries,
|
|
57661
57724
|
});
|
|
57725
|
+
if (hasMetadata &&
|
|
57726
|
+
sqlStore !== undefined &&
|
|
57727
|
+
sqlStore.isBatchUpdateSupported() === true) {
|
|
57728
|
+
operationsWithDenormedRecords.push({
|
|
57729
|
+
...operation,
|
|
57730
|
+
entries: putMetadata,
|
|
57731
|
+
type: 'setMetadata',
|
|
57732
|
+
});
|
|
57733
|
+
}
|
|
57662
57734
|
}
|
|
57663
57735
|
return durableStore.batchOperations(operationsWithDenormedRecords);
|
|
57664
57736
|
};
|
|
@@ -60125,9 +60197,11 @@
|
|
|
60125
60197
|
let apiName = null;
|
|
60126
60198
|
let objectInfo;
|
|
60127
60199
|
if (dataIsRecord(key)) {
|
|
60200
|
+
incomingRecords.delete(key);
|
|
60128
60201
|
apiName = data.apiName;
|
|
60129
60202
|
}
|
|
60130
60203
|
else if (dataIsObjectInfo(key)) {
|
|
60204
|
+
incomingObjectInfos.delete(key);
|
|
60131
60205
|
apiName = data.apiName;
|
|
60132
60206
|
objectInfo = data;
|
|
60133
60207
|
}
|
|
@@ -60638,6 +60712,9 @@
|
|
|
60638
60712
|
isEvalSupported() {
|
|
60639
60713
|
return true;
|
|
60640
60714
|
}
|
|
60715
|
+
isBatchUpdateSupported() {
|
|
60716
|
+
return this.supportsBatchUpdates;
|
|
60717
|
+
}
|
|
60641
60718
|
query(sql, params) {
|
|
60642
60719
|
return new Promise((resolve, reject) => {
|
|
60643
60720
|
this.plugin.query(sql, params, (result) => {
|
|
@@ -61802,7 +61879,6 @@
|
|
|
61802
61879
|
}, {});
|
|
61803
61880
|
fields['Id'] = { value: id, displayValue: null };
|
|
61804
61881
|
fields['RecordTypeId'] = { value: recordTypeId, displayValue: null };
|
|
61805
|
-
const links = this.generateFieldLinks(id, [...requestedFields, 'Id', 'RecordTypeId']);
|
|
61806
61882
|
return {
|
|
61807
61883
|
apiName: node[`${requiredPrefix}ApiName`],
|
|
61808
61884
|
childRelationships: {},
|
|
@@ -61824,18 +61900,9 @@
|
|
|
61824
61900
|
: null,
|
|
61825
61901
|
weakEtag: node[`${requiredPrefix}WeakEtag`],
|
|
61826
61902
|
fields,
|
|
61827
|
-
links,
|
|
61903
|
+
links: {},
|
|
61828
61904
|
};
|
|
61829
61905
|
}
|
|
61830
|
-
generateFieldLinks(id, fields) {
|
|
61831
|
-
const links = {};
|
|
61832
|
-
for (const field of fields) {
|
|
61833
|
-
links[field] = {
|
|
61834
|
-
__ref: `UiApi::RecordRepresentation:${id}__fields__${field}`,
|
|
61835
|
-
};
|
|
61836
|
-
}
|
|
61837
|
-
return links;
|
|
61838
|
-
}
|
|
61839
61906
|
}
|
|
61840
61907
|
|
|
61841
61908
|
class RecordIngestor {
|
|
@@ -62064,6 +62131,20 @@
|
|
|
62064
62131
|
async writeBatch(records, overwrite) {
|
|
62065
62132
|
const idsToPrime = new Set();
|
|
62066
62133
|
const written = [];
|
|
62134
|
+
if (overwrite === true) {
|
|
62135
|
+
// if overwrite is true we need to raise change notifications so use the batchOperations
|
|
62136
|
+
const operations = {};
|
|
62137
|
+
for (const { record, metadata } of records) {
|
|
62138
|
+
const key = keyBuilder$26(this.getLuvio(), { recordId: record.id });
|
|
62139
|
+
idsToPrime.add(record.id);
|
|
62140
|
+
operations[key] = {
|
|
62141
|
+
data: record,
|
|
62142
|
+
metadata: { ...metadata, metadataVersion: DURABLE_METADATA_VERSION },
|
|
62143
|
+
};
|
|
62144
|
+
}
|
|
62145
|
+
await this.store.setEntries(operations, DefaultDurableSegment);
|
|
62146
|
+
return { written: Array.from(idsToPrime), conflicted: [], errors: [] };
|
|
62147
|
+
}
|
|
62067
62148
|
const statement = `${overwrite ? 'REPLACE' : 'INSERT or IGNORE'} INTO lds_data (key, data, metadata) VALUES ${records
|
|
62068
62149
|
.map((_) => `(?,?,?)`)
|
|
62069
62150
|
.join(',')} returning key;`;
|
|
@@ -62179,7 +62260,9 @@
|
|
|
62179
62260
|
return instrumentPrimingSession(session);
|
|
62180
62261
|
}
|
|
62181
62262
|
|
|
62182
|
-
const DEFAULT_MAX_RECORD_COUNT =
|
|
62263
|
+
const DEFAULT_MAX_RECORD_COUNT = aggressiveTrimLowLimitGate.isOpen({ fallback: false })
|
|
62264
|
+
? 20000
|
|
62265
|
+
: 200000;
|
|
62183
62266
|
const DEFAULT_MAX_BATCH_SIZE = 200;
|
|
62184
62267
|
async function aggressiveTrim(data, deallocateFn, options = {}) {
|
|
62185
62268
|
const maxStoreRecords = options.maxStoreRecords !== undefined ? options.maxStoreRecords : DEFAULT_MAX_RECORD_COUNT;
|
|
@@ -62290,9 +62373,11 @@
|
|
|
62290
62373
|
// user id centric record ID generator
|
|
62291
62374
|
const { newRecordId, isGenerated } = recordIdGenerator(userId);
|
|
62292
62375
|
// non-draft-aware base services
|
|
62293
|
-
|
|
62294
|
-
|
|
62295
|
-
|
|
62376
|
+
let storeOptions = {};
|
|
62377
|
+
{
|
|
62378
|
+
storeOptions.customTrimPolicy = aggressiveTrim;
|
|
62379
|
+
}
|
|
62380
|
+
const store = new InMemoryStore(storeOptions);
|
|
62296
62381
|
lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter, {
|
|
62297
62382
|
reportChunkCandidateUrlLength: reportChunkCandidateUrlLength,
|
|
62298
62383
|
}));
|
|
@@ -62319,7 +62404,7 @@
|
|
|
62319
62404
|
let getIngestRecords;
|
|
62320
62405
|
let getIngestMetadata;
|
|
62321
62406
|
let getIngestStore;
|
|
62322
|
-
const recordDenormingStore = makeRecordDenormalizingDurableStore(lazyLuvio, lazyBaseDurableStore, () => (getIngestRecords !== undefined ? getIngestRecords() : {}), () => (getIngestMetadata !== undefined ? getIngestMetadata() : {}), () => (getIngestStore !== undefined ? getIngestStore() : undefined));
|
|
62407
|
+
const recordDenormingStore = makeRecordDenormalizingDurableStore(lazyLuvio, lazyBaseDurableStore, () => (getIngestRecords !== undefined ? getIngestRecords() : {}), () => (getIngestMetadata !== undefined ? getIngestMetadata() : {}), () => (getIngestStore !== undefined ? getIngestStore() : undefined), lazyBaseDurableStore);
|
|
62323
62408
|
const baseEnv = new Environment(store, lazyNetworkAdapter);
|
|
62324
62409
|
const gqlEnv = makeEnvironmentGraphqlAware(baseEnv);
|
|
62325
62410
|
const durableEnv = makeDurable(gqlEnv, {
|
|
@@ -62429,7 +62514,7 @@
|
|
|
62429
62514
|
id: '@salesforce/lds-network-adapter',
|
|
62430
62515
|
instrument: instrument$2,
|
|
62431
62516
|
});
|
|
62432
|
-
// version: 1.287.0-
|
|
62517
|
+
// version: 1.287.0-dev7-60e10f218
|
|
62433
62518
|
|
|
62434
62519
|
const { create: create$3, keys: keys$3 } = Object;
|
|
62435
62520
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -82493,7 +82578,7 @@
|
|
|
82493
82578
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
82494
82579
|
instrument: instrument$1,
|
|
82495
82580
|
});
|
|
82496
|
-
// version: 1.287.0-
|
|
82581
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
82497
82582
|
|
|
82498
82583
|
// On core the unstable adapters are re-exported with different names,
|
|
82499
82584
|
// we want to match them here.
|
|
@@ -84749,7 +84834,7 @@
|
|
|
84749
84834
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
84750
84835
|
graphQLImperative = ldsAdapter;
|
|
84751
84836
|
});
|
|
84752
|
-
// version: 1.287.0-
|
|
84837
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
84753
84838
|
|
|
84754
84839
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
84755
84840
|
__proto__: null,
|
|
@@ -85487,7 +85572,7 @@
|
|
|
85487
85572
|
function register(r) {
|
|
85488
85573
|
callbacks$1.forEach((callback) => callback(r));
|
|
85489
85574
|
}
|
|
85490
|
-
// version: 1.287.0-
|
|
85575
|
+
// version: 1.287.0-dev7-60e10f218
|
|
85491
85576
|
|
|
85492
85577
|
/**
|
|
85493
85578
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -90468,4 +90553,4 @@
|
|
|
90468
90553
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
90469
90554
|
|
|
90470
90555
|
}));
|
|
90471
|
-
// version: 1.287.0-
|
|
90556
|
+
// version: 1.287.0-dev7-60e10f218
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.287.0-
|
|
3
|
+
"version": "1.287.0-dev7",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/standalone/es/lds-worker-api.js",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
|
|
38
|
-
"@salesforce/lds-adapters-graphql": "^1.287.0-
|
|
39
|
-
"@salesforce/lds-adapters-uiapi": "^1.287.0-
|
|
40
|
-
"@salesforce/lds-default-luvio": "^1.287.0-
|
|
41
|
-
"@salesforce/lds-drafts": "^1.287.0-
|
|
42
|
-
"@salesforce/lds-graphql-parser": "^1.287.0-
|
|
43
|
-
"@salesforce/lds-luvio-engine": "^1.287.0-
|
|
44
|
-
"@salesforce/lds-priming": "^1.287.0-
|
|
45
|
-
"@salesforce/lds-runtime-mobile": "^1.287.0-
|
|
46
|
-
"@salesforce/nimbus-plugin-lds": "^1.287.0-
|
|
38
|
+
"@salesforce/lds-adapters-graphql": "^1.287.0-dev7",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.287.0-dev7",
|
|
40
|
+
"@salesforce/lds-default-luvio": "^1.287.0-dev7",
|
|
41
|
+
"@salesforce/lds-drafts": "^1.287.0-dev7",
|
|
42
|
+
"@salesforce/lds-graphql-parser": "^1.287.0-dev7",
|
|
43
|
+
"@salesforce/lds-luvio-engine": "^1.287.0-dev7",
|
|
44
|
+
"@salesforce/lds-priming": "^1.287.0-dev7",
|
|
45
|
+
"@salesforce/lds-runtime-mobile": "^1.287.0-dev7",
|
|
46
|
+
"@salesforce/nimbus-plugin-lds": "^1.287.0-dev7",
|
|
47
47
|
"ajv": "^8.11.0",
|
|
48
48
|
"glob": "^7.1.5",
|
|
49
49
|
"nimbus-types": "^2.0.0-alpha1",
|