@salesforce/lds-ads-bridge 1.248.0 → 1.249.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.
@@ -16,12 +16,15 @@ var SnapshotState;
16
16
  const { create: create$1, entries, freeze: freeze$1, keys: keys$2, values } = Object;
17
17
  const { isArray: isArray$1 } = Array;
18
18
  const { parse: parse$1, stringify: stringify$1 } = JSON;
19
+ const WeakSetCtor = WeakSet;
19
20
 
21
+ const deeplyFrozen = new WeakSetCtor();
20
22
  function deepFreeze(value) {
21
- // No need to freeze primitives
22
- if (typeof value !== 'object' || value === null) {
23
+ // No need to freeze primitives or already frozen stuff
24
+ if (typeof value !== 'object' || value === null || deeplyFrozen.has(value)) {
23
25
  return;
24
26
  }
27
+ deeplyFrozen.add(value);
25
28
  if (isArray$1(value)) {
26
29
  for (let i = 0, len = value.length; i < len; i += 1) {
27
30
  deepFreeze(value[i]);
@@ -427,7 +430,7 @@ function createResourceParamsImpl(config, configMetadata) {
427
430
  }
428
431
  return resourceParams;
429
432
  }
430
- // engine version: 0.151.1-fc3a996e
433
+ // engine version: 0.152.2-f6f687b3
431
434
 
432
435
  /**
433
436
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -475,7 +478,7 @@ const callbacks$1 = [];
475
478
  function register(r) {
476
479
  callbacks$1.forEach((callback) => callback(r));
477
480
  }
478
- // version: 1.248.0-1f7f01112
481
+ // version: 1.249.0-11c3e1ed5
479
482
 
480
483
  /**
481
484
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -7594,22 +7597,12 @@ function _markMissingPath(record, path) {
7594
7597
  const fieldValueRepresentation = record.object('fields');
7595
7598
  const fieldName = path.shift();
7596
7599
  if (fieldValueRepresentation.isUndefined(fieldName) === true) {
7597
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
7598
- // an undefined/non-present __ref if isMissing is present
7599
- fieldValueRepresentation.write(fieldName, {
7600
- __ref: undefined,
7601
- isMissing: true,
7602
- });
7600
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
7603
7601
  return;
7604
7602
  }
7605
7603
  const link = fieldValueRepresentation.link(fieldName);
7606
7604
  if (link.isPending()) {
7607
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
7608
- // an undefined/non-present __ref if isMissing is present
7609
- fieldValueRepresentation.write(fieldName, {
7610
- __ref: undefined,
7611
- isMissing: true,
7612
- });
7605
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
7613
7606
  }
7614
7607
  else if (path.length > 0 && link.isMissing() === false) {
7615
7608
  const fieldValue = link.follow();
@@ -7625,6 +7618,19 @@ function _markMissingPath(record, path) {
7625
7618
  }
7626
7619
  }
7627
7620
  }
7621
+ /**
7622
+ * Graph Node Directly modifies store entries, which is generally a non-starter.
7623
+ * Until we can refactor this mess, you need to use this function to safely mark the RecordRepresentation
7624
+ * as a seenId in the store when you perform this mutation.
7625
+ */
7626
+ function writeMissingFieldToStore(field, fieldName) {
7627
+ // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
7628
+ // an undefined/non-present __ref if isMissing is present
7629
+ field.write(fieldName, {
7630
+ __ref: undefined,
7631
+ isMissing: true,
7632
+ });
7633
+ }
7628
7634
  /**
7629
7635
  * Tells you if an objectApiName is supported by UI API or not.
7630
7636
  * Note: Luvio does not currently support all the entities, the list is limited to UI API supported entities
@@ -7756,8 +7762,11 @@ function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTr
7756
7762
  return existing;
7757
7763
  }
7758
7764
  function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
7759
- const incomingNode = luvio.wrapNormalizedGraphNode(incoming);
7760
- const existingNode = luvio.wrapNormalizedGraphNode(existing);
7765
+ const recordKey = keyBuilder$3b(luvio, {
7766
+ recordId: incoming.id,
7767
+ });
7768
+ const incomingNode = luvio.wrapNormalizedGraphNode(incoming, recordKey);
7769
+ const existingNode = luvio.wrapNormalizedGraphNode(existing, recordKey);
7761
7770
  const incomingTrackedFieldsTrieRoot = {
7762
7771
  name: incoming.apiName,
7763
7772
  children: {},
@@ -7766,9 +7775,6 @@ function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
7766
7775
  name: existing.apiName,
7767
7776
  children: {},
7768
7777
  };
7769
- const recordKey = keyBuilder$3b(luvio, {
7770
- recordId: incoming.id,
7771
- });
7772
7778
  const trackedFieldsConfig = {
7773
7779
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMergeConflict(),
7774
7780
  onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
package/dist/adsBridge.js CHANGED
@@ -372,4 +372,4 @@ function withAdsBridge(callback) {
372
372
  }
373
373
 
374
374
  export { instrument, withAdsBridge };
375
- // version: 1.248.0-1f7f01112
375
+ // version: 1.249.0-11c3e1ed5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-ads-bridge",
3
- "version": "1.248.0",
3
+ "version": "1.249.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Bridge to sync data between LDS and ADS",
6
6
  "main": "dist/adsBridge.js",