@temporal-contract/client 2.0.0 → 2.2.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/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
+ import { ActivityFailure, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, ServerFailure, TerminatedFailure, TimeoutFailure, TypedSearchAttributes } from "@temporalio/common";
1
2
  import { ResultAsync } from "neverthrow";
3
+ import { ActivityDefinition, AnySchema, AnyWorkflowDefinition, ContractDefinition, QueryDefinition, SearchAttributeDefinition, SearchAttributeKindToType, SignalDefinition, SignalNamesOf, UpdateDefinition } from "@temporal-contract/contract";
2
4
  import { Client, ScheduleClient, ScheduleDescription, ScheduleOptions, ScheduleOptionsStartWorkflowAction, ScheduleOverlapPolicy, ScheduleSpec, WorkflowHandle, WorkflowSignalWithStartOptions, WorkflowStartOptions } from "@temporalio/client";
3
- import { ActivityDefinition, AnySchema, ContractDefinition, QueryDefinition, SearchAttributeDefinition, SearchAttributeKindToType, SignalDefinition, UpdateDefinition, WorkflowDefinition } from "@temporal-contract/contract";
4
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
5
6
 
6
7
  //#region src/types.d.ts
@@ -26,7 +27,7 @@ type ClientInferOutput<T extends {
26
27
  * Infer workflow function signature from client perspective
27
28
  * Client sends z.output and receives z.input
28
29
  */
29
- type ClientInferWorkflow<TWorkflow extends WorkflowDefinition> = (args: ClientInferInput<TWorkflow>) => Promise<ClientInferOutput<TWorkflow>>;
30
+ type ClientInferWorkflow<TWorkflow extends AnyWorkflowDefinition> = (args: ClientInferInput<TWorkflow>) => Promise<ClientInferOutput<TWorkflow>>;
30
31
  /**
31
32
  * Infer activity function signature from client perspective
32
33
  * Client sends z.output and receives z.input
@@ -61,26 +62,37 @@ type ClientInferActivities<TContract extends ContractDefinition> = TContract["ac
61
62
  /**
62
63
  * Infer activities from a workflow definition (client perspective)
63
64
  */
64
- type ClientInferWorkflowActivities<T extends WorkflowDefinition> = T["activities"] extends Record<string, ActivityDefinition> ? { [K in keyof T["activities"]]: ClientInferActivity<T["activities"][K]> } : {};
65
+ type ClientInferWorkflowActivities<T extends AnyWorkflowDefinition> = T["activities"] extends Record<string, ActivityDefinition> ? { [K in keyof T["activities"]]: ClientInferActivity<T["activities"][K]> } : {};
65
66
  /**
66
67
  * Infer signals from a workflow definition (client perspective)
67
68
  */
68
- type ClientInferWorkflowSignals<T extends WorkflowDefinition> = T["signals"] extends Record<string, SignalDefinition> ? { [K in keyof T["signals"]]: ClientInferSignal<T["signals"][K]> } : {};
69
+ type ClientInferWorkflowSignals<T extends AnyWorkflowDefinition> = T["signals"] extends Record<string, SignalDefinition> ? { [K in keyof T["signals"]]: ClientInferSignal<T["signals"][K]> } : {};
69
70
  /**
70
71
  * Infer queries from a workflow definition (client perspective)
71
72
  */
72
- type ClientInferWorkflowQueries<T extends WorkflowDefinition> = T["queries"] extends Record<string, QueryDefinition> ? { [K in keyof T["queries"]]: ClientInferQuery<T["queries"][K]> } : {};
73
+ type ClientInferWorkflowQueries<T extends AnyWorkflowDefinition> = T["queries"] extends Record<string, QueryDefinition> ? { [K in keyof T["queries"]]: ClientInferQuery<T["queries"][K]> } : {};
73
74
  /**
74
75
  * Infer updates from a workflow definition (client perspective)
75
76
  */
76
- type ClientInferWorkflowUpdates<T extends WorkflowDefinition> = T["updates"] extends Record<string, UpdateDefinition> ? { [K in keyof T["updates"]]: ClientInferUpdate<T["updates"][K]> } : {};
77
+ type ClientInferWorkflowUpdates<T extends AnyWorkflowDefinition> = T["updates"] extends Record<string, UpdateDefinition> ? { [K in keyof T["updates"]]: ClientInferUpdate<T["updates"][K]> } : {};
77
78
  /**
78
79
  * Infer all activities available in a workflow context (client perspective)
79
80
  * Combines workflow-specific activities with global activities
80
81
  */
81
- type ClientInferWorkflowContextActivities<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"]> = ClientInferWorkflowActivities<TContract["workflows"][TWorkflowName]> & ClientInferActivities<TContract>;
82
+ type ClientInferWorkflowContextActivities<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"] & string> = ClientInferWorkflowActivities<TContract["workflows"][TWorkflowName]> & ClientInferActivities<TContract>;
82
83
  //#endregion
83
84
  //#region src/errors.d.ts
85
+ /**
86
+ * Union of the actionable Temporal failure types that can surface as the
87
+ * `cause` of a `WorkflowFailedError`. These all extend Temporal's internal
88
+ * `TemporalFailure` base class — we list them by leaf type rather than by
89
+ * the base class so consumer code can use a single `switch (true)` over
90
+ * `instanceof` discriminants without an exhaustiveness escape hatch.
91
+ *
92
+ * Re-exported from the package entry point so consumers can import it
93
+ * directly: `import type { TemporalFailure } from "@temporal-contract/client"`.
94
+ */
95
+ type TemporalFailure = ApplicationFailure | CancelledFailure | TerminatedFailure | TimeoutFailure | ChildWorkflowFailure | ServerFailure | ActivityFailure;
84
96
  /**
85
97
  * Base class for all typed client errors with boxed pattern
86
98
  */
@@ -143,18 +155,24 @@ declare class WorkflowExecutionNotFoundError extends TypedClientError {
143
155
  * on a workflow's result and the workflow completes with a failure —
144
156
  * Temporal's `WorkflowFailedError`.
145
157
  *
146
- * `cause` is the *unwrapped* underlying failure (typically an
158
+ * `cause` is the *unwrapped* underlying {@link TemporalFailure} (typically an
147
159
  * `ApplicationFailure`, `CancelledFailure`, `TerminatedFailure`, or
148
160
  * `TimeoutFailure`) lifted from Temporal's wrapper, so callers can branch
149
161
  * on the failure category in one step (`err.cause instanceof
150
- * ApplicationFailure`) instead of unwrapping twice via the SDK wrapper.
162
+ * ApplicationFailure`) instead of unwrapping twice via the SDK wrapper. The
163
+ * SDK declares `WorkflowFailedError.cause` as the wider `Error | undefined`
164
+ * (since `cause` lives on `Error`), but the runtime guarantee — driven by
165
+ * Temporal's wire format — is that it is always a `TemporalFailure` subclass
166
+ * when the wrapper is surfaced. `classifyResultError` narrows that wider
167
+ * static type to the public {@link TemporalFailure} union with a cast, so
168
+ * consumers see the precise leaf-failure typing instead of a bare `Error`.
151
169
  *
152
170
  * Returned from `executeWorkflow` and `handle.result()`.
153
171
  */
154
172
  declare class WorkflowFailedError extends TypedClientError {
155
173
  readonly workflowId: string;
156
- readonly cause?: unknown | undefined;
157
- constructor(workflowId: string, cause?: unknown | undefined);
174
+ readonly cause?: TemporalFailure | undefined;
175
+ constructor(workflowId: string, cause?: TemporalFailure | undefined);
158
176
  }
159
177
  /**
160
178
  * Thrown when workflow input or output validation fails
@@ -213,10 +231,19 @@ type TypedScheduleActionOverrides = Pick<ScheduleOptionsStartWorkflowAction<neve
213
231
  * Workflow-action–level overrides nest under {@link action} so memo and
214
232
  * other fields with the same name don't collide between the two scopes.
215
233
  */
216
- type TypedScheduleCreateOptions<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"]> = {
234
+ type TypedScheduleCreateOptions<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"] & string> = {
217
235
  /** Schedule ID. Recommended to use a meaningful business identifier. */scheduleId: string; /** When the schedule should fire (cron, interval, calendar). */
218
236
  spec: ScheduleSpec; /** Workflow input — validated against the contract's input schema. */
219
- args: ClientInferInput<TContract["workflows"][TWorkflowName]>; /** Temporal schedule policies (overlap, catchupWindow, pauseOnFailure, etc.). */
237
+ args: ClientInferInput<TContract["workflows"][TWorkflowName]>;
238
+ /**
239
+ * Indexed search attributes for each workflow run spawned by this
240
+ * schedule. Keys and value types are constrained to those declared on
241
+ * the destination workflow's contract via `defineSearchAttribute`.
242
+ * Translated to Temporal's `typedSearchAttributes` and attached to the
243
+ * schedule's `startWorkflow` action so each spawned run is indexed
244
+ * identically to one started directly via `client.startWorkflow`.
245
+ */
246
+ searchAttributes?: TypedSearchAttributeMap<TContract["workflows"][TWorkflowName]>; /** Temporal schedule policies (overlap, catchupWindow, pauseOnFailure, etc.). */
220
247
  policies?: ScheduleOptions["policies"]; /** Temporal schedule state (paused, note, limited, etc.). */
221
248
  state?: ScheduleOptions["state"]; /** Schedule-level memo (non-indexed metadata on the schedule itself). */
222
249
  memo?: ScheduleOptions["memo"];
@@ -261,7 +288,7 @@ declare class TypedScheduleClient<TContract extends ContractDefinition> {
261
288
  * `workflowType` are pulled from the contract automatically; the typed
262
289
  * options shape omits them so call sites don't have to repeat themselves.
263
290
  */
264
- create<TWorkflowName extends keyof TContract["workflows"]>(workflowName: TWorkflowName, options: TypedScheduleCreateOptions<TContract, TWorkflowName>): ResultAsync<TypedScheduleHandle, WorkflowNotFoundError | WorkflowValidationError | RuntimeClientError>;
291
+ create<TWorkflowName extends keyof TContract["workflows"] & string>(workflowName: TWorkflowName, options: TypedScheduleCreateOptions<TContract, TWorkflowName>): ResultAsync<TypedScheduleHandle, WorkflowNotFoundError | WorkflowValidationError | RuntimeClientError>;
265
292
  /**
266
293
  * Get a typed handle to an existing schedule. Does not validate that the
267
294
  * schedule exists — handle methods (`describe`, `pause`, etc.) will
@@ -282,8 +309,38 @@ declare class TypedScheduleClient<TContract extends ContractDefinition> {
282
309
  * meaning the `searchAttributes` field is effectively absent from the start
283
310
  * options for that workflow.
284
311
  */
285
- type TypedSearchAttributeMap<TWorkflow extends WorkflowDefinition> = TWorkflow["searchAttributes"] extends Record<string, SearchAttributeDefinition> ? { [K in keyof TWorkflow["searchAttributes"]]?: SearchAttributeKindToType<TWorkflow["searchAttributes"][K]["kind"]> } : never;
286
- type TypedWorkflowStartOptions<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"]> = Omit<WorkflowStartOptions, "taskQueue" | "args" | "searchAttributes" | "typedSearchAttributes"> & {
312
+ type TypedSearchAttributeMap<TWorkflow extends AnyWorkflowDefinition> = TWorkflow["searchAttributes"] extends Record<string, SearchAttributeDefinition> ? { [K in keyof TWorkflow["searchAttributes"]]?: SearchAttributeKindToType<TWorkflow["searchAttributes"][K]["kind"]> } : never;
313
+ /**
314
+ * Read declared search attributes off a `TypedSearchAttributes` instance —
315
+ * the read-side counterpart to the write-side `searchAttributes` option on
316
+ * `startWorkflow` / `signalWithStart` / `executeWorkflow` /
317
+ * `schedule.create`.
318
+ *
319
+ * Use it on the result of `handle.describe()` (or a schedule's describe) to
320
+ * recover the typed shape of indexed attributes. The Temporal SDK only
321
+ * exposes a `.get(key)` accessor on `TypedSearchAttributes` and requires
322
+ * the caller to reconstruct each `SearchAttributeKey` from the contract's
323
+ * declared `kind` — this helper does that lookup once for every declared
324
+ * attribute, returning a `Partial<TypedSearchAttributeMap<TWorkflow>>`
325
+ * (each declared key may or may not have been set on the workflow).
326
+ *
327
+ * Workflows without declared `searchAttributes` get an empty object back.
328
+ *
329
+ * @example
330
+ * ```ts
331
+ * const description = await handle.describe();
332
+ * if (description.isOk()) {
333
+ * const attrs = readTypedSearchAttributes(
334
+ * myContract.workflows.processOrder,
335
+ * description.value.typedSearchAttributes,
336
+ * );
337
+ * // attrs.customerId: string | undefined
338
+ * // attrs.priority: number | undefined
339
+ * }
340
+ * ```
341
+ */
342
+ declare function readTypedSearchAttributes<TWorkflow extends AnyWorkflowDefinition>(workflowDef: TWorkflow, instance: TypedSearchAttributes): Partial<TypedSearchAttributeMap<TWorkflow>>;
343
+ type TypedWorkflowStartOptions<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"] & string> = Omit<WorkflowStartOptions, "taskQueue" | "args" | "searchAttributes" | "typedSearchAttributes"> & {
287
344
  args: ClientInferInput<TContract["workflows"][TWorkflowName]>;
288
345
  /**
289
346
  * Indexed search attributes for the started workflow. Keys and value types
@@ -297,7 +354,7 @@ type TypedWorkflowStartOptions<TContract extends ContractDefinition, TWorkflowNa
297
354
  * Options for {@link TypedClient.signalWithStart} — typed against both the
298
355
  * workflow's input schema and the named signal's input schema.
299
356
  */
300
- type TypedSignalWithStartOptions<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"], TSignalName extends keyof TContract["workflows"][TWorkflowName]["signals"] & string> = Omit<WorkflowSignalWithStartOptions, "taskQueue" | "args" | "signal" | "signalArgs" | "searchAttributes" | "typedSearchAttributes"> & {
357
+ type TypedSignalWithStartOptions<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"] & string, TSignalName extends SignalNamesOf<TContract["workflows"][TWorkflowName]>> = Omit<WorkflowSignalWithStartOptions, "taskQueue" | "args" | "signal" | "signalArgs" | "searchAttributes" | "typedSearchAttributes"> & {
301
358
  args: ClientInferInput<TContract["workflows"][TWorkflowName]>;
302
359
  signalName: TSignalName;
303
360
  signalArgs: TContract["workflows"][TWorkflowName]["signals"][TSignalName] extends SignalDefinition ? ClientInferInput<TContract["workflows"][TWorkflowName]["signals"][TSignalName]> : never;
@@ -314,7 +371,7 @@ type TypedSignalWithStartOptions<TContract extends ContractDefinition, TWorkflow
314
371
  * to the standard handle so callers can correlate the signal with the
315
372
  * (possibly pre-existing) workflow execution chain.
316
373
  */
317
- type TypedWorkflowHandleWithSignaledRunId<TWorkflow extends WorkflowDefinition> = TypedWorkflowHandle<TWorkflow> & {
374
+ type TypedWorkflowHandleWithSignaledRunId<TWorkflow extends AnyWorkflowDefinition> = TypedWorkflowHandle<TWorkflow> & {
318
375
  /**
319
376
  * The Run Id of the bound Workflow at the time of `signalWithStart`. Since
320
377
  * `signalWithStart` may have signaled an existing Workflow Chain, this is
@@ -325,7 +382,7 @@ type TypedWorkflowHandleWithSignaledRunId<TWorkflow extends WorkflowDefinition>
325
382
  /**
326
383
  * Typed workflow handle with validated results using neverthrow Result/ResultAsync
327
384
  */
328
- type TypedWorkflowHandle<TWorkflow extends WorkflowDefinition> = {
385
+ type TypedWorkflowHandle<TWorkflow extends AnyWorkflowDefinition> = {
329
386
  workflowId: string;
330
387
  /**
331
388
  * Type-safe queries based on workflow definition with Result pattern
@@ -440,7 +497,7 @@ declare class TypedClient<TContract extends ContractDefinition> {
440
497
  * );
441
498
  * ```
442
499
  */
443
- startWorkflow<TWorkflowName extends keyof TContract["workflows"]>(workflowName: TWorkflowName, {
500
+ startWorkflow<TWorkflowName extends keyof TContract["workflows"] & string>(workflowName: TWorkflowName, {
444
501
  args,
445
502
  searchAttributes,
446
503
  ...temporalOptions
@@ -471,7 +528,7 @@ declare class TypedClient<TContract extends ContractDefinition> {
471
528
  * );
472
529
  * ```
473
530
  */
474
- signalWithStart<TWorkflowName extends keyof TContract["workflows"], TSignalName extends keyof TContract["workflows"][TWorkflowName]["signals"] & string>(workflowName: TWorkflowName, {
531
+ signalWithStart<TWorkflowName extends keyof TContract["workflows"] & string, TSignalName extends SignalNamesOf<TContract["workflows"][TWorkflowName]>>(workflowName: TWorkflowName, {
475
532
  args,
476
533
  signalName,
477
534
  signalArgs,
@@ -496,7 +553,7 @@ declare class TypedClient<TContract extends ContractDefinition> {
496
553
  * );
497
554
  * ```
498
555
  */
499
- executeWorkflow<TWorkflowName extends keyof TContract["workflows"]>(workflowName: TWorkflowName, {
556
+ executeWorkflow<TWorkflowName extends keyof TContract["workflows"] & string>(workflowName: TWorkflowName, {
500
557
  args,
501
558
  searchAttributes,
502
559
  ...temporalOptions
@@ -516,9 +573,9 @@ declare class TypedClient<TContract extends ContractDefinition> {
516
573
  * );
517
574
  * ```
518
575
  */
519
- getHandle<TWorkflowName extends keyof TContract["workflows"]>(workflowName: TWorkflowName, workflowId: string): ResultAsync<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, WorkflowNotFoundError | RuntimeClientError>;
576
+ getHandle<TWorkflowName extends keyof TContract["workflows"] & string>(workflowName: TWorkflowName, workflowId: string): ResultAsync<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, WorkflowNotFoundError | RuntimeClientError>;
520
577
  private createTypedHandle;
521
578
  }
522
579
  //#endregion
523
- export { type ClientInferActivities, type ClientInferActivity, type ClientInferInput, type ClientInferOutput, type ClientInferQuery, type ClientInferSignal, type ClientInferUpdate, type ClientInferWorkflow, type ClientInferWorkflowActivities, type ClientInferWorkflowContextActivities, type ClientInferWorkflowQueries, type ClientInferWorkflowSignals, type ClientInferWorkflowUpdates, type ClientInferWorkflows, QueryValidationError, RuntimeClientError, SignalValidationError, TypedClient, type TypedScheduleActionOverrides, TypedScheduleClient, type TypedScheduleCreateOptions, type TypedScheduleHandle, type TypedSignalWithStartOptions, type TypedWorkflowHandle, type TypedWorkflowHandleWithSignaledRunId, type TypedWorkflowStartOptions, UpdateValidationError, WorkflowAlreadyStartedError, WorkflowExecutionNotFoundError, WorkflowFailedError, WorkflowNotFoundError, WorkflowValidationError };
580
+ export { type ClientInferActivities, type ClientInferActivity, type ClientInferInput, type ClientInferOutput, type ClientInferQuery, type ClientInferSignal, type ClientInferUpdate, type ClientInferWorkflow, type ClientInferWorkflowActivities, type ClientInferWorkflowContextActivities, type ClientInferWorkflowQueries, type ClientInferWorkflowSignals, type ClientInferWorkflowUpdates, type ClientInferWorkflows, QueryValidationError, RuntimeClientError, SignalValidationError, type TemporalFailure, TypedClient, type TypedScheduleActionOverrides, TypedScheduleClient, type TypedScheduleCreateOptions, type TypedScheduleHandle, type TypedSearchAttributeMap, type TypedSignalWithStartOptions, type TypedWorkflowHandle, type TypedWorkflowHandleWithSignaledRunId, type TypedWorkflowStartOptions, UpdateValidationError, WorkflowAlreadyStartedError, WorkflowExecutionNotFoundError, WorkflowFailedError, WorkflowNotFoundError, WorkflowValidationError, readTypedSearchAttributes };
524
581
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/errors.ts","../src/schedule.ts","../src/client.ts"],"mappings":";;;;;;;;;AAgBA;KAAY,gBAAA;EAA6B,KAAA,EAAO,SAAA;AAAA,KAAe,gBAAA,CAAiB,UAAA,CAC9E,CAAA;;;;;KAOU,iBAAA;EAA8B,MAAA,EAAQ,SAAA;AAAA,KAAe,gBAAA,CAAiB,WAAA,CAChF,CAAA;;;;;;AADF;;;KAaY,mBAAA,mBAAsC,kBAAA,KAChD,IAAA,EAAM,gBAAA,CAAiB,SAAA,MACpB,OAAA,CAAQ,iBAAA,CAAkB,SAAA;;;;;KAMnB,mBAAA,mBAAsC,kBAAA,KAChD,IAAA,EAAM,gBAAA,CAAiB,SA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;;;;;;;;;EGiQE,aAAA,6BAA0C,SAAA,cAAA,CACxC,YAAA,EAAc,aAAA;IAEZ,IAAA;IACA,gBAAA;IAAA,GACG;EAAA,GACF,yBAAA,CAA0B,SAAA,EAAW,aAAA,IACvC,WAAA,CACD,mBAAA,CAAoB,SAAA,cAAuB,aAAA,IACzC,qBAAA,GACA,uBAAA,GACA,2BAAA,GACA,kBAAA;EH1Q4D;;;;AAOlE;;;;;;;;;;;;;;;;;;;;;;EGoUE,eAAA,6BAC8B,SAAA,yCACF,SAAA,cAAuB,aAAA,sBAAA,CAEjD,YAAA,EAAc,aAAA;IAEZ,IAAA;IACA,UAAA;IACA,UAAA;IACA,gBAAA;IAAA,GACG;EAAA,GACF,2BAAA,CAA4B,SAAA,EAAW,aAAA,EAAe,WAAA,IACxD,WAAA,CACD,oCAAA,CAAqC,SAAA,cAAuB,aAAA,IAC1D,qBAAA,GACA,uBAAA,GACA,qBAAA,GACA,2BAAA,GACA,kBAAA;EHnVqE;;AAO3E;;;;;;;;;;;;;;;;EGiaE,eAAA,6BAA4C,SAAA,cAAA,CAC1C,YAAA,EAAc,aAAA;IAEZ,IAAA;IACA,gBAAA;IAAA,GACG;EAAA,GACF,yBAAA,CAA0B,SAAA,EAAW,aAAA,IACvC,WAAA,CACD,iBAAA,CAAkB,SAAA,cAAuB,aAAA,IACvC,qBAAA,GACA,uBAAA,GACA,2BAAA,GACA,mBAAA,GACA,8BAAA,GACA,kBAAA;EH9agC;;;;;;;;AAStC;;;;;;;EG0fE,SAAA,6BAAsC,SAAA,cAAA,CACpC,YAAA,EAAc,aAAA,EACd,UAAA,WACC,WAAA,CACD,mBAAA,CAAoB,SAAA,cAAuB,aAAA,IAC3C,qBAAA,GAAwB,kBAAA;EAAA,QAoBlB,iBAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/errors.ts","../src/schedule.ts","../src/client.ts"],"mappings":";;;;;;;;;;;KAgBY,gBAAA;EAA6B,KAA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BAAA,CAA4B,SAAA,EAAW,aAAA,EAAe,WAAA,IACxD,WAAA,CACD,oCAAA,CAAqC,SAAA,cAAuB,aAAA,IAC1D,qBAAA,GACA,uBAAA,GACA,qBAAA,GACA,2BAAA,GACA,kBAAA;EHzZ2C;;;;;;;;;;;;;;;;;;EGue/C,eAAA,6BAA4C,SAAA,uBAAA,CAC1C,YAAA,EAAc,aAAA;IAEZ,IAAA;IACA,gBAAA;IAAA,GACG;EAAA,GACF,yBAAA,CAA0B,SAAA,EAAW,aAAA,IACvC,WAAA,CACD,iBAAA,CAAkB,SAAA,cAAuB,aAAA,IACvC,qBAAA,GACA,uBAAA,GACA,2BAAA,GACA,mBAAA,GACA,8BAAA,GACA,kBAAA;EHlf2D;;;AAOjE;;;;;;;;;;;;EGskBE,SAAA,6BAAsC,SAAA,uBAAA,CACpC,YAAA,EAAc,aAAA,EACd,UAAA,WACC,WAAA,CACD,mBAAA,CAAoB,SAAA,cAAuB,aAAA,IAC3C,qBAAA,GAAwB,kBAAA;EAAA,QAoBlB,iBAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  import { TypedSearchAttributes, WorkflowNotFoundError as WorkflowNotFoundError$1, defineSearchAttributeKey } from "@temporalio/common";
2
2
  import { ResultAsync, err, ok } from "neverthrow";
3
+ import { summarizeIssues } from "@temporal-contract/contract";
3
4
  import { WorkflowExecutionAlreadyStartedError, WorkflowFailedError as WorkflowFailedError$1 } from "@temporalio/client";
5
+ import { _internal_makeResultAsync } from "@temporal-contract/contract/result-async";
4
6
  //#region src/errors.ts
5
7
  /**
6
8
  * Base class for all typed client errors with boxed pattern
@@ -76,11 +78,17 @@ var WorkflowExecutionNotFoundError = class extends TypedClientError {
76
78
  * on a workflow's result and the workflow completes with a failure —
77
79
  * Temporal's `WorkflowFailedError`.
78
80
  *
79
- * `cause` is the *unwrapped* underlying failure (typically an
81
+ * `cause` is the *unwrapped* underlying {@link TemporalFailure} (typically an
80
82
  * `ApplicationFailure`, `CancelledFailure`, `TerminatedFailure`, or
81
83
  * `TimeoutFailure`) lifted from Temporal's wrapper, so callers can branch
82
84
  * on the failure category in one step (`err.cause instanceof
83
- * ApplicationFailure`) instead of unwrapping twice via the SDK wrapper.
85
+ * ApplicationFailure`) instead of unwrapping twice via the SDK wrapper. The
86
+ * SDK declares `WorkflowFailedError.cause` as the wider `Error | undefined`
87
+ * (since `cause` lives on `Error`), but the runtime guarantee — driven by
88
+ * Temporal's wire format — is that it is always a `TemporalFailure` subclass
89
+ * when the wrapper is surfaced. `classifyResultError` narrows that wider
90
+ * static type to the public {@link TemporalFailure} union with a cast, so
91
+ * consumers see the precise leaf-failure typing instead of a bare `Error`.
84
92
  *
85
93
  * Returned from `executeWorkflow` and `handle.result()`.
86
94
  */
@@ -93,52 +101,6 @@ var WorkflowFailedError = class extends TypedClientError {
93
101
  }
94
102
  };
95
103
  /**
96
- * Pattern for string keys safe to render with dot notation. A "safe" key is a
97
- * JavaScript identifier (letters/digits/underscore/$, not starting with a
98
- * digit). Anything else — keys containing dots, spaces, leading digits, the
99
- * empty string, the literal string `"0"` etc. — gets bracket-quoted so the
100
- * path is unambiguous.
101
- *
102
- * This helper is intentionally duplicated with the worker package so each
103
- * entry point is self-contained; keep the two copies in sync.
104
- */
105
- const SAFE_IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
106
- /**
107
- * Render a Standard Schema {@link StandardSchemaV1.Issue} into a human-readable
108
- * string that includes the failing field's path.
109
- *
110
- * Example output:
111
- * - `at items[0].quantity: Expected number, received undefined`
112
- * - `at customerId: Expected string, received undefined`
113
- * - `at user["first name"]: Expected string, received undefined`
114
- * - `Validation error` *(no path)*
115
- *
116
- * Path segments come either as bare `PropertyKey` values or as
117
- * `{ key: PropertyKey }` objects (per the spec); both are normalized.
118
- * - Numeric keys → `[N]`
119
- * - String keys that are valid JS identifiers → bare (first) or `.key`
120
- * - String keys that aren't valid identifiers → `["..."]` with JSON-style
121
- * escaping (handles dots, spaces, leading digits, the empty string, the
122
- * literal string `"0"`, embedded quotes, etc.)
123
- * - Symbol / other `PropertyKey` → `[Symbol(name)]`
124
- */
125
- function formatIssue(issue) {
126
- if (issue.path === void 0 || issue.path.length === 0) return issue.message;
127
- let path = "";
128
- for (let i = 0; i < issue.path.length; i++) {
129
- const segment = issue.path[i];
130
- const key = segment !== null && typeof segment === "object" && "key" in segment ? segment.key : segment;
131
- if (typeof key === "number") path += `[${key}]`;
132
- else if (typeof key === "string" && SAFE_IDENTIFIER.test(key)) path += i === 0 ? key : `.${key}`;
133
- else if (typeof key === "string") path += `[${JSON.stringify(key)}]`;
134
- else path += `[${String(key)}]`;
135
- }
136
- return `at ${path}: ${issue.message}`;
137
- }
138
- function summarizeIssues(issues) {
139
- return issues.map(formatIssue).join("; ");
140
- }
141
- /**
142
104
  * Thrown when workflow input or output validation fails
143
105
  */
144
106
  var WorkflowValidationError = class extends TypedClientError {
@@ -191,6 +153,37 @@ var UpdateValidationError = class extends TypedClientError {
191
153
  * In-package modules and tests import it directly via relative path.
192
154
  */
193
155
  /**
156
+ * Translate the contract's typed `searchAttributes` map (declared
157
+ * name → value) into a Temporal `TypedSearchAttributes` instance, so the
158
+ * Temporal client honours indexing when starting the workflow.
159
+ *
160
+ * Workflows without a `searchAttributes` block (or callers passing no
161
+ * values) resolve to `ok(undefined)`, matching the Temporal SDK's
162
+ * "absent ≠ empty" semantics.
163
+ *
164
+ * Returns `err(RuntimeClientError)` on unknown keys. The TypeScript
165
+ * surface already gates the happy path; the runtime check catches typed
166
+ * escape hatches (`as never`, `as any`, raw-call interop) where a typo
167
+ * would otherwise silently drop the attribute, leaving the workflow
168
+ * unindexed without any signal to the caller.
169
+ */
170
+ function toTypedSearchAttributes(workflowDef, workflowName, values) {
171
+ if (!values) return ok(void 0);
172
+ const declared = workflowDef.searchAttributes ?? {};
173
+ const pairs = [];
174
+ for (const [name, value] of Object.entries(values)) {
175
+ if (value === void 0) continue;
176
+ const def = declared[name];
177
+ if (!def) return err(new RuntimeClientError("searchAttributes", /* @__PURE__ */ new Error(`Search attribute "${name}" is not declared on workflow "${workflowName}". Declared attributes: ${Object.keys(declared).join(", ") || "none"}.`)));
178
+ const key = defineSearchAttributeKey(name, def.kind);
179
+ pairs.push({
180
+ key,
181
+ value
182
+ });
183
+ }
184
+ return ok(pairs.length > 0 ? new TypedSearchAttributes(pairs) : void 0);
185
+ }
186
+ /**
194
187
  * Wrap an async result-producing function in a `ResultAsync`, catching any
195
188
  * unhandled rejection as a `RuntimeClientError("unexpected", error)`.
196
189
  *
@@ -200,10 +193,12 @@ var UpdateValidationError = class extends TypedClientError {
200
193
  *
201
194
  * Used by `client.ts` (workflow operations) and `schedule.ts` (schedule
202
195
  * operations) so the unexpected-rejection shape is identical across the
203
- * typed client surface.
196
+ * typed client surface. Delegates to `_internal_makeResultAsync` from
197
+ * `@temporal-contract/contract` so the same wrapper is shared between the
198
+ * client and worker packages.
204
199
  */
205
200
  function makeResultAsync(work) {
206
- return new ResultAsync(work().catch((e) => err(new RuntimeClientError("unexpected", e))));
201
+ return _internal_makeResultAsync(work, (e) => new RuntimeClientError("unexpected", e));
207
202
  }
208
203
  /**
209
204
  * Map a thrown error from `client.workflow.start` / `signalWithStart` into
@@ -272,9 +267,12 @@ var TypedScheduleClient = class {
272
267
  create(workflowName, options) {
273
268
  const work = async () => {
274
269
  const definition = this.contract.workflows[workflowName];
275
- if (!definition) return err(new WorkflowNotFoundError(String(workflowName), Object.keys(this.contract.workflows)));
270
+ if (!definition) return err(new WorkflowNotFoundError(workflowName, Object.keys(this.contract.workflows)));
276
271
  const inputResult = await definition.input["~standard"].validate(options.args);
277
- if (inputResult.issues) return err(new WorkflowValidationError(String(workflowName), "input", inputResult.issues));
272
+ if (inputResult.issues) return err(new WorkflowValidationError(workflowName, "input", inputResult.issues));
273
+ const searchAttributesResult = toTypedSearchAttributes(definition, workflowName, options.searchAttributes);
274
+ if (searchAttributesResult.isErr()) return err(searchAttributesResult.error);
275
+ const typedSearchAttributes = searchAttributesResult.value;
278
276
  try {
279
277
  const overrides = options.action ?? {};
280
278
  const action = {
@@ -282,6 +280,7 @@ var TypedScheduleClient = class {
282
280
  workflowType: workflowName,
283
281
  taskQueue: this.contract.taskQueue,
284
282
  args: [inputResult.value],
283
+ ...typedSearchAttributes ? { typedSearchAttributes } : {},
285
284
  ...overrides.workflowId !== void 0 ? { workflowId: overrides.workflowId } : {},
286
285
  ...overrides.workflowExecutionTimeout !== void 0 ? { workflowExecutionTimeout: overrides.workflowExecutionTimeout } : {},
287
286
  ...overrides.workflowRunTimeout !== void 0 ? { workflowRunTimeout: overrides.workflowRunTimeout } : {},
@@ -327,28 +326,76 @@ function wrapScheduleHandle(handle) {
327
326
  //#endregion
328
327
  //#region src/client.ts
329
328
  /**
330
- * Translate the contract's typed `searchAttributes` map (declared
331
- * name value) into a Temporal `TypedSearchAttributes` instance, so the
332
- * Temporal client honours indexing when starting the workflow.
329
+ * Read declared search attributes off a `TypedSearchAttributes` instance
330
+ * the read-side counterpart to the write-side `searchAttributes` option on
331
+ * `startWorkflow` / `signalWithStart` / `executeWorkflow` /
332
+ * `schedule.create`.
333
333
  *
334
- * Workflows without a `searchAttributes` block (or callers passing no
335
- * values) skip the conversion entirely and return `undefined`, matching
336
- * the Temporal SDK's "absent empty" semantics.
334
+ * Use it on the result of `handle.describe()` (or a schedule's describe) to
335
+ * recover the typed shape of indexed attributes. The Temporal SDK only
336
+ * exposes a `.get(key)` accessor on `TypedSearchAttributes` and requires
337
+ * the caller to reconstruct each `SearchAttributeKey` from the contract's
338
+ * declared `kind` — this helper does that lookup once for every declared
339
+ * attribute, returning a `Partial<TypedSearchAttributeMap<TWorkflow>>`
340
+ * (each declared key may or may not have been set on the workflow).
341
+ *
342
+ * Workflows without declared `searchAttributes` get an empty object back.
343
+ *
344
+ * @example
345
+ * ```ts
346
+ * const description = await handle.describe();
347
+ * if (description.isOk()) {
348
+ * const attrs = readTypedSearchAttributes(
349
+ * myContract.workflows.processOrder,
350
+ * description.value.typedSearchAttributes,
351
+ * );
352
+ * // attrs.customerId: string | undefined
353
+ * // attrs.priority: number | undefined
354
+ * }
355
+ * ```
337
356
  */
338
- function toTypedSearchAttributes(workflowDef, values) {
339
- if (!values || !workflowDef.searchAttributes) return void 0;
340
- const pairs = [];
341
- for (const [name, value] of Object.entries(values)) {
342
- if (value === void 0) continue;
343
- const def = workflowDef.searchAttributes[name];
344
- if (!def) continue;
357
+ function readTypedSearchAttributes(workflowDef, instance) {
358
+ const declared = workflowDef.searchAttributes;
359
+ if (!declared) return {};
360
+ const result = {};
361
+ for (const [name, def] of Object.entries(declared)) {
345
362
  const key = defineSearchAttributeKey(name, def.kind);
346
- pairs.push({
347
- key,
348
- value
349
- });
363
+ const value = instance.get(key);
364
+ if (value !== void 0) result[name] = value;
350
365
  }
351
- return pairs.length > 0 ? new TypedSearchAttributes(pairs) : void 0;
366
+ return result;
367
+ }
368
+ /**
369
+ * Shared pre-call ritual for the three contract-driven entry points that
370
+ * actually start a workflow (`startWorkflow`, `signalWithStart`,
371
+ * `executeWorkflow`):
372
+ *
373
+ * 1. Look up the workflow definition on the contract.
374
+ * 2. Surface a `WorkflowNotFoundError` if absent.
375
+ * 3. Validate `args` against the workflow's input schema.
376
+ * 4. Surface a `WorkflowValidationError` if validation fails.
377
+ * 5. Translate any caller-supplied `searchAttributes` into Temporal's
378
+ * `TypedSearchAttributes` shape (or `undefined`).
379
+ *
380
+ * `getHandle` deliberately keeps its own three-line lookup — it doesn't
381
+ * accept `args` or `searchAttributes`, so it can't share this helper. The
382
+ * call-specific extras (signal validation, post-call output validation,
383
+ * extended error classification) stay at the call site — those are the
384
+ * differentiators that make each method distinct.
385
+ */
386
+ async function resolveDefinitionAndValidateInput(contract, workflowName, args, searchAttributes) {
387
+ const definition = contract.workflows[workflowName];
388
+ if (!definition) return err(createWorkflowNotFoundError(workflowName, contract));
389
+ const inputResult = await definition.input["~standard"].validate(args);
390
+ if (inputResult.issues) return err(createWorkflowValidationError(workflowName, "input", inputResult.issues));
391
+ const searchAttributesResult = toTypedSearchAttributes(definition, workflowName, searchAttributes);
392
+ if (searchAttributesResult.isErr()) return err(searchAttributesResult.error);
393
+ const typedSearchAttributes = searchAttributesResult.value;
394
+ return ok({
395
+ definition,
396
+ validatedInput: inputResult.value,
397
+ typedSearchAttributes
398
+ });
352
399
  }
353
400
  /**
354
401
  * Typed Temporal client with neverthrow Result/ResultAsync pattern based on a contract
@@ -434,16 +481,14 @@ var TypedClient = class TypedClient {
434
481
  */
435
482
  startWorkflow(workflowName, { args, searchAttributes, ...temporalOptions }) {
436
483
  const work = async () => {
437
- const definition = this.contract.workflows[workflowName];
438
- if (!definition) return err(createWorkflowNotFoundError(workflowName, this.contract));
439
- const inputResult = await definition.input["~standard"].validate(args);
440
- if (inputResult.issues) return err(createWorkflowValidationError(workflowName, "input", inputResult.issues));
441
- const typedSearchAttributes = toTypedSearchAttributes(definition, searchAttributes);
484
+ const resolved = await resolveDefinitionAndValidateInput(this.contract, workflowName, args, searchAttributes);
485
+ if (resolved.isErr()) return err(resolved.error);
486
+ const { definition, validatedInput, typedSearchAttributes } = resolved.value;
442
487
  try {
443
488
  const handle = await this.client.workflow.start(workflowName, {
444
489
  ...temporalOptions,
445
490
  taskQueue: this.contract.taskQueue,
446
- args: [inputResult.value],
491
+ args: [validatedInput],
447
492
  ...typedSearchAttributes ? { typedSearchAttributes } : {}
448
493
  });
449
494
  return ok(this.createTypedHandle(handle, definition));
@@ -481,20 +526,18 @@ var TypedClient = class TypedClient {
481
526
  */
482
527
  signalWithStart(workflowName, { args, signalName, signalArgs, searchAttributes, ...temporalOptions }) {
483
528
  const work = async () => {
484
- const definition = this.contract.workflows[workflowName];
485
- if (!definition) return err(createWorkflowNotFoundError(workflowName, this.contract));
486
- const inputResult = await definition.input["~standard"].validate(args);
487
- if (inputResult.issues) return err(createWorkflowValidationError(workflowName, "input", inputResult.issues));
529
+ const resolved = await resolveDefinitionAndValidateInput(this.contract, workflowName, args, searchAttributes);
530
+ if (resolved.isErr()) return err(resolved.error);
531
+ const { definition, validatedInput, typedSearchAttributes } = resolved.value;
488
532
  const signalDef = definition.signals?.[signalName];
489
- if (!signalDef) return err(new SignalValidationError(signalName, [{ message: `Signal "${signalName}" is not declared on workflow "${String(workflowName)}".` }]));
533
+ if (!signalDef) return err(new SignalValidationError(signalName, [{ message: `Signal "${signalName}" is not declared on workflow "${workflowName}".` }]));
490
534
  const signalInputResult = await signalDef.input["~standard"].validate(signalArgs);
491
535
  if (signalInputResult.issues) return err(new SignalValidationError(signalName, signalInputResult.issues));
492
- const typedSearchAttributes = toTypedSearchAttributes(definition, searchAttributes);
493
536
  try {
494
537
  const handle = await this.client.workflow.signalWithStart(workflowName, {
495
538
  ...temporalOptions,
496
539
  taskQueue: this.contract.taskQueue,
497
- args: [inputResult.value],
540
+ args: [validatedInput],
498
541
  signal: signalName,
499
542
  signalArgs: [signalInputResult.value],
500
543
  ...typedSearchAttributes ? { typedSearchAttributes } : {}
@@ -529,16 +572,14 @@ var TypedClient = class TypedClient {
529
572
  */
530
573
  executeWorkflow(workflowName, { args, searchAttributes, ...temporalOptions }) {
531
574
  const work = async () => {
532
- const definition = this.contract.workflows[workflowName];
533
- if (!definition) return err(createWorkflowNotFoundError(workflowName, this.contract));
534
- const inputResult = await definition.input["~standard"].validate(args);
535
- if (inputResult.issues) return err(createWorkflowValidationError(workflowName, "input", inputResult.issues));
536
- const typedSearchAttributes = toTypedSearchAttributes(definition, searchAttributes);
575
+ const resolved = await resolveDefinitionAndValidateInput(this.contract, workflowName, args, searchAttributes);
576
+ if (resolved.isErr()) return err(resolved.error);
577
+ const { definition, validatedInput, typedSearchAttributes } = resolved.value;
537
578
  try {
538
579
  const result = await this.client.workflow.execute(workflowName, {
539
580
  ...temporalOptions,
540
581
  taskQueue: this.contract.taskQueue,
541
- args: [inputResult.value],
582
+ args: [validatedInput],
542
583
  ...typedSearchAttributes ? { typedSearchAttributes } : {}
543
584
  });
544
585
  const outputResult = await definition.output["~standard"].validate(result);
@@ -672,6 +713,6 @@ function buildValidatedProxy({ defs, operation, workflowId, makeValidationError,
672
713
  return proxy;
673
714
  }
674
715
  //#endregion
675
- export { QueryValidationError, RuntimeClientError, SignalValidationError, TypedClient, TypedScheduleClient, UpdateValidationError, WorkflowAlreadyStartedError, WorkflowExecutionNotFoundError, WorkflowFailedError, WorkflowNotFoundError, WorkflowValidationError };
716
+ export { QueryValidationError, RuntimeClientError, SignalValidationError, TypedClient, TypedScheduleClient, UpdateValidationError, WorkflowAlreadyStartedError, WorkflowExecutionNotFoundError, WorkflowFailedError, WorkflowNotFoundError, WorkflowValidationError, readTypedSearchAttributes };
676
717
 
677
718
  //# sourceMappingURL=index.mjs.map