@salesforce/lds-runtime-aura 1.368.0 → 1.370.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.
@@ -21,6 +21,7 @@ import useRelatedListPlus from '@salesforce/gate/lds.pdl.useRelatedListPlus';
21
21
  import useCmpDefPredictions from '@salesforce/gate/lds.pdl.useCmpDefPredictions';
22
22
  import applyPredictionRequestLimit from '@salesforce/gate/lds.pdl.applyRequestLimit';
23
23
  import useLocalStorage from '@salesforce/gate/lds.pdl.useLocalStorage';
24
+ import useOneStoreGraphql from '@salesforce/gate/lds.oneStoreGraphqlEnabled';
24
25
  import { GetApexWireAdapterFactory, registerPrefetcher as registerPrefetcher$1 } from 'force/ldsAdaptersApex';
25
26
  import { getRecordAvatarsAdapterFactory, getRecordAdapterFactory, coerceFieldIdArray, getRecordsAdapterFactory, getRecordActionsAdapterFactory, getObjectInfosAdapterFactory, coerceObjectIdArray, getObjectInfoAdapterFactory, coerceObjectId, getRelatedListsActionsAdapterFactory, getRelatedListInfoBatchAdapterFactory, getRelatedListInfoAdapterFactory, getRelatedListRecordsBatchAdapterFactory, getRelatedListRecordsAdapterFactory, getListInfoByNameAdapterFactory, getListInfosByObjectNameAdapterFactory, getListRecordsByNameAdapterFactory, getListObjectInfoAdapterFactory, getRelatedListsInfoAdapterFactory, getRelatedListActionsAdapterFactory, getRecordId18Array, instrument, configuration, InMemoryRecordRepresentationQueryEvaluator, UiApiNamespace, RecordRepresentationRepresentationType, registerPrefetcher } from 'force/ldsAdaptersUiapi';
26
27
  import { getInstrumentation } from 'o11y/client';
@@ -505,6 +506,38 @@ function setOverlaps(setA, setB) {
505
506
  }
506
507
  return false;
507
508
  }
