@salesforce/lds-runtime-bridge 1.271.0 → 1.272.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.
@@ -301,7 +301,7 @@ class DurableTTLStore {
301
301
  }
302
302
  }
303
303
 
304
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, redirects, additionalDurableStoreOperations = [], enableDurableMetadataRefresh = false) {
304
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, crossEnvironmentNotifier, durableStoreErrorHandler, redirects, additionalDurableStoreOperations = [], enableDurableMetadataRefresh = false) {
305
305
  const durableRecords = create$3(null);
306
306
  const refreshedDurableRecords = create$3(null);
307
307
  const evictedRecords = create$3(null);
@@ -348,6 +348,14 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
348
348
  entries: refreshedDurableRecords,
349
349
  segment: DefaultDurableSegment,
350
350
  });
351
+ if (crossEnvironmentNotifier !== undefined) {
352
+ crossEnvironmentNotifier.notifyCrossEnvironments({
353
+ data: {
354
+ refreshedDurableRecords,
355
+ },
356
+ type: 'Update',
357
+ });
358
+ }
351
359
  }
352
360
  // redirects
353
361
  redirects.forEach((value, key) => {
@@ -679,6 +687,15 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
679
687
  }
680
688
  }
681
689
  });
690
+ let notifier;
691
+ const getCrossEnvironmentNotifier = function () {
692
+ validateNotDisposed();
693
+ return notifier;
694
+ };
695
+ const setCrossEnvironmentNotifier = function (crossEnvironmentNotifier) {
696
+ validateNotDisposed();
697
+ notifier = crossEnvironmentNotifier;
698
+ };
682
699
  const dispose = function () {
683
700
  validateNotDisposed();
684
701
  disposed = true;
@@ -731,7 +748,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
731
748
  if (stagingStore === null) {
732
749
  return Promise.resolve();
733
750
  }
734
- const promise = flushInMemoryStoreValuesToDurableStore(stagingStore, durableStore, durableStoreErrorHandler, new Map(pendingStoreRedirects), additionalDurableStoreOperations, enableDurableMetadataRefresh);
751
+ const promise = flushInMemoryStoreValuesToDurableStore(stagingStore, durableStore, getCrossEnvironmentNotifier(), durableStoreErrorHandler, new Map(pendingStoreRedirects), additionalDurableStoreOperations, enableDurableMetadataRefresh);
735
752
  pendingStoreRedirects.clear();
736
753
  stagingStore = null;
737
754
  return promise;
@@ -900,6 +917,10 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
900
917
  }
901
918
  return {};
902
919
  };
920
+ const getIngestStagingStore = function () {
921
+ validateNotDisposed();
922
+ return stagingStore === null || stagingStore === void 0 ? void 0 : stagingStore.fallbackStringKeyInMemoryStore;
923
+ };
903
924
  const handleSuccessResponse = async function (ingestAndBroadcastFunc, getResponseCacheKeysFunc) {
904
925
  validateNotDisposed();
905
926
  const cacheKeyMap = getResponseCacheKeysFunc();
@@ -1092,10 +1113,13 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1092
1113
  applyCachePolicy: { value: applyCachePolicy },
1093
1114
  getIngestStagingStoreRecords: { value: getIngestStagingStoreRecords },
1094
1115
  getIngestStagingStoreMetadata: { value: getIngestStagingStoreMetadata },
1116
+ getIngestStagingStore: { value: getIngestStagingStore },
1095
1117
  handleSuccessResponse: { value: handleSuccessResponse },
1096
1118
  handleErrorResponse: { value: handleErrorResponse },
1097
1119
  getNotifyChangeStoreEntries: { value: getNotifyChangeStoreEntries },
1098
1120
  notifyStoreUpdateAvailable: { value: notifyStoreUpdateAvailable },
1121
+ getCrossEnvironmentNotifier: { value: getCrossEnvironmentNotifier },
1122
+ setCrossEnvironmentNotifier: { value: setCrossEnvironmentNotifier },
1099
1123
  });
1100
1124
  }
1101
1125
 
@@ -3665,7 +3689,7 @@ function normalizeRecordFields(key, entry) {
3665
3689
  * @param normalizedRecord Record containing normalized field links
3666
3690
  * @param recordStore a store containing referenced record fields
3667
3691
  */
3668
- function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntries) {
3692
+ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntries, store) {
3669
3693
  const fields = normalizedRecord.fields;
3670
3694
  const filteredFields = {};
3671
3695
  const links = {};
@@ -3692,6 +3716,19 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
3692
3716
  if (ref !== undefined) {
3693
3717
  filteredFields[fieldName] = ref;
3694
3718
  }
3719
+ else {
3720
+ // if we have a store to read, try to find the field there too
3721
+ // The durable ingest staging store may pass through to L1, and
3722
+ // not all fields are necessarily published every time, so it is
3723
+ // important to check L1 and not just the fields being published,
3724
+ // otherwise we risk truncating the fields on the record.
3725
+ if (store) {
3726
+ ref = store.readEntry(__ref);
3727
+ if (ref !== undefined) {
3728
+ filteredFields[fieldName] = ref;
3729
+ }
3730
+ }
3731
+ }
3695
3732
  }
