@salesforce/lds-worker-api 1.136.5 → 1.136.6

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.
@@ -643,24 +643,21 @@ const allowList = ['enqueue', 'getQueueActions'];
643
643
  * to the instance of the lds-drafts' DraftQueue implementation
644
644
  */
645
645
  const nimbusDraftQueue = {
646
- callProxyMethod(methodName, serializedArgsArray, resultCallback, errorCallback) {
646
+ callProxyMethod(methodName, serializedArgsArray, resultCallback,
647
+ // NOTE: the other side of the proxy is expecting an error message string
648
+ // (not a JSON serialized Error object)
649
+ errorCallback) {
647
650
  const method = draftQueue[methodName];
648
651
  if (method === undefined) {
649
- return errorCallback(stringify({
650
- message: 'Method does not exist on the draft queue',
651
- }));
652
+ return errorCallback('Method does not exist on the draft queue');
652
653
  }
653
654
  if (allowList.includes(methodName) === false) {
654
- return errorCallback(stringify({
655
- message: `Method ${methodName} is not available for proxy invocation`,
656
- }));
655
+ return errorCallback(`Method ${methodName} is not available for proxy invocation`);
657
656
  }
658
657
  const parsedArgs = parse(serializedArgsArray);
659
658
  // TODO [W-9933226]: we should validate the argument list based on which method is being called
660
659
  if (isArray(parsedArgs) === false) {
661
- return errorCallback(stringify({
662
- message: 'expected array argument list',
663
- }));
660
+ return errorCallback('expected array argument list');
664
661
  }
665
662
  let methodResult = undefined;
666
663
  try {
@@ -672,7 +669,7 @@ const nimbusDraftQueue = {
672
669
  }
673
670
  }
674
671
  catch (err) {
675
- return errorCallback(stringify(err));
672
+ return errorCallback(normalizeError(err).message);
676
673
  }
677
674
  if (methodResult.then === undefined) {
678
675
  return resultCallback(stringify(methodResult));
@@ -682,7 +679,7 @@ const nimbusDraftQueue = {
682
679
  resultCallback(stringify(result));
683
680
  })
684
681
  .catch((err) => {
685
- errorCallback(stringify(err));
682
+ errorCallback(normalizeError(err).message);
686
683
  });
687
684
  },
688
685
  };
@@ -761,4 +758,4 @@ if (process.env.NODE_ENV !== 'production') {
761
758
  }
762
759
 
763
760
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
764
- // version: 1.136.5-4301ab650
761
+ // version: 1.136.6-0f5ec3ee7
@@ -3797,7 +3797,7 @@ function withDefaultLuvio(callback) {
3797
3797
  }
3798
3798
  callbacks.push(callback);
3799
3799
  }
3800
- // version: 1.136.5-4301ab650
3800
+ // version: 1.136.6-0f5ec3ee7
3801
3801
 
3802
3802
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3803
3803
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15221,7 +15221,7 @@ function parseAndVisit(source) {
15221
15221
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15222
15222
  return luvioDocumentNode;
15223
15223
  }
15224
- // version: 1.136.5-4301ab650
15224
+ // version: 1.136.6-0f5ec3ee7
15225
15225
 
15226
15226
  function unwrap(data) {
15227
15227
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16134,7 +16134,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
16134
16134
  const { apiFamily, name } = metadata;
16135
16135
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16136
16136
  }
16137
- // version: 1.136.5-4301ab650
16137
+ // version: 1.136.6-0f5ec3ee7
16138
16138
 
