@salesforce/lds-worker-api 1.281.0 → 1.283.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.
@@ -28,9 +28,17 @@ const { parse: parse$a, stringify: stringify$a } = JSON;
28
28
  const WeakSetCtor = WeakSet;
29
29
 
30
30
  const deeplyFrozen = new WeakSetCtor();
31
+ // Allow custom environments to bypass deep freeze for performance reasons
32
+ let bypassDeepFreeze = false;
33
+ function setBypassDeepFreeze(value) {
34
+ bypassDeepFreeze = value;
35
+ }
31
36
  function deepFreeze(value) {
32
37
  // No need to freeze primitives or already frozen stuff
33
- if (typeof value !== 'object' || value === null || deeplyFrozen.has(value)) {
38
+ if (bypassDeepFreeze ||
39
+ typeof value !== 'object' ||
40
+ value === null ||
41
+ deeplyFrozen.has(value)) {
34
42
  return;
35
43
  }
36
44
  deeplyFrozen.add(value);
@@ -4041,7 +4049,7 @@ function createResourceParamsImpl(config, configMetadata) {
4041
4049
  }
4042
4050
  return resourceParams;
4043
4051
  }
4044
- // engine version: 0.154.14-2fbbff64
4052
+ // engine version: 0.154.15-db466bed
4045
4053
 
4046
4054
  /**
4047
4055
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -4169,7 +4177,7 @@ function withDefaultLuvio(callback) {
4169
4177
  }
4170
4178
  callbacks.push(callback);
4171
4179
  }
4172
- // version: 1.281.0-9a56a08f0
4180
+ // version: 1.283.0-a330da944
4173
4181
 
4174
4182
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4175
4183
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15677,7 +15685,7 @@ function gql(literals, ...subs) {
15677
15685
  }
15678
15686
  return superResult;
15679
15687
  }
15680
- // version: 1.281.0-9a56a08f0
15688
+ // version: 1.283.0-a330da944
15681
15689
 
15682
15690
  function unwrap(data) {
15683
15691
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16602,7 +16610,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16602
16610
  const { apiFamily, name } = metadata;
16603
16611
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16604
16612
  }
16605
- // version: 1.281.0-9a56a08f0
16613
+ // version: 1.283.0-a330da944
16606
16614
 
16607
16615
  /**
16608
16616
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16701,7 +16709,7 @@ var TypeCheckShapes;
16701
16709
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
16702
16710
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
16703
16711
  })(TypeCheckShapes || (TypeCheckShapes = {}));
16704
- // engine version: 0.154.14-2fbbff64
16712
+ // engine version: 0.154.15-db466bed
16705
16713
 
16706
16714
  const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
16707
16715
 
@@ -21631,10 +21639,10 @@ function tokenForAtMost$1(paginationMetadata, maxOffset) {
21631
21639
  }
21632
21640
 
21633
21641
  const TTL$x = 30000;
21634
- const VERSION$18$1 = "88d8362577eaa3dae0820deeea3b7ae4";
21642
+ const VERSION$18$1 = "e635ab62cb633d32aeeb183e568bb2c7";
21635
21643
  const RepresentationType$T = 'ListRecordCollectionRepresentation';
21636
21644
  function keyBuilder$23(luvio, config) {
21637
- return keyPrefix$2 + '::' + RepresentationType$T + ':' + config.objectApiName + ':' + (config.searchTerm === null ? '' : config.searchTerm) + ':' + (config.sortBy === null ? '' : '[' + config.sortBy.join(',') + ']') + ':' + (config.listViewId === null ? '' : config.listViewId) + ':' + (config.listViewApiName === null ? '' : config.listViewApiName);
21645
+ return keyPrefix$2 + '::' + RepresentationType$T + ':' + config.objectApiName + ':' + (config.searchTerm === null ? '' : config.searchTerm) + ':' + (config.sortBy === null ? '' : '[' + config.sortBy.join(',') + ']') + ':' + (config.listViewId === null ? '' : config.listViewId) + ':' + (config.where === null ? '' : config.where) + ':' + (config.listViewApiName === null ? '' : config.listViewApiName);
21638
21646
  }
21639
21647
  function keyBuilderFromType$B(luvio, object) {
21640
21648
  const keyParams = {
@@ -21642,6 +21650,7 @@ function keyBuilderFromType$B(luvio, object) {
21642
21650
  searchTerm: object.searchTerm,
21643
21651
  sortBy: object.sortBy,
21644
21652
  listViewId: object.listInfoETag,
21653
+ where: object.where,
21645
21654
  listViewApiName: object.listReference.listViewApiName
21646
21655
  };
21647
21656
  return keyBuilder$23(luvio, keyParams);
@@ -22701,7 +22710,7 @@ function splitListRecordCollectionKey(key) {
22701
22710
  const keyElements = key.split(':');
22702
22711
  return {
22703
22712
  objectApiName: keyElements[3],
22704
- listViewApiName: keyElements[7],
22713
+ listViewApiName: keyElements[8],
22705
22714
  };
22706
22715
  }
22707
22716
  function splitListSummaryCollectionKey(key) {
@@ -22927,6 +22936,7 @@ function listFields(luvio, { fields = [], optionalFields = [], sortBy, }, listIn
22927
22936
  listViewId: listInfo.eTag,
22928
22937
  sortBy: sortBy || null,
22929
22938
  searchTerm: null,
22939
+ where: null,
22930
22940
  objectApiName: listInfo.listReference.objectApiName,
22931
22941
  listViewApiName: listInfo.listReference.listViewApiName,
22932
22942
  }) + '__fieldstatus';
@@ -22992,17 +23002,18 @@ function keyBuilder$1$(luvio, params) {
22992
23002
  const listReference = getListReference(query, context$1);
22993
23003
  if (listReference !== undefined) {
22994
23004
  // Check and use any default values returned from the server (i.e. sortBy)
22995
- const config = { ...params.urlParams, ...params.queryParams };
23005
+ const config = { ...params.urlParams, ...params.body };
22996
23006
  const defaults = getServerDefaults(config, context$1);
22997
23007
  // Use default values when sortBy is undefined or an empty Array []
22998
23008
  return keyBuilder$23(luvio, {
22999
23009
  objectApiName: listReference.objectApiName,
23000
23010
  listViewApiName: listReference.listViewApiName,
23001
23011
  listViewId: listReference.id,
23002
- searchTerm: params.queryParams.searchTerm || null,
23003
- sortBy: params.queryParams.sortBy !== undefined && params.queryParams.sortBy.length <= 0
23004
- ? defaults.sortBy || params.queryParams.sortBy || []
23005
- : params.queryParams.sortBy || defaults.sortBy || [],
23012
+ searchTerm: params.body.searchTerm || null,
23013
+ where: params.body.where || null,
23014
+ sortBy: params.body.sortBy !== undefined && params.body.sortBy.length <= 0
23015
+ ? defaults.sortBy || params.body.sortBy || []
23016
+ : params.body.sortBy || defaults.sortBy || [],
23006
23017
  });
23007
23018
  }
23008
23019
  // If there are no matching entries in the store, then we haven't fetched any data for this list view yet.
@@ -23011,13 +23022,14 @@ function keyBuilder$1$(luvio, params) {
23011
23022
  objectApiName: params.urlParams.objectApiName,
23012
23023
  listViewApiName: params.urlParams.listViewApiName,
23013
23024
  listViewId: '',
23014
- searchTerm: params.queryParams.searchTerm || null,
23015
- sortBy: params.queryParams.sortBy || [],
23025
+ searchTerm: params.body.searchTerm || null,
23026
+ where: params.body.where || null,
23027
+ sortBy: params.body.sortBy || [],
23016
23028
  });
23017
23029
  }
23018
23030
 
23019
23031
  function select$1K(luvio, params) {
23020
- const { fields = [], optionalFields = [] } = params.queryParams;
23032
+ const { fields = [], optionalFields = [] } = params.body;
23021
23033
  return dynamicSelect$7({
23022
23034
  records: {
23023
23035
  name: 'records',
@@ -23035,7 +23047,7 @@ function ingestSuccess$Q(luvio, resourceParams, response, snapshotRefresh) {
23035
23047
  const { body } = response;
23036
23048
  const key = keyBuilder$1$(luvio, resourceParams);
23037
23049
  luvio.storeIngest(key, ingest$M$1, body);
23038
- const optionalFields = resourceParams.queryParams.optionalFields;
23050
+ const optionalFields = resourceParams.body.optionalFields;
23039
23051
  if (optionalFields && optionalFields.length > 0) {
23040
23052
  const normalized = body;
23041
23053
  markMissingOptionalFieldsOnRecords$1(luvio, normalized, optionalFields);
@@ -23060,10 +23072,10 @@ function markMissingOptionalFieldsOnRecords$1(luvio, nomalized, optionalFields)
23060
23072
  }
23061
23073
 
23062
23074
  function createPaginationParams$4(params) {
23063
- const { queryParams } = params;
23075
+ const { body } = params;
23064
23076
  return {
23065
- token: queryParams.pageToken,
23066
- pageSize: queryParams.pageSize === undefined ? 50 : queryParams.pageSize
23077
+ token: body.pageToken,
23078
+ pageSize: body.pageSize === undefined ? 50 : body.pageSize
23067
23079
  };
23068
23080
  }
23069
23081
  function getResponseCacheKeys$$(storeKeyMap, luvio, resourceParams, response) {
@@ -23086,10 +23098,10 @@ function createResourceRequest$15(config) {
23086
23098
  return {
23087
23099
  baseUri: '/services/data/v61.0',
23088
23100
  basePath: '/ui-api/list-records/' + config.urlParams.objectApiName + '/' + config.urlParams.listViewApiName + '',
23089
- method: 'get',
23090
- body: null,
23101
+ method: 'post',
23102
+ body: config.body,
23091
23103
  urlParams: config.urlParams,
23092
- queryParams: config.queryParams,
23104
+ queryParams: {},
23093
23105
  headers,
23094
23106
  priority: 'normal',
23095
23107
  };
@@ -23952,6 +23964,7 @@ function prepareRequest_getMruListRecords(luvio, config, listInfo, snapshot) {
23952
23964
  const paginationKey = paginationKeyBuilder(luvio, {
23953
23965
  listViewId: listInfo.eTag,
23954
23966
  searchTerm: null,
23967
+ where: null,
23955
23968
  sortBy: config.sortBy === undefined ? null : config.sortBy,
23956
23969
  objectApiName: listInfo.listReference.objectApiName,
23957
23970
  listViewApiName: listInfo.listReference.listViewApiName,
@@ -23999,6 +24012,7 @@ function onResourceSuccess_getMruListRecords(luvio, config, listInfo, response)
23999
24012
  luvio.storeIngest(keyBuilder$23(luvio, {
24000
24013
  listViewId: listInfoETag,
24001
24014
  searchTerm: null,
24015
+ where: null,
24002
24016
  sortBy: body.sortBy,
24003
24017
  objectApiName: listInfo.listReference.objectApiName,
24004
24018
  listViewApiName: listInfo.listReference.listViewApiName,
@@ -24294,6 +24308,13 @@ function prepareRequest_getListRecords(luvio, context, config, listInfo, snapsho
24294
24308
  pageToken,
24295
24309
  sortBy,
24296
24310
  };
24311
+ const body = {
24312
+ fields,
24313
+ optionalFields,
24314
+ pageSize,
24315
+ pageToken,
24316
+ sortBy,
24317
+ };
24297
24318
  let request;
24298
24319
  if (isGetListUiByApiNameConfig(config)) {
24299
24320
  request = createResourceRequest$15({
@@ -24301,7 +24322,7 @@ function prepareRequest_getListRecords(luvio, context, config, listInfo, snapsho
24301
24322
  listViewApiName: config.listViewApiName,
24302
24323
  objectApiName: config.objectApiName,
24303
24324
  },
24304
- queryParams,
24325
+ body,
24305
24326
  });
24306
24327
  }
24307
24328
  else if (isGetListUiByListViewIdConfig(config)) {
@@ -24326,6 +24347,7 @@ function prepareRequest_getListRecords(luvio, context, config, listInfo, snapsho
24326
24347
  const paginationKey = paginationKeyBuilder(luvio, {
24327
24348
  listViewId: listInfo.eTag,
24328
24349
  searchTerm: null,
24350
+ where: null,
24329
24351
  sortBy: getSortBy(config, context),
24330
24352
  objectApiName: listInfo.listReference.objectApiName,
24331
24353
  listViewApiName: listInfo.listReference.listViewApiName,
@@ -24376,6 +24398,7 @@ function onResourceSuccess_getListRecords(luvio, context, config, listInfo, resp
24376
24398
  luvio.storeIngest(keyBuilder$23(luvio, {
24377
24399
  listViewId: listInfoETag,
24378
24400
  searchTerm: null,
24401
+ where: null,
24379
24402
  sortBy: body.sortBy,
24380
24403
  objectApiName: listInfo.listReference.objectApiName,
24381
24404
  listViewApiName: listInfo.listReference.listViewApiName,
@@ -29537,7 +29560,7 @@ function getTypeCacheKeys$z$1(rootKeySet, luvio, input, fullPathFactory) {
29537
29560
  }
29538
29561
 
29539
29562
  const TTL$n = 300000;
29540
- const VERSION$O$1 = "1781f2d3d4e413cf0c681774d82d02cd";
29563
+ const VERSION$O$1 = "b33c534240965bedfcf073228d48b940";
29541
29564
  const RepresentationType$x = 'AppRepresentation';
29542
29565
  function keyBuilder$1k(luvio, config) {
29543
29566
  return keyPrefix$2 + '::' + RepresentationType$x + ':' + (config.appId === null ? '' : config.appId);
@@ -29698,11 +29721,6 @@ function equals$E(existing, incoming) {
29698
29721
  if (!(existing_eTag === incoming_eTag)) {
29699
29722
  return false;
29700
29723
  }
29701
- const existing_headerColor = existing.headerColor;
29702
- const incoming_headerColor = incoming.headerColor;
29703
- if (!(existing_headerColor === incoming_headerColor)) {
29704
- return false;
29705
- }
29706
29724
  const existing_label = existing.label;
29707
29725
  const incoming_label = incoming.label;
29708
29726
  if (!(existing_label === incoming_label)) {
@@ -29743,6 +29761,11 @@ function equals$E(existing, incoming) {
29743
29761
  if (equals_formFactors_items === false) {
29744
29762
  return false;
29745
29763
  }
29764
+ const existing_headerColor = existing.headerColor;
29765
+ const incoming_headerColor = incoming.headerColor;
29766
+ if (!(existing_headerColor === incoming_headerColor)) {
29767
+ return false;
29768
+ }
29746
29769
  const existing_iconUrl = existing.iconUrl;
29747
29770
  const incoming_iconUrl = incoming.iconUrl;
29748
29771
  if (!(existing_iconUrl === incoming_iconUrl)) {
@@ -38364,7 +38387,7 @@ function createPaginationParams(params) {
38364
38387
  function keyBuilder$s$1(luvio, params) {
38365
38388
  return keyBuilder$t$1(luvio, {
38366
38389
  sortBy: params.body.sortBy || [],
38367
- where: params.body.where || "",
38390
+ where: params.body.where || null,
38368
38391
  parentRecordId: params.urlParams.parentRecordId,
38369
38392
  relatedListId: params.urlParams.relatedListId
38370
38393
  });
@@ -40669,12 +40692,13 @@ const adapterName$6 = 'getListRecordsByName';
40669
40692
  const getListRecordsByName_ConfigPropertyMetadata = [
40670
40693
  generateParamConfigMetadata$2('listViewApiName', true, 0 /* UrlParameter */, 0 /* String */),