3696
3733
  // we want to preserve fields that are missing nodes
3697
3734
  if (filteredFields[fieldName] !== undefined || field.isMissing === true) {
@@ -3713,7 +3750,7 @@ function getDenormalizedKey(originalKey, recordId, luvio) {
3713
3750
  }
3714
3751
  return keyBuilderRecord(luvio, { recordId });
3715
3752
  }
3716
- function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata) {
3753
+ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore) {
3717
3754
  const getEntries = function (entries, segment) {
3718
3755
  // this HOF only inspects records in the default segment
3719
3756
  if (segment !== DefaultDurableSegment) {
@@ -3781,6 +3818,7 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
3781
3818
  const putRecordViews = {};
3782
3819
  const storeRecords = getStoreRecords !== undefined ? getStoreRecords() : {};
3783
3820
  const storeMetadata = getStoreMetadata !== undefined ? getStoreMetadata() : {};
3821
+ const store = getStore();
3784
3822
  for (let i = 0, len = keys$1.length; i < len; i++) {
3785
3823
  const key = keys$1[i];
3786
3824
  let value = entries[key];
@@ -3827,7 +3865,7 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
3827
3865
  metadataVersion: DURABLE_METADATA_VERSION,
3828
3866
  };
3829
3867
  }
3830
- const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries);
3868
+ const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
3831
3869
  putEntries[recordKey] = {
3832
3870
  data: denormalizedRecord,
3833
3871
  metadata,
@@ -3920,6 +3958,7 @@ new CachedGraphQLSchema();
3920
3958
  let luvio;
3921
3959
  let getIngestRecords;
3922
3960
  let getIngestMetadata;
3961
+ let getIngestStore;
3923
3962
  // LdsSqliteStore plugin helper
3924
3963
  function getNimbusDurableStore() {
3925
3964
  const resolvedPlugin = __nimbus.plugins.LdsSqliteStore;
@@ -3931,7 +3970,7 @@ function getNimbusDurableStore() {
3931
3970
  * See TD-0153300 for moving RecordDenormalizingDurableStore out of lds-drafts
3932
3971
  */
3933
3972
  function createRecordDenormingStore(luvio, durableStore) {
3934
- const recordDenormingStore = makeRecordDenormalizingDurableStore(luvio, durableStore, () => getIngestRecords(), () => getIngestMetadata());
3973
+ const recordDenormingStore = makeRecordDenormalizingDurableStore(luvio, durableStore, () => getIngestRecords(), () => getIngestMetadata(), () => getIngestStore());
3935
3974
  return recordDenormingStore;
3936
3975
  }
3937
3976
  function getRuntime() {
@@ -3947,6 +3986,7 @@ function getRuntime() {
3947
3986
  // Set ingest records/metadata properties from durable environment
3948
3987
  getIngestRecords = durableEnv.getIngestStagingStoreRecords;
3949
3988
  getIngestMetadata = durableEnv.getIngestStagingStoreMetadata;
3989
+ getIngestStore = durableEnv.getIngestStagingStore;
3950
3990
  // Return new luvio instance
3951
3991
  luvio = new Luvio(durableEnv, {
3952
3992
  instrument: instrumentLuvio,
@@ -3972,4 +4012,4 @@ function ldsRuntimeBridge() {
3972
4012
  }
3973
4013
 
3974
4014
  export { ldsRuntimeBridge as default };
3975
- // version: 1.271.0-b5964d6f9
4015
+ // version: 1.272.0-61ac36df4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-bridge",
3
- "version": "1.271.0",
3
+ "version": "1.272.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for bridge.app.",
6
6
  "main": "dist/ldsRuntimeBridge.js",
@@ -34,17 +34,17 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-bridge"
35
35
  },
36
36
  "dependencies": {
37
- "@salesforce/lds-adapters-uiapi": "^1.271.0",
38
- "@salesforce/lds-instrumentation": "^1.271.0",
37
+ "@salesforce/lds-adapters-uiapi": "^1.272.0",
38
+ "@salesforce/lds-instrumentation": "^1.272.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "244.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-drafts-adapters-uiapi": "^1.271.0",
44
- "@salesforce/lds-network-aura": "^1.271.0",
45
- "@salesforce/lds-runtime-aura": "^1.271.0",
46
- "@salesforce/lds-store-nimbus": "^1.271.0",
47
- "@salesforce/nimbus-plugin-lds": "^1.271.0",
43
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.272.0",
44
+ "@salesforce/lds-network-aura": "^1.272.0",
45
+ "@salesforce/lds-runtime-aura": "^1.272.0",
46
+ "@salesforce/lds-store-nimbus": "^1.272.0",
47
+ "@salesforce/nimbus-plugin-lds": "^1.272.0",
48
48
  "babel-plugin-dynamic-import-node": "^2.3.3"
49
49
  },
50
50
  "luvioBundlesize": [