@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.
@@ -34,9 +34,17 @@
34
34
  const WeakSetCtor = WeakSet;
35
35
 
36
36
  const deeplyFrozen = new WeakSetCtor();
37
+ // Allow custom environments to bypass deep freeze for performance reasons
38
+ let bypassDeepFreeze = false;
39
+ function setBypassDeepFreeze(value) {
40
+ bypassDeepFreeze = value;
41
+ }
37
42
  function deepFreeze(value) {
38
43
  // No need to freeze primitives or already frozen stuff
39
- if (typeof value !== 'object' || value === null || deeplyFrozen.has(value)) {
44
+ if (bypassDeepFreeze ||
45
+ typeof value !== 'object' ||
46
+ value === null ||
47
+ deeplyFrozen.has(value)) {
40
48
  return;
41
49
  }
42
50
  deeplyFrozen.add(value);
@@ -4047,7 +4055,7 @@
4047
4055
  }
4048
4056
  return resourceParams;
4049
4057
  }
4050
- // engine version: 0.154.14-2fbbff64
4058
+ // engine version: 0.154.15-db466bed
4051
4059
 
4052
4060
  /**
4053
4061
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -4175,7 +4183,7 @@
4175
4183
  }
4176
4184
  callbacks.push(callback);
4177
4185
  }
4178
- // version: 1.281.0-9a56a08f0
4186
+ // version: 1.283.0-a330da944
4179
4187
 
4180
4188
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4181
4189
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15683,7 +15691,7 @@
15683
15691
  }
15684
15692
  return superResult;
15685
15693
  }
15686
- // version: 1.281.0-9a56a08f0
15694
+ // version: 1.283.0-a330da944
15687
15695
 
15688
15696
  function unwrap(data) {
15689
15697
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16608,7 +16616,7 @@
16608
16616
  const { apiFamily, name } = metadata;
16609
16617
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16610
16618
  }
16611
- // version: 1.281.0-9a56a08f0
16619
+ // version: 1.283.0-a330da944
16612
16620
 
16613
16621
  /**
16614
16622
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -16707,7 +16715,7 @@
16707
16715
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
16708
16716
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
16709
16717
  })(TypeCheckShapes || (TypeCheckShapes = {}));
16710
- // engine version: 0.154.14-2fbbff64
16718
+ // engine version: 0.154.15-db466bed
16711
16719
 
16712
16720
  const { keys: ObjectKeys$3, create: ObjectCreate$3 } = Object;
16713
16721
 
@@ -21637,10 +21645,10 @@
21637
21645
  }
21638
21646
 
21639
21647
  const TTL$x = 30000;
21640
- const VERSION$18$1 = "88d8362577eaa3dae0820deeea3b7ae4";
21648
+ const VERSION$18$1 = "e635ab62cb633d32aeeb183e568bb2c7";
21641
21649
  const RepresentationType$T = 'ListRecordCollectionRepresentation';
21642
21650
  function keyBuilder$23(luvio, config) {
21643
- 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);
21651
+ 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);
21644
21652
  }
21645
21653
  function keyBuilderFromType$B(luvio, object) {
21646
21654
  const keyParams = {
@@ -21648,6 +21656,7 @@
21648
21656
  searchTerm: object.searchTerm,
21649
21657
  sortBy: object.sortBy,
21650
21658
  listViewId: object.listInfoETag,
21659
+ where: object.where,
21651
21660
  listViewApiName: object.listReference.listViewApiName
21652
21661
  };
21653
21662
  return keyBuilder$23(luvio, keyParams);
@@ -22707,7 +22716,7 @@
22707
22716
  const keyElements = key.split(':');
22708
22717
  return {
22709
22718
  objectApiName: keyElements[3],
22710
- listViewApiName: keyElements[7],
22719
+ listViewApiName: keyElements[8],
22711
22720
  };
22712
22721
  }
22713
22722
  function splitListSummaryCollectionKey(key) {
@@ -22933,6 +22942,7 @@
22933
22942
  listViewId: listInfo.eTag,
22934
22943
  sortBy: sortBy || null,
22935
22944
  searchTerm: null,
22945
+ where: null,
22936
22946
  objectApiName: listInfo.listReference.objectApiName,
22937
22947
  listViewApiName: listInfo.listReference.listViewApiName,
22938
22948
  }) + '__fieldstatus';
@@ -22998,17 +23008,18 @@
22998
23008
  const listReference = getListReference(query, context$1);
22999
23009
  if (listReference !== undefined) {
23000
23010
  // Check and use any default values returned from the server (i.e. sortBy)
23001
- const config = { ...params.urlParams, ...params.queryParams };
23011
+ const config = { ...params.urlParams, ...params.body };
23002
23012
  const defaults = getServerDefaults(config, context$1);
23003
23013
  // Use default values when sortBy is undefined or an empty Array []
23004
23014
  return keyBuilder$23(luvio, {
23005
23015
  objectApiName: listReference.objectApiName,
23006
23016
  listViewApiName: listReference.listViewApiName,
23007
23017
  listViewId: listReference.id,
23008
- searchTerm: params.queryParams.searchTerm || null,
23009
- sortBy: params.queryParams.sortBy !== undefined && params.queryParams.sortBy.length <= 0
23010
- ? defaults.sortBy || params.queryParams.sortBy || []
23011
- : params.queryParams.sortBy || defaults.sortBy || [],
23018
+ searchTerm: params.body.searchTerm || null,
23019
+ where: params.body.where || null,
23020
+ sortBy: params.body.sortBy !== undefined && params.body.sortBy.length <= 0
23021
+ ? defaults.sortBy || params.body.sortBy || []
23022
+ : params.body.sortBy || defaults.sortBy || [],
23012
23023
  });
23013
23024
  }
23014
23025
  // If there are no matching entries in the store, then we haven't fetched any data for this list view yet.
@@ -23017,13 +23028,14 @@
23017
23028
  objectApiName: params.urlParams.objectApiName,
23018
23029
  listViewApiName: params.urlParams.listViewApiName,
23019
23030
  listViewId: '',
23020
- searchTerm: params.queryParams.searchTerm || null,
23021
- sortBy: params.queryParams.sortBy || [],
23031
+ searchTerm: params.body.searchTerm || null,
23032
+ where: params.body.where || null,
23033
+ sortBy: params.body.sortBy || [],
23022
23034
  });
23023
23035
  }
23024
23036
 
23025
23037
  function select$1K(luvio, params) {
23026
- const { fields = [], optionalFields = [] } = params.queryParams;
23038
+ const { fields = [], optionalFields = [] } = params.body;
23027
23039
  return dynamicSelect$7({
23028
23040
  records: {
23029
23041
  name: 'records',
@@ -23041,7 +23053,7 @@
23041
23053
  const { body } = response;
23042
23054
  const key = keyBuilder$1$(luvio, resourceParams);
23043
23055
  luvio.storeIngest(key, ingest$M$1, body);
23044
- const optionalFields = resourceParams.queryParams.optionalFields;
23056
+ const optionalFields = resourceParams.body.optionalFields;
23045
23057
  if (optionalFields && optionalFields.length > 0) {
23046
23058
  const normalized = body;
23047
23059
  markMissingOptionalFieldsOnRecords$1(luvio, normalized, optionalFields);
@@ -23066,10 +23078,10 @@
23066
23078
  }
23067
23079
 
23068
23080
  function createPaginationParams$4(params) {
23069
- const { queryParams } = params;
23081
+ const { body } = params;
23070
23082
  return {
23071
- token: queryParams.pageToken,
23072
- pageSize: queryParams.pageSize === undefined ? 50 : queryParams.pageSize
23083
+ token: body.pageToken,
23084
+ pageSize: body.pageSize === undefined ? 50 : body.pageSize
23073
23085
  };
23074
23086
  }
23075
23087
  function getResponseCacheKeys$$(storeKeyMap, luvio, resourceParams, response) {
@@ -23092,10 +23104,10 @@
23092
23104
  return {
23093
23105
  baseUri: '/services/data/v61.0',
23094
23106
  basePath: '/ui-api/list-records/' + config.urlParams.objectApiName + '/' + config.urlParams.listViewApiName + '',
23095
- method: 'get',
23096
- body: null,
23107
+ method: 'post',
23108
+ body: config.body,
23097
23109
  urlParams: config.urlParams,
23098
- queryParams: config.queryParams,
23110
+ queryParams: {},
23099
23111
  headers,
23100
23112
  priority: 'normal',
23101
23113
  };
@@ -23958,6 +23970,7 @@
23958
23970
  const paginationKey = paginationKeyBuilder(luvio, {
23959
23971
  listViewId: listInfo.eTag,
23960
23972
  searchTerm: null,
23973
+ where: null,
23961
23974
  sortBy: config.sortBy === undefined ? null : config.sortBy,
23962
23975
  objectApiName: listInfo.listReference.objectApiName,
23963
23976
  listViewApiName: listInfo.listReference.listViewApiName,
@@ -24005,6 +24018,7 @@
24005
24018
  luvio.storeIngest(keyBuilder$23(luvio, {
24006
24019
  listViewId: listInfoETag,
24007
24020
  searchTerm: null,
24021
+ where: null,
24008
24022
  sortBy: body.sortBy,
24009
24023
  objectApiName: listInfo.listReference.objectApiName,
24010
24024
  listViewApiName: listInfo.listReference.listViewApiName,
@@ -24300,6 +24314,13 @@
24300
24314
  pageToken,
24301
24315
  sortBy,
24302
24316
  };
24317
+ const body = {
24318
+ fields,
24319
+ optionalFields,
24320
+ pageSize,
24321
+ pageToken,
24322
+ sortBy,
24323
+ };
24303
24324
  let request;
24304
24325
  if (isGetListUiByApiNameConfig(config)) {
24305
24326
  request = createResourceRequest$15({
@@ -24307,7 +24328,7 @@
24307
24328
  listViewApiName: config.listViewApiName,
24308
24329
  objectApiName: config.objectApiName,
24309
24330
  },
24310
- queryParams,
24331
+ body,
24311
24332
  });
24312
24333
  }
24313
24334
  else if (isGetListUiByListViewIdConfig(config)) {
@@ -24332,6 +24353,7 @@
24332
24353
  const paginationKey = paginationKeyBuilder(luvio, {
24333
24354
  listViewId: listInfo.eTag,
24334
24355
  searchTerm: null,
24356
+ where: null,
24335
24357
  sortBy: getSortBy(config, context),
24336
24358
  objectApiName: listInfo.listReference.objectApiName,
24337
24359
  listViewApiName: listInfo.listReference.listViewApiName,
@@ -24382,6 +24404,7 @@
24382
24404
  luvio.storeIngest(keyBuilder$23(luvio, {
24383
24405
  listViewId: listInfoETag,
24384
24406
  searchTerm: null,
24407
+ where: null,
24385
24408
  sortBy: body.sortBy,
24386
24409
  objectApiName: listInfo.listReference.objectApiName,
24387
24410
  listViewApiName: listInfo.listReference.listViewApiName,
@@ -29543,7 +29566,7 @@
29543
29566
  }
29544
29567
 
29545
29568
  const TTL$n = 300000;
29546
- const VERSION$O$1 = "1781f2d3d4e413cf0c681774d82d02cd";
29569
+ const VERSION$O$1 = "b33c534240965bedfcf073228d48b940";
29547
29570
  const RepresentationType$x = 'AppRepresentation';
29548
29571
  function keyBuilder$1k(luvio, config) {
29549
29572
  return keyPrefix$2 + '::' + RepresentationType$x + ':' + (config.appId === null ? '' : config.appId);
@@ -29704,11 +29727,6 @@
29704
29727
  if (!(existing_eTag === incoming_eTag)) {
29705
29728
  return false;
29706
29729
  }
29707
- const existing_headerColor = existing.headerColor;
29708
- const incoming_headerColor = incoming.headerColor;
29709
- if (!(existing_headerColor === incoming_headerColor)) {
29710
- return false;
29711
- }
29712
29730
  const existing_label = existing.label;
29713
29731
  const incoming_label = incoming.label;
29714
29732
  if (!(existing_label === incoming_label)) {
@@ -29749,6 +29767,11 @@
29749
29767
  if (equals_formFactors_items === false) {
29750
29768
  return false;
29751
29769
  }
29770
+ const existing_headerColor = existing.headerColor;
29771
+ const incoming_headerColor = incoming.headerColor;
29772
+ if (!(existing_headerColor === incoming_headerColor)) {
29773
+ return false;
29774
+ }
29752
29775
  const existing_iconUrl = existing.iconUrl;
29753
29776
  const incoming_iconUrl = incoming.iconUrl;
29754
29777
  if (!(existing_iconUrl === incoming_iconUrl)) {
@@ -38370,7 +38393,7 @@
38370
38393
  function keyBuilder$s$1(luvio, params) {
38371
38394
  return keyBuilder$t$1(luvio, {
38372
38395
  sortBy: params.body.sortBy || [],
38373
- where: params.body.where || "",
38396
+ where: params.body.where || null,
38374
38397
  parentRecordId: params.urlParams.parentRecordId,
38375
38398
  relatedListId: params.urlParams.relatedListId
38376
38399
  });
@@ -40675,12 +40698,13 @@
40675
40698
  const getListRecordsByName_ConfigPropertyMetadata = [
40676
40699
  generateParamConfigMetadata$2('listViewApiName', true, 0 /* UrlParameter */, 0 /* String */),
