@salesforce/lds-runtime-aura 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/ldsEngineCreator.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* *******************************************************************************************
|
|
13
13
|
*/
|
|
14
14
|
/* proxy-compat-disable */
|
|
15
|
-
import { HttpStatusCode as HttpStatusCode$
|
|
15
|
+
import { HttpStatusCode as HttpStatusCode$2, InMemoryStore, Environment, Luvio, InMemoryStoreQueryEvaluator } from 'force/luvioEngine';
|
|
16
16
|
import ldsTrackedFieldsBehaviorGate from '@salesforce/gate/lds.useNewTrackedFieldBehavior';
|
|
17
17
|
import usePredictiveLoading from '@salesforce/gate/lds.usePredictiveLoading';
|
|
18
18
|
import useApexPredictions from '@salesforce/gate/lds.pdl.useApexPredictions';
|
|
@@ -25,7 +25,7 @@ import useOneStoreGraphql from '@salesforce/gate/lds.oneStoreGraphqlEnabled.ltng
|
|
|
25
25
|
import { GetApexWireAdapterFactory, registerPrefetcher as registerPrefetcher$1 } from 'force/ldsAdaptersApex';
|
|
26
26
|
import { getRecordAvatarsAdapterFactory, getRecordAdapterFactory, coerceFieldIdArray, getRecordsAdapterFactory, getRecordActionsAdapterFactory, getObjectInfosAdapterFactory, coerceObjectIdArray, getObjectInfoAdapterFactory, coerceObjectId, getRelatedListsActionsAdapterFactory, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoAdapterFactory, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsAdapterFactory, getListInfoByNameAdapterFactory, getListInfosByObjectNameAdapterFactory, getListRecordsByNameAdapterFactory, getListObjectInfoAdapterFactory, getRelatedListsInfoAdapterFactory, getRelatedListActionsAdapterFactory, getRecordId18Array, instrument, buildRecordRepKeyFromId, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType, registerPrefetcher, RecordRepresentationVersion } from 'force/ldsAdaptersUiapi';
|
|
27
27
|
import { getInstrumentation } from 'o11y/client';
|
|
28
|
-
import { buildGraphQLInputExtension } from 'force/luvioGraphqlNormalization';
|
|
28
|
+
import { buildGraphQLInputExtension, addTypenameToDocument } from 'force/luvioGraphqlNormalization';
|
|
29
29
|
import { print } from 'force/luvioOnestoreGraphqlParser';
|
|
30
30
|
import { setServices } from 'force/luvioServiceProvisioner1';
|
|
31
31
|
import { unstable_loadComponentDefs, executeGlobalControllerRawResponse } from 'aura';
|
|
@@ -109,18 +109,24 @@ let Err$1 = class Err {
|
|
|
109
109
|
};
|
|
110
110
|
const ok$2 = (value) => new Ok$2(value);
|
|
111
111
|
const err$1 = (err2) => new Err$1(err2);
|
|
112
|
+
function isResult(value) {
|
|
113
|
+
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);
|
|
114
|
+
}
|
|
115
|
+
function isSubscribable(obj) {
|
|
116
|
+
return typeof obj === "object" && obj !== null && "subscribe" in obj && typeof obj.subscribe === "function" && "refresh" in obj && typeof obj.refresh === "function";
|
|
117
|
+
}
|
|
112
118
|
function isSubscribableResult(x) {
|
|
113
|
-
if (
|
|
119
|
+
if (!isResult(x)) {
|
|
114
120
|
return false;
|
|
115
121
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
return isSubscribable(x.isOk() ? x.value : x.error);
|
|
123
|
+
}
|
|
124
|
+
function buildSubscribableResult$1(result, subscribe, refresh) {
|
|
125
|
+
if (result.isOk()) {
|
|
126
|
+
return ok$2({ data: result.value, subscribe, refresh });
|
|
127
|
+
} else {
|
|
128
|
+
return err$1({ failure: result.error, subscribe, refresh });
|
|
122
129
|
}
|
|
123
|
-
return false;
|
|
124
130
|
}
|
|
125
131
|
function resolvedPromiseLike$3(result) {
|
|
126
132
|
if (isPromiseLike$3(result)) {
|
|
@@ -208,6 +214,47 @@ function toError(x) {
|
|
|
208
214
|
}
|
|
209
215
|
return new Error(typeof x === "string" ? x : JSON.stringify(x));
|
|
210
216
|
}
|
|
217
|
+
var HttpStatusCode$1 = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
218
|
+
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
219
|
+
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
220
|
+
HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
|
|
221
|
+
HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
|
|
222
|
+
HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
|
|
223
|
+
HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
|
|
224
|
+
HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
|
|
225
|
+
HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
|
|
226
|
+
HttpStatusCode2[HttpStatusCode2["ServerError"] = 500] = "ServerError";
|
|
227
|
+
HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
228
|
+
return HttpStatusCode2;
|
|
229
|
+
})(HttpStatusCode$1 || {});
|
|
230
|
+
function getStatusText(status) {
|
|
231
|
+
switch (status) {
|
|
232
|
+
case 200:
|
|
233
|
+
return "OK";
|
|
234
|
+
case 201:
|
|
235
|
+
return "Created";
|
|
236
|
+
case 304:
|
|
237
|
+
return "Not Modified";
|
|
238
|
+
case 400:
|
|
239
|
+
return "Bad Request";
|
|
240
|
+
case 404:
|
|
241
|
+
return "Not Found";
|
|
242
|
+
case 500:
|
|
243
|
+
return "Server Error";
|
|
244
|
+
default:
|
|
245
|
+
return `Unexpected HTTP Status Code: ${status}`;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
class FetchResponse extends Error {
|
|
249
|
+
constructor(status, body, headers) {
|
|
250
|
+
super();
|
|
251
|
+
this.status = status;
|
|
252
|
+
this.body = body;
|
|
253
|
+
this.headers = headers || {};
|
|
254
|
+
this.ok = status >= 200 && this.status <= 299;
|
|
255
|
+
this.statusText = getStatusText(status);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
211
258
|
class InternalError extends Error {
|
|
212
259
|
constructor(data) {
|
|
213
260
|
super();
|
|
@@ -252,35 +299,27 @@ let NetworkCommand$1 = class NetworkCommand extends BaseCommand {
|
|
|
252
299
|
}
|
|
253
300
|
fetchSubscribableResult(res) {
|
|
254
301
|
return res.then((networkResult) => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
};
|
|
266
|
-
},
|
|
267
|
-
refresh: () => this.refresh()
|
|
268
|
-
});
|
|
269
|
-
}
|
|
302
|
+
return buildSubscribableResult$1(
|
|
303
|
+
networkResult,
|
|
304
|
+
(cb) => {
|
|
305
|
+
this.subscriptions.push(cb);
|
|
306
|
+
return () => {
|
|
307
|
+
this.subscriptions = this.subscriptions.filter((cb2) => cb2 !== cb);
|
|
308
|
+
};
|
|
309
|
+
},
|
|
310
|
+
() => this.refresh()
|
|
311
|
+
);
|
|
270
312
|
});
|
|
271
313
|
}
|
|
272
314
|
refresh() {
|
|
273
315
|
return this.execute().then((newResult) => {
|
|
274
|
-
if (newResult
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
return ok$2(void 0);
|
|
316
|
+
if (isSubscribableResult(newResult)) {
|
|
317
|
+
const value = newResult.isOk() ? ok$2(newResult.value.data) : err$1(newResult.error.failure);
|
|
318
|
+
this.subscriptions.forEach((cb) => {
|
|
319
|
+
cb(value);
|
|
320
|
+
});
|
|
282
321
|
}
|
|
283
|
-
return
|
|
322
|
+
return ok$2(void 0);
|
|
284
323
|
});
|
|
285
324
|
}
|
|
286
325
|
async afterRequestHooks(_options) {
|
|
@@ -431,6 +470,13 @@ class Err {
|
|
|
431
470
|
}
|
|
432
471
|
const ok$1 = (value) => new Ok$1(value);
|
|
433
472
|
const err = (err2) => new Err(err2);
|
|
473
|
+
function buildSubscribableResult(result, subscribe, refresh) {
|
|
474
|
+
if (result.isOk()) {
|
|
475
|
+
return ok$1({ data: result.value, subscribe, refresh });
|
|
476
|
+
} else {
|
|
477
|
+
return err({ failure: result.error, subscribe, refresh });
|
|
478
|
+
}
|
|
479
|
+
}
|
|
434
480
|
function resolvedPromiseLike$2(result) {
|
|
435
481
|
if (isPromiseLike$2(result)) {
|
|
436
482
|
return result.then((nextResult) => nextResult);
|
|
@@ -530,7 +576,7 @@ class CacheControlRequestRunner {
|
|
|
530
576
|
const resultPromise = this.readFromCacheInternal(cache);
|
|
531
577
|
return resultPromise.then((result) => {
|
|
532
578
|
if (result.isErr()) {
|
|
533
|
-
return err(result.error);
|
|
579
|
+
return err(result.error.failure);
|
|
534
580
|
}
|
|
535
581
|
this.returnData = result;
|
|
536
582
|
return ok$1(void 0);
|
|
@@ -538,7 +584,7 @@ class CacheControlRequestRunner {
|
|
|
538
584
|
}
|
|
539
585
|
requestFromNetwork() {
|
|
540
586
|
const that = this;
|
|
541
|
-
return async function* () {
|
|
587
|
+
return (async function* () {
|
|
542
588
|
const result = await that.requestFromNetworkInternal();
|
|
543
589
|
if (result.isErr()) {
|
|
544
590
|
that.networkError = result;
|
|
@@ -546,7 +592,7 @@ class CacheControlRequestRunner {
|
|
|
546
592
|
that.networkData = result;
|
|
547
593
|
}
|
|
548
594
|
yield result;
|
|
549
|
-
}();
|
|
595
|
+
})();
|
|
550
596
|
}
|
|
551
597
|
writeToCache(cache, networkResult) {
|
|
552
598
|
return this.writeToCacheInternal(cache, networkResult);
|
|
@@ -559,7 +605,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
559
605
|
this.keysUsed = /* @__PURE__ */ new Set();
|
|
560
606
|
this.keysUpdated = void 0;
|
|
561
607
|
this.operationType = "query";
|
|
562
|
-
this.
|
|
608
|
+
this.lastResult = void 0;
|
|
563
609
|
this.unsubscribeFromKeysImpl = () => void 0;
|
|
564
610
|
this.subscriptions = [];
|
|
565
611
|
this.instantiationTime = Date.now() / 1e3;
|
|
@@ -576,32 +622,54 @@ class CacheControlCommand extends BaseCommand {
|
|
|
576
622
|
instrumentationAttributes: this.instrumentationAttributes
|
|
577
623
|
});
|
|
578
624
|
return resultPromise.then((result) => {
|
|
579
|
-
return this.handleCacheControllerResult(result, requestRunner)
|
|
625
|
+
return this.handleCacheControllerResult(result, requestRunner).then((result2) => {
|
|
626
|
+
if (this.lastResult === void 0) {
|
|
627
|
+
if (result2.isErr()) {
|
|
628
|
+
this.lastResult = { type: "error", error: result2.error.failure };
|
|
629
|
+
} else {
|
|
630
|
+
this.lastResult = { type: "data", data: result2.value.data };
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return result2;
|
|
634
|
+
});
|
|
580
635
|
});
|
|
581
636
|
}
|
|
582
637
|
handleCacheControllerResult(result, requestRunner) {
|
|
583
638
|
const { networkError, networkData, returnData } = requestRunner;
|
|
584
639
|
return this.publishUpdatedKeys().then(() => {
|
|
585
640
|
if (networkError) {
|
|
586
|
-
return
|
|
641
|
+
return buildSubscribableResult(
|
|
642
|
+
networkError,
|
|
643
|
+
this.buildSubscribe(),
|
|
644
|
+
() => this.refresh()
|
|
645
|
+
);
|
|
587
646
|
}
|
|
588
647
|
if (result.isErr()) {
|
|
589
648
|
if (networkData) {
|
|
590
|
-
return
|
|
649
|
+
return buildSubscribableResult(
|
|
650
|
+
networkData,
|
|
651
|
+
this.buildSubscribe(),
|
|
652
|
+
() => this.refresh()
|
|
653
|
+
);
|
|
591
654
|
}
|
|
592
|
-
return
|
|
655
|
+
return buildSubscribableResult(result, this.buildSubscribe(), () => this.refresh());
|
|
593
656
|
}
|
|
594
657
|
if (this.subscriptions.length > 0) {
|
|
595
658
|
this.subscribeToKeysUsed();
|
|
596
659
|
}
|
|
597
660
|
if (returnData === void 0) {
|
|
598
661
|
if (networkData) {
|
|
599
|
-
return
|
|
662
|
+
return buildSubscribableResult(
|
|
663
|
+
networkData,
|
|
664
|
+
this.buildSubscribe(),
|
|
665
|
+
() => this.refresh()
|
|
666
|
+
);
|
|
600
667
|
}
|
|
601
|
-
return
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
668
|
+
return buildSubscribableResult(
|
|
669
|
+
err(new Error("Cache miss after fetching from network")),
|
|
670
|
+
this.buildSubscribe(),
|
|
671
|
+
() => this.refresh()
|
|
672
|
+
);
|
|
605
673
|
}
|
|
606
674
|
return returnData;
|
|
607
675
|
});
|
|
@@ -661,7 +729,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
661
729
|
refresh() {
|
|
662
730
|
return this.rerun({ cacheControlConfig: { type: "no-cache" } }).then((result) => {
|
|
663
731
|
if (result.isErr()) {
|
|
664
|
-
return err(result.error);
|
|
732
|
+
return err(result.error.failure);
|
|
665
733
|
}
|
|
666
734
|
return ok$1(void 0);
|
|
667
735
|
});
|
|
@@ -679,22 +747,22 @@ class CacheControlCommand extends BaseCommand {
|
|
|
679
747
|
const result = this.readFromCache(recordableCache);
|
|
680
748
|
return result.then((readResult) => {
|
|
681
749
|
if (readResult.isErr()) {
|
|
682
|
-
return
|
|
750
|
+
return buildSubscribableResult(
|
|
751
|
+
readResult,
|
|
752
|
+
this.buildSubscribe(),
|
|
753
|
+
() => this.refresh()
|
|
754
|
+
);
|
|
683
755
|
} else {
|
|
684
756
|
const data = readResult.value;
|
|
685
757
|
this.keysUsed = recordableCache.keysRead;
|
|
686
|
-
return
|
|
758
|
+
return buildSubscribableResult(
|
|
759
|
+
ok$1(data),
|
|
760
|
+
this.buildSubscribe(),
|
|
761
|
+
() => this.refresh()
|
|
762
|
+
);
|
|
687
763
|
}
|
|
688
764
|
});
|
|
689
765
|
}
|
|
690
|
-
constructSubscribableResult(data) {
|
|
691
|
-
return ok$1({
|
|
692
|
-
data,
|
|
693
|
-
// this cast is in case we need to return Network data as a fallback for caching errors
|
|
694
|
-
subscribe: this.buildSubscribe(),
|
|
695
|
-
refresh: () => this.refresh()
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
766
|
/**
|
|
699
767
|
* Builds a function that subscribes to cache changes via the pubsub service. Whenever
|
|
700
768
|
* relevant cache updates occur, it re-reads the data and compares it against
|
|
@@ -706,7 +774,7 @@ class CacheControlCommand extends BaseCommand {
|
|
|
706
774
|
*/
|
|
707
775
|
buildSubscribe() {
|
|
708
776
|
return (consumerCallback) => {
|
|
709
|
-
if (this.subscriptions.length === 0 && this.operationType === "query") {
|
|
777
|
+
if (this.subscriptions.length === 0 && (this.operationType === "query" || this.operationType === "graphql")) {
|
|
710
778
|
this.subscribeToKeysUsed();
|
|
711
779
|
}
|
|
712
780
|
this.subscriptions.push(consumerCallback);
|
|
@@ -721,11 +789,12 @@ class CacheControlCommand extends BaseCommand {
|
|
|
721
789
|
rerun(overrides) {
|
|
722
790
|
return this.execute(overrides).then((result) => {
|
|
723
791
|
if (result.isErr()) {
|
|
724
|
-
this.
|
|
792
|
+
this.lastResult = { type: "error", error: result.error.failure };
|
|
793
|
+
this.invokeConsumerCallbacks(err(result.error.failure));
|
|
725
794
|
return result;
|
|
726
795
|
}
|
|
727
|
-
if (!this.equals(this.
|
|
728
|
-
this.
|
|
796
|
+
if (this.lastResult === void 0 || this.lastResult.type === "error" || !this.equals(this.lastResult.data, result.value.data)) {
|
|
797
|
+
this.lastResult = { type: "data", data: result.value.data };
|
|
729
798
|
this.invokeConsumerCallbacks(ok$1(result.value.data));
|
|
730
799
|
}
|
|
731
800
|
return result;
|
|
@@ -869,9 +938,6 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand$1 {
|
|
|
869
938
|
super(services);
|
|
870
939
|
this.services = services;
|
|
871
940
|
}
|
|
872
|
-
execute() {
|
|
873
|
-
return super.execute();
|
|
874
|
-
}
|
|
875
941
|
readFromCache(cache) {
|
|
876
942
|
var _a;
|
|
877
943
|
const data = (_a = cache.get(this.buildKey())) == null ? void 0 : _a.value;
|
|
@@ -1157,35 +1223,27 @@ class NetworkCommand extends BaseCommand {
|
|
|
1157
1223
|
}
|
|
1158
1224
|
fetchSubscribableResult(res) {
|
|
1159
1225
|
return res.then((networkResult) => {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
};
|
|
1171
|
-
},
|
|
1172
|
-
refresh: () => this.refresh()
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1226
|
+
return buildSubscribableResult$1(
|
|
1227
|
+
networkResult,
|
|
1228
|
+
(cb) => {
|
|
1229
|
+
this.subscriptions.push(cb);
|
|
1230
|
+
return () => {
|
|
1231
|
+
this.subscriptions = this.subscriptions.filter((cb2) => cb2 !== cb);
|
|
1232
|
+
};
|
|
1233
|
+
},
|
|
1234
|
+
() => this.refresh()
|
|
1235
|
+
);
|
|
1175
1236
|
});
|
|
1176
1237
|
}
|
|
1177
1238
|
refresh() {
|
|
1178
1239
|
return this.execute().then((newResult) => {
|
|
1179
|
-
if (newResult
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
});
|
|
1185
|
-
}
|
|
1186
|
-
return ok$2(void 0);
|
|
1240
|
+
if (isSubscribableResult(newResult)) {
|
|
1241
|
+
const value = newResult.isOk() ? ok$2(newResult.value.data) : err$1(newResult.error.failure);
|
|
1242
|
+
this.subscriptions.forEach((cb) => {
|
|
1243
|
+
cb(value);
|
|
1244
|
+
});
|
|
1187
1245
|
}
|
|
1188
|
-
return
|
|
1246
|
+
return ok$2(void 0);
|
|
1189
1247
|
});
|
|
1190
1248
|
}
|
|
1191
1249
|
async afterRequestHooks(_options) {
|
|
@@ -2055,6 +2113,59 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
2055
2113
|
];
|
|
2056
2114
|
}
|
|
2057
2115
|
}
|
|
2116
|
+
class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
2117
|
+
execute(options) {
|
|
2118
|
+
const startTime = this.services.instrumentation ? this.services.instrumentation.currentTimeMs() : 0;
|
|
2119
|
+
return this.services.cacheInclusionPolicy.read({
|
|
2120
|
+
l1: this.filteredCache,
|
|
2121
|
+
readFromL1: (l1) => this.requestRunner.readFromCache(l1)
|
|
2122
|
+
}).then((result) => {
|
|
2123
|
+
if (result.isOk()) {
|
|
2124
|
+
this.collectCacheHitInstrumentation(
|
|
2125
|
+
startTime,
|
|
2126
|
+
options == null ? void 0 : options.instrumentationAttributes
|
|
2127
|
+
);
|
|
2128
|
+
return ok$2(void 0);
|
|
2129
|
+
}
|
|
2130
|
+
this.collectCacheMissInstrumentation(startTime, options == null ? void 0 : options.instrumentationAttributes);
|
|
2131
|
+
const error = new UserVisibleError(
|
|
2132
|
+
new FetchResponse(HttpStatusCode$1.GatewayTimeout, {
|
|
2133
|
+
error: "Cache miss for only-if-cached request"
|
|
2134
|
+
})
|
|
2135
|
+
);
|
|
2136
|
+
return err$1(error);
|
|
2137
|
+
});
|
|
2138
|
+
}
|
|
2139
|
+
get expiredChecks() {
|
|
2140
|
+
return [
|
|
2141
|
+
(cacheControlMetadata) => cacheControlMetadata.type === "no-store"
|
|
2142
|
+
];
|
|
2143
|
+
}
|
|
2144
|
+
collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
|
|
2145
|
+
if (this.services.instrumentation) {
|
|
2146
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
2147
|
+
meter.createCounter(`command.only-if-cached.cache-hit.count`).add(1, instrumentationAttributes);
|
|
2148
|
+
meter.createHistogram(
|
|
2149
|
+
`command.only-if-cached.cache-hit.duration`
|
|
2150
|
+
).record(
|
|
2151
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
2152
|
+
instrumentationAttributes
|
|
2153
|
+
);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
collectCacheMissInstrumentation(startTime, instrumentationAttributes) {
|
|
2157
|
+
if (this.services.instrumentation) {
|
|
2158
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
2159
|
+
meter.createCounter(`command.only-if-cached.cache-miss.count`).add(1, instrumentationAttributes);
|
|
2160
|
+
meter.createHistogram(
|
|
2161
|
+
`command.only-if-cached.cache-miss.duration`
|
|
2162
|
+
).record(
|
|
2163
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
2164
|
+
instrumentationAttributes
|
|
2165
|
+
);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2058
2169
|
class CacheController {
|
|
2059
2170
|
constructor(services) {
|
|
2060
2171
|
this.services = services;
|
|
@@ -2068,6 +2179,8 @@ class CacheController {
|
|
|
2068
2179
|
return new MaxAgeCacheControlStrategy(this.services, config, requestRunner);
|
|
2069
2180
|
} else if (config.type === "no-cache") {
|
|
2070
2181
|
return new NoCacheCacheControlStrategy(this.services, config, requestRunner);
|
|
2182
|
+
} else if (config.type === "only-if-cached") {
|
|
2183
|
+
return new OnlyIfCachedCacheControlStrategy(this.services, config, requestRunner);
|
|
2071
2184
|
}
|
|
2072
2185
|
throw new Error(`Unknown cache control strategy ${config.type}`);
|
|
2073
2186
|
}
|
|
@@ -2309,7 +2422,7 @@ function buildServiceDescriptor$5(luvio) {
|
|
|
2309
2422
|
},
|
|
2310
2423
|
};
|
|
2311
2424
|
}
|
|
2312
|
-
// version: 1.
|
|
2425
|
+
// version: 1.380.0-dev10-0a2876c461
|
|
2313
2426
|
|
|
2314
2427
|
/*!
|
|
2315
2428
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -2411,29 +2524,29 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2411
2524
|
),
|
|
2412
2525
|
(errs) => this.coerceError(errs)
|
|
2413
2526
|
).then((result) => {
|
|
2414
|
-
|
|
2415
|
-
return this.constructSubscribableResult(result.value);
|
|
2416
|
-
}
|
|
2417
|
-
return result;
|
|
2527
|
+
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
2418
2528
|
});
|
|
2419
2529
|
} else if (this.shouldUseFetch()) {
|
|
2420
2530
|
return this.convertFetchResponseToData(
|
|
2421
2531
|
this.services.fetch(...this.originalFetchParams)
|
|
2422
2532
|
).then((result) => {
|
|
2423
|
-
|
|
2424
|
-
return this.constructSubscribableResult(result.value);
|
|
2425
|
-
}
|
|
2426
|
-
return result;
|
|
2533
|
+
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
2427
2534
|
});
|
|
2428
2535
|
}
|
|
2429
|
-
return resolvedPromiseLike$3(
|
|
2536
|
+
return resolvedPromiseLike$3(
|
|
2537
|
+
buildSubscribableResult$1(
|
|
2538
|
+
err$1(toError("Aura/Fetch network services not found")),
|
|
2539
|
+
this.buildSubscribe(),
|
|
2540
|
+
() => this.refresh()
|
|
2541
|
+
)
|
|
2542
|
+
);
|
|
2430
2543
|
}
|
|
2431
2544
|
buildRequestQuery() {
|
|
2432
2545
|
const augmentedQueryResult = this.documentRootType.buildAugmentedQuery(this.config);
|
|
2433
2546
|
if (augmentedQueryResult.isErr()) {
|
|
2434
2547
|
throw augmentedQueryResult.error;
|
|
2435
2548
|
}
|
|
2436
|
-
return augmentedQueryResult.value;
|
|
2549
|
+
return addTypenameToDocument(augmentedQueryResult.value);
|
|
2437
2550
|
}
|
|
2438
2551
|
buildWriteInput(data) {
|
|
2439
2552
|
const extensionResult = buildGraphQLInputExtension({
|
|
@@ -2455,9 +2568,6 @@ class AuraGraphQLNormalizedCacheControlCommand extends AuraNormalizedCacheContro
|
|
|
2455
2568
|
if (this.subscriptions.length > 0) {
|
|
2456
2569
|
this.subscribeToKeysUsed();
|
|
2457
2570
|
}
|
|
2458
|
-
if (this.lastEmittedData === void 0) {
|
|
2459
|
-
this.lastEmittedData = returnData.value.data;
|
|
2460
|
-
}
|
|
2461
2571
|
return returnData;
|
|
2462
2572
|
});
|
|
2463
2573
|
}
|
|
@@ -2527,7 +2637,7 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
2527
2637
|
if (augmentedQueryResult.isErr()) {
|
|
2528
2638
|
throw augmentedQueryResult.error;
|
|
2529
2639
|
}
|
|
2530
|
-
return augmentedQueryResult.value;
|
|
2640
|
+
return addTypenameToDocument(augmentedQueryResult.value);
|
|
2531
2641
|
}
|
|
2532
2642
|
buildWriteInput(data) {
|
|
2533
2643
|
const extensionResult = buildGraphQLInputExtension({
|
|
@@ -2549,10 +2659,7 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
2549
2659
|
return this.convertFetchResponseToData(
|
|
2550
2660
|
this.services.fetch(...this.originalFetchParams)
|
|
2551
2661
|
).then((result) => {
|
|
2552
|
-
|
|
2553
|
-
return this.constructSubscribableResult(result.value);
|
|
2554
|
-
}
|
|
2555
|
-
return result;
|
|
2662
|
+
return buildSubscribableResult$1(result, this.buildSubscribe(), () => this.refresh());
|
|
2556
2663
|
});
|
|
2557
2664
|
}
|
|
2558
2665
|
// Any changes to this method should most likely be duplicated in the aura command as well
|
|
@@ -2565,9 +2672,6 @@ class HttpGraphQLNormalizedCacheControlCommand extends HttpNormalizedCacheContro
|
|
|
2565
2672
|
if (this.subscriptions.length > 0) {
|
|
2566
2673
|
this.subscribeToKeysUsed();
|
|
2567
2674
|
}
|
|
2568
|
-
if (this.lastEmittedData === void 0) {
|
|
2569
|
-
this.lastEmittedData = returnData.value.data;
|
|
2570
|
-
}
|
|
2571
2675
|
return returnData;
|
|
2572
2676
|
});
|
|
2573
2677
|
}
|
|
@@ -2628,7 +2732,7 @@ function buildServiceDescriptor$1(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
2628
2732
|
},
|
|
2629
2733
|
};
|
|
2630
2734
|
}
|
|
2631
|
-
// version: 1.
|
|
2735
|
+
// version: 1.380.0-dev10-0a2876c461
|
|
2632
2736
|
|
|
2633
2737
|
/*!
|
|
2634
2738
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -2660,12 +2764,12 @@ function t(e2) {
|
|
|
2660
2764
|
throw "Illegal base64url string!";
|
|
2661
2765
|
}
|
|
2662
2766
|
try {
|
|
2663
|
-
return function(e3) {
|
|
2664
|
-
return decodeURIComponent(r(e3).replace(/(.)/g, function(e4, r2) {
|
|
2767
|
+
return (function(e3) {
|
|
2768
|
+
return decodeURIComponent(r(e3).replace(/(.)/g, (function(e4, r2) {
|
|
2665
2769
|
var t3 = r2.charCodeAt(0).toString(16).toUpperCase();
|
|
2666
2770
|
return t3.length < 2 && (t3 = "0" + t3), "%" + t3;
|
|
2667
|
-
}));
|
|
2668
|
-
}(t2);
|
|
2771
|
+
})));
|
|
2772
|
+
})(t2);
|
|
2669
2773
|
} catch (e3) {
|
|
2670
2774
|
return r(t2);
|
|
2671
2775
|
}
|
|
@@ -3268,7 +3372,7 @@ const platformSfapJwtResolver = {
|
|
|
3268
3372
|
}
|
|
3269
3373
|
// AuraFetchResponse errors
|
|
3270
3374
|
const { status } = error;
|
|
3271
|
-
if (status !== HttpStatusCode$
|
|
3375
|
+
if (status !== HttpStatusCode$2.ServerError) {
|
|
3272
3376
|
// ConnectInJavaError
|
|
3273
3377
|
reject(error.body.message);
|
|
3274
3378
|
return;
|
|
@@ -4722,6 +4826,14 @@ class GetListInfosByObjectNameRequestStrategy extends LuvioAdapterRequestStrateg
|
|
|
4722
4826
|
}
|
|
4723
4827
|
|
|
4724
4828
|
const GET_LIST_RECORDS_BY_NAME_ADAPTER_NAME = 'getListRecordsByName';
|
|
4829
|
+
function arrEq(array1, array2) {
|
|
4830
|
+
if (array1.length !== array2.length) {
|
|
4831
|
+
return false;
|
|
4832
|
+
}
|
|
4833
|
+
const sortedArray1 = [...array1].sort();
|
|
4834
|
+
const sortedArray2 = [...array2].sort();
|
|
4835
|
+
return sortedArray1.every((value, index) => value === sortedArray2[index]);
|
|
4836
|
+
}
|
|
4725
4837
|
class GetListRecordsByNameRequestStrategy extends LuvioAdapterRequestStrategy {
|
|
4726
4838
|
constructor() {
|
|
4727
4839
|
super(...arguments);
|
|
@@ -4732,19 +4844,8 @@ class GetListRecordsByNameRequestStrategy extends LuvioAdapterRequestStrategy {
|
|
|
4732
4844
|
return similarRequest;
|
|
4733
4845
|
}
|
|
4734
4846
|
transformForSave(request) {
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
}
|
|
4738
|
-
let fields = request.config.fields || [];
|
|
4739
|
-
let optionalFields = request.config.optionalFields || [];
|
|
4740
|
-
return {
|
|
4741
|
-
...request,
|
|
4742
|
-
config: {
|
|
4743
|
-
...request.config,
|
|
4744
|
-
fields: [],
|
|
4745
|
-
optionalFields: Array.from(new Set([...fields, ...optionalFields])),
|
|
4746
|
-
},
|
|
4747
|
-
};
|
|
4847
|
+
// No longer combining fields and optionalFields due to issue W-17353101
|
|
4848
|
+
return request;
|
|
4748
4849
|
}
|
|
4749
4850
|
canCombine(reqA, reqB) {
|
|
4750
4851
|
return (reqA.objectApiName === reqB.objectApiName &&
|
|
@@ -4752,13 +4853,12 @@ class GetListRecordsByNameRequestStrategy extends LuvioAdapterRequestStrategy {
|
|
|
4752
4853
|
reqA.pageSize === reqB.pageSize &&
|
|
4753
4854
|
reqA.searchTerm === reqB.searchTerm &&
|
|
4754
4855
|
reqA.sortBy === reqB.sortBy &&
|
|
4755
|
-
reqA.where === reqB.where
|
|
4856
|
+
reqA.where === reqB.where &&
|
|
4857
|
+
arrEq(reqA.fields || [], reqB.fields || []) &&
|
|
4858
|
+
arrEq(reqB.optionalFields || [], reqB.optionalFields || []));
|
|
4756
4859
|
}
|
|
4757
|
-
combineRequests(reqA,
|
|
4758
|
-
return
|
|
4759
|
-
...reqA,
|
|
4760
|
-
optionalFields: Array.from(new Set([...(reqA.optionalFields || []), ...(reqB.optionalFields || [])])),
|
|
4761
|
-
};
|
|
4860
|
+
combineRequests(reqA, _reqB) {
|
|
4861
|
+
return reqA;
|
|
4762
4862
|
}
|
|
4763
4863
|
}
|
|
4764
4864
|
|
|
@@ -6123,7 +6223,7 @@ function getEnvironmentSetting(name) {
|
|
|
6123
6223
|
}
|
|
6124
6224
|
return undefined;
|
|
6125
6225
|
}
|
|
6126
|
-
// version: 1.
|
|
6226
|
+
// version: 1.380.0-dev10-0a2876c461
|
|
6127
6227
|
|
|
6128
6228
|
const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
|
|
6129
6229
|
//TODO: Some duplication here that can be most likely moved to a util class
|
|
@@ -7090,4 +7190,4 @@ function ldsEngineCreator() {
|
|
|
7090
7190
|
}
|
|
7091
7191
|
|
|
7092
7192
|
export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
|
|
7093
|
-
// version: 1.
|
|
7193
|
+
// version: 1.380.0-dev10-215164b7de
|
|
@@ -15,5 +15,5 @@ export declare class GetListRecordsByNameRequestStrategy extends LuvioAdapterReq
|
|
|
15
15
|
buildConcreteRequest(similarRequest: GetListRecordsByNameRequest): GetListRecordsByNameRequest;
|
|
16
16
|
transformForSave(request: GetListRecordsByNameRequest): GetListRecordsByNameRequest;
|
|
17
17
|
canCombine(reqA: GetListRecordsByNameConfig, reqB: GetListRecordsByNameConfig): boolean;
|
|
18
|
-
combineRequests(reqA: GetListRecordsByNameConfig,
|
|
18
|
+
combineRequests(reqA: GetListRecordsByNameConfig, _reqB: GetListRecordsByNameConfig): GetListRecordsByNameConfig;
|
|
19
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-aura",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.380.0-dev10",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS engine for Aura runtime",
|
|
6
6
|
"main": "dist/ldsEngineCreator.js",
|
|
@@ -34,47 +34,47 @@
|
|
|
34
34
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@luvio/service-provisioner": "5.
|
|
38
|
-
"@luvio/tools-core": "5.
|
|
39
|
-
"@salesforce/lds-adapters-apex": "^1.
|
|
40
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
37
|
+
"@luvio/service-provisioner": " 5.60.0-dev2",
|
|
38
|
+
"@luvio/tools-core": " 5.60.0-dev2",
|
|
39
|
+
"@salesforce/lds-adapters-apex": "^1.380.0-dev10",
|
|
40
|
+
"@salesforce/lds-adapters-uiapi": "^1.380.0-dev10",
|
|
41
41
|
"@salesforce/lds-adapters-uiapi-lex": "^1.371.0",
|
|
42
|
-
"@salesforce/lds-ads-bridge": "^1.
|
|
43
|
-
"@salesforce/lds-aura-storage": "^1.
|
|
44
|
-
"@salesforce/lds-bindings": "^1.
|
|
45
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
46
|
-
"@salesforce/lds-network-aura": "^1.
|
|
47
|
-
"@salesforce/lds-network-fetch": "^1.
|
|
42
|
+
"@salesforce/lds-ads-bridge": "^1.380.0-dev10",
|
|
43
|
+
"@salesforce/lds-aura-storage": "^1.380.0-dev10",
|
|
44
|
+
"@salesforce/lds-bindings": "^1.380.0-dev10",
|
|
45
|
+
"@salesforce/lds-instrumentation": "^1.380.0-dev10",
|
|
46
|
+
"@salesforce/lds-network-aura": "^1.380.0-dev10",
|
|
47
|
+
"@salesforce/lds-network-fetch": "^1.380.0-dev10",
|
|
48
48
|
"jwt-encode": "1.0.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@luvio/command-aura-graphql-normalized-cache-control": "5.
|
|
52
|
-
"@luvio/command-aura-network": "5.
|
|
53
|
-
"@luvio/command-aura-normalized-cache-control": "5.
|
|
54
|
-
"@luvio/command-aura-resource-cache-control": "5.
|
|
55
|
-
"@luvio/command-fetch-network": "5.
|
|
56
|
-
"@luvio/command-http-graphql-normalized-cache-control": "5.
|
|
57
|
-
"@luvio/command-http-normalized-cache-control": "5.
|
|
58
|
-
"@luvio/command-ndjson": "5.
|
|
59
|
-
"@luvio/command-network": "5.
|
|
60
|
-
"@luvio/command-sse": "5.
|
|
61
|
-
"@luvio/command-streaming": "5.
|
|
51
|
+
"@luvio/command-aura-graphql-normalized-cache-control": " 5.60.0-dev2",
|
|
52
|
+
"@luvio/command-aura-network": " 5.60.0-dev2",
|
|
53
|
+
"@luvio/command-aura-normalized-cache-control": " 5.60.0-dev2",
|
|
54
|
+
"@luvio/command-aura-resource-cache-control": " 5.60.0-dev2",
|
|
55
|
+
"@luvio/command-fetch-network": " 5.60.0-dev2",
|
|
56
|
+
"@luvio/command-http-graphql-normalized-cache-control": " 5.60.0-dev2",
|
|
57
|
+
"@luvio/command-http-normalized-cache-control": " 5.60.0-dev2",
|
|
58
|
+
"@luvio/command-ndjson": " 5.60.0-dev2",
|
|
59
|
+
"@luvio/command-network": " 5.60.0-dev2",
|
|
60
|
+
"@luvio/command-sse": " 5.60.0-dev2",
|
|
61
|
+
"@luvio/command-streaming": " 5.60.0-dev2",
|
|
62
62
|
"@luvio/network-adapter-composable": "0.158.7",
|
|
63
63
|
"@luvio/network-adapter-fetch": "0.158.7",
|
|
64
|
-
"@luvio/service-aura-network": "5.
|
|
65
|
-
"@luvio/service-cache": "5.
|
|
66
|
-
"@luvio/service-cache-control": "5.
|
|
67
|
-
"@luvio/service-cache-inclusion-policy": "5.
|
|
68
|
-
"@luvio/service-feature-flags": "5.
|
|
69
|
-
"@luvio/service-fetch-network": "5.
|
|
70
|
-
"@luvio/service-instrument-command": "5.
|
|
71
|
-
"@luvio/service-pubsub": "5.
|
|
72
|
-
"@luvio/service-store": "5.
|
|
73
|
-
"@luvio/utils": "5.
|
|
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.
|
|
64
|
+
"@luvio/service-aura-network": " 5.60.0-dev2",
|
|
65
|
+
"@luvio/service-cache": " 5.60.0-dev2",
|
|
66
|
+
"@luvio/service-cache-control": " 5.60.0-dev2",
|
|
67
|
+
"@luvio/service-cache-inclusion-policy": " 5.60.0-dev2",
|
|
68
|
+
"@luvio/service-feature-flags": " 5.60.0-dev2",
|
|
69
|
+
"@luvio/service-fetch-network": " 5.60.0-dev2",
|
|
70
|
+
"@luvio/service-instrument-command": " 5.60.0-dev2",
|
|
71
|
+
"@luvio/service-pubsub": " 5.60.0-dev2",
|
|
72
|
+
"@luvio/service-store": " 5.60.0-dev2",
|
|
73
|
+
"@luvio/utils": " 5.60.0-dev2",
|
|
74
|
+
"@salesforce/lds-adapters-onestore-graphql": "^1.380.0-dev10",
|
|
75
|
+
"@salesforce/lds-adapters-uiapi-lex": "^1.380.0-dev10",
|
|
76
|
+
"@salesforce/lds-luvio-service": "^1.380.0-dev10",
|
|
77
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-dev10"
|
|
78
78
|
},
|
|
79
79
|
"luvioBundlesize": [
|
|
80
80
|
{
|