@salesforce/lds-worker-api 1.248.0 → 1.249.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sfdc/es/ldsWorkerApi.js +11 -146
- package/dist/standalone/es/lds-worker-api.js +375 -445
- package/dist/standalone/umd/lds-worker-api.js +375 -445
- package/package.json +4 -4
|
@@ -25,12 +25,15 @@ const { hasOwnProperty: hasOwnProperty$3 } = Object.prototype;
|
|
|
25
25
|
const { isArray: isArray$9 } = Array;
|
|
26
26
|
const { push: push$5, indexOf, slice: slice$2 } = Array.prototype;
|
|
27
27
|
const { parse: parse$a, stringify: stringify$a } = JSON;
|
|
28
|
+
const WeakSetCtor = WeakSet;
|
|
28
29
|
|
|
30
|
+
const deeplyFrozen = new WeakSetCtor();
|
|
29
31
|
function deepFreeze(value) {
|
|
30
|
-
// No need to freeze primitives
|
|
31
|
-
if (typeof value !== 'object' || value === null) {
|
|
32
|
+
// No need to freeze primitives or already frozen stuff
|
|
33
|
+
if (typeof value !== 'object' || value === null || deeplyFrozen.has(value)) {
|
|
32
34
|
return;
|
|
33
35
|
}
|
|
36
|
+
deeplyFrozen.add(value);
|
|
34
37
|
if (isArray$9(value)) {
|
|
35
38
|
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
36
39
|
deepFreeze(value[i]);
|
|
@@ -575,6 +578,9 @@ class StringKeyInMemoryStore {
|
|
|
575
578
|
this.reverseRedirectKeys = create$b(null);
|
|
576
579
|
this.currentSnapshotId = 0;
|
|
577
580
|
this.scheduler = options.scheduler || buildDefaultScheduler();
|
|
581
|
+
if (options.initialData) {
|
|
582
|
+
this.deserialize(options.initialData, options.resetInitialDataTtls);
|
|
583
|
+
}
|
|
578
584
|
}
|
|
579
585
|
// interface methods
|
|
580
586
|
readEntry(key) {
|
|
@@ -1155,6 +1161,25 @@ class StringKeyInMemoryStore {
|
|
|
1155
1161
|
},
|
|
1156
1162
|
};
|
|
1157
1163
|
}
|
|
1164
|
+
deserialize(storeData, resetInitialDataTtls) {
|
|
1165
|
+
const luvioStoreData = storeData.luvioStoreData;
|
|
1166
|
+
if (Serialized_StringKey_Version === luvioStoreData.version) {
|
|
1167
|
+
this.records = luvioStoreData.data;
|
|
1168
|
+
this.metadata = this.calculateAndSetNewTTLs(luvioStoreData.metadata, resetInitialDataTtls);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
calculateAndSetNewTTLs(storeMetadata, resetInitialDataTtls) {
|
|
1172
|
+
if (resetInitialDataTtls === true) {
|
|
1173
|
+
const now = Date.now();
|
|
1174
|
+
keys$c(storeMetadata).forEach((key) => {
|
|
1175
|
+
const storeMetadataEntry = storeMetadata[key];
|
|
1176
|
+
const ttl = storeMetadataEntry.expirationTimestamp - storeMetadataEntry.ingestionTimestamp;
|
|
1177
|
+
storeMetadataEntry.ingestionTimestamp = now;
|
|
1178
|
+
storeMetadataEntry.expirationTimestamp = now + ttl;
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
return storeMetadata;
|
|
1182
|
+
}
|
|
1158
1183
|
}
|
|
1159
1184
|
|
|
1160
1185
|
function hasOverlappingIds(snapshot, visitedIds) {
|
|
@@ -1790,6 +1815,10 @@ class InMemoryStore {
|
|
|
1790
1815
|
}
|
|
1791
1816
|
}
|
|
1792
1817
|
markVisited(canonicalKey) {
|
|
1818
|
+
if (typeof canonicalKey === 'string') {
|
|
1819
|
+
this.fallbackStringKeyInMemoryStore.markVisited(canonicalKey);
|
|
1820
|
+
return;
|
|
1821
|
+
}
|
|
1793
1822
|
const { visitedIdsSet, reverseRedirectKeysMap } = this;
|
|
1794
1823
|
let redirectKey = canonicalKey;
|
|
1795
1824
|
// mark all redirects leading up to the canonical key as visited so
|
|
@@ -2105,7 +2134,7 @@ class GraphLink {
|
|
|
2105
2134
|
if (isStoreRecordError$1(linked)) {
|
|
2106
2135
|
return new GraphNodeError(this.store, linked);
|
|
2107
2136
|
}
|
|
2108
|
-
return new GraphNode(this.store, linked);
|
|
2137
|
+
return new GraphNode(this.store, linked, __ref);
|
|
2109
2138
|
}
|
|
2110
2139
|
linkData() {
|
|
2111
2140
|
return this.data.data;
|
|
@@ -2115,10 +2144,11 @@ class GraphLink {
|
|
|
2115
2144
|
}
|
|
2116
2145
|
}
|
|
2117
2146
|
class GraphNode {
|
|
2118
|
-
constructor(store, data) {
|
|
2147
|
+
constructor(store, data, storeKey) {
|
|
2119
2148
|
this.type = GraphNodeType$1.Node;
|
|
2120
2149
|
this.store = store;
|
|
2121
2150
|
this.data = data;
|
|
2151
|
+
this.storeKey = storeKey;
|
|
2122
2152
|
}
|
|
2123
2153
|
object(propertyName) {
|
|
2124
2154
|
const value = this.data[propertyName];
|
|
@@ -2128,7 +2158,8 @@ class GraphNode {
|
|
|
2128
2158
|
if (typeof value !== 'object' || value === null) {
|
|
2129
2159
|
throw new Error(`Cannot walk to path ${String(propertyName)}. "${String(propertyName)}" is a scalar: "${value}"`);
|
|
2130
2160
|
}
|
|
2131
|
-
|
|
2161
|
+
// We're walking to an object property on the current store record, pass the storeKey down.
|
|
2162
|
+
return new GraphNode(this.store, value, this.storeKey);
|
|
2132
2163
|
}
|
|
2133
2164
|
link(propertyName) {
|
|
2134
2165
|
const value = this.data[propertyName];
|
|
@@ -2158,6 +2189,8 @@ class GraphNode {
|
|
|
2158
2189
|
}
|
|
2159
2190
|
write(propertyName, value) {
|
|
2160
2191
|
this.data[propertyName] = value;
|
|
2192
|
+
const canonicalKey = this.store.getCanonicalRecordId(this.storeKey);
|
|
2193
|
+
this.store.markVisited(canonicalKey);
|
|
2161
2194
|
}
|
|
2162
2195
|
isUndefined(propertyName) {
|
|
2163
2196
|
return this.data[propertyName] === undefined;
|
|
@@ -3323,9 +3356,9 @@ class Environment {
|
|
|
3323
3356
|
if (value === undefined) {
|
|
3324
3357
|
return null;
|
|
3325
3358
|
}
|
|
3326
|
-
return this.wrapNormalizedGraphNode(value, store);
|
|
3359
|
+
return this.wrapNormalizedGraphNode(value, key, store);
|
|
3327
3360
|
}
|
|
3328
|
-
wrapNormalizedGraphNode(normalized, storeOverride) {
|
|
3361
|
+
wrapNormalizedGraphNode(normalized, key, storeOverride) {
|
|
3329
3362
|
if (normalized === null) {
|
|
3330
3363
|
return null;
|
|
3331
3364
|
}
|
|
@@ -3333,7 +3366,7 @@ class Environment {
|
|
|
3333
3366
|
if (isStoreRecordError$1(normalized)) {
|
|
3334
3367
|
return new GraphNodeError(store, normalized);
|
|
3335
3368
|
}
|
|
3336
|
-
return new GraphNode(store, normalized);
|
|
3369
|
+
return new GraphNode(store, normalized, key);
|
|
3337
3370
|
}
|
|
3338
3371
|
withContext(adapter, options) {
|
|
3339
3372
|
const { contextId, onContextLoaded } = options;
|
|
@@ -3631,8 +3664,8 @@ class Luvio {
|
|
|
3631
3664
|
getNode(key) {
|
|
3632
3665
|
return this.environment.getNode(key);
|
|
3633
3666
|
}
|
|
3634
|
-
wrapNormalizedGraphNode(normalized) {
|
|
3635
|
-
return this.environment.wrapNormalizedGraphNode(normalized);
|
|
3667
|
+
wrapNormalizedGraphNode(normalized, key) {
|
|
3668
|
+
return this.environment.wrapNormalizedGraphNode(normalized, key);
|
|
3636
3669
|
}
|
|
3637
3670
|
instrument(paramsBuilder) {
|
|
3638
3671
|
const { instrument } = this.options;
|
|
@@ -3943,7 +3976,7 @@ function createResourceParamsImpl(config, configMetadata) {
|
|
|
3943
3976
|
}
|
|
3944
3977
|
return resourceParams;
|
|
3945
3978
|
}
|
|
3946
|
-
// engine version: 0.
|
|
3979
|
+
// engine version: 0.152.2-f6f687b3
|
|
3947
3980
|
|
|
3948
3981
|
/**
|
|
3949
3982
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4071,7 +4104,7 @@ function withDefaultLuvio(callback) {
|
|
|
4071
4104
|
}
|
|
4072
4105
|
callbacks.push(callback);
|
|
4073
4106
|
}
|
|
4074
|
-
// version: 1.
|
|
4107
|
+
// version: 1.249.0-11c3e1ed5
|
|
4075
4108
|
|
|
4076
4109
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4077
4110
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15579,7 +15612,7 @@ function gql(literals, ...subs) {
|
|
|
15579
15612
|
}
|
|
15580
15613
|
return superResult;
|
|
15581
15614
|
}
|
|
15582
|
-
// version: 1.
|
|
15615
|
+
// version: 1.249.0-11c3e1ed5
|
|
15583
15616
|
|
|
15584
15617
|
function unwrap(data) {
|
|
15585
15618
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16504,7 +16537,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
|
|
|
16504
16537
|
const { apiFamily, name } = metadata;
|
|
16505
16538
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16506
16539
|
}
|
|
16507
|
-
// version: 1.
|
|
16540
|
+
// version: 1.249.0-11c3e1ed5
|
|
16508
16541
|
|
|
16509
16542
|
/**
|
|
16510
16543
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -16603,7 +16636,7 @@ var TypeCheckShapes;
|
|
|
16603
16636
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
16604
16637
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
16605
16638
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
16606
|
-
// engine version: 0.
|
|
16639
|
+
// engine version: 0.152.2-f6f687b3
|
|
16607
16640
|
|
|
16608
16641
|
const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
|
|
16609
16642
|
|
|
@@ -20075,22 +20108,12 @@ function _markMissingPath(record, path) {
|
|
|
20075
20108
|
const fieldValueRepresentation = record.object('fields');
|
|
20076
20109
|
const fieldName = path.shift();
|
|
20077
20110
|
if (fieldValueRepresentation.isUndefined(fieldName) === true) {
|
|
20078
|
-
|
|
20079
|
-
// an undefined/non-present __ref if isMissing is present
|
|
20080
|
-
fieldValueRepresentation.write(fieldName, {
|
|
20081
|
-
__ref: undefined,
|
|
20082
|
-
isMissing: true,
|
|
20083
|
-
});
|
|
20111
|
+
writeMissingFieldToStore(fieldValueRepresentation, fieldName);
|
|
20084
20112
|
return;
|
|
20085
20113
|
}
|
|
20086
20114
|
const link = fieldValueRepresentation.link(fieldName);
|
|
20087
20115
|
if (link.isPending()) {
|
|
20088
|
-
|
|
20089
|
-
// an undefined/non-present __ref if isMissing is present
|
|
20090
|
-
fieldValueRepresentation.write(fieldName, {
|
|
20091
|
-
__ref: undefined,
|
|
20092
|
-
isMissing: true,
|
|
20093
|
-
});
|
|
20116
|
+
writeMissingFieldToStore(fieldValueRepresentation, fieldName);
|
|
20094
20117
|
}
|
|
20095
20118
|
else if (path.length > 0 && link.isMissing() === false) {
|
|
20096
20119
|
const fieldValue = link.follow();
|
|
@@ -20106,6 +20129,19 @@ function _markMissingPath(record, path) {
|
|
|
20106
20129
|
}
|
|
20107
20130
|
}
|
|
20108
20131
|
}
|
|
20132
|
+
/**
|
|
20133
|
+
* Graph Node Directly modifies store entries, which is generally a non-starter.
|
|
20134
|
+
* Until we can refactor this mess, you need to use this function to safely mark the RecordRepresentation
|
|
20135
|
+
* as a seenId in the store when you perform this mutation.
|
|
20136
|
+
*/
|
|
20137
|
+
function writeMissingFieldToStore(field, fieldName) {
|
|
20138
|
+
// TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
|
|
20139
|
+
// an undefined/non-present __ref if isMissing is present
|
|
20140
|
+
field.write(fieldName, {
|
|
20141
|
+
__ref: undefined,
|
|
20142
|
+
isMissing: true,
|
|
20143
|
+
});
|
|
20144
|
+
}
|
|
20109
20145
|
/**
|
|
20110
20146
|
* Tells you if an objectApiName is supported by UI API or not.
|
|
20111
20147
|
* Note: Luvio does not currently support all the entities, the list is limited to UI API supported entities
|
|
@@ -20257,8 +20293,11 @@ function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTr
|
|
|
20257
20293
|
return existing;
|
|
20258
20294
|
}
|
|
20259
20295
|
function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
|
|
20260
|
-
const
|
|
20261
|
-
|
|
20296
|
+
const recordKey = keyBuilder$1$(luvio, {
|
|
20297
|
+
recordId: incoming.id,
|
|
20298
|
+
});
|
|
20299
|
+
const incomingNode = luvio.wrapNormalizedGraphNode(incoming, recordKey);
|
|
20300
|
+
const existingNode = luvio.wrapNormalizedGraphNode(existing, recordKey);
|
|
20262
20301
|
const incomingTrackedFieldsTrieRoot = {
|
|
20263
20302
|
name: incoming.apiName,
|
|
20264
20303
|
children: {},
|
|
@@ -20267,9 +20306,6 @@ function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
|
|
|
20267
20306
|
name: existing.apiName,
|
|
20268
20307
|
children: {},
|
|
20269
20308
|
};
|
|
20270
|
-
const recordKey = keyBuilder$1$(luvio, {
|
|
20271
|
-
recordId: incoming.id,
|
|
20272
|
-
});
|
|
20273
20309
|
const trackedFieldsConfig = {
|
|
20274
20310
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMergeConflict(),
|
|
20275
20311
|
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
@@ -20794,10 +20830,11 @@ function buildCachedSnapshotCachePolicy$N(context, storeLookup) {
|
|
|
20794
20830
|
}
|
|
20795
20831
|
function buildNetworkSnapshotCachePolicy$N(context, coercedAdapterRequestContext) {
|
|
20796
20832
|
const { config, luvio } = context;
|
|
20797
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
20833
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
20798
20834
|
const dispatchOptions = {
|
|
20799
20835
|
resourceRequestContext: {
|
|
20800
20836
|
requestCorrelator,
|
|
20837
|
+
sourceContext,
|
|
20801
20838
|
},
|
|
20802
20839
|
eventObservers,
|
|
20803
20840
|
};
|
|
@@ -23275,10 +23312,11 @@ function buildCachedListUiSnapshot$1(context, storeLookup) {
|
|
|
23275
23312
|
}
|
|
23276
23313
|
function buildNetworkListUiSnapshot$1(context, coercedAdapterRequestContext) {
|
|
23277
23314
|
const { config, listInfo, listUi, luvio } = context;
|
|
23278
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
23315
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
23279
23316
|
const dispatchOptions = {
|
|
23280
23317
|
resourceRequestContext: {
|
|
23281
23318
|
requestCorrelator,
|
|
23319
|
+
sourceContext,
|
|
23282
23320
|
},
|
|
23283
23321
|
eventObservers,
|
|
23284
23322
|
};
|
|
@@ -23639,10 +23677,11 @@ function buildCachedListUiSnapshot(context, storeLookup) {
|
|
|
23639
23677
|
}
|
|
23640
23678
|
function buildNetworkListUiSnapshot(context, coercedAdapterRequestContext) {
|
|
23641
23679
|
const { adapterContext, config, listInfo, listUi, luvio } = context;
|
|
23642
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
23680
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
23643
23681
|
const dispatchOptions = {
|
|
23644
23682
|
resourceRequestContext: {
|
|
23645
23683
|
requestCorrelator,
|
|
23684
|
+
sourceContext,
|
|
23646
23685
|
},
|
|
23647
23686
|
eventObservers,
|
|
23648
23687
|
};
|
|
@@ -24893,10 +24932,11 @@ function buildCachedRecordUiRepresentationSnapshot(context, storeLookup) {
|
|
|
24893
24932
|
}
|
|
24894
24933
|
}
|
|
24895
24934
|
function buildNetworkRecordUiRepresentationSnapshot(context, coercedAdapterRequestContext) {
|
|
24896
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
24935
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
24897
24936
|
const dispatchOptions = {
|
|
24898
24937
|
resourceRequestContext: {
|
|
24899
24938
|
requestCorrelator,
|
|
24939
|
+
sourceContext,
|
|
24900
24940
|
},
|
|
24901
24941
|
eventObservers,
|
|
24902
24942
|
};
|
|
@@ -25099,10 +25139,11 @@ function buildNetworkSnapshot$Z(context, coercedAdapterRequestContext) {
|
|
|
25099
25139
|
const { recordId } = config;
|
|
25100
25140
|
const optionalFields = config.optionalFields === undefined ? [] : dedupe$2(config.optionalFields).sort();
|
|
25101
25141
|
const refresh = buildSnapshotRefresh$3(luvio, config);
|
|
25102
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
25142
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
25103
25143
|
const dispatchOptions = {
|
|
25104
25144
|
resourceRequestContext: {
|
|
25105
25145
|
requestCorrelator,
|
|
25146
|
+
sourceContext,
|
|
25106
25147
|
},
|
|
25107
25148
|
eventObservers,
|
|
25108
25149
|
};
|
|
@@ -25414,7 +25455,7 @@ const notifyChangeFactory = (luvio) => {
|
|
|
25414
25455
|
const responsePromises = [];
|
|
25415
25456
|
for (let i = 0, len = entries.length; i < len; i++) {
|
|
25416
25457
|
const { key, record } = entries[i];
|
|
25417
|
-
const node = luvio.wrapNormalizedGraphNode(record);
|
|
25458
|
+
const node = luvio.wrapNormalizedGraphNode(record, key);
|
|
25418
25459
|
const optionalFields = getTrackedFields(key, node, {
|
|
25419
25460
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnNotifyChange(),
|
|
25420
25461
|
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
@@ -32793,10 +32834,11 @@ function buildCachedSnapshot$3(luvio, config) {
|
|
|
32793
32834
|
}
|
|
32794
32835
|
function buildNetworkSnapshotCachePolicy$m(context, coercedAdapterRequestContext) {
|
|
32795
32836
|
const { config, luvio } = context;
|
|
32796
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
32837
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
32797
32838
|
const dispatchOptions = {
|
|
32798
32839
|
resourceRequestContext: {
|
|
32799
32840
|
requestCorrelator,
|
|
32841
|
+
sourceContext,
|
|
32800
32842
|
},
|
|
32801
32843
|
eventObservers,
|
|
32802
32844
|
};
|
|
@@ -33904,10 +33946,11 @@ function buildNetworkSnapshotCachePolicy$k(context, coercedAdapterRequestContext
|
|
|
33904
33946
|
if (uncachedRecordIds !== undefined) {
|
|
33905
33947
|
config.uncachedRecordIds = uncachedRecordIds;
|
|
33906
33948
|
}
|
|
33907
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
33949
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
33908
33950
|
const dispatchOptions = {
|
|
33909
33951
|
resourceRequestContext: {
|
|
33910
33952
|
requestCorrelator,
|
|
33953
|
+
sourceContext,
|
|
33911
33954
|
},
|
|
33912
33955
|
eventObservers,
|
|
33913
33956
|
};
|
|
@@ -38307,14 +38350,15 @@ const getLookupMetadataAdapterFactory = (luvio) => function UiApi__getLookupMeta
|
|
|
38307
38350
|
};
|
|
38308
38351
|
|
|
38309
38352
|
const TTL$6 = 200;
|
|
38310
|
-
const VERSION$9$1 = "
|
|
38353
|
+
const VERSION$9$1 = "877ca614d967f458099a6ae606b1cd1b";
|
|
38311
38354
|
const RepresentationType$9 = 'SearchResultsSummaryRepresentation';
|
|
38312
38355
|
function keyBuilder$g$1(luvio, config) {
|
|
38313
|
-
return keyPrefix$2 + '::' + RepresentationType$9 + ':' + config.query;
|
|
38356
|
+
return keyPrefix$2 + '::' + RepresentationType$9 + ':' + config.query + ':' + (config.configurationName === null ? '' : config.configurationName);
|
|
38314
38357
|
}
|
|
38315
38358
|
function keyBuilderFromType$6(luvio, object) {
|
|
38316
38359
|
const keyParams = {
|
|
38317
|
-
query: object.query
|
|
38360
|
+
query: object.query,
|
|
38361
|
+
configurationName: object.configurationName
|
|
38318
38362
|
};
|
|
38319
38363
|
return keyBuilder$g$1(luvio, keyParams);
|
|
38320
38364
|
}
|
|
@@ -38356,7 +38400,8 @@ function select$9$1(luvio, params) {
|
|
|
38356
38400
|
}
|
|
38357
38401
|
function keyBuilder$f$1(luvio, params) {
|
|
38358
38402
|
return keyBuilder$g$1(luvio, {
|
|
38359
|
-
query: params.queryParams.q
|
|
38403
|
+
query: params.queryParams.q,
|
|
38404
|
+
configurationName: params.body.configurationName || null
|
|
38360
38405
|
});
|
|
38361
38406
|
}
|
|
38362
38407
|
function getResponseCacheKeys$c(storeKeyMap, luvio, resourceParams, response) {
|
|
@@ -38404,6 +38449,7 @@ const adapterName$c = 'getSearchResults';
|
|
|
38404
38449
|
const getSearchResults_ConfigPropertyMetadata = [
|
|
38405
38450
|
generateParamConfigMetadata$2('q', true, 1 /* QueryParameter */, 0 /* String */),
|
|
38406
38451
|
generateParamConfigMetadata$2('answerTypes', false, 2 /* Body */, 0 /* String */, true),
|
|
38452
|
+
generateParamConfigMetadata$2('configurationName', false, 2 /* Body */, 0 /* String */),
|
|
38407
38453
|
generateParamConfigMetadata$2('objectApiNames', false, 2 /* Body */, 0 /* String */, true),
|
|
38408
38454
|
];
|
|
38409
38455
|
const getSearchResults_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig$2(adapterName$c, getSearchResults_ConfigPropertyMetadata);
|
|
@@ -38555,15 +38601,16 @@ function validate$b(obj, path = 'SearchFilterInputRepresentation') {
|
|
|
38555
38601
|
}
|
|
38556
38602
|
|
|
38557
38603
|
const TTL$5 = 200;
|
|
38558
|
-
const VERSION$8$1 = "
|
|
38604
|
+
const VERSION$8$1 = "3102453bf10ea449d9665914d5f5febf";
|
|
38559
38605
|
const RepresentationType$8 = 'KeywordSearchResultsSummaryRepresentation';
|
|
38560
38606
|
function keyBuilder$d$1(luvio, config) {
|
|
38561
|
-
return keyPrefix$2 + '::' + RepresentationType$8 + ':' + config.query + ':' + config.objectApiName;
|
|
38607
|
+
return keyPrefix$2 + '::' + RepresentationType$8 + ':' + config.query + ':' + config.objectApiName + ':' + (config.configurationName === null ? '' : config.configurationName);
|
|
38562
38608
|
}
|
|
38563
38609
|
function keyBuilderFromType$5(luvio, object) {
|
|
38564
38610
|
const keyParams = {
|
|
38565
38611
|
query: object.query,
|
|
38566
|
-
objectApiName: object.objectApiName
|
|
38612
|
+
objectApiName: object.objectApiName,
|
|
38613
|
+
configurationName: object.configurationName
|
|
38567
38614
|
};
|
|
38568
38615
|
return keyBuilder$d$1(luvio, keyParams);
|
|
38569
38616
|
}
|
|
@@ -38606,7 +38653,8 @@ function select$7$1(luvio, params) {
|
|
|
38606
38653
|
function keyBuilder$c$1(luvio, params) {
|
|
38607
38654
|
return keyBuilder$d$1(luvio, {
|
|
38608
38655
|
query: params.queryParams.q,
|
|
38609
|
-
objectApiName: params.queryParams.objectApiName
|
|
38656
|
+
objectApiName: params.queryParams.objectApiName,
|
|
38657
|
+
configurationName: params.body.configurationName || null
|
|
38610
38658
|
});
|
|
38611
38659
|
}
|
|
38612
38660
|
function getResponseCacheKeys$b(storeKeyMap, luvio, resourceParams, response) {
|
|
@@ -38654,6 +38702,7 @@ const adapterName$b = 'getKeywordSearchResults';
|
|
|
38654
38702
|
const getKeywordSearchResults_ConfigPropertyMetadata = [
|
|
38655
38703
|
generateParamConfigMetadata$2('objectApiName', true, 1 /* QueryParameter */, 0 /* String */),
|
|
38656
38704
|
generateParamConfigMetadata$2('q', true, 1 /* QueryParameter */, 0 /* String */),
|
|
38705
|
+
generateParamConfigMetadata$2('configurationName', false, 2 /* Body */, 0 /* String */),
|
|
38657
38706
|
generateParamConfigMetadata$2('filters', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
38658
38707
|
generateParamConfigMetadata$2('pageSize', false, 2 /* Body */, 3 /* Integer */),
|
|
38659
38708
|
generateParamConfigMetadata$2('pageToken', false, 2 /* Body */, 0 /* String */),
|
|
@@ -40514,10 +40563,11 @@ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
|
40514
40563
|
}
|
|
40515
40564
|
function buildNetworkSnapshotCachePolicy$2$1(context, coercedAdapterRequestContext) {
|
|
40516
40565
|
const { config, adapterContext, luvio } = context;
|
|
40517
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
40566
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
40518
40567
|
const dispatchOptions = {
|
|
40519
40568
|
resourceRequestContext: {
|
|
40520
40569
|
requestCorrelator,
|
|
40570
|
+
sourceContext,
|
|
40521
40571
|
},
|
|
40522
40572
|
eventObservers,
|
|
40523
40573
|
};
|
|
@@ -41043,10 +41093,11 @@ const buildCachedSnapshot$1 = (luvio, context, config) => {
|
|
|
41043
41093
|
};
|
|
41044
41094
|
function buildNetworkSnapshotCachePolicy$1$1(context, coercedAdapterRequestContext) {
|
|
41045
41095
|
const { config, adapterContext, luvio } = context;
|
|
41046
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
41096
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
41047
41097
|
const dispatchOptions = {
|
|
41048
41098
|
resourceRequestContext: {
|
|
41049
41099
|
requestCorrelator,
|
|
41100
|
+
sourceContext,
|
|
41050
41101
|
},
|
|
41051
41102
|
eventObservers,
|
|
41052
41103
|
};
|
|
@@ -41583,10 +41634,11 @@ function buildCachedSnapshot$9(luvio, context, config) {
|
|
|
41583
41634
|
}
|
|
41584
41635
|
const buildNetworkSnapshotCachePolicy$O = (context, coercedAdapterRequestContext) => {
|
|
41585
41636
|
const { config, adapterContext, luvio } = context;
|
|
41586
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
41637
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
41587
41638
|
const dispatchOptions = {
|
|
41588
41639
|
resourceRequestContext: {
|
|
41589
41640
|
requestCorrelator,
|
|
41641
|
+
sourceContext,
|
|
41590
41642
|
},
|
|
41591
41643
|
eventObservers,
|
|
41592
41644
|
};
|
|
@@ -42287,10 +42339,11 @@ function createDispatchResourceRequestContext$1(requestContext) {
|
|
|
42287
42339
|
let dispatchOptions = undefined;
|
|
42288
42340
|
if (requestContext !== undefined) {
|
|
42289
42341
|
const coercedAdapterRequestContext = coerceAdapterRequestContext(requestContext);
|
|
42290
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
42342
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
42291
42343
|
dispatchOptions = {
|
|
42292
42344
|
resourceRequestContext: {
|
|
42293
42345
|
requestCorrelator,
|
|
42346
|
+
sourceContext,
|
|
42294
42347
|
luvioRequestMethod: undefined,
|
|
42295
42348
|
},
|
|
42296
42349
|
eventObservers,
|
|
@@ -42362,10 +42415,11 @@ function createDispatchResourceRequestContext(requestContext) {
|
|
|
42362
42415
|
let dispatchOptions = undefined;
|
|
42363
42416
|
if (requestContext !== undefined) {
|
|
42364
42417
|
const coercedAdapterRequestContext = coerceAdapterRequestContext(requestContext);
|
|
42365
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
42418
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
42366
42419
|
dispatchOptions = {
|
|
42367
42420
|
resourceRequestContext: {
|
|
42368
42421
|
requestCorrelator,
|
|
42422
|
+
sourceContext,
|
|
42369
42423
|
luvioRequestMethod: undefined,
|
|
42370
42424
|
},
|
|
42371
42425
|
eventObservers,
|
|
@@ -42878,7 +42932,16 @@ withDefaultLuvio((luvio) => {
|
|
|
42878
42932
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
|
|
42879
42933
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
|
|
42880
42934
|
});
|
|
42881
|
-
// version: 1.
|
|
42935
|
+
// version: 1.249.0-15efc7f9b
|
|
42936
|
+
|
|
42937
|
+
var ldsIdempotencyWriteDisabled = {
|
|
42938
|
+
isOpen: function (e) {
|
|
42939
|
+
return e.fallback;
|
|
42940
|
+
},
|
|
42941
|
+
hasError: function () {
|
|
42942
|
+
return !0;
|
|
42943
|
+
},
|
|
42944
|
+
};
|
|
42882
42945
|
|
|
42883
42946
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
42884
42947
|
|
|
@@ -44203,12 +44266,12 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
|
|
|
44203
44266
|
}
|
|
44204
44267
|
return environment.getNode(key, stagingStore);
|
|
44205
44268
|
};
|
|
44206
|
-
const wrapNormalizedGraphNode = function (normalized) {
|
|
44269
|
+
const wrapNormalizedGraphNode = function (normalized, key) {
|
|
44207
44270
|
validateNotDisposed();
|
|
44208
44271
|
if (stagingStore === null) {
|
|
44209
44272
|
stagingStore = buildIngestStagingStore(environment);
|
|
44210
44273
|
}
|
|
44211
|
-
return environment.wrapNormalizedGraphNode(normalized, stagingStore);
|
|
44274
|
+
return environment.wrapNormalizedGraphNode(normalized, key, stagingStore);
|
|
44212
44275
|
};
|
|
44213
44276
|
const rebuildSnapshot = function (snapshot, onRebuild) {
|
|
44214
44277
|
validateNotDisposed();
|
|
@@ -47916,6 +47979,21 @@ class AsyncWorkerPool {
|
|
|
47916
47979
|
}
|
|
47917
47980
|
}
|
|
47918
47981
|
|
|
47982
|
+
/**
|
|
47983
|
+
Use Math.random to generate v4 RFC4122 compliant uuid
|
|
47984
|
+
*/
|
|
47985
|
+
function uuidv4() {
|
|
47986
|
+
const uuid = [];
|
|
47987
|
+
for (let i = 0; i < 32; i++) {
|
|
47988
|
+
const random = (Math.random() * 16) | 0;
|
|
47989
|
+
if (i === 8 || i === 12 || i === 16 || i === 20) {
|
|
47990
|
+
uuid.push('-');
|
|
47991
|
+
}
|
|
47992
|
+
uuid.push((i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16));
|
|
47993
|
+
}
|
|
47994
|
+
return uuid.join('');
|
|
47995
|
+
}
|
|
47996
|
+
|
|
47919
47997
|
/**
|
|
47920
47998
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
47921
47999
|
* All rights reserved.
|
|
@@ -47923,20 +48001,20 @@ class AsyncWorkerPool {
|
|
|
47923
48001
|
*/
|
|
47924
48002
|
|
|
47925
48003
|
|
|
47926
|
-
var DraftActionStatus
|
|
48004
|
+
var DraftActionStatus;
|
|
47927
48005
|
(function (DraftActionStatus) {
|
|
47928
48006
|
DraftActionStatus["Pending"] = "pending";
|
|
47929
48007
|
DraftActionStatus["Uploading"] = "uploading";
|
|
47930
48008
|
DraftActionStatus["Error"] = "error";
|
|
47931
48009
|
DraftActionStatus["Completed"] = "completed";
|
|
47932
|
-
})(DraftActionStatus
|
|
48010
|
+
})(DraftActionStatus || (DraftActionStatus = {}));
|
|
47933
48011
|
function isDraftError(draft) {
|
|
47934
|
-
return draft.status === DraftActionStatus
|
|
48012
|
+
return draft.status === DraftActionStatus.Error;
|
|
47935
48013
|
}
|
|
47936
48014
|
function isDraftQueueStateChangeEvent(event) {
|
|
47937
|
-
return event.type === DraftQueueEventType
|
|
48015
|
+
return event.type === DraftQueueEventType.QueueStateChanged;
|
|
47938
48016
|
}
|
|
47939
|
-
var ProcessActionResult
|
|
48017
|
+
var ProcessActionResult;
|
|
47940
48018
|
(function (ProcessActionResult) {
|
|
47941
48019
|
// non-2xx network error, requires user intervention
|
|
47942
48020
|
ProcessActionResult["ACTION_ERRORED"] = "ERROR";
|
|
@@ -47952,8 +48030,8 @@ var ProcessActionResult$1;
|
|
|
47952
48030
|
ProcessActionResult["BLOCKED_ON_ERROR"] = "BLOCKED_ON_ERROR";
|
|
47953
48031
|
//waiting for user to execute custom action
|
|
47954
48032
|
ProcessActionResult["CUSTOM_ACTION_WAITING"] = "CUSTOM_ACTION_WAITING";
|
|
47955
|
-
})(ProcessActionResult
|
|
47956
|
-
var DraftQueueState
|
|
48033
|
+
})(ProcessActionResult || (ProcessActionResult = {}));
|
|
48034
|
+
var DraftQueueState;
|
|
47957
48035
|
(function (DraftQueueState) {
|
|
47958
48036
|
/** Currently processing an item in the queue or queue is empty and waiting to process the next item. */
|
|
47959
48037
|
DraftQueueState["Started"] = "started";
|
|
@@ -47972,8 +48050,8 @@ var DraftQueueState$1;
|
|
|
47972
48050
|
* To attempt to force an upload now call startDraftQueue().
|
|
47973
48051
|
*/
|
|
47974
48052
|
DraftQueueState["Waiting"] = "waiting";
|
|
47975
|
-
})(DraftQueueState
|
|
47976
|
-
var DraftQueueEventType
|
|
48053
|
+
})(DraftQueueState || (DraftQueueState = {}));
|
|
48054
|
+
var DraftQueueEventType;
|
|
47977
48055
|
(function (DraftQueueEventType) {
|
|
47978
48056
|
/**
|
|
47979
48057
|
* Triggered after an action had been added to the queue
|
|
@@ -48003,13 +48081,13 @@ var DraftQueueEventType$1;
|
|
|
48003
48081
|
* Triggered after the Draft Queue state changes
|
|
48004
48082
|
*/
|
|
48005
48083
|
DraftQueueEventType["QueueStateChanged"] = "state";
|
|
48006
|
-
})(DraftQueueEventType
|
|
48007
|
-
var QueueOperationType
|
|
48084
|
+
})(DraftQueueEventType || (DraftQueueEventType = {}));
|
|
48085
|
+
var QueueOperationType;
|
|
48008
48086
|
(function (QueueOperationType) {
|
|
48009
48087
|
QueueOperationType["Add"] = "add";
|
|
48010
48088
|
QueueOperationType["Delete"] = "delete";
|
|
48011
48089
|
QueueOperationType["Update"] = "update";
|
|
48012
|
-
})(QueueOperationType
|
|
48090
|
+
})(QueueOperationType || (QueueOperationType = {}));
|
|
48013
48091
|
|
|
48014
48092
|
class DraftSynthesisError extends Error {
|
|
48015
48093
|
constructor(message, errorType) {
|
|
@@ -48129,20 +48207,6 @@ function generateUniqueDraftActionId(existingIds) {
|
|
|
48129
48207
|
}
|
|
48130
48208
|
return newId.toString();
|
|
48131
48209
|
}
|
|
48132
|
-
/**
|
|
48133
|
-
Use Math.random to generate v4 RFC4122 compliant uuid
|
|
48134
|
-
*/
|
|
48135
|
-
function uuidv4$1() {
|
|
48136
|
-
const uuid = [];
|
|
48137
|
-
for (let i = 0; i < 32; i++) {
|
|
48138
|
-
const random = (Math.random() * 16) | 0;
|
|
48139
|
-
if (i === 8 || i === 12 || i === 16 || i === 20) {
|
|
48140
|
-
uuid.push('-');
|
|
48141
|
-
}
|
|
48142
|
-
uuid.push((i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16));
|
|
48143
|
-
}
|
|
48144
|
-
return uuid.join('');
|
|
48145
|
-
}
|
|
48146
48210
|
|
|
48147
48211
|
const HTTP_HEADER_RETRY_AFTER = 'Retry-After';
|
|
48148
48212
|
const HTTP_HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
|
@@ -48182,7 +48246,7 @@ function buildLuvioOverrideForDraftAdapters(luvio, handler, extractTargetIdFromC
|
|
|
48182
48246
|
const resourceRequestCopy = clone$1(resourceRequest);
|
|
48183
48247
|
resourceRequestCopy.headers = resourceRequestCopy.headers || {};
|
|
48184
48248
|
if (handler.hasIdempotencySupport()) {
|
|
48185
|
-
resourceRequestCopy.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4
|
|
48249
|
+
resourceRequestCopy.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
48186
48250
|
}
|
|
48187
48251
|
// enable return extra fields for record creation and record update http call
|
|
48188
48252
|
if (resourceRequest.basePath === '/ui-api/records' &&
|
|
@@ -48287,26 +48351,26 @@ async function clearDraftIdSegment(durableStore) {
|
|
|
48287
48351
|
}
|
|
48288
48352
|
}
|
|
48289
48353
|
|
|
48290
|
-
var CustomActionResultType
|
|
48354
|
+
var CustomActionResultType;
|
|
48291
48355
|
(function (CustomActionResultType) {
|
|
48292
48356
|
CustomActionResultType["SUCCESS"] = "SUCCESS";
|
|
48293
48357
|
CustomActionResultType["FAILURE"] = "FAILURE";
|
|
48294
|
-
})(CustomActionResultType
|
|
48295
|
-
var CustomActionErrorType
|
|
48358
|
+
})(CustomActionResultType || (CustomActionResultType = {}));
|
|
48359
|
+
var CustomActionErrorType;
|
|
48296
48360
|
(function (CustomActionErrorType) {
|
|
48297
48361
|
CustomActionErrorType["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
48298
48362
|
CustomActionErrorType["CLIENT_ERROR"] = "CLIENT_ERROR";
|
|
48299
|
-
})(CustomActionErrorType
|
|
48363
|
+
})(CustomActionErrorType || (CustomActionErrorType = {}));
|
|
48300
48364
|
function isCustomActionSuccess(result) {
|
|
48301
|
-
return result.type === CustomActionResultType
|
|
48365
|
+
return result.type === CustomActionResultType.SUCCESS;
|
|
48302
48366
|
}
|
|
48303
48367
|
function isCustomActionFailed(result) {
|
|
48304
|
-
return result.type === CustomActionResultType
|
|
48368
|
+
return result.type === CustomActionResultType.FAILURE;
|
|
48305
48369
|
}
|
|
48306
48370
|
function customActionHandler(executor, id, draftQueue) {
|
|
48307
48371
|
const handle = (action, actionCompleted, actionErrored) => {
|
|
48308
48372
|
notifyCustomActionToExecute(action, actionCompleted, actionErrored);
|
|
48309
|
-
return Promise.resolve(ProcessActionResult
|
|
48373
|
+
return Promise.resolve(ProcessActionResult.CUSTOM_ACTION_WAITING);
|
|
48310
48374
|
};
|
|
48311
48375
|
const notifyCustomActionToExecute = (action, actionCompleted, actionErrored) => {
|
|
48312
48376
|
if (executor !== undefined) {
|
|
@@ -48317,16 +48381,16 @@ function customActionHandler(executor, id, draftQueue) {
|
|
|
48317
48381
|
if (isCustomActionSuccess(result)) {
|
|
48318
48382
|
actionCompleted({
|
|
48319
48383
|
...action,
|
|
48320
|
-
status: DraftActionStatus
|
|
48384
|
+
status: DraftActionStatus.Completed,
|
|
48321
48385
|
response: createOkResponse(undefined),
|
|
48322
48386
|
});
|
|
48323
48387
|
}
|
|
48324
48388
|
else if (isCustomActionFailed(result)) {
|
|
48325
48389
|
actionErrored({
|
|
48326
48390
|
...action,
|
|
48327
|
-
status: DraftActionStatus
|
|
48391
|
+
status: DraftActionStatus.Error,
|
|
48328
48392
|
error: result.error.message,
|
|
48329
|
-
}, result.error.type === CustomActionErrorType
|
|
48393
|
+
}, result.error.type === CustomActionErrorType.NETWORK_ERROR);
|
|
48330
48394
|
}
|
|
48331
48395
|
};
|
|
48332
48396
|
const buildPendingAction = (action, queue) => {
|
|
@@ -48335,7 +48399,7 @@ function customActionHandler(executor, id, draftQueue) {
|
|
|
48335
48399
|
return Promise.resolve({
|
|
48336
48400
|
id,
|
|
48337
48401
|
targetId,
|
|
48338
|
-
status: DraftActionStatus
|
|
48402
|
+
status: DraftActionStatus.Pending,
|
|
48339
48403
|
data,
|
|
48340
48404
|
tag,
|
|
48341
48405
|
timestamp: Date.now(),
|
|
@@ -48347,7 +48411,7 @@ function customActionHandler(executor, id, draftQueue) {
|
|
|
48347
48411
|
const { id } = action;
|
|
48348
48412
|
const queueOperations = [];
|
|
48349
48413
|
queueOperations.push({
|
|
48350
|
-
type: QueueOperationType
|
|
48414
|
+
type: QueueOperationType.Delete,
|
|
48351
48415
|
id: id,
|
|
48352
48416
|
});
|
|
48353
48417
|
return queueOperations;
|
|
@@ -48397,8 +48461,8 @@ class DurableDraftQueue {
|
|
|
48397
48461
|
this.minimumRetryInterval = 250;
|
|
48398
48462
|
this.maximumRetryInterval = 32000;
|
|
48399
48463
|
this.draftQueueChangedListeners = [];
|
|
48400
|
-
this.state = DraftQueueState
|
|
48401
|
-
this.userState = DraftQueueState
|
|
48464
|
+
this.state = DraftQueueState.Stopped;
|
|
48465
|
+
this.userState = DraftQueueState.Stopped;
|
|
48402
48466
|
this.uploadingActionId = undefined;
|
|
48403
48467
|
this.timeoutHandler = undefined;
|
|
48404
48468
|
this.handlers = {};
|
|
@@ -48425,8 +48489,8 @@ class DurableDraftQueue {
|
|
|
48425
48489
|
return this.state;
|
|
48426
48490
|
}
|
|
48427
48491
|
async startQueue() {
|
|
48428
|
-
this.userState = DraftQueueState
|
|
48429
|
-
if (this.state === DraftQueueState
|
|
48492
|
+
this.userState = DraftQueueState.Started;
|
|
48493
|
+
if (this.state === DraftQueueState.Started) {
|
|
48430
48494
|
// Do nothing if the queue state is already started
|
|
48431
48495
|
return;
|
|
48432
48496
|
}
|
|
@@ -48437,30 +48501,30 @@ class DurableDraftQueue {
|
|
|
48437
48501
|
return;
|
|
48438
48502
|
}
|
|
48439
48503
|
this.retryIntervalMilliseconds = 0;
|
|
48440
|
-
this.state = DraftQueueState
|
|
48504
|
+
this.state = DraftQueueState.Started;
|
|
48441
48505
|
await this.notifyChangedListeners({
|
|
48442
|
-
type: DraftQueueEventType
|
|
48506
|
+
type: DraftQueueEventType.QueueStateChanged,
|
|
48443
48507
|
state: this.state,
|
|
48444
48508
|
});
|
|
48445
48509
|
const result = await this.processNextAction();
|
|
48446
48510
|
switch (result) {
|
|
48447
|
-
case ProcessActionResult
|
|
48448
|
-
this.state = DraftQueueState
|
|
48511
|
+
case ProcessActionResult.BLOCKED_ON_ERROR:
|
|
48512
|
+
this.state = DraftQueueState.Error;
|
|
48449
48513
|
return Promise.reject();
|
|
48450
48514
|
default:
|
|
48451
48515
|
return Promise.resolve();
|
|
48452
48516
|
}
|
|
48453
48517
|
}
|
|
48454
48518
|
stopQueue() {
|
|
48455
|
-
this.userState = DraftQueueState
|
|
48456
|
-
if (this.state === DraftQueueState
|
|
48519
|
+
this.userState = DraftQueueState.Stopped;
|
|
48520
|
+
if (this.state === DraftQueueState.Stopped) {
|
|
48457
48521
|
// Do nothing if the queue state is already stopped
|
|
48458
48522
|
return Promise.resolve();
|
|
48459
48523
|
}
|
|
48460
48524
|
this.stopQueueManually();
|
|
48461
48525
|
return this.notifyChangedListeners({
|
|
48462
|
-
type: DraftQueueEventType
|
|
48463
|
-
state: DraftQueueState
|
|
48526
|
+
type: DraftQueueEventType.QueueStateChanged,
|
|
48527
|
+
state: DraftQueueState.Stopped,
|
|
48464
48528
|
});
|
|
48465
48529
|
}
|
|
48466
48530
|
/**
|
|
@@ -48471,7 +48535,7 @@ class DurableDraftQueue {
|
|
|
48471
48535
|
clearTimeout(this.timeoutHandler);
|
|
48472
48536
|
this.timeoutHandler = undefined;
|
|
48473
48537
|
}
|
|
48474
|
-
this.state = DraftQueueState
|
|
48538
|
+
this.state = DraftQueueState.Stopped;
|
|
48475
48539
|
}
|
|
48476
48540
|
async getQueueActions() {
|
|
48477
48541
|
const drafts = (await this.draftStore.getAllDrafts());
|
|
@@ -48481,7 +48545,7 @@ class DurableDraftQueue {
|
|
|
48481
48545
|
}
|
|
48482
48546
|
drafts.forEach((draft) => {
|
|
48483
48547
|
if (draft.id === this.uploadingActionId) {
|
|
48484
|
-
draft.status = DraftActionStatus
|
|
48548
|
+
draft.status = DraftActionStatus.Uploading;
|
|
48485
48549
|
}
|
|
48486
48550
|
queue.push(draft);
|
|
48487
48551
|
});
|
|
@@ -48507,11 +48571,11 @@ class DurableDraftQueue {
|
|
|
48507
48571
|
await this.draftStore.writeAction(pendingAction);
|
|
48508
48572
|
queue = await this.getQueueActions();
|
|
48509
48573
|
await this.notifyChangedListeners({
|
|
48510
|
-
type: DraftQueueEventType
|
|
48574
|
+
type: DraftQueueEventType.ActionAdded,
|
|
48511
48575
|
action: pendingAction,
|
|
48512
48576
|
});
|
|
48513
48577
|
await handler.handleActionEnqueued(pendingAction, queue);
|
|
48514
|
-
if (this.state === DraftQueueState
|
|
48578
|
+
if (this.state === DraftQueueState.Started) {
|
|
48515
48579
|
this.processNextAction();
|
|
48516
48580
|
}
|
|
48517
48581
|
const actionData = (await handler.getDataForAction(pendingAction));
|
|
@@ -48543,10 +48607,10 @@ class DurableDraftQueue {
|
|
|
48543
48607
|
this.retryIntervalMilliseconds = 0;
|
|
48544
48608
|
this.uploadingActionId = undefined;
|
|
48545
48609
|
await this.notifyChangedListeners({
|
|
48546
|
-
type: DraftQueueEventType
|
|
48610
|
+
type: DraftQueueEventType.ActionCompleted,
|
|
48547
48611
|
action,
|
|
48548
48612
|
});
|
|
48549
|
-
if (this.state === DraftQueueState
|
|
48613
|
+
if (this.state === DraftQueueState.Started) {
|
|
48550
48614
|
this.processNextAction();
|
|
48551
48615
|
}
|
|
48552
48616
|
},
|
|
@@ -48556,12 +48620,12 @@ class DurableDraftQueue {
|
|
|
48556
48620
|
if (actionDataChanged === true) {
|
|
48557
48621
|
await this.draftStore.writeAction({
|
|
48558
48622
|
...action,
|
|
48559
|
-
status: DraftActionStatus
|
|
48623
|
+
status: DraftActionStatus.Pending,
|
|
48560
48624
|
});
|
|
48561
48625
|
}
|
|
48562
48626
|
this.uploadingActionId = undefined;
|
|
48563
|
-
if (retry && this.state !== DraftQueueState
|
|
48564
|
-
this.state = DraftQueueState
|
|
48627
|
+
if (retry && this.state !== DraftQueueState.Stopped) {
|
|
48628
|
+
this.state = DraftQueueState.Waiting;
|
|
48565
48629
|
return retryDelayInMs !== undefined
|
|
48566
48630
|
? this.scheduleRetryWithSpecifiedDelay(retryDelayInMs)
|
|
48567
48631
|
: this.scheduleRetry();
|
|
@@ -48585,27 +48649,27 @@ class DurableDraftQueue {
|
|
|
48585
48649
|
const action = queue[0];
|
|
48586
48650
|
if (action === undefined) {
|
|
48587
48651
|
this.processingAction = undefined;
|
|
48588
|
-
return ProcessActionResult
|
|
48652
|
+
return ProcessActionResult.NO_ACTION_TO_PROCESS;
|
|
48589
48653
|
}
|
|
48590
48654
|
const { status, id } = action;
|
|
48591
|
-
if (status === DraftActionStatus
|
|
48592
|
-
this.state = DraftQueueState
|
|
48655
|
+
if (status === DraftActionStatus.Error) {
|
|
48656
|
+
this.state = DraftQueueState.Error;
|
|
48593
48657
|
this.processingAction = undefined;
|
|
48594
|
-
return ProcessActionResult
|
|
48658
|
+
return ProcessActionResult.BLOCKED_ON_ERROR;
|
|
48595
48659
|
}
|
|
48596
48660
|
if (id === this.uploadingActionId) {
|
|
48597
|
-
this.state = DraftQueueState
|
|
48661
|
+
this.state = DraftQueueState.Started;
|
|
48598
48662
|
this.processingAction = undefined;
|
|
48599
|
-
return ProcessActionResult
|
|
48663
|
+
return ProcessActionResult.ACTION_ALREADY_PROCESSING;
|
|
48600
48664
|
}
|
|
48601
48665
|
this.uploadingActionId = id;
|
|
48602
48666
|
this.processingAction = undefined;
|
|
48603
|
-
if (this.state === DraftQueueState
|
|
48604
|
-
this.state = DraftQueueState
|
|
48667
|
+
if (this.state === DraftQueueState.Waiting) {
|
|
48668
|
+
this.state = DraftQueueState.Started;
|
|
48605
48669
|
}
|
|
48606
48670
|
this.notifyChangedListeners({
|
|
48607
|
-
type: DraftQueueEventType
|
|
48608
|
-
action: { ...action, status: DraftActionStatus
|
|
48671
|
+
type: DraftQueueEventType.ActionUploading,
|
|
48672
|
+
action: { ...action, status: DraftActionStatus.Uploading },
|
|
48609
48673
|
});
|
|
48610
48674
|
return this.handle(action);
|
|
48611
48675
|
}
|
|
@@ -48618,14 +48682,14 @@ class DurableDraftQueue {
|
|
|
48618
48682
|
}
|
|
48619
48683
|
const errorAction = {
|
|
48620
48684
|
...action,
|
|
48621
|
-
status: DraftActionStatus
|
|
48685
|
+
status: DraftActionStatus.Error,
|
|
48622
48686
|
error,
|
|
48623
48687
|
metadata: newMetadata,
|
|
48624
48688
|
};
|
|
48625
48689
|
await this.draftStore.writeAction(errorAction);
|
|
48626
|
-
this.state = DraftQueueState
|
|
48690
|
+
this.state = DraftQueueState.Error;
|
|
48627
48691
|
return this.notifyChangedListeners({
|
|
48628
|
-
type: DraftQueueEventType
|
|
48692
|
+
type: DraftQueueEventType.ActionFailed,
|
|
48629
48693
|
action: errorAction,
|
|
48630
48694
|
});
|
|
48631
48695
|
}
|
|
@@ -48644,7 +48708,7 @@ class DurableDraftQueue {
|
|
|
48644
48708
|
* started
|
|
48645
48709
|
*/
|
|
48646
48710
|
async startQueueSafe() {
|
|
48647
|
-
if (this.userState === DraftQueueState
|
|
48711
|
+
if (this.userState === DraftQueueState.Started && this.state !== DraftQueueState.Started) {
|
|
48648
48712
|
await this.startQueue();
|
|
48649
48713
|
}
|
|
48650
48714
|
}
|
|
@@ -48671,11 +48735,11 @@ class DurableDraftQueue {
|
|
|
48671
48735
|
}
|
|
48672
48736
|
await handler.handleActionRemoved(action, queue.filter((x) => x.id !== actionId));
|
|
48673
48737
|
await this.notifyChangedListeners({
|
|
48674
|
-
type: DraftQueueEventType
|
|
48738
|
+
type: DraftQueueEventType.ActionDeleted,
|
|
48675
48739
|
action,
|
|
48676
48740
|
});
|
|
48677
|
-
if (this.userState === DraftQueueState
|
|
48678
|
-
this.state !== DraftQueueState
|
|
48741
|
+
if (this.userState === DraftQueueState.Started &&
|
|
48742
|
+
this.state !== DraftQueueState.Started &&
|
|
48679
48743
|
this.replacingAction === undefined) {
|
|
48680
48744
|
await this.startQueue();
|
|
48681
48745
|
}
|
|
@@ -48705,14 +48769,14 @@ class DurableDraftQueue {
|
|
|
48705
48769
|
action.metadata = handler.updateMetadata(action.metadata, metadata);
|
|
48706
48770
|
await this.draftStore.writeAction(action);
|
|
48707
48771
|
await this.notifyChangedListeners({
|
|
48708
|
-
type: DraftQueueEventType
|
|
48772
|
+
type: DraftQueueEventType.ActionUpdated,
|
|
48709
48773
|
action: action,
|
|
48710
48774
|
});
|
|
48711
48775
|
return action;
|
|
48712
48776
|
}
|
|
48713
48777
|
scheduleRetryWithSpecifiedDelay(retryDelayInMs) {
|
|
48714
48778
|
this.timeoutHandler = setTimeout(() => {
|
|
48715
|
-
if (this.state !== DraftQueueState
|
|
48779
|
+
if (this.state !== DraftQueueState.Stopped) {
|
|
48716
48780
|
this.processNextAction();
|
|
48717
48781
|
}
|
|
48718
48782
|
}, retryDelayInMs);
|
|
@@ -48748,11 +48812,11 @@ class DurableDraftQueue {
|
|
|
48748
48812
|
if (targetTag !== sourceTag) {
|
|
48749
48813
|
throw Error('Cannot replace/merge actions for different tags.');
|
|
48750
48814
|
}
|
|
48751
|
-
if (targetStatus === DraftActionStatus
|
|
48752
|
-
targetStatus === DraftActionStatus
|
|
48815
|
+
if (targetStatus === DraftActionStatus.Completed ||
|
|
48816
|
+
targetStatus === DraftActionStatus.Uploading) {
|
|
48753
48817
|
throw Error(`Cannot replace/merge actions when targetAction is in ${targetStatus} status.`);
|
|
48754
48818
|
}
|
|
48755
|
-
if (sourceStatus !== DraftActionStatus
|
|
48819
|
+
if (sourceStatus !== DraftActionStatus.Pending) {
|
|
48756
48820
|
throw Error(`Cannot replace/merge actions when sourceAction is in ${sourceStatus} status.`);
|
|
48757
48821
|
}
|
|
48758
48822
|
if (targetVersion !== sourceVersion) {
|
|
@@ -48782,7 +48846,7 @@ class DurableDraftQueue {
|
|
|
48782
48846
|
// update the target
|
|
48783
48847
|
await this.draftStore.writeAction(updatedTarget);
|
|
48784
48848
|
await this.notifyChangedListeners({
|
|
48785
|
-
type: DraftQueueEventType
|
|
48849
|
+
type: DraftQueueEventType.ActionUpdated,
|
|
48786
48850
|
action: updatedTarget,
|
|
48787
48851
|
});
|
|
48788
48852
|
// remove the source from queue
|
|
@@ -48881,7 +48945,7 @@ class DurableDraftStore {
|
|
|
48881
48945
|
const { draftStore } = this;
|
|
48882
48946
|
for (let i = 0, len = queueOperations.length; i < len; i++) {
|
|
48883
48947
|
const operation = queueOperations[i];
|
|
48884
|
-
if (operation.type === QueueOperationType
|
|
48948
|
+
if (operation.type === QueueOperationType.Delete) {
|
|
48885
48949
|
const action = draftStore[operation.id];
|
|
48886
48950
|
if (action !== undefined) {
|
|
48887
48951
|
delete draftStore[operation.id];
|
|
@@ -49005,7 +49069,12 @@ class AbstractResourceRequestActionHandler {
|
|
|
49005
49069
|
// the luvio store redirect table, during which a new draft might be enqueued
|
|
49006
49070
|
// which would not see a necessary mapping.
|
|
49007
49071
|
this.ephemeralRedirects = {};
|
|
49072
|
+
// determined by Server setup.
|
|
49008
49073
|
this.isIdempotencySupported = true;
|
|
49074
|
+
// idempotency write flag set by lds
|
|
49075
|
+
this.isLdsIdempotencyWriteDisabled = ldsIdempotencyWriteDisabled.isOpen({
|
|
49076
|
+
fallback: false,
|
|
49077
|
+
});
|
|
49009
49078
|
}
|
|
49010
49079
|
enqueue(data) {
|
|
49011
49080
|
return this.draftQueue.enqueue(this.handlerId, data);
|
|
@@ -49019,9 +49088,9 @@ class AbstractResourceRequestActionHandler {
|
|
|
49019
49088
|
await actionCompleted({
|
|
49020
49089
|
...action,
|
|
49021
49090
|
response,
|
|
49022
|
-
status: DraftActionStatus
|
|
49091
|
+
status: DraftActionStatus.Completed,
|
|
49023
49092
|
});
|
|
49024
|
-
return ProcessActionResult
|
|
49093
|
+
return ProcessActionResult.ACTION_SUCCEEDED;
|
|
49025
49094
|
}
|
|
49026
49095
|
let shouldRetry = false;
|
|
49027
49096
|
let retryDelayInMs = undefined;
|
|
@@ -49081,13 +49150,13 @@ class AbstractResourceRequestActionHandler {
|
|
|
49081
49150
|
: {
|
|
49082
49151
|
...updatedAction,
|
|
49083
49152
|
error: response,
|
|
49084
|
-
status: DraftActionStatus
|
|
49153
|
+
status: DraftActionStatus.Error,
|
|
49085
49154
|
}, shouldRetry, retryDelayInMs, actionDataChanged);
|
|
49086
|
-
return ProcessActionResult
|
|
49155
|
+
return ProcessActionResult.ACTION_ERRORED;
|
|
49087
49156
|
}
|
|
49088
49157
|
catch (e) {
|
|
49089
49158
|
await actionErrored(action, true);
|
|
49090
|
-
return ProcessActionResult
|
|
49159
|
+
return ProcessActionResult.NETWORK_ERROR;
|
|
49091
49160
|
}
|
|
49092
49161
|
}
|
|
49093
49162
|
// true if response is an idempotency server error. updates or deletes idempotency key if the reponse is idempotency related error. Idempotency related error is in format of UiApiError array.
|
|
@@ -49097,7 +49166,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
49097
49166
|
if (targetErrorCodes.includes(errorCode)) {
|
|
49098
49167
|
action.data.headers = action.data.headers || {};
|
|
49099
49168
|
if (updateIdempotencyKey) {
|
|
49100
|
-
action.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4
|
|
49169
|
+
action.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
49101
49170
|
}
|
|
49102
49171
|
else {
|
|
49103
49172
|
delete action.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY];
|
|
@@ -49126,7 +49195,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
49126
49195
|
targetId,
|
|
49127
49196
|
tag,
|
|
49128
49197
|
data: request,
|
|
49129
|
-
status: DraftActionStatus
|
|
49198
|
+
status: DraftActionStatus.Pending,
|
|
49130
49199
|
id: generateUniqueDraftActionId(queue.map((x) => x.id)),
|
|
49131
49200
|
timestamp: Date.now(),
|
|
49132
49201
|
metadata: {},
|
|
@@ -49192,11 +49261,11 @@ class AbstractResourceRequestActionHandler {
|
|
|
49192
49261
|
};
|
|
49193
49262
|
// item needs to be replaced with a new item at the new record key
|
|
49194
49263
|
queueOperations.push({
|
|
49195
|
-
type: QueueOperationType
|
|
49264
|
+
type: QueueOperationType.Delete,
|
|
49196
49265
|
id: queueActionId,
|
|
49197
49266
|
});
|
|
49198
49267
|
queueOperations.push({
|
|
49199
|
-
type: QueueOperationType
|
|
49268
|
+
type: QueueOperationType.Add,
|
|
49200
49269
|
action: updatedAction,
|
|
49201
49270
|
});
|
|
49202
49271
|
}
|
|
@@ -49211,7 +49280,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
49211
49280
|
};
|
|
49212
49281
|
// item needs to be updated
|
|
49213
49282
|
queueOperations.push({
|
|
49214
|
-
type: QueueOperationType
|
|
49283
|
+
type: QueueOperationType.Update,
|
|
49215
49284
|
id: queueActionId,
|
|
49216
49285
|
action: updatedAction,
|
|
49217
49286
|
});
|
|
@@ -49222,7 +49291,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
49222
49291
|
}
|
|
49223
49292
|
// delete completed action
|
|
49224
49293
|
queueOperations.push({
|
|
49225
|
-
type: QueueOperationType
|
|
49294
|
+
type: QueueOperationType.Delete,
|
|
49226
49295
|
id: action.id,
|
|
49227
49296
|
});
|
|
49228
49297
|
return queueOperations;
|
|
@@ -49258,7 +49327,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
49258
49327
|
synchronousIngest: this.synchronousIngest.bind(this),
|
|
49259
49328
|
buildCacheKeysForResponse: this.buildCacheKeysFromResponse.bind(this),
|
|
49260
49329
|
});
|
|
49261
|
-
const recordsNeedingReplay = queueOperations.filter((x) => x.type === QueueOperationType
|
|
49330
|
+
const recordsNeedingReplay = queueOperations.filter((x) => x.type === QueueOperationType.Update);
|
|
49262
49331
|
for (const recordNeedingReplay of recordsNeedingReplay) {
|
|
49263
49332
|
const { action } = recordNeedingReplay;
|
|
49264
49333
|
if (isResourceRequestAction(action)) {
|
|
@@ -49286,7 +49355,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
49286
49355
|
}
|
|
49287
49356
|
if (this.isActionOfType(targetAction) &&
|
|
49288
49357
|
this.isActionOfType(sourceAction)) {
|
|
49289
|
-
targetAction.status = DraftActionStatus
|
|
49358
|
+
targetAction.status = DraftActionStatus.Pending;
|
|
49290
49359
|
targetAction.data = sourceAction.data;
|
|
49291
49360
|
return targetAction;
|
|
49292
49361
|
}
|
|
@@ -49323,12 +49392,12 @@ class AbstractResourceRequestActionHandler {
|
|
|
49323
49392
|
};
|
|
49324
49393
|
// Updates Idempotency key if target has one
|
|
49325
49394
|
if (targetData.headers && targetData.headers[HTTP_HEADER_IDEMPOTENCY_KEY]) {
|
|
49326
|
-
merged.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4
|
|
49395
|
+
merged.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
49327
49396
|
}
|
|
49328
49397
|
// overlay metadata
|
|
49329
49398
|
merged.metadata = { ...targetMetadata, ...sourceMetadata };
|
|
49330
49399
|
// put status back to pending to auto upload if queue is active and targed is at the head.
|
|
49331
|
-
merged.status = DraftActionStatus
|
|
49400
|
+
merged.status = DraftActionStatus.Pending;
|
|
49332
49401
|
return merged;
|
|
49333
49402
|
}
|
|
49334
49403
|
shouldDeleteActionByTagOnRemoval(action) {
|
|
@@ -49362,12 +49431,12 @@ class AbstractResourceRequestActionHandler {
|
|
|
49362
49431
|
return [action.targetId];
|
|
49363
49432
|
}
|
|
49364
49433
|
hasIdempotencySupport() {
|
|
49365
|
-
return this.isIdempotencySupported;
|
|
49434
|
+
return this.isIdempotencySupported && !this.isLdsIdempotencyWriteDisabled;
|
|
49366
49435
|
}
|
|
49367
49436
|
async ingestResponses(responses, action) {
|
|
49368
49437
|
const luvio = this.getLuvio();
|
|
49369
49438
|
await luvio.handleSuccessResponse(() => {
|
|
49370
|
-
if (action.status === DraftActionStatus
|
|
49439
|
+
if (action.status === DraftActionStatus.Completed) {
|
|
49371
49440
|
const mappings = this.getRedirectMappings(action);
|
|
49372
49441
|
if (mappings) {
|
|
49373
49442
|
mappings.forEach((mapping) => {
|
|
@@ -49422,14 +49491,14 @@ function isResourceRequestAction(action) {
|
|
|
49422
49491
|
/**
|
|
49423
49492
|
* Denotes what kind of operation a DraftQueueItem represents.
|
|
49424
49493
|
*/
|
|
49425
|
-
var DraftActionOperationType
|
|
49494
|
+
var DraftActionOperationType;
|
|
49426
49495
|
(function (DraftActionOperationType) {
|
|
49427
49496
|
DraftActionOperationType["Create"] = "create";
|
|
49428
49497
|
DraftActionOperationType["Update"] = "update";
|
|
49429
49498
|
DraftActionOperationType["Delete"] = "delete";
|
|
49430
49499
|
DraftActionOperationType["Custom"] = "custom";
|
|
49431
|
-
})(DraftActionOperationType
|
|
49432
|
-
var DraftQueueOperationType
|
|
49500
|
+
})(DraftActionOperationType || (DraftActionOperationType = {}));
|
|
49501
|
+
var DraftQueueOperationType;
|
|
49433
49502
|
(function (DraftQueueOperationType) {
|
|
49434
49503
|
DraftQueueOperationType["ItemAdded"] = "added";
|
|
49435
49504
|
DraftQueueOperationType["ItemUploading"] = "uploading";
|
|
@@ -49439,7 +49508,7 @@ var DraftQueueOperationType$1;
|
|
|
49439
49508
|
DraftQueueOperationType["ItemUpdated"] = "updated";
|
|
49440
49509
|
DraftQueueOperationType["QueueStarted"] = "started";
|
|
49441
49510
|
DraftQueueOperationType["QueueStopped"] = "stopped";
|
|
49442
|
-
})(DraftQueueOperationType
|
|
49511
|
+
})(DraftQueueOperationType || (DraftQueueOperationType = {}));
|
|
49443
49512
|
/**
|
|
49444
49513
|
* Converts the internal DraftAction's ResourceRequest into
|
|
49445
49514
|
* a DraftActionOperationType.
|
|
@@ -49453,11 +49522,11 @@ function getOperationTypeFrom(action) {
|
|
|
49453
49522
|
switch (action.data.method) {
|
|
49454
49523
|
case 'put':
|
|
49455
49524
|
case 'patch':
|
|
49456
|
-
return DraftActionOperationType
|
|
49525
|
+
return DraftActionOperationType.Update;
|
|
49457
49526
|
case 'post':
|
|
49458
|
-
return DraftActionOperationType
|
|
49527
|
+
return DraftActionOperationType.Create;
|
|
49459
49528
|
case 'delete':
|
|
49460
|
-
return DraftActionOperationType
|
|
49529
|
+
return DraftActionOperationType.Delete;
|
|
49461
49530
|
default:
|
|
49462
49531
|
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
49463
49532
|
throw new Error(`${action.data.method} is an unsupported request method type for DraftQueue.`);
|
|
@@ -49469,7 +49538,7 @@ function getOperationTypeFrom(action) {
|
|
|
49469
49538
|
}
|
|
49470
49539
|
}
|
|
49471
49540
|
else {
|
|
49472
|
-
return DraftActionOperationType
|
|
49541
|
+
return DraftActionOperationType.Custom;
|
|
49473
49542
|
}
|
|
49474
49543
|
}
|
|
49475
49544
|
function toQueueState(queue) {
|
|
@@ -49484,13 +49553,13 @@ class DraftManager {
|
|
|
49484
49553
|
constructor(draftQueue) {
|
|
49485
49554
|
this.listeners = [];
|
|
49486
49555
|
this.draftEventsShouldBeEmitted = [
|
|
49487
|
-
DraftQueueEventType
|
|
49488
|
-
DraftQueueEventType
|
|
49489
|
-
DraftQueueEventType
|
|
49490
|
-
DraftQueueEventType
|
|
49491
|
-
DraftQueueEventType
|
|
49492
|
-
DraftQueueEventType
|
|
49493
|
-
DraftQueueEventType
|
|
49556
|
+
DraftQueueEventType.ActionAdded,
|
|
49557
|
+
DraftQueueEventType.ActionUploading,
|
|
49558
|
+
DraftQueueEventType.ActionCompleted,
|
|
49559
|
+
DraftQueueEventType.ActionDeleted,
|
|
49560
|
+
DraftQueueEventType.ActionFailed,
|
|
49561
|
+
DraftQueueEventType.ActionUpdated,
|
|
49562
|
+
DraftQueueEventType.QueueStateChanged,
|
|
49494
49563
|
];
|
|
49495
49564
|
this.draftQueue = draftQueue;
|
|
49496
49565
|
draftQueue.registerOnChangedListener((event) => {
|
|
@@ -49502,28 +49571,28 @@ class DraftManager {
|
|
|
49502
49571
|
}
|
|
49503
49572
|
draftQueueEventTypeToOperationType(type) {
|
|
49504
49573
|
switch (type) {
|
|
49505
|
-
case DraftQueueEventType
|
|
49506
|
-
return DraftQueueOperationType
|
|
49507
|
-
case DraftQueueEventType
|
|
49508
|
-
return DraftQueueOperationType
|
|
49509
|
-
case DraftQueueEventType
|
|
49510
|
-
return DraftQueueOperationType
|
|
49511
|
-
case DraftQueueEventType
|
|
49512
|
-
return DraftQueueOperationType
|
|
49513
|
-
case DraftQueueEventType
|
|
49514
|
-
return DraftQueueOperationType
|
|
49515
|
-
case DraftQueueEventType
|
|
49516
|
-
return DraftQueueOperationType
|
|
49574
|
+
case DraftQueueEventType.ActionAdded:
|
|
49575
|
+
return DraftQueueOperationType.ItemAdded;
|
|
49576
|
+
case DraftQueueEventType.ActionUploading:
|
|
49577
|
+
return DraftQueueOperationType.ItemUploading;
|
|
49578
|
+
case DraftQueueEventType.ActionCompleted:
|
|
49579
|
+
return DraftQueueOperationType.ItemCompleted;
|
|
49580
|
+
case DraftQueueEventType.ActionDeleted:
|
|
49581
|
+
return DraftQueueOperationType.ItemDeleted;
|
|
49582
|
+
case DraftQueueEventType.ActionFailed:
|
|
49583
|
+
return DraftQueueOperationType.ItemFailed;
|
|
49584
|
+
case DraftQueueEventType.ActionUpdated:
|
|
49585
|
+
return DraftQueueOperationType.ItemUpdated;
|
|
49517
49586
|
default:
|
|
49518
49587
|
throw Error('Unsupported event type');
|
|
49519
49588
|
}
|
|
49520
49589
|
}
|
|
49521
49590
|
draftQueueStateToOperationType(state) {
|
|
49522
49591
|
switch (state) {
|
|
49523
|
-
case DraftQueueState
|
|
49524
|
-
return DraftQueueOperationType
|
|
49525
|
-
case DraftQueueState
|
|
49526
|
-
return DraftQueueOperationType
|
|
49592
|
+
case DraftQueueState.Started:
|
|
49593
|
+
return DraftQueueOperationType.QueueStarted;
|
|
49594
|
+
case DraftQueueState.Stopped:
|
|
49595
|
+
return DraftQueueOperationType.QueueStopped;
|
|
49527
49596
|
default:
|
|
49528
49597
|
throw Error('Unsupported event type');
|
|
49529
49598
|
}
|
|
@@ -49900,14 +49969,20 @@ function buildQueryTypeStringKey$1(args) {
|
|
|
49900
49969
|
*/
|
|
49901
49970
|
|
|
49902
49971
|
|
|
49972
|
+
const MAX_BATCH_SIZE = 2000;
|
|
49903
49973
|
class DataLoader {
|
|
49904
|
-
constructor(batchLoadFn) {
|
|
49974
|
+
constructor(batchLoadFn, options) {
|
|
49905
49975
|
this._batchLoadFn = batchLoadFn;
|
|
49906
49976
|
this._batch = null;
|
|
49907
49977
|
this._batchScheduleFn = function (fn) {
|
|
49908
49978
|
setTimeout(fn, 0);
|
|
49909
49979
|
};
|
|
49910
49980
|
this._cacheMap = new Map();
|
|
49981
|
+
this._maxBatchSize = MAX_BATCH_SIZE;
|
|
49982
|
+
if (options !== undefined) {
|
|
49983
|
+
const { maxBatchSize } = options;
|
|
49984
|
+
this._maxBatchSize = maxBatchSize || MAX_BATCH_SIZE;
|
|
49985
|
+
}
|
|
49911
49986
|
}
|
|
49912
49987
|
load(key) {
|
|
49913
49988
|
if (key === null || key === undefined) {
|
|
@@ -49937,7 +50012,9 @@ class DataLoader {
|
|
|
49937
50012
|
// If there is an existing batch which has not yet dispatched and is within
|
|
49938
50013
|
// the limit of the batch size, then return it.
|
|
49939
50014
|
const existingBatch = this._batch;
|
|
49940
|
-
if (existingBatch !== null &&
|
|
50015
|
+
if (existingBatch !== null &&
|
|
50016
|
+
!existingBatch.hasDispatched &&
|
|
50017
|
+
existingBatch.keys.length < this._maxBatchSize) {
|
|
49941
50018
|
return existingBatch;
|
|
49942
50019
|
}
|
|
49943
50020
|
// Otherwise, create a new batch for this loader.
|
|
@@ -52330,7 +52407,9 @@ function extendSchemaWithObjectInfos(cache, objectInfoMap) {
|
|
|
52330
52407
|
];
|
|
52331
52408
|
// extend the schema and add resolvers
|
|
52332
52409
|
const schema = addResolversToSchema(extendSchema(cache.getSchema(), extensions), polymorphicFieldTypeNames);
|
|
52410
|
+
const polymorphicFieldTypeNamesSet = new Set(polymorphicFieldTypeNames);
|
|
52333
52411
|
cache.setSchema(schema);
|
|
52412
|
+
cache.setPolymorphicFieldTypeNames([...polymorphicFieldTypeNamesSet]);
|
|
52334
52413
|
return cache;
|
|
52335
52414
|
}
|
|
52336
52415
|
/**
|
|
@@ -52486,7 +52565,10 @@ function extendExistingRecordType(schema, type, objectInfo, objectInfoMap) {
|
|
|
52486
52565
|
let typedScalars = new Set();
|
|
52487
52566
|
let parentRelationshipFields = new Set();
|
|
52488
52567
|
const existingFields = keys$4(type.getFields());
|
|
52489
|
-
const missingFields = values$2(objectInfo.fields).filter((field) =>
|
|
52568
|
+
const missingFields = values$2(objectInfo.fields).filter((field) => {
|
|
52569
|
+
return (existingFields.includes(field.apiName) === false ||
|
|
52570
|
+
(field.relationshipName !== null && field.referenceToInfos.length > 1));
|
|
52571
|
+
});
|
|
52490
52572
|
const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfoMap, parentRelationshipFields, 'Cached');
|
|
52491
52573
|
const { apiName, childRelationships } = objectInfo;
|
|
52492
52574
|
// handles child relationship
|
|
@@ -52586,8 +52668,10 @@ function makeRecordField(fieldRepresentations, objectInfoMap, existingParentRela
|
|
|
52586
52668
|
// For polymorphic field, its type is 'Record' inteface. The concrete entity type name is saved for field resolving of next phase
|
|
52587
52669
|
}
|
|
52588
52670
|
else if (field.referenceToInfos.length > 1) {
|
|
52589
|
-
|
|
52590
|
-
|
|
52671
|
+
if (recordTypeInSchema === 'Missing') {
|
|
52672
|
+
existingParentRelationships.add(field.relationshipName);
|
|
52673
|
+
fields += `${field.relationshipName}: Record\n`;
|
|
52674
|
+
}
|
|
52591
52675
|
for (const relation of field.referenceToInfos) {
|
|
52592
52676
|
if (objectInfoMap[relation.apiName] !== undefined) {
|
|
52593
52677
|
polymorphicFieldTypeNames.add(relation.apiName);
|
|
@@ -55036,34 +55120,42 @@ function applyReferenceLinksToDraft(record, draftMetadata) {
|
|
|
55036
55120
|
}
|
|
55037
55121
|
const { dataType, relationshipName, referenceToInfos } = fieldInfo;
|
|
55038
55122
|
const draftFieldValue = record.fields[draftField].value;
|
|
55039
|
-
if (dataType === 'Reference' && relationshipName !== null
|
|
55040
|
-
if (
|
|
55041
|
-
|
|
55123
|
+
if (dataType === 'Reference' && relationshipName !== null) {
|
|
55124
|
+
if (draftFieldValue === null) {
|
|
55125
|
+
recordFields[relationshipName] = {
|
|
55126
|
+
displayValue: null,
|
|
55127
|
+
value: null,
|
|
55128
|
+
};
|
|
55042
55129
|
}
|
|
55043
|
-
|
|
55044
|
-
|
|
55045
|
-
|
|
55046
|
-
displayValue: null,
|
|
55047
|
-
value: createLink$2(key),
|
|
55048
|
-
};
|
|
55049
|
-
// for custom objects, we select the 'Name' field
|
|
55050
|
-
// otherwise we check the object info for name fields.
|
|
55051
|
-
//if there are multiple we select 'Name' if it exists, otherwise the first one
|
|
55052
|
-
if (referencedRecord !== undefined && referenceToInfos.length > 0) {
|
|
55053
|
-
let nameField;
|
|
55054
|
-
const referenceToInfo = referenceToInfos[0];
|
|
55055
|
-
const nameFields = referenceToInfo.nameFields;
|
|
55056
|
-
if (nameFields.length !== 0) {
|
|
55057
|
-
nameField = nameFields.find((x) => x === 'Name');
|
|
55058
|
-
if (nameField === undefined) {
|
|
55059
|
-
nameField = nameFields[0];
|
|
55060
|
-
}
|
|
55130
|
+
else {
|
|
55131
|
+
if (typeof draftFieldValue !== 'string') {
|
|
55132
|
+
throw Error('reference field value is not a string');
|
|
55061
55133
|
}
|
|
55062
|
-
|
|
55063
|
-
|
|
55064
|
-
|
|
55065
|
-
|
|
55066
|
-
|
|
55134
|
+
const key = getRecordKeyForId(luvio, draftFieldValue);
|
|
55135
|
+
const referencedRecord = referencedRecords.get(key);
|
|
55136
|
+
recordFields[relationshipName] = {
|
|
55137
|
+
displayValue: null,
|
|
55138
|
+
value: createLink$2(key),
|
|
55139
|
+
};
|
|
55140
|
+
// for custom objects, we select the 'Name' field
|
|
55141
|
+
// otherwise we check the object info for name fields.
|
|
55142
|
+
//if there are multiple we select 'Name' if it exists, otherwise the first one
|
|
55143
|
+
if (referencedRecord !== undefined && referenceToInfos.length > 0) {
|
|
55144
|
+
let nameField;
|
|
55145
|
+
const referenceToInfo = referenceToInfos[0];
|
|
55146
|
+
const nameFields = referenceToInfo.nameFields;
|
|
55147
|
+
if (nameFields.length !== 0) {
|
|
55148
|
+
nameField = nameFields.find((x) => x === 'Name');
|
|
55149
|
+
if (nameField === undefined) {
|
|
55150
|
+
nameField = nameFields[0];
|
|
55151
|
+
}
|
|
55152
|
+
}
|
|
55153
|
+
if (nameField !== undefined) {
|
|
55154
|
+
const nameFieldRef = referencedRecord.fields[nameField];
|
|
55155
|
+
if (nameFieldRef) {
|
|
55156
|
+
recordFields[relationshipName].displayValue =
|
|
55157
|
+
(_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
|
|
55158
|
+
}
|
|
55067
55159
|
}
|
|
55068
55160
|
}
|
|
55069
55161
|
}
|
|
@@ -55356,17 +55448,8 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
55356
55448
|
};
|
|
55357
55449
|
for (const fieldName of keys$3$1(recordWithSpanningRefLinks.fields)) {
|
|
55358
55450
|
const fieldKey = buildRecordFieldStoreKey(key, fieldName);
|
|
55359
|
-
|
|
55360
|
-
|
|
55361
|
-
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55362
|
-
publishData(fieldKey, fieldData);
|
|
55363
|
-
}
|
|
55364
|
-
else if (recordWithSpanningRefLinks.fields[fieldName] &&
|
|
55365
|
-
recordWithSpanningRefLinks.fields[fieldName].value &&
|
|
55366
|
-
recordWithSpanningRefLinks.fields[fieldName].value.__ref !== undefined) {
|
|
55367
|
-
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55368
|
-
publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
|
|
55369
|
-
}
|
|
55451
|
+
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55452
|
+
publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
|
|
55370
55453
|
}
|
|
55371
55454
|
// publish the normalized record
|
|
55372
55455
|
publishData(key, normalizedRecord);
|
|
@@ -58013,29 +58096,29 @@ const withInstrumentation = (operation, config) => {
|
|
|
58013
58096
|
function instrumentDraftQueue(queue) {
|
|
58014
58097
|
queue.registerOnChangedListener((draftQueueEvent) => {
|
|
58015
58098
|
switch (draftQueueEvent.type) {
|
|
58016
|
-
case DraftQueueEventType
|
|
58099
|
+
case DraftQueueEventType.QueueStateChanged:
|
|
58017
58100
|
switch (draftQueueEvent.state) {
|
|
58018
|
-
case DraftQueueState
|
|
58101
|
+
case DraftQueueState.Error:
|
|
58019
58102
|
break;
|
|
58020
|
-
case DraftQueueState
|
|
58103
|
+
case DraftQueueState.Started:
|
|
58021
58104
|
break;
|
|
58022
|
-
case DraftQueueState
|
|
58105
|
+
case DraftQueueState.Stopped:
|
|
58023
58106
|
break;
|
|
58024
|
-
case DraftQueueState
|
|
58107
|
+
case DraftQueueState.Waiting:
|
|
58025
58108
|
break;
|
|
58026
58109
|
}
|
|
58027
58110
|
break;
|
|
58028
|
-
case DraftQueueEventType
|
|
58111
|
+
case DraftQueueEventType.ActionAdded:
|
|
58029
58112
|
break;
|
|
58030
|
-
case DraftQueueEventType
|
|
58113
|
+
case DraftQueueEventType.ActionUploading:
|
|
58031
58114
|
break;
|
|
58032
|
-
case DraftQueueEventType
|
|
58115
|
+
case DraftQueueEventType.ActionCompleted:
|
|
58033
58116
|
break;
|
|
58034
|
-
case DraftQueueEventType
|
|
58117
|
+
case DraftQueueEventType.ActionDeleted:
|
|
58035
58118
|
break;
|
|
58036
|
-
case DraftQueueEventType
|
|
58119
|
+
case DraftQueueEventType.ActionFailed:
|
|
58037
58120
|
break;
|
|
58038
|
-
case DraftQueueEventType
|
|
58121
|
+
case DraftQueueEventType.ActionUpdated:
|
|
58039
58122
|
break;
|
|
58040
58123
|
}
|
|
58041
58124
|
return Promise.resolve();
|
|
@@ -58196,6 +58279,14 @@ class ObjectInfoService {
|
|
|
58196
58279
|
return this.updateObjectInfoMapping(keyPrefix, apiName);
|
|
58197
58280
|
}
|
|
58198
58281
|
};
|
|
58282
|
+
this.getCachedObjectInfoStatus = async () => {
|
|
58283
|
+
const infos = await this.readObjectInfoDataFromDurableStore();
|
|
58284
|
+
const map = new Map();
|
|
58285
|
+
infos.forEach(({ apiName, expirationTimestamp }) => {
|
|
58286
|
+
map.set(apiName, { expiration: expirationTimestamp });
|
|
58287
|
+
});
|
|
58288
|
+
return map;
|
|
58289
|
+
};
|
|
58199
58290
|
this.isObjectInfoInDurableStore = async (apiName) => {
|
|
58200
58291
|
if (this.apiNameToKeyPrefixMemoryCache[apiName] !== undefined) {
|
|
58201
58292
|
return Promise.resolve(true);
|
|
@@ -58204,12 +58295,10 @@ class ObjectInfoService {
|
|
|
58204
58295
|
return this.apiNameToKeyPrefixMemoryCache[apiName] !== undefined;
|
|
58205
58296
|
};
|
|
58206
58297
|
this.loadObjectInfoMaps = async () => {
|
|
58207
|
-
const
|
|
58208
|
-
|
|
58209
|
-
const apiName = row[0];
|
|
58210
|
-
const keyPrefix = row[1];
|
|
58298
|
+
const infos = await this.readObjectInfoDataFromDurableStore();
|
|
58299
|
+
infos.forEach(({ keyPrefix, apiName }) => {
|
|
58211
58300
|
this.updateObjectInfoMapping(keyPrefix, apiName);
|
|
58212
|
-
}
|
|
58301
|
+
});
|
|
58213
58302
|
};
|
|
58214
58303
|
this.updateObjectInfoMapping = (keyPrefix, apiName) => {
|
|
58215
58304
|
this.apiNameToKeyPrefixMemoryCache[apiName] = keyPrefix;
|
|
@@ -58253,6 +58342,24 @@ class ObjectInfoService {
|
|
|
58253
58342
|
}
|
|
58254
58343
|
return snapshot.data;
|
|
58255
58344
|
}
|
|
58345
|
+
async readObjectInfoDataFromDurableStore() {
|
|
58346
|
+
const rows = (await this.durableStore.query(`
|
|
58347
|
+
SELECT
|
|
58348
|
+
json_extract(data, '$.apiName') as ApiName,
|
|
58349
|
+
json_extract(data, '$.keyPrefix') as keyPrefix,
|
|
58350
|
+
JSON_EXTRACT(metadata, '$.expirationTimestamp') AS expirationTimestamp
|
|
58351
|
+
from
|
|
58352
|
+
lds_data
|
|
58353
|
+
where
|
|
58354
|
+
key like '%ObjectInfoRepresentation%'`, [])).rows;
|
|
58355
|
+
return rows.map((row) => {
|
|
58356
|
+
return {
|
|
58357
|
+
apiName: row[0],
|
|
58358
|
+
keyPrefix: row[1],
|
|
58359
|
+
expirationTimestamp: row[2],
|
|
58360
|
+
};
|
|
58361
|
+
});
|
|
58362
|
+
}
|
|
58256
58363
|
}
|
|
58257
58364
|
|
|
58258
58365
|
function instrumentGraphQLEval(adapter) {
|
|
@@ -59341,7 +59448,7 @@ class ConflictPool {
|
|
|
59341
59448
|
}
|
|
59342
59449
|
}
|
|
59343
59450
|
|
|
59344
|
-
const DEFAULT_BATCH_SIZE = 500;
|
|
59451
|
+
const DEFAULT_BATCH_SIZE$1 = 500;
|
|
59345
59452
|
const DEFAULT_CONCURRENCY = 6;
|
|
59346
59453
|
const DEFAULT_GQL_QUERY_BATCH_SIZE = 5;
|
|
59347
59454
|
class PrimingSession extends EventEmitter {
|
|
@@ -59349,7 +59456,7 @@ class PrimingSession extends EventEmitter {
|
|
|
59349
59456
|
var _a, _b;
|
|
59350
59457
|
super();
|
|
59351
59458
|
this.useBatchGQL = false;
|
|
59352
|
-
this.batchSize = (_a = config.batchSize) !== null && _a !== void 0 ? _a : DEFAULT_BATCH_SIZE;
|
|
59459
|
+
this.batchSize = (_a = config.batchSize) !== null && _a !== void 0 ? _a : DEFAULT_BATCH_SIZE$1;
|
|
59353
59460
|
this.concurrency = (_b = config.concurrency) !== null && _b !== void 0 ? _b : DEFAULT_CONCURRENCY;
|
|
59354
59461
|
this.recordLoader = config.recordLoader;
|
|
59355
59462
|
this.recordIngestor = config.recordIngestor;
|
|
@@ -59968,10 +60075,6 @@ class NimbusPrimingNetworkAdapter {
|
|
|
59968
60075
|
// ref: https://gnome.pages.gitlab.gnome.org/tracker/docs/developer/limits.html?gi-language=c
|
|
59969
60076
|
const SQLITE_MAX_VARIABLE_NUMBER = 999;
|
|
59970
60077
|
const PARAMS_PER_RECORD = 3;
|
|
59971
|
-
/**
|
|
59972
|
-
* No key builder (or adapter) exists for the object info directory, we need to build the key manually
|
|
59973
|
-
*/
|
|
59974
|
-
const ObjectInfoDirectoryKey = `${keyPrefix$2}::${RepresentationType$H}:`;
|
|
59975
60078
|
// We need to batch the records to avoid hitting the SQLITE_MAX_VARIABLE_NUMBER limit. Each record has 3 parameters
|
|
59976
60079
|
const BATCH_SIZE = Math.floor(SQLITE_MAX_VARIABLE_NUMBER / PARAMS_PER_RECORD);
|
|
59977
60080
|
class SqlitePrimingStore {
|
|
@@ -60036,44 +60139,6 @@ class SqlitePrimingStore {
|
|
|
60036
60139
|
};
|
|
60037
60140
|
}
|
|
60038
60141
|
}
|
|
60039
|
-
async readObjectInfoDirectory() {
|
|
60040
|
-
const sql = 'SELECT data FROM lds_data WHERE key = ?';
|
|
60041
|
-
const params = [ObjectInfoDirectoryKey];
|
|
60042
|
-
const result = await this.store.query(sql, params);
|
|
60043
|
-
if (result.rows.length === 1) {
|
|
60044
|
-
return JSON.parse(result.rows[0][0]);
|
|
60045
|
-
}
|
|
60046
|
-
return undefined;
|
|
60047
|
-
}
|
|
60048
|
-
async readObjectApiNames() {
|
|
60049
|
-
const sql = 'SELECT key FROM lds_data WHERE key like ?';
|
|
60050
|
-
const params = [`%${RepresentationType$M}%`];
|
|
60051
|
-
const result = await this.store.query(sql, params);
|
|
60052
|
-
const apiNames = new Set();
|
|
60053
|
-
result.rows.forEach((row) => {
|
|
60054
|
-
const key = row[0];
|
|
60055
|
-
const parts = key.split(':');
|
|
60056
|
-
apiNames.add(parts[parts.length - 1]);
|
|
60057
|
-
});
|
|
60058
|
-
return apiNames;
|
|
60059
|
-
}
|
|
60060
|
-
writeObjectInfoDirectory(directory) {
|
|
60061
|
-
const sql = 'INSERT or IGNORE into lds_data (key, data) values (?, ?)';
|
|
60062
|
-
const params = [ObjectInfoDirectoryKey, JSON.stringify(directory)];
|
|
60063
|
-
return this.store.query(sql, params).then(() => { });
|
|
60064
|
-
}
|
|
60065
|
-
writeObjectInfos(objectInfos) {
|
|
60066
|
-
const sql = `INSERT or IGNORE into lds_data (key, data) values ${objectInfos
|
|
60067
|
-
.map(() => '(?, ?)')
|
|
60068
|
-
.join(',')};`;
|
|
60069
|
-
const params = [];
|
|
60070
|
-
objectInfos.forEach((objectInfo) => {
|
|
60071
|
-
const key = keyBuilder$1Q(this.getLuvio(), { apiName: objectInfo.apiName });
|
|
60072
|
-
params.push(key);
|
|
60073
|
-
params.push(JSON.stringify(objectInfo));
|
|
60074
|
-
});
|
|
60075
|
-
return this.store.query(sql, params).then(() => { });
|
|
60076
|
-
}
|
|
60077
60142
|
}
|
|
60078
60143
|
function batchArray(arr, batchSize = BATCH_SIZE) {
|
|
60079
60144
|
const batches = [];
|
|
@@ -60148,9 +60213,7 @@ function primingSessionFactory(config) {
|
|
|
60148
60213
|
recordLoader,
|
|
60149
60214
|
recordIngestor,
|
|
60150
60215
|
store: primingStore,
|
|
60151
|
-
objectInfoLoader:
|
|
60152
|
-
getObjectInfos: objectInfoService.getObjectInfos.bind(objectInfoService),
|
|
60153
|
-
},
|
|
60216
|
+
objectInfoLoader: objectInfoService,
|
|
60154
60217
|
concurrency: config.concurrency,
|
|
60155
60218
|
batchSize: config.batchSize,
|
|
60156
60219
|
ldsRecordRefresher: new LdsPrimingRecordRefresher(config.getRecords),
|
|
@@ -60313,7 +60376,7 @@ register$1({
|
|
|
60313
60376
|
id: '@salesforce/lds-network-adapter',
|
|
60314
60377
|
instrument: instrument$2,
|
|
60315
60378
|
});
|
|
60316
|
-
// version: 1.
|
|
60379
|
+
// version: 1.249.0-11c3e1ed5
|
|
60317
60380
|
|
|
60318
60381
|
const { create: create$3, keys: keys$3 } = Object;
|
|
60319
60382
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -78090,10 +78153,11 @@ function buildNetworkSnapshot$2(luvio, config, options) {
|
|
|
78090
78153
|
}
|
|
78091
78154
|
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
78092
78155
|
const { luvio, config } = context;
|
|
78093
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
78156
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
78094
78157
|
const dispatchOptions = {
|
|
78095
78158
|
resourceRequestContext: {
|
|
78096
78159
|
requestCorrelator,
|
|
78160
|
+
sourceContext,
|
|
78097
78161
|
luvioRequestMethod: 'get',
|
|
78098
78162
|
},
|
|
78099
78163
|
eventObservers,
|
|
@@ -78635,7 +78699,7 @@ register$1({
|
|
|
78635
78699
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
78636
78700
|
instrument: instrument$1,
|
|
78637
78701
|
});
|
|
78638
|
-
// version: 1.
|
|
78702
|
+
// version: 1.249.0-15efc7f9b
|
|
78639
78703
|
|
|
78640
78704
|
// On core the unstable adapters are re-exported with different names,
|
|
78641
78705
|
// we want to match them here.
|
|
@@ -80750,10 +80814,11 @@ function buildInMemorySnapshot(context, storeLookup) {
|
|
|
80750
80814
|
}
|
|
80751
80815
|
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
80752
80816
|
const { config, fragment, luvio } = context;
|
|
80753
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
80817
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
80754
80818
|
const dispatchOptions = {
|
|
80755
80819
|
resourceRequestContext: {
|
|
80756
80820
|
requestCorrelator,
|
|
80821
|
+
sourceContext,
|
|
80757
80822
|
},
|
|
80758
80823
|
eventObservers,
|
|
80759
80824
|
};
|
|
@@ -80884,7 +80949,7 @@ withDefaultLuvio((luvio) => {
|
|
|
80884
80949
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
80885
80950
|
graphQLImperative = ldsAdapter;
|
|
80886
80951
|
});
|
|
80887
|
-
// version: 1.
|
|
80952
|
+
// version: 1.249.0-15efc7f9b
|
|
80888
80953
|
|
|
80889
80954
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
80890
80955
|
__proto__: null,
|
|
@@ -81582,7 +81647,7 @@ const callbacks$1 = [];
|
|
|
81582
81647
|
function register(r) {
|
|
81583
81648
|
callbacks$1.forEach((callback) => callback(r));
|
|
81584
81649
|
}
|
|
81585
|
-
// version: 1.
|
|
81650
|
+
// version: 1.249.0-11c3e1ed5
|
|
81586
81651
|
|
|
81587
81652
|
/**
|
|
81588
81653
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -86226,142 +86291,6 @@ function removeEventHandler(session, handler) {
|
|
|
86226
86291
|
}
|
|
86227
86292
|
}
|
|
86228
86293
|
|
|
86229
|
-
/**
|
|
86230
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
86231
|
-
* All rights reserved.
|
|
86232
|
-
* For full license text, see the LICENSE.txt file
|
|
86233
|
-
*/
|
|
86234
|
-
|
|
86235
|
-
|
|
86236
|
-
var DraftActionStatus;
|
|
86237
|
-
(function (DraftActionStatus) {
|
|
86238
|
-
DraftActionStatus["Pending"] = "pending";
|
|
86239
|
-
DraftActionStatus["Uploading"] = "uploading";
|
|
86240
|
-
DraftActionStatus["Error"] = "error";
|
|
86241
|
-
DraftActionStatus["Completed"] = "completed";
|
|
86242
|
-
})(DraftActionStatus || (DraftActionStatus = {}));
|
|
86243
|
-
var ProcessActionResult;
|
|
86244
|
-
(function (ProcessActionResult) {
|
|
86245
|
-
// non-2xx network error, requires user intervention
|
|
86246
|
-
ProcessActionResult["ACTION_ERRORED"] = "ERROR";
|
|
86247
|
-
// upload succeeded
|
|
86248
|
-
ProcessActionResult["ACTION_SUCCEEDED"] = "SUCCESS";
|
|
86249
|
-
// queue is empty
|
|
86250
|
-
ProcessActionResult["NO_ACTION_TO_PROCESS"] = "NO_ACTION_TO_PROCESS";
|
|
86251
|
-
// network request is in flight
|
|
86252
|
-
ProcessActionResult["ACTION_ALREADY_PROCESSING"] = "ACTION_ALREADY_PROCESSING";
|
|
86253
|
-
// network call failed (offline)
|
|
86254
|
-
ProcessActionResult["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
86255
|
-
// queue is blocked on an error that requires user intervention
|
|
86256
|
-
ProcessActionResult["BLOCKED_ON_ERROR"] = "BLOCKED_ON_ERROR";
|
|
86257
|
-
//waiting for user to execute custom action
|
|
86258
|
-
ProcessActionResult["CUSTOM_ACTION_WAITING"] = "CUSTOM_ACTION_WAITING";
|
|
86259
|
-
})(ProcessActionResult || (ProcessActionResult = {}));
|
|
86260
|
-
var DraftQueueState;
|
|
86261
|
-
(function (DraftQueueState) {
|
|
86262
|
-
/** Currently processing an item in the queue or queue is empty and waiting to process the next item. */
|
|
86263
|
-
DraftQueueState["Started"] = "started";
|
|
86264
|
-
/**
|
|
86265
|
-
* The queue is stopped and will not attempt to upload any drafts until startDraftQueue() is called.
|
|
86266
|
-
* This is the initial state when the DraftQueue gets instantiated.
|
|
86267
|
-
*/
|
|
86268
|
-
DraftQueueState["Stopped"] = "stopped";
|
|
86269
|
-
/**
|
|
86270
|
-
* The queue is stopped due to a blocking error from the last upload attempt.
|
|
86271
|
-
* The queue will not run again until startDraftQueue() is called.
|
|
86272
|
-
*/
|
|
86273
|
-
DraftQueueState["Error"] = "error";
|
|
86274
|
-
/**
|
|
86275
|
-
* There was a network error and the queue will attempt to upload again shortly.
|
|
86276
|
-
* To attempt to force an upload now call startDraftQueue().
|
|
86277
|
-
*/
|
|
86278
|
-
DraftQueueState["Waiting"] = "waiting";
|
|
86279
|
-
})(DraftQueueState || (DraftQueueState = {}));
|
|
86280
|
-
var DraftQueueEventType;
|
|
86281
|
-
(function (DraftQueueEventType) {
|
|
86282
|
-
/**
|
|
86283
|
-
* Triggered after an action had been added to the queue
|
|
86284
|
-
*/
|
|
86285
|
-
DraftQueueEventType["ActionAdded"] = "added";
|
|
86286
|
-
/**
|
|
86287
|
-
* Triggered when starting to upload and process an action
|
|
86288
|
-
*/
|
|
86289
|
-
DraftQueueEventType["ActionUploading"] = "uploading";
|
|
86290
|
-
/**
|
|
86291
|
-
* Triggered once an action failed
|
|
86292
|
-
*/
|
|
86293
|
-
DraftQueueEventType["ActionFailed"] = "failed";
|
|
86294
|
-
/**
|
|
86295
|
-
* Triggered after an action has been deleted from the queue
|
|
86296
|
-
*/
|
|
86297
|
-
DraftQueueEventType["ActionDeleted"] = "deleted";
|
|
86298
|
-
/**
|
|
86299
|
-
* Triggered after an action has been completed and after it has been removed from the queue
|
|
86300
|
-
*/
|
|
86301
|
-
DraftQueueEventType["ActionCompleted"] = "completed";
|
|
86302
|
-
/**
|
|
86303
|
-
* Triggered after an action has been updated by the updateAction API
|
|
86304
|
-
*/
|
|
86305
|
-
DraftQueueEventType["ActionUpdated"] = "updated";
|
|
86306
|
-
/**
|
|
86307
|
-
* Triggered after the Draft Queue state changes
|
|
86308
|
-
*/
|
|
86309
|
-
DraftQueueEventType["QueueStateChanged"] = "state";
|
|
86310
|
-
})(DraftQueueEventType || (DraftQueueEventType = {}));
|
|
86311
|
-
var QueueOperationType;
|
|
86312
|
-
(function (QueueOperationType) {
|
|
86313
|
-
QueueOperationType["Add"] = "add";
|
|
86314
|
-
QueueOperationType["Delete"] = "delete";
|
|
86315
|
-
QueueOperationType["Update"] = "update";
|
|
86316
|
-
})(QueueOperationType || (QueueOperationType = {}));
|
|
86317
|
-
/**
|
|
86318
|
-
Use Math.random to generate v4 RFC4122 compliant uuid
|
|
86319
|
-
*/
|
|
86320
|
-
function uuidv4() {
|
|
86321
|
-
const uuid = [];
|
|
86322
|
-
for (let i = 0; i < 32; i++) {
|
|
86323
|
-
const random = (Math.random() * 16) | 0;
|
|
86324
|
-
if (i === 8 || i === 12 || i === 16 || i === 20) {
|
|
86325
|
-
uuid.push('-');
|
|
86326
|
-
}
|
|
86327
|
-
uuid.push((i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16));
|
|
86328
|
-
}
|
|
86329
|
-
return uuid.join('');
|
|
86330
|
-
}
|
|
86331
|
-
|
|
86332
|
-
var CustomActionResultType;
|
|
86333
|
-
(function (CustomActionResultType) {
|
|
86334
|
-
CustomActionResultType["SUCCESS"] = "SUCCESS";
|
|
86335
|
-
CustomActionResultType["FAILURE"] = "FAILURE";
|
|
86336
|
-
})(CustomActionResultType || (CustomActionResultType = {}));
|
|
86337
|
-
var CustomActionErrorType;
|
|
86338
|
-
(function (CustomActionErrorType) {
|
|
86339
|
-
CustomActionErrorType["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
86340
|
-
CustomActionErrorType["CLIENT_ERROR"] = "CLIENT_ERROR";
|
|
86341
|
-
})(CustomActionErrorType || (CustomActionErrorType = {}));
|
|
86342
|
-
|
|
86343
|
-
/**
|
|
86344
|
-
* Denotes what kind of operation a DraftQueueItem represents.
|
|
86345
|
-
*/
|
|
86346
|
-
var DraftActionOperationType;
|
|
86347
|
-
(function (DraftActionOperationType) {
|
|
86348
|
-
DraftActionOperationType["Create"] = "create";
|
|
86349
|
-
DraftActionOperationType["Update"] = "update";
|
|
86350
|
-
DraftActionOperationType["Delete"] = "delete";
|
|
86351
|
-
DraftActionOperationType["Custom"] = "custom";
|
|
86352
|
-
})(DraftActionOperationType || (DraftActionOperationType = {}));
|
|
86353
|
-
var DraftQueueOperationType;
|
|
86354
|
-
(function (DraftQueueOperationType) {
|
|
86355
|
-
DraftQueueOperationType["ItemAdded"] = "added";
|
|
86356
|
-
DraftQueueOperationType["ItemUploading"] = "uploading";
|
|
86357
|
-
DraftQueueOperationType["ItemDeleted"] = "deleted";
|
|
86358
|
-
DraftQueueOperationType["ItemCompleted"] = "completed";
|
|
86359
|
-
DraftQueueOperationType["ItemFailed"] = "failed";
|
|
86360
|
-
DraftQueueOperationType["ItemUpdated"] = "updated";
|
|
86361
|
-
DraftQueueOperationType["QueueStarted"] = "started";
|
|
86362
|
-
DraftQueueOperationType["QueueStopped"] = "stopped";
|
|
86363
|
-
})(DraftQueueOperationType || (DraftQueueOperationType = {}));
|
|
86364
|
-
|
|
86365
86294
|
var EvictStatus;
|
|
86366
86295
|
(function (EvictStatus) {
|
|
86367
86296
|
EvictStatus["Started"] = "Started";
|
|
@@ -86378,7 +86307,7 @@ const EVICTION_IN_PROGESS_MESSAGE = `Cache eviction in progress. Can't start ano
|
|
|
86378
86307
|
* Only one eviction is allowed at a time. running status is return when evictCacheRecordsByIds or
|
|
86379
86308
|
* evictExpiredCacheEntries is called if there's already an eviction in progress.
|
|
86380
86309
|
*/
|
|
86381
|
-
var
|
|
86310
|
+
var activeEvictionInProgress = false;
|
|
86382
86311
|
var cancelCurrentEviction = false;
|
|
86383
86312
|
/**
|
|
86384
86313
|
* Purging records specified by an array of record id from durable store
|
|
@@ -86391,13 +86320,13 @@ var cancelCurrentEviction = false;
|
|
|
86391
86320
|
*/
|
|
86392
86321
|
function evictCacheRecordsByIds(recordIds, onProgressUpdate) {
|
|
86393
86322
|
// Send error back if an eviction is going on.
|
|
86394
|
-
if (
|
|
86323
|
+
if (activeEvictionInProgress) {
|
|
86395
86324
|
return {
|
|
86396
86325
|
status: EvictStatus.Running,
|
|
86397
86326
|
message: EVICTION_IN_PROGESS_MESSAGE,
|
|
86398
86327
|
};
|
|
86399
86328
|
}
|
|
86400
|
-
|
|
86329
|
+
activeEvictionInProgress = true;
|
|
86401
86330
|
cancelCurrentEviction = false;
|
|
86402
86331
|
const evictAChunk = () => {
|
|
86403
86332
|
evictChunksOfRecord(recordIds).then(onEvicted);
|
|
@@ -86418,13 +86347,13 @@ function evictCacheRecordsByIds(recordIds, onProgressUpdate) {
|
|
|
86418
86347
|
*/
|
|
86419
86348
|
function evictExpiredCacheEntries(expiredByDays, onProgressUpdate) {
|
|
86420
86349
|
// Send error back if an eviction is going on.
|
|
86421
|
-
if (
|
|
86350
|
+
if (activeEvictionInProgress) {
|
|
86422
86351
|
return {
|
|
86423
86352
|
status: EvictStatus.Running,
|
|
86424
86353
|
message: EVICTION_IN_PROGESS_MESSAGE,
|
|
86425
86354
|
};
|
|
86426
86355
|
}
|
|
86427
|
-
|
|
86356
|
+
activeEvictionInProgress = true;
|
|
86428
86357
|
cancelCurrentEviction = false;
|
|
86429
86358
|
const overdueExpirationTimeStamp = Date.now() - expiredByDays * 24 * 3600 * 1000;
|
|
86430
86359
|
const evictAChunk = () => {
|
|
@@ -86438,7 +86367,7 @@ function evictExpiredCacheEntries(expiredByDays, onProgressUpdate) {
|
|
|
86438
86367
|
* Signal to stop current eviction if there's an active eviction going on.
|
|
86439
86368
|
*/
|
|
86440
86369
|
function stopEviction() {
|
|
86441
|
-
if (
|
|
86370
|
+
if (activeEvictionInProgress) {
|
|
86442
86371
|
cancelCurrentEviction = true;
|
|
86443
86372
|
}
|
|
86444
86373
|
}
|
|
@@ -86453,11 +86382,11 @@ function getOnEvictedCallback(onProgressUpdate, evictAChunk) {
|
|
|
86453
86382
|
onProgressUpdate(progress);
|
|
86454
86383
|
const { status } = progress;
|
|
86455
86384
|
if (status === EvictStatus.Succeeded || status === EvictStatus.Error) {
|
|
86456
|
-
|
|
86385
|
+
activeEvictionInProgress = false;
|
|
86457
86386
|
}
|
|
86458
86387
|
if (status === EvictStatus.Evicted) {
|
|
86459
86388
|
if (cancelCurrentEviction) {
|
|
86460
|
-
|
|
86389
|
+
activeEvictionInProgress = false;
|
|
86461
86390
|
onProgressUpdate({ status: EvictStatus.Canceled });
|
|
86462
86391
|
}
|
|
86463
86392
|
else {
|
|
@@ -86533,7 +86462,8 @@ function evictChunkOfOverdueEntries(overdueExpirationTimestamp) {
|
|
|
86533
86462
|
WHERE key NOT LIKE 'UiApi::ObjectInfoRepresentation:%'
|
|
86534
86463
|
AND
|
|
86535
86464
|
(
|
|
86536
|
-
key NOT LIKE 'UiApi::RecordRepresentation:%'
|
|
86465
|
+
key NOT LIKE 'UiApi::RecordRepresentation:%' AND
|
|
86466
|
+
JSON_EXTRACT(metadata, '$.expirationTimestamp') < ${overdueExpirationTimestamp}
|
|
86537
86467
|
OR
|
|
86538
86468
|
key LIKE 'UiApi::RecordRepresentation:%' AND
|
|
86539
86469
|
JSON_EXTRACT(data, '$.drafts') IS NULL AND
|
|
@@ -86580,4 +86510,4 @@ const { luvio } = getRuntime();
|
|
|
86580
86510
|
setDefaultLuvio({ luvio });
|
|
86581
86511
|
|
|
86582
86512
|
export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
|
|
86583
|
-
// version: 1.
|
|
86513
|
+
// version: 1.249.0-11c3e1ed5
|