40677
40700
  generateParamConfigMetadata$2('objectApiName', true, 0 /* UrlParameter */, 0 /* String */),
40678
- generateParamConfigMetadata$2('fields', false, 1 /* QueryParameter */, 0 /* String */, true),
40679
- generateParamConfigMetadata$2('optionalFields', false, 1 /* QueryParameter */, 0 /* String */, true),
40680
- generateParamConfigMetadata$2('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
40681
- generateParamConfigMetadata$2('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
40682
- generateParamConfigMetadata$2('searchTerm', false, 1 /* QueryParameter */, 0 /* String */),
40683
- generateParamConfigMetadata$2('sortBy', false, 1 /* QueryParameter */, 0 /* String */, true),
40701
+ generateParamConfigMetadata$2('fields', false, 2 /* Body */, 0 /* String */, true),
40702
+ generateParamConfigMetadata$2('optionalFields', false, 2 /* Body */, 0 /* String */, true),
40703
+ generateParamConfigMetadata$2('pageSize', false, 2 /* Body */, 3 /* Integer */),
40704
+ generateParamConfigMetadata$2('pageToken', false, 2 /* Body */, 0 /* String */),
40705
+ generateParamConfigMetadata$2('searchTerm', false, 2 /* Body */, 0 /* String */),
40706
+ generateParamConfigMetadata$2('sortBy', false, 2 /* Body */, 0 /* String */, true),
40707
+ generateParamConfigMetadata$2('where', false, 2 /* Body */, 0 /* String */),
40684
40708
  ];
40685
40709
  const getListRecordsByName_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig$2(adapterName$6, getListRecordsByName_ConfigPropertyMetadata);
40686
40710
  const createResourceParams$8 = /*#__PURE__*/ createResourceParams$13(getListRecordsByName_ConfigPropertyMetadata);
@@ -40797,7 +40821,7 @@
40797
40821
  return node.data.__metadata;
40798
40822
  }
