@salesforce/lds-worker-api 1.136.4 → 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.4-be22a02bc
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.4-be22a02bc
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.4-be22a02bc
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.4-be22a02bc
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.4-1b206f2a8
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:
@@ -49685,6 +49685,8 @@ class AbstractResourceRequestActionHandler {
49685
49685
  };
49686
49686
  // overlay metadata
49687
49687
  merged.metadata = { ...targetMetadata, ...sourceMetadata };
49688
+ // put status back to pending to auto upload if queue is active and targed is at the head.
49689
+ merged.status = DraftActionStatus.Pending;
49688
49690
  return merged;
49689
49691
  }
49690
49692
  shouldDeleteActionByTagOnRemoval(action) {
@@ -55852,6 +55854,19 @@ function makeRecordDenormalizingDurableStore(luvio, durableStore, getStoreRecord
55852
55854
  });
55853
55855
  }
55854
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
+
55855
55870
  const PERFORM_QUICK_ACTION_ENDPOINT_REGEX = /^\/ui-api\/actions\/perform-quick-action\/.*$/;
55856
55871
  /**
55857
55872
  * Checks if a provided resource request is a POST operation on the record
@@ -55870,7 +55885,7 @@ function performQuickActionDraftEnvironment(luvio, env, handler) {
55870
55885
  return env.dispatchResourceRequest(request, context, eventObservers);
55871
55886
  }
55872
55887
  const { data } = await handler.enqueue(request).catch((err) => {
55873
- throw createDraftSynthesisErrorResponse(err.message);
55888
+ throw createDraftSynthesisErrorResponse(normalizeError$1(err).message);
55874
55889
  });
55875
55890
  if (data === undefined) {
55876
55891
  return Promise.reject(createDraftSynthesisErrorResponse());
@@ -57866,15 +57881,15 @@ class NimbusDraftQueue {
57866
57881
  enqueue(handlerId, data) {
57867
57882
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
57868
57883
  if (callProxyMethod === undefined) {
57869
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
57884
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
57870
57885
  }
57871
57886
  const serializedAction = stringify$6([handlerId, data]);
57872
57887
  return new Promise((resolve, reject) => {
57873
57888
  callProxyMethod('enqueue', serializedAction, (serializedActionResponse) => {
57874
57889
  const response = parse$6(serializedActionResponse);
57875
57890
  resolve(response);
57876
- }, (serializedError) => {
57877
- reject(parse$6(serializedError));
57891
+ }, (errorMessage) => {
57892
+ reject(new Error(errorMessage));
57878
57893
  });
57879
57894
  });
57880
57895
  }
@@ -57884,18 +57899,18 @@ class NimbusDraftQueue {
57884
57899
  return Promise.resolve;
57885
57900
  }
57886
57901
  processNextAction() {
57887
- return Promise.reject('Cannot call processNextAction from the NimbusDraftQueue');
57902
+ return Promise.reject(new Error('Cannot call processNextAction from the NimbusDraftQueue'));
57888
57903
  }
57889
57904
  getQueueActions() {
57890
57905
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
57891
57906
  if (callProxyMethod === undefined) {
57892
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
57907
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
57893
57908
  }
57894
57909
  return new Promise((resolve, reject) => {
57895
57910
  callProxyMethod('getQueueActions', stringify$6([]), (serializedQueue) => {
57896
57911
  resolve(parse$6(serializedQueue));
57897
- }, (serializedError) => {
57898
- reject(parse$6(serializedError));
57912
+ }, (errorMessage) => {
57913
+ reject(new Error(errorMessage));
57899
57914
  });
57900
57915
  });
57901
57916
  }
@@ -57923,32 +57938,32 @@ class NimbusDraftQueue {
57923
57938
  throw new Error('Cannot call getQueueState from the NimbusDraftQueue');
57924
57939
  }
57925
57940
  removeDraftAction(_actionId) {
57926
- return Promise.reject('Cannot call removeDraftAction from the NimbusDraftQueue');
57941
+ return Promise.reject(new Error('Cannot call removeDraftAction from the NimbusDraftQueue'));
57927
57942
  }
57928
57943
  startQueue() {
57929
- return Promise.reject('Cannot call startQueue from the NimbusDraftQueue');
57944
+ return Promise.reject(new Error('Cannot call startQueue from the NimbusDraftQueue'));
57930
57945
  }
57931
57946
  stopQueue() {
57932
- return Promise.reject('Cannot call stopQueue from the NimbusDraftQueue');
57947
+ return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
57933
57948
  }
57934
57949
  replaceAction(_actionId, _withActionId) {
57935
- return Promise.reject('Cannot call replaceAction from the NimbusDraftQueue');
57950
+ return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
57936
57951
  }
57937
57952
  mergeActions(_targetActionId, _sourceActionId) {
57938
- return Promise.reject('Cannot call mergeActions from the NimbusDraftQueue');
57953
+ return Promise.reject(new Error('Cannot call mergeActions from the NimbusDraftQueue'));
57939
57954
  }
57940
57955
  setMetadata(_actionId, _metadata) {
57941
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57956
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57942
57957
  }
57943
57958
  addHandler(_handler) {
57944
57959
  // no-op -- all registration occurs against concrete draft queue
57945
57960
  return Promise.resolve();
57946
57961
  }
57947
57962
  addCustomHandler(_id, _executor) {
57948
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57963
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57949
57964
  }
57950
57965
  removeHandler(_id) {
57951
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57966
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57952
57967
  }
57953
57968
  }
57954
57969
 
@@ -57971,7 +57986,7 @@ function attachObserversToAdapterRequestContext(observers, adapterRequestContext
57971
57986
  * @param err Unknown object to sanitize
57972
57987
  * @returns an instance of error
57973
57988
  */
