@salesforce/lds-runtime-aura 1.353.0 → 1.354.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.
@@ -488,6 +488,25 @@ function buildServiceDescriptor$c() {
488
488
  */
489
489
 
490
490
 
491
+ // Needs TS 2023+ (esnext) AND node 20+ to remove
492
+ function setOverlaps(setA, setB) {
493
+ if (setA.size > setB.size) {
494
+ for (const key of setB.keys()) {
495
+ if (setA.has(key)) {
496
+ return true;
497
+ }
498
+ }
499
+ }
500
+ else {
501
+ for (const key of setA) {
502
+ if (setB.has(key)) {
503
+ return true;
504
+ }
505
+ }
506
+ }
507
+ return false;
508
+ }
509
+
491
510
  /**
492
511
  * An implementation of BaseCommand that allows for extending abstract cache methods
493
512
  *
@@ -503,21 +522,21 @@ class CacheControlCommand extends BaseCommand {
503
522
  this.rebuildUnsubscribe = () => { };
504
523
  this.refreshUnsubscribe = () => { };
505
524
  this.lastEmittedData = undefined;
506
- this.subscribeToMostRecentKeys = () => undefined;
525
+ this.subscribeToKeys = () => undefined;
526
+ this.unsubscribeFromKeys = () => undefined;
507
527
  this.subscriptions = [];
508
528
  this.instantiationTime = Date.now() / 1000; // in seconds
509
529
  }
510
530
  execute(overrides) {
511
- this.subscribeToMostRecentKeys = () => undefined;
512
- this.rebuildUnsubscribe();
513
- this.refreshUnsubscribe();
531
+ this.unsubscribeFromKeys();
532
+ this.subscribeToKeys = () => undefined;
514
533
  const mergedCacheControlConfig = mergeCacheControlConfigs(this.cacheControlStrategyConfig, overrides);
515
534
  const resultPromise = this.services.cacheController.execute(mergedCacheControlConfig, (cache) => this.buildRequestRunner(cache), {
516
535
  instrumentationAttributes: this.instrumentationAttributes,
517
536
  });
518
537
  return resultPromise.then((result) => {
519
- if (this.operationType === 'query') {
520
- this.subscribeToMostRecentKeys();
538
+ if (this.subscriptions.length > 0) {
539
+ this.subscribeToKeys();
521
540
  }
522
541
  if (result.isOk() && this.lastEmittedData === undefined) {
523
542
  this.lastEmittedData = result.value.data;
@@ -569,7 +588,7 @@ class CacheControlCommand extends BaseCommand {
569
588
  else {
570
589
  const data = readResult.value;
571
590
  if (data !== undefined) {
572
- this.subscribeToMostRecentKeys = () => this.subscribeToKeys(recordableCache.keysRead);
591
+ this.subscribeToKeys = () => this.subscribeToKeySet(recordableCache.keysRead);
573
592
  return ok({
574
593
  data,
575
594
  subscribe: this.buildSubscribe(),
@@ -591,9 +610,15 @@ class CacheControlCommand extends BaseCommand {
591
610
  */
592
611
  buildSubscribe() {
593
612
  return (consumerCallback) => {
613
+ if (this.subscriptions.length === 0 && this.operationType === 'query') {
614
+ this.subscribeToKeys();
615
+ }
594
616
  this.subscriptions.push(consumerCallback);
595
617
  return () => {
596
618
  this.subscriptions = this.subscriptions.filter((cb) => cb !== consumerCallback);
619
+ if (this.subscriptions.length === 0) {
620
+ this.unsubscribeFromKeys();
621
+ }
597
622
  };
598
623
  };
599
624
  }
@@ -610,7 +635,7 @@ class CacheControlCommand extends BaseCommand {
610
635
  return result;
611
636
  });
612
637
  }
