@salesforce/lds-runtime-mobile 1.274.0 → 1.275.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 (3) hide show
  1. package/dist/main.js +20 -32
  2. package/package.json +16 -16
  3. package/sfdc/main.js +20 -32
package/dist/main.js CHANGED
@@ -786,7 +786,7 @@ class DurableTTLStore {
786
786
  }
787
787
  }
788
788
 
789
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, crossEnvironmentNotifier, durableStoreErrorHandler, redirects, additionalDurableStoreOperations = [], enableDurableMetadataRefresh = false) {
789
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, redirects, additionalDurableStoreOperations = [], enableDurableMetadataRefresh = false) {
790
790
  const durableRecords = create$6(null);
791
791
  const refreshedDurableRecords = create$6(null);
792
792
  const evictedRecords = create$6(null);
@@ -814,7 +814,10 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, crossEnviro
814
814
  const entries = wasVisited === true || enableDurableMetadataRefresh === false
815
815
  ? durableRecords
816
816
  : refreshedDurableRecords;
817
- setRecordTo(entries, key, record, metadata);
817
+ const isMetadataRefresh = entries === refreshedDurableRecords;
818
+ setRecordTo(entries, key,
819
+ // dont send record data with metadata refresh
820
+ isMetadataRefresh ? undefined : record, metadata);
818
821
  }
819
822
  const durableStoreOperations = additionalDurableStoreOperations;
820
823
  const recordKeys = keys$7(durableRecords);
@@ -826,21 +829,14 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, crossEnviro
826
829
  segment: DefaultDurableSegment,
827
830
  });
828
831
  }
829
- if (keys$7(refreshedDurableRecords).length > 0) {
832
+ const refreshKeys = keys$7(refreshedDurableRecords);
833
+ if (refreshKeys.length > 0) {
830
834
  // publishes with only metadata updates
831
835
  durableStoreOperations.push({
832
836
  type: 'setMetadata',
833
837
  entries: refreshedDurableRecords,
834
838
  segment: DefaultDurableSegment,
835
839
  });
836
- if (crossEnvironmentNotifier !== undefined) {
837
- crossEnvironmentNotifier.notifyCrossEnvironments({
838
- data: {
839
- refreshedDurableRecords,
840
- },
841
- type: 'Update',
842
- });
843
- }
844
840
  }
845
841
  // redirects
846
842
  redirects.forEach((value, key) => {
@@ -1142,14 +1138,17 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1142
1138
  }
1143
1139
  // process metadata only refreshes
1144
1140
  if (metadataRefreshSegmentKeys.length > 0) {
1145
- const entries = await durableStore.getMetadata(metadataRefreshSegmentKeys, DefaultDurableSegment);
1146
- if (entries !== undefined) {
1147
- const entryKeys = keys$7(entries);
1148
- for (let i = 0, len = entryKeys.length; i < len; i++) {
1149
- const entryKey = entryKeys[i];
1150
- const { metadata } = entries[entryKey];
1151
- if (metadata !== undefined) {
1152
- environment.putStoreMetadata(entryKey, metadata, false);
1141
+ const filteredKeys = metadataRefreshSegmentKeys.filter((s) => environment.storeKeyExists(s));
1142
+ if (filteredKeys.length > 0) {
1143
+ const entries = await durableStore.getMetadata(filteredKeys, DefaultDurableSegment);
1144
+ if (entries !== undefined) {
1145
+ const entryKeys = keys$7(entries);
1146
+ for (let i = 0, len = entryKeys.length; i < len; i++) {
1147
+ const entryKey = entryKeys[i];
1148
+ const { metadata } = entries[entryKey];
1149
+ if (metadata !== undefined) {
1150
+ environment.putStoreMetadata(entryKey, metadata, false);
1151
+ }
1153
1152
  }
1154
1153
  }
1155
1154
  }
@@ -1172,15 +1171,6 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1172
1171
  }
1173
1172
  }
1174
1173
  });
1175
- let notifier;
1176
- const getCrossEnvironmentNotifier = function () {
1177
- validateNotDisposed();
1178
- return notifier;
1179
- };
1180
- const setCrossEnvironmentNotifier = function (crossEnvironmentNotifier) {
1181
- validateNotDisposed();
1182
- notifier = crossEnvironmentNotifier;
1183
- };
1184
1174
  const dispose = function () {
1185
1175
  validateNotDisposed();
1186
1176
  disposed = true;
@@ -1233,7 +1223,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1233
1223
  if (stagingStore === null) {
1234
1224
  return Promise.resolve();
1235
1225
  }
1236
- const promise = flushInMemoryStoreValuesToDurableStore(stagingStore, durableStore, getCrossEnvironmentNotifier(), durableStoreErrorHandler, new Map(pendingStoreRedirects), additionalDurableStoreOperations, enableDurableMetadataRefresh);
1226
+ const promise = flushInMemoryStoreValuesToDurableStore(stagingStore, durableStore, durableStoreErrorHandler, new Map(pendingStoreRedirects), additionalDurableStoreOperations, enableDurableMetadataRefresh);
1237
1227
  pendingStoreRedirects.clear();
1238
1228
  stagingStore = null;
1239
1229
  return promise;
@@ -1603,8 +1593,6 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1603
1593
  handleErrorResponse: { value: handleErrorResponse },
1604
1594
  getNotifyChangeStoreEntries: { value: getNotifyChangeStoreEntries },
1605
1595
  notifyStoreUpdateAvailable: { value: notifyStoreUpdateAvailable },
1606
- getCrossEnvironmentNotifier: { value: getCrossEnvironmentNotifier },
1607
- setCrossEnvironmentNotifier: { value: setCrossEnvironmentNotifier },
1608
1596
  });
1609
1597
  }
