@salesforce/lds-runtime-bridge 1.298.0 → 1.300.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.
@@ -296,7 +296,7 @@ class DurableTTLStore {
296
296
  }
297
297
  }
298
298
 
299
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, redirects, additionalDurableStoreOperations = [], enableDurableMetadataRefresh = false) {
299
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, redirects, shouldFlush, additionalDurableStoreOperations = [], enableDurableMetadataRefresh = false) {
300
300
  const durableRecords = create$3(null);
301
301
  const refreshedDurableRecords = create$3(null);
302
302
  const evictedRecords = create$3(null);
@@ -324,7 +324,16 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
324
324
  const entries = wasVisited === true || enableDurableMetadataRefresh === false
325
325
  ? durableRecords
326
326
  : refreshedDurableRecords;
327
- setRecordTo(entries, key, record, metadata);
327
+ const { flushValue: flushValue, forceFlushMetadata: flushMetadata } = shouldFlush(key, record);
328
+ if (flushValue) {
329
+ setRecordTo(entries, key, record, metadata);
330
+ }
331
+ else {
332
+ // If the record is not to be flushed, we still need to update the metadata
333
+ if (flushMetadata === true) {
334
+ setRecordTo(refreshedDurableRecords, key, record, metadata);
335
+ }
336
+ }
328
337
  }
329
338
  const durableStoreOperations = additionalDurableStoreOperations;
330
339
  const recordKeys = keys$3(durableRecords);