40671
40694
  generateParamConfigMetadata$2('objectApiName', true, 0 /* UrlParameter */, 0 /* String */),
40672
- generateParamConfigMetadata$2('fields', false, 1 /* QueryParameter */, 0 /* String */, true),
40673
- generateParamConfigMetadata$2('optionalFields', false, 1 /* QueryParameter */, 0 /* String */, true),
40674
- generateParamConfigMetadata$2('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
40675
- generateParamConfigMetadata$2('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
40676
- generateParamConfigMetadata$2('searchTerm', false, 1 /* QueryParameter */, 0 /* String */),
40677
- generateParamConfigMetadata$2('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true),
40695
+ generateParamConfigMetadata$2('fields', false, 2 /* Body */, 0 /* String */, true),
40696
+ generateParamConfigMetadata$2('optionalFields', false, 2 /* Body */, 0 /* String */, true),
40697
+ generateParamConfigMetadata$2('pageSize', false, 2 /* Body */, 3 /* Integer */),
40698
+ generateParamConfigMetadata$2('pageToken', false, 2 /* Body */, 0 /* String */),
40699
+ generateParamConfigMetadata$2('searchTerm', false, 2 /* Body */, 0 /* String */),
40700
+ generateParamConfigMetadata$2('sortBy', false, 2 /* Body */, 0 /* String */, true),
40701
+ generateParamConfigMetadata$2('where', false, 2 /* Body */, 0 /* String */),
40678
40702
  ];
40679
40703
  const getListRecordsByName_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig$2(adapterName$6, getListRecordsByName_ConfigPropertyMetadata);
40680
40704
  const createResourceParams$8 = /*#__PURE__*/ createResourceParams$13(getListRecordsByName_ConfigPropertyMetadata);
@@ -40791,7 +40815,7 @@ function getPaginationMetadata(luvio, resourceParams) {
40791
40815
  return node.data.__metadata;
40792
40816
  }
40793
40817
  function buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext) {
40794
- return buildNetworkSnapshotCachePolicy$S(context, coercedAdapterRequestContext, buildNetworkSnapshot$9, undefined, true);
40818
+ return buildNetworkSnapshotCachePolicy$S(context, coercedAdapterRequestContext, buildNetworkSnapshot$9, 'get', true);
40795
40819
  }
40796
40820
  function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
40797
40821
  const { luvio, config } = context;
@@ -44069,7 +44093,7 @@ withDefaultLuvio((luvio) => {
44069
44093
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44070
44094
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44071
44095
  });
44072
- // version: 1.281.0-bcef40769
44096
+ // version: 1.283.0-80ddb6c3c
44073
44097
 
44074
44098
  var ldsIdempotencyWriteDisabled = {
44075
44099
  isOpen: function (e) {
@@ -45208,7 +45232,9 @@ function isUnfulfilledSnapshot$1(cachedSnapshotResult) {
45208
45232
  * @param durableStore A DurableStore implementation
45209
45233
  * @param instrumentation An instrumentation function implementation
45210
45234
  */
45211
- function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, enableDurableMetadataRefresh = false, }) {
45235
+ function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, enableDurableMetadataRefresh = false, disableDeepFreeze = false, }) {
45236
+ // runtimes can choose to disable deepFreeze, e.g. headless mobile runtime
45237
+ setBypassDeepFreeze(disableDeepFreeze);
45212
45238
  let stagingStore = null;
45213
45239
  const durableTTLStore = new DurableTTLStore(durableStore);
45214
45240
  const mergeKeysPromiseMap = new Map();
@@ -49701,6 +49727,10 @@ class DurableDraftQueue {
49701
49727
  switch (result) {
49702
49728
  case ProcessActionResult.BLOCKED_ON_ERROR:
49703
49729
  this.state = DraftQueueState.Error;
49730
+ await this.notifyChangedListeners({
49731
+ type: DraftQueueEventType.QueueStateChanged,
49732
+ state: this.state,
49733
+ });
49704
49734
  return Promise.reject();
49705
49735
  default:
49706
49736
  return Promise.resolve();
@@ -52142,6 +52172,9 @@ function sanitizePredicateIDValue(value, draftFunction) {
52142
52172
  if (isArray$2$1(value)) {
52143
52173
  return value.map((singleValue) => sanitizePredicateIDValue(singleValue, draftFunction));
52144
52174
  }
52175
+ else if (typeof value === 'string' && value === '') {
52176
+ return value;
52177
+ }
52145
52178
  else {
52146
52179
  const coercedId = getRecordId18(value);
52147
52180
  if (coercedId !== undefined) {
@@ -52215,6 +52248,9 @@ function createSinglePredicate(val, operator, field, alias) {
52215
52248
  else if (field.apiName === 'weakEtag') {
52216
52249
  leftPath = '$.weakEtag';
52217
52250
  }
52251
+ else if (field.apiName === 'RecordTypeId') {
52252
+ leftPath = '$.recordTypeId';
52253
+ }
52218
52254
  return {
52219
52255
  alias,
52220
52256
  leftPath,
@@ -52861,19 +52897,7 @@ function isCapableRelationship(node) {
52861
52897
  });
52862
52898
  }
52863
52899
  }
52864
- else if (isInlineFragmentNode(node)) {
52865
- if (!node.selectionSet)
52866
- return false;
52867
- return node.selectionSet.selections.some((selection) => {
52868
- if (selection.kind !== Kind$1.FIELD && selection.kind !== Kind$1.INLINE_FRAGMENT)
52869
- return false;
52870
- // example: Account { Id }
52871
- if (selection.kind === Kind$1.FIELD && selection.name.value === 'Id')
52872
- return true;
52873
- return selection.selectionSet !== undefined;
52874
- });
52875
- }
52876
- return false;
52900
+ return isInlineFragmentNode(node);
52877
52901
  }
52878
52902
  /**
52879
52903
  * checks if the 'ArgumentNode' is a specific scope type
@@ -55500,7 +55524,8 @@ function injectParentRelationships(selections, parentNode, parentPath, ancestors
55500
55524
  * @param objectInfos
55501
55525
  * @returns
55502
55526
  */
55503
- function injectFieldsForDisplayValue({ selectionSet }, parentNode, objectInfos) {
55527
+ function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
55528
+ const { selectionSet } = topNode;
55504
55529
  if (selectionSet === undefined)
55505
55530
  return [];
55506
55531
  let displayValueNameFields = [];
@@ -55513,6 +55538,10 @@ function injectFieldsForDisplayValue({ selectionSet }, parentNode, objectInfos)
55513
55538
  displayValue = node;
55514
55539
  break;
55515
55540
  }
55541
+ if (isInlineFragmentNode(node)) {
55542
+ const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
55543
+ displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
55544
+ }
55516
55545
  }
55517
55546
  if (displayValue !== undefined) {
55518
55547
  const apiName = parentNode.name.value;
@@ -55582,10 +55611,17 @@ function injectFields(selections, parentNode, parentPath, ancestors, objectInfos
55582
55611
  // example: TimeSheetId { value }
55583
55612
  relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
55584
55613
  }
55614
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, {
55615
+ ...parent,
55616
+ name: {
55617
+ ...parent.name,
55618
+ value: targetRelationship.childObjectApiName,
55619
+ },
55620
+ }, objectInfos));
55585
55621
  }
55586
55622
  }
55587
55623
  }