40799
40823
  function buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext) {
40800
- return buildNetworkSnapshotCachePolicy$S(context, coercedAdapterRequestContext, buildNetworkSnapshot$9, undefined, true);
40824
+ return buildNetworkSnapshotCachePolicy$S(context, coercedAdapterRequestContext, buildNetworkSnapshot$9, 'get', true);
40801
40825
  }
40802
40826
  function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
40803
40827
  const { luvio, config } = context;
@@ -44075,7 +44099,7 @@
44075
44099
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44076
44100
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44077
44101
  });
44078
- // version: 1.281.0-bcef40769
44102
+ // version: 1.283.0-80ddb6c3c
44079
44103
 
44080
44104
  var ldsIdempotencyWriteDisabled = {
44081
44105
  isOpen: function (e) {
@@ -45214,7 +45238,9 @@
45214
45238
  * @param durableStore A DurableStore implementation
45215
45239
  * @param instrumentation An instrumentation function implementation
45216
45240
  */
45217
- function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, enableDurableMetadataRefresh = false, }) {
45241
+ function makeDurable(environment, { durableStore, instrumentation, useRevivingStore, enableDurableMetadataRefresh = false, disableDeepFreeze = false, }) {
45242
+ // runtimes can choose to disable deepFreeze, e.g. headless mobile runtime
45243
+ setBypassDeepFreeze(disableDeepFreeze);
45218
45244
  let stagingStore = null;
45219
45245
  const durableTTLStore = new DurableTTLStore(durableStore);
45220
45246
  const mergeKeysPromiseMap = new Map();
@@ -49707,6 +49733,10 @@
49707
49733
  switch (result) {
49708
49734
  case ProcessActionResult.BLOCKED_ON_ERROR:
49709
49735
  this.state = DraftQueueState.Error;
49736
+ await this.notifyChangedListeners({
49737
+ type: DraftQueueEventType.QueueStateChanged,
49738
+ state: this.state,
49739
+ });
49710
49740
  return Promise.reject();
49711
49741
  default:
49712
49742
  return Promise.resolve();
@@ -52148,6 +52178,9 @@
52148
52178
  if (isArray$2$1(value)) {
52149
52179
  return value.map((singleValue) => sanitizePredicateIDValue(singleValue, draftFunction));
52150
52180
  }
52181
+ else if (typeof value === 'string' && value === '') {
52182
+ return value;
52183
+ }
52151
52184
  else {
52152
52185
  const coercedId = getRecordId18(value);
52153
52186
  if (coercedId !== undefined) {
@@ -52221,6 +52254,9 @@
52221
52254
  else if (field.apiName === 'weakEtag') {
52222
52255
  leftPath = '$.weakEtag';
52223
52256
  }
52257
+ else if (field.apiName === 'RecordTypeId') {
52258
+ leftPath = '$.recordTypeId';
52259
+ }
52224
52260
  return {
52225
52261
  alias,
52226
52262
  leftPath,
@@ -52867,19 +52903,7 @@
52867
52903
  });
52868
52904
  }
52869
52905
  }
52870
- else if (isInlineFragmentNode(node)) {
52871
- if (!node.selectionSet)
52872
- return false;
52873
- return node.selectionSet.selections.some((selection) => {
52874
- if (selection.kind !== Kind$1.FIELD && selection.kind !== Kind$1.INLINE_FRAGMENT)
52875
- return false;
52876
- // example: Account { Id }
52877
- if (selection.kind === Kind$1.FIELD && selection.name.value === 'Id')
52878
- return true;
52879
- return selection.selectionSet !== undefined;
52880
- });
52881
- }
52882
- return false;
52906
+ return isInlineFragmentNode(node);
52883
52907
  }
52884
52908
  /**
52885
52909
  * checks if the 'ArgumentNode' is a specific scope type
@@ -55506,7 +55530,8 @@
55506
55530
  * @param objectInfos
55507
55531
  * @returns
55508
55532
  */
55509
- function injectFieldsForDisplayValue({ selectionSet }, parentNode, objectInfos) {
55533
+ function injectFieldsForDisplayValue(topNode, parentNode, objectInfos) {
55534
+ const { selectionSet } = topNode;
55510
55535
  if (selectionSet === undefined)
55511
55536
  return [];
55512
55537
  let displayValueNameFields = [];
@@ -55519,6 +55544,10 @@
55519
55544
  displayValue = node;
55520
55545
  break;
55521
55546
  }
55547
+ if (isInlineFragmentNode(node)) {
55548
+ const name = node.typeCondition !== undefined ? node.typeCondition.name : parentNode.name;
55549
+ displayValueNameFields = injectFieldsForDisplayValue(node, { ...parentNode, name }, objectInfos);
55550
+ }
55522
55551
  }
55523
55552
  if (displayValue !== undefined) {
55524
55553
  const apiName = parentNode.name.value;
@@ -55588,10 +55617,17 @@
55588
55617
  // example: TimeSheetId { value }
55589
55618
  relatedIdForChildRelationship.push(createFieldNode(injectedParentFieldName, FieldValueNodeSelectionSet));
55590
55619
  }
55620
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, {
55621
+ ...parent,
55622
+ name: {
55623
+ ...parent.name,
55624
+ value: targetRelationship.childObjectApiName,
55625
+ },
55626
+ }, objectInfos));
55591
55627
  }
