@mnci/az-durable 0.1.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.
@@ -0,0 +1,92 @@
1
+ import type { InvocationContext } from '@azure/functions';
2
+ import type { OrchestrationContext, RetryOptions, Task } from 'durable-functions';
3
+ import type { TypedActivity, TypedTask } from './types';
4
+ /**
5
+ * Registers an activity and remembers its input and output types.
6
+ *
7
+ * @remarks
8
+ * **Do not annotate `handler` as `ActivityHandler`.** That type is an alias for
9
+ * `FunctionHandler`, which the SDK declares as
10
+ * `(triggerInput: any, context: InvocationContext) => FunctionResult<any>` — so
11
+ * annotating it discards the very signature this function exists to capture and
12
+ * silently reduces the activity to `any` in and `any` out. The same applies to
13
+ * any middleware wrapper typed `(h: ActivityHandler) => ActivityHandler`; make
14
+ * such wrappers generic instead. Both traps are lintable — see the
15
+ * `no-untyped-activity-handler` rule.
16
+ *
17
+ * `TOutput` is wrapped in `Awaited` so an `async` handler contributes its
18
+ * resolved type rather than a `Promise`.
19
+ *
20
+ * @param name - The activity name, a literal. Never derived from a variable or
21
+ * file name: it is baked into orchestration history, so a rename breaks every
22
+ * in-flight instance.
23
+ * @param handler - The activity implementation.
24
+ * @returns The activity, carrying its input and output types.
25
+ * @throws Error when `name` is already registered.
26
+ * @typeParam TInput - The JSON-serialisable input.
27
+ * @typeParam TOutput - The handler's return type, awaited.
28
+ */
29
+ export declare function defineActivity<TInput, TOutput>(name: string, handler: (input: TInput, context: InvocationContext) => TOutput | Promise<TOutput>): TypedActivity<TInput, Awaited<TOutput>>;
30
+ /**
31
+ * Schedules an activity without yielding it, for fan-out.
32
+ *
33
+ * @remarks
34
+ * The single place in this package that schedules an activity. `callActivity`
35
+ * is implemented in terms of it, so there is exactly one line to audit against
36
+ * an SDK change.
37
+ *
38
+ * **Scheduled through `context`, not through `activity.registered`,** and the
39
+ * two are equivalent — verified in the SDK source rather than assumed:
40
+ *
41
+ * ```
42
+ * registered(input) -> new AtomicTask(false, new CallActivityAction(name, input))
43
+ * context.df.callActivity(...) -> new AtomicTask(false, new CallActivityAction(name, input))
44
+ * ```
45
+ *
46
+ * `RegisteredActivityTask` is an `AtomicTask` subclass that only ADDS
47
+ * `withRetry`; the retry paths are identical too, both producing
48
+ * `RetryableTask(AtomicTask(CallActivityWithRetryAction(...)))`. The action is
49
+ * what enters orchestration history, so replay is unaffected.
50
+ *
51
+ * Routing through `context` is what makes {@link runWorkflow} possible without
52
+ * reading `task.action.functionName` — an undocumented internal the package's
53
+ * non-goals forbid depending on. It also makes every helper here uniformly
54
+ * context-first.
55
+ *
56
+ * @param context - The orchestration context.
57
+ * @param activity - The activity to schedule.
58
+ * @param input - The input, checked against the activity's declared type.
59
+ * @param retry - Optional retry policy.
60
+ * @returns A scheduled task, for `all`/`any`.
61
+ * @throws Never - scheduling is synchronous and cannot fail here.
62
+ * @typeParam TInput - The activity's input type.
63
+ * @typeParam TOutput - The activity's output type.
64
+ */
65
+ export declare function activityTask<TInput, TOutput>(context: OrchestrationContext, activity: TypedActivity<TInput, TOutput>, input: TInput, retry?: RetryOptions): TypedTask<TOutput>;
66
+ /**
67
+ * Calls an activity and returns its typed result.
68
+ *
69
+ * @remarks
70
+ * **Must be invoked with `yield*`, not `yield`.** The delegation is what carries
71
+ * the type: `yield*` returns this generator's `TReturn`, which is per-call
72
+ * generic, whereas a generator's `TNext` is shared by every `yield` and so can
73
+ * never be typed per call. A bare `yield` is a compile error rather than a
74
+ * silent `any` — `callActivity` returns a `Generator`, and yielding one where a
75
+ * `Task` is expected does not typecheck — but the error message is obscure, so
76
+ * prefer the lint rule's.
77
+ *
78
+ * Determinism is unaffected. The task yielded up to the Durable driver is the
79
+ * identical object a hand-written call would yield, so replay history and
80
+ * in-flight instances are untouched. This is a type-level change only.
81
+ *
82
+ * @param context - The orchestration context.
83
+ * @param activity - The activity to call.
84
+ * @param input - The input, checked against the activity's declared type.
85
+ * @param retry - Optional retry policy.
86
+ * @returns A generator to delegate to; its return value is the activity output.
87
+ * @throws Whatever the activity threw, once the driver resumes with a failure.
88
+ * @typeParam TInput - The activity's input type.
89
+ * @typeParam TOutput - The activity's output type.
90
+ */
91
+ export declare function callActivity<TInput, TOutput>(context: OrchestrationContext, activity: TypedActivity<TInput, TOutput>, input: TInput, retry?: RetryOptions): Generator<Task, TOutput, unknown>;
92
+ //# sourceMappingURL=activity.d.ts.map
@@ -0,0 +1,23 @@
1
+ import type { DurableClient } from 'durable-functions';
2
+ import type { TypedOrchestration } from './types';
3
+ /**
4
+ * Starts an orchestration with an input checked against its declared type.
5
+ *
6
+ * @remarks
7
+ * `DurableClient.startNew` takes the orchestration **name** and an options
8
+ * object carrying `input`, both untyped. This narrows the pair so a caller
9
+ * cannot start an orchestration with the wrong payload shape.
10
+ *
11
+ * @param client - The Durable client, from `df.getClient(context)`.
12
+ * @param orchestration - The orchestration to start.
13
+ * @param input - The input, checked against its declared type.
14
+ * @param options - Optional instance id.
15
+ * @returns The new instance id.
16
+ * @throws Propagates whatever the client throws.
17
+ * @typeParam TInput - The orchestration's input type.
18
+ * @typeParam TOutput - The orchestration's output type, unused at runtime.
19
+ */
20
+ export declare function startOrchestration<TInput, TOutput>(client: DurableClient, orchestration: TypedOrchestration<TInput, TOutput>, input: TInput, options?: {
21
+ instanceId?: string;
22
+ }): Promise<string>;
23
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,46 @@
1
+ import type { Rule } from './rules/shared';
2
+ export type { Rule } from './rules/shared';
3
+ /**
4
+ * Every rule this plugin ships, by name.
5
+ *
6
+ * @remarks
7
+ * The keys are the names a config writes after the `az-durable/` prefix, so
8
+ * renaming one is a breaking change for any consumer's config.
9
+ */
10
+ export declare const rules: Record<string, Rule>;
11
+ /**
12
+ * The plugin object, for a flat config's `plugins` map.
13
+ *
14
+ * @remarks
15
+ * Shipped from a separate entry point so lint rules are never a runtime import
16
+ * of the wrapper itself.
17
+ */
18
+ export declare const plugin: {
19
+ rules: Record<string, Rule>;
20
+ };
21
+ /**
22
+ * The recommended rule set.
23
+ *
24
+ * @remarks
25
+ * Two errors and one warning, and the split is deliberate.
26
+ * `no-nondeterministic-orchestrator` and `no-untyped-activity-handler` catch
27
+ * failures nothing else does — silent replay corruption, and a type collapse
28
+ * TypeScript accepts as legal. `require-yield-star` is a warning because the
29
+ * compiler already rejects the code it flags; it only improves the message.
30
+ */
31
+ export declare const recommended: {
32
+ readonly plugins: {
33
+ readonly 'az-durable': {
34
+ rules: Record<string, Rule>;
35
+ };
36
+ };
37
+ readonly rules: {
38
+ readonly 'az-durable/no-nondeterministic-orchestrator': "error";
39
+ readonly 'az-durable/no-untyped-activity-handler': "error";
40
+ readonly 'az-durable/require-yield-star': "warn";
41
+ };
42
+ };
43
+ export { noNondeterministicOrchestrator } from './rules/noNondeterministicOrchestrator';
44
+ export { requireYieldStar } from './rules/requireYieldStar';
45
+ export { noUntypedActivityHandler } from './rules/noUntypedActivityHandler';
46
+ //# sourceMappingURL=eslint-plugin.d.ts.map
@@ -0,0 +1,81 @@
1
+ import type { DurableClient, OrchestrationContext, Task } from 'durable-functions';
2
+ import type { TypedTask } from './types';
3
+ /**
4
+ * An external event name with its payload type attached.
5
+ *
6
+ * @remarks
7
+ * `__payload` is phantom — never assigned, never read. Event names, like
8
+ * activity names, are matched as strings by the runtime and must stay explicit
9
+ * literals.
10
+ *
11
+ * @typeParam TPayload - The JSON-serialisable payload the event carries.
12
+ */
13
+ export interface EventRef<TPayload> {
14
+ /** The event name, verbatim. */
15
+ readonly name: string;
16
+ /** Phantom. Never assigned. Carries `TPayload`. */
17
+ readonly __payload?: () => TPayload;
18
+ }
19
+ /**
20
+ * Declares an external event and its payload type.
21
+ *
22
+ * @remarks
23
+ * Deliberately does not register anything — external events have no
24
+ * registration step in Durable Functions. This exists only to pair a name with
25
+ * a payload type so the waiter and the raiser cannot disagree.
26
+ *
27
+ * @param name - The event name, a literal.
28
+ * @returns The event reference.
29
+ * @throws Never - constructs an object.
30
+ * @typeParam TPayload - The payload type.
31
+ */
32
+ export declare function defineEvent<TPayload>(name: string): EventRef<TPayload>;
33
+ /**
34
+ * Waits for an external event and returns its typed payload.
35
+ *
36
+ * @remarks
37
+ * **Must be invoked with `yield *`.**
38
+ *
39
+ * @param context - The orchestration context.
40
+ * @param event - The event to wait for.
41
+ * @returns A generator whose return value is the event payload.
42
+ * @throws Never - resolves when the event arrives.
43
+ * @typeParam TPayload - The payload type.
44
+ */
45
+ export declare function waitForEvent<TPayload>(context: OrchestrationContext, event: EventRef<TPayload>): Generator<Task, TPayload, unknown>;
46
+ /**
47
+ * Schedules a wait for an external event, without yielding it.
48
+ *
49
+ * @remarks
50
+ * The task form of {@link waitForEvent}, and the reason it exists is a gap the
51
+ * reconstructed workflows found: `any` and `all` take `TypedTask`s, so with
52
+ * only the generator form the single most common Durable Functions pattern —
53
+ * **wait for human approval, or time out** — could not be expressed at all.
54
+ *
55
+ * Pair it with {@link timerTask} and hand both to `any`.
56
+ *
57
+ * @param context - The orchestration context.
58
+ * @param event - The event to wait for.
59
+ * @returns A task carrying the event's payload type.
60
+ * @throws Never - scheduling only.
61
+ * @typeParam TPayload - The payload type.
62
+ */
63
+ export declare function eventTask<TPayload>(context: OrchestrationContext, event: EventRef<TPayload>): TypedTask<TPayload>;
64
+ /**
65
+ * Raises an external event to a waiting instance, with a checked payload.
66
+ *
67
+ * @remarks
68
+ * The client half of {@link waitForEvent}. Pairing both sides through the same
69
+ * `EventRef` is what stops the raiser and the waiter disagreeing about the
70
+ * payload shape — the SDK types `eventData` as `unknown`, so nothing else would.
71
+ *
72
+ * @param client - The Durable client.
73
+ * @param instanceId - The instance to signal.
74
+ * @param event - The event being raised.
75
+ * @param payload - The payload, checked against the event's declared type.
76
+ * @returns A promise resolving when the event is enqueued.
77
+ * @throws Propagates whatever the client throws.
78
+ * @typeParam TPayload - The payload type.
79
+ */
80
+ export declare function raiseEvent<TPayload>(client: DurableClient, instanceId: string, event: EventRef<TPayload>, payload: TPayload): Promise<void>;
81
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1,14 @@
1
+ export type { TypedActivity, TypedOrchestration, TypedTask, TypedTimerTask } from './types';
2
+ export { defineActivity, activityTask, callActivity } from './activity';
3
+ export { defineOrchestration, callSubOrchestration, subOrchestrationTask } from './orchestration';
4
+ export type { DefineOrchestrationOptions, OrchestrationSelf } from './orchestration';
5
+ export { startOrchestration } from './client';
6
+ export { retryPolicy } from './retry';
7
+ export type { RetryPolicy } from './retry';
8
+ export { all, any, resultOf } from './parallel';
9
+ export type { TaskOutputs } from './parallel';
10
+ export { defineEvent, waitForEvent, eventTask, raiseEvent } from './events';
11
+ export type { EventRef } from './events';
12
+ export { now, sleepUntil, sleepFor, timerTask, timerTaskUntil } from './time';
13
+ export { defineStatuses, setStatus } from './status';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,117 @@
1
+ import type { OrchestrationContext, RetryOptions, Task } from 'durable-functions';
2
+ import type { TypedOrchestration, TypedTask } from './types';
3
+ /**
4
+ * The orchestration's handle on itself, handed to its own handler.
5
+ *
6
+ * @remarks
7
+ * Exists so `continueAsNew` can be typed. See the member for why it cannot be
8
+ * a free function.
9
+ *
10
+ * @typeParam TInput - This orchestration's input type.
11
+ */
12
+ export interface OrchestrationSelf<TInput> {
13
+ /** The orchestration's own registered name. */
14
+ readonly name: string;
15
+ /**
16
+ * Restarts this orchestration with fresh input, discarding its history.
17
+ *
18
+ * @remarks
19
+ * Handed to the handler rather than exported as a free function, and that is
20
+ * the whole design: `continueAsNew` restarts **this** orchestration, so its
21
+ * argument must be this orchestration's own `TInput`. A free
22
+ * `continueAsNew(context, input)` could only be generic on a type nothing
23
+ * constrains, so it would accept any shape at all — precisely the unchecked
24
+ * cast this package exists to remove. Referring to the orchestration
25
+ * constant from inside its own handler is not an option either: it is not
26
+ * initialised yet.
27
+ *
28
+ * The call does not by itself end the generator. Return immediately after
29
+ * it, as the SDK requires; anything scheduled afterwards is discarded when
30
+ * the instance restarts.
31
+ */
32
+ readonly continueAsNew: (input: TInput) => void;
33
+ }
34
+ /**
35
+ * Options accepted by {@link defineOrchestration}.
36
+ *
37
+ * @remarks
38
+ * Only `parse` for now. Kept as an options object rather than a positional
39
+ * argument so a later addition does not change the call signature of every
40
+ * existing `defineOrchestration` call.
41
+ *
42
+ * @typeParam TInput - The orchestration's input type, which `parse` produces.
43
+ */
44
+ export interface DefineOrchestrationOptions<TInput> {
45
+ /**
46
+ * Validates and narrows the raw input before the handler sees it.
47
+ *
48
+ * @remarks
49
+ * Optional, and worth using. `context.df.getInput<T>()` is an **unchecked
50
+ * cast** — `T` is a claim the SDK never verifies. That matters more here than
51
+ * in ordinary code because orchestration input comes back out of the task hub:
52
+ * an instance started by yesterday's deploy resumes against today's code, so a
53
+ * shape change between deploys surfaces as a silently wrong object rather than
54
+ * an error. A `parse` makes the claim real at the boundary.
55
+ */
56
+ readonly parse?: (raw: unknown) => TInput;
57
+ }
58
+ /**
59
+ * Registers an orchestration, handing the handler its deserialised input.
60
+ *
61
+ * @remarks
62
+ * The SDK's `OrchestrationHandler` takes **only** `context` — there is no input
63
+ * parameter — so this wrapper calls `getInput` itself and passes the result as a
64
+ * second argument. That is why consumers never write
65
+ * `context.df.getInput() as SomeType`.
66
+ *
67
+ * @param name - The orchestration name, a literal. Baked into history; never derive it.
68
+ * @param handler - The orchestration generator, receiving context and input.
69
+ * @param options - Optional input validation. See {@link DefineOrchestrationOptions}.
70
+ * @returns The orchestration, carrying its input and output types.
71
+ * @throws Error when `name` is already registered.
72
+ * @typeParam TInput - The JSON-serialisable input.
73
+ * @typeParam TOutput - The value the orchestration returns.
74
+ */
75
+ export declare function defineOrchestration<TInput, TOutput>(name: string, handler: (context: OrchestrationContext, input: TInput, self: OrchestrationSelf<TInput>) => Generator<Task, TOutput, unknown>, options?: DefineOrchestrationOptions<TInput>): TypedOrchestration<TInput, TOutput>;
76
+ /**
77
+ * Calls a sub-orchestration and returns its typed result.
78
+ *
79
+ * @remarks
80
+ * **Must be invoked with `yield*`.** See `callActivity` for why delegation is
81
+ * what carries the type.
82
+ *
83
+ * @param orchestration - The sub-orchestration to call.
84
+ * @param input - The input, checked against its declared type.
85
+ * @param options - Optional instance id and retry policy.
86
+ * @returns A generator to delegate to; its return value is the sub-orchestration output.
87
+ * @throws Whatever the sub-orchestration threw, once the driver resumes with a failure.
88
+ * @typeParam TInput - The sub-orchestration's input type.
89
+ * @typeParam TOutput - The sub-orchestration's output type.
90
+ */
91
+ export declare function callSubOrchestration<TInput, TOutput>(context: OrchestrationContext, orchestration: TypedOrchestration<TInput, TOutput>, input: TInput, options?: {
92
+ instanceId?: string;
93
+ retry?: RetryOptions;
94
+ }): Generator<Task, TOutput, unknown>;
95
+ /**
96
+ * Schedules a sub-orchestration without yielding it.
97
+ *
98
+ * @remarks
99
+ * The task form of {@link callSubOrchestration}, so several sub-orchestrations
100
+ * can run concurrently through `all`. Fanning out over sub-orchestrations is
101
+ * the standard way to bound a large batch — each child gets its own history,
102
+ * so the parent's history does not grow with the batch size.
103
+ *
104
+ * @param context - The orchestration context.
105
+ * @param orchestration - The sub-orchestration to schedule.
106
+ * @param input - Its input, checked against its declared type.
107
+ * @param options - Optional fixed instance id and retry policy.
108
+ * @returns A task carrying the sub-orchestration's output type.
109
+ * @throws Never - scheduling only.
110
+ * @typeParam TInput - The sub-orchestration's input type.
111
+ * @typeParam TOutput - The sub-orchestration's output type.
112
+ */
113
+ export declare function subOrchestrationTask<TInput, TOutput>(context: OrchestrationContext, orchestration: TypedOrchestration<TInput, TOutput>, input: TInput, options?: {
114
+ instanceId?: string;
115
+ retry?: RetryOptions;
116
+ }): TypedTask<TOutput>;
117
+ //# sourceMappingURL=orchestration.d.ts.map
@@ -0,0 +1,71 @@
1
+ import type { OrchestrationContext, Task } from 'durable-functions';
2
+ import type { TypedTask } from './types';
3
+ /**
4
+ * The outputs of a tuple of tasks, in the same positions.
5
+ *
6
+ * @remarks
7
+ * Position preservation is the whole value: without it a `[string, number]`
8
+ * fan-out degrades to `(string | number)[]` and every destructured binding
9
+ * needs a cast, which is what the package exists to remove. `-readonly` strips
10
+ * the modifier that `readonly [...T]` introduces, so the result is an ordinary
11
+ * mutable tuple.
12
+ *
13
+ * @typeParam T - The tuple of tasks.
14
+ */
15
+ export type TaskOutputs<T extends readonly TypedTask<unknown>[]> = {
16
+ -readonly [K in keyof T]: T[K] extends TypedTask<infer O> ? O : never;
17
+ };
18
+ /**
19
+ * Waits for every task, preserving tuple positions.
20
+ *
21
+ * @remarks
22
+ * **Must be invoked with `yield *`.** Takes `context` because `Task.all` is an
23
+ * instance member of `context.df`, not a static — the build plan's
24
+ * context-free signature cannot reach it.
25
+ *
26
+ * @param context - The orchestration context.
27
+ * @param tasks - The scheduled tasks, as a tuple.
28
+ * @returns A generator whose return value is the outputs, in input order.
29
+ * @throws `AggregatedError` when any task failed, matching the SDK.
30
+ * @typeParam T - The tuple of tasks.
31
+ */
32
+ export declare function all<T extends readonly TypedTask<unknown>[]>(context: OrchestrationContext, tasks: readonly [...T]): Generator<Task, TaskOutputs<T>, unknown>;
33
+ /**
34
+ * Waits for the first task to complete and returns **which one won**.
35
+ *
36
+ * @remarks
37
+ * Returns the winning task, not its result, because that is what the SDK does:
38
+ * `Task.any` is documented as returning "the first Task from tasks to
39
+ * complete", and the SDK's own example compares it by identity
40
+ * (`if (winner === otherTask)`). The build plan's signature returned the
41
+ * output type instead, which would hand back a `Task` at runtime while the
42
+ * compiler believed it was the output — the exact class of silent mistyping
43
+ * this package exists to prevent.
44
+ *
45
+ * The winner is mapped back to the `TypedTask` the caller passed, so `===`
46
+ * against the original works. Read its value with {@link resultOf}.
47
+ *
48
+ * **Must be invoked with `yield *`.**
49
+ *
50
+ * @param context - The orchestration context.
51
+ * @param tasks - The scheduled tasks.
52
+ * @returns A generator whose return value is the winning task.
53
+ * @throws Error when the SDK returns a task that was not one of the inputs.
54
+ * @typeParam T - The tuple of tasks.
55
+ */
56
+ export declare function any<T extends readonly TypedTask<unknown>[]>(context: OrchestrationContext, tasks: readonly [...T]): Generator<Task, T[number], unknown>;
57
+ /**
58
+ * Reads a completed task's result, typed.
59
+ *
60
+ * @remarks
61
+ * `Task.result` is declared `unknown` by the SDK. This applies the output type
62
+ * the `TypedTask` was carrying all along. Only meaningful after the task has
63
+ * completed — typically on the winner from {@link any}.
64
+ *
65
+ * @param task - A completed task.
66
+ * @returns Its result, typed as the task's output.
67
+ * @throws Never - reads a property.
68
+ * @typeParam TOutput - The task's output type.
69
+ */
70
+ export declare function resultOf<TOutput>(task: TypedTask<TOutput>): TOutput;
71
+ //# sourceMappingURL=parallel.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Duplicate-name detection for activities and orchestrations.
3
+ *
4
+ * @remarks
5
+ * Activity and orchestration names are **global to the Function App** and are
6
+ * baked into orchestration history in the task hub. Two features registering
7
+ * the same string is a silent misbinding: the second registration wins, and the
8
+ * first feature's calls quietly execute the wrong handler. Nothing surfaces
9
+ * until replay, by which point the history already refers to the wrong thing.
10
+ *
11
+ * Failing loudly at startup is strictly better, so registration throws.
12
+ */
13
+ /**
14
+ * Records a name, throwing if it was already taken.
15
+ *
16
+ * @remarks
17
+ * The error names **both** call sites when the stack makes them available. A
18
+ * bare "duplicate name" message sends the reader hunting through a Function App
19
+ * for the other registration, which is the slowest part of fixing this.
20
+ *
21
+ * @param kind - `activity` or `orchestration`, for the message.
22
+ * @param name - The name being registered.
23
+ * @returns Nothing.
24
+ * @throws Error when `name` has already been registered.
25
+ * @typeParam None - this function has no generic type parameters.
26
+ */
27
+ export declare function claimName(kind: 'activity' | 'orchestration', name: string): void;
28
+ /**
29
+ * Clears the registry. Test-only.
30
+ *
31
+ * @remarks
32
+ * Module state persists across tests in the same worker, so without this a
33
+ * second test registering the same name fails for the wrong reason. Not
34
+ * exported from the package entry point — it is only reachable inside the
35
+ * package's own tests.
36
+ *
37
+ * @param None - this function takes no parameters.
38
+ * @returns Nothing.
39
+ * @throws Never - clears a map.
40
+ * @typeParam None - this function has no generic type parameters.
41
+ */
42
+ export declare function resetRegistryForTests(): void;
43
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1,45 @@
1
+ import { RetryOptions } from 'durable-functions';
2
+ /**
3
+ * A retry policy as a plain object.
4
+ *
5
+ * @remarks
6
+ * Exists because the SDK's `RetryOptions` is a **class** whose two required
7
+ * settings are constructor arguments and whose three optional ones are mutable
8
+ * properties. That shape cannot be written as an object literal, so without
9
+ * this every caller has to `new RetryOptions(1000, 3)` and then assign the rest
10
+ * — and discover that for themselves, since a literal fails with a `TS2739`
11
+ * naming three members it never mentions.
12
+ *
13
+ * @typeParam None - this interface has no generic type parameters.
14
+ */
15
+ export interface RetryPolicy {
16
+ /** The first retry interval, in milliseconds. Must be greater than 0. */
17
+ readonly firstRetryIntervalInMilliseconds: number;
18
+ /** How many attempts to make in total, the first included. */
19
+ readonly maxNumberOfAttempts: number;
20
+ /** Multiplier applied to the interval after each attempt. Defaults to the SDK's. */
21
+ readonly backoffCoefficient?: number;
22
+ /** Ceiling on the interval between attempts, in milliseconds. */
23
+ readonly maxRetryIntervalInMilliseconds?: number;
24
+ /** Overall deadline for the retries, in milliseconds. */
25
+ readonly retryTimeoutInMilliseconds?: number;
26
+ }
27
+ /**
28
+ * Builds a real SDK `RetryOptions` from a plain object.
29
+ *
30
+ * @remarks
31
+ * Returns a genuine class instance rather than a structurally-similar literal,
32
+ * deliberately: handing `callActivityWithRetry` a plain object would depend on
33
+ * the SDK reading it structurally, which is undocumented and exactly the kind
34
+ * of internal this package refuses to rely on.
35
+ *
36
+ * Only the properties actually supplied are assigned, so the SDK's own
37
+ * defaults stand for the rest instead of being overwritten with `undefined`.
38
+ *
39
+ * @param policy - The retry settings.
40
+ * @returns An SDK `RetryOptions` instance.
41
+ * @throws Whatever the SDK constructor throws for an invalid interval.
42
+ * @typeParam None - this function has no generic type parameters.
43
+ */
44
+ export declare function retryPolicy(policy: RetryPolicy): RetryOptions;
45
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { type Rule } from './shared';
2
+ /**
3
+ * Flags non-deterministic operations inside an orchestration body.
4
+ *
5
+ * @remarks
6
+ * The highest-value rule in the package. Each of these returns a DIFFERENT
7
+ * value on every replay, and the failure is silent: the orchestration still
8
+ * completes, it just produces output that disagrees with its own history.
9
+ * Nothing in the runtime reports it.
10
+ *
11
+ * Every message names the replacement, because "this is non-deterministic" is
12
+ * only half of what a reader needs.
13
+ *
14
+ * Heuristic by design — see {@link isOrchestrationRegistration}.
15
+ */
16
+ export declare const noNondeterministicOrchestrator: Rule;
17
+ //# sourceMappingURL=noNondeterministicOrchestrator.d.ts.map
@@ -0,0 +1,27 @@
1
+ import type { Rule } from './shared';
2
+ /**
3
+ * Flags annotations that collapse a typed handler back to `any`.
4
+ *
5
+ * @remarks
6
+ * **The rule that actually earns its keep**, because TypeScript cannot catch
7
+ * this: the annotation is legal, so nothing errors — the types simply stop
8
+ * meaning anything.
9
+ *
10
+ * `ActivityHandler` is an alias for `FunctionHandler`, which the SDK declares as
11
+ * `(triggerInput: any, context: InvocationContext) => FunctionResult<any>`. So
12
+ * annotating a handler with it discards the very signature `defineActivity`
13
+ * exists to capture, and the activity silently becomes `any` in, `any` out. The
14
+ * package then appears to work — every call compiles — while checking nothing.
15
+ *
16
+ * The second, nastier form is a middleware wrapper typed
17
+ * `(h: ActivityHandler) => ActivityHandler`. That collapses EVERY handler it
18
+ * wraps, so one `injectLogger` helper can quietly disable type safety across a
19
+ * whole Function App. The fix is to make the wrapper generic:
20
+ *
21
+ * ```ts
22
+ * const withLogging = <I, O>(h: (i: I, c: InvocationContext) => O) =>
23
+ * (i: I, c: InvocationContext): O => { c.log('...'); return h(i, c) }
24
+ * ```
25
+ */
26
+ export declare const noUntypedActivityHandler: Rule;
27
+ //# sourceMappingURL=noUntypedActivityHandler.d.ts.map
@@ -0,0 +1,22 @@
1
+ import type { Rule } from './shared';
2
+ /**
3
+ * Flags `yield callActivity(...)` where `yield *` is meant.
4
+ *
5
+ * @remarks
6
+ * **A convenience, not a safety net — and the build plan was wrong about this.**
7
+ * The plan described bare `yield` as compiling silently to `any`, "the
8
+ * difference between the package working and appearing to work". Measured
9
+ * against the real typings, it is a COMPILE ERROR in both registration paths:
10
+ * `TS2345` through `defineOrchestration` and `TS2322` through the SDK's own
11
+ * `OrchestrationHandler`, because these helpers return a `Generator` and
12
+ * yielding one where a `Task` is expected does not typecheck.
13
+ *
14
+ * The genuinely silent case is the RAW SDK — `yield context.df.callActivity(...)`
15
+ * returns `any` and compiles — which is the baseline this package replaces.
16
+ *
17
+ * So this rule earns its place only by reporting a clearer message than
18
+ * `TS2345` does. It is in `recommended` for that reason, not because anything
19
+ * depends on it.
20
+ */
21
+ export declare const requireYieldStar: Rule;
22
+ //# sourceMappingURL=requireYieldStar.d.ts.map