@diia-inhouse/workflow 2.9.13 → 2.10.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.
@@ -1 +1,2 @@
1
- import { buildActivitiesProxy } from "./proxy.js";
1
+ import { ActivityOptions, LocalActivityOptions, RetryPolicy, buildActivitiesProxy } from "./proxy.js";
2
+ export { ActivityOptions, LocalActivityOptions, RetryPolicy, buildActivitiesProxy };
@@ -1,2 +1,2 @@
1
- import "./proxy.js";
2
- export {};
1
+ import { buildActivitiesProxy } from "./proxy.js";
2
+ export { buildActivitiesProxy };
@@ -1,10 +1,26 @@
1
- import { ActivityInterfaceFor, ActivityOptions, proxyLocalActivities } from "@temporalio/workflow";
1
+ import { ActivityInterfaceFor, ActivityOptions, RetryPolicy, proxyLocalActivities } from "@temporalio/workflow";
2
2
 
3
3
  //#region src/activities/proxy.d.ts
4
4
  type ActivityClass<T> = T extends {
5
5
  prototype: infer P;
6
6
  } ? P : never;
7
- type LocalActivityOptions = Parameters<typeof proxyLocalActivities>[0];
7
+ type TemporalLocalActivityOptions = Parameters<typeof proxyLocalActivities>[0];
8
+ /**
9
+ * Retry policy exposed by pkg-workflow.
10
+ *
11
+ * `nonRetryableErrorTypes` is intentionally omitted from Temporal's {@link TemporalRetryPolicy}:
12
+ * services must not mark failures as non-retryable by error type through the activity proxy, so
13
+ * removing the field here disables the ability to set it via {@link buildActivitiesProxy}.
14
+ */
15
+ type RetryPolicy$1 = Omit<RetryPolicy, "nonRetryableErrorTypes">;
16
+ /** Activity options exposed by pkg-workflow, without {@link RetryPolicy.nonRetryableErrorTypes}. */
17
+ type ActivityOptions$1 = Omit<ActivityOptions, "retry"> & {
18
+ retry?: RetryPolicy$1;
19
+ };
20
+ /** Local activity options exposed by pkg-workflow, without {@link RetryPolicy.nonRetryableErrorTypes}. */
21
+ type LocalActivityOptions = Omit<TemporalLocalActivityOptions, "retry"> & {
22
+ retry?: RetryPolicy$1;
23
+ };
8
24
  /**
9
25
  * Enhances Temporal activities by prefixing method names with their class name.
10
26
  *
@@ -29,6 +45,6 @@ type LocalActivityOptions = Parameters<typeof proxyLocalActivities>[0];
29
45
  * }
30
46
  */
31
47
  declare function buildActivitiesProxy<TActivity extends Record<string, unknown>>(useLocalActivitiesProxy: true): { [K in keyof TActivity]: (options: LocalActivityOptions) => ActivityInterfaceFor<ActivityClass<TActivity[K]>> };
32
- declare function buildActivitiesProxy<TActivity extends Record<string, unknown>>(useLocalActivitiesProxy?: false): { [K in keyof TActivity]: (options: ActivityOptions) => ActivityInterfaceFor<ActivityClass<TActivity[K]>> };
48
+ declare function buildActivitiesProxy<TActivity extends Record<string, unknown>>(useLocalActivitiesProxy?: false): { [K in keyof TActivity]: (options: ActivityOptions$1) => ActivityInterfaceFor<ActivityClass<TActivity[K]>> };
33
49
  //#endregion
34
- export { buildActivitiesProxy };
50
+ export { ActivityOptions$1 as ActivityOptions, LocalActivityOptions, RetryPolicy$1 as RetryPolicy, buildActivitiesProxy };
@@ -5,10 +5,8 @@ function buildActivitiesProxy(useLocalActivitiesProxy = false) {
5
5
  const activityWrapper = (options) => {
6
6
  const activities = useLocalActivitiesProxy ? proxyLocalActivities(options) : proxyActivities(options);
7
7
  return new Proxy({}, { get: function(_inner, prop) {
8
- const activityFn = activities[`${activityType}.${prop}`];
9
- return (...args) => {
10
- return activityFn(...args);
11
- };
8
+ const activityName = `${activityType}.${prop}`;
9
+ return activities[activityName];
12
10
  } });
13
11
  };
14
12
  return activityWrapper;
@@ -1,2 +1,2 @@
1
- import { ApplicationFailure, CancelledFailure, CompleteAsyncError, Context, Info as ActivityInfo, activityInfo, cancellationSignal, cancelled, heartbeat, log, sleep } from "@temporalio/activity";
2
- export { type ActivityInfo, ApplicationFailure, CancelledFailure, CompleteAsyncError, Context, activityInfo, cancellationSignal, cancelled, heartbeat, log, sleep };
1
+ import { ApplicationFailure, CancelledFailure, CompleteAsyncError, Context, Info as ActivityInfo, activityInfo, cancellationDetails, cancellationSignal, cancelled, getClient, heartbeat, log, metricMeter, sleep } from "@temporalio/activity";
2
+ export { type ActivityInfo, ApplicationFailure, CancelledFailure, CompleteAsyncError, Context, activityInfo, cancellationDetails, cancellationSignal, cancelled, getClient, heartbeat, log, metricMeter, sleep };
package/dist/activity.js CHANGED
@@ -1,2 +1,2 @@
1
- import { ApplicationFailure, CancelledFailure, CompleteAsyncError, Context, activityInfo, cancellationSignal, cancelled, heartbeat, log, sleep } from "@temporalio/activity";
2
- export { ApplicationFailure, CancelledFailure, CompleteAsyncError, Context, activityInfo, cancellationSignal, cancelled, heartbeat, log, sleep };
1
+ import { ApplicationFailure, CancelledFailure, CompleteAsyncError, Context, activityInfo, cancellationDetails, cancellationSignal, cancelled, getClient, heartbeat, log, metricMeter, sleep } from "@temporalio/activity";
2
+ export { ApplicationFailure, CancelledFailure, CompleteAsyncError, Context, activityInfo, cancellationDetails, cancellationSignal, cancelled, getClient, heartbeat, log, metricMeter, sleep };
@@ -116,6 +116,7 @@ var CheckWorkflowDeterminismCommand = class {
116
116
  });
117
117
  this.logger.warn(`⏰ Workflow ${outcome.workflowId} timed out`);
118
118
  break;
119
+ default: break;
119
120
  }
120
121
  if (processed % 50 === 0) {
121
122
  const report = reportBuilder.build();
@@ -213,6 +214,7 @@ var CheckWorkflowDeterminismCommand = class {
213
214
  });
214
215
  this.logger.warn(`⏰ Workflow ${workflowId} timed out after ${outcome.timeoutMs / 1e3}s — skipping`);
215
216
  break;
217
+ default: break;
216
218
  }
217
219
  }
218
220
  async fetchWorkflowHistory(client, workflowId) {
@@ -13,7 +13,7 @@ function collectHistoryFiles(dir) {
13
13
  }
14
14
  return files;
15
15
  }
