@salesforce/lds-worker-api 1.287.0-dev6 → 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
|
|
@@ -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.17-
|
|
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.17-
|
|
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;
|
|
@@ -57485,7 +57512,7 @@ function getDenormalizedKey(originalKey, recordId, luvio) {
|
|
|
57485
57512
|
}
|
|
57486
57513
|
return keyBuilder$26(luvio, { recordId });
|
|
57487
57514
|
}
|
|
57488
|
-
function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore) {
|
|
57515
|
+
function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore, sqlStore) {
|
|
57489
57516
|
const getEntries = function (entries, segment) {
|
|
57490
57517
|
// this HOF only inspects records in the default segment
|
|
57491
57518
|
if (segment !== DefaultDurableSegment) {
|
|
@@ -57547,7 +57574,10 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57547
57574
|
});
|
|
57548
57575
|
};
|
|
57549
57576
|
const denormalizeEntries = function (entries) {
|
|
57577
|
+
let hasEntries = false;
|
|
57578
|
+
let hasMetadata = false;
|
|
57550
57579
|
const putEntries = create$3$1(null);
|
|
57580
|
+
const putMetadata = create$3$1(null);
|
|
57551
57581
|
const keys$1 = keys$3$1(entries);
|
|
57552
57582
|
const putRecords = {};
|
|
57553
57583
|
const putRecordViews = {};
|
|
@@ -57590,6 +57620,7 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57590
57620
|
putRecords[recordId] = true;
|
|
57591
57621
|
}
|
|
57592
57622
|
if (isStoreRecordError(record)) {
|
|
57623
|
+
hasEntries = true;
|
|
57593
57624
|
putEntries[recordKey] = value;
|
|
57594
57625
|
continue;
|
|
57595
57626
|
}
|
|
@@ -57602,24 +57633,43 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57602
57633
|
}
|
|
57603
57634
|
const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
|
|
57604
57635
|
if (denormalizedRecord !== undefined) {
|
|
57636
|
+
hasEntries = true;
|
|
57605
57637
|
putEntries[recordKey] = {
|
|
57606
57638
|
data: denormalizedRecord,
|
|
57607
57639
|
metadata,
|
|
57608
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
|
+
};
|
|
57609
57650
|
}
|
|
57610
57651
|
}
|
|
57611
57652
|
else {
|
|
57653
|
+
hasEntries = true;
|
|
57612
57654
|
putEntries[key] = value;
|
|
57613
57655
|
}
|
|
57614
57656
|
}
|
|
57615
|
-
return putEntries;
|
|
57657
|
+
return { putEntries, putMetadata, hasEntries, hasMetadata };
|
|
57616
57658
|
};
|
|
57617
57659
|
const setEntries = function (entries, segment) {
|
|
57618
57660
|
if (segment !== DefaultDurableSegment) {
|
|
57619
57661
|
return durableStore.setEntries(entries, segment);
|
|
57620
57662
|
}
|
|
57621
|
-
const putEntries = denormalizeEntries(entries);
|
|
57622
|
-
|
|
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(() => { });
|
|
57623
57673
|
};
|
|
57624
57674
|
const batchOperations = function (operations) {
|
|
57625
57675
|
const operationsWithDenormedRecords = [];
|
|
@@ -57636,10 +57686,20 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57636
57686
|
// this is determined by the plugin supporting update batch calls before it gets to this HOF.
|
|
57637
57687
|
// so we only need to check one entry to confirm this for performance
|
|
57638
57688
|
if (firstEntry.data !== undefined) {
|
|
57689
|
+
const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
|
|
57639
57690
|
operationsWithDenormedRecords.push({
|
|
57640
57691
|
...operation,
|
|
57641
|
-
entries:
|
|
57692
|
+
entries: putEntries,
|
|
57642
57693
|
});
|
|
57694
|
+
if (hasMetadata &&
|
|
57695
|
+
sqlStore !== undefined &&
|
|
57696
|
+
sqlStore.isBatchUpdateSupported() === true) {
|
|
57697
|
+
operationsWithDenormedRecords.push({
|
|
57698
|
+
...operation,
|
|
57699
|
+
entries: putMetadata,
|
|
57700
|
+
type: 'setMetadata',
|
|
57701
|
+
});
|
|
57702
|
+
}
|
|
57643
57703
|
}
|
|
57644
57704
|
else {
|
|
57645
57705
|
operationsWithDenormedRecords.push(operation);
|
|
@@ -57651,10 +57711,20 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
|
|
|
57651
57711
|
operationsWithDenormedRecords.push(operation);
|
|
57652
57712
|
continue;
|
|
57653
57713
|
}
|
|
57714
|
+
const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
|
|
57654
57715
|
operationsWithDenormedRecords.push({
|
|
57655
57716
|
...operation,
|
|
57656
|
-
entries:
|
|
57717
|
+
entries: putEntries,
|
|
57657
57718
|
});
|
|
57719
|
+
if (hasMetadata &&
|
|
57720
|
+
sqlStore !== undefined &&
|
|
57721
|
+
sqlStore.isBatchUpdateSupported() === true) {
|
|
57722
|
+
operationsWithDenormedRecords.push({
|
|
57723
|
+
...operation,
|
|
57724
|
+
entries: putMetadata,
|
|
57725
|
+
type: 'setMetadata',
|
|
57726
|
+
});
|
|
57727
|
+
}
|
|
57658
57728
|
}
|
|
57659
57729
|
return durableStore.batchOperations(operationsWithDenormedRecords);
|
|
57660
57730
|
};
|
|
@@ -60636,6 +60706,9 @@ class NimbusSqliteStore {
|
|
|
60636
60706
|
isEvalSupported() {
|
|
60637
60707
|
return true;
|
|
60638
60708
|
}
|
|
60709
|
+
isBatchUpdateSupported() {
|
|
60710
|
+
return this.supportsBatchUpdates;
|
|
60711
|
+
}
|
|
60639
60712
|
query(sql, params) {
|
|
60640
60713
|
return new Promise((resolve, reject) => {
|
|
60641
60714
|
this.plugin.query(sql, params, (result) => {
|
|
@@ -62052,6 +62125,20 @@ class SqlitePrimingStore {
|
|
|
62052
62125
|
async writeBatch(records, overwrite) {
|
|
62053
62126
|
const idsToPrime = new Set();
|
|
62054
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
|
+
}
|
|
62055
62142
|
const statement = `${overwrite ? 'REPLACE' : 'INSERT or IGNORE'} INTO lds_data (key, data, metadata) VALUES ${records
|
|
62056
62143
|
.map((_) => `(?,?,?)`)
|
|
62057
62144
|
.join(',')} returning key;`;
|
|
@@ -62167,7 +62254,9 @@ function primingSessionFactory(config) {
|
|
|
62167
62254
|
return instrumentPrimingSession(session);
|
|
62168
62255
|
}
|
|
62169
62256
|
|
|
62170
|
-
const DEFAULT_MAX_RECORD_COUNT =
|
|
62257
|
+
const DEFAULT_MAX_RECORD_COUNT = aggressiveTrimLowLimitGate.isOpen({ fallback: false })
|
|
62258
|
+
? 20000
|
|
62259
|
+
: 200000;
|
|
62171
62260
|
const DEFAULT_MAX_BATCH_SIZE = 200;
|
|
62172
62261
|
async function aggressiveTrim(data, deallocateFn, options = {}) {
|
|
62173
62262
|
const maxStoreRecords = options.maxStoreRecords !== undefined ? options.maxStoreRecords : DEFAULT_MAX_RECORD_COUNT;
|
|
@@ -62278,9 +62367,11 @@ function getRuntime() {
|
|
|
62278
62367
|
// user id centric record ID generator
|
|
62279
62368
|
const { newRecordId, isGenerated } = recordIdGenerator(userId);
|
|
62280
62369
|
// non-draft-aware base services
|
|
62281
|
-
|
|
62282
|
-
|
|
62283
|
-
|
|
62370
|
+
let storeOptions = {};
|
|
62371
|
+
{
|
|
62372
|
+
storeOptions.customTrimPolicy = aggressiveTrim;
|
|
62373
|
+
}
|
|
62374
|
+
const store = new InMemoryStore(storeOptions);
|
|
62284
62375
|
lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter, {
|
|
62285
62376
|
reportChunkCandidateUrlLength: reportChunkCandidateUrlLength,
|
|
62286
62377
|
}));
|
|
@@ -62307,7 +62398,7 @@ function getRuntime() {
|
|
|
62307
62398
|
let getIngestRecords;
|
|
62308
62399
|
let getIngestMetadata;
|
|
62309
62400
|
let getIngestStore;
|
|
62310
|
-
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);
|
|
62311
62402
|
const baseEnv = new Environment(store, lazyNetworkAdapter);
|
|
62312
62403
|
const gqlEnv = makeEnvironmentGraphqlAware(baseEnv);
|
|
62313
62404
|
const durableEnv = makeDurable(gqlEnv, {
|
|
@@ -62417,7 +62508,7 @@ register$1({
|
|
|
62417
62508
|
id: '@salesforce/lds-network-adapter',
|
|
62418
62509
|
instrument: instrument$2,
|
|
62419
62510
|
});
|
|
62420
|
-
// version: 1.287.0-
|
|
62511
|
+
// version: 1.287.0-dev7-60e10f218
|
|
62421
62512
|
|
|
62422
62513
|
const { create: create$3, keys: keys$3 } = Object;
|
|
62423
62514
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -82481,7 +82572,7 @@ register$1({
|
|
|
82481
82572
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
82482
82573
|
instrument: instrument$1,
|
|
82483
82574
|
});
|
|
82484
|
-
// version: 1.287.0-
|
|
82575
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
82485
82576
|
|
|
82486
82577
|
// On core the unstable adapters are re-exported with different names,
|
|
82487
82578
|
// we want to match them here.
|
|
@@ -84737,7 +84828,7 @@ withDefaultLuvio((luvio) => {
|
|
|
84737
84828
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
84738
84829
|
graphQLImperative = ldsAdapter;
|
|
84739
84830
|
});
|
|
84740
|
-
// version: 1.287.0-
|
|
84831
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
84741
84832
|
|
|
84742
84833
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
84743
84834
|
__proto__: null,
|
|
@@ -85475,7 +85566,7 @@ const callbacks$1 = [];
|
|
|
85475
85566
|
function register(r) {
|
|
85476
85567
|
callbacks$1.forEach((callback) => callback(r));
|
|
85477
85568
|
}
|
|
85478
|
-
// version: 1.287.0-
|
|
85569
|
+
// version: 1.287.0-dev7-60e10f218
|
|
85479
85570
|
|
|
85480
85571
|
/**
|
|
85481
85572
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -90437,4 +90528,4 @@ const { luvio } = getRuntime();
|
|
|
90437
90528
|
setDefaultLuvio({ luvio });
|
|
90438
90529
|
|
|
90439
90530
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
90440
|
-
// 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
|
|
@@ -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.17-
|
|
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.17-
|
|
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;
|
|
@@ -57491,7 +57518,7 @@
|
|
|
57491
57518
|
}
|
|
57492
57519
|
return keyBuilder$26(luvio, { recordId });
|
|
57493
57520
|
}
|
|
57494
|
-
function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore) {
|
|
57521
|
+
function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore, sqlStore) {
|
|
57495
57522
|
const getEntries = function (entries, segment) {
|
|
57496
57523
|
// this HOF only inspects records in the default segment
|
|
57497
57524
|
if (segment !== DefaultDurableSegment) {
|
|
@@ -57553,7 +57580,10 @@
|
|
|
57553
57580
|
});
|
|
57554
57581
|
};
|
|
57555
57582
|
const denormalizeEntries = function (entries) {
|
|
57583
|
+
let hasEntries = false;
|
|
57584
|
+
let hasMetadata = false;
|
|
57556
57585
|
const putEntries = create$3$1(null);
|
|
57586
|
+
const putMetadata = create$3$1(null);
|
|
57557
57587
|
const keys$1 = keys$3$1(entries);
|
|
57558
57588
|
const putRecords = {};
|
|
57559
57589
|
const putRecordViews = {};
|
|
@@ -57596,6 +57626,7 @@
|
|
|
57596
57626
|
putRecords[recordId] = true;
|
|
57597
57627
|
}
|
|
57598
57628
|
if (isStoreRecordError(record)) {
|
|
57629
|
+
hasEntries = true;
|
|
57599
57630
|
putEntries[recordKey] = value;
|
|
57600
57631
|
continue;
|
|
57601
57632
|
}
|
|
@@ -57608,24 +57639,43 @@
|
|
|
57608
57639
|
}
|
|
57609
57640
|
const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
|
|
57610
57641
|
if (denormalizedRecord !== undefined) {
|
|
57642
|
+
hasEntries = true;
|
|
57611
57643
|
putEntries[recordKey] = {
|
|
57612
57644
|
data: denormalizedRecord,
|
|
57613
57645
|
metadata,
|
|
57614
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
|
+
};
|
|
57615
57656
|
}
|
|
57616
57657
|
}
|
|
57617
57658
|
else {
|
|
57659
|
+
hasEntries = true;
|
|
57618
57660
|
putEntries[key] = value;
|
|
57619
57661
|
}
|
|
57620
57662
|
}
|
|
57621
|
-
return putEntries;
|
|
57663
|
+
return { putEntries, putMetadata, hasEntries, hasMetadata };
|
|
57622
57664
|
};
|
|
57623
57665
|
const setEntries = function (entries, segment) {
|
|
57624
57666
|
if (segment !== DefaultDurableSegment) {
|
|
57625
57667
|
return durableStore.setEntries(entries, segment);
|
|
57626
57668
|
}
|
|
57627
|
-
const putEntries = denormalizeEntries(entries);
|
|
57628
|
-
|
|
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(() => { });
|
|
57629
57679
|
};
|
|
57630
57680
|
const batchOperations = function (operations) {
|
|
57631
57681
|
const operationsWithDenormedRecords = [];
|
|
@@ -57642,10 +57692,20 @@
|
|
|
57642
57692
|
// this is determined by the plugin supporting update batch calls before it gets to this HOF.
|
|
57643
57693
|
// so we only need to check one entry to confirm this for performance
|
|
57644
57694
|
if (firstEntry.data !== undefined) {
|
|
57695
|
+
const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
|
|
57645
57696
|
operationsWithDenormedRecords.push({
|
|
57646
57697
|
...operation,
|
|
57647
|
-
entries:
|
|
57698
|
+
entries: putEntries,
|
|
57648
57699
|
});
|
|
57700
|
+
if (hasMetadata &&
|
|
57701
|
+
sqlStore !== undefined &&
|
|
57702
|
+
sqlStore.isBatchUpdateSupported() === true) {
|
|
57703
|
+
operationsWithDenormedRecords.push({
|
|
57704
|
+
...operation,
|
|
57705
|
+
entries: putMetadata,
|
|
57706
|
+
type: 'setMetadata',
|
|
57707
|
+
});
|
|
57708
|
+
}
|
|
57649
57709
|
}
|
|
57650
57710
|
else {
|
|
57651
57711
|
operationsWithDenormedRecords.push(operation);
|
|
@@ -57657,10 +57717,20 @@
|
|
|
57657
57717
|
operationsWithDenormedRecords.push(operation);
|
|
57658
57718
|
continue;
|
|
57659
57719
|
}
|
|
57720
|
+
const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
|
|
57660
57721
|
operationsWithDenormedRecords.push({
|
|
57661
57722
|
...operation,
|
|
57662
|
-
entries:
|
|
57723
|
+
entries: putEntries,
|
|
57663
57724
|
});
|
|
57725
|
+
if (hasMetadata &&
|
|
57726
|
+
sqlStore !== undefined &&
|
|
57727
|
+
sqlStore.isBatchUpdateSupported() === true) {
|
|
57728
|
+
operationsWithDenormedRecords.push({
|
|
57729
|
+
...operation,
|
|
57730
|
+
entries: putMetadata,
|
|
57731
|
+
type: 'setMetadata',
|
|
57732
|
+
});
|
|
57733
|
+
}
|
|
57664
57734
|
}
|
|
57665
57735
|
return durableStore.batchOperations(operationsWithDenormedRecords);
|
|
57666
57736
|
};
|
|
@@ -60642,6 +60712,9 @@
|
|
|
60642
60712
|
isEvalSupported() {
|
|
60643
60713
|
return true;
|
|
60644
60714
|
}
|
|
60715
|
+
isBatchUpdateSupported() {
|
|
60716
|
+
return this.supportsBatchUpdates;
|
|
60717
|
+
}
|
|
60645
60718
|
query(sql, params) {
|
|
60646
60719
|
return new Promise((resolve, reject) => {
|
|
60647
60720
|
this.plugin.query(sql, params, (result) => {
|
|
@@ -62058,6 +62131,20 @@
|
|
|
62058
62131
|
async writeBatch(records, overwrite) {
|
|
62059
62132
|
const idsToPrime = new Set();
|
|
62060
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
|
+
}
|
|
62061
62148
|
const statement = `${overwrite ? 'REPLACE' : 'INSERT or IGNORE'} INTO lds_data (key, data, metadata) VALUES ${records
|
|
62062
62149
|
.map((_) => `(?,?,?)`)
|
|
62063
62150
|
.join(',')} returning key;`;
|
|
@@ -62173,7 +62260,9 @@
|
|
|
62173
62260
|
return instrumentPrimingSession(session);
|
|
62174
62261
|
}
|
|
62175
62262
|
|
|
62176
|
-
const DEFAULT_MAX_RECORD_COUNT =
|
|
62263
|
+
const DEFAULT_MAX_RECORD_COUNT = aggressiveTrimLowLimitGate.isOpen({ fallback: false })
|
|
62264
|
+
? 20000
|
|
62265
|
+
: 200000;
|
|
62177
62266
|
const DEFAULT_MAX_BATCH_SIZE = 200;
|
|
62178
62267
|
async function aggressiveTrim(data, deallocateFn, options = {}) {
|
|
62179
62268
|
const maxStoreRecords = options.maxStoreRecords !== undefined ? options.maxStoreRecords : DEFAULT_MAX_RECORD_COUNT;
|
|
@@ -62284,9 +62373,11 @@
|
|
|
62284
62373
|
// user id centric record ID generator
|
|
62285
62374
|
const { newRecordId, isGenerated } = recordIdGenerator(userId);
|
|
62286
62375
|
// non-draft-aware base services
|
|
62287
|
-
|
|
62288
|
-
|
|
62289
|
-
|
|
62376
|
+
let storeOptions = {};
|
|
62377
|
+
{
|
|
62378
|
+
storeOptions.customTrimPolicy = aggressiveTrim;
|
|
62379
|
+
}
|
|
62380
|
+
const store = new InMemoryStore(storeOptions);
|
|
62290
62381
|
lazyNetworkAdapter = platformNetworkAdapter(makeNetworkAdapterChunkRecordFields(NimbusNetworkAdapter, {
|
|
62291
62382
|
reportChunkCandidateUrlLength: reportChunkCandidateUrlLength,
|
|
62292
62383
|
}));
|
|
@@ -62313,7 +62404,7 @@
|
|
|
62313
62404
|
let getIngestRecords;
|
|
62314
62405
|
let getIngestMetadata;
|
|
62315
62406
|
let getIngestStore;
|
|
62316
|
-
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);
|
|
62317
62408
|
const baseEnv = new Environment(store, lazyNetworkAdapter);
|
|
62318
62409
|
const gqlEnv = makeEnvironmentGraphqlAware(baseEnv);
|
|
62319
62410
|
const durableEnv = makeDurable(gqlEnv, {
|
|
@@ -62423,7 +62514,7 @@
|
|
|
62423
62514
|
id: '@salesforce/lds-network-adapter',
|
|
62424
62515
|
instrument: instrument$2,
|
|
62425
62516
|
});
|
|
62426
|
-
// version: 1.287.0-
|
|
62517
|
+
// version: 1.287.0-dev7-60e10f218
|
|
62427
62518
|
|
|
62428
62519
|
const { create: create$3, keys: keys$3 } = Object;
|
|
62429
62520
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -82487,7 +82578,7 @@
|
|
|
82487
82578
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
82488
82579
|
instrument: instrument$1,
|
|
82489
82580
|
});
|
|
82490
|
-
// version: 1.287.0-
|
|
82581
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
82491
82582
|
|
|
82492
82583
|
// On core the unstable adapters are re-exported with different names,
|
|
82493
82584
|
// we want to match them here.
|
|
@@ -84743,7 +84834,7 @@
|
|
|
84743
84834
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
84744
84835
|
graphQLImperative = ldsAdapter;
|
|
84745
84836
|
});
|
|
84746
|
-
// version: 1.287.0-
|
|
84837
|
+
// version: 1.287.0-dev7-62bbd479a
|
|
84747
84838
|
|
|
84748
84839
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
84749
84840
|
__proto__: null,
|
|
@@ -85481,7 +85572,7 @@
|
|
|
85481
85572
|
function register(r) {
|
|
85482
85573
|
callbacks$1.forEach((callback) => callback(r));
|
|
85483
85574
|
}
|
|
85484
|
-
// version: 1.287.0-
|
|
85575
|
+
// version: 1.287.0-dev7-60e10f218
|
|
85485
85576
|
|
|
85486
85577
|
/**
|
|
85487
85578
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -90462,4 +90553,4 @@
|
|
|
90462
90553
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
90463
90554
|
|
|
90464
90555
|
}));
|
|
90465
|
-
// 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",
|