509
+ class CacheControlRequestRunner {
510
+ constructor(readFromCache, requestFromNetwork, writeToCache) {
511
+ this.readFromCacheInternal = readFromCache;
512
+ this.requestFromNetworkInternal = requestFromNetwork;
513
+ this.writeToCacheInternal = writeToCache;
514
+ }
515
+ readFromCache(cache) {
516
+ const resultPromise = this.readFromCacheInternal(cache);
517
+ return resultPromise.then((result) => {
518
+ if (result.isErr()) {
519
+ return err(result.error);
520
+ }
521
+ this.returnData = result;
522
+ return ok$1(void 0);
523
+ });
524
+ }
525
+ requestFromNetwork() {
526
+ const that = this;
527
+ return async function* () {
528
+ const result = await that.requestFromNetworkInternal();
529
+ if (result.isErr()) {
530
+ that.networkError = result;
531
+ } else {
532
+ that.networkData = result;
533
+ }
534
+ yield result;
535
+ }();
536
+ }
537
+ writeToCache(cache, networkResult) {
538
+ return this.writeToCacheInternal(cache, networkResult);
539
+ }
540
+ }
508
541
  class CacheControlCommand extends BaseCommand {
509
542
  constructor(services) {
510
543
  super();
@@ -524,57 +557,48 @@ class CacheControlCommand extends BaseCommand {
524
557
  this.cacheControlStrategyConfig,
525
558
  overrides
526
559
  );
527
- let returnData;
528
- let returnError;
529
- const requestRunner = {
530
- readFromCache: (cache) => {
531
- const resultPromise2 = this.buildResultWithSubscribe(cache);
532
- return resultPromise2.then((result) => {
533
- if (result.isErr()) {
534
- return err(result.error);
535
- }
536
- returnData = result;
537
- return ok$1(void 0);
538
- });
539
- },
540
- requestFromNetwork: () => {
541
- const that = this;
542
- return async function* () {
543
- const result = await that.requestFromNetwork();
544
- if (result.isErr()) {
545
- returnError = result;
546
- }
547
- yield result;
548
- }();
549
- },
550
- writeToCache: (cache, networkResult) => {
551
- return this.writeToCacheAndRecordKeys(cache, networkResult);
552
- }
553
- };
560
+ const requestRunner = this.buildRequestRunner();
554
561
  const resultPromise = this.services.cacheController.execute(mergedCacheControlConfig, requestRunner, {
555
562
  instrumentationAttributes: this.instrumentationAttributes
556
563
  });
557
564
  return resultPromise.then((result) => {
558
- return this.publishUpdatedKeys().then(() => {
559
- if (returnError) {
560
- return returnError;
561
- }
562
- if (result.isErr()) {
563
- return err(result.error);
564
- }
565
- if (this.subscriptions.length > 0) {
566
- this.subscribeToKeysUsed();
567
- }
568
- if (returnData === void 0) {
569
- return err(new Error("Cache miss after fetching from network"));
565
+ return this.handleCacheControllerResult(result, requestRunner);
566
+ });
567
+ }
568
+ handleCacheControllerResult(result, requestRunner) {
569
+ const { networkError, networkData, returnData } = requestRunner;
570
+ return this.publishUpdatedKeys().then(() => {
571
+ if (networkError) {
572
+ return networkError;
573
+ }
574
+ if (result.isErr()) {
575
+ if (networkData) {
576
+ return this.constructSubscribableResult(networkData.value);
570
577
  }
571
- if (returnData.isOk() && this.lastEmittedData === void 0) {
572
- this.lastEmittedData = returnData.value.data;
578
+ return err(result.error);
579
+ }
580
+ if (this.subscriptions.length > 0) {
581
+ this.subscribeToKeysUsed();
582
+ }
583
+ if (returnData === void 0) {
584
+ if (networkData) {
585
+ return this.constructSubscribableResult(networkData.value);
573
586
  }
574
- return returnData;
575
- });
587
+ return err(new Error("Cache miss after fetching from network"));
588
+ }
589
+ if (returnData.isOk() && this.lastEmittedData === void 0) {
590
+ this.lastEmittedData = returnData.value.data;
591
+ }
592
+ return returnData;
576
593
  });
577
594
  }
595
+ buildRequestRunner() {
596
+ return new CacheControlRequestRunner(
597
+ (cache) => this.buildResultWithSubscribe(cache),
598
+ () => this.requestFromNetwork(),
599
+ (cache, networkResult) => this.writeToCacheAndRecordKeys(cache, networkResult)
600
+ );
601
+ }
578
602
  publishUpdatedKeys() {
579
603
  if (this.services.pubSub) {
580
604
  if (this.keysUpdated !== void 0 && this.keysUpdated.size > 0) {
@@ -645,14 +669,18 @@ class CacheControlCommand extends BaseCommand {
645
669
  } else {
646
670
  const data = readResult.value;
647
671
  this.keysUsed = recordableCache.keysRead;
648
- return ok$1({
649
- data,
650
- subscribe: this.buildSubscribe(),
651
- refresh: () => this.refresh()
652
- });
672
+ return this.constructSubscribableResult(data);
653
673
  }
654
674
  });
655
675
  }
676
+ constructSubscribableResult(data) {
677
+ return ok$1({
678
+ data,
679
+ // this cast is in case we need to return Network data as a fallback for caching errors
680
+ subscribe: this.buildSubscribe(),
681
+ refresh: () => this.refresh()
682
+ });
683
+ }
656
684
  /**
657
685
  * Builds a function that subscribes to cache changes via the pubsub service. Whenever
658
686
  * relevant cache updates occur, it re-reads the data and compares it against
@@ -2710,7 +2738,7 @@ var TypeCheckShapes;
2710
2738
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
2711
2739
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
2712
2740
  })(TypeCheckShapes || (TypeCheckShapes = {}));
2713
- // engine version: 0.158.3-41cf8514
2741
+ // engine version: 0.158.7-bafe2646
2714
2742
 
2715
2743
  const { keys: keys$1 } = Object;
2716
2744
 
@@ -5697,7 +5725,7 @@ function getEnvironmentSetting(name) {
5697
5725
  }
5698
5726
  return undefined;
5699
5727
  }
5700
- // version: 1.368.0-de8cc6721e
5728
+ // version: 1.370.0-7c1df2520b
5701
5729
 
5702
5730
  const forceRecordTransactionsDisabled = getEnvironmentSetting(EnvironmentSettings.ForceRecordTransactionsDisabled);
5703
5731
  //TODO: Some duplication here that can be most likely moved to a util class
@@ -6503,12 +6531,17 @@ function buildPredictorForContext(context) {
6503
6531
  }
6504
6532
  const currentContext = __lexPrefetcher.context;
6505
6533
  let isSameContext = false;
6506
- if (RecordHomePage.handlesContext(currentContext)) {
6534
+ if (RecordHomePage.handlesContext(currentContext) && RecordHomePage.handlesContext(context)) {
6507
6535
  isSameContext =
6508
6536
  currentContext.actionName === context.actionName &&
6509
6537
  currentContext.objectApiName === context.objectApiName &&
6510
- currentContext.recordId === context.recordId &&
6511
- currentContext.type === context.type;
6538
+ currentContext.recordId === context.recordId;
6539
+ }
6540
+ else if (ObjectHomePage.handlesContext(currentContext) &&
6541
+ ObjectHomePage.handlesContext(context)) {
6542
+ isSameContext =
6543
+ currentContext.objectApiName === context.objectApiName &&
6544
+ currentContext.listViewApiName === context.listViewApiName;
6512
6545
  }
6513
6546
  // // This chunk configures which page we're going to use to try and preload.
6514
6547
  __lexPrefetcher.context = context;
@@ -6599,6 +6632,15 @@ function initializeOneStore() {
6599
6632
  ];
6600
6633
  setServices(services);
6601
6634
  }
6635
+ function initializeOnestoreUiApiAdapters() {
6636
+ // W-17577671 - UIAPI adapters need to be updated to new onestore spec
6637
+ // ldsAdaptersUiapiConfig.setGetObjectInfoAdapter(getObjectInfo);
6638
+ // ldsAdaptersUiapiConfig.setGetObjectInfosAdapter(getObjectInfos);
6639
+ if (useOneStoreGraphql.isOpen({ fallback: false })) {
6640
+ configuration.setGraphQLWireAdapter({});
6641
+ configuration.setGraphQLImperativeQueryAdapter({});
6642
+ }
6643
+ }
6602
6644
  function buildAuraNetworkService() {
6603
6645
  return {
6604
6646
  type: 'auraNetwork',
@@ -6611,11 +6653,13 @@ function ldsEngineCreator() {
6611
6653
  // One store initialization needs to happen first in order to set the one store adapter correctly in configuration object.
6612
6654
  if (oneStoreEnabled.isOpen({ fallback: true })) {
6613
6655
  initializeOneStore();
6614
- if (oneStoreUiapiEnabled.isOpen({ fallback: false })) ;
6656
+ if (oneStoreUiapiEnabled.isOpen({ fallback: false })) {
6657
+ initializeOnestoreUiApiAdapters();
6658
+ }
6615
6659
  }
6616
6660
  initializeLDS();
6617
6661
  return { name: 'ldsEngineCreator' };
6618
6662
  }
6619
6663
 
6620
6664
  export { LexRequestStrategy, PdlRequestPriority, buildPredictorForContext, ldsEngineCreator as default, initializeLDS, initializeOneStore, registerRequestStrategy, saveRequestAsPrediction, unregisterRequestStrategy, whenPredictionsReady };
6621
- // version: 1.368.0-20c9e0247b
6665
+ // version: 1.370.0-3ec6ffba72
@@ -1,4 +1,4 @@
1
- import { type RecordHomePageContext } from './predictive-loading';
1
+ import { ObjectHomePageContext, type RecordHomePageContext } from './predictive-loading';
2
2
  import type { LexRequestStrategy } from './predictive-loading/request-strategy/lex-request-strategy';
3
3
  import { type LexRequest } from './predictive-loading/lex';
4
4
  export { PdlRequestPriority } from './predictive-loading';
@@ -42,7 +42,7 @@ export declare function saveRequestAsPrediction(request: LexRequest): void;
42
42
  * of when those predictions are completed.
43
43
  * - getPredictionSummary: Returns the count of exact and similar prediction requests
44
44
  */
45
- export declare function buildPredictorForContext(context: RecordHomePageContext): {
45
+ export declare function buildPredictorForContext(context: RecordHomePageContext | ObjectHomePageContext): {
46
46
  hasPredictions(): boolean;
47
47
  watchPageLoadForPredictions(): void;
48
48
  runPredictions(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.368.0",
3
+ "version": "1.370.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,48 +34,48 @@
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.43.1",
38
- "@luvio/tools-core": "5.43.1",
39
- "@salesforce/lds-adapters-apex": "^1.368.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.368.0",
37
+ "@luvio/service-provisioner": "5.44.0",
38
+ "@luvio/tools-core": "5.44.0",
39
+ "@salesforce/lds-adapters-apex": "^1.370.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.370.0",
41
41
  "@salesforce/lds-adapters-uiapi-lex": "^1.302.0",
42
- "@salesforce/lds-ads-bridge": "^1.368.0",
43
- "@salesforce/lds-aura-storage": "^1.368.0",
44
- "@salesforce/lds-bindings": "^1.368.0",
45
- "@salesforce/lds-instrumentation": "^1.368.0",
46
- "@salesforce/lds-network-aura": "^1.368.0",
47
- "@salesforce/lds-network-fetch": "^1.368.0",
42
+ "@salesforce/lds-ads-bridge": "^1.370.0",
43
+ "@salesforce/lds-aura-storage": "^1.370.0",
44
+ "@salesforce/lds-bindings": "^1.370.0",
45
+ "@salesforce/lds-instrumentation": "^1.370.0",
46
+ "@salesforce/lds-network-aura": "^1.370.0",
47
+ "@salesforce/lds-network-fetch": "^1.370.0",
48
48
  "jwt-encode": "1.0.1"
49
49
  },
50
50
  "dependencies": {
51
- "@luvio/command-aura-network": "5.43.1",
52
- "@luvio/command-aura-normalized-cache-control": "5.43.1",
53
- "@luvio/command-aura-resource-cache-control": "5.43.1",
54
- "@luvio/command-fetch-network": "5.43.1",
55
- "@luvio/command-http-normalized-cache-control": "5.43.1",
56
- "@luvio/command-ndjson": "5.43.1",
57
- "@luvio/command-network": "5.43.1",
58
- "@luvio/command-sse": "5.43.1",
59
- "@luvio/command-streaming": "5.43.1",
60
- "@luvio/network-adapter-composable": "0.158.3",
61
- "@luvio/network-adapter-fetch": "0.158.3",
62
- "@luvio/service-aura-network": "5.43.1",
63
- "@luvio/service-cache": "5.43.1",
64
- "@luvio/service-cache-control": "5.43.1",
65
- "@luvio/service-cache-inclusion-policy": "5.43.1",
66
- "@luvio/service-fetch-network": "5.43.1",
67
- "@luvio/service-instrument-command": "5.43.1",
68
- "@luvio/service-pubsub": "5.43.1",
69
- "@luvio/service-store": "5.43.1",
70
- "@luvio/utils": "5.43.1",
71
- "@salesforce/lds-adapters-uiapi-lex": "^1.368.0"
51
+ "@luvio/command-aura-network": "5.44.0",
52
+ "@luvio/command-aura-normalized-cache-control": "5.44.0",
53
+ "@luvio/command-aura-resource-cache-control": "5.44.0",
54
+ "@luvio/command-fetch-network": "5.44.0",
55
+ "@luvio/command-http-normalized-cache-control": "5.44.0",
56
+ "@luvio/command-ndjson": "5.44.0",
57
+ "@luvio/command-network": "5.44.0",
58
+ "@luvio/command-sse": "5.44.0",
59
+ "@luvio/command-streaming": "5.44.0",
60
+ "@luvio/network-adapter-composable": "0.158.7",
61
+ "@luvio/network-adapter-fetch": "0.158.7",
62
+ "@luvio/service-aura-network": "5.44.0",
63
+ "@luvio/service-cache": "5.44.0",
64
+ "@luvio/service-cache-control": "5.44.0",
65
+ "@luvio/service-cache-inclusion-policy": "5.44.0",
66
+ "@luvio/service-fetch-network": "5.44.0",
67
+ "@luvio/service-instrument-command": "5.44.0",
68
+ "@luvio/service-pubsub": "5.44.0",
69
+ "@luvio/service-store": "5.44.0",
70
+ "@luvio/utils": "5.44.0",
71
+ "@salesforce/lds-adapters-uiapi-lex": "^1.370.0"
72
72
  },
73
73
  "luvioBundlesize": [
74
74
  {
75
75
  "path": "./dist/ldsEngineCreator.js",
76
76
  "maxSize": {
77
77
  "none": "250 kB",
78
- "min": "110 kB",
78
+ "min": "111 kB",
79
79
  "compressed": "45 kB"
80
80
  }
81
81
  }