@salesforce/lds-runtime-mobile 1.442.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.
package/dist/main.js CHANGED
@@ -2297,7 +2297,7 @@ function customActionHandler(executor, id, draftQueue) {
2297
2297
  }, result.error.type === CustomActionErrorType.NETWORK_ERROR);
2298
2298
  }
2299
2299
  };
2300
- const buildPendingAction = (action, queue) => {
2300
+ const buildPendingAction = (action, queue, observabilityContext) => {
2301
2301
  const { data, tag, targetId, handler } = action;
2302
2302
  const id = generateUniqueDraftActionId(queue.map((a) => a.id));
2303
2303
  return Promise.resolve({
@@ -2309,6 +2309,7 @@ function customActionHandler(executor, id, draftQueue) {
2309
2309
  timestamp: Date.now(),
2310
2310
  metadata: data,
2311
2311
  handler,
2312
+ observabilityContext,
2312
2313
  });
2313
2314
  };
2314
2315
  const getQueueOperationsForCompletingDrafts = (_queue, action) => {
@@ -2480,12 +2481,12 @@ class DurableDraftQueue {
2480
2481
  return aTime - bTime;
2481
2482
  });
2482
2483
  }
2483
- async enqueue(handlerId, data) {
2484
+ async enqueue(handlerId, data, observabilityContext) {
2484
2485
  return this.workerPool.push({
2485
2486
  workFn: async () => {
2486
2487
  let queue = await this.getQueueActions();
2487
2488
  const handler = this.getHandler(handlerId);
2488
- const pendingAction = (await handler.buildPendingAction(data, queue));
2489
+ const pendingAction = (await handler.buildPendingAction(data, queue, observabilityContext));
2489
2490
  await this.draftStore.writeAction(pendingAction);
2490
2491
  queue = await this.getQueueActions();
2491
2492
  await this.notifyChangedListeners({
@@ -3307,7 +3308,7 @@ class DraftManager {
3307
3308
  }
3308
3309
  buildDraftQueueItem(action) {
3309
3310
  const operationType = getOperationTypeFrom(action);
3310
- const { id, status, timestamp, targetId, metadata } = action;
3311
+ const { id, status, timestamp, targetId, metadata, observabilityContext } = action;
3311
3312
  const item = {
3312
3313
  id,
3313
3314
  targetId,
@@ -3315,6 +3316,7 @@ class DraftManager {
3315
3316
  timestamp,
3316
3317
  operationType,
3317
3318
  metadata,
3319
+ observabilityContext,
3318
3320
  };
3319
3321
  if (isDraftError(action)) {
3320
3322
  // We should always return an array, if the body is just a dictionary,
@@ -42180,10 +42182,10 @@ class AbstractResourceRequestActionHandler {
42180
42182
  // determined by Server setup.
42181
42183
  this.isIdempotencySupported = true;
42182
42184
  }
42183
- enqueue(data) {
42184
- return this.draftQueue.enqueue(this.handlerId, data);
42185
+ enqueue(data, observabilityContext) {
42186
+ return this.draftQueue.enqueue(this.handlerId, data, observabilityContext);
42185
42187
  }
42186
- async buildPendingAction(request, queue) {
42188
+ async buildPendingAction(request, queue, observabilityContext) {
42187
42189
  const targetId = await this.getIdFromRequest(request);
42188
42190
  const tag = this.buildTagForTargetId(targetId);
42189
42191
  const handlerActions = queue.filter((x) => x.handler === this.handlerId);
@@ -42203,13 +42205,16 @@ class AbstractResourceRequestActionHandler {
42203
42205
  timestamp: Date.now(),
42204
42206
  metadata: {},
42205
42207
  version: '242.0.0',
42208
+ observabilityContext,
42206
42209
  };
42207
42210
  }
42208
42211
  async handleAction(action, actionCompleted, actionErrored) {
42209
42212
  const { data: request } = action;
42210
- // no context is stored in draft action
42213
+ const dispatchOptions = action.observabilityContext !== undefined
42214
+ ? { requestCorrelator: { observabilityContext: action.observabilityContext } }
42215
+ : {};
42211
42216
  try {
42212
- const response = await this.networkAdapter(request, {});
42217
+ const response = await this.networkAdapter(request, dispatchOptions);
42213
42218
  if (response.ok) {
42214
42219
  await actionCompleted({
42215
42220
  ...action,
@@ -42489,6 +42494,17 @@ class AbstractResourceRequestActionHandler {
42489
42494
  timestamp: targetTimestamp,
42490
42495
  id: targetId,
42491
42496
  };
42497
+ // The merged action retains the target's observabilityContext, not the source's.
42498
+ // Attribution belongs to the user action that first enqueued the target draft; the
42499
+ // source's context (if any) is intentionally discarded. If the target had no context
42500
+ // when it was enqueued, the merged action has none — we do not promote the source's
42501
+ // context as a fallback.
42502
+ if (targetAction.observabilityContext !== undefined) {
42503
+ merged.observabilityContext = targetAction.observabilityContext;
42504
+ }
42505
+ else {
42506
+ delete merged.observabilityContext;
42507
+ }
42492
42508
  // overlay data
42493
42509
  // NOTE: we stick to the target's ResourceRequest properties (except body
42494
42510
  // which is merged) because we don't want to overwrite a POST with a PATCH
@@ -42636,9 +42652,9 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
42636
42652
  setSideEffectHooks(hooks) {
42637
42653
  this.sideEffectHooks = hooks;
42638
42654
  }
42639
- async buildPendingAction(request, queue) {
42655
+ async buildPendingAction(request, queue, observabilityContext) {
42640
42656
  const resolvedRequest = this.resolveResourceRequest(request);
42641
- let pendingAction = (await super.buildPendingAction(resolvedRequest, queue));
42657
+ let pendingAction = (await super.buildPendingAction(resolvedRequest, queue, observabilityContext));
42642
42658
  const { tag, targetId } = pendingAction;
42643
42659
  const targetApiName = await this.getApiNameForRecordId(targetId, tag, resolvedRequest);
42644
42660
  pendingAction.metadata[LDS_ACTION_METADATA_API_NAME] = targetApiName;
@@ -43081,10 +43097,10 @@ class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler {
43081
43097
  constructor(draftQueue, networkAdapter, getLuvio, recordService) {
43082
43098
  super(draftQueue, networkAdapter, getLuvio, recordService);
43083
43099
  }
43084
- async buildPendingAction(request, queue) {
43100
+ async buildPendingAction(request, queue, observabilityContext) {
43085
43101
  this.resolveResourceRequestBody(request.body);
43086
43102
  // eslint-disable-next-line no-return-await
43087
- return await super.buildPendingAction(request, queue);
43103
+ return await super.buildPendingAction(request, queue, observabilityContext);
43088
43104
  }
43089
43105
  resolveResourceRequestBody(body) {
43090
43106
  let contextId = body.contextId;
@@ -43701,8 +43717,8 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
43701
43717
  this.handlerId = HANDLER_ID;
43702
43718
  draftRecordService.registerRecordHandler(this);
43703
43719
  }
43704
- async buildPendingAction(request, queue) {
43705
- const pendingAction = (await super.buildPendingAction(request, queue));
43720
+ async buildPendingAction(request, queue, observabilityContext) {
43721
+ const pendingAction = (await super.buildPendingAction(request, queue, observabilityContext));
43706
43722
  const { targetId } = pendingAction;
43707
43723
  // remember ContentDocument ID
43708
43724
  pendingAction.metadata[CONTENT_DOCUMENT_DRAFT_ID_KEY] = targetId;
@@ -51909,12 +51925,16 @@ function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink
51909
51925
  * to a concrete implementation running in jscore.
51910
51926
  */
51911
51927
  class NimbusDraftQueue {
51912
- enqueue(handlerId, data) {
51928
+ enqueue(handlerId, data, observabilityContext) {
51913
51929
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
51914
51930
  if (callProxyMethod === undefined) {
51915
51931
  return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
51916
51932
  }
51917
- const serializedAction = stringify$5([handlerId, data]);
51933
+ const args = [handlerId, data];
51934
+ if (observabilityContext !== undefined) {
51935
+ args.push(observabilityContext);
51936
+ }
51937
+ const serializedAction = stringify$5(args);
51918
51938
  return new Promise((resolve, reject) => {
51919
51939
  callProxyMethod('enqueue', serializedAction, (serializedActionResponse) => {
51920
51940
  const response = parse$5(serializedActionResponse);
@@ -56587,7 +56607,10 @@ function deepEquals$1(x, y) {
56587
56607
  }
56588
56608
  for (let i = 0; i < xkeys.length; ++i) {
56589
56609
  const key = xkeys[i];
56590
- if (!deepEquals$1(x[key], y[key])) {
56610
+ if (!deepEquals$1(
56611
+ x[key],
56612
+ y[key]
56613
+ )) {
56591
56614
  return false;
56592
56615
  }
56593
56616
  }
@@ -56657,6 +56680,19 @@ var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
56657
56680
  HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
56658
56681
  return HttpStatusCode2;
56659
56682
  })(HttpStatusCode || {});
56683
+ function getFetchResponseFromAuraError(err2) {
56684
+ if (err2.data !== void 0 && err2.data.statusCode !== void 0) {
56685
+ let data = {};
56686
+ data = err2.data;
56687
+ if (err2.id !== void 0) {
56688
+ data.id = err2.id;
56689
+ }
56690
+ return new FetchResponse(data.statusCode, data);
56691
+ }
56692
+ return new FetchResponse(500, {
56693
+ error: err2.message
56694
+ });
56695
+ }
56660
56696
  function getStatusText(status) {
56661
56697
  switch (status) {
56662
56698
  case 200:
@@ -56798,7 +56834,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
56798
56834
  );
56799
56835
  }
56800
56836
  coerceAuraErrors(auraErrors) {
56801
- return toError(auraErrors[0]);
56837
+ return new UserVisibleError(getFetchResponseFromAuraError(auraErrors[0]));
56802
56838
  }
56803
56839
  /**
56804
56840
  * Customize how non-2xx fetch fallback responses are converted into errors.
@@ -56983,7 +57019,10 @@ function deepEquals(x, y) {
56983
57019
  }
56984
57020
  for (let i = 0; i < xkeys.length; ++i) {
56985
57021
  const key = xkeys[i];
56986
- if (!deepEquals(x[key], y[key])) {
57022
+ if (!deepEquals(
57023
+ x[key],
57024
+ y[key]
57025
+ )) {
56987
57026
  return false;
56988
57027
  }
56989
57028
  }
@@ -58902,7 +58941,7 @@ function buildServiceDescriptor$b(luvio) {
58902
58941
  },
58903
58942
  };
58904
58943
  }
58905
- // version: 1.442.0-e47893165a
58944
+ // version: 1.444.0-a7f42f9edf
58906
58945
 
58907
58946
  /**
58908
58947
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -58928,7 +58967,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
58928
58967
  },
58929
58968
  };
58930
58969
  }
58931
- // version: 1.442.0-e47893165a
58970
+ // version: 1.444.0-a7f42f9edf
58932
58971
 
58933
58972
  function findExecutableOperation(input) {
58934
58973
  const operations = input.query.definitions.filter(
@@ -59968,7 +60007,10 @@ class GraphQLImperativeBindingsService {
59968
60007
  const options = {
59969
60008
  acceptedOperations: ["query"]
59970
60009
  };
59971
- const result = resolveAndValidateGraphQLConfig(params[0], options);
60010
+ const result = resolveAndValidateGraphQLConfig(
60011
+ params[0],
60012
+ options
60013
+ );
59972
60014
  if (result?.isErr()) {
59973
60015
  return result.error;
59974
60016
  }
@@ -60165,7 +60207,10 @@ class GraphQLMutationBindingsService {
60165
60207
  const options = {
60166
60208
  acceptedOperations: ["mutation"]
60167
60209
  };
60168
- const result2 = resolveAndValidateGraphQLConfig(params[0], options);
60210
+ const result2 = resolveAndValidateGraphQLConfig(
60211
+ params[0],
60212
+ options
60213
+ );
60169
60214
  if (result2?.isErr()) {
60170
60215
  return {
60171
60216
  data: void 0,
@@ -61608,4 +61653,4 @@ register({
61608
61653
  });
61609
61654
 
61610
61655
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, initializeOneStore, registerReportObserver, reportGraphqlQueryParseError };
61611
- // version: 1.442.0-e47893165a
61656
+ // version: 1.444.0-a7f42f9edf
@@ -1,4 +1,5 @@
1
1
  import type { DraftAction, DraftQueue, ProcessActionResult, DraftQueueState, DraftQueueChangeListener, DraftActionMetadata, ActionHandler, CustomActionExecutor, PendingDraftAction } from '@salesforce/lds-drafts';
2
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
2
3
  /**
3
4
  * An implementation of the DraftQueue interface which serializes
4
5
  * requests and sends them across the Nimbus bridge and deserializes the result.
@@ -7,7 +8,7 @@ import type { DraftAction, DraftQueue, ProcessActionResult, DraftQueueState, Dra
7
8
  * to a concrete implementation running in jscore.
8
9
  */
9
10
  export declare class NimbusDraftQueue implements DraftQueue {
10
- enqueue<Data>(handlerId: string, data: unknown): Promise<PendingDraftAction<Data>>;
11
+ enqueue<Data>(handlerId: string, data: unknown, observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<Data>>;
11
12
  registerOnChangedListener(_listener: DraftQueueChangeListener): () => Promise<void>;
12
13
  processNextAction(): Promise<ProcessActionResult>;
13
14
  getQueueActions(): Promise<DraftAction<unknown, unknown>[]>;
@@ -1,5 +1,6 @@
1
1
  import type { NetworkAdapter, ResourceRequest, Luvio, DurableStoreKeyMetadataMap } from '@luvio/engine';
2
2
  import type { DraftAction, CompletedDraftAction, QueueOperation, PendingDraftAction, DraftActionMetadata, DraftQueue, ActionHandler } from '@salesforce/lds-drafts';
3
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
3
4
  import { ProcessActionResult } from '@salesforce/lds-drafts';
4
5
  import type { UiApiDraftRecordService } from './UiApiDraftRecordService';
5
6
  export type ResponseIngestionEntry<T = unknown> = {
@@ -22,8 +23,8 @@ export declare abstract class AbstractResourceRequestActionHandler<ResponseType>
22
23
  protected readonly recordService: UiApiDraftRecordService;
23
24
  isIdempotencySupported: boolean;
24
25
  constructor(draftQueue: DraftQueue, networkAdapter: NetworkAdapter, getLuvio: () => Luvio, recordService: UiApiDraftRecordService);
25
- enqueue(data: ResourceRequest): Promise<PendingDraftAction<ResourceRequest>>;
26
- buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
26
+ enqueue(data: ResourceRequest, observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<ResourceRequest>>;
27
+ buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[], observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<ResourceRequest>>;
27
28
  handleAction(action: DraftAction<ResourceRequest, ResponseType>, actionCompleted: (action: CompletedDraftAction<ResourceRequest, ResponseType>) => Promise<void>, actionErrored: (action: DraftAction<ResourceRequest, ResponseType>, retry: boolean, retryDelayInMs?: number, actionDataChanged?: boolean) => Promise<void>): Promise<ProcessActionResult>;
28
29
  handleActionEnqueued(action: PendingDraftAction<ResourceRequest>): Promise<void>;
29
30
  handleActionRemoved(action: DraftAction<ResourceRequest, ResponseType>): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import type { DurableStoreKeyMetadataMap, Luvio, NetworkAdapter, ResourceRequest } from '@luvio/engine';
2
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
2
3
  import type { DraftIdAndKeyMapping } from '../AbstractResourceRequestActionHandler';
3
4
  import { AbstractResourceRequestActionHandler, type ResponseIngestionEntry } from '../AbstractResourceRequestActionHandler';
4
5
  import type { PendingDraftAction, DraftAction, DraftQueue, CompletedDraftAction } from '@salesforce/lds-drafts';
@@ -27,7 +28,7 @@ export declare class ContentDocumentCompositeRepresentationActionHandler extends
27
28
  private binaryStoreUrlsToUpdate;
28
29
  handlerId: string;
29
30
  constructor(getLuvio: () => Luvio, userId: string, draftRecordService: UiApiDraftRecordService, objectInfoService: ObjectInfoService, draftQueue: DraftQueue, networkAdapter: NetworkAdapter, isDraftId: (targetId: string) => boolean, binaryStore: BinaryStore, sideEffectService: SideEffectService);
30
- buildPendingAction(request: CreateContentDocumentAndVersionResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<CreateContentDocumentAndVersionResourceRequest>>;
31
+ buildPendingAction(request: CreateContentDocumentAndVersionResourceRequest, queue: DraftAction<unknown, unknown>[], observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<CreateContentDocumentAndVersionResourceRequest>>;
31
32
  getBackdatingNameEntries(objectInfo: ObjectInfoRepresentation, timestamp: number): {
32
33
  name: string;
33
34
  value: string | File;
@@ -3,9 +3,10 @@ import type { QuickActionExecutionRepresentation } from '@salesforce/lds-adapter
3
3
  import type { NetworkAdapter, ResourceRequest } from '@luvio/engine';
4
4
  import type { DraftAction, DraftQueue, PendingDraftAction } from '@salesforce/lds-drafts';
5
5
  import type { Luvio } from '@luvio/engine';
6
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
6
7
  import type { UiApiDraftRecordService } from '../UiApiDraftRecordService';
7
8
  export declare abstract class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler<QuickActionExecutionRepresentation> {
8
9
  constructor(draftQueue: DraftQueue, networkAdapter: NetworkAdapter, getLuvio: () => Luvio, recordService: UiApiDraftRecordService);
9
- buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
10
+ buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[], observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<ResourceRequest>>;
10
11
  private resolveResourceRequestBody;
11
12
  }
@@ -1,4 +1,5 @@
1
1
  import { type Adapter, type DurableStoreKeyMetadataMap, type Luvio, type NetworkAdapter, type ResourceRequest } from '@luvio/engine';
2
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
2
3
  import type { GetRecordConfig, RecordRepresentation, RecordInputRepresentation } from '@salesforce/lds-adapters-uiapi';
3
4
  import type { CompletedDraftAction, DraftAction, DraftActionMetadata, DraftQueue, PendingDraftAction, QueueOperation } from '@salesforce/lds-drafts';
4
5
  import type { ObjectInfoService } from '../../utils/types';
@@ -32,7 +33,7 @@ export declare class UiApiActionHandler extends AbstractResourceRequestActionHan
32
33
  private sideEffectHooks;
33
34
  constructor(getLuvio: () => Luvio, networkAdapter: NetworkAdapter, draftQueue: DraftQueue, getRecordAdapter: Adapter<GetRecordConfig, RecordRepresentation>, objectInfoService: ObjectInfoService, isDraftId: (targetId: string) => boolean, recordService: UiApiDraftRecordService, sideEffectService: SideEffectService, durableRecordStore: DurableRecordStore);
34
35
  setSideEffectHooks(hooks: SideEffectHook[]): void;
35
- buildPendingAction(request: RecordResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
36
+ buildPendingAction(request: RecordResourceRequest, queue: DraftAction<unknown, unknown>[], observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<ResourceRequest>>;
36
37
  private getBackdatingFields;
37
38
  getRedirectMappings(action: CompletedDraftAction<ResourceRequest, RecordRepresentation>): DraftIdAndKeyMapping[] | undefined;
38
39
  handleActionCompleted(completedAction: CompletedDraftAction<ResourceRequest, RecordRepresentation>, queueOperations: QueueOperation[]): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-mobile",
3
- "version": "1.442.0",
3
+ "version": "1.444.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS runtime for mobile/hybrid environments.",
6
6
  "main": "dist/main.js",
@@ -32,44 +32,44 @@
32
32
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
33
33
  },
34
34
  "dependencies": {
35
- "@conduit-client/service-bindings-imperative": "3.21.0",
36
- "@conduit-client/service-bindings-lwc": "3.21.0",
37
- "@conduit-client/service-provisioner": "3.21.0",
38
- "@salesforce/lds-adapters-uiapi": "^1.442.0",
39
- "@salesforce/lds-bindings": "^1.442.0",
40
- "@salesforce/lds-instrumentation": "^1.442.0",
41
- "@salesforce/lds-luvio-service": "^1.442.0",
42
- "@salesforce/lds-luvio-uiapi-records-service": "^1.442.0",
35
+ "@conduit-client/service-bindings-imperative": "3.23.1",
36
+ "@conduit-client/service-bindings-lwc": "3.23.1",
37
+ "@conduit-client/service-provisioner": "3.23.1",
38
+ "@salesforce/lds-adapters-uiapi": "^1.444.0",
39
+ "@salesforce/lds-bindings": "^1.444.0",
40
+ "@salesforce/lds-instrumentation": "^1.444.0",
41
+ "@salesforce/lds-luvio-service": "^1.444.0",
42
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.444.0",
43
43
  "@salesforce/user": "0.0.21",
44
44
  "o11y": "250.7.0",
45
45
  "o11y_schema": "256.126.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@conduit-client/command-aura-network": "3.21.0",
49
- "@conduit-client/command-aura-normalized-cache-control": "3.21.0",
50
- "@conduit-client/command-aura-resource-cache-control": "3.21.0",
51
- "@conduit-client/command-fetch-network": "3.21.0",
52
- "@conduit-client/command-http-normalized-cache-control": "3.21.0",
53
- "@conduit-client/command-network": "3.21.0",
54
- "@conduit-client/service-cache": "3.21.0",
55
- "@conduit-client/service-cache-control": "3.21.0",
56
- "@conduit-client/service-cache-inclusion-policy": "3.21.0",
57
- "@conduit-client/service-fetch-network": "3.21.0",
58
- "@conduit-client/service-instrument-command": "3.21.0",
59
- "@conduit-client/service-instrumentation": "3.21.0",
60
- "@conduit-client/service-pubsub": "3.21.0",
61
- "@conduit-client/service-store": "3.21.0",
62
- "@conduit-client/utils": "3.21.0",
63
- "@salesforce/lds-adapters-graphql": "^1.442.0",
64
- "@salesforce/lds-drafts": "^1.442.0",
65
- "@salesforce/lds-durable-records": "^1.442.0",
66
- "@salesforce/lds-network-adapter": "^1.442.0",
67
- "@salesforce/lds-network-nimbus": "^1.442.0",
68
- "@salesforce/lds-store-binary": "^1.442.0",
69
- "@salesforce/lds-store-nimbus": "^1.442.0",
70
- "@salesforce/lds-store-sql": "^1.442.0",
71
- "@salesforce/lds-utils-adapters": "^1.442.0",
72
- "@salesforce/nimbus-plugin-lds": "^1.442.0",
48
+ "@conduit-client/command-aura-network": "3.23.1",
49
+ "@conduit-client/command-aura-normalized-cache-control": "3.23.1",
50
+ "@conduit-client/command-aura-resource-cache-control": "3.23.1",
51
+ "@conduit-client/command-fetch-network": "3.23.1",
52
+ "@conduit-client/command-http-normalized-cache-control": "3.23.1",
53
+ "@conduit-client/command-network": "3.23.1",
54
+ "@conduit-client/service-cache": "3.23.1",
55
+ "@conduit-client/service-cache-control": "3.23.1",
56
+ "@conduit-client/service-cache-inclusion-policy": "3.23.1",
57
+ "@conduit-client/service-fetch-network": "3.23.1",
58
+ "@conduit-client/service-instrument-command": "3.23.1",
59
+ "@conduit-client/service-instrumentation": "3.23.1",
60
+ "@conduit-client/service-pubsub": "3.23.1",
61
+ "@conduit-client/service-store": "3.23.1",
62
+ "@conduit-client/utils": "3.23.1",
63
+ "@salesforce/lds-adapters-graphql": "^1.444.0",
64
+ "@salesforce/lds-drafts": "^1.444.0",
65
+ "@salesforce/lds-durable-records": "^1.444.0",
66
+ "@salesforce/lds-network-adapter": "^1.444.0",
67
+ "@salesforce/lds-network-nimbus": "^1.444.0",
68
+ "@salesforce/lds-store-binary": "^1.444.0",
69
+ "@salesforce/lds-store-nimbus": "^1.444.0",
70
+ "@salesforce/lds-store-sql": "^1.444.0",
71
+ "@salesforce/lds-utils-adapters": "^1.444.0",
72
+ "@salesforce/nimbus-plugin-lds": "^1.444.0",
73
73
  "babel-plugin-dynamic-import-node": "^2.3.3",
74
74
  "wait-for-expect": "^3.0.2"
75
75
  },
package/sfdc/main.js CHANGED
@@ -2297,7 +2297,7 @@ function customActionHandler(executor, id, draftQueue) {
2297
2297
  }, result.error.type === CustomActionErrorType.NETWORK_ERROR);
2298
2298
  }
2299
2299
  };
2300
- const buildPendingAction = (action, queue) => {
2300
+ const buildPendingAction = (action, queue, observabilityContext) => {
2301
2301
  const { data, tag, targetId, handler } = action;
2302
2302
  const id = generateUniqueDraftActionId(queue.map((a) => a.id));
2303
2303
  return Promise.resolve({
@@ -2309,6 +2309,7 @@ function customActionHandler(executor, id, draftQueue) {
2309
2309
  timestamp: Date.now(),
2310
2310
  metadata: data,
2311
2311
  handler,
2312
+ observabilityContext,
2312
2313
  });
2313
2314
  };
2314
2315
  const getQueueOperationsForCompletingDrafts = (_queue, action) => {
@@ -2480,12 +2481,12 @@ class DurableDraftQueue {
2480
2481
  return aTime - bTime;
2481
2482
  });
2482
2483
  }
2483
- async enqueue(handlerId, data) {
2484
+ async enqueue(handlerId, data, observabilityContext) {
2484
2485
  return this.workerPool.push({
2485
2486
  workFn: async () => {
2486
2487
  let queue = await this.getQueueActions();
2487
2488
  const handler = this.getHandler(handlerId);
2488
- const pendingAction = (await handler.buildPendingAction(data, queue));
2489
+ const pendingAction = (await handler.buildPendingAction(data, queue, observabilityContext));
2489
2490
  await this.draftStore.writeAction(pendingAction);
2490
2491
  queue = await this.getQueueActions();
2491
2492
  await this.notifyChangedListeners({
@@ -3307,7 +3308,7 @@ class DraftManager {
3307
3308
  }
3308
3309
  buildDraftQueueItem(action) {
3309
3310
  const operationType = getOperationTypeFrom(action);
3310
- const { id, status, timestamp, targetId, metadata } = action;
3311
+ const { id, status, timestamp, targetId, metadata, observabilityContext } = action;
3311
3312
  const item = {
3312
3313
  id,
3313
3314
  targetId,
@@ -3315,6 +3316,7 @@ class DraftManager {
3315
3316
  timestamp,
3316
3317
  operationType,
3317
3318
  metadata,
3319
+ observabilityContext,
3318
3320
  };
3319
3321
  if (isDraftError(action)) {
3320
3322
  // We should always return an array, if the body is just a dictionary,
@@ -42180,10 +42182,10 @@ class AbstractResourceRequestActionHandler {
42180
42182
  // determined by Server setup.
42181
42183
  this.isIdempotencySupported = true;
42182
42184
  }
42183
- enqueue(data) {
42184
- return this.draftQueue.enqueue(this.handlerId, data);
42185
+ enqueue(data, observabilityContext) {
42186
+ return this.draftQueue.enqueue(this.handlerId, data, observabilityContext);
42185
42187
  }
42186
- async buildPendingAction(request, queue) {
42188
+ async buildPendingAction(request, queue, observabilityContext) {
42187
42189
  const targetId = await this.getIdFromRequest(request);
42188
42190
  const tag = this.buildTagForTargetId(targetId);
42189
42191
  const handlerActions = queue.filter((x) => x.handler === this.handlerId);
@@ -42203,13 +42205,16 @@ class AbstractResourceRequestActionHandler {
42203
42205
  timestamp: Date.now(),
42204
42206
  metadata: {},
42205
42207
  version: '242.0.0',
42208
+ observabilityContext,
42206
42209
  };
42207
42210
  }
42208
42211
  async handleAction(action, actionCompleted, actionErrored) {
42209
42212
  const { data: request } = action;
42210
- // no context is stored in draft action
42213
+ const dispatchOptions = action.observabilityContext !== undefined
42214
+ ? { requestCorrelator: { observabilityContext: action.observabilityContext } }
42215
+ : {};
42211
42216
  try {
42212
- const response = await this.networkAdapter(request, {});
42217
+ const response = await this.networkAdapter(request, dispatchOptions);
42213
42218
  if (response.ok) {
42214
42219
  await actionCompleted({
42215
42220
  ...action,
@@ -42489,6 +42494,17 @@ class AbstractResourceRequestActionHandler {
42489
42494
  timestamp: targetTimestamp,
42490
42495
  id: targetId,
42491
42496
  };
42497
+ // The merged action retains the target's observabilityContext, not the source's.
42498
+ // Attribution belongs to the user action that first enqueued the target draft; the
42499
+ // source's context (if any) is intentionally discarded. If the target had no context
42500
+ // when it was enqueued, the merged action has none — we do not promote the source's
42501
+ // context as a fallback.
42502
+ if (targetAction.observabilityContext !== undefined) {
42503
+ merged.observabilityContext = targetAction.observabilityContext;
42504
+ }
42505
+ else {
42506
+ delete merged.observabilityContext;
42507
+ }
42492
42508
  // overlay data
42493
42509
  // NOTE: we stick to the target's ResourceRequest properties (except body
42494
42510
  // which is merged) because we don't want to overwrite a POST with a PATCH
@@ -42636,9 +42652,9 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
42636
42652
  setSideEffectHooks(hooks) {
42637
42653
  this.sideEffectHooks = hooks;
42638
42654
  }
42639
- async buildPendingAction(request, queue) {
42655
+ async buildPendingAction(request, queue, observabilityContext) {
42640
42656
  const resolvedRequest = this.resolveResourceRequest(request);
42641
- let pendingAction = (await super.buildPendingAction(resolvedRequest, queue));
42657
+ let pendingAction = (await super.buildPendingAction(resolvedRequest, queue, observabilityContext));
42642
42658
  const { tag, targetId } = pendingAction;
42643
42659
  const targetApiName = await this.getApiNameForRecordId(targetId, tag, resolvedRequest);
42644
42660
  pendingAction.metadata[LDS_ACTION_METADATA_API_NAME] = targetApiName;
@@ -43081,10 +43097,10 @@ class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler {
43081
43097
  constructor(draftQueue, networkAdapter, getLuvio, recordService) {
43082
43098
  super(draftQueue, networkAdapter, getLuvio, recordService);
43083
43099
  }
43084
- async buildPendingAction(request, queue) {
43100
+ async buildPendingAction(request, queue, observabilityContext) {
43085
43101
  this.resolveResourceRequestBody(request.body);
43086
43102
  // eslint-disable-next-line no-return-await
43087
- return await super.buildPendingAction(request, queue);
43103
+ return await super.buildPendingAction(request, queue, observabilityContext);
43088
43104
  }
43089
43105
  resolveResourceRequestBody(body) {
43090
43106
  let contextId = body.contextId;
@@ -43701,8 +43717,8 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
43701
43717
  this.handlerId = HANDLER_ID;
43702
43718
  draftRecordService.registerRecordHandler(this);
43703
43719
  }
43704
- async buildPendingAction(request, queue) {
43705
- const pendingAction = (await super.buildPendingAction(request, queue));
43720
+ async buildPendingAction(request, queue, observabilityContext) {
43721
+ const pendingAction = (await super.buildPendingAction(request, queue, observabilityContext));
43706
43722
  const { targetId } = pendingAction;
43707
43723
  // remember ContentDocument ID
43708
43724
  pendingAction.metadata[CONTENT_DOCUMENT_DRAFT_ID_KEY] = targetId;
@@ -51909,12 +51925,16 @@ function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink
51909
51925
  * to a concrete implementation running in jscore.
51910
51926
  */
51911
51927
  class NimbusDraftQueue {
51912
- enqueue(handlerId, data) {
51928
+ enqueue(handlerId, data, observabilityContext) {
51913
51929
  const callProxyMethod = __nimbus.plugins.LdsDraftQueue.callProxyMethod;
51914
51930
  if (callProxyMethod === undefined) {
51915
51931
  return Promise.reject(new Error('callProxyMethod not defined on the nimbus plugin'));
51916
51932
  }
51917
- const serializedAction = stringify$5([handlerId, data]);
51933
+ const args = [handlerId, data];
51934
+ if (observabilityContext !== undefined) {
51935
+ args.push(observabilityContext);
51936
+ }
51937
+ const serializedAction = stringify$5(args);
51918
51938
  return new Promise((resolve, reject) => {
51919
51939
  callProxyMethod('enqueue', serializedAction, (serializedActionResponse) => {
51920
51940
  const response = parse$5(serializedActionResponse);
@@ -56587,7 +56607,10 @@ function deepEquals$1(x, y) {
56587
56607
  }
56588
56608
  for (let i = 0; i < xkeys.length; ++i) {
56589
56609
  const key = xkeys[i];
56590
- if (!deepEquals$1(x[key], y[key])) {
56610
+ if (!deepEquals$1(
56611
+ x[key],
56612
+ y[key]
56613
+ )) {
56591
56614
  return false;
56592
56615
  }
56593
56616
  }
@@ -56657,6 +56680,19 @@ var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
56657
56680
  HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
56658
56681
  return HttpStatusCode2;
56659
56682
  })(HttpStatusCode || {});
56683
+ function getFetchResponseFromAuraError(err2) {
56684
+ if (err2.data !== void 0 && err2.data.statusCode !== void 0) {
56685
+ let data = {};
56686
+ data = err2.data;
56687
+ if (err2.id !== void 0) {
56688
+ data.id = err2.id;
56689
+ }
56690
+ return new FetchResponse(data.statusCode, data);
56691
+ }
56692
+ return new FetchResponse(500, {
56693
+ error: err2.message
56694
+ });
56695
+ }
56660
56696
  function getStatusText(status) {
56661
56697
  switch (status) {
56662
56698
  case 200:
@@ -56798,7 +56834,7 @@ class AuraNetworkCommand extends NetworkCommand$1 {
56798
56834
  );
56799
56835
  }
56800
56836
  coerceAuraErrors(auraErrors) {
56801
- return toError(auraErrors[0]);
56837
+ return new UserVisibleError(getFetchResponseFromAuraError(auraErrors[0]));
56802
56838
  }
56803
56839
  /**
56804
56840
  * Customize how non-2xx fetch fallback responses are converted into errors.
@@ -56983,7 +57019,10 @@ function deepEquals(x, y) {
56983
57019
  }
56984
57020
  for (let i = 0; i < xkeys.length; ++i) {
56985
57021
  const key = xkeys[i];
56986
- if (!deepEquals(x[key], y[key])) {
57022
+ if (!deepEquals(
57023
+ x[key],
57024
+ y[key]
57025
+ )) {
56987
57026
  return false;
56988
57027
  }
56989
57028
  }
@@ -58902,7 +58941,7 @@ function buildServiceDescriptor$b(luvio) {
58902
58941
  },
58903
58942
  };
58904
58943
  }
58905
- // version: 1.442.0-e47893165a
58944
+ // version: 1.444.0-a7f42f9edf
58906
58945
 
58907
58946
  /**
58908
58947
  * Copyright (c) 2022, Salesforce, Inc.,
@@ -58928,7 +58967,7 @@ function buildServiceDescriptor$a(notifyRecordUpdateAvailable, getNormalizedLuvi
58928
58967
  },
58929
58968
  };
58930
58969
  }
58931
- // version: 1.442.0-e47893165a
58970
+ // version: 1.444.0-a7f42f9edf
58932
58971
 
58933
58972
  function findExecutableOperation(input) {
58934
58973
  const operations = input.query.definitions.filter(
@@ -59968,7 +60007,10 @@ class GraphQLImperativeBindingsService {
59968
60007
  const options = {
59969
60008
  acceptedOperations: ["query"]
59970
60009
  };
59971
- const result = resolveAndValidateGraphQLConfig(params[0], options);
60010
+ const result = resolveAndValidateGraphQLConfig(
60011
+ params[0],
60012
+ options
60013
+ );
59972
60014
  if (result?.isErr()) {
59973
60015
  return result.error;
59974
60016
  }
@@ -60165,7 +60207,10 @@ class GraphQLMutationBindingsService {
60165
60207
  const options = {
60166
60208
  acceptedOperations: ["mutation"]
60167
60209
  };
60168
- const result2 = resolveAndValidateGraphQLConfig(params[0], options);
60210
+ const result2 = resolveAndValidateGraphQLConfig(
60211
+ params[0],
60212
+ options
60213
+ );
60169
60214
  if (result2?.isErr()) {
60170
60215
  return {
60171
60216
  data: void 0,
@@ -61608,4 +61653,4 @@ register({
61608
61653
  });
61609
61654
 
61610
61655
  export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, initializeOneStore, registerReportObserver, reportGraphqlQueryParseError };
61611
- // version: 1.442.0-e47893165a
61656
+ // version: 1.444.0-a7f42f9edf
@@ -1,4 +1,5 @@
1
1
  import type { DraftAction, DraftQueue, ProcessActionResult, DraftQueueState, DraftQueueChangeListener, DraftActionMetadata, ActionHandler, CustomActionExecutor, PendingDraftAction } from '@salesforce/lds-drafts';
2
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
2
3
  /**
3
4
  * An implementation of the DraftQueue interface which serializes
4
5
  * requests and sends them across the Nimbus bridge and deserializes the result.
@@ -7,7 +8,7 @@ import type { DraftAction, DraftQueue, ProcessActionResult, DraftQueueState, Dra
7
8
  * to a concrete implementation running in jscore.
8
9
  */
9
10
  export declare class NimbusDraftQueue implements DraftQueue {
10
- enqueue<Data>(handlerId: string, data: unknown): Promise<PendingDraftAction<Data>>;
11
+ enqueue<Data>(handlerId: string, data: unknown, observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<Data>>;
11
12
  registerOnChangedListener(_listener: DraftQueueChangeListener): () => Promise<void>;
12
13
  processNextAction(): Promise<ProcessActionResult>;
13
14
  getQueueActions(): Promise<DraftAction<unknown, unknown>[]>;
@@ -1,5 +1,6 @@
1
1
  import type { NetworkAdapter, ResourceRequest, Luvio, DurableStoreKeyMetadataMap } from '@luvio/engine';
2
2
  import type { DraftAction, CompletedDraftAction, QueueOperation, PendingDraftAction, DraftActionMetadata, DraftQueue, ActionHandler } from '@salesforce/lds-drafts';
3
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
3
4
  import { ProcessActionResult } from '@salesforce/lds-drafts';
4
5
  import type { UiApiDraftRecordService } from './UiApiDraftRecordService';
5
6
  export type ResponseIngestionEntry<T = unknown> = {
@@ -22,8 +23,8 @@ export declare abstract class AbstractResourceRequestActionHandler<ResponseType>
22
23
  protected readonly recordService: UiApiDraftRecordService;
23
24
  isIdempotencySupported: boolean;
24
25
  constructor(draftQueue: DraftQueue, networkAdapter: NetworkAdapter, getLuvio: () => Luvio, recordService: UiApiDraftRecordService);
25
- enqueue(data: ResourceRequest): Promise<PendingDraftAction<ResourceRequest>>;
26
- buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
26
+ enqueue(data: ResourceRequest, observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<ResourceRequest>>;
27
+ buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[], observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<ResourceRequest>>;
27
28
  handleAction(action: DraftAction<ResourceRequest, ResponseType>, actionCompleted: (action: CompletedDraftAction<ResourceRequest, ResponseType>) => Promise<void>, actionErrored: (action: DraftAction<ResourceRequest, ResponseType>, retry: boolean, retryDelayInMs?: number, actionDataChanged?: boolean) => Promise<void>): Promise<ProcessActionResult>;
28
29
  handleActionEnqueued(action: PendingDraftAction<ResourceRequest>): Promise<void>;
29
30
  handleActionRemoved(action: DraftAction<ResourceRequest, ResponseType>): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import type { DurableStoreKeyMetadataMap, Luvio, NetworkAdapter, ResourceRequest } from '@luvio/engine';
2
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
2
3
  import type { DraftIdAndKeyMapping } from '../AbstractResourceRequestActionHandler';
3
4
  import { AbstractResourceRequestActionHandler, type ResponseIngestionEntry } from '../AbstractResourceRequestActionHandler';
4
5
  import type { PendingDraftAction, DraftAction, DraftQueue, CompletedDraftAction } from '@salesforce/lds-drafts';
@@ -27,7 +28,7 @@ export declare class ContentDocumentCompositeRepresentationActionHandler extends
27
28
  private binaryStoreUrlsToUpdate;
28
29
  handlerId: string;
29
30
  constructor(getLuvio: () => Luvio, userId: string, draftRecordService: UiApiDraftRecordService, objectInfoService: ObjectInfoService, draftQueue: DraftQueue, networkAdapter: NetworkAdapter, isDraftId: (targetId: string) => boolean, binaryStore: BinaryStore, sideEffectService: SideEffectService);
30
- buildPendingAction(request: CreateContentDocumentAndVersionResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<CreateContentDocumentAndVersionResourceRequest>>;
31
+ buildPendingAction(request: CreateContentDocumentAndVersionResourceRequest, queue: DraftAction<unknown, unknown>[], observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<CreateContentDocumentAndVersionResourceRequest>>;
31
32
  getBackdatingNameEntries(objectInfo: ObjectInfoRepresentation, timestamp: number): {
32
33
  name: string;
33
34
  value: string | File;
@@ -3,9 +3,10 @@ import type { QuickActionExecutionRepresentation } from '@salesforce/lds-adapter
3
3
  import type { NetworkAdapter, ResourceRequest } from '@luvio/engine';
4
4
  import type { DraftAction, DraftQueue, PendingDraftAction } from '@salesforce/lds-drafts';
5
5
  import type { Luvio } from '@luvio/engine';
6
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
6
7
  import type { UiApiDraftRecordService } from '../UiApiDraftRecordService';
7
8
  export declare abstract class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler<QuickActionExecutionRepresentation> {
8
9
  constructor(draftQueue: DraftQueue, networkAdapter: NetworkAdapter, getLuvio: () => Luvio, recordService: UiApiDraftRecordService);
9
- buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
10
+ buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[], observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<ResourceRequest>>;
10
11
  private resolveResourceRequestBody;
11
12
  }
@@ -1,4 +1,5 @@
1
1
  import { type Adapter, type DurableStoreKeyMetadataMap, type Luvio, type NetworkAdapter, type ResourceRequest } from '@luvio/engine';
2
+ import type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
2
3
  import type { GetRecordConfig, RecordRepresentation, RecordInputRepresentation } from '@salesforce/lds-adapters-uiapi';
3
4
  import type { CompletedDraftAction, DraftAction, DraftActionMetadata, DraftQueue, PendingDraftAction, QueueOperation } from '@salesforce/lds-drafts';
4
5
  import type { ObjectInfoService } from '../../utils/types';
@@ -32,7 +33,7 @@ export declare class UiApiActionHandler extends AbstractResourceRequestActionHan
32
33
  private sideEffectHooks;
33
34
  constructor(getLuvio: () => Luvio, networkAdapter: NetworkAdapter, draftQueue: DraftQueue, getRecordAdapter: Adapter<GetRecordConfig, RecordRepresentation>, objectInfoService: ObjectInfoService, isDraftId: (targetId: string) => boolean, recordService: UiApiDraftRecordService, sideEffectService: SideEffectService, durableRecordStore: DurableRecordStore);
34
35
  setSideEffectHooks(hooks: SideEffectHook[]): void;
35
- buildPendingAction(request: RecordResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
36
+ buildPendingAction(request: RecordResourceRequest, queue: DraftAction<unknown, unknown>[], observabilityContext?: ObservabilityContext): Promise<PendingDraftAction<ResourceRequest>>;
36
37
  private getBackdatingFields;
37
38
  getRedirectMappings(action: CompletedDraftAction<ResourceRequest, RecordRepresentation>): DraftIdAndKeyMapping[] | undefined;
38
39
  handleActionCompleted(completedAction: CompletedDraftAction<ResourceRequest, RecordRepresentation>, queueOperations: QueueOperation[]): Promise<void>;