@salesforce/lds-runtime-aura 1.426.1 → 1.428.0-dev1

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.
@@ -813,14 +813,15 @@ class CacheControlCommand extends BaseCommand {
813
813
  return "query";
814
814
  }
815
815
  /**
816
- * Subscribes to cache update and invalidation events for reactive updates
816
+ * Subscribes to cache update, invalidation, and eviction events for reactive updates
817
817
  *
818
818
  * This method sets up subscriptions to listen for changes that affect the data returned
819
819
  * by this Command.
820
820
  *
821
- * By default, it subscribes to two types of events on the PubSub service:
821
+ * By default, it subscribes to three types of events on the PubSub service:
822
822
  * - 'cacheUpdate': Triggers a rebuild with the original instantiation time
823
- * - 'cacheInvalidation': Triggers a full refresh without time constraints
823
+ * - 'cacheInvalidation': Triggers a full refresh without time constraints (data marked stale)
824
+ * - 'cacheEviction': Triggers a full refresh without time constraints (data removed from cache)
824
825
  *
825
826
  * This method can be extended by subclasses to add additional subscriptions.
826
827
  *
@@ -845,7 +846,13 @@ class CacheControlCommand extends BaseCommand {
845
846
  callback: () => this.rerun().then(() => void 0),
846
847
  keys: this.keysUsed
847
848
  });
848
- this.unsubscribers.push(rebuildUnsubscribe, refreshUnsubscribe);
849
+ const evictionUnsubscribe = pubSub.subscribe({
850
+ type: "cacheEviction",
851
+ predicate: (event) => setOverlaps(event.data, this.keysUsed),
852
+ callback: () => this.rerun().then(() => void 0),
853
+ keys: this.keysUsed
854
+ });
855
+ this.unsubscribers.push(rebuildUnsubscribe, refreshUnsubscribe, evictionUnsubscribe);
849
856
  }
850
857
  /**
851
858
  * Unsubscribes from all stored subscriptions
@@ -2705,7 +2712,7 @@ function buildServiceDescriptor$d(luvio) {
2705
2712
  },
2706
2713
  };
2707
2714
  }
2708
- // version: 1.426.1-9fe18ee3ae
2715
+ // version: 1.428.0-dev1-52205c6c54
2709
2716
 
2710
2717
  /*!
2711
2718
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -3058,7 +3065,7 @@ function buildServiceDescriptor$9(notifyRecordUpdateAvailable, getNormalizedLuvi
3058
3065
  },
3059
3066
  };
3060
3067
  }
3061
- // version: 1.426.1-9fe18ee3ae
3068
+ // version: 1.428.0-dev1-52205c6c54
3062
3069
 
3063
3070
  /*!
3064
3071
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -5694,7 +5701,7 @@ function getEnvironmentSetting(name) {
5694
5701
  }
5695
5702
  return undefined;
5696
5703
  }
5697
- // version: 1.426.1-9fe18ee3ae
5704
+ // version: 1.428.0-dev1-52205c6c54
5698
5705
 
5699
5706
  const environmentHasAura = typeof window !== 'undefined' && typeof window.$A !== 'undefined';
5700
5707
  const defaultConfig = {
@@ -9628,6 +9635,9 @@ function buildUpdate(update, existing) {
9628
9635
  );
9629
9636
  return updatedCacheControl !== void 0 ? { type: "metadata", metadata: updatedCacheControl } : { type: "no-op" };
9630
9637
  }
9638
+ case "evict": {
9639
+ return { type: "delete" };
9640
+ }
9631
9641
  default:
9632
9642
  throw new Error(`Invalid update operation: ${update.type}`);
9633
9643
  }
@@ -9700,6 +9710,13 @@ class InMemoryCacheInclusionPolicy extends CacheInclusionPolicyService {
9700
9710
  });
9701
9711
  yield key;
9702
9712
  break;
9713
+ case "delete":
9714
+ this.write({
9715
+ l1: cache,
9716
+ writeToL1: (l1) => resolvedPromiseLike(ok(l1.delete(key)))
9717
+ });
9718
+ yield key;
9719
+ break;
9703
9720
  }
9704
9721
  }
9705
9722
  }
@@ -9971,6 +9988,10 @@ class AuraDurableCacheInclusionPolicy extends DurableCacheInclusionPolicy {
9971
9988
  * Find and modify entries matching a query
9972
9989
  * @param query - Cache query to match entries
9973
9990
  * @param cacheUpdate - Update to apply to matching entries
9991
+ *
9992
+ * Note: This method does not publish cache events. Callers should publish
9993
+ * appropriate cache events (e.g., 'cacheEviction') after eviction operations
9994
+ * to notify subscribers.
9974
9995
  */
