@salesforce/lds-ads-bridge 1.213.0 → 1.213.2

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.
@@ -348,7 +348,28 @@ var ScalarTypes;
348
348
  ScalarTypes[ScalarTypes["Number"] = 2] = "Number";
349
349
  ScalarTypes[ScalarTypes["Integer"] = 3] = "Integer";
350
350
  })(ScalarTypes || (ScalarTypes = {}));
351
- // engine version: 0.144.2-0928b9a8
351
+ function ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, namespace, version, representationName, equals) {
352
+ const existingRecord = store.readEntry(key);
353
+ let incomingRecord = normalize(input, existingRecord, {
354
+ fullPath: key,
355
+ parent: path.parent,
356
+ propertyName: path.propertyName,
357
+ ttl: ttlToUse,
358
+ }, luvio, store, timestamp);
359
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
360
+ luvio.storePublish(key, incomingRecord);
361
+ }
362
+ if (ttlToUse !== undefined) {
363
+ const storeMetadataParams = {
364
+ ttl: ttlToUse,
365
+ namespace,
366
+ version,
367
+ representationName,
368
+ };
369
+ luvio.publishStoreMetadata(key, storeMetadataParams);
370
+ }
371
+ }
372
+ // engine version: 0.144.6-819f7fff
352
373
 
