@salesforce/lds-runtime-aura 1.348.0 → 1.349.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.
Files changed (2) hide show
  1. package/dist/ldsEngineCreator.js +175 -88
  2. package/package.json +29 -27
@@ -40,6 +40,48 @@ import { createStorage, clearStorages } from 'force/ldsStorage';
40
40
  import useHttpInsteadAuraTransport from '@salesforce/gate/lds.useHttpInsteadAuraTransport';
41
41
  import { ThirdPartyTracker } from 'instrumentation:beaconLib';
42
42
 
43
+ /**
44
+ * Copyright (c) 2022, Salesforce, Inc.,
45
+ * All rights reserved.
46
+ * For full license text, see the LICENSE.txt file
47
+ */
48
+
49
+ /**
50
+ * BaseCommand is an abstract implementation of SubscribableCommand. It adds the
51
+ * notions of typed configuration, request context, and a set of runtime services
52
+ * to the contract defined by Command/SubscribableCommand.
53
+ */
54
+ class BaseCommand {
55
+ }
56
+
57
+ /**
58
+ * Copyright (c) 2022, Salesforce, Inc.,
59
+ * All rights reserved.
60
+ * For full license text, see the LICENSE.txt file
61
+ */
62
+
63
+
64
+ /**
65
+ * An implementation of BaseCommand that makes network requests but does not try to
66
+ * use the store.
67
+ */
68
+ class NetworkCommand extends BaseCommand {
69
+ constructor(services) {
70
+ super();
71
+ this.services = services;
72
+ }
73
+ execute() {
74
+ return this.fetch();
75
+ }
76
+ }
77
+ function buildServiceDescriptor$d() {
78
+ return {
79
+ type: 'networkCommandBaseClass',
80
+ version: '1.0',
81
+ service: NetworkCommand,
82
+ };
83
+ }
84
+
43
85
  /**
44
86
  * Copyright (c) 2022, Salesforce, Inc.,
45
87
  * All rights reserved.
@@ -316,78 +358,6 @@ var HttpStatusCode$2;
316
358
  HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
317
359
  })(HttpStatusCode$2 || (HttpStatusCode$2 = {}));
318
360
 
319
- /**
320
- * Copyright (c) 2022, Salesforce, Inc.,
321
- * All rights reserved.
322
- * For full license text, see the LICENSE.txt file
323
- */
324
-
325
- /**
326
- * BaseCommand is an abstract implementation of SubscribableCommand. It adds the
327
- * notions of typed configuration, request context, and a set of runtime services
328
- * to the contract defined by Command/SubscribableCommand.
329
- */
330
- class BaseCommand {
331
- }
332
-
333
- /**
334
- * Copyright (c) 2022, Salesforce, Inc.,
335
- * All rights reserved.
336
- * For full license text, see the LICENSE.txt file
337
- */
338
-
339
-
340
- /**
341
- * An implementation of BaseCommand that makes network requests but does not try to
342
- * use the store.
343
- */
344
- class NetworkCommand extends BaseCommand {
345
- constructor(services) {
346
- super();
347
- this.services = services;
348
- this.subscriptions = [];
349
- }
350
- execute() {
351
- return this.fetch().then((networkResult) => {
352
- if (networkResult.isErr()) {
353
- return err(networkResult.error);
354
- }
355
- else {
356
- const data = networkResult.value;
357
- return ok({
358
- data,
359
- subscribe: (cb) => {
360
- this.subscriptions.push(cb);
361
- return () => {
362
- this.subscriptions = this.subscriptions.filter((cb2) => cb2 !== cb);
363
- };
364
- },
365
- refresh: () => this.refresh(),
366
- });
367
- }
368
- });
369
- }
370
- refresh() {
371
- return this.execute().then((newResult) => {
372
- if (newResult.isOk()) {
373
- const value = newResult.value;
374
- this.subscriptions.forEach((cb) => {
375
- cb(ok(value.data));
376
- });
377
- return ok(undefined);
378
- }
379
- return err(newResult.error);
380
- });
381
- }
382
- }
383
- function buildServiceDescriptor$b() {
384
- return {
385
- type: 'networkCommandBaseClass',
386
- version: '1.0',
387
- service: NetworkCommand,
388
- };
389
- }
390
-
391
361
  /**
392
362
  * Copyright (c) 2022, Salesforce, Inc.,
393
363
  * All rights reserved.
@@ -433,7 +403,7 @@ class AuraNetworkCommand extends NetworkCommand {
433
403
  }
434
404
  }
435
405
 
436
- function buildServiceDescriptor$a() {
406
+ function buildServiceDescriptor$c() {
437
407
  return {
438
408
  type: 'auraNetworkCommandBaseClass',
439
409
  version: '1.0',
@@ -484,14 +454,6 @@ class CacheControlCommand extends BaseCommand {
484
454
  writeToCache: (networkResult) => this.writeToCacheAndPublish(cache, networkResult),
485
455
  };
486
456
  }
487
- refresh() {
488
- return this.execute({ cacheControlConfig: { type: 'no-cache' } }).then((res) => {
489
- if (res.isOk()) {
490
- return ok(undefined);
491
- }
492
- return err(res.error);
493
- });
494
- }
495
457
  // TODO: This is added as a temporary measure for ensuring that cache write events are
496
458
  // published to pubSub. A follow-up will be required to find the right home for this logic.
497
459
  writeToCacheAndPublish(cache, networkResult) {
@@ -520,7 +482,6 @@ class CacheControlCommand extends BaseCommand {
520
482
  return ok({
521
483
  data,
522
484
  subscribe: this.buildSubscribe(),
523
- refresh: () => this.refresh(),
524
485
  });
525
486
  }
526
487
  return ok(undefined);
@@ -708,7 +669,7 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand {
708
669
  }
709
670
  }
710
671
 
711
- function buildServiceDescriptor$9() {
672
+ function buildServiceDescriptor$b() {
712
673
  return {
713
674
  type: 'auraResourceCacheControlCommand',
714
675
  version: '1.0',
@@ -723,6 +684,130 @@ function buildServiceDescriptor$9() {
723
684
  */