55592
55628
  }
55593
55629
  }
55594
- displayValueNameFields = injectFieldsForDisplayValue(parentNode, parent, objectInfos);
55630
+ displayValueNameFields.push(...injectFieldsForDisplayValue(parentNode, parent, objectInfos));
55595
55631
  }
55596
55632
  }
55597
55633
  return [
@@ -55844,6 +55880,10 @@
55844
55880
  // build our output from the original result set
55845
55881
  // so we keep any other results that are not included in a record query
55846
55882
  const output = { ...result };
55883
+ // graphqlBatch return deep frozon object, need to spread out new writeable copy for injected field removal
55884
+ output.data = { ...output.data };
55885
+ output.data.uiapi = { ...output.data.uiapi };
55886
+ output.data.uiapi.query = { ...output.data.uiapi.query };
55847
55887
  const outputApiParent = output.data.uiapi.query;
55848
55888
  const keys$1 = keys$4(nodeJson);
55849
55889
  keys$1.forEach((recordName) => {
@@ -57947,11 +57987,14 @@
57947
57987
  };
57948
57988
  // create the runtime cache for the graphql schema when the factory creates the adapter
57949
57989
  const graphqlSchemaCache = new CachedGraphQLSchema();
57950
- function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
57951
- const getCanonicalId = (id) => {
57990
+ function getCanonicalIdFunction(luvio) {
57991
+ return (id) => {
57952
57992
  var _a;
57953
57993
  return ((_a = extractRecordIdFromStoreKey$1(luvio.storeGetCanonicalKey(RECORD_ID_PREFIX$1 + id))) !== null && _a !== void 0 ? _a : id);
57954
57994
  };
57995
+ }
57996
+ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
57997
+ const getCanonicalId = getCanonicalIdFunction(luvio);
57955
57998
  return async function draftAwareGraphQLAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
57956
57999
  //create a copy to not accidentally modify the AST in the astResolver map of luvio
57957
58000
  const copy = parse$3(stringify$3(config.query));
@@ -58101,9 +58144,61 @@
58101
58144
  return resultSnapshot;
58102
58145
  };
58103
58146
  }
58104
- function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio) {
58147
+ function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId) {
58105
58148
  return async function environmentAwareGraphQLBatchAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
58106
- return luvio.applyCachePolicy(requestContext, { config, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
58149
+ const batchQueryCopy = config.batchQuery.map((query) => clone(query));
58150
+ let injectedBatchQuery = [];
58151
+ const getCanonicalId = getCanonicalIdFunction(luvio);
58152
+ const draftFunctions = {
58153
+ isDraftId,
58154
+ getCanonicalId,
58155
+ };
58156
+ // return error snapshot if fails injecting fields into grapqhBatch batchQuery
58157
+ try {
58158
+ injectedBatchQuery = await Promise.all(batchQueryCopy.map((query) => injectSyntheticFields(query.query, objectInfoService, draftFunctions, query.variables)));
58159
+ }
58160
+ catch (error) {
58161
+ const message = error instanceof Error ? error.message : String(error);
58162
+ return {
58163
+ data: undefined,
58164
+ state: 'Error',
58165
+ error: {
58166
+ errorType: 'adapterError',
58167
+ error: {
58168
+ message,
58169
+ },
58170
+ },
58171
+ };
58172
+ }
58173
+ const injectedConfig = {
58174
+ batchQuery: injectedBatchQuery.map((query, index) => {
58175
+ return {
58176
+ query: query.modifiedAST,
58177
+ variables: config.batchQuery[index].variables,
58178
+ };
58179
+ }),
58180
+ };
58181
+ const snapshot = (await luvio.applyCachePolicy(requestContext, { config: injectedConfig, luvio }, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
58182
+ if (snapshot.state === 'Error') {
58183
+ return snapshot;
58184
+ }
58185
+ // remove injected fields from response.
58186
+ const data = snapshot.data;
58187
+ const userResults = data.results.map((compositeResult, index) => {
58188
+ if (compositeResult.statusCode === HttpStatusCode$1.Ok) {
58189
+ return {
58190
+ result: removeSyntheticFields(compositeResult.result, config.batchQuery[index].query),
58191
+ statusCode: compositeResult.statusCode,
58192
+ };
58193
+ }
58194
+ return compositeResult;
58195
+ });
58196
+ return {
58197
+ ...snapshot,
58198
+ data: {
58199
+ results: userResults,
58200
+ },
58201
+ };
58107
58202
  };
58108
58203
  }
58109
58204
 
@@ -61038,13 +61133,13 @@
61038
61133
  // since none of the changed fields are part of the incoming record
61039
61134
  if (missingFields.every((field) => {
61040
61135
  const referenceFieldName = findReferenceFieldForSpanningField(field, objectInfo);
61041
- if (referenceFieldName !== undefined) {
61042
- return (incomingRecord.fields[referenceFieldName].value ===
61043
- existingRecord.fields[referenceFieldName].value);
61044
- }
61045
- else {
61136
+ if (referenceFieldName === undefined) {
61046
61137
  return false;
61047
61138
  }
61139
+ return (existingRecord.fields[referenceFieldName] &&
61140
+ incomingRecord.fields[referenceFieldName] &&
61141
+ incomingRecord.fields[referenceFieldName].value ===
61142
+ existingRecord.fields[referenceFieldName].value);
61048
61143
  })) {
61049
61144
  return {
61050
61145
  ok: true,
@@ -61921,6 +62016,9 @@
61921
62016
  optionalFields: value.fields.map((f) => `${_apiName}.${f}`),
61922
62017
  },
61923
62018
  ],
62019
+ }, {
62020
+ cachePolicy: { type: 'no-cache' },
62021
+ priority: 'background',
61924
62022
  }));
61925
62023
  });
