@salesforce/lds-runtime-aura 1.399.0 → 1.401.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/ldsEngineCreator.js
CHANGED
|
@@ -51,7 +51,7 @@ import useHttpUiapiOneRuntime from '@salesforce/gate/lds.useHttpUiapiOneRuntime'
|
|
|
51
51
|
*/
|
|
52
52
|
const { create: create$1, freeze, keys: keys$2, entries: entries$1 } = Object;
|
|
53
53
|
const { isArray: isArray$3 } = Array;
|
|
54
|
-
const { stringify: stringify$
|
|
54
|
+
const { stringify: stringify$3, parse: parse$2 } = JSON;
|
|
55
55
|
const LogLevelMap$1 = {
|
|
56
56
|
TRACE: 4,
|
|
57
57
|
DEBUG: 3,
|
|
@@ -179,7 +179,7 @@ function stableJSONStringify$2(node) {
|
|
|
179
179
|
return isFinite(node) ? "" + node : "null";
|
|
180
180
|
}
|
|
181
181
|
if (typeof node !== "object") {
|
|
182
|
-
return stringify$
|
|
182
|
+
return stringify$3(node);
|
|
183
183
|
}
|
|
184
184
|
let i;
|
|
185
185
|
let out;
|
|
@@ -207,7 +207,7 @@ function stableJSONStringify$2(node) {
|
|
|
207
207
|
if (out) {
|
|
208
208
|
out += ",";
|
|
209
209
|
}
|
|
210
|
-
out += stringify$
|
|
210
|
+
out += stringify$3(key) + ":" + value;
|
|
211
211
|
}
|
|
212
212
|
return "{" + out + "}";
|
|
213
213
|
}
|
|
@@ -341,7 +341,7 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
341
341
|
async afterRequestHooks(_options) {
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
|
-
function buildServiceDescriptor$
|
|
344
|
+
function buildServiceDescriptor$k() {
|
|
345
345
|
return {
|
|
346
346
|
type: "networkCommandBaseClass",
|
|
347
347
|
version: "1.0",
|
|
@@ -443,7 +443,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
|
|
|
443
443
|
return resolvedPromiseLike$3(err$1(toError("Aura/Fetch network services not found")));
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
function buildServiceDescriptor$
|
|
446
|
+
function buildServiceDescriptor$j() {
|
|
447
447
|
return {
|
|
448
448
|
type: "auraNetworkCommandBaseClass",
|
|
449
449
|
version: "1.0",
|
|
@@ -1131,7 +1131,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
|
|
|
1131
1131
|
return `{"endpoint":${this.endpoint},"params":${stableJSONStringify$2(this.auraParams)}}`;
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
function buildServiceDescriptor$
|
|
1134
|
+
function buildServiceDescriptor$i() {
|
|
1135
1135
|
return {
|
|
1136
1136
|
type: "auraResourceCacheControlCommand",
|
|
1137
1137
|
version: "1.0",
|
|
@@ -1255,7 +1255,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
|
1255
1255
|
const data = this.buildResultType().query(cache, this.buildQuery());
|
|
1256
1256
|
if (data.isErr()) {
|
|
1257
1257
|
return resolvedPromiseLike$3(
|
|
1258
|
-
err$1(new Error(`Failed to build data from type: ${stringify$
|
|
1258
|
+
err$1(new Error(`Failed to build data from type: ${stringify$3(data.error)}`))
|
|
1259
1259
|
);
|
|
1260
1260
|
}
|
|
1261
1261
|
return resolvedPromiseLike$3(ok$2(data.value));
|
|
@@ -1270,7 +1270,7 @@ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
|
|
|
1270
1270
|
return resolvedPromiseLike$3(void 0);
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
1273
|
-
function buildServiceDescriptor$
|
|
1273
|
+
function buildServiceDescriptor$h() {
|
|
1274
1274
|
return {
|
|
1275
1275
|
type: "auraNormalizedCacheControlCommand",
|
|
1276
1276
|
version: "1.0",
|
|
@@ -1344,7 +1344,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
|
1344
1344
|
const data = this.buildResultType().query(cache, this.buildQuery());
|
|
1345
1345
|
if (data.isErr()) {
|
|
1346
1346
|
return resolvedPromiseLike$3(
|
|
1347
|
-
err$1(new Error(`Failed to build data from type: ${stringify$
|
|
1347
|
+
err$1(new Error(`Failed to build data from type: ${stringify$3(data.error)}`))
|
|
1348
1348
|
);
|
|
1349
1349
|
}
|
|
1350
1350
|
return resolvedPromiseLike$3(ok$2(data.value));
|
|
@@ -1359,7 +1359,7 @@ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
|
|
|
1359
1359
|
return resolvedPromiseLike$3(void 0);
|
|
1360
1360
|
}
|
|
1361
1361
|
}
|
|
1362
|
-
function buildServiceDescriptor$
|
|
1362
|
+
function buildServiceDescriptor$g() {
|
|
1363
1363
|
return {
|
|
1364
1364
|
type: "httpNormalizedCacheControlCommand",
|
|
1365
1365
|
version: "1.0",
|
|
@@ -1537,7 +1537,7 @@ _FetchNetworkCommand.availableDecorators = {
|
|
|
1537
1537
|
abortable: createAbortableDecorator
|
|
1538
1538
|
};
|
|
1539
1539
|
let FetchNetworkCommand = _FetchNetworkCommand;
|
|
1540
|
-
function buildServiceDescriptor$
|
|
1540
|
+
function buildServiceDescriptor$f() {
|
|
1541
1541
|
return {
|
|
1542
1542
|
type: "fetchNetworkCommandBaseClass",
|
|
1543
1543
|
version: "1.0",
|
|
@@ -1573,7 +1573,7 @@ class StreamingCommand extends BaseCommand {
|
|
|
1573
1573
|
);
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
|
-
function buildServiceDescriptor$
|
|
1576
|
+
function buildServiceDescriptor$e() {
|
|
1577
1577
|
return {
|
|
1578
1578
|
type: "streamingCommandBaseClass",
|
|
1579
1579
|
version: "1.0",
|
|
@@ -1656,7 +1656,7 @@ class SSEParsingStream extends TransformStream {
|
|
|
1656
1656
|
});
|
|
1657
1657
|
}
|
|
1658
1658
|
}
|
|
1659
|
-
function buildServiceDescriptor$
|
|
1659
|
+
function buildServiceDescriptor$d() {
|
|
1660
1660
|
return {
|
|
1661
1661
|
type: "SSECommandBaseClass",
|
|
1662
1662
|
version: "1.0",
|
|
@@ -1707,7 +1707,7 @@ function buildInstrumentCommand(services) {
|
|
|
1707
1707
|
};
|
|
1708
1708
|
};
|
|
1709
1709
|
}
|
|
1710
|
-
function buildServiceDescriptor$
|
|
1710
|
+
function buildServiceDescriptor$c(instrumentation) {
|
|
1711
1711
|
return {
|
|
1712
1712
|
type: "instrumentCommand",
|
|
1713
1713
|
version: "1.0",
|
|
@@ -1977,7 +1977,7 @@ class O11yInstrumentation {
|
|
|
1977
1977
|
this.metrics = new O11yOTelMetricsAPI(this.services);
|
|
1978
1978
|
}
|
|
1979
1979
|
}
|
|
1980
|
-
function buildServiceDescriptor$
|
|
1980
|
+
function buildServiceDescriptor$b(logger) {
|
|
1981
1981
|
return {
|
|
1982
1982
|
type: "instrumentation",
|
|
1983
1983
|
version: "1.0",
|
|
@@ -1995,12 +1995,12 @@ function buildServiceDescriptor$a(logger) {
|
|
|
1995
1995
|
* All rights reserved.
|
|
1996
1996
|
* For full license text, see the LICENSE.txt file
|
|
1997
1997
|
*/
|
|
1998
|
-
const { stringify: stringify$
|
|
1999
|
-
function deepCopy(x) {
|
|
2000
|
-
const stringified = stringify$
|
|
2001
|
-
return stringified ? parse(stringified) : void 0;
|
|
1998
|
+
const { stringify: stringify$2, parse: parse$1 } = JSON;
|
|
1999
|
+
function deepCopy$1(x) {
|
|
2000
|
+
const stringified = stringify$2(x);
|
|
2001
|
+
return stringified ? parse$1(stringified) : void 0;
|
|
2002
2002
|
}
|
|
2003
|
-
class DefaultRecordableCache {
|
|
2003
|
+
let DefaultRecordableCache$1 = class DefaultRecordableCache {
|
|
2004
2004
|
constructor(baseCache) {
|
|
2005
2005
|
this.baseCache = baseCache;
|
|
2006
2006
|
this.keysRead = /* @__PURE__ */ new Set();
|
|
@@ -2019,7 +2019,7 @@ class DefaultRecordableCache {
|
|
|
2019
2019
|
this.missingKeysRead.add(key);
|
|
2020
2020
|
}
|
|
2021
2021
|
if (options == null ? void 0 : options.copy) {
|
|
2022
|
-
return deepCopy(value);
|
|
2022
|
+
return deepCopy$1(value);
|
|
2023
2023
|
}
|
|
2024
2024
|
return value;
|
|
2025
2025
|
}
|
|
@@ -2045,13 +2045,13 @@ class DefaultRecordableCache {
|
|
|
2045
2045
|
return new DefaultRecordableCache(this);
|
|
2046
2046
|
}
|
|
2047
2047
|
filter(predicate) {
|
|
2048
|
-
return new DefaultFilteredCache(this, predicate);
|
|
2048
|
+
return new DefaultFilteredCache$1(this, predicate);
|
|
2049
2049
|
}
|
|
2050
2050
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2051
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
2051
|
+
return new FixedTimeWritableCache$1(this, generatedTime);
|
|
2052
2052
|
}
|
|
2053
|
-
}
|
|
2054
|
-
class DefaultFilteredCache {
|
|
2053
|
+
};
|
|
2054
|
+
let DefaultFilteredCache$1 = class DefaultFilteredCache {
|
|
2055
2055
|
constructor(baseCache, predicate) {
|
|
2056
2056
|
this.baseCache = baseCache;
|
|
2057
2057
|
this.predicate = predicate;
|
|
@@ -2063,7 +2063,7 @@ class DefaultFilteredCache {
|
|
|
2063
2063
|
const result = this.baseCache.get(key);
|
|
2064
2064
|
if (result && this.predicate(key, result)) {
|
|
2065
2065
|
if (options == null ? void 0 : options.copy) {
|
|
2066
|
-
return deepCopy(result);
|
|
2066
|
+
return deepCopy$1(result);
|
|
2067
2067
|
}
|
|
2068
2068
|
return result;
|
|
2069
2069
|
}
|
|
@@ -2085,7 +2085,7 @@ class DefaultFilteredCache {
|
|
|
2085
2085
|
return this.getFilteredEntries();
|
|
2086
2086
|
}
|
|
2087
2087
|
record() {
|
|
2088
|
-
return new DefaultRecordableCache(this);
|
|
2088
|
+
return new DefaultRecordableCache$1(this);
|
|
2089
2089
|
}
|
|
2090
2090
|
filter(predicate) {
|
|
2091
2091
|
return new DefaultFilteredCache(this, predicate);
|
|
@@ -2105,10 +2105,10 @@ class DefaultFilteredCache {
|
|
|
2105
2105
|
return filteredKeySet;
|
|
2106
2106
|
}
|
|
2107
2107
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2108
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
2108
|
+
return new FixedTimeWritableCache$1(this, generatedTime);
|
|
2109
2109
|
}
|
|
2110
|
-
}
|
|
2111
|
-
class FixedTimeWritableCache {
|
|
2110
|
+
};
|
|
2111
|
+
let FixedTimeWritableCache$1 = class FixedTimeWritableCache {
|
|
2112
2112
|
constructor(baseCache, generatedTime) {
|
|
2113
2113
|
this.baseCache = baseCache;
|
|
2114
2114
|
this.generatedTime = generatedTime;
|
|
@@ -2144,22 +2144,22 @@ class FixedTimeWritableCache {
|
|
|
2144
2144
|
return this.baseCache.entries();
|
|
2145
2145
|
}
|
|
2146
2146
|
record() {
|
|
2147
|
-
return new DefaultRecordableCache(this);
|
|
2147
|
+
return new DefaultRecordableCache$1(this);
|
|
2148
2148
|
}
|
|
2149
2149
|
filter(predicate) {
|
|
2150
|
-
return new DefaultFilteredCache(this, predicate);
|
|
2150
|
+
return new DefaultFilteredCache$1(this, predicate);
|
|
2151
2151
|
}
|
|
2152
2152
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2153
2153
|
return new FixedTimeWritableCache(this, generatedTime);
|
|
2154
2154
|
}
|
|
2155
|
-
}
|
|
2156
|
-
class DefaultCache {
|
|
2155
|
+
};
|
|
2156
|
+
let DefaultCache$1 = class DefaultCache {
|
|
2157
2157
|
constructor() {
|
|
2158
2158
|
this.data = {};
|
|
2159
2159
|
}
|
|
2160
2160
|
get(key, options) {
|
|
2161
2161
|
if (options == null ? void 0 : options.copy) {
|
|
2162
|
-
return deepCopy(this.data[key]);
|
|
2162
|
+
return deepCopy$1(this.data[key]);
|
|
2163
2163
|
}
|
|
2164
2164
|
return this.data[key];
|
|
2165
2165
|
}
|
|
@@ -2221,20 +2221,20 @@ class DefaultCache {
|
|
|
2221
2221
|
return Object.entries(this.data);
|
|
2222
2222
|
}
|
|
2223
2223
|
record() {
|
|
2224
|
-
return new DefaultRecordableCache(this);
|
|
2224
|
+
return new DefaultRecordableCache$1(this);
|
|
2225
2225
|
}
|
|
2226
2226
|
filter(predicate) {
|
|
2227
|
-
return new DefaultFilteredCache(this, predicate);
|
|
2227
|
+
return new DefaultFilteredCache$1(this, predicate);
|
|
2228
2228
|
}
|
|
2229
2229
|
buildFixedTimeWritableCache(generatedTime) {
|
|
2230
|
-
return new FixedTimeWritableCache(this, generatedTime);
|
|
2230
|
+
return new FixedTimeWritableCache$1(this, generatedTime);
|
|
2231
2231
|
}
|
|
2232
|
-
}
|
|
2233
|
-
function buildServiceDescriptor$
|
|
2232
|
+
};
|
|
2233
|
+
function buildServiceDescriptor$a() {
|
|
2234
2234
|
return {
|
|
2235
2235
|
type: "cache",
|
|
2236
2236
|
version: "1.0",
|
|
2237
|
-
service: new DefaultCache()
|
|
2237
|
+
service: new DefaultCache$1()
|
|
2238
2238
|
};
|
|
2239
2239
|
}
|
|
2240
2240
|
|
|
@@ -2453,7 +2453,7 @@ class CacheController {
|
|
|
2453
2453
|
yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
|
|
2454
2454
|
}
|
|
2455
2455
|
}
|
|
2456
|
-
function buildServiceDescriptor$
|
|
2456
|
+
function buildServiceDescriptor$9(cache, cacheInclusionPolicy, instrumentation) {
|
|
2457
2457
|
return {
|
|
2458
2458
|
type: "cacheController",
|
|
2459
2459
|
version: "1.0",
|
|
@@ -2563,7 +2563,7 @@ class DefaultPubSubService {
|
|
|
2563
2563
|
return matchingSubscriptions;
|
|
2564
2564
|
}
|
|
2565
2565
|
}
|
|
2566
|
-
function buildServiceDescriptor$
|
|
2566
|
+
function buildServiceDescriptor$8() {
|
|
2567
2567
|
return {
|
|
2568
2568
|
type: "pubSub",
|
|
2569
2569
|
version: "1.0",
|
|
@@ -2626,7 +2626,7 @@ class NDJSONParsingStream extends TransformStream {
|
|
|
2626
2626
|
});
|
|
2627
2627
|
}
|
|
2628
2628
|
}
|
|
2629
|
-
function buildServiceDescriptor$
|
|
2629
|
+
function buildServiceDescriptor$7() {
|
|
2630
2630
|
return {
|
|
2631
2631
|
type: "NDJSONCommandBaseClass",
|
|
2632
2632
|
version: "1.0",
|
|
@@ -2667,7 +2667,7 @@ function buildServiceDescriptor$6() {
|
|
|
2667
2667
|
* };
|
|
2668
2668
|
* ```
|
|
2669
2669
|
*/
|
|
2670
|
-
function buildServiceDescriptor$
|
|
2670
|
+
function buildServiceDescriptor$6(luvio) {
|
|
2671
2671
|
return {
|
|
2672
2672
|
type: 'luvio',
|
|
2673
2673
|
version: '1.0',
|
|
@@ -2676,7 +2676,7 @@ function buildServiceDescriptor$5(luvio) {
|
|
|
2676
2676
|
},
|
|
2677
2677
|
};
|
|
2678
2678
|
}
|
|
2679
|
-
// version: 1.
|
|
2679
|
+
// version: 1.401.0-c620f9ffed
|
|
2680
2680
|
|
|
2681
2681
|
/*!
|
|
2682
2682
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -2840,7 +2840,7 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2840
2840
|
});
|
|
2841
2841
|
}
|
|
2842
2842
|
}
|
|
2843
|
-
function buildServiceDescriptor$
|
|
2843
|
+
function buildServiceDescriptor$5() {
|
|
2844
2844
|
return {
|
|
2845
2845
|
type: "auraGraphQLNormalizedCacheControlCommand",
|
|
2846
2846
|
version: "1.0",
|
|
@@ -2958,7 +2958,7 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
2958
2958
|
});
|
|
2959
2959
|
}
|
|
2960
2960
|
}
|
|
2961
|
-
function buildServiceDescriptor$
|
|
2961
|
+
function buildServiceDescriptor$4() {
|
|
2962
2962
|
return {
|
|
2963
2963
|
type: "httpGraphQLNormalizedCacheControlCommand",
|
|
2964
2964
|
version: "1.0",
|
|
@@ -2982,7 +2982,7 @@ class FeatureFlagsService {
|
|
|
2982
2982
|
return this.flags.get(flagName) || defaultValue;
|
|
2983
2983
|
}
|
|
2984
2984
|
}
|
|
2985
|
-
function buildServiceDescriptor$
|
|
2985
|
+
function buildServiceDescriptor$3() {
|
|
2986
2986
|
return {
|
|
2987
2987
|
version: "1.0",
|
|
2988
2988
|
service: new FeatureFlagsService(),
|
|
@@ -3004,7 +3004,7 @@ function buildServiceDescriptor$2() {
|
|
|
3004
3004
|
* *******************************************************************************************
|
|
3005
3005
|
*/
|
|
3006
3006
|
/* proxy-compat-disable */
|
|
3007
|
-
function buildServiceDescriptor$
|
|
3007
|
+
function buildServiceDescriptor$2(notifyRecordUpdateAvailable, getNormalizedLuvioRecord) {
|
|
3008
3008
|
return {
|
|
3009
3009
|
type: 'luvioUiapiRecords',
|
|
3010
3010
|
version: '1.0',
|
|
@@ -3014,7 +3014,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3014
3014
|
},
|
|
3015
3015
|
};
|
|
3016
3016
|
}
|
|
3017
|
-
// version: 1.
|
|
3017
|
+
// version: 1.401.0-c620f9ffed
|
|
3018
3018
|
|
|
3019
3019
|
/*!
|
|
3020
3020
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3058,7 +3058,7 @@ class RetryService {
|
|
|
3058
3058
|
}
|
|
3059
3059
|
class RetryPolicy {
|
|
3060
3060
|
}
|
|
3061
|
-
function buildServiceDescriptor(defaultRetryPolicy) {
|
|
3061
|
+
function buildServiceDescriptor$1(defaultRetryPolicy) {
|
|
3062
3062
|
return {
|
|
3063
3063
|
version: "1.0",
|
|
3064
3064
|
service: new RetryService(defaultRetryPolicy),
|
|
@@ -4001,7 +4001,7 @@ function getEnvironmentSetting(name) {
|
|
|
4001
4001
|
}
|
|
4002
4002
|
return undefined;
|
|
4003
4003
|
}
|
|
4004
|
-
// version: 1.
|
|
4004
|
+
// version: 1.401.0-c620f9ffed
|
|
4005
4005
|
|
|
4006
4006
|
/**
|
|
4007
4007
|
* Observability / Critical Availability Program (230+)
|
|
@@ -4051,7 +4051,7 @@ const TOTAL_ADAPTER_REQUEST_SUCCESS_COUNT = {
|
|
|
4051
4051
|
|
|
4052
4052
|
const { create, keys, hasOwnProperty, entries } = Object;
|
|
4053
4053
|
const { isArray, from } = Array;
|
|
4054
|
-
const { stringify } = JSON;
|
|
4054
|
+
const { stringify: stringify$1 } = JSON;
|
|
4055
4055
|
|
|
4056
4056
|
/**
|
|
4057
4057
|
* A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
|
|
@@ -4077,7 +4077,7 @@ function stableJSONStringify$1(node) {
|
|
|
4077
4077
|
return isFinite(node) ? '' + node : 'null';
|
|
4078
4078
|
}
|
|
4079
4079
|
if (typeof node !== 'object') {
|
|
4080
|
-
return stringify(node);
|
|
4080
|
+
return stringify$1(node);
|
|
4081
4081
|
}
|
|
4082
4082
|
let i;
|
|
4083
4083
|
let out;
|
|
@@ -4108,7 +4108,7 @@ function stableJSONStringify$1(node) {
|
|
|
4108
4108
|
if (out) {
|
|
4109
4109
|
out += ',';
|
|
4110
4110
|
}
|
|
4111
|
-
out += stringify(key) + ':' + value;
|
|
4111
|
+
out += stringify$1(key) + ':' + value;
|
|
4112
4112
|
}
|
|
4113
4113
|
return '{' + out + '}';
|
|
4114
4114
|
}
|
|
@@ -6001,7 +6001,7 @@ function stableJSONStringify(node) {
|
|
|
6001
6001
|
return isFinite(node) ? '' + node : 'null';
|
|
6002
6002
|
}
|
|
6003
6003
|
if (typeof node !== 'object') {
|
|
6004
|
-
return stringify(node);
|
|
6004
|
+
return stringify$1(node);
|
|
6005
6005
|
}
|
|
6006
6006
|
let i;
|
|
6007
6007
|
let out;
|
|
@@ -6029,7 +6029,7 @@ function stableJSONStringify(node) {
|
|
|
6029
6029
|
if (out) {
|
|
6030
6030
|
out += ',';
|
|
6031
6031
|
}
|
|
6032
|
-
out += stringify(key) + ':' + value;
|
|
6032
|
+
out += stringify$1(key) + ':' + value;
|
|
6033
6033
|
}
|
|
6034
6034
|
return '{' + out + '}';
|
|
6035
6035
|
}
|
|
@@ -7303,6 +7303,15 @@ class Ok {
|
|
|
7303
7303
|
}
|
|
7304
7304
|
}
|
|
7305
7305
|
const ok = (value) => new Ok(value);
|
|
7306
|
+
function setDifference(setA, setB) {
|
|
7307
|
+
const differenceSet = /* @__PURE__ */ new Set();
|
|
7308
|
+
for (const element of setA) {
|
|
7309
|
+
if (!setB.has(element)) {
|
|
7310
|
+
differenceSet.add(element);
|
|
7311
|
+
}
|
|
7312
|
+
}
|
|
7313
|
+
return differenceSet;
|
|
7314
|
+
}
|
|
7306
7315
|
function resolvedPromiseLike(result) {
|
|
7307
7316
|
if (isPromiseLike(result)) {
|
|
7308
7317
|
return result.then((nextResult) => nextResult);
|
|
@@ -7340,6 +7349,303 @@ function rejectedPromiseLike(reason) {
|
|
|
7340
7349
|
function isPromiseLike(x) {
|
|
7341
7350
|
return typeof (x == null ? void 0 : x.then) === "function";
|
|
7342
7351
|
}
|
|
7352
|
+
/*!
|
|
7353
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
7354
|
+
* All rights reserved.
|
|
7355
|
+
* For full license text, see the LICENSE.txt file
|
|
7356
|
+
*/
|
|
7357
|
+
/*!
|
|
7358
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
7359
|
+
* All rights reserved.
|
|
7360
|
+
* For full license text, see the LICENSE.txt file
|
|
7361
|
+
*/
|
|
7362
|
+
const { stringify, parse } = JSON;
|
|
7363
|
+
function deepCopy(x) {
|
|
7364
|
+
const stringified = stringify(x);
|
|
7365
|
+
return stringified ? parse(stringified) : void 0;
|
|
7366
|
+
}
|
|
7367
|
+
class DefaultRecordableCache {
|
|
7368
|
+
constructor(baseCache) {
|
|
7369
|
+
this.baseCache = baseCache;
|
|
7370
|
+
this.keysRead = /* @__PURE__ */ new Set();
|
|
7371
|
+
this.missingKeysRead = /* @__PURE__ */ new Set();
|
|
7372
|
+
this.keysUpdated = /* @__PURE__ */ new Set();
|
|
7373
|
+
this.metadataKeysUpdated = /* @__PURE__ */ new Set();
|
|
7374
|
+
}
|
|
7375
|
+
delete(key) {
|
|
7376
|
+
this.keysUpdated.add(key);
|
|
7377
|
+
this.baseCache.delete(key);
|
|
7378
|
+
}
|
|
7379
|
+
get(key, options) {
|
|
7380
|
+
this.keysRead.add(key);
|
|
7381
|
+
const value = this.baseCache.get(key);
|
|
7382
|
+
if (value === void 0) {
|
|
7383
|
+
this.missingKeysRead.add(key);
|
|
7384
|
+
}
|
|
7385
|
+
if (options == null ? void 0 : options.copy) {
|
|
7386
|
+
return deepCopy(value);
|
|
7387
|
+
}
|
|
7388
|
+
return value;
|
|
7389
|
+
}
|
|
7390
|
+
set(key, value) {
|
|
7391
|
+
this.keysUpdated.add(key);
|
|
7392
|
+
this.metadataKeysUpdated.add(key);
|
|
7393
|
+
this.baseCache.set(key, value);
|
|
7394
|
+
}
|
|
7395
|
+
setMetadata(key, cacheControlMetadata) {
|
|
7396
|
+
this.metadataKeysUpdated.add(key);
|
|
7397
|
+
this.baseCache.setMetadata(key, cacheControlMetadata);
|
|
7398
|
+
}
|
|
7399
|
+
length() {
|
|
7400
|
+
return this.baseCache.length();
|
|
7401
|
+
}
|
|
7402
|
+
keys() {
|
|
7403
|
+
return this.baseCache.keys();
|
|
7404
|
+
}
|
|
7405
|
+
entries() {
|
|
7406
|
+
return this.baseCache.entries();
|
|
7407
|
+
}
|
|
7408
|
+
record() {
|
|
7409
|
+
return new DefaultRecordableCache(this);
|
|
7410
|
+
}
|
|
7411
|
+
filter(predicate) {
|
|
7412
|
+
return new DefaultFilteredCache(this, predicate);
|
|
7413
|
+
}
|
|
7414
|
+
buildFixedTimeWritableCache(generatedTime) {
|
|
7415
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
7416
|
+
}
|
|
7417
|
+
}
|
|
7418
|
+
class DefaultFilteredCache {
|
|
7419
|
+
constructor(baseCache, predicate) {
|
|
7420
|
+
this.baseCache = baseCache;
|
|
7421
|
+
this.predicate = predicate;
|
|
7422
|
+
}
|
|
7423
|
+
delete(key) {
|
|
7424
|
+
this.baseCache.delete(key);
|
|
7425
|
+
}
|
|
7426
|
+
get(key, options) {
|
|
7427
|
+
const result = this.baseCache.get(key);
|
|
7428
|
+
if (result && this.predicate(key, result)) {
|
|
7429
|
+
if (options == null ? void 0 : options.copy) {
|
|
7430
|
+
return deepCopy(result);
|
|
7431
|
+
}
|
|
7432
|
+
return result;
|
|
7433
|
+
}
|
|
7434
|
+
return void 0;
|
|
7435
|
+
}
|
|
7436
|
+
set(key, value) {
|
|
7437
|
+
this.baseCache.set(key, value);
|
|
7438
|
+
}
|
|
7439
|
+
setMetadata(key, cacheControlMetadata) {
|
|
7440
|
+
this.baseCache.setMetadata(key, cacheControlMetadata);
|
|
7441
|
+
}
|
|
7442
|
+
length() {
|
|
7443
|
+
return this.getFilteredKeys().size;
|
|
7444
|
+
}
|
|
7445
|
+
keys() {
|
|
7446
|
+
return this.getFilteredKeys();
|
|
7447
|
+
}
|
|
7448
|
+
entries() {
|
|
7449
|
+
return this.getFilteredEntries();
|
|
7450
|
+
}
|
|
7451
|
+
record() {
|
|
7452
|
+
return new DefaultRecordableCache(this);
|
|
7453
|
+
}
|
|
7454
|
+
filter(predicate) {
|
|
7455
|
+
return new DefaultFilteredCache(this, predicate);
|
|
7456
|
+
}
|
|
7457
|
+
getFilteredEntries() {
|
|
7458
|
+
return this.baseCache.entries().filter(([key, _value]) => {
|
|
7459
|
+
return this.get(key);
|
|
7460
|
+
});
|
|
7461
|
+
}
|
|
7462
|
+
getFilteredKeys() {
|
|
7463
|
+
const filteredKeySet = /* @__PURE__ */ new Set();
|
|
7464
|
+
this.baseCache.keys().forEach((key) => {
|
|
7465
|
+
if (this.get(key)) {
|
|
7466
|
+
filteredKeySet.add(key);
|
|
7467
|
+
}
|
|
7468
|
+
});
|
|
7469
|
+
return filteredKeySet;
|
|
7470
|
+
}
|
|
7471
|
+
buildFixedTimeWritableCache(generatedTime) {
|
|
7472
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
7473
|
+
}
|
|
7474
|
+
}
|
|
7475
|
+
class FixedTimeWritableCache {
|
|
7476
|
+
constructor(baseCache, generatedTime) {
|
|
7477
|
+
this.baseCache = baseCache;
|
|
7478
|
+
this.generatedTime = generatedTime;
|
|
7479
|
+
}
|
|
7480
|
+
delete(key) {
|
|
7481
|
+
this.baseCache.delete(key);
|
|
7482
|
+
}
|
|
7483
|
+
get(key, options) {
|
|
7484
|
+
return this.baseCache.get(key, options);
|
|
7485
|
+
}
|
|
7486
|
+
set(key, value) {
|
|
7487
|
+
this.baseCache.set(key, {
|
|
7488
|
+
...value,
|
|
7489
|
+
metadata: {
|
|
7490
|
+
...value.metadata,
|
|
7491
|
+
cacheControl: { ...value.metadata.cacheControl, generatedTime: this.generatedTime }
|
|
7492
|
+
}
|
|
7493
|
+
});
|
|
7494
|
+
}
|
|
7495
|
+
setMetadata(key, cacheControlMetadata) {
|
|
7496
|
+
this.baseCache.setMetadata(key, {
|
|
7497
|
+
...cacheControlMetadata,
|
|
7498
|
+
generatedTime: this.generatedTime
|
|
7499
|
+
});
|
|
7500
|
+
}
|
|
7501
|
+
length() {
|
|
7502
|
+
return this.baseCache.length();
|
|
7503
|
+
}
|
|
7504
|
+
keys() {
|
|
7505
|
+
return this.baseCache.keys();
|
|
7506
|
+
}
|
|
7507
|
+
entries() {
|
|
7508
|
+
return this.baseCache.entries();
|
|
7509
|
+
}
|
|
7510
|
+
record() {
|
|
7511
|
+
return new DefaultRecordableCache(this);
|
|
7512
|
+
}
|
|
7513
|
+
filter(predicate) {
|
|
7514
|
+
return new DefaultFilteredCache(this, predicate);
|
|
7515
|
+
}
|
|
7516
|
+
buildFixedTimeWritableCache(generatedTime) {
|
|
7517
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
7518
|
+
}
|
|
7519
|
+
}
|
|
7520
|
+
class DefaultCache {
|
|
7521
|
+
constructor() {
|
|
7522
|
+
this.data = {};
|
|
7523
|
+
}
|
|
7524
|
+
get(key, options) {
|
|
7525
|
+
if (options == null ? void 0 : options.copy) {
|
|
7526
|
+
return deepCopy(this.data[key]);
|
|
7527
|
+
}
|
|
7528
|
+
return this.data[key];
|
|
7529
|
+
}
|
|
7530
|
+
/**
|
|
7531
|
+
* Adds the specified key/value to the cache.
|
|
7532
|
+
*
|
|
7533
|
+
* @param key key at which to store value
|
|
7534
|
+
* @param entry value to be stored
|
|
7535
|
+
*/
|
|
7536
|
+
set(key, entry) {
|
|
7537
|
+
if (entry.metadata.cacheControl.type === "no-store") {
|
|
7538
|
+
return;
|
|
7539
|
+
}
|
|
7540
|
+
this.data[key] = {
|
|
7541
|
+
...entry,
|
|
7542
|
+
metadata: {
|
|
7543
|
+
...entry.metadata,
|
|
7544
|
+
type: entry.metadata.type || {
|
|
7545
|
+
namespace: "OneStore:Internal",
|
|
7546
|
+
name: "UnknownType"
|
|
7547
|
+
},
|
|
7548
|
+
cacheControl: {
|
|
7549
|
+
generatedTime: Date.now() / 1e3,
|
|
7550
|
+
...entry.metadata.cacheControl
|
|
7551
|
+
}
|
|
7552
|
+
}
|
|
7553
|
+
};
|
|
7554
|
+
}
|
|
7555
|
+
/**
|
|
7556
|
+
* Removes the cache entry associated with the specified key.
|
|
7557
|
+
*
|
|
7558
|
+
* @param key key to be removed from the store
|
|
7559
|
+
*/
|
|
7560
|
+
delete(key) {
|
|
7561
|
+
delete this.data[key];
|
|
7562
|
+
}
|
|
7563
|
+
/**
|
|
7564
|
+
* Sets the metadata for the specified key if the key is in cache.
|
|
7565
|
+
* If the key doesn't exist, it does nothing.
|
|
7566
|
+
*
|
|
7567
|
+
* @param key key at which to store metadata
|
|
7568
|
+
* @param cacheControlMetadata metadata to be stored
|
|
7569
|
+
*/
|
|
7570
|
+
setMetadata(key, cacheControlMetadata) {
|
|
7571
|
+
if (key in this.data) {
|
|
7572
|
+
this.data[key].metadata.cacheControl = {
|
|
7573
|
+
generatedTime: Date.now() / 1e3,
|
|
7574
|
+
...cacheControlMetadata
|
|
7575
|
+
};
|
|
7576
|
+
}
|
|
7577
|
+
}
|
|
7578
|
+
length() {
|
|
7579
|
+
return this.keys().size;
|
|
7580
|
+
}
|
|
7581
|
+
keys() {
|
|
7582
|
+
return new Set(Object.keys(this.data));
|
|
7583
|
+
}
|
|
7584
|
+
entries() {
|
|
7585
|
+
return Object.entries(this.data);
|
|
7586
|
+
}
|
|
7587
|
+
record() {
|
|
7588
|
+
return new DefaultRecordableCache(this);
|
|
7589
|
+
}
|
|
7590
|
+
filter(predicate) {
|
|
7591
|
+
return new DefaultFilteredCache(this, predicate);
|
|
7592
|
+
}
|
|
7593
|
+
buildFixedTimeWritableCache(generatedTime) {
|
|
7594
|
+
return new FixedTimeWritableCache(this, generatedTime);
|
|
7595
|
+
}
|
|
7596
|
+
}
|
|
7597
|
+
function buildServiceDescriptor() {
|
|
7598
|
+
return {
|
|
7599
|
+
type: "cache",
|
|
7600
|
+
version: "1.0",
|
|
7601
|
+
service: new DefaultCache()
|
|
7602
|
+
};
|
|
7603
|
+
}
|
|
7604
|
+
class DurableCacheInclusionPolicy extends CacheInclusionPolicyService {
|
|
7605
|
+
/**
|
|
7606
|
+
* Reads data out of a 2 level inclusive store.
|
|
7607
|
+
*/
|
|
7608
|
+
read(options) {
|
|
7609
|
+
const { l1, readFromL1, alreadyRevivedKeys } = options;
|
|
7610
|
+
const recordableCache = l1.record();
|
|
7611
|
+
return readFromL1(recordableCache).then((readResult) => {
|
|
7612
|
+
if (readResult.isOk()) {
|
|
7613
|
+
return readResult;
|
|
7614
|
+
}
|
|
7615
|
+
const keysToRevive = recordableCache.keysRead;
|
|
7616
|
+
if (alreadyRevivedKeys && setDifference(keysToRevive, alreadyRevivedKeys).size === 0) {
|
|
7617
|
+
return readResult;
|
|
7618
|
+
}
|
|
7619
|
+
return this.revive(keysToRevive, l1).then((revivedKeys) => {
|
|
7620
|
+
if (setDifference(keysToRevive, revivedKeys).size > 0) {
|
|
7621
|
+
return readResult;
|
|
7622
|
+
}
|
|
7623
|
+
return this.read({ l1, readFromL1, alreadyRevivedKeys: revivedKeys });
|
|
7624
|
+
});
|
|
7625
|
+
});
|
|
7626
|
+
}
|
|
7627
|
+
/**
|
|
7628
|
+
* Writes data to a 2 level inclusive store.
|
|
7629
|
+
*/
|
|
7630
|
+
write(options) {
|
|
7631
|
+
const { l1, writeToL1 } = options;
|
|
7632
|
+
const tempL1 = buildServiceDescriptor().service.record();
|
|
7633
|
+
return writeToL1(tempL1).then(() => {
|
|
7634
|
+
const keysToReviveRecordableCache = l1.record();
|
|
7635
|
+
tempL1.keysUpdated.forEach((key) => keysToReviveRecordableCache.get(key));
|
|
7636
|
+
tempL1.missingKeysRead.forEach((key) => keysToReviveRecordableCache.get(key));
|
|
7637
|
+
const missingKeys = keysToReviveRecordableCache.missingKeysRead;
|
|
7638
|
+
const revivePromiseLike = missingKeys.size > 0 ? this.revive(missingKeys, l1).then(() => void 0) : resolvedPromiseLike(void 0);
|
|
7639
|
+
return revivePromiseLike.then(() => {
|
|
7640
|
+
const recordableCache = l1.record();
|
|
7641
|
+
return writeToL1(recordableCache).then((result) => {
|
|
7642
|
+
this.syncToL2Cache(recordableCache.keysUpdated, l1);
|
|
7643
|
+
return result;
|
|
7644
|
+
});
|
|
7645
|
+
});
|
|
7646
|
+
});
|
|
7647
|
+
}
|
|
7648
|
+
}
|
|
7343
7649
|
const isAndQuery = (query) => "$and" in query;
|
|
7344
7650
|
const isOrQuery = (query) => "$or" in query;
|
|
7345
7651
|
const isNotQuery = (query) => "$not" in query;
|
|
@@ -7533,6 +7839,314 @@ class FetchThrottlingRetryPolicy extends RetryPolicy {
|
|
|
7533
7839
|
}
|
|
7534
7840
|
}
|
|
7535
7841
|
|
|
7842
|
+
/**
|
|
7843
|
+
* Default storage configuration for the durable cache
|
|
7844
|
+
*/
|
|
7845
|
+
const DEFAULT_STORAGE_CONFIG = {
|
|
7846
|
+
name: 'ldsDurableCache',
|
|
7847
|
+
persistent: true,
|
|
7848
|
+
secure: true,
|
|
7849
|
+
maxSize: 10 * 1024 * 1024,
|
|
7850
|
+
expiration: 30 * 24 * 60 * 60,
|
|
7851
|
+
clearOnInit: false,
|
|
7852
|
+
debugLogging: false,
|
|
7853
|
+
};
|
|
7854
|
+
/**
|
|
7855
|
+
* Durable cache inclusion policy that uses AuraStorage for persistent L2 cache
|
|
7856
|
+
*/
|
|
7857
|
+
class AuraDurableCacheInclusionPolicy extends DurableCacheInclusionPolicy {
|
|
7858
|
+
constructor(config = {}) {
|
|
7859
|
+
super();
|
|
7860
|
+
// Create storage with merged configuration
|
|
7861
|
+
const storageConfig = {
|
|
7862
|
+
...DEFAULT_STORAGE_CONFIG,
|
|
7863
|
+
...config,
|
|
7864
|
+
};
|
|
7865
|
+
this.storage = createStorage(storageConfig);
|
|
7866
|
+
if (!this.storage) {
|
|
7867
|
+
console.warn('Failed to create durable storage for cache inclusion policy');
|
|
7868
|
+
}
|
|
7869
|
+
}
|
|
7870
|
+
/**
|
|
7871
|
+
* Revive cache entries from AuraStorage into L1 cache
|
|
7872
|
+
* @param keys - Set of keys to revive
|
|
7873
|
+
* @param l1 - L1 cache instance
|
|
7874
|
+
* @returns Set of keys that were successfully revived
|
|
7875
|
+
*/
|
|
7876
|
+
async revive(keys, l1) {
|
|
7877
|
+
if (keys.size === 0 || !this.storage) {
|
|
7878
|
+
return new Set();
|
|
7879
|
+
}
|
|
7880
|
+
const revivedKeys = new Set();
|
|
7881
|
+
try {
|
|
7882
|
+
// Convert keys to array of strings for getAll()
|
|
7883
|
+
const keysArray = Array.from(keys).map((key) => key);
|
|
7884
|
+
// Get only the requested entries using getAll() with specific keys
|
|
7885
|
+
const storedData = (await this.storage.getAll(keysArray));
|
|
7886
|
+
// Process the retrieved cache entries
|
|
7887
|
+
for (const [storageKey, storedEntry] of Object.entries(storedData)) {
|
|
7888
|
+
const key = storageKey;
|
|
7889
|
+
const entry = storedEntry;
|
|
7890
|
+
if (entry) {
|
|
7891
|
+
l1.set(key, entry);
|
|
7892
|
+
revivedKeys.add(key);
|
|
7893
|
+
}
|
|
7894
|
+
}
|
|
7895
|
+
}
|
|
7896
|
+
catch (error) {
|
|
7897
|
+
// Log error but don't fail the operation
|
|
7898
|
+
console.warn('Failed to revive cache entries from AuraStorage:', error);
|
|
7899
|
+
}
|
|
7900
|
+
return revivedKeys;
|
|
7901
|
+
}
|
|
7902
|
+
/**
|
|
7903
|
+
* Sync changed keys from L1 cache to AuraStorage (L2 cache)
|
|
7904
|
+
* @param changedKeys - Set of keys that have changed
|
|
7905
|
+
* @param l1 - L1 cache instance
|
|
7906
|
+
*/
|
|
7907
|
+
async syncToL2Cache(changedKeys, l1) {
|
|
7908
|
+
if (changedKeys.size === 0 || !this.storage) {
|
|
7909
|
+
return;
|
|
7910
|
+
}
|
|
7911
|
+
const promises = [];
|
|
7912
|
+
for (const key of changedKeys) {
|
|
7913
|
+
const storageKey = key;
|
|
7914
|
+
const entry = l1.get(key);
|
|
7915
|
+
if (entry) {
|
|
7916
|
+
// Add or update the entry
|
|
7917
|
+
promises.push(this.storage.set(storageKey, entry).catch((error) => {
|
|
7918
|
+
console.warn(`Failed to persist cache entry: ${storageKey}`, error);
|
|
7919
|
+
}));
|
|
7920
|
+
}
|
|
7921
|
+
else {
|
|
7922
|
+
// Remove the entry if it doesn't exist in L1
|
|
7923
|
+
promises.push(this.storage
|
|
7924
|
+
.remove(storageKey)
|
|
7925
|
+
.catch((error) => {
|
|
7926
|
+
console.warn(`Failed to remove cache entry: ${storageKey}`, error);
|
|
7927
|
+
})
|
|
7928
|
+
.then(() => { }));
|
|
7929
|
+
}
|
|
7930
|
+
}
|
|
7931
|
+
await Promise.all(promises);
|
|
7932
|
+
}
|
|
7933
|
+
/**
|
|
7934
|
+
* Find entries matching a query
|
|
7935
|
+
* @param query - Cache query to match entries
|
|
7936
|
+
*/
|
|
7937
|
+
async *find(query) {
|
|
7938
|
+
if (!this.storage) {
|
|
7939
|
+
return;
|
|
7940
|
+
}
|
|
7941
|
+
try {
|
|
7942
|
+
// Need to get all entries to search through them with the query
|
|
7943
|
+
// Cannot pass specific keys since we don't know which entries match the query
|
|
7944
|
+
const allStoredData = (await this.storage.getAll());
|
|
7945
|
+
// Iterate through all cache entries and yield those matching the query
|
|
7946
|
+
for (const [storageKey, storedEntry] of Object.entries(allStoredData)) {
|
|
7947
|
+
const entry = storedEntry;
|
|
7948
|
+
const key = storageKey;
|
|
7949
|
+
if (entry && this.matchesQuery(key, entry, query)) {
|
|
7950
|
+
yield [key, entry];
|
|
7951
|
+
}
|
|
7952
|
+
}
|
|
7953
|
+
}
|
|
7954
|
+
catch (error) {
|
|
7955
|
+
console.warn('Failed to find cache entries in AuraStorage:', error);
|
|
7956
|
+
}
|
|
7957
|
+
}
|
|
7958
|
+
/**
|
|
7959
|
+
* Find and modify entries matching a query
|
|
7960
|
+
* @param query - Cache query to match entries
|
|
7961
|
+
* @param cacheUpdate - Update to apply to matching entries
|
|
7962
|
+
*/
|
|
7963
|
+
async *findAndModify(query, cacheUpdate) {
|
|
7964
|
+
if (!this.storage) {
|
|
7965
|
+
return;
|
|
7966
|
+
}
|
|
7967
|
+
try {
|
|
7968
|
+
// Need to get all entries to search through them with the query
|
|
7969
|
+
// Cannot pass specific keys since we don't know which entries match the query
|
|
7970
|
+
const allStoredData = (await this.storage.getAll());
|
|
7971
|
+
const modifiedEntries = [];
|
|
7972
|
+
// Find and modify matching entries
|
|
7973
|
+
for (const [storageKey, storedEntry] of Object.entries(allStoredData)) {
|
|
7974
|
+
const entry = storedEntry;
|
|
7975
|
+
const key = storageKey;
|
|
7976
|
+
if (entry && this.matchesQuery(key, entry, query)) {
|
|
7977
|
+
// Apply the update to the entry
|
|
7978
|
+
const updatedEntry = this.applyUpdate(entry, cacheUpdate);
|
|
7979
|
+
if (updatedEntry) {
|
|
7980
|
+
modifiedEntries.push({ storageKey, entry: updatedEntry, modifiedKey: key });
|
|
7981
|
+
}
|
|
7982
|
+
}
|
|
7983
|
+
}
|
|
7984
|
+
// Save all modified entries back to storage
|
|
7985
|
+
if (modifiedEntries.length > 0 && this.storage) {
|
|
7986
|
+
const promises = modifiedEntries.map(({ storageKey, entry }) => this.storage.set(storageKey, entry).catch((error) => {
|
|
7987
|
+
console.warn(`Failed to update cache entry: ${storageKey}`, error);
|
|
7988
|
+
}));
|
|
7989
|
+
await Promise.all(promises);
|
|
7990
|
+
// Yield all modified keys
|
|
7991
|
+
for (const { modifiedKey } of modifiedEntries) {
|
|
7992
|
+
yield modifiedKey;
|
|
7993
|
+
}
|
|
7994
|
+
}
|
|
7995
|
+
}
|
|
7996
|
+
catch (error) {
|
|
7997
|
+
console.warn('Failed to find and modify cache entries in AuraStorage:', error);
|
|
7998
|
+
}
|
|
7999
|
+
}
|
|
8000
|
+
/**
|
|
8001
|
+
* Check if an entry matches a cache query
|
|
8002
|
+
* @param key - Cache key to check
|
|
8003
|
+
* @param entry - Cache entry to check
|
|
8004
|
+
* @param query - Query to match against
|
|
8005
|
+
* @returns true if the entry matches the query
|
|
8006
|
+
*/
|
|
8007
|
+
matchesQuery(key, entry, query) {
|
|
8008
|
+
if (!query)
|
|
8009
|
+
return true;
|
|
8010
|
+
// Handle logical operators
|
|
8011
|
+
if (this.isAndQuery(query)) {
|
|
8012
|
+
return query.$and.every((subQuery) => this.matchesQuery(key, entry, subQuery));
|
|
8013
|
+
}
|
|
8014
|
+
if (this.isOrQuery(query)) {
|
|
8015
|
+
return query.$or.some((subQuery) => this.matchesQuery(key, entry, subQuery));
|
|
8016
|
+
}
|
|
8017
|
+
if (this.isNotQuery(query)) {
|
|
8018
|
+
return !this.matchesQuery(key, entry, query.$not);
|
|
8019
|
+
}
|
|
8020
|
+
// Handle specific query types
|
|
8021
|
+
if ('key' in query) {
|
|
8022
|
+
return this.matchesKey(query.key, key);
|
|
8023
|
+
}
|
|
8024
|
+
if ('metadata' in query) {
|
|
8025
|
+
return this.matchesMetadata(query.metadata, entry.metadata.cacheControl);
|
|
8026
|
+
}
|
|
8027
|
+
if ('value' in query) {
|
|
8028
|
+
return false; // Value-based querying not implemented
|
|
8029
|
+
}
|
|
8030
|
+
return false; // Unknown query type
|
|
8031
|
+
}
|
|
8032
|
+
isAndQuery(query) {
|
|
8033
|
+
return '$and' in query;
|
|
8034
|
+
}
|
|
8035
|
+
isOrQuery(query) {
|
|
8036
|
+
return '$or' in query;
|
|
8037
|
+
}
|
|
8038
|
+
isNotQuery(query) {
|
|
8039
|
+
return '$not' in query;
|
|
8040
|
+
}
|
|
8041
|
+
matchesKey(keyQuery, key) {
|
|
8042
|
+
if ('$regex' in keyQuery) {
|
|
8043
|
+
const keyString = typeof key === 'string' ? key : JSON.stringify(key);
|
|
8044
|
+
return keyQuery.$regex.test(keyString);
|
|
8045
|
+
}
|
|
8046
|
+
return false;
|
|
8047
|
+
}
|
|
8048
|
+
matchesMetadata(metadataQuery, cacheControl) {
|
|
8049
|
+
if ('cacheControlType' in metadataQuery &&
|
|
8050
|
+
cacheControl.type !== metadataQuery.cacheControlType.$eq) {
|
|
8051
|
+
return false;
|
|
8052
|
+
}
|
|
8053
|
+
if ('maxAge' in metadataQuery && cacheControl.type === 'max-age') {
|
|
8054
|
+
const maxAge = cacheControl.maxAge ?? 0;
|
|
8055
|
+
if ((metadataQuery.maxAge.$gte !== undefined && maxAge < metadataQuery.maxAge.$gte) ||
|
|
8056
|
+
(metadataQuery.maxAge.$lte !== undefined && maxAge > metadataQuery.maxAge.$lte)) {
|
|
8057
|
+
return false;
|
|
8058
|
+
}
|
|
8059
|
+
}
|
|
8060
|
+
return true;
|
|
8061
|
+
}
|
|
8062
|
+
/**
|
|
8063
|
+
* Apply an update to a cache entry
|
|
8064
|
+
* @param entry - Original cache entry
|
|
8065
|
+
* @param update - Update to apply
|
|
8066
|
+
* @returns Updated entry or null if no update needed
|
|
8067
|
+
*/
|
|
8068
|
+
applyUpdate(entry, update) {
|
|
8069
|
+
try {
|
|
8070
|
+
const updateResult = this.buildUpdate(update, entry);
|
|
8071
|
+
switch (updateResult.type) {
|
|
8072
|
+
case 'entry':
|
|
8073
|
+
return updateResult.entry;
|
|
8074
|
+
case 'metadata':
|
|
8075
|
+
// Create a new entry with updated metadata
|
|
8076
|
+
return {
|
|
8077
|
+
...entry,
|
|
8078
|
+
metadata: {
|
|
8079
|
+
...entry.metadata,
|
|
8080
|
+
cacheControl: updateResult.metadata,
|
|
8081
|
+
},
|
|
8082
|
+
};
|
|
8083
|
+
case 'no-op':
|
|
8084
|
+
return null; // No changes needed
|
|
8085
|
+
default:
|
|
8086
|
+
return null;
|
|
8087
|
+
}
|
|
8088
|
+
}
|
|
8089
|
+
catch (error) {
|
|
8090
|
+
console.warn('Failed to apply update to cache entry:', error);
|
|
8091
|
+
return null;
|
|
8092
|
+
}
|
|
8093
|
+
}
|
|
8094
|
+
/**
|
|
8095
|
+
* Build an update for a cache entry
|
|
8096
|
+
* @param update - The cache update operation to apply
|
|
8097
|
+
* @param existing - The existing cache entry being modified
|
|
8098
|
+
* @returns An object indicating the type of update
|
|
8099
|
+
*/
|
|
8100
|
+
buildUpdate(update, existing) {
|
|
8101
|
+
switch (update.type) {
|
|
8102
|
+
case 'invalidate':
|
|
8103
|
+
const updatedCacheControl = this.buildInvalidatedCacheControl(existing.metadata.cacheControl);
|
|
8104
|
+
return updatedCacheControl !== undefined
|
|
8105
|
+
? { type: 'metadata', metadata: updatedCacheControl }
|
|
8106
|
+
: { type: 'no-op' };
|
|
8107
|
+
default:
|
|
8108
|
+
throw new Error(`Invalid update operation: ${update.type}`);
|
|
8109
|
+
}
|
|
8110
|
+
}
|
|
8111
|
+
/**
|
|
8112
|
+
* Build an invalidated cache control metadata
|
|
8113
|
+
* @param existingCacheControl - The current CacheControlMetadata
|
|
8114
|
+
* @returns A new CacheControlMetadata object with maxAge set to 0, or undefined if no changes needed
|
|
8115
|
+
*/
|
|
8116
|
+
buildInvalidatedCacheControl(existingCacheControl) {
|
|
8117
|
+
switch (existingCacheControl.type) {
|
|
8118
|
+
case 'max-age':
|
|
8119
|
+
case 'stale-while-revalidate':
|
|
8120
|
+
if (existingCacheControl.maxAge !== 0) {
|
|
8121
|
+
return {
|
|
8122
|
+
...existingCacheControl,
|
|
8123
|
+
maxAge: 0,
|
|
8124
|
+
};
|
|
8125
|
+
}
|
|
8126
|
+
return undefined; // Already invalidated
|
|
8127
|
+
case 'no-cache':
|
|
8128
|
+
case 'no-store':
|
|
8129
|
+
// These types don't need invalidation
|
|
8130
|
+
return undefined;
|
|
8131
|
+
default:
|
|
8132
|
+
return undefined;
|
|
8133
|
+
}
|
|
8134
|
+
}
|
|
8135
|
+
}
|
|
8136
|
+
/**
|
|
8137
|
+
* Factory function to create an AuraDurableCacheInclusionPolicy service descriptor
|
|
8138
|
+
* @param config - Optional configuration for the storage
|
|
8139
|
+
* @returns Service descriptor for the cache inclusion policy
|
|
8140
|
+
*/
|
|
8141
|
+
function buildAuraDurableCacheInclusionPolicyService(config) {
|
|
8142
|
+
return {
|
|
8143
|
+
service: new AuraDurableCacheInclusionPolicy(config),
|
|
8144
|
+
type: 'cacheInclusionPolicy',
|
|
8145
|
+
version: '1.0',
|
|
8146
|
+
tags: { storage: 'durable' },
|
|
8147
|
+
};
|
|
8148
|
+
}
|
|
8149
|
+
|
|
7536
8150
|
// This code *should* be in lds-network-adapter, but when combined with the Aura
|
|
7537
8151
|
// component test workaround in lds-default-luvio it creates a circular dependecy
|
|
7538
8152
|
// between lds-default-luvio and lds-network-adapter. We do the register on behalf
|
|
@@ -7794,12 +8408,17 @@ function initializeLDS() {
|
|
|
7794
8408
|
// Initializes OneStore in LEX
|
|
7795
8409
|
function initializeOneStore(luvio) {
|
|
7796
8410
|
const loggerService = new ConsoleLogger$1('ERROR');
|
|
7797
|
-
const cacheServiceDescriptor = buildServiceDescriptor$
|
|
7798
|
-
const instrumentationServiceDescriptor = buildServiceDescriptor$
|
|
8411
|
+
const cacheServiceDescriptor = buildServiceDescriptor$a();
|
|
8412
|
+
const instrumentationServiceDescriptor = buildServiceDescriptor$b(loggerService);
|
|
7799
8413
|
const inMemoryCacheInclusionPolicyServiceDescriptor = buildInMemoryCacheInclusionPolicyService(cacheServiceDescriptor.service);
|
|
7800
|
-
const
|
|
8414
|
+
const durableCacheInclusionPolicyServiceDescriptor = buildAuraDurableCacheInclusionPolicyService();
|
|
8415
|
+
const durableCacheControlService = {
|
|
8416
|
+
...buildServiceDescriptor$9(cacheServiceDescriptor.service, durableCacheInclusionPolicyServiceDescriptor.service, instrumentationServiceDescriptor.service),
|
|
8417
|
+
tags: { storage: 'durable' },
|
|
8418
|
+
};
|
|
8419
|
+
const featureFlagsServiceDescriptor = buildServiceDescriptor$3();
|
|
7801
8420
|
const featureFlagsService = featureFlagsServiceDescriptor.service;
|
|
7802
|
-
const luvioUiapiRecordsServiceDescriptor = buildServiceDescriptor$
|
|
8421
|
+
const luvioUiapiRecordsServiceDescriptor = buildServiceDescriptor$2((configs) => {
|
|
7803
8422
|
return notifyUpdateAvailableFactory(luvio)(configs);
|
|
7804
8423
|
}, (recordId, reader) => {
|
|
7805
8424
|
const recordKey = buildRecordRepKeyFromId(recordId);
|
|
@@ -7819,7 +8438,7 @@ function initializeOneStore(luvio) {
|
|
|
7819
8438
|
return linkedData.data;
|
|
7820
8439
|
});
|
|
7821
8440
|
const retryPolicy = new FetchThrottlingRetryPolicy();
|
|
7822
|
-
const retryServiceDescriptor = buildServiceDescriptor(retryPolicy);
|
|
8441
|
+
const retryServiceDescriptor = buildServiceDescriptor$1(retryPolicy);
|
|
7823
8442
|
const retryService = retryServiceDescriptor.service;
|
|
7824
8443
|
// set flags based on gates
|
|
7825
8444
|
featureFlagsService.set('useOneStoreGraphQL', useOneStoreGraphql.isOpen({ fallback: false }));
|
|
@@ -7830,23 +8449,25 @@ function initializeOneStore(luvio) {
|
|
|
7830
8449
|
buildJwtAuthorizedSfapFetchServiceDescriptor(loggerService),
|
|
7831
8450
|
buildCopilotFetchServiceDescriptor(loggerService),
|
|
7832
8451
|
buildAuraNetworkService(),
|
|
7833
|
-
buildServiceDescriptor$
|
|
7834
|
-
|
|
7835
|
-
buildServiceDescriptor$
|
|
7836
|
-
|
|
7837
|
-
buildServiceDescriptor$e(),
|
|
8452
|
+
buildServiceDescriptor$c(instrumentationServiceDescriptor.service),
|
|
8453
|
+
// Ordering of services matters - L1 only CacheControlService must come before durable
|
|
8454
|
+
buildServiceDescriptor$9(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service, instrumentationServiceDescriptor.service),
|
|
8455
|
+
durableCacheControlService,
|
|
7838
8456
|
buildServiceDescriptor$j(),
|
|
8457
|
+
buildServiceDescriptor$7(),
|
|
8458
|
+
buildServiceDescriptor$f(),
|
|
8459
|
+
buildServiceDescriptor$k(),
|
|
8460
|
+
buildServiceDescriptor$e(),
|
|
7839
8461
|
buildServiceDescriptor$d(),
|
|
7840
|
-
buildServiceDescriptor$
|
|
8462
|
+
buildServiceDescriptor$i(),
|
|
7841
8463
|
buildServiceDescriptor$h(),
|
|
7842
8464
|
buildServiceDescriptor$g(),
|
|
7843
|
-
buildServiceDescriptor$
|
|
7844
|
-
buildServiceDescriptor$7(),
|
|
8465
|
+
buildServiceDescriptor$8(),
|
|
7845
8466
|
buildLexRuntimeAllow5xxFetchServiceDescriptor(loggerService, retryService),
|
|
7846
|
-
buildServiceDescriptor$
|
|
8467
|
+
buildServiceDescriptor$6(luvio),
|
|
7847
8468
|
luvioUiapiRecordsServiceDescriptor,
|
|
8469
|
+
buildServiceDescriptor$5(),
|
|
7848
8470
|
buildServiceDescriptor$4(),
|
|
7849
|
-
buildServiceDescriptor$3(),
|
|
7850
8471
|
featureFlagsServiceDescriptor,
|
|
7851
8472
|
retryServiceDescriptor,
|
|
7852
8473
|
];
|
|
@@ -7868,4 +8489,4 @@ function ldsEngineCreator() {
|
|
|
7868
8489
|
}
|
|
7869
8490
|
|
|
7870
8491
|
export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
|
|
7871
|
-
// version: 1.
|
|
8492
|
+
// version: 1.401.0-b1adb82748
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type AuraStorageConfig } from '@salesforce/lds-aura-storage';
|
|
2
|
+
import { type CacheInclusionPolicyServiceDescriptor, type CacheQuery, type CacheUpdate, DurableCacheInclusionPolicy } from '@conduit-client/service-cache-inclusion-policy/v1';
|
|
3
|
+
import type { Cache, CacheEntry, Key } from '@conduit-client/service-cache/v1';
|
|
4
|
+
import type { DeepReadonly } from '@conduit-client/utils';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for AuraDurableCacheInclusionPolicy
|
|
7
|
+
*/
|
|
8
|
+
export type DurableCacheConfig = Partial<AuraStorageConfig>;
|
|
9
|
+
/**
|
|
10
|
+
* Durable cache inclusion policy that uses AuraStorage for persistent L2 cache
|
|
11
|
+
*/
|
|
12
|
+
export declare class AuraDurableCacheInclusionPolicy extends DurableCacheInclusionPolicy {
|
|
13
|
+
private readonly storage;
|
|
14
|
+
constructor(config?: DurableCacheConfig);
|
|
15
|
+
/**
|
|
16
|
+
* Revive cache entries from AuraStorage into L1 cache
|
|
17
|
+
* @param keys - Set of keys to revive
|
|
18
|
+
* @param l1 - L1 cache instance
|
|
19
|
+
* @returns Set of keys that were successfully revived
|
|
20
|
+
*/
|
|
21
|
+
revive(keys: Set<Key>, l1: Cache): Promise<Set<Key>>;
|
|
22
|
+
/**
|
|
23
|
+
* Sync changed keys from L1 cache to AuraStorage (L2 cache)
|
|
24
|
+
* @param changedKeys - Set of keys that have changed
|
|
25
|
+
* @param l1 - L1 cache instance
|
|
26
|
+
*/
|
|
27
|
+
syncToL2Cache(changedKeys: Set<Key>, l1: Cache): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Find entries matching a query
|
|
30
|
+
* @param query - Cache query to match entries
|
|
31
|
+
*/
|
|
32
|
+
find(query: CacheQuery): AsyncGenerator<[key: Key, value: DeepReadonly<CacheEntry<unknown>>], void, unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* Find and modify entries matching a query
|
|
35
|
+
* @param query - Cache query to match entries
|
|
36
|
+
* @param cacheUpdate - Update to apply to matching entries
|
|
37
|
+
*/
|
|
38
|
+
findAndModify(query: CacheQuery, cacheUpdate: CacheUpdate): AsyncGenerator<Key, void, unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* Check if an entry matches a cache query
|
|
41
|
+
* @param key - Cache key to check
|
|
42
|
+
* @param entry - Cache entry to check
|
|
43
|
+
* @param query - Query to match against
|
|
44
|
+
* @returns true if the entry matches the query
|
|
45
|
+
*/
|
|
46
|
+
private matchesQuery;
|
|
47
|
+
private isAndQuery;
|
|
48
|
+
private isOrQuery;
|
|
49
|
+
private isNotQuery;
|
|
50
|
+
private matchesKey;
|
|
51
|
+
private matchesMetadata;
|
|
52
|
+
/**
|
|
53
|
+
* Apply an update to a cache entry
|
|
54
|
+
* @param entry - Original cache entry
|
|
55
|
+
* @param update - Update to apply
|
|
56
|
+
* @returns Updated entry or null if no update needed
|
|
57
|
+
*/
|
|
58
|
+
private applyUpdate;
|
|
59
|
+
/**
|
|
60
|
+
* Build an update for a cache entry
|
|
61
|
+
* @param update - The cache update operation to apply
|
|
62
|
+
* @param existing - The existing cache entry being modified
|
|
63
|
+
* @returns An object indicating the type of update
|
|
64
|
+
*/
|
|
65
|
+
private buildUpdate;
|
|
66
|
+
/**
|
|
67
|
+
* Build an invalidated cache control metadata
|
|
68
|
+
* @param existingCacheControl - The current CacheControlMetadata
|
|
69
|
+
* @returns A new CacheControlMetadata object with maxAge set to 0, or undefined if no changes needed
|
|
70
|
+
*/
|
|
71
|
+
private buildInvalidatedCacheControl;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Factory function to create an AuraDurableCacheInclusionPolicy service descriptor
|
|
75
|
+
* @param config - Optional configuration for the storage
|
|
76
|
+
* @returns Service descriptor for the cache inclusion policy
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildAuraDurableCacheInclusionPolicyService(config?: DurableCacheConfig): CacheInclusionPolicyServiceDescriptor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-aura",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.401.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Aura runtime",
|
|
6
6
|
"main": "dist/ldsEngineCreator.js",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@conduit-client/service-provisioner": "2.0.1",
|
|
38
38
|
"@conduit-client/tools-core": "2.0.1",
|
|
39
|
-
"@salesforce/lds-adapters-apex": "^1.
|
|
40
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
41
|
-
"@salesforce/lds-ads-bridge": "^1.
|
|
42
|
-
"@salesforce/lds-aura-storage": "^1.
|
|
43
|
-
"@salesforce/lds-bindings": "^1.
|
|
44
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
45
|
-
"@salesforce/lds-network-aura": "^1.
|
|
46
|
-
"@salesforce/lds-network-fetch": "^1.
|
|
39
|
+
"@salesforce/lds-adapters-apex": "^1.401.0",
|
|
40
|
+
"@salesforce/lds-adapters-uiapi": "^1.401.0",
|
|
41
|
+
"@salesforce/lds-ads-bridge": "^1.401.0",
|
|
42
|
+
"@salesforce/lds-aura-storage": "^1.401.0",
|
|
43
|
+
"@salesforce/lds-bindings": "^1.401.0",
|
|
44
|
+
"@salesforce/lds-instrumentation": "^1.401.0",
|
|
45
|
+
"@salesforce/lds-network-aura": "^1.401.0",
|
|
46
|
+
"@salesforce/lds-network-fetch": "^1.401.0",
|
|
47
47
|
"jwt-encode": "1.0.1"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"@luvio/network-adapter-composable": "0.158.7",
|
|
72
72
|
"@luvio/network-adapter-fetch": "0.158.7",
|
|
73
73
|
"@lwc/state": "^0.23.0",
|
|
74
|
-
"@salesforce/lds-adapters-onestore-graphql": "^1.
|
|
75
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.
|
|
76
|
-
"@salesforce/lds-luvio-service": "^1.
|
|
77
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.
|
|
74
|
+
"@salesforce/lds-adapters-onestore-graphql": "^1.401.0",
|
|
75
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.401.0",
|
|
76
|
+
"@salesforce/lds-luvio-service": "^1.401.0",
|
|
77
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.401.0"
|
|
78
78
|
},
|
|
79
79
|
"luvioBundlesize": [
|
|
80
80
|
{
|