724
685
 
725
686
 
687
+ /**
688
+ * An implementation of BaseCommand that allows for extending abstract cache methods
689
+ *
690
+ * @typeParam Data cache result for read operations
691
+ * @typeParam NetworkResult cache result including network metadata
692
+ * @typeParam ExtraServices additional named services needed by a subclass
693
+ */
694
+ class AuraNormalizedCacheControlCommand extends AuraCacheControlCommand {
695
+ constructor(services) {
696
+ super(services);
697
+ this.services = services;
698
+ }
699
+ readFromCache(cache) {
700
+ const data = this.buildResultType().query(cache, this.buildQuery());
701
+ if (data.isErr()) {
702
+ return resolvedPromiseLike(err(new Error(`Failed to build data from type: ${stringify$1(data.error)}`)));
703
+ }
704
+ return resolvedPromiseLike(ok(data.value));
705
+ }
706
+ writeToCache(cache, networkResult) {
707
+ if (networkResult.isOk()) {
708
+ this.buildResultType().write(cache.buildFixedTimeWritableCache(Date.now() / 1000), this.buildWriteInput(networkResult.value));
709
+ }
710
+ return resolvedPromiseLike(undefined);
711
+ }
712
+ }
713
+
714
+ function buildServiceDescriptor$a() {
715
+ return {
716
+ type: 'auraNormalizedCacheControlCommand',
717
+ version: '1.0',
718
+ service: AuraNormalizedCacheControlCommand,
719
+ };
720
+ }
721
+
722
+ /**
723
+ * Copyright (c) 2022, Salesforce, Inc.,
724
+ * All rights reserved.
725
+ * For full license text, see the LICENSE.txt file
726
+ */
727
+
728
+
729
+ /**
730
+ * An implementation of BaseCommand that allows for extending abstract cache methods
731
+ *
732
+ * @typeParam Data cache result for read operations
733
+ * @typeParam NetworkResult cache result including network metadata
734
+ * @typeParam ExtraServices additional named services needed by a subclass
735
+ */
736
+ class HttpCacheControlCommand extends CacheControlCommand {
737
+ constructor(services) {
738
+ super(services);
739
+ this.services = services;
740
+ }
741
+ requestFromNetwork() {
742
+ return this.fetch();
743
+ }
744
+ fetch() {
745
+ return this.convertFetchResponseToData(this.services.fetch(...this.fetchParams));
746
+ }
747
+ async coerceError(errorResponse) {
748
+ return toError(errorResponse.statusText); // Default Behavior
749
+ }
750
+ convertFetchResponseToData(response) {
751
+ return response.then((response) => {
752
+ if (response.ok) {
753
+ return response.json().then((json) => ok(json), (reason) => err(toError(reason)));
754
+ }
755
+ else {
756
+ return this.coerceError(response).then((coercedError) => err(coercedError));
757
+ }
758
+ }, (reason) => err(toError(reason)));
759
+ }
760
+ }
761
+
762
+ /**
763
+ * Copyright (c) 2022, Salesforce, Inc.,
764
+ * All rights reserved.
765
+ * For full license text, see the LICENSE.txt file
766
+ */
767
+
768
+
769
+ /**
770
+ * An implementation of BaseCommand that allows for extending abstract cache methods
771
+ *
772
+ * @typeParam Data cache result for read operations
773
+ * @typeParam NetworkResult cache result including network metadata
774
+ * @typeParam ExtraServices additional named services needed by a subclass
775
+ */
776
+ class HttpNormalizedCacheControlCommand extends HttpCacheControlCommand {
777
+ constructor(services) {
778
+ super(services);
779
+ this.services = services;
780
+ }
781
+ readFromCache(cache) {
782
+ const data = this.buildResultType().query(cache, this.buildQuery());
783
+ if (data.isErr()) {
784
+ return resolvedPromiseLike(err(new Error(`Failed to build data from type: ${stringify$1(data.error)}`)));
785
+ }
786
+ return resolvedPromiseLike(ok(data.value));
787
+ }
788
+ writeToCache(cache, networkResult) {
789
+ if (networkResult.isOk()) {
790
+ this.buildResultType().write(cache.buildFixedTimeWritableCache(Date.now() / 1000), this.buildWriteInput(networkResult.value));
791
+ }
792
+ return resolvedPromiseLike(undefined);
793
+ }
794
+ }
795
+
796
+ function buildServiceDescriptor$9() {
797
+ return {
798
+ type: 'httpNormalizedCacheControlCommand',
799
+ version: '1.0',
800
+ service: HttpNormalizedCacheControlCommand,
801
+ };
802
+ }
803
+
804
+ /**
805
+ * Copyright (c) 2022, Salesforce, Inc.,
806
+ * All rights reserved.
807
+ * For full license text, see the LICENSE.txt file
808
+ */
809
+
810
+
726
811
  /**
727
812
  * An implementation of NetworkCommand that uses HTTP/fetch as the transport mechanism.
728
813
  */