61926
62024
  const promiseResults = await allSettled(promises);
@@ -62025,6 +62123,8 @@
62025
62123
  const durableEnv = makeDurable(gqlEnv, {
62026
62124
  durableStore: recordDenormingStore,
62027
62125
  enableDurableMetadataRefresh: ldsMetadataRefreshEnabled.isOpen({ fallback: false }),
62126
+ // disable luvio deep freeze in headless environments
62127
+ disableDeepFreeze: typeof window === 'undefined',
62028
62128
  });
62029
62129
  getIngestRecords = durableEnv.getIngestStagingStoreRecords;
62030
62130
  getIngestMetadata = durableEnv.getIngestStagingStoreMetadata;
@@ -62080,7 +62180,7 @@
62080
62180
  setDraftAwareGraphQLAdapter(
62081
62181
  // return a draft aware graphql adapter here
62082
62182
  draftAwareGraphQLAdapter);
62083
- const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio);
62183
+ const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio, isGenerated);
62084
62184
  setEnvironmentAwareGraphQLBatchAdapter(environmentAwareGraphQLBatchAdapter);
62085
62185
  };
62086
62186
  const draftAwareCreateContentDocumentAndVersionAdapter = createContentDocumentAndVersionDraftAdapterFactory(lazyLuvio, NimbusBinaryStore, contentDocumentCompositeActionHandler);