57974
- function normalizeError$1(err) {
57989
+ function normalizeError$2(err) {
57975
57990
  if (err instanceof Error) {
57976
57991
  return err;
57977
57992
  }
@@ -57983,13 +57998,13 @@ function normalizeError$1(err) {
57983
57998
  const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
57984
57999
  const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
57985
58000
  function reportGraphqlQueryParseError(err) {
57986
- normalizeError$1(err);
58001
+ normalizeError$2(err);
57987
58002
  }
57988
58003
  function reportGraphqlSqlEvalPreconditionError(err) {
57989
- normalizeError$1(err);
58004
+ normalizeError$2(err);
57990
58005
  }
57991
58006
  function reportGraphqlCreateSnapshotError(err) {
57992
- normalizeError$1(err);
58007
+ normalizeError$2(err);
57993
58008
  }
57994
58009
  function reportGraphQlEvalDbReadDuration(duration) {
57995
58010
  }
@@ -57999,7 +58014,7 @@ function reportDraftAwareContentDocumentVersionSynthesizeError(err) {
57999
58014
  error = err.body;
58000
58015
  }
58001
58016
  else {
58002
- error = normalizeError$1(err);
58017
+ error = normalizeError$2(err);
58003
58018
  }
58004
58019
  const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
58005
58020
  const errorType = error.errorType;
@@ -58028,7 +58043,7 @@ const withInstrumentation = (operation, config) => {
58028
58043
  const { tags, metricName, logError } = config;
58029
58044
  return operation()
58030
58045
  .catch((err) => {
58031
- const error = normalizeError$1(err);
58046
+ const error = normalizeError$2(err);
58032
58047
  tags['errorMessage'] = error.message;
58033
58048
  throw err;
58034
58049
  })
@@ -59512,7 +59527,7 @@ register({
59512
59527
  id: '@salesforce/lds-network-adapter',
59513
59528
  instrument: instrument$1,
59514
59529
  });
59515
- // version: 1.136.4-be22a02bc
59530
+ // version: 1.136.6-0f5ec3ee7
59516
59531
 
59517
59532
  const { create: create$2, keys: keys$2 } = Object;
59518
59533
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -73946,7 +73961,7 @@ register({
73946
73961
  configuration: { ...configurationForGraphQLAdapters },
73947
73962
  instrument,
73948
73963
  });
73949
- // version: 1.136.4-1b206f2a8
73964
+ // version: 1.136.6-acf28210f
73950
73965
 
73951
73966
  // On core the unstable adapters are re-exported with different names,
73952
73967
 
@@ -76057,7 +76072,7 @@ withDefaultLuvio((luvio) => {
76057
76072
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
76058
76073
  graphQLImperative = ldsAdapter;
76059
76074
  });
76060
- // version: 1.136.4-1b206f2a8
76075
+ // version: 1.136.6-acf28210f
76061
76076
 
76062
76077
  var gqlApi = /*#__PURE__*/Object.freeze({
76063
76078
  __proto__: null,
@@ -76667,24 +76682,21 @@ const allowList = ['enqueue', 'getQueueActions'];
76667
76682
  * to the instance of the lds-drafts' DraftQueue implementation
76668
76683
  */
76669
76684
  const nimbusDraftQueue = {
76670
- 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) {
76671
76689
  const method = draftQueue[methodName];
76672
76690
  if (method === undefined) {
76673
- return errorCallback(stringify$1({
76674
- message: 'Method does not exist on the draft queue',
76675
- }));
76691
+ return errorCallback('Method does not exist on the draft queue');
76676
76692
  }
76677
76693
  if (allowList.includes(methodName) === false) {
76678
- return errorCallback(stringify$1({
76679
- message: `Method ${methodName} is not available for proxy invocation`,
76680
- }));
76694
+ return errorCallback(`Method ${methodName} is not available for proxy invocation`);
76681
76695
  }
76682
76696
  const parsedArgs = parse$1(serializedArgsArray);
76683
76697
  // TODO [W-9933226]: we should validate the argument list based on which method is being called
76684
76698
  if (isArray$1(parsedArgs) === false) {
76685
- return errorCallback(stringify$1({
76686
- message: 'expected array argument list',
76687
- }));
76699
+ return errorCallback('expected array argument list');
76688
76700
  }
76689
76701
  let methodResult = undefined;
76690
76702
  try {
@@ -76696,7 +76708,7 @@ const nimbusDraftQueue = {
76696
76708
  }
76697
76709
  }
76698
76710
  catch (err) {
76699
- return errorCallback(stringify$1(err));
76711
+ return errorCallback(normalizeError(err).message);
76700
76712
  }
76701
76713
  if (methodResult.then === undefined) {
76702
76714
  return resultCallback(stringify$1(methodResult));
@@ -76706,7 +76718,7 @@ const nimbusDraftQueue = {
76706
76718
  resultCallback(stringify$1(result));
76707
76719
  })
76708
76720
  .catch((err) => {
76709
- errorCallback(stringify$1(err));
76721
+ errorCallback(normalizeError(err).message);
76710
76722
  });
76711
76723
  },
76712
76724
  };
@@ -76749,4 +76761,4 @@ const { luvio } = getRuntime();
76749
76761
  setDefaultLuvio({ luvio });
76750
76762
 
76751
76763
  export { createPrimingSession, draftManager, draftQueue, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, invokeAdapter, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, subscribeToAdapter };
76752
- // version: 1.136.4-be22a02bc
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.4-be22a02bc
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.4-be22a02bc
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.4-be22a02bc
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.4-1b206f2a8
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:
@@ -49691,6 +49691,8 @@
49691
49691
  };
49692
49692
  // overlay metadata
49693
49693
  merged.metadata = { ...targetMetadata, ...sourceMetadata };
49694
+ // put status back to pending to auto upload if queue is active and targed is at the head.
49695
+ merged.status = DraftActionStatus.Pending;
49694
49696
  return merged;
49695
49697
  }
49696
49698
  shouldDeleteActionByTagOnRemoval(action) {
@@ -55858,6 +55860,19 @@
55858
55860
  });
55859
55861
  }
55860
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
+
55861
55876
  const PERFORM_QUICK_ACTION_ENDPOINT_REGEX = /^\/ui-api\/actions\/perform-quick-action\/.*$/;
55862
55877
  /**
55863
55878
  * Checks if a provided resource request is a POST operation on the record
@@ -55876,7 +55891,7 @@
55876
55891
  return env.dispatchResourceRequest(request, context, eventObservers);
55877
55892
  }
55878
55893
  const { data } = await handler.enqueue(request).catch((err) => {
55879
- throw createDraftSynthesisErrorResponse(err.message);
55894
+ throw createDraftSynthesisErrorResponse(normalizeError$1(err).message);
55880
55895
  });
55881
55896
  if (data === undefined) {
55882
55897
  return Promise.reject(createDraftSynthesisErrorResponse());
@@ -57872,15 +57887,15 @@
57872
57887
  enqueue(handlerId, data) {
57873
57888
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
57874
57889
  if (callProxyMethod === undefined) {
57875
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
57890
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
57876
57891
  }
57877
57892
  const serializedAction = stringify$6([handlerId, data]);
57878
57893
  return new Promise((resolve, reject) => {
57879
57894
  callProxyMethod('enqueue', serializedAction, (serializedActionResponse) => {
57880
57895
  const response = parse$6(serializedActionResponse);
57881
57896
  resolve(response);
57882
- }, (serializedError) => {
57883
- reject(parse$6(serializedError));
57897
+ }, (errorMessage) => {
57898
+ reject(new Error(errorMessage));
57884
57899
  });
57885
57900
  });
57886
57901
  }
@@ -57890,18 +57905,18 @@
57890
57905
  return Promise.resolve;
57891
57906
  }
57892
57907
  processNextAction() {
57893
- return Promise.reject('Cannot call processNextAction from the NimbusDraftQueue');
57908
+ return Promise.reject(new Error('Cannot call processNextAction from the NimbusDraftQueue'));
57894
57909
  }
57895
57910
  getQueueActions() {
57896
57911
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
57897
57912
  if (callProxyMethod === undefined) {
57898
- return Promise.reject('callProxyMethod not defined on the nimbus plugin');
57913
+ return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
57899
57914
  }
57900
57915
  return new Promise((resolve, reject) => {
57901
57916
  callProxyMethod('getQueueActions', stringify$6([]), (serializedQueue) => {
57902
57917
  resolve(parse$6(serializedQueue));
57903
- }, (serializedError) => {
57904
- reject(parse$6(serializedError));
57918
+ }, (errorMessage) => {
57919
+ reject(new Error(errorMessage));
57905
57920
  });
57906
57921
  });
57907
57922
  }
@@ -57929,32 +57944,32 @@
57929
57944
  throw new Error('Cannot call getQueueState from the NimbusDraftQueue');
57930
57945
  }
57931
57946
  removeDraftAction(_actionId) {
57932
- return Promise.reject('Cannot call removeDraftAction from the NimbusDraftQueue');
57947
+ return Promise.reject(new Error('Cannot call removeDraftAction from the NimbusDraftQueue'));
57933
57948
  }
57934
57949
  startQueue() {
57935
- return Promise.reject('Cannot call startQueue from the NimbusDraftQueue');
57950
+ return Promise.reject(new Error('Cannot call startQueue from the NimbusDraftQueue'));
57936
57951
  }
57937
57952
  stopQueue() {
57938
- return Promise.reject('Cannot call stopQueue from the NimbusDraftQueue');
57953
+ return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
57939
57954
  }
57940
57955
  replaceAction(_actionId, _withActionId) {
57941
- return Promise.reject('Cannot call replaceAction from the NimbusDraftQueue');
57956
+ return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
57942
57957
  }
57943
57958
  mergeActions(_targetActionId, _sourceActionId) {
57944
- return Promise.reject('Cannot call mergeActions from the NimbusDraftQueue');
57959
+ return Promise.reject(new Error('Cannot call mergeActions from the NimbusDraftQueue'));
57945
57960
  }
57946
57961
  setMetadata(_actionId, _metadata) {
57947
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57962
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57948
57963
  }
57949
57964
  addHandler(_handler) {
57950
57965
  // no-op -- all registration occurs against concrete draft queue
57951
57966
  return Promise.resolve();
57952
57967
  }
57953
57968
  addCustomHandler(_id, _executor) {
57954
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57969
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57955
57970
  }
57956
57971
  removeHandler(_id) {
57957
- return Promise.reject('Cannot call setMetadata from the NimbusDraftQueue');
57972
+ return Promise.reject(new Error('Cannot call setMetadata from the NimbusDraftQueue'));
57958
57973
  }
57959
57974
  }
57960
57975
 
@@ -57977,7 +57992,7 @@
57977
57992
  * @param err Unknown object to sanitize
57978
57993
  * @returns an instance of error
57979
57994
  */
57980
- function normalizeError$1(err) {
57995
+ function normalizeError$2(err) {
57981
57996
  if (err instanceof Error) {
57982
57997
  return err;
57983
57998
  }
@@ -57989,13 +58004,13 @@
57989
58004
  const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = 'draft-queue-total-mergeActions-calls';
57990
58005
  const DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR = 'draft-aware-create-content-document-and-version-error';
57991
58006
  function reportGraphqlQueryParseError(err) {
57992
- normalizeError$1(err);
58007
+ normalizeError$2(err);
57993
58008
  }
57994
58009
  function reportGraphqlSqlEvalPreconditionError(err) {
57995
- normalizeError$1(err);
58010
+ normalizeError$2(err);
57996
58011
  }
57997
58012
  function reportGraphqlCreateSnapshotError(err) {
57998
- normalizeError$1(err);
58013
+ normalizeError$2(err);
57999
58014
  }
58000
58015
  function reportGraphQlEvalDbReadDuration(duration) {
58001
58016
  }
@@ -58005,7 +58020,7 @@
58005
58020
  error = err.body;
58006
58021
  }
58007
58022
  else {
58008
- error = normalizeError$1(err);
58023
+ error = normalizeError$2(err);
58009
58024
  }
58010
58025
  const errorCode = DRAFT_AWARE_CREATE_CONTENT_DOCUMENT_AND_VERSION_ERROR;
58011
58026
  const errorType = error.errorType;
@@ -58034,7 +58049,7 @@
58034
58049
  const { tags, metricName, logError } = config;
58035
58050
  return operation()
58036
58051
  .catch((err) => {
58037
- const error = normalizeError$1(err);
58052
+ const error = normalizeError$2(err);
58038
58053
  tags['errorMessage'] = error.message;
58039
58054
  throw err;
58040
58055
  })
@@ -59518,7 +59533,7 @@
59518
59533
  id: '@salesforce/lds-network-adapter',
59519
59534
  instrument: instrument$1,
59520
59535
  });
