@salesforce/lds-runtime-webruntime 1.379.1 → 1.380.0-dev10
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 +261 -116
- 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;
|
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -3280,7 +3393,7 @@ function buildGraphQLInputExtension(input) {
|
|
|
3280
3393
|
};
|
|
3281
3394
|
return prev;
|
|
3282
3395
|
}, {})) || {};
|
|
3283
|
-
const fragments = input.query.definitions.filter(
|
|
3396
|
+
const fragments = input.query.definitions.filter(isFragmentDefinition).reduce((prev, fragment) => {
|
|
3284
3397
|
prev[fragment.name.value] = fragment;
|
|
3285
3398
|
return prev;
|
|
3286
3399
|
}, {});
|
|
@@ -3290,6 +3403,47 @@ function buildGraphQLInputExtension(input) {
|
|
|
3290
3403
|
parentFieldSelection: void 0
|
|
3291
3404
|
});
|
|
3292
3405
|
}
|
|
3406
|
+
const TYPENAME_FIELD = {
|
|
3407
|
+
kind: Kind.FIELD,
|
|
3408
|
+
name: {
|
|
3409
|
+
kind: Kind.NAME,
|
|
3410
|
+
value: "__typename"
|
|
3411
|
+
}
|
|
3412
|
+
};
|
|
3413
|
+
function addTypenameToDocument(doc) {
|
|
3414
|
+
return visit(doc, {
|
|
3415
|
+
SelectionSet: {
|
|
3416
|
+
enter(node, _key, parent) {
|
|
3417
|
+
if (isOperationDefinition(parent)) {
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3420
|
+
const { selections } = node;
|
|
3421
|
+
if (!selections || selections.length === 0) {
|
|
3422
|
+
return;
|
|
3423
|
+
}
|
|
3424
|
+
const skip = selections.some((selection) => {
|
|
3425
|
+
return isField(selection) && (selection.name.value === "__typename" || selection.name.value.lastIndexOf("__", 0) === 0);
|
|
3426
|
+
});
|
|
3427
|
+
if (skip) {
|
|
3428
|
+
return;
|
|
3429
|
+
}
|
|
3430
|
+
return {
|
|
3431
|
+
...node,
|
|
3432
|
+
selections: [...selections, TYPENAME_FIELD]
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
});
|
|
3437
|
+
}
|
|
3438
|
+
function isOperationDefinition(parent) {
|
|
3439
|
+
return !!parent && !Array.isArray(parent) && parent.kind === Kind.OPERATION_DEFINITION;
|
|
3440
|
+
}
|
|
3441
|
+
function isField(node) {
|
|
3442
|
+
return node.kind === Kind.FIELD;
|
|
3443
|
+
}
|
|
3444
|
+
function isFragmentDefinition(node) {
|
|
3445
|
+
return node.kind === Kind.FRAGMENT_DEFINITION;
|
|
3446
|
+
}
|
|
3293
3447
|
|
|
3294
3448
|
/*!
|
|
3295
3449
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3391,29 +3545,29 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
3391
3545
|
),
|
|
3392
3546
|
(errs) => this.coerceError(errs)
|
|
3393
3547
|
).then((result) => {
|
|
3394
|
-
|
|
3395
|
-
return this.constructSubscribableResult(result.value);
|
|
3396
|
-
}
|
|
3397
|
-
return result;
|
|
3548
|
+
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
3398
3549
|
});
|
|
3399
3550
|
} else if (this.shouldUseFetch()) {
|
|
3400
3551
|
return this.convertFetchResponseToData(
|
|
3401
3552
|
this.services.fetch(...this.originalFetchParams)
|
|
3402
3553
|
).then((result) => {
|
|
3403
|
-
|
|
3404
|
-
return this.constructSubscribableResult(result.value);
|
|
3405
|
-
}
|
|
3406
|
-
return result;
|
|
3554
|
+
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
3407
3555
|
});
|
|
3408
3556
|
}
|
|
3409
|
-
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
|
+
);
|
|
3410
3564
|
}
|
|
3411
3565
|
buildRequestQuery() {
|
|
3412
3566
|
const augmentedQueryResult = this.documentRootType.buildAugmentedQuery(this.config);
|
|
3413
3567
|
if (augmentedQueryResult.isErr()) {
|
|
3414
3568
|
throw augmentedQueryResult.error;
|
|
3415
3569
|
}
|
|
3416
|
-
return augmentedQueryResult.value;
|
|
3570
|
+
return addTypenameToDocument(augmentedQueryResult.value);
|
|
3417
3571
|
}
|
|
3418
3572
|
buildWriteInput(data) {
|
|
3419
3573
|
const extensionResult = buildGraphQLInputExtension({
|
|
@@ -3435,9 +3589,6 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
3435
3589
|
if (this.subscriptions.length > 0) {
|
|
3436
3590
|
this.subscribeToKeysUsed();
|
|
3437
3591
|
}
|
|
3438
|
-
if (this.lastEmittedData === void 0) {
|
|
3439
|
-
this.lastEmittedData = returnData.value.data;
|
|
3440
|
-
}
|
|
3441
3592
|
return returnData;
|
|
3442
3593
|
});
|
|
3443
3594
|
}
|
|
@@ -3507,7 +3658,7 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
3507
3658
|
if (augmentedQueryResult.isErr()) {
|
|
3508
3659
|
throw augmentedQueryResult.error;
|
|
3509
3660
|
}
|
|
3510
|
-
return augmentedQueryResult.value;
|
|
3661
|
+
return addTypenameToDocument(augmentedQueryResult.value);
|
|
3511
3662
|
}
|
|
3512
3663
|
buildWriteInput(data) {
|
|
3513
3664
|
const extensionResult = buildGraphQLInputExtension({
|
|
@@ -3529,10 +3680,7 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
3529
3680
|
return this.convertFetchResponseToData(
|
|
3530
3681
|
this.services.fetch(...this.originalFetchParams)
|
|
3531
3682
|
).then((result) => {
|
|
3532
|
-
|
|
3533
|
-
return this.constructSubscribableResult(result.value);
|
|
3534
|
-
}
|
|
3535
|
-
return result;
|
|
3683
|
+
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
3536
3684
|
});
|
|
3537
3685
|
}
|
|
3538
3686
|
// Any changes to this method should most likely be duplicated in the aura command as well
|
|
@@ -3545,9 +3693,6 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
3545
3693
|
if (this.subscriptions.length > 0) {
|
|
3546
3694
|
this.subscribeToKeysUsed();
|
|
3547
3695
|
}
|
|
3548
|
-
if (this.lastEmittedData === void 0) {
|
|
3549
|
-
this.lastEmittedData = returnData.value.data;
|
|
3550
|
-
}
|
|
3551
3696
|
return returnData;
|
|
3552
3697
|
});
|
|
3553
3698
|
}
|
|
@@ -3665,7 +3810,7 @@ function buildServiceDescriptor$2(luvio) {
|
|
|
3665
3810
|
},
|
|
3666
3811
|
};
|
|
3667
3812
|
}
|
|
3668
|
-
// version: 1.
|
|
3813
|
+
// version: 1.380.0-dev10-0a2876c461
|
|
3669
3814
|
|
|
3670
3815
|
/**
|
|
3671
3816
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3691,7 +3836,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
3691
3836
|
},
|
|
3692
3837
|
};
|
|
3693
3838
|
}
|
|
3694
|
-
// version: 1.
|
|
3839
|
+
// version: 1.380.0-dev10-0a2876c461
|
|
3695
3840
|
|
|
3696
3841
|
/*!
|
|
3697
3842
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -3723,12 +3868,12 @@ function t(e2) {
|
|
|
3723
3868
|
throw "Illegal base64url string!";
|
|
3724
3869
|
}
|
|
3725
3870
|
try {
|
|
3726
|
-
return function(e3) {
|
|
3727
|
-
return decodeURIComponent(r(e3).replace(/(.)/g, function(e4, r2) {
|
|
3871
|
+
return (function(e3) {
|
|
3872
|
+
return decodeURIComponent(r(e3).replace(/(.)/g, (function(e4, r2) {
|
|
3728
3873
|
var t3 = r2.charCodeAt(0).toString(16).toUpperCase();
|
|
3729
3874
|
return t3.length < 2 && (t3 = "0" + t3), "%" + t3;
|
|
3730
|
-
}));
|
|
3731
|
-
}(t2);
|
|
3875
|
+
})));
|
|
3876
|
+
})(t2);
|
|
3732
3877
|
} catch (e3) {
|
|
3733
3878
|
return r(t2);
|
|
3734
3879
|
}
|
|
@@ -4311,4 +4456,4 @@ const services = [
|
|
|
4311
4456
|
buildServiceDescriptor$1({}, {}),
|
|
4312
4457
|
];
|
|
4313
4458
|
setServices(services);
|
|
4314
|
-
// version: 1.
|
|
4459
|
+
// version: 1.380.0-dev10-215164b7de
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-webruntime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.380.0-dev10",
|
|
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-dev2",
|
|
39
|
+
"@luvio/tools-core": " 5.60.0-dev2",
|
|
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-dev2",
|
|
44
|
+
"@luvio/command-aura-normalized-cache-control": " 5.60.0-dev2",
|
|
45
|
+
"@luvio/command-aura-resource-cache-control": " 5.60.0-dev2",
|
|
46
|
+
"@luvio/command-fetch-network": " 5.60.0-dev2",
|
|
47
|
+
"@luvio/command-http-normalized-cache-control": " 5.60.0-dev2",
|
|
48
|
+
"@luvio/command-ndjson": " 5.60.0-dev2",
|
|
49
|
+
"@luvio/command-network": " 5.60.0-dev2",
|
|
50
|
+
"@luvio/command-sse": " 5.60.0-dev2",
|
|
51
|
+
"@luvio/command-streaming": " 5.60.0-dev2",
|
|
52
|
+
"@luvio/jwt-manager": " 5.60.0-dev2",
|
|
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.
|
|
65
|
-
"@salesforce/lds-luvio-service": "^1.
|
|
66
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.
|
|
55
|
+
"@luvio/service-aura-network": " 5.60.0-dev2",
|
|
56
|
+
"@luvio/service-cache": " 5.60.0-dev2",
|
|
57
|
+
"@luvio/service-cache-control": " 5.60.0-dev2",
|
|
58
|
+
"@luvio/service-cache-inclusion-policy": " 5.60.0-dev2",
|
|
59
|
+
"@luvio/service-fetch-network": " 5.60.0-dev2",
|
|
60
|
+
"@luvio/service-instrument-command": " 5.60.0-dev2",
|
|
61
|
+
"@luvio/service-pubsub": " 5.60.0-dev2",
|
|
62
|
+
"@luvio/service-store": " 5.60.0-dev2",
|
|
63
|
+
"@luvio/utils": " 5.60.0-dev2",
|
|
64
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.380.0-dev10",
|
|
65
|
+
"@salesforce/lds-luvio-service": "^1.380.0-dev10",
|
|
66
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-dev10"
|
|
67
67
|
},
|
|
68
68
|
"luvioBundlesize": [
|
|
69
69
|
{
|