@@ -62127,7 +62227,7 @@
62127
62227
  id: '@salesforce/lds-network-adapter',
62128
62228
  instrument: instrument$2,
62129
62229
  });
62130
- // version: 1.281.0-9a56a08f0
62230
+ // version: 1.283.0-a330da944
62131
62231
 
62132
62232
  const { create: create$3, keys: keys$3 } = Object;
62133
62233
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82137,7 +82237,7 @@
82137
82237
  configuration: { ...configurationForGraphQLAdapters$1 },
82138
82238
  instrument: instrument$1,
82139
82239
  });
82140
- // version: 1.281.0-bcef40769
82240
+ // version: 1.283.0-80ddb6c3c
82141
82241
 
82142
82242
  // On core the unstable adapters are re-exported with different names,
82143
82243
  // we want to match them here.
@@ -84393,7 +84493,7 @@
84393
84493
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84394
84494
  graphQLImperative = ldsAdapter;
84395
84495
  });
84396
- // version: 1.281.0-bcef40769
84496
+ // version: 1.283.0-80ddb6c3c
84397
84497
 
84398
84498
  var gqlApi = /*#__PURE__*/Object.freeze({
84399
84499
  __proto__: null,
@@ -84742,16 +84842,7 @@
84742
84842
  onResponse(responseValue);
84743
84843
  })