@@ -5247,7 +5332,7 @@ function buildAuraLocalStoragePrefetchStorage(options = {}) {
5247
5332
  ...DEFAULT_STORAGE_OPTIONS,
5248
5333
  ...storageOptions,
5249
5334
  secure: false,
5250
- adapter: 'localstorage',
5335
+ adapterType: 'localstorage',
5251
5336
  name: 'pdl',
5252
5337
  maxSize: 4096000, // 4MB
5253
5338
  });
@@ -5369,7 +5454,7 @@ function getEnvironmentSetting(name) {
5369
5454
  }
5370
5455
  return undefined;
5371
5456
  }
5372
- // version: 1.348.0-4aa8c0c0cb
5457
+ // version: 1.349.0-2008e7132b
5373
5458
 
5374
5459
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
5375
5460
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -6030,11 +6115,13 @@ function initializeOneStore() {
6030
6115
  buildAuraNetworkService(),
6031
6116
  buildServiceDescriptor$5(instrumentationServiceDescriptor.service),
6032
6117
  buildServiceDescriptor$2(cacheServiceDescriptor.service),
6033
- buildServiceDescriptor$a(),
6118
+ buildServiceDescriptor$c(),
6034
6119
  buildServiceDescriptor$8(),
6035
- buildServiceDescriptor$b(),
6120
+ buildServiceDescriptor$d(),
6036
6121
  buildServiceDescriptor$7(),
6037
6122
  buildServiceDescriptor$6(),
6123
+ buildServiceDescriptor$b(),
6124
+ buildServiceDescriptor$a(),
6038
6125
  buildServiceDescriptor$9(),
6039
6126
  buildServiceDescriptor$1(),
6040
6127
  ];