353
374
  /**
354
375
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -395,7 +416,7 @@ const callbacks$1 = [];
395
416
  function register(r) {
396
417
  callbacks$1.forEach((callback) => callback(r));
397
418
  }
398
- // version: 1.213.0-831919511
419
+ // version: 1.213.2-69d4eea1b
399
420
 
400
421
  /**
401
422
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -5402,8 +5423,171 @@ function getFetchResponseStatusText(status) {
5402
5423
  return `Unexpected HTTP Status Code: ${status}`;
5403
5424
  }
5404
5425
  }
5426
+ function generateParamConfigMetadata(name, required, coerceFn) {
5427
+ return {
5428
+ name,
5429
+ required,
5430
+ coerceFn,
5431
+ };
5432
+ }
5433
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
5434
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
5435
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
5436
+ return {
5437
+ displayName,
5438
+ parameters: {
5439
+ required,
5440
+ optional,
5441
+ }
5442
+ };
5443
+ }
5405
5444
  const keyPrefix = 'UiApi';
5406
5445
 
5446
+ const { assign, create, freeze, keys: keys$1 } = Object;
5447
+ const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
5448
+ const { split, endsWith } = String.prototype;
5449
+ const { isArray } = Array;
5450
+ const { concat, filter, includes, push: push$1, reduce } = Array.prototype;
5451
+
5452
+ function isString(value) {
5453
+ return typeof value === 'string';
5454
+ }
5455
+ /**
5456
+ * @param value The array to dedupe
5457
+ * @returns An array without duplicates.
5458
+ */
5459
+ function dedupe(value) {
5460
+ const result = {};
5461
+ for (let i = 0, len = value.length; i < len; i += 1) {
5462
+ result[value[i]] = true;
5463
+ }
5464
+ return keys$1(result);
5465
+ }
5466
+ /**
5467
+ * @param source The array of string to filter
5468
+ * @param compare The array to filter against
5469
+ * @returns An array with values from source that do not exist in compare
5470
+ * If the "compare" array is empty, "source" array itself is returned, not a shallow copy
5471
+ */
5472
+ function difference(source, compare) {
5473
+ const { length: sourceLength } = source;
5474
+ const { length: compareLength } = compare;
5475
+ if (sourceLength === 0 || source === compare) {
5476
+ return [];
5477
+ }
5478
+ if (compareLength === 0) {
5479
+ return source;
5480
+ }
5481
+ // Put all the values from "compare" into a map
5482
+ // This should be faster than doing an indexOf for every string in source
5483
+ const map = {};
5484
+ for (let i = 0; i < compareLength; i += 1) {
5485
+ map[compare[i]] = true;
5486
+ }
5487
+ const strings = [];
5488
+ for (let i = 0; i < sourceLength; i += 1) {
5489
+ const string = source[i];
5490
+ if (map[string] === undefined) {
5491
+ strings.push(string);
5492
+ }
5493
+ }
5494
+ return strings;
5495
+ }
5496
+
5497
+ function isObjectId(unknown) {
5498
+ if (typeof unknown !== 'object' || unknown === null) {
5499
+ return false;
5500
+ }
5501
+ return isString(unknown.objectApiName);
5502
+ }
5503
+
5504
+ /**
5505
+ * Returns the object API name.
5506
+ * @param value The value from which to get the object API name.
5507
+ * @returns The object API name.
5508
+ */
5509
+ function getObjectApiName$1(value) {
5510
+ // Note: tightening validation logic changes behavior from userland getting
5511
+ // a server-provided error to the adapter noop'ing. In 224 we decided to not
5512
+ // change the behavior.
5513
+ if (typeof value === 'string') {
5514
+ const trimmed = value.trim();
5515
+ if (trimmed.length > 0) {
5516
+ return trimmed;
5517
+ }
5518
+ }
5519
+ else if (isObjectId(value)) {
5520
+ return value.objectApiName.trim();
5521
+ }
5522
+ return undefined;
5523
+ }
5524
+
5525
+ function isFieldId(unknown) {
5526
+ if (typeof unknown !== 'object' || unknown === null) {
5527
+ return false;
5528
+ }
5529
+ const value = unknown;
5530
+ return isString(value.objectApiName) && isString(value.fieldApiName);
5531
+ }
5532
+ /**
5533
+ * Split the object API name and field API name from a qualified field name.
5534
+ * Eg: Opportunity.Title returns ['Opportunity', 'Title']
5535
+ * Eg: Opportunity.Account.Name returns ['Opportunity', 'Account.Name']
5536
+ * @param fieldApiName The qualified field name.
5537
+ * @return The object and field API names.
5538
+ */
5539
+ function splitQualifiedFieldApiName(fieldApiName) {
5540
+ const idx = fieldApiName.indexOf('.');
5541
+ if (idx < 1) {
5542
+ // object api name must non-empty
5543
+ throw new TypeError('Value does not include an object API name.');
5544
+ }
5545
+ return [fieldApiName.substring(0, idx), fieldApiName.substring(idx + 1)];
5546
+ }
5547
+
5548
+ /**
5549
+ * Returns the field API name, qualified with an object name if possible.
5550
+ * @param value The value from which to get the qualified field API name.
5551
+ * @return The qualified field API name.
5552
+ */
5553
+ function getFieldApiName(value) {
5554
+ // Note: tightening validation logic changes behavior from userland getting
5555
+ // a server-provided error to the adapter noop'ing. In 224 we decided to not
5556
+ // change the behavior.
5557
+ if (isString(value)) {
5558
+ const trimmed = value.trim();
5559
+ if (trimmed.length > 0) {
5560
+ return trimmed;
5561
+ }
5562
+ }
5563
+ else if (isFieldId(value)) {
5564
+ return value.objectApiName + '.' + value.fieldApiName;
5565
+ }
5566
+ return undefined;
5567
+ }
5568
+
5569
+ /**
5570
+ * Returns the field API name.
5571
+ * @param value The value from which to get the field API name.
5572
+ * @returns The field API name.
5573
+ */
5574
+ function getFieldApiNamesArray(value) {
5575
+ const valueArray = isArray(value) ? value : [value];
5576
+ const array = [];
5577
+ for (let i = 0, len = valueArray.length; i < len; i += 1) {
5578
+ const item = valueArray[i];
5579
+ const apiName = getFieldApiName(item);
5580
+ if (apiName === undefined) {
5581
+ return undefined;
5582
+ }
5583
+ push$1.call(array, apiName);
5584
+ }
5585
+ if (array.length === 0) {
5586
+ return undefined;
5587
+ }
5588
+ return dedupe(array).sort();
5589
+ }
5590
+
5407
5591
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
5408
5592
  const { isArray: ArrayIsArray } = Array;
5409
5593
  function equalsArray(a, b, equalsItem) {
@@ -5678,12 +5862,6 @@ function getTypeCacheKeys$1W(rootKeySet, luvio, input, fullPathFactory) {
5678
5862
  }
5679
5863
  }
5680
5864
 
5681
- const { assign, create, freeze, keys: keys$1 } = Object;
5682
- const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
5683
- const { split, endsWith } = String.prototype;
5684
- const { isArray } = Array;
5685
- const { concat, filter, includes, push: push$1, reduce } = Array.prototype;
5686
-
5687
5865
  // we override the generated so we can set "mergeable: true" on the root key
5688
5866
  const getTypeCacheKeys$1V = (rootKeySet, luvio, input, _fullPathFactory) => {
5689
5867
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
@@ -5991,26 +6169,8 @@ const ingest$1R = function RecordCollectionRepresentationIngest(input, path, luv
5991
6169
  }
5992
6170
  }
