@salesforce/lds-worker-api 1.282.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.
@@ -385,16 +385,7 @@ function invokeAdapterWithDraftToReplace(adapterId, config, draftIdToReplace, on
385
385
  onResponse(responseValue);
386
386
  })
387
387
  .catch((error) => {
388
- let message = 'Unknown error replacing draft';
389
- if (error instanceof Error) {
390
- message = error.message;
391
- }
392
- else if (typeof error === 'string') {
393
- message = error;
394
- }
395
- onResponse({
396
- error: createNativeFetchErrorResponse(message),
397
- });
388
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing draft'));
398
389
  });
399
390
  }
400
391
  else {
@@ -445,6 +436,9 @@ function invokeAdapterWithMetadata(adapterId, config, metadata, onResponse, nati
445
436
  .setMetadata(draftId, { ...existingMetadata, ...metadata })
446
437
  .then(() => {
447
438
  onResponse(responseValue);
439
+ })
440
+ .catch((error) => {
441
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
448
442
  });
449
443
  }
450
444
  else {
@@ -487,8 +481,13 @@ function invokeAdapterWithMetadataDeleteRecord(adapter, config, metadata, onResp
487
481
  onResponse(response);
488
482
  }
489
483
  else {
490
- draftManager.setMetadata(addedDrafts[0].id, metadata).then(() => {
484
+ draftManager
485
+ .setMetadata(addedDrafts[0].id, metadata)
486
+ .then(() => {
491
487
  onResponse(responseValue);
488
+ })
489
+ .catch((error) => {
490
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
492
491
  });
493
492
  }
494
493
  });
@@ -537,6 +536,9 @@ function invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToR
537
536
  .replaceAction(draftIdToReplace, addedDrafts[0].id)
538
537
  .then(() => {
539
538
  onResponse(responseValue);
539
+ })
540
+ .catch((error) => {
541
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing action'));
540
542
  });
541
543
  }
542
544
  });
@@ -549,6 +551,18 @@ function invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToR
549
551
  }, nativeAdapterRequestContext);
550
552
  });
551
553
  }
554
+ function convertErrorIntoNativeFetchError(error, defaultMessage) {
555
+ let message = defaultMessage;
556
+ if (error instanceof Error) {
557
+ message = error.message;
558
+ }
559
+ else if (typeof error === 'string') {
560
+ message = error;
561
+ }
562
+ return {
563
+ error: createNativeFetchErrorResponse(message),
564
+ };
565
+ }
552
566
  function draftIdsForResponseValue(response) {
553
567
  if (response.data !== undefined &&
554
568
  response.data.drafts !== undefined &&
@@ -1048,4 +1062,4 @@ if (process.env.NODE_ENV !== 'production') {
1048
1062
  }
1049
1063
 
1050
1064
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1051
- // version: 1.282.0-f3e0ca0c7
1065
+ // version: 1.283.0-a330da944
@@ -4177,7 +4177,7 @@ function withDefaultLuvio(callback) {
4177
4177
  }
4178
4178
  callbacks.push(callback);
4179
4179
  }
4180
- // version: 1.282.0-f3e0ca0c7
4180
+ // version: 1.283.0-a330da944
4181
4181
 
4182
4182
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4183
4183
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15685,7 +15685,7 @@ function gql(literals, ...subs) {
15685
15685
  }
15686
15686
  return superResult;
15687
15687
  }
15688
- // version: 1.282.0-f3e0ca0c7
15688
+ // version: 1.283.0-a330da944
15689
15689
 
15690
15690
  function unwrap(data) {
15691
15691
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16610,7 +16610,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16610
16610
  const { apiFamily, name } = metadata;
16611
16611
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16612
16612
  }
16613
- // version: 1.282.0-f3e0ca0c7
16613
+ // version: 1.283.0-a330da944
16614
16614
 
