@salesforce/lds-worker-api 1.443.0 → 1.444.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.
@@ -1373,4 +1373,4 @@ if (process.env.NODE_ENV !== 'production') {
1373
1373
  }
1374
1374
 
1375
1375
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
1376
- // version: 1.443.0-be70f6bb6e
1376
+ // version: 1.444.0-a7f42f9edf
@@ -4148,7 +4148,7 @@ function createResourceParamsImpl(config, configMetadata) {
4148
4148
  }
4149
4149
  return resourceParams;
4150
4150
  }
4151
- // engine version: 0.160.5-e6ada846
4151
+ // engine version: 0.161.0-fe06f180
4152
4152
 
4153
4153
  /**
4154
4154
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -4276,7 +4276,7 @@ function withDefaultLuvio(callback) {
4276
4276
  }
4277
4277
  callbacks.push(callback);
4278
4278
  }
4279
- // version: 1.443.0-be70f6bb6e
4279
+ // version: 1.444.0-a7f42f9edf
4280
4280
 
4281
4281
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4282
4282
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5320,7 +5320,7 @@ function createGraphQLWireAdapterConstructor(luvio, adapter, metadata, astResolv
5320
5320
  const { apiFamily, name } = metadata;
5321
5321
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5322
5322
  }
5323
- // version: 1.443.0-be70f6bb6e
5323
+ // version: 1.444.0-a7f42f9edf
5324
5324
 
5325
5325
  function isSupportedEntity(_objectApiName) {
5326
5326
  return true;
@@ -5426,7 +5426,7 @@ var TypeCheckShapes;
5426
5426
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
5427
5427
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
5428
5428
  })(TypeCheckShapes || (TypeCheckShapes = {}));
5429
- // engine version: 0.160.5-e6ada846
5429
+ // engine version: 0.161.0-fe06f180
5430
5430
 
5431
5431
  const { keys: ObjectKeys$4, create: ObjectCreate$4 } = Object;
5432
5432
 
@@ -32538,7 +32538,7 @@ withDefaultLuvio((luvio) => {
32538
32538
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
32539
32539
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
32540
32540
  });
32541
- // version: 1.443.0-3de9a44799
32541
+ // version: 1.444.0-86f5a57eb3
32542
32542
 
32543
32543
  var allowUpdatesForNonCachedRecords = {
32544
32544
  isOpen: function (e) {
@@ -44293,7 +44293,10 @@ function deepEquals$2(x, y) {
44293
44293
  }
44294
44294
  for (let i = 0; i < xkeys.length; ++i) {
44295
44295
  const key = xkeys[i];
44296
- if (!deepEquals$2(x[key], y[key])) {
44296
+ if (!deepEquals$2(
44297
+ x[key],
44298
+ y[key]
44299
+ )) {
44297
44300
  return false;
44298
44301
  }
44299
44302
  }
@@ -48115,7 +48118,7 @@ function customActionHandler(executor, id, draftQueue) {
48115
48118
  }, result.error.type === CustomActionErrorType.NETWORK_ERROR);
48116
48119
  }
48117
48120
  };
48118
- const buildPendingAction = (action, queue) => {
48121
+ const buildPendingAction = (action, queue, observabilityContext) => {
48119
48122
  const { data, tag, targetId, handler } = action;
48120
48123
  const id = generateUniqueDraftActionId(queue.map((a) => a.id));
48121
48124
  return Promise.resolve({
@@ -48127,6 +48130,7 @@ function customActionHandler(executor, id, draftQueue) {
48127
48130
  timestamp: Date.now(),
48128
48131
  metadata: data,
48129
48132
  handler,
48133
+ observabilityContext,
48130
48134
  });
48131
48135
  };
48132
48136
  const getQueueOperationsForCompletingDrafts = (_queue, action) => {
@@ -48298,12 +48302,12 @@ class DurableDraftQueue {
48298
48302
  return aTime - bTime;
48299
48303
  });
48300
48304
  }
48301
- async enqueue(handlerId, data) {
48305
+ async enqueue(handlerId, data, observabilityContext) {
48302
48306
  return this.workerPool.push({
48303
48307
  workFn: async () => {
48304
48308
  let queue = await this.getQueueActions();
48305
48309
  const handler = this.getHandler(handlerId);
48306
- const pendingAction = (await handler.buildPendingAction(data, queue));
48310
+ const pendingAction = (await handler.buildPendingAction(data, queue, observabilityContext));
48307
48311
  await this.draftStore.writeAction(pendingAction);
48308
48312
  queue = await this.getQueueActions();
48309
48313
  await this.notifyChangedListeners({
@@ -49117,7 +49121,7 @@ class DraftManager {
49117
49121
  }
49118
49122
  buildDraftQueueItem(action) {
49119
49123
  const operationType = getOperationTypeFrom(action);
49120
- const { id, status, timestamp, targetId, metadata } = action;
49124
+ const { id, status, timestamp, targetId, metadata, observabilityContext } = action;
49121
49125
  const item = {
49122
49126
  id,
49123
49127
  targetId,
@@ -49125,6 +49129,7 @@ class DraftManager {
49125
49129
  timestamp,
49126
49130
  operationType,
49127
49131
  metadata,
49132
+ observabilityContext,
49128
49133
  };
49129
49134
  if (isDraftError(action)) {
49130
49135
  // We should always return an array, if the body is just a dictionary,
@@ -79978,10 +79983,10 @@ class AbstractResourceRequestActionHandler {
79978
79983
  // determined by Server setup.
79979
79984
  this.isIdempotencySupported = true;
79980
79985
  }
79981
- enqueue(data) {
79982
- return this.draftQueue.enqueue(this.handlerId, data);
79986
+ enqueue(data, observabilityContext) {
79987
+ return this.draftQueue.enqueue(this.handlerId, data, observabilityContext);
79983
79988
  }
79984
- async buildPendingAction(request, queue) {
79989
+ async buildPendingAction(request, queue, observabilityContext) {
79985
79990
  const targetId = await this.getIdFromRequest(request);
79986
79991
  const tag = this.buildTagForTargetId(targetId);
79987
79992
  const handlerActions = queue.filter((x) => x.handler === this.handlerId);
@@ -80001,13 +80006,16 @@ class AbstractResourceRequestActionHandler {
80001
80006
  timestamp: Date.now(),
80002
80007
  metadata: {},
80003
80008
  version: '242.0.0',
80009
+ observabilityContext,
80004
80010
  };
80005
80011
  }
80006
80012
  async handleAction(action, actionCompleted, actionErrored) {
80007
80013
  const { data: request } = action;
80008
- // no context is stored in draft action
80014
+ const dispatchOptions = action.observabilityContext !== undefined
80015
+ ? { requestCorrelator: { observabilityContext: action.observabilityContext } }
80016
+ : {};
80009
80017
  try {
80010
- const response = await this.networkAdapter(request, {});
80018
+ const response = await this.networkAdapter(request, dispatchOptions);
80011
80019
  if (response.ok) {
80012
80020
  await actionCompleted({
80013
80021
  ...action,
@@ -80287,6 +80295,17 @@ class AbstractResourceRequestActionHandler {
80287
80295
  timestamp: targetTimestamp,
80288
80296
  id: targetId,
80289
80297
  };
80298
+ // The merged action retains the target's observabilityContext, not the source's.
80299
+ // Attribution belongs to the user action that first enqueued the target draft; the
80300
+ // source's context (if any) is intentionally discarded. If the target had no context
80301
+ // when it was enqueued, the merged action has none — we do not promote the source's
80302
+ // context as a fallback.
80303
+ if (targetAction.observabilityContext !== undefined) {
80304
+ merged.observabilityContext = targetAction.observabilityContext;
80305
+ }
80306
+ else {
80307
+ delete merged.observabilityContext;
80308
+ }
80290
80309
  // overlay data
80291
80310
  // NOTE: we stick to the target's ResourceRequest properties (except body
80292
80311
  // which is merged) because we don't want to overwrite a POST with a PATCH
@@ -80434,9 +80453,9 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
80434
80453
  setSideEffectHooks(hooks) {
80435
80454
  this.sideEffectHooks = hooks;
80436
80455
  }
80437
- async buildPendingAction(request, queue) {
80456
+ async buildPendingAction(request, queue, observabilityContext) {
80438
80457
  const resolvedRequest = this.resolveResourceRequest(request);
80439
- let pendingAction = (await super.buildPendingAction(resolvedRequest, queue));
80458
+ let pendingAction = (await super.buildPendingAction(resolvedRequest, queue, observabilityContext));
80440
80459
  const { tag, targetId } = pendingAction;
80441
80460
  const targetApiName = await this.getApiNameForRecordId(targetId, tag, resolvedRequest);
80442
80461
  pendingAction.metadata[LDS_ACTION_METADATA_API_NAME] = targetApiName;
@@ -80879,10 +80898,10 @@ class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler {
80879
80898
  constructor(draftQueue, networkAdapter, getLuvio, recordService) {
80880
80899
  super(draftQueue, networkAdapter, getLuvio, recordService);
80881
80900
  }
80882
- async buildPendingAction(request, queue) {
80901
+ async buildPendingAction(request, queue, observabilityContext) {
80883
80902
  this.resolveResourceRequestBody(request.body);
80884
80903
  // eslint-disable-next-line no-return-await
80885
- return await super.buildPendingAction(request, queue);
80904
+ return await super.buildPendingAction(request, queue, observabilityContext);
80886
80905
  }
80887
80906
  resolveResourceRequestBody(body) {
80888
80907
  let contextId = body.contextId;
@@ -81492,8 +81511,8 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
81492
81511
  this.handlerId = HANDLER_ID;
81493
81512
  draftRecordService.registerRecordHandler(this);
81494
81513
  }
81495
- async buildPendingAction(request, queue) {
81496
- const pendingAction = (await super.buildPendingAction(request, queue));
81514
+ async buildPendingAction(request, queue, observabilityContext) {
81515
+ const pendingAction = (await super.buildPendingAction(request, queue, observabilityContext));
81497
81516
  const { targetId } = pendingAction;
81498
81517
  // remember ContentDocument ID
81499
81518
  pendingAction.metadata[CONTENT_DOCUMENT_DRAFT_ID_KEY] = targetId;
@@ -89699,12 +89718,16 @@ function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink
89699
89718
  * to a concrete implementation running in jscore.
89700
89719
  */