613
- subscribeToKeys(keysRead) {
638
+ subscribeToKeySet(keysRead) {
614
639
  const { pubSub } = this.services;
615
640
  if (!pubSub) {
616
641
  return;
@@ -623,10 +648,13 @@ class CacheControlCommand extends BaseCommand {
623
648
  // Unsubscribe to be sure that this command didn't re-execute and re-subscribe in between the start of command execution and now
624
649
  // it shouldn't be possible for this command to resubscribe between the beginning of execution and now
625
650
  // ...but lets be defensive.
626
- this.rebuildUnsubscribe();
627
- this.refreshUnsubscribe();
628
- this.rebuildUnsubscribe = createKeySubscriber('cacheUpdate', () => this.rerun({ now: this.instantiationTime }).then(() => undefined));
629
- this.refreshUnsubscribe = createKeySubscriber('cacheInvalidation', () => this.rerun().then(() => undefined));
651
+ this.unsubscribeFromKeys();
652
+ const rebuildUnsubscribe = createKeySubscriber('cacheUpdate', () => this.rerun({ now: this.instantiationTime }).then(() => undefined));
653
+ const refreshUnsubscribe = createKeySubscriber('cacheInvalidation', () => this.rerun().then(() => undefined));
654
+ this.unsubscribeFromKeys = () => {
655
+ rebuildUnsubscribe();
656
+ refreshUnsubscribe();
657
+ };
630
658
  }
631
659
  invokeConsumerCallbacks(data) {
632
660
  this.subscriptions.forEach((cb) => {
@@ -660,24 +688,6 @@ function mergeCacheControlConfigs(baseConfig, overrides) {
660
688
  now,
661
689
  };
662
690
  }
663
- // Needs TS 2023+ (esnext) AND node 20+ to remove
664
- function setOverlaps(setA, setB) {
665
- if (setA.size > setB.size) {
666
- for (const key of setB.keys()) {
667
- if (setA.has(key)) {
668
- return true;
669
- }
670
- }
671
- }
672
- else {
673
- for (const key of setA) {
674
- if (setB.has(key)) {
675
- return true;
676
- }
677
- }
678
- }
679
- return false;
680
- }
681
691
 
682
692
  /**
683
693
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -5596,7 +5606,7 @@ function getEnvironmentSetting(name) {
5596
5606
  }
5597
5607
  return undefined;
5598
5608
  }
5599
- // version: 1.353.0-330d59cfcb
5609
+ // version: 1.354.0-c6c04442c4
5600
5610
 
5601
5611
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
5602
5612
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -6288,4 +6298,4 @@ function ldsEngineCreator() {
6288
6298
  }
6289
6299
 
6290
6300
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
6291
- // version: 1.353.0-cc9b469dc4
6301
+ // version: 1.354.0-dc8789df55
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.353.0",
3
+ "version": "1.354.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,39 +34,39 @@
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.0",
38
- "@luvio/tools-core": "5.38.0",
39
- "@salesforce/lds-adapters-apex": "^1.353.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.353.0",
37
+ "@luvio/service-provisioner": "5.38.2",
38
+ "@luvio/tools-core": "5.38.2",
39
+ "@salesforce/lds-adapters-apex": "^1.354.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.354.0",
41
41
  "@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
42
- "@salesforce/lds-ads-bridge": "^1.353.0",
43
- "@salesforce/lds-aura-storage": "^1.353.0",
44
- "@salesforce/lds-bindings": "^1.353.0",
45
- "@salesforce/lds-instrumentation": "^1.353.0",
46
- "@salesforce/lds-network-aura": "^1.353.0",
47
- "@salesforce/lds-network-fetch": "^1.353.0",
42
+ "@salesforce/lds-ads-bridge": "^1.354.0",
43
+ "@salesforce/lds-aura-storage": "^1.354.0",
44
+ "@salesforce/lds-bindings": "^1.354.0",
45
+ "@salesforce/lds-instrumentation": "^1.354.0",
46
+ "@salesforce/lds-network-aura": "^1.354.0",
47
+ "@salesforce/lds-network-fetch": "^1.354.0",
48
48
  "jwt-encode": "1.0.1"
49
49
  },
50
50
  "dependencies": {
51
- "@luvio/command-aura-network": "5.38.0",
52
- "@luvio/command-aura-normalized-cache-control": "5.38.0",
53
- "@luvio/command-aura-resource-cache-control": "5.38.0",
54
- "@luvio/command-fetch-network": "5.38.0",
55
- "@luvio/command-http-normalized-cache-control": "5.38.0",
56
- "@luvio/command-network": "5.38.0",
57
- "@luvio/command-sse": "5.38.0",
58
- "@luvio/command-streaming": "5.38.0",
51
+ "@luvio/command-aura-network": "5.38.2",
52
+ "@luvio/command-aura-normalized-cache-control": "5.38.2",
53
+ "@luvio/command-aura-resource-cache-control": "5.38.2",
54
+ "@luvio/command-fetch-network": "5.38.2",
55
+ "@luvio/command-http-normalized-cache-control": "5.38.2",
56
+ "@luvio/command-network": "5.38.2",
57
+ "@luvio/command-sse": "5.38.2",
58
+ "@luvio/command-streaming": "5.38.2",
59
59
  "@luvio/network-adapter-composable": "0.156.7",
60
60
  "@luvio/network-adapter-fetch": "0.156.7",
61
- "@luvio/service-aura-network": "5.38.0",
62
- "@luvio/service-cache": "5.38.0",
63
- "@luvio/service-cache-control": "5.38.0",
64
- "@luvio/service-fetch-network": "5.38.0",
65
- "@luvio/service-instrument-command": "5.38.0",
66
- "@luvio/service-pubsub": "5.38.0",
67
- "@luvio/service-store": "5.38.0",
68
- "@luvio/utils": "5.38.0",
69
- "@salesforce/lds-adapters-uiapi-lex": "^1.353.0"
61
+ "@luvio/service-aura-network": "5.38.2",
62
+ "@luvio/service-cache": "5.38.2",
63
+ "@luvio/service-cache-control": "5.38.2",
64
+ "@luvio/service-fetch-network": "5.38.2",
65
+ "@luvio/service-instrument-command": "5.38.2",
66
+ "@luvio/service-pubsub": "5.38.2",
67
+ "@luvio/service-store": "5.38.2",
68
+ "@luvio/utils": "5.38.2",
69
+ "@salesforce/lds-adapters-uiapi-lex": "^1.354.0"
70
70
  },
71
71
  "luvioBundlesize": [
72
72
  {