@salesforce/lds-worker-api 1.419.0 → 1.420.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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.420.0-fc658f6118
|
|
@@ -2351,7 +2351,7 @@ function isDefined(value) {
|
|
|
2351
2351
|
/**
|
|
2352
2352
|
* Checks if the given variable is an object
|
|
2353
2353
|
*/
|
|
2354
|
-
function isObject$
|
|
2354
|
+
function isObject$3(value) {
|
|
2355
2355
|
return typeof value === 'object' && value !== null;
|
|
2356
2356
|
}
|
|
2357
2357
|
|
|
@@ -2981,10 +2981,10 @@ class Reader {
|
|
|
2981
2981
|
}
|
|
2982
2982
|
if (fragment.opaque) {
|
|
2983
2983
|
this.checkIfChanged(result.value, { useDeepEquals: true });
|
|
2984
|
-
if (isObject$
|
|
2984
|
+
if (isObject$3(result.value) && !readerOpaqueReferenceMap.has(result.value)) {
|
|
2985
2985
|
readerOpaqueReferenceMap.set(result.value, this.opaqueCopy(result.value));
|
|
2986
2986
|
}
|
|
2987
|
-
const opaqueValue = isObject$
|
|
2987
|
+
const opaqueValue = isObject$3(result.value)
|
|
2988
2988
|
? readerOpaqueReferenceMap.get(result.value)
|
|
2989
2989
|
: result.value;
|
|
2990
2990
|
return {
|
|
@@ -4146,7 +4146,7 @@ function createResourceParamsImpl(config, configMetadata) {
|
|
|
4146
4146
|
}
|
|
4147
4147
|
return resourceParams;
|
|
4148
4148
|
}
|
|
4149
|
-
// engine version: 0.160.
|
|
4149
|
+
// engine version: 0.160.3-354dc58b
|
|
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.420.0-fc658f6118
|
|
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.420.0-fc658f6118
|
|
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.160.
|
|
5420
|
+
// engine version: 0.160.3-354dc58b
|
|
5421
5421
|
|
|
5422
5422
|
const { keys: ObjectKeys$4, create: ObjectCreate$4 } = Object;
|
|
5423
5423
|
|
|
@@ -35491,7 +35491,7 @@ withDefaultLuvio((luvio) => {
|
|
|
35491
35491
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
35492
35492
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
35493
35493
|
});
|
|
35494
|
-
// version: 1.
|
|
35494
|
+
// version: 1.420.0-576a1ea316
|
|
35495
35495
|
|
|
35496
35496
|
var allowUpdatesForNonCachedRecords = {
|
|
35497
35497
|
isOpen: function (e) {
|
|
@@ -48922,7 +48922,7 @@ const RedirectDurableSegment$1 = 'REDIRECT_KEYS';
|
|
|
48922
48922
|
const MessagingDurableSegment = 'MESSAGING';
|
|
48923
48923
|
const MessageNotifyStoreUpdateAvailable = 'notifyStoreUpdateAvailable';
|
|
48924
48924
|
|
|
48925
|
-
const { keys: keys$5, create: create$5, assign: assign$4, freeze: freeze$2 } = Object;
|
|
48925
|
+
const { keys: keys$5, create: create$5, assign: assign$4, freeze: freeze$2, isFrozen: isFrozen$1$1 } = Object;
|
|
48926
48926
|
|
|
48927
48927
|
//Durable store error instrumentation key
|
|
48928
48928
|
const DURABLE_STORE_ERROR = 'durable-store-error';
|
|
@@ -49006,6 +49006,74 @@ function publishDurableStoreEntries(durableRecords, put, publishMetadata) {
|
|
|
49006
49006
|
}
|
|
49007
49007
|
return { revivedKeys, hadUnexpectedShape };
|
|
49008
49008
|
}
|
|
49009
|
+
/**
|
|
49010
|
+
* Extracts field filtering configuration from the selection.
|
|
49011
|
+
*/
|
|
49012
|
+
function extractFieldFilteringConfig(select, recordId, baseEnvironment) {
|
|
49013
|
+
const rootRecordKey = serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(recordId));
|
|
49014
|
+
let topLevelFields;
|
|
49015
|
+
let nestedFieldRequirements;
|
|
49016
|
+
if (select &&
|
|
49017
|
+
select.node.kind === 'Fragment' &&
|
|
49018
|
+
'selections' in select.node &&
|
|
49019
|
+
select.node.selections) {
|
|
49020
|
+
topLevelFields = extractRequestedFieldNames(select.node.selections);
|
|
49021
|
+
nestedFieldRequirements = extractNestedFieldRequirements(select.node.selections);
|
|
49022
|
+
}
|
|
49023
|
+
// Merge all nested field requirements into a single set
|
|
49024
|
+
let nestedFields;
|
|
49025
|
+
if (nestedFieldRequirements && nestedFieldRequirements.size > 0) {
|
|
49026
|
+
nestedFields = new Set();
|
|
49027
|
+
for (const fieldSet of nestedFieldRequirements.values()) {
|
|
49028
|
+
for (const field of fieldSet) {
|
|
49029
|
+
nestedFields.add(field);
|
|
49030
|
+
}
|
|
49031
|
+
}
|
|
49032
|
+
}
|
|
49033
|
+
return { rootRecordKey, topLevelFields, nestedFields };
|
|
49034
|
+
}
|
|
49035
|
+
/**
|
|
49036
|
+
* Categorizes keys into different fetch strategies based on filtering requirements.
|
|
49037
|
+
*/
|
|
49038
|
+
function categorizeKeysForL2Fetch(keysToRevive, config, baseEnvironment, shouldFilterFields) {
|
|
49039
|
+
const unfilteredKeys = [];
|
|
49040
|
+
const rootKeysWithTopLevelFields = [];
|
|
49041
|
+
const nestedKeysWithNestedFields = [];
|
|
49042
|
+
const canFilter = config.topLevelFields !== undefined && config.topLevelFields.size > 0;
|
|
49043
|
+
for (let i = 0, len = keysToRevive.length; i < len; i += 1) {
|
|
49044
|
+
const canonicalKey = serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(keysToRevive[i]));
|
|
49045
|
+
if (!shouldFilterFields(canonicalKey) || !canFilter) {
|
|
49046
|
+
unfilteredKeys.push(canonicalKey);
|
|
49047
|
+
continue;
|
|
49048
|
+
}
|
|
49049
|
+
const isRootRecord = canonicalKey === config.rootRecordKey;
|
|
49050
|
+
if (isRootRecord) {
|
|
49051
|
+
rootKeysWithTopLevelFields.push(canonicalKey);
|
|
49052
|
+
}
|
|
49053
|
+
else if (config.nestedFields !== undefined && config.nestedFields.size > 0) {
|
|
49054
|
+
nestedKeysWithNestedFields.push(canonicalKey);
|
|
49055
|
+
}
|
|
49056
|
+
else {
|
|
49057
|
+
unfilteredKeys.push(canonicalKey);
|
|
49058
|
+
}
|
|
49059
|
+
}
|
|
49060
|
+
return { unfilteredKeys, rootKeysWithTopLevelFields, nestedKeysWithNestedFields };
|
|
49061
|
+
}
|
|
49062
|
+
/**
|
|
49063
|
+
* Builds L2 fetch promises for different key categories.
|
|
49064
|
+
*/
|
|
49065
|
+
function buildL2FetchPromises(categorizedKeys, config, durableStore) {
|
|
49066
|
+
const promises = [
|
|
49067
|
+
durableStore.getEntries(categorizedKeys.unfilteredKeys, DefaultDurableSegment),
|
|
49068
|
+
];
|
|
49069
|
+
if (config.topLevelFields && categorizedKeys.rootKeysWithTopLevelFields.length > 0) {
|
|
49070
|
+
promises.push(durableStore.getEntriesWithSpecificFields(categorizedKeys.rootKeysWithTopLevelFields, config.topLevelFields, DefaultDurableSegment));
|
|
49071
|
+
}
|
|
49072
|
+
if (config.nestedFields && categorizedKeys.nestedKeysWithNestedFields.length > 0) {
|
|
49073
|
+
promises.push(durableStore.getEntriesWithSpecificFields(categorizedKeys.nestedKeysWithNestedFields, config.nestedFields, DefaultDurableSegment));
|
|
49074
|
+
}
|
|
49075
|
+
return promises;
|
|
49076
|
+
}
|
|
49009
49077
|
/**
|
|
49010
49078
|
* This method returns a Promise to a snapshot that is revived from L2 cache. If
|
|
49011
49079
|
* L2 does not have the entries necessary to fulfill the snapshot then this method
|
|
@@ -49041,53 +49109,41 @@ function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, dura
|
|
|
49041
49109
|
const keysToRevive = keysToReviveSet.keysAsArray();
|
|
49042
49110
|
const start = Date.now();
|
|
49043
49111
|
const { l2Trips } = reviveMetrics;
|
|
49044
|
-
// Extract
|
|
49045
|
-
|
|
49046
|
-
|
|
49047
|
-
|
|
49048
|
-
|
|
49049
|
-
const
|
|
49050
|
-
|
|
49051
|
-
|
|
49052
|
-
|
|
49053
|
-
|
|
49054
|
-
if (requestedFields !== undefined &&
|
|
49055
|
-
requestedFields.size > 0 &&
|
|
49056
|
-
shouldFilterFields(canonicalKey)) {
|
|
49057
|
-
filteredCanonicalKeys.push(canonicalKey);
|
|
49058
|
-
}
|
|
49059
|
-
else {
|
|
49060
|
-
canonicalKeys.push(canonicalKey);
|
|
49061
|
-
}
|
|
49062
|
-
}
|
|
49063
|
-
const fetchPromises = [
|
|
49064
|
-
durableStore.getEntries(canonicalKeys, DefaultDurableSegment),
|
|
49065
|
-
];
|
|
49066
|
-
if (requestedFields !== undefined &&
|
|
49067
|
-
requestedFields.size > 0 &&
|
|
49068
|
-
filteredCanonicalKeys.length > 0) {
|
|
49069
|
-
fetchPromises.push(durableStore.getEntriesWithSpecificFields(filteredCanonicalKeys, requestedFields, DefaultDurableSegment));
|
|
49070
|
-
}
|
|
49071
|
-
return Promise.all(fetchPromises).then(([durableRecords, filteredDurableRecords]) => {
|
|
49112
|
+
// Extract field filtering requirements from the selection
|
|
49113
|
+
const fieldFilteringConfig = extractFieldFilteringConfig(select, recordId, baseEnvironment);
|
|
49114
|
+
// Categorize keys by how they should be fetched from L2
|
|
49115
|
+
const categorizedKeys = categorizeKeysForL2Fetch(keysToRevive, fieldFilteringConfig, baseEnvironment, shouldFilterFields);
|
|
49116
|
+
// Build fetch promises for each category
|
|
49117
|
+
const fetchPromises = buildL2FetchPromises(categorizedKeys, fieldFilteringConfig, durableStore);
|
|
49118
|
+
return Promise.all(fetchPromises).then(([durableRecords, filteredDurableRecords, nestedFilteredDurableRecords]) => {
|
|
49119
|
+
const totalKeysRequested = categorizedKeys.unfilteredKeys.length +
|
|
49120
|
+
categorizedKeys.rootKeysWithTopLevelFields.length +
|
|
49121
|
+
categorizedKeys.nestedKeysWithNestedFields.length;
|
|
49072
49122
|
l2Trips.push({
|
|
49073
49123
|
duration: Date.now() - start,
|
|
49074
|
-
keysRequestedCount:
|
|
49124
|
+
keysRequestedCount: totalKeysRequested,
|
|
49075
49125
|
});
|
|
49076
|
-
// Process
|
|
49126
|
+
// Process all three categories of records
|
|
49077
49127
|
const revivedKeys = new StoreKeySet();
|
|
49078
49128
|
let hadUnexpectedShape = false;
|
|
49079
|
-
// Process normal records
|
|
49129
|
+
// Process normal records (all fields)
|
|
49080
49130
|
if (durableRecords !== undefined) {
|
|
49081
49131
|
const normalResult = publishDurableStoreEntries(durableRecords, baseEnvironment.storePut.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49082
49132
|
revivedKeys.merge(normalResult.revivedKeys);
|
|
49083
49133
|
hadUnexpectedShape = hadUnexpectedShape || normalResult.hadUnexpectedShape;
|
|
49084
49134
|
}
|
|
49085
|
-
// Process filtered records with merging
|
|
49135
|
+
// Process filtered records (root with top-level fields) with merging
|
|
49086
49136
|
if (filteredDurableRecords !== undefined) {
|
|
49087
49137
|
const filteredResult = publishDurableStoreEntries(filteredDurableRecords, createMergeFilteredPut((key) => baseEnvironment.store.readEntry(key), baseEnvironment.storePut.bind(baseEnvironment)), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49088
49138
|
revivedKeys.merge(filteredResult.revivedKeys);
|
|
49089
49139
|
hadUnexpectedShape = hadUnexpectedShape || filteredResult.hadUnexpectedShape;
|
|
49090
49140
|
}
|
|
49141
|
+
// Process nested filtered records with merging
|
|
49142
|
+
if (nestedFilteredDurableRecords !== undefined) {
|
|
49143
|
+
const nestedFilteredResult = publishDurableStoreEntries(nestedFilteredDurableRecords, createMergeFilteredPut((key) => baseEnvironment.store.readEntry(key), baseEnvironment.storePut.bind(baseEnvironment)), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49144
|
+
revivedKeys.merge(nestedFilteredResult.revivedKeys);
|
|
49145
|
+
hadUnexpectedShape = hadUnexpectedShape || nestedFilteredResult.hadUnexpectedShape;
|
|
49146
|
+
}
|
|
49091
49147
|
// if the data coming back from DS had an unexpected shape then just
|
|
49092
49148
|
// return the L1 snapshot
|
|
49093
49149
|
if (hadUnexpectedShape === true) {
|
|
@@ -49133,6 +49189,54 @@ function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, dura
|
|
|
49133
49189
|
return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
|
|
49134
49190
|
});
|
|
49135
49191
|
}
|
|
49192
|
+
/**
|
|
49193
|
+
* Filters out null fields from a fields object (null indicates field doesn't exist in L2).
|
|
49194
|
+
* Returns a new object without null values, or the original if no filtering needed.
|
|
49195
|
+
*/
|
|
49196
|
+
function filterNullFields(fields) {
|
|
49197
|
+
const keys$1 = keys$5(fields);
|
|
49198
|
+
let hasNull = false;
|
|
49199
|
+
// Check if any nulls exist before allocating new object
|
|
49200
|
+
for (let i = 0, len = keys$1.length; i < len; i += 1) {
|
|
49201
|
+
if (fields[keys$1[i]] === null) {
|
|
49202
|
+
hasNull = true;
|
|
49203
|
+
break;
|
|
49204
|
+
}
|
|
49205
|
+
}
|
|
49206
|
+
if (!hasNull) {
|
|
49207
|
+
return fields;
|
|
49208
|
+
}
|
|
49209
|
+
const cleaned = {};
|
|
49210
|
+
for (let i = 0, len = keys$1.length; i < len; i += 1) {
|
|
49211
|
+
const key = keys$1[i];
|
|
49212
|
+
if (fields[key] !== null) {
|
|
49213
|
+
cleaned[key] = fields[key];
|
|
49214
|
+
}
|
|
49215
|
+
}
|
|
49216
|
+
return cleaned;
|
|
49217
|
+
}
|
|
49218
|
+
/**
|
|
49219
|
+
* Merges new fields into existing fields object, skipping null values.
|
|
49220
|
+
* Creates a new object to avoid mutations.
|
|
49221
|
+
*/
|
|
49222
|
+
function mergeFieldsObjects(existing, incoming) {
|
|
49223
|
+
const merged = { ...existing };
|
|
49224
|
+
const keys$1 = keys$5(incoming);
|
|
49225
|
+
for (let i = 0, len = keys$1.length; i < len; i += 1) {
|
|
49226
|
+
const key = keys$1[i];
|
|
49227
|
+
// Skip null values - they indicate the field doesn't exist in L2
|
|
49228
|
+
if (incoming[key] !== null) {
|
|
49229
|
+
merged[key] = incoming[key];
|
|
49230
|
+
}
|
|
49231
|
+
}
|
|
49232
|
+
return merged;
|
|
49233
|
+
}
|
|
49234
|
+
/**
|
|
49235
|
+
* Type guard to check if value is a non-null object.
|
|
49236
|
+
*/
|
|
49237
|
+
function isObject$1(value) {
|
|
49238
|
+
return typeof value === 'object' && value !== null;
|
|
49239
|
+
}
|
|
49136
49240
|
/**
|
|
49137
49241
|
* Creates a put function that merges filtered fields with existing L1 records instead of replacing them.
|
|
49138
49242
|
* This is used when reviving filtered fields from L2 to preserve existing data in L1.
|
|
@@ -49140,28 +49244,36 @@ function reviveSnapshot(baseEnvironment, durableStore, unavailableSnapshot, dura
|
|
|
49140
49244
|
function createMergeFilteredPut(readEntry, storePut) {
|
|
49141
49245
|
return (key, filteredData) => {
|
|
49142
49246
|
const existingRecord = readEntry(key);
|
|
49143
|
-
if
|
|
49144
|
-
|
|
49145
|
-
|
|
49146
|
-
|
|
49147
|
-
|
|
49148
|
-
|
|
49149
|
-
const
|
|
49150
|
-
|
|
49151
|
-
|
|
49152
|
-
|
|
49153
|
-
|
|
49154
|
-
|
|
49155
|
-
|
|
49156
|
-
|
|
49157
|
-
|
|
49158
|
-
|
|
49159
|
-
|
|
49247
|
+
// Merge with existing record if both are objects
|
|
49248
|
+
if (isObject$1(existingRecord) && isObject$1(filteredData)) {
|
|
49249
|
+
// Create target object (copy if frozen to avoid mutation errors)
|
|
49250
|
+
const targetObj = isFrozen$1$1(existingRecord)
|
|
49251
|
+
? { ...existingRecord }
|
|
49252
|
+
: existingRecord;
|
|
49253
|
+
const keys$1 = keys$5(filteredData);
|
|
49254
|
+
for (let i = 0, len = keys$1.length; i < len; i += 1) {
|
|
49255
|
+
const fieldKey = keys$1[i];
|
|
49256
|
+
const incomingValue = filteredData[fieldKey];
|
|
49257
|
+
// Special handling for 'fields' property to merge rather than replace
|
|
49258
|
+
if (fieldKey === 'fields' &&
|
|
49259
|
+
isObject$1(incomingValue) &&
|
|
49260
|
+
isObject$1(targetObj[fieldKey])) {
|
|
49261
|
+
targetObj[fieldKey] = mergeFieldsObjects(targetObj[fieldKey], incomingValue);
|
|
49262
|
+
}
|
|
49263
|
+
else {
|
|
49264
|
+
targetObj[fieldKey] = incomingValue;
|
|
49265
|
+
}
|
|
49160
49266
|
}
|
|
49161
49267
|
storePut(key, targetObj);
|
|
49162
49268
|
}
|
|
49163
49269
|
else {
|
|
49164
|
-
// No existing record
|
|
49270
|
+
// No existing record - clean null fields before storing
|
|
49271
|
+
if (isObject$1(filteredData) && 'fields' in filteredData) {
|
|
49272
|
+
const fields = filteredData.fields;
|
|
49273
|
+
if (isObject$1(fields)) {
|
|
49274
|
+
filteredData.fields = filterNullFields(fields);
|
|
49275
|
+
}
|
|
49276
|
+
}
|
|
49165
49277
|
storePut(key, filteredData);
|
|
49166
49278
|
}
|
|
49167
49279
|
};
|
|
@@ -49175,16 +49287,101 @@ function extractRequestedFieldNames(selections) {
|
|
|
49175
49287
|
return undefined;
|
|
49176
49288
|
}
|
|
49177
49289
|
// Find the 'fields' ObjectSelection
|
|
49178
|
-
|
|
49179
|
-
|
|
49290
|
+
let fieldsSelection;
|
|
49291
|
+
for (let i = 0, len = selections.length; i < len; i += 1) {
|
|
49292
|
+
const sel = selections[i];
|
|
49293
|
+
if (sel.kind === 'Object' && sel.name === 'fields') {
|
|
49294
|
+
fieldsSelection = sel;
|
|
49295
|
+
break;
|
|
49296
|
+
}
|
|
49297
|
+
}
|
|
49298
|
+
if (!fieldsSelection ||
|
|
49299
|
+
!fieldsSelection.selections ||
|
|
49300
|
+
fieldsSelection.selections.length === 0) {
|
|
49180
49301
|
return undefined;
|
|
49181
49302
|
}
|
|
49182
49303
|
// Extract all field names from the fields selections
|
|
49304
|
+
const fieldSelections = fieldsSelection.selections;
|
|
49183
49305
|
const fieldNames = new Set();
|
|
49184
|
-
for (
|
|
49185
|
-
fieldNames.add(
|
|
49306
|
+
for (let i = 0, len = fieldSelections.length; i < len; i += 1) {
|
|
49307
|
+
fieldNames.add(fieldSelections[i].name);
|
|
49308
|
+
}
|
|
49309
|
+
return fieldNames;
|
|
49310
|
+
}
|
|
49311
|
+
/**
|
|
49312
|
+
* Extracts nested field requirements for spanning fields.
|
|
49313
|
+
* For spanning fields like Case.CreatedBy.Name, we need to extract what fields
|
|
49314
|
+
* are requested from the nested record (User in this case).
|
|
49315
|
+
* The structure is: fields { CreatedBy { value (Link with fragment) { fields { Name } } } }
|
|
49316
|
+
*/
|
|
49317
|
+
function extractNestedFieldRequirements(selections) {
|
|
49318
|
+
if (!selections) {
|
|
49319
|
+
return undefined;
|
|
49320
|
+
}
|
|
49321
|
+
// Find the 'fields' ObjectSelection
|
|
49322
|
+
let fieldsSelection;
|
|
49323
|
+
for (let i = 0, len = selections.length; i < len; i += 1) {
|
|
49324
|
+
const sel = selections[i];
|
|
49325
|
+
if (sel.kind === 'Object' && sel.name === 'fields') {
|
|
49326
|
+
fieldsSelection = sel;
|
|
49327
|
+
break;
|
|
49328
|
+
}
|
|
49329
|
+
}
|
|
49330
|
+
if (!fieldsSelection || !fieldsSelection.selections) {
|
|
49331
|
+
return undefined;
|
|
49332
|
+
}
|
|
49333
|
+
let nestedFieldsMap;
|
|
49334
|
+
// Look for ObjectSelections within fields (these are spanning fields)
|
|
49335
|
+
const fieldSelections = fieldsSelection.selections;
|
|
49336
|
+
for (let i = 0, len = fieldSelections.length; i < len; i += 1) {
|
|
49337
|
+
const fieldSel = fieldSelections[i];
|
|
49338
|
+
if (fieldSel.kind !== 'Object') {
|
|
49339
|
+
continue;
|
|
49340
|
+
}
|
|
49341
|
+
const objSel = fieldSel;
|
|
49342
|
+
if (!objSel.selections) {
|
|
49343
|
+
continue;
|
|
49344
|
+
}
|
|
49345
|
+
// Look for the 'value' Link selection
|
|
49346
|
+
let valueLinkSelection;
|
|
49347
|
+
for (let j = 0, jlen = objSel.selections.length; j < jlen; j += 1) {
|
|
49348
|
+
const sel = objSel.selections[j];
|
|
49349
|
+
if (sel.kind === 'Link' && sel.name === 'value') {
|
|
49350
|
+
valueLinkSelection = sel;
|
|
49351
|
+
break;
|
|
49352
|
+
}
|
|
49353
|
+
}
|
|
49354
|
+
if (!valueLinkSelection || !('fragment' in valueLinkSelection)) {
|
|
49355
|
+
continue;
|
|
49356
|
+
}
|
|
49357
|
+
const fragment = valueLinkSelection.fragment;
|
|
49358
|
+
if (!fragment || !fragment.selections) {
|
|
49359
|
+
continue;
|
|
49360
|
+
}
|
|
49361
|
+
// Look for the 'fields' selection within the fragment
|
|
49362
|
+
let nestedFieldsSelection;
|
|
49363
|
+
for (let j = 0, jlen = fragment.selections.length; j < jlen; j += 1) {
|
|
49364
|
+
const sel = fragment.selections[j];
|
|
49365
|
+
if (sel.kind === 'Object' && sel.name === 'fields') {
|
|
49366
|
+
nestedFieldsSelection = sel;
|
|
49367
|
+
break;
|
|
49368
|
+
}
|
|
49369
|
+
}
|
|
49370
|
+
if (nestedFieldsSelection && nestedFieldsSelection.selections) {
|
|
49371
|
+
const nestedFields = new Set();
|
|
49372
|
+
for (const nestedFieldSel of nestedFieldsSelection.selections) {
|
|
49373
|
+
nestedFields.add(nestedFieldSel.name);
|
|
49374
|
+
}
|
|
49375
|
+
if (nestedFields.size > 0) {
|
|
49376
|
+
// Lazy initialize map only if we have nested fields
|
|
49377
|
+
if (!nestedFieldsMap) {
|
|
49378
|
+
nestedFieldsMap = new Map();
|
|
49379
|
+
}
|
|
49380
|
+
nestedFieldsMap.set(fieldSel.name, nestedFields);
|
|
49381
|
+
}
|
|
49382
|
+
}
|
|
49186
49383
|
}
|
|
49187
|
-
return
|
|
49384
|
+
return nestedFieldsMap;
|
|
49188
49385
|
}
|
|
49189
49386
|
|
|
49190
49387
|
const TTL_DURABLE_SEGMENT = 'TTL_DURABLE_SEGMENT';
|
|
@@ -91328,7 +91525,7 @@ function ldsParamsToString(params) {
|
|
|
91328
91525
|
else {
|
|
91329
91526
|
returnParams[key] = `${value}`;
|
|
91330
91527
|
}
|
|
91331
|
-
if (isObject$
|
|
91528
|
+
if (isObject$2(value) === true && keys$2$1(value).length > 0) {
|
|
91332
91529
|
returnParams[key] = stringify$4(value);
|
|
91333
91530
|
}
|
|
91334
91531
|
}
|
|
@@ -91381,7 +91578,7 @@ function isStatusOk(status) {
|
|
|
91381
91578
|
return status >= 200 && status <= 299;
|
|
91382
91579
|
}
|
|
91383
91580
|
// adapted from adapter-utils untrustedIsObject
|
|
91384
|
-
function isObject$
|
|
91581
|
+
function isObject$2(value) {
|
|
91385
91582
|
return typeof value === 'object' && value !== null && isArray$2$1(value) === false;
|
|
91386
91583
|
}
|
|
91387
91584
|
function stringifyIfPresent(value) {
|
|
@@ -98872,7 +99069,7 @@ function buildServiceDescriptor$b(luvio) {
|
|
|
98872
99069
|
},
|
|
98873
99070
|
};
|
|
98874
99071
|
}
|
|
98875
|
-
// version: 1.
|
|
99072
|
+
// version: 1.420.0-576a1ea316
|
|
98876
99073
|
|
|
98877
99074
|
/**
|
|
98878
99075
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -98898,7 +99095,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
98898
99095
|
},
|
|
98899
99096
|
};
|
|
98900
99097
|
}
|
|
98901
|
-
// version: 1.
|
|
99098
|
+
// version: 1.420.0-576a1ea316
|
|
98902
99099
|
|
|
98903
99100
|
/*!
|
|
98904
99101
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -101547,7 +101744,7 @@ register$1({
|
|
|
101547
101744
|
id: '@salesforce/lds-network-adapter',
|
|
101548
101745
|
instrument: instrument$2,
|
|
101549
101746
|
});
|
|
101550
|
-
// version: 1.
|
|
101747
|
+
// version: 1.420.0-fc658f6118
|
|
101551
101748
|
|
|
101552
101749
|
const { create: create$2, keys: keys$2 } = Object;
|
|
101553
101750
|
const { stringify, parse } = JSON;
|
|
@@ -109089,7 +109286,7 @@ function registerCallback(cb) {
|
|
|
109089
109286
|
cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
|
|
109090
109287
|
}
|
|
109091
109288
|
}
|
|
109092
|
-
// version: 1.
|
|
109289
|
+
// version: 1.420.0-576a1ea316
|
|
109093
109290
|
|
|
109094
109291
|
function createFragmentMap(documentNode) {
|
|
109095
109292
|
const fragments = {};
|
|
@@ -138314,7 +138511,7 @@ register$1({
|
|
|
138314
138511
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
138315
138512
|
instrument: instrument$1,
|
|
138316
138513
|
});
|
|
138317
|
-
// version: 1.
|
|
138514
|
+
// version: 1.420.0-576a1ea316
|
|
138318
138515
|
|
|
138319
138516
|
// On core the unstable adapters are re-exported with different names,
|
|
138320
138517
|
// we want to match them here.
|
|
@@ -138466,7 +138663,7 @@ withDefaultLuvio((luvio) => {
|
|
|
138466
138663
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
138467
138664
|
graphQLImperative = ldsAdapter;
|
|
138468
138665
|
});
|
|
138469
|
-
// version: 1.
|
|
138666
|
+
// version: 1.420.0-576a1ea316
|
|
138470
138667
|
|
|
138471
138668
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
138472
138669
|
__proto__: null,
|
|
@@ -139265,7 +139462,7 @@ const callbacks$1 = [];
|
|
|
139265
139462
|
function register(r) {
|
|
139266
139463
|
callbacks$1.forEach((callback) => callback(r));
|
|
139267
139464
|
}
|
|
139268
|
-
// version: 1.
|
|
139465
|
+
// version: 1.420.0-fc658f6118
|
|
139269
139466
|
|
|
139270
139467
|
/**
|
|
139271
139468
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -140581,4 +140778,4 @@ const { luvio } = getRuntime();
|
|
|
140581
140778
|
setDefaultLuvio({ luvio });
|
|
140582
140779
|
|
|
140583
140780
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
140584
|
-
// version: 1.
|
|
140781
|
+
// version: 1.420.0-fc658f6118
|
|
@@ -2357,7 +2357,7 @@
|
|
|
2357
2357
|
/**
|
|
2358
2358
|
* Checks if the given variable is an object
|
|
2359
2359
|
*/
|
|
2360
|
-
function isObject$
|
|
2360
|
+
function isObject$3(value) {
|
|
2361
2361
|
return typeof value === 'object' && value !== null;
|
|
2362
2362
|
}
|
|
2363
2363
|
|
|
@@ -2987,10 +2987,10 @@
|
|
|
2987
2987
|
}
|
|
2988
2988
|
if (fragment.opaque) {
|
|
2989
2989
|
this.checkIfChanged(result.value, { useDeepEquals: true });
|
|
2990
|
-
if (isObject$
|
|
2990
|
+
if (isObject$3(result.value) && !readerOpaqueReferenceMap.has(result.value)) {
|
|
2991
2991
|
readerOpaqueReferenceMap.set(result.value, this.opaqueCopy(result.value));
|
|
2992
2992
|
}
|
|
2993
|
-
const opaqueValue = isObject$
|
|
2993
|
+
const opaqueValue = isObject$3(result.value)
|
|
2994
2994
|
? readerOpaqueReferenceMap.get(result.value)
|
|
2995
2995
|
: result.value;
|
|
2996
2996
|
return {
|
|
@@ -4152,7 +4152,7 @@
|
|
|
4152
4152
|
}
|
|
4153
4153
|
return resourceParams;
|
|
4154
4154
|
}
|
|
4155
|
-
// engine version: 0.160.
|
|
4155
|
+
// engine version: 0.160.3-354dc58b
|
|
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.420.0-fc658f6118
|
|
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.420.0-fc658f6118
|
|
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.160.
|
|
5426
|
+
// engine version: 0.160.3-354dc58b
|
|
5427
5427
|
|
|
5428
5428
|
const { keys: ObjectKeys$4, create: ObjectCreate$4 } = Object;
|
|
5429
5429
|
|
|
@@ -35497,7 +35497,7 @@
|
|
|
35497
35497
|
throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
|
|
35498
35498
|
throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
|
|
35499
35499
|
});
|
|
35500
|
-
// version: 1.
|
|
35500
|
+
// version: 1.420.0-576a1ea316
|
|
35501
35501
|
|
|
35502
35502
|
var allowUpdatesForNonCachedRecords = {
|
|
35503
35503
|
isOpen: function (e) {
|
|
@@ -48928,7 +48928,7 @@
|
|
|
48928
48928
|
const MessagingDurableSegment = 'MESSAGING';
|
|
48929
48929
|
const MessageNotifyStoreUpdateAvailable = 'notifyStoreUpdateAvailable';
|
|
48930
48930
|
|
|
48931
|
-
const { keys: keys$5, create: create$5, assign: assign$4, freeze: freeze$2 } = Object;
|
|
48931
|
+
const { keys: keys$5, create: create$5, assign: assign$4, freeze: freeze$2, isFrozen: isFrozen$1$1 } = Object;
|
|
48932
48932
|
|
|
48933
48933
|
//Durable store error instrumentation key
|
|
48934
48934
|
const DURABLE_STORE_ERROR = 'durable-store-error';
|
|
@@ -49012,6 +49012,74 @@
|
|
|
49012
49012
|
}
|
|
49013
49013
|
return { revivedKeys, hadUnexpectedShape };
|
|
49014
49014
|
}
|
|
49015
|
+
/**
|
|
49016
|
+
* Extracts field filtering configuration from the selection.
|
|
49017
|
+
*/
|
|
49018
|
+
function extractFieldFilteringConfig(select, recordId, baseEnvironment) {
|
|
49019
|
+
const rootRecordKey = serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(recordId));
|
|
49020
|
+
let topLevelFields;
|
|
49021
|
+
let nestedFieldRequirements;
|
|
49022
|
+
if (select &&
|
|
49023
|
+
select.node.kind === 'Fragment' &&
|
|
49024
|
+
'selections' in select.node &&
|
|
49025
|
+
select.node.selections) {
|
|
49026
|
+
topLevelFields = extractRequestedFieldNames(select.node.selections);
|
|
49027
|
+
nestedFieldRequirements = extractNestedFieldRequirements(select.node.selections);
|
|
49028
|
+
}
|
|
49029
|
+
// Merge all nested field requirements into a single set
|
|
49030
|
+
let nestedFields;
|
|
49031
|
+
if (nestedFieldRequirements && nestedFieldRequirements.size > 0) {
|
|
49032
|
+
nestedFields = new Set();
|
|
49033
|
+
for (const fieldSet of nestedFieldRequirements.values()) {
|
|
49034
|
+
for (const field of fieldSet) {
|
|
49035
|
+
nestedFields.add(field);
|
|
49036
|
+
}
|
|
49037
|
+
}
|
|
49038
|
+
}
|
|
49039
|
+
return { rootRecordKey, topLevelFields, nestedFields };
|
|
49040
|
+
}
|
|
49041
|
+
/**
|
|
49042
|
+
* Categorizes keys into different fetch strategies based on filtering requirements.
|
|
49043
|
+
*/
|
|
49044
|
+
function categorizeKeysForL2Fetch(keysToRevive, config, baseEnvironment, shouldFilterFields) {
|
|
49045
|
+
const unfilteredKeys = [];
|
|
49046
|
+
const rootKeysWithTopLevelFields = [];
|
|
49047
|
+
const nestedKeysWithNestedFields = [];
|
|
49048
|
+
const canFilter = config.topLevelFields !== undefined && config.topLevelFields.size > 0;
|
|
49049
|
+
for (let i = 0, len = keysToRevive.length; i < len; i += 1) {
|
|
49050
|
+
const canonicalKey = serializeStructuredKey(baseEnvironment.storeGetCanonicalKey(keysToRevive[i]));
|
|
49051
|
+
if (!shouldFilterFields(canonicalKey) || !canFilter) {
|
|
49052
|
+
unfilteredKeys.push(canonicalKey);
|
|
49053
|
+
continue;
|
|
49054
|
+
}
|
|
49055
|
+
const isRootRecord = canonicalKey === config.rootRecordKey;
|
|
49056
|
+
if (isRootRecord) {
|
|
49057
|
+
rootKeysWithTopLevelFields.push(canonicalKey);
|
|
49058
|
+
}
|
|
49059
|
+
else if (config.nestedFields !== undefined && config.nestedFields.size > 0) {
|
|
49060
|
+
nestedKeysWithNestedFields.push(canonicalKey);
|
|
49061
|
+
}
|
|
49062
|
+
else {
|
|
49063
|
+
unfilteredKeys.push(canonicalKey);
|
|
49064
|
+
}
|
|
49065
|
+
}
|
|
49066
|
+
return { unfilteredKeys, rootKeysWithTopLevelFields, nestedKeysWithNestedFields };
|
|
49067
|
+
}
|
|
49068
|
+
/**
|
|
49069
|
+
* Builds L2 fetch promises for different key categories.
|
|
49070
|
+
*/
|
|
49071
|
+
function buildL2FetchPromises(categorizedKeys, config, durableStore) {
|
|
49072
|
+
const promises = [
|
|
49073
|
+
durableStore.getEntries(categorizedKeys.unfilteredKeys, DefaultDurableSegment),
|
|
49074
|
+
];
|
|
49075
|
+
if (config.topLevelFields && categorizedKeys.rootKeysWithTopLevelFields.length > 0) {
|
|
49076
|
+
promises.push(durableStore.getEntriesWithSpecificFields(categorizedKeys.rootKeysWithTopLevelFields, config.topLevelFields, DefaultDurableSegment));
|
|
49077
|
+
}
|
|
49078
|
+
if (config.nestedFields && categorizedKeys.nestedKeysWithNestedFields.length > 0) {
|
|
49079
|
+
promises.push(durableStore.getEntriesWithSpecificFields(categorizedKeys.nestedKeysWithNestedFields, config.nestedFields, DefaultDurableSegment));
|
|
49080
|
+
}
|
|
49081
|
+
return promises;
|
|
49082
|
+
}
|
|
49015
49083
|
/**
|
|
49016
49084
|
* This method returns a Promise to a snapshot that is revived from L2 cache. If
|
|
49017
49085
|
* L2 does not have the entries necessary to fulfill the snapshot then this method
|
|
@@ -49047,53 +49115,41 @@
|
|
|
49047
49115
|
const keysToRevive = keysToReviveSet.keysAsArray();
|
|
49048
49116
|
const start = Date.now();
|
|
49049
49117
|
const { l2Trips } = reviveMetrics;
|
|
49050
|
-
// Extract
|
|
49051
|
-
|
|
49052
|
-
|
|
49053
|
-
|
|
49054
|
-
|
|
49055
|
-
const
|
|
49056
|
-
|
|
49057
|
-
|
|
49058
|
-
|
|
49059
|
-
|
|
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]) => {
|
|
49118
|
+
// Extract field filtering requirements from the selection
|
|
49119
|
+
const fieldFilteringConfig = extractFieldFilteringConfig(select, recordId, baseEnvironment);
|
|
49120
|
+
// Categorize keys by how they should be fetched from L2
|
|
49121
|
+
const categorizedKeys = categorizeKeysForL2Fetch(keysToRevive, fieldFilteringConfig, baseEnvironment, shouldFilterFields);
|
|
49122
|
+
// Build fetch promises for each category
|
|
49123
|
+
const fetchPromises = buildL2FetchPromises(categorizedKeys, fieldFilteringConfig, durableStore);
|
|
49124
|
+
return Promise.all(fetchPromises).then(([durableRecords, filteredDurableRecords, nestedFilteredDurableRecords]) => {
|
|
49125
|
+
const totalKeysRequested = categorizedKeys.unfilteredKeys.length +
|
|
49126
|
+
categorizedKeys.rootKeysWithTopLevelFields.length +
|
|
49127
|
+
categorizedKeys.nestedKeysWithNestedFields.length;
|
|
49078
49128
|
l2Trips.push({
|
|
49079
49129
|
duration: Date.now() - start,
|
|
49080
|
-
keysRequestedCount:
|
|
49130
|
+
keysRequestedCount: totalKeysRequested,
|
|
49081
49131
|
});
|
|
49082
|
-
// Process
|
|
49132
|
+
// Process all three categories of records
|
|
49083
49133
|
const revivedKeys = new StoreKeySet();
|
|
49084
49134
|
let hadUnexpectedShape = false;
|
|
49085
|
-
// Process normal records
|
|
49135
|
+
// Process normal records (all fields)
|
|
49086
49136
|
if (durableRecords !== undefined) {
|
|
49087
49137
|
const normalResult = publishDurableStoreEntries(durableRecords, baseEnvironment.storePut.bind(baseEnvironment), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49088
49138
|
revivedKeys.merge(normalResult.revivedKeys);
|
|
49089
49139
|
hadUnexpectedShape = hadUnexpectedShape || normalResult.hadUnexpectedShape;
|
|
49090
49140
|
}
|
|
49091
|
-
// Process filtered records with merging
|
|
49141
|
+
// Process filtered records (root with top-level fields) with merging
|
|
49092
49142
|
if (filteredDurableRecords !== undefined) {
|
|
49093
49143
|
const filteredResult = publishDurableStoreEntries(filteredDurableRecords, createMergeFilteredPut((key) => baseEnvironment.store.readEntry(key), baseEnvironment.storePut.bind(baseEnvironment)), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49094
49144
|
revivedKeys.merge(filteredResult.revivedKeys);
|
|
49095
49145
|
hadUnexpectedShape = hadUnexpectedShape || filteredResult.hadUnexpectedShape;
|
|
49096
49146
|
}
|
|
49147
|
+
// Process nested filtered records with merging
|
|
49148
|
+
if (nestedFilteredDurableRecords !== undefined) {
|
|
49149
|
+
const nestedFilteredResult = publishDurableStoreEntries(nestedFilteredDurableRecords, createMergeFilteredPut((key) => baseEnvironment.store.readEntry(key), baseEnvironment.storePut.bind(baseEnvironment)), baseEnvironment.publishStoreMetadata.bind(baseEnvironment));
|
|
49150
|
+
revivedKeys.merge(nestedFilteredResult.revivedKeys);
|
|
49151
|
+
hadUnexpectedShape = hadUnexpectedShape || nestedFilteredResult.hadUnexpectedShape;
|
|
49152
|
+
}
|
|
49097
49153
|
// if the data coming back from DS had an unexpected shape then just
|
|
49098
49154
|
// return the L1 snapshot
|
|
49099
49155
|
if (hadUnexpectedShape === true) {
|
|
@@ -49139,6 +49195,54 @@
|
|
|
49139
49195
|
return { snapshot: unavailableSnapshot, metrics: reviveMetrics };
|
|
49140
49196
|
});
|
|
49141
49197
|
}
|
|
49198
|
+
/**
|
|
49199
|
+
* Filters out null fields from a fields object (null indicates field doesn't exist in L2).
|
|
49200
|
+
* Returns a new object without null values, or the original if no filtering needed.
|
|
49201
|
+
*/
|
|
49202
|
+
function filterNullFields(fields) {
|
|
49203
|
+
const keys$1 = keys$5(fields);
|
|
49204
|
+
let hasNull = false;
|
|
49205
|
+
// Check if any nulls exist before allocating new object
|
|
49206
|
+
for (let i = 0, len = keys$1.length; i < len; i += 1) {
|
|
49207
|
+
if (fields[keys$1[i]] === null) {
|
|
49208
|
+
hasNull = true;
|
|
49209
|
+
break;
|
|
49210
|
+
}
|
|
49211
|
+
}
|
|
49212
|
+
if (!hasNull) {
|
|
49213
|
+
return fields;
|
|
49214
|
+
}
|
|
49215
|
+
const cleaned = {};
|
|
49216
|
+
for (let i = 0, len = keys$1.length; i < len; i += 1) {
|
|
49217
|
+
const key = keys$1[i];
|
|
49218
|
+
if (fields[key] !== null) {
|
|
49219
|
+
cleaned[key] = fields[key];
|
|
49220
|
+
}
|
|
49221
|
+
}
|
|
49222
|
+
return cleaned;
|
|
49223
|
+
}
|
|
49224
|
+
/**
|
|
49225
|
+
* Merges new fields into existing fields object, skipping null values.
|
|
49226
|
+
* Creates a new object to avoid mutations.
|
|
49227
|
+
*/
|
|
49228
|
+
function mergeFieldsObjects(existing, incoming) {
|
|
49229
|
+
const merged = { ...existing };
|
|
49230
|
+
const keys$1 = keys$5(incoming);
|
|
49231
|
+
for (let i = 0, len = keys$1.length; i < len; i += 1) {
|
|
49232
|
+
const key = keys$1[i];
|
|
49233
|
+
// Skip null values - they indicate the field doesn't exist in L2
|
|
49234
|
+
if (incoming[key] !== null) {
|
|
49235
|
+
merged[key] = incoming[key];
|
|
49236
|
+
}
|
|
49237
|
+
}
|
|
49238
|
+
return merged;
|
|
49239
|
+
}
|
|
49240
|
+
/**
|
|
49241
|
+
* Type guard to check if value is a non-null object.
|
|
49242
|
+
*/
|
|
49243
|
+
function isObject$1(value) {
|
|
49244
|
+
return typeof value === 'object' && value !== null;
|
|
49245
|
+
}
|
|
49142
49246
|
/**
|
|
49143
49247
|
* Creates a put function that merges filtered fields with existing L1 records instead of replacing them.
|
|
49144
49248
|
* This is used when reviving filtered fields from L2 to preserve existing data in L1.
|
|
@@ -49146,28 +49250,36 @@
|
|
|
49146
49250
|
function createMergeFilteredPut(readEntry, storePut) {
|
|
49147
49251
|
return (key, filteredData) => {
|
|
49148
49252
|
const existingRecord = readEntry(key);
|
|
49149
|
-
if
|
|
49150
|
-
|
|
49151
|
-
|
|
49152
|
-
|
|
49153
|
-
|
|
49154
|
-
|
|
49155
|
-
const
|
|
49156
|
-
|
|
49157
|
-
|
|
49158
|
-
|
|
49159
|
-
|
|
49160
|
-
|
|
49161
|
-
|
|
49162
|
-
|
|
49163
|
-
|
|
49164
|
-
|
|
49165
|
-
|
|
49253
|
+
// Merge with existing record if both are objects
|
|
49254
|
+
if (isObject$1(existingRecord) && isObject$1(filteredData)) {
|
|
49255
|
+
// Create target object (copy if frozen to avoid mutation errors)
|
|
49256
|
+
const targetObj = isFrozen$1$1(existingRecord)
|
|
49257
|
+
? { ...existingRecord }
|
|
49258
|
+
: existingRecord;
|
|
49259
|
+
const keys$1 = keys$5(filteredData);
|
|
49260
|
+
for (let i = 0, len = keys$1.length; i < len; i += 1) {
|
|
49261
|
+
const fieldKey = keys$1[i];
|
|
49262
|
+
const incomingValue = filteredData[fieldKey];
|
|
49263
|
+
// Special handling for 'fields' property to merge rather than replace
|
|
49264
|
+
if (fieldKey === 'fields' &&
|
|
49265
|
+
isObject$1(incomingValue) &&
|
|
49266
|
+
isObject$1(targetObj[fieldKey])) {
|
|
49267
|
+
targetObj[fieldKey] = mergeFieldsObjects(targetObj[fieldKey], incomingValue);
|
|
49268
|
+
}
|
|
49269
|
+
else {
|
|
49270
|
+
targetObj[fieldKey] = incomingValue;
|
|
49271
|
+
}
|
|
49166
49272
|
}
|
|
49167
49273
|
storePut(key, targetObj);
|
|
49168
49274
|
}
|
|
49169
49275
|
else {
|
|
49170
|
-
// No existing record
|
|
49276
|
+
// No existing record - clean null fields before storing
|
|
49277
|
+
if (isObject$1(filteredData) && 'fields' in filteredData) {
|
|
49278
|
+
const fields = filteredData.fields;
|
|
49279
|
+
if (isObject$1(fields)) {
|
|
49280
|
+
filteredData.fields = filterNullFields(fields);
|
|
49281
|
+
}
|
|
49282
|
+
}
|
|
49171
49283
|
storePut(key, filteredData);
|
|
49172
49284
|
}
|
|
49173
49285
|
};
|
|
@@ -49181,16 +49293,101 @@
|
|
|
49181
49293
|
return undefined;
|
|
49182
49294
|
}
|
|
49183
49295
|
// Find the 'fields' ObjectSelection
|
|
49184
|
-
|
|
49185
|
-
|
|
49296
|
+
let fieldsSelection;
|
|
49297
|
+
for (let i = 0, len = selections.length; i < len; i += 1) {
|
|
49298
|
+
const sel = selections[i];
|
|
49299
|
+
if (sel.kind === 'Object' && sel.name === 'fields') {
|
|
49300
|
+
fieldsSelection = sel;
|
|
49301
|
+
break;
|
|
49302
|
+
}
|
|
49303
|
+
}
|
|
49304
|
+
if (!fieldsSelection ||
|
|
49305
|
+
!fieldsSelection.selections ||
|
|
49306
|
+
fieldsSelection.selections.length === 0) {
|
|
49186
49307
|
return undefined;
|
|
49187
49308
|
}
|
|
49188
49309
|
// Extract all field names from the fields selections
|
|
49310
|
+
const fieldSelections = fieldsSelection.selections;
|
|
49189
49311
|
const fieldNames = new Set();
|
|
49190
|
-
for (
|
|
49191
|
-
fieldNames.add(
|
|
49312
|
+
for (let i = 0, len = fieldSelections.length; i < len; i += 1) {
|
|
49313
|
+
fieldNames.add(fieldSelections[i].name);
|
|
49314
|
+
}
|
|
49315
|
+
return fieldNames;
|
|
49316
|
+
}
|
|
49317
|
+
/**
|
|
49318
|
+
* Extracts nested field requirements for spanning fields.
|
|
49319
|
+
* For spanning fields like Case.CreatedBy.Name, we need to extract what fields
|
|
49320
|
+
* are requested from the nested record (User in this case).
|
|
49321
|
+
* The structure is: fields { CreatedBy { value (Link with fragment) { fields { Name } } } }
|
|
49322
|
+
*/
|
|
49323
|
+
function extractNestedFieldRequirements(selections) {
|
|
49324
|
+
if (!selections) {
|
|
49325
|
+
return undefined;
|
|
49326
|
+
}
|
|
49327
|
+
// Find the 'fields' ObjectSelection
|
|
49328
|
+
let fieldsSelection;
|
|
49329
|
+
for (let i = 0, len = selections.length; i < len; i += 1) {
|
|
49330
|
+
const sel = selections[i];
|
|
49331
|
+
if (sel.kind === 'Object' && sel.name === 'fields') {
|
|
49332
|
+
fieldsSelection = sel;
|
|
49333
|
+
break;
|
|
49334
|
+
}
|
|
49335
|
+
}
|
|
49336
|
+
if (!fieldsSelection || !fieldsSelection.selections) {
|
|
49337
|
+
return undefined;
|
|
49338
|
+
}
|
|
49339
|
+
let nestedFieldsMap;
|
|
49340
|
+
// Look for ObjectSelections within fields (these are spanning fields)
|
|
49341
|
+
const fieldSelections = fieldsSelection.selections;
|
|
49342
|
+
for (let i = 0, len = fieldSelections.length; i < len; i += 1) {
|
|
49343
|
+
const fieldSel = fieldSelections[i];
|
|
49344
|
+
if (fieldSel.kind !== 'Object') {
|
|
49345
|
+
continue;
|
|
49346
|
+
}
|
|
49347
|
+
const objSel = fieldSel;
|
|
49348
|
+
if (!objSel.selections) {
|
|
49349
|
+
continue;
|
|
49350
|
+
}
|
|
49351
|
+
// Look for the 'value' Link selection
|
|
49352
|
+
let valueLinkSelection;
|
|
49353
|
+
for (let j = 0, jlen = objSel.selections.length; j < jlen; j += 1) {
|
|
49354
|
+
const sel = objSel.selections[j];
|
|
49355
|
+
if (sel.kind === 'Link' && sel.name === 'value') {
|
|
49356
|
+
valueLinkSelection = sel;
|
|
49357
|
+
break;
|
|
49358
|
+
}
|
|
49359
|
+
}
|
|
49360
|
+
if (!valueLinkSelection || !('fragment' in valueLinkSelection)) {
|
|
49361
|
+
continue;
|
|
49362
|
+
}
|
|
49363
|
+
const fragment = valueLinkSelection.fragment;
|
|
49364
|
+
if (!fragment || !fragment.selections) {
|
|
49365
|
+
continue;
|
|
49366
|
+
}
|
|
49367
|
+
// Look for the 'fields' selection within the fragment
|
|
49368
|
+
let nestedFieldsSelection;
|
|
49369
|
+
for (let j = 0, jlen = fragment.selections.length; j < jlen; j += 1) {
|
|
49370
|
+
const sel = fragment.selections[j];
|
|
49371
|
+
if (sel.kind === 'Object' && sel.name === 'fields') {
|
|
49372
|
+
nestedFieldsSelection = sel;
|
|
49373
|
+
break;
|
|
49374
|
+
}
|
|
49375
|
+
}
|
|
49376
|
+
if (nestedFieldsSelection && nestedFieldsSelection.selections) {
|
|
49377
|
+
const nestedFields = new Set();
|
|
49378
|
+
for (const nestedFieldSel of nestedFieldsSelection.selections) {
|
|
49379
|
+
nestedFields.add(nestedFieldSel.name);
|
|
49380
|
+
}
|
|
49381
|
+
if (nestedFields.size > 0) {
|
|
49382
|
+
// Lazy initialize map only if we have nested fields
|
|
49383
|
+
if (!nestedFieldsMap) {
|
|
49384
|
+
nestedFieldsMap = new Map();
|
|
49385
|
+
}
|
|
49386
|
+
nestedFieldsMap.set(fieldSel.name, nestedFields);
|
|
49387
|
+
}
|
|
49388
|
+
}
|
|
49192
49389
|
}
|
|
49193
|
-
return
|
|
49390
|
+
return nestedFieldsMap;
|
|
49194
49391
|
}
|
|
49195
49392
|
|
|
49196
49393
|
const TTL_DURABLE_SEGMENT = 'TTL_DURABLE_SEGMENT';
|
|
@@ -91334,7 +91531,7 @@
|
|
|
91334
91531
|
else {
|
|
91335
91532
|
returnParams[key] = `${value}`;
|
|
91336
91533
|
}
|
|
91337
|
-
if (isObject$
|
|
91534
|
+
if (isObject$2(value) === true && keys$2$1(value).length > 0) {
|
|
91338
91535
|
returnParams[key] = stringify$4(value);
|
|
91339
91536
|
}
|
|
91340
91537
|
}
|
|
@@ -91387,7 +91584,7 @@
|
|
|
91387
91584
|
return status >= 200 && status <= 299;
|
|
91388
91585
|
}
|
|
91389
91586
|
// adapted from adapter-utils untrustedIsObject
|
|
91390
|
-
function isObject$
|
|
91587
|
+
function isObject$2(value) {
|
|
91391
91588
|
return typeof value === 'object' && value !== null && isArray$2$1(value) === false;
|
|
91392
91589
|
}
|
|
91393
91590
|
function stringifyIfPresent(value) {
|
|
@@ -98878,7 +99075,7 @@
|
|
|
98878
99075
|
},
|
|
98879
99076
|
};
|
|
98880
99077
|
}
|
|
98881
|
-
// version: 1.
|
|
99078
|
+
// version: 1.420.0-576a1ea316
|
|
98882
99079
|
|
|
98883
99080
|
/**
|
|
98884
99081
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -98904,7 +99101,7 @@
|
|
|
98904
99101
|
},
|
|
98905
99102
|
};
|
|
98906
99103
|
}
|
|
98907
|
-
// version: 1.
|
|
99104
|
+
// version: 1.420.0-576a1ea316
|
|
98908
99105
|
|
|
98909
99106
|
/*!
|
|
98910
99107
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -101553,7 +101750,7 @@
|
|
|
101553
101750
|
id: '@salesforce/lds-network-adapter',
|
|
101554
101751
|
instrument: instrument$2,
|
|
101555
101752
|
});
|
|
101556
|
-
// version: 1.
|
|
101753
|
+
// version: 1.420.0-fc658f6118
|
|
101557
101754
|
|
|
101558
101755
|
const { create: create$2, keys: keys$2 } = Object;
|
|
101559
101756
|
const { stringify, parse } = JSON;
|
|
@@ -109095,7 +109292,7 @@
|
|
|
109095
109292
|
cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
|
|
109096
109293
|
}
|
|
109097
109294
|
}
|
|
109098
|
-
// version: 1.
|
|
109295
|
+
// version: 1.420.0-576a1ea316
|
|
109099
109296
|
|
|
109100
109297
|
function createFragmentMap(documentNode) {
|
|
109101
109298
|
const fragments = {};
|
|
@@ -138320,7 +138517,7 @@
|
|
|
138320
138517
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
138321
138518
|
instrument: instrument$1,
|
|
138322
138519
|
});
|
|
138323
|
-
// version: 1.
|
|
138520
|
+
// version: 1.420.0-576a1ea316
|
|
138324
138521
|
|
|
138325
138522
|
// On core the unstable adapters are re-exported with different names,
|
|
138326
138523
|
// we want to match them here.
|
|
@@ -138472,7 +138669,7 @@
|
|
|
138472
138669
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
138473
138670
|
graphQLImperative = ldsAdapter;
|
|
138474
138671
|
});
|
|
138475
|
-
// version: 1.
|
|
138672
|
+
// version: 1.420.0-576a1ea316
|
|
138476
138673
|
|
|
138477
138674
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
138478
138675
|
__proto__: null,
|
|
@@ -139271,7 +139468,7 @@
|
|
|
139271
139468
|
function register(r) {
|
|
139272
139469
|
callbacks$1.forEach((callback) => callback(r));
|
|
139273
139470
|
}
|
|
139274
|
-
// version: 1.
|
|
139471
|
+
// version: 1.420.0-fc658f6118
|
|
139275
139472
|
|
|
139276
139473
|
/**
|
|
139277
139474
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -140608,4 +140805,4 @@
|
|
|
140608
140805
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
140609
140806
|
|
|
140610
140807
|
}));
|
|
140611
|
-
// version: 1.
|
|
140808
|
+
// version: 1.420.0-fc658f6118
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-worker-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.420.0",
|
|
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.420.0",
|
|
39
|
+
"@salesforce/lds-adapters-uiapi": "^1.420.0",
|
|
40
|
+
"@salesforce/lds-default-luvio": "^1.420.0",
|
|
41
|
+
"@salesforce/lds-drafts": "^1.420.0",
|
|
42
|
+
"@salesforce/lds-graphql-parser": "^1.420.0",
|
|
43
|
+
"@salesforce/lds-luvio-engine": "^1.420.0",
|
|
44
|
+
"@salesforce/lds-runtime-mobile": "^1.420.0",
|
|
45
|
+
"@salesforce/nimbus-plugin-lds": "^1.420.0",
|
|
46
46
|
"ajv": "^8.11.0",
|
|
47
47
|
"glob": "^7.1.5",
|
|
48
48
|
"nimbus-types": "^2.0.0-alpha1",
|