9975
9996
  async *findAndModify(query, cacheUpdate) {
9976
9997
  if (!this.storage) {
@@ -9981,28 +10002,51 @@ class AuraDurableCacheInclusionPolicy extends DurableCacheInclusionPolicy {
9981
10002
  // Cannot pass specific keys since we don't know which entries match the query
9982
10003
  const allStoredData = (await this.storage.getAll());
9983
10004
  const modifiedEntries = [];
9984
- // Find and modify matching entries
10005
+ const deletedEntries = [];
10006
+ // Find and process matching entries
9985
10007
  for (const [storageKey, storedEntry] of Object.entries(allStoredData)) {
9986
10008
  const entry = storedEntry;
9987
10009
  const key = storageKey;
9988
10010
  if (entry && this.matchesQuery(key, entry, query)) {
9989
10011
  // Apply the update to the entry
9990
10012
  const updatedEntry = this.applyUpdate(entry, cacheUpdate);
9991
- if (updatedEntry) {
9992
- modifiedEntries.push({ storageKey, entry: updatedEntry, modifiedKey: key });
10013
+ if (updatedEntry.status === 'modified') {
10014
+ modifiedEntries.push({
10015
+ storageKey,
10016
+ entry: updatedEntry.entry,
10017
+ modifiedKey: key,
10018
+ });
10019
+ }
10020
+ else if (updatedEntry.status === 'deleted') {
10021
+ deletedEntries.push({ storageKey, deletedKey: key });
9993
10022
  }
10023
+ // 'no-op' case: do nothing
9994
10024
  }
9995
10025
  }
10026
+ let promises = [];
9996
10027
  // Save all modified entries back to storage
9997
10028
  if (modifiedEntries.length > 0 && this.storage) {
9998
- const promises = modifiedEntries.map(({ storageKey, entry }) => this.storage.set(storageKey, entry).catch((error) => {
10029
+ promises = modifiedEntries.map(({ storageKey, entry }) => this.storage.set(storageKey, entry).catch((error) => {
9999
10030
  console.warn(`Failed to update cache entry: ${storageKey}`, error);
10000
10031
  }));
10001
- await Promise.all(promises);
10002
- // Yield all modified keys
10003
- for (const { modifiedKey } of modifiedEntries) {
10004
- yield modifiedKey;
10005
- }
10032
+ }
10033
+ // Handle deleted entries
10034
+ if (deletedEntries.length > 0 && this.storage) {
10035
+ const keysToDelete = deletedEntries.map(({ storageKey }) => storageKey);
10036
+ promises.push(this.storage.removeAll(keysToDelete)
10037
+ .catch((error) => {
10038
+ console.warn(`Failed to remove cache entries: ${keysToDelete.join(', ')}`, error);
10039
+ })
10040
+ .then(() => { }));
10041
+ }
10042
+ await Promise.all(promises);
10043
+ // Yield all modified keys
10044
+ for (const { modifiedKey } of modifiedEntries) {
10045
+ yield modifiedKey;
10046
+ }
10047
+ // Yield all deleted keys
10048
+ for (const { deletedKey } of deletedEntries) {
10049
+ yield deletedKey;
10006
10050
  }
10007
10051
  }
10008
10052
  catch (error) {
@@ -10017,7 +10061,7 @@ class AuraDurableCacheInclusionPolicy extends DurableCacheInclusionPolicy {
10017
10061
  * @returns true if the entry matches the query
10018
10062
  */
10019
10063
  matchesQuery(key, entry, query) {
10020
- if (!query)
10064
+ if (!query || Object.keys(query).length === 0)
10021
10065
  return true;
10022
10066
  // Handle logical operators
10023
10067
  if (this.isAndQuery(query)) {
@@ -10075,32 +10119,37 @@ class AuraDurableCacheInclusionPolicy extends DurableCacheInclusionPolicy {
10075
10119
  * Apply an update to a cache entry
10076
10120
  * @param entry - Original cache entry
10077
10121
  * @param update - Update to apply
10078
- * @returns Updated entry or null if no update needed
10122
+ * @returns Object indicating the result: modified entry, deleted marker, or no-op
10079
10123
  */
10080
10124
  applyUpdate(entry, update) {
10081
10125
  try {
10082
10126
  const updateResult = this.buildUpdate(update, entry);
10083
10127
  switch (updateResult.type) {
10084
10128
  case 'entry':
10085
- return updateResult.entry;
10129
+ return { status: 'modified', entry: updateResult.entry };
10086
10130
  case 'metadata':
10087
10131
  // Create a new entry with updated metadata
10088
10132
  return {
10089
- ...entry,
10090
- metadata: {
10091
- ...entry.metadata,
10092
- cacheControl: updateResult.metadata,
10133
+ status: 'modified',
10134
+ entry: {
10135
+ ...entry,
10136
+ metadata: {
10137
+ ...entry.metadata,
10138
+ cacheControl: updateResult.metadata,
10139
+ },
10093
10140
  },
10094
10141
  };
10142
+ case 'delete':
10143
+ return { status: 'deleted' };
10095
10144
  case 'no-op':
10096
- return null; // No changes needed
10145
+ return { status: 'no-op' };
10097
10146
  default:
10098
- return null;
10147
+ return { status: 'no-op' };
10099
10148
  }
10100
10149
  }
10101
10150
  catch (error) {
10102
10151
  console.warn('Failed to apply update to cache entry:', error);
10103
- return null;
10152
+ return { status: 'no-op' };
10104
10153
  }
10105
10154
  }
10106
10155
  /**
@@ -10116,6 +10165,9 @@ class AuraDurableCacheInclusionPolicy extends DurableCacheInclusionPolicy {
10116
10165
  return updatedCacheControl !== undefined
10117
10166
  ? { type: 'metadata', metadata: updatedCacheControl }
10118
10167
  : { type: 'no-op' };
10168
+ case 'evict':
10169
+ // Eviction removes the entry entirely from storage
10170
+ return { type: 'delete' };
10119
10171
  default:
10120
10172
  throw new Error(`Invalid update operation: ${update.type}`);
10121
10173
  }
@@ -10480,4 +10532,4 @@ function ldsEngineCreator() {
10480
10532
  }
10481
10533
 
10482
10534
  export { LexRequestStrategy, PdlPrefetcherEventType, PdlRequestPriority, buildPredictorForContext, configService, ldsEngineCreator as default, initializeLDS, initializeOneStore, notifyUpdateAvailableFactory, registerRequestStrategy, saveRequestAsPrediction, subscribeToPrefetcherEvents, unregisterRequestStrategy, whenPredictionsReady };
10483
- // version: 1.426.1-37e68ccef8
10535
+ // version: 1.428.0-dev1-c95a813572
@@ -34,6 +34,10 @@ export declare class AuraDurableCacheInclusionPolicy extends DurableCacheInclusi
34
34
  * Find and modify entries matching a query
35
35
  * @param query - Cache query to match entries
36
36
  * @param cacheUpdate - Update to apply to matching entries
37
+ *
38
+ * Note: This method does not publish cache events. Callers should publish
39
+ * appropriate cache events (e.g., 'cacheEviction') after eviction operations
40
+ * to notify subscribers.
37
41
  */
38
42
  findAndModify(query: CacheQuery, cacheUpdate: CacheUpdate): AsyncGenerator<Key, void, unknown>;
39
43
  /**
@@ -53,7 +57,7 @@ export declare class AuraDurableCacheInclusionPolicy extends DurableCacheInclusi
53
57
  * Apply an update to a cache entry
54
58
  * @param entry - Original cache entry
55
59
  * @param update - Update to apply
56
- * @returns Updated entry or null if no update needed
60
+ * @returns Object indicating the result: modified entry, deleted marker, or no-op
57
61
  */
58
62
  private applyUpdate;
59
63
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.426.1",
3
+ "version": "1.428.0-dev1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,51 +34,51 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
35
35
  },
36
36
  "devDependencies": {
37
- "@conduit-client/service-provisioner": "3.17.3",
38
- "@conduit-client/tools-core": "3.17.3",
39
- "@salesforce/lds-adapters-apex": "^1.426.1",
40
- "@salesforce/lds-adapters-uiapi": "^1.426.1",
41
- "@salesforce/lds-ads-bridge": "^1.426.1",
42
- "@salesforce/lds-aura-storage": "^1.426.1",
43
- "@salesforce/lds-bindings": "^1.426.1",
44
- "@salesforce/lds-instrumentation": "^1.426.1",
45
- "@salesforce/lds-network-aura": "^1.426.1",
46
- "@salesforce/lds-network-fetch": "^1.426.1",
37
+ "@conduit-client/service-provisioner": "3.18.0",
38
+ "@conduit-client/tools-core": "3.18.0",
39
+ "@salesforce/lds-adapters-apex": "^1.428.0-dev1",
40
+ "@salesforce/lds-adapters-uiapi": "^1.428.0-dev1",
41
+ "@salesforce/lds-ads-bridge": "^1.428.0-dev1",
42
+ "@salesforce/lds-aura-storage": "^1.428.0-dev1",
43
+ "@salesforce/lds-bindings": "^1.428.0-dev1",
44
+ "@salesforce/lds-instrumentation": "^1.428.0-dev1",
45
+ "@salesforce/lds-network-aura": "^1.428.0-dev1",
46
+ "@salesforce/lds-network-fetch": "^1.428.0-dev1",
47
47
  "jwt-encode": "1.0.1"
48
48
  },
49
49
  "dependencies": {
50
- "@conduit-client/command-aura-graphql-normalized-cache-control": "3.17.3",
51
- "@conduit-client/command-aura-network": "3.17.3",
52
- "@conduit-client/command-aura-normalized-cache-control": "3.17.3",
53
- "@conduit-client/command-aura-resource-cache-control": "3.17.3",
54
- "@conduit-client/command-fetch-network": "3.17.3",
55
- "@conduit-client/command-http-graphql-normalized-cache-control": "3.17.3",
56
- "@conduit-client/command-http-normalized-cache-control": "3.17.3",
57
- "@conduit-client/command-ndjson": "3.17.3",
58
- "@conduit-client/command-network": "3.17.3",
59
- "@conduit-client/command-sse": "3.17.3",
60
- "@conduit-client/command-streaming": "3.17.3",
61
- "@conduit-client/service-aura-network": "3.17.3",
62
- "@conduit-client/service-bindings-imperative": "3.17.3",
63
- "@conduit-client/service-bindings-lwc": "3.17.3",
64
- "@conduit-client/service-cache": "3.17.3",
65
- "@conduit-client/service-cache-control": "3.17.3",
66
- "@conduit-client/service-cache-inclusion-policy": "3.17.3",
67
- "@conduit-client/service-config": "3.17.3",
68
- "@conduit-client/service-feature-flags": "3.17.3",
69
- "@conduit-client/service-fetch-network": "3.17.3",
70
- "@conduit-client/service-instrument-command": "3.17.3",
71
- "@conduit-client/service-pubsub": "3.17.3",
72
- "@conduit-client/service-store": "3.17.3",
73
- "@conduit-client/utils": "3.17.3",
50
+ "@conduit-client/command-aura-graphql-normalized-cache-control": "3.18.0",
51
+ "@conduit-client/command-aura-network": "3.18.0",
52
+ "@conduit-client/command-aura-normalized-cache-control": "3.18.0",
53
+ "@conduit-client/command-aura-resource-cache-control": "3.18.0",
54
+ "@conduit-client/command-fetch-network": "3.18.0",
55
+ "@conduit-client/command-http-graphql-normalized-cache-control": "3.18.0",
56
+ "@conduit-client/command-http-normalized-cache-control": "3.18.0",
57
+ "@conduit-client/command-ndjson": "3.18.0",
58
+ "@conduit-client/command-network": "3.18.0",
59
+ "@conduit-client/command-sse": "3.18.0",
60
+ "@conduit-client/command-streaming": "3.18.0",
61
+ "@conduit-client/service-aura-network": "3.18.0",
62
+ "@conduit-client/service-bindings-imperative": "3.18.0",
63
+ "@conduit-client/service-bindings-lwc": "3.18.0",
64
+ "@conduit-client/service-cache": "3.18.0",
65
+ "@conduit-client/service-cache-control": "3.18.0",
66
+ "@conduit-client/service-cache-inclusion-policy": "3.18.0",
67
+ "@conduit-client/service-config": "3.18.0",
68
+ "@conduit-client/service-feature-flags": "3.18.0",
69
+ "@conduit-client/service-fetch-network": "3.18.0",
70
+ "@conduit-client/service-instrument-command": "3.18.0",
71
+ "@conduit-client/service-pubsub": "3.18.0",
72
+ "@conduit-client/service-store": "3.18.0",
73
+ "@conduit-client/utils": "3.18.0",
74
74
  "@luvio/network-adapter-composable": "0.160.3",
75
75
  "@luvio/network-adapter-fetch": "0.160.3",
76
76
  "@lwc/state": "^0.29.0",
77
- "@salesforce/lds-adapters-onestore-graphql": "^1.426.1",
77
+ "@salesforce/lds-adapters-onestore-graphql": "^1.428.0-dev1",
78
78
  "@salesforce/lds-adapters-uiapi-lex": "^1.415.0",
79
- "@salesforce/lds-durable-storage": "^1.426.1",
80
- "@salesforce/lds-luvio-service": "^1.426.1",
81
- "@salesforce/lds-luvio-uiapi-records-service": "^1.426.1"
79
+ "@salesforce/lds-durable-storage": "^1.428.0-dev1",
80
+ "@salesforce/lds-luvio-service": "^1.428.0-dev1",
81
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.428.0-dev1"
82
82
  },
83
83
  "luvioBundlesize": [
84
84
  {