@dudousxd/nestjs-durable 0.55.2 → 0.56.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.cjs +219 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +145 -79
- package/dist/index.d.ts +145 -79
- package/dist/index.js +219 -60
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend,
|
|
1
|
+
import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, TenantVerifier, VerifiedTenant, TenantTokenSource, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunRequest, RunReply, DurableTopology, RunDetailOptions, RunDetail, FanPageQuery, FanPage, WorkflowRun, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, RepublishLifecycleTarget, RepublishLifecycleResult, WorkflowLifecycleLinks, EngineEvent, StepInvocation, LifecycleKind, TenantEvent, SignalOptions } from '@dudousxd/nestjs-durable-core';
|
|
2
2
|
export { AttributeFilter, DynamicWorkflowCtx, EngineEvent, EventSubscription, InferSearchAttributes, LIFECYCLE_PENDING_TAG, LifecycleEventOf, LifecycleKind, OnErrorInput, OnEventEntry, RunDetail, RunGateway, RunListItem, RunQuery, RunSchedulesOptions, RunStatus, RunWaiting, ScheduledWorkflow, SearchAttributes, SearchAttributesSchema, StepCheckpoint, StepEvent, StepLogger, TenantTokenSource, TenantVerifier, VerifiedTenant, WorkflowCtx, WorkflowEngine, WorkflowHandler, WorkflowLifecycleEvent, WorkflowRun, hmacTenantVerifier, lifecycleRunId, lifecycleSourceOf, prevCronFireMs, readSearchAttributes, runCompletedEvent, runFailedEvent, runSchedules, scheduleRunIdAt, scheduledRunId, signTenantToken, triggeredRunsOf } from '@dudousxd/nestjs-durable-core';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
|
|
@@ -575,6 +575,58 @@ declare const OnEvent: typeof OnDurableEvent;
|
|
|
575
575
|
*/
|
|
576
576
|
declare function getOnEvents(meta: WorkflowMeta, target: object): OnEventEntry[];
|
|
577
577
|
|
|
578
|
+
/** What a tenant verifier receives for each request a tenant process sends. */
|
|
579
|
+
interface TenantVerifierInput {
|
|
580
|
+
/** The token presented on the request (the wire `tenant` field). */
|
|
581
|
+
token?: string | undefined;
|
|
582
|
+
/** The tenant the request *claims* to be. Advisory only: derive the real one from the token. */
|
|
583
|
+
tenant?: string | undefined;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* The object/class form of `verifyTenant`. Runs on the control plane for every request a tenant
|
|
587
|
+
* process sends.
|
|
588
|
+
*/
|
|
589
|
+
interface TenantVerifierContract {
|
|
590
|
+
/**
|
|
591
|
+
* Turn the wire token into the tenant it authenticates as. Return `null` to reject: the request is
|
|
592
|
+
* answered `unauthorized` and never touches a run. Throw when you cannot decide (the identity
|
|
593
|
+
* provider is down): the request fails with the error and the next one calls `verify` again. The
|
|
594
|
+
* returned `tenant` is trusted as-is, so derive it from the verified token, never from
|
|
595
|
+
* `input.tenant`.
|
|
596
|
+
*/
|
|
597
|
+
verify(input: TenantVerifierInput): VerifiedTenant | null | Promise<VerifiedTenant | null>;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* The object/class form of `tenantToken`. Runs on the tenant process before every request it sends.
|
|
601
|
+
*/
|
|
602
|
+
interface TenantCredentialsContract {
|
|
603
|
+
/**
|
|
604
|
+
* The token to present on the next request, sent as-is in the wire `tenant` field. Called once per
|
|
605
|
+
* request, so cache the token and fetch a new one before it expires. A throw (or an empty string)
|
|
606
|
+
* fails that request; the next request calls `token()` again.
|
|
607
|
+
*/
|
|
608
|
+
token(): string | Promise<string>;
|
|
609
|
+
}
|
|
610
|
+
/** A class implementing a contract; its constructor parameters are resolved by Nest DI. */
|
|
611
|
+
type ContractClass<T> = new (...args: any[]) => T;
|
|
612
|
+
/** A lazy import of a module whose default export is a contract class or object. */
|
|
613
|
+
type LazyContract<T> = () => Promise<{
|
|
614
|
+
default: ContractClass<T> | T;
|
|
615
|
+
}>;
|
|
616
|
+
/**
|
|
617
|
+
* The `verifyTenant` option: a function (e.g. `hmacTenantVerifier(secret)`), an object implementing
|
|
618
|
+
* {@link TenantVerifierContract}, a class implementing it (built once through Nest DI: the registered
|
|
619
|
+
* provider when there is one, else `ModuleRef.create`), or a lazy import of a module whose default
|
|
620
|
+
* export is such a class or object (imported once).
|
|
621
|
+
*/
|
|
622
|
+
type TenantVerifierOption = TenantVerifier | TenantVerifierContract | ContractClass<TenantVerifierContract> | LazyContract<TenantVerifierContract>;
|
|
623
|
+
/**
|
|
624
|
+
* The `tenantToken` option: a string, a function called before every request, an object implementing
|
|
625
|
+
* {@link TenantCredentialsContract}, a class implementing it (built once through Nest DI), or a lazy
|
|
626
|
+
* import of a module whose default export is such a class or object (imported once).
|
|
627
|
+
*/
|
|
628
|
+
type TenantTokenOption = TenantTokenSource | TenantCredentialsContract | ContractClass<TenantCredentialsContract> | LazyContract<TenantCredentialsContract>;
|
|
629
|
+
|
|
578
630
|
/**
|
|
579
631
|
* Retention config for the {@link RetentionPoller}. One or more {@link RetentionPolicy policies}
|
|
580
632
|
* (status sets must be disjoint per scope — validated at boot), swept together on a shared interval.
|
|
@@ -607,28 +659,24 @@ interface DurableRetentionOptions {
|
|
|
607
659
|
batchSize?: number;
|
|
608
660
|
}
|
|
609
661
|
/**
|
|
610
|
-
*
|
|
611
|
-
* `connection` are set:
|
|
662
|
+
* The options every {@link DurableModuleOptions} variant shares. With no `topology` (or
|
|
663
|
+
* `topology: 'standalone'`) the **role is inferred** from which of `store`/`connection` are set:
|
|
612
664
|
*
|
|
613
|
-
* - `{ store, transport }
|
|
665
|
+
* - `{ store, transport }`: **operator**, a real `WorkflowEngine` + `StoreRunGateway` + drivers/
|
|
614
666
|
* timer/retention/registrars, executing registered bodies INLINE. Driven by {@link drive} (default
|
|
615
667
|
* `true`).
|
|
616
|
-
* - `{ connection }` (no `store`)
|
|
668
|
+
* - `{ connection }` (no `store`): **thin worker**, `WorkflowEngine` resolves to a store-less
|
|
617
669
|
* `DurableStartClient`; `RUN_GATEWAY` is a `ProxyRunGateway` when `transport` is also given, else
|
|
618
|
-
* every method rejects with a clear error. No store/timer/retention/entity
|
|
670
|
+
* every method rejects with a clear error. No store/timer/retention/entity, just discovered
|
|
619
671
|
* `@Workflow`/`@Step` handlers served over ONE `runRedisWorker` consumer.
|
|
620
|
-
* - `{ store, transport, connection }
|
|
672
|
+
* - `{ store, transport, connection }`: an **operator that also runs a co-located worker**: every
|
|
621
673
|
* `@Workflow` is registered GROUP-SERVED (dispatched over the transport, PER WORKFLOW NAME, instead
|
|
622
674
|
* of inline) and a co-located consumer (one `runRedisWorker` call) replays the same bodies.
|
|
623
675
|
*
|
|
624
676
|
* `forRoot` throws when neither `store` nor `connection` is set, and when `store` is set without a
|
|
625
677
|
* `transport`.
|
|
626
|
-
*
|
|
627
|
-
* Set {@link DurableModuleOptions.topology} to name the role explicitly instead of relying on this
|
|
628
|
-
* inference — it additionally VALIDATES the axes above (`namespace` vs `partition`) that this prose
|
|
629
|
-
* is otherwise the only source of truth for. Omitting it changes nothing.
|
|
630
678
|
*/
|
|
631
|
-
interface
|
|
679
|
+
interface DurableModuleSharedOptions {
|
|
632
680
|
/** State store — set this to play the **operator** role (see the interface doc for the full role
|
|
633
681
|
* matrix). Omit for a store-less **thin worker** (`connection` only). */
|
|
634
682
|
store?: StateStore;
|
|
@@ -937,73 +985,96 @@ interface DurableModuleOptions {
|
|
|
937
985
|
* **Operator.** Verifies the signed tenant token a store-less tenant worker presents in the wire
|
|
938
986
|
* `tenant` field of every run request and start-run message, and DERIVES the tenant from it,
|
|
939
987
|
* discarding the wire claim. An invalid, tampered or absent token is rejected: a run request gets
|
|
940
|
-
* an `unauthorized` error reply, a start-run creates nothing
|
|
941
|
-
* (tokens minted by `signTenantToken`,
|
|
988
|
+
* an `unauthorized` error reply, a start-run creates nothing; a verifier that throws fails the
|
|
989
|
+
* request with its error. Use `hmacTenantVerifier(secret)` (tokens minted by `signTenantToken`,
|
|
990
|
+
* wire-compatible with Agora) or supply your own: a function, an object or class implementing
|
|
991
|
+
* `TenantVerifierContract` (a class is built once through Nest DI), or a lazy import of one
|
|
992
|
+
* (`() => import('./tenant-verifier.js')`, imported once).
|
|
942
993
|
*
|
|
943
994
|
* Optional. Absent: the wire `tenant` is trusted verbatim (prefix/network isolation only), exactly
|
|
944
|
-
* as before.
|
|
945
|
-
*
|
|
995
|
+
* as before. `topology: 'control-plane'` without a verifier logs a warning at boot; a standalone
|
|
996
|
+
* operator boots silently.
|
|
946
997
|
*/
|
|
947
|
-
verifyTenant?:
|
|
998
|
+
verifyTenant?: TenantVerifierOption;
|
|
948
999
|
/**
|
|
949
1000
|
* **Tenant worker.** The signed token (see `signTenantToken`) this worker presents, verbatim, in
|
|
950
1001
|
* the `tenant` field of every run request (`ProxyRunGateway`) and start-run (`engine.start`), so
|
|
951
|
-
* an operator with {@link verifyTenant} can authenticate it. A string,
|
|
952
|
-
* every request (rotation, short-lived tokens)
|
|
953
|
-
*
|
|
1002
|
+
* an operator with {@link verifyTenant} can authenticate it. A string, a function called before
|
|
1003
|
+
* every request (rotation, short-lived tokens), an object or class implementing
|
|
1004
|
+
* `TenantCredentialsContract` (a class is built once through Nest DI), or a lazy import of one.
|
|
1005
|
+
* Every form but the string is called per request and owns its caching. Optional: absent, the raw
|
|
1006
|
+
* {@link partition} is sent, as before. Live-tail stays keyed by the partition, never the token.
|
|
954
1007
|
*/
|
|
955
|
-
tenantToken?:
|
|
1008
|
+
tenantToken?: TenantTokenOption;
|
|
1009
|
+
}
|
|
1010
|
+
/** The process roles a {@link DurableModuleOptions.topology} names. Same vocabulary as Agora. */
|
|
1011
|
+
type DurableTopologyName = 'standalone' | 'control-plane' | 'tenant';
|
|
1012
|
+
/**
|
|
1013
|
+
* The default topology: today's role inference from `store`/`connection` (see
|
|
1014
|
+
* {@link DurableModuleSharedOptions}). `partition` is the queue suffix a worker role serves.
|
|
1015
|
+
*/
|
|
1016
|
+
interface StandaloneDurableOptions extends DurableModuleSharedOptions {
|
|
1017
|
+
topology?: 'standalone';
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* A coordinator: owns the store, dispatches over the transport, recovers, fires timers, prunes
|
|
1021
|
+
* retention and answers tenant requests. Requires `store` and `transport` (or `transports`).
|
|
1022
|
+
*/
|
|
1023
|
+
interface ControlPlaneDurableOptions extends Omit<DurableModuleSharedOptions, 'store' | 'tenantToken'> {
|
|
1024
|
+
topology: 'control-plane';
|
|
1025
|
+
store: StateStore;
|
|
956
1026
|
/**
|
|
957
|
-
*
|
|
958
|
-
*
|
|
959
|
-
*
|
|
960
|
-
*
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
* Unset makes the instance see (drive) EVERY namespace.
|
|
966
|
-
* `{ role: 'control-plane' }` is the only preset that allows it.
|
|
967
|
-
* - `partition` is the WORKER's queue-routing suffix: which queue a thin/co-located worker's
|
|
968
|
-
* consumer subscribes to (`<name>@<partition>`), matching the queue an operator's convention
|
|
969
|
-
* dispatch routes a run's `namespace` to. `{ role: 'tenant' }` sets this FOR you from `tenant` —
|
|
970
|
-
* you never set `partition` directly under `topology`.
|
|
971
|
-
*
|
|
972
|
-
* **One `tenant` word, two axes — the preset maps it to the right one per role:** on a
|
|
973
|
-
* `control-plane` an optional `tenant` scopes the OPERATOR to its own runs (maps to `namespace` —
|
|
974
|
-
* a self-contained local stack sharing a broker with a deployed cluster names itself so neither
|
|
975
|
-
* drives the other's runs; leave it unset on a deployed operator to drive every tenant). On a
|
|
976
|
-
* `tenant` role it is required and maps to `partition` (the worker's queue suffix).
|
|
977
|
-
*
|
|
978
|
-
* ```ts
|
|
979
|
-
* // Control plane: owns the store, dispatches over the transport, prunes old runs. The optional
|
|
980
|
-
* // `tenant` (e.g. from an env var) scopes this operator to its own runs — undefined on a
|
|
981
|
-
* // deployed operator (drives everything), set on a local stack sharing the broker.
|
|
982
|
-
* DurableModule.forRoot({
|
|
983
|
-
* topology: { role: 'control-plane', tenant: process.env.DURABLE_TENANT },
|
|
984
|
-
* store,
|
|
985
|
-
* transport,
|
|
986
|
-
* retention: { policies: [{ statuses: ['completed', 'cancelled'], maxAge: '14d' }] },
|
|
987
|
-
* });
|
|
988
|
-
*
|
|
989
|
-
* // Tenant: store-less worker scoped to its own partition — `tenant` maps to `partition` for you.
|
|
990
|
-
* DurableModule.forRoot({
|
|
991
|
-
* topology: { role: 'tenant', tenant: 'acme-corp' },
|
|
992
|
-
* connection: process.env.REDIS_URL,
|
|
993
|
-
* });
|
|
994
|
-
* ```
|
|
995
|
-
*
|
|
996
|
-
* Validated at `forRoot`/`forRootAsync` resolution time — see {@link DurableModule} for the exact
|
|
997
|
-
* error messages, which double as the axis primer above.
|
|
998
|
-
*/
|
|
999
|
-
topology?: {
|
|
1000
|
-
role: 'control-plane';
|
|
1001
|
-
tenant?: string;
|
|
1002
|
-
} | {
|
|
1003
|
-
role: 'tenant';
|
|
1004
|
-
tenant: string;
|
|
1005
|
-
};
|
|
1027
|
+
* The namespace this control plane serves. Omit it on a deployed control plane, which then drives
|
|
1028
|
+
* every tenant's runs. Set it to scope a self-contained stack (a developer's machine sharing a
|
|
1029
|
+
* broker with a deployed cluster) to its own runs: it becomes this node's `namespace` and the
|
|
1030
|
+
* `<name>@<partition>` queues its co-located consumers subscribe to.
|
|
1031
|
+
*/
|
|
1032
|
+
partition?: string;
|
|
1033
|
+
/** A control plane verifies tenant tokens; it does not present one. */
|
|
1034
|
+
tenantToken?: never;
|
|
1006
1035
|
}
|
|
1036
|
+
/**
|
|
1037
|
+
* A store-less worker for one partition: it pulls `<name>@<partition>` tasks from the broker over
|
|
1038
|
+
* `connection` and, with a `transport`, proxies reads and control actions to the control plane.
|
|
1039
|
+
*/
|
|
1040
|
+
interface TenantDurableOptions extends Omit<DurableModuleSharedOptions, 'store' | 'namespace' | 'partition' | 'connection' | 'verifyTenant'> {
|
|
1041
|
+
topology: 'tenant';
|
|
1042
|
+
/** A tenant is store-less: everything goes over the wire to the control plane. */
|
|
1043
|
+
store?: never;
|
|
1044
|
+
/** `namespace` scopes an operator's poll loop; a tenant has none. Use `partition`. */
|
|
1045
|
+
namespace?: never;
|
|
1046
|
+
/** The partition this process serves and acts as. Required. */
|
|
1047
|
+
partition: string;
|
|
1048
|
+
/** The broker connection the tenant's consumer pulls its partition's tasks from. Required. */
|
|
1049
|
+
connection: string | Record<string, unknown>;
|
|
1050
|
+
/** A tenant presents a token (`tenantToken`); the control plane verifies it. */
|
|
1051
|
+
verifyTenant?: never;
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Options for `DurableModule.forRoot`/`forRootAsync`, discriminated on `topology`:
|
|
1055
|
+
*
|
|
1056
|
+
* ```ts
|
|
1057
|
+
* // Control plane: owns the store, dispatches over the transport, prunes old runs.
|
|
1058
|
+
* DurableModule.forRoot({
|
|
1059
|
+
* topology: 'control-plane',
|
|
1060
|
+
* store,
|
|
1061
|
+
* transport,
|
|
1062
|
+
* retention: { policies: [{ statuses: ['completed', 'cancelled'], maxAge: '14d' }] },
|
|
1063
|
+
* });
|
|
1064
|
+
*
|
|
1065
|
+
* // Tenant: a store-less worker serving its own partition.
|
|
1066
|
+
* DurableModule.forRoot({
|
|
1067
|
+
* topology: 'tenant',
|
|
1068
|
+
* partition: 'acme-corp',
|
|
1069
|
+
* connection: process.env.REDIS_URL,
|
|
1070
|
+
* });
|
|
1071
|
+
* ```
|
|
1072
|
+
*
|
|
1073
|
+
* Omit `topology` (or pass `'standalone'`) to keep the role inference described on
|
|
1074
|
+
* {@link DurableModuleSharedOptions}. TypeScript rejects a `store` on a tenant; the rest is
|
|
1075
|
+
* validated at `forRoot`/`forRootAsync` resolution time.
|
|
1076
|
+
*/
|
|
1077
|
+
type DurableModuleOptions = StandaloneDurableOptions | ControlPlaneDurableOptions | TenantDurableOptions;
|
|
1007
1078
|
interface DurableModuleAsyncOptions {
|
|
1008
1079
|
useFactory: (...args: never[]) => DurableModuleOptions | Promise<DurableModuleOptions>;
|
|
1009
1080
|
inject?: InjectionToken[];
|
|
@@ -1011,13 +1082,7 @@ interface DurableModuleAsyncOptions {
|
|
|
1011
1082
|
declare class DurableModule {
|
|
1012
1083
|
static forRoot(options: DurableModuleOptions): DynamicModule;
|
|
1013
1084
|
static forRootAsync(options: DurableModuleAsyncOptions): DynamicModule;
|
|
1014
|
-
/**
|
|
1015
|
-
* Validates role/axis constraints, in resolution order. When {@link DurableModuleOptions.topology}
|
|
1016
|
-
* is set, it OWNS validation — {@link assertValidTopology}'s own store/transport/connection checks
|
|
1017
|
-
* are strictly stronger than {@link assertValidRole}'s, so the topology-specific, axis-teaching
|
|
1018
|
-
* message is what a `topology`-opted-in consumer sees (not the older generic one). Falls back to
|
|
1019
|
-
* {@link assertValidRole} unchanged when `topology` is absent — zero behavior change.
|
|
1020
|
-
*/
|
|
1085
|
+
/** Validates the topology and its role/axis constraints; see {@link assertValidTopology}. */
|
|
1021
1086
|
private static assertValid;
|
|
1022
1087
|
private static build;
|
|
1023
1088
|
}
|
|
@@ -1038,6 +1103,7 @@ declare class DurableStartClient {
|
|
|
1038
1103
|
private readonly options;
|
|
1039
1104
|
private readonly deps?;
|
|
1040
1105
|
private readonly tenant;
|
|
1106
|
+
private readonly tenantToken;
|
|
1041
1107
|
constructor(options: DurableModuleOptions, deps?: StartRunDeps | undefined);
|
|
1042
1108
|
start<C extends WorkflowClass>(workflow: C, input: WorkflowInputOf<C>, runId?: string, opts?: StartOptions): Promise<RunResult>;
|
|
1043
1109
|
start(workflow: string, input: unknown, runId?: string, opts?: StartOptions): Promise<RunResult>;
|
|
@@ -1270,7 +1336,7 @@ interface RunRequestResponderOptions {
|
|
|
1270
1336
|
verifyTenant?: TenantVerifier | undefined;
|
|
1271
1337
|
/**
|
|
1272
1338
|
* Warn at construction when no {@link verifyTenant} is set. Default `true`. `DurableModule` passes
|
|
1273
|
-
* `true` only for
|
|
1339
|
+
* `true` only for `topology: 'control-plane'`, so a standalone operator app that
|
|
1274
1340
|
* never serves tenants boots silently.
|
|
1275
1341
|
*/
|
|
1276
1342
|
warnWithoutVerifier?: boolean | undefined;
|
|
@@ -1644,4 +1710,4 @@ declare class WorkflowService {
|
|
|
1644
1710
|
republishLifecycle(target: RepublishLifecycleTarget): Promise<RepublishLifecycleResult>;
|
|
1645
1711
|
}
|
|
1646
1712
|
|
|
1647
|
-
export { BAD_RUN_REQUEST, CONTEXT_ACCESSOR, type ContextAccessor, type ContextStore, DEAD_LETTER_METADATA, DURABLE_STEP_METADATA, DURABLE_WORKER_RUNNERS, DURABLE_WORKER_RUNTIME, DeadLetter, type DtoClass, DurableModule, type DurableModuleAsyncOptions, type DurableModuleOptions, type DurableRetentionOptions, DurableStartClient, DurableStep, type DurableStepInterceptor, type DurableStepMeta, ENTITY_METADATA, ENTITY_ON_METADATA, Entity, EntityService, type ErrorClassWithCode, IN_APP_RUN_REDIS_WORKER, IN_APP_WORKER_BINDING, IN_APP_WORKER_RUNNERS, IN_APP_WORKER_RUNTIME, type InAppWorkerBinding, InAppWorkerBootstrap, type IoSchema, ON_ERROR_METADATA, ON_EVENT_BATCH_METADATA, ON_EVENT_METADATA, On, OnDurableEvent, OnError, type OnErrorMethod, OnEvent, OnWorkflowCompleted, OnWorkflowFailed, type OnWorkflowFailedOptions, type OnWorkflowSettledOptions, ProxyRunGateway, RUN_GATEWAY, RUN_REDIS_WORKER, RunGatewayError, type RunGatewayErrorCode, type RunLookupStore, type RunRedisWorkerFn, RunRequestResponder, type RunRequestResponderOptions, type RunRequestTransport, STEP_INTERCEPTOR_METADATA, Step, StepInterceptor, type StepOptions, StoreRunGateway, type SubscriberBatch, type SubscriberDebounce, type SubscriberDecorator, TENANT_REPUBLISH_MAX_LIMIT, TenantEventRepublisher, ThinStepRegistrar, ThinWorkerBootstrap, ThinWorkflowRegistrar, UNSUPPORTED_RUN_REQUEST, type UserRef, WORKFLOW_METADATA, Workflow, type WorkflowAttributesOf, type WorkflowMeta, type WorkflowOptions, WorkflowService, attributesOf, entityConfigFor, eventBatchOf, getDurableStepMeta, getEntityMeta, getOnEvents, getWorkflowMeta, inAppWorkerProviders, isDeadLetterHandler, isDrivingOperator, isOperatorRole, isStepInterceptor, onErrorCodesOf, thinWorkerProviders, unavailableRunGateway };
|
|
1713
|
+
export { BAD_RUN_REQUEST, CONTEXT_ACCESSOR, type ContextAccessor, type ContextStore, type ContractClass, type ControlPlaneDurableOptions, DEAD_LETTER_METADATA, DURABLE_STEP_METADATA, DURABLE_WORKER_RUNNERS, DURABLE_WORKER_RUNTIME, DeadLetter, type DtoClass, DurableModule, type DurableModuleAsyncOptions, type DurableModuleOptions, type DurableModuleSharedOptions, type DurableRetentionOptions, DurableStartClient, DurableStep, type DurableStepInterceptor, type DurableStepMeta, type DurableTopologyName, ENTITY_METADATA, ENTITY_ON_METADATA, Entity, EntityService, type ErrorClassWithCode, IN_APP_RUN_REDIS_WORKER, IN_APP_WORKER_BINDING, IN_APP_WORKER_RUNNERS, IN_APP_WORKER_RUNTIME, type InAppWorkerBinding, InAppWorkerBootstrap, type IoSchema, type LazyContract, ON_ERROR_METADATA, ON_EVENT_BATCH_METADATA, ON_EVENT_METADATA, On, OnDurableEvent, OnError, type OnErrorMethod, OnEvent, OnWorkflowCompleted, OnWorkflowFailed, type OnWorkflowFailedOptions, type OnWorkflowSettledOptions, ProxyRunGateway, RUN_GATEWAY, RUN_REDIS_WORKER, RunGatewayError, type RunGatewayErrorCode, type RunLookupStore, type RunRedisWorkerFn, RunRequestResponder, type RunRequestResponderOptions, type RunRequestTransport, STEP_INTERCEPTOR_METADATA, type StandaloneDurableOptions, Step, StepInterceptor, type StepOptions, StoreRunGateway, type SubscriberBatch, type SubscriberDebounce, type SubscriberDecorator, TENANT_REPUBLISH_MAX_LIMIT, type TenantCredentialsContract, type TenantDurableOptions, TenantEventRepublisher, type TenantTokenOption, type TenantVerifierContract, type TenantVerifierInput, type TenantVerifierOption, ThinStepRegistrar, ThinWorkerBootstrap, ThinWorkflowRegistrar, UNSUPPORTED_RUN_REQUEST, type UserRef, WORKFLOW_METADATA, Workflow, type WorkflowAttributesOf, type WorkflowMeta, type WorkflowOptions, WorkflowService, attributesOf, entityConfigFor, eventBatchOf, getDurableStepMeta, getEntityMeta, getOnEvents, getWorkflowMeta, inAppWorkerProviders, isDeadLetterHandler, isDrivingOperator, isOperatorRole, isStepInterceptor, onErrorCodesOf, thinWorkerProviders, unavailableRunGateway };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend,
|
|
1
|
+
import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, TenantVerifier, VerifiedTenant, TenantTokenSource, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunRequest, RunReply, DurableTopology, RunDetailOptions, RunDetail, FanPageQuery, FanPage, WorkflowRun, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, RepublishLifecycleTarget, RepublishLifecycleResult, WorkflowLifecycleLinks, EngineEvent, StepInvocation, LifecycleKind, TenantEvent, SignalOptions } from '@dudousxd/nestjs-durable-core';
|
|
2
2
|
export { AttributeFilter, DynamicWorkflowCtx, EngineEvent, EventSubscription, InferSearchAttributes, LIFECYCLE_PENDING_TAG, LifecycleEventOf, LifecycleKind, OnErrorInput, OnEventEntry, RunDetail, RunGateway, RunListItem, RunQuery, RunSchedulesOptions, RunStatus, RunWaiting, ScheduledWorkflow, SearchAttributes, SearchAttributesSchema, StepCheckpoint, StepEvent, StepLogger, TenantTokenSource, TenantVerifier, VerifiedTenant, WorkflowCtx, WorkflowEngine, WorkflowHandler, WorkflowLifecycleEvent, WorkflowRun, hmacTenantVerifier, lifecycleRunId, lifecycleSourceOf, prevCronFireMs, readSearchAttributes, runCompletedEvent, runFailedEvent, runSchedules, scheduleRunIdAt, scheduledRunId, signTenantToken, triggeredRunsOf } from '@dudousxd/nestjs-durable-core';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
|
|
@@ -575,6 +575,58 @@ declare const OnEvent: typeof OnDurableEvent;
|
|
|
575
575
|
*/
|
|
576
576
|
declare function getOnEvents(meta: WorkflowMeta, target: object): OnEventEntry[];
|
|
577
577
|
|
|
578
|
+
/** What a tenant verifier receives for each request a tenant process sends. */
|
|
579
|
+
interface TenantVerifierInput {
|
|
580
|
+
/** The token presented on the request (the wire `tenant` field). */
|
|
581
|
+
token?: string | undefined;
|
|
582
|
+
/** The tenant the request *claims* to be. Advisory only: derive the real one from the token. */
|
|
583
|
+
tenant?: string | undefined;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* The object/class form of `verifyTenant`. Runs on the control plane for every request a tenant
|
|
587
|
+
* process sends.
|
|
588
|
+
*/
|
|
589
|
+
interface TenantVerifierContract {
|
|
590
|
+
/**
|
|
591
|
+
* Turn the wire token into the tenant it authenticates as. Return `null` to reject: the request is
|
|
592
|
+
* answered `unauthorized` and never touches a run. Throw when you cannot decide (the identity
|
|
593
|
+
* provider is down): the request fails with the error and the next one calls `verify` again. The
|
|
594
|
+
* returned `tenant` is trusted as-is, so derive it from the verified token, never from
|
|
595
|
+
* `input.tenant`.
|
|
596
|
+
*/
|
|
597
|
+
verify(input: TenantVerifierInput): VerifiedTenant | null | Promise<VerifiedTenant | null>;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* The object/class form of `tenantToken`. Runs on the tenant process before every request it sends.
|
|
601
|
+
*/
|
|
602
|
+
interface TenantCredentialsContract {
|
|
603
|
+
/**
|
|
604
|
+
* The token to present on the next request, sent as-is in the wire `tenant` field. Called once per
|
|
605
|
+
* request, so cache the token and fetch a new one before it expires. A throw (or an empty string)
|
|
606
|
+
* fails that request; the next request calls `token()` again.
|
|
607
|
+
*/
|
|
608
|
+
token(): string | Promise<string>;
|
|
609
|
+
}
|
|
610
|
+
/** A class implementing a contract; its constructor parameters are resolved by Nest DI. */
|
|
611
|
+
type ContractClass<T> = new (...args: any[]) => T;
|
|
612
|
+
/** A lazy import of a module whose default export is a contract class or object. */
|
|
613
|
+
type LazyContract<T> = () => Promise<{
|
|
614
|
+
default: ContractClass<T> | T;
|
|
615
|
+
}>;
|
|
616
|
+
/**
|
|
617
|
+
* The `verifyTenant` option: a function (e.g. `hmacTenantVerifier(secret)`), an object implementing
|
|
618
|
+
* {@link TenantVerifierContract}, a class implementing it (built once through Nest DI: the registered
|
|
619
|
+
* provider when there is one, else `ModuleRef.create`), or a lazy import of a module whose default
|
|
620
|
+
* export is such a class or object (imported once).
|
|
621
|
+
*/
|
|
622
|
+
type TenantVerifierOption = TenantVerifier | TenantVerifierContract | ContractClass<TenantVerifierContract> | LazyContract<TenantVerifierContract>;
|
|
623
|
+
/**
|
|
624
|
+
* The `tenantToken` option: a string, a function called before every request, an object implementing
|
|
625
|
+
* {@link TenantCredentialsContract}, a class implementing it (built once through Nest DI), or a lazy
|
|
626
|
+
* import of a module whose default export is such a class or object (imported once).
|
|
627
|
+
*/
|
|
628
|
+
type TenantTokenOption = TenantTokenSource | TenantCredentialsContract | ContractClass<TenantCredentialsContract> | LazyContract<TenantCredentialsContract>;
|
|
629
|
+
|
|
578
630
|
/**
|
|
579
631
|
* Retention config for the {@link RetentionPoller}. One or more {@link RetentionPolicy policies}
|
|
580
632
|
* (status sets must be disjoint per scope — validated at boot), swept together on a shared interval.
|
|
@@ -607,28 +659,24 @@ interface DurableRetentionOptions {
|
|
|
607
659
|
batchSize?: number;
|
|
608
660
|
}
|
|
609
661
|
/**
|
|
610
|
-
*
|
|
611
|
-
* `connection` are set:
|
|
662
|
+
* The options every {@link DurableModuleOptions} variant shares. With no `topology` (or
|
|
663
|
+
* `topology: 'standalone'`) the **role is inferred** from which of `store`/`connection` are set:
|
|
612
664
|
*
|
|
613
|
-
* - `{ store, transport }
|
|
665
|
+
* - `{ store, transport }`: **operator**, a real `WorkflowEngine` + `StoreRunGateway` + drivers/
|
|
614
666
|
* timer/retention/registrars, executing registered bodies INLINE. Driven by {@link drive} (default
|
|
615
667
|
* `true`).
|
|
616
|
-
* - `{ connection }` (no `store`)
|
|
668
|
+
* - `{ connection }` (no `store`): **thin worker**, `WorkflowEngine` resolves to a store-less
|
|
617
669
|
* `DurableStartClient`; `RUN_GATEWAY` is a `ProxyRunGateway` when `transport` is also given, else
|
|
618
|
-
* every method rejects with a clear error. No store/timer/retention/entity
|
|
670
|
+
* every method rejects with a clear error. No store/timer/retention/entity, just discovered
|
|
619
671
|
* `@Workflow`/`@Step` handlers served over ONE `runRedisWorker` consumer.
|
|
620
|
-
* - `{ store, transport, connection }
|
|
672
|
+
* - `{ store, transport, connection }`: an **operator that also runs a co-located worker**: every
|
|
621
673
|
* `@Workflow` is registered GROUP-SERVED (dispatched over the transport, PER WORKFLOW NAME, instead
|
|
622
674
|
* of inline) and a co-located consumer (one `runRedisWorker` call) replays the same bodies.
|
|
623
675
|
*
|
|
624
676
|
* `forRoot` throws when neither `store` nor `connection` is set, and when `store` is set without a
|
|
625
677
|
* `transport`.
|
|
626
|
-
*
|
|
627
|
-
* Set {@link DurableModuleOptions.topology} to name the role explicitly instead of relying on this
|
|
628
|
-
* inference — it additionally VALIDATES the axes above (`namespace` vs `partition`) that this prose
|
|
629
|
-
* is otherwise the only source of truth for. Omitting it changes nothing.
|
|
630
678
|
*/
|
|
631
|
-
interface
|
|
679
|
+
interface DurableModuleSharedOptions {
|
|
632
680
|
/** State store — set this to play the **operator** role (see the interface doc for the full role
|
|
633
681
|
* matrix). Omit for a store-less **thin worker** (`connection` only). */
|
|
634
682
|
store?: StateStore;
|
|
@@ -937,73 +985,96 @@ interface DurableModuleOptions {
|
|
|
937
985
|
* **Operator.** Verifies the signed tenant token a store-less tenant worker presents in the wire
|
|
938
986
|
* `tenant` field of every run request and start-run message, and DERIVES the tenant from it,
|
|
939
987
|
* discarding the wire claim. An invalid, tampered or absent token is rejected: a run request gets
|
|
940
|
-
* an `unauthorized` error reply, a start-run creates nothing
|
|
941
|
-
* (tokens minted by `signTenantToken`,
|
|
988
|
+
* an `unauthorized` error reply, a start-run creates nothing; a verifier that throws fails the
|
|
989
|
+
* request with its error. Use `hmacTenantVerifier(secret)` (tokens minted by `signTenantToken`,
|
|
990
|
+
* wire-compatible with Agora) or supply your own: a function, an object or class implementing
|
|
991
|
+
* `TenantVerifierContract` (a class is built once through Nest DI), or a lazy import of one
|
|
992
|
+
* (`() => import('./tenant-verifier.js')`, imported once).
|
|
942
993
|
*
|
|
943
994
|
* Optional. Absent: the wire `tenant` is trusted verbatim (prefix/network isolation only), exactly
|
|
944
|
-
* as before.
|
|
945
|
-
*
|
|
995
|
+
* as before. `topology: 'control-plane'` without a verifier logs a warning at boot; a standalone
|
|
996
|
+
* operator boots silently.
|
|
946
997
|
*/
|
|
947
|
-
verifyTenant?:
|
|
998
|
+
verifyTenant?: TenantVerifierOption;
|
|
948
999
|
/**
|
|
949
1000
|
* **Tenant worker.** The signed token (see `signTenantToken`) this worker presents, verbatim, in
|
|
950
1001
|
* the `tenant` field of every run request (`ProxyRunGateway`) and start-run (`engine.start`), so
|
|
951
|
-
* an operator with {@link verifyTenant} can authenticate it. A string,
|
|
952
|
-
* every request (rotation, short-lived tokens)
|
|
953
|
-
*
|
|
1002
|
+
* an operator with {@link verifyTenant} can authenticate it. A string, a function called before
|
|
1003
|
+
* every request (rotation, short-lived tokens), an object or class implementing
|
|
1004
|
+
* `TenantCredentialsContract` (a class is built once through Nest DI), or a lazy import of one.
|
|
1005
|
+
* Every form but the string is called per request and owns its caching. Optional: absent, the raw
|
|
1006
|
+
* {@link partition} is sent, as before. Live-tail stays keyed by the partition, never the token.
|
|
954
1007
|
*/
|
|
955
|
-
tenantToken?:
|
|
1008
|
+
tenantToken?: TenantTokenOption;
|
|
1009
|
+
}
|
|
1010
|
+
/** The process roles a {@link DurableModuleOptions.topology} names. Same vocabulary as Agora. */
|
|
1011
|
+
type DurableTopologyName = 'standalone' | 'control-plane' | 'tenant';
|
|
1012
|
+
/**
|
|
1013
|
+
* The default topology: today's role inference from `store`/`connection` (see
|
|
1014
|
+
* {@link DurableModuleSharedOptions}). `partition` is the queue suffix a worker role serves.
|
|
1015
|
+
*/
|
|
1016
|
+
interface StandaloneDurableOptions extends DurableModuleSharedOptions {
|
|
1017
|
+
topology?: 'standalone';
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* A coordinator: owns the store, dispatches over the transport, recovers, fires timers, prunes
|
|
1021
|
+
* retention and answers tenant requests. Requires `store` and `transport` (or `transports`).
|
|
1022
|
+
*/
|
|
1023
|
+
interface ControlPlaneDurableOptions extends Omit<DurableModuleSharedOptions, 'store' | 'tenantToken'> {
|
|
1024
|
+
topology: 'control-plane';
|
|
1025
|
+
store: StateStore;
|
|
956
1026
|
/**
|
|
957
|
-
*
|
|
958
|
-
*
|
|
959
|
-
*
|
|
960
|
-
*
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
* Unset makes the instance see (drive) EVERY namespace.
|
|
966
|
-
* `{ role: 'control-plane' }` is the only preset that allows it.
|
|
967
|
-
* - `partition` is the WORKER's queue-routing suffix: which queue a thin/co-located worker's
|
|
968
|
-
* consumer subscribes to (`<name>@<partition>`), matching the queue an operator's convention
|
|
969
|
-
* dispatch routes a run's `namespace` to. `{ role: 'tenant' }` sets this FOR you from `tenant` —
|
|
970
|
-
* you never set `partition` directly under `topology`.
|
|
971
|
-
*
|
|
972
|
-
* **One `tenant` word, two axes — the preset maps it to the right one per role:** on a
|
|
973
|
-
* `control-plane` an optional `tenant` scopes the OPERATOR to its own runs (maps to `namespace` —
|
|
974
|
-
* a self-contained local stack sharing a broker with a deployed cluster names itself so neither
|
|
975
|
-
* drives the other's runs; leave it unset on a deployed operator to drive every tenant). On a
|
|
976
|
-
* `tenant` role it is required and maps to `partition` (the worker's queue suffix).
|
|
977
|
-
*
|
|
978
|
-
* ```ts
|
|
979
|
-
* // Control plane: owns the store, dispatches over the transport, prunes old runs. The optional
|
|
980
|
-
* // `tenant` (e.g. from an env var) scopes this operator to its own runs — undefined on a
|
|
981
|
-
* // deployed operator (drives everything), set on a local stack sharing the broker.
|
|
982
|
-
* DurableModule.forRoot({
|
|
983
|
-
* topology: { role: 'control-plane', tenant: process.env.DURABLE_TENANT },
|
|
984
|
-
* store,
|
|
985
|
-
* transport,
|
|
986
|
-
* retention: { policies: [{ statuses: ['completed', 'cancelled'], maxAge: '14d' }] },
|
|
987
|
-
* });
|
|
988
|
-
*
|
|
989
|
-
* // Tenant: store-less worker scoped to its own partition — `tenant` maps to `partition` for you.
|
|
990
|
-
* DurableModule.forRoot({
|
|
991
|
-
* topology: { role: 'tenant', tenant: 'acme-corp' },
|
|
992
|
-
* connection: process.env.REDIS_URL,
|
|
993
|
-
* });
|
|
994
|
-
* ```
|
|
995
|
-
*
|
|
996
|
-
* Validated at `forRoot`/`forRootAsync` resolution time — see {@link DurableModule} for the exact
|
|
997
|
-
* error messages, which double as the axis primer above.
|
|
998
|
-
*/
|
|
999
|
-
topology?: {
|
|
1000
|
-
role: 'control-plane';
|
|
1001
|
-
tenant?: string;
|
|
1002
|
-
} | {
|
|
1003
|
-
role: 'tenant';
|
|
1004
|
-
tenant: string;
|
|
1005
|
-
};
|
|
1027
|
+
* The namespace this control plane serves. Omit it on a deployed control plane, which then drives
|
|
1028
|
+
* every tenant's runs. Set it to scope a self-contained stack (a developer's machine sharing a
|
|
1029
|
+
* broker with a deployed cluster) to its own runs: it becomes this node's `namespace` and the
|
|
1030
|
+
* `<name>@<partition>` queues its co-located consumers subscribe to.
|
|
1031
|
+
*/
|
|
1032
|
+
partition?: string;
|
|
1033
|
+
/** A control plane verifies tenant tokens; it does not present one. */
|
|
1034
|
+
tenantToken?: never;
|
|
1006
1035
|
}
|
|
1036
|
+
/**
|
|
1037
|
+
* A store-less worker for one partition: it pulls `<name>@<partition>` tasks from the broker over
|
|
1038
|
+
* `connection` and, with a `transport`, proxies reads and control actions to the control plane.
|
|
1039
|
+
*/
|
|
1040
|
+
interface TenantDurableOptions extends Omit<DurableModuleSharedOptions, 'store' | 'namespace' | 'partition' | 'connection' | 'verifyTenant'> {
|
|
1041
|
+
topology: 'tenant';
|
|
1042
|
+
/** A tenant is store-less: everything goes over the wire to the control plane. */
|
|
1043
|
+
store?: never;
|
|
1044
|
+
/** `namespace` scopes an operator's poll loop; a tenant has none. Use `partition`. */
|
|
1045
|
+
namespace?: never;
|
|
1046
|
+
/** The partition this process serves and acts as. Required. */
|
|
1047
|
+
partition: string;
|
|
1048
|
+
/** The broker connection the tenant's consumer pulls its partition's tasks from. Required. */
|
|
1049
|
+
connection: string | Record<string, unknown>;
|
|
1050
|
+
/** A tenant presents a token (`tenantToken`); the control plane verifies it. */
|
|
1051
|
+
verifyTenant?: never;
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Options for `DurableModule.forRoot`/`forRootAsync`, discriminated on `topology`:
|
|
1055
|
+
*
|
|
1056
|
+
* ```ts
|
|
1057
|
+
* // Control plane: owns the store, dispatches over the transport, prunes old runs.
|
|
1058
|
+
* DurableModule.forRoot({
|
|
1059
|
+
* topology: 'control-plane',
|
|
1060
|
+
* store,
|
|
1061
|
+
* transport,
|
|
1062
|
+
* retention: { policies: [{ statuses: ['completed', 'cancelled'], maxAge: '14d' }] },
|
|
1063
|
+
* });
|
|
1064
|
+
*
|
|
1065
|
+
* // Tenant: a store-less worker serving its own partition.
|
|
1066
|
+
* DurableModule.forRoot({
|
|
1067
|
+
* topology: 'tenant',
|
|
1068
|
+
* partition: 'acme-corp',
|
|
1069
|
+
* connection: process.env.REDIS_URL,
|
|
1070
|
+
* });
|
|
1071
|
+
* ```
|
|
1072
|
+
*
|
|
1073
|
+
* Omit `topology` (or pass `'standalone'`) to keep the role inference described on
|
|
1074
|
+
* {@link DurableModuleSharedOptions}. TypeScript rejects a `store` on a tenant; the rest is
|
|
1075
|
+
* validated at `forRoot`/`forRootAsync` resolution time.
|
|
1076
|
+
*/
|
|
1077
|
+
type DurableModuleOptions = StandaloneDurableOptions | ControlPlaneDurableOptions | TenantDurableOptions;
|
|
1007
1078
|
interface DurableModuleAsyncOptions {
|
|
1008
1079
|
useFactory: (...args: never[]) => DurableModuleOptions | Promise<DurableModuleOptions>;
|
|
1009
1080
|
inject?: InjectionToken[];
|
|
@@ -1011,13 +1082,7 @@ interface DurableModuleAsyncOptions {
|
|
|
1011
1082
|
declare class DurableModule {
|
|
1012
1083
|
static forRoot(options: DurableModuleOptions): DynamicModule;
|
|
1013
1084
|
static forRootAsync(options: DurableModuleAsyncOptions): DynamicModule;
|
|
1014
|
-
/**
|
|
1015
|
-
* Validates role/axis constraints, in resolution order. When {@link DurableModuleOptions.topology}
|
|
1016
|
-
* is set, it OWNS validation — {@link assertValidTopology}'s own store/transport/connection checks
|
|
1017
|
-
* are strictly stronger than {@link assertValidRole}'s, so the topology-specific, axis-teaching
|
|
1018
|
-
* message is what a `topology`-opted-in consumer sees (not the older generic one). Falls back to
|
|
1019
|
-
* {@link assertValidRole} unchanged when `topology` is absent — zero behavior change.
|
|
1020
|
-
*/
|
|
1085
|
+
/** Validates the topology and its role/axis constraints; see {@link assertValidTopology}. */
|
|
1021
1086
|
private static assertValid;
|
|
1022
1087
|
private static build;
|
|
1023
1088
|
}
|
|
@@ -1038,6 +1103,7 @@ declare class DurableStartClient {
|
|
|
1038
1103
|
private readonly options;
|
|
1039
1104
|
private readonly deps?;
|
|
1040
1105
|
private readonly tenant;
|
|
1106
|
+
private readonly tenantToken;
|
|
1041
1107
|
constructor(options: DurableModuleOptions, deps?: StartRunDeps | undefined);
|
|
1042
1108
|
start<C extends WorkflowClass>(workflow: C, input: WorkflowInputOf<C>, runId?: string, opts?: StartOptions): Promise<RunResult>;
|
|
1043
1109
|
start(workflow: string, input: unknown, runId?: string, opts?: StartOptions): Promise<RunResult>;
|
|
@@ -1270,7 +1336,7 @@ interface RunRequestResponderOptions {
|
|
|
1270
1336
|
verifyTenant?: TenantVerifier | undefined;
|
|
1271
1337
|
/**
|
|
1272
1338
|
* Warn at construction when no {@link verifyTenant} is set. Default `true`. `DurableModule` passes
|
|
1273
|
-
* `true` only for
|
|
1339
|
+
* `true` only for `topology: 'control-plane'`, so a standalone operator app that
|
|
1274
1340
|
* never serves tenants boots silently.
|
|
1275
1341
|
*/
|
|
1276
1342
|
warnWithoutVerifier?: boolean | undefined;
|
|
@@ -1644,4 +1710,4 @@ declare class WorkflowService {
|
|
|
1644
1710
|
republishLifecycle(target: RepublishLifecycleTarget): Promise<RepublishLifecycleResult>;
|
|
1645
1711
|
}
|
|
1646
1712
|
|
|
1647
|
-
export { BAD_RUN_REQUEST, CONTEXT_ACCESSOR, type ContextAccessor, type ContextStore, DEAD_LETTER_METADATA, DURABLE_STEP_METADATA, DURABLE_WORKER_RUNNERS, DURABLE_WORKER_RUNTIME, DeadLetter, type DtoClass, DurableModule, type DurableModuleAsyncOptions, type DurableModuleOptions, type DurableRetentionOptions, DurableStartClient, DurableStep, type DurableStepInterceptor, type DurableStepMeta, ENTITY_METADATA, ENTITY_ON_METADATA, Entity, EntityService, type ErrorClassWithCode, IN_APP_RUN_REDIS_WORKER, IN_APP_WORKER_BINDING, IN_APP_WORKER_RUNNERS, IN_APP_WORKER_RUNTIME, type InAppWorkerBinding, InAppWorkerBootstrap, type IoSchema, ON_ERROR_METADATA, ON_EVENT_BATCH_METADATA, ON_EVENT_METADATA, On, OnDurableEvent, OnError, type OnErrorMethod, OnEvent, OnWorkflowCompleted, OnWorkflowFailed, type OnWorkflowFailedOptions, type OnWorkflowSettledOptions, ProxyRunGateway, RUN_GATEWAY, RUN_REDIS_WORKER, RunGatewayError, type RunGatewayErrorCode, type RunLookupStore, type RunRedisWorkerFn, RunRequestResponder, type RunRequestResponderOptions, type RunRequestTransport, STEP_INTERCEPTOR_METADATA, Step, StepInterceptor, type StepOptions, StoreRunGateway, type SubscriberBatch, type SubscriberDebounce, type SubscriberDecorator, TENANT_REPUBLISH_MAX_LIMIT, TenantEventRepublisher, ThinStepRegistrar, ThinWorkerBootstrap, ThinWorkflowRegistrar, UNSUPPORTED_RUN_REQUEST, type UserRef, WORKFLOW_METADATA, Workflow, type WorkflowAttributesOf, type WorkflowMeta, type WorkflowOptions, WorkflowService, attributesOf, entityConfigFor, eventBatchOf, getDurableStepMeta, getEntityMeta, getOnEvents, getWorkflowMeta, inAppWorkerProviders, isDeadLetterHandler, isDrivingOperator, isOperatorRole, isStepInterceptor, onErrorCodesOf, thinWorkerProviders, unavailableRunGateway };
|
|
1713
|
+
export { BAD_RUN_REQUEST, CONTEXT_ACCESSOR, type ContextAccessor, type ContextStore, type ContractClass, type ControlPlaneDurableOptions, DEAD_LETTER_METADATA, DURABLE_STEP_METADATA, DURABLE_WORKER_RUNNERS, DURABLE_WORKER_RUNTIME, DeadLetter, type DtoClass, DurableModule, type DurableModuleAsyncOptions, type DurableModuleOptions, type DurableModuleSharedOptions, type DurableRetentionOptions, DurableStartClient, DurableStep, type DurableStepInterceptor, type DurableStepMeta, type DurableTopologyName, ENTITY_METADATA, ENTITY_ON_METADATA, Entity, EntityService, type ErrorClassWithCode, IN_APP_RUN_REDIS_WORKER, IN_APP_WORKER_BINDING, IN_APP_WORKER_RUNNERS, IN_APP_WORKER_RUNTIME, type InAppWorkerBinding, InAppWorkerBootstrap, type IoSchema, type LazyContract, ON_ERROR_METADATA, ON_EVENT_BATCH_METADATA, ON_EVENT_METADATA, On, OnDurableEvent, OnError, type OnErrorMethod, OnEvent, OnWorkflowCompleted, OnWorkflowFailed, type OnWorkflowFailedOptions, type OnWorkflowSettledOptions, ProxyRunGateway, RUN_GATEWAY, RUN_REDIS_WORKER, RunGatewayError, type RunGatewayErrorCode, type RunLookupStore, type RunRedisWorkerFn, RunRequestResponder, type RunRequestResponderOptions, type RunRequestTransport, STEP_INTERCEPTOR_METADATA, type StandaloneDurableOptions, Step, StepInterceptor, type StepOptions, StoreRunGateway, type SubscriberBatch, type SubscriberDebounce, type SubscriberDecorator, TENANT_REPUBLISH_MAX_LIMIT, type TenantCredentialsContract, type TenantDurableOptions, TenantEventRepublisher, type TenantTokenOption, type TenantVerifierContract, type TenantVerifierInput, type TenantVerifierOption, ThinStepRegistrar, ThinWorkerBootstrap, ThinWorkflowRegistrar, UNSUPPORTED_RUN_REQUEST, type UserRef, WORKFLOW_METADATA, Workflow, type WorkflowAttributesOf, type WorkflowMeta, type WorkflowOptions, WorkflowService, attributesOf, entityConfigFor, eventBatchOf, getDurableStepMeta, getEntityMeta, getOnEvents, getWorkflowMeta, inAppWorkerProviders, isDeadLetterHandler, isDrivingOperator, isOperatorRole, isStepInterceptor, onErrorCodesOf, thinWorkerProviders, unavailableRunGateway };
|