16139
16139
  /**
16140
16140
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -43901,7 +43901,7 @@ withDefaultLuvio((luvio) => {
43901
43901
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
43902
43902
  });
43903
43903
  });
43904
- // version: 1.136.5-9eb467125
43904
+ // version: 1.136.6-acf28210f
43905
43905
 
43906
43906
  var caseSensitiveUserId = '005B0000000GR4OIAW';
43907
43907
 
@@ -45955,7 +45955,7 @@ function comparisonOperatorToSql(operator) {
45955
45955
  case ComparisonOperator.eq:
45956
45956
  return '=';
45957
45957
  case ComparisonOperator.ne:
45958
- return '!=';
45958
+ return 'IS NOT';
45959
45959
  case ComparisonOperator.gt:
45960
45960
  return '>';
45961
45961
  case ComparisonOperator.gte:
@@ -55854,6 +55854,19 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
55854
55854
  });
55855
55855
  }
55856
55856
 
55857
+ /**
55858
+ * This function takes an unknown error and normalizes it to an Error object
55859
+ */
55860
+ function normalizeError$1(error) {
55861
+ if (typeof error === 'object' && error instanceof Error) {
55862
+ return error;
55863
+ }
55864
+ else if (typeof error === 'string') {
55865
+ return new Error(error);
55866
+ }
55867
+ return new Error(stringify$2(error));
55868
+ }
55869
+
55857
55870
  const PERFORM_QUICK_ACTION_ENDPOINT_REGEX = /^\/ui-api\/actions\/perform-quick-action\/.*$/;
55858
55871
  /**
55859
55872
  * Checks if a provided resource request is a POST operation on the record
@@ -55872,7 +55885,7 @@ function performQuickActionDraftEnvironment(luvio, env, handler) {
55872
55885
  return env.dispatchResourceRequest(request, context, eventObservers);
55873
55886
  }
55874
55887
  const { data } = await handler.enqueue(request).catch((err) => {
55875
- throw createDraftSynthesisErrorResponse(err.message);
55888
+ throw createDraftSynthesisErrorResponse(normalizeError$1(err).message);
55876
55889
  });
55877
55890
  if (data === undefined) {
55878
55891
  return Promise.reject(createDraftSynthesisErrorResponse());
@@ -57868,15 +57881,15 @@ class NimbusDraftQueue {
57868
57881
  enqueue(handlerId, data) {
57869
57882
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
57870
57883
  if (callProxyMethod === undefined) {
57871
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
57884
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
57872
57885
  }
57873
57886
  const serializedAction = stringify$6([handlerId, data]);
57874
57887
  return new Promise((resolve, reject) => {
57875
57888
  callProxyMethod('enqueue', serializedAction, (serializedActionResponse) => {
57876
57889
  const response = parse$6(serializedActionResponse);
57877
57890
  resolve(response);
57878
- }, (serializedError) => {
57879
- reject(parse$6(serializedError));
57891
+ }, (errorMessage) => {
57892
+ reject(new Error(errorMessage));
57880
57893
  });
57881
57894
  });
57882
57895
  }
@@ -57886,18 +57899,18 @@ class NimbusDraftQueue {
57886
57899
  return Promise.resolve;
57887
57900
  }
57888
57901
  processNextAction() {
57889
- return Promise.reject('Cannot call processNextAction from the NimbusDraftQueue');
57902
+ return Promise.reject(new Error('Cannot call processNextAction from the NimbusDraftQueue'));
57890
57903
  }
57891
57904
  getQueueActions() {
57892
57905
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
57893
57906
  if (callProxyMethod === undefined) {
57894
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
57907
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
57895
57908
  }
57896
57909
  return new Promise((resolve, reject) => {
57897
57910
  callProxyMethod('getQueueActions', stringify$6([]), (serializedQueue) => {
57898
57911
  resolve(parse$6(serializedQueue));
57899
- }, (serializedError) => {
57900
- reject(parse$6(serializedError));
57912
+ }, (errorMessage) => {
57913
+ reject(new Error(errorMessage));
57901
57914
  });
57902
57915
  });
57903
57916
  }
@@ -57925,32 +57938,32 @@ class NimbusDraftQueue {
57925
57938
  throw new Error('Cannot call getQueueState from the NimbusDraftQueue');
57926
57939
  }
57927
57940
  removeDraftAction(_actionId) {
57928
- return Promise.reject('Cannot call removeDraftAction from the NimbusDraftQueue');
57941
+ return Promise.reject(new Error('Cannot call removeDraftAction from the NimbusDraftQueue'));
57929
57942
  }
57930
57943
  startQueue() {
57931
- return Promise.reject('Cannot call startQueue from the NimbusDraftQueue');
57944
+ return Promise.reject(new Error('Cannot call startQueue from the NimbusDraftQueue'));
57932
57945
  }
57933
57946
  stopQueue() {
57934
- return Promise.reject('Cannot call stopQueue from the NimbusDraftQueue');
57947
+ return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
57935
57948
  }
57936
57949
  replaceAction(_actionId, _withActionId) {
57937
- return Promise.reject('Cannot call replaceAction from the NimbusDraftQueue');
57950
+ return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
57938
57951
  }
57939
57952
  mergeActions(_targetActionId, _sourceActionId) {
57940
- return Promise.reject('Cannot call mergeActions from the NimbusDraftQueue');
57953
+ return Promise.reject(new Error('Cannot call mergeActions from the NimbusDraftQueue'));
57941
57954
  }
57942
57955
  setMetadata(_actionId, _metadata) {
57943
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57956
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57944
57957
  }
57945
57958
  addHandler(_handler) {
57946
57959
  // no-op -- all registration occurs against concrete draft queue
57947
57960
  return Promise.resolve();
57948
57961
  }
57949
57962
  addCustomHandler(_id, _executor) {
57950
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57963
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57951
57964
  }
57952
57965
  removeHandler(_id) {
57953
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57966
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57954
57967
  }
57955
57968
  }
57956
57969
 
@@ -57973,7 +57986,7 @@ function attachObserversToAdapterRequestContext(observers, adapterRequestContext
57973
57986
  * @param err Unknown object to sanitize
57974
57987
  * @returns an instance of error
57975
57988
  */
