@dudousxd/nestjs-durable-store-drizzle 0.24.7 → 0.26.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 +75 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +148 -1
- package/dist/index.d.ts +148 -1
- package/dist/index.js +75 -6
- package/dist/index.js.map +1 -1
- package/dist/pg/index.cjs +719 -121
- package/dist/pg/index.cjs.map +1 -1
- package/dist/pg/index.d.cts +159 -2
- package/dist/pg/index.d.ts +159 -2
- package/dist/pg/index.js +600 -13
- package/dist/pg/index.js.map +1 -1
- package/package.json +3 -3
package/dist/pg/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
2
2
|
import { PgDatabase } from 'drizzle-orm/pg-core';
|
|
3
|
-
import { StateStore, WorkflowRun, RunStatus, RetentionPolicy, StepCheckpoint, StepSettlement, StoreTransaction, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait, BufferedSignalRow } from '@dudousxd/nestjs-durable-core';
|
|
3
|
+
import { StateStore, WorkflowRun, RunStatus, RetentionPolicy, StepCheckpoint, StepSettlement, StepResultSettlement, StoreTransaction, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait, BufferedSignalRow } from '@dudousxd/nestjs-durable-core';
|
|
4
4
|
import { SQL } from 'drizzle-orm';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -57,6 +57,16 @@ declare function drizzlePgSchemaRepairWarning(repairs: readonly string[]): strin
|
|
|
57
57
|
*/
|
|
58
58
|
declare function ensureDrizzlePgDurableSchema(db: PgDatabase<any, any, any>, options?: EnsureDrizzlePgDurableSchemaOptions): Promise<void>;
|
|
59
59
|
|
|
60
|
+
interface PgHotPathOptions {
|
|
61
|
+
/**
|
|
62
|
+
* Send the hot statements as NAMED prepared statements (parsed once per connection). Saves
|
|
63
|
+
* Postgres a parse per statement, which halves its CPU per workflow. Needs a direct connection or
|
|
64
|
+
* a pooler that supports protocol-level prepared statements (PgBouncer in transaction mode before
|
|
65
|
+
* 1.21 does not): pass `false` there. Default on.
|
|
66
|
+
*/
|
|
67
|
+
preparedStatements?: boolean | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
60
70
|
/**
|
|
61
71
|
* Any drizzle Postgres database — `drizzle-orm/node-postgres`, `drizzle-orm/postgres-js`,
|
|
62
72
|
* `drizzle-orm/pglite`, Neon, … — built with or without a relational schema. The store only uses the
|
|
@@ -79,6 +89,13 @@ interface DrizzlePgStateStoreOptions {
|
|
|
79
89
|
* satisfies it.
|
|
80
90
|
*/
|
|
81
91
|
schemaLogger?: DurableSchemaLogger | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* On node-postgres, send the statements every workflow turn and step result run as NAMED prepared
|
|
94
|
+
* statements, parsed once per connection (see `PgHotPathOptions`). Needs a direct connection or
|
|
95
|
+
* a pooler with protocol-level prepared statements; pass `false` behind PgBouncer in transaction
|
|
96
|
+
* mode before 1.21. Default on.
|
|
97
|
+
*/
|
|
98
|
+
preparedStatements?: PgHotPathOptions['preparedStatements'];
|
|
82
99
|
}
|
|
83
100
|
/**
|
|
84
101
|
* Drizzle `StateStore` for **PostgreSQL**. Pass any drizzle Postgres db (see {@link DrizzlePgDatabase});
|
|
@@ -99,7 +116,18 @@ declare class DrizzlePgStateStore implements StateStore {
|
|
|
99
116
|
private readonly db;
|
|
100
117
|
private readonly options;
|
|
101
118
|
private readonly scopeNamespace;
|
|
119
|
+
/** Constant-SQL path for the per-step statements, on node-postgres (see `hot-path.ts`). */
|
|
120
|
+
private readonly hot;
|
|
121
|
+
/** The run read-scope predicate as SQL text from `$2` on, and its values (hot path). */
|
|
122
|
+
private readonly hotScope;
|
|
123
|
+
/** Hot-path UPDATE texts by patch shape. */
|
|
124
|
+
private readonly hotUpdates;
|
|
102
125
|
constructor(db: DrizzlePgDatabase, options?: DrizzlePgStateStoreOptions);
|
|
126
|
+
/**
|
|
127
|
+
* A hot-path `UPDATE` of the runs table setting `row`'s columns on run `$n`, optionally only while
|
|
128
|
+
* its status is one of `expected` (then `RETURNING "id"`). Text cached per shape.
|
|
129
|
+
*/
|
|
130
|
+
private hotRunUpdate;
|
|
103
131
|
/** A store confined to `scope.namespace`, sharing this store's db (no new connection). Used by the
|
|
104
132
|
* NestJS module's `scopeReads`; `{ namespace: undefined }` is the unscoped operator view. */
|
|
105
133
|
withScope(scope: {
|
|
@@ -127,6 +155,11 @@ declare class DrizzlePgStateStore implements StateStore {
|
|
|
127
155
|
saveCheckpointIfPending(checkpoint: StepCheckpoint): Promise<boolean>;
|
|
128
156
|
saveCheckpointsIfPending(checkpoints: StepCheckpoint[]): Promise<boolean[]>;
|
|
129
157
|
settleCheckpointsIfPending(settlements: StepSettlement[]): Promise<boolean[]>;
|
|
158
|
+
settleResultsIfPending(results: StepResultSettlement[]): Promise<(StepCheckpoint | null)[]>;
|
|
159
|
+
insertCheckpointIfAbsent(checkpoint: StepCheckpoint): Promise<boolean>;
|
|
160
|
+
tryLockRunAndGet(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<WorkflowRun | null>;
|
|
161
|
+
/** Run `work` on the db as is when it is one statement (atomic by itself), else in a transaction. */
|
|
162
|
+
private inTransactionIf;
|
|
130
163
|
transaction<T>(work: (tx: StoreTransaction) => Promise<T>): Promise<T>;
|
|
131
164
|
/** Crash recovery. Namespace-scoped: a worker re-drives only its own tenant's runs. */
|
|
132
165
|
listIncompleteRuns(namespace?: string): Promise<WorkflowRun[]>;
|
|
@@ -134,6 +167,7 @@ declare class DrizzlePgStateStore implements StateStore {
|
|
|
134
167
|
/** FIFO pick-up, served by `durable_workflow_runs_namespace_status_idx`. The engine then leases
|
|
135
168
|
* each run with {@link tryLockRun}; the listing itself takes no locks (it runs outside a tx). */
|
|
136
169
|
listPendingRuns(limit: number, namespace?: string): Promise<WorkflowRun[]>;
|
|
170
|
+
claimPendingRuns(limit: number, owner: string, leaseUntilMs: number, nowMs: number, namespace?: string): Promise<WorkflowRun[]>;
|
|
137
171
|
listDueTimers(nowMs: number, namespace?: string, limit?: number): Promise<WorkflowRun[]>;
|
|
138
172
|
tryLockRun(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<boolean>;
|
|
139
173
|
releaseRunLock(runId: string, owner?: string): Promise<void>;
|
|
@@ -182,6 +216,13 @@ declare class DrizzlePgStateStore implements StateStore {
|
|
|
182
216
|
takeBufferedSignal(token: string): Promise<{
|
|
183
217
|
payload: unknown;
|
|
184
218
|
} | null>;
|
|
219
|
+
takeOldestBufferedSignal(tokens: string[]): Promise<{
|
|
220
|
+
token: string;
|
|
221
|
+
payload: unknown;
|
|
222
|
+
} | null>;
|
|
223
|
+
claimSignalId(token: string, id: string, expiresAt: number, nowMs: number): Promise<boolean>;
|
|
224
|
+
releaseSignalId(token: string, id: string): Promise<void>;
|
|
225
|
+
deleteExpiredSignalIds(nowMs: number, limit: number): Promise<number>;
|
|
185
226
|
listBufferedSignals(tokenPrefix: string, afterId: string | undefined, limit: number): Promise<BufferedSignalRow[]>;
|
|
186
227
|
deleteBufferedSignals(ids: string[]): Promise<void>;
|
|
187
228
|
bufferEvent(input: {
|
|
@@ -1147,6 +1188,64 @@ declare const durableBufferedEvents: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1147
1188
|
};
|
|
1148
1189
|
dialect: "pg";
|
|
1149
1190
|
}>;
|
|
1191
|
+
declare const durableSignalIds: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1192
|
+
name: "durable_signal_ids";
|
|
1193
|
+
schema: undefined;
|
|
1194
|
+
columns: {
|
|
1195
|
+
token: drizzle_orm_pg_core.PgColumn<{
|
|
1196
|
+
name: "token";
|
|
1197
|
+
tableName: "durable_signal_ids";
|
|
1198
|
+
dataType: "string";
|
|
1199
|
+
columnType: "PgText";
|
|
1200
|
+
data: string;
|
|
1201
|
+
driverParam: string;
|
|
1202
|
+
notNull: true;
|
|
1203
|
+
hasDefault: false;
|
|
1204
|
+
isPrimaryKey: false;
|
|
1205
|
+
isAutoincrement: false;
|
|
1206
|
+
hasRuntimeDefault: false;
|
|
1207
|
+
enumValues: [string, ...string[]];
|
|
1208
|
+
baseColumn: never;
|
|
1209
|
+
identity: undefined;
|
|
1210
|
+
generated: undefined;
|
|
1211
|
+
}, {}, {}>;
|
|
1212
|
+
signalId: drizzle_orm_pg_core.PgColumn<{
|
|
1213
|
+
name: "signal_id";
|
|
1214
|
+
tableName: "durable_signal_ids";
|
|
1215
|
+
dataType: "string";
|
|
1216
|
+
columnType: "PgText";
|
|
1217
|
+
data: string;
|
|
1218
|
+
driverParam: string;
|
|
1219
|
+
notNull: true;
|
|
1220
|
+
hasDefault: false;
|
|
1221
|
+
isPrimaryKey: false;
|
|
1222
|
+
isAutoincrement: false;
|
|
1223
|
+
hasRuntimeDefault: false;
|
|
1224
|
+
enumValues: [string, ...string[]];
|
|
1225
|
+
baseColumn: never;
|
|
1226
|
+
identity: undefined;
|
|
1227
|
+
generated: undefined;
|
|
1228
|
+
}, {}, {}>;
|
|
1229
|
+
expiresAt: drizzle_orm_pg_core.PgColumn<{
|
|
1230
|
+
name: string;
|
|
1231
|
+
tableName: "durable_signal_ids";
|
|
1232
|
+
dataType: "date";
|
|
1233
|
+
columnType: "PgTimestamp";
|
|
1234
|
+
data: Date;
|
|
1235
|
+
driverParam: string;
|
|
1236
|
+
notNull: true;
|
|
1237
|
+
hasDefault: false;
|
|
1238
|
+
isPrimaryKey: false;
|
|
1239
|
+
isAutoincrement: false;
|
|
1240
|
+
hasRuntimeDefault: false;
|
|
1241
|
+
enumValues: undefined;
|
|
1242
|
+
baseColumn: never;
|
|
1243
|
+
identity: undefined;
|
|
1244
|
+
generated: undefined;
|
|
1245
|
+
}, {}, {}>;
|
|
1246
|
+
};
|
|
1247
|
+
dialect: "pg";
|
|
1248
|
+
}>;
|
|
1150
1249
|
declare const durableSchedules: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1151
1250
|
name: "durable_schedules";
|
|
1152
1251
|
schema: undefined;
|
|
@@ -2249,6 +2348,64 @@ declare const durablePgSchema: {
|
|
|
2249
2348
|
};
|
|
2250
2349
|
dialect: "pg";
|
|
2251
2350
|
}>;
|
|
2351
|
+
durableSignalIds: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2352
|
+
name: "durable_signal_ids";
|
|
2353
|
+
schema: undefined;
|
|
2354
|
+
columns: {
|
|
2355
|
+
token: drizzle_orm_pg_core.PgColumn<{
|
|
2356
|
+
name: "token";
|
|
2357
|
+
tableName: "durable_signal_ids";
|
|
2358
|
+
dataType: "string";
|
|
2359
|
+
columnType: "PgText";
|
|
2360
|
+
data: string;
|
|
2361
|
+
driverParam: string;
|
|
2362
|
+
notNull: true;
|
|
2363
|
+
hasDefault: false;
|
|
2364
|
+
isPrimaryKey: false;
|
|
2365
|
+
isAutoincrement: false;
|
|
2366
|
+
hasRuntimeDefault: false;
|
|
2367
|
+
enumValues: [string, ...string[]];
|
|
2368
|
+
baseColumn: never;
|
|
2369
|
+
identity: undefined;
|
|
2370
|
+
generated: undefined;
|
|
2371
|
+
}, {}, {}>;
|
|
2372
|
+
signalId: drizzle_orm_pg_core.PgColumn<{
|
|
2373
|
+
name: "signal_id";
|
|
2374
|
+
tableName: "durable_signal_ids";
|
|
2375
|
+
dataType: "string";
|
|
2376
|
+
columnType: "PgText";
|
|
2377
|
+
data: string;
|
|
2378
|
+
driverParam: string;
|
|
2379
|
+
notNull: true;
|
|
2380
|
+
hasDefault: false;
|
|
2381
|
+
isPrimaryKey: false;
|
|
2382
|
+
isAutoincrement: false;
|
|
2383
|
+
hasRuntimeDefault: false;
|
|
2384
|
+
enumValues: [string, ...string[]];
|
|
2385
|
+
baseColumn: never;
|
|
2386
|
+
identity: undefined;
|
|
2387
|
+
generated: undefined;
|
|
2388
|
+
}, {}, {}>;
|
|
2389
|
+
expiresAt: drizzle_orm_pg_core.PgColumn<{
|
|
2390
|
+
name: string;
|
|
2391
|
+
tableName: "durable_signal_ids";
|
|
2392
|
+
dataType: "date";
|
|
2393
|
+
columnType: "PgTimestamp";
|
|
2394
|
+
data: Date;
|
|
2395
|
+
driverParam: string;
|
|
2396
|
+
notNull: true;
|
|
2397
|
+
hasDefault: false;
|
|
2398
|
+
isPrimaryKey: false;
|
|
2399
|
+
isAutoincrement: false;
|
|
2400
|
+
hasRuntimeDefault: false;
|
|
2401
|
+
enumValues: undefined;
|
|
2402
|
+
baseColumn: never;
|
|
2403
|
+
identity: undefined;
|
|
2404
|
+
generated: undefined;
|
|
2405
|
+
}, {}, {}>;
|
|
2406
|
+
};
|
|
2407
|
+
dialect: "pg";
|
|
2408
|
+
}>;
|
|
2252
2409
|
durableSchedules: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2253
2410
|
name: "durable_schedules";
|
|
2254
2411
|
schema: undefined;
|
|
@@ -2440,4 +2597,4 @@ declare const durablePgSchema: {
|
|
|
2440
2597
|
*/
|
|
2441
2598
|
declare function durablePgManagedTables(): string[];
|
|
2442
2599
|
|
|
2443
|
-
export { DEFAULT_NAMESPACE, DURABLE_PG_DDL, type DrizzlePgDatabase, type DrizzlePgSqlExecutor, DrizzlePgStateStore, type DrizzlePgStateStoreOptions, type DurableSchemaLogger, type EnsureDrizzlePgDurableSchemaOptions, drizzlePgExecutor, drizzlePgSchemaRepairWarning, durableBufferedEvents, durableBufferedSignals, durablePgManagedTables, durablePgSchema, durableRunAttributes, durableSchedules, durableSignalWaiters, durableStepCheckpoints, durableWorkflowRuns, ensureDrizzlePgDurableSchema, rowsOf, toDrizzleSql };
|
|
2600
|
+
export { DEFAULT_NAMESPACE, DURABLE_PG_DDL, type DrizzlePgDatabase, type DrizzlePgSqlExecutor, DrizzlePgStateStore, type DrizzlePgStateStoreOptions, type DurableSchemaLogger, type EnsureDrizzlePgDurableSchemaOptions, drizzlePgExecutor, drizzlePgSchemaRepairWarning, durableBufferedEvents, durableBufferedSignals, durablePgManagedTables, durablePgSchema, durableRunAttributes, durableSchedules, durableSignalIds, durableSignalWaiters, durableStepCheckpoints, durableWorkflowRuns, ensureDrizzlePgDurableSchema, rowsOf, toDrizzleSql };
|
package/dist/pg/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
2
2
|
import { PgDatabase } from 'drizzle-orm/pg-core';
|
|
3
|
-
import { StateStore, WorkflowRun, RunStatus, RetentionPolicy, StepCheckpoint, StepSettlement, StoreTransaction, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait, BufferedSignalRow } from '@dudousxd/nestjs-durable-core';
|
|
3
|
+
import { StateStore, WorkflowRun, RunStatus, RetentionPolicy, StepCheckpoint, StepSettlement, StepResultSettlement, StoreTransaction, OwnedLeaseReclaim, RunQuery, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, ScheduleRecord, ScheduleQuery, CheckpointStat, CheckpointQuery, SignalWaiter, ChildWait, BufferedSignalRow } from '@dudousxd/nestjs-durable-core';
|
|
4
4
|
import { SQL } from 'drizzle-orm';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -57,6 +57,16 @@ declare function drizzlePgSchemaRepairWarning(repairs: readonly string[]): strin
|
|
|
57
57
|
*/
|
|
58
58
|
declare function ensureDrizzlePgDurableSchema(db: PgDatabase<any, any, any>, options?: EnsureDrizzlePgDurableSchemaOptions): Promise<void>;
|
|
59
59
|
|
|
60
|
+
interface PgHotPathOptions {
|
|
61
|
+
/**
|
|
62
|
+
* Send the hot statements as NAMED prepared statements (parsed once per connection). Saves
|
|
63
|
+
* Postgres a parse per statement, which halves its CPU per workflow. Needs a direct connection or
|
|
64
|
+
* a pooler that supports protocol-level prepared statements (PgBouncer in transaction mode before
|
|
65
|
+
* 1.21 does not): pass `false` there. Default on.
|
|
66
|
+
*/
|
|
67
|
+
preparedStatements?: boolean | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
60
70
|
/**
|
|
61
71
|
* Any drizzle Postgres database — `drizzle-orm/node-postgres`, `drizzle-orm/postgres-js`,
|
|
62
72
|
* `drizzle-orm/pglite`, Neon, … — built with or without a relational schema. The store only uses the
|
|
@@ -79,6 +89,13 @@ interface DrizzlePgStateStoreOptions {
|
|
|
79
89
|
* satisfies it.
|
|
80
90
|
*/
|
|
81
91
|
schemaLogger?: DurableSchemaLogger | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* On node-postgres, send the statements every workflow turn and step result run as NAMED prepared
|
|
94
|
+
* statements, parsed once per connection (see `PgHotPathOptions`). Needs a direct connection or
|
|
95
|
+
* a pooler with protocol-level prepared statements; pass `false` behind PgBouncer in transaction
|
|
96
|
+
* mode before 1.21. Default on.
|
|
97
|
+
*/
|
|
98
|
+
preparedStatements?: PgHotPathOptions['preparedStatements'];
|
|
82
99
|
}
|
|
83
100
|
/**
|
|
84
101
|
* Drizzle `StateStore` for **PostgreSQL**. Pass any drizzle Postgres db (see {@link DrizzlePgDatabase});
|
|
@@ -99,7 +116,18 @@ declare class DrizzlePgStateStore implements StateStore {
|
|
|
99
116
|
private readonly db;
|
|
100
117
|
private readonly options;
|
|
101
118
|
private readonly scopeNamespace;
|
|
119
|
+
/** Constant-SQL path for the per-step statements, on node-postgres (see `hot-path.ts`). */
|
|
120
|
+
private readonly hot;
|
|
121
|
+
/** The run read-scope predicate as SQL text from `$2` on, and its values (hot path). */
|
|
122
|
+
private readonly hotScope;
|
|
123
|
+
/** Hot-path UPDATE texts by patch shape. */
|
|
124
|
+
private readonly hotUpdates;
|
|
102
125
|
constructor(db: DrizzlePgDatabase, options?: DrizzlePgStateStoreOptions);
|
|
126
|
+
/**
|
|
127
|
+
* A hot-path `UPDATE` of the runs table setting `row`'s columns on run `$n`, optionally only while
|
|
128
|
+
* its status is one of `expected` (then `RETURNING "id"`). Text cached per shape.
|
|
129
|
+
*/
|
|
130
|
+
private hotRunUpdate;
|
|
103
131
|
/** A store confined to `scope.namespace`, sharing this store's db (no new connection). Used by the
|
|
104
132
|
* NestJS module's `scopeReads`; `{ namespace: undefined }` is the unscoped operator view. */
|
|
105
133
|
withScope(scope: {
|
|
@@ -127,6 +155,11 @@ declare class DrizzlePgStateStore implements StateStore {
|
|
|
127
155
|
saveCheckpointIfPending(checkpoint: StepCheckpoint): Promise<boolean>;
|
|
128
156
|
saveCheckpointsIfPending(checkpoints: StepCheckpoint[]): Promise<boolean[]>;
|
|
129
157
|
settleCheckpointsIfPending(settlements: StepSettlement[]): Promise<boolean[]>;
|
|
158
|
+
settleResultsIfPending(results: StepResultSettlement[]): Promise<(StepCheckpoint | null)[]>;
|
|
159
|
+
insertCheckpointIfAbsent(checkpoint: StepCheckpoint): Promise<boolean>;
|
|
160
|
+
tryLockRunAndGet(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<WorkflowRun | null>;
|
|
161
|
+
/** Run `work` on the db as is when it is one statement (atomic by itself), else in a transaction. */
|
|
162
|
+
private inTransactionIf;
|
|
130
163
|
transaction<T>(work: (tx: StoreTransaction) => Promise<T>): Promise<T>;
|
|
131
164
|
/** Crash recovery. Namespace-scoped: a worker re-drives only its own tenant's runs. */
|
|
132
165
|
listIncompleteRuns(namespace?: string): Promise<WorkflowRun[]>;
|
|
@@ -134,6 +167,7 @@ declare class DrizzlePgStateStore implements StateStore {
|
|
|
134
167
|
/** FIFO pick-up, served by `durable_workflow_runs_namespace_status_idx`. The engine then leases
|
|
135
168
|
* each run with {@link tryLockRun}; the listing itself takes no locks (it runs outside a tx). */
|
|
136
169
|
listPendingRuns(limit: number, namespace?: string): Promise<WorkflowRun[]>;
|
|
170
|
+
claimPendingRuns(limit: number, owner: string, leaseUntilMs: number, nowMs: number, namespace?: string): Promise<WorkflowRun[]>;
|
|
137
171
|
listDueTimers(nowMs: number, namespace?: string, limit?: number): Promise<WorkflowRun[]>;
|
|
138
172
|
tryLockRun(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<boolean>;
|
|
139
173
|
releaseRunLock(runId: string, owner?: string): Promise<void>;
|
|
@@ -182,6 +216,13 @@ declare class DrizzlePgStateStore implements StateStore {
|
|
|
182
216
|
takeBufferedSignal(token: string): Promise<{
|
|
183
217
|
payload: unknown;
|
|
184
218
|
} | null>;
|
|
219
|
+
takeOldestBufferedSignal(tokens: string[]): Promise<{
|
|
220
|
+
token: string;
|
|
221
|
+
payload: unknown;
|
|
222
|
+
} | null>;
|
|
223
|
+
claimSignalId(token: string, id: string, expiresAt: number, nowMs: number): Promise<boolean>;
|
|
224
|
+
releaseSignalId(token: string, id: string): Promise<void>;
|
|
225
|
+
deleteExpiredSignalIds(nowMs: number, limit: number): Promise<number>;
|
|
185
226
|
listBufferedSignals(tokenPrefix: string, afterId: string | undefined, limit: number): Promise<BufferedSignalRow[]>;
|
|
186
227
|
deleteBufferedSignals(ids: string[]): Promise<void>;
|
|
187
228
|
bufferEvent(input: {
|
|
@@ -1147,6 +1188,64 @@ declare const durableBufferedEvents: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1147
1188
|
};
|
|
1148
1189
|
dialect: "pg";
|
|
1149
1190
|
}>;
|
|
1191
|
+
declare const durableSignalIds: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1192
|
+
name: "durable_signal_ids";
|
|
1193
|
+
schema: undefined;
|
|
1194
|
+
columns: {
|
|
1195
|
+
token: drizzle_orm_pg_core.PgColumn<{
|
|
1196
|
+
name: "token";
|
|
1197
|
+
tableName: "durable_signal_ids";
|
|
1198
|
+
dataType: "string";
|
|
1199
|
+
columnType: "PgText";
|
|
1200
|
+
data: string;
|
|
1201
|
+
driverParam: string;
|
|
1202
|
+
notNull: true;
|
|
1203
|
+
hasDefault: false;
|
|
1204
|
+
isPrimaryKey: false;
|
|
1205
|
+
isAutoincrement: false;
|
|
1206
|
+
hasRuntimeDefault: false;
|
|
1207
|
+
enumValues: [string, ...string[]];
|
|
1208
|
+
baseColumn: never;
|
|
1209
|
+
identity: undefined;
|
|
1210
|
+
generated: undefined;
|
|
1211
|
+
}, {}, {}>;
|
|
1212
|
+
signalId: drizzle_orm_pg_core.PgColumn<{
|
|
1213
|
+
name: "signal_id";
|
|
1214
|
+
tableName: "durable_signal_ids";
|
|
1215
|
+
dataType: "string";
|
|
1216
|
+
columnType: "PgText";
|
|
1217
|
+
data: string;
|
|
1218
|
+
driverParam: string;
|
|
1219
|
+
notNull: true;
|
|
1220
|
+
hasDefault: false;
|
|
1221
|
+
isPrimaryKey: false;
|
|
1222
|
+
isAutoincrement: false;
|
|
1223
|
+
hasRuntimeDefault: false;
|
|
1224
|
+
enumValues: [string, ...string[]];
|
|
1225
|
+
baseColumn: never;
|
|
1226
|
+
identity: undefined;
|
|
1227
|
+
generated: undefined;
|
|
1228
|
+
}, {}, {}>;
|
|
1229
|
+
expiresAt: drizzle_orm_pg_core.PgColumn<{
|
|
1230
|
+
name: string;
|
|
1231
|
+
tableName: "durable_signal_ids";
|
|
1232
|
+
dataType: "date";
|
|
1233
|
+
columnType: "PgTimestamp";
|
|
1234
|
+
data: Date;
|
|
1235
|
+
driverParam: string;
|
|
1236
|
+
notNull: true;
|
|
1237
|
+
hasDefault: false;
|
|
1238
|
+
isPrimaryKey: false;
|
|
1239
|
+
isAutoincrement: false;
|
|
1240
|
+
hasRuntimeDefault: false;
|
|
1241
|
+
enumValues: undefined;
|
|
1242
|
+
baseColumn: never;
|
|
1243
|
+
identity: undefined;
|
|
1244
|
+
generated: undefined;
|
|
1245
|
+
}, {}, {}>;
|
|
1246
|
+
};
|
|
1247
|
+
dialect: "pg";
|
|
1248
|
+
}>;
|
|
1150
1249
|
declare const durableSchedules: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1151
1250
|
name: "durable_schedules";
|
|
1152
1251
|
schema: undefined;
|
|
@@ -2249,6 +2348,64 @@ declare const durablePgSchema: {
|
|
|
2249
2348
|
};
|
|
2250
2349
|
dialect: "pg";
|
|
2251
2350
|
}>;
|
|
2351
|
+
durableSignalIds: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2352
|
+
name: "durable_signal_ids";
|
|
2353
|
+
schema: undefined;
|
|
2354
|
+
columns: {
|
|
2355
|
+
token: drizzle_orm_pg_core.PgColumn<{
|
|
2356
|
+
name: "token";
|
|
2357
|
+
tableName: "durable_signal_ids";
|
|
2358
|
+
dataType: "string";
|
|
2359
|
+
columnType: "PgText";
|
|
2360
|
+
data: string;
|
|
2361
|
+
driverParam: string;
|
|
2362
|
+
notNull: true;
|
|
2363
|
+
hasDefault: false;
|
|
2364
|
+
isPrimaryKey: false;
|
|
2365
|
+
isAutoincrement: false;
|
|
2366
|
+
hasRuntimeDefault: false;
|
|
2367
|
+
enumValues: [string, ...string[]];
|
|
2368
|
+
baseColumn: never;
|
|
2369
|
+
identity: undefined;
|
|
2370
|
+
generated: undefined;
|
|
2371
|
+
}, {}, {}>;
|
|
2372
|
+
signalId: drizzle_orm_pg_core.PgColumn<{
|
|
2373
|
+
name: "signal_id";
|
|
2374
|
+
tableName: "durable_signal_ids";
|
|
2375
|
+
dataType: "string";
|
|
2376
|
+
columnType: "PgText";
|
|
2377
|
+
data: string;
|
|
2378
|
+
driverParam: string;
|
|
2379
|
+
notNull: true;
|
|
2380
|
+
hasDefault: false;
|
|
2381
|
+
isPrimaryKey: false;
|
|
2382
|
+
isAutoincrement: false;
|
|
2383
|
+
hasRuntimeDefault: false;
|
|
2384
|
+
enumValues: [string, ...string[]];
|
|
2385
|
+
baseColumn: never;
|
|
2386
|
+
identity: undefined;
|
|
2387
|
+
generated: undefined;
|
|
2388
|
+
}, {}, {}>;
|
|
2389
|
+
expiresAt: drizzle_orm_pg_core.PgColumn<{
|
|
2390
|
+
name: string;
|
|
2391
|
+
tableName: "durable_signal_ids";
|
|
2392
|
+
dataType: "date";
|
|
2393
|
+
columnType: "PgTimestamp";
|
|
2394
|
+
data: Date;
|
|
2395
|
+
driverParam: string;
|
|
2396
|
+
notNull: true;
|
|
2397
|
+
hasDefault: false;
|
|
2398
|
+
isPrimaryKey: false;
|
|
2399
|
+
isAutoincrement: false;
|
|
2400
|
+
hasRuntimeDefault: false;
|
|
2401
|
+
enumValues: undefined;
|
|
2402
|
+
baseColumn: never;
|
|
2403
|
+
identity: undefined;
|
|
2404
|
+
generated: undefined;
|
|
2405
|
+
}, {}, {}>;
|
|
2406
|
+
};
|
|
2407
|
+
dialect: "pg";
|
|
2408
|
+
}>;
|
|
2252
2409
|
durableSchedules: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2253
2410
|
name: "durable_schedules";
|
|
2254
2411
|
schema: undefined;
|
|
@@ -2440,4 +2597,4 @@ declare const durablePgSchema: {
|
|
|
2440
2597
|
*/
|
|
2441
2598
|
declare function durablePgManagedTables(): string[];
|
|
2442
2599
|
|
|
2443
|
-
export { DEFAULT_NAMESPACE, DURABLE_PG_DDL, type DrizzlePgDatabase, type DrizzlePgSqlExecutor, DrizzlePgStateStore, type DrizzlePgStateStoreOptions, type DurableSchemaLogger, type EnsureDrizzlePgDurableSchemaOptions, drizzlePgExecutor, drizzlePgSchemaRepairWarning, durableBufferedEvents, durableBufferedSignals, durablePgManagedTables, durablePgSchema, durableRunAttributes, durableSchedules, durableSignalWaiters, durableStepCheckpoints, durableWorkflowRuns, ensureDrizzlePgDurableSchema, rowsOf, toDrizzleSql };
|
|
2600
|
+
export { DEFAULT_NAMESPACE, DURABLE_PG_DDL, type DrizzlePgDatabase, type DrizzlePgSqlExecutor, DrizzlePgStateStore, type DrizzlePgStateStoreOptions, type DurableSchemaLogger, type EnsureDrizzlePgDurableSchemaOptions, drizzlePgExecutor, drizzlePgSchemaRepairWarning, durableBufferedEvents, durableBufferedSignals, durablePgManagedTables, durablePgSchema, durableRunAttributes, durableSchedules, durableSignalIds, durableSignalWaiters, durableStepCheckpoints, durableWorkflowRuns, ensureDrizzlePgDurableSchema, rowsOf, toDrizzleSql };
|