@@ -525,7 +534,7 @@ function isUnfulfilledSnapshot(cachedSnapshotResult) {
525
534
  * @param durableStore A DurableStore implementation
526
535
  * @param instrumentation An instrumentation function implementation
527
536
  */
528
- function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, enableDurableMetadataRefresh = false, disableDeepFreeze = false, }) {
537
+ function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, shouldFlush, enableDurableMetadataRefresh = false, disableDeepFreeze = false, }) {
529
538
  // runtimes can choose to disable deepFreeze, e.g. headless mobile runtime
530
539
  setBypassDeepFreeze(disableDeepFreeze);
531
540
  let stagingStore = null;
@@ -732,7 +741,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
732
741
  if (stagingStore === null) {
733
742
  return Promise.resolve();
734
743
  }
735
- const promise = flushInMemoryStoreValuesToDurableStore(stagingStore, durableStore, durableStoreErrorHandler, new Map(pendingStoreRedirects), additionalDurableStoreOperations, enableDurableMetadataRefresh);
744
+ const promise = flushInMemoryStoreValuesToDurableStore(stagingStore, durableStore, durableStoreErrorHandler, new Map(pendingStoreRedirects), shouldFlush !== null && shouldFlush !== void 0 ? shouldFlush : (() => ({ flushValue: true })), additionalDurableStoreOperations, enableDurableMetadataRefresh);
736
745
  pendingStoreRedirects.clear();
737
746
  stagingStore = null;
738
747
  return promise;
@@ -1894,9 +1903,9 @@ function getFieldApiNamesArray(value, options = { onlyQualifiedFieldNames: false
1894
1903
  }
1895
1904
  return dedupe(array).sort();
1896
1905
  }
1897
- const RepresentationType$Z = 'RecordRepresentation';
1898
- function keyBuilder$3r(luvio, config) {
1899
- return keyPrefix + '::' + RepresentationType$Z + ':' + config.recordId;
1906
+ const RepresentationType$_ = 'RecordRepresentation';
1907
+ function keyBuilder$3u(luvio, config) {
1908
+ return keyPrefix + '::' + RepresentationType$_ + ':' + config.recordId;
1900
1909
  }
1901
1910
  freeze$1({
1902
1911
  name: '',
@@ -1907,7 +1916,7 @@ ObjectCreate$1(null);
1907
1916
 
1908
1917
  ObjectCreate$1(null);
1909
1918
 
1910
- const adapterName$$ = 'getListUiByApiName';
1919
+ const adapterName$10 = 'getListUiByApiName';
1911
1920
  const getListUiByApiName_ConfigPropertyMetadata = [
1912
1921
  generateParamConfigMetadata('listViewApiName', true, 0 /* UrlParameter */, 0 /* String */),
1913
1922
  generateParamConfigMetadata('objectApiName', true, 0 /* UrlParameter */, 0 /* String */, false, getObjectApiName$1),
@@ -1917,9 +1926,9 @@ const getListUiByApiName_ConfigPropertyMetadata = [
1917
1926
  generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
1918
1927
  generateParamConfigMetadata('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1919
1928
  ];
1920
- const getListUiByApiName_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$$, getListUiByApiName_ConfigPropertyMetadata);
1929
+ const getListUiByApiName_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$10, getListUiByApiName_ConfigPropertyMetadata);
1921
1930
 
1922
- const adapterName$_ = 'getListUiByListViewId';
1931
+ const adapterName$$ = 'getListUiByListViewId';
1923
1932
  const getListUiByListViewId_ConfigPropertyMetadata = [
1924
1933
  generateParamConfigMetadata('listViewId', true, 0 /* UrlParameter */, 0 /* String */),
1925
1934
  generateParamConfigMetadata('fields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
@@ -1928,9 +1937,9 @@ const getListUiByListViewId_ConfigPropertyMetadata = [
1928
1937
  generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
1929
1938
  generateParamConfigMetadata('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1930
1939
  ];
1931
- const getListUiByListViewId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$_, getListUiByListViewId_ConfigPropertyMetadata);
1940
+ const getListUiByListViewId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$$, getListUiByListViewId_ConfigPropertyMetadata);
1932
1941
 
1933
- const adapterName$Y = 'getMruListUi';
1942
+ const adapterName$Z = 'getMruListUi';
1934
1943
  const getMruListUi_ConfigPropertyMetadata = [
1935
1944
  generateParamConfigMetadata('objectApiName', true, 0 /* UrlParameter */, 0 /* String */, false, getObjectApiName$1),
1936
1945
  generateParamConfigMetadata('fields', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
@@ -1939,7 +1948,7 @@ const getMruListUi_ConfigPropertyMetadata = [
1939
1948
  generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
1940
1949
  generateParamConfigMetadata('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true, getFieldApiNamesArray),
1941
1950
  ];
1942
- const getMruListUi_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$Y, getMruListUi_ConfigPropertyMetadata);
1951
+ const getMruListUi_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$Z, getMruListUi_ConfigPropertyMetadata);
1943
1952
  // make local copies of the adapter configs so we can ignore other getListUi config parameters to match
1944
1953
  // lds222 behavior
1945
1954
  ({
@@ -2296,7 +2305,7 @@ function isEntryDurableRecordRepresentation(entry, key) {
2296
2305
  function normalizeRecordFields(key, entry) {
2297
2306
  const { data: record } = entry;
2298
2307
  const { fields, links } = record;
2299
- const missingFieldLinks = keys(links);
2308
+ const missingFieldLinks = links === undefined ? [] : keys(links);
2300
2309
  const fieldNames = keys(fields);
2301
2310
  const normalizedFields = {};
2302
2311
  const returnEntries = {};
@@ -2304,6 +2313,10 @@ function normalizeRecordFields(key, entry) {
2304
2313
  for (let i = 0, len = fieldNames.length; i < len; i++) {
2305
2314
  const fieldName = fieldNames[i];
2306
2315
  const field = fields[fieldName];
2316
+ if (field.__state !== undefined && field.__state.isMissing === true) {
2317
+ normalizedFields[fieldName] = { isMissing: true, __ref: undefined };
2318
+ continue;
2319
+ }
2307
2320
  const fieldKey = buildRecordFieldStoreKey(key, fieldName);
2308
2321
  returnEntries[fieldKey] = { data: field };
2309
2322
  normalizedFields[fieldName] = createLink(fieldKey);
@@ -2335,7 +2348,6 @@ function normalizeRecordFields(key, entry) {
2335
2348
  function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntries, store) {
2336
2349
  const fields = normalizedRecord.fields;
2337
2350
  const filteredFields = {};
2338
- const links = {};
2339
2351
  const fieldNames = keys(fields);
2340
2352
  for (let i = 0, len = fieldNames.length; i < len; i++) {
2341
2353
  const fieldName = fieldNames[i];
@@ -2377,13 +2389,16 @@ function buildDurableRecordRepresentation(normalizedRecord, records, pendingEntr
2377
2389
  }
2378
2390
  // we want to preserve fields that are missing nodes
2379
2391
  if (field.isMissing === true) {
2380
- links[fieldName] = field;
2392
+ filteredFields[fieldName] = {
2393
+ value: undefined,
2394
+ displayValue: undefined,
2395
+ __state: { isMissing: true },
2396
+ };
2381
2397
  }
2382
2398
  }
2383
2399
  return {
2384
2400
  ...normalizedRecord,
2385
2401
  fields: filteredFields,
2386
- links,
2387
2402
  };
2388
2403
  }
2389
2404
  function getDenormalizedKey(originalKey, recordId, luvio) {
@@ -2393,7 +2408,7 @@ function getDenormalizedKey(originalKey, recordId, luvio) {
2393
2408
  if (originalKey.startsWith(RECORD_VIEW_ENTITY_ID_PREFIX)) {
2394
2409
  return RECORD_VIEW_ENTITY_ID_PREFIX + recordId;
2395
2410
  }
2396
- return keyBuilder$3r(luvio, { recordId });
2411
+ return keyBuilder$3u(luvio, { recordId });
2397
2412
  }
2398
2413
  function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecords, getStoreMetadata, getStore, sqlStore) {
2399
2414
  const getEntries = function (entries, segment) {
@@ -2611,35 +2626,10 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
2611
2626
  }
2612
2627
  return durableStore.batchOperations(operationsWithDenormedRecords);
2613
2628
  };
2614
- /**
2615
- * Retrieves a denormalized record from the store
2616
- * NOTE: do no use this if you don't know what you're doing, this can still contain normalized record references
2617
- * @param recordKey record key
2618
- * @param durableStore the durable store
2619
- * @returns a DraftRecordRepresentation containing the requested fields
2620
- */
2621
- const getDenormalizedRecord = function (recordKey) {
2622
- return durableStore.getEntries([recordKey], DefaultDurableSegment).then((entries) => {
2623
- if (entries === undefined) {
2624
- return undefined;
2625
- }
2626
- const denormalizedEntry = entries[recordKey];
2627
- if (denormalizedEntry === undefined) {
2628
- return undefined;
2629
- }
2630
- // don't include link information
2631
- const denormalizedRecord = denormalizedEntry.data;
2632
- if (isStoreRecordError(denormalizedRecord)) {
2633
- return undefined;
2634
- }
2635
- return denormalizedRecord;
2636
- });
2637
- };
2638
2629
  return create(durableStore, {
2639
2630
  getEntries: { value: getEntries, writable: true },
2640
2631
  setEntries: { value: setEntries, writable: true },
2641
2632
  batchOperations: { value: batchOperations, writable: true },
2642
- getDenormalizedRecord: { value: getDenormalizedRecord, writable: true },
2643
2633
  });
2644
2634
  }
2645
2635
 
@@ -2654,8 +2644,6 @@ function getNimbusDurableStore() {
2654
2644
  }
2655
2645
  /**
2656
2646
  * Use record denormalizing store to persist field values and references
2657
- * When not used, subsequent reads may result in empty field values
2658
- * See TD-0153300 for moving RecordDenormalizingDurableStore out of lds-drafts
2659
2647
  */
2660
2648
  function createRecordDenormingStore(luvio, durableStore) {
2661
2649
  const recordDenormingStore = makeRecordDenormalizingDurableStore(luvio, durableStore, () => getIngestRecords(), () => getIngestMetadata(), () => getIngestStore());
@@ -2700,4 +2688,4 @@ function ldsRuntimeBridge() {
2700
2688
  }
2701
2689
 
2702
2690
  export { ldsRuntimeBridge as default };
2703
- // version: 1.298.0-3a2eedddc
2691
+ // version: 1.300.0-76f5b2b4ea
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-bridge",
3
- "version": "1.298.0",
3
+ "version": "1.300.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for bridge.app.",
6
6
  "main": "dist/ldsRuntimeBridge.js",
@@ -34,16 +34,16 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-bridge"
35
35
  },
36
36
  "dependencies": {
37
- "@salesforce/lds-durable-records": "^1.298.0",
38
- "@salesforce/lds-instrumentation": "^1.298.0",
37
+ "@salesforce/lds-durable-records": "^1.300.0",
38
+ "@salesforce/lds-instrumentation": "^1.300.0",
39
39
  "@salesforce/user": "0.0.21",
40
40
  "o11y": "250.7.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@salesforce/lds-network-aura": "^1.298.0",
44
- "@salesforce/lds-runtime-aura": "^1.298.0",
45
- "@salesforce/lds-store-nimbus": "^1.298.0",
46
- "@salesforce/nimbus-plugin-lds": "^1.298.0",
43
+ "@salesforce/lds-network-aura": "^1.300.0",
44
+ "@salesforce/lds-runtime-aura": "^1.300.0",
45
+ "@salesforce/lds-store-nimbus": "^1.300.0",
46
+ "@salesforce/nimbus-plugin-lds": "^1.300.0",
47
47
  "babel-plugin-dynamic-import-node": "^2.3.3"
48
48
  },
49
49
  "luvioBundlesize": [