57976
- function normalizeError$1(err) {
57989
+ function normalizeError$2(err) {
57977
57990
  if (err instanceof Error) {
57978
57991
  return err;
57979
57992
  }
@@ -57985,13 +57998,13 @@ function normalizeError$1(err) {
57985
57998
  const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
57986
57999
  const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
57987
58000
  function reportGraphqlQueryParseError(err) {
57988
- normalizeError$1(err);
58001
+ normalizeError$2(err);
57989
58002
  }
57990
58003
  function reportGraphqlSqlEvalPreconditionError(err) {
57991
- normalizeError$1(err);
58004
+ normalizeError$2(err);
57992
58005
  }
57993
58006
  function reportGraphqlCreateSnapshotError(err) {
57994
- normalizeError$1(err);
58007
+ normalizeError$2(err);
57995
58008
  }
57996
58009
  function reportGraphQlEvalDbReadDuration(duration) {
57997
58010
  }
@@ -58001,7 +58014,7 @@ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
58001
58014
  error = err.body;
58002
58015
  }
58003
58016
  else {
58004
- error = normalizeError$1(err);
58017
+ error = normalizeError$2(err);
58005
58018
  }
58006
58019
  const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
58007
58020
  const errorType = error.errorType;
@@ -58030,7 +58043,7 @@ const withInstrumentation = (operation, config) => {
58030
58043
  const { tags, metricName, logError } = config;
58031
58044
  return operation()
58032
58045
  .catch((err) => {
58033
- const error = normalizeError$1(err);
58046
+ const error = normalizeError$2(err);
58034
58047
  tags['errorMessage'] = error.message;
58035
58048
  throw err;
58036
58049
  })
@@ -59514,7 +59527,7 @@ register({
59514
59527
  id: '@salesforce/lds-network-adapter',
59515
59528
  instrument: instrument$1,
59516
59529
  });
59517
- // version: 1.136.5-4301ab650
59530
+ // version: 1.136.6-0f5ec3ee7
59518
59531
 
59519
59532
  const { create: create$2, keys: keys$2 } = Object;
59520
59533
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -73948,7 +73961,7 @@ register({
73948
73961
  configuration: { ...configurationForGraphQLAdapters },
73949
73962
  instrument,
73950
73963
  });
73951
- // version: 1.136.5-9eb467125
73964
+ // version: 1.136.6-acf28210f
73952
73965
 
73953
73966
  // On core the unstable adapters are re-exported with different names,
73954
73967
 
@@ -76059,7 +76072,7 @@ withDefaultLuvio((luvio) => {
76059
76072
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
76060
76073
  graphQLImperative = ldsAdapter;
76061
76074
  });
76062
- // version: 1.136.5-9eb467125
76075
+ // version: 1.136.6-acf28210f
76063
76076
 
76064
76077
  var gqlApi = /*#__PURE__*/Object.freeze({
76065
76078
  __proto__: null,
@@ -76669,24 +76682,21 @@ const allowList = ['enqueue', 'getQueueActions'];
76669
76682
  * to the instance of the lds-drafts' DraftQueue implementation
76670
76683
  */
76671
76684
  const nimbusDraftQueue = {
76672
- callProxyMethod(methodName, serializedArgsArray, resultCallback, errorCallback) {
76685
+ callProxyMethod(methodName, serializedArgsArray, resultCallback,
76686
+ // NOTE: the other side of the proxy is expecting an error message string
76687
+ // (not a JSON serialized Error object)
76688
+ errorCallback) {
76673
76689
  const method = draftQueue[methodName];
76674
76690
  if (method === undefined) {
76675
- return errorCallback(stringify$1({
76676
- message: 'Method does not exist on the draft queue',
76677
- }));
76691
+ return errorCallback('Method does not exist on the draft queue');
76678
76692
  }
76679
76693
  if (allowList.includes(methodName) === false) {
76680
- return errorCallback(stringify$1({
76681
- message: `Method ${methodName} is not available for proxy invocation`,
76682
- }));
76694
+ return errorCallback(`Method ${methodName} is not available for proxy invocation`);
76683
76695
  }
76684
76696
  const parsedArgs = parse$1(serializedArgsArray);
76685
76697
  // TODO [W-9933226]: we should validate the argument list based on which method is being called
76686
76698
  if (isArray$1(parsedArgs) === false) {
76687
- return errorCallback(stringify$1({
76688
- message: 'expected array argument list',
76689
- }));
76699
+ return errorCallback('expected array argument list');
76690
76700
  }
76691
76701
  let methodResult = undefined;
76692
76702
  try {
@@ -76698,7 +76708,7 @@ const nimbusDraftQueue = {
76698
76708
  }
76699
76709
  }
76700
76710
  catch (err) {
76701
- return errorCallback(stringify$1(err));
76711
+ return errorCallback(normalizeError(err).message);
76702
76712
  }
76703
76713
  if (methodResult.then === undefined) {
76704
76714
  return resultCallback(stringify$1(methodResult));
@@ -76708,7 +76718,7 @@ const nimbusDraftQueue = {
76708
76718
  resultCallback(stringify$1(result));
76709
76719
  })
76710
76720
  .catch((err) => {
76711
- errorCallback(stringify$1(err));
76721
+ errorCallback(normalizeError(err).message);
76712
76722
  });
76713
76723
  },
76714
76724
  };
@@ -76751,4 +76761,4 @@ const { luvio } = getRuntime();
76751
76761
  setDefaultLuvio({ luvio });
76752
76762
 
76753
76763
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
76754
- // version: 1.136.5-4301ab650
76764
+ // version: 1.136.6-0f5ec3ee7
@@ -0,0 +1,18 @@
1
+ import type { IdleDetector, Activity } from 'o11y/dist/modules/o11y/client/interfaces';
2
+ export declare const idleDetector: IdleDetector;
3
+ export declare const activity: Partial<Activity>;
4
+ type MetricsTags = Record<string, number | string | boolean>;
5
+ declare function startActivity(_name: string): Activity;
6
+ export declare const mockInstrumentation: {
7
+ startActivity: typeof startActivity;
8
+ error: () => void;
9
+ trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
10
+ incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
11
+ };
12
+ export declare const getInstrumentation: () => {
13
+ startActivity: typeof startActivity;
14
+ error: () => void;
15
+ trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
16
+ incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
17
+ };
18
+ export {};
@@ -3803,7 +3803,7 @@
3803
3803
  }
3804
3804
  callbacks.push(callback);
3805
3805
  }
3806
- // version: 1.136.5-4301ab650
3806
+ // version: 1.136.6-0f5ec3ee7
3807
3807
 
3808
3808
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
3809
3809
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -15227,7 +15227,7 @@
15227
15227
  updateReferenceMapWithKnownKey(ast, luvioDocumentNode);
15228
15228
  return luvioDocumentNode;
15229
15229
  }
15230
- // version: 1.136.5-4301ab650
15230
+ // version: 1.136.6-0f5ec3ee7
15231
15231
 
15232
15232
  function unwrap(data) {
15233
15233
  // The lwc-luvio bindings import a function from lwc called "unwrap".
@@ -16140,7 +16140,7 @@
16140
16140
  const { apiFamily, name } = metadata;
16141
16141
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
16142
16142
  }
16143
- // version: 1.136.5-4301ab650
16143
+ // version: 1.136.6-0f5ec3ee7
16144
16144
 
16145
16145
  /**
16146
16146
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -43907,7 +43907,7 @@
43907
43907
  dropFunction: instrumentation$2.notifyRecordUpdateAvailableDropped,
43908
43908
  });
43909
43909
  });
43910
- // version: 1.136.5-9eb467125
43910
+ // version: 1.136.6-acf28210f
43911
43911
 
43912
43912
  var caseSensitiveUserId = '005B0000000GR4OIAW';
43913
43913
 
@@ -45961,7 +45961,7 @@
45961
45961
  case ComparisonOperator.eq:
45962
45962
  return '=';
45963
45963
  case ComparisonOperator.ne:
45964
- return '!=';
45964
+ return 'IS NOT';
45965
45965
  case ComparisonOperator.gt:
45966
45966
  return '>';
45967
45967
  case ComparisonOperator.gte:
@@ -55860,6 +55860,19 @@
55860
55860
  });
55861
55861
  }
55862
55862
 
55863
+ /**
55864
+ * This function takes an unknown error and normalizes it to an Error object
55865
+ */
55866
+ function normalizeError$1(error) {
55867
+ if (typeof error === 'object' && error instanceof Error) {
55868
+ return error;
55869
+ }
55870
+ else if (typeof error === 'string') {
55871
+ return new Error(error);
55872
+ }
55873
+ return new Error(stringify$2(error));
55874
+ }
55875
+
55863
55876
  const PERFORM_QUICK_ACTION_ENDPOINT_REGEX = /^\/ui-api\/actions\/perform-quick-action\/.*$/;
55864
55877
  /**
55865
55878
  * Checks if a provided resource request is a POST operation on the record
@@ -55878,7 +55891,7 @@
55878
55891
  return env.dispatchResourceRequest(request, context, eventObservers);
55879
55892
  }
55880
55893
  const { data } = await handler.enqueue(request).catch((err) => {
55881
- throw createDraftSynthesisErrorResponse(err.message);
55894
+ throw createDraftSynthesisErrorResponse(normalizeError$1(err).message);
55882
55895
  });
55883
55896
  if (data === undefined) {
55884
55897
  return Promise.reject(createDraftSynthesisErrorResponse());
@@ -57874,15 +57887,15 @@
57874
57887
  enqueue(handlerId, data) {
57875
57888
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
57876
57889
  if (callProxyMethod === undefined) {
57877
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
57890
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
57878
57891
  }
57879
57892
  const serializedAction = stringify$6([handlerId, data]);
57880
57893
  return new Promise((resolve, reject) => {
57881
57894
  callProxyMethod('enqueue', serializedAction, (serializedActionResponse) => {
57882
57895
  const response = parse$6(serializedActionResponse);
57883
57896
  resolve(response);
57884
- }, (serializedError) => {
57885
- reject(parse$6(serializedError));
57897
+ }, (errorMessage) => {
57898
+ reject(new Error(errorMessage));
57886
57899
  });
57887
57900
  });
57888
57901
  }
@@ -57892,18 +57905,18 @@
57892
57905
  return Promise.resolve;
57893
57906
  }
57894
57907
  processNextAction() {
57895
- return Promise.reject('Cannot call processNextAction from the NimbusDraftQueue');
57908
+ return Promise.reject(new Error('Cannot call processNextAction from the NimbusDraftQueue'));
57896
57909
  }
57897
57910
  getQueueActions() {
57898
57911
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
57899
57912
  if (callProxyMethod === undefined) {
57900
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
57913
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
57901
57914
  }
57902
57915
  return new Promise((resolve, reject) => {
57903
57916
  callProxyMethod('getQueueActions', stringify$6([]), (serializedQueue) => {
57904
57917
  resolve(parse$6(serializedQueue));
57905
- }, (serializedError) => {
57906
- reject(parse$6(serializedError));
57918
+ }, (errorMessage) => {
57919
+ reject(new Error(errorMessage));
57907
57920
  });
57908
57921
  });
57909
57922
  }
@@ -57931,32 +57944,32 @@
57931
57944
  throw new Error('Cannot call getQueueState from the NimbusDraftQueue');
57932
57945
  }
57933
57946
  removeDraftAction(_actionId) {
57934
- return Promise.reject('Cannot call removeDraftAction from the NimbusDraftQueue');
57947
+ return Promise.reject(new Error('Cannot call removeDraftAction from the NimbusDraftQueue'));
57935
57948
  }
57936
57949
  startQueue() {
57937
- return Promise.reject('Cannot call startQueue from the NimbusDraftQueue');
57950
+ return Promise.reject(new Error('Cannot call startQueue from the NimbusDraftQueue'));
57938
57951
  }
57939
57952
  stopQueue() {
57940
- return Promise.reject('Cannot call stopQueue from the NimbusDraftQueue');
57953
+ return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
57941
57954
  }
57942
57955
  replaceAction(_actionId, _withActionId) {
57943
- return Promise.reject('Cannot call replaceAction from the NimbusDraftQueue');
57956
+ return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
57944
57957
  }
57945
57958
  mergeActions(_targetActionId, _sourceActionId) {
57946
- return Promise.reject('Cannot call mergeActions from the NimbusDraftQueue');
57959
+ return Promise.reject(new Error('Cannot call mergeActions from the NimbusDraftQueue'));
57947
57960
  }
57948
57961
  setMetadata(_actionId, _metadata) {
57949
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57962
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57950
57963
  }
57951
57964
  addHandler(_handler) {
57952
57965
  // no-op -- all registration occurs against concrete draft queue
57953
57966
  return Promise.resolve();
57954
57967
  }
57955
57968
  addCustomHandler(_id, _executor) {
57956
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57969
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57957
57970
  }
57958
57971
  removeHandler(_id) {
57959
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57972
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57960
57973
  }
57961
57974
  }
57962
57975
 
@@ -57979,7 +57992,7 @@
57979
57992
  * @param err Unknown object to sanitize
57980
57993
  * @returns an instance of error
57981
57994
  */
57982
- function normalizeError$1(err) {
57995
+ function normalizeError$2(err) {
57983
57996
  if (err instanceof Error) {
57984
57997
  return err;
57985
57998
  }
@@ -57991,13 +58004,13 @@
57991
58004
  const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
57992
58005
  const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
57993
58006
  function reportGraphqlQueryParseError(err) {
57994
- normalizeError$1(err);
58007
+ normalizeError$2(err);
57995
58008
  }
57996
58009
  function reportGraphqlSqlEvalPreconditionError(err) {
57997
- normalizeError$1(err);
58010
+ normalizeError$2(err);
57998
58011
  }
57999
58012
  function reportGraphqlCreateSnapshotError(err) {
58000
- normalizeError$1(err);
58013
+ normalizeError$2(err);
58001
58014
  }
58002
58015
  function reportGraphQlEvalDbReadDuration(duration) {
58003
58016
  }
@@ -58007,7 +58020,7 @@
58007
58020
  error = err.body;
58008
58021
  }
58009
58022
  else {
58010
- error = normalizeError$1(err);
58023
+ error = normalizeError$2(err);
58011
58024
  }
58012
58025
  const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
58013
58026
  const errorType = error.errorType;
@@ -58036,7 +58049,7 @@
58036
58049
  const { tags, metricName, logError } = config;
58037
58050
  return operation()
58038
58051
  .catch((err) => {
58039
- const error = normalizeError$1(err);
58052
+ const error = normalizeError$2(err);
58040
58053
  tags['errorMessage'] = error.message;
58041
58054
  throw err;
58042
58055
  })
@@ -59520,7 +59533,7 @@
59520
59533
  id: '@salesforce/lds-network-adapter',
59521
59534
  instrument: instrument$1,
59522
59535
  });
59523
- // version: 1.136.5-4301ab650
59536
+ // version: 1.136.6-0f5ec3ee7
59524
59537
 
59525
59538
  const { create: create$2, keys: keys$2 } = Object;
59526
59539
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -73954,7 +73967,7 @@
73954
73967
  configuration: { ...configurationForGraphQLAdapters },
73955
73968
  instrument,
73956
73969
  });