1610
1598
 
@@ -17960,4 +17948,4 @@ register({
17960
17948
  });
17961
17949
 
17962
17950
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17963
- // version: 1.274.0-67da496e8
17951
+ // version: 1.275.0-c8b3e2f72
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.274.0",
3
+ "version": "1.275.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,25 +32,25 @@
32
32
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
33
33
  },
34
34
  "dependencies": {
35
- "@salesforce/lds-adapters-uiapi": "^1.274.0",
36
- "@salesforce/lds-bindings": "^1.274.0",
37
- "@salesforce/lds-instrumentation": "^1.274.0",
38
- "@salesforce/lds-priming": "^1.274.0",
35
+ "@salesforce/lds-adapters-uiapi": "^1.275.0",
36
+ "@salesforce/lds-bindings": "^1.275.0",
37
+ "@salesforce/lds-instrumentation": "^1.275.0",
38
+ "@salesforce/lds-priming": "^1.275.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "244.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-adapters-graphql": "^1.274.0",
44
- "@salesforce/lds-drafts": "^1.274.0",
45
- "@salesforce/lds-drafts-adapters-uiapi": "^1.274.0",
46
- "@salesforce/lds-graphql-eval": "^1.274.0",
47
- "@salesforce/lds-network-adapter": "^1.274.0",
48
- "@salesforce/lds-network-nimbus": "^1.274.0",
49
- "@salesforce/lds-store-binary": "^1.274.0",
50
- "@salesforce/lds-store-nimbus": "^1.274.0",
51
- "@salesforce/lds-store-sql": "^1.274.0",
52
- "@salesforce/lds-utils-adapters": "^1.274.0",
53
- "@salesforce/nimbus-plugin-lds": "^1.274.0",
43
+ "@salesforce/lds-adapters-graphql": "^1.275.0",
44
+ "@salesforce/lds-drafts": "^1.275.0",
45
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.275.0",
46
+ "@salesforce/lds-graphql-eval": "^1.275.0",
47
+ "@salesforce/lds-network-adapter": "^1.275.0",
48
+ "@salesforce/lds-network-nimbus": "^1.275.0",
49
+ "@salesforce/lds-store-binary": "^1.275.0",
50
+ "@salesforce/lds-store-nimbus": "^1.275.0",
51
+ "@salesforce/lds-store-sql": "^1.275.0",
52
+ "@salesforce/lds-utils-adapters": "^1.275.0",
53
+ "@salesforce/nimbus-plugin-lds": "^1.275.0",
54
54
  "babel-plugin-dynamic-import-node": "^2.3.3",
55
55
  "wait-for-expect": "^3.0.2"
56
56
  },
package/sfdc/main.js CHANGED
@@ -786,7 +786,7 @@ class DurableTTLStore {
786
786
  }
787
787
  }
788
788
 
789
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, crossEnvironmentNotifier, durableStoreErrorHandler, redirects, additionalDurableStoreOperations = [], enableDurableMetadataRefresh = false) {
789
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, redirects, additionalDurableStoreOperations = [], enableDurableMetadataRefresh = false) {
790
790
  const durableRecords = create$6(null);
791
791
  const refreshedDurableRecords = create$6(null);
792
792
  const evictedRecords = create$6(null);
@@ -814,7 +814,10 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, crossEnviro
814
814
  const entries = wasVisited === true || enableDurableMetadataRefresh === false
815
815
  ? durableRecords
816
816
  : refreshedDurableRecords;
817
- setRecordTo(entries, key, record, metadata);
817
+ const isMetadataRefresh = entries === refreshedDurableRecords;
818
+ setRecordTo(entries, key,
819
+ // dont send record data with metadata refresh
820
+ isMetadataRefresh ? undefined : record, metadata);
818
821
  }