5993
6171
  const key = path.fullPath;
5994
- const existingRecord = store.readEntry(key);
5995
6172
  const ttlToUse = TTL$C;
5996
- let incomingRecord = normalize$M(input, store.readEntry(key), {
5997
- fullPath: key,
5998
- parent: path.parent,
5999
- propertyName: path.propertyName,
6000
- ttl: ttlToUse
6001
- }, luvio, store, timestamp);
6002
- if (existingRecord === undefined || equals$_(existingRecord, incomingRecord) === false) {
6003
- luvio.storePublish(key, incomingRecord);
6004
- }
6005
- {
6006
- const storeMetadataParams = {
6007
- ttl: ttlToUse,
6008
- namespace: "UiApi",
6009
- version: VERSION$2h,
6010
- representationName: RepresentationType$U,
6011
- };
6012
- luvio.publishStoreMetadata(key, storeMetadataParams);
6013
- }
6173
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$M, "UiApi", VERSION$2h, RepresentationType$U, equals$_);
6014
6174
  return createLink$1(key);
6015
6175
  };
6016
6176
  function getTypeCacheKeys$1U(rootKeySet, luvio, input, fullPathFactory) {
@@ -6465,95 +6625,6 @@ function equals$Z(existing, incoming) {
6465
6625
  return true;
6466
6626
  }
6467
6627
 
6468
- function isString(value) {
6469
- return typeof value === 'string';
6470
- }
6471
- /**
6472
- * @param value The array to dedupe
6473
- * @returns An array without duplicates.
6474
- */
6475
- function dedupe(value) {
6476
- const result = {};
6477
- for (let i = 0, len = value.length; i < len; i += 1) {
6478
- result[value[i]] = true;
6479
- }
6480
- return keys$1(result);
6481
- }
6482
- /**
6483
- * @param source The array of string to filter
6484
- * @param compare The array to filter against
6485
- * @returns An array with values from source that do not exist in compare
6486
- * If the "compare" array is empty, "source" array itself is returned, not a shallow copy
6487
- */
6488
- function difference(source, compare) {
6489
- const { length: sourceLength } = source;
6490
- const { length: compareLength } = compare;
6491
- if (sourceLength === 0 || source === compare) {
6492
- return [];
6493
- }
6494
- if (compareLength === 0) {
6495
- return source;
6496
- }
6497
- // Put all the values from "compare" into a map
6498
- // This should be faster than doing an indexOf for every string in source
6499
- const map = {};
6500
- for (let i = 0; i < compareLength; i += 1) {
6501
- map[compare[i]] = true;
6502
- }
6503
- const strings = [];
6504
- for (let i = 0; i < sourceLength; i += 1) {
6505
- const string = source[i];
6506
- if (map[string] === undefined) {
6507
- strings.push(string);
6508
- }
6509
- }
6510
- return strings;
6511
- }
6512
-
6513
- function isFieldId(unknown) {
6514
- if (typeof unknown !== 'object' || unknown === null) {
6515
- return false;
6516
- }
6517
- const value = unknown;
6518
- return isString(value.objectApiName) && isString(value.fieldApiName);
6519
- }
6520
- /**
6521
- * Split the object API name and field API name from a qualified field name.
6522
- * Eg: Opportunity.Title returns ['Opportunity', 'Title']
6523
- * Eg: Opportunity.Account.Name returns ['Opportunity', 'Account.Name']
6524
- * @param fieldApiName The qualified field name.
6525
- * @return The object and field API names.
6526
- */
6527
- function splitQualifiedFieldApiName(fieldApiName) {
6528
- const idx = fieldApiName.indexOf('.');
6529
- if (idx < 1) {
6530
- // object api name must non-empty
6531
- throw new TypeError('Value does not include an object API name.');
6532
- }
6533
- return [fieldApiName.substring(0, idx), fieldApiName.substring(idx + 1)];
6534
- }
6535
-
6536
- /**
6537
- * Returns the field API name, qualified with an object name if possible.
6538
- * @param value The value from which to get the qualified field API name.
6539
- * @return The qualified field API name.
6540
- */
6541
- function getFieldApiName(value) {
6542
- // Note: tightening validation logic changes behavior from userland getting
6543
- // a server-provided error to the adapter noop'ing. In 224 we decided to not
6544
- // change the behavior.
6545
- if (isString(value)) {
6546
- const trimmed = value.trim();
6547
- if (trimmed.length > 0) {
6548
- return trimmed;
6549
- }
6550
- }
6551
- else if (isFieldId(value)) {
6552
- return value.objectApiName + '.' + value.fieldApiName;
6553
- }
6554
- return undefined;
6555
- }
6556
-
6557
6628
  /**
6558
6629
  * A set of the string names of known ui-api supported entities.
6559
6630
  *
@@ -9329,29 +9400,39 @@ const ingest$1Q = (input, path, luvio, store, timestamp) => {
9329
9400
  return result;
9330
9401
  };
9331
9402
 
9332
- const getListUiByApiName_ConfigPropertyNames = {
9333
- displayName: 'getListUiByApiName',
9334
- parameters: {
9335
- required: ['listViewApiName', 'objectApiName'],
9336
- optional: ['fields', 'optionalFields', 'pageSize', 'pageToken', 'sortBy']
9337
- }
9338
- };
9339
-
9340
- const getListUiByListViewId_ConfigPropertyNames = {
9341
- displayName: 'getListUiByListViewId',
9342
- parameters: {
9343
- required: ['listViewId'],
9344
- optional: ['fields', 'optionalFields', 'pageSize', 'pageToken', 'sortBy']
9345
- }
9346
- };
9347
-
9348
- const getMruListUi_ConfigPropertyNames = {
9349
- displayName: 'getMruListUi',
9350
- parameters: {
9351
- required: ['objectApiName'],
9352
- optional: ['fields', 'optionalFields', 'pageSize', 'pageToken', 'sortBy']
9353
- }
9354
- };
9403
+ const adapterName$S = 'getListUiByApiName';
9404
+ const getListUiByApiName_ConfigPropertyMetadata = [
9405
+ generateParamConfigMetadata('listViewApiName', true),
9406
+ generateParamConfigMetadata('objectApiName', true, getObjectApiName$1),
9407
+ generateParamConfigMetadata('fields', false, getFieldApiNamesArray),
9408
+ generateParamConfigMetadata('optionalFields', false, getFieldApiNamesArray),
9409
+ generateParamConfigMetadata('pageSize', false),
9410
+ generateParamConfigMetadata('pageToken', false),
9411
+ generateParamConfigMetadata('sortBy', false, getFieldApiNamesArray),
9412
+ ];
9413
+ const getListUiByApiName_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$S, getListUiByApiName_ConfigPropertyMetadata);
9414
+
9415
+ const adapterName$R = 'getListUiByListViewId';
9416
+ const getListUiByListViewId_ConfigPropertyMetadata = [
9417
+ generateParamConfigMetadata('listViewId', true),
9418
+ generateParamConfigMetadata('fields', false, getFieldApiNamesArray),
9419
+ generateParamConfigMetadata('optionalFields', false, getFieldApiNamesArray),
9420
+ generateParamConfigMetadata('pageSize', false),
9421
+ generateParamConfigMetadata('pageToken', false),
9422
+ generateParamConfigMetadata('sortBy', false, getFieldApiNamesArray),
9423
+ ];
9424
+ const getListUiByListViewId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$R, getListUiByListViewId_ConfigPropertyMetadata);
9425
+
9426
+ const adapterName$P = 'getMruListUi';
9427
+ const getMruListUi_ConfigPropertyMetadata = [
9428
+ generateParamConfigMetadata('objectApiName', true, getObjectApiName$1),
9429
+ generateParamConfigMetadata('fields', false, getFieldApiNamesArray),
9430
+ generateParamConfigMetadata('optionalFields', false, getFieldApiNamesArray),
9431
+ generateParamConfigMetadata('pageSize', false),
9432
+ generateParamConfigMetadata('pageToken', false),
9433
+ generateParamConfigMetadata('sortBy', false, getFieldApiNamesArray),
9434
+ ];
9435
+ const getMruListUi_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$P, getMruListUi_ConfigPropertyMetadata);
9355
9436
  // make local copies of the adapter configs so we can ignore other getListUi config parameters to match
9356
9437
  // lds222 behavior
9357
9438
  ({
package/dist/adsBridge.js CHANGED
@@ -375,4 +375,4 @@ function withAdsBridge(callback) {
375
375
  }
376
376
 
377
377
  export { instrument, withAdsBridge };
378
- // version: 1.213.0-831919511
378
+ // version: 1.213.2-69d4eea1b
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-ads-bridge",
3
- "version": "1.213.0",
3
+ "version": "1.213.2",
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",