@salesforce/lwc-adapters-uiapi 1.229.0-dev8 → 1.229.0-dev9

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 (2) hide show
  1. package/dist/main.js +27 -21
  2. package/package.json +4 -4
package/dist/main.js CHANGED
@@ -19,12 +19,15 @@ var SnapshotState;
19
19
  const { create: create$1, entries, freeze: freeze$1, keys: keys$1, values } = Object;
20
20
  const { isArray: isArray$1 } = Array;
21
21
  const { parse: parse$2, stringify: stringify$1 } = JSON;
22
+ const WeakSetCtor = WeakSet;
22
23
 
24
+ const deeplyFrozen = new WeakSetCtor();
23
25
  function deepFreeze(value) {
24
- // No need to freeze primitives
25
- if (typeof value !== 'object' || value === null) {
26
+ // No need to freeze primitives or already frozen stuff
27
+ if (typeof value !== 'object' || value === null || deeplyFrozen.has(value)) {
26
28
  return;
27
29
  }
30
+ deeplyFrozen.add(value);
28
31
  if (isArray$1(value)) {
29
32
  for (let i = 0, len = value.length; i < len; i += 1) {
30
33
  deepFreeze(value[i]);
@@ -564,7 +567,7 @@ function createResourceParamsImpl(config, configMetadata) {
564
567
  }
565
568
  return resourceParams;
566
569
  }
567
- // engine version: 0.146.0-dev4-c265089a
570
+ // engine version: 0.146.0-dev5-a2ec6e3f
568
571
 
569
572
  /**
570
573
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -12666,22 +12669,12 @@ function _markMissingPath(record, path) {
12666
12669
  const fieldValueRepresentation = record.object('fields');
12667
12670
  const fieldName = path.shift();
12668
12671
  if (fieldValueRepresentation.isUndefined(fieldName) === true) {
12669
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
12670
- // an undefined/non-present __ref if isMissing is present
12671
- fieldValueRepresentation.write(fieldName, {
12672
- __ref: undefined,
12673
- isMissing: true,
12674
- });
12672
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
12675
12673
  return;
12676
12674
  }
12677
12675
  const link = fieldValueRepresentation.link(fieldName);
12678
12676
  if (link.isPending()) {
12679
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
12680
- // an undefined/non-present __ref if isMissing is present
12681
- fieldValueRepresentation.write(fieldName, {
12682
- __ref: undefined,
12683
- isMissing: true,
12684
- });
12677
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
12685
12678
  }
12686
12679
  else if (path.length > 0 && link.isMissing() === false) {
12687
12680
  const fieldValue = link.follow();
@@ -12697,6 +12690,19 @@ function _markMissingPath(record, path) {
12697
12690
  }
12698
12691
  }
12699
12692
  }
12693
+ /**
12694
+ * Graph Node Directly modifies store entries, which is generally a non-starter.
12695
+ * Until we can refactor this mess, you need to use this function to safely mark the RecordRepresentation
12696
+ * as a seenId in the store when you perform this mutation.
12697
+ */
12698
+ function writeMissingFieldToStore(field, fieldName) {
12699
+ // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
12700
+ // an undefined/non-present __ref if isMissing is present
12701
+ field.write(fieldName, {
12702
+ __ref: undefined,
12703
+ isMissing: true,
12704
+ });
12705
+ }
12700
12706
  /**
12701
12707
  * Tells you if an objectApiName is supported by UI API or not.
12702
12708
  * Note: Luvio does not currently support all the entities, the list is limited to UI API supported entities
@@ -12828,8 +12834,11 @@ function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTr
12828
12834
  return existing;
12829
12835
  }
12830
12836
  function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
12831
- const incomingNode = luvio.wrapNormalizedGraphNode(incoming);
12832
- const existingNode = luvio.wrapNormalizedGraphNode(existing);
12837
+ const recordKey = keyBuilder$35(luvio, {
12838
+ recordId: incoming.id,
12839
+ });
12840
+ const incomingNode = luvio.wrapNormalizedGraphNode(incoming, recordKey);
12841
+ const existingNode = luvio.wrapNormalizedGraphNode(existing, recordKey);
12833
12842
  const incomingTrackedFieldsTrieRoot = {
12834
12843
  name: incoming.apiName,
12835
12844
  children: {},
@@ -12838,9 +12847,6 @@ function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
12838
12847
  name: existing.apiName,
12839
12848
  children: {},
12840
12849
  };
12841
- const recordKey = keyBuilder$35(luvio, {
12842
- recordId: incoming.id,
12843
- });
12844
12850
  const trackedFieldsConfig = {
12845
12851
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMergeConflict(),
12846
12852
  onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
@@ -20042,7 +20048,7 @@ const notifyChangeFactory = (luvio) => {
20042
20048
  const responsePromises = [];
20043
20049
  for (let i = 0, len = entries.length; i < len; i++) {
20044
20050
  const { key, record } = entries[i];
20045
- const node = luvio.wrapNormalizedGraphNode(record);
20051
+ const node = luvio.wrapNormalizedGraphNode(record, key);
20046
20052
  const optionalFields = getTrackedFields(key, node, {
20047
20053
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnNotifyChange(),
20048
20054
  onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lwc-adapters-uiapi",
3
- "version": "1.229.0-dev8",
3
+ "version": "1.229.0-dev9",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "UIAPI adapters with LWC bindings",
6
6
  "module": "dist/main.js",
@@ -31,10 +31,10 @@
31
31
  "clean": "rm -rf dist src/generated"
32
32
  },
33
33
  "devDependencies": {
34
- "@salesforce/lds-adapters-uiapi": "1.229.0-dev8"
34
+ "@salesforce/lds-adapters-uiapi": "1.229.0-dev9"
35
35
  },
36
36
  "dependencies": {
37
- "@luvio/lwc-luvio": "0.146.0-dev4",
38
- "@salesforce/lds-default-luvio": "1.229.0-dev8"
37
+ "@luvio/lwc-luvio": "0.146.0-dev5",
38
+ "@salesforce/lds-default-luvio": "1.229.0-dev9"
39
39
  }
40
40
  }