@salesforce/lds-runtime-webruntime 1.380.0-dev2 → 1.380.0-dev22
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/ldsWebruntimeOneStoreInit.js +225 -121
- package/package.json +25 -25
|
@@ -91,18 +91,24 @@ let Err$1 = class Err {
|
|
|
91
91
|
};
|
|
92
92
|
const ok$2 = (value) => new Ok$2(value);
|
|
93
93
|
const err$1 = (err2) => new Err$1(err2);
|
|
94
|
+
function isResult(value) {
|
|
95
|
+
return value != null && typeof value === "object" && "isOk" in value && "isErr" in value && typeof value.isOk === "function" && typeof value.isErr === "function" && (value.isOk() === true && value.isErr() === false && "value" in value || value.isOk() === false && value.isErr() === true && "error" in value);
|
|
96
|
+
}
|
|
97
|
+
function isSubscribable(obj) {
|
|
98
|
+
return typeof obj === "object" && obj !== null && "subscribe" in obj && typeof obj.subscribe === "function" && "refresh" in obj && typeof obj.refresh === "function";
|
|
99
|
+
}
|
|
94
100
|
function isSubscribableResult(x) {
|
|
95
|
-
if (
|
|
101
|
+
if (!isResult(x)) {
|
|
96
102
|
return false;
|
|
97
103
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
return isSubscribable(x.isOk() ? x.value : x.error);
|
|
105
|
+
}
|
|
106
|
+
function buildSubscribableResult$1(result, subscribe, refresh) {
|
|
107
|
+
if (result.isOk()) {
|
|
108
|
+
return ok$2({ data: result.value, subscribe, refresh });
|
|
109
|
+
} else {
|
|
110
|
+
return err$1({ failure: result.error, subscribe, refresh });
|
|
104
111
|
}
|
|
105
|
-
return false;
|
|
106
112
|
}
|
|
107
113
|
function resolvedPromiseLike$3(result) {
|
|
108
114
|
if (isPromiseLike$3(result)) {
|
|
@@ -190,6 +196,47 @@ function toError(x) {
|
|
|
190
196
|
}
|
|
191
197
|
return new Error(typeof x === "string" ? x : JSON.stringify(x));
|
|
192
198
|
}
|
|
199
|
+
var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
200
|
+
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
201
|
+
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
202
|
+
HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
|
|
203
|
+
HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
|
|
204
|
+
HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
|
|
205
|
+
HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
|
|
206
|
+
HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
|
|
207
|
+
HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
|
|
208
|
+
HttpStatusCode2[HttpStatusCode2["ServerError"] = 500] = "ServerError";
|
|
209
|
+
HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
210
|
+
return HttpStatusCode2;
|
|
211
|
+
})(HttpStatusCode || {});
|
|
212
|
+
function getStatusText(status) {
|
|
213
|
+
switch (status) {
|
|
214
|
+
case 200:
|
|
215
|
+
return "OK";
|
|
216
|
+
case 201:
|
|
217
|
+
return "Created";
|
|
218
|
+
case 304:
|
|
219
|
+
return "Not Modified";
|
|
220
|
+
case 400:
|
|
221
|
+
return "Bad Request";
|
|
222
|
+
case 404:
|
|
223
|
+
return "Not Found";
|
|
224
|
+
case 500:
|
|
225
|
+
return "Server Error";
|
|
226
|
+
default:
|
|
227
|
+
return `Unexpected HTTP Status Code: ${status}`;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
class FetchResponse extends Error {
|
|
231
|
+
constructor(status, body, headers) {
|
|
232
|
+
super();
|
|
233
|
+
this.status = status;
|
|
234
|
+
this.body = body;
|
|
235
|
+
this.headers = headers || {};
|
|
236
|
+
this.ok = status >= 200 && this.status <= 299;
|
|
237
|
+
this.statusText = getStatusText(status);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
193
240
|
class InternalError extends Error {
|
|
194
241
|
constructor(data) {
|
|
195
242
|
super();
|
|
@@ -234,35 +281,27 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
234
281
|
}
|
|
235
282
|
fetchSubscribableResult(res) {
|
|
236
283
|
return res.then((networkResult) => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
};
|
|
248
|
-
},
|
|
249
|
-
refresh: () => this.refresh()
|
|
250
|
-
});
|
|
251
|
-
}
|
|
284
|
+
return buildSubscribableResult$1(
|
|
285
|
+
networkResult,
|
|
286
|
+
(cb) => {
|
|
287
|
+
this.subscriptions.push(cb);
|
|
288
|
+
return () => {
|
|
289
|
+
this.subscriptions = this.subscriptions.filter((cb2) => cb2 !== cb);
|
|
290
|
+
};
|
|
291
|
+
},
|
|
292
|
+
() => this.refresh()
|
|
293
|
+
);
|
|
252
294
|
});
|
|
253
295
|
}
|
|
254
296
|
refresh() {
|
|
255
297
|
return this.execute().then((newResult) => {
|
|
256
|
-
if (newResult
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
return ok$2(void 0);
|
|
298
|
+
if (isSubscribableResult(newResult)) {
|
|
299
|
+
const value = newResult.isOk() ? ok$2(newResult.value.data) : err$1(newResult.error.failure);
|
|
300
|
+
this.subscriptions.forEach((cb) => {
|
|
301
|
+
cb(value);
|
|
302
|
+
});
|
|
264
303
|
}
|
|
265
|
-
return
|
|
304
|
+
return ok$2(void 0);
|
|
266
305
|
});
|
|
267
306
|
}
|
|
268
307
|
async afterRequestHooks(_options) {
|
|
@@ -413,6 +452,13 @@ class Err {
|
|
|
413
452
|
}
|
|
414
453
|
const ok$1 = (value) => new Ok$1(value);
|
|
415
454
|
const err = (err2) => new Err(err2);
|
|
455
|
+
function buildSubscribableResult(result, subscribe, refresh) {
|
|
456
|
+
if (result.isOk()) {
|
|
457
|
+
return ok$1({ data: result.value, subscribe, refresh });
|
|
458
|
+
} else {
|
|
459
|
+
return err({ failure: result.error, subscribe, refresh });
|
|
460
|
+
}
|
|
461
|
+
}
|
|
416
462
|
function resolvedPromiseLike$2(result) {
|
|
417
463
|
if (isPromiseLike$2(result)) {
|
|
418
464
|
return result.then((nextResult) => nextResult);
|
|
@@ -512,7 +558,7 @@ class CacheControlRequestRunner {
|
|
|
512
558
|
const resultPromise = this.readFromCacheInternal(cache);
|
|
513
559
|
return resultPromise.then((result) => {
|
|
514
560
|
if (result.isErr()) {
|
|
515
|
-
return err(result.error);
|
|
561
|
+
return err(result.error.failure);
|
|
516
562
|
}
|
|
517
563
|
this.returnData = result;
|
|
518
564
|
return ok$1(void 0);
|
|
@@ -520,7 +566,7 @@ class CacheControlRequestRunner {
|
|
|
520
566
|
}
|
|
521
567
|
requestFromNetwork() {
|
|
522
568
|
const that = this;
|
|
523
|
-
return async function* () {
|
|
569
|
+
return (async function* () {
|
|
524
570
|
const result = await that.requestFromNetworkInternal();
|
|
525
571
|
if (result.isErr()) {
|
|
526
572
|
that.networkError = result;
|
|
@@ -528,7 +574,7 @@ class CacheControlRequestRunner {
|
|
|
528
574
|
that.networkData = result;
|
|
529
575
|
}
|
|
530
576
|
yield result;
|
|
531
|
-
}();
|
|
577
|
+
})();
|
|
532
578
|
}
|
|
533
579
|
writeToCache(cache, networkResult) {
|
|
534
580
|
return this.writeToCacheInternal(cache, networkResult);
|
|
@@ -541,7 +587,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
541
587
|
this.keysUsed = /* @__PURE__ */ new Set();
|
|
542
588
|
this.keysUpdated = void 0;
|
|
543
589
|
this.operationType = "query";
|
|
544
|
-
this.
|
|
590
|
+
this.lastResult = void 0;
|
|
545
591
|
this.unsubscribeFromKeysImpl = () => void 0;
|
|
546
592
|
this.subscriptions = [];
|
|
547
593
|
this.instantiationTime = Date.now() / 1e3;
|
|
@@ -558,32 +604,54 @@ class CacheControlCommand extends BaseCommand {
|
|
|
558
604
|
instrumentationAttributes: this.instrumentationAttributes
|
|
559
605
|
});
|
|
560
606
|
return resultPromise.then((result) => {
|
|
561
|
-
return this.handleCacheControllerResult(result, requestRunner)
|
|
607
|
+
return this.handleCacheControllerResult(result, requestRunner).then((result2) => {
|
|
608
|
+
if (this.lastResult === void 0) {
|
|
609
|
+
if (result2.isErr()) {
|
|
610
|
+
this.lastResult = { type: "error", error: result2.error.failure };
|
|
611
|
+
} else {
|
|
612
|
+
this.lastResult = { type: "data", data: result2.value.data };
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return result2;
|
|
616
|
+
});
|
|
562
617
|
});
|
|
563
618
|
}
|
|
564
619
|
handleCacheControllerResult(result, requestRunner) {
|
|
565
620
|
const { networkError, networkData, returnData } = requestRunner;
|
|
566
621
|
return this.publishUpdatedKeys().then(() => {
|
|
567
622
|
if (networkError) {
|
|
568
|
-
return
|
|
623
|
+
return buildSubscribableResult(
|
|
624
|
+
networkError,
|
|
625
|
+
this.buildSubscribe(),
|
|
626
|
+
() => this.refresh()
|
|
627
|
+
);
|
|
569
628
|
}
|
|
570
629
|
if (result.isErr()) {
|
|
571
630
|
if (networkData) {
|
|
572
|
-
return
|
|
631
|
+
return buildSubscribableResult(
|
|
632
|
+
networkData,
|
|
633
|
+
this.buildSubscribe(),
|
|
634
|
+
() => this.refresh()
|
|
635
|
+
);
|
|
573
636
|
}
|
|
574
|
-
return
|
|
637
|
+
return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
|
|
575
638
|
}
|
|
576
639
|
if (this.subscriptions.length > 0) {
|
|
577
640
|
this.subscribeToKeysUsed();
|
|
578
641
|
}
|
|
579
642
|
if (returnData === void 0) {
|
|
580
643
|
if (networkData) {
|
|
581
|
-
return
|
|
644
|
+
return buildSubscribableResult(
|
|
645
|
+
networkData,
|
|
646
|
+
this.buildSubscribe(),
|
|
647
|
+
() => this.refresh()
|
|
648
|
+
);
|
|
582
649
|
}
|
|
583
|
-
return
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
650
|
+
return buildSubscribableResult(
|
|
651
|
+
err(new Error("Cache miss after fetching from network")),
|
|
652
|
+
this.buildSubscribe(),
|
|
653
|
+
() => this.refresh()
|
|
654
|
+
);
|
|
587
655
|
}
|
|
588
656
|
return returnData;
|
|
589
657
|
});
|
|
@@ -643,7 +711,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
643
711
|
refresh() {
|
|
644
712
|
return this.rerun({ cacheControlConfig: { type: "no-cache" } }).then((result) => {
|
|
645
713
|
if (result.isErr()) {
|
|
646
|
-
return err(result.error);
|
|
714
|
+
return err(result.error.failure);
|
|
647
715
|
}
|
|
648
716
|
return ok$1(void 0);
|
|
649
717
|
});
|
|
@@ -661,22 +729,22 @@ class CacheControlCommand extends BaseCommand {
|
|
|
661
729
|
const result = this.readFromCache(recordableCache);
|
|
662
730
|
return result.then((readResult) => {
|
|
663
731
|
if (readResult.isErr()) {
|
|
664
|
-
return
|
|
732
|
+
return buildSubscribableResult(
|
|
733
|
+
readResult,
|
|
734
|
+
this.buildSubscribe(),
|
|
735
|
+
() => this.refresh()
|
|
736
|
+
);
|
|
665
737
|
} else {
|
|
666
738
|
const data = readResult.value;
|
|
667
739
|
this.keysUsed = recordableCache.keysRead;
|
|
668
|
-
return
|
|
740
|
+
return buildSubscribableResult(
|
|
741
|
+
ok$1(data),
|
|
742
|
+
this.buildSubscribe(),
|
|
743
|
+
() => this.refresh()
|
|
744
|
+
);
|
|
669
745
|
}
|
|
670
746
|
});
|
|
671
747
|
}
|
|
672
|
-
constructSubscribableResult(data) {
|
|
673
|
-
return ok$1({
|
|
674
|
-
data,
|
|
675
|
-
// this cast is in case we need to return Network data as a fallback for caching errors
|
|
676
|
-
subscribe: this.buildSubscribe(),
|
|
677
|
-
refresh: () => this.refresh()
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
748
|
/**
|
|
681
749
|
* Builds a function that subscribes to cache changes via the pubsub service. Whenever
|
|
682
750
|
* relevant cache updates occur, it re-reads the data and compares it against
|
|
@@ -688,7 +756,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
688
756
|
*/
|
|
689
757
|
buildSubscribe() {
|
|
690
758
|
return (consumerCallback) => {
|
|
691
|
-
if (this.subscriptions.length === 0 && this.operationType === "query") {
|
|
759
|
+
if (this.subscriptions.length === 0 && (this.operationType === "query" || this.operationType === "graphql")) {
|
|
692
760
|
this.subscribeToKeysUsed();
|
|
693
761
|
}
|
|
694
762
|
this.subscriptions.push(consumerCallback);
|
|
@@ -703,11 +771,12 @@ class CacheControlCommand extends BaseCommand {
|
|
|
703
771
|
rerun(overrides) {
|
|
704
772
|
return this.execute(overrides).then((result) => {
|
|
705
773
|
if (result.isErr()) {
|
|
706
|
-
this.
|
|
774
|
+
this.lastResult = { type: "error", error: result.error.failure };
|
|
775
|
+
this.invokeConsumerCallbacks(err(result.error.failure));
|
|
707
776
|
return result;
|
|
708
777
|
}
|
|
709
|
-
if (!this.equals(this.
|
|
710
|
-
this.
|
|
778
|
+
if (this.lastResult === void 0 || this.lastResult.type === "error" || !this.equals(this.lastResult.data, result.value.data)) {
|
|
779
|
+
this.lastResult = { type: "data", data: result.value.data };
|
|
711
780
|
this.invokeConsumerCallbacks(ok$1(result.value.data));
|
|
712
781
|
}
|
|
713
782
|
return result;
|
|
@@ -776,14 +845,14 @@ let AuraCacheControlCommand$1 = class AuraCacheControlCommand extends CacheContr
|
|
|
776
845
|
if (this.shouldUseAuraNetwork()) {
|
|
777
846
|
return this.convertAuraResponseToData(
|
|
778
847
|
this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig),
|
|
779
|
-
(errs) => this.
|
|
848
|
+
(errs) => this.coerceAuraErrors(errs)
|
|
780
849
|
);
|
|
781
850
|
} else if (this.shouldUseFetch()) {
|
|
782
851
|
return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
|
|
783
852
|
}
|
|
784
853
|
return resolvedPromiseLike$3(err$1(toError("Aura/Fetch network services not found")));
|
|
785
854
|
}
|
|
786
|
-
|
|
855
|
+
coerceAuraErrors(auraErrors) {
|
|
787
856
|
return toError(auraErrors[0]);
|
|
788
857
|
}
|
|
789
858
|
async coerceFetchError(errorResponse) {
|
|
@@ -851,9 +920,6 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
|
|
|
851
920
|
super(services);
|
|
852
921
|
this.services = services;
|
|
853
922
|
}
|
|
854
|
-
execute() {
|
|
855
|
-
return super.execute();
|
|
856
|
-
}
|
|
857
923
|
readFromCache(cache) {
|
|
858
924
|
var _a;
|
|
859
925
|
const data = (_a = cache.get(this.buildKey())) == null ? void 0 : _a.value;
|
|
@@ -922,14 +988,14 @@ class AuraCacheControlCommand extends CacheControlCommand {
|
|
|
922
988
|
if (this.shouldUseAuraNetwork()) {
|
|
923
989
|
return this.convertAuraResponseToData(
|
|
924
990
|
this.services.auraNetwork(this.endpoint, this.auraParams, this.actionConfig),
|
|
925
|
-
(errs) => this.
|
|
991
|
+
(errs) => this.coerceAuraErrors(errs)
|
|
926
992
|
);
|
|
927
993
|
} else if (this.shouldUseFetch()) {
|
|
928
994
|
return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
|
|
929
995
|
}
|
|
930
996
|
return resolvedPromiseLike$3(err$1(toError("Aura/Fetch network services not found")));
|
|
931
997
|
}
|
|
932
|
-
|
|
998
|
+
coerceAuraErrors(auraErrors) {
|
|
933
999
|
return toError(auraErrors[0]);
|
|
934
1000
|
}
|
|
935
1001
|
async coerceFetchError(errorResponse) {
|
|
@@ -1139,35 +1205,27 @@ class NetworkCommand extends BaseCommand {
|
|
|
1139
1205
|
}
|
|
1140
1206
|
fetchSubscribableResult(res) {
|
|
1141
1207
|
return res.then((networkResult) => {
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
};
|
|
1153
|
-
},
|
|
1154
|
-
refresh: () => this.refresh()
|
|
1155
|
-
});
|
|
1156
|
-
}
|
|
1208
|
+
return buildSubscribableResult$1(
|
|
1209
|
+
networkResult,
|
|
1210
|
+
(cb) => {
|
|
1211
|
+
this.subscriptions.push(cb);
|
|
1212
|
+
return () => {
|
|
1213
|
+
this.subscriptions = this.subscriptions.filter((cb2) => cb2 !== cb);
|
|
1214
|
+
};
|
|
1215
|
+
},
|
|
1216
|
+
() => this.refresh()
|
|
1217
|
+
);
|
|
1157
1218
|
});
|
|
1158
1219
|
}
|
|
1159
1220
|
refresh() {
|
|
1160
1221
|
return this.execute().then((newResult) => {
|
|
1161
|
-
if (newResult
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
});
|
|
1167
|
-
}
|
|
1168
|
-
return ok$2(void 0);
|
|
1222
|
+
if (isSubscribableResult(newResult)) {
|
|
1223
|
+
const value = newResult.isOk() ? ok$2(newResult.value.data) : err$1(newResult.error.failure);
|
|
1224
|
+
this.subscriptions.forEach((cb) => {
|
|
1225
|
+
cb(value);
|
|
1226
|
+
});
|
|
1169
1227
|
}
|
|
1170
|
-
return
|
|
1228
|
+
return ok$2(void 0);
|
|
1171
1229
|
});
|
|
1172
1230
|
}
|
|
1173
1231
|
async afterRequestHooks(_options) {
|
|
@@ -2037,6 +2095,59 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2037
2095
|
];
|
|
2038
2096
|
}
|
|
2039
2097
|
}
|
|
2098
|
+
class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
2099
|
+
execute(options) {
|
|
2100
|
+
const startTime = this.services.instrumentation ? this.services.instrumentation.currentTimeMs() : 0;
|
|
2101
|
+
return this.services.cacheInclusionPolicy.read({
|
|
2102
|
+
l1: this.filteredCache,
|
|
2103
|
+
readFromL1: (l1) => this.requestRunner.readFromCache(l1)
|
|
2104
|
+
}).then((result) => {
|
|
2105
|
+
if (result.isOk()) {
|
|
2106
|
+
this.collectCacheHitInstrumentation(
|
|
2107
|
+
startTime,
|
|
2108
|
+
options == null ? void 0 : options.instrumentationAttributes
|
|
2109
|
+
);
|
|
2110
|
+
return ok$2(void 0);
|
|
2111
|
+
}
|
|
2112
|
+
this.collectCacheMissInstrumentation(startTime, options == null ? void 0 : options.instrumentationAttributes);
|
|
2113
|
+
const error = new UserVisibleError(
|
|
2114
|
+
new FetchResponse(HttpStatusCode.GatewayTimeout, {
|
|
2115
|
+
error: "Cache miss for only-if-cached request"
|
|
2116
|
+
})
|
|
2117
|
+
);
|
|
2118
|
+
return err$1(error);
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
get expiredChecks() {
|
|
2122
|
+
return [
|
|
2123
|
+
(cacheControlMetadata) => cacheControlMetadata.type === "no-store"
|
|
2124
|
+
];
|
|
2125
|
+
}
|
|
2126
|
+
collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
|
|
2127
|
+
if (this.services.instrumentation) {
|
|
2128
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
2129
|
+
meter.createCounter(`command.only-if-cached.cache-hit.count`).add(1, instrumentationAttributes);
|
|
2130
|
+
meter.createHistogram(
|
|
2131
|
+
`command.only-if-cached.cache-hit.duration`
|
|
2132
|
+
).record(
|
|
2133
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
2134
|
+
instrumentationAttributes
|
|
2135
|
+
);
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
collectCacheMissInstrumentation(startTime, instrumentationAttributes) {
|
|
2139
|
+
if (this.services.instrumentation) {
|
|
2140
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
2141
|
+
meter.createCounter(`command.only-if-cached.cache-miss.count`).add(1, instrumentationAttributes);
|
|
2142
|
+
meter.createHistogram(
|
|
2143
|
+
`command.only-if-cached.cache-miss.duration`
|
|
2144
|
+
).record(
|
|
2145
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
2146
|
+
instrumentationAttributes
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2040
2151
|
class CacheController {
|
|
2041
2152
|
constructor(services) {
|
|
2042
2153
|
this.services = services;
|
|
@@ -2050,6 +2161,8 @@ class CacheController {
|
|
|
2050
2161
|
return new MaxAgeCacheControlStrategy(this.services, config, requestRunner);
|
|
2051
2162
|
} else if (config.type === "no-cache") {
|
|
2052
2163
|
return new NoCacheCacheControlStrategy(this.services, config, requestRunner);
|
|
2164
|
+
} else if (config.type === "only-if-cached") {
|
|
2165
|
+
return new OnlyIfCachedCacheControlStrategy(this.services, config, requestRunner);
|
|
2053
2166
|
}
|
|
2054
2167
|
throw new Error(`Unknown cache control strategy ${config.type}`);
|
|
2055
2168
|
}
|
|
@@ -2068,11 +2181,11 @@ class CacheController {
|
|
|
2068
2181
|
yield* this.services.cacheInclusionPolicy.findAndModify(query, cacheUpdate);
|
|
2069
2182
|
}
|
|
2070
2183
|
}
|
|
2071
|
-
function buildServiceDescriptor$8(cache, cacheInclusionPolicy) {
|
|
2184
|
+
function buildServiceDescriptor$8(cache, cacheInclusionPolicy, instrumentation) {
|
|
2072
2185
|
return {
|
|
2073
2186
|
type: "cacheController",
|
|
2074
2187
|
version: "1.0",
|
|
2075
|
-
service: new CacheController({ cache, cacheInclusionPolicy })
|
|
2188
|
+
service: new CacheController({ cache, cacheInclusionPolicy, instrumentation })
|
|
2076
2189
|
};
|
|
2077
2190
|
}
|
|
2078
2191
|
|
|
@@ -3430,24 +3543,24 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
3430
3543
|
this.originalAuraParams,
|
|
3431
3544
|
this.actionConfig
|
|
3432
3545
|
),
|
|
3433
|
-
(errs) => this.
|
|
3546
|
+
(errs) => this.coerceAuraErrors(errs)
|
|
3434
3547
|
).then((result) => {
|
|
3435
|
-
|
|
3436
|
-
return this.constructSubscribableResult(result.value);
|
|
3437
|
-
}
|
|
3438
|
-
return result;
|
|
3548
|
+
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
3439
3549
|
});
|
|
3440
3550
|
} else if (this.shouldUseFetch()) {
|
|
3441
3551
|
return this.convertFetchResponseToData(
|
|
3442
3552
|
this.services.fetch(...this.originalFetchParams)
|
|
3443
3553
|
).then((result) => {
|
|
3444
|
-
|
|
3445
|
-
return this.constructSubscribableResult(result.value);
|
|
3446
|
-
}
|
|
3447
|
-
return result;
|
|
3554
|
+
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
3448
3555
|
});
|
|
3449
3556
|
}
|
|
3450
|
-
return resolvedPromiseLike$3(
|
|
3557
|
+
return resolvedPromiseLike$3(
|
|
3558
|
+
buildSubscribableResult$1(
|
|
3559
|
+
err$1(toError("Aura/Fetch network services not found")),
|
|
3560
|
+
this.buildSubscribe(),
|
|
3561
|
+
() => this.refresh()
|
|
3562
|
+
)
|
|
3563
|
+
);
|
|
3451
3564
|
}
|
|
3452
3565
|
buildRequestQuery() {
|
|
3453
3566
|
const augmentedQueryResult = this.documentRootType.buildAugmentedQuery(this.config);
|
|
@@ -3476,9 +3589,6 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
3476
3589
|
if (this.subscriptions.length > 0) {
|
|
3477
3590
|
this.subscribeToKeysUsed();
|
|
3478
3591
|
}
|
|
3479
|
-
if (this.lastEmittedData === void 0) {
|
|
3480
|
-
this.lastEmittedData = returnData.value.data;
|
|
3481
|
-
}
|
|
3482
3592
|
return returnData;
|
|
3483
3593
|
});
|
|
3484
3594
|
}
|
|
@@ -3570,10 +3680,7 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
3570
3680
|
return this.convertFetchResponseToData(
|
|
3571
3681
|
this.services.fetch(...this.originalFetchParams)
|
|
3572
3682
|
).then((result) => {
|
|
3573
|
-
|
|
3574
|
-
return this.constructSubscribableResult(result.value);
|
|
3575
|
-
}
|
|
3576
|
-
return result;
|
|
3683
|
+
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
3577
3684
|
});
|
|
3578
3685
|
}
|
|
3579
3686
|
// Any changes to this method should most likely be duplicated in the aura command as well
|
|
@@ -3586,9 +3693,6 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
3586
3693
|
if (this.subscriptions.length > 0) {
|
|
3587
3694
|
this.subscribeToKeysUsed();
|
|
3588
3695
|
}
|
|
3589
|
-
if (this.lastEmittedData === void 0) {
|
|
3590
|
-
this.lastEmittedData = returnData.value.data;
|
|
3591
|
-
}
|
|
3592
3696
|
return returnData;
|
|
3593
3697
|
});
|
|
3594
3698
|
}
|
|
@@ -3706,7 +3810,7 @@ function buildServiceDescriptor$2(luvio) {
|
|
|
3706
3810
|
},
|
|
3707
3811
|
};
|
|
3708
3812
|
}
|
|
3709
|
-
// version: 1.380.0-
|
|
3813
|
+
// version: 1.380.0-dev22-411853e059
|
|
3710
3814
|
|
|
3711
3815
|
/**
|
|
3712
3816
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3732,7 +3836,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3732
3836
|
},
|
|
3733
3837
|
};
|
|
3734
3838
|
}
|
|
3735
|
-
// version: 1.380.0-
|
|
3839
|
+
// version: 1.380.0-dev22-411853e059
|
|
3736
3840
|
|
|
3737
3841
|
/*!
|
|
3738
3842
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3764,12 +3868,12 @@ function t(e2) {
|
|
|
3764
3868
|
throw "Illegal base64url string!";
|
|
3765
3869
|
}
|
|
3766
3870
|
try {
|
|
3767
|
-
return function(e3) {
|
|
3768
|
-
return decodeURIComponent(r(e3).replace(/(.)/g, function(e4, r2) {
|
|
3871
|
+
return (function(e3) {
|
|
3872
|
+
return decodeURIComponent(r(e3).replace(/(.)/g, (function(e4, r2) {
|
|
3769
3873
|
var t3 = r2.charCodeAt(0).toString(16).toUpperCase();
|
|
3770
3874
|
return t3.length < 2 && (t3 = "0" + t3), "%" + t3;
|
|
3771
|
-
}));
|
|
3772
|
-
}(t2);
|
|
3875
|
+
})));
|
|
3876
|
+
})(t2);
|
|
3773
3877
|
} catch (e3) {
|
|
3774
3878
|
return r(t2);
|
|
3775
3879
|
}
|
|
@@ -4333,7 +4437,7 @@ const services = [
|
|
|
4333
4437
|
buildJwtAuthorizedSfapFetchServiceDescriptor(loggerService),
|
|
4334
4438
|
buildCopilotFetchServiceDescriptor(loggerService),
|
|
4335
4439
|
buildServiceDescriptor$b(instrumentationServiceDescriptor.service),
|
|
4336
|
-
buildServiceDescriptor$8(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service),
|
|
4440
|
+
buildServiceDescriptor$8(cacheServiceDescriptor.service, inMemoryCacheInclusionPolicyServiceDescriptor.service, instrumentationServiceDescriptor.service),
|
|
4337
4441
|
buildServiceDescriptor$i(),
|
|
4338
4442
|
buildServiceDescriptor$3(),
|
|
4339
4443
|
buildServiceDescriptor$e(),
|
|
@@ -4352,4 +4456,4 @@ const services = [
|
|
|
4352
4456
|
buildServiceDescriptor$1({}, {}),
|
|
4353
4457
|
];
|
|
4354
4458
|
setServices(services);
|
|
4355
|
-
// version: 1.380.0-
|
|
4459
|
+
// version: 1.380.0-dev22-f437c5b4a5
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-webruntime",
|
|
3
|
-
"version": "1.380.0-
|
|
3
|
+
"version": "1.380.0-dev22",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Webruntime runtime",
|
|
6
6
|
"main": "dist/ldsWebruntimeOneStoreInit.js",
|
|
@@ -35,35 +35,35 @@
|
|
|
35
35
|
"ready": "yarn build && jest --collectCoverage && yarn test:size && yarn release:corejar"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@luvio/service-provisioner": "5.
|
|
39
|
-
"@luvio/tools-core": "5.
|
|
38
|
+
"@luvio/service-provisioner": " 5.60.0-dev4",
|
|
39
|
+
"@luvio/tools-core": " 5.60.0-dev4",
|
|
40
40
|
"jwt-encode": "1.0.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@luvio/command-aura-network": "5.
|
|
44
|
-
"@luvio/command-aura-normalized-cache-control": "5.
|
|
45
|
-
"@luvio/command-aura-resource-cache-control": "5.
|
|
46
|
-
"@luvio/command-fetch-network": "5.
|
|
47
|
-
"@luvio/command-http-normalized-cache-control": "5.
|
|
48
|
-
"@luvio/command-ndjson": "5.
|
|
49
|
-
"@luvio/command-network": "5.
|
|
50
|
-
"@luvio/command-sse": "5.
|
|
51
|
-
"@luvio/command-streaming": "5.
|
|
52
|
-
"@luvio/jwt-manager": "5.
|
|
43
|
+
"@luvio/command-aura-network": " 5.60.0-dev4",
|
|
44
|
+
"@luvio/command-aura-normalized-cache-control": " 5.60.0-dev4",
|
|
45
|
+
"@luvio/command-aura-resource-cache-control": " 5.60.0-dev4",
|
|
46
|
+
"@luvio/command-fetch-network": " 5.60.0-dev4",
|
|
47
|
+
"@luvio/command-http-normalized-cache-control": " 5.60.0-dev4",
|
|
48
|
+
"@luvio/command-ndjson": " 5.60.0-dev4",
|
|
49
|
+
"@luvio/command-network": " 5.60.0-dev4",
|
|
50
|
+
"@luvio/command-sse": " 5.60.0-dev4",
|
|
51
|
+
"@luvio/command-streaming": " 5.60.0-dev4",
|
|
52
|
+
"@luvio/jwt-manager": " 5.60.0-dev4",
|
|
53
53
|
"@luvio/network-adapter-composable": "0.158.7",
|
|
54
54
|
"@luvio/network-adapter-fetch": "0.158.7",
|
|
55
|
-
"@luvio/service-aura-network": "5.
|
|
56
|
-
"@luvio/service-cache": "5.
|
|
57
|
-
"@luvio/service-cache-control": "5.
|
|
58
|
-
"@luvio/service-cache-inclusion-policy": "5.
|
|
59
|
-
"@luvio/service-fetch-network": "5.
|
|
60
|
-
"@luvio/service-instrument-command": "5.
|
|
61
|
-
"@luvio/service-pubsub": "5.
|
|
62
|
-
"@luvio/service-store": "5.
|
|
63
|
-
"@luvio/utils": "5.
|
|
64
|
-
"@salesforce/lds-adapters-uiapi-lex": "^1.380.0-
|
|
65
|
-
"@salesforce/lds-luvio-service": "^1.380.0-
|
|
66
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-
|
|
55
|
+
"@luvio/service-aura-network": " 5.60.0-dev4",
|
|
56
|
+
"@luvio/service-cache": " 5.60.0-dev4",
|
|
57
|
+
"@luvio/service-cache-control": " 5.60.0-dev4",
|
|
58
|
+
"@luvio/service-cache-inclusion-policy": " 5.60.0-dev4",
|
|
59
|
+
"@luvio/service-fetch-network": " 5.60.0-dev4",
|
|
60
|
+
"@luvio/service-instrument-command": " 5.60.0-dev4",
|
|
61
|
+
"@luvio/service-pubsub": " 5.60.0-dev4",
|
|
62
|
+
"@luvio/service-store": " 5.60.0-dev4",
|
|
63
|
+
"@luvio/utils": " 5.60.0-dev4",
|
|
64
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.380.0-dev22",
|
|
65
|
+
"@salesforce/lds-luvio-service": "^1.380.0-dev22",
|
|
66
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-dev22"
|
|
67
67
|
},
|
|
68
68
|
"luvioBundlesize": [
|
|
69
69
|
{
|