55588
- displayValueNameFields = injectFieldsForDisplayValue(parentNode, parent, objectInfos);
55624
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, parent, objectInfos));
55589
55625
  }
55590
55626
  }
55591
55627
  return [
@@ -55838,6 +55874,10 @@ function removeSyntheticFields(result, query) {
55838
55874
  // build our output from the original result set
55839
55875
  // so we keep any other results that are not included in a record query
55840
55876
  const output = { ...result };
55877
+ // graphqlBatch return deep frozon object, need to spread out new writeable copy for injected field removal
55878
+ output.data = { ...output.data };
55879
+ output.data.uiapi = { ...output.data.uiapi };
55880
+ output.data.uiapi.query = { ...output.data.uiapi.query };
55841
55881
  const outputApiParent = output.data.uiapi.query;
55842
55882
  const keys$1 = keys$4(nodeJson);
55843
55883
  keys$1.forEach((recordName) => {
@@ -57941,11 +57981,14 @@ const replaceDraftIdsInVariables$1 = (variables, draftFunctions, unmappedDraftID
57941
57981
  };
57942
57982
  // create the runtime cache for the graphql schema when the factory creates the adapter
57943
57983
  const graphqlSchemaCache = new CachedGraphQLSchema();
57944
- function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
57945
- const getCanonicalId = (id) => {
57984
+ function getCanonicalIdFunction(luvio) {
57985
+ return (id) => {
57946
57986
  var _a;
57947
57987
  return ((_a = extractRecordIdFromStoreKey$1(luvio.storeGetCanonicalKey(RECORD_ID_PREFIX$1 + id))) !== null && _a !== void 0 ? _a : id);
57948
57988
  };
57989
+ }
57990
+ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
57991
+ const getCanonicalId = getCanonicalIdFunction(luvio);
57949
57992
  return async function draftAwareGraphQLAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
57950
57993
  //create a copy to not accidentally modify the AST in the astResolver map of luvio
57951
57994
  const copy = parse$3(stringify$3(config.query));
@@ -58095,9 +58138,61 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
58095
58138
  return resultSnapshot;
58096
58139
  };
58097
58140
  }
58098
- function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio) {
58141
+ function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId) {
58099
58142
  return async function environmentAwareGraphQLBatchAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
58100
- return luvio.applyCachePolicy(requestContext, { config, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
58143
+ const batchQueryCopy = config.batchQuery.map((query) => clone(query));
58144
+ let injectedBatchQuery = [];
58145
+ const getCanonicalId = getCanonicalIdFunction(luvio);
58146
+ const draftFunctions = {
58147
+ isDraftId,
58148
+ getCanonicalId,
58149
+ };
58150
+ // return error snapshot if fails injecting fields into grapqhBatch batchQuery
58151
+ try {
58152
+ injectedBatchQuery = await Promise.all(batchQueryCopy.map((query) => injectSyntheticFields(query.query, objectInfoService, draftFunctions, query.variables)));
58153
+ }
58154
+ catch (error) {
58155
+ const message = error instanceof Error ? error.message : String(error);
58156
+ return {
58157
+ data: undefined,
58158
+ state: 'Error',
58159
+ error: {
58160
+ errorType: 'adapterError',
58161
+ error: {
58162
+ message,
58163
+ },
58164
+ },
58165
+ };
58166
+ }
58167
+ const injectedConfig = {
58168
+ batchQuery: injectedBatchQuery.map((query, index) => {
58169
+ return {
58170
+ query: query.modifiedAST,
58171
+ variables: config.batchQuery[index].variables,
58172
+ };
58173
+ }),
58174
+ };
58175
+ const snapshot = (await luvio.applyCachePolicy(requestContext, { config: injectedConfig, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
58176
+ if (snapshot.state === 'Error') {
58177
+ return snapshot;
58178
+ }
58179
+ // remove injected fields from response.
58180
+ const data = snapshot.data;
58181
+ const userResults = data.results.map((compositeResult, index) => {
58182
+ if (compositeResult.statusCode === HttpStatusCode$1.Ok) {
58183
+ return {
58184
+ result: removeSyntheticFields(compositeResult.result, config.batchQuery[index].query),
58185
+ statusCode: compositeResult.statusCode,
58186
+ };
58187
+ }
58188
+ return compositeResult;
58189
+ });
58190
+ return {
58191
+ ...snapshot,
58192
+ data: {
58193
+ results: userResults,
58194
+ },
58195
+ };
58101
58196
  };
58102
58197
  }
58103
58198
 
@@ -61032,13 +61127,13 @@ function mergeRecord(existingRecord, incomingRecord, objectInfo) {
61032
61127
  // since none of the changed fields are part of the incoming record
61033
61128
  if (missingFields.every((field) => {
61034
61129
  const referenceFieldName = findReferenceFieldForSpanningField(field, objectInfo);
61035
- if (referenceFieldName !== undefined) {
61036
- return (incomingRecord.fields[referenceFieldName].value ===
61037
- existingRecord.fields[referenceFieldName].value);
61038
- }
61039
- else {
61130
+ if (referenceFieldName === undefined) {
61040
61131
  return false;
61041
61132
  }
61133
+ return (existingRecord.fields[referenceFieldName] &&
61134
+ incomingRecord.fields[referenceFieldName] &&
61135
+ incomingRecord.fields[referenceFieldName].value ===
61136
+ existingRecord.fields[referenceFieldName].value);
61042
61137
  })) {
61043
61138
  return {
61044
61139
  ok: true,
@@ -61915,6 +62010,9 @@ class LdsPrimingRecordRefresher {
61915
62010
  optionalFields: value.fields.map((f) => `${_apiName}.${f}`),
61916
62011
  },
61917
62012
  ],
62013
+ }, {
62014
+ cachePolicy: { type: 'no-cache' },
62015
+ priority: 'background',
61918
62016
  }));
61919
62017
  });
61920
62018
  const promiseResults = await allSettled(promises);
@@ -62019,6 +62117,8 @@ function getRuntime() {
62019
62117
  const durableEnv = makeDurable(gqlEnv, {
62020
62118
  durableStore: recordDenormingStore,
62021
62119
  enableDurableMetadataRefresh: ldsMetadataRefreshEnabled.isOpen({ fallback: false }),
62120
+ // disable luvio deep freeze in headless environments
62121
+ disableDeepFreeze: typeof window === 'undefined',
62022
62122
  });
62023
62123
  getIngestRecords = durableEnv.getIngestStagingStoreRecords;
62024
62124
  getIngestMetadata = durableEnv.getIngestStagingStoreMetadata;
@@ -62074,7 +62174,7 @@ function getRuntime() {
62074
62174
  setDraftAwareGraphQLAdapter(
62075
62175
  // return a draft aware graphql adapter here
62076
62176
  draftAwareGraphQLAdapter);
62077
- const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio);
62177
+ const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio, isGenerated);
62078
62178
  setEnvironmentAwareGraphQLBatchAdapter(environmentAwareGraphQLBatchAdapter);
62079
62179
  };
62080
62180
  const draftAwareCreateContentDocumentAndVersionAdapter = createContentDocumentAndVersionDraftAdapterFactory(lazyLuvio, NimbusBinaryStore, contentDocumentCompositeActionHandler);
@@ -62121,7 +62221,7 @@ register$1({
62121
62221
  id: '@salesforce/lds-network-adapter',
62122
62222
  instrument: instrument$2,
62123
62223
  });
62124
- // version: 1.281.0-9a56a08f0
62224
+ // version: 1.283.0-a330da944
62125
62225
 
62126
62226
  const { create: create$3, keys: keys$3 } = Object;
62127
62227
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82131,7 +82231,7 @@ register$1({
82131
82231
  configuration: { ...configurationForGraphQLAdapters$1 },
82132
82232
  instrument: instrument$1,
82133
82233
  });
82134
- // version: 1.281.0-bcef40769
82234
+ // version: 1.283.0-80ddb6c3c
82135
82235
 
82136
82236
  // On core the unstable adapters are re-exported with different names,
82137
82237
  // we want to match them here.
@@ -84387,7 +84487,7 @@ withDefaultLuvio((luvio) => {
84387
84487
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84388
84488
  graphQLImperative = ldsAdapter;
84389
84489
  });
84390
- // version: 1.281.0-bcef40769
84490
+ // version: 1.283.0-80ddb6c3c
84391
84491
 
84392
84492
  var gqlApi = /*#__PURE__*/Object.freeze({
84393
84493
  __proto__: null,
@@ -84736,16 +84836,7 @@ function invokeAdapterWithDraftToReplace(adapterId, config, draftIdToReplace, on
84736
84836
  onResponse(responseValue);
84737
84837
  })
84738
84838
  .catch((error) => {
84739
- let message = 'Unknown error replacing draft';
84740
- if (error instanceof Error) {
84741
- message = error.message;
84742
- }
84743
- else if (typeof error === 'string') {
84744
- message = error;
84745
- }
84746
- onResponse({
84747
- error: createNativeFetchErrorResponse(message),
84748
- });
84839
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing draft'));
84749
84840
  });
84750
84841
  }
84751
84842
  else {
@@ -84796,6 +84887,9 @@ function invokeAdapterWithMetadata(adapterId, config, metadata, onResponse, nati
84796
84887
  .setMetadata(draftId, { ...existingMetadata, ...metadata })
84797
84888
  .then(() => {
84798
84889
  onResponse(responseValue);
84890
+ })
84891
+ .catch((error) => {
84892
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
84799
84893
  });
84800
84894
  }
84801
84895
  else {
@@ -84838,8 +84932,13 @@ function invokeAdapterWithMetadataDeleteRecord(adapter, config, metadata, onResp
84838
84932
  onResponse(response);
84839
84933
  }
84840
84934
  else {
84841
- draftManager.setMetadata(addedDrafts[0].id, metadata).then(() => {
84935
+ draftManager
84936
+ .setMetadata(addedDrafts[0].id, metadata)
84937
+ .then(() => {
84842
84938
  onResponse(responseValue);
84939
+ })
84940
+ .catch((error) => {
84941
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
84843
84942
  });
84844
84943
  }
84845
84944
  });
@@ -84888,6 +84987,9 @@ function invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToR
84888
84987
  .replaceAction(draftIdToReplace, addedDrafts[0].id)
84889
84988
  .then(() => {
84890
84989
  onResponse(responseValue);
84990
+ })
84991
+ .catch((error) => {
84992
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing action'));
84891
84993
  });
84892
84994
  }
84893
84995
  });
@@ -84900,6 +85002,18 @@ function invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToR
84900
85002
  }, nativeAdapterRequestContext);
84901
85003
  });
84902
85004
  }
85005
+ function convertErrorIntoNativeFetchError(error, defaultMessage) {
85006
+ let message = defaultMessage;
85007
+ if (error instanceof Error) {
85008
+ message = error.message;
85009
+ }
85010
+ else if (typeof error === 'string') {
85011
+ message = error;
85012
+ }
85013
+ return {
85014
+ error: createNativeFetchErrorResponse(message),
85015
+ };
85016
+ }
84903
85017
  function draftIdsForResponseValue(response) {
84904
85018
  if (response.data !== undefined &&
84905
85019
  response.data.drafts !== undefined &&
@@ -85099,7 +85213,7 @@ const callbacks$1 = [];
85099
85213
  function register(r) {
85100
85214
  callbacks$1.forEach((callback) => callback(r));
85101
85215
  }
85102
- // version: 1.281.0-9a56a08f0
85216
+ // version: 1.283.0-a330da944
85103
85217
 
85104
85218
  /**
85105
85219
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90014,4 +90128,4 @@ const { luvio } = getRuntime();
90014
90128
  setDefaultLuvio({ luvio });
90015
90129
 
90016
90130
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
90017
- // version: 1.281.0-9a56a08f0
90131
+ // version: 1.283.0-a330da944