89701
89720
  class NimbusDraftQueue {
89702
- enqueue(handlerId, data) {
89721
+ enqueue(handlerId, data, observabilityContext) {
89703
89722
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
89704
89723
  if (callProxyMethod === undefined) {
89705
89724
  return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
89706
89725
  }
89707
- const serializedAction = stringify$5([handlerId, data]);
89726
+ const args = [handlerId, data];
89727
+ if (observabilityContext !== undefined) {
89728
+ args.push(observabilityContext);
89729
+ }
89730
+ const serializedAction = stringify$5(args);
89708
89731
  return new Promise((resolve, reject) => {
89709
89732
  callProxyMethod('enqueue', serializedAction, (serializedActionResponse) => {
89710
89733
  const response = parse$5(serializedActionResponse);
@@ -94229,7 +94252,10 @@ function deepEquals$1(x, y) {
94229
94252
  }
94230
94253
  for (let i = 0; i < xkeys.length; ++i) {
94231
94254
  const key = xkeys[i];
94232
- if (!deepEquals$1(x[key], y[key])) {
94255
+ if (!deepEquals$1(
94256
+ x[key],
94257
+ y[key]
94258
+ )) {
94233
94259
  return false;
94234
94260
  }
94235
94261
  }
@@ -94299,6 +94325,19 @@ var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
94299
94325
  HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
94300
94326
  return HttpStatusCode2;
94301
94327
  })(HttpStatusCode || {});
94328
+ function getFetchResponseFromAuraError(err2) {
94329
+ if (err2.data !== void 0 && err2.data.statusCode !== void 0) {
94330
+ let data = {};
94331
+ data = err2.data;
94332
+ if (err2.id !== void 0) {
94333
+ data.id = err2.id;
94334
+ }
94335
+ return new FetchResponse(data.statusCode, data);
94336
+ }
94337
+ return new FetchResponse(500, {
94338
+ error: err2.message
94339
+ });
94340
+ }
94302
94341
  function getStatusText(status) {
94303
94342
  switch (status) {
94304
94343
  case 200:
@@ -94440,7 +94479,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
94440
94479
  );
94441
94480
  }
94442
94481
  coerceAuraErrors(auraErrors) {
94443
- return toError(auraErrors[0]);
94482
+ return new UserVisibleError(getFetchResponseFromAuraError(auraErrors[0]));
94444
94483
  }
94445
94484
  /**
94446
94485
  * Customize how non-2xx fetch fallback responses are converted into errors.
@@ -94625,7 +94664,10 @@ function deepEquals(x, y) {
94625
94664
  }
94626
94665
  for (let i = 0; i < xkeys.length; ++i) {
94627
94666
  const key = xkeys[i];
94628
- if (!deepEquals(x[key], y[key])) {
94667
+ if (!deepEquals(
94668
+ x[key],
94669
+ y[key]
94670
+ )) {
94629
94671
  return false;
94630
94672
  }
94631
94673
  }
@@ -96528,7 +96570,7 @@ function buildServiceDescriptor$b(luvio) {
96528
96570
  },
96529
96571
  };
96530
96572
  }
96531
- // version: 1.443.0-be70f6bb6e
96573
+ // version: 1.444.0-a7f42f9edf
96532
96574
 
96533
96575
  /**
96534
96576
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96554,7 +96596,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
96554
96596
  },
96555
96597
  };
96556
96598
  }
96557
- // version: 1.443.0-be70f6bb6e
96599
+ // version: 1.444.0-a7f42f9edf
96558
96600
 
96559
96601
  function findExecutableOperation$1(input) {
96560
96602
  const operations = input.query.definitions.filter(
@@ -97594,7 +97636,10 @@ class GraphQLImperativeBindingsService {
97594
97636
  const options = {
97595
97637
  acceptedOperations: ["query"]
97596
97638
  };
97597
- const result = resolveAndValidateGraphQLConfig(params[0], options);
97639
+ const result = resolveAndValidateGraphQLConfig(
97640
+ params[0],
97641
+ options
97642
+ );
97598
97643
  if (result?.isErr()) {
97599
97644
  return result.error;
97600
97645
  }
@@ -97791,7 +97836,10 @@ class GraphQLMutationBindingsService {
97791
97836
  const options = {
97792
97837
  acceptedOperations: ["mutation"]
97793
97838
  };
97794
- const result2 = resolveAndValidateGraphQLConfig(params[0], options);
97839
+ const result2 = resolveAndValidateGraphQLConfig(
97840
+ params[0],
97841
+ options
97842
+ );
97795
97843
  if (result2?.isErr()) {
97796
97844
  return {
97797
97845
  data: void 0,
@@ -99231,7 +99279,7 @@ register$1({
99231
99279
  id: '@salesforce/lds-network-adapter',
99232
99280
  instrument: instrument$2,
99233
99281
  });
99234
- // version: 1.443.0-be70f6bb6e
99282
+ // version: 1.444.0-a7f42f9edf
99235
99283
 
99236
99284
  const { create: create$2, keys: keys$2 } = Object;
99237
99285
  const { stringify, parse } = JSON;
@@ -106714,7 +106762,7 @@ function registerCallback(cb) {
106714
106762
  cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
106715
106763
  }
106716
106764
  }
106717
- // version: 1.443.0-3de9a44799
106765
+ // version: 1.444.0-86f5a57eb3
106718
106766
 
106719
106767
  function createFragmentMap(documentNode) {
106720
106768
  const fragments = {};
@@ -135921,7 +135969,7 @@ register$1({
135921
135969
  configuration: { ...configurationForGraphQLAdapters$1 },
135922
135970
  instrument: instrument$1,
135923
135971
  });
135924
- // version: 1.443.0-3de9a44799
135972
+ // version: 1.444.0-86f5a57eb3
135925
135973
 
135926
135974
  // On core the unstable adapters are re-exported with different names,
135927
135975
  // we want to match them here.
@@ -136073,7 +136121,7 @@ withDefaultLuvio((luvio) => {
136073
136121
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
136074
136122
  graphQLImperative = ldsAdapter;
136075
136123
  });
136076
- // version: 1.443.0-3de9a44799
136124
+ // version: 1.444.0-86f5a57eb3
136077
136125
 
136078
136126
  var gqlApi = /*#__PURE__*/Object.freeze({
136079
136127
  __proto__: null,
@@ -136872,7 +136920,7 @@ const callbacks$1 = [];
136872
136920
  function register(r) {
136873
136921
  callbacks$1.forEach((callback) => callback(r));
136874
136922
  }
136875
- // version: 1.443.0-be70f6bb6e
136923
+ // version: 1.444.0-a7f42f9edf
136876
136924
 
136877
136925
  /**
136878
136926
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -138161,4 +138209,4 @@ const { luvio } = getRuntime();
138161
138209
  setDefaultLuvio({ luvio });
138162
138210
 
138163
138211
  export { createPrimingSession, draftManager, draftQueue, evictCacheRecordsByIds, evictExpiredCacheEntries, executeAdapter, executeMutatingAdapter, getImperativeAdapterNames, importLuvioAdapterModule, importOneStoreAdapterModule, invokeAdapter, invokeAdapterWithDraftToMerge, invokeAdapterWithDraftToReplace, invokeAdapterWithMetadata, nimbusDraftQueue, registerReportObserver, setMetadataTTL, setUiApiRecordTTL, stopEviction, subscribeToAdapter };
138164
- // version: 1.443.0-be70f6bb6e
138212
+ // version: 1.444.0-a7f42f9edf
@@ -4154,7 +4154,7 @@
4154
4154
  }
4155
4155
  return resourceParams;
4156
4156
  }
4157
- // engine version: 0.160.5-e6ada846
4157
+ // engine version: 0.161.0-fe06f180
4158
4158
 
4159
4159
  /**
4160
4160
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -4282,7 +4282,7 @@
4282
4282
  }
4283
4283
  callbacks.push(callback);
4284
4284
  }
4285
- // version: 1.443.0-be70f6bb6e
4285
+ // version: 1.444.0-a7f42f9edf
4286
4286
 
4287
4287
  // TODO [TD-0081508]: once that TD is fulfilled we can probably change this file
4288
4288
  function instrumentAdapter$1(createFunction, _metadata) {
@@ -5326,7 +5326,7 @@
5326
5326
  const { apiFamily, name } = metadata;
5327
5327
  return createGraphQLWireAdapterConstructor$1(adapter, `${apiFamily}.${name}`, luvio, astResolver);
5328
5328
  }
5329
- // version: 1.443.0-be70f6bb6e
5329
+ // version: 1.444.0-a7f42f9edf
5330
5330
 
5331
5331
  function isSupportedEntity(_objectApiName) {
5332
5332
  return true;
@@ -5432,7 +5432,7 @@
5432
5432
  TypeCheckShapes[TypeCheckShapes["Integer"] = 3] = "Integer";
5433
5433
  TypeCheckShapes[TypeCheckShapes["Unsupported"] = 4] = "Unsupported";
5434
5434
  })(TypeCheckShapes || (TypeCheckShapes = {}));
5435
- // engine version: 0.160.5-e6ada846
5435
+ // engine version: 0.161.0-fe06f180
5436
5436
 
5437
5437
  const { keys: ObjectKeys$4, create: ObjectCreate$4 } = Object;
5438
5438
 
@@ -32544,7 +32544,7 @@
32544
32544
  throttle(60, 60000, setupNotifyAllListRecordUpdateAvailable(luvio));
32545
32545
  throttle(60, 60000, setupNotifyAllListInfoSummaryUpdateAvailable(luvio));
32546
32546
  });
32547
- // version: 1.443.0-3de9a44799
32547
+ // version: 1.444.0-86f5a57eb3
32548
32548
 
32549
32549
  var allowUpdatesForNonCachedRecords = {
32550
32550
  isOpen: function (e) {
@@ -44299,7 +44299,10 @@
44299
44299
  }
44300
44300
  for (let i = 0; i < xkeys.length; ++i) {
44301
44301
  const key = xkeys[i];
44302
- if (!deepEquals$2(x[key], y[key])) {
44302
+ if (!deepEquals$2(
44303
+ x[key],
44304
+ y[key]
44305
+ )) {
44303
44306
  return false;
44304
44307
  }
44305
44308
  }
@@ -48121,7 +48124,7 @@
48121
48124
  }, result.error.type === CustomActionErrorType.NETWORK_ERROR);
48122
48125
  }
48123
48126
  };
48124
- const buildPendingAction = (action, queue) => {
48127
+ const buildPendingAction = (action, queue, observabilityContext) => {
48125
48128
  const { data, tag, targetId, handler } = action;
48126
48129
  const id = generateUniqueDraftActionId(queue.map((a) => a.id));
48127
48130
  return Promise.resolve({
@@ -48133,6 +48136,7 @@
48133
48136
  timestamp: Date.now(),
48134
48137
  metadata: data,
48135
48138
  handler,
48139
+ observabilityContext,
48136
48140
  });
48137
48141
  };
48138
48142
  const getQueueOperationsForCompletingDrafts = (_queue, action) => {
@@ -48304,12 +48308,12 @@
48304
48308
  return aTime - bTime;
48305
48309
  });
48306
48310
  }
48307
- async enqueue(handlerId, data) {
48311
+ async enqueue(handlerId, data, observabilityContext) {
48308
48312
  return this.workerPool.push({
48309
48313
  workFn: async () => {
48310
48314
  let queue = await this.getQueueActions();
48311
48315
  const handler = this.getHandler(handlerId);
48312
- const pendingAction = (await handler.buildPendingAction(data, queue));
48316
+ const pendingAction = (await handler.buildPendingAction(data, queue, observabilityContext));
48313
48317
  await this.draftStore.writeAction(pendingAction);
48314
48318
  queue = await this.getQueueActions();
48315
48319
  await this.notifyChangedListeners({
@@ -49123,7 +49127,7 @@
49123
49127
  }
49124
49128
  buildDraftQueueItem(action) {
49125
49129
  const operationType = getOperationTypeFrom(action);
49126
- const { id, status, timestamp, targetId, metadata } = action;
49130
+ const { id, status, timestamp, targetId, metadata, observabilityContext } = action;
49127
49131
  const item = {
49128
49132
  id,
49129
49133
  targetId,
@@ -49131,6 +49135,7 @@
49131
49135
  timestamp,
49132
49136
  operationType,
49133
49137
  metadata,
49138
+ observabilityContext,
49134
49139
  };
49135
49140
  if (isDraftError(action)) {
49136
49141
  // We should always return an array, if the body is just a dictionary,
@@ -79984,10 +79989,10 @@
79984
79989
  // determined by Server setup.
79985
79990
  this.isIdempotencySupported = true;
79986
79991
  }
79987
- enqueue(data) {
79988
- return this.draftQueue.enqueue(this.handlerId, data);
79992
+ enqueue(data, observabilityContext) {
79993
+ return this.draftQueue.enqueue(this.handlerId, data, observabilityContext);
79989
79994
  }
79990
- async buildPendingAction(request, queue) {
79995
+ async buildPendingAction(request, queue, observabilityContext) {
79991
79996
  const targetId = await this.getIdFromRequest(request);
79992
79997
  const tag = this.buildTagForTargetId(targetId);
79993
79998
  const handlerActions = queue.filter((x) => x.handler === this.handlerId);
@@ -80007,13 +80012,16 @@
80007
80012
  timestamp: Date.now(),
80008
80013
  metadata: {},
80009
80014
  version: '242.0.0',
80015
+ observabilityContext,
80010
80016
  };
80011
80017
  }
80012
80018
  async handleAction(action, actionCompleted, actionErrored) {
80013
80019
  const { data: request } = action;
80014
- // no context is stored in draft action
80020
+ const dispatchOptions = action.observabilityContext !== undefined
80021
+ ? { requestCorrelator: { observabilityContext: action.observabilityContext } }
80022
+ : {};
80015
80023
  try {
80016
- const response = await this.networkAdapter(request, {});
80024
+ const response = await this.networkAdapter(request, dispatchOptions);
80017
80025
  if (response.ok) {
80018
80026
  await actionCompleted({
80019
80027
  ...action,
@@ -80293,6 +80301,17 @@
80293
80301
  timestamp: targetTimestamp,
80294
80302
  id: targetId,
80295
80303
  };
80304
+ // The merged action retains the target's observabilityContext, not the source's.
80305
+ // Attribution belongs to the user action that first enqueued the target draft; the
80306
+ // source's context (if any) is intentionally discarded. If the target had no context
80307
+ // when it was enqueued, the merged action has none — we do not promote the source's
80308
+ // context as a fallback.
80309
+ if (targetAction.observabilityContext !== undefined) {
80310
+ merged.observabilityContext = targetAction.observabilityContext;
80311
+ }
80312
+ else {
80313
+ delete merged.observabilityContext;
80314
+ }
80296
80315
  // overlay data
80297
80316
  // NOTE: we stick to the target's ResourceRequest properties (except body
80298
80317
  // which is merged) because we don't want to overwrite a POST with a PATCH
@@ -80440,9 +80459,9 @@
80440
80459
  setSideEffectHooks(hooks) {
80441
80460
  this.sideEffectHooks = hooks;
80442
80461
  }
80443
- async buildPendingAction(request, queue) {
80462
+ async buildPendingAction(request, queue, observabilityContext) {
80444
80463
  const resolvedRequest = this.resolveResourceRequest(request);
80445
- let pendingAction = (await super.buildPendingAction(resolvedRequest, queue));
80464
+ let pendingAction = (await super.buildPendingAction(resolvedRequest, queue, observabilityContext));
80446
80465
  const { tag, targetId } = pendingAction;
80447
80466
  const targetApiName = await this.getApiNameForRecordId(targetId, tag, resolvedRequest);
80448
80467
  pendingAction.metadata[LDS_ACTION_METADATA_API_NAME] = targetApiName;
@@ -80885,10 +80904,10 @@
80885
80904
  constructor(draftQueue, networkAdapter, getLuvio, recordService) {
80886
80905
  super(draftQueue, networkAdapter, getLuvio, recordService);
80887
80906
  }
80888
- async buildPendingAction(request, queue) {
80907
+ async buildPendingAction(request, queue, observabilityContext) {
80889
80908
  this.resolveResourceRequestBody(request.body);
80890
80909
  // eslint-disable-next-line no-return-await
80891
- return await super.buildPendingAction(request, queue);
80910
+ return await super.buildPendingAction(request, queue, observabilityContext);
80892
80911
  }
80893
80912
  resolveResourceRequestBody(body) {
80894
80913
  let contextId = body.contextId;
@@ -81498,8 +81517,8 @@
81498
81517
  this.handlerId = HANDLER_ID;
81499
81518
  draftRecordService.registerRecordHandler(this);
81500
81519
  }
81501
- async buildPendingAction(request, queue) {
81502
- const pendingAction = (await super.buildPendingAction(request, queue));
81520
+ async buildPendingAction(request, queue, observabilityContext) {
81521
+ const pendingAction = (await super.buildPendingAction(request, queue, observabilityContext));
81503
81522
  const { targetId } = pendingAction;
81504
81523
  // remember ContentDocument ID
81505
81524
  pendingAction.metadata[CONTENT_DOCUMENT_DRAFT_ID_KEY] = targetId;
@@ -89705,12 +89724,16 @@
89705
89724
  * to a concrete implementation running in jscore.
89706
89725
  */
89707
89726
  class NimbusDraftQueue {
89708
- enqueue(handlerId, data) {
89727
+ enqueue(handlerId, data, observabilityContext) {
89709
89728
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
89710
89729
  if (callProxyMethod === undefined) {
89711
89730
  return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
89712
89731
  }
89713
- const serializedAction = stringify$5([handlerId, data]);
89732
+ const args = [handlerId, data];
89733
+ if (observabilityContext !== undefined) {
89734
+ args.push(observabilityContext);
89735
+ }
89736
+ const serializedAction = stringify$5(args);
89714
89737
  return new Promise((resolve, reject) => {
89715
89738
  callProxyMethod('enqueue', serializedAction, (serializedActionResponse) => {
89716
89739
  const response = parse$5(serializedActionResponse);
@@ -94235,7 +94258,10 @@
94235
94258
  }
94236
94259
  for (let i = 0; i < xkeys.length; ++i) {
94237
94260
  const key = xkeys[i];
94238
- if (!deepEquals$1(x[key], y[key])) {
94261
+ if (!deepEquals$1(
94262
+ x[key],
94263
+ y[key]
94264
+ )) {
94239
94265
  return false;
94240
94266
  }
94241
94267
  }
@@ -94305,6 +94331,19 @@
94305
94331
  HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
94306
94332
  return HttpStatusCode2;
94307
94333
  })(HttpStatusCode || {});
94334
+ function getFetchResponseFromAuraError(err2) {
94335
+ if (err2.data !== void 0 && err2.data.statusCode !== void 0) {
94336
+ let data = {};
94337
+ data = err2.data;
94338
+ if (err2.id !== void 0) {
94339
+ data.id = err2.id;
94340
+ }
94341
+ return new FetchResponse(data.statusCode, data);
94342
+ }
94343
+ return new FetchResponse(500, {
94344
+ error: err2.message
94345
+ });
94346
+ }
94308
94347
  function getStatusText(status) {
94309
94348
  switch (status) {
94310
94349
  case 200:
@@ -94446,7 +94485,7 @@
94446
94485
  );
94447
94486
  }
94448
94487
  coerceAuraErrors(auraErrors) {
94449
- return toError(auraErrors[0]);
94488
+ return new UserVisibleError(getFetchResponseFromAuraError(auraErrors[0]));
94450
94489
  }
94451
94490
  /**
94452
94491
  * Customize how non-2xx fetch fallback responses are converted into errors.
@@ -94631,7 +94670,10 @@
94631
94670
  }
94632
94671
  for (let i = 0; i < xkeys.length; ++i) {
94633
94672
  const key = xkeys[i];
94634
- if (!deepEquals(x[key], y[key])) {
94673
+ if (!deepEquals(
94674
+ x[key],
94675
+ y[key]
94676
+ )) {
94635
94677
  return false;
94636
94678
  }
94637
94679
  }
@@ -96534,7 +96576,7 @@
96534
96576
  },
96535
96577
  };
96536
96578
  }
96537
- // version: 1.443.0-be70f6bb6e
96579
+ // version: 1.444.0-a7f42f9edf
96538
96580
 
96539
96581
  /**
96540
96582
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -96560,7 +96602,7 @@
96560
96602
  },
96561
96603
  };
96562
96604
  }
96563
- // version: 1.443.0-be70f6bb6e
96605
+ // version: 1.444.0-a7f42f9edf
96564
96606
 
96565
96607
  function findExecutableOperation$1(input) {
96566
96608
  const operations = input.query.definitions.filter(
@@ -97600,7 +97642,10 @@
97600
97642
  const options = {
97601
97643
  acceptedOperations: ["query"]
97602
97644
  };
97603
- const result = resolveAndValidateGraphQLConfig(params[0], options);
97645
+ const result = resolveAndValidateGraphQLConfig(
97646
+ params[0],
97647
+ options
97648
+ );
97604
97649
  if (result?.isErr()) {
97605
97650
  return result.error;
97606
97651
  }
@@ -97797,7 +97842,10 @@
97797
97842
  const options = {
97798
97843
  acceptedOperations: ["mutation"]
97799
97844
  };
97800
- const result2 = resolveAndValidateGraphQLConfig(params[0], options);
97845
+ const result2 = resolveAndValidateGraphQLConfig(
97846
+ params[0],
97847
+ options
97848
+ );
97801
97849
  if (result2?.isErr()) {
97802
97850
  return {
97803
97851
  data: void 0,
@@ -99237,7 +99285,7 @@
99237
99285
  id: '@salesforce/lds-network-adapter',
99238
99286
  instrument: instrument$2,
99239
99287
  });
99240
- // version: 1.443.0-be70f6bb6e
99288
+ // version: 1.444.0-a7f42f9edf
99241
99289
 
99242
99290
  const { create: create$2, keys: keys$2 } = Object;
99243
99291
  const { stringify, parse } = JSON;
@@ -106720,7 +106768,7 @@
106720
106768
  cb(graphql_v1_import, graphql_imperative$1, graphql_imperative_legacy_v1_import, graphql_state_manager, useOneStoreGraphQL);
106721
106769
  }
106722
106770
  }
106723
- // version: 1.443.0-3de9a44799
106771
+ // version: 1.444.0-86f5a57eb3
106724
106772
 
106725
106773
  function createFragmentMap(documentNode) {
106726
106774
  const fragments = {};
@@ -135927,7 +135975,7 @@
135927
135975
  configuration: { ...configurationForGraphQLAdapters$1 },
135928
135976
  instrument: instrument$1,
135929
135977
  });
135930
- // version: 1.443.0-3de9a44799
135978
+ // version: 1.444.0-86f5a57eb3
135931
135979
 
135932
135980
  // On core the unstable adapters are re-exported with different names,
135933
135981
  // we want to match them here.
@@ -136079,7 +136127,7 @@
136079
136127
  unstable_graphQL_imperative = createImperativeAdapter(luvio, createInstrumentedAdapter(ldsAdapter, adapterMetadata), adapterMetadata);
136080
136128
  graphQLImperative = ldsAdapter;
136081
136129
  });
136082
- // version: 1.443.0-3de9a44799
136130
+ // version: 1.444.0-86f5a57eb3
136083
136131
 
136084
136132
  var gqlApi = /*#__PURE__*/Object.freeze({
136085
136133
  __proto__: null,
@@ -136878,7 +136926,7 @@
136878
136926
  function register(r) {
136879
136927
  callbacks$1.forEach((callback) => callback(r));
136880
136928
  }
136881
- // version: 1.443.0-be70f6bb6e
136929
+ // version: 1.444.0-a7f42f9edf
136882
136930
 
136883
136931
  /**
136884
136932
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -138188,4 +138236,4 @@
138188
138236
  exports.subscribeToAdapter = subscribeToAdapter;
138189
138237
 
138190
138238
  }));
138191
- // version: 1.443.0-be70f6bb6e
138239
+ // version: 1.444.0-a7f42f9edf
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-worker-api",
3
- "version": "1.443.0",
3
+ "version": "1.444.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "",
6
6
  "main": "dist/standalone/es/lds-worker-api.js",
@@ -35,14 +35,14 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
38
- "@salesforce/lds-adapters-graphql": "^1.443.0",
39
- "@salesforce/lds-adapters-uiapi": "^1.443.0",
40
- "@salesforce/lds-default-luvio": "^1.443.0",
41
- "@salesforce/lds-drafts": "^1.443.0",
42
- "@salesforce/lds-graphql-parser": "^1.443.0",
43
- "@salesforce/lds-luvio-engine": "^1.443.0",
44
- "@salesforce/lds-runtime-mobile": "^1.443.0",
45
- "@salesforce/nimbus-plugin-lds": "^1.443.0",
38
+ "@salesforce/lds-adapters-graphql": "^1.444.0",
39
+ "@salesforce/lds-adapters-uiapi": "^1.444.0",
40
+ "@salesforce/lds-default-luvio": "^1.444.0",
41
+ "@salesforce/lds-drafts": "^1.444.0",
42
+ "@salesforce/lds-graphql-parser": "^1.444.0",
43
+ "@salesforce/lds-luvio-engine": "^1.444.0",
44
+ "@salesforce/lds-runtime-mobile": "^1.444.0",
45
+ "@salesforce/nimbus-plugin-lds": "^1.444.0",
46
46
  "ajv": "^8.11.0",
47
47
  "glob": "^7.1.5",
48
48
  "nimbus-types": "^2.0.0-alpha1",