84744
84844
  .catch((error) => {
84745
- let message = 'Unknown error replacing draft';
84746
- if (error instanceof Error) {
84747
- message = error.message;
84748
- }
84749
- else if (typeof error === 'string') {
84750
- message = error;
84751
- }
84752
- onResponse({
84753
- error: createNativeFetchErrorResponse(message),
84754
- });
84845
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing draft'));
84755
84846
  });
84756
84847
  }
84757
84848
  else {
@@ -84802,6 +84893,9 @@
84802
84893
  .setMetadata(draftId, { ...existingMetadata, ...metadata })
84803
84894
  .then(() => {
84804
84895
  onResponse(responseValue);
84896
+ })
84897
+ .catch((error) => {
84898
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
84805
84899
  });
84806
84900
  }
84807
84901
  else {
@@ -84844,8 +84938,13 @@
84844
84938
  onResponse(response);
84845
84939
  }
84846
84940
  else {
84847
- draftManager.setMetadata(addedDrafts[0].id, metadata).then(() => {
84941
+ draftManager
84942
+ .setMetadata(addedDrafts[0].id, metadata)
84943
+ .then(() => {
84848
84944
  onResponse(responseValue);
84945
+ })
84946
+ .catch((error) => {
84947
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
84849
84948
  });
84850
84949
  }
84851
84950
  });
