@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
|
@@ -31,12 +31,15 @@
|
|
|
31
31
|
const { isArray: isArray$9 } = Array;
|
|
32
32
|
const { push: push$5, indexOf, slice: slice$2 } = Array.prototype;
|
|
33
33
|
const { parse: parse$a, stringify: stringify$a } = JSON;
|
|
34
|
+
const WeakSetCtor = WeakSet;
|
|
34
35
|
|
|
36
|
+
const deeplyFrozen = new WeakSetCtor();
|
|
35
37
|
function deepFreeze(value) {
|
|
36
|
-
// No need to freeze primitives
|
|
37
|
-
if (typeof value !== 'object' || value === null) {
|
|
38
|
+
// No need to freeze primitives or already frozen stuff
|
|
39
|
+
if (typeof value !== 'object' || value === null || deeplyFrozen.has(value)) {
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
42
|
+
deeplyFrozen.add(value);
|
|
40
43
|
if (isArray$9(value)) {
|
|
41
44
|
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
42
45
|
deepFreeze(value[i]);
|
|
@@ -581,6 +584,9 @@
|
|
|
581
584
|
this.reverseRedirectKeys = create$b(null);
|
|
582
585
|
this.currentSnapshotId = 0;
|
|
583
586
|
this.scheduler = options.scheduler || buildDefaultScheduler();
|
|
587
|
+
if (options.initialData) {
|
|
588
|
+
this.deserialize(options.initialData, options.resetInitialDataTtls);
|
|
589
|
+
}
|
|
584
590
|
}
|
|
585
591
|
// interface methods
|
|
586
592
|
readEntry(key) {
|
|
@@ -1161,6 +1167,25 @@
|
|
|
1161
1167
|
},
|
|
1162
1168
|
};
|
|
1163
1169
|
}
|
|
1170
|
+
deserialize(storeData, resetInitialDataTtls) {
|
|
1171
|
+
const luvioStoreData = storeData.luvioStoreData;
|
|
1172
|
+
if (Serialized_StringKey_Version === luvioStoreData.version) {
|
|
1173
|
+
this.records = luvioStoreData.data;
|
|
1174
|
+
this.metadata = this.calculateAndSetNewTTLs(luvioStoreData.metadata, resetInitialDataTtls);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
calculateAndSetNewTTLs(storeMetadata, resetInitialDataTtls) {
|
|
1178
|
+
if (resetInitialDataTtls === true) {
|
|
1179
|
+
const now = Date.now();
|
|
1180
|
+
keys$c(storeMetadata).forEach((key) => {
|
|
1181
|
+
const storeMetadataEntry = storeMetadata[key];
|
|
1182
|
+
const ttl = storeMetadataEntry.expirationTimestamp - storeMetadataEntry.ingestionTimestamp;
|
|
1183
|
+
storeMetadataEntry.ingestionTimestamp = now;
|
|
1184
|
+
storeMetadataEntry.expirationTimestamp = now + ttl;
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
return storeMetadata;
|
|
1188
|
+
}
|
|
1164
1189
|
}
|
|
1165
1190
|
|
|
1166
1191
|
function hasOverlappingIds(snapshot, visitedIds) {
|
|
@@ -1796,6 +1821,10 @@
|
|
|
1796
1821
|
}
|
|
1797
1822
|
}
|
|
1798
1823
|
markVisited(canonicalKey) {
|
|
1824
|
+
if (typeof canonicalKey === 'string') {
|
|
1825
|
+
this.fallbackStringKeyInMemoryStore.markVisited(canonicalKey);
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1799
1828
|
const { visitedIdsSet, reverseRedirectKeysMap } = this;
|
|
1800
1829
|
let redirectKey = canonicalKey;
|
|
1801
1830
|
// mark all redirects leading up to the canonical key as visited so
|
|
@@ -2111,7 +2140,7 @@
|
|
|
2111
2140
|
if (isStoreRecordError$1(linked)) {
|
|
2112
2141
|
return new GraphNodeError(this.store, linked);
|
|
2113
2142
|
}
|
|
2114
|
-
return new GraphNode(this.store, linked);
|
|
2143
|
+
return new GraphNode(this.store, linked, __ref);
|
|
2115
2144
|
}
|
|
2116
2145
|
linkData() {
|
|
2117
2146
|
return this.data.data;
|
|
@@ -2121,10 +2150,11 @@
|
|
|
2121
2150
|
}
|
|
2122
2151
|
}
|
|
2123
2152
|
class GraphNode {
|
|
2124
|
-
constructor(store, data) {
|
|
2153
|
+
constructor(store, data, storeKey) {
|
|
2125
2154
|
this.type = GraphNodeType$1.Node;
|
|
2126
2155
|
this.store = store;
|
|
2127
2156
|
this.data = data;
|
|
2157
|
+
this.storeKey = storeKey;
|
|
2128
2158
|
}
|
|
2129
2159
|
object(propertyName) {
|
|
2130
2160
|
const value = this.data[propertyName];
|
|
@@ -2134,7 +2164,8 @@
|
|
|
2134
2164
|
if (typeof value !== 'object' || value === null) {
|
|
2135
2165
|
throw new Error(`Cannot walk to path ${String(propertyName)}. "${String(propertyName)}" is a scalar: "${value}"`);
|
|
2136
2166
|
}
|
|
2137
|
-
|
|
2167
|
+
// We're walking to an object property on the current store record, pass the storeKey down.
|
|
2168
|
+
return new GraphNode(this.store, value, this.storeKey);
|
|
2138
2169
|
}
|
|
2139
2170
|
link(propertyName) {
|
|
2140
2171
|
const value = this.data[propertyName];
|
|
@@ -2164,6 +2195,8 @@
|
|
|
2164
2195
|
}
|
|
2165
2196
|
write(propertyName, value) {
|
|
2166
2197
|
this.data[propertyName] = value;
|
|
2198
|
+
const canonicalKey = this.store.getCanonicalRecordId(this.storeKey);
|
|
2199
|
+
this.store.markVisited(canonicalKey);
|
|
2167
2200
|
}
|
|
2168
2201
|
isUndefined(propertyName) {
|
|
2169
2202
|
return this.data[propertyName] === undefined;
|
|
@@ -3329,9 +3362,9 @@
|
|
|
3329
3362
|
if (value === undefined) {
|
|
3330
3363
|
return null;
|
|
3331
3364
|
}
|
|
3332
|
-
return this.wrapNormalizedGraphNode(value, store);
|
|
3365
|
+
return this.wrapNormalizedGraphNode(value, key, store);
|
|
3333
3366
|
}
|
|
3334
|
-
wrapNormalizedGraphNode(normalized, storeOverride) {
|
|
3367
|
+
wrapNormalizedGraphNode(normalized, key, storeOverride) {
|
|
3335
3368
|
if (normalized === null) {
|
|
3336
3369
|
return null;
|
|
3337
3370
|
}
|
|
@@ -3339,7 +3372,7 @@
|
|
|
3339
3372
|
if (isStoreRecordError$1(normalized)) {
|
|
3340
3373
|
return new GraphNodeError(store, normalized);
|
|
3341
3374
|
}
|
|
3342
|
-
return new GraphNode(store, normalized);
|
|
3375
|
+
return new GraphNode(store, normalized, key);
|
|
3343
3376
|
}
|
|
3344
3377
|
withContext(adapter, options) {
|
|
3345
3378
|
const { contextId, onContextLoaded } = options;
|
|
@@ -3637,8 +3670,8 @@
|
|
|
3637
3670
|
getNode(key) {
|
|
3638
3671
|
return this.environment.getNode(key);
|
|
3639
3672
|
}
|
|
3640
|
-
wrapNormalizedGraphNode(normalized) {
|
|
3641
|
-
return this.environment.wrapNormalizedGraphNode(normalized);
|
|
3673
|
+
wrapNormalizedGraphNode(normalized, key) {
|
|
3674
|
+
return this.environment.wrapNormalizedGraphNode(normalized, key);
|
|
3642
3675
|
}
|
|
3643
3676
|
instrument(paramsBuilder) {
|
|
3644
3677
|
const { instrument } = this.options;
|
|
@@ -3949,7 +3982,7 @@
|
|
|
3949
3982
|
}
|
|
3950
3983
|
return resourceParams;
|
|
3951
3984
|
}
|
|
3952
|
-
// engine version: 0.
|
|
3985
|
+
// engine version: 0.152.2-f6f687b3
|
|
3953
3986
|
|
|
3954
3987
|
/**
|
|
3955
3988
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -4077,7 +4110,7 @@
|
|
|
4077
4110
|
}
|
|
4078
4111
|
callbacks.push(callback);
|
|
4079
4112
|
}
|
|
4080
|
-
// version: 1.
|
|
4113
|
+
// version: 1.249.0-11c3e1ed5
|
|
4081
4114
|
|
|
4082
4115
|
// TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
|
|
4083
4116
|
function instrumentAdapter$1(createFunction, _metadata) {
|
|
@@ -15585,7 +15618,7 @@
|
|
|
15585
15618
|
}
|
|
15586
15619
|
return superResult;
|
|
15587
15620
|
}
|
|
15588
|
-
// version: 1.
|
|
15621
|
+
// version: 1.249.0-11c3e1ed5
|
|
15589
15622
|
|
|
15590
15623
|
function unwrap(data) {
|
|
15591
15624
|
// The lwc-luvio bindings import a function from lwc called "unwrap".
|
|
@@ -16510,7 +16543,7 @@
|
|
|
16510
16543
|
const { apiFamily, name } = metadata;
|
|
16511
16544
|
return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
|
|
16512
16545
|
}
|
|
16513
|
-
// version: 1.
|
|
16546
|
+
// version: 1.249.0-11c3e1ed5
|
|
16514
16547
|
|
|
16515
16548
|
/**
|
|
16516
16549
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -16609,7 +16642,7 @@
|
|
|
16609
16642
|
TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
|
|
16610
16643
|
TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
|
|
16611
16644
|
})(TypeCheckShapes || (TypeCheckShapes = {}));
|
|
16612
|
-
// engine version: 0.
|
|
16645
|
+
// engine version: 0.152.2-f6f687b3
|
|
16613
16646
|
|
|
16614
16647
|
const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
|
|
16615
16648
|
|
|
@@ -20081,22 +20114,12 @@
|
|
|
20081
20114
|
const fieldValueRepresentation = record.object('fields');
|
|
20082
20115
|
const fieldName = path.shift();
|
|
20083
20116
|
if (fieldValueRepresentation.isUndefined(fieldName) === true) {
|
|
20084
|
-
|
|
20085
|
-
// an undefined/non-present __ref if isMissing is present
|
|
20086
|
-
fieldValueRepresentation.write(fieldName, {
|
|
20087
|
-
__ref: undefined,
|
|
20088
|
-
isMissing: true,
|
|
20089
|
-
});
|
|
20117
|
+
writeMissingFieldToStore(fieldValueRepresentation, fieldName);
|
|
20090
20118
|
return;
|
|
20091
20119
|
}
|
|
20092
20120
|
const link = fieldValueRepresentation.link(fieldName);
|
|
20093
20121
|
if (link.isPending()) {
|
|
20094
|
-
|
|
20095
|
-
// an undefined/non-present __ref if isMissing is present
|
|
20096
|
-
fieldValueRepresentation.write(fieldName, {
|
|
20097
|
-
__ref: undefined,
|
|
20098
|
-
isMissing: true,
|
|
20099
|
-
});
|
|
20122
|
+
writeMissingFieldToStore(fieldValueRepresentation, fieldName);
|
|
20100
20123
|
}
|
|
20101
20124
|
else if (path.length > 0 && link.isMissing() === false) {
|
|
20102
20125
|
const fieldValue = link.follow();
|
|
@@ -20112,6 +20135,19 @@
|
|
|
20112
20135
|
}
|
|
20113
20136
|
}
|
|
20114
20137
|
}
|
|
20138
|
+
/**
|
|
20139
|
+
* Graph Node Directly modifies store entries, which is generally a non-starter.
|
|
20140
|
+
* Until we can refactor this mess, you need to use this function to safely mark the RecordRepresentation
|
|
20141
|
+
* as a seenId in the store when you perform this mutation.
|
|
20142
|
+
*/
|
|
20143
|
+
function writeMissingFieldToStore(field, fieldName) {
|
|
20144
|
+
// TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
|
|
20145
|
+
// an undefined/non-present __ref if isMissing is present
|
|
20146
|
+
field.write(fieldName, {
|
|
20147
|
+
__ref: undefined,
|
|
20148
|
+
isMissing: true,
|
|
20149
|
+
});
|
|
20150
|
+
}
|
|
20115
20151
|
/**
|
|
20116
20152
|
* Tells you if an objectApiName is supported by UI API or not.
|
|
20117
20153
|
* Note: Luvio does not currently support all the entities, the list is limited to UI API supported entities
|
|
@@ -20263,8 +20299,11 @@
|
|
|
20263
20299
|
return existing;
|
|
20264
20300
|
}
|
|
20265
20301
|
function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
|
|
20266
|
-
const
|
|
20267
|
-
|
|
20302
|
+
const recordKey = keyBuilder$1$(luvio, {
|
|
20303
|
+
recordId: incoming.id,
|
|
20304
|
+
});
|
|
20305
|
+
const incomingNode = luvio.wrapNormalizedGraphNode(incoming, recordKey);
|
|
20306
|
+
const existingNode = luvio.wrapNormalizedGraphNode(existing, recordKey);
|
|
20268
20307
|
const incomingTrackedFieldsTrieRoot = {
|
|
20269
20308
|
name: incoming.apiName,
|
|
20270
20309
|
children: {},
|
|
@@ -20273,9 +20312,6 @@
|
|
|
20273
20312
|
name: existing.apiName,
|
|
20274
20313
|
children: {},
|
|
20275
20314
|
};
|
|
20276
|
-
const recordKey = keyBuilder$1$(luvio, {
|
|
20277
|
-
recordId: incoming.id,
|
|
20278
|
-
});
|
|
20279
20315
|
const trackedFieldsConfig = {
|
|
20280
20316
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnCacheMergeConflict(),
|
|
20281
20317
|
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
@@ -20800,10 +20836,11 @@
|
|
|
20800
20836
|
}
|
|
20801
20837
|
function buildNetworkSnapshotCachePolicy$N(context, coercedAdapterRequestContext) {
|
|
20802
20838
|
const { config, luvio } = context;
|
|
20803
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
20839
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
20804
20840
|
const dispatchOptions = {
|
|
20805
20841
|
resourceRequestContext: {
|
|
20806
20842
|
requestCorrelator,
|
|
20843
|
+
sourceContext,
|
|
20807
20844
|
},
|
|
20808
20845
|
eventObservers,
|
|
20809
20846
|
};
|
|
@@ -23281,10 +23318,11 @@
|
|
|
23281
23318
|
}
|
|
23282
23319
|
function buildNetworkListUiSnapshot$1(context, coercedAdapterRequestContext) {
|
|
23283
23320
|
const { config, listInfo, listUi, luvio } = context;
|
|
23284
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
23321
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
23285
23322
|
const dispatchOptions = {
|
|
23286
23323
|
resourceRequestContext: {
|
|
23287
23324
|
requestCorrelator,
|
|
23325
|
+
sourceContext,
|
|
23288
23326
|
},
|
|
23289
23327
|
eventObservers,
|
|
23290
23328
|
};
|
|
@@ -23645,10 +23683,11 @@
|
|
|
23645
23683
|
}
|
|
23646
23684
|
function buildNetworkListUiSnapshot(context, coercedAdapterRequestContext) {
|
|
23647
23685
|
const { adapterContext, config, listInfo, listUi, luvio } = context;
|
|
23648
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
23686
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
23649
23687
|
const dispatchOptions = {
|
|
23650
23688
|
resourceRequestContext: {
|
|
23651
23689
|
requestCorrelator,
|
|
23690
|
+
sourceContext,
|
|
23652
23691
|
},
|
|
23653
23692
|
eventObservers,
|
|
23654
23693
|
};
|
|
@@ -24899,10 +24938,11 @@
|
|
|
24899
24938
|
}
|
|
24900
24939
|
}
|
|
24901
24940
|
function buildNetworkRecordUiRepresentationSnapshot(context, coercedAdapterRequestContext) {
|
|
24902
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
24941
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
24903
24942
|
const dispatchOptions = {
|
|
24904
24943
|
resourceRequestContext: {
|
|
24905
24944
|
requestCorrelator,
|
|
24945
|
+
sourceContext,
|
|
24906
24946
|
},
|
|
24907
24947
|
eventObservers,
|
|
24908
24948
|
};
|
|
@@ -25105,10 +25145,11 @@
|
|
|
25105
25145
|
const { recordId } = config;
|
|
25106
25146
|
const optionalFields = config.optionalFields === undefined ? [] : dedupe$2(config.optionalFields).sort();
|
|
25107
25147
|
const refresh = buildSnapshotRefresh$3(luvio, config);
|
|
25108
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
25148
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
25109
25149
|
const dispatchOptions = {
|
|
25110
25150
|
resourceRequestContext: {
|
|
25111
25151
|
requestCorrelator,
|
|
25152
|
+
sourceContext,
|
|
25112
25153
|
},
|
|
25113
25154
|
eventObservers,
|
|
25114
25155
|
};
|
|
@@ -25420,7 +25461,7 @@
|
|
|
25420
25461
|
const responsePromises = [];
|
|
25421
25462
|
for (let i = 0, len = entries.length; i < len; i++) {
|
|
25422
25463
|
const { key, record } = entries[i];
|
|
25423
|
-
const node = luvio.wrapNormalizedGraphNode(record);
|
|
25464
|
+
const node = luvio.wrapNormalizedGraphNode(record, key);
|
|
25424
25465
|
const optionalFields = getTrackedFields(key, node, {
|
|
25425
25466
|
maxDepth: configurationForRestAdapters$2.getTrackedFieldDepthOnNotifyChange(),
|
|
25426
25467
|
onlyFetchLeafNodeIdAndName: configurationForRestAdapters$2.getTrackedFieldLeafNodeIdAndNameOnly(),
|
|
@@ -32799,10 +32840,11 @@
|
|
|
32799
32840
|
}
|
|
32800
32841
|
function buildNetworkSnapshotCachePolicy$m(context, coercedAdapterRequestContext) {
|
|
32801
32842
|
const { config, luvio } = context;
|
|
32802
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
32843
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
32803
32844
|
const dispatchOptions = {
|
|
32804
32845
|
resourceRequestContext: {
|
|
32805
32846
|
requestCorrelator,
|
|
32847
|
+
sourceContext,
|
|
32806
32848
|
},
|
|
32807
32849
|
eventObservers,
|
|
32808
32850
|
};
|
|
@@ -33910,10 +33952,11 @@
|
|
|
33910
33952
|
if (uncachedRecordIds !== undefined) {
|
|
33911
33953
|
config.uncachedRecordIds = uncachedRecordIds;
|
|
33912
33954
|
}
|
|
33913
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
33955
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
33914
33956
|
const dispatchOptions = {
|
|
33915
33957
|
resourceRequestContext: {
|
|
33916
33958
|
requestCorrelator,
|
|
33959
|
+
sourceContext,
|
|
33917
33960
|
},
|
|
33918
33961
|
eventObservers,
|
|
33919
33962
|
};
|
|
@@ -38313,14 +38356,15 @@
|
|
|
38313
38356
|
};
|
|
38314
38357
|
|
|
38315
38358
|
const TTL$6 = 200;
|
|
38316
|
-
const VERSION$9$1 = "
|
|
38359
|
+
const VERSION$9$1 = "877ca614d967f458099a6ae606b1cd1b";
|
|
38317
38360
|
const RepresentationType$9 = 'SearchResultsSummaryRepresentation';
|
|
38318
38361
|
function keyBuilder$g$1(luvio, config) {
|
|
38319
|
-
return keyPrefix$2 + '::' + RepresentationType$9 + ':' + config.query;
|
|
38362
|
+
return keyPrefix$2 + '::' + RepresentationType$9 + ':' + config.query + ':' + (config.configurationName === null ? '' : config.configurationName);
|
|
38320
38363
|
}
|
|
38321
38364
|
function keyBuilderFromType$6(luvio, object) {
|
|
38322
38365
|
const keyParams = {
|
|
38323
|
-
query: object.query
|
|
38366
|
+
query: object.query,
|
|
38367
|
+
configurationName: object.configurationName
|
|
38324
38368
|
};
|
|
38325
38369
|
return keyBuilder$g$1(luvio, keyParams);
|
|
38326
38370
|
}
|
|
@@ -38362,7 +38406,8 @@
|
|
|
38362
38406
|
}
|
|
38363
38407
|
function keyBuilder$f$1(luvio, params) {
|
|
38364
38408
|
return keyBuilder$g$1(luvio, {
|
|
38365
|
-
query: params.queryParams.q
|
|
38409
|
+
query: params.queryParams.q,
|
|
38410
|
+
configurationName: params.body.configurationName || null
|
|
38366
38411
|
});
|
|
38367
38412
|
}
|
|
38368
38413
|
function getResponseCacheKeys$c(storeKeyMap, luvio, resourceParams, response) {
|
|
@@ -38410,6 +38455,7 @@
|
|
|
38410
38455
|
const getSearchResults_ConfigPropertyMetadata = [
|
|
38411
38456
|
generateParamConfigMetadata$2('q', true, 1 /* QueryParameter */, 0 /* String */),
|
|
38412
38457
|
generateParamConfigMetadata$2('answerTypes', false, 2 /* Body */, 0 /* String */, true),
|
|
38458
|
+
generateParamConfigMetadata$2('configurationName', false, 2 /* Body */, 0 /* String */),
|
|
38413
38459
|
generateParamConfigMetadata$2('objectApiNames', false, 2 /* Body */, 0 /* String */, true),
|
|
38414
38460
|
];
|
|
38415
38461
|
const getSearchResults_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig$2(adapterName$c, getSearchResults_ConfigPropertyMetadata);
|
|
@@ -38561,15 +38607,16 @@
|
|
|
38561
38607
|
}
|
|
38562
38608
|
|
|
38563
38609
|
const TTL$5 = 200;
|
|
38564
|
-
const VERSION$8$1 = "
|
|
38610
|
+
const VERSION$8$1 = "3102453bf10ea449d9665914d5f5febf";
|
|
38565
38611
|
const RepresentationType$8 = 'KeywordSearchResultsSummaryRepresentation';
|
|
38566
38612
|
function keyBuilder$d$1(luvio, config) {
|
|
38567
|
-
return keyPrefix$2 + '::' + RepresentationType$8 + ':' + config.query + ':' + config.objectApiName;
|
|
38613
|
+
return keyPrefix$2 + '::' + RepresentationType$8 + ':' + config.query + ':' + config.objectApiName + ':' + (config.configurationName === null ? '' : config.configurationName);
|
|
38568
38614
|
}
|
|
38569
38615
|
function keyBuilderFromType$5(luvio, object) {
|
|
38570
38616
|
const keyParams = {
|
|
38571
38617
|
query: object.query,
|
|
38572
|
-
objectApiName: object.objectApiName
|
|
38618
|
+
objectApiName: object.objectApiName,
|
|
38619
|
+
configurationName: object.configurationName
|
|
38573
38620
|
};
|
|
38574
38621
|
return keyBuilder$d$1(luvio, keyParams);
|
|
38575
38622
|
}
|
|
@@ -38612,7 +38659,8 @@
|
|
|
38612
38659
|
function keyBuilder$c$1(luvio, params) {
|
|
38613
38660
|
return keyBuilder$d$1(luvio, {
|
|
38614
38661
|
query: params.queryParams.q,
|
|
38615
|
-
objectApiName: params.queryParams.objectApiName
|
|
38662
|
+
objectApiName: params.queryParams.objectApiName,
|
|
38663
|
+
configurationName: params.body.configurationName || null
|
|
38616
38664
|
});
|
|
38617
38665
|
}
|
|
38618
38666
|
function getResponseCacheKeys$b(storeKeyMap, luvio, resourceParams, response) {
|
|
@@ -38660,6 +38708,7 @@
|
|
|
38660
38708
|
const getKeywordSearchResults_ConfigPropertyMetadata = [
|
|
38661
38709
|
generateParamConfigMetadata$2('objectApiName', true, 1 /* QueryParameter */, 0 /* String */),
|
|
38662
38710
|
generateParamConfigMetadata$2('q', true, 1 /* QueryParameter */, 0 /* String */),
|
|
38711
|
+
generateParamConfigMetadata$2('configurationName', false, 2 /* Body */, 0 /* String */),
|
|
38663
38712
|
generateParamConfigMetadata$2('filters', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
38664
38713
|
generateParamConfigMetadata$2('pageSize', false, 2 /* Body */, 3 /* Integer */),
|
|
38665
38714
|
generateParamConfigMetadata$2('pageToken', false, 2 /* Body */, 0 /* String */),
|
|
@@ -40520,10 +40569,11 @@
|
|
|
40520
40569
|
}
|
|
40521
40570
|
function buildNetworkSnapshotCachePolicy$2$1(context, coercedAdapterRequestContext) {
|
|
40522
40571
|
const { config, adapterContext, luvio } = context;
|
|
40523
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
40572
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
40524
40573
|
const dispatchOptions = {
|
|
40525
40574
|
resourceRequestContext: {
|
|
40526
40575
|
requestCorrelator,
|
|
40576
|
+
sourceContext,
|
|
40527
40577
|
},
|
|
40528
40578
|
eventObservers,
|
|
40529
40579
|
};
|
|
@@ -41049,10 +41099,11 @@
|
|
|
41049
41099
|
};
|
|
41050
41100
|
function buildNetworkSnapshotCachePolicy$1$1(context, coercedAdapterRequestContext) {
|
|
41051
41101
|
const { config, adapterContext, luvio } = context;
|
|
41052
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
41102
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
41053
41103
|
const dispatchOptions = {
|
|
41054
41104
|
resourceRequestContext: {
|
|
41055
41105
|
requestCorrelator,
|
|
41106
|
+
sourceContext,
|
|
41056
41107
|
},
|
|
41057
41108
|
eventObservers,
|
|
41058
41109
|
};
|
|
@@ -41589,10 +41640,11 @@
|
|
|
41589
41640
|
}
|
|
41590
41641
|
const buildNetworkSnapshotCachePolicy$O = (context, coercedAdapterRequestContext) => {
|
|
41591
41642
|
const { config, adapterContext, luvio } = context;
|
|
41592
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
41643
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
41593
41644
|
const dispatchOptions = {
|
|
41594
41645
|
resourceRequestContext: {
|
|
41595
41646
|
requestCorrelator,
|
|
41647
|
+
sourceContext,
|
|
41596
41648
|
},
|
|
41597
41649
|
eventObservers,
|
|
41598
41650
|
};
|
|
@@ -42293,10 +42345,11 @@
|
|
|
42293
42345
|
let dispatchOptions = undefined;
|
|
42294
42346
|
if (requestContext !== undefined) {
|
|
42295
42347
|
const coercedAdapterRequestContext = coerceAdapterRequestContext(requestContext);
|
|
42296
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
42348
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
42297
42349
|
dispatchOptions = {
|
|
42298
42350
|
resourceRequestContext: {
|
|
42299
42351
|
requestCorrelator,
|
|
42352
|
+
sourceContext,
|
|
42300
42353
|
luvioRequestMethod: undefined,
|
|
42301
42354
|
},
|
|
42302
42355
|
eventObservers,
|
|
@@ -42368,10 +42421,11 @@
|
|
|
42368
42421
|
let dispatchOptions = undefined;
|
|
42369
42422
|
if (requestContext !== undefined) {
|
|
42370
42423
|
const coercedAdapterRequestContext = coerceAdapterRequestContext(requestContext);
|
|
42371
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
42424
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
42372
42425
|
dispatchOptions = {
|
|
42373
42426
|
resourceRequestContext: {
|
|
42374
42427
|
requestCorrelator,
|
|
42428
|
+
sourceContext,
|
|
42375
42429
|
luvioRequestMethod: undefined,
|
|
42376
42430
|
},
|
|
42377
42431
|
eventObservers,
|
|
@@ -42884,7 +42938,16 @@
|
|
|
42884
42938
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyListInfoUpdateAvailable', notifyUpdateAvailableFactory$1));
|
|
42885
42939
|
throttle(60, 60000, createLDSAdapter(luvio, 'notifyQuickActionDefaultsUpdateAvailable', notifyUpdateAvailableFactory));
|
|
42886
42940
|
});
|
|
42887
|
-
// version: 1.
|
|
42941
|
+
// version: 1.249.0-15efc7f9b
|
|
42942
|
+
|
|
42943
|
+
var ldsIdempotencyWriteDisabled = {
|
|
42944
|
+
isOpen: function (e) {
|
|
42945
|
+
return e.fallback;
|
|
42946
|
+
},
|
|
42947
|
+
hasError: function () {
|
|
42948
|
+
return !0;
|
|
42949
|
+
},
|
|
42950
|
+
};
|
|
42888
42951
|
|
|
42889
42952
|
var caseSensitiveUserId = '005B0000000GR4OIAW';
|
|
42890
42953
|
|
|
@@ -44209,12 +44272,12 @@
|
|
|
44209
44272
|
}
|
|
44210
44273
|
return environment.getNode(key, stagingStore);
|
|
44211
44274
|
};
|
|
44212
|
-
const wrapNormalizedGraphNode = function (normalized) {
|
|
44275
|
+
const wrapNormalizedGraphNode = function (normalized, key) {
|
|
44213
44276
|
validateNotDisposed();
|
|
44214
44277
|
if (stagingStore === null) {
|
|
44215
44278
|
stagingStore = buildIngestStagingStore(environment);
|
|
44216
44279
|
}
|
|
44217
|
-
return environment.wrapNormalizedGraphNode(normalized, stagingStore);
|
|
44280
|
+
return environment.wrapNormalizedGraphNode(normalized, key, stagingStore);
|
|
44218
44281
|
};
|
|
44219
44282
|
const rebuildSnapshot = function (snapshot, onRebuild) {
|
|
44220
44283
|
validateNotDisposed();
|
|
@@ -47922,6 +47985,21 @@
|
|
|
47922
47985
|
}
|
|
47923
47986
|
}
|
|
47924
47987
|
|
|
47988
|
+
/**
|
|
47989
|
+
Use Math.random to generate v4 RFC4122 compliant uuid
|
|
47990
|
+
*/
|
|
47991
|
+
function uuidv4() {
|
|
47992
|
+
const uuid = [];
|
|
47993
|
+
for (let i = 0; i < 32; i++) {
|
|
47994
|
+
const random = (Math.random() * 16) | 0;
|
|
47995
|
+
if (i === 8 || i === 12 || i === 16 || i === 20) {
|
|
47996
|
+
uuid.push('-');
|
|
47997
|
+
}
|
|
47998
|
+
uuid.push((i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16));
|
|
47999
|
+
}
|
|
48000
|
+
return uuid.join('');
|
|
48001
|
+
}
|
|
48002
|
+
|
|
47925
48003
|
/**
|
|
47926
48004
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
47927
48005
|
* All rights reserved.
|
|
@@ -47929,20 +48007,20 @@
|
|
|
47929
48007
|
*/
|
|
47930
48008
|
|
|
47931
48009
|
|
|
47932
|
-
var DraftActionStatus
|
|
48010
|
+
var DraftActionStatus;
|
|
47933
48011
|
(function (DraftActionStatus) {
|
|
47934
48012
|
DraftActionStatus["Pending"] = "pending";
|
|
47935
48013
|
DraftActionStatus["Uploading"] = "uploading";
|
|
47936
48014
|
DraftActionStatus["Error"] = "error";
|
|
47937
48015
|
DraftActionStatus["Completed"] = "completed";
|
|
47938
|
-
})(DraftActionStatus
|
|
48016
|
+
})(DraftActionStatus || (DraftActionStatus = {}));
|
|
47939
48017
|
function isDraftError(draft) {
|
|
47940
|
-
return draft.status === DraftActionStatus
|
|
48018
|
+
return draft.status === DraftActionStatus.Error;
|
|
47941
48019
|
}
|
|
47942
48020
|
function isDraftQueueStateChangeEvent(event) {
|
|
47943
|
-
return event.type === DraftQueueEventType
|
|
48021
|
+
return event.type === DraftQueueEventType.QueueStateChanged;
|
|
47944
48022
|
}
|
|
47945
|
-
var ProcessActionResult
|
|
48023
|
+
var ProcessActionResult;
|
|
47946
48024
|
(function (ProcessActionResult) {
|
|
47947
48025
|
// non-2xx network error, requires user intervention
|
|
47948
48026
|
ProcessActionResult["ACTION_ERRORED"] = "ERROR";
|
|
@@ -47958,8 +48036,8 @@
|
|
|
47958
48036
|
ProcessActionResult["BLOCKED_ON_ERROR"] = "BLOCKED_ON_ERROR";
|
|
47959
48037
|
//waiting for user to execute custom action
|
|
47960
48038
|
ProcessActionResult["CUSTOM_ACTION_WAITING"] = "CUSTOM_ACTION_WAITING";
|
|
47961
|
-
})(ProcessActionResult
|
|
47962
|
-
var DraftQueueState
|
|
48039
|
+
})(ProcessActionResult || (ProcessActionResult = {}));
|
|
48040
|
+
var DraftQueueState;
|
|
47963
48041
|
(function (DraftQueueState) {
|
|
47964
48042
|
/** Currently processing an item in the queue or queue is empty and waiting to process the next item. */
|
|
47965
48043
|
DraftQueueState["Started"] = "started";
|
|
@@ -47978,8 +48056,8 @@
|
|
|
47978
48056
|
* To attempt to force an upload now call startDraftQueue().
|
|
47979
48057
|
*/
|
|
47980
48058
|
DraftQueueState["Waiting"] = "waiting";
|
|
47981
|
-
})(DraftQueueState
|
|
47982
|
-
var DraftQueueEventType
|
|
48059
|
+
})(DraftQueueState || (DraftQueueState = {}));
|
|
48060
|
+
var DraftQueueEventType;
|
|
47983
48061
|
(function (DraftQueueEventType) {
|
|
47984
48062
|
/**
|
|
47985
48063
|
* Triggered after an action had been added to the queue
|
|
@@ -48009,13 +48087,13 @@
|
|
|
48009
48087
|
* Triggered after the Draft Queue state changes
|
|
48010
48088
|
*/
|
|
48011
48089
|
DraftQueueEventType["QueueStateChanged"] = "state";
|
|
48012
|
-
})(DraftQueueEventType
|
|
48013
|
-
var QueueOperationType
|
|
48090
|
+
})(DraftQueueEventType || (DraftQueueEventType = {}));
|
|
48091
|
+
var QueueOperationType;
|
|
48014
48092
|
(function (QueueOperationType) {
|
|
48015
48093
|
QueueOperationType["Add"] = "add";
|
|
48016
48094
|
QueueOperationType["Delete"] = "delete";
|
|
48017
48095
|
QueueOperationType["Update"] = "update";
|
|
48018
|
-
})(QueueOperationType
|
|
48096
|
+
})(QueueOperationType || (QueueOperationType = {}));
|
|
48019
48097
|
|
|
48020
48098
|
class DraftSynthesisError extends Error {
|
|
48021
48099
|
constructor(message, errorType) {
|
|
@@ -48135,20 +48213,6 @@
|
|
|
48135
48213
|
}
|
|
48136
48214
|
return newId.toString();
|
|
48137
48215
|
}
|
|
48138
|
-
/**
|
|
48139
|
-
Use Math.random to generate v4 RFC4122 compliant uuid
|
|
48140
|
-
*/
|
|
48141
|
-
function uuidv4$1() {
|
|
48142
|
-
const uuid = [];
|
|
48143
|
-
for (let i = 0; i < 32; i++) {
|
|
48144
|
-
const random = (Math.random() * 16) | 0;
|
|
48145
|
-
if (i === 8 || i === 12 || i === 16 || i === 20) {
|
|
48146
|
-
uuid.push('-');
|
|
48147
|
-
}
|
|
48148
|
-
uuid.push((i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16));
|
|
48149
|
-
}
|
|
48150
|
-
return uuid.join('');
|
|
48151
|
-
}
|
|
48152
48216
|
|
|
48153
48217
|
const HTTP_HEADER_RETRY_AFTER = 'Retry-After';
|
|
48154
48218
|
const HTTP_HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
|
@@ -48188,7 +48252,7 @@
|
|
|
48188
48252
|
const resourceRequestCopy = clone$1(resourceRequest);
|
|
48189
48253
|
resourceRequestCopy.headers = resourceRequestCopy.headers || {};
|
|
48190
48254
|
if (handler.hasIdempotencySupport()) {
|
|
48191
|
-
resourceRequestCopy.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4
|
|
48255
|
+
resourceRequestCopy.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
48192
48256
|
}
|
|
48193
48257
|
// enable return extra fields for record creation and record update http call
|
|
48194
48258
|
if (resourceRequest.basePath === '/ui-api/records' &&
|
|
@@ -48293,26 +48357,26 @@
|
|
|
48293
48357
|
}
|
|
48294
48358
|
}
|
|
48295
48359
|
|
|
48296
|
-
var CustomActionResultType
|
|
48360
|
+
var CustomActionResultType;
|
|
48297
48361
|
(function (CustomActionResultType) {
|
|
48298
48362
|
CustomActionResultType["SUCCESS"] = "SUCCESS";
|
|
48299
48363
|
CustomActionResultType["FAILURE"] = "FAILURE";
|
|
48300
|
-
})(CustomActionResultType
|
|
48301
|
-
var CustomActionErrorType
|
|
48364
|
+
})(CustomActionResultType || (CustomActionResultType = {}));
|
|
48365
|
+
var CustomActionErrorType;
|
|
48302
48366
|
(function (CustomActionErrorType) {
|
|
48303
48367
|
CustomActionErrorType["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
48304
48368
|
CustomActionErrorType["CLIENT_ERROR"] = "CLIENT_ERROR";
|
|
48305
|
-
})(CustomActionErrorType
|
|
48369
|
+
})(CustomActionErrorType || (CustomActionErrorType = {}));
|
|
48306
48370
|
function isCustomActionSuccess(result) {
|
|
48307
|
-
return result.type === CustomActionResultType
|
|
48371
|
+
return result.type === CustomActionResultType.SUCCESS;
|
|
48308
48372
|
}
|
|
48309
48373
|
function isCustomActionFailed(result) {
|
|
48310
|
-
return result.type === CustomActionResultType
|
|
48374
|
+
return result.type === CustomActionResultType.FAILURE;
|
|
48311
48375
|
}
|
|
48312
48376
|
function customActionHandler(executor, id, draftQueue) {
|
|
48313
48377
|
const handle = (action, actionCompleted, actionErrored) => {
|
|
48314
48378
|
notifyCustomActionToExecute(action, actionCompleted, actionErrored);
|
|
48315
|
-
return Promise.resolve(ProcessActionResult
|
|
48379
|
+
return Promise.resolve(ProcessActionResult.CUSTOM_ACTION_WAITING);
|
|
48316
48380
|
};
|
|
48317
48381
|
const notifyCustomActionToExecute = (action, actionCompleted, actionErrored) => {
|
|
48318
48382
|
if (executor !== undefined) {
|
|
@@ -48323,16 +48387,16 @@
|
|
|
48323
48387
|
if (isCustomActionSuccess(result)) {
|
|
48324
48388
|
actionCompleted({
|
|
48325
48389
|
...action,
|
|
48326
|
-
status: DraftActionStatus
|
|
48390
|
+
status: DraftActionStatus.Completed,
|
|
48327
48391
|
response: createOkResponse(undefined),
|
|
48328
48392
|
});
|
|
48329
48393
|
}
|
|
48330
48394
|
else if (isCustomActionFailed(result)) {
|
|
48331
48395
|
actionErrored({
|
|
48332
48396
|
...action,
|
|
48333
|
-
status: DraftActionStatus
|
|
48397
|
+
status: DraftActionStatus.Error,
|
|
48334
48398
|
error: result.error.message,
|
|
48335
|
-
}, result.error.type === CustomActionErrorType
|
|
48399
|
+
}, result.error.type === CustomActionErrorType.NETWORK_ERROR);
|
|
48336
48400
|
}
|
|
48337
48401
|
};
|
|
48338
48402
|
const buildPendingAction = (action, queue) => {
|
|
@@ -48341,7 +48405,7 @@
|
|
|
48341
48405
|
return Promise.resolve({
|
|
48342
48406
|
id,
|
|
48343
48407
|
targetId,
|
|
48344
|
-
status: DraftActionStatus
|
|
48408
|
+
status: DraftActionStatus.Pending,
|
|
48345
48409
|
data,
|
|
48346
48410
|
tag,
|
|
48347
48411
|
timestamp: Date.now(),
|
|
@@ -48353,7 +48417,7 @@
|
|
|
48353
48417
|
const { id } = action;
|
|
48354
48418
|
const queueOperations = [];
|
|
48355
48419
|
queueOperations.push({
|
|
48356
|
-
type: QueueOperationType
|
|
48420
|
+
type: QueueOperationType.Delete,
|
|
48357
48421
|
id: id,
|
|
48358
48422
|
});
|
|
48359
48423
|
return queueOperations;
|
|
@@ -48403,8 +48467,8 @@
|
|
|
48403
48467
|
this.minimumRetryInterval = 250;
|
|
48404
48468
|
this.maximumRetryInterval = 32000;
|
|
48405
48469
|
this.draftQueueChangedListeners = [];
|
|
48406
|
-
this.state = DraftQueueState
|
|
48407
|
-
this.userState = DraftQueueState
|
|
48470
|
+
this.state = DraftQueueState.Stopped;
|
|
48471
|
+
this.userState = DraftQueueState.Stopped;
|
|
48408
48472
|
this.uploadingActionId = undefined;
|
|
48409
48473
|
this.timeoutHandler = undefined;
|
|
48410
48474
|
this.handlers = {};
|
|
@@ -48431,8 +48495,8 @@
|
|
|
48431
48495
|
return this.state;
|
|
48432
48496
|
}
|
|
48433
48497
|
async startQueue() {
|
|
48434
|
-
this.userState = DraftQueueState
|
|
48435
|
-
if (this.state === DraftQueueState
|
|
48498
|
+
this.userState = DraftQueueState.Started;
|
|
48499
|
+
if (this.state === DraftQueueState.Started) {
|
|
48436
48500
|
// Do nothing if the queue state is already started
|
|
48437
48501
|
return;
|
|
48438
48502
|
}
|
|
@@ -48443,30 +48507,30 @@
|
|
|
48443
48507
|
return;
|
|
48444
48508
|
}
|
|
48445
48509
|
this.retryIntervalMilliseconds = 0;
|
|
48446
|
-
this.state = DraftQueueState
|
|
48510
|
+
this.state = DraftQueueState.Started;
|
|
48447
48511
|
await this.notifyChangedListeners({
|
|
48448
|
-
type: DraftQueueEventType
|
|
48512
|
+
type: DraftQueueEventType.QueueStateChanged,
|
|
48449
48513
|
state: this.state,
|
|
48450
48514
|
});
|
|
48451
48515
|
const result = await this.processNextAction();
|
|
48452
48516
|
switch (result) {
|
|
48453
|
-
case ProcessActionResult
|
|
48454
|
-
this.state = DraftQueueState
|
|
48517
|
+
case ProcessActionResult.BLOCKED_ON_ERROR:
|
|
48518
|
+
this.state = DraftQueueState.Error;
|
|
48455
48519
|
return Promise.reject();
|
|
48456
48520
|
default:
|
|
48457
48521
|
return Promise.resolve();
|
|
48458
48522
|
}
|
|
48459
48523
|
}
|
|
48460
48524
|
stopQueue() {
|
|
48461
|
-
this.userState = DraftQueueState
|
|
48462
|
-
if (this.state === DraftQueueState
|
|
48525
|
+
this.userState = DraftQueueState.Stopped;
|
|
48526
|
+
if (this.state === DraftQueueState.Stopped) {
|
|
48463
48527
|
// Do nothing if the queue state is already stopped
|
|
48464
48528
|
return Promise.resolve();
|
|
48465
48529
|
}
|
|
48466
48530
|
this.stopQueueManually();
|
|
48467
48531
|
return this.notifyChangedListeners({
|
|
48468
|
-
type: DraftQueueEventType
|
|
48469
|
-
state: DraftQueueState
|
|
48532
|
+
type: DraftQueueEventType.QueueStateChanged,
|
|
48533
|
+
state: DraftQueueState.Stopped,
|
|
48470
48534
|
});
|
|
48471
48535
|
}
|
|
48472
48536
|
/**
|
|
@@ -48477,7 +48541,7 @@
|
|
|
48477
48541
|
clearTimeout(this.timeoutHandler);
|
|
48478
48542
|
this.timeoutHandler = undefined;
|
|
48479
48543
|
}
|
|
48480
|
-
this.state = DraftQueueState
|
|
48544
|
+
this.state = DraftQueueState.Stopped;
|
|
48481
48545
|
}
|
|
48482
48546
|
async getQueueActions() {
|
|
48483
48547
|
const drafts = (await this.draftStore.getAllDrafts());
|
|
@@ -48487,7 +48551,7 @@
|
|
|
48487
48551
|
}
|
|
48488
48552
|
drafts.forEach((draft) => {
|
|
48489
48553
|
if (draft.id === this.uploadingActionId) {
|
|
48490
|
-
draft.status = DraftActionStatus
|
|
48554
|
+
draft.status = DraftActionStatus.Uploading;
|
|
48491
48555
|
}
|
|
48492
48556
|
queue.push(draft);
|
|
48493
48557
|
});
|
|
@@ -48513,11 +48577,11 @@
|
|
|
48513
48577
|
await this.draftStore.writeAction(pendingAction);
|
|
48514
48578
|
queue = await this.getQueueActions();
|
|
48515
48579
|
await this.notifyChangedListeners({
|
|
48516
|
-
type: DraftQueueEventType
|
|
48580
|
+
type: DraftQueueEventType.ActionAdded,
|
|
48517
48581
|
action: pendingAction,
|
|
48518
48582
|
});
|
|
48519
48583
|
await handler.handleActionEnqueued(pendingAction, queue);
|
|
48520
|
-
if (this.state === DraftQueueState
|
|
48584
|
+
if (this.state === DraftQueueState.Started) {
|
|
48521
48585
|
this.processNextAction();
|
|
48522
48586
|
}
|
|
48523
48587
|
const actionData = (await handler.getDataForAction(pendingAction));
|
|
@@ -48549,10 +48613,10 @@
|
|
|
48549
48613
|
this.retryIntervalMilliseconds = 0;
|
|
48550
48614
|
this.uploadingActionId = undefined;
|
|
48551
48615
|
await this.notifyChangedListeners({
|
|
48552
|
-
type: DraftQueueEventType
|
|
48616
|
+
type: DraftQueueEventType.ActionCompleted,
|
|
48553
48617
|
action,
|
|
48554
48618
|
});
|
|
48555
|
-
if (this.state === DraftQueueState
|
|
48619
|
+
if (this.state === DraftQueueState.Started) {
|
|
48556
48620
|
this.processNextAction();
|
|
48557
48621
|
}
|
|
48558
48622
|
},
|
|
@@ -48562,12 +48626,12 @@
|
|
|
48562
48626
|
if (actionDataChanged === true) {
|
|
48563
48627
|
await this.draftStore.writeAction({
|
|
48564
48628
|
...action,
|
|
48565
|
-
status: DraftActionStatus
|
|
48629
|
+
status: DraftActionStatus.Pending,
|
|
48566
48630
|
});
|
|
48567
48631
|
}
|
|
48568
48632
|
this.uploadingActionId = undefined;
|
|
48569
|
-
if (retry && this.state !== DraftQueueState
|
|
48570
|
-
this.state = DraftQueueState
|
|
48633
|
+
if (retry && this.state !== DraftQueueState.Stopped) {
|
|
48634
|
+
this.state = DraftQueueState.Waiting;
|
|
48571
48635
|
return retryDelayInMs !== undefined
|
|
48572
48636
|
? this.scheduleRetryWithSpecifiedDelay(retryDelayInMs)
|
|
48573
48637
|
: this.scheduleRetry();
|
|
@@ -48591,27 +48655,27 @@
|
|
|
48591
48655
|
const action = queue[0];
|
|
48592
48656
|
if (action === undefined) {
|
|
48593
48657
|
this.processingAction = undefined;
|
|
48594
|
-
return ProcessActionResult
|
|
48658
|
+
return ProcessActionResult.NO_ACTION_TO_PROCESS;
|
|
48595
48659
|
}
|
|
48596
48660
|
const { status, id } = action;
|
|
48597
|
-
if (status === DraftActionStatus
|
|
48598
|
-
this.state = DraftQueueState
|
|
48661
|
+
if (status === DraftActionStatus.Error) {
|
|
48662
|
+
this.state = DraftQueueState.Error;
|
|
48599
48663
|
this.processingAction = undefined;
|
|
48600
|
-
return ProcessActionResult
|
|
48664
|
+
return ProcessActionResult.BLOCKED_ON_ERROR;
|
|
48601
48665
|
}
|
|
48602
48666
|
if (id === this.uploadingActionId) {
|
|
48603
|
-
this.state = DraftQueueState
|
|
48667
|
+
this.state = DraftQueueState.Started;
|
|
48604
48668
|
this.processingAction = undefined;
|
|
48605
|
-
return ProcessActionResult
|
|
48669
|
+
return ProcessActionResult.ACTION_ALREADY_PROCESSING;
|
|
48606
48670
|
}
|
|
48607
48671
|
this.uploadingActionId = id;
|
|
48608
48672
|
this.processingAction = undefined;
|
|
48609
|
-
if (this.state === DraftQueueState
|
|
48610
|
-
this.state = DraftQueueState
|
|
48673
|
+
if (this.state === DraftQueueState.Waiting) {
|
|
48674
|
+
this.state = DraftQueueState.Started;
|
|
48611
48675
|
}
|
|
48612
48676
|
this.notifyChangedListeners({
|
|
48613
|
-
type: DraftQueueEventType
|
|
48614
|
-
action: { ...action, status: DraftActionStatus
|
|
48677
|
+
type: DraftQueueEventType.ActionUploading,
|
|
48678
|
+
action: { ...action, status: DraftActionStatus.Uploading },
|
|
48615
48679
|
});
|
|
48616
48680
|
return this.handle(action);
|
|
48617
48681
|
}
|
|
@@ -48624,14 +48688,14 @@
|
|
|
48624
48688
|
}
|
|
48625
48689
|
const errorAction = {
|
|
48626
48690
|
...action,
|
|
48627
|
-
status: DraftActionStatus
|
|
48691
|
+
status: DraftActionStatus.Error,
|
|
48628
48692
|
error,
|
|
48629
48693
|
metadata: newMetadata,
|
|
48630
48694
|
};
|
|
48631
48695
|
await this.draftStore.writeAction(errorAction);
|
|
48632
|
-
this.state = DraftQueueState
|
|
48696
|
+
this.state = DraftQueueState.Error;
|
|
48633
48697
|
return this.notifyChangedListeners({
|
|
48634
|
-
type: DraftQueueEventType
|
|
48698
|
+
type: DraftQueueEventType.ActionFailed,
|
|
48635
48699
|
action: errorAction,
|
|
48636
48700
|
});
|
|
48637
48701
|
}
|
|
@@ -48650,7 +48714,7 @@
|
|
|
48650
48714
|
* started
|
|
48651
48715
|
*/
|
|
48652
48716
|
async startQueueSafe() {
|
|
48653
|
-
if (this.userState === DraftQueueState
|
|
48717
|
+
if (this.userState === DraftQueueState.Started && this.state !== DraftQueueState.Started) {
|
|
48654
48718
|
await this.startQueue();
|
|
48655
48719
|
}
|
|
48656
48720
|
}
|
|
@@ -48677,11 +48741,11 @@
|
|
|
48677
48741
|
}
|
|
48678
48742
|
await handler.handleActionRemoved(action, queue.filter((x) => x.id !== actionId));
|
|
48679
48743
|
await this.notifyChangedListeners({
|
|
48680
|
-
type: DraftQueueEventType
|
|
48744
|
+
type: DraftQueueEventType.ActionDeleted,
|
|
48681
48745
|
action,
|
|
48682
48746
|
});
|
|
48683
|
-
if (this.userState === DraftQueueState
|
|
48684
|
-
this.state !== DraftQueueState
|
|
48747
|
+
if (this.userState === DraftQueueState.Started &&
|
|
48748
|
+
this.state !== DraftQueueState.Started &&
|
|
48685
48749
|
this.replacingAction === undefined) {
|
|
48686
48750
|
await this.startQueue();
|
|
48687
48751
|
}
|
|
@@ -48711,14 +48775,14 @@
|
|
|
48711
48775
|
action.metadata = handler.updateMetadata(action.metadata, metadata);
|
|
48712
48776
|
await this.draftStore.writeAction(action);
|
|
48713
48777
|
await this.notifyChangedListeners({
|
|
48714
|
-
type: DraftQueueEventType
|
|
48778
|
+
type: DraftQueueEventType.ActionUpdated,
|
|
48715
48779
|
action: action,
|
|
48716
48780
|
});
|
|
48717
48781
|
return action;
|
|
48718
48782
|
}
|
|
48719
48783
|
scheduleRetryWithSpecifiedDelay(retryDelayInMs) {
|
|
48720
48784
|
this.timeoutHandler = setTimeout(() => {
|
|
48721
|
-
if (this.state !== DraftQueueState
|
|
48785
|
+
if (this.state !== DraftQueueState.Stopped) {
|
|
48722
48786
|
this.processNextAction();
|
|
48723
48787
|
}
|
|
48724
48788
|
}, retryDelayInMs);
|
|
@@ -48754,11 +48818,11 @@
|
|
|
48754
48818
|
if (targetTag !== sourceTag) {
|
|
48755
48819
|
throw Error('Cannot replace/merge actions for different tags.');
|
|
48756
48820
|
}
|
|
48757
|
-
if (targetStatus === DraftActionStatus
|
|
48758
|
-
targetStatus === DraftActionStatus
|
|
48821
|
+
if (targetStatus === DraftActionStatus.Completed ||
|
|
48822
|
+
targetStatus === DraftActionStatus.Uploading) {
|
|
48759
48823
|
throw Error(`Cannot replace/merge actions when targetAction is in ${targetStatus} status.`);
|
|
48760
48824
|
}
|
|
48761
|
-
if (sourceStatus !== DraftActionStatus
|
|
48825
|
+
if (sourceStatus !== DraftActionStatus.Pending) {
|
|
48762
48826
|
throw Error(`Cannot replace/merge actions when sourceAction is in ${sourceStatus} status.`);
|
|
48763
48827
|
}
|
|
48764
48828
|
if (targetVersion !== sourceVersion) {
|
|
@@ -48788,7 +48852,7 @@
|
|
|
48788
48852
|
// update the target
|
|
48789
48853
|
await this.draftStore.writeAction(updatedTarget);
|
|
48790
48854
|
await this.notifyChangedListeners({
|
|
48791
|
-
type: DraftQueueEventType
|
|
48855
|
+
type: DraftQueueEventType.ActionUpdated,
|
|
48792
48856
|
action: updatedTarget,
|
|
48793
48857
|
});
|
|
48794
48858
|
// remove the source from queue
|
|
@@ -48887,7 +48951,7 @@
|
|
|
48887
48951
|
const { draftStore } = this;
|
|
48888
48952
|
for (let i = 0, len = queueOperations.length; i < len; i++) {
|
|
48889
48953
|
const operation = queueOperations[i];
|
|
48890
|
-
if (operation.type === QueueOperationType
|
|
48954
|
+
if (operation.type === QueueOperationType.Delete) {
|
|
48891
48955
|
const action = draftStore[operation.id];
|
|
48892
48956
|
if (action !== undefined) {
|
|
48893
48957
|
delete draftStore[operation.id];
|
|
@@ -49011,7 +49075,12 @@
|
|
|
49011
49075
|
// the luvio store redirect table, during which a new draft might be enqueued
|
|
49012
49076
|
// which would not see a necessary mapping.
|
|
49013
49077
|
this.ephemeralRedirects = {};
|
|
49078
|
+
// determined by Server setup.
|
|
49014
49079
|
this.isIdempotencySupported = true;
|
|
49080
|
+
// idempotency write flag set by lds
|
|
49081
|
+
this.isLdsIdempotencyWriteDisabled = ldsIdempotencyWriteDisabled.isOpen({
|
|
49082
|
+
fallback: false,
|
|
49083
|
+
});
|
|
49015
49084
|
}
|
|
49016
49085
|
enqueue(data) {
|
|
49017
49086
|
return this.draftQueue.enqueue(this.handlerId, data);
|
|
@@ -49025,9 +49094,9 @@
|
|
|
49025
49094
|
await actionCompleted({
|
|
49026
49095
|
...action,
|
|
49027
49096
|
response,
|
|
49028
|
-
status: DraftActionStatus
|
|
49097
|
+
status: DraftActionStatus.Completed,
|
|
49029
49098
|
});
|
|
49030
|
-
return ProcessActionResult
|
|
49099
|
+
return ProcessActionResult.ACTION_SUCCEEDED;
|
|
49031
49100
|
}
|
|
49032
49101
|
let shouldRetry = false;
|
|
49033
49102
|
let retryDelayInMs = undefined;
|
|
@@ -49087,13 +49156,13 @@
|
|
|
49087
49156
|
: {
|
|
49088
49157
|
...updatedAction,
|
|
49089
49158
|
error: response,
|
|
49090
|
-
status: DraftActionStatus
|
|
49159
|
+
status: DraftActionStatus.Error,
|
|
49091
49160
|
}, shouldRetry, retryDelayInMs, actionDataChanged);
|
|
49092
|
-
return ProcessActionResult
|
|
49161
|
+
return ProcessActionResult.ACTION_ERRORED;
|
|
49093
49162
|
}
|
|
49094
49163
|
catch (e) {
|
|
49095
49164
|
await actionErrored(action, true);
|
|
49096
|
-
return ProcessActionResult
|
|
49165
|
+
return ProcessActionResult.NETWORK_ERROR;
|
|
49097
49166
|
}
|
|
49098
49167
|
}
|
|
49099
49168
|
// 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.
|
|
@@ -49103,7 +49172,7 @@
|
|
|
49103
49172
|
if (targetErrorCodes.includes(errorCode)) {
|
|
49104
49173
|
action.data.headers = action.data.headers || {};
|
|
49105
49174
|
if (updateIdempotencyKey) {
|
|
49106
|
-
action.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4
|
|
49175
|
+
action.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
49107
49176
|
}
|
|
49108
49177
|
else {
|
|
49109
49178
|
delete action.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY];
|
|
@@ -49132,7 +49201,7 @@
|
|
|
49132
49201
|
targetId,
|
|
49133
49202
|
tag,
|
|
49134
49203
|
data: request,
|
|
49135
|
-
status: DraftActionStatus
|
|
49204
|
+
status: DraftActionStatus.Pending,
|
|
49136
49205
|
id: generateUniqueDraftActionId(queue.map((x) => x.id)),
|
|
49137
49206
|
timestamp: Date.now(),
|
|
49138
49207
|
metadata: {},
|
|
@@ -49198,11 +49267,11 @@
|
|
|
49198
49267
|
};
|
|
49199
49268
|
// item needs to be replaced with a new item at the new record key
|
|
49200
49269
|
queueOperations.push({
|
|
49201
|
-
type: QueueOperationType
|
|
49270
|
+
type: QueueOperationType.Delete,
|
|
49202
49271
|
id: queueActionId,
|
|
49203
49272
|
});
|
|
49204
49273
|
queueOperations.push({
|
|
49205
|
-
type: QueueOperationType
|
|
49274
|
+
type: QueueOperationType.Add,
|
|
49206
49275
|
action: updatedAction,
|
|
49207
49276
|
});
|
|
49208
49277
|
}
|
|
@@ -49217,7 +49286,7 @@
|
|
|
49217
49286
|
};
|
|
49218
49287
|
// item needs to be updated
|
|
49219
49288
|
queueOperations.push({
|
|
49220
|
-
type: QueueOperationType
|
|
49289
|
+
type: QueueOperationType.Update,
|
|
49221
49290
|
id: queueActionId,
|
|
49222
49291
|
action: updatedAction,
|
|
49223
49292
|
});
|
|
@@ -49228,7 +49297,7 @@
|
|
|
49228
49297
|
}
|
|
49229
49298
|
// delete completed action
|
|
49230
49299
|
queueOperations.push({
|
|
49231
|
-
type: QueueOperationType
|
|
49300
|
+
type: QueueOperationType.Delete,
|
|
49232
49301
|
id: action.id,
|
|
49233
49302
|
});
|
|
49234
49303
|
return queueOperations;
|
|
@@ -49264,7 +49333,7 @@
|
|
|
49264
49333
|
synchronousIngest: this.synchronousIngest.bind(this),
|
|
49265
49334
|
buildCacheKeysForResponse: this.buildCacheKeysFromResponse.bind(this),
|
|
49266
49335
|
});
|
|
49267
|
-
const recordsNeedingReplay = queueOperations.filter((x) => x.type === QueueOperationType
|
|
49336
|
+
const recordsNeedingReplay = queueOperations.filter((x) => x.type === QueueOperationType.Update);
|
|
49268
49337
|
for (const recordNeedingReplay of recordsNeedingReplay) {
|
|
49269
49338
|
const { action } = recordNeedingReplay;
|
|
49270
49339
|
if (isResourceRequestAction(action)) {
|
|
@@ -49292,7 +49361,7 @@
|
|
|
49292
49361
|
}
|
|
49293
49362
|
if (this.isActionOfType(targetAction) &&
|
|
49294
49363
|
this.isActionOfType(sourceAction)) {
|
|
49295
|
-
targetAction.status = DraftActionStatus
|
|
49364
|
+
targetAction.status = DraftActionStatus.Pending;
|
|
49296
49365
|
targetAction.data = sourceAction.data;
|
|
49297
49366
|
return targetAction;
|
|
49298
49367
|
}
|
|
@@ -49329,12 +49398,12 @@
|
|
|
49329
49398
|
};
|
|
49330
49399
|
// Updates Idempotency key if target has one
|
|
49331
49400
|
if (targetData.headers && targetData.headers[HTTP_HEADER_IDEMPOTENCY_KEY]) {
|
|
49332
|
-
merged.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4
|
|
49401
|
+
merged.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
49333
49402
|
}
|
|
49334
49403
|
// overlay metadata
|
|
49335
49404
|
merged.metadata = { ...targetMetadata, ...sourceMetadata };
|
|
49336
49405
|
// put status back to pending to auto upload if queue is active and targed is at the head.
|
|
49337
|
-
merged.status = DraftActionStatus
|
|
49406
|
+
merged.status = DraftActionStatus.Pending;
|
|
49338
49407
|
return merged;
|
|
49339
49408
|
}
|
|
49340
49409
|
shouldDeleteActionByTagOnRemoval(action) {
|
|
@@ -49368,12 +49437,12 @@
|
|
|
49368
49437
|
return [action.targetId];
|
|
49369
49438
|
}
|
|
49370
49439
|
hasIdempotencySupport() {
|
|
49371
|
-
return this.isIdempotencySupported;
|
|
49440
|
+
return this.isIdempotencySupported && !this.isLdsIdempotencyWriteDisabled;
|
|
49372
49441
|
}
|
|
49373
49442
|
async ingestResponses(responses, action) {
|
|
49374
49443
|
const luvio = this.getLuvio();
|
|
49375
49444
|
await luvio.handleSuccessResponse(() => {
|
|
49376
|
-
if (action.status === DraftActionStatus
|
|
49445
|
+
if (action.status === DraftActionStatus.Completed) {
|
|
49377
49446
|
const mappings = this.getRedirectMappings(action);
|
|
49378
49447
|
if (mappings) {
|
|
49379
49448
|
mappings.forEach((mapping) => {
|
|
@@ -49428,14 +49497,14 @@
|
|
|
49428
49497
|
/**
|
|
49429
49498
|
* Denotes what kind of operation a DraftQueueItem represents.
|
|
49430
49499
|
*/
|
|
49431
|
-
var DraftActionOperationType
|
|
49500
|
+
var DraftActionOperationType;
|
|
49432
49501
|
(function (DraftActionOperationType) {
|
|
49433
49502
|
DraftActionOperationType["Create"] = "create";
|
|
49434
49503
|
DraftActionOperationType["Update"] = "update";
|
|
49435
49504
|
DraftActionOperationType["Delete"] = "delete";
|
|
49436
49505
|
DraftActionOperationType["Custom"] = "custom";
|
|
49437
|
-
})(DraftActionOperationType
|
|
49438
|
-
var DraftQueueOperationType
|
|
49506
|
+
})(DraftActionOperationType || (DraftActionOperationType = {}));
|
|
49507
|
+
var DraftQueueOperationType;
|
|
49439
49508
|
(function (DraftQueueOperationType) {
|
|
49440
49509
|
DraftQueueOperationType["ItemAdded"] = "added";
|
|
49441
49510
|
DraftQueueOperationType["ItemUploading"] = "uploading";
|
|
@@ -49445,7 +49514,7 @@
|
|
|
49445
49514
|
DraftQueueOperationType["ItemUpdated"] = "updated";
|
|
49446
49515
|
DraftQueueOperationType["QueueStarted"] = "started";
|
|
49447
49516
|
DraftQueueOperationType["QueueStopped"] = "stopped";
|
|
49448
|
-
})(DraftQueueOperationType
|
|
49517
|
+
})(DraftQueueOperationType || (DraftQueueOperationType = {}));
|
|
49449
49518
|
/**
|
|
49450
49519
|
* Converts the internal DraftAction's ResourceRequest into
|
|
49451
49520
|
* a DraftActionOperationType.
|
|
@@ -49459,11 +49528,11 @@
|
|
|
49459
49528
|
switch (action.data.method) {
|
|
49460
49529
|
case 'put':
|
|
49461
49530
|
case 'patch':
|
|
49462
|
-
return DraftActionOperationType
|
|
49531
|
+
return DraftActionOperationType.Update;
|
|
49463
49532
|
case 'post':
|
|
49464
|
-
return DraftActionOperationType
|
|
49533
|
+
return DraftActionOperationType.Create;
|
|
49465
49534
|
case 'delete':
|
|
49466
|
-
return DraftActionOperationType
|
|
49535
|
+
return DraftActionOperationType.Delete;
|
|
49467
49536
|
default:
|
|
49468
49537
|
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
49469
49538
|
throw new Error(`${action.data.method} is an unsupported request method type for DraftQueue.`);
|
|
@@ -49475,7 +49544,7 @@
|
|
|
49475
49544
|
}
|
|
49476
49545
|
}
|
|
49477
49546
|
else {
|
|
49478
|
-
return DraftActionOperationType
|
|
49547
|
+
return DraftActionOperationType.Custom;
|
|
49479
49548
|
}
|
|
49480
49549
|
}
|
|
49481
49550
|
function toQueueState(queue) {
|
|
@@ -49490,13 +49559,13 @@
|
|
|
49490
49559
|
constructor(draftQueue) {
|
|
49491
49560
|
this.listeners = [];
|
|
49492
49561
|
this.draftEventsShouldBeEmitted = [
|
|
49493
|
-
DraftQueueEventType
|
|
49494
|
-
DraftQueueEventType
|
|
49495
|
-
DraftQueueEventType
|
|
49496
|
-
DraftQueueEventType
|
|
49497
|
-
DraftQueueEventType
|
|
49498
|
-
DraftQueueEventType
|
|
49499
|
-
DraftQueueEventType
|
|
49562
|
+
DraftQueueEventType.ActionAdded,
|
|
49563
|
+
DraftQueueEventType.ActionUploading,
|
|
49564
|
+
DraftQueueEventType.ActionCompleted,
|
|
49565
|
+
DraftQueueEventType.ActionDeleted,
|
|
49566
|
+
DraftQueueEventType.ActionFailed,
|
|
49567
|
+
DraftQueueEventType.ActionUpdated,
|
|
49568
|
+
DraftQueueEventType.QueueStateChanged,
|
|
49500
49569
|
];
|
|
49501
49570
|
this.draftQueue = draftQueue;
|
|
49502
49571
|
draftQueue.registerOnChangedListener((event) => {
|
|
@@ -49508,28 +49577,28 @@
|
|
|
49508
49577
|
}
|
|
49509
49578
|
draftQueueEventTypeToOperationType(type) {
|
|
49510
49579
|
switch (type) {
|
|
49511
|
-
case DraftQueueEventType
|
|
49512
|
-
return DraftQueueOperationType
|
|
49513
|
-
case DraftQueueEventType
|
|
49514
|
-
return DraftQueueOperationType
|
|
49515
|
-
case DraftQueueEventType
|
|
49516
|
-
return DraftQueueOperationType
|
|
49517
|
-
case DraftQueueEventType
|
|
49518
|
-
return DraftQueueOperationType
|
|
49519
|
-
case DraftQueueEventType
|
|
49520
|
-
return DraftQueueOperationType
|
|
49521
|
-
case DraftQueueEventType
|
|
49522
|
-
return DraftQueueOperationType
|
|
49580
|
+
case DraftQueueEventType.ActionAdded:
|
|
49581
|
+
return DraftQueueOperationType.ItemAdded;
|
|
49582
|
+
case DraftQueueEventType.ActionUploading:
|
|
49583
|
+
return DraftQueueOperationType.ItemUploading;
|
|
49584
|
+
case DraftQueueEventType.ActionCompleted:
|
|
49585
|
+
return DraftQueueOperationType.ItemCompleted;
|
|
49586
|
+
case DraftQueueEventType.ActionDeleted:
|
|
49587
|
+
return DraftQueueOperationType.ItemDeleted;
|
|
49588
|
+
case DraftQueueEventType.ActionFailed:
|
|
49589
|
+
return DraftQueueOperationType.ItemFailed;
|
|
49590
|
+
case DraftQueueEventType.ActionUpdated:
|
|
49591
|
+
return DraftQueueOperationType.ItemUpdated;
|
|
49523
49592
|
default:
|
|
49524
49593
|
throw Error('Unsupported event type');
|
|
49525
49594
|
}
|
|
49526
49595
|
}
|
|
49527
49596
|
draftQueueStateToOperationType(state) {
|
|
49528
49597
|
switch (state) {
|
|
49529
|
-
case DraftQueueState
|
|
49530
|
-
return DraftQueueOperationType
|
|
49531
|
-
case DraftQueueState
|
|
49532
|
-
return DraftQueueOperationType
|
|
49598
|
+
case DraftQueueState.Started:
|
|
49599
|
+
return DraftQueueOperationType.QueueStarted;
|
|
49600
|
+
case DraftQueueState.Stopped:
|
|
49601
|
+
return DraftQueueOperationType.QueueStopped;
|
|
49533
49602
|
default:
|
|
49534
49603
|
throw Error('Unsupported event type');
|
|
49535
49604
|
}
|
|
@@ -49906,14 +49975,20 @@
|
|
|
49906
49975
|
*/
|
|
49907
49976
|
|
|
49908
49977
|
|
|
49978
|
+
const MAX_BATCH_SIZE = 2000;
|
|
49909
49979
|
class DataLoader {
|
|
49910
|
-
constructor(batchLoadFn) {
|
|
49980
|
+
constructor(batchLoadFn, options) {
|
|
49911
49981
|
this._batchLoadFn = batchLoadFn;
|
|
49912
49982
|
this._batch = null;
|
|
49913
49983
|
this._batchScheduleFn = function (fn) {
|
|
49914
49984
|
setTimeout(fn, 0);
|
|
49915
49985
|
};
|
|
49916
49986
|
this._cacheMap = new Map();
|
|
49987
|
+
this._maxBatchSize = MAX_BATCH_SIZE;
|
|
49988
|
+
if (options !== undefined) {
|
|
49989
|
+
const { maxBatchSize } = options;
|
|
49990
|
+
this._maxBatchSize = maxBatchSize || MAX_BATCH_SIZE;
|
|
49991
|
+
}
|
|
49917
49992
|
}
|
|
49918
49993
|
load(key) {
|
|
49919
49994
|
if (key === null || key === undefined) {
|
|
@@ -49943,7 +50018,9 @@
|
|
|
49943
50018
|
// If there is an existing batch which has not yet dispatched and is within
|
|
49944
50019
|
// the limit of the batch size, then return it.
|
|
49945
50020
|
const existingBatch = this._batch;
|
|
49946
|
-
if (existingBatch !== null &&
|
|
50021
|
+
if (existingBatch !== null &&
|
|
50022
|
+
!existingBatch.hasDispatched &&
|
|
50023
|
+
existingBatch.keys.length < this._maxBatchSize) {
|
|
49947
50024
|
return existingBatch;
|
|
49948
50025
|
}
|
|
49949
50026
|
// Otherwise, create a new batch for this loader.
|
|
@@ -52336,7 +52413,9 @@
|
|
|
52336
52413
|
];
|
|
52337
52414
|
// extend the schema and add resolvers
|
|
52338
52415
|
const schema = addResolversToSchema(extendSchema(cache.getSchema(), extensions), polymorphicFieldTypeNames);
|
|
52416
|
+
const polymorphicFieldTypeNamesSet = new Set(polymorphicFieldTypeNames);
|
|
52339
52417
|
cache.setSchema(schema);
|
|
52418
|
+
cache.setPolymorphicFieldTypeNames([...polymorphicFieldTypeNamesSet]);
|
|
52340
52419
|
return cache;
|
|
52341
52420
|
}
|
|
52342
52421
|
/**
|
|
@@ -52492,7 +52571,10 @@
|
|
|
52492
52571
|
let typedScalars = new Set();
|
|
52493
52572
|
let parentRelationshipFields = new Set();
|
|
52494
52573
|
const existingFields = keys$4(type.getFields());
|
|
52495
|
-
const missingFields = values$2(objectInfo.fields).filter((field) =>
|
|
52574
|
+
const missingFields = values$2(objectInfo.fields).filter((field) => {
|
|
52575
|
+
return (existingFields.includes(field.apiName) === false ||
|
|
52576
|
+
(field.relationshipName !== null && field.referenceToInfos.length > 1));
|
|
52577
|
+
});
|
|
52496
52578
|
const { fields, polymorphicFieldTypeNames } = makeRecordField(missingFields, objectInfoMap, parentRelationshipFields, 'Cached');
|
|
52497
52579
|
const { apiName, childRelationships } = objectInfo;
|
|
52498
52580
|
// handles child relationship
|
|
@@ -52592,8 +52674,10 @@
|
|
|
52592
52674
|
// For polymorphic field, its type is 'Record' inteface. The concrete entity type name is saved for field resolving of next phase
|
|
52593
52675
|
}
|
|
52594
52676
|
else if (field.referenceToInfos.length > 1) {
|
|
52595
|
-
|
|
52596
|
-
|
|
52677
|
+
if (recordTypeInSchema === 'Missing') {
|
|
52678
|
+
existingParentRelationships.add(field.relationshipName);
|
|
52679
|
+
fields += `${field.relationshipName}: Record\n`;
|
|
52680
|
+
}
|
|
52597
52681
|
for (const relation of field.referenceToInfos) {
|
|
52598
52682
|
if (objectInfoMap[relation.apiName] !== undefined) {
|
|
52599
52683
|
polymorphicFieldTypeNames.add(relation.apiName);
|
|
@@ -55042,34 +55126,42 @@
|
|
|
55042
55126
|
}
|
|
55043
55127
|
const { dataType, relationshipName, referenceToInfos } = fieldInfo;
|
|
55044
55128
|
const draftFieldValue = record.fields[draftField].value;
|
|
55045
|
-
if (dataType === 'Reference' && relationshipName !== null
|
|
55046
|
-
if (
|
|
55047
|
-
|
|
55129
|
+
if (dataType === 'Reference' && relationshipName !== null) {
|
|
55130
|
+
if (draftFieldValue === null) {
|
|
55131
|
+
recordFields[relationshipName] = {
|
|
55132
|
+
displayValue: null,
|
|
55133
|
+
value: null,
|
|
55134
|
+
};
|
|
55048
55135
|
}
|
|
55049
|
-
|
|
55050
|
-
|
|
55051
|
-
|
|
55052
|
-
displayValue: null,
|
|
55053
|
-
value: createLink$2(key),
|
|
55054
|
-
};
|
|
55055
|
-
// for custom objects, we select the 'Name' field
|
|
55056
|
-
// otherwise we check the object info for name fields.
|
|
55057
|
-
//if there are multiple we select 'Name' if it exists, otherwise the first one
|
|
55058
|
-
if (referencedRecord !== undefined && referenceToInfos.length > 0) {
|
|
55059
|
-
let nameField;
|
|
55060
|
-
const referenceToInfo = referenceToInfos[0];
|
|
55061
|
-
const nameFields = referenceToInfo.nameFields;
|
|
55062
|
-
if (nameFields.length !== 0) {
|
|
55063
|
-
nameField = nameFields.find((x) => x === 'Name');
|
|
55064
|
-
if (nameField === undefined) {
|
|
55065
|
-
nameField = nameFields[0];
|
|
55066
|
-
}
|
|
55136
|
+
else {
|
|
55137
|
+
if (typeof draftFieldValue !== 'string') {
|
|
55138
|
+
throw Error('reference field value is not a string');
|
|
55067
55139
|
}
|
|
55068
|
-
|
|
55069
|
-
|
|
55070
|
-
|
|
55071
|
-
|
|
55072
|
-
|
|
55140
|
+
const key = getRecordKeyForId(luvio, draftFieldValue);
|
|
55141
|
+
const referencedRecord = referencedRecords.get(key);
|
|
55142
|
+
recordFields[relationshipName] = {
|
|
55143
|
+
displayValue: null,
|
|
55144
|
+
value: createLink$2(key),
|
|
55145
|
+
};
|
|
55146
|
+
// for custom objects, we select the 'Name' field
|
|
55147
|
+
// otherwise we check the object info for name fields.
|
|
55148
|
+
//if there are multiple we select 'Name' if it exists, otherwise the first one
|
|
55149
|
+
if (referencedRecord !== undefined && referenceToInfos.length > 0) {
|
|
55150
|
+
let nameField;
|
|
55151
|
+
const referenceToInfo = referenceToInfos[0];
|
|
55152
|
+
const nameFields = referenceToInfo.nameFields;
|
|
55153
|
+
if (nameFields.length !== 0) {
|
|
55154
|
+
nameField = nameFields.find((x) => x === 'Name');
|
|
55155
|
+
if (nameField === undefined) {
|
|
55156
|
+
nameField = nameFields[0];
|
|
55157
|
+
}
|
|
55158
|
+
}
|
|
55159
|
+
if (nameField !== undefined) {
|
|
55160
|
+
const nameFieldRef = referencedRecord.fields[nameField];
|
|
55161
|
+
if (nameFieldRef) {
|
|
55162
|
+
recordFields[relationshipName].displayValue =
|
|
55163
|
+
(_a = nameFieldRef.displayValue) !== null && _a !== void 0 ? _a : nameFieldRef.value;
|
|
55164
|
+
}
|
|
55073
55165
|
}
|
|
55074
55166
|
}
|
|
55075
55167
|
}
|
|
@@ -55362,17 +55454,8 @@
|
|
|
55362
55454
|
};
|
|
55363
55455
|
for (const fieldName of keys$3$1(recordWithSpanningRefLinks.fields)) {
|
|
55364
55456
|
const fieldKey = buildRecordFieldStoreKey(key, fieldName);
|
|
55365
|
-
|
|
55366
|
-
|
|
55367
|
-
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55368
|
-
publishData(fieldKey, fieldData);
|
|
55369
|
-
}
|
|
55370
|
-
else if (recordWithSpanningRefLinks.fields[fieldName] &&
|
|
55371
|
-
recordWithSpanningRefLinks.fields[fieldName].value &&
|
|
55372
|
-
recordWithSpanningRefLinks.fields[fieldName].value.__ref !== undefined) {
|
|
55373
|
-
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55374
|
-
publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
|
|
55375
|
-
}
|
|
55457
|
+
normalizedRecord.fields[fieldName] = { __ref: fieldKey };
|
|
55458
|
+
publishData(fieldKey, recordWithSpanningRefLinks.fields[fieldName]);
|
|
55376
55459
|
}
|
|
55377
55460
|
// publish the normalized record
|
|
55378
55461
|
publishData(key, normalizedRecord);
|
|
@@ -58019,29 +58102,29 @@
|
|
|
58019
58102
|
function instrumentDraftQueue(queue) {
|
|
58020
58103
|
queue.registerOnChangedListener((draftQueueEvent) => {
|
|
58021
58104
|
switch (draftQueueEvent.type) {
|
|
58022
|
-
case DraftQueueEventType
|
|
58105
|
+
case DraftQueueEventType.QueueStateChanged:
|
|
58023
58106
|
switch (draftQueueEvent.state) {
|
|
58024
|
-
case DraftQueueState
|
|
58107
|
+
case DraftQueueState.Error:
|
|
58025
58108
|
break;
|
|
58026
|
-
case DraftQueueState
|
|
58109
|
+
case DraftQueueState.Started:
|
|
58027
58110
|
break;
|
|
58028
|
-
case DraftQueueState
|
|
58111
|
+
case DraftQueueState.Stopped:
|
|
58029
58112
|
break;
|
|
58030
|
-
case DraftQueueState
|
|
58113
|
+
case DraftQueueState.Waiting:
|
|
58031
58114
|
break;
|
|
58032
58115
|
}
|
|
58033
58116
|
break;
|
|
58034
|
-
case DraftQueueEventType
|
|
58117
|
+
case DraftQueueEventType.ActionAdded:
|
|
58035
58118
|
break;
|
|
58036
|
-
case DraftQueueEventType
|
|
58119
|
+
case DraftQueueEventType.ActionUploading:
|
|
58037
58120
|
break;
|
|
58038
|
-
case DraftQueueEventType
|
|
58121
|
+
case DraftQueueEventType.ActionCompleted:
|
|
58039
58122
|
break;
|
|
58040
|
-
case DraftQueueEventType
|
|
58123
|
+
case DraftQueueEventType.ActionDeleted:
|
|
58041
58124
|
break;
|
|
58042
|
-
case DraftQueueEventType
|
|
58125
|
+
case DraftQueueEventType.ActionFailed:
|
|
58043
58126
|
break;
|
|
58044
|
-
case DraftQueueEventType
|
|
58127
|
+
case DraftQueueEventType.ActionUpdated:
|
|
58045
58128
|
break;
|
|
58046
58129
|
}
|
|
58047
58130
|
return Promise.resolve();
|
|
@@ -58202,6 +58285,14 @@
|
|
|
58202
58285
|
return this.updateObjectInfoMapping(keyPrefix, apiName);
|
|
58203
58286
|
}
|
|
58204
58287
|
};
|
|
58288
|
+
this.getCachedObjectInfoStatus = async () => {
|
|
58289
|
+
const infos = await this.readObjectInfoDataFromDurableStore();
|
|
58290
|
+
const map = new Map();
|
|
58291
|
+
infos.forEach(({ apiName, expirationTimestamp }) => {
|
|
58292
|
+
map.set(apiName, { expiration: expirationTimestamp });
|
|
58293
|
+
});
|
|
58294
|
+
return map;
|
|
58295
|
+
};
|
|
58205
58296
|
this.isObjectInfoInDurableStore = async (apiName) => {
|
|
58206
58297
|
if (this.apiNameToKeyPrefixMemoryCache[apiName] !== undefined) {
|
|
58207
58298
|
return Promise.resolve(true);
|
|
@@ -58210,12 +58301,10 @@
|
|
|
58210
58301
|
return this.apiNameToKeyPrefixMemoryCache[apiName] !== undefined;
|
|
58211
58302
|
};
|
|
58212
58303
|
this.loadObjectInfoMaps = async () => {
|
|
58213
|
-
const
|
|
58214
|
-
|
|
58215
|
-
const apiName = row[0];
|
|
58216
|
-
const keyPrefix = row[1];
|
|
58304
|
+
const infos = await this.readObjectInfoDataFromDurableStore();
|
|
58305
|
+
infos.forEach(({ keyPrefix, apiName }) => {
|
|
58217
58306
|
this.updateObjectInfoMapping(keyPrefix, apiName);
|
|
58218
|
-
}
|
|
58307
|
+
});
|
|
58219
58308
|
};
|
|
58220
58309
|
this.updateObjectInfoMapping = (keyPrefix, apiName) => {
|
|
58221
58310
|
this.apiNameToKeyPrefixMemoryCache[apiName] = keyPrefix;
|
|
@@ -58259,6 +58348,24 @@
|
|
|
58259
58348
|
}
|
|
58260
58349
|
return snapshot.data;
|
|
58261
58350
|
}
|
|
58351
|
+
async readObjectInfoDataFromDurableStore() {
|
|
58352
|
+
const rows = (await this.durableStore.query(`
|
|
58353
|
+
SELECT
|
|
58354
|
+
json_extract(data, '$.apiName') as ApiName,
|
|
58355
|
+
json_extract(data, '$.keyPrefix') as keyPrefix,
|
|
58356
|
+
JSON_EXTRACT(metadata, '$.expirationTimestamp') AS expirationTimestamp
|
|
58357
|
+
from
|
|
58358
|
+
lds_data
|
|
58359
|
+
where
|
|
58360
|
+
key like '%ObjectInfoRepresentation%'`, [])).rows;
|
|
58361
|
+
return rows.map((row) => {
|
|
58362
|
+
return {
|
|
58363
|
+
apiName: row[0],
|
|
58364
|
+
keyPrefix: row[1],
|
|
58365
|
+
expirationTimestamp: row[2],
|
|
58366
|
+
};
|
|
58367
|
+
});
|
|
58368
|
+
}
|
|
58262
58369
|
}
|
|
58263
58370
|
|
|
58264
58371
|
function instrumentGraphQLEval(adapter) {
|
|
@@ -59347,7 +59454,7 @@
|
|
|
59347
59454
|
}
|
|
59348
59455
|
}
|
|
59349
59456
|
|
|
59350
|
-
const DEFAULT_BATCH_SIZE = 500;
|
|
59457
|
+
const DEFAULT_BATCH_SIZE$1 = 500;
|
|
59351
59458
|
const DEFAULT_CONCURRENCY = 6;
|
|
59352
59459
|
const DEFAULT_GQL_QUERY_BATCH_SIZE = 5;
|
|
59353
59460
|
class PrimingSession extends EventEmitter {
|
|
@@ -59355,7 +59462,7 @@
|
|
|
59355
59462
|
var _a, _b;
|
|
59356
59463
|
super();
|
|
59357
59464
|
this.useBatchGQL = false;
|
|
59358
|
-
this.batchSize = (_a = config.batchSize) !== null && _a !== void 0 ? _a : DEFAULT_BATCH_SIZE;
|
|
59465
|
+
this.batchSize = (_a = config.batchSize) !== null && _a !== void 0 ? _a : DEFAULT_BATCH_SIZE$1;
|
|
59359
59466
|
this.concurrency = (_b = config.concurrency) !== null && _b !== void 0 ? _b : DEFAULT_CONCURRENCY;
|
|
59360
59467
|
this.recordLoader = config.recordLoader;
|
|
59361
59468
|
this.recordIngestor = config.recordIngestor;
|
|
@@ -59974,10 +60081,6 @@
|
|
|
59974
60081
|
// ref: https://gnome.pages.gitlab.gnome.org/tracker/docs/developer/limits.html?gi-language=c
|
|
59975
60082
|
const SQLITE_MAX_VARIABLE_NUMBER = 999;
|
|
59976
60083
|
const PARAMS_PER_RECORD = 3;
|
|
59977
|
-
/**
|
|
59978
|
-
* No key builder (or adapter) exists for the object info directory, we need to build the key manually
|
|
59979
|
-
*/
|
|
59980
|
-
const ObjectInfoDirectoryKey = `${keyPrefix$2}::${RepresentationType$H}:`;
|
|
59981
60084
|
// We need to batch the records to avoid hitting the SQLITE_MAX_VARIABLE_NUMBER limit. Each record has 3 parameters
|
|
59982
60085
|
const BATCH_SIZE = Math.floor(SQLITE_MAX_VARIABLE_NUMBER / PARAMS_PER_RECORD);
|
|
59983
60086
|
class SqlitePrimingStore {
|
|
@@ -60042,44 +60145,6 @@
|
|
|
60042
60145
|
};
|
|
60043
60146
|
}
|
|
60044
60147
|
}
|
|
60045
|
-
async readObjectInfoDirectory() {
|
|
60046
|
-
const sql = 'SELECT data FROM lds_data WHERE key = ?';
|
|
60047
|
-
const params = [ObjectInfoDirectoryKey];
|
|
60048
|
-
const result = await this.store.query(sql, params);
|
|
60049
|
-
if (result.rows.length === 1) {
|
|
60050
|
-
return JSON.parse(result.rows[0][0]);
|
|
60051
|
-
}
|
|
60052
|
-
return undefined;
|
|
60053
|
-
}
|
|
60054
|
-
async readObjectApiNames() {
|
|
60055
|
-
const sql = 'SELECT key FROM lds_data WHERE key like ?';
|
|
60056
|
-
const params = [`%${RepresentationType$M}%`];
|
|
60057
|
-
const result = await this.store.query(sql, params);
|
|
60058
|
-
const apiNames = new Set();
|
|
60059
|
-
result.rows.forEach((row) => {
|
|
60060
|
-
const key = row[0];
|
|
60061
|
-
const parts = key.split(':');
|
|
60062
|
-
apiNames.add(parts[parts.length - 1]);
|
|
60063
|
-
});
|
|
60064
|
-
return apiNames;
|
|
60065
|
-
}
|
|
60066
|
-
writeObjectInfoDirectory(directory) {
|
|
60067
|
-
const sql = 'INSERT or IGNORE into lds_data (key, data) values (?, ?)';
|
|
60068
|
-
const params = [ObjectInfoDirectoryKey, JSON.stringify(directory)];
|
|
60069
|
-
return this.store.query(sql, params).then(() => { });
|
|
60070
|
-
}
|
|
60071
|
-
writeObjectInfos(objectInfos) {
|
|
60072
|
-
const sql = `INSERT or IGNORE into lds_data (key, data) values ${objectInfos
|
|
60073
|
-
.map(() => '(?, ?)')
|
|
60074
|
-
.join(',')};`;
|
|
60075
|
-
const params = [];
|
|
60076
|
-
objectInfos.forEach((objectInfo) => {
|
|
60077
|
-
const key = keyBuilder$1Q(this.getLuvio(), { apiName: objectInfo.apiName });
|
|
60078
|
-
params.push(key);
|
|
60079
|
-
params.push(JSON.stringify(objectInfo));
|
|
60080
|
-
});
|
|
60081
|
-
return this.store.query(sql, params).then(() => { });
|
|
60082
|
-
}
|
|
60083
60148
|
}
|
|
60084
60149
|
function batchArray(arr, batchSize = BATCH_SIZE) {
|
|
60085
60150
|
const batches = [];
|
|
@@ -60154,9 +60219,7 @@
|
|
|
60154
60219
|
recordLoader,
|
|
60155
60220
|
recordIngestor,
|
|
60156
60221
|
store: primingStore,
|
|
60157
|
-
objectInfoLoader:
|
|
60158
|
-
getObjectInfos: objectInfoService.getObjectInfos.bind(objectInfoService),
|
|
60159
|
-
},
|
|
60222
|
+
objectInfoLoader: objectInfoService,
|
|
60160
60223
|
concurrency: config.concurrency,
|
|
60161
60224
|
batchSize: config.batchSize,
|
|
60162
60225
|
ldsRecordRefresher: new LdsPrimingRecordRefresher(config.getRecords),
|
|
@@ -60319,7 +60382,7 @@
|
|
|
60319
60382
|
id: '@salesforce/lds-network-adapter',
|
|
60320
60383
|
instrument: instrument$2,
|
|
60321
60384
|
});
|
|
60322
|
-
// version: 1.
|
|
60385
|
+
// version: 1.249.0-11c3e1ed5
|
|
60323
60386
|
|
|
60324
60387
|
const { create: create$3, keys: keys$3 } = Object;
|
|
60325
60388
|
const { stringify: stringify$1, parse: parse$1 } = JSON;
|
|
@@ -78096,10 +78159,11 @@
|
|
|
78096
78159
|
}
|
|
78097
78160
|
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
78098
78161
|
const { luvio, config } = context;
|
|
78099
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
78162
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
78100
78163
|
const dispatchOptions = {
|
|
78101
78164
|
resourceRequestContext: {
|
|
78102
78165
|
requestCorrelator,
|
|
78166
|
+
sourceContext,
|
|
78103
78167
|
luvioRequestMethod: 'get',
|
|
78104
78168
|
},
|
|
78105
78169
|
eventObservers,
|
|
@@ -78641,7 +78705,7 @@
|
|
|
78641
78705
|
configuration: { ...configurationForGraphQLAdapters$1 },
|
|
78642
78706
|
instrument: instrument$1,
|
|
78643
78707
|
});
|
|
78644
|
-
// version: 1.
|
|
78708
|
+
// version: 1.249.0-15efc7f9b
|
|
78645
78709
|
|
|
78646
78710
|
// On core the unstable adapters are re-exported with different names,
|
|
78647
78711
|
// we want to match them here.
|
|
@@ -80756,10 +80820,11 @@
|
|
|
80756
80820
|
}
|
|
80757
80821
|
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
80758
80822
|
const { config, fragment, luvio } = context;
|
|
80759
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
80823
|
+
const { networkPriority, requestCorrelator, eventObservers, sourceContext } = coercedAdapterRequestContext;
|
|
80760
80824
|
const dispatchOptions = {
|
|
80761
80825
|
resourceRequestContext: {
|
|
80762
80826
|
requestCorrelator,
|
|
80827
|
+
sourceContext,
|
|
80763
80828
|
},
|
|
80764
80829
|
eventObservers,
|
|
80765
80830
|
};
|
|
@@ -80890,7 +80955,7 @@
|
|
|
80890
80955
|
unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
|
|
80891
80956
|
graphQLImperative = ldsAdapter;
|
|
80892
80957
|
});
|
|
80893
|
-
// version: 1.
|
|
80958
|
+
// version: 1.249.0-15efc7f9b
|
|
80894
80959
|
|
|
80895
80960
|
var gqlApi = /*#__PURE__*/Object.freeze({
|
|
80896
80961
|
__proto__: null,
|
|
@@ -81588,7 +81653,7 @@
|
|
|
81588
81653
|
function register(r) {
|
|
81589
81654
|
callbacks$1.forEach((callback) => callback(r));
|
|
81590
81655
|
}
|
|
81591
|
-
// version: 1.
|
|
81656
|
+
// version: 1.249.0-11c3e1ed5
|
|
81592
81657
|
|
|
81593
81658
|
/**
|
|
81594
81659
|
* Returns true if the value acts like a Promise, i.e. has a "then" function,
|
|
@@ -86232,142 +86297,6 @@
|
|
|
86232
86297
|
}
|
|
86233
86298
|
}
|
|
86234
86299
|
|
|
86235
|
-
/**
|
|
86236
|
-
* Copyright (c) 2022, Salesforce, Inc.,
|
|
86237
|
-
* All rights reserved.
|
|
86238
|
-
* For full license text, see the LICENSE.txt file
|
|
86239
|
-
*/
|
|
86240
|
-
|
|
86241
|
-
|
|
86242
|
-
var DraftActionStatus;
|
|
86243
|
-
(function (DraftActionStatus) {
|
|
86244
|
-
DraftActionStatus["Pending"] = "pending";
|
|
86245
|
-
DraftActionStatus["Uploading"] = "uploading";
|
|
86246
|
-
DraftActionStatus["Error"] = "error";
|
|
86247
|
-
DraftActionStatus["Completed"] = "completed";
|
|
86248
|
-
})(DraftActionStatus || (DraftActionStatus = {}));
|
|
86249
|
-
var ProcessActionResult;
|
|
86250
|
-
(function (ProcessActionResult) {
|
|
86251
|
-
// non-2xx network error, requires user intervention
|
|
86252
|
-
ProcessActionResult["ACTION_ERRORED"] = "ERROR";
|
|
86253
|
-
// upload succeeded
|
|
86254
|
-
ProcessActionResult["ACTION_SUCCEEDED"] = "SUCCESS";
|
|
86255
|
-
// queue is empty
|
|
86256
|
-
ProcessActionResult["NO_ACTION_TO_PROCESS"] = "NO_ACTION_TO_PROCESS";
|
|
86257
|
-
// network request is in flight
|
|
86258
|
-
ProcessActionResult["ACTION_ALREADY_PROCESSING"] = "ACTION_ALREADY_PROCESSING";
|
|
86259
|
-
// network call failed (offline)
|
|
86260
|
-
ProcessActionResult["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
86261
|
-
// queue is blocked on an error that requires user intervention
|
|
86262
|
-
ProcessActionResult["BLOCKED_ON_ERROR"] = "BLOCKED_ON_ERROR";
|
|
86263
|
-
//waiting for user to execute custom action
|
|
86264
|
-
ProcessActionResult["CUSTOM_ACTION_WAITING"] = "CUSTOM_ACTION_WAITING";
|
|
86265
|
-
})(ProcessActionResult || (ProcessActionResult = {}));
|
|
86266
|
-
var DraftQueueState;
|
|
86267
|
-
(function (DraftQueueState) {
|
|
86268
|
-
/** Currently processing an item in the queue or queue is empty and waiting to process the next item. */
|
|
86269
|
-
DraftQueueState["Started"] = "started";
|
|
86270
|
-
/**
|
|
86271
|
-
* The queue is stopped and will not attempt to upload any drafts until startDraftQueue() is called.
|
|
86272
|
-
* This is the initial state when the DraftQueue gets instantiated.
|
|
86273
|
-
*/
|
|
86274
|
-
DraftQueueState["Stopped"] = "stopped";
|
|
86275
|
-
/**
|
|
86276
|
-
* The queue is stopped due to a blocking error from the last upload attempt.
|
|
86277
|
-
* The queue will not run again until startDraftQueue() is called.
|
|
86278
|
-
*/
|
|
86279
|
-
DraftQueueState["Error"] = "error";
|
|
86280
|
-
/**
|
|
86281
|
-
* There was a network error and the queue will attempt to upload again shortly.
|
|
86282
|
-
* To attempt to force an upload now call startDraftQueue().
|
|
86283
|
-
*/
|
|
86284
|
-
DraftQueueState["Waiting"] = "waiting";
|
|
86285
|
-
})(DraftQueueState || (DraftQueueState = {}));
|
|
86286
|
-
var DraftQueueEventType;
|
|
86287
|
-
(function (DraftQueueEventType) {
|
|
86288
|
-
/**
|
|
86289
|
-
* Triggered after an action had been added to the queue
|
|
86290
|
-
*/
|
|
86291
|
-
DraftQueueEventType["ActionAdded"] = "added";
|
|
86292
|
-
/**
|
|
86293
|
-
* Triggered when starting to upload and process an action
|
|
86294
|
-
*/
|
|
86295
|
-
DraftQueueEventType["ActionUploading"] = "uploading";
|
|
86296
|
-
/**
|
|
86297
|
-
* Triggered once an action failed
|
|
86298
|
-
*/
|
|
86299
|
-
DraftQueueEventType["ActionFailed"] = "failed";
|
|
86300
|
-
/**
|
|
86301
|
-
* Triggered after an action has been deleted from the queue
|
|
86302
|
-
*/
|
|
86303
|
-
DraftQueueEventType["ActionDeleted"] = "deleted";
|
|
86304
|
-
/**
|
|
86305
|
-
* Triggered after an action has been completed and after it has been removed from the queue
|
|
86306
|
-
*/
|
|
86307
|
-
DraftQueueEventType["ActionCompleted"] = "completed";
|
|
86308
|
-
/**
|
|
86309
|
-
* Triggered after an action has been updated by the updateAction API
|
|
86310
|
-
*/
|
|
86311
|
-
DraftQueueEventType["ActionUpdated"] = "updated";
|
|
86312
|
-
/**
|
|
86313
|
-
* Triggered after the Draft Queue state changes
|
|
86314
|
-
*/
|
|
86315
|
-
DraftQueueEventType["QueueStateChanged"] = "state";
|
|
86316
|
-
})(DraftQueueEventType || (DraftQueueEventType = {}));
|
|
86317
|
-
var QueueOperationType;
|
|
86318
|
-
(function (QueueOperationType) {
|
|
86319
|
-
QueueOperationType["Add"] = "add";
|
|
86320
|
-
QueueOperationType["Delete"] = "delete";
|
|
86321
|
-
QueueOperationType["Update"] = "update";
|
|
86322
|
-
})(QueueOperationType || (QueueOperationType = {}));
|
|
86323
|
-
/**
|
|
86324
|
-
Use Math.random to generate v4 RFC4122 compliant uuid
|
|
86325
|
-
*/
|
|
86326
|
-
function uuidv4() {
|
|
86327
|
-
const uuid = [];
|
|
86328
|
-
for (let i = 0; i < 32; i++) {
|
|
86329
|
-
const random = (Math.random() * 16) | 0;
|
|
86330
|
-
if (i === 8 || i === 12 || i === 16 || i === 20) {
|
|
86331
|
-
uuid.push('-');
|
|
86332
|
-
}
|
|
86333
|
-
uuid.push((i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16));
|
|
86334
|
-
}
|
|
86335
|
-
return uuid.join('');
|
|
86336
|
-
}
|
|
86337
|
-
|
|
86338
|
-
var CustomActionResultType;
|
|
86339
|
-
(function (CustomActionResultType) {
|
|
86340
|
-
CustomActionResultType["SUCCESS"] = "SUCCESS";
|
|
86341
|
-
CustomActionResultType["FAILURE"] = "FAILURE";
|
|
86342
|
-
})(CustomActionResultType || (CustomActionResultType = {}));
|
|
86343
|
-
var CustomActionErrorType;
|
|
86344
|
-
(function (CustomActionErrorType) {
|
|
86345
|
-
CustomActionErrorType["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
86346
|
-
CustomActionErrorType["CLIENT_ERROR"] = "CLIENT_ERROR";
|
|
86347
|
-
})(CustomActionErrorType || (CustomActionErrorType = {}));
|
|
86348
|
-
|
|
86349
|
-
/**
|
|
86350
|
-
* Denotes what kind of operation a DraftQueueItem represents.
|
|
86351
|
-
*/
|
|
86352
|
-
var DraftActionOperationType;
|
|
86353
|
-
(function (DraftActionOperationType) {
|
|
86354
|
-
DraftActionOperationType["Create"] = "create";
|
|
86355
|
-
DraftActionOperationType["Update"] = "update";
|
|
86356
|
-
DraftActionOperationType["Delete"] = "delete";
|
|
86357
|
-
DraftActionOperationType["Custom"] = "custom";
|
|
86358
|
-
})(DraftActionOperationType || (DraftActionOperationType = {}));
|
|
86359
|
-
var DraftQueueOperationType;
|
|
86360
|
-
(function (DraftQueueOperationType) {
|
|
86361
|
-
DraftQueueOperationType["ItemAdded"] = "added";
|
|
86362
|
-
DraftQueueOperationType["ItemUploading"] = "uploading";
|
|
86363
|
-
DraftQueueOperationType["ItemDeleted"] = "deleted";
|
|
86364
|
-
DraftQueueOperationType["ItemCompleted"] = "completed";
|
|
86365
|
-
DraftQueueOperationType["ItemFailed"] = "failed";
|
|
86366
|
-
DraftQueueOperationType["ItemUpdated"] = "updated";
|
|
86367
|
-
DraftQueueOperationType["QueueStarted"] = "started";
|
|
86368
|
-
DraftQueueOperationType["QueueStopped"] = "stopped";
|
|
86369
|
-
})(DraftQueueOperationType || (DraftQueueOperationType = {}));
|
|
86370
|
-
|
|
86371
86300
|
var EvictStatus;
|
|
86372
86301
|
(function (EvictStatus) {
|
|
86373
86302
|
EvictStatus["Started"] = "Started";
|
|
@@ -86384,7 +86313,7 @@
|
|
|
86384
86313
|
* Only one eviction is allowed at a time. running status is return when evictCacheRecordsByIds or
|
|
86385
86314
|
* evictExpiredCacheEntries is called if there's already an eviction in progress.
|
|
86386
86315
|
*/
|
|
86387
|
-
var
|
|
86316
|
+
var activeEvictionInProgress = false;
|
|
86388
86317
|
var cancelCurrentEviction = false;
|
|
86389
86318
|
/**
|
|
86390
86319
|
* Purging records specified by an array of record id from durable store
|
|
@@ -86397,13 +86326,13 @@
|
|
|
86397
86326
|
*/
|
|
86398
86327
|
function evictCacheRecordsByIds(recordIds, onProgressUpdate) {
|
|
86399
86328
|
// Send error back if an eviction is going on.
|
|
86400
|
-
if (
|
|
86329
|
+
if (activeEvictionInProgress) {
|
|
86401
86330
|
return {
|
|
86402
86331
|
status: EvictStatus.Running,
|
|
86403
86332
|
message: EVICTION_IN_PROGESS_MESSAGE,
|
|
86404
86333
|
};
|
|
86405
86334
|
}
|
|
86406
|
-
|
|
86335
|
+
activeEvictionInProgress = true;
|
|
86407
86336
|
cancelCurrentEviction = false;
|
|
86408
86337
|
const evictAChunk = () => {
|
|
86409
86338
|
evictChunksOfRecord(recordIds).then(onEvicted);
|
|
@@ -86424,13 +86353,13 @@
|
|
|
86424
86353
|
*/
|
|
86425
86354
|
function evictExpiredCacheEntries(expiredByDays, onProgressUpdate) {
|
|
86426
86355
|
// Send error back if an eviction is going on.
|
|
86427
|
-
if (
|
|
86356
|
+
if (activeEvictionInProgress) {
|
|
86428
86357
|
return {
|
|
86429
86358
|
status: EvictStatus.Running,
|
|
86430
86359
|
message: EVICTION_IN_PROGESS_MESSAGE,
|
|
86431
86360
|
};
|
|
86432
86361
|
}
|
|
86433
|
-
|
|
86362
|
+
activeEvictionInProgress = true;
|
|
86434
86363
|
cancelCurrentEviction = false;
|
|
86435
86364
|
const overdueExpirationTimeStamp = Date.now() - expiredByDays * 24 * 3600 * 1000;
|
|
86436
86365
|
const evictAChunk = () => {
|
|
@@ -86444,7 +86373,7 @@
|
|
|
86444
86373
|
* Signal to stop current eviction if there's an active eviction going on.
|
|
86445
86374
|
*/
|
|
86446
86375
|
function stopEviction() {
|
|
86447
|
-
if (
|
|
86376
|
+
if (activeEvictionInProgress) {
|
|
86448
86377
|
cancelCurrentEviction = true;
|
|
86449
86378
|
}
|
|
86450
86379
|
}
|
|
@@ -86459,11 +86388,11 @@
|
|
|
86459
86388
|
onProgressUpdate(progress);
|
|
86460
86389
|
const { status } = progress;
|
|
86461
86390
|
if (status === EvictStatus.Succeeded || status === EvictStatus.Error) {
|
|
86462
|
-
|
|
86391
|
+
activeEvictionInProgress = false;
|
|
86463
86392
|
}
|
|
86464
86393
|
if (status === EvictStatus.Evicted) {
|
|
86465
86394
|
if (cancelCurrentEviction) {
|
|
86466
|
-
|
|
86395
|
+
activeEvictionInProgress = false;
|
|
86467
86396
|
onProgressUpdate({ status: EvictStatus.Canceled });
|
|
86468
86397
|
}
|
|
86469
86398
|
else {
|
|
@@ -86539,7 +86468,8 @@
|
|
|
86539
86468
|
WHERE key NOT LIKE 'UiApi::ObjectInfoRepresentation:%'
|
|
86540
86469
|
AND
|
|
86541
86470
|
(
|
|
86542
|
-
key NOT LIKE 'UiApi::RecordRepresentation:%'
|
|
86471
|
+
key NOT LIKE 'UiApi::RecordRepresentation:%' AND
|
|
86472
|
+
JSON_EXTRACT(metadata, '$.expirationTimestamp') < ${overdueExpirationTimestamp}
|
|
86543
86473
|
OR
|
|
86544
86474
|
key LIKE 'UiApi::RecordRepresentation:%' AND
|
|
86545
86475
|
JSON_EXTRACT(data, '$.drafts') IS NULL AND
|
|
@@ -86604,4 +86534,4 @@
|
|
|
86604
86534
|
exports.subscribeToAdapter = subscribeToAdapter;
|
|
86605
86535
|
|
|
86606
86536
|
}));
|
|
86607
|
-
// version: 1.
|
|
86537
|
+
// version: 1.249.0-11c3e1ed5
|