16615
16615
  /**
16616
16616
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44093,7 +44093,7 @@ withDefaultLuvio((luvio) => {
44093
44093
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44094
44094
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44095
44095
  });
44096
- // version: 1.282.0-dd2e9831c
44096
+ // version: 1.283.0-80ddb6c3c
44097
44097
 
44098
44098
  var ldsIdempotencyWriteDisabled = {
44099
44099
  isOpen: function (e) {
@@ -49727,6 +49727,10 @@ class DurableDraftQueue {
49727
49727
  switch (result) {
49728
49728
  case ProcessActionResult.BLOCKED_ON_ERROR:
49729
49729
  this.state = DraftQueueState.Error;
49730
+ await this.notifyChangedListeners({
49731
+ type: DraftQueueEventType.QueueStateChanged,
49732
+ state: this.state,
49733
+ });
49730
49734
  return Promise.reject();
49731
49735
  default:
49732
49736
  return Promise.resolve();
@@ -52244,6 +52248,9 @@ function createSinglePredicate(val, operator, field, alias) {
52244
52248
  else if (field.apiName === 'weakEtag') {
52245
52249
  leftPath = '$.weakEtag';
52246
52250
  }
52251
+ else if (field.apiName === 'RecordTypeId') {
52252
+ leftPath = '$.recordTypeId';
52253
+ }
52247
52254
  return {
52248
52255
  alias,
52249
52256
  leftPath,
@@ -55867,6 +55874,10 @@ function removeSyntheticFields(result, query) {
55867
55874
  // build our output from the original result set
55868
55875
  // so we keep any other results that are not included in a record query
55869
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 };
55870
55881
  const outputApiParent = output.data.uiapi.query;
55871
55882
  const keys$1 = keys$4(nodeJson);
55872
55883
  keys$1.forEach((recordName) => {
@@ -57970,11 +57981,14 @@ const replaceDraftIdsInVariables$1 = (variables, draftFunctions, unmappedDraftID
57970
57981
  };
57971
57982
  // create the runtime cache for the graphql schema when the factory creates the adapter
57972
57983
  const graphqlSchemaCache = new CachedGraphQLSchema();
57973
- function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
57974
- const getCanonicalId = (id) => {
57984
+ function getCanonicalIdFunction(luvio) {
57985
+ return (id) => {
57975
57986
  var _a;
57976
57987
  return ((_a = extractRecordIdFromStoreKey$1(luvio.storeGetCanonicalKey(RECORD_ID_PREFIX$1 + id))) !== null && _a !== void 0 ? _a : id);
57977
57988
  };
57989
+ }
57990
+ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
57991
+ const getCanonicalId = getCanonicalIdFunction(luvio);
57978
57992
  return async function draftAwareGraphQLAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
57979
57993
  //create a copy to not accidentally modify the AST in the astResolver map of luvio
57980
57994
  const copy = parse$3(stringify$3(config.query));
@@ -58124,9 +58138,61 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
58124
58138
  return resultSnapshot;
58125
58139
  };
58126
58140
  }
58127
- function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio) {
58141
+ function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId) {
58128
58142
  return async function environmentAwareGraphQLBatchAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
58129
- 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
+ };
58130
58196
  };
58131
58197
  }
58132
58198
 
@@ -62108,7 +62174,7 @@ function getRuntime() {
62108
62174
  setDraftAwareGraphQLAdapter(
62109
62175
  // return a draft aware graphql adapter here
62110
62176
  draftAwareGraphQLAdapter);
62111
- const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio);
62177
+ const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio, isGenerated);
62112
62178
  setEnvironmentAwareGraphQLBatchAdapter(environmentAwareGraphQLBatchAdapter);
62113
62179
  };
62114
62180
  const draftAwareCreateContentDocumentAndVersionAdapter = createContentDocumentAndVersionDraftAdapterFactory(lazyLuvio, NimbusBinaryStore, contentDocumentCompositeActionHandler);
@@ -62155,7 +62221,7 @@ register$1({
62155
62221
  id: '@salesforce/lds-network-adapter',
62156
62222
  instrument: instrument$2,
62157
62223
  });
62158
- // version: 1.282.0-f3e0ca0c7
62224
+ // version: 1.283.0-a330da944
62159
62225
 
62160
62226
  const { create: create$3, keys: keys$3 } = Object;
62161
62227
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82165,7 +82231,7 @@ register$1({
82165
82231
  configuration: { ...configurationForGraphQLAdapters$1 },
82166
82232
  instrument: instrument$1,
82167
82233
  });
82168
- // version: 1.282.0-dd2e9831c
82234
+ // version: 1.283.0-80ddb6c3c
82169
82235
 
82170
82236
  // On core the unstable adapters are re-exported with different names,
82171
82237
  // we want to match them here.
@@ -84421,7 +84487,7 @@ withDefaultLuvio((luvio) => {
84421
84487
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84422
84488
  graphQLImperative = ldsAdapter;
84423
84489
  });
84424
- // version: 1.282.0-dd2e9831c
84490
+ // version: 1.283.0-80ddb6c3c
84425
84491
 
84426
84492
  var gqlApi = /*#__PURE__*/Object.freeze({
84427
84493
  __proto__: null,
@@ -84770,16 +84836,7 @@ function invokeAdapterWithDraftToReplace(adapterId, config, draftIdToReplace, on
84770
84836
  onResponse(responseValue);
84771
84837
  })
84772
84838
  .catch((error) => {
84773
- let message = 'Unknown error replacing draft';
84774
- if (error instanceof Error) {
84775
- message = error.message;
84776
- }
84777
- else if (typeof error === 'string') {
84778
- message = error;
84779
- }
84780
- onResponse({
84781
- error: createNativeFetchErrorResponse(message),
84782
- });
84839
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing draft'));
84783
84840
  });
84784
84841
  }