@@ -84894,6 +84993,9 @@
84894
84993
  .replaceAction(draftIdToReplace, addedDrafts[0].id)
84895
84994
  .then(() => {
84896
84995
  onResponse(responseValue);
84996
+ })
84997
+ .catch((error) => {
84998
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing action'));
84897
84999
  });
84898
85000
  }
84899
85001
  });
@@ -84906,6 +85008,18 @@
84906
85008
  }, nativeAdapterRequestContext);
84907
85009
  });
84908
85010
  }
85011
+ function convertErrorIntoNativeFetchError(error, defaultMessage) {
85012
+ let message = defaultMessage;
85013
+ if (error instanceof Error) {
85014
+ message = error.message;
85015
+ }
85016
+ else if (typeof error === 'string') {
85017
+ message = error;
85018
+ }
85019
+ return {
85020
+ error: createNativeFetchErrorResponse(message),
85021
+ };
85022
+ }
84909
85023
  function draftIdsForResponseValue(response) {
84910
85024
  if (response.data !== undefined &&
84911
85025
  response.data.drafts !== undefined &&
@@ -85105,7 +85219,7 @@
85105
85219
  function register(r) {
85106
85220
  callbacks$1.forEach((callback) => callback(r));
85107
85221
  }
85108
- // version: 1.281.0-9a56a08f0
85222
+ // version: 1.283.0-a330da944
85109
85223
 
85110
85224
  /**
85111
85225
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90038,4 +90152,4 @@
90038
90152
  exports.subscribeToAdapter = subscribeToAdapter;
90039
90153
 
90040
90154
  }));
90041
- // version: 1.281.0-9a56a08f0
90155
+ // version: 1.283.0-a330da944