73957
- // version: 1.136.5-9eb467125
73970
+ // version: 1.136.6-acf28210f
73958
73971
 
73959
73972
  // On core the unstable adapters are re-exported with different names,
73960
73973
 
@@ -76065,7 +76078,7 @@
76065
76078
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
76066
76079
  graphQLImperative = ldsAdapter;
76067
76080
  });
76068
- // version: 1.136.5-9eb467125
76081
+ // version: 1.136.6-acf28210f
76069
76082
 
76070
76083
  var gqlApi = /*#__PURE__*/Object.freeze({
76071
76084
  __proto__: null,
@@ -76675,24 +76688,21 @@
76675
76688
  * to the instance of the lds-drafts' DraftQueue implementation
76676
76689
  */
76677
76690
  const nimbusDraftQueue = {
76678
- callProxyMethod(methodName, serializedArgsArray, resultCallback, errorCallback) {
76691
+ callProxyMethod(methodName, serializedArgsArray, resultCallback,
76692
+ // NOTE: the other side of the proxy is expecting an error message string
76693
+ // (not a JSON serialized Error object)
76694
+ errorCallback) {
76679
76695
  const method = draftQueue[methodName];
76680
76696
  if (method === undefined) {
76681
- return errorCallback(stringify$1({
76682
- message: 'Method does not exist on the draft queue',
76683
- }));
76697
+ return errorCallback('Method does not exist on the draft queue');
76684
76698
  }
76685
76699
  if (allowList.includes(methodName) === false) {
76686
- return errorCallback(stringify$1({
76687
- message: `Method ${methodName} is not available for proxy invocation`,
76688
- }));
76700
+ return errorCallback(`Method ${methodName} is not available for proxy invocation`);
76689
76701
  }
76690
76702
  const parsedArgs = parse$1(serializedArgsArray);
76691
76703
  // TODO [W-9933226]: we should validate the argument list based on which method is being called
76692
76704
  if (isArray$1(parsedArgs) === false) {
76693
- return errorCallback(stringify$1({
76694
- message: 'expected array argument list',
76695
- }));
76705
+ return errorCallback('expected array argument list');
76696
76706
  }
76697
76707
  let methodResult = undefined;
76698
76708
  try {
@@ -76704,7 +76714,7 @@
76704
76714
  }
76705
76715
  }
76706
76716
  catch (err) {
76707
- return errorCallback(stringify$1(err));
76717
+ return errorCallback(normalizeError(err).message);
76708
76718
  }
76709
76719
  if (methodResult.then === undefined) {
76710
76720
  return resultCallback(stringify$1(methodResult));
@@ -76714,7 +76724,7 @@
76714
76724
  resultCallback(stringify$1(result));
76715
76725
  })
76716
76726
  .catch((err) => {
76717
- errorCallback(stringify$1(err));
76727
+ errorCallback(normalizeError(err).message);
76718
76728
  });
76719
76729
  },
76720
76730
  };
@@ -76774,4 +76784,4 @@
76774
76784
  Object.defineProperty(exports, '__esModule', { value: true });
76775
76785
 
76776
76786
  }));
76777
- // version: 1.136.5-4301ab650
76787
+ // version: 1.136.6-0f5ec3ee7
@@ -0,0 +1,18 @@
1
+ import type { IdleDetector, Activity } from 'o11y/dist/modules/o11y/client/interfaces';
2
+ export declare const idleDetector: IdleDetector;
3
+ export declare const activity: Partial<Activity>;
4
+ type MetricsTags = Record<string, number | string | boolean>;
5
+ declare function startActivity(_name: string): Activity;
6
+ export declare const mockInstrumentation: {
7
+ startActivity: typeof startActivity;
8
+ error: () => void;
9
+ trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
10
+ incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
11
+ };
12
+ export declare const getInstrumentation: () => {
13
+ startActivity: typeof startActivity;
14
+ error: () => void;
15
+ trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
16
+ incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
17
+ };
18
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.136.5",
3
+ "version": "1.136.6",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",