84785
84842
  else {
@@ -84830,6 +84887,9 @@ function invokeAdapterWithMetadata(adapterId, config, metadata, onResponse, nati
84830
84887
  .setMetadata(draftId, { ...existingMetadata, ...metadata })
84831
84888
  .then(() => {
84832
84889
  onResponse(responseValue);
84890
+ })
84891
+ .catch((error) => {
84892
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
84833
84893
  });
84834
84894
  }
84835
84895
  else {
@@ -84872,8 +84932,13 @@ function invokeAdapterWithMetadataDeleteRecord(adapter, config, metadata, onResp
84872
84932
  onResponse(response);
84873
84933
  }
84874
84934
  else {
84875
- draftManager.setMetadata(addedDrafts[0].id, metadata).then(() => {
84935
+ draftManager
84936
+ .setMetadata(addedDrafts[0].id, metadata)
84937
+ .then(() => {
84876
84938
  onResponse(responseValue);
84939
+ })
84940
+ .catch((error) => {
84941
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
84877
84942
  });
84878
84943
  }
84879
84944
  });
@@ -84922,6 +84987,9 @@ function invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToR
84922
84987
  .replaceAction(draftIdToReplace, addedDrafts[0].id)
84923
84988
  .then(() => {
84924
84989
  onResponse(responseValue);
84990
+ })
84991
+ .catch((error) => {
84992
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing action'));
84925
84993
  });
84926
84994
  }
84927
84995
  });
@@ -84934,6 +85002,18 @@ function invokeAdapterWithDraftToReplaceDeleteRecord(adapter, config, draftIdToR
84934
85002
  }, nativeAdapterRequestContext);
84935
85003
  });
