@bratsos/workflow-engine-console 1.0.0-alpha.2
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/README.md +464 -0
- package/dist/actions-DOP8plrl.d.ts +52 -0
- package/dist/chunk-4RL6UAMS.js +486 -0
- package/dist/chunk-4RL6UAMS.js.map +1 -0
- package/dist/chunk-HUHLRNNM.js +517 -0
- package/dist/chunk-HUHLRNNM.js.map +1 -0
- package/dist/chunk-RCVZ3AP4.js +62 -0
- package/dist/chunk-RCVZ3AP4.js.map +1 -0
- package/dist/chunk-THOZTVDT.js +85 -0
- package/dist/chunk-THOZTVDT.js.map +1 -0
- package/dist/cli.d.ts +33 -0
- package/dist/cli.js +230 -0
- package/dist/cli.js.map +1 -0
- package/dist/handler-Cq2cVh7p.d.ts +47 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +15 -0
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/dist/prisma-read-port-GPAHJEVC.js +4 -0
- package/dist/prisma-read-port-GPAHJEVC.js.map +1 -0
- package/dist/read-port-CRmaGAKb.d.ts +257 -0
- package/dist/testing.d.ts +50 -0
- package/dist/testing.js +346 -0
- package/dist/testing.js.map +1 -0
- package/package.json +64 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export { createWorkflowConsole } from './chunk-4RL6UAMS.js';
|
|
2
|
+
export { PrismaConsoleReadPort, createPrismaConsoleReadPort } from './chunk-HUHLRNNM.js';
|
|
3
|
+
export { ALL_CAPABILITIES, CONSOLE_STATUSES, ConsoleBadRequestError, ConsoleQueryTimeoutError, DEFAULT_RUN_LIMIT, MAX_LIMIT, clampLimit, decodeCursor, encodeCursor, isConsoleStatus, isStatementTimeout } from './chunk-THOZTVDT.js';
|
|
4
|
+
|
|
5
|
+
// src/actions.ts
|
|
6
|
+
var CONSOLE_ACTIONS = [
|
|
7
|
+
"runs.read",
|
|
8
|
+
"run.read",
|
|
9
|
+
"queue.read",
|
|
10
|
+
"suspended.read",
|
|
11
|
+
"deadLetters.read",
|
|
12
|
+
"workers.read",
|
|
13
|
+
"costs.read",
|
|
14
|
+
"run.cancel",
|
|
15
|
+
"run.rerun",
|
|
16
|
+
"step.signal",
|
|
17
|
+
"deadLetters.replay"
|
|
18
|
+
];
|
|
19
|
+
var WRITE_ACTIONS = [
|
|
20
|
+
"run.cancel",
|
|
21
|
+
"run.rerun",
|
|
22
|
+
"step.signal",
|
|
23
|
+
"deadLetters.replay"
|
|
24
|
+
];
|
|
25
|
+
function isWriteAction(action) {
|
|
26
|
+
return WRITE_ACTIONS.includes(action);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { CONSOLE_ACTIONS, WRITE_ACTIONS, isWriteAction };
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/actions.ts"],"names":[],"mappings":";;;;;AAcO,IAAM,eAAA,GAAkB;AAAA,EAC7B,WAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,cAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF;AAKO,IAAM,aAAA,GAA0C;AAAA,EACrD,YAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF;AAEO,SAAS,cAAc,MAAA,EAAgC;AAC5D,EAAA,OAAO,aAAA,CAAc,SAAS,MAAM,CAAA;AACtC","file":"index.js","sourcesContent":["/**\n * The console's write vocabulary.\n *\n * Modelled on verbs rather than HTTP methods, so an `authorize` callback\n * grants \"may cancel a run\" rather than \"may POST\". Every write dispatches\n * a kernel command — the console never issues SQL of its own. That is not\n * squeamishness: the kernel owns run state, and a console that wrote\n * `UPDATE workflow_runs SET status='CANCELLED'` would be a second,\n * unaudited writer against state the kernel believes it is alone in\n * changing, skipping the leases, idempotency and outbox events every other\n * path goes through.\n */\n\n/** Every action the console can be asked to perform, read or write. */\nexport const CONSOLE_ACTIONS = [\n \"runs.read\",\n \"run.read\",\n \"queue.read\",\n \"suspended.read\",\n \"deadLetters.read\",\n \"workers.read\",\n \"costs.read\",\n \"run.cancel\",\n \"run.rerun\",\n \"step.signal\",\n \"deadLetters.replay\",\n] as const;\n\nexport type ConsoleAction = (typeof CONSOLE_ACTIONS)[number];\n\n/** The subset that changes state. Each is refused unless `actions` is enabled. */\nexport const WRITE_ACTIONS: readonly ConsoleAction[] = [\n \"run.cancel\",\n \"run.rerun\",\n \"step.signal\",\n \"deadLetters.replay\",\n] as const;\n\nexport function isWriteAction(action: ConsoleAction): boolean {\n return WRITE_ACTIONS.includes(action);\n}\n\n/**\n * The minimum of the engine's kernel the console needs: a dispatcher.\n *\n * Declared structurally rather than imported so the package carries no\n * runtime dependency on the engine and nothing in the engine can come to\n * depend on the console.\n */\nexport interface ConsoleKernel {\n dispatch(command: {\n readonly type: string;\n readonly [key: string]: unknown;\n }): Promise<unknown>;\n}\n\n/** What `authorize` is asked, and what `onAction` is told afterwards. */\nexport interface ConsoleAuthorizeContext {\n action: ConsoleAction;\n request: Request;\n /** Present for the actions scoped to one run. */\n runId?: string;\n /** Present for the actions scoped to one durable step (`step.signal`). */\n stageId?: string;\n stepId?: string;\n}\n\nexport interface ConsoleActionEvent {\n action: ConsoleAction;\n runId?: string;\n stageId?: string;\n stepId?: string;\n request: Request;\n result: unknown;\n at: Date;\n}\n"]}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import { W as WorkflowConsoleHandler } from './handler-Cq2cVh7p.js';
|
|
3
|
+
import './actions-DOP8plrl.js';
|
|
4
|
+
import './read-port-CRmaGAKb.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Adapt the fetch handler to Node's `http` request/response pair.
|
|
8
|
+
*
|
|
9
|
+
* Only Express, Fastify and bare `node:http` need this. Next.js route
|
|
10
|
+
* handlers, Hono, Cloudflare Workers, Deno and Bun all speak `Request` and
|
|
11
|
+
* `Response` natively, so they mount the handler directly — see the README.
|
|
12
|
+
*/
|
|
13
|
+
declare function toNodeHandler(handler: WorkflowConsoleHandler): (request: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
14
|
+
|
|
15
|
+
export { toNodeHandler };
|
package/dist/node.js
ADDED
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"node.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"prisma-read-port-GPAHJEVC.js"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The console's read contract.
|
|
3
|
+
*
|
|
4
|
+
* Everything the console can show is expressed here, and nothing else in
|
|
5
|
+
* the package reaches for a database. An implementation is handed the
|
|
6
|
+
* connection its caller already has — a Prisma client, or the transaction
|
|
7
|
+
* client the caller opened — and never opens one of its own. That is the
|
|
8
|
+
* property the whole design exists to preserve: a consumer running the
|
|
9
|
+
* kernel inside one transaction per tenant, under row-level security, gets
|
|
10
|
+
* the console's reads inside that same transaction, evaluated against the
|
|
11
|
+
* same policies, with authentication already decided upstream. A reader
|
|
12
|
+
* that dialled the database itself would be a second session and therefore
|
|
13
|
+
* a second security context, and no amount of configuration recovers the
|
|
14
|
+
* tenant scoping once that happens.
|
|
15
|
+
*
|
|
16
|
+
* The interface is declared here rather than added to the engine's
|
|
17
|
+
* `PersistenceCore` on purpose — see the note in the package README. It is
|
|
18
|
+
* a small, optional surface; making it a required part of the persistence
|
|
19
|
+
* port would break every third-party adapter for a feature that is
|
|
20
|
+
* explicitly optional.
|
|
21
|
+
*/
|
|
22
|
+
/** Run/stage/job lifecycle states, mirroring the engine's `Status` enum. */
|
|
23
|
+
type ConsoleStatus = "PENDING" | "RUNNING" | "SUSPENDED" | "COMPLETED" | "FAILED" | "CANCELLED" | "SKIPPED";
|
|
24
|
+
declare const CONSOLE_STATUSES: readonly ConsoleStatus[];
|
|
25
|
+
declare function isConsoleStatus(value: string): value is ConsoleStatus;
|
|
26
|
+
/** One row of the runs list. Deliberately excludes `input`/`output`/`config`: a list page must not carry payloads. */
|
|
27
|
+
interface RunSummary {
|
|
28
|
+
id: string;
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
updatedAt: Date;
|
|
31
|
+
workflowId: string;
|
|
32
|
+
workflowName: string;
|
|
33
|
+
workflowType: string;
|
|
34
|
+
status: ConsoleStatus;
|
|
35
|
+
startedAt: Date | null;
|
|
36
|
+
completedAt: Date | null;
|
|
37
|
+
duration: number | null;
|
|
38
|
+
totalCost: number;
|
|
39
|
+
totalTokens: number;
|
|
40
|
+
priority: number;
|
|
41
|
+
definitionVersion: string | null;
|
|
42
|
+
redriveCount: number;
|
|
43
|
+
}
|
|
44
|
+
interface StageSummary {
|
|
45
|
+
id: string;
|
|
46
|
+
workflowRunId: string;
|
|
47
|
+
stageId: string;
|
|
48
|
+
stageName: string;
|
|
49
|
+
stageNumber: number;
|
|
50
|
+
executionGroup: number;
|
|
51
|
+
attempt: number;
|
|
52
|
+
status: ConsoleStatus;
|
|
53
|
+
startedAt: Date | null;
|
|
54
|
+
completedAt: Date | null;
|
|
55
|
+
duration: number | null;
|
|
56
|
+
nextPollAt: Date | null;
|
|
57
|
+
pollInterval: number | null;
|
|
58
|
+
maxWaitUntil: Date | null;
|
|
59
|
+
errorMessage: string | null;
|
|
60
|
+
}
|
|
61
|
+
/** A durable-step ledger entry. `status` is a free-form string in the schema, so it stays one here. */
|
|
62
|
+
interface StepSummary {
|
|
63
|
+
id: string;
|
|
64
|
+
stageRecordId: string;
|
|
65
|
+
stepId: string;
|
|
66
|
+
seq: number;
|
|
67
|
+
kind: string;
|
|
68
|
+
status: string;
|
|
69
|
+
attempt: number;
|
|
70
|
+
leaseExpiresAt: Date | null;
|
|
71
|
+
deadlineAt: Date | null;
|
|
72
|
+
/** Deterministic name of the external effect a `run` step creates; null for other kinds. */
|
|
73
|
+
externalKey: string | null;
|
|
74
|
+
error: string | null;
|
|
75
|
+
createdAt: Date;
|
|
76
|
+
updatedAt: Date;
|
|
77
|
+
}
|
|
78
|
+
interface AnnotationSummary {
|
|
79
|
+
id: string;
|
|
80
|
+
createdAt: Date;
|
|
81
|
+
workflowRunId: string;
|
|
82
|
+
workflowStageRecordId: string | null;
|
|
83
|
+
attempt: number;
|
|
84
|
+
scope: string;
|
|
85
|
+
scopeId: string | null;
|
|
86
|
+
actorKind: string | null;
|
|
87
|
+
actorId: string | null;
|
|
88
|
+
key: string;
|
|
89
|
+
value: unknown;
|
|
90
|
+
}
|
|
91
|
+
interface LogEntry {
|
|
92
|
+
id: string;
|
|
93
|
+
createdAt: Date;
|
|
94
|
+
workflowRunId: string | null;
|
|
95
|
+
workflowStageId: string | null;
|
|
96
|
+
level: string;
|
|
97
|
+
message: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* One retained outbox row, read as a run's event timeline. The engine marks
|
|
101
|
+
* events published rather than deleting them, and `(workflowRunId, sequence)`
|
|
102
|
+
* is unique, so a run timeline is an index range scan.
|
|
103
|
+
*/
|
|
104
|
+
interface RunEvent {
|
|
105
|
+
id: string;
|
|
106
|
+
workflowRunId: string;
|
|
107
|
+
sequence: number;
|
|
108
|
+
eventType: string;
|
|
109
|
+
occurredAt: Date;
|
|
110
|
+
publishedAt: Date | null;
|
|
111
|
+
retryCount: number;
|
|
112
|
+
dlqAt: Date | null;
|
|
113
|
+
}
|
|
114
|
+
interface RunDetail {
|
|
115
|
+
run: RunSummary & {
|
|
116
|
+
input: unknown;
|
|
117
|
+
output: unknown;
|
|
118
|
+
config: unknown;
|
|
119
|
+
metadata: unknown;
|
|
120
|
+
};
|
|
121
|
+
stages: StageSummary[];
|
|
122
|
+
steps: StepSummary[];
|
|
123
|
+
annotations: AnnotationSummary[];
|
|
124
|
+
logs: LogEntry[];
|
|
125
|
+
events: RunEvent[];
|
|
126
|
+
/** True when a list was cut off by its limit, so the UI can say so instead of implying completeness. */
|
|
127
|
+
truncated: {
|
|
128
|
+
steps: boolean;
|
|
129
|
+
annotations: boolean;
|
|
130
|
+
logs: boolean;
|
|
131
|
+
events: boolean;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
interface RunListFilters {
|
|
135
|
+
status?: ConsoleStatus[];
|
|
136
|
+
workflowId?: string;
|
|
137
|
+
workflowType?: string;
|
|
138
|
+
createdAfter?: Date;
|
|
139
|
+
createdBefore?: Date;
|
|
140
|
+
definitionVersion?: string;
|
|
141
|
+
}
|
|
142
|
+
interface RunListQuery {
|
|
143
|
+
filters?: RunListFilters;
|
|
144
|
+
/** Opaque cursor from a previous page's `nextCursor`. Keyset, not offset. */
|
|
145
|
+
cursor?: string;
|
|
146
|
+
limit?: number;
|
|
147
|
+
}
|
|
148
|
+
interface RunListPage {
|
|
149
|
+
runs: RunSummary[];
|
|
150
|
+
nextCursor: string | null;
|
|
151
|
+
}
|
|
152
|
+
interface QueueHealth {
|
|
153
|
+
countsByStatus: Record<ConsoleStatus, number>;
|
|
154
|
+
/** Enqueue time of the oldest job still waiting to be picked up. */
|
|
155
|
+
oldestPendingAt: Date | null;
|
|
156
|
+
/** `lockedAt` of the longest-held lease among running jobs — a lease older than your reaper's threshold is a stuck worker. */
|
|
157
|
+
oldestLeaseAt: Date | null;
|
|
158
|
+
/** Suspended jobs whose `nextPollAt` is already in the past. */
|
|
159
|
+
overduePolls: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A worker, derived from the leases it holds. The engine has no worker
|
|
163
|
+
* registry table; `touchJob` refreshes `job_queue.lockedAt`, so the newest
|
|
164
|
+
* lease a worker holds is the best available heartbeat, and a worker with
|
|
165
|
+
* no running job is invisible here by construction.
|
|
166
|
+
*/
|
|
167
|
+
interface WorkerInstance {
|
|
168
|
+
workerId: string;
|
|
169
|
+
runningJobs: number;
|
|
170
|
+
oldestLockedAt: Date | null;
|
|
171
|
+
/** Most recent `touchJob`; the console renders `now - lastSeenAt` as heartbeat age. */
|
|
172
|
+
lastSeenAt: Date | null;
|
|
173
|
+
}
|
|
174
|
+
interface SuspendedStage {
|
|
175
|
+
id: string;
|
|
176
|
+
workflowRunId: string;
|
|
177
|
+
workflowId: string;
|
|
178
|
+
stageId: string;
|
|
179
|
+
stageName: string;
|
|
180
|
+
attempt: number;
|
|
181
|
+
nextPollAt: Date | null;
|
|
182
|
+
pollInterval: number | null;
|
|
183
|
+
maxWaitUntil: Date | null;
|
|
184
|
+
}
|
|
185
|
+
interface DeadLetter {
|
|
186
|
+
id: string;
|
|
187
|
+
workflowRunId: string;
|
|
188
|
+
sequence: number;
|
|
189
|
+
eventType: string;
|
|
190
|
+
retryCount: number;
|
|
191
|
+
occurredAt: Date;
|
|
192
|
+
dlqAt: Date | null;
|
|
193
|
+
}
|
|
194
|
+
interface CostBucket {
|
|
195
|
+
/** A workflow id, or an ISO date (`YYYY-MM-DD`) when bucketing by day. */
|
|
196
|
+
key: string;
|
|
197
|
+
runs: number;
|
|
198
|
+
cost: number;
|
|
199
|
+
tokens: number;
|
|
200
|
+
}
|
|
201
|
+
interface CostQuery {
|
|
202
|
+
by: "workflow" | "day";
|
|
203
|
+
from?: Date;
|
|
204
|
+
to?: Date;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* What a given reader can actually serve, so the UI hides what is not there
|
|
208
|
+
* rather than rendering an empty page. Adapters that predate a view, or
|
|
209
|
+
* schemas whose migrations lag, report `false` and the tab disappears.
|
|
210
|
+
*/
|
|
211
|
+
interface ConsoleCapabilities {
|
|
212
|
+
runs: boolean;
|
|
213
|
+
steps: boolean;
|
|
214
|
+
annotations: boolean;
|
|
215
|
+
queue: boolean;
|
|
216
|
+
suspended: boolean;
|
|
217
|
+
deadLetters: boolean;
|
|
218
|
+
workers: boolean;
|
|
219
|
+
costs: boolean;
|
|
220
|
+
}
|
|
221
|
+
declare const ALL_CAPABILITIES: ConsoleCapabilities;
|
|
222
|
+
interface RunDetailOptions {
|
|
223
|
+
stepLimit?: number;
|
|
224
|
+
annotationLimit?: number;
|
|
225
|
+
logLimit?: number;
|
|
226
|
+
eventLimit?: number;
|
|
227
|
+
}
|
|
228
|
+
interface ConsoleReadPort {
|
|
229
|
+
readonly capabilities: ConsoleCapabilities;
|
|
230
|
+
listRuns(query: RunListQuery): Promise<RunListPage>;
|
|
231
|
+
getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
|
|
232
|
+
/** Incremental tail of one run's timeline. `afterSequence` of 0 returns from the start. */
|
|
233
|
+
listRunEvents(runId: string, afterSequence: number, limit?: number): Promise<RunEvent[]>;
|
|
234
|
+
getQueueHealth(): Promise<QueueHealth>;
|
|
235
|
+
listSuspendedStages(limit?: number): Promise<SuspendedStage[]>;
|
|
236
|
+
listDeadLetters(limit?: number): Promise<DeadLetter[]>;
|
|
237
|
+
listWorkers(): Promise<WorkerInstance[]>;
|
|
238
|
+
getCosts(query: CostQuery): Promise<CostBucket[]>;
|
|
239
|
+
}
|
|
240
|
+
/** Default page size for the runs list. */
|
|
241
|
+
declare const DEFAULT_RUN_LIMIT = 50;
|
|
242
|
+
/** Hard ceiling on any page size, whatever the request asks for. */
|
|
243
|
+
declare const MAX_LIMIT = 200;
|
|
244
|
+
declare function clampLimit(requested: number | undefined, fallback?: number): number;
|
|
245
|
+
/**
|
|
246
|
+
* Keyset cursors are `(createdAt, id)` — the exact tuple the composite
|
|
247
|
+
* indexes carry — encoded as opaque text so callers cannot turn one into an
|
|
248
|
+
* offset. Offset pagination is what makes page 400 a sequential scan.
|
|
249
|
+
*/
|
|
250
|
+
interface RunCursor {
|
|
251
|
+
createdAt: Date;
|
|
252
|
+
id: string;
|
|
253
|
+
}
|
|
254
|
+
declare function encodeCursor(cursor: RunCursor): string;
|
|
255
|
+
declare function decodeCursor(raw: string): RunCursor | null;
|
|
256
|
+
|
|
257
|
+
export { ALL_CAPABILITIES as A, type ConsoleReadPort as C, type DeadLetter as D, type LogEntry as L, MAX_LIMIT as M, type QueueHealth as Q, type RunListQuery as R, type SuspendedStage as S, type WorkerInstance as W, type ConsoleCapabilities as a, type RunListPage as b, type RunDetailOptions as c, type RunDetail as d, type RunEvent as e, type CostQuery as f, type CostBucket as g, type AnnotationSummary as h, CONSOLE_STATUSES as i, type ConsoleStatus as j, DEFAULT_RUN_LIMIT as k, type RunCursor as l, type RunListFilters as m, type RunSummary as n, type StageSummary as o, type StepSummary as p, clampLimit as q, decodeCursor as r, encodeCursor as s, isConsoleStatus as t };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { n as RunSummary, o as StageSummary, p as StepSummary, h as AnnotationSummary, L as LogEntry, e as RunEvent, j as ConsoleStatus, C as ConsoleReadPort, a as ConsoleCapabilities, R as RunListQuery, b as RunListPage, c as RunDetailOptions, d as RunDetail, Q as QueueHealth, S as SuspendedStage, D as DeadLetter, W as WorkerInstance, f as CostQuery, g as CostBucket } from './read-port-CRmaGAKb.js';
|
|
2
|
+
|
|
3
|
+
/** Mutable fixture store. Every array defaults to empty. */
|
|
4
|
+
interface ConsoleFixtures {
|
|
5
|
+
runs?: Array<Omit<RunSummary, "definitionVersion" | "redriveCount"> & {
|
|
6
|
+
definitionVersion?: string | null;
|
|
7
|
+
redriveCount?: number;
|
|
8
|
+
input?: unknown;
|
|
9
|
+
output?: unknown;
|
|
10
|
+
config?: unknown;
|
|
11
|
+
metadata?: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
stages?: StageSummary[];
|
|
14
|
+
steps?: StepSummary[];
|
|
15
|
+
annotations?: AnnotationSummary[];
|
|
16
|
+
logs?: LogEntry[];
|
|
17
|
+
events?: RunEvent[];
|
|
18
|
+
/** job_queue rows, reduced to what the console reads off them. */
|
|
19
|
+
jobs?: Array<{
|
|
20
|
+
id: string;
|
|
21
|
+
workflowRunId: string;
|
|
22
|
+
stageId: string;
|
|
23
|
+
status: ConsoleStatus;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
workerId?: string | null;
|
|
26
|
+
lockedAt?: Date | null;
|
|
27
|
+
nextPollAt?: Date | null;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
interface InMemoryConsoleReadPortOptions {
|
|
31
|
+
now?: () => Date;
|
|
32
|
+
capabilities?: Partial<ConsoleCapabilities>;
|
|
33
|
+
}
|
|
34
|
+
declare class InMemoryConsoleReadPort implements ConsoleReadPort {
|
|
35
|
+
readonly capabilities: ConsoleCapabilities;
|
|
36
|
+
readonly fixtures: Required<ConsoleFixtures>;
|
|
37
|
+
private readonly now;
|
|
38
|
+
constructor(fixtures?: ConsoleFixtures, options?: InMemoryConsoleReadPortOptions);
|
|
39
|
+
listRuns(query: RunListQuery): Promise<RunListPage>;
|
|
40
|
+
getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
|
|
41
|
+
listRunEvents(runId: string, afterSequence: number, limit?: number): Promise<RunEvent[]>;
|
|
42
|
+
getQueueHealth(): Promise<QueueHealth>;
|
|
43
|
+
listSuspendedStages(limit?: number): Promise<SuspendedStage[]>;
|
|
44
|
+
listDeadLetters(limit?: number): Promise<DeadLetter[]>;
|
|
45
|
+
listWorkers(): Promise<WorkerInstance[]>;
|
|
46
|
+
getCosts(query: CostQuery): Promise<CostBucket[]>;
|
|
47
|
+
}
|
|
48
|
+
declare function createInMemoryConsoleReadPort(fixtures?: ConsoleFixtures, options?: InMemoryConsoleReadPortOptions): InMemoryConsoleReadPort;
|
|
49
|
+
|
|
50
|
+
export { type ConsoleFixtures, InMemoryConsoleReadPort, type InMemoryConsoleReadPortOptions, createInMemoryConsoleReadPort };
|