@nagi-js/core 0.1.1-rc.20 → 0.1.1-rc.22
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/{chunk-VQTYTI6X.js → chunk-PUAV56FC.js} +922 -519
- package/dist/chunk-PUAV56FC.js.map +1 -0
- package/dist/index.d.ts +90 -115
- package/dist/index.js +693 -1390
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +675 -214
- package/dist/testing.js.map +1 -1
- package/dist/{types-DFSYjJE3.d.ts → types-Ct5xHI4W.d.ts} +119 -125
- package/package.json +1 -1
- package/dist/chunk-VQTYTI6X.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type SkipReason = "when-false" | "transitive"
|
|
1
|
+
type SkipReason = "when-false" | "transitive";
|
|
2
2
|
type StepCancelCause = {
|
|
3
3
|
readonly kind: "run-canceled";
|
|
4
4
|
} | {
|
|
@@ -13,11 +13,6 @@ type RunCancelCause = {
|
|
|
13
13
|
readonly kind: "explicit";
|
|
14
14
|
readonly reason: string;
|
|
15
15
|
readonly note?: string;
|
|
16
|
-
} | {
|
|
17
|
-
readonly kind: "operator";
|
|
18
|
-
readonly actor: string;
|
|
19
|
-
readonly reason: string;
|
|
20
|
-
readonly note?: string;
|
|
21
16
|
};
|
|
22
17
|
type StepState = {
|
|
23
18
|
readonly tag: "pending";
|
|
@@ -79,11 +74,11 @@ interface RunState {
|
|
|
79
74
|
readonly input: Json;
|
|
80
75
|
readonly phase: RunPhase;
|
|
81
76
|
readonly steps: Readonly<Record<StepId, StepState>>;
|
|
82
|
-
readonly selectedArms: Readonly<Record<StepId, string>>;
|
|
83
77
|
readonly bufferedSignals: Readonly<Record<StepId, {
|
|
84
78
|
readonly payload: Json;
|
|
85
79
|
readonly signalName?: string;
|
|
86
80
|
}>>;
|
|
81
|
+
readonly resetCounts: Readonly<Record<StepId, number>>;
|
|
87
82
|
readonly facts: readonly Fact[];
|
|
88
83
|
readonly parent?: ParentLink;
|
|
89
84
|
readonly flowHash?: string;
|
|
@@ -134,37 +129,67 @@ type RowDelta = {
|
|
|
134
129
|
readonly stepId: StepId;
|
|
135
130
|
readonly attempt: AttemptNumber;
|
|
136
131
|
readonly startedAt: Date;
|
|
132
|
+
} | {
|
|
133
|
+
readonly row: "step";
|
|
134
|
+
readonly status: "backoff";
|
|
135
|
+
readonly stepId: StepId;
|
|
136
|
+
readonly attempt: AttemptNumber;
|
|
137
|
+
readonly error: SerializedError;
|
|
137
138
|
} | {
|
|
138
139
|
readonly row: "step";
|
|
139
140
|
readonly status: "completed";
|
|
140
141
|
readonly stepId: StepId;
|
|
141
142
|
readonly attempt: AttemptNumber;
|
|
142
143
|
readonly output: Json;
|
|
144
|
+
readonly completedAt: Date;
|
|
143
145
|
} | {
|
|
144
146
|
readonly row: "step";
|
|
145
147
|
readonly status: "failed";
|
|
146
148
|
readonly stepId: StepId;
|
|
147
149
|
readonly attempt: AttemptNumber;
|
|
148
150
|
readonly error: SerializedError;
|
|
151
|
+
readonly completedAt: Date;
|
|
149
152
|
} | {
|
|
150
153
|
readonly row: "step";
|
|
151
154
|
readonly status: "canceled";
|
|
152
155
|
readonly stepId: StepId;
|
|
153
156
|
readonly attempt: AttemptNumber;
|
|
154
157
|
readonly error: SerializedError | null;
|
|
158
|
+
readonly completedAt: Date;
|
|
155
159
|
} | {
|
|
156
160
|
readonly row: "step";
|
|
157
161
|
readonly status: "skipped";
|
|
158
162
|
readonly stepId: StepId;
|
|
163
|
+
readonly completedAt: Date;
|
|
159
164
|
} | {
|
|
160
165
|
readonly row: "step";
|
|
161
166
|
readonly status: "reset";
|
|
162
167
|
readonly stepId: StepId;
|
|
168
|
+
};
|
|
169
|
+
type Release = {
|
|
170
|
+
readonly tag: "release-step";
|
|
171
|
+
readonly stepId: StepId;
|
|
172
|
+
readonly timer: boolean;
|
|
163
173
|
} | {
|
|
164
|
-
readonly
|
|
174
|
+
readonly tag: "release-lease";
|
|
165
175
|
readonly stepId: StepId;
|
|
166
|
-
readonly
|
|
167
|
-
|
|
176
|
+
readonly attempt: AttemptNumber;
|
|
177
|
+
} | {
|
|
178
|
+
readonly tag: "release-run";
|
|
179
|
+
};
|
|
180
|
+
type StreamEffect = {
|
|
181
|
+
readonly tag: "close-ok";
|
|
182
|
+
readonly stepId: StepId;
|
|
183
|
+
} | {
|
|
184
|
+
readonly tag: "close-error";
|
|
185
|
+
readonly stepId: StepId;
|
|
186
|
+
readonly error: SerializedError;
|
|
187
|
+
} | {
|
|
188
|
+
readonly tag: "retry";
|
|
189
|
+
readonly stepId: StepId;
|
|
190
|
+
readonly nextAttempt: AttemptNumber;
|
|
191
|
+
} | {
|
|
192
|
+
readonly tag: "close-run";
|
|
168
193
|
};
|
|
169
194
|
|
|
170
195
|
interface FlowStartedFact extends FactBase {
|
|
@@ -195,17 +220,13 @@ interface FlowCanceledExplicitlyFact extends FactBase {
|
|
|
195
220
|
readonly reason: string;
|
|
196
221
|
readonly note?: string;
|
|
197
222
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
readonly
|
|
204
|
-
}
|
|
205
|
-
type FlowCanceledFact = FlowCanceledByConcurrencyFact | FlowCanceledExplicitlyFact | FlowCanceledByOperatorFact;
|
|
206
|
-
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
207
|
-
type CancelArgs = DistributiveOmit<FlowCanceledExplicitlyFact | FlowCanceledByOperatorFact, "kind" | "runId" | "at">;
|
|
208
|
-
type FlowFact = FlowStartedFact | FlowCompletedFact | FlowFailedFact | FlowCanceledFact;
|
|
223
|
+
type FlowCanceledFact = FlowCanceledByConcurrencyFact | FlowCanceledExplicitlyFact;
|
|
224
|
+
type CancelArgs = Omit<FlowCanceledExplicitlyFact, "kind" | "runId" | "at">;
|
|
225
|
+
type RunEndFact = FlowCompletedFact | FlowFailedFact | FlowCanceledFact;
|
|
226
|
+
type FlowFact = FlowStartedFact | RunEndFact;
|
|
227
|
+
declare function isRunEnd(fact: {
|
|
228
|
+
readonly kind: string;
|
|
229
|
+
}): fact is RunEndFact;
|
|
209
230
|
interface FlowRefUpdatedFact {
|
|
210
231
|
readonly kind: "flow_ref.updated";
|
|
211
232
|
readonly flowId: string;
|
|
@@ -250,35 +271,19 @@ interface StepSkippedFact extends FactBase {
|
|
|
250
271
|
readonly kind: "step.skipped";
|
|
251
272
|
readonly stepId: StepId;
|
|
252
273
|
readonly reason: SkipReason;
|
|
253
|
-
readonly actor?: string;
|
|
254
|
-
readonly note?: string;
|
|
255
274
|
}
|
|
256
275
|
interface StepResetFact extends FactBase {
|
|
257
276
|
readonly kind: "step.reset";
|
|
258
277
|
readonly stepId: StepId;
|
|
259
278
|
readonly cascadedFrom?: StepId;
|
|
260
|
-
readonly
|
|
261
|
-
readonly note?: string;
|
|
279
|
+
readonly scope?: ResetScope;
|
|
262
280
|
}
|
|
263
281
|
interface StepAbortRequestedFact extends FactBase {
|
|
264
282
|
readonly kind: "step.abort-requested";
|
|
265
283
|
readonly stepId: StepId;
|
|
266
284
|
readonly attempt: AttemptNumber;
|
|
267
|
-
readonly actor: string;
|
|
268
|
-
readonly note?: string;
|
|
269
|
-
}
|
|
270
|
-
interface MatchArmSelectedFact extends FactBase {
|
|
271
|
-
readonly kind: "match.arm-selected";
|
|
272
|
-
readonly stepId: StepId;
|
|
273
|
-
readonly arm: string;
|
|
274
|
-
}
|
|
275
|
-
interface OnceRecordedFact extends FactBase {
|
|
276
|
-
readonly kind: "once.recorded";
|
|
277
|
-
readonly stepId: StepId;
|
|
278
|
-
readonly scope: string;
|
|
279
|
-
readonly value: Json;
|
|
280
285
|
}
|
|
281
|
-
type StepFact = StepStartedFact | StepCompletedFact | StepFailedFact | StepCanceledFact | StepRetriedFact | StepSkippedFact | StepResetFact | StepAbortRequestedFact
|
|
286
|
+
type StepFact = StepStartedFact | StepCompletedFact | StepFailedFact | StepCanceledFact | StepRetriedFact | StepSkippedFact | StepResetFact | StepAbortRequestedFact;
|
|
282
287
|
|
|
283
288
|
interface SignalReceivedFact extends FactBase {
|
|
284
289
|
readonly kind: "signal.received";
|
|
@@ -306,7 +311,13 @@ type LeaseFact = LeaseReapedFact;
|
|
|
306
311
|
type Fact = FlowFact | StepFact | SignalFact | LeaseFact;
|
|
307
312
|
type FactKind = Fact["kind"];
|
|
308
313
|
declare function foldRun(runId: RunId, facts: readonly Fact[]): RunState;
|
|
309
|
-
|
|
314
|
+
interface FactConsequences {
|
|
315
|
+
readonly rows: RowDelta | null;
|
|
316
|
+
readonly release: Release | null;
|
|
317
|
+
readonly stream: StreamEffect | null;
|
|
318
|
+
readonly event: RunEvent | null;
|
|
319
|
+
}
|
|
320
|
+
declare function factConsequences(fact: Fact): FactConsequences;
|
|
310
321
|
|
|
311
322
|
type StepRunStatus = StepStatus;
|
|
312
323
|
interface RunView {
|
|
@@ -349,6 +360,7 @@ type ReaperDecision = {
|
|
|
349
360
|
readonly reason: "terminal" | "still-live" | "child-active";
|
|
350
361
|
} | {
|
|
351
362
|
readonly tag: "reap";
|
|
363
|
+
readonly fact: LeaseReapedFact;
|
|
352
364
|
readonly nextAttempt: AttemptNumber;
|
|
353
365
|
readonly backoffMs: Millis;
|
|
354
366
|
};
|
|
@@ -417,7 +429,7 @@ interface Register {
|
|
|
417
429
|
type Tx = Register extends {
|
|
418
430
|
tx: infer T;
|
|
419
431
|
} ? T : unknown;
|
|
420
|
-
type StepKind = "task" | "activity" | "signal" | "
|
|
432
|
+
type StepKind = "task" | "activity" | "signal" | "subflow" | "streaming";
|
|
421
433
|
interface Step<Output = unknown> {
|
|
422
434
|
readonly kind: StepKind;
|
|
423
435
|
readonly id: StepId;
|
|
@@ -500,24 +512,25 @@ interface StepLifecycleHooks<Output> {
|
|
|
500
512
|
readonly onError?: (event: StepErrorEvent) => void | Promise<void>;
|
|
501
513
|
readonly onRetry?: (event: StepRetryEvent) => void | Promise<void>;
|
|
502
514
|
}
|
|
503
|
-
interface
|
|
515
|
+
interface HandlerConfigBase<Input, N extends NeedsMap> extends StepConfigBase<Input, N> {
|
|
504
516
|
readonly retry?: RetryPolicy;
|
|
517
|
+
readonly timeoutMs?: Millis;
|
|
518
|
+
}
|
|
519
|
+
interface TaskConfig<Input, N extends NeedsMap, Output> extends HandlerConfigBase<Input, N>, StepLifecycleHooks<Output> {
|
|
505
520
|
readonly run: (args: {
|
|
506
521
|
readonly input: NoInfer<Input>;
|
|
507
522
|
readonly needs: NoInfer<ResolvedNeeds<N>>;
|
|
508
523
|
readonly ctx: StepCtx<NoInfer<Input>>;
|
|
509
524
|
}) => Promise<Output>;
|
|
510
525
|
}
|
|
511
|
-
interface ActivityConfig<Input, N extends NeedsMap, Output> extends
|
|
512
|
-
readonly retry?: RetryPolicy;
|
|
526
|
+
interface ActivityConfig<Input, N extends NeedsMap, Output> extends HandlerConfigBase<Input, N>, StepLifecycleHooks<Output> {
|
|
513
527
|
readonly run: (args: {
|
|
514
528
|
readonly input: NoInfer<Input>;
|
|
515
529
|
readonly needs: NoInfer<ResolvedNeeds<N>>;
|
|
516
530
|
readonly ctx: ActivityCtx<NoInfer<Input>>;
|
|
517
531
|
}) => Promise<Output>;
|
|
518
532
|
}
|
|
519
|
-
interface StreamingTaskConfig<Input, N extends NeedsMap, Output, Chunk> extends
|
|
520
|
-
readonly retry?: RetryPolicy;
|
|
533
|
+
interface StreamingTaskConfig<Input, N extends NeedsMap, Output, Chunk> extends HandlerConfigBase<Input, N>, StepLifecycleHooks<Output> {
|
|
521
534
|
readonly run: (args: {
|
|
522
535
|
readonly input: NoInfer<Input>;
|
|
523
536
|
readonly needs: NoInfer<ResolvedNeeds<N>>;
|
|
@@ -529,39 +542,6 @@ interface SignalConfig<Input, N extends NeedsMap, Schema extends StandardSchemaV
|
|
|
529
542
|
readonly names?: readonly [string, ...string[]];
|
|
530
543
|
readonly timeoutMs: Millis | "unbounded";
|
|
531
544
|
}
|
|
532
|
-
interface MatchArmGuard<Input, N extends NeedsMap, M extends StepMap> {
|
|
533
|
-
readonly when: (args: {
|
|
534
|
-
readonly input: NoInfer<Input>;
|
|
535
|
-
readonly needs: NoInfer<ResolvedNeeds<N>>;
|
|
536
|
-
}) => boolean;
|
|
537
|
-
readonly otherwise?: never;
|
|
538
|
-
readonly build: (b: Builder<Input>) => M;
|
|
539
|
-
}
|
|
540
|
-
interface MatchArmOtherwise<Input, M extends StepMap> {
|
|
541
|
-
readonly otherwise: true;
|
|
542
|
-
readonly when?: never;
|
|
543
|
-
readonly build: (b: Builder<Input>) => M;
|
|
544
|
-
}
|
|
545
|
-
type MatchArm<Input, N extends NeedsMap, M extends StepMap> = MatchArmGuard<Input, N, M> | MatchArmOtherwise<Input, M>;
|
|
546
|
-
type MatchArmShape<Input, N extends NeedsMap> = {
|
|
547
|
-
readonly when: (args: {
|
|
548
|
-
readonly input: NoInfer<Input>;
|
|
549
|
-
readonly needs: NoInfer<ResolvedNeeds<N>>;
|
|
550
|
-
}) => boolean;
|
|
551
|
-
readonly otherwise?: never;
|
|
552
|
-
readonly build: (b: Builder<Input>) => StepMap;
|
|
553
|
-
} | {
|
|
554
|
-
readonly otherwise: true;
|
|
555
|
-
readonly when?: never;
|
|
556
|
-
readonly build: (b: Builder<Input>) => StepMap;
|
|
557
|
-
};
|
|
558
|
-
interface MatchGuardConfig<Input, N extends NeedsMap, M extends StepMap> {
|
|
559
|
-
readonly needs?: N;
|
|
560
|
-
readonly arms: ReadonlyArray<MatchArm<Input, N, M>>;
|
|
561
|
-
}
|
|
562
|
-
type MatchArmOutput<M extends StepMap> = {
|
|
563
|
-
readonly [K in keyof M]: StepOutput<M[K]>;
|
|
564
|
-
};
|
|
565
545
|
interface SubflowConfig<Input, N extends NeedsMap, Child extends Flow> extends StepConfigBase<Input, N> {
|
|
566
546
|
readonly input: (args: {
|
|
567
547
|
readonly input: NoInfer<Input>;
|
|
@@ -578,10 +558,6 @@ interface Builder<Input = unknown> {
|
|
|
578
558
|
streamingTask<N extends NeedsMap, O, C = Json>(config: StreamingTaskConfig<Input, N, O, C>): Step<O>;
|
|
579
559
|
signal<N extends NeedsMap, S extends StandardSchemaV1>(config: SignalConfig<Input, N, S>): Step<InferSchemaOutput<S>>;
|
|
580
560
|
subflow<N extends NeedsMap, Child extends Flow>(child: Child, config: SubflowConfig<Input, N, Child>): Step<SubflowStepOutput<FlowOutput<Child>>>;
|
|
581
|
-
match<N extends NeedsMap, Arms extends ReadonlyArray<MatchArmShape<Input, N>>>(config: {
|
|
582
|
-
readonly needs?: N;
|
|
583
|
-
readonly arms: Arms;
|
|
584
|
-
}): Step<MatchArmOutput<ReturnType<Arms[number]["build"]>>>;
|
|
585
561
|
}
|
|
586
562
|
type ConcurrencyMode = "cancel-in-progress";
|
|
587
563
|
type StringKeyOf<Input> = {
|
|
@@ -679,6 +655,7 @@ interface WorkerConfig {
|
|
|
679
655
|
readonly pollIntervalMs?: Millis;
|
|
680
656
|
readonly signal?: AbortSignal;
|
|
681
657
|
readonly timerSweepIntervalMs?: Millis;
|
|
658
|
+
readonly reaperIntervalMs?: Millis;
|
|
682
659
|
readonly snapshotGonePolicy?: SnapshotGonePolicy;
|
|
683
660
|
readonly maxConcurrencyPerFlow?: number;
|
|
684
661
|
}
|
|
@@ -723,6 +700,12 @@ type SettleSignalResult = {
|
|
|
723
700
|
} | {
|
|
724
701
|
readonly tag: "noop";
|
|
725
702
|
};
|
|
703
|
+
type GetOnceResult = {
|
|
704
|
+
readonly tag: "hit";
|
|
705
|
+
readonly value: Json;
|
|
706
|
+
} | {
|
|
707
|
+
readonly tag: "miss";
|
|
708
|
+
};
|
|
726
709
|
interface TimedOutSignal {
|
|
727
710
|
readonly runId: RunId;
|
|
728
711
|
readonly stepId: StepId;
|
|
@@ -730,7 +713,8 @@ interface TimedOutSignal {
|
|
|
730
713
|
readonly fireAt: Date;
|
|
731
714
|
}
|
|
732
715
|
interface Store {
|
|
733
|
-
appendFact(runId: RunId, fact: Fact): Promise<void>;
|
|
716
|
+
appendFact(runId: RunId, fact: Exclude<Fact, RunEndFact>): Promise<void>;
|
|
717
|
+
endRun(runId: RunId, fact: RunEndFact): Promise<boolean>;
|
|
734
718
|
loadRunState(runId: RunId): Promise<RunState>;
|
|
735
719
|
settleSignal(args: {
|
|
736
720
|
readonly runId: RunId;
|
|
@@ -773,9 +757,8 @@ interface Store {
|
|
|
773
757
|
readonly now: Date;
|
|
774
758
|
readonly limit?: number;
|
|
775
759
|
}): Promise<readonly TimedOutSignal[]>;
|
|
776
|
-
settleStep(runId: RunId, stepId: StepId, fact: StepCompletedFact | StepFailedFact): Promise<void>;
|
|
777
760
|
recordOnce(runId: RunId, stepId: StepId, scope: string, value: Json): Promise<void>;
|
|
778
|
-
getOnce(runId: RunId, stepId: StepId, scope: string): Promise<
|
|
761
|
+
getOnce(runId: RunId, stepId: StepId, scope: string): Promise<GetOnceResult>;
|
|
779
762
|
runStep<T extends Json>(runId: RunId, stepId: StepId, attempt: AttemptNumber, body: (tx: Tx) => Promise<{
|
|
780
763
|
readonly output: T;
|
|
781
764
|
readonly fact: StepCompletedFact | StepFailedFact | StepCanceledFact;
|
|
@@ -792,11 +775,57 @@ interface Store {
|
|
|
792
775
|
readonly dag: Json;
|
|
793
776
|
} | null>;
|
|
794
777
|
appendGlobalFact(fact: GlobalFact): Promise<void>;
|
|
795
|
-
queryRuns(opts: QueryRunsOpts): Promise<QueryRunsResult>;
|
|
796
778
|
describe(runId: RunId): Promise<RunDescription>;
|
|
797
779
|
listChildren(parentRunId: RunId): Promise<ReadonlyArray<RunId>>;
|
|
798
780
|
pruneFacts(opts: Required<PruneOpts>): Promise<PruneResult>;
|
|
799
781
|
readonly stream?: StreamTransport;
|
|
782
|
+
readonly events?: RunEventTransport;
|
|
783
|
+
}
|
|
784
|
+
type RunEvent = {
|
|
785
|
+
readonly type: "flow.started";
|
|
786
|
+
readonly flowId: string;
|
|
787
|
+
} | {
|
|
788
|
+
readonly type: "flow.completed";
|
|
789
|
+
readonly output: Json;
|
|
790
|
+
} | {
|
|
791
|
+
readonly type: "flow.failed";
|
|
792
|
+
readonly error: SerializedError;
|
|
793
|
+
} | {
|
|
794
|
+
readonly type: "flow.canceled";
|
|
795
|
+
readonly cause: "concurrency";
|
|
796
|
+
readonly canceledByRunId: RunId;
|
|
797
|
+
} | {
|
|
798
|
+
readonly type: "flow.canceled";
|
|
799
|
+
readonly cause: "explicit";
|
|
800
|
+
} | {
|
|
801
|
+
readonly type: "step.started";
|
|
802
|
+
readonly stepId: StepId;
|
|
803
|
+
readonly attempt: AttemptNumber;
|
|
804
|
+
} | {
|
|
805
|
+
readonly type: "step.completed";
|
|
806
|
+
readonly stepId: StepId;
|
|
807
|
+
readonly attempt: AttemptNumber;
|
|
808
|
+
readonly output: Json;
|
|
809
|
+
} | {
|
|
810
|
+
readonly type: "step.failed";
|
|
811
|
+
readonly stepId: StepId;
|
|
812
|
+
readonly attempt: AttemptNumber;
|
|
813
|
+
readonly error: SerializedError;
|
|
814
|
+
} | {
|
|
815
|
+
readonly type: "step.retried";
|
|
816
|
+
readonly stepId: StepId;
|
|
817
|
+
readonly attempt: AttemptNumber;
|
|
818
|
+
} | {
|
|
819
|
+
readonly type: "step.skipped";
|
|
820
|
+
readonly stepId: StepId;
|
|
821
|
+
readonly reason: SkipReason;
|
|
822
|
+
};
|
|
823
|
+
type RunEventEnvelope = RunEvent & {
|
|
824
|
+
readonly runId: RunId;
|
|
825
|
+
};
|
|
826
|
+
interface RunEventTransport {
|
|
827
|
+
watchRun(runId: RunId, handler: (e: RunEventEnvelope) => void): () => void;
|
|
828
|
+
watchRuns(handler: (e: RunEventEnvelope) => void): () => void;
|
|
800
829
|
}
|
|
801
830
|
interface StreamTransport {
|
|
802
831
|
subscribeStream(runId: RunId, stepId: StepId, opts?: {
|
|
@@ -804,34 +833,6 @@ interface StreamTransport {
|
|
|
804
833
|
}): AsyncIterable<StreamEvent<Json>>;
|
|
805
834
|
publishChunk(runId: RunId, stepId: StepId, chunk: Json): void;
|
|
806
835
|
}
|
|
807
|
-
interface QueryRunsWhere<FlowId extends string = string> {
|
|
808
|
-
readonly flowId?: FlowId;
|
|
809
|
-
readonly status?: ReadonlyArray<RunStatus>;
|
|
810
|
-
readonly input?: Record<string, Json>;
|
|
811
|
-
}
|
|
812
|
-
type QueryRunsOpts<FlowId extends string = string> = {
|
|
813
|
-
readonly where?: QueryRunsWhere<FlowId>;
|
|
814
|
-
readonly latest: true;
|
|
815
|
-
readonly limit?: never;
|
|
816
|
-
readonly cursor?: never;
|
|
817
|
-
} | {
|
|
818
|
-
readonly where?: QueryRunsWhere<FlowId>;
|
|
819
|
-
readonly latest?: false;
|
|
820
|
-
readonly limit?: number;
|
|
821
|
-
readonly cursor?: string;
|
|
822
|
-
};
|
|
823
|
-
interface RunSummary<FlowId extends string = string> {
|
|
824
|
-
readonly runId: RunId;
|
|
825
|
-
readonly flowId: FlowId;
|
|
826
|
-
readonly status: RunStatus;
|
|
827
|
-
readonly startedAt: Date;
|
|
828
|
-
readonly completedAt: Date | null;
|
|
829
|
-
readonly input: Json;
|
|
830
|
-
}
|
|
831
|
-
interface QueryRunsResult<FlowId extends string = string> {
|
|
832
|
-
readonly runs: ReadonlyArray<RunSummary<FlowId>>;
|
|
833
|
-
readonly cursor: string | null;
|
|
834
|
-
}
|
|
835
836
|
type PrunableStatus = Extract<RunStatus, "completed" | "failed" | "canceled">;
|
|
836
837
|
interface PruneOpts {
|
|
837
838
|
readonly olderThan: Date;
|
|
@@ -887,20 +888,13 @@ type RunStatus = "pending" | "running" | "completed" | "failed" | "canceled";
|
|
|
887
888
|
type StepStatus = "pending" | "running" | "completed" | "failed" | "canceled" | "skipped";
|
|
888
889
|
|
|
889
890
|
type ReplayMode = "inspect" | "continue";
|
|
891
|
+
type ResetScope = "cascade" | "step";
|
|
890
892
|
interface ReplayOpts {
|
|
891
893
|
readonly mode: ReplayMode;
|
|
892
894
|
readonly allowDrift?: boolean;
|
|
893
895
|
readonly fireHooks?: boolean;
|
|
894
896
|
readonly from?: StepId;
|
|
895
|
-
|
|
896
|
-
interface OperatorAuditOpts {
|
|
897
|
-
readonly actor: string;
|
|
898
|
-
readonly note?: string;
|
|
899
|
-
}
|
|
900
|
-
interface Operator {
|
|
901
|
-
skip(runId: RunId, stepId: StepId, opts: OperatorAuditOpts): Promise<void>;
|
|
902
|
-
retry(runId: RunId, stepId: StepId, opts: OperatorAuditOpts): Promise<void>;
|
|
903
|
-
abort(runId: RunId, opts: OperatorAuditOpts): Promise<void>;
|
|
897
|
+
readonly scope?: ResetScope;
|
|
904
898
|
}
|
|
905
899
|
|
|
906
|
-
export { type
|
|
900
|
+
export { type QueueEnqueueOpts as $, type ActivityConfig as A, type BackoffStrategy as B, type CancelArgs as C, DEFAULT_REAPER_INTERVAL_MS as D, type FlowStartedFact as E, type Fact as F, type GetOnceResult as G, type GlobalFact as H, type InferSchemaInput as I, type InferSchemaOutput as J, type Json as K, type LeaseReapedFact as L, type LogEntry as M, type LogLevel as N, type Logger as O, type Millis as P, type NeedRef as Q, type NeedsMap as R, type NeedsOutputs as S, type Optional as T, type ParentLink as U, type ParentRef as V, type PrunableStatus as W, type PruneOpts as X, type PruneResult as Y, type Queue as Z, type QueueDequeueOpts as _, type ActivityCtx as a, type StreamTransport as a$, type QueueInspectEntry as a0, type QueueMessage as a1, type ReapedLease as a2, type ReaperDecision as a3, type Register as a4, type Release as a5, type ReplayMode as a6, type ReplayOpts as a7, type ResetScope as a8, type Resolved as a9, type StepAbortRequestedFact as aA, type StepCancelCause as aB, type StepCanceledFact as aC, type StepCompleteEvent as aD, type StepCompletedFact as aE, type StepCtx as aF, type StepErrorEvent as aG, type StepEvent as aH, type StepFailedFact as aI, type StepId as aJ, type StepKind as aK, type StepLifecycleHooks as aL, type StepMap as aM, type StepOutput as aN, type StepResetFact as aO, type StepRetriedFact as aP, type StepRetryEvent as aQ, type StepRunStatus as aR, type StepSkippedFact as aS, type StepStartEvent as aT, type StepStartedFact as aU, type StepState as aV, type StepStatus as aW, type StepView as aX, type Store as aY, type StreamEffect as aZ, type StreamEvent as a_, type ResolvedConcurrency as aa, type ResolvedNeeds as ab, type RetryPolicy as ac, type RowDelta as ad, type RunCancelCause as ae, type RunDescription as af, type RunEndFact as ag, type RunEvent as ah, type RunEventEnvelope as ai, type RunEventTransport as aj, type RunId as ak, type RunPhase as al, type RunState as am, type RunStatus as an, type RunView as ao, type SerializedError as ap, type SettleSignalResult as aq, type SignalBufferedFact as ar, type SignalConfig as as, type SignalReceivedEvent as at, type SignalReceivedFact as au, type SkipReason as av, type SnapshotGoneDisposition as aw, type SnapshotGonePolicy as ax, StandardSchemaV1 as ay, type Step as az, type AttemptNumber as b, type StreamingStepCtx as b0, type StreamingTaskConfig as b1, type StringKeyOf as b2, type SubflowConfig as b3, type SubflowStepOutput as b4, type TaskConfig as b5, type TimedOutSignal as b6, type Tx as b7, type Worker as b8, type WorkerConfig as b9, type WorkerRunOnceOpts as ba, type WorkerRunResult as bb, type WorkerRunUntilEmptyOpts as bc, attemptOf as bd, decideExpiredLeaseAction as be, errorOf as bf, factConsequences as bg, foldRun as bh, isRunEnd as bi, isStepTerminal as bj, isTerminalRun as bk, outputOf as bl, resolvedOf as bm, runStatusOf as bn, stepStateOf as bo, stepStatusOf as bp, unwrap as bq, type Builder as c, type ClaimToken as d, type Clock as e, type ConcurrencyMode as f, type DriftPolicy as g, type FactConsequences as h, type FactKind as i, type Flow as j, type FlowCanceledByConcurrencyFact as k, type FlowCanceledExplicitlyFact as l, type FlowCanceledFact as m, type FlowCompleteEvent as n, type FlowCompletedFact as o, type FlowConcurrency as p, type FlowConfig as q, type FlowErrorEvent as r, type FlowEvent as s, type FlowFailedFact as t, type FlowHooks as u, type FlowIdOf as v, type FlowInput as w, type FlowOutput as x, type FlowRefUpdatedFact as y, type FlowStartEvent as z };
|