59521
- // version: 1.136.4-be22a02bc
59536
+ // version: 1.136.6-0f5ec3ee7
59522
59537
 
59523
59538
  const { create: create$2, keys: keys$2 } = Object;
59524
59539
  const { stringify: stringify$1, parse: parse$1 } = JSON;
@@ -73952,7 +73967,7 @@
73952
73967
  configuration: { ...configurationForGraphQLAdapters },
73953
73968
  instrument,
73954
73969
  });
73955
- // version: 1.136.4-1b206f2a8
73970
+ // version: 1.136.6-acf28210f
73956
73971
 
73957
73972
  // On core the unstable adapters are re-exported with different names,
73958
73973
 
@@ -76063,7 +76078,7 @@
76063
76078
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
76064
76079
  graphQLImperative = ldsAdapter;
76065
76080
  });
76066
- // version: 1.136.4-1b206f2a8
76081
+ // version: 1.136.6-acf28210f
76067
76082
 
76068
76083
  var gqlApi = /*#__PURE__*/Object.freeze({
76069
76084
  __proto__: null,
@@ -76673,24 +76688,21 @@
76673
76688
  * to the instance of the lds-drafts' DraftQueue implementation
76674
76689
  */
76675
76690
  const nimbusDraftQueue = {
76676
- 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) {
76677
76695
  const method = draftQueue[methodName];
76678
76696
  if (method === undefined) {
76679
- return errorCallback(stringify$1({
76680
- message: 'Method does not exist on the draft queue',
76681
- }));
76697
+ return errorCallback('Method does not exist on the draft queue');
76682
76698
  }
76683
76699
  if (allowList.includes(methodName) === false) {
76684
- return errorCallback(stringify$1({
76685
- message: `Method ${methodName} is not available for proxy invocation`,
76686
- }));
76700
+ return errorCallback(`Method ${methodName} is not available for proxy invocation`);
76687
76701
  }
76688
76702
  const parsedArgs = parse$1(serializedArgsArray);
76689
76703
  // TODO [W-9933226]: we should validate the argument list based on which method is being called
76690
76704
  if (isArray$1(parsedArgs) === false) {
76691
- return errorCallback(stringify$1({
76692
- message: 'expected array argument list',
76693
- }));
76705
+ return errorCallback('expected array argument list');
76694
76706
  }
76695
76707
  let methodResult = undefined;
76696
76708
  try {
@@ -76702,7 +76714,7 @@
76702
76714
  }
76703
76715
  }
76704
76716
  catch (err) {
76705
- return errorCallback(stringify$1(err));
76717
+ return errorCallback(normalizeError(err).message);
76706
76718
  }
76707
76719
  if (methodResult.then === undefined) {
76708
76720
  return resultCallback(stringify$1(methodResult));
@@ -76712,7 +76724,7 @@
76712
76724
  resultCallback(stringify$1(result));
76713
76725
  })
76714
76726
  .catch((err) => {
76715
- errorCallback(stringify$1(err));
76727
+ errorCallback(normalizeError(err).message);
76716
76728
  });
76717
76729
  },
76718
76730
  };
@@ -76772,4 +76784,4 @@
76772
76784
  Object.defineProperty(exports, '__esModule', { value: true });
76773
76785
 
76774
76786
  }));
76775
- // version: 1.136.4-be22a02bc
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.4",
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",