819
822
  const durableStoreOperations = additionalDurableStoreOperations;
820
823
  const recordKeys = keys$7(durableRecords);
@@ -826,21 +829,14 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, crossEnviro
826
829
  segment: DefaultDurableSegment,
827
830
  });
828
831
  }
829
- if (keys$7(refreshedDurableRecords).length > 0) {
832
+ const refreshKeys = keys$7(refreshedDurableRecords);
833
+ if (refreshKeys.length > 0) {
830
834
  // publishes with only metadata updates
831
835
  durableStoreOperations.push({
832
836
  type: 'setMetadata',
833
837
  entries: refreshedDurableRecords,
834
838
  segment: DefaultDurableSegment,
835
839
  });
836
- if (crossEnvironmentNotifier !== undefined) {
837
- crossEnvironmentNotifier.notifyCrossEnvironments({
838
- data: {
839
- refreshedDurableRecords,
840
- },
841
- type: 'Update',
842
- });
843
- }
844
840
  }
845
841
  // redirects
846
842
  redirects.forEach((value, key) => {
@@ -1142,14 +1138,17 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1142
1138
  }
1143
1139
  // process metadata only refreshes
1144
1140
  if (metadataRefreshSegmentKeys.length > 0) {
1145
- const entries = await durableStore.getMetadata(metadataRefreshSegmentKeys, DefaultDurableSegment);
1146
- if (entries !== undefined) {
1147
- const entryKeys = keys$7(entries);
1148
- for (let i = 0, len = entryKeys.length; i < len; i++) {
1149
- const entryKey = entryKeys[i];
1150
- const { metadata } = entries[entryKey];
1151
- if (metadata !== undefined) {
1152
- environment.putStoreMetadata(entryKey, metadata, false);
1141
+ const filteredKeys = metadataRefreshSegmentKeys.filter((s) => environment.storeKeyExists(s));
1142
+ if (filteredKeys.length > 0) {
1143
+ const entries = await durableStore.getMetadata(filteredKeys, DefaultDurableSegment);
1144
+ if (entries !== undefined) {
1145
+ const entryKeys = keys$7(entries);
1146
+ for (let i = 0, len = entryKeys.length; i < len; i++) {
1147
+ const entryKey = entryKeys[i];
1148
+ const { metadata } = entries[entryKey];
1149
+ if (metadata !== undefined) {
1150
+ environment.putStoreMetadata(entryKey, metadata, false);
1151
+ }
1153
1152
  }
1154
1153
  }
1155
1154
  }
@@ -1172,15 +1171,6 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1172
1171
  }
1173
1172
  }
1174
1173
  });
1175
- let notifier;
1176
- const getCrossEnvironmentNotifier = function () {
1177
- validateNotDisposed();
1178
- return notifier;
1179
- };
1180
- const setCrossEnvironmentNotifier = function (crossEnvironmentNotifier) {
1181
- validateNotDisposed();
1182
- notifier = crossEnvironmentNotifier;
1183
- };
1184
1174
  const dispose = function () {
1185
1175
  validateNotDisposed();
1186
1176
  disposed = true;
@@ -1233,7 +1223,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1233
1223
  if (stagingStore === null) {
1234
1224
  return Promise.resolve();
1235
1225
  }
1236
- const promise = flushInMemoryStoreValuesToDurableStore(stagingStore, durableStore, getCrossEnvironmentNotifier(), durableStoreErrorHandler, new Map(pendingStoreRedirects), additionalDurableStoreOperations, enableDurableMetadataRefresh);
1226
+ const promise = flushInMemoryStoreValuesToDurableStore(stagingStore, durableStore, durableStoreErrorHandler, new Map(pendingStoreRedirects), additionalDurableStoreOperations, enableDurableMetadataRefresh);
1237
1227
  pendingStoreRedirects.clear();
1238
1228
  stagingStore = null;
1239
1229
  return promise;
@@ -1603,8 +1593,6 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1603
1593
  handleErrorResponse: { value: handleErrorResponse },
1604
1594
  getNotifyChangeStoreEntries: { value: getNotifyChangeStoreEntries },
1605
1595
  notifyStoreUpdateAvailable: { value: notifyStoreUpdateAvailable },
1606
- getCrossEnvironmentNotifier: { value: getCrossEnvironmentNotifier },
1607
- setCrossEnvironmentNotifier: { value: setCrossEnvironmentNotifier },
1608
1596
  });
1609
1597
  }
1610
1598
 
@@ -17960,4 +17948,4 @@ register({
17960
17948
  });
17961
17949
 
17962
17950
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17963
- // version: 1.274.0-67da496e8
17951
+ // version: 1.275.0-c8b3e2f72