84936
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
+ }
84937
85017
  function draftIdsForResponseValue(response) {
84938
85018
  if (response.data !== undefined &&
84939
85019
  response.data.drafts !== undefined &&
@@ -85133,7 +85213,7 @@ const callbacks$1 = [];
85133
85213
  function register(r) {
85134
85214
  callbacks$1.forEach((callback) => callback(r));
85135
85215
  }
85136
- // version: 1.282.0-f3e0ca0c7
85216
+ // version: 1.283.0-a330da944
85137
85217
 
85138
85218
  /**
85139
85219
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90048,4 +90128,4 @@ const { luvio } = getRuntime();
90048
90128
  setDefaultLuvio({ luvio });
90049
90129
 
90050
90130
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
90051
- // version: 1.282.0-f3e0ca0c7
90131
+ // version: 1.283.0-a330da944
@@ -4183,7 +4183,7 @@
4183
4183
  }
4184
4184
  callbacks.push(callback);
4185
4185
  }
4186
- // version: 1.282.0-f3e0ca0c7
4186
+ // version: 1.283.0-a330da944
4187
4187
 
4188
4188
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4189
4189
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15691,7 +15691,7 @@
15691
15691
  }
15692
15692
  return superResult;
15693
15693
  }
15694
- // version: 1.282.0-f3e0ca0c7
15694
+ // version: 1.283.0-a330da944
15695
15695
 
15696
15696
  function unwrap(data) {
15697
15697
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16616,7 +16616,7 @@
16616
16616
  const { apiFamily, name } = metadata;
16617
16617
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16618
16618
  }
16619
- // version: 1.282.0-f3e0ca0c7
16619
+ // version: 1.283.0-a330da944
16620
16620
 
16621
16621
  /**
16622
16622
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -44099,7 +44099,7 @@
44099
44099
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
44100
44100
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
44101
44101
  });
44102
- // version: 1.282.0-dd2e9831c
44102
+ // version: 1.283.0-80ddb6c3c
44103
44103
 
44104
44104
  var ldsIdempotencyWriteDisabled = {
44105
44105
  isOpen: function (e) {
@@ -49733,6 +49733,10 @@
49733
49733
  switch (result) {
49734
49734
  case ProcessActionResult.BLOCKED_ON_ERROR:
49735
49735
  this.state = DraftQueueState.Error;
49736
+ await this.notifyChangedListeners({
49737
+ type: DraftQueueEventType.QueueStateChanged,
49738
+ state: this.state,
49739
+ });
49736
49740
  return Promise.reject();
49737
49741
  default:
49738
49742
  return Promise.resolve();
@@ -52250,6 +52254,9 @@
52250
52254
  else if (field.apiName === 'weakEtag') {
52251
52255
  leftPath = '$.weakEtag';
52252
52256
  }
52257
+ else if (field.apiName === 'RecordTypeId') {
52258
+ leftPath = '$.recordTypeId';
52259
+ }
52253
52260
  return {
52254
52261
  alias,
52255
52262
  leftPath,
@@ -55873,6 +55880,10 @@
55873
55880
  // build our output from the original result set
55874
55881
  // so we keep any other results that are not included in a record query
55875
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 };
55876
55887
  const outputApiParent = output.data.uiapi.query;
55877
55888
  const keys$1 = keys$4(nodeJson);
55878
55889
  keys$1.forEach((recordName) => {
@@ -57976,11 +57987,14 @@
57976
57987
  };
57977
57988
  // create the runtime cache for the graphql schema when the factory creates the adapter
57978
57989
  const graphqlSchemaCache = new CachedGraphQLSchema();
57979
- function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
57980
- const getCanonicalId = (id) => {
57990
+ function getCanonicalIdFunction(luvio) {
57991
+ return (id) => {
57981
57992
  var _a;
57982
57993
  return ((_a = extractRecordIdFromStoreKey$1(luvio.storeGetCanonicalKey(RECORD_ID_PREFIX$1 + id))) !== null && _a !== void 0 ? _a : id);
57983
57994
  };
57995
+ }
57996
+ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio, isDraftId) {
57997
+ const getCanonicalId = getCanonicalIdFunction(luvio);
57984
57998
  return async function draftAwareGraphQLAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
57985
57999
  //create a copy to not accidentally modify the AST in the astResolver map of luvio
57986
58000
  const copy = parse$3(stringify$3(config.query));
@@ -58130,9 +58144,61 @@
58130
58144
  return resultSnapshot;
58131
58145
  };
58132
58146
  }
58133
- function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio) {
58147
+ function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, isDraftId) {
58134
58148
  return async function environmentAwareGraphQLBatchAdapter(config, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy, requestContext = {}) {
58135
- 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
+ };
58136
58202
  };
58137
58203
  }
58138
58204
 
@@ -62114,7 +62180,7 @@
62114
62180
  setDraftAwareGraphQLAdapter(
62115
62181
  // return a draft aware graphql adapter here
62116
62182
  draftAwareGraphQLAdapter);
62117
- const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio);
62183
+ const environmentAwareGraphQLBatchAdapter = environmentAwareGraphQLBatchAdapterFactory(lazyObjectInfoService, lazyLuvio, isGenerated);
62118
62184
  setEnvironmentAwareGraphQLBatchAdapter(environmentAwareGraphQLBatchAdapter);
62119
62185
  };
62120
62186
  const draftAwareCreateContentDocumentAndVersionAdapter = createContentDocumentAndVersionDraftAdapterFactory(lazyLuvio, NimbusBinaryStore, contentDocumentCompositeActionHandler);
@@ -62161,7 +62227,7 @@
62161
62227
  id: '@salesforce/lds-network-adapter',
62162
62228
  instrument: instrument$2,
62163
62229
  });
62164
- // version: 1.282.0-f3e0ca0c7
62230
+ // version: 1.283.0-a330da944
62165
62231
 
62166
62232
  const { create: create$3, keys: keys$3 } = Object;
62167
62233
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -82171,7 +82237,7 @@
82171
82237
  configuration: { ...configurationForGraphQLAdapters$1 },
82172
82238
  instrument: instrument$1,
82173
82239
  });
82174
- // version: 1.282.0-dd2e9831c
82240
+ // version: 1.283.0-80ddb6c3c
82175
82241
 
82176
82242
  // On core the unstable adapters are re-exported with different names,
82177
82243
  // we want to match them here.
@@ -84427,7 +84493,7 @@
84427
84493
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
84428
84494
  graphQLImperative = ldsAdapter;
84429
84495
  });
84430
- // version: 1.282.0-dd2e9831c
84496
+ // version: 1.283.0-80ddb6c3c
84431
84497
 
84432
84498
  var gqlApi = /*#__PURE__*/Object.freeze({
84433
84499
  __proto__: null,
@@ -84776,16 +84842,7 @@
84776
84842
  onResponse(responseValue);
84777
84843
  })
84778
84844
  .catch((error) => {
84779
- let message = 'Unknown error replacing draft';
84780
- if (error instanceof Error) {
84781
- message = error.message;
84782
- }
84783
- else if (typeof error === 'string') {
84784
- message = error;
84785
- }
84786
- onResponse({
84787
- error: createNativeFetchErrorResponse(message),
84788
- });
84845
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing draft'));
84789
84846
  });
84790
84847
  }
84791
84848
  else {
@@ -84836,6 +84893,9 @@
84836
84893
  .setMetadata(draftId, { ...existingMetadata, ...metadata })
84837
84894
  .then(() => {
84838
84895
  onResponse(responseValue);
84896
+ })
84897
+ .catch((error) => {
84898
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
84839
84899
  });
84840
84900
  }
84841
84901
  else {
@@ -84878,8 +84938,13 @@
84878
84938
  onResponse(response);
84879
84939
  }
84880
84940
  else {
84881
- draftManager.setMetadata(addedDrafts[0].id, metadata).then(() => {
84941
+ draftManager
84942
+ .setMetadata(addedDrafts[0].id, metadata)
84943
+ .then(() => {
84882
84944
  onResponse(responseValue);
84945
+ })
84946
+ .catch((error) => {
84947
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error setting metadata'));
84883
84948
  });
84884
84949
  }
84885
84950
  });
@@ -84928,6 +84993,9 @@
84928
84993
  .replaceAction(draftIdToReplace, addedDrafts[0].id)
84929
84994
  .then(() => {
84930
84995
  onResponse(responseValue);
84996
+ })
84997
+ .catch((error) => {
84998
+ onResponse(convertErrorIntoNativeFetchError(error, 'Unknown error replacing action'));
84931
84999
  });
84932
85000
  }
