@salesforce/lds-ads-bridge 1.266.0-dev2 → 1.266.0-dev21

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.
@@ -21,7 +21,9 @@ const WeakSetCtor = WeakSet;
21
21
  const deeplyFrozen = new WeakSetCtor();
22
22
  function deepFreeze(value) {
23
23
  // No need to freeze primitives or already frozen stuff
24
- if (typeof value !== 'object' || value === null || deeplyFrozen.has(value)) {
24
+ if (typeof value !== 'object' ||
25
+ value === null ||
26
+ deeplyFrozen.has(value)) {
25
27
  return;
26
28
  }
27
29
  deeplyFrozen.add(value);
@@ -383,6 +385,7 @@ function ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normal
383
385
  namespace,
384
386
  version,
385
387
  representationName,
388
+ ingestionTimestamp: timestamp,
386
389
  };
387
390
  luvio.publishStoreMetadata(key, storeMetadataParams);
388
391
  }
@@ -430,7 +433,7 @@ function createResourceParamsImpl(config, configMetadata) {
430
433
  }
431
434
  return resourceParams;
432
435
  }
433
- // engine version: 0.154.6-a3a5150a
436
+ // engine version: 0.154.7-dev8-fca5df34
434
437
 
435
438
  /**
436
439
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -478,7 +481,7 @@ const callbacks$1 = [];
478
481
  function register(r) {
479
482
  callbacks$1.forEach((callback) => callback(r));
480
483
  }
481
- // version: 1.266.0-dev2-7c2f3615f
484
+ // version: 1.266.0-dev21-b2a247476
482
485
 
483
486
  /**
484
487
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -4794,15 +4797,17 @@ function splitQualifiedFieldApiName(fieldApiName) {
4794
4797
  /**
4795
4798
  * Returns the field API name, qualified with an object name if possible.
4796
4799
  * @param value The value from which to get the qualified field API name.
4800
+ * @param onlyQualifiedFieldNames - Whether or not this function should skip fieldApiName that do not include the delimiter '.'
4797
4801
  * @return The qualified field API name.
4798
4802
  */
