@salesforce/lds-runtime-bridge 1.266.0-dev24 → 1.266.0-dev26

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.
@@ -696,7 +696,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
696
696
  // because we do not want some other code attempting to use the
697
697
  // in-memory values before the durable store onChanged handler
698
698
  // calls back and revives the values to in-memory
699
- environment.storeEvict(key);
699
+ environment.storeDealloc(key);
700
700
  };
701
701
  const publishStoreMetadata = function (recordId, storeMetadata) {
702
702
  validateNotDisposed();
@@ -1106,7 +1106,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
1106
1106
  });
1107
1107
  }
1108
1108
 
1109
- const { keys: keys$2, create: create$2, assign: assign$2, entries: entries$1, values: values$2 } = Object;
1109
+ const { keys: keys$2, create: create$2, assign: assign$2, entries: entries$2, values: values$2 } = Object;
1110
1110
  const { stringify: stringify$1, parse: parse$1 } = JSON;
1111
1111
 
1112
1112
  function selectColumnsFromTableWhereKeyIn(columnNames, table, keyColumnName, whereIn) {
@@ -1362,6 +1362,9 @@ class NimbusSqliteStore {
1362
1362
  isEvalSupported() {
1363
1363
  return true;
1364
1364
  }
1365
+ isBatchUpdateSupported() {
1366
+ return this.supportsBatchUpdates;
1367
+ }
1365
1368
  query(sql, params) {
1366
1369
  return new Promise((resolve, reject) => {
1367
1370
  this.plugin.query(sql, params, (result) => {
@@ -1404,6 +1407,7 @@ class NimbusSqliteStore {
1404
1407
  return this.batchOperationAsPromise([operation]);
1405
1408
  }
1406
1409
  batchOperations(operations) {
1410
+ let fallbackSetMetadata = [];
1407
1411
  const sqliteOperations = operations.reduce((acc, cur) => {
1408
1412
  if (cur.type === 'setEntries') {
1409
1413
  const table = this.getTable(cur.segment);
@@ -1427,7 +1431,14 @@ class NimbusSqliteStore {
1427
1431
  }
1428
1432
  return acc;
1429
1433
  }, []);
1430
- return this.batchOperationAsPromise(sqliteOperations);
1434
+ return this.batchOperationAsPromise(sqliteOperations).then(() => {
1435
+ if (fallbackSetMetadata.length > 0) {
1436
+ return Promise.all(fallbackSetMetadata.map((fallback) => {
1437
+ const { entries, segment } = fallback;
1438
+ return this.setMetadata(entries, segment);
1439
+ })).then(() => { });
1440
+ }
1441
+ });
1431
1442
  }
1432
1443
  evictEntries(entryIds, segment) {
1433
1444
  const sqliteOperation = this.idsToDeleteOperation(entryIds, segment);
@@ -1745,7 +1756,7 @@ function buildQueryTypeStringKey(args) {
1745
1756
  */
1746
1757
 
1747
1758
 
1748
- const { create: create$1, keys: keys$1, values: values$1, entries, assign: assign$1 } = Object;
1759
+ const { create: create$1, keys: keys$1, values: values$1, entries: entries$1, assign: assign$1 } = Object;
1749
1760
  const { stringify, parse } = JSON;
1750
1761
  const { isArray, from } = Array;
1751
1762
 
@@ -2417,7 +2428,7 @@ function filterToPredicates(where, recordType, alias, objectInfoMap, joins, draf
2417
2428
  }
2418
2429
  else {
2419
2430
  //`field` match the filedInfo's apiName
2420
- for (const [op, value] of entries(where[field])) {
2431
+ for (const [op, value] of entries$1(where[field])) {
2421
2432
  const operator = operatorToSql(op);
2422
2433
  /**
2423
2434
  Two types ID processing might be needed. Draft ID swapping is optional, which depends on DraftFunctions existence.
@@ -3639,7 +3650,7 @@ function buildBaseSchema() {
3639
3650
  */
3640
3651
 
3641
3652
 
3642
- const { keys, values, create, assign, freeze } = Object;
3653
+ const { keys, values, create, assign, freeze, entries } = Object;
3643
3654
 
3644
3655
  /**
3645
3656
  * Records are stored in the durable store with scalar fields denormalized. This function takes that denoramlized
@@ -3751,7 +3762,7 @@ function getDenormalizedKey(originalKey, recordId, luvio) {
3751
3762
  }
3752
3763
  return keyBuilderRecord(luvio, { recordId });
3753
3764
  }
3754
- function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore) {
3765
+ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore, sqlStore) {
3755
3766
  const getEntries = function (entries, segment) {
3756
3767
  // this HOF only inspects records in the default segment
3757
3768
  if (segment !== DefaultDurableSegment) {
@@ -3813,7 +3824,10 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
3813
3824
  });
3814
3825
  };
3815
3826
  const denormalizeEntries = function (entries) {
3827
+ let hasEntries = false;
3828
+ let hasMetadata = false;
3816
3829
  const putEntries = create(null);
3830
+ const putMetadata = create(null);
3817
3831
  const keys$1 = keys(entries);
3818
3832
  const putRecords = {};
3819
3833
  const putRecordViews = {};
@@ -3856,6 +3870,7 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
3856
3870
  putRecords[recordId] = true;
3857
3871
  }
3858
3872
  if (isStoreRecordError(record)) {
3873
+ hasEntries = true;
3859
3874
  putEntries[recordKey] = value;
3860
3875
  continue;
3861
3876
  }
@@ -3868,24 +3883,43 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
3868
3883
  }
3869
3884
  const denormalizedRecord = buildDurableRecordRepresentation(record, storeRecords, recordEntries, store);
3870
3885
  if (denormalizedRecord !== undefined) {
3886
+ hasEntries = true;
3871
3887
  putEntries[recordKey] = {
3872
3888
  data: denormalizedRecord,
3873
3889
  metadata,
3874
3890
  };
3891
+ // if undefined then it is pending
3892
+ // we should still update metadata on pending records
3893
+ }
3894
+ else {
3895
+ hasMetadata = true;
3896
+ metadata.expirationTimestamp = metadata.ingestionTimestamp;
3897
+ putMetadata[recordKey] = {
3898
+ metadata,
3899
+ };
3875
3900
  }
3876
3901
  }
3877
3902
  else {
3903
+ hasEntries = true;
3878
3904
  putEntries[key] = value;
3879
3905
  }
3880
3906
  }
3881
- return putEntries;
3907
+ return { putEntries, putMetadata, hasEntries, hasMetadata };
3882
3908
  };
3883
3909
  const setEntries = function (entries, segment) {
3884
3910
  if (segment !== DefaultDurableSegment) {
3885
3911
  return durableStore.setEntries(entries, segment);
3886
3912
  }
3887
- const putEntries = denormalizeEntries(entries);
3888
- return durableStore.setEntries(putEntries, segment);
3913
+ const { putEntries, putMetadata, hasEntries, hasMetadata } = denormalizeEntries(entries);
3914
+ const promises = [
3915
+ hasEntries ? durableStore.setEntries(putEntries, segment) : undefined,
3916
+ ];
3917
+ if (sqlStore !== undefined && sqlStore.isBatchUpdateSupported()) {
3918
+ promises.push(hasMetadata && sqlStore !== undefined
3919
+ ? durableStore.setMetadata(putMetadata, segment)
3920
+ : undefined);
3921
+ }
3922
+ return Promise.all(promises).then(() => { });
3889
3923
  };
3890
3924
  const batchOperations = function (operations) {
3891
3925
  const operationsWithDenormedRecords = [];
@@ -3902,10 +3936,20 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
3902
3936
  // this is determined by the plugin supporting update batch calls before it gets to this HOF.
3903
3937
  // so we only need to check one entry to confirm this for performance
3904
3938
  if (firstEntry.data !== undefined) {
3939
+ const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
3905
3940
  operationsWithDenormedRecords.push({
3906
3941
  ...operation,
3907
- entries: denormalizeEntries(operation.entries),
3942
+ entries: putEntries,
3908
3943
  });
3944
+ if (hasMetadata &&
3945
+ sqlStore !== undefined &&
3946
+ sqlStore.isBatchUpdateSupported() === true) {
3947
+ operationsWithDenormedRecords.push({
3948
+ ...operation,
3949
+ entries: putMetadata,
3950
+ type: 'setMetadata',
3951
+ });
3952
+ }
3909
3953
  }
3910
3954
  else {
3911
3955
  operationsWithDenormedRecords.push(operation);
@@ -3917,10 +3961,20 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
3917
3961
  operationsWithDenormedRecords.push(operation);
3918
3962
  continue;
3919
3963
  }
3964
+ const { putEntries, putMetadata, hasMetadata } = denormalizeEntries(operation.entries);
3920
3965
  operationsWithDenormedRecords.push({
3921
3966
  ...operation,
3922
- entries: denormalizeEntries(operation.entries),
3967
+ entries: putEntries,
3923
3968
  });
3969
+ if (hasMetadata &&
3970
+ sqlStore !== undefined &&
3971
+ sqlStore.isBatchUpdateSupported() === true) {
3972
+ operationsWithDenormedRecords.push({
3973
+ ...operation,
3974
+ entries: putMetadata,
3975
+ type: 'setMetadata',
3976
+ });
3977
+ }
3924
3978
  }
3925
3979
  return durableStore.batchOperations(operationsWithDenormedRecords);
3926
3980
  };
@@ -4015,4 +4069,4 @@ function ldsRuntimeBridge() {
4015
4069
  }
4016
4070
 
4017
4071
  export { ldsRuntimeBridge as default };
4018
- // version: 1.266.0-dev24-0b5c20389
4072
+ // version: 1.266.0-dev26-c7c66cb1b
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-bridge",
3
- "version": "1.266.0-dev24",
3
+ "version": "1.266.0-dev26",
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.266.0-dev24",
38
- "@salesforce/lds-instrumentation": "^1.266.0-dev24",
37
+ "@salesforce/lds-adapters-uiapi": "^1.266.0-dev26",
38
+ "@salesforce/lds-instrumentation": "^1.266.0-dev26",
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.266.0-dev24",
44
- "@salesforce/lds-network-aura": "^1.266.0-dev24",
45
- "@salesforce/lds-runtime-aura": "^1.266.0-dev24",
46
- "@salesforce/lds-store-nimbus": "^1.266.0-dev24",
47
- "@salesforce/nimbus-plugin-lds": "^1.266.0-dev24",
43
+ "@salesforce/lds-drafts-adapters-uiapi": "^1.266.0-dev26",
44
+ "@salesforce/lds-network-aura": "^1.266.0-dev26",
45
+ "@salesforce/lds-runtime-aura": "^1.266.0-dev26",
46
+ "@salesforce/lds-store-nimbus": "^1.266.0-dev26",
47
+ "@salesforce/nimbus-plugin-lds": "^1.266.0-dev26",
48
48
  "babel-plugin-dynamic-import-node": "^2.3.3"
49
49
  },
50
50
  "luvioBundlesize": [