@@ -6059,4 +6146,4 @@ function ldsEngineCreator() {
6059
6146
  }
6060
6147
 
6061
6148
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
6062
- // version: 1.348.0-09ae8e3e37
6149
+ // version: 1.349.0-3d2a6c656b
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.348.0",
3
+ "version": "1.349.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,43 +34,45 @@
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.32.1",
38
- "@salesforce/lds-adapters-apex": "^1.348.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.348.0",
37
+ "@luvio/service-provisioner": "5.33.0",
38
+ "@salesforce/lds-adapters-apex": "^1.349.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.349.0",
40
40
  "@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
41
- "@salesforce/lds-ads-bridge": "^1.348.0",
42
- "@salesforce/lds-aura-storage": "^1.348.0",
43
- "@salesforce/lds-bindings": "^1.348.0",
44
- "@salesforce/lds-instrumentation": "^1.348.0",
45
- "@salesforce/lds-network-aura": "^1.348.0",
46
- "@salesforce/lds-network-fetch": "^1.348.0",
41
+ "@salesforce/lds-ads-bridge": "^1.349.0",
42
+ "@salesforce/lds-aura-storage": "^1.349.0",
43
+ "@salesforce/lds-bindings": "^1.349.0",
44
+ "@salesforce/lds-instrumentation": "^1.349.0",
45
+ "@salesforce/lds-network-aura": "^1.349.0",
46
+ "@salesforce/lds-network-fetch": "^1.349.0",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@luvio/command-aura-network": "5.32.1",
51
- "@luvio/command-aura-resource-cache-control": "5.32.1",
52
- "@luvio/command-fetch-network": "5.32.1",
53
- "@luvio/command-network": "5.32.1",
54
- "@luvio/command-sse": "5.32.1",
55
- "@luvio/command-streaming": "5.32.1",
50
+ "@luvio/command-aura-network": "5.33.0",
51
+ "@luvio/command-aura-normalized-cache-control": "5.33.0",
52
+ "@luvio/command-aura-resource-cache-control": "5.33.0",
53
+ "@luvio/command-fetch-network": "5.33.0",
54
+ "@luvio/command-http-normalized-cache-control": "5.33.0",
55
+ "@luvio/command-network": "5.33.0",
56
+ "@luvio/command-sse": "5.33.0",
57
+ "@luvio/command-streaming": "5.33.0",
56
58
  "@luvio/network-adapter-composable": "0.156.7",
57
59
  "@luvio/network-adapter-fetch": "0.156.7",
58
- "@luvio/service-aura-network": "5.32.1",
59
- "@luvio/service-cache": "5.32.1",
60
- "@luvio/service-cache-control": "5.32.1",
61
- "@luvio/service-fetch-network": "5.32.1",
62
- "@luvio/service-instrument-command": "5.32.1",
63
- "@luvio/service-pubsub": "5.32.1",
64
- "@luvio/service-store": "5.32.1",
65
- "@luvio/utils": "5.32.1",
66
- "@salesforce/lds-adapters-uiapi-lex": "^1.348.0"
60
+ "@luvio/service-aura-network": "5.33.0",
61
+ "@luvio/service-cache": "5.33.0",
62
+ "@luvio/service-cache-control": "5.33.0",
63
+ "@luvio/service-fetch-network": "5.33.0",
64
+ "@luvio/service-instrument-command": "5.33.0",
65
+ "@luvio/service-pubsub": "5.33.0",
66
+ "@luvio/service-store": "5.33.0",
67
+ "@luvio/utils": "5.33.0",
68
+ "@salesforce/lds-adapters-uiapi-lex": "^1.349.0"
67
69
  },
68
70
  "luvioBundlesize": [
69
71
  {
70
72
  "path": "./dist/ldsEngineCreator.js",
71
73
  "maxSize": {
72
- "none": "226.5 kB",
73
- "min": "93.5 kB",
74
+ "none": "229.5 kB",
75
+ "min": "94.7 kB",
74
76
  "compressed": "39.5 kB"
75
77
  }
76
78
  }