@salesforce/lds-runtime-mobile 1.273.1 → 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 +23 -43
  2. package/package.json +16 -16
  3. package/sfdc/main.js +23 -43
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
 
@@ -4400,9 +4388,7 @@ function rootRecordQuery(selection, input) {
4400
4388
  if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
4401
4389
  const timestamp = Number(queryMetadata.ingestionTimestamp);
4402
4390
  if (!isNaN(timestamp)) {
4403
- // adjust the timestamp to account for ingestion processing time
4404
- // 30s is used because this is the default record TTL
4405
- input.rootTimestamp = timestamp - 30000;
4391
+ input.rootTimestamp = timestamp;
4406
4392
  }
4407
4393
  }
4408
4394
  }
@@ -9068,11 +9054,7 @@ function findFieldInfo(objectInfo, fieldName) {
9068
9054
  }
9069
9055
  async function readIngestionTimestampForKey(key, query) {
9070
9056
  let ingestionTimestamp = 0;
9071
- const sql = `
9072
- SELECT json_extract(metadata, '${JSON_EXTRACT_PATH_INGESTION_TIMESTAMP}')
9073
- FROM lds_data
9074
- WHERE key IS ?
9075
- `;
9057
+ const sql = `SELECT json_extract(metadata, '${JSON_EXTRACT_PATH_INGESTION_TIMESTAMP}') FROM lds_data WHERE key IS ?`;
9076
9058
  const results = await query(sql, [key]);
9077
9059
  const [timestamp] = results.rows.map((row) => row[0]);
9078
9060
  if (timestamp !== null) {
@@ -9080,9 +9062,7 @@ async function readIngestionTimestampForKey(key, query) {
9080
9062
  if (isNaN(numericalTimestamp)) {
9081
9063
  return ingestionTimestamp;
9082
9064
  }
9083
- // adjust the timestamp to account for ingestion processing time
9084
- // 30s is used because this is the default record TTL
9085
- ingestionTimestamp = numericalTimestamp - 30000;
9065
+ ingestionTimestamp = numericalTimestamp;
9086
9066
  }
9087
9067
  return ingestionTimestamp;
9088
9068
  }
@@ -17968,4 +17948,4 @@ register({
17968
17948
  });
17969
17949
 
17970
17950
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17971
- // version: 1.273.1-37fe48f59
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.273.1",
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.273.1",
36
- "@salesforce/lds-bindings": "^1.273.1",
37
- "@salesforce/lds-instrumentation": "^1.273.1",
38
- "@salesforce/lds-priming": "^1.273.1",
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.273.1",
44
- "@salesforce/lds-drafts": "^1.273.1",
45
- "@salesforce/lds-drafts-adapters-uiapi": "^1.273.1",
46
- "@salesforce/lds-graphql-eval": "^1.273.1",
47
- "@salesforce/lds-network-adapter": "^1.273.1",
48
- "@salesforce/lds-network-nimbus": "^1.273.1",
49
- "@salesforce/lds-store-binary": "^1.273.1",
50
- "@salesforce/lds-store-nimbus": "^1.273.1",
51
- "@salesforce/lds-store-sql": "^1.273.1",
52
- "@salesforce/lds-utils-adapters": "^1.273.1",
53
- "@salesforce/nimbus-plugin-lds": "^1.273.1",
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
 
@@ -4400,9 +4388,7 @@ function rootRecordQuery(selection, input) {
4400
4388
  if (queryMetadata !== undefined && queryMetadata.ingestionTimestamp !== undefined) {
4401
4389
  const timestamp = Number(queryMetadata.ingestionTimestamp);
4402
4390
  if (!isNaN(timestamp)) {
4403
- // adjust the timestamp to account for ingestion processing time
4404
- // 30s is used because this is the default record TTL
4405
- input.rootTimestamp = timestamp - 30000;
4391
+ input.rootTimestamp = timestamp;
4406
4392
  }
4407
4393
  }
4408
4394
  }
@@ -9068,11 +9054,7 @@ function findFieldInfo(objectInfo, fieldName) {
9068
9054
  }
9069
9055
  async function readIngestionTimestampForKey(key, query) {
9070
9056
  let ingestionTimestamp = 0;
9071
- const sql = `
9072
- SELECT json_extract(metadata, '${JSON_EXTRACT_PATH_INGESTION_TIMESTAMP}')
9073
- FROM lds_data
9074
- WHERE key IS ?
9075
- `;
9057
+ const sql = `SELECT json_extract(metadata, '${JSON_EXTRACT_PATH_INGESTION_TIMESTAMP}') FROM lds_data WHERE key IS ?`;
9076
9058
  const results = await query(sql, [key]);
9077
9059
  const [timestamp] = results.rows.map((row) => row[0]);
9078
9060
  if (timestamp !== null) {
@@ -9080,9 +9062,7 @@ async function readIngestionTimestampForKey(key, query) {
9080
9062
  if (isNaN(numericalTimestamp)) {
9081
9063
  return ingestionTimestamp;
9082
9064
  }
9083
- // adjust the timestamp to account for ingestion processing time
9084
- // 30s is used because this is the default record TTL
9085
- ingestionTimestamp = numericalTimestamp - 30000;
9065
+ ingestionTimestamp = numericalTimestamp;
9086
9066
  }
9087
9067
  return ingestionTimestamp;
9088
9068
  }
@@ -17968,4 +17948,4 @@ register({
17968
17948
  });
17969
17949
 
17970
17950
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
17971
- // version: 1.273.1-37fe48f59
17951
+ // version: 1.275.0-c8b3e2f72