4799
- function getFieldApiName(value) {
4803
+ function getFieldApiName(value, onlyQualifiedFieldNames = false) {
4800
4804
  // Note: tightening validation logic changes behavior from userland getting
4801
4805
  // a server-provided error to the adapter noop'ing. In 224 we decided to not
4802
- // change the behavior.
4806
+ // change the behavior. In 250 we decided to add the 'onlyQualifiedFieldName' flag to tighten the logic
4807
+ // optionally to avoid issues with persisted invalid field names.
4803
4808
  if (isString(value)) {
4804
4809
  const trimmed = value.trim();
4805
- if (trimmed.length > 0) {
4810
+ if (trimmed.length > 0 && (onlyQualifiedFieldNames ? trimmed.indexOf('.') > -1 : true)) {
4806
4811
  return trimmed;
4807
4812
  }
4808
4813
  }
@@ -4815,15 +4820,19 @@ function getFieldApiName(value) {
4815
4820
  /**
4816
4821
  * Returns the field API name.
4817
4822
  * @param value The value from which to get the field API name.
4823
+ * @param options Option bag. onlyQualifiedFieldNames is a boolean that allows this function to skip returning invalid FieldApiNames.
4818
4824
  * @returns The field API name.
4819
4825
  */
4820
- function getFieldApiNamesArray(value) {
4826
+ function getFieldApiNamesArray(value, options = { onlyQualifiedFieldNames: false }) {
4821
4827
  const valueArray = isArray(value) ? value : [value];
4822
4828
  const array = [];
4823
4829
  for (let i = 0, len = valueArray.length; i < len; i += 1) {
4824
4830
  const item = valueArray[i];
4825
- const apiName = getFieldApiName(item);
4831
+ const apiName = getFieldApiName(item, options.onlyQualifiedFieldNames);
4826
4832
  if (apiName === undefined) {
4833
+ if (options.onlyQualifiedFieldNames) {
4834
+ continue; // Just skips invalid field names rather than failing to return an array at all
4835
+ }
4827
4836
  return undefined;
4828
4837
  }
4829
4838
  push$1.call(array, apiName);
@@ -4920,7 +4929,7 @@ function toSortedStringArray(value) {
4920
4929
  }
4921
4930
 
4922
4931
  const VERSION$2j = "d1e589a127fb1060c89070cdb6f500b2";
4923
- function validate$1Q(obj, path = 'RecordTypeInfoRepresentation') {
4932
+ function validate$1R(obj, path = 'RecordTypeInfoRepresentation') {
4924
4933
  const v_error = (() => {
4925
4934
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
4926
4935
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -5012,7 +5021,7 @@ function equals$14(existing, incoming) {
5012
5021
  }
5013
5022
 
5014
5023
  const VERSION$2i = "195d918987a35f45e1aa4dce9a11d8c5";
5015
- function validate$1P(obj, path = 'FieldValueRepresentation') {
5024
+ function validate$1Q(obj, path = 'FieldValueRepresentation') {
5016
5025
  const v_error = (() => {
5017
5026
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
5018
5027
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -5181,7 +5190,7 @@ const getTypeCacheKeys$1Y = (rootKeySet, luvio, input, _fullPathFactory) => {
5181
5190
 
5182
5191
  const TTL$E = 120000;
5183
5192
  const VERSION$2h = "79cb5ac9f44542f683d00245fdfe500d";
5184
- function validate$1O(obj, path = 'RecordCollectionRepresentation') {
5193
+ function validate$1P(obj, path = 'RecordCollectionRepresentation') {
5185
5194
  const v_error = (() => {
5186
5195
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
5187
5196
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -5454,7 +5463,7 @@ function equals$12(existing, incoming) {
5454
5463
  }
5455
5464
  const ingest$1U = function RecordCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
5456
5465
  if (process.env.NODE_ENV !== 'production') {
5457
- const validateError = validate$1O(input);
5466
+ const validateError = validate$1P(input);
5458
5467
  if (validateError !== null) {
5459
5468
  throw validateError;
5460
5469
  }
@@ -5490,7 +5499,7 @@ const keyBuilderFromType$B = function RecordRepresentationKeyBuilderFromType(luv
5490
5499
 
5491
5500
  const TTL$D = 30000;
5492
5501
  const VERSION$2g = "98c5b18512e48ca8d28727549507e4ba";
5493
- function validate$1N(obj, path = 'RecordRepresentation') {
5502
+ function validate$1O(obj, path = 'RecordRepresentation') {
5494
5503
  const v_error = (() => {
5495
5504
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
5496
5505
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -5620,7 +5629,7 @@ function validate$1N(obj, path = 'RecordRepresentation') {
5620
5629
  const path_recordTypeInfo = path + '.recordTypeInfo';
5621
5630
  let obj_recordTypeInfo_union0 = null;
5622
5631
  const obj_recordTypeInfo_union0_error = (() => {
5623
- const referencepath_recordTypeInfoValidationError = validate$1Q(obj_recordTypeInfo, path_recordTypeInfo);
5632
+ const referencepath_recordTypeInfoValidationError = validate$1R(obj_recordTypeInfo, path_recordTypeInfo);
5624
5633
  if (referencepath_recordTypeInfoValidationError !== null) {
5625
5634
  let message = 'Object doesn\'t match RecordTypeInfoRepresentation (at "' + path_recordTypeInfo + '")\n';
5626
5635
  message += referencepath_recordTypeInfoValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -8078,7 +8087,7 @@ function normalize$P(input, existing, path, luvio, store, timestamp, fieldsTrie,
8078
8087
  function makeIngest(fieldsTrie, optionalFieldsTrie, recordConflictMap) {
8079
8088
  return (input, path, luvio, store, timestamp) => {
8080
8089
  if (process.env.NODE_ENV !== 'production') {
8081
- const validateError = validate$1P(input);
8090
+ const validateError = validate$1Q(input);
8082
8091
  if (validateError !== null) {
8083
8092
  throw validateError;
8084
8093
  }
@@ -8171,7 +8180,7 @@ const createRecordIngest = (fieldsTrie, optionalFieldsTrie, recordConflictMap) =
8171
8180
  const childNormalize = createChildRecordNormalize(fieldsTrie, optionalFieldsTrie, recordConflictMap);
8172
8181
  return (input, path, luvio, store, timestamp) => {
8173
8182
  if (process.env.NODE_ENV !== 'production') {
8174
- const validateError = validate$1N(input);
8183
+ const validateError = validate$1O(input);
8175
8184
  if (validateError !== null) {
8176
8185
  throw validateError;
8177
8186
  }
@@ -8200,6 +8209,7 @@ const createRecordIngest = (fieldsTrie, optionalFieldsTrie, recordConflictMap) =
8200
8209
  representationName: RepresentationType$X,
8201
8210
  namespace: keyPrefix,
8202
8211
  version: VERSION$2g,
8212
+ ingestionTimestamp: timestamp,
8203
8213
  });
8204
8214
  return createLink$1(key);
8205
8215
  };
@@ -8394,17 +8404,19 @@ function onResourceError(luvio, config, key, err) {
8394
8404
  function buildNetworkSnapshot$18(luvio, config, serverRequestCount = 0, options) {
8395
8405
  const { request, key, allTrackedFields, resourceParams } = prepareRequest$6(luvio, config);
8396
8406
  return luvio.dispatchResourceRequest(request, options).then((response) => {
8407
+ // W-11964675 - Condition to dedupe a very specific set of requests for
8408
+ // Komaci - a batch record request with a single record followed by a single
8409
+ // record request. The fulfill logic sends the same network response, so
8410
+ // there is some TypeScript massaging to extract the RecordRepresentation
8411
+ //
8412
+ // W-14381091 - Ensure hoisting the response body happens prior to
8413
+ // calling `luvio.handleSuccessResponse`, since both arguments capture
8414
+ // the response.
8415
+ if (isSingleBatchRecordResponse(response.body)) {
8416
+ response.body = response.body.results[0]
8417
+ .result;
8418
+ }
8397
8419
  return luvio.handleSuccessResponse(() => {
8398
- // W-11964675 - Condition to dedupe a very specific set of requests for
8399
- // Komaci - a batch record request with a single record followed by a single
8400
- // record request. The fulfill logic sends the same network response, so
8401
- // there is some TypeScript massaging to extract the RecordRepresentation
8402
- if (isSingleBatchRecordResponse(response.body)) {
8403
- let recordResponse = response;
8404
- recordResponse.body = response.body.results[0]
8405
- .result;
8406
- return onResourceSuccess(luvio, config, key, allTrackedFields, recordResponse, serverRequestCount + 1);
8407
- }
8408
8420
  return onResourceSuccess(luvio, config, key, allTrackedFields, response, serverRequestCount + 1);
8409
8421
  }, () => {
8410
8422
  const cache = new StoreKeyMap();
package/dist/adsBridge.js CHANGED
@@ -372,4 +372,4 @@ function withAdsBridge(callback) {
372
372
  }
373
373
 
374
374
  export { instrument, withAdsBridge };
375
- // version: 1.266.0-dev2-7c2f3615f
375
+ // version: 1.266.0-dev21-b2a247476
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-ads-bridge",
3
- "version": "1.266.0-dev2",
3
+ "version": "1.266.0-dev21",
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": "^1.266.0-dev2",
33
- "@salesforce/lds-uiapi-record-utils": "^1.266.0-dev2"
32
+ "@salesforce/lds-adapters-uiapi": "^1.266.0-dev21",
33
+ "@salesforce/lds-uiapi-record-utils": "^1.266.0-dev21"
34
34
  }
35
35
  }