16
- const TERMINAL_EVENT_TYPES = new Set([
16
+ const TERMINAL_EVENT_TYPES = /* @__PURE__ */ new Set([
17
17
  "EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED",
18
18
  "EVENT_TYPE_WORKFLOW_EXECUTION_FAILED",
19
19
  "EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT",
@@ -75,4 +75,4 @@ function loadHistoryEntries(historyDir, workflows, options = {}) {
75
75
  };
76
76
  }
77
77
  //#endregion
78
- export { loadHistoryEntries };
78
+ export { collectHistoryFiles, loadHistoryEntries, parseHistoryFile };
@@ -1,7 +1,7 @@
1
- import "./errorClassifier.js";
2
- import "./historyFiles.js";
3
- import "./report.js";
4
- import "./replayOptions.js";
5
- import "./replayExecutor.js";
6
- import "./reportPrinter.js";
7
- export {};
1
+ import { isNewStepsAdded, isWorkflowNotFoundError } from "./errorClassifier.js";
2
+ import { loadHistoryEntries } from "./historyFiles.js";
3
+ import { DeterminismReportBuilder } from "./report.js";
4
+ import { buildReplayOptions, resolveWorkflowsPath } from "./replayOptions.js";
5
+ import { replayBatch, replaySingle } from "./replayExecutor.js";
6
+ import { printReport } from "./reportPrinter.js";
7
+ export { DeterminismReportBuilder, buildReplayOptions, isNewStepsAdded, isWorkflowNotFoundError, loadHistoryEntries, printReport, replayBatch, replaySingle, resolveWorkflowsPath };
package/dist/client.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { TemporalClient } from "./services/client.js";
2
- import { ActivityFailure, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, Client, DAYS_OF_WEEK, DayOfWeek, MONTHS, Month, ProtoFailure, ScheduleOptions, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, WorkflowClient, WorkflowHandleWithFirstExecutionRunId } from "@temporalio/client";
3
- export { ActivityFailure, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, Client, DAYS_OF_WEEK, type DayOfWeek, MONTHS, type Month, type ProtoFailure, type ScheduleOptions, ServerFailure, TemporalClient, TemporalFailure, TerminatedFailure, TimeoutFailure, WorkflowClient, type WorkflowHandleWithFirstExecutionRunId };
2
+ import { ActivityClient, ActivityExecutionDescription, ActivityExecutionInfo, ActivityFailure, ActivityHandle, ActivityIdConflictPolicy, ActivityIdReusePolicy, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, Client, ClientPlugin, ConnectionPlugin, CountActivityExecutions, DAYS_OF_WEEK, DayOfWeek, MONTHS, Month, ProtoFailure, ScheduleOptions, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, TypedActivityClient, WithStartWorkflowOperation, WorkflowClient, WorkflowHandleWithFirstExecutionRunId, WorkflowUpdateStage } from "@temporalio/client";
3
+ export { ActivityClient, type ActivityExecutionDescription, type ActivityExecutionInfo, ActivityFailure, type ActivityHandle, ActivityIdConflictPolicy, ActivityIdReusePolicy, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, Client, type ClientPlugin, type ConnectionPlugin, type CountActivityExecutions, DAYS_OF_WEEK, type DayOfWeek, MONTHS, type Month, type ProtoFailure, type ScheduleOptions, ServerFailure, TemporalClient, TemporalFailure, TerminatedFailure, TimeoutFailure, type TypedActivityClient, WithStartWorkflowOperation, WorkflowClient, type WorkflowHandleWithFirstExecutionRunId, WorkflowUpdateStage };
package/dist/client.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { TemporalClient } from "./services/client.js";
2
- import { ActivityFailure, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, Client, DAYS_OF_WEEK, MONTHS, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, WorkflowClient } from "@temporalio/client";
3
- export { ActivityFailure, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, Client, DAYS_OF_WEEK, MONTHS, ServerFailure, TemporalClient, TemporalFailure, TerminatedFailure, TimeoutFailure, WorkflowClient };
2
+ import { ActivityClient, ActivityFailure, ActivityIdConflictPolicy, ActivityIdReusePolicy, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, Client, DAYS_OF_WEEK, MONTHS, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, WithStartWorkflowOperation, WorkflowClient, WorkflowUpdateStage } from "@temporalio/client";
3
+ export { ActivityClient, ActivityFailure, ActivityIdConflictPolicy, ActivityIdReusePolicy, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, Client, DAYS_OF_WEEK, MONTHS, ServerFailure, TemporalClient, TemporalFailure, TerminatedFailure, TimeoutFailure, WithStartWorkflowOperation, WorkflowClient, WorkflowUpdateStage };
package/dist/common.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { DataConverter, WorkflowExecutionAlreadyStartedError, arrayFromPayloads, cutoffStackTrace, defaultFailureConverter, ensureApplicationFailure, ensureTemporalFailure, extractWorkflowType, rootCause } from "@temporalio/common";
2
- export { type DataConverter, WorkflowExecutionAlreadyStartedError, arrayFromPayloads, cutoffStackTrace, defaultFailureConverter, ensureApplicationFailure, ensureTemporalFailure, extractWorkflowType, rootCause };
1
+ import { ActivityCancellationDetails, ActivityCancellationDetailsOptions, ActivitySerializationContext, AutoUpgradeVersioningOverride, DataConverter, InitialVersioningBehavior, PinnedVersioningOverride, Priority, SearchAttributePair, SearchAttributeType, SearchAttributeUpdatePair, SerializationContext, SuggestContinueAsNewReason, TypedSearchAttributes, VersioningBehavior, VersioningOverride, WorkerDeploymentVersion, WorkflowDefinitionOptions, WorkflowDefinitionOptionsOrGetter, WorkflowExecutionAlreadyStartedError, WorkflowSerializationContext, arrayFromPayloads, cutoffStackTrace, defaultFailureConverter, defineSearchAttributeKey, ensureApplicationFailure, ensureTemporalFailure, extractWorkflowType, rootCause, toCanonicalString } from "@temporalio/common";
2
+ export { ActivityCancellationDetails, type ActivityCancellationDetailsOptions, type ActivitySerializationContext, type AutoUpgradeVersioningOverride, type DataConverter, InitialVersioningBehavior, type PinnedVersioningOverride, type Priority, type SearchAttributePair, SearchAttributeType, type SearchAttributeUpdatePair, type SerializationContext, SuggestContinueAsNewReason, TypedSearchAttributes, VersioningBehavior, type VersioningOverride, type WorkerDeploymentVersion, type WorkflowDefinitionOptions, type WorkflowDefinitionOptionsOrGetter, WorkflowExecutionAlreadyStartedError, type WorkflowSerializationContext, arrayFromPayloads, cutoffStackTrace, defaultFailureConverter, defineSearchAttributeKey, ensureApplicationFailure, ensureTemporalFailure, extractWorkflowType, rootCause, toCanonicalString };
package/dist/common.js CHANGED
@@ -1,2 +1,2 @@
1
- import { WorkflowExecutionAlreadyStartedError, arrayFromPayloads, cutoffStackTrace, defaultFailureConverter, ensureApplicationFailure, ensureTemporalFailure, extractWorkflowType, rootCause } from "@temporalio/common";
2
- export { WorkflowExecutionAlreadyStartedError, arrayFromPayloads, cutoffStackTrace, defaultFailureConverter, ensureApplicationFailure, ensureTemporalFailure, extractWorkflowType, rootCause };
1
+ import { ActivityCancellationDetails, InitialVersioningBehavior, SearchAttributeType, SuggestContinueAsNewReason, TypedSearchAttributes, VersioningBehavior, WorkflowExecutionAlreadyStartedError, arrayFromPayloads, cutoffStackTrace, defaultFailureConverter, defineSearchAttributeKey, ensureApplicationFailure, ensureTemporalFailure, extractWorkflowType, rootCause, toCanonicalString } from "@temporalio/common";
2
+ export { ActivityCancellationDetails, InitialVersioningBehavior, SearchAttributeType, SuggestContinueAsNewReason, TypedSearchAttributes, VersioningBehavior, WorkflowExecutionAlreadyStartedError, arrayFromPayloads, cutoffStackTrace, defaultFailureConverter, defineSearchAttributeKey, ensureApplicationFailure, ensureTemporalFailure, extractWorkflowType, rootCause, toCanonicalString };
@@ -1,3 +1,4 @@
1
1
  import { getDataConverter } from "./dataConverter.js";
2
2
  import { EncryptionCodec } from "./encryptionCodec.js";
3
- import { decrypt, encrypt } from "./crypto.js";
3
+ import { decrypt, encrypt } from "./crypto.js";
4
+ export { EncryptionCodec, decrypt, encrypt, getDataConverter };
@@ -1,4 +1,4 @@
1
- import "./crypto.js";
2
- import "./encryptionCodec.js";
3
- import "./dataConverter.js";
4
- export {};
1
+ import { decrypt, encrypt } from "./crypto.js";
2
+ import { EncryptionCodec } from "./encryptionCodec.js";
3
+ import { getDataConverter } from "./dataConverter.js";
4
+ export { EncryptionCodec, decrypt, encrypt, getDataConverter };
@@ -20,8 +20,8 @@ interface TemporalConfig extends Omit<ClientOptions, "dataConverter"> {
20
20
  * Controls whether the Temporal worker runs in the same process as the service.
21
21
  *
22
22
  * - `true` (default): Worker is bootstrapped together with the service in the same process.
23
- * - `false`: Service starts without bootstrapping the worker. The worker should be run
24
- * as a separate process using `bootstrapWorker()`.
23
+ * - `false`: Service starts without running the worker in-process. The worker should be run
24
+ * as a separate process using `runStandaloneWorker()`.
25
25
  *
26
26
  * This is configured at the service level to enable flexible deployment topologies
27
27
  * where workers can be scaled independently from the main service.
@@ -31,8 +31,8 @@ interface TemporalConfig extends Omit<ClientOptions, "dataConverter"> {
31
31
  * Whether to disable message queue consumers when running as a separate worker process.
32
32
  * Applies to all queue connection types (internal, external, etc.).
33
33
  *
34
- * Defaults to `true` when `bootstrapWorker` manages the full application lifecycle
35
- * (i.e. when `configFactory` and `deps` are provided).
34
+ * Defaults to `true`. Applied by `runStandaloneWorker` (the dedicated worker process)
35
+ * when it shapes config before starting the app.
36
36
  */
37
37
  disableQueueConsumers?: boolean;
38
38
  }
@@ -1 +1,2 @@
1
- import { AppConfig, TemporalConfig } from "./config.js";
1
+ import { AppConfig, TemporalConfig } from "./config.js";
2
+ export { AppConfig, TemporalConfig };
@@ -24,7 +24,10 @@ interface NodeTracerProviderLike {
24
24
  }
25
25
  type WorkerStatusProvider = () => WorkerStatus;
26
26
  type ActivityClass = new (...args: any[]) => any;
27
- interface WorkerBootstrapOptions extends Omit<WorkerOptions, "taskQueue" | "activities" | "workflowsPath"> {
27
+ /**
28
+ * Options shared by both worker entry points (`runStandaloneWorker` and `runInProcessWorker`).
29
+ */
30
+ interface WorkerRunOptions extends Omit<WorkerOptions, "taskQueue" | "activities" | "workflowsPath"> {
28
31
  /**
29
32
  * Path to the workflows module. Accepts either an absolute filesystem path
30
33
  * or a `file://` URL (e.g. from `import.meta.resolve('./worker/workflows/index.js')`).
@@ -42,14 +45,35 @@ interface WorkerBootstrapOptions extends Omit<WorkerOptions, "taskQueue" | "acti
42
45
  workflowTypes?: string[];
43
46
  /** Service name for the metric. Defaults to the name derived from the task queue. */
44
47
  service?: string;
48
+ }
49
+ /**
50
+ * Options for `runInProcessWorker` — attaches the worker to an already-started service
51
+ * process. The service owns the application lifecycle; this only runs the worker (and
52
+ * only when `temporal.workerInProcess` is not `false`).
53
+ */
54
+ type RunInProcessWorkerOptions = WorkerRunOptions;
55
+ /**
56
+ * Options for `runStandaloneWorker` — the dedicated worker process. It owns the full
57
+ * application lifecycle, so `configFactory` and `deps` are required.
58
+ */
59
+ interface RunStandaloneWorkerOptions extends WorkerRunOptions {
45
60
  /**
46
- * When provided together with `deps`, `bootstrapWorker` manages the full application
47
- * lifecycle: setConfig → apply worker overrides → setDeps → initialize → start → run worker.
61
+ * Config factory passed to `app.setConfig()`. `runStandaloneWorker` manages the full
62
+ * application lifecycle: setConfig → apply worker overrides → setDeps → initialize → start → run worker.
48
63
  */
64
+ configFactory: (...args: any[]) => Promise<any>;
65
+ /** Dependency factory passed to `app.setDeps()`. */
66
+ deps: (...args: any[]) => Promise<any>;
67
+ }
68
+ /**
69
+ * @deprecated Use {@link RunStandaloneWorkerOptions} (dedicated worker process) or
70
+ * {@link RunInProcessWorkerOptions} (in-process, main service). Options for the deprecated
71
+ * {@link WorkerBootstrapOptions | bootstrapWorker} — `configFactory`/`deps` are optional here
72
+ * only to preserve its legacy behaviour of switching roles by which options are present.
73
+ */
74
+ interface WorkerBootstrapOptions extends WorkerRunOptions {
75
+ /** When provided together with `deps`, behaves like `runStandaloneWorker`; otherwise like `runInProcessWorker`. */
49
76
  configFactory?: (...args: any[]) => Promise<any>;
50
- /**
51
- * Dependency factory passed to `app.setDeps()`. Required when `configFactory` is provided.
52
- */
53
77
  deps?: (...args: any[]) => Promise<any>;
54
78
  }
55
79
  interface Container {
@@ -66,4 +90,4 @@ interface App {
66
90
  }>;
67
91
  }
68
92
  //#endregion
69
- export { ActivityClass, App, NodeTracerProviderLike, WorkerBootstrapOptions, WorkerStatusProvider };
93
+ export { ActivityClass, App, NodeTracerProviderLike, RunInProcessWorkerOptions, RunStandaloneWorkerOptions, WorkerBootstrapOptions, WorkerRunOptions, WorkerStatusProvider };
@@ -0,0 +1,2 @@
1
+ export * from "@temporalio/nexus";
2
+ export * from "nexus-rpc";
package/dist/nexus.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "@temporalio/nexus";
2
+ export * from "nexus-rpc";
3
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { buildActivitiesProxy } from "./activities/proxy.js";
2
2
  import { workflowInterceptors } from "./interceptors.js";
3
3
  import { ActivityFailure as ActivityFailure$1 } from "@temporalio/common";
4
- import { ActivityFailure, ApplicationFailure, CancellationScope, CancellationScopeOptions, CancelledFailure, ChildWorkflowFailure, ChildWorkflowHandle, ChildWorkflowOptions, CommonWorkflowOptions, ContinueAsNew, ContinueAsNewOptions, DeterminismViolationError, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, Trigger, WorkflowError, WorkflowInfo, WorkflowInterceptorsFactory, addDefaultWorkflowOptions, allHandlersFinished, condition, continueAsNew, currentUpdateInfo, defineQuery, defineSignal, defineUpdate, deprecatePatch, executeChild, extractWorkflowType, getExternalWorkflowHandle, inWorkflowContext, isCancellation, log, makeContinueAsNewFunc, patched, proxyActivities, proxyLocalActivities, proxySinks, scheduleActivity, scheduleLocalActivity, setDefaultSignalHandler, setHandler, sleep, startChild, upsertMemo, upsertSearchAttributes, uuid4, workflowInfo, workflowMetadataQuery } from "@temporalio/workflow";
4
+ import { ActivityFailure, ApplicationFailure, CancellationScope, CancellationScopeOptions, CancelledFailure, ChildWorkflowFailure, ChildWorkflowHandle, ChildWorkflowOptions, CommonWorkflowOptions, ContinueAsNew, ContinueAsNewOptions, DeterminismViolationError, NexusOperationCancellationType, NexusOperationHandle, NexusServiceClient, NexusServiceClientOptions, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, TimerOptions, Trigger, UnsafeRandomSource, WorkflowError, WorkflowInfo, WorkflowInterceptorsFactory, WorkflowRandomStream, addDefaultWorkflowOptions, allHandlersFinished, condition, continueAsNew, createNexusServiceClient, currentUpdateInfo, defineQuery, defineSignal, defineUpdate, deprecatePatch, executeChild, extractWorkflowType, getCurrentDetails, getExternalWorkflowHandle, getRandomStream, inWorkflowContext, isCancellation, log, makeContinueAsNewFunc, patched, proxyActivities, proxyLocalActivities, proxySinks, scheduleActivity, scheduleLocalActivity, setCurrentDetails, setDefaultQueryHandler, setDefaultSignalHandler, setDefaultUpdateHandler, setHandler, setWorkflowOptions, sleep, startChild, upsertMemo, upsertSearchAttributes, uuid4, workflowInfo, workflowMetadataQuery, workflowRandom } from "@temporalio/workflow";
5
5
 
6
6
  //#region src/operations.d.ts
7
7
  declare function isNonRetryableFailure(err: unknown): err is ActivityFailure$1;
8
8
  //#endregion
9
- export { ActivityFailure, ApplicationFailure, CancellationScope, type CancellationScopeOptions, CancelledFailure, ChildWorkflowFailure, type ChildWorkflowHandle, type ChildWorkflowOptions, type CommonWorkflowOptions, ContinueAsNew, type ContinueAsNewOptions, DeterminismViolationError, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, Trigger, WorkflowError, type WorkflowInfo, type WorkflowInterceptorsFactory, addDefaultWorkflowOptions, allHandlersFinished, buildActivitiesProxy, condition, continueAsNew, currentUpdateInfo, defineQuery, defineSignal, defineUpdate, deprecatePatch, executeChild, extractWorkflowType, getExternalWorkflowHandle, inWorkflowContext, isCancellation, isNonRetryableFailure, log, makeContinueAsNewFunc, patched, proxyActivities, proxyLocalActivities, proxySinks, scheduleActivity, scheduleLocalActivity, setDefaultSignalHandler, setHandler, sleep, startChild, upsertMemo, upsertSearchAttributes, uuid4, workflowInfo, workflowInterceptors, workflowMetadataQuery };
9
+ export { ActivityFailure, ApplicationFailure, CancellationScope, type CancellationScopeOptions, CancelledFailure, ChildWorkflowFailure, type ChildWorkflowHandle, type ChildWorkflowOptions, type CommonWorkflowOptions, ContinueAsNew, type ContinueAsNewOptions, DeterminismViolationError, NexusOperationCancellationType, type NexusOperationHandle, type NexusServiceClient, type NexusServiceClientOptions, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, type TimerOptions, Trigger, type UnsafeRandomSource, WorkflowError, type WorkflowInfo, type WorkflowInterceptorsFactory, type WorkflowRandomStream, addDefaultWorkflowOptions, allHandlersFinished, buildActivitiesProxy, condition, continueAsNew, createNexusServiceClient, currentUpdateInfo, defineQuery, defineSignal, defineUpdate, deprecatePatch, executeChild, extractWorkflowType, getCurrentDetails, getExternalWorkflowHandle, getRandomStream, inWorkflowContext, isCancellation, isNonRetryableFailure, log, makeContinueAsNewFunc, patched, proxyActivities, proxyLocalActivities, proxySinks, scheduleActivity, scheduleLocalActivity, setCurrentDetails, setDefaultQueryHandler, setDefaultSignalHandler, setDefaultUpdateHandler, setHandler, setWorkflowOptions, sleep, startChild, upsertMemo, upsertSearchAttributes, uuid4, workflowInfo, workflowInterceptors, workflowMetadataQuery, workflowRandom };
@@ -2,7 +2,7 @@ import { buildActivitiesProxy } from "./activities/proxy.js";
2
2
  import "./activities/index.js";
3
3
  import { workflowInterceptors } from "./interceptors.js";
4
4
  import { ActivityFailure as ActivityFailure$1, ApplicationFailure as ApplicationFailure$1, RetryState } from "@temporalio/common";
5
- import { ActivityFailure, ApplicationFailure, CancellationScope, CancelledFailure, ChildWorkflowFailure, ContinueAsNew, DeterminismViolationError, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, Trigger, WorkflowError, addDefaultWorkflowOptions, allHandlersFinished, condition, continueAsNew, currentUpdateInfo, defineQuery, defineSignal, defineUpdate, deprecatePatch, executeChild, extractWorkflowType, getExternalWorkflowHandle, inWorkflowContext, isCancellation, log, makeContinueAsNewFunc, patched, proxyActivities, proxyLocalActivities, proxySinks, scheduleActivity, scheduleLocalActivity, setDefaultSignalHandler, setHandler, sleep, startChild, upsertMemo, upsertSearchAttributes, uuid4, workflowInfo, workflowMetadataQuery } from "@temporalio/workflow";
5
+ import { ActivityFailure, ApplicationFailure, CancellationScope, CancelledFailure, ChildWorkflowFailure, ContinueAsNew, DeterminismViolationError, NexusOperationCancellationType, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, Trigger, WorkflowError, addDefaultWorkflowOptions, allHandlersFinished, condition, continueAsNew, createNexusServiceClient, currentUpdateInfo, defineQuery, defineSignal, defineUpdate, deprecatePatch, executeChild, extractWorkflowType, getCurrentDetails, getExternalWorkflowHandle, getRandomStream, inWorkflowContext, isCancellation, log, makeContinueAsNewFunc, patched, proxyActivities, proxyLocalActivities, proxySinks, scheduleActivity, scheduleLocalActivity, setCurrentDetails, setDefaultQueryHandler, setDefaultSignalHandler, setDefaultUpdateHandler, setHandler, setWorkflowOptions, sleep, startChild, upsertMemo, upsertSearchAttributes, uuid4, workflowInfo, workflowMetadataQuery, workflowRandom } from "@temporalio/workflow";
6
6
  //#region src/operations.ts
7
7
  function isNonRetryableFailure(err) {
8
8
  if (!(err instanceof ActivityFailure$1)) return false;
@@ -10,4 +10,4 @@ function isNonRetryableFailure(err) {
10
10
  return err.cause instanceof ApplicationFailure$1 && Boolean(err.cause.nonRetryable);
11
11
  }
12
12
  //#endregion
13
- export { ActivityFailure, ApplicationFailure, CancellationScope, CancelledFailure, ChildWorkflowFailure, ContinueAsNew, DeterminismViolationError, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, Trigger, WorkflowError, addDefaultWorkflowOptions, allHandlersFinished, buildActivitiesProxy, condition, continueAsNew, currentUpdateInfo, defineQuery, defineSignal, defineUpdate, deprecatePatch, executeChild, extractWorkflowType, getExternalWorkflowHandle, inWorkflowContext, isCancellation, isNonRetryableFailure, log, makeContinueAsNewFunc, patched, proxyActivities, proxyLocalActivities, proxySinks, scheduleActivity, scheduleLocalActivity, setDefaultSignalHandler, setHandler, sleep, startChild, upsertMemo, upsertSearchAttributes, uuid4, workflowInfo, workflowInterceptors, workflowMetadataQuery };
13
+ export { ActivityFailure, ApplicationFailure, CancellationScope, CancelledFailure, ChildWorkflowFailure, ContinueAsNew, DeterminismViolationError, NexusOperationCancellationType, ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, Trigger, WorkflowError, addDefaultWorkflowOptions, allHandlersFinished, buildActivitiesProxy, condition, continueAsNew, createNexusServiceClient, currentUpdateInfo, defineQuery, defineSignal, defineUpdate, deprecatePatch, executeChild, extractWorkflowType, getCurrentDetails, getExternalWorkflowHandle, getRandomStream, inWorkflowContext, isCancellation, isNonRetryableFailure, log, makeContinueAsNewFunc, patched, proxyActivities, proxyLocalActivities, proxySinks, scheduleActivity, scheduleLocalActivity, setCurrentDetails, setDefaultQueryHandler, setDefaultSignalHandler, setDefaultUpdateHandler, setHandler, setWorkflowOptions, sleep, startChild, upsertMemo, upsertSearchAttributes, uuid4, workflowInfo, workflowInterceptors, workflowMetadataQuery, workflowRandom };
@@ -8,7 +8,7 @@ declare class TemporalClient implements OnInit {
8
8
  private readonly config;
9
9
  private readonly envService;
10
10
  private readonly logger;
11
- nativeClient!: Client;
11
+ nativeClient: Client;
12
12
  private readonly defaultTimezone;
13
13
  /** Default maximum gRPC message size (in bytes) the client may receive. */
14
14
  private readonly defaultMaxReceiveMessageLength;
@@ -18,6 +18,11 @@ declare class TemporalClient implements OnInit {
18
18
  get workflowService(): Client["workflowService"];
19
19
  get schedule(): Client["schedule"];
20
20
  get taskQueue(): Client["taskQueue"];
21
+ /**
22
+ * Client for starting and managing Standalone Activities (run directly from a client,
23
+ * without a workflow). Mirrors `nativeClient.activity`.
24
+ */
25
+ get activity(): Client["activity"];
21
26
  onInit(): Promise<void>;
22
27
  syncSchedules(schedules: Record<string, ((config: TemporalConfig) => ScheduleOptions) | ScheduleOptions>): Promise<void>;
23
28
  updateSchedule(scheduleId: string, updateData: ScheduleUpdateOptions): Promise<void>;
@@ -33,6 +33,13 @@ var TemporalClient = class {
33
33
  get taskQueue() {
34
34
  return this.nativeClient.taskQueue;
35
35
  }
36
+ /**
37
+ * Client for starting and managing Standalone Activities (run directly from a client,
38
+ * without a workflow). Mirrors `nativeClient.activity`.
39
+ */
40
+ get activity() {
41
+ return this.nativeClient.activity;
42
+ }
36
43
  async onInit() {
37
44
  const { address, tls, connectTimeout, channelArgs, encryptionEnabled, encryptionKeyId, encryptionKeyRefreshInterval, ...clientConfig } = this.config;
38
45
  const connection = await Connection.connect({
@@ -1,5 +1,5 @@
1
1
  import { AppConfig } from "../interfaces/config.js";
2
- import { ActivityClass, App, NodeTracerProviderLike, WorkerBootstrapOptions } from "../interfaces/services/worker.js";
2
+ import { ActivityClass, App, NodeTracerProviderLike, RunInProcessWorkerOptions, RunStandaloneWorkerOptions, WorkerBootstrapOptions, WorkerRunOptions } from "../interfaces/services/worker.js";
3
3
  import { WorkerHealthDetails, WorkerHealthService } from "./workerHealth.js";
4
4
  import { buildWorkerIdentity } from "./worker/identity.js";
5
5
  import { EnvService } from "@diia-inhouse/env";
@@ -33,75 +33,81 @@ declare function applyWorkerProcessConfig(config: AppConfig): void;
33
33
  declare function toWorkflowsPath(input: string): string;
34
34
  declare function instantiateActivities(app: App, workerActivities: Record<string, ActivityClass>): Record<string, (...args: unknown[]) => Promise<unknown>>;
35
35
  /**
36
- * Initializes and starts Temporal worker with full dependency injection support.
36
+ * Runs the Temporal worker in the **dedicated worker process**.
37
37
  *
38
- * This is the recommended way to initialize Temporal workers. It handles:
39
- * - Automatic dependency injection for activities
40
- * - AsyncLocalStorage setup for distributed tracing
41
- * - OpenTelemetry integration
42
- * - Activity instantiation and binding
38
+ * This entry point owns the full application lifecycle it is meant to be the only
39
+ * call in a standalone worker entry file (e.g. `workerEntry.ts`):
43
40
  *
44
- * @param app - App instance for DI container and config access
45
- * @param options - Worker configuration options
46
- * @param options.nodeTracerProvider - OpenTelemetry tracer provider
47
- * @param options.workflowsPath - Path to workflows module
48
- * @param options.activities - Activity classes to instantiate
41
+ * setConfig apply worker overrides setDeps initialize start → run worker
42
+ *
43
+ * A worker process always runs a worker, so `workerInProcess` is not consulted here.
44
+ * Applies the worker-process config overrides (disables queue consumers, moves metrics
45
+ * to the `temporal-worker` scraper port) before the app starts, and integrates worker
46
+ * health with the app's centralized health check.
47
+ *
48
+ * @param app - App instance (config is set here, so it must be un-initialized)
49
+ * @param options - Worker process options; `configFactory` and `deps` are required
49
50
  *
50
51
  * @example
51
52
  * ```typescript
52
- * // Define your activities
53
- * const workerActivities = {
54
- * userActivity: UserActivity,
55
- * notificationActivity: NotificationActivity,
56
- * }
57
- *
58
- * // Initialize and start the worker
59
- * await initTemporalWorker(app, {
60
- * nodeTracerProvider,
53
+ * // workerEntry.ts the standalone worker process
54
+ * const app = new Application(serviceName, nodeTracerProvider, loggerConfig)
55
+ *
56
+ * await runStandaloneWorker(app, {
57
+ * configFactory,
58
+ * deps,
61
59
  * workflowsPath: import.meta.resolve('./worker/workflows/index.js'),
62
60
  * activities: workerActivities,
61
+ * nodeTracerProvider,
63
62
  * })
64
63
  * ```
65
64
  */
66
- declare function initTemporalWorker(app: App, options: {
67
- nodeTracerProvider: NodeTracerProviderLike;
68
- workflowsPath: string;
69
- activities: Record<string, ActivityClass>; /** The workflows this worker runs. Auto-detected from the workflows folder when left empty. */
70
- workflowTypes?: string[]; /** Service name. Defaults to the name derived from the task queue. */
71
- service?: string;
72
- } & Omit<WorkerOptions, "taskQueue" | "activities" | "workflowsPath">): Promise<void>;
65
+ declare function runStandaloneWorker(app: App, options: RunStandaloneWorkerOptions): Promise<void>;
73
66
  /**
74
- * Bootstraps and runs Temporal worker with graceful shutdown.
67
+ * Runs the Temporal worker **in the main service process**, alongside an app that the
68
+ * caller has already initialized and started.
75
69
  *
76
- * Handles both in-process and separate-process worker topologies:
70
+ * Behaviour is driven solely by `temporal.workerInProcess`:
77
71
  *
78
- * - **In-process** (`workerInProcess` is `true` or unset): initializes and runs the worker.
79
- * - **Separate process** (called from a dedicated worker entry with `configFactory`/`deps`):
80
- * manages the full application lifecycle: setConfig → apply worker overrides → setDeps →
81
- * initialize → start → run worker.
82
- * - **Service-only** (`workerInProcess` is `false`, no `configFactory`): disables temporal
83
- * scrapers on the main service (worker handles them separately) and returns immediately.
72
+ * - not `false` (default): builds and runs the worker in this process (blocks until shutdown).
73
+ * - `false`: the worker runs elsewhere (see {@link runStandaloneWorker}); disables the temporal
74
+ * scrapers on this service and returns immediately.
84
75
  *
85
- * Automatically integrates worker health with the app's centralized health check
86
- * system via `HealthCheck.addHealthCheckable()`.
76
+ * Call it after `initialized.start()`.
87
77
  *
88
78
  * @param app - App instance for DI container and config access
89
- * @param options - Worker bootstrap options
79
+ * @param options - In-process worker options
90
80
  *
91
81
  * @example
92
82
  * ```typescript
93
- * // Separate worker process with full lifecycle management
94
- * const app = new Application(serviceName, nodeTracerProvider, loggerConfig)
83
+ * // bootstrap.ts the main service process
84
+ * await app.setConfig(configFactory)
85
+ * await app.setDeps(deps)
86
+ * const initialized = await app.initialize()
87
+ * await initialized.start()
95
88
  *
96
- * await bootstrapWorker(app, {
97
- * configFactory,
98
- * deps,
89
+ * await runInProcessWorker(app, {
99
90
  * workflowsPath: import.meta.resolve('./worker/workflows/index.js'),
100
91
  * activities: workerActivities,
101
92
  * nodeTracerProvider,
102
93
  * })
103
94
  * ```
104
95
  */
96
+ declare function runInProcessWorker(app: App, options: RunInProcessWorkerOptions): Promise<void>;
97
+ /**
98
+ * @deprecated Split into two role-specific entry points — migrate to one of:
99
+ *
100
+ * - {@link runStandaloneWorker} — the dedicated worker process (was `bootstrapWorker(app, { configFactory, deps, ... })`).
101
+ * - {@link runInProcessWorker} — the worker running inside the already-started main service
102
+ * (was `bootstrapWorker(app, { ... })` without `configFactory`/`deps`).
103
+ *
104
+ * This shim just forwards to those based on whether `configFactory` and `deps` are present, so
105
+ * existing call sites keep working. It multiplexes both roles by inspecting which options were
106
+ * passed — the exact ambiguity the split removes — and will be dropped in a future major.
107
+ *
108
+ * @param app - App instance for DI container and config access
109
+ * @param options - Legacy worker bootstrap options
110
+ */
105
111
  declare function bootstrapWorker(app: App, options: WorkerBootstrapOptions): Promise<void>;
106
112
  /**
107
113
  * Initializes Temporal worker.
@@ -125,4 +131,4 @@ declare function initWorker({
125
131
  service?: string;
126
132
  }, envService: EnvService, logger?: Logger, nodeTracerProvider?: NodeTracerProviderLike, asyncLocalStorage?: AsyncLocalStorage<AlsData>): Promise<Worker>;
127
133
  //#endregion
128
- export { applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, initTemporalWorker, initWorker, instantiateActivities, toWorkflowsPath };
134
+ export { type ActivityClass, type App, type RunInProcessWorkerOptions, type RunStandaloneWorkerOptions, type WorkerBootstrapOptions, type WorkerHealthDetails, WorkerHealthService, type WorkerRunOptions, applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, buildWorkerIdentity, initWorker, instantiateActivities, runInProcessWorker, runStandaloneWorker, toWorkflowsPath };
@@ -111,96 +111,118 @@ function instantiateActivities(app, workerActivities) {
111
111
  return activities;
112
112
  }
113
113
  /**
114
- * Initializes and starts Temporal worker with full dependency injection support.
114
+ * Runs the Temporal worker in the **dedicated worker process**.
115
115
  *
116
- * This is the recommended way to initialize Temporal workers. It handles:
117
- * - Automatic dependency injection for activities
118
- * - AsyncLocalStorage setup for distributed tracing
119
- * - OpenTelemetry integration
120
- * - Activity instantiation and binding
116
+ * This entry point owns the full application lifecycle it is meant to be the only
117
+ * call in a standalone worker entry file (e.g. `workerEntry.ts`):
121
118
  *
122
- * @param app - App instance for DI container and config access
123
- * @param options - Worker configuration options
124
- * @param options.nodeTracerProvider - OpenTelemetry tracer provider
125
- * @param options.workflowsPath - Path to workflows module
126
- * @param options.activities - Activity classes to instantiate
119
+ * setConfig apply worker overrides setDeps initialize start → run worker
120
+ *
121
+ * A worker process always runs a worker, so `workerInProcess` is not consulted here.
122
+ * Applies the worker-process config overrides (disables queue consumers, moves metrics
123
+ * to the `temporal-worker` scraper port) before the app starts, and integrates worker
124
+ * health with the app's centralized health check.
125
+ *
126
+ * @param app - App instance (config is set here, so it must be un-initialized)
127
+ * @param options - Worker process options; `configFactory` and `deps` are required
127
128
  *
128
129
  * @example
129
130
  * ```typescript
130
- * // Define your activities
131
- * const workerActivities = {
132
- * userActivity: UserActivity,
133
- * notificationActivity: NotificationActivity,
134
- * }
131
+ * // workerEntry.ts the standalone worker process
132
+ * const app = new Application(serviceName, nodeTracerProvider, loggerConfig)
135
133
  *
136
- * // Initialize and start the worker
137
- * await initTemporalWorker(app, {
138
- * nodeTracerProvider,
134
+ * await runStandaloneWorker(app, {
135
+ * configFactory,
136
+ * deps,
139
137
  * workflowsPath: import.meta.resolve('./worker/workflows/index.js'),
140
138
  * activities: workerActivities,
139
+ * nodeTracerProvider,
141
140
  * })
142
141
  * ```
143
142
  */
144
- async function initTemporalWorker(app, options) {
145
- const config = app.getConfig?.();
146
- const { nodeTracerProvider, workflowsPath: workflowsPathInput, activities, ...workerOptions } = options;
147
- const workflowsPath = toWorkflowsPath(workflowsPathInput);
148
- const envService = app.container.resolve("envService");
149
- const logger = app.container.resolve("logger");
150
- const asyncLocalStorage = app.container.resolve("asyncLocalStorage");
151
- const instantiatedActivities = instantiateActivities(app, activities);
152
- await (await initWorker(config, {
153
- ...workerOptions,
154
- workflowsPath,
155
- activities: instantiatedActivities
156
- }, envService, logger, nodeTracerProvider, asyncLocalStorage)).run();
143
+ async function runStandaloneWorker(app, options) {
144
+ const { configFactory, deps, ...runOptions } = options;
145
+ await app.setConfig(configFactory);
146
+ applyWorkerProcessConfig(app.getConfig());
147
+ await app.setDeps(deps);
148
+ await (await app.initialize()).start();
149
+ await runWorker(app, runOptions);
157
150
  }
158
151
  /**
159
- * Bootstraps and runs Temporal worker with graceful shutdown.
152
+ * Runs the Temporal worker **in the main service process**, alongside an app that the
153
+ * caller has already initialized and started.
160
154
  *
161
- * Handles both in-process and separate-process worker topologies:
155
+ * Behaviour is driven solely by `temporal.workerInProcess`:
162
156
  *
163
- * - **In-process** (`workerInProcess` is `true` or unset): initializes and runs the worker.
164
- * - **Separate process** (called from a dedicated worker entry with `configFactory`/`deps`):
165
- * manages the full application lifecycle: setConfig → apply worker overrides → setDeps →
166
- * initialize → start → run worker.
167
- * - **Service-only** (`workerInProcess` is `false`, no `configFactory`): disables temporal
168
- * scrapers on the main service (worker handles them separately) and returns immediately.
157
+ * - not `false` (default): builds and runs the worker in this process (blocks until shutdown).
158
+ * - `false`: the worker runs elsewhere (see {@link runStandaloneWorker}); disables the temporal
159
+ * scrapers on this service and returns immediately.
169
160
  *
170
- * Automatically integrates worker health with the app's centralized health check
171
- * system via `HealthCheck.addHealthCheckable()`.
161
+ * Call it after `initialized.start()`.
172
162
  *
173
163
  * @param app - App instance for DI container and config access
174
- * @param options - Worker bootstrap options
164
+ * @param options - In-process worker options
175
165
  *
176
166
  * @example
177
167
  * ```typescript
178
- * // Separate worker process with full lifecycle management
179
- * const app = new Application(serviceName, nodeTracerProvider, loggerConfig)
168
+ * // bootstrap.ts the main service process
169
+ * await app.setConfig(configFactory)
170
+ * await app.setDeps(deps)
171
+ * const initialized = await app.initialize()
172
+ * await initialized.start()
180
173
  *
181
- * await bootstrapWorker(app, {
182
- * configFactory,
183
- * deps,
174
+ * await runInProcessWorker(app, {
184
175
  * workflowsPath: import.meta.resolve('./worker/workflows/index.js'),
185
176
  * activities: workerActivities,
186
177
  * nodeTracerProvider,
187
178
  * })
188
179
  * ```
189
180
  */
190
- async function bootstrapWorker(app, options) {
191
- const { configFactory, deps, workflowsPath: workflowsPathInput, activities, nodeTracerProvider, shutdownSignals = ["SIGTERM", "SIGINT"], ...workerOptions } = options;
192
- const workflowsPath = toWorkflowsPath(workflowsPathInput);
193
- if (configFactory && deps) {
194
- await app.setConfig(configFactory);
195
- applyWorkerProcessConfig(app.getConfig());
196
- await app.setDeps(deps);
197
- await (await app.initialize()).start();
198
- }
181
+ async function runInProcessWorker(app, options) {
199
182
  const config = app.getConfig?.();
200
- if (!configFactory && config.temporal.workerInProcess === false) {
183
+ if (config.temporal.workerInProcess === false) {
201
184
  applyServiceProcessConfig(config);
202
185
  return;
203
186
  }
187
+ await runWorker(app, options);
188
+ }
189
+ /**
190
+ * @deprecated Split into two role-specific entry points — migrate to one of:
191
+ *
192
+ * - {@link runStandaloneWorker} — the dedicated worker process (was `bootstrapWorker(app, { configFactory, deps, ... })`).
193
+ * - {@link runInProcessWorker} — the worker running inside the already-started main service
194
+ * (was `bootstrapWorker(app, { ... })` without `configFactory`/`deps`).
195
+ *
196
+ * This shim just forwards to those based on whether `configFactory` and `deps` are present, so
197
+ * existing call sites keep working. It multiplexes both roles by inspecting which options were
198
+ * passed — the exact ambiguity the split removes — and will be dropped in a future major.
199
+ *
200
+ * @param app - App instance for DI container and config access
201
+ * @param options - Legacy worker bootstrap options
202
+ */
203
+ async function bootstrapWorker(app, options) {
204
+ const { configFactory, deps, ...runOptions } = options;
205
+ if (configFactory && deps) {
206
+ await runStandaloneWorker(app, {
207
+ ...runOptions,
208
+ configFactory,
209
+ deps
210
+ });
211
+ return;
212
+ }
213
+ await runInProcessWorker(app, runOptions);
214
+ }
215
+ /**
216
+ * Shared worker startup used by both {@link runStandaloneWorker} and {@link runInProcessWorker}.
217
+ *
218
+ * Assumes the app is already initialized and started. Instantiates activities from the DI
219
+ * container, creates the worker, registers its health check, installs graceful-shutdown
220
+ * signal handlers, and runs it until shutdown.
221
+ */
222
+ async function runWorker(app, options) {
223
+ const { workflowsPath: workflowsPathInput, activities, nodeTracerProvider, shutdownSignals = ["SIGTERM", "SIGINT"], ...workerOptions } = options;
224
+ const workflowsPath = toWorkflowsPath(workflowsPathInput);
225
+ const config = app.getConfig?.();
204
226
  const envService = app.container.resolve("envService");
205
227
  const logger = app.container.resolve("logger");
206
228
  const asyncLocalStorage = app.container.resolve("asyncLocalStorage");
@@ -298,4 +320,4 @@ async function initWorker({ temporal: temporalConfig, metrics: { custom: metrics
298
320
  }
299
321
  }
300
322
  //#endregion
301
- export { applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, initTemporalWorker, initWorker, instantiateActivities, toWorkflowsPath };
323
+ export { WorkerHealthService, applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, buildWorkerIdentity, initWorker, instantiateActivities, runInProcessWorker, runStandaloneWorker, toWorkflowsPath };
package/dist/worker.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { workflowInterceptors } from "./interceptors.js";
2
- import { ActivityClass, App, WorkerBootstrapOptions } from "./interfaces/services/worker.js";
2
+ import { ActivityClass, App, RunInProcessWorkerOptions, RunStandaloneWorkerOptions, WorkerBootstrapOptions, WorkerRunOptions } from "./interfaces/services/worker.js";
3
3
  import { WorkerHealthDetails, WorkerHealthService } from "./services/workerHealth.js";
4
4
  import { buildWorkerIdentity } from "./services/worker/identity.js";
5
- import { applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, initTemporalWorker, initWorker, instantiateActivities, toWorkflowsPath } from "./services/worker.js";
5
+ import { applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, initWorker, instantiateActivities, runInProcessWorker, runStandaloneWorker, toWorkflowsPath } from "./services/worker.js";
6
6
  import { RegisterWorkerInfoParams, WORKER_INFO_METRIC, WorkerInfoLabels, deriveWorkflowTypes, registerWorkerInfo, taskQueueToService } from "./services/worker/info.js";
7
- import { NativeConnection, Runtime, State, Worker, WorkerInterceptors, WorkerOptions, WorkerStatus, bundleWorkflowCode } from "@temporalio/worker";
8
- export { ActivityClass, App, NativeConnection, RegisterWorkerInfoParams, Runtime, type State, WORKER_INFO_METRIC, Worker, WorkerBootstrapOptions, WorkerHealthDetails, WorkerHealthService, WorkerInfoLabels, type WorkerInterceptors, type WorkerOptions, type WorkerStatus, applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, buildWorkerIdentity, bundleWorkflowCode, deriveWorkflowTypes, initTemporalWorker, initWorker, instantiateActivities, registerWorkerInfo, taskQueueToService, toWorkflowsPath, workflowInterceptors };
7
+ import { NativeConnection, NativeConnectionPlugin, Runtime, State, Worker, WorkerDeploymentOptions, WorkerInterceptors, WorkerOptions, WorkerPlugin, WorkerStatus, bundleWorkflowCode } from "@temporalio/worker";
8
+ export { type ActivityClass, type App, NativeConnection, type NativeConnectionPlugin, RegisterWorkerInfoParams, type RunInProcessWorkerOptions, type RunStandaloneWorkerOptions, Runtime, type State, WORKER_INFO_METRIC, Worker, type WorkerBootstrapOptions, type WorkerDeploymentOptions, type WorkerHealthDetails, WorkerHealthService, WorkerInfoLabels, type WorkerInterceptors, type WorkerOptions, type WorkerPlugin, type WorkerRunOptions, type WorkerStatus, applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, buildWorkerIdentity, bundleWorkflowCode, deriveWorkflowTypes, initWorker, instantiateActivities, registerWorkerInfo, runInProcessWorker, runStandaloneWorker, taskQueueToService, toWorkflowsPath, workflowInterceptors };
package/dist/worker.js CHANGED
@@ -2,6 +2,6 @@ import { workflowInterceptors } from "./interceptors.js";
2
2
  import { buildWorkerIdentity } from "./services/worker/identity.js";
3
3
  import { WORKER_INFO_METRIC, deriveWorkflowTypes, registerWorkerInfo, taskQueueToService } from "./services/worker/info.js";
4
4
  import { WorkerHealthService } from "./services/workerHealth.js";
5
- import { applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, initTemporalWorker, initWorker, instantiateActivities, toWorkflowsPath } from "./services/worker.js";
5
+ import { applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, initWorker, instantiateActivities, runInProcessWorker, runStandaloneWorker, toWorkflowsPath } from "./services/worker.js";
6
6
  import { NativeConnection, Runtime, Worker, bundleWorkflowCode } from "@temporalio/worker";
7
- export { NativeConnection, Runtime, WORKER_INFO_METRIC, Worker, WorkerHealthService, applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, buildWorkerIdentity, bundleWorkflowCode, deriveWorkflowTypes, initTemporalWorker, initWorker, instantiateActivities, registerWorkerInfo, taskQueueToService, toWorkflowsPath, workflowInterceptors };
7
+ export { NativeConnection, Runtime, WORKER_INFO_METRIC, Worker, WorkerHealthService, applyServiceProcessConfig, applyWorkerProcessConfig, bootstrapWorker, buildWorkerIdentity, bundleWorkflowCode, deriveWorkflowTypes, initWorker, instantiateActivities, registerWorkerInfo, runInProcessWorker, runStandaloneWorker, taskQueueToService, toWorkflowsPath, workflowInterceptors };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diia-inhouse/workflow",
3
- "version": "2.9.13",
3
+ "version": "2.10.0",
4
4
  "description": "Workflow",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,37 +17,42 @@
17
17
  },
18
18
  "exports": {
19
19
  ".": {
20
- "types": "./dist/types/index.d.ts",
20
+ "types": "./dist/index.d.ts",
21
21
  "import": "./dist/index.js",
22
22
  "require": "./dist/index.js"
23
23
  },
24
24
  "./activity": {
25
- "types": "./dist/types/activity.d.ts",
25
+ "types": "./dist/activity.d.ts",
26
26
  "import": "./dist/activity.js",
27
27
  "require": "./dist/activity.js"
28
28
  },
29
29
  "./client": {
30
- "types": "./dist/types/client.d.ts",
30
+ "types": "./dist/client.d.ts",
31
31
  "import": "./dist/client.js",
32
32
  "require": "./dist/client.js"
33
33
  },
34
34
  "./common": {
35
- "types": "./dist/types/common.d.ts",
35
+ "types": "./dist/common.d.ts",
36
36
  "import": "./dist/common.js",
37
37
  "require": "./dist/common.js"
38
38
  },
39
39
  "./operations": {
40
- "types": "./dist/types/operations.d.ts",
40
+ "types": "./dist/operations.d.ts",
41
41
  "import": "./dist/operations.js",
42
42
  "require": "./dist/operations.js"
43
43
  },
44
44
  "./worker": {
45
- "types": "./dist/types/worker.d.ts",
45
+ "types": "./dist/worker.d.ts",
46
46
  "import": "./dist/worker.js",
47
47
  "require": "./dist/worker.js"
48
48
  },
49
+ "./nexus": {
50
+ "types": "./dist/nexus.d.ts",
51
+ "import": "./dist/nexus.js",
52
+ "require": "./dist/nexus.js"
53
+ },
49
54
  "./testing": {
50
- "types": "./dist/types/testing.d.ts",
55
+ "types": "./dist/testing.d.ts",
51
56
  "import": "./dist/testing.js",
52
57
  "require": "./dist/testing.js"
53
58
  }
@@ -70,15 +75,17 @@
70
75
  "@opentelemetry/resources": "1.30.1",
71
76
  "@opentelemetry/sdk-trace-node": "1.30.1",
72
77
  "@opentelemetry/semantic-conventions": "1.40.0",
73
- "@temporalio/activity": "1.12.1",
74
- "@temporalio/client": "1.12.1",
75
- "@temporalio/common": "1.12.1",
76
- "@temporalio/interceptors-opentelemetry": "1.12.1",
77
- "@temporalio/proto": "1.12.1",
78
- "@temporalio/testing": "1.12.1",
79
- "@temporalio/worker": "1.12.1",
80
- "@temporalio/workflow": "1.12.1",
78
+ "@temporalio/activity": "1.20.2",
79
+ "@temporalio/client": "1.20.2",
80
+ "@temporalio/common": "1.20.2",
81
+ "@temporalio/interceptors-opentelemetry": "1.20.2",
82
+ "@temporalio/nexus": "1.20.2",
83
+ "@temporalio/proto": "1.20.2",
84
+ "@temporalio/testing": "1.20.2",
85
+ "@temporalio/worker": "1.20.2",
86
+ "@temporalio/workflow": "1.20.2",
81
87
  "lodash": "4.18.1",
88
+ "nexus-rpc": "0.0.2",
82
89
  "yargs": "18.0.0"
83
90
  },
84
91
  "peerDependencies": {
@@ -100,31 +107,31 @@
100
107
  },
101
108
  "devDependencies": {
102
109
  "@diia-inhouse/configs": "7.0.1",
103
- "@diia-inhouse/diia-logger": "4.4.8",
104
- "@diia-inhouse/diia-metrics": "7.1.46",
105
- "@diia-inhouse/diia-queue": "14.1.3",
106
- "@diia-inhouse/env": "3.3.29",
107
- "@diia-inhouse/healthcheck": "2.1.53",
108
- "@diia-inhouse/oxc-config": "1.11.0",
109
- "@diia-inhouse/test": "8.2.17",
110
- "@diia-inhouse/types": "14.1.1",
111
- "@diia-inhouse/utils": "6.0.43",
110
+ "@diia-inhouse/diia-logger": "4.4.14",
111
+ "@diia-inhouse/diia-metrics": "7.1.53",
112
+ "@diia-inhouse/diia-queue": "14.1.4",
113
+ "@diia-inhouse/env": "3.3.31",
114
+ "@diia-inhouse/healthcheck": "2.1.60",
115
+ "@diia-inhouse/oxc-config": "2.0.0",
116
+ "@diia-inhouse/test": "8.2.19",
117
+ "@diia-inhouse/types": "14.2.0",
118
+ "@diia-inhouse/utils": "6.0.49",
112
119
  "@types/lodash": "4.17.24",
113
- "@types/node": "25.6.2",
120
+ "@types/node": "26.1.0",
114
121
  "@types/yargs": "17.0.35",
115
- "@vitest/coverage-v8": "4.1.5",
116
- "@vitest/ui": "4.1.5",
122
+ "@vitest/coverage-v8": "4.1.9",
123
+ "@vitest/ui": "4.1.9",
117
124
  "glob": "13.0.6",
118
125
  "lockfile-lint": "5.0.0",
119
126
  "madge": "8.0.0",
120
- "oxfmt": "0.48.0",
121
- "oxlint": "1.63.0",
122
- "oxlint-tsgolint": "0.22.1",
127
+ "oxfmt": "0.57.0",
128
+ "oxlint": "1.72.0",
129
+ "oxlint-tsgolint": "0.24.0",
123
130
  "rimraf": "6.1.3",
124
- "semantic-release": "25.0.3",
125
- "tsdown": "0.22.0",
131
+ "semantic-release": "25.0.5",
132
+ "tsdown": "0.22.3",
126
133
  "vite-tsconfig-paths": "6.1.1",
127
- "vitest": "4.1.5",
134
+ "vitest": "4.1.9",
128
135
  "vitest-mock-extended": "4.0.0"
129
136
  },
130
137
  "release": {