84933
85001
  });
@@ -84940,6 +85008,18 @@
84940
85008
  }, nativeAdapterRequestContext);
84941
85009
  });
84942
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
+ }
84943
85023
  function draftIdsForResponseValue(response) {
84944
85024
  if (response.data !== undefined &&
84945
85025
  response.data.drafts !== undefined &&
@@ -85139,7 +85219,7 @@
85139
85219
  function register(r) {
85140
85220
  callbacks$1.forEach((callback) => callback(r));
85141
85221
  }
85142
- // version: 1.282.0-f3e0ca0c7
85222
+ // version: 1.283.0-a330da944
85143
85223
 
85144
85224
  /**
85145
85225
  * Returns true if the value acts like a Promise, i.e. has a "then" function,
@@ -90072,4 +90152,4 @@
90072
90152
  exports.subscribeToAdapter = subscribeToAdapter;
90073
90153
 
90074
90154
  }));
90075
- // version: 1.282.0-f3e0ca0c7
90155
+ // version: 1.283.0-a330da944
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.282.0",
3
+ "version": "1.283.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,15 +35,15 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.282.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.282.0",
40
- "@salesforce/lds-default-luvio": "^1.282.0",
41
- "@salesforce/lds-drafts": "^1.282.0",
42
- "@salesforce/lds-graphql-parser": "^1.282.0",
43
- "@salesforce/lds-luvio-engine": "^1.282.0",
44
- "@salesforce/lds-priming": "^1.282.0",
45
- "@salesforce/lds-runtime-mobile": "^1.282.0",
46
- "@salesforce/nimbus-plugin-lds": "^1.282.0",
38
+ "@salesforce/lds-adapters-graphql": "^1.283.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.283.0",
40
+ "@salesforce/lds-default-luvio": "^1.283.0",
41
+ "@salesforce/lds-drafts": "^1.283.0",
42
+ "@salesforce/lds-graphql-parser": "^1.283.0",
43
+ "@salesforce/lds-luvio-engine": "^1.283.0",
44
+ "@salesforce/lds-priming": "^1.283.0",
45
+ "@salesforce/lds-runtime-mobile": "^1.283.0",
46
+ "@salesforce/nimbus-plugin-lds": "^1.283.0",
47
47
  "ajv": "^8.11.0",
48
48
  "glob": "^7.1.5",
49
49
  "nimbus-types": "^2.0.0-alpha1",
@@ -55,8 +55,8 @@
55
55
  {
56
56
  "path": "./dist/sfdc/es/ldsWorkerApi.js",
57
57
  "maxSize": {
58
- "none": "41.8 kB",
59
- "min": "17.7 kB",
58
+ "none": "42.3 kB",
59
+ "min": "17.8 kB",
60
60
  "compressed": "7.4 kB"
61
61
  }
62
62
  }