@salesforce/lds-ads-bridge 1.228.1 → 1.229.0-dev10

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.145.2-6a13677c
433
+ // engine version: 0.146.0-dev5-a2ec6e3f
431
434
 
432
435
  /**
433
436
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -474,7 +477,7 @@ const callbacks$1 = [];
474
477
  function register(r) {
475
478
  callbacks$1.forEach((callback) => callback(r));
476
479
  }
477
- // version: 1.228.1-4e6356f71
480
+ // version: 1.229.0-dev10-bc9ef2513
478
481
 
479
482
  /**
480
483
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -5504,7 +5507,7 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
5504
5507
  }
5505
5508
  const keyPrefix = 'UiApi';
5506
5509
 
5507
- const { assign, create, freeze, keys: keys$1 } = Object;
5510
+ const { assign, create, freeze, isFrozen, keys: keys$1 } = Object;
5508
5511
  const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
5509
5512
  const { split, endsWith } = String.prototype;
5510
5513
  const { isArray } = Array;
@@ -8275,7 +8278,7 @@ function extractTrackedFieldsToTrie(recordId, node, root, config, visitedRecordI
8275
8278
  extractTrackedFieldsToTrie(spanningLink.data.__ref, spanning, next, config, spanningVisitedRecordIds, depth + 1);
8276
8279
  // For a spanning record that is detected to be a circular reference, we add the field along with Id and Name.
8277
8280
  // It's possible for spanning record lookup fields to sometimes be circular, and sometimes not - depending on the value of the lookup field.
8278
- // For more information on scenarios that caused this fix: https://salesforce.quip.com/OvzNAh3eNIWY
8281
+ // For more information on scenarios that caused this fix: search "LDS Recursive Spanning Fields Problem" in Quip
8279
8282
  if (keys$1(next.children).length === 0) {
8280
8283
  addScalarFieldId(next);
8281
8284
  addScalarFieldName(next);
@@ -8422,22 +8425,12 @@ function _markMissingPath(record, path) {
8422
8425
  const fieldValueRepresentation = record.object('fields');
8423
8426
  const fieldName = path.shift();
8424
8427
  if (fieldValueRepresentation.isUndefined(fieldName) === true) {
8425
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
8426
- // an undefined/non-present __ref if isMissing is present
8427
- fieldValueRepresentation.write(fieldName, {
8428
- __ref: undefined,
8429
- isMissing: true,
8430
- });
8428
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
8431
8429
  return;
8432
8430
  }
8433
8431
  const link = fieldValueRepresentation.link(fieldName);
8434
8432
  if (link.isPending()) {
8435
- // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
8436
- // an undefined/non-present __ref if isMissing is present
8437
- fieldValueRepresentation.write(fieldName, {
8438
- __ref: undefined,
8439
- isMissing: true,
8440
- });
8433
+ writeMissingFieldToStore(fieldValueRepresentation, fieldName);
8441
8434
  }
8442
8435
  else if (path.length > 0 && link.isMissing() === false) {
8443
8436
  const fieldValue = link.follow();
@@ -8453,6 +8446,19 @@ function _markMissingPath(record, path) {
8453
8446
  }
8454
8447
  }
8455
8448
  }
8449
+ /**
8450
+ * Graph Node Directly modifies store entries, which is generally a non-starter.
8451
+ * Until we can refactor this mess, you need to use this function to safely mark the RecordRepresentation
8452
+ * as a seenId in the store when you perform this mutation.
8453
+ */
8454
+ function writeMissingFieldToStore(field, fieldName) {
8455
+ // TODO [W-6900046]: remove cast, make RecordRepresentationNormalized['fields'] accept
8456
+ // an undefined/non-present __ref if isMissing is present
8457
+ field.write(fieldName, {
8458
+ __ref: undefined,
8459
+ isMissing: true,
8460
+ });
8461
+ }
8456
8462
  /**
8457
8463
  * Tells you if an objectApiName is supported by UI API or not.
8458
8464
  * Note: Luvio does not currently support all the entities, the list is limited to UI API supported entities
@@ -8584,8 +8590,11 @@ function mergeAndRefreshLowerVersionRecord(luvio, incoming, existing, incomingTr
8584
8590
  return existing;
8585
8591
  }
8586
8592
  function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
8587
- const incomingNode = luvio.wrapNormalizedGraphNode(incoming);
8588
- const existingNode = luvio.wrapNormalizedGraphNode(existing);
8593
+ const recordKey = keyBuilder$35(luvio, {
8594
+ recordId: incoming.id,
8595
+ });
8596
+ const incomingNode = luvio.wrapNormalizedGraphNode(incoming, recordKey);
8597
+ const existingNode = luvio.wrapNormalizedGraphNode(existing, recordKey);
8589
8598
  const incomingTrackedFieldsTrieRoot = {
8590
8599
  name: incoming.apiName,
8591
8600
  children: {},
@@ -8594,9 +8603,6 @@ function mergeRecordConflict(luvio, incoming, existing, recordConflictMap) {
8594
8603
  name: existing.apiName,
8595
8604
  children: {},
8596
8605
  };
8597
- const recordKey = keyBuilder$35(luvio, {
8598
- recordId: incoming.id,
8599
- });
8600
8606
  const trackedFieldsConfig = {
8601
8607
  maxDepth: configurationForRestAdapters.getTrackedFieldDepthOnCacheMergeConflict(),
8602
8608
  onlyFetchLeafNodeIdAndName: configurationForRestAdapters.getTrackedFieldLeafNodeIdAndNameOnly(),
@@ -8919,7 +8925,7 @@ function fulfill(existing, incoming) {
8919
8925
  const batchRequestWithSingleRequest = isSingleBatchRecordRequest(existingUrlParams) &&
8920
8926
  isSingleRecordRequest(urlParams) &&
8921
8927
  incomingUrlRecords[0] === existingUrlRecords[0];
8922
- if (!batchRequestWithSingleRequest) {
8928
+ if (!batchRequestWithSingleRequest || isRestrictedPathCondition(existingPath, path)) {
8923
8929
  return false;
8924
8930
  }
8925
8931
  }
@@ -8962,6 +8968,12 @@ function isSingleBatchRecordRequest(urlParams) {
8962
8968
  function isSingleRecordRequest(urlParams) {
8963
8969
  return hasOwnProperty$1.call(urlParams, 'recordId');
8964
8970
  }
8971
+ function isRestrictedPathCondition(existingPath, path) {
8972
+ // should not dedupe getRecordUi and getRecord as both of their representation is different
8973
+ // records call cannot digest response of getRecordUi
8974
+ return ((existingPath.includes('/record-ui') && path.includes('/records')) ||
8975
+ (existingPath.includes('/records') && path.includes('/record-ui')));
8976
+ }
8965
8977
 
8966
8978
  const createResourceRequest$16 = function getUiApiRecordsByRecordIdCreateResourceRequest(config) {
8967
8979
  return {
package/dist/adsBridge.js CHANGED
@@ -375,4 +375,4 @@ function withAdsBridge(callback) {
375
375
  }
376
376
 
377
377
  export { instrument, withAdsBridge };
378
- // version: 1.228.1-4e6356f71
378
+ // version: 1.229.0-dev10-bc9ef2513
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-ads-bridge",
3
- "version": "1.228.1",
3
+ "version": "1.229.0-dev10",
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",
@@ -29,7 +29,7 @@
29
29
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-ads-bridge"
30
30
  },
31
31
  "devDependencies": {
32
- "@salesforce/lds-adapters-uiapi": "*",
33
- "@salesforce/lds-uiapi-record-utils": "*"
32
+ "@salesforce/lds-adapters-uiapi": "1.229.0-dev10",
33
+ "@salesforce/lds-uiapi-record-utils": "1.229.0-dev10"
34
34
  }
35
35
  }