@workflow/world-postgres 5.1.1 → 5.2.1
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 +37 -17
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +64 -11
- package/dist/config.js +42 -3
- package/dist/connection-errors.js +1 -1
- package/dist/drizzle/cbor.js +1 -1
- package/dist/drizzle/index.js +1 -1
- package/dist/drizzle/schema.d.ts +168 -0
- package/dist/drizzle/schema.js +26 -2
- package/dist/executor.js +1 -1
- package/dist/index.js +24 -6
- package/dist/invocation-notifications.js +1 -1
- package/dist/invocation-retention.js +1 -1
- package/dist/invocations.js +1 -1
- package/dist/job-lease.d.ts +65 -16
- package/dist/job-lease.js +217 -28
- package/dist/message.d.ts +1 -1
- package/dist/message.js +3 -3
- package/dist/queue.d.ts +26 -9
- package/dist/queue.js +566 -156
- package/dist/retention.d.ts +1 -1
- package/dist/retention.js +2 -2
- package/dist/run-events.d.ts +35 -0
- package/dist/run-events.js +264 -0
- package/dist/run-lease.d.ts +91 -0
- package/dist/run-lease.js +309 -0
- package/dist/run-status.d.ts +3 -4
- package/dist/run-status.js +4 -9
- package/dist/snapshots.js +1 -1
- package/dist/start-hook.js +1 -1
- package/dist/storage.d.ts +6 -0
- package/dist/storage.js +98 -59
- package/dist/streamer.d.ts +6 -0
- package/dist/streamer.js +9 -3
- package/dist/util.js +1 -1
- package/dist/zod.d.ts +1 -1
- package/dist/zod.js +3 -3
- package/package.json +24 -22
- package/src/drizzle/migrations/0030_add_job_lock_holders.sql +9 -0
- package/src/drizzle/migrations/0031_add_run_delivery_leases.sql +14 -0
- package/src/drizzle/migrations/meta/_journal.json +14 -0
- package/dist/cli.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/connection-errors.d.ts.map +0 -1
- package/dist/drizzle/cbor.d.ts.map +0 -1
- package/dist/drizzle/index.d.ts.map +0 -1
- package/dist/drizzle/schema.d.ts.map +0 -1
- package/dist/executor.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/invocation-notifications.d.ts.map +0 -1
- package/dist/invocation-retention.d.ts.map +0 -1
- package/dist/invocations.d.ts.map +0 -1
- package/dist/job-lease.d.ts.map +0 -1
- package/dist/message.d.ts.map +0 -1
- package/dist/queue.d.ts.map +0 -1
- package/dist/retention.d.ts.map +0 -1
- package/dist/run-status.d.ts.map +0 -1
- package/dist/snapshots.d.ts.map +0 -1
- package/dist/start-hook.d.ts.map +0 -1
- package/dist/storage.d.ts.map +0 -1
- package/dist/streamer.d.ts.map +0 -1
- package/dist/util.d.ts.map +0 -1
- package/dist/zod.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -120,6 +120,9 @@ export WORKFLOW_POSTGRES_URL="postgres://username:password@localhost:5432/databa
|
|
|
120
120
|
# Optional: Job prefix for queue operations
|
|
121
121
|
export WORKFLOW_POSTGRES_JOB_PREFIX="myapp"
|
|
122
122
|
|
|
123
|
+
# Optional: Pin each run to the deployment that started it (an image tag or commit SHA)
|
|
124
|
+
export WORKFLOW_POSTGRES_DEPLOYMENT_ID="v1.2.3"
|
|
125
|
+
|
|
123
126
|
# Optional: Worker concurrency (default: 10)
|
|
124
127
|
export WORKFLOW_POSTGRES_WORKER_CONCURRENCY="10"
|
|
125
128
|
|
|
@@ -133,7 +136,8 @@ export WORKFLOW_POSTGRES_APPLICATION_MANAGED_SHUTDOWN="1"
|
|
|
133
136
|
export WORKFLOW_POSTGRES_HOOK_RETENTION_LIMIT_DAYS="30"
|
|
134
137
|
|
|
135
138
|
# Optional: Seconds a running delivery's job lock may go unrenewed before
|
|
136
|
-
# another process redelivers the job (default:
|
|
139
|
+
# another process redelivers the job (default: unset, which releases only
|
|
140
|
+
# spec 9 run-lease jobs of renewing holders after 300s; 30 is a good value
|
|
137
141
|
# when more than one process shares the database, see "Crash recovery")
|
|
138
142
|
export WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS="30"
|
|
139
143
|
```
|
|
@@ -196,10 +200,11 @@ An aborted HTTP request does not guarantee that its server-side handler stopped,
|
|
|
196
200
|
| `maxPoolSize` | `number` | `process.env.WORKFLOW_POSTGRES_MAX_POOL_SIZE` or `pg.Pool` default (`10`) | Optional. Sets the internal `pg.Pool` max size when `createWorld()` creates the pool |
|
|
197
201
|
| `pool` | `pg.Pool` | Not applicable | Optional. When set, used for Drizzle, Graphile Worker, and stream writes. `world.close()` does not end it, and the World adds no `'error'` listeners to it (see above). |
|
|
198
202
|
| `jobPrefix` | `string` | `process.env.WORKFLOW_POSTGRES_JOB_PREFIX` or `'workflow_'` | Optional prefix for queue job names. Use a distinct prefix per application sharing a database. |
|
|
203
|
+
| `deploymentId` | `string` | `process.env.WORKFLOW_POSTGRES_DEPLOYMENT_ID` | Pins each run to the deployment that started it: each deployment claims and recovers only its own runs, and messages for another deployment's runs are routed to it. |
|
|
199
204
|
| `queueConcurrency` | `number` | `50` | Number of concurrent active step executions per process. A parent workflow awaiting `returnValue` of a child it started suspends on a system hook and holds no slot, but a `returnValue` polled inside a step holds one until the child run terminates, so cover the peak number of those in flight. |
|
|
200
205
|
| `pollInterval` | `number` | `500` | Milliseconds between idle job fetches per worker. |
|
|
201
206
|
| `applicationManagedShutdown` | `boolean` | `false`; `WORKFLOW_POSTGRES_APPLICATION_MANAGED_SHUTDOWN=1` enables it for the default package configuration | Whether the application coordinates shutdown and awaits `world.close()` instead of Graphile Worker responding automatically. |
|
|
202
|
-
| `jobLockStaleSeconds` | `number` | `process.env.WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS
|
|
207
|
+
| `jobLockStaleSeconds` | `number` | `process.env.WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS`, or unset: renew every delivery and release only spec 9 run-lease jobs of renewing holders after 300 s | Seconds a running delivery's job lock may go unrenewed before another process redelivers any of this World's jobs. `0` turns renewal and the release of stale locks off. `30` is a good value when more than one process shares the database. See [Crash recovery](#crash-recovery). |
|
|
203
208
|
|
|
204
209
|
## Environment variables
|
|
205
210
|
|
|
@@ -208,12 +213,13 @@ An aborted HTTP request does not guarantee that its server-side handler stopped,
|
|
|
208
213
|
| `WORKFLOW_TARGET_WORLD` | Set to `"@workflow/world-postgres"` to use this world | - |
|
|
209
214
|
| `WORKFLOW_POSTGRES_URL` | PostgreSQL connection string | `DATABASE_URL` or `'postgres://world:world@localhost:5432/world'` |
|
|
210
215
|
| `WORKFLOW_POSTGRES_JOB_PREFIX` | Prefix for queue job names, and the scope of startup recovery | `workflow_` |
|
|
216
|
+
| `WORKFLOW_POSTGRES_DEPLOYMENT_ID` | Pins each run to the deployment that started it | unset |
|
|
211
217
|
| `WORKFLOW_POSTGRES_WORKER_CONCURRENCY` | Number of concurrent workers | `50` |
|
|
212
218
|
| `WORKFLOW_POSTGRES_POLL_INTERVAL_MS` | Milliseconds between idle job fetches per worker | `500` |
|
|
213
219
|
| `WORKFLOW_POSTGRES_MAX_POOL_SIZE` | Internal `pg.Pool` max size | `10` |
|
|
214
220
|
| `WORKFLOW_POSTGRES_APPLICATION_MANAGED_SHUTDOWN` | Set to `1` when the application coordinates shutdown and awaits `world.close()` | unset (`false`) |
|
|
215
221
|
| `WORKFLOW_POSTGRES_HOOK_RETENTION_LIMIT_DAYS` | Maximum Hook minimum retention in days | `30` |
|
|
216
|
-
| `WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS` | Seconds a running delivery's job lock may go unrenewed before another process redelivers the job; `0` disables |
|
|
222
|
+
| `WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS` | Seconds a running delivery's job lock may go unrenewed before another process redelivers the job; `0` disables | unset: 300 s, spec 9 run-lease jobs only |
|
|
217
223
|
|
|
218
224
|
When `pool` is omitted, `maxPoolSize` precedence is: `createWorld({ maxPoolSize })`, then `WORKFLOW_POSTGRES_MAX_POOL_SIZE`, then the `pg.Pool` default.
|
|
219
225
|
|
|
@@ -331,17 +337,19 @@ and its token can be reused. If the token is never reused, the expired
|
|
|
331
337
|
- Backlog stays in PostgreSQL when all execution slots are busy
|
|
332
338
|
- Retry and sleep-style delays use Graphile `runAt` scheduling
|
|
333
339
|
- Workflow orchestration and queued step execution are both sent through `/.well-known/workflow/v1/flow`
|
|
334
|
-
-
|
|
340
|
+
- A running delivery renews its job lock, and a job whose process died is redelivered by another process: a spec 9 run's orchestrator job after 300 seconds by default, any job after `jobLockStaleSeconds` when it is set (see below)
|
|
335
341
|
|
|
336
342
|
### Crash recovery
|
|
337
343
|
|
|
338
|
-
Graphile Worker on its own keeps a dead worker's job locked for 4 hours.
|
|
344
|
+
Graphile Worker on its own keeps a dead worker's job locked for 4 hours. A running delivery therefore renews its Graphile job lock every quarter of the stale window, and at least every 10 seconds, and every process that runs workers releases jobs whose locks have gone unrenewed for that window.
|
|
345
|
+
|
|
346
|
+
By default (`jobLockStaleSeconds` unset), the window is 300 seconds and the release covers only the jobs that own a spec 9 run's delivery lease (its orchestrator deliveries, and invoke mode's executor lane) whose holder registered as renewing. A worker registers in `workflow.workflow_job_lock_holders` (migration 0030, applied by `bootstrap`) before its delivery runs. A spec 9 run whose worker was killed mid-delivery thus continues within about 8 minutes (one and a half windows). A job held by a process on an earlier version is never released this way, so the default is safe during a rolling upgrade, and other jobs are recovered by the next `start()`, which re-enqueues active runs, or after Graphile Worker's 4 hours. Without migrations 0030 and 0031, deliveries still run and renew, but nothing is released; a warning names the migration.
|
|
339
347
|
|
|
340
|
-
Set `jobLockStaleSeconds` (or `WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS`) to
|
|
348
|
+
Set `jobLockStaleSeconds` (or `WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS`) to release every job of this World, whoever holds it, after that many seconds. When a process dies mid-delivery, another process redelivers its jobs within about one and a half windows: about 45 seconds at 30. `30` is a good value when more than one process shares the database. The redelivery counts the attempt the dead process used. In invoke mode, the release covers the run's executor jobs too.
|
|
341
349
|
|
|
342
350
|
Use the same value on every process that shares the database. Keep it well above the longest a process can go without running its timers (synchronous work that blocks the event loop) or getting a connection from its pool. A delivery whose renewals stall past the window is redelivered while it still runs, and the original delivery is not acknowledged when it finishes. Workflow and step handlers already tolerate that at-least-once delivery.
|
|
343
351
|
|
|
344
|
-
|
|
352
|
+
Setting it is a choice to make after a rolling upgrade. Processes on an earlier version don't renew their locks, so an upgraded process would redeliver any of their deliveries that run longer than the window, and when the earlier-version process finishes such a delivery, its acknowledgement isn't fenced on the lock holder and can delete the redelivered job's row. So set it only once every process that shares the database runs a version that includes `jobLockStaleSeconds`, and set the same value on all of them. `0` turns renewal and release off entirely.
|
|
345
353
|
|
|
346
354
|
### Experimental synchronous invocation
|
|
347
355
|
|
|
@@ -386,20 +394,25 @@ With invocation disabled (the default), deliveries for the same run may execute
|
|
|
386
394
|
concurrently. A workflow request can execute a step inline and wait for a hook
|
|
387
395
|
wake to abort that step, so the queue cannot hold a per-run lock for the entire
|
|
388
396
|
request. Each queue instance coalesces in-flight and recently completed deliveries
|
|
389
|
-
with the same idempotency key
|
|
397
|
+
with the same idempotency key: a job whose key another delivery in the process is
|
|
398
|
+
running waits for it, and is acknowledged without delivery only if that delivery
|
|
399
|
+
completed. Handlers must still tolerate at-least-once delivery
|
|
390
400
|
across worker processes, restarts, or completed-message cache eviction.
|
|
391
401
|
|
|
392
402
|
With invocation enabled, each Graphile worker pool registers two task
|
|
393
|
-
identifiers. A task identifier selects a handler. A
|
|
394
|
-
|
|
403
|
+
identifiers. A task identifier selects a handler. A run's delivery lease
|
|
404
|
+
(`workflow.workflow_run_delivery_leases`, see [HOW_IT_WORKS.md](./HOW_IT_WORKS.md#serializing-a-runs-deliveries-run-leases))
|
|
405
|
+
controls which jobs can execute concurrently. The default job prefix produces
|
|
406
|
+
these names:
|
|
395
407
|
|
|
396
|
-
| Task identifier | Work |
|
|
408
|
+
| Task identifier | Work | Run lease |
|
|
397
409
|
| --- | --- | --- |
|
|
398
|
-
| `workflow_flows_executor` | Start or resume workflow execution |
|
|
399
|
-
| `workflow_flows` | Step execution and health checks |
|
|
410
|
+
| `workflow_flows_executor` | Start or resume workflow execution | Takes the run's lease |
|
|
411
|
+
| `workflow_flows` | Step execution and health checks | None |
|
|
400
412
|
|
|
401
|
-
|
|
402
|
-
|
|
413
|
+
One job holds a run's lease at a time across worker processes; a delivery that
|
|
414
|
+
finds it held leaves its message for the holder, which re-adds it when it
|
|
415
|
+
releases. Different runs, step jobs, and health checks can execute concurrently.
|
|
403
416
|
`queueConcurrency` limits the total active Graphile jobs per worker process
|
|
404
417
|
across both task identifiers and defaults to **50**.
|
|
405
418
|
|
|
@@ -418,7 +431,7 @@ workflow execution request can process several invocations.
|
|
|
418
431
|
Before processing pending inputs, the HTTP receiver verifies the execution
|
|
419
432
|
request against Graphile's `jobs` view. The worker supplies the job ID, worker ID,
|
|
420
433
|
and attempt through private HTTP headers. The receiver requires a locked job
|
|
421
|
-
with matching metadata
|
|
434
|
+
with matching metadata and the executor task identifier, that owns the run's lease.
|
|
422
435
|
Application-supplied headers cannot replace this metadata. Step jobs and health
|
|
423
436
|
checks process their own work without reading pending invocation rows.
|
|
424
437
|
|
|
@@ -550,4 +563,11 @@ export WORKFLOW_TARGET_WORLD="@workflow/world-postgres"
|
|
|
550
563
|
|
|
551
564
|
## Spec 9 (experimental)
|
|
552
565
|
|
|
553
|
-
Runs of the experimental spec 9 runtime (`WORKFLOW_SPEC_VERSION=9`) run their orchestrator deliveries one at a time
|
|
566
|
+
Runs of the experimental spec 9 runtime (`WORKFLOW_SPEC_VERSION=9`) run their orchestrator deliveries one at a time under the run's delivery lease (`workflow.workflow_run_delivery_leases`, migration 0031), with or without invocation, and publish their keyed messages with the `unsafe_dedupe` job key mode. A worker killed mid-job keeps the lease, through its locked job, until another process releases the job, by default after 300 seconds unrenewed (see [Crash recovery](#crash-recovery)); the job's redelivery takes the lease back. Earlier versions used a Graphile named queue per run, whose rows Graphile never deletes and locks on every poll, so throughput fell as runs accumulated. See [world-postgres on spec 9 runs](https://github.com/vercel/workflow/blob/main/packages/core/src/runtime/spec9/README.md#first-party-worlds).
|
|
567
|
+
|
|
568
|
+
- **Live event feed.** Every committed event write of a spec 9 run sends a `NOTIFY` on `workflow_run_events` after its transaction commits, and `events.subscribe` delivers the run's new events to a running orchestrator from one shared `LISTEN` connection per process, read from the table in slot order. A delivery with nothing left to run then lingers on the feed while it waits on a background step (30 seconds, `WORKFLOW_ORCHESTRATOR_LINGER_MS`) or an open hook (5 seconds), so a burst of step outcomes or hook resumes is handled by one warm delivery. The feed does not deliver a `resumeHook()` resume (a `hook_received` with a `resumeId`): it ends there, so a delivery that is only waiting stops lingering, and the resume's wake, which carries its timing, consumes and measures it. A lingering delivery holds a worker slot, so at most half of a process's `queueConcurrency` slots keep a live feed at once (none at `queueConcurrency: 1`); past that, a delivery polls the log instead of lingering. The `LISTEN` connection needs a database connection that supports sessions, as for streams.
|
|
569
|
+
- **Coalescing.** An orchestrator delivery that finds the run's lease held leaves its message on the lease and completes. When the holder finishes, it runs the handler again in the same worker for a wake left there (neither a start message nor a legacy `hookInput` resume, which are re-added as jobs instead), up to 32 times, instead of delivering each one. A re-run reports the next `deliveryCount`, the same `attempt` and the same `invocationStartedAt`, and carries the `hookResumeTiming` of a hook wake it absorbed, so the resume it consumes is measured (`workflow.resume.total_ms`). A handoff (`{ timeoutSeconds: 0 }`) passes the lease to its continuation, in the same transaction that adds it.
|
|
570
|
+
- **Delivery cap.** A spec 9 orchestrator's `{ timeoutSeconds: n > 0 }` (a redelivery after the in-band fence refused its write) carries `attempt` over, so a run refused on every pass fails with `MAX_DELIVERIES_EXCEEDED` instead of looping. A step's retry in place still starts `attempt` over.
|
|
571
|
+
- **Unstamped messages.** An orchestrator message without a spec stamp (an older SDK's `resumeHook()` or `cancel()` during a rolling upgrade) is checked against the run's stored `spec_version` when a worker takes it. For a spec 9 run, it is stamped with that version and re-added, so it takes the run's lease and waits for the run's live delivery instead of running beside it.
|
|
572
|
+
|
|
573
|
+
Every run's keyed step messages, spec 8 included, use `unsafe_dedupe`: a step message sent again while its job is locked or in retry backoff adds no second job. With `preserve_run_at`, a spec 8 step message sent again while its job was being delivered (spec 8 republishes a delivery's step messages after a failed send) added a second job, and another worker ran the step body a second time.
|
package/dist/cli.js
CHANGED
|
@@ -60,4 +60,4 @@ if (import.meta.url === `file://${process.argv[1]}`) {
|
|
|
60
60
|
setupDatabase();
|
|
61
61
|
}
|
|
62
62
|
export { setupDatabase };
|
|
63
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NsaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUMxQyxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sVUFBVSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxRQUFRLENBQUM7QUFDaEMsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3BELE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUM3RCxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDbEQsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLElBQUksQ0FBQztBQUUxQixNQUFNLFNBQVMsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztBQUUxRCxLQUFLLFVBQVUsYUFBYTtJQUMxQiw4QkFBOEI7SUFDOUIsTUFBTSxFQUFFLENBQUM7SUFFVCxNQUFNLGdCQUFnQixHQUNwQixPQUFPLENBQUMsR0FBRyxDQUFDLHFCQUFxQjtRQUNqQyxPQ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.
|
|
19
19
|
*/
|
|
20
20
|
jobPrefix?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Pins every run to the deployment (for example, the container image
|
|
23
|
+
* version) that started it, the way Vercel deployments do.
|
|
24
|
+
*
|
|
25
|
+
* Set, it becomes part of this World's effective job prefix
|
|
26
|
+
* (`${jobPrefix}${deploymentId}_`), so each deployment's workers claim only
|
|
27
|
+
* the jobs of runs that deployment started, and startup recovery re-enqueues
|
|
28
|
+
* only those runs. A message enqueued for another deployment (a hook
|
|
29
|
+
* resumed from a newer deployment, say) is routed to that deployment's
|
|
30
|
+
* task, and the World declares `deploymentAffinity`. Keep a deployment's
|
|
31
|
+
* workers running until its runs have finished: nothing else claims them.
|
|
32
|
+
*
|
|
33
|
+
* Letters, digits, `.`, `-`, `_` and `@`, and not `postgres`. The
|
|
34
|
+
* effective prefix must fit Graphile Worker's 128 character names: at most
|
|
35
|
+
* 72 characters with the default `jobPrefix`, and in general
|
|
36
|
+
* `jobPrefix` and `deploymentId` together at most 81. Defaults to
|
|
37
|
+
* WORKFLOW_POSTGRES_DEPLOYMENT_ID. Unset, every process sharing the
|
|
38
|
+
* `jobPrefix` claims every run, and `getDeploymentId()` reports `postgres`.
|
|
39
|
+
*
|
|
40
|
+
* Runs started without it record `postgres` and stay on the unpinned task:
|
|
41
|
+
* keep a process without `deploymentId` running until they finish.
|
|
42
|
+
*/
|
|
43
|
+
deploymentId?: string;
|
|
21
44
|
/**
|
|
22
45
|
* namespace for queue topic prefixes (e.g. 'custom' → '__custom_wkf_workflow_').
|
|
23
46
|
* defaults to WORKFLOW_QUEUE_NAMESPACE env var if not provided.
|
|
@@ -30,16 +53,20 @@ export type PostgresWorldConfig = PgConnectionConfig & {
|
|
|
30
53
|
enableInvoke?: boolean;
|
|
31
54
|
/**
|
|
32
55
|
* Seconds a running delivery's Graphile job lock may go unrenewed before
|
|
33
|
-
* another process releases
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* Defaults to WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS
|
|
41
|
-
*
|
|
42
|
-
*
|
|
56
|
+
* another process releases any of this World's jobs for redelivery. Use the
|
|
57
|
+
* same value on every process that shares the database, keep it well above
|
|
58
|
+
* the longest time a process can go without running its timers (a blocked
|
|
59
|
+
* event loop) or getting a pool connection, and set it only once every
|
|
60
|
+
* process runs a version that renews its locks. 30 is a good value when
|
|
61
|
+
* more than one process shares the database.
|
|
62
|
+
*
|
|
63
|
+
* Defaults to WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS. When neither is
|
|
64
|
+
* set, every delivery still renews its lock and registers its worker as
|
|
65
|
+
* renewing (`workflow.workflow_job_lock_holders`, migration 0030), and only
|
|
66
|
+
* the jobs that own a spec 9 run's delivery lease (migration 0031) whose
|
|
67
|
+
* holder registered are released, after 300 seconds unrenewed; other jobs keep Graphile Worker's
|
|
68
|
+
* fixed 4 hour reset. `0` turns renewal and the release of stale locks off,
|
|
69
|
+
* which leaves recovery to that reset and to restarts.
|
|
43
70
|
*/
|
|
44
71
|
jobLockStaleSeconds?: number;
|
|
45
72
|
/**
|
|
@@ -60,7 +87,33 @@ export type PostgresWorldConfig = PgConnectionConfig & {
|
|
|
60
87
|
* from, and the one stamped on the runs this World creates. Both must come
|
|
61
88
|
* from here, so that recovery only ever re-enqueues a run into the task whose
|
|
62
89
|
* runner claims it.
|
|
90
|
+
*
|
|
91
|
+
* Pass `deploymentId` to resolve the prefix of another deployment sharing this
|
|
92
|
+
* World's `jobPrefix`, the task a message for one of its runs goes to.
|
|
93
|
+
*/
|
|
94
|
+
export declare function resolveJobPrefix(config: Pick<PostgresWorldConfig, 'jobPrefix' | 'deploymentId'>, deploymentId?: string | undefined): string;
|
|
95
|
+
/**
|
|
96
|
+
* The deployment id a run records when no `deploymentId` is set (see
|
|
97
|
+
* `getDeploymentId()`). Reserved: a run recorded with it is unpinned, and its
|
|
98
|
+
* jobs are on the unpinned task (`${jobPrefix}flows`).
|
|
99
|
+
*/
|
|
100
|
+
export declare const UNPINNED_DEPLOYMENT_ID = "postgres";
|
|
101
|
+
/**
|
|
102
|
+
* The longest effective job prefix whose Graphile names fit: Graphile Worker
|
|
103
|
+
* limits task identifiers and queue names to 128 characters. Runs no longer
|
|
104
|
+
* use per-run named queues (see `run-lease.ts`), but earlier versions put a
|
|
105
|
+
* spec 9 run's jobs in `${prefix}flows:${runId}:executor`, where a run id is
|
|
106
|
+
* `wrun_` and a ULID (31 characters); the bound keeps those fitting while
|
|
107
|
+
* such processes share the database during a rolling upgrade.
|
|
108
|
+
*/
|
|
109
|
+
export declare const MAX_JOB_PREFIX_LENGTH: number;
|
|
110
|
+
/**
|
|
111
|
+
* Throws unless `deploymentId` is usable with this `jobPrefix`: letters,
|
|
112
|
+
* digits, `.`, `-`, `_` and `@`, not the reserved
|
|
113
|
+
* {@link UNPINNED_DEPLOYMENT_ID}, and short enough that the effective prefix
|
|
114
|
+
* `${jobPrefix}${deploymentId}_` is at most {@link MAX_JOB_PREFIX_LENGTH}
|
|
115
|
+
* characters (72 with the default `workflow_`).
|
|
63
116
|
*/
|
|
64
|
-
export declare function
|
|
117
|
+
export declare function assertValidDeploymentId(deploymentId: string, jobPrefix?: string): void;
|
|
65
118
|
export {};
|
|
66
119
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.js
CHANGED
|
@@ -4,8 +4,47 @@ const DEFAULT_JOB_PREFIX = 'workflow_';
|
|
|
4
4
|
* from, and the one stamped on the runs this World creates. Both must come
|
|
5
5
|
* from here, so that recovery only ever re-enqueues a run into the task whose
|
|
6
6
|
* runner claims it.
|
|
7
|
+
*
|
|
8
|
+
* Pass `deploymentId` to resolve the prefix of another deployment sharing this
|
|
9
|
+
* World's `jobPrefix`, the task a message for one of its runs goes to.
|
|
7
10
|
*/
|
|
8
|
-
export function resolveJobPrefix(config) {
|
|
9
|
-
|
|
11
|
+
export function resolveJobPrefix(config, deploymentId = config.deploymentId) {
|
|
12
|
+
const base = config.jobPrefix || DEFAULT_JOB_PREFIX;
|
|
13
|
+
if (deploymentId === undefined) {
|
|
14
|
+
return base;
|
|
15
|
+
}
|
|
16
|
+
assertValidDeploymentId(deploymentId, base);
|
|
17
|
+
return `${base}${deploymentId}_`;
|
|
10
18
|
}
|
|
11
|
-
|
|
19
|
+
const DEPLOYMENT_ID = /^[A-Za-z0-9._@-]+$/;
|
|
20
|
+
/**
|
|
21
|
+
* The deployment id a run records when no `deploymentId` is set (see
|
|
22
|
+
* `getDeploymentId()`). Reserved: a run recorded with it is unpinned, and its
|
|
23
|
+
* jobs are on the unpinned task (`${jobPrefix}flows`).
|
|
24
|
+
*/
|
|
25
|
+
export const UNPINNED_DEPLOYMENT_ID = 'postgres';
|
|
26
|
+
/**
|
|
27
|
+
* The longest effective job prefix whose Graphile names fit: Graphile Worker
|
|
28
|
+
* limits task identifiers and queue names to 128 characters. Runs no longer
|
|
29
|
+
* use per-run named queues (see `run-lease.ts`), but earlier versions put a
|
|
30
|
+
* spec 9 run's jobs in `${prefix}flows:${runId}:executor`, where a run id is
|
|
31
|
+
* `wrun_` and a ULID (31 characters); the bound keeps those fitting while
|
|
32
|
+
* such processes share the database during a rolling upgrade.
|
|
33
|
+
*/
|
|
34
|
+
export const MAX_JOB_PREFIX_LENGTH = 128 - 'flows:'.length - 'wrun_'.length - 26 - ':executor'.length;
|
|
35
|
+
/**
|
|
36
|
+
* Throws unless `deploymentId` is usable with this `jobPrefix`: letters,
|
|
37
|
+
* digits, `.`, `-`, `_` and `@`, not the reserved
|
|
38
|
+
* {@link UNPINNED_DEPLOYMENT_ID}, and short enough that the effective prefix
|
|
39
|
+
* `${jobPrefix}${deploymentId}_` is at most {@link MAX_JOB_PREFIX_LENGTH}
|
|
40
|
+
* characters (72 with the default `workflow_`).
|
|
41
|
+
*/
|
|
42
|
+
export function assertValidDeploymentId(deploymentId, jobPrefix = DEFAULT_JOB_PREFIX) {
|
|
43
|
+
const maxLength = MAX_JOB_PREFIX_LENGTH - jobPrefix.length - 1;
|
|
44
|
+
if (!DEPLOYMENT_ID.test(deploymentId) ||
|
|
45
|
+
deploymentId.length > maxLength ||
|
|
46
|
+
deploymentId === UNPINNED_DEPLOYMENT_ID) {
|
|
47
|
+
throw new Error(`Invalid Postgres World deploymentId ${JSON.stringify(deploymentId)}: use letters, digits, ".", "-", "_" or "@", at most ${Math.max(0, maxLength)} characters with jobPrefix ${JSON.stringify(jobPrefix)}, and not ${JSON.stringify(UNPINNED_DEPLOYMENT_ID)}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpRkEsTUFBTSxrQkFBa0IsR0FBRyxXQUFXLENBQUM7QUFFdkM7Ozs7Ozs7O0dBUUc7QUFDSCxNQUFNLFVBQVUsZ0JBQWdCLENBQzlCLE1BQStELEVBQy9ELGVBQW1DLE1BQU0sQ0FBQyxZQUFZO0lBRXRELE1BQU0sSUFBSSxHQUFHLE1BQU0sQ0FBQyxTQUFTLElBQUksa0JBQWtCLENBQUM7SUFDcEQsSUFBSSxZQUFZLEtBQUssU0FBUyxFQUFFLENBQUM7UUFDL0IsT0FBTyxJQUFJLENBQUM7SUFDZCxDQUFDO0lBQ0QsdUJBQXVCLENBQUMsWUFBWSxFQUFFLElBQUksQ0FBQyxDQUFDO0lBQzVDLE9BQU8sR0FBRyxJQUFJLEdBQUcsWUFBWSxHQUFHLENBQUM7QUFDbkMsQ0FBQztBQUVELE1BQU0sYUFBYSxHQUFHLG9CQUFvQixDQUFDO0FBRTNDOzs7O0dBSUc7QUFDSCxNQUFNLENBQUMsTUFBTSxzQkFBc0IsR0FBRyxVQUFVLENBQUM7QUFFakQ7Ozs7Ozs7R0FPRztBQUNILE1BQU0sQ0FBQyxNQUFNLHFCQUFxQixHQUNoQyxHQUFHLEdBQUcsUUFBUSxDQUFDLE1BQU0sR0FBRyxPQUFPLENBQUMsTUFBTSxHQUFHLEVBQUUsR0FBRyxXQUFXLENBQUMsTUFBTSxDQUFDO0FBRW5FOzs7Ozs7R0FNRztBQUNILE1BQU0sVUFBVSx1QkFBdUIsQ0FDckMsWUFBb0IsRUFDcEIsWUFBb0Isa0JBQWtCO0lBRXRDLE1BQU0sU0FBUyxHQUFHLHFCQUFxQixHQUFHLFNBQVMsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDO0lBQy9ELElBQ0UsQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQztRQUNqQyxZQUFZLENBQUMsTUFBTSxHQUFHLFNBQVM7UUFDL0IsWUFBWSxLQUFLLHNCQUFzQixFQUN2QyxDQUFDO1FBQ0QsTUFBTSxJQUFJLEtBQUssQ0FDYix1Q0FBdUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxZQUFZLENBQUMsd0RBQXdELElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQyxFQUFFLFNBQVMsQ0FBQyw4QkFBOEIsSUFBSSxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsYUFBYSxJQUFJLENBQUMsU0FBUyxDQUFDLHNCQUFzQixDQUFDLEVBQUUsQ0FDOVAsQ0FBQztJQUNKLENBQUM7QUFDSCxDQUFDIn0=
|
|
@@ -42,4 +42,4 @@ export function handleConnectionErrors(pool, isClosing) {
|
|
|
42
42
|
// logged it, so this one only keeps the pool from throwing.
|
|
43
43
|
pool.on('error', () => { });
|
|
44
44
|
}
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29ubmVjdGlvbi1lcnJvcnMuanMiLCJzb3VyY2VSb290IjoiIiwic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FBQztBQUM3QixDQUFDIn0=
|
package/dist/drizzle/cbor.js
CHANGED
|
@@ -7,4 +7,4 @@ export function Cbor() {
|
|
|
7
7
|
toDriver: (value) => encode(value),
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Jvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kcml6emxlL2Nib3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLEVBQUUsTUFBTSxRQUFRLENBQUM7QUFDeEMsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRWpELE1BQU0sVUFBVSxJQUFJO0lBQ2xCLE9BQU8sVUFBVSxDQUFrQztRQUNqRCxRQUFRLEVBQUUsR0FBRyxFQUFFLENBQUMsT0FBTztRQUN2QixVQUFVLEVBQUUsQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUM7UUFDcEMsUUFBUSxFQUFFLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDO0tBQ25DLENBQUMsQ0FBQztBQUNMLENBQUMifQ==
|
package/dist/drizzle/index.js
CHANGED
|
@@ -4,4 +4,4 @@ export { Schema };
|
|
|
4
4
|
export function createClient(pool) {
|
|
5
5
|
return drizzle(pool, { schema: Schema });
|
|
6
6
|
}
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZHJpenpsZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFcEQsT0FBTyxLQUFLLE1BQU0sTUFBTSxhQUFhLENBQUM7QUFFdEMsT0FBTyxFQUFFLE1BQU0sRUFBRSxDQUFDO0FBWWxCLE1BQU0sVUFBVSxZQUFZLENBQUMsSUFBVTtJQUNyQyxPQUFPLE9BQU8sQ0FBQyxJQUFJLEVBQUUsRUFBRSxNQUFNLEVBQUUsTUFBTSxFQUFFLENBQUMsQ0FBQztBQUMzQyxDQUFDIn0=
|
package/dist/drizzle/schema.d.ts
CHANGED
|
@@ -1916,6 +1916,174 @@ export declare const snapshots: import("drizzle-orm/pg-core").PgTableWithColumns
|
|
|
1916
1916
|
};
|
|
1917
1917
|
dialect: "pg";
|
|
1918
1918
|
}>;
|
|
1919
|
+
/**
|
|
1920
|
+
* Graphile workers of processes that renew their job locks (`job-lease.ts`).
|
|
1921
|
+
* The default stale-lock sweep releases a job that owns a run's delivery
|
|
1922
|
+
* lease only when its holder is listed here, so a process on an earlier version, which
|
|
1923
|
+
* neither renews nor fences its acknowledgement, is never released under.
|
|
1924
|
+
* `renewed_at` only ages out the rows of workers that hold no job.
|
|
1925
|
+
*/
|
|
1926
|
+
export declare const jobLockHolders: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
1927
|
+
name: "workflow_job_lock_holders";
|
|
1928
|
+
schema: "workflow";
|
|
1929
|
+
columns: {
|
|
1930
|
+
workerId: import("drizzle-orm/pg-core").PgColumn<{
|
|
1931
|
+
name: "worker_id";
|
|
1932
|
+
tableName: "workflow_job_lock_holders";
|
|
1933
|
+
dataType: "string";
|
|
1934
|
+
columnType: "PgText";
|
|
1935
|
+
data: string;
|
|
1936
|
+
driverParam: string;
|
|
1937
|
+
notNull: true;
|
|
1938
|
+
hasDefault: false;
|
|
1939
|
+
isPrimaryKey: true;
|
|
1940
|
+
isAutoincrement: false;
|
|
1941
|
+
hasRuntimeDefault: false;
|
|
1942
|
+
enumValues: [string, ...string[]];
|
|
1943
|
+
baseColumn: never;
|
|
1944
|
+
identity: undefined;
|
|
1945
|
+
generated: undefined;
|
|
1946
|
+
}, {}, {}>;
|
|
1947
|
+
renewedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
1948
|
+
name: "renewed_at";
|
|
1949
|
+
tableName: "workflow_job_lock_holders";
|
|
1950
|
+
dataType: "custom";
|
|
1951
|
+
columnType: "PgCustomColumn";
|
|
1952
|
+
data: Date;
|
|
1953
|
+
driverParam: string | Date;
|
|
1954
|
+
notNull: true;
|
|
1955
|
+
hasDefault: true;
|
|
1956
|
+
isPrimaryKey: false;
|
|
1957
|
+
isAutoincrement: false;
|
|
1958
|
+
hasRuntimeDefault: false;
|
|
1959
|
+
enumValues: undefined;
|
|
1960
|
+
baseColumn: never;
|
|
1961
|
+
identity: undefined;
|
|
1962
|
+
generated: undefined;
|
|
1963
|
+
}, {}, {
|
|
1964
|
+
pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
|
|
1965
|
+
}>;
|
|
1966
|
+
};
|
|
1967
|
+
dialect: "pg";
|
|
1968
|
+
}>;
|
|
1969
|
+
/**
|
|
1970
|
+
* Per-run delivery leases (`run-lease.ts`): a run's row exists only while a
|
|
1971
|
+
* delivery drives it. `ownerJobId` is the Graphile job that owns it; `wake`
|
|
1972
|
+
* and `deferred` are the messages other deliveries left for that owner.
|
|
1973
|
+
*/
|
|
1974
|
+
export declare const runDeliveryLeases: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
1975
|
+
name: "workflow_run_delivery_leases";
|
|
1976
|
+
schema: "workflow";
|
|
1977
|
+
columns: {
|
|
1978
|
+
runId: import("drizzle-orm/pg-core").PgColumn<{
|
|
1979
|
+
name: "run_id";
|
|
1980
|
+
tableName: "workflow_run_delivery_leases";
|
|
1981
|
+
dataType: "string";
|
|
1982
|
+
columnType: "PgVarchar";
|
|
1983
|
+
data: string;
|
|
1984
|
+
driverParam: string;
|
|
1985
|
+
notNull: true;
|
|
1986
|
+
hasDefault: false;
|
|
1987
|
+
isPrimaryKey: true;
|
|
1988
|
+
isAutoincrement: false;
|
|
1989
|
+
hasRuntimeDefault: false;
|
|
1990
|
+
enumValues: [string, ...string[]];
|
|
1991
|
+
baseColumn: never;
|
|
1992
|
+
identity: undefined;
|
|
1993
|
+
generated: undefined;
|
|
1994
|
+
}, {}, {
|
|
1995
|
+
length: number | undefined;
|
|
1996
|
+
}>;
|
|
1997
|
+
ownerJobId: import("drizzle-orm/pg-core").PgColumn<{
|
|
1998
|
+
name: "owner_job_id";
|
|
1999
|
+
tableName: "workflow_run_delivery_leases";
|
|
2000
|
+
dataType: "bigint";
|
|
2001
|
+
columnType: "PgBigInt64";
|
|
2002
|
+
data: bigint;
|
|
2003
|
+
driverParam: string;
|
|
2004
|
+
notNull: true;
|
|
2005
|
+
hasDefault: false;
|
|
2006
|
+
isPrimaryKey: false;
|
|
2007
|
+
isAutoincrement: false;
|
|
2008
|
+
hasRuntimeDefault: false;
|
|
2009
|
+
enumValues: undefined;
|
|
2010
|
+
baseColumn: never;
|
|
2011
|
+
identity: undefined;
|
|
2012
|
+
generated: undefined;
|
|
2013
|
+
}, {}, {}>;
|
|
2014
|
+
wake: import("drizzle-orm/pg-core").PgColumn<{
|
|
2015
|
+
name: "wake";
|
|
2016
|
+
tableName: "workflow_run_delivery_leases";
|
|
2017
|
+
dataType: "json";
|
|
2018
|
+
columnType: "PgJsonb";
|
|
2019
|
+
data: unknown;
|
|
2020
|
+
driverParam: unknown;
|
|
2021
|
+
notNull: false;
|
|
2022
|
+
hasDefault: false;
|
|
2023
|
+
isPrimaryKey: false;
|
|
2024
|
+
isAutoincrement: false;
|
|
2025
|
+
hasRuntimeDefault: false;
|
|
2026
|
+
enumValues: undefined;
|
|
2027
|
+
baseColumn: never;
|
|
2028
|
+
identity: undefined;
|
|
2029
|
+
generated: undefined;
|
|
2030
|
+
}, {}, {}>;
|
|
2031
|
+
wakeResume: import("drizzle-orm/pg-core").PgColumn<{
|
|
2032
|
+
name: "wake_resume";
|
|
2033
|
+
tableName: "workflow_run_delivery_leases";
|
|
2034
|
+
dataType: "boolean";
|
|
2035
|
+
columnType: "PgBoolean";
|
|
2036
|
+
data: boolean;
|
|
2037
|
+
driverParam: boolean;
|
|
2038
|
+
notNull: true;
|
|
2039
|
+
hasDefault: true;
|
|
2040
|
+
isPrimaryKey: false;
|
|
2041
|
+
isAutoincrement: false;
|
|
2042
|
+
hasRuntimeDefault: false;
|
|
2043
|
+
enumValues: undefined;
|
|
2044
|
+
baseColumn: never;
|
|
2045
|
+
identity: undefined;
|
|
2046
|
+
generated: undefined;
|
|
2047
|
+
}, {}, {}>;
|
|
2048
|
+
deferred: import("drizzle-orm/pg-core").PgColumn<{
|
|
2049
|
+
name: "deferred";
|
|
2050
|
+
tableName: "workflow_run_delivery_leases";
|
|
2051
|
+
dataType: "json";
|
|
2052
|
+
columnType: "PgJsonb";
|
|
2053
|
+
data: unknown;
|
|
2054
|
+
driverParam: unknown;
|
|
2055
|
+
notNull: true;
|
|
2056
|
+
hasDefault: true;
|
|
2057
|
+
isPrimaryKey: false;
|
|
2058
|
+
isAutoincrement: false;
|
|
2059
|
+
hasRuntimeDefault: false;
|
|
2060
|
+
enumValues: undefined;
|
|
2061
|
+
baseColumn: never;
|
|
2062
|
+
identity: undefined;
|
|
2063
|
+
generated: undefined;
|
|
2064
|
+
}, {}, {}>;
|
|
2065
|
+
claimedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
2066
|
+
name: "claimed_at";
|
|
2067
|
+
tableName: "workflow_run_delivery_leases";
|
|
2068
|
+
dataType: "custom";
|
|
2069
|
+
columnType: "PgCustomColumn";
|
|
2070
|
+
data: Date;
|
|
2071
|
+
driverParam: string | Date;
|
|
2072
|
+
notNull: true;
|
|
2073
|
+
hasDefault: true;
|
|
2074
|
+
isPrimaryKey: false;
|
|
2075
|
+
isAutoincrement: false;
|
|
2076
|
+
hasRuntimeDefault: false;
|
|
2077
|
+
enumValues: undefined;
|
|
2078
|
+
baseColumn: never;
|
|
2079
|
+
identity: undefined;
|
|
2080
|
+
generated: undefined;
|
|
2081
|
+
}, {}, {
|
|
2082
|
+
pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
|
|
2083
|
+
}>;
|
|
2084
|
+
};
|
|
2085
|
+
dialect: "pg";
|
|
2086
|
+
}>;
|
|
1919
2087
|
export declare const streams: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
1920
2088
|
name: "workflow_stream_chunks";
|
|
1921
2089
|
schema: "workflow";
|