@salesforce/lds-worker-api 1.415.0 → 1.416.1
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.
|
@@ -1371,4 +1371,4 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
|
|
1373
1373
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
1374
|
-
// version: 1.
|
|
1374
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
@@ -4146,7 +4146,7 @@ function createResourceParamsImpl(config, configMetadata) {
|
|
|
4146
4146
|
}
|
|
4147
4147
|
return resourceParams;
|
|
4148
4148
|
}
|
|
4149
|
-
// engine version: 0.
|
|
4149
|
+
// engine version: 0.159.0-6e2a1824
|
|
4150
4150
|
|
|
4151
4151
|
/**
|
|
4152
4152
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4274,7 +4274,7 @@ function withDefaultLuvio(callback) {
|
|
|
4274
4274
|
}
|
|
4275
4275
|
callbacks.push(callback);
|
|
4276
4276
|
}
|
|
4277
|
-
// version: 1.
|
|
4277
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
4278
4278
|
|
|
4279
4279
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4280
4280
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5318,7 +5318,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
5318
5318
|
const { apiFamily, name } = metadata;
|
|
5319
5319
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5320
5320
|
}
|
|
5321
|
-
// version: 1.
|
|
5321
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
5322
5322
|
|
|
5323
5323
|
/**
|
|
5324
5324
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -5417,7 +5417,7 @@ var TypeCheckShapes;
|
|
|
5417
5417
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
5418
5418
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
5419
5419
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
5420
|
-
// engine version: 0.
|
|
5420
|
+
// engine version: 0.159.0-6e2a1824
|
|
5421
5421
|
|
|
5422
5422
|
const { keys: ObjectKeys$4, create: ObjectCreate$5 } = Object;
|
|
5423
5423
|
|
|
@@ -23480,7 +23480,7 @@ function equals$y(existing, incoming) {
|
|
|
23480
23480
|
}
|
|
23481
23481
|
|
|
23482
23482
|
const TTL$k$1 = 900000;
|
|
23483
|
-
const VERSION$D$2 = "
|
|
23483
|
+
const VERSION$D$2 = "a88bc29a18dfa64f33730b5bbe6aeb24";
|
|
23484
23484
|
const RepresentationType$u = 'ListObjectInfoRepresentation';
|
|
23485
23485
|
function keyBuilder$15$2(luvio, config) {
|
|
23486
23486
|
return keyPrefix$3 + '::' + RepresentationType$u + ':' + config.objectApiName;
|
|
@@ -23522,6 +23522,10 @@ const select$Z$2 = function ListObjectInfoRepresentationSelect() {
|
|
|
23522
23522
|
name: 'objectApiName',
|
|
23523
23523
|
kind: 'Scalar'
|
|
23524
23524
|
},
|
|
23525
|
+
{
|
|
23526
|
+
name: 'publicCreateable',
|
|
23527
|
+
kind: 'Scalar'
|
|
23528
|
+
},
|
|
23525
23529
|
{
|
|
23526
23530
|
name: 'publicOrSharedCreateable',
|
|
23527
23531
|
kind: 'Scalar'
|
|
@@ -23529,6 +23533,10 @@ const select$Z$2 = function ListObjectInfoRepresentationSelect() {
|
|
|
23529
23533
|
{
|
|
23530
23534
|
name: 'relatedEntityApiName',
|
|
23531
23535
|
kind: 'Scalar'
|
|
23536
|
+
},
|
|
23537
|
+
{
|
|
23538
|
+
name: 'sharedCreateable',
|
|
23539
|
+
kind: 'Scalar'
|
|
23532
23540
|
}
|
|
23533
23541
|
]
|
|
23534
23542
|
};
|
|
@@ -23539,11 +23547,21 @@ function equals$x(existing, incoming) {
|
|
|
23539
23547
|
if (!(existing_createable === incoming_createable)) {
|
|
23540
23548
|
return false;
|
|
23541
23549
|
}
|
|
23550
|
+
const existing_publicCreateable = existing.publicCreateable;
|
|
23551
|
+
const incoming_publicCreateable = incoming.publicCreateable;
|
|
23552
|
+
if (!(existing_publicCreateable === incoming_publicCreateable)) {
|
|
23553
|
+
return false;
|
|
23554
|
+
}
|
|
23542
23555
|
const existing_publicOrSharedCreateable = existing.publicOrSharedCreateable;
|
|
23543
23556
|
const incoming_publicOrSharedCreateable = incoming.publicOrSharedCreateable;
|
|
23544
23557
|
if (!(existing_publicOrSharedCreateable === incoming_publicOrSharedCreateable)) {
|
|
23545
23558
|
return false;
|
|
23546
23559
|
}
|
|
23560
|
+
const existing_sharedCreateable = existing.sharedCreateable;
|
|
23561
|
+
const incoming_sharedCreateable = incoming.sharedCreateable;
|
|
23562
|
+
if (!(existing_sharedCreateable === incoming_sharedCreateable)) {
|
|
23563
|
+
return false;
|
|
23564
|
+
}
|
|
23547
23565
|
const existing_objectApiName = existing.objectApiName;
|
|
23548
23566
|
const incoming_objectApiName = incoming.objectApiName;
|
|
23549
23567
|
if (!(existing_objectApiName === incoming_objectApiName)) {
|
|
@@ -35473,7 +35491,7 @@ withDefaultLuvio((luvio) => {
|
|
|
35473
35491
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
35474
35492
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
35475
35493
|
});
|
|
35476
|
-
// version: 1.
|
|
35494
|
+
// version: 1.416.1-c10be671f4
|
|
35477
35495
|
|
|
35478
35496
|
var allowUpdatesForNonCachedRecords = {
|
|
35479
35497
|
isOpen: function (e) {
|
|
@@ -48412,6 +48430,15 @@ var productConsumedSideEffects = {
|
|
|
48412
48430
|
},
|
|
48413
48431
|
};
|
|
48414
48432
|
|
|
48433
|
+
var reviveOnlyRequestedFields = {
|
|
48434
|
+
isOpen: function (e) {
|
|
48435
|
+
return e.fallback;
|
|
48436
|
+
},
|
|
48437
|
+
hasError: function () {
|
|
48438
|
+
return !0;
|
|
48439
|
+
},
|
|
48440
|
+
};
|
|
48441
|
+
|
|
48415
48442
|
/**
|
|
48416
48443
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
48417
48444
|
* All rights reserved.
|
|
@@ -48991,7 +49018,7 @@ function publishDurableStoreEntries(durableRecords, put, publishMetadata) {
|
|
|
48991
49018
|
* will refresh the snapshot from network, and then run the results from network
|
|
48992
49019
|
* through L2 ingestion, returning the subsequent revived snapshot.
|
|
48993
49020
|
*/
|
|
48994
|
-
function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, revivingStore, reviveMetrics = { l2Trips: [] }) {
|
|
49021
|
+
function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, revivingStore, reviveMetrics = { l2Trips: [] }, shouldFilterFields) {
|
|
48995
49022
|
const { recordId, select, missingLinks, seenRecords, state } = unavailableSnapshot;
|
|
48996
49023
|
// L2 can only revive Unfulfilled snapshots that have a selector since they have the
|
|
48997
49024
|
// info needed to revive (like missingLinks) and rebuild. Otherwise return L1 snapshot.
|
|
@@ -49018,19 +49045,55 @@ function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, dura
|
|
|
49018
49045
|
}
|
|
49019
49046
|
keysToReviveSet.merge(missingLinks);
|
|
49020
49047
|
const keysToRevive = keysToReviveSet.keysAsArray();
|
|
49021
|
-
const canonicalKeys = keysToRevive.map((x) => serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(x)));
|
|
49022
49048
|
const start = Date.now();
|
|
49023
49049
|
const { l2Trips } = reviveMetrics;
|
|
49024
|
-
|
|
49050
|
+
// Extract requested fields first to determine if filtering is possible
|
|
49051
|
+
let requestedFields;
|
|
49052
|
+
if (select.node.kind === 'Fragment' && 'selections' in select.node && select.node.selections) {
|
|
49053
|
+
requestedFields = extractRequestedFieldNames(select.node.selections);
|
|
49054
|
+
}
|
|
49055
|
+
const canonicalKeys = [];
|
|
49056
|
+
const filteredCanonicalKeys = [];
|
|
49057
|
+
for (let i = 0, len = keysToRevive.length; i < len; i += 1) {
|
|
49058
|
+
const canonicalKey = serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(keysToRevive[i]));
|
|
49059
|
+
// Only filter if we have fields to filter and shouldFilterFields returns true
|
|
49060
|
+
if (requestedFields !== undefined &&
|
|
49061
|
+
requestedFields.size > 0 &&
|
|
49062
|
+
shouldFilterFields(canonicalKey)) {
|
|
49063
|
+
filteredCanonicalKeys.push(canonicalKey);
|
|
49064
|
+
}
|
|
49065
|
+
else {
|
|
49066
|
+
canonicalKeys.push(canonicalKey);
|
|
49067
|
+
}
|
|
49068
|
+
}
|
|
49069
|
+
const fetchPromises = [
|
|
49070
|
+
durableStore.getEntries(canonicalKeys, DefaultDurableSegment),
|
|
49071
|
+
];
|
|
49072
|
+
if (requestedFields !== undefined &&
|
|
49073
|
+
requestedFields.size > 0 &&
|
|
49074
|
+
filteredCanonicalKeys.length > 0) {
|
|
49075
|
+
fetchPromises.push(durableStore.getEntriesWithSpecificFields(filteredCanonicalKeys, requestedFields, DefaultDurableSegment));
|
|
49076
|
+
}
|
|
49077
|
+
return Promise.all(fetchPromises).then(([durableRecords, filteredDurableRecords]) => {
|
|
49025
49078
|
l2Trips.push({
|
|
49026
49079
|
duration: Date.now() - start,
|
|
49027
|
-
keysRequestedCount: canonicalKeys.length,
|
|
49080
|
+
keysRequestedCount: canonicalKeys.length + filteredCanonicalKeys.length,
|
|
49028
49081
|
});
|
|
49029
|
-
|
|
49030
|
-
|
|
49031
|
-
|
|
49032
|
-
//
|
|
49033
|
-
|
|
49082
|
+
// Process both normal and filtered records in a single pass
|
|
49083
|
+
const revivedKeys = new StoreKeySet();
|
|
49084
|
+
let hadUnexpectedShape = false;
|
|
49085
|
+
// Process normal records
|
|
49086
|
+
if (durableRecords !== undefined) {
|
|
49087
|
+
const normalResult = publishDurableStoreEntries(durableRecords, baseEnvironment.storePut.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49088
|
+
revivedKeys.merge(normalResult.revivedKeys);
|
|
49089
|
+
hadUnexpectedShape = hadUnexpectedShape || normalResult.hadUnexpectedShape;
|
|
49090
|
+
}
|
|
49091
|
+
// Process filtered records with merging
|
|
49092
|
+
if (filteredDurableRecords !== undefined) {
|
|
49093
|
+
const filteredResult = publishDurableStoreEntries(filteredDurableRecords, createMergeFilteredPut((key) => baseEnvironment.store.readEntry(key), baseEnvironment.storePut.bind(baseEnvironment)), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49094
|
+
revivedKeys.merge(filteredResult.revivedKeys);
|
|
49095
|
+
hadUnexpectedShape = hadUnexpectedShape || filteredResult.hadUnexpectedShape;
|
|
49096
|
+
}
|
|
49034
49097
|
// if the data coming back from DS had an unexpected shape then just
|
|
49035
49098
|
// return the L1 snapshot
|
|
49036
49099
|
if (hadUnexpectedShape === true) {
|
|
@@ -49065,7 +49128,7 @@ function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, dura
|
|
|
49065
49128
|
for (let i = 0, len = newKeys.length; i < len; i++) {
|
|
49066
49129
|
const newSnapshotSeenKey = newKeys[i];
|
|
49067
49130
|
if (!alreadyRequestedOrRevivedSet.has(newSnapshotSeenKey)) {
|
|
49068
|
-
return reviveSnapshot(baseEnvironment, durableStore, snapshot, durableStoreErrorHandler, buildL1Snapshot, revivingStore, reviveMetrics);
|
|
49131
|
+
return reviveSnapshot(baseEnvironment, durableStore, snapshot, durableStoreErrorHandler, buildL1Snapshot, revivingStore, reviveMetrics, shouldFilterFields);
|
|
49069
49132
|
}
|
|
49070
49133
|
}
|
|
49071
49134
|
}
|
|
@@ -49076,6 +49139,59 @@ function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, dura
|
|
|
49076
49139
|
return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
|
|
49077
49140
|
});
|
|
49078
49141
|
}
|
|
49142
|
+
/**
|
|
49143
|
+
* Creates a put function that merges filtered fields with existing L1 records instead of replacing them.
|
|
49144
|
+
* This is used when reviving filtered fields from L2 to preserve existing data in L1.
|
|
49145
|
+
*/
|
|
49146
|
+
function createMergeFilteredPut(readEntry, storePut) {
|
|
49147
|
+
return (key, filteredData) => {
|
|
49148
|
+
const existingRecord = readEntry(key);
|
|
49149
|
+
if (existingRecord !== undefined &&
|
|
49150
|
+
existingRecord !== null &&
|
|
49151
|
+
typeof filteredData === 'object' &&
|
|
49152
|
+
filteredData !== null &&
|
|
49153
|
+
typeof existingRecord === 'object') {
|
|
49154
|
+
const filteredFields = filteredData;
|
|
49155
|
+
const existingObj = existingRecord;
|
|
49156
|
+
// Check if object is frozen (can happen after deepFreeze)
|
|
49157
|
+
// If frozen, create a shallow copy to merge fields into
|
|
49158
|
+
let targetObj = existingObj;
|
|
49159
|
+
if (Object.isFrozen(existingObj)) {
|
|
49160
|
+
targetObj = { ...existingObj };
|
|
49161
|
+
}
|
|
49162
|
+
const keys = Object.keys(filteredFields);
|
|
49163
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
49164
|
+
const fieldKey = keys[i];
|
|
49165
|
+
targetObj[fieldKey] = filteredFields[fieldKey];
|
|
49166
|
+
}
|
|
49167
|
+
storePut(key, targetObj);
|
|
49168
|
+
}
|
|
49169
|
+
else {
|
|
49170
|
+
// No existing record, just put the filtered data
|
|
49171
|
+
storePut(key, filteredData);
|
|
49172
|
+
}
|
|
49173
|
+
};
|
|
49174
|
+
}
|
|
49175
|
+
/**
|
|
49176
|
+
* Extracts the requested field names from the selections of a 'fields' ObjectSelection.
|
|
49177
|
+
* Returns undefined if no 'fields' selection is found or if it doesn't have selections.
|
|
49178
|
+
*/
|
|
49179
|
+
function extractRequestedFieldNames(selections) {
|
|
49180
|
+
if (!selections) {
|
|
49181
|
+
return undefined;
|
|
49182
|
+
}
|
|
49183
|
+
// Find the 'fields' ObjectSelection
|
|
49184
|
+
const fieldsSelection = selections.find((sel) => sel.kind === 'Object' && sel.name === 'fields');
|
|
49185
|
+
if (!fieldsSelection || !fieldsSelection.selections) {
|
|
49186
|
+
return undefined;
|
|
49187
|
+
}
|
|
49188
|
+
// Extract all field names from the fields selections
|
|
49189
|
+
const fieldNames = new Set();
|
|
49190
|
+
for (const fieldSel of fieldsSelection.selections) {
|
|
49191
|
+
fieldNames.add(fieldSel.name);
|
|
49192
|
+
}
|
|
49193
|
+
return fieldNames.size > 0 ? fieldNames : undefined;
|
|
49194
|
+
}
|
|
49079
49195
|
|
|
49080
49196
|
const TTL_DURABLE_SEGMENT = 'TTL_DURABLE_SEGMENT';
|
|
49081
49197
|
const TTL_DEFAULT_KEY = 'TTL_DEFAULT_KEY';
|
|
@@ -49392,7 +49508,7 @@ function isUnfulfilledSnapshot$3(cachedSnapshotResult) {
|
|
|
49392
49508
|
* @param durableStore A DurableStore implementation
|
|
49393
49509
|
* @param instrumentation An instrumentation function implementation
|
|
49394
49510
|
*/
|
|
49395
|
-
function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, shouldFlush, enableDurableMetadataRefresh = false, disableDeepFreeze = false, }) {
|
|
49511
|
+
function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, shouldFlush, enableDurableMetadataRefresh = false, disableDeepFreeze = false, shouldFilterFieldsOnRevive, }) {
|
|
49396
49512
|
// runtimes can choose to disable deepFreeze, e.g. headless mobile runtime
|
|
49397
49513
|
setBypassDeepFreeze(disableDeepFreeze);
|
|
49398
49514
|
let stagingStore = null;
|
|
@@ -49934,7 +50050,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
|
|
|
49934
50050
|
const result = buildL1Snapshot();
|
|
49935
50051
|
stagingStore = tempStore;
|
|
49936
50052
|
return result;
|
|
49937
|
-
}, revivingStore).finally(() => {
|
|
50053
|
+
}, revivingStore, { l2Trips: [] }, shouldFilterFieldsOnRevive !== null && shouldFilterFieldsOnRevive !== void 0 ? shouldFilterFieldsOnRevive : (() => false)).finally(() => {
|
|
49938
50054
|
});
|
|
49939
50055
|
};
|
|
49940
50056
|
const expirePossibleStaleRecords = async function (keys$1, config, refresh) {
|
|
@@ -92454,6 +92570,27 @@ class LdsDataTable {
|
|
|
92454
92570
|
}, reject);
|
|
92455
92571
|
});
|
|
92456
92572
|
}
|
|
92573
|
+
getByKeysWithSpecificFields(keys, fields, _segment) {
|
|
92574
|
+
// SQLite json_object has a max argument limit (~127 pairs = 254 args)
|
|
92575
|
+
// If too many fields requested, return undefined to indicate filtering not possible
|
|
92576
|
+
if (fields.size > 100) {
|
|
92577
|
+
return Promise.resolve(undefined);
|
|
92578
|
+
}
|
|
92579
|
+
return new Promise((resolve, reject) => {
|
|
92580
|
+
// Build JSON object with only the specified fields from the nested 'fields' property
|
|
92581
|
+
const jsonFields = Array.from(fields)
|
|
92582
|
+
.map((field) => `'${field}', json_extract(${COLUMN_NAME_DATA$2}, '$.fields.${field}')`)
|
|
92583
|
+
.join(', ');
|
|
92584
|
+
const filteredFieldsExpr = `json_object(${jsonFields})`;
|
|
92585
|
+
// Use json_set to replace the 'fields' property in the data with the filtered version
|
|
92586
|
+
const filteredDataExpr = `json_set(${COLUMN_NAME_DATA$2}, '$.fields', ${filteredFieldsExpr})`;
|
|
92587
|
+
const paramList = keys.map(() => '?').join(',');
|
|
92588
|
+
const getQuery = `SELECT ${COLUMN_NAME_KEY$2}, ${filteredDataExpr} as ${COLUMN_NAME_DATA$2}, ${COLUMN_NAME_METADATA$1} FROM ${this.tableName} WHERE ${COLUMN_NAME_KEY$2} IN (${paramList})`;
|
|
92589
|
+
this.plugin.query(getQuery, keys, (x) => {
|
|
92590
|
+
resolve(this.mapToDurableEntries(x));
|
|
92591
|
+
}, reject);
|
|
92592
|
+
});
|
|
92593
|
+
}
|
|
92457
92594
|
getMetadataByKeys(keys) {
|
|
92458
92595
|
const query = selectColumnsFromTableWhereKeyIn([COLUMN_NAME_KEY$2, COLUMN_NAME_METADATA$1], this.tableName, COLUMN_NAME_KEY$2, keys);
|
|
92459
92596
|
return new Promise((resolve, reject) => {
|
|
@@ -92560,6 +92697,30 @@ class LdsInternalDataTable {
|
|
|
92560
92697
|
}, reject);
|
|
92561
92698
|
});
|
|
92562
92699
|
}
|
|
92700
|
+
getByKeysWithSpecificFields(keys, fields, namespace) {
|
|
92701
|
+
if (namespace === undefined) {
|
|
92702
|
+
throw Error('LdsInternalDataTable requires namespace');
|
|
92703
|
+
}
|
|
92704
|
+
// SQLite json_object has a max argument limit (~127 pairs = 254 args)
|
|
92705
|
+
// If too many fields requested, return undefined to indicate filtering not possible
|
|
92706
|
+
if (fields.size > 100) {
|
|
92707
|
+
return Promise.resolve(undefined);
|
|
92708
|
+
}
|
|
92709
|
+
return new Promise((resolve, reject) => {
|
|
92710
|
+
// Build JSON object with only the specified fields from the nested 'fields' property
|
|
92711
|
+
const jsonFields = Array.from(fields)
|
|
92712
|
+
.map((field) => `'${field}', json_extract(${COLUMN_NAME_DATA$1}, '$.fields.${field}')`)
|
|
92713
|
+
.join(', ');
|
|
92714
|
+
const filteredFieldsExpr = `json_object(${jsonFields})`;
|
|
92715
|
+
// Use json_set to replace the 'fields' property in the data with the filtered version
|
|
92716
|
+
const filteredDataExpr = `json_set(${COLUMN_NAME_DATA$1}, '$.fields', ${filteredFieldsExpr})`;
|
|
92717
|
+
const paramList = keys.map(() => '?').join(',');
|
|
92718
|
+
const getQuery = `SELECT ${COLUMN_NAME_KEY$1}, ${filteredDataExpr} as ${COLUMN_NAME_DATA$1}, ${COLUMN_NAME_METADATA}, ${COLUMN_NAME_NAMESPACE} FROM ${this.tableName} WHERE ${COLUMN_NAME_NAMESPACE} = ? AND ${COLUMN_NAME_KEY$1} IN (${paramList})`;
|
|
92719
|
+
this.plugin.query(getQuery, [namespace].concat(keys), (x) => {
|
|
92720
|
+
resolve(this.mapToDurableEntries(x));
|
|
92721
|
+
}, reject);
|
|
92722
|
+
});
|
|
92723
|
+
}
|
|
92563
92724
|
getMetadataByKeys(keys, namespace) {
|
|
92564
92725
|
if (namespace === undefined) {
|
|
92565
92726
|
throw Error('LdsInternalDataTable requires namespace');
|
|
@@ -92697,6 +92858,11 @@ class NimbusSqliteStore {
|
|
|
92697
92858
|
.getByKeys(entryIds, segment)
|
|
92698
92859
|
.finally(() => tasker.done());
|
|
92699
92860
|
}
|
|
92861
|
+
async getEntriesWithSpecificFields(entryIds, fields, segment) {
|
|
92862
|
+
return this.getTable(segment)
|
|
92863
|
+
.getByKeysWithSpecificFields(entryIds, fields, segment)
|
|
92864
|
+
.finally(() => tasker.done());
|
|
92865
|
+
}
|
|
92700
92866
|
async getMetadata(entryIds, segment) {
|
|
92701
92867
|
return this.getTable(segment)
|
|
92702
92868
|
.getMetadataByKeys(entryIds, segment)
|
|
@@ -92853,6 +93019,27 @@ class AbstractKeyValueDataTable {
|
|
|
92853
93019
|
}, reject);
|
|
92854
93020
|
});
|
|
92855
93021
|
}
|
|
93022
|
+
getByKeysWithSpecificFields(keys, fields, _segment) {
|
|
93023
|
+
// SQLite json_object has a max argument limit (~127 pairs = 254 args)
|
|
93024
|
+
// If too many fields requested, return undefined to indicate filtering not possible
|
|
93025
|
+
if (fields.size > 100) {
|
|
93026
|
+
return Promise.resolve(undefined);
|
|
93027
|
+
}
|
|
93028
|
+
return new Promise((resolve, reject) => {
|
|
93029
|
+
// Build JSON object with only the specified fields from the nested 'fields' property
|
|
93030
|
+
const jsonFields = Array.from(fields)
|
|
93031
|
+
.map((field) => `'${field}', json_extract(${COLUMN_NAME_DATA}, '$.fields.${field}')`)
|
|
93032
|
+
.join(', ');
|
|
93033
|
+
const filteredFieldsExpr = `json_object(${jsonFields})`;
|
|
93034
|
+
// Use json_set to replace the 'fields' property in the data with the filtered version
|
|
93035
|
+
const filteredDataExpr = `json_set(${COLUMN_NAME_DATA}, '$.fields', ${filteredFieldsExpr})`;
|
|
93036
|
+
const paramList = keys.map(() => '?').join(',');
|
|
93037
|
+
const getQuery = `SELECT ${COLUMN_NAME_KEY}, ${filteredDataExpr} as ${COLUMN_NAME_DATA} FROM ${this.tableName} WHERE ${COLUMN_NAME_KEY} IN (${paramList})`;
|
|
93038
|
+
this.plugin.query(getQuery, keys, (x) => {
|
|
93039
|
+
resolve(this.mapToDurableEntries(x));
|
|
93040
|
+
}, reject);
|
|
93041
|
+
});
|
|
93042
|
+
}
|
|
92856
93043
|
getMetadataByKeys(_keys) {
|
|
92857
93044
|
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
92858
93045
|
throw new Error(`There is no metadata in the ${this.tableName} table.`);
|
|
@@ -98691,7 +98878,7 @@ function buildServiceDescriptor$b(luvio) {
|
|
|
98691
98878
|
},
|
|
98692
98879
|
};
|
|
98693
98880
|
}
|
|
98694
|
-
// version: 1.
|
|
98881
|
+
// version: 1.416.1-c10be671f4
|
|
98695
98882
|
|
|
98696
98883
|
/**
|
|
98697
98884
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -98717,7 +98904,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
98717
98904
|
},
|
|
98718
98905
|
};
|
|
98719
98906
|
}
|
|
98720
|
-
// version: 1.
|
|
98907
|
+
// version: 1.416.1-c10be671f4
|
|
98721
98908
|
|
|
98722
98909
|
/*!
|
|
98723
98910
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -101231,6 +101418,12 @@ function getRuntime({ primeUser = false } = {}) {
|
|
|
101231
101418
|
lazyInternalLuvio = internalLuvio;
|
|
101232
101419
|
lazyObjectInfoService = new ObjectInfoService(getObjectInfo, getObjectInfos, getObjectInfoDirectory, lazyDurableStore);
|
|
101233
101420
|
const baseEnv = new Environment(store, lazyNetworkAdapter);
|
|
101421
|
+
const shouldFilterFieldsOnRevive = (key) => {
|
|
101422
|
+
if (reviveOnlyRequestedFields.isOpen({ fallback: false })) {
|
|
101423
|
+
return isStoreKeyRecordId(key);
|
|
101424
|
+
}
|
|
101425
|
+
return false;
|
|
101426
|
+
};
|
|
101234
101427
|
const gqlEnv = makeEnvironmentGraphqlAware(baseEnv);
|
|
101235
101428
|
const durableEnv = makeDurable(gqlEnv, {
|
|
101236
101429
|
durableStore: lazyDurableStore,
|
|
@@ -101238,6 +101431,7 @@ function getRuntime({ primeUser = false } = {}) {
|
|
|
101238
101431
|
// disable luvio deep freeze in headless environments
|
|
101239
101432
|
disableDeepFreeze: typeof window === 'undefined',
|
|
101240
101433
|
shouldFlush,
|
|
101434
|
+
shouldFilterFieldsOnRevive,
|
|
101241
101435
|
});
|
|
101242
101436
|
// draft queue
|
|
101243
101437
|
lazyDraftQueue = buildLdsDraftQueue(lazyDurableStore);
|
|
@@ -101355,7 +101549,7 @@ register$1({
|
|
|
101355
101549
|
id: '@salesforce/lds-network-adapter',
|
|
101356
101550
|
instrument: instrument$2,
|
|
101357
101551
|
});
|
|
101358
|
-
// version: 1.
|
|
101552
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
101359
101553
|
|
|
101360
101554
|
const { create: create$3, keys: keys$3 } = Object;
|
|
101361
101555
|
const { stringify, parse } = JSON;
|
|
@@ -115166,7 +115360,7 @@ function registerCallback(cb) {
|
|
|
115166
115360
|
cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
|
|
115167
115361
|
}
|
|
115168
115362
|
}
|
|
115169
|
-
// version: 1.
|
|
115363
|
+
// version: 1.416.1-c10be671f4
|
|
115170
115364
|
|
|
115171
115365
|
function createFragmentMap(documentNode) {
|
|
115172
115366
|
const fragments = {};
|
|
@@ -144391,7 +144585,7 @@ register$1({
|
|
|
144391
144585
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
144392
144586
|
instrument: instrument$1,
|
|
144393
144587
|
});
|
|
144394
|
-
// version: 1.
|
|
144588
|
+
// version: 1.416.1-c10be671f4
|
|
144395
144589
|
|
|
144396
144590
|
// On core the unstable adapters are re-exported with different names,
|
|
144397
144591
|
// we want to match them here.
|
|
@@ -144543,7 +144737,7 @@ withDefaultLuvio((luvio) => {
|
|
|
144543
144737
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
144544
144738
|
graphQLImperative = ldsAdapter;
|
|
144545
144739
|
});
|
|
144546
|
-
// version: 1.
|
|
144740
|
+
// version: 1.416.1-c10be671f4
|
|
144547
144741
|
|
|
144548
144742
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
144549
144743
|
__proto__: null,
|
|
@@ -145342,7 +145536,7 @@ const callbacks$1 = [];
|
|
|
145342
145536
|
function register(r) {
|
|
145343
145537
|
callbacks$1.forEach((callback) => callback(r));
|
|
145344
145538
|
}
|
|
145345
|
-
// version: 1.
|
|
145539
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
145346
145540
|
|
|
145347
145541
|
/**
|
|
145348
145542
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -146658,4 +146852,4 @@ const { luvio } = getRuntime();
|
|
|
146658
146852
|
setDefaultLuvio({ luvio });
|
|
146659
146853
|
|
|
146660
146854
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
146661
|
-
// version: 1.
|
|
146855
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
@@ -4152,7 +4152,7 @@
|
|
|
4152
4152
|
}
|
|
4153
4153
|
return resourceParams;
|
|
4154
4154
|
}
|
|
4155
|
-
// engine version: 0.
|
|
4155
|
+
// engine version: 0.159.0-6e2a1824
|
|
4156
4156
|
|
|
4157
4157
|
/**
|
|
4158
4158
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4280,7 +4280,7 @@
|
|
|
4280
4280
|
}
|
|
4281
4281
|
callbacks.push(callback);
|
|
4282
4282
|
}
|
|
4283
|
-
// version: 1.
|
|
4283
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
4284
4284
|
|
|
4285
4285
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4286
4286
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -5324,7 +5324,7 @@
|
|
|
5324
5324
|
const { apiFamily, name } = metadata;
|
|
5325
5325
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
5326
5326
|
}
|
|
5327
|
-
// version: 1.
|
|
5327
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
5328
5328
|
|
|
5329
5329
|
/**
|
|
5330
5330
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -5423,7 +5423,7 @@
|
|
|
5423
5423
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
5424
5424
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
5425
5425
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
5426
|
-
// engine version: 0.
|
|
5426
|
+
// engine version: 0.159.0-6e2a1824
|
|
5427
5427
|
|
|
5428
5428
|
const { keys: ObjectKeys$4, create: ObjectCreate$5 } = Object;
|
|
5429
5429
|
|
|
@@ -23486,7 +23486,7 @@
|
|
|
23486
23486
|
}
|
|
23487
23487
|
|
|
23488
23488
|
const TTL$k$1 = 900000;
|
|
23489
|
-
const VERSION$D$2 = "
|
|
23489
|
+
const VERSION$D$2 = "a88bc29a18dfa64f33730b5bbe6aeb24";
|
|
23490
23490
|
const RepresentationType$u = 'ListObjectInfoRepresentation';
|
|
23491
23491
|
function keyBuilder$15$2(luvio, config) {
|
|
23492
23492
|
return keyPrefix$3 + '::' + RepresentationType$u + ':' + config.objectApiName;
|
|
@@ -23528,6 +23528,10 @@
|
|
|
23528
23528
|
name: 'objectApiName',
|
|
23529
23529
|
kind: 'Scalar'
|
|
23530
23530
|
},
|
|
23531
|
+
{
|
|
23532
|
+
name: 'publicCreateable',
|
|
23533
|
+
kind: 'Scalar'
|
|
23534
|
+
},
|
|
23531
23535
|
{
|
|
23532
23536
|
name: 'publicOrSharedCreateable',
|
|
23533
23537
|
kind: 'Scalar'
|
|
@@ -23535,6 +23539,10 @@
|
|
|
23535
23539
|
{
|
|
23536
23540
|
name: 'relatedEntityApiName',
|
|
23537
23541
|
kind: 'Scalar'
|
|
23542
|
+
},
|
|
23543
|
+
{
|
|
23544
|
+
name: 'sharedCreateable',
|
|
23545
|
+
kind: 'Scalar'
|
|
23538
23546
|
}
|
|
23539
23547
|
]
|
|
23540
23548
|
};
|
|
@@ -23545,11 +23553,21 @@
|
|
|
23545
23553
|
if (!(existing_createable === incoming_createable)) {
|
|
23546
23554
|
return false;
|
|
23547
23555
|
}
|
|
23556
|
+
const existing_publicCreateable = existing.publicCreateable;
|
|
23557
|
+
const incoming_publicCreateable = incoming.publicCreateable;
|
|
23558
|
+
if (!(existing_publicCreateable === incoming_publicCreateable)) {
|
|
23559
|
+
return false;
|
|
23560
|
+
}
|
|
23548
23561
|
const existing_publicOrSharedCreateable = existing.publicOrSharedCreateable;
|
|
23549
23562
|
const incoming_publicOrSharedCreateable = incoming.publicOrSharedCreateable;
|
|
23550
23563
|
if (!(existing_publicOrSharedCreateable === incoming_publicOrSharedCreateable)) {
|
|
23551
23564
|
return false;
|
|
23552
23565
|
}
|
|
23566
|
+
const existing_sharedCreateable = existing.sharedCreateable;
|
|
23567
|
+
const incoming_sharedCreateable = incoming.sharedCreateable;
|
|
23568
|
+
if (!(existing_sharedCreateable === incoming_sharedCreateable)) {
|
|
23569
|
+
return false;
|
|
23570
|
+
}
|
|
23553
23571
|
const existing_objectApiName = existing.objectApiName;
|
|
23554
23572
|
const incoming_objectApiName = incoming.objectApiName;
|
|
23555
23573
|
if (!(existing_objectApiName === incoming_objectApiName)) {
|
|
@@ -35479,7 +35497,7 @@
|
|
|
35479
35497
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
35480
35498
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
35481
35499
|
});
|
|
35482
|
-
// version: 1.
|
|
35500
|
+
// version: 1.416.1-c10be671f4
|
|
35483
35501
|
|
|
35484
35502
|
var allowUpdatesForNonCachedRecords = {
|
|
35485
35503
|
isOpen: function (e) {
|
|
@@ -48418,6 +48436,15 @@
|
|
|
48418
48436
|
},
|
|
48419
48437
|
};
|
|
48420
48438
|
|
|
48439
|
+
var reviveOnlyRequestedFields = {
|
|
48440
|
+
isOpen: function (e) {
|
|
48441
|
+
return e.fallback;
|
|
48442
|
+
},
|
|
48443
|
+
hasError: function () {
|
|
48444
|
+
return !0;
|
|
48445
|
+
},
|
|
48446
|
+
};
|
|
48447
|
+
|
|
48421
48448
|
/**
|
|
48422
48449
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
48423
48450
|
* All rights reserved.
|
|
@@ -48997,7 +49024,7 @@
|
|
|
48997
49024
|
* will refresh the snapshot from network, and then run the results from network
|
|
48998
49025
|
* through L2 ingestion, returning the subsequent revived snapshot.
|
|
48999
49026
|
*/
|
|
49000
|
-
function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, revivingStore, reviveMetrics = { l2Trips: [] }) {
|
|
49027
|
+
function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, durableStoreErrorHandler, buildL1Snapshot, revivingStore, reviveMetrics = { l2Trips: [] }, shouldFilterFields) {
|
|
49001
49028
|
const { recordId, select, missingLinks, seenRecords, state } = unavailableSnapshot;
|
|
49002
49029
|
// L2 can only revive Unfulfilled snapshots that have a selector since they have the
|
|
49003
49030
|
// info needed to revive (like missingLinks) and rebuild. Otherwise return L1 snapshot.
|
|
@@ -49024,19 +49051,55 @@
|
|
|
49024
49051
|
}
|
|
49025
49052
|
keysToReviveSet.merge(missingLinks);
|
|
49026
49053
|
const keysToRevive = keysToReviveSet.keysAsArray();
|
|
49027
|
-
const canonicalKeys = keysToRevive.map((x) => serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(x)));
|
|
49028
49054
|
const start = Date.now();
|
|
49029
49055
|
const { l2Trips } = reviveMetrics;
|
|
49030
|
-
|
|
49056
|
+
// Extract requested fields first to determine if filtering is possible
|
|
49057
|
+
let requestedFields;
|
|
49058
|
+
if (select.node.kind === 'Fragment' && 'selections' in select.node && select.node.selections) {
|
|
49059
|
+
requestedFields = extractRequestedFieldNames(select.node.selections);
|
|
49060
|
+
}
|
|
49061
|
+
const canonicalKeys = [];
|
|
49062
|
+
const filteredCanonicalKeys = [];
|
|
49063
|
+
for (let i = 0, len = keysToRevive.length; i < len; i += 1) {
|
|
49064
|
+
const canonicalKey = serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(keysToRevive[i]));
|
|
49065
|
+
// Only filter if we have fields to filter and shouldFilterFields returns true
|
|
49066
|
+
if (requestedFields !== undefined &&
|
|
49067
|
+
requestedFields.size > 0 &&
|
|
49068
|
+
shouldFilterFields(canonicalKey)) {
|
|
49069
|
+
filteredCanonicalKeys.push(canonicalKey);
|
|
49070
|
+
}
|
|
49071
|
+
else {
|
|
49072
|
+
canonicalKeys.push(canonicalKey);
|
|
49073
|
+
}
|
|
49074
|
+
}
|
|
49075
|
+
const fetchPromises = [
|
|
49076
|
+
durableStore.getEntries(canonicalKeys, DefaultDurableSegment),
|
|
49077
|
+
];
|
|
49078
|
+
if (requestedFields !== undefined &&
|
|
49079
|
+
requestedFields.size > 0 &&
|
|
49080
|
+
filteredCanonicalKeys.length > 0) {
|
|
49081
|
+
fetchPromises.push(durableStore.getEntriesWithSpecificFields(filteredCanonicalKeys, requestedFields, DefaultDurableSegment));
|
|
49082
|
+
}
|
|
49083
|
+
return Promise.all(fetchPromises).then(([durableRecords, filteredDurableRecords]) => {
|
|
49031
49084
|
l2Trips.push({
|
|
49032
49085
|
duration: Date.now() - start,
|
|
49033
|
-
keysRequestedCount: canonicalKeys.length,
|
|
49086
|
+
keysRequestedCount: canonicalKeys.length + filteredCanonicalKeys.length,
|
|
49034
49087
|
});
|
|
49035
|
-
|
|
49036
|
-
|
|
49037
|
-
|
|
49038
|
-
//
|
|
49039
|
-
|
|
49088
|
+
// Process both normal and filtered records in a single pass
|
|
49089
|
+
const revivedKeys = new StoreKeySet();
|
|
49090
|
+
let hadUnexpectedShape = false;
|
|
49091
|
+
// Process normal records
|
|
49092
|
+
if (durableRecords !== undefined) {
|
|
49093
|
+
const normalResult = publishDurableStoreEntries(durableRecords, baseEnvironment.storePut.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49094
|
+
revivedKeys.merge(normalResult.revivedKeys);
|
|
49095
|
+
hadUnexpectedShape = hadUnexpectedShape || normalResult.hadUnexpectedShape;
|
|
49096
|
+
}
|
|
49097
|
+
// Process filtered records with merging
|
|
49098
|
+
if (filteredDurableRecords !== undefined) {
|
|
49099
|
+
const filteredResult = publishDurableStoreEntries(filteredDurableRecords, createMergeFilteredPut((key) => baseEnvironment.store.readEntry(key), baseEnvironment.storePut.bind(baseEnvironment)), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49100
|
+
revivedKeys.merge(filteredResult.revivedKeys);
|
|
49101
|
+
hadUnexpectedShape = hadUnexpectedShape || filteredResult.hadUnexpectedShape;
|
|
49102
|
+
}
|
|
49040
49103
|
// if the data coming back from DS had an unexpected shape then just
|
|
49041
49104
|
// return the L1 snapshot
|
|
49042
49105
|
if (hadUnexpectedShape === true) {
|
|
@@ -49071,7 +49134,7 @@
|
|
|
49071
49134
|
for (let i = 0, len = newKeys.length; i < len; i++) {
|
|
49072
49135
|
const newSnapshotSeenKey = newKeys[i];
|
|
49073
49136
|
if (!alreadyRequestedOrRevivedSet.has(newSnapshotSeenKey)) {
|
|
49074
|
-
return reviveSnapshot(baseEnvironment, durableStore, snapshot, durableStoreErrorHandler, buildL1Snapshot, revivingStore, reviveMetrics);
|
|
49137
|
+
return reviveSnapshot(baseEnvironment, durableStore, snapshot, durableStoreErrorHandler, buildL1Snapshot, revivingStore, reviveMetrics, shouldFilterFields);
|
|
49075
49138
|
}
|
|
49076
49139
|
}
|
|
49077
49140
|
}
|
|
@@ -49082,6 +49145,59 @@
|
|
|
49082
49145
|
return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
|
|
49083
49146
|
});
|
|
49084
49147
|
}
|
|
49148
|
+
/**
|
|
49149
|
+
* Creates a put function that merges filtered fields with existing L1 records instead of replacing them.
|
|
49150
|
+
* This is used when reviving filtered fields from L2 to preserve existing data in L1.
|
|
49151
|
+
*/
|
|
49152
|
+
function createMergeFilteredPut(readEntry, storePut) {
|
|
49153
|
+
return (key, filteredData) => {
|
|
49154
|
+
const existingRecord = readEntry(key);
|
|
49155
|
+
if (existingRecord !== undefined &&
|
|
49156
|
+
existingRecord !== null &&
|
|
49157
|
+
typeof filteredData === 'object' &&
|
|
49158
|
+
filteredData !== null &&
|
|
49159
|
+
typeof existingRecord === 'object') {
|
|
49160
|
+
const filteredFields = filteredData;
|
|
49161
|
+
const existingObj = existingRecord;
|
|
49162
|
+
// Check if object is frozen (can happen after deepFreeze)
|
|
49163
|
+
// If frozen, create a shallow copy to merge fields into
|
|
49164
|
+
let targetObj = existingObj;
|
|
49165
|
+
if (Object.isFrozen(existingObj)) {
|
|
49166
|
+
targetObj = { ...existingObj };
|
|
49167
|
+
}
|
|
49168
|
+
const keys = Object.keys(filteredFields);
|
|
49169
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
49170
|
+
const fieldKey = keys[i];
|
|
49171
|
+
targetObj[fieldKey] = filteredFields[fieldKey];
|
|
49172
|
+
}
|
|
49173
|
+
storePut(key, targetObj);
|
|
49174
|
+
}
|
|
49175
|
+
else {
|
|
49176
|
+
// No existing record, just put the filtered data
|
|
49177
|
+
storePut(key, filteredData);
|
|
49178
|
+
}
|
|
49179
|
+
};
|
|
49180
|
+
}
|
|
49181
|
+
/**
|
|
49182
|
+
* Extracts the requested field names from the selections of a 'fields' ObjectSelection.
|
|
49183
|
+
* Returns undefined if no 'fields' selection is found or if it doesn't have selections.
|
|
49184
|
+
*/
|
|
49185
|
+
function extractRequestedFieldNames(selections) {
|
|
49186
|
+
if (!selections) {
|
|
49187
|
+
return undefined;
|
|
49188
|
+
}
|
|
49189
|
+
// Find the 'fields' ObjectSelection
|
|
49190
|
+
const fieldsSelection = selections.find((sel) => sel.kind === 'Object' && sel.name === 'fields');
|
|
49191
|
+
if (!fieldsSelection || !fieldsSelection.selections) {
|
|
49192
|
+
return undefined;
|
|
49193
|
+
}
|
|
49194
|
+
// Extract all field names from the fields selections
|
|
49195
|
+
const fieldNames = new Set();
|
|
49196
|
+
for (const fieldSel of fieldsSelection.selections) {
|
|
49197
|
+
fieldNames.add(fieldSel.name);
|
|
49198
|
+
}
|
|
49199
|
+
return fieldNames.size > 0 ? fieldNames : undefined;
|
|
49200
|
+
}
|
|
49085
49201
|
|
|
49086
49202
|
const TTL_DURABLE_SEGMENT = 'TTL_DURABLE_SEGMENT';
|
|
49087
49203
|
const TTL_DEFAULT_KEY = 'TTL_DEFAULT_KEY';
|
|
@@ -49398,7 +49514,7 @@
|
|
|
49398
49514
|
* @param durableStore A DurableStore implementation
|
|
49399
49515
|
* @param instrumentation An instrumentation function implementation
|
|
49400
49516
|
*/
|
|
49401
|
-
function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, shouldFlush, enableDurableMetadataRefresh = false, disableDeepFreeze = false, }) {
|
|
49517
|
+
function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, shouldFlush, enableDurableMetadataRefresh = false, disableDeepFreeze = false, shouldFilterFieldsOnRevive, }) {
|
|
49402
49518
|
// runtimes can choose to disable deepFreeze, e.g. headless mobile runtime
|
|
49403
49519
|
setBypassDeepFreeze(disableDeepFreeze);
|
|
49404
49520
|
let stagingStore = null;
|
|
@@ -49940,7 +50056,7 @@
|
|
|
49940
50056
|
const result = buildL1Snapshot();
|
|
49941
50057
|
stagingStore = tempStore;
|
|
49942
50058
|
return result;
|
|
49943
|
-
}, revivingStore).finally(() => {
|
|
50059
|
+
}, revivingStore, { l2Trips: [] }, shouldFilterFieldsOnRevive !== null && shouldFilterFieldsOnRevive !== void 0 ? shouldFilterFieldsOnRevive : (() => false)).finally(() => {
|
|
49944
50060
|
});
|
|
49945
50061
|
};
|
|
49946
50062
|
const expirePossibleStaleRecords = async function (keys$1, config, refresh) {
|
|
@@ -92460,6 +92576,27 @@
|
|
|
92460
92576
|
}, reject);
|
|
92461
92577
|
});
|
|
92462
92578
|
}
|
|
92579
|
+
getByKeysWithSpecificFields(keys, fields, _segment) {
|
|
92580
|
+
// SQLite json_object has a max argument limit (~127 pairs = 254 args)
|
|
92581
|
+
// If too many fields requested, return undefined to indicate filtering not possible
|
|
92582
|
+
if (fields.size > 100) {
|
|
92583
|
+
return Promise.resolve(undefined);
|
|
92584
|
+
}
|
|
92585
|
+
return new Promise((resolve, reject) => {
|
|
92586
|
+
// Build JSON object with only the specified fields from the nested 'fields' property
|
|
92587
|
+
const jsonFields = Array.from(fields)
|
|
92588
|
+
.map((field) => `'${field}', json_extract(${COLUMN_NAME_DATA$2}, '$.fields.${field}')`)
|
|
92589
|
+
.join(', ');
|
|
92590
|
+
const filteredFieldsExpr = `json_object(${jsonFields})`;
|
|
92591
|
+
// Use json_set to replace the 'fields' property in the data with the filtered version
|
|
92592
|
+
const filteredDataExpr = `json_set(${COLUMN_NAME_DATA$2}, '$.fields', ${filteredFieldsExpr})`;
|
|
92593
|
+
const paramList = keys.map(() => '?').join(',');
|
|
92594
|
+
const getQuery = `SELECT ${COLUMN_NAME_KEY$2}, ${filteredDataExpr} as ${COLUMN_NAME_DATA$2}, ${COLUMN_NAME_METADATA$1} FROM ${this.tableName} WHERE ${COLUMN_NAME_KEY$2} IN (${paramList})`;
|
|
92595
|
+
this.plugin.query(getQuery, keys, (x) => {
|
|
92596
|
+
resolve(this.mapToDurableEntries(x));
|
|
92597
|
+
}, reject);
|
|
92598
|
+
});
|
|
92599
|
+
}
|
|
92463
92600
|
getMetadataByKeys(keys) {
|
|
92464
92601
|
const query = selectColumnsFromTableWhereKeyIn([COLUMN_NAME_KEY$2, COLUMN_NAME_METADATA$1], this.tableName, COLUMN_NAME_KEY$2, keys);
|
|
92465
92602
|
return new Promise((resolve, reject) => {
|
|
@@ -92566,6 +92703,30 @@
|
|
|
92566
92703
|
}, reject);
|
|
92567
92704
|
});
|
|
92568
92705
|
}
|
|
92706
|
+
getByKeysWithSpecificFields(keys, fields, namespace) {
|
|
92707
|
+
if (namespace === undefined) {
|
|
92708
|
+
throw Error('LdsInternalDataTable requires namespace');
|
|
92709
|
+
}
|
|
92710
|
+
// SQLite json_object has a max argument limit (~127 pairs = 254 args)
|
|
92711
|
+
// If too many fields requested, return undefined to indicate filtering not possible
|
|
92712
|
+
if (fields.size > 100) {
|
|
92713
|
+
return Promise.resolve(undefined);
|
|
92714
|
+
}
|
|
92715
|
+
return new Promise((resolve, reject) => {
|
|
92716
|
+
// Build JSON object with only the specified fields from the nested 'fields' property
|
|
92717
|
+
const jsonFields = Array.from(fields)
|
|
92718
|
+
.map((field) => `'${field}', json_extract(${COLUMN_NAME_DATA$1}, '$.fields.${field}')`)
|
|
92719
|
+
.join(', ');
|
|
92720
|
+
const filteredFieldsExpr = `json_object(${jsonFields})`;
|
|
92721
|
+
// Use json_set to replace the 'fields' property in the data with the filtered version
|
|
92722
|
+
const filteredDataExpr = `json_set(${COLUMN_NAME_DATA$1}, '$.fields', ${filteredFieldsExpr})`;
|
|
92723
|
+
const paramList = keys.map(() => '?').join(',');
|
|
92724
|
+
const getQuery = `SELECT ${COLUMN_NAME_KEY$1}, ${filteredDataExpr} as ${COLUMN_NAME_DATA$1}, ${COLUMN_NAME_METADATA}, ${COLUMN_NAME_NAMESPACE} FROM ${this.tableName} WHERE ${COLUMN_NAME_NAMESPACE} = ? AND ${COLUMN_NAME_KEY$1} IN (${paramList})`;
|
|
92725
|
+
this.plugin.query(getQuery, [namespace].concat(keys), (x) => {
|
|
92726
|
+
resolve(this.mapToDurableEntries(x));
|
|
92727
|
+
}, reject);
|
|
92728
|
+
});
|
|
92729
|
+
}
|
|
92569
92730
|
getMetadataByKeys(keys, namespace) {
|
|
92570
92731
|
if (namespace === undefined) {
|
|
92571
92732
|
throw Error('LdsInternalDataTable requires namespace');
|
|
@@ -92703,6 +92864,11 @@
|
|
|
92703
92864
|
.getByKeys(entryIds, segment)
|
|
92704
92865
|
.finally(() => tasker.done());
|
|
92705
92866
|
}
|
|
92867
|
+
async getEntriesWithSpecificFields(entryIds, fields, segment) {
|
|
92868
|
+
return this.getTable(segment)
|
|
92869
|
+
.getByKeysWithSpecificFields(entryIds, fields, segment)
|
|
92870
|
+
.finally(() => tasker.done());
|
|
92871
|
+
}
|
|
92706
92872
|
async getMetadata(entryIds, segment) {
|
|
92707
92873
|
return this.getTable(segment)
|
|
92708
92874
|
.getMetadataByKeys(entryIds, segment)
|
|
@@ -92859,6 +93025,27 @@
|
|
|
92859
93025
|
}, reject);
|
|
92860
93026
|
});
|
|
92861
93027
|
}
|
|
93028
|
+
getByKeysWithSpecificFields(keys, fields, _segment) {
|
|
93029
|
+
// SQLite json_object has a max argument limit (~127 pairs = 254 args)
|
|
93030
|
+
// If too many fields requested, return undefined to indicate filtering not possible
|
|
93031
|
+
if (fields.size > 100) {
|
|
93032
|
+
return Promise.resolve(undefined);
|
|
93033
|
+
}
|
|
93034
|
+
return new Promise((resolve, reject) => {
|
|
93035
|
+
// Build JSON object with only the specified fields from the nested 'fields' property
|
|
93036
|
+
const jsonFields = Array.from(fields)
|
|
93037
|
+
.map((field) => `'${field}', json_extract(${COLUMN_NAME_DATA}, '$.fields.${field}')`)
|
|
93038
|
+
.join(', ');
|
|
93039
|
+
const filteredFieldsExpr = `json_object(${jsonFields})`;
|
|
93040
|
+
// Use json_set to replace the 'fields' property in the data with the filtered version
|
|
93041
|
+
const filteredDataExpr = `json_set(${COLUMN_NAME_DATA}, '$.fields', ${filteredFieldsExpr})`;
|
|
93042
|
+
const paramList = keys.map(() => '?').join(',');
|
|
93043
|
+
const getQuery = `SELECT ${COLUMN_NAME_KEY}, ${filteredDataExpr} as ${COLUMN_NAME_DATA} FROM ${this.tableName} WHERE ${COLUMN_NAME_KEY} IN (${paramList})`;
|
|
93044
|
+
this.plugin.query(getQuery, keys, (x) => {
|
|
93045
|
+
resolve(this.mapToDurableEntries(x));
|
|
93046
|
+
}, reject);
|
|
93047
|
+
});
|
|
93048
|
+
}
|
|
92862
93049
|
getMetadataByKeys(_keys) {
|
|
92863
93050
|
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
92864
93051
|
throw new Error(`There is no metadata in the ${this.tableName} table.`);
|
|
@@ -98697,7 +98884,7 @@
|
|
|
98697
98884
|
},
|
|
98698
98885
|
};
|
|
98699
98886
|
}
|
|
98700
|
-
// version: 1.
|
|
98887
|
+
// version: 1.416.1-c10be671f4
|
|
98701
98888
|
|
|
98702
98889
|
/**
|
|
98703
98890
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -98723,7 +98910,7 @@
|
|
|
98723
98910
|
},
|
|
98724
98911
|
};
|
|
98725
98912
|
}
|
|
98726
|
-
// version: 1.
|
|
98913
|
+
// version: 1.416.1-c10be671f4
|
|
98727
98914
|
|
|
98728
98915
|
/*!
|
|
98729
98916
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -101237,6 +101424,12 @@
|
|
|
101237
101424
|
lazyInternalLuvio = internalLuvio;
|
|
101238
101425
|
lazyObjectInfoService = new ObjectInfoService(getObjectInfo, getObjectInfos, getObjectInfoDirectory, lazyDurableStore);
|
|
101239
101426
|
const baseEnv = new Environment(store, lazyNetworkAdapter);
|
|
101427
|
+
const shouldFilterFieldsOnRevive = (key) => {
|
|
101428
|
+
if (reviveOnlyRequestedFields.isOpen({ fallback: false })) {
|
|
101429
|
+
return isStoreKeyRecordId(key);
|
|
101430
|
+
}
|
|
101431
|
+
return false;
|
|
101432
|
+
};
|
|
101240
101433
|
const gqlEnv = makeEnvironmentGraphqlAware(baseEnv);
|
|
101241
101434
|
const durableEnv = makeDurable(gqlEnv, {
|
|
101242
101435
|
durableStore: lazyDurableStore,
|
|
@@ -101244,6 +101437,7 @@
|
|
|
101244
101437
|
// disable luvio deep freeze in headless environments
|
|
101245
101438
|
disableDeepFreeze: typeof window === 'undefined',
|
|
101246
101439
|
shouldFlush,
|
|
101440
|
+
shouldFilterFieldsOnRevive,
|
|
101247
101441
|
});
|
|
101248
101442
|
// draft queue
|
|
101249
101443
|
lazyDraftQueue = buildLdsDraftQueue(lazyDurableStore);
|
|
@@ -101361,7 +101555,7 @@
|
|
|
101361
101555
|
id: '@salesforce/lds-network-adapter',
|
|
101362
101556
|
instrument: instrument$2,
|
|
101363
101557
|
});
|
|
101364
|
-
// version: 1.
|
|
101558
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
101365
101559
|
|
|
101366
101560
|
const { create: create$3, keys: keys$3 } = Object;
|
|
101367
101561
|
const { stringify, parse } = JSON;
|
|
@@ -115172,7 +115366,7 @@ keys: keys$2,
|
|
|
115172
115366
|
cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
|
|
115173
115367
|
}
|
|
115174
115368
|
}
|
|
115175
|
-
// version: 1.
|
|
115369
|
+
// version: 1.416.1-c10be671f4
|
|
115176
115370
|
|
|
115177
115371
|
function createFragmentMap(documentNode) {
|
|
115178
115372
|
const fragments = {};
|
|
@@ -144397,7 +144591,7 @@ keys: keys$2,
|
|
|
144397
144591
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
144398
144592
|
instrument: instrument$1,
|
|
144399
144593
|
});
|
|
144400
|
-
// version: 1.
|
|
144594
|
+
// version: 1.416.1-c10be671f4
|
|
144401
144595
|
|
|
144402
144596
|
// On core the unstable adapters are re-exported with different names,
|
|
144403
144597
|
// we want to match them here.
|
|
@@ -144549,7 +144743,7 @@ keys: keys$2,
|
|
|
144549
144743
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
144550
144744
|
graphQLImperative = ldsAdapter;
|
|
144551
144745
|
});
|
|
144552
|
-
// version: 1.
|
|
144746
|
+
// version: 1.416.1-c10be671f4
|
|
144553
144747
|
|
|
144554
144748
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
144555
144749
|
__proto__: null,
|
|
@@ -145348,7 +145542,7 @@ keys: keys$2,
|
|
|
145348
145542
|
function register(r) {
|
|
145349
145543
|
callbacks$1.forEach((callback) => callback(r));
|
|
145350
145544
|
}
|
|
145351
|
-
// version: 1.
|
|
145545
|
+
// version: 1.416.1-0ee8f9a6ba
|
|
145352
145546
|
|
|
145353
145547
|
/**
|
|
145354
145548
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -146685,4 +146879,4 @@ keys: keys$2,
|
|
|
146685
146879
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
146686
146880
|
|
|
146687
146881
|
}));
|
|
146688
|
-
// version: 1.
|
|
146882
|
+
// version: 1.416.1-0ee8f9a6ba
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.416.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/standalone/es/lds-worker-api.js",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
|
|
38
|
-
"@salesforce/lds-adapters-graphql": "^1.
|
|
39
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
40
|
-
"@salesforce/lds-default-luvio": "^1.
|
|
41
|
-
"@salesforce/lds-drafts": "^1.
|
|
42
|
-
"@salesforce/lds-graphql-parser": "^1.
|
|
43
|
-
"@salesforce/lds-luvio-engine": "^1.
|
|
44
|
-
"@salesforce/lds-runtime-mobile": "^1.
|
|
45
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
38
|
+
"@salesforce/lds-adapters-graphql": "^1.416.1",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.416.1",
|
|
40
|
+
"@salesforce/lds-default-luvio": "^1.416.1",
|
|
41
|
+
"@salesforce/lds-drafts": "^1.416.1",
|
|
42
|
+
"@salesforce/lds-graphql-parser": "^1.416.1",
|
|
43
|
+
"@salesforce/lds-luvio-engine": "^1.416.1",
|
|
44
|
+
"@salesforce/lds-runtime-mobile": "^1.416.1",
|
|
45
|
+
"@salesforce/nimbus-plugin-lds": "^1.416.1",
|
|
46
46
|
"ajv": "^8.11.0",
|
|
47
47
|
"glob": "^7.1.5",
|
|
48
48
|
"nimbus-types": "^2.0.0-alpha1",
|