pipework 0.198.0 → 0.200.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/CHANGELOG.md +28 -0
- package/REFERENCE.md +56 -0
- package/dist/REFERENCE.md +7 -195
- package/dist/async/jobs/queue-door.d.ts +20 -0
- package/dist/async/jobs/queue-door.d.ts.map +1 -0
- package/dist/async/jobs/queue-door.js +38 -0
- package/dist/async/jobs/queue-door.js.map +1 -0
- package/dist/async/jobs/queue.d.ts +5 -0
- package/dist/async/jobs/queue.d.ts.map +1 -1
- package/dist/async/jobs/queue.js +2 -0
- package/dist/async/jobs/queue.js.map +1 -1
- package/dist/auth/tenant/in-tenant.d.ts +12 -1
- package/dist/auth/tenant/in-tenant.d.ts.map +1 -1
- package/dist/auth/tenant/in-tenant.js +28 -11
- package/dist/auth/tenant/in-tenant.js.map +1 -1
- package/dist/auth/tenant/scoped-db.d.ts +8 -0
- package/dist/auth/tenant/scoped-db.d.ts.map +1 -1
- package/dist/auth/tenant/scoped-db.js +47 -0
- package/dist/auth/tenant/scoped-db.js.map +1 -1
- package/dist/cli/commands/alerts.js +4 -2
- package/dist/cli/commands/alerts.js.map +1 -1
- package/dist/cli/commands/check.d.ts +14 -0
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +26 -1
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/db.d.ts.map +1 -1
- package/dist/cli/commands/db.js +26 -1
- package/dist/cli/commands/db.js.map +1 -1
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +8 -2
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/core/config/load.d.ts +19 -0
- package/dist/core/config/load.d.ts.map +1 -1
- package/dist/core/config/load.js +30 -3
- package/dist/core/config/load.js.map +1 -1
- package/dist/core/config/namespace.d.ts +8 -0
- package/dist/core/config/namespace.d.ts.map +1 -1
- package/dist/core/config/resolve.d.ts +2 -0
- package/dist/core/config/resolve.d.ts.map +1 -1
- package/dist/core/config/resolve.js +2 -2
- package/dist/core/config/resolve.js.map +1 -1
- package/dist/core/config/schema.d.ts +17 -0
- package/dist/core/config/schema.d.ts.map +1 -1
- package/dist/core/config/schema.js +64 -0
- package/dist/core/config/schema.js.map +1 -1
- package/dist/core/pipework.d.ts +10 -2
- package/dist/core/pipework.d.ts.map +1 -1
- package/dist/core/pipework.js +18 -5
- package/dist/core/pipework.js.map +1 -1
- package/dist/core/surface/worker.d.ts.map +1 -1
- package/dist/core/surface/worker.js +16 -9
- package/dist/core/surface/worker.js.map +1 -1
- package/dist/core/validation/connectivity.d.ts.map +1 -1
- package/dist/core/validation/connectivity.js +2 -1
- package/dist/core/validation/connectivity.js.map +1 -1
- package/dist/core/validation/rls-role.d.ts +5 -0
- package/dist/core/validation/rls-role.d.ts.map +1 -1
- package/dist/core/validation/rls-role.js +43 -0
- package/dist/core/validation/rls-role.js.map +1 -1
- package/dist/core/validation/startup.d.ts.map +1 -1
- package/dist/core/validation/startup.js +2 -1
- package/dist/core/validation/startup.js.map +1 -1
- package/dist/data/db/db.d.ts +48 -0
- package/dist/data/db/db.d.ts.map +1 -1
- package/dist/data/db/db.js +117 -3
- package/dist/data/db/db.js.map +1 -1
- package/dist/data/db/namespace.d.ts +3 -1
- package/dist/data/db/namespace.d.ts.map +1 -1
- package/dist/data/db/namespace.js +3 -1
- package/dist/data/db/namespace.js.map +1 -1
- package/dist/data/db/owner-labels.d.ts +9 -0
- package/dist/data/db/owner-labels.d.ts.map +1 -0
- package/dist/data/db/owner-labels.js +9 -0
- package/dist/data/db/owner-labels.js.map +1 -0
- package/dist/data/db/pool.d.ts +4 -2
- package/dist/data/db/pool.d.ts.map +1 -1
- package/dist/data/db/pool.js.map +1 -1
- package/dist/data/db/unbound.d.ts +18 -0
- package/dist/data/db/unbound.d.ts.map +1 -0
- package/dist/data/db/unbound.js +26 -0
- package/dist/data/db/unbound.js.map +1 -0
- package/dist/data/migrate/door-generate.d.ts +35 -0
- package/dist/data/migrate/door-generate.d.ts.map +1 -0
- package/dist/data/migrate/door-generate.js +96 -0
- package/dist/data/migrate/door-generate.js.map +1 -0
- package/dist/data/migrate/generate.d.ts +2 -2
- package/dist/data/migrate/generate.d.ts.map +1 -1
- package/dist/data/migrate/generate.js +15 -4
- package/dist/data/migrate/generate.js.map +1 -1
- package/dist/data/migrate/run.d.ts.map +1 -1
- package/dist/data/migrate/run.js +2 -1
- package/dist/data/migrate/run.js.map +1 -1
- package/dist/data/migrate/snapshot.d.ts +6 -0
- package/dist/data/migrate/snapshot.d.ts.map +1 -1
- package/dist/data/migrate/snapshot.js.map +1 -1
- package/dist/infra/alerts/beat.d.ts +6 -0
- package/dist/infra/alerts/beat.d.ts.map +1 -1
- package/dist/infra/alerts/beat.js +9 -0
- package/dist/infra/alerts/beat.js.map +1 -1
- package/dist/infra/alerts/faults.d.ts +4 -3
- package/dist/infra/alerts/faults.d.ts.map +1 -1
- package/dist/infra/alerts/faults.js +34 -10
- package/dist/infra/alerts/faults.js.map +1 -1
- package/dist/infra/alerts/namespace.d.ts +8 -1
- package/dist/infra/alerts/namespace.d.ts.map +1 -1
- package/dist/infra/alerts/namespace.js +8 -1
- package/dist/infra/alerts/namespace.js.map +1 -1
- package/dist/infra/cache/create.d.ts.map +1 -1
- package/dist/infra/cache/create.js +3 -3
- package/dist/infra/cache/create.js.map +1 -1
- package/dist/infra/cache/entry.d.ts +7 -1
- package/dist/infra/cache/entry.d.ts.map +1 -1
- package/dist/infra/cache/entry.js +10 -5
- package/dist/infra/cache/entry.js.map +1 -1
- package/dist/infra/cache/tenant.d.ts.map +1 -1
- package/dist/infra/cache/tenant.js +2 -3
- package/dist/infra/cache/tenant.js.map +1 -1
- package/dist/infra/email/sigv4.d.ts +24 -0
- package/dist/infra/email/sigv4.d.ts.map +1 -0
- package/dist/infra/email/sigv4.js +55 -0
- package/dist/infra/email/sigv4.js.map +1 -0
- package/dist/infra/storage/handle.d.ts.map +1 -1
- package/dist/infra/storage/handle.js +28 -6
- package/dist/infra/storage/handle.js.map +1 -1
- package/dist/request/di/resolve.d.ts.map +1 -1
- package/dist/request/di/resolve.js +2 -2
- package/dist/request/di/resolve.js.map +1 -1
- package/dist/request/http/server.d.ts.map +1 -1
- package/dist/request/http/server.js +2 -3
- package/dist/request/http/server.js.map +1 -1
- package/dist/test/plugin.d.ts.map +1 -1
- package/dist/test/plugin.js +8 -1
- package/dist/test/plugin.js.map +1 -1
- package/dist/test/setup.d.ts.map +1 -1
- package/dist/test/setup.js +28 -0
- package/dist/test/setup.js.map +1 -1
- package/dist/test/system-channel.d.ts +3 -1
- package/dist/test/system-channel.d.ts.map +1 -1
- package/dist/test/system-channel.js +10 -3
- package/dist/test/system-channel.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.200.0
|
|
4
|
+
|
|
5
|
+
- **Added: platform mode, so tenant data is reached by no BYPASSRLS role at runtime** (#759).
|
|
6
|
+
- Set per database `systemUrl` / `systemTestUrl` and `rls.platformRole`. `pipe.system()` and pipework's own runtime connections then run on that platform role:
|
|
7
|
+
- trace, worker and queue, scheduler, health, quota, rate limits, faults, cache, RBAC and the storage sweep;
|
|
8
|
+
- the role must not be BYPASSRLS.
|
|
9
|
+
- Only `pipework migrate` and the trace-partition and audit-chain DDL use the owner. Pass `pool.getOrCreate(cfg, 'owner', '<label>')` there.
|
|
10
|
+
- Startup refuses a platform role that is SUPERUSER, has BYPASSRLS or does not match `rls.platformRole`. Without platform mode, behaviour is unchanged, and a database with `rls` logs one warning that its system channel bypasses RLS.
|
|
11
|
+
- **Added: doors, named cross-tenant reads.** `doors: { 'admission.ledger': { table, reason } }` generates a SELECT policy on that one table, `TO <platformRole>`. It opens only while `pipework.door` is set to the door's name.
|
|
12
|
+
- `pipe.door(name, db => …)` runs one transaction with the door set. Its `db` can read the door's table and non-tenant tables, and refuses any other tenant table and any write at build time.
|
|
13
|
+
- A tenant-table statement through `pipe.system()` in platform mode is refused at build time, naming the table and `pipe.door`.
|
|
14
|
+
- `pipework check` lists the doors and the runtime role.
|
|
15
|
+
- **Pipework's own doors:** `pipework.storage_sweep` (SELECT and DELETE on `storage_file`) and `pipework.queue.<table>` (SELECT and UPDATE, for queues with a tenant column). They are generated in platform mode. App door names may not start with `pipework.`.
|
|
16
|
+
- The storage sweep refuses, removing nothing, if its door's policies are missing.
|
|
17
|
+
- **Changed in platform mode only:**
|
|
18
|
+
- Cache loaders and RBAC resolution run with the tenant set.
|
|
19
|
+
- `pipe()` / `pipeRaw()` with no bound transaction refuses when a tenant is in context; use `pipe.transaction` or the request's transaction.
|
|
20
|
+
- `pipework db setup` creates the platform role and grants it the runtime privileges.
|
|
21
|
+
- **Not covered by doors:** limiting a door to some of a table's columns.
|
|
22
|
+
|
|
23
|
+
## 0.199.0
|
|
24
|
+
|
|
25
|
+
- **Added: a process that is not a pipework surface can record faults and loop beats** (#769). Before this, `alerts.recordFault` outside a Flow did nothing unless a worker surface had registered a target. Now:
|
|
26
|
+
- **`alerts.useFaultTarget(manifold | db | () => db)`:** a custom drain registers once at boot. It returns the release to call at shutdown. A manifold without `alerts` registers nothing.
|
|
27
|
+
- **`alerts.recordFaultFor(manifold, kind, message, context?)`:** writes a fault from code that holds the manifold.
|
|
28
|
+
- **`alerts.recordBeat(manifold, name, { ok, error?, everyMs })`:** your own loop beats for `alerts.source.loopStalled`, recorded outside any Flow.
|
|
29
|
+
- **Changed: a fault with nowhere to go is no longer silent.** When there is no Flow and no registered target, `recordFault` logs one warning per kind: `fault "<kind>" dropped: no Flow and no fault target; call alerts.useFaultTarget(manifold) at boot`.
|
|
30
|
+
|
|
3
31
|
## 0.198.0
|
|
4
32
|
|
|
5
33
|
- **Added: a queue job's claim history** (#765). Queue tables gain `claims jsonb NOT NULL DEFAULT '[]'`.
|
package/REFERENCE.md
CHANGED
|
@@ -730,6 +730,59 @@ Database accessor — returns a Drizzle DB instance scoped to the current reques
|
|
|
730
730
|
|
|
731
731
|
The system channel — deliberate cross-tenant access for pre-tenant surfaces (auth membership resolution, public webhook ingress, admin tooling). Never tenant-scoped or tenant-guarded; runs on the owner-role connection outside the request transaction.
|
|
732
732
|
|
|
733
|
+
That holds where the database has no `rls.platformRole`. Where the owner role has BYPASSRLS, every system-channel statement bypasses row-level security; at startup a database with `rls` and no platform role logs one warning saying so (not an error).
|
|
734
|
+
|
|
735
|
+
With `rls.platformRole` set (platform mode), `pipe.system()` runs on the `systemUrl` connection, as that role, outside the request transaction. The role must have no SUPERUSER or BYPASSRLS; startup refuses a `systemUrl` role that has either, or whose `current_user` is not `rls.platformRole`. The handle refuses at build time any statement built over a tenant-scoped table, naming the table and pointing at `pipe.door`. A table with no tenant (auth registry, queues, `pipework_*` tables) reads and writes as before, on the role's grants. `db.execute(sql...)` cannot be inspected; a raw statement over a tenant table returns no rows, because no policy admits the platform role without a door. Under collapsed test isolation the same guards apply on the test connection.
|
|
736
|
+
|
|
737
|
+
### `pipe.door`
|
|
738
|
+
|
|
739
|
+
`pipe.door(name, fn, options?: { database? })` — a named cross-tenant read for platform work with no requesting tenant (sweeps, integrity checks, reaper reads). It needs an active Flow and `rls.platformRole` on the door's database; outside platform mode it throws, naming the database.
|
|
740
|
+
|
|
741
|
+
Declare each door in config, by name:
|
|
742
|
+
|
|
743
|
+
```ts
|
|
744
|
+
createManifold({
|
|
745
|
+
databases: {
|
|
746
|
+
app: {
|
|
747
|
+
url: 'DATABASE_URL',
|
|
748
|
+
systemUrl: 'SYSTEM_DATABASE_URL', // connection as the platform role
|
|
749
|
+
systemTestUrl: 'SYSTEM_DATABASE_URL_TEST',
|
|
750
|
+
rls: { platformRole: 'app_platform' }, // NOSUPERUSER NOBYPASSRLS
|
|
751
|
+
},
|
|
752
|
+
},
|
|
753
|
+
doors: {
|
|
754
|
+
'admission.ledger': { table: 'walk_job_costs', reason: 'admission reads every tenant\'s spend' },
|
|
755
|
+
},
|
|
756
|
+
})
|
|
757
|
+
|
|
758
|
+
const rows = await pipe.door('admission.ledger', db => db.select().from(walkJobCosts))
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
A door name is lowercase dotted words (`/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$/`). `table` is the SQL table name; `database` defaults to the default database; `reason` is required. Config refuses, at load: a door on a database with no `rls.platformRole`; `systemUrl` without `rls.platformRole`; `rls.platformRole` without `systemUrl`.
|
|
762
|
+
|
|
763
|
+
`pipework generate` writes, for each door, `CREATE POLICY "pipework_door_<name, . as __>" ON <table> AS PERMISSIVE FOR SELECT TO <platformRole> USING (current_setting('pipework.door', true) = '<name>')`. Doors are recorded in the migration snapshot: adding one, removing one, or changing its table or the platform role makes the next `generate` emit the matching `CREATE POLICY` or `DROP POLICY IF EXISTS`, even when no table changed. A door on a table that is not tenant-scoped in any definition is refused by name at generate: such a table is not row-secured and needs no door.
|
|
764
|
+
|
|
765
|
+
`fn(db)` runs in one transaction on the system connection; the transaction first runs `set_config('pipework.door', name, true)`, so the door is open for that transaction only, and `pipe.door` resolves with `fn`'s result. `db` allows `select` from the door's table and from any table with no tenant. It refuses at build time any other tenant-scoped table (naming the table and the door) and `insert`, `update` and `delete` on the door's table. An undeclared name throws, listing the declared doors. Column limiting is out of scope: a door opens the whole table to SELECT for the transaction. `pipework check` lists the declared doors as `name -> database.table: reason`.
|
|
766
|
+
|
|
767
|
+
**pipework's own doors.** Where the default database has `rls.platformRole` and the blueprint has `storage: {}`, pipework declares the door `pipework.storage_sweep` on `storage_file` itself. It is the only door that also deletes: `pipework generate` writes two policies for it, `FOR SELECT` and `FOR DELETE`, both `TO <platformRole>` and open on the door setting. It is recorded in the snapshot like an app door. App config may not declare a name starting `pipework.`; config refuses it. `pipework check` lists it, marked `(pipework's own)`. `storage.sweep()` runs its expiry delete, its read of referenced files and its per-object re-check (with the content lock) inside that door. Before listing any object it checks `pg_policy` for both policies and throws by name, removing nothing, if either is missing, because without the door the sweep would see no file referencing any object. Run `pipework generate` and `pipework migrate` after turning platform mode on. Outside platform mode the sweep is unchanged.
|
|
768
|
+
|
|
769
|
+
`pipework db setup` creates the platform role like the runtime role (LOGIN, a generated password, NOBYPASSRLS), grants it the same table and sequence privileges and default privileges, and writes `systemUrl`/`systemTestUrl` to `.env`. The test template creates `rls.platformRole` NOLOGIN, never BYPASSRLS, before its migrations run, and grants it to the test login. Under collapsed test isolation the door runs on the test connection, each statement bracketed with `pipework.door` and the test-only system policy open, so the test connection reads the door's table across tenants; the build-time guards are the same.
|
|
770
|
+
|
|
771
|
+
#### Platform mode: the runtime role
|
|
772
|
+
|
|
773
|
+
In platform mode a running manifold opens no connection on the database's owner role (`url`). `pool.getOrCreate(config)` with no role resolves to `'system'` (the platform role, `systemUrl`) where the database sets `rls.platformRole`, and to `'owner'` otherwise; `getOrCreate(config, 'owner', label)` still gives the owner, and in platform mode logs one info line naming `label`. `pool.ownerConnectionsCreated()` counts the owner connections a pool has created; a running platform-mode manifold keeps it at 0. `pipework check` prints `runtime role: <platformRole> (owner used only for: migrate, trace-partition-maintenance)`.
|
|
774
|
+
|
|
775
|
+
What runs on the platform role: trace open, flush, close, truncate and copy-on-error; faults, loop beats and alert sources; the worker's LISTEN, claim loop, reaper and scheduler; the step-graph dead letter; the storage sweep (through `pipework.storage_sweep`); startup and `/ready` database checks (and the startup connectivity probe, which dials `systemUrl`); quota; rate-limit classes; `AuthContext.db`; `pipework alerts stale` and `unit-fault`. Their tables carry no tenant column, or the framework policies (insert for anyone; read and update for a transaction that sets `pipework.maintenance`, which these paths already do). Their grants are the platform role's, written by `pipework db setup`.
|
|
776
|
+
|
|
777
|
+
Tenant tables are read with the tenant set. Where a database is in platform mode:
|
|
778
|
+
- cache loaders (`cache.create`, `cache.createTenant`) and RBAC resolution for a route's `.permission()` run their statements in a short transaction on the platform connection that first sets `rls.sessionVar` to the tenant (the Flow's, or for `cache.createTenant` the tenant asked for; for RBAC the request's). With no tenant in the Flow a cache loader runs on the platform connection as is, and tenant tables return nothing.
|
|
779
|
+
- `pipe()`, `pipeRaw()` and a handler's database dependency with no bound transaction use the pooled platform connection. With no tenant in the Flow they run as is: a table with no tenant reads, a tenant table returns nothing. With a tenant in the Flow they throw, naming `pipe.transaction` and the request or job transaction: the tenant setting is set per transaction, and a builder runs its statement unwrapped on the connection it was made from. Inside a request, a job or `pipe.transaction` the tenant is set as always.
|
|
780
|
+
- `inTenant`, which the access-link, storage, support and credits `...For` forms use, runs on the platform connection without the system channel's build-time guard, with the tenant set for the transaction.
|
|
781
|
+
|
|
782
|
+
A queue whose `exclusion.tenantColumn` is set has a tenant-secured table that claim and reap scan across tenants. In platform mode pipework declares the framework door `pipework.queue.<table>` for it, one of pipework's own doors (like `pipework.storage_sweep`, same snapshot `ops`, same `(pipework's own)` line in `pipework check`): `FOR SELECT` and `FOR UPDATE` policies (`..._update`) to the platform role that open while `pipework.door` names it. No DELETE: a queue never deletes a row. Queue tables register when a worker surface or step graph is constructed, so the door is declared from the loaded app, not from config. The worker runs claim, reap, heartbeat, complete, fail, later and hand-back through it, each in its own transaction with the door set. `queue.door` is its name, `null` for a queue with no tenant column. A scheduled job on a tenant-column queue cannot be enqueued by the scheduler (it has no tenant to give), as before.
|
|
783
|
+
|
|
784
|
+
The owner stays for DDL: `pipework migrate` and `pipework generate` (the migrate runner opens it as `migrate`), and trace and audit partition maintenance (`createTracePartitionStartupHook`, `scheduleTracePartitionMaintenance`, `syncTracePartitions`, `installAuditChain`, `retireAuditPartition`), which take the `db` the app hands them: pass `pool.getOrCreate(config, 'owner', 'trace-partition-maintenance')`. A manifold that must not hold the owner at runtime runs partition maintenance from a process that does. The `app` role still falls back to `url` when `appUrl` is unset; set `appUrl` so the request path is not the owner either.
|
|
785
|
+
|
|
733
786
|
### `pipe.filter`
|
|
734
787
|
|
|
735
788
|
Query operators and aggregates — eq, gt, lt, and, or, count, sum, etc.
|
|
@@ -1792,6 +1845,9 @@ Pass in `sources`; each raises with a fixed key on a tick and, where it can tell
|
|
|
1792
1845
|
- `alerts.source.traces({ graceMs? = 93_600_000, settleMs?, severity?, owner?, runbook?, database? })` — `trace-expired:<entryKind>` for traces the expiry sweep force-closed since the last tick (read from `closed_at` where `status = 'expired'`); `trace-expiry-undrained:all` while open traces are more than `graceMs` (default 26 h, as the maintenance job is daily) past `expires_at`, meaning the expiry job is not running. Needs the `trace` block in the blueprint.
|
|
1793
1846
|
- `alerts.source.faults({ kinds?, settleMs?, severity? = 'error', owner?, runbook?, database? })` — failures that code swallowed and only logged, recorded in `pipework_faults` (comes with the `alerts` blueprint flag; not tenant-scoped): `fault:<kind>`, message `<count> <kind> fault(s); last: <message>`, context `count`, `lastMessage`, `lastContext`; clears by the quiet period. `kinds` limits it. Pipework records `audit-write` (alert, auth, email, storage, support audit writes and read touches), `quota-record`, `credits-callback`, `trace-steps-lost`, `trace-write`, `trace-record`, `support-inbound-untenanted`, `queue-listener`, `queue-reaper`, `queue-heartbeat`, `scheduler`, `job-event-callback`, `queue-handback`, `step-graph-on-failed`, `inbound-raw-delete`, `access-link-on-miss` and `client-fault-raise`.
|
|
1794
1847
|
- `alerts.recordFault(kind, message, context?)` — records a failure your own code swallowed so the faults source can raise it: `void alerts.recordFault('webhook-parse', err.message, { id })` next to the log line. Best effort: never throws (a failed write is one `log.warn`), does nothing where the blueprint has no `alerts`, writes on the system connection outside the caller's transaction (so a rollback keeps it), stores the current tenant, cuts `message` at 2000 characters, and redacts email addresses from message and context before storing. Rows older than `occurrenceRetentionMs` are pruned by the tick, as occurrences are. `kind` is a short stable name.
|
|
1848
|
+
- `alerts.useFaultTarget(manifold | db | () => db)` — registers where `alerts.recordFault` writes when it runs outside any Flow, for a process that is not a pipework surface (a custom queue drain). Call it once at boot and keep the release for shutdown: `const release = alerts.useFaultTarget(manifold)` ... `release()`. A manifold resolves lazily to its default database and registers nothing (the release is a no-op) where the blueprint has no `alerts`. With no Flow and no target, `recordFault` writes nothing and logs one warn per kind per process: `fault "<kind>" dropped: no Flow and no fault target; call alerts.useFaultTarget(manifold) at boot`.
|
|
1849
|
+
- `alerts.recordFaultFor(manifold, kind, message, context?)` — `recordFault` for code that holds the manifold: writes on its default database with no Flow and no registered target; never warns, does nothing without `alerts`.
|
|
1850
|
+
- `alerts.recordBeat(manifold, name, { ok, error?, everyMs })` — one iteration of a background loop of your own, for `alerts.source.loopStalled` to raise when it stops. Works outside any Flow on the manifold's default database; best effort, never throws, does nothing without `alerts`.
|
|
1795
1851
|
- `queue.totals(db)` — `{ overall, byType }`, each `{ ready, running, oldestReadyWaitMs }` (ready: pending and not waiting on a retry time; running: claimed or running; wait from `queued_at`, null when none is ready); `byType` omits a type with neither.
|
|
1796
1852
|
- `alerts.source.health(checks, { severity? = 'error' })` — `health:<name>` while a `HealthCheck` is unhealthy or throws; resolves when it recovers. Degraded is not a fault.
|
|
1797
1853
|
|
package/dist/REFERENCE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Pipework API Reference
|
|
2
2
|
|
|
3
3
|
> Auto-generated from source JSDoc. Do not edit manually.
|
|
4
|
-
> Generated: 2026-10-
|
|
4
|
+
> Generated: 2026-10-09
|
|
5
5
|
|
|
6
6
|
## Contents
|
|
7
7
|
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
- [jobs — Background Jobs](#jobs-background-jobs)
|
|
11
11
|
- [pipeline — Multi-Step Pipelines](#pipeline-multi-step-pipelines)
|
|
12
12
|
- [state — State Machines](#state-state-machines)
|
|
13
|
-
- [steps](#steps)
|
|
14
13
|
- [auth — Authentication](#auth-authentication)
|
|
15
14
|
- [rbac — Access Control](#rbac-access-control)
|
|
16
15
|
- [tenant — Multi-Tenancy](#tenant-multi-tenancy)
|
|
@@ -31,9 +30,7 @@
|
|
|
31
30
|
- [cache — Caching](#cache-caching)
|
|
32
31
|
- [credits](#credits)
|
|
33
32
|
- [mail](#mail)
|
|
34
|
-
- [untrustedFetch](#untrustedfetch)
|
|
35
33
|
- [storage](#storage)
|
|
36
|
-
- [support](#support)
|
|
37
34
|
- [webhook — Inbound & Outbound Webhooks](#webhook-inbound-outbound-webhooks)
|
|
38
35
|
- [behavior — Resource Decorators](#behavior-resource-decorators)
|
|
39
36
|
- [fitting — Dependency Injection](#fitting-dependency-injection)
|
|
@@ -88,18 +85,6 @@ function createManifold<const TEnv extends EnvDefs = EnvDefs>( raw: Omit<Bluepri
|
|
|
88
85
|
interface Manifold<TEnv extends EnvDefs = EnvDefs>
|
|
89
86
|
```
|
|
90
87
|
|
|
91
|
-
**`ScriptOptions`** — Options for {@link Manifold.script}.
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
interface ScriptOptions
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
**`StartOptions`** — Options for {@link Manifold.start}.
|
|
98
|
-
|
|
99
|
-
```typescript
|
|
100
|
-
interface StartOptions
|
|
101
|
-
```
|
|
102
|
-
|
|
103
88
|
**`SeedOptions`** — ALS context the {@link Manifold.seed} callback runs under — tenant scope, auth principal, and job type.
|
|
104
89
|
|
|
105
90
|
```typescript
|
|
@@ -244,14 +229,6 @@ Creates a job queue with claim/complete/fail lifecycle, heartbeat, and dead lett
|
|
|
244
229
|
|
|
245
230
|
Executes a fitting handler as a background job with its own Flow context.
|
|
246
231
|
|
|
247
|
-
### `jobs.later`
|
|
248
|
-
|
|
249
|
-
The error to throw to end an attempt as "later": pending again after `delayMs`, no attempt counted.
|
|
250
|
-
|
|
251
|
-
### `jobs.permanent`
|
|
252
|
-
|
|
253
|
-
The error to throw to dead-letter the job now, whatever attempts remain.
|
|
254
|
-
|
|
255
232
|
### `jobs.parseCron`
|
|
256
233
|
|
|
257
234
|
Parses a 5-field cron expression into a CronSchedule (minute, hour, dom, month, dow).
|
|
@@ -292,14 +269,6 @@ Thrown when a transition is not allowed from the current state.
|
|
|
292
269
|
|
|
293
270
|
Thrown when the state machine definition is internally inconsistent.
|
|
294
271
|
|
|
295
|
-
## steps
|
|
296
|
-
|
|
297
|
-
Step graphs over a job queue: results recorded by their inputs, only missing steps run.
|
|
298
|
-
|
|
299
|
-
### `steps.define`
|
|
300
|
-
|
|
301
|
-
Defines a graph of named steps over a jobs Queue. Pass it to `createWorkerSurface({ graphs })` to run its steps.
|
|
302
|
-
|
|
303
272
|
## auth — Authentication
|
|
304
273
|
|
|
305
274
|
Authentication namespace — session management, multi-org support, auth chain resolution.
|
|
@@ -320,10 +289,6 @@ Hashes and verifies passwords with scrypt; reports when a stored hash needs reha
|
|
|
320
289
|
|
|
321
290
|
Guarded password sign-in that slows, then refuses, repeated failures per account and per client.
|
|
322
291
|
|
|
323
|
-
### `auth.emailLinks`
|
|
324
|
-
|
|
325
|
-
Emailed single-use links that prove control of an address: password reset and address verification; the token is never stored.
|
|
326
|
-
|
|
327
292
|
### `auth.runChain`
|
|
328
293
|
|
|
329
294
|
Executes an auth chain (strategy pipeline) to resolve auth + tenant from a request.
|
|
@@ -358,7 +323,7 @@ interface AuthContext
|
|
|
358
323
|
interface AuthStrategy<TAuth>
|
|
359
324
|
```
|
|
360
325
|
|
|
361
|
-
**`AuthRequest`** — Normalized request shape passed to auth strategies — headers,
|
|
326
|
+
**`AuthRequest`** — Normalized request shape passed to auth strategies — headers, cookies, method, url.
|
|
362
327
|
|
|
363
328
|
```typescript
|
|
364
329
|
interface AuthRequest
|
|
@@ -388,18 +353,6 @@ interface TenantResolver<TAuth>
|
|
|
388
353
|
interface AuthChainConfig<TAuth>
|
|
389
354
|
```
|
|
390
355
|
|
|
391
|
-
**`SessionAuth`** — What `sessions.strategy()` authenticates: the token's user and org, its roles, and where the token came from.
|
|
392
|
-
|
|
393
|
-
```typescript
|
|
394
|
-
type SessionAuth = BaseAuth &
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
**`SessionStrategyOptions`** — Options for `sessions.strategy()`.
|
|
398
|
-
|
|
399
|
-
```typescript
|
|
400
|
-
interface SessionStrategyOptions
|
|
401
|
-
```
|
|
402
|
-
|
|
403
356
|
**`SessionConfig`** — Session configuration — signing keys, issuer, audience, token TTLs, refresh rotation.
|
|
404
357
|
|
|
405
358
|
```typescript
|
|
@@ -671,10 +624,6 @@ Base error class with code, statusCode, and suggestion fields.
|
|
|
671
624
|
|
|
672
625
|
403 — authenticated but insufficient permissions.
|
|
673
626
|
|
|
674
|
-
### `errors.CrossSiteRequest`
|
|
675
|
-
|
|
676
|
-
403 `CROSS_SITE_REQUEST` — a cookie-authenticated write that did not come from the app's own site.
|
|
677
|
-
|
|
678
627
|
### `errors.Validation`
|
|
679
628
|
|
|
680
629
|
422 — input validation failed, carries field-level details.
|
|
@@ -695,17 +644,13 @@ Base error class with code, statusCode, and suggestion fields.
|
|
|
695
644
|
|
|
696
645
|
415 — request body media type not accepted by the route.
|
|
697
646
|
|
|
698
|
-
### `errors.MalformedMultipart`
|
|
699
|
-
|
|
700
|
-
400 `MALFORMED_MULTIPART` — a multipart body that cannot be parsed or ends before its closing boundary.
|
|
701
|
-
|
|
702
647
|
## lifecycle — Startup & Shutdown
|
|
703
648
|
|
|
704
649
|
Application lifecycle namespace — startup orchestration with hooks and timeouts.
|
|
705
650
|
|
|
706
651
|
### `lifecycle.orchestrate`
|
|
707
652
|
|
|
708
|
-
Runs pre-start hooks (DB readiness checks, migrations, etc.) with a configurable timeout.
|
|
653
|
+
Runs pre-start hooks (DB readiness checks, migrations, etc.) with a configurable timeout.
|
|
709
654
|
|
|
710
655
|
## log — Structured Logging
|
|
711
656
|
|
|
@@ -745,7 +690,7 @@ Creates a worker surface — a long-running process that claims and executes job
|
|
|
745
690
|
|
|
746
691
|
### `surface.script`
|
|
747
692
|
|
|
748
|
-
Creates a script surface — a one-shot process that runs and exits (migrations, seeds, CLI tools).
|
|
693
|
+
Creates a script surface — a one-shot process that runs and exits (migrations, seeds, CLI tools).
|
|
749
694
|
|
|
750
695
|
## pipe — Database
|
|
751
696
|
|
|
@@ -842,7 +787,7 @@ Pipework-owned UPDATE builder — the only consumer-facing way to update pipewor
|
|
|
842
787
|
|
|
843
788
|
### `pipe.insert`
|
|
844
789
|
|
|
845
|
-
Pipework-owned INSERT builder — the only consumer-facing way to insert into pipework-managed tables (Q8).
|
|
790
|
+
Pipework-owned INSERT builder — the only consumer-facing way to insert into pipework-managed tables (Q8).
|
|
846
791
|
|
|
847
792
|
### `pipe.delete`
|
|
848
793
|
|
|
@@ -850,7 +795,7 @@ Pipework-owned DELETE builder — the only consumer-facing way to delete from pi
|
|
|
850
795
|
|
|
851
796
|
### `pipe.upsert`
|
|
852
797
|
|
|
853
|
-
Pipework-owned UPSERT builder — insert with conflict resolution (Q8).
|
|
798
|
+
Pipework-owned UPSERT builder — insert with conflict resolution (Q8).
|
|
854
799
|
|
|
855
800
|
### Types
|
|
856
801
|
|
|
@@ -1002,14 +947,6 @@ Query all versions of temporal records (no date filter).
|
|
|
1002
947
|
|
|
1003
948
|
Close the current version and create a new one with updated data.
|
|
1004
949
|
|
|
1005
|
-
### `temporal.setVersion`
|
|
1006
|
-
|
|
1007
|
-
Append the next version of an append-only-versions definition: serialised per scope, numbered, never back-dated, audited.
|
|
1008
|
-
|
|
1009
|
-
### `temporal.versionAt`
|
|
1010
|
-
|
|
1011
|
-
The version in force at a moment: the row with the greatest effectiveFrom at or before it.
|
|
1012
|
-
|
|
1013
950
|
## valve
|
|
1014
951
|
|
|
1015
952
|
Valve namespace — typed, directional, gated boundaries between code silos.
|
|
@@ -1192,18 +1129,6 @@ Alerts namespace — raise and resolve keyed conditions, grouped, delivered to s
|
|
|
1192
1129
|
|
|
1193
1130
|
Creates an alerts handle.
|
|
1194
1131
|
|
|
1195
|
-
### `alerts.http`
|
|
1196
|
-
|
|
1197
|
-
Routes for an operations agent: list, get, totals, delivery health, acknowledge, resolve, link; bearer credentials.
|
|
1198
|
-
|
|
1199
|
-
### `alerts.clientFaults`
|
|
1200
|
-
|
|
1201
|
-
One POST route that records failures reported by browser code as a trace step and an alert; answers 204, no session needed. Send with `reportClientFault` from `pipework/client`.
|
|
1202
|
-
|
|
1203
|
-
### `alerts.requestFaults`
|
|
1204
|
-
|
|
1205
|
-
An `onInternalError` hook for the HTTP server: raises `request-fault:<METHOD> <route>` for each internal 500.
|
|
1206
|
-
|
|
1207
1132
|
### `alerts.webhook`
|
|
1208
1133
|
|
|
1209
1134
|
A sink that POSTs the alert as signed JSON to a URL.
|
|
@@ -1236,10 +1161,6 @@ The newest record's `{ seq, hash }` in the tenant's audit hash chain (blueprint
|
|
|
1236
1161
|
|
|
1237
1162
|
Walks the tenant's audit hash chain and reports the first break (hash-mismatch, prev-mismatch, missing, head-mismatch, anchor-mismatch), or `{ ok: true }`.
|
|
1238
1163
|
|
|
1239
|
-
### `audit.removeTenant`
|
|
1240
|
-
|
|
1241
|
-
Deletes every audit record of one tenant and its hash chain, for the closure of that tenant's account. Irreversible; returns the number of records removed. Other tenants' records and chains are untouched.
|
|
1242
|
-
|
|
1243
1164
|
## cache — Caching
|
|
1244
1165
|
|
|
1245
1166
|
In-memory caching namespace — TTL-based with stats, preload, and tenant-aware variants.
|
|
@@ -1292,36 +1213,6 @@ Inbound source: SES receipt rule storing raw messages in S3 and notifying a sign
|
|
|
1292
1213
|
|
|
1293
1214
|
Inbound development source: `.eml` files dropped in a folder, received by `scan()`; refused in production.
|
|
1294
1215
|
|
|
1295
|
-
## untrustedFetch
|
|
1296
|
-
|
|
1297
|
-
Untrusted fetch — fetch one URL a stranger gave without letting them reach the app's private network.
|
|
1298
|
-
|
|
1299
|
-
### `untrustedFetch.get`
|
|
1300
|
-
|
|
1301
|
-
Fetches `url` with GET and returns `{ ok: true, url, status, contentType, body, bytes }`, or `{ ok: false, reason, message }`
|
|
1302
|
-
naming the rule that refused: `scheme`, `address`, `redirects`, `too_large`, `timeout`, `status`, `rejected` or `network`.
|
|
1303
|
-
It does not throw for these.
|
|
1304
|
-
|
|
1305
|
-
Rules, none of which can be switched off: only `http:` and `https:`; the name is resolved and every address is checked
|
|
1306
|
-
(loopback, private, link-local including cloud metadata, CGNAT, unique-local and site-local IPv6, multicast, reserved,
|
|
1307
|
-
unspecified, and IPv4-mapped or NAT64 forms of these; literal IP URLs likewise) and the connection goes to a checked
|
|
1308
|
-
address; redirects are followed up to `maxRedirects` and each hop is checked as the first, and the app's `headers` go only to the first origin;
|
|
1309
|
-
the body is stopped the moment it passes `maxBytes`, whatever Content-Length says; `timeoutMs` covers the whole fetch.
|
|
1310
|
-
`accept({ status, contentType, firstBytes })` sees the first 1024 bytes before the body is kept: return false, or a string
|
|
1311
|
-
(your own message), to refuse with `rejected`. Messages never contain an address or anything a server sent.
|
|
1312
|
-
|
|
1313
|
-
`resolve` and `connect` are for tests: `resolve(hostname)` replaces DNS and `connect(target)` replaces the socket after the
|
|
1314
|
-
address check passed, so a test sends a fake public address to a local server. The address check always runs on what `resolve` returns.
|
|
1315
|
-
|
|
1316
|
-
The call is the trace step `pipework/fetch:get`; its child `pipework/fetch:outcome` carries host, status, bytes and reason.
|
|
1317
|
-
The full URL is recorded only when `urlIsSafeToTrace` is true; otherwise only the host.
|
|
1318
|
-
|
|
1319
|
-
```ts
|
|
1320
|
-
const got = await untrustedFetch.get(pasted, { maxBytes: 5_000_000, timeoutMs: 10_000, maxRedirects: 3,
|
|
1321
|
-
accept: h => h.firstBytes[0] === 0x25 || 'That does not look like a PDF.' })
|
|
1322
|
-
if (!got.ok) return tell(got.message)
|
|
1323
|
-
```
|
|
1324
|
-
|
|
1325
1216
|
## storage
|
|
1326
1217
|
|
|
1327
1218
|
Storage namespace — tenant-scoped, content-addressed file storage with signed URLs and retention.
|
|
@@ -1338,18 +1229,6 @@ S3-compatible backend (AWS S3, MinIO, R2): SigV4 over `fetch`, multipart streami
|
|
|
1338
1229
|
|
|
1339
1230
|
Local-disk backend for development and tests; refused in production.
|
|
1340
1231
|
|
|
1341
|
-
## support
|
|
1342
|
-
|
|
1343
|
-
Support namespace — tickets from email (and later chat), with replies sent only after an approval.
|
|
1344
|
-
|
|
1345
|
-
### `support.create`
|
|
1346
|
-
|
|
1347
|
-
Creates the support handle: tickets, messages, notes, links, drafts, `approve`, `receiveEmail`, and the events job.
|
|
1348
|
-
|
|
1349
|
-
### `support.templates`
|
|
1350
|
-
|
|
1351
|
-
The reply template to spread into `mail.create({ templates })`; it renders the approved draft verbatim.
|
|
1352
|
-
|
|
1353
1232
|
## webhook — Inbound & Outbound Webhooks
|
|
1354
1233
|
|
|
1355
1234
|
Webhook namespace — inbound verification, outbound delivery with retries, HMAC signing.
|
|
@@ -1440,10 +1319,6 @@ Returns the current Flow or undefined — use for optional context detection.
|
|
|
1440
1319
|
|
|
1441
1320
|
Creates a Flow for test isolation with optional auth and tenant overrides.
|
|
1442
1321
|
|
|
1443
|
-
### `flow.actAs`
|
|
1444
|
-
|
|
1445
|
-
Runs `fn` as a tenant and user chosen inside a tenantless Flow (sign-up, a public sign-in): RLS, audit and trace under that tenant, on the request's transaction.
|
|
1446
|
-
|
|
1447
1322
|
## http — Server
|
|
1448
1323
|
|
|
1449
1324
|
HTTP namespace: `http.file()` builds a file response; the server itself is managed by manifold.start().
|
|
@@ -1468,36 +1343,6 @@ interface SecurityConfig
|
|
|
1468
1343
|
interface RateLimitConfig
|
|
1469
1344
|
```
|
|
1470
1345
|
|
|
1471
|
-
**`RateLimitWindow`** — One fixed window: at most `max` requests per `windowSeconds`.
|
|
1472
|
-
|
|
1473
|
-
```typescript
|
|
1474
|
-
interface RateLimitWindow
|
|
1475
|
-
```
|
|
1476
|
-
|
|
1477
|
-
**`RateLimitClass`** — A named limit class: any of a per-user, per-tenant and per-address window, each counted on its own.
|
|
1478
|
-
|
|
1479
|
-
```typescript
|
|
1480
|
-
interface RateLimitClass
|
|
1481
|
-
```
|
|
1482
|
-
|
|
1483
|
-
**`RateLimitRefusal`** — What `onRefused` is told about one refused window of one request.
|
|
1484
|
-
|
|
1485
|
-
```typescript
|
|
1486
|
-
interface RateLimitRefusal
|
|
1487
|
-
```
|
|
1488
|
-
|
|
1489
|
-
**`RateLimitClassesConfig`**
|
|
1490
|
-
|
|
1491
|
-
Named limit classes, checked after auth and counted in Postgres (`pipework_rate_limit_counts`, opted in
|
|
1492
|
-
with the blueprint's `rateLimits: {}`), so every server process on the same database shares one count.
|
|
1493
|
-
Windows are counted perUser, perTenant, perAddress in turn, up to the first one over its max, so one user's
|
|
1494
|
-
refused requests don't spend the tenant's budget. A route is in `signedIn` (auth required, or optional with
|
|
1495
|
-
a user), `public` (no auth, or optional without a user) or the class its fitting names with `.rateLimit(name)`.
|
|
1496
|
-
|
|
1497
|
-
```typescript
|
|
1498
|
-
interface RateLimitClassesConfig
|
|
1499
|
-
```
|
|
1500
|
-
|
|
1501
1346
|
**`InjectOptions`** — Options for server.inject() — method, url, headers, payload for testing without HTTP.
|
|
1502
1347
|
|
|
1503
1348
|
```typescript
|
|
@@ -1516,12 +1361,6 @@ interface InjectResponse
|
|
|
1516
1361
|
interface ServerConfig
|
|
1517
1362
|
```
|
|
1518
1363
|
|
|
1519
|
-
**`InternalErrorFault`** — What `onInternalError` is told about one request that ended in an internal error.
|
|
1520
|
-
|
|
1521
|
-
```typescript
|
|
1522
|
-
interface InternalErrorFault
|
|
1523
|
-
```
|
|
1524
|
-
|
|
1525
1364
|
**`HandlerResponse`** — Standard handler response shape — statusCode, headers, body.
|
|
1526
1365
|
|
|
1527
1366
|
```typescript
|
|
@@ -1580,7 +1419,7 @@ Generates an OpenAPI 3.1 document from route registrations — schemas derived f
|
|
|
1580
1419
|
|
|
1581
1420
|
## trace
|
|
1582
1421
|
|
|
1583
|
-
Trace namespace — hand the current trace to a process outside Node
|
|
1422
|
+
Trace namespace — hand the current trace to a process outside Node and record the steps it reports back.
|
|
1584
1423
|
|
|
1585
1424
|
### `trace.traceparent`
|
|
1586
1425
|
|
|
@@ -1594,15 +1433,6 @@ W3C `traceparent` for the current trace and open step; `null` outside a traced f
|
|
|
1594
1433
|
|
|
1595
1434
|
Records steps reported as JSON lines (or objects) by an outside process under the step open now. Synchronous; never throws.
|
|
1596
1435
|
|
|
1597
|
-
### `trace.event`
|
|
1598
|
-
|
|
1599
|
-
Records one zero-length step `external:<name>` under the step open now, with an optional `capture` and `error`. A no-op outside a traced flow; never throws.
|
|
1600
|
-
|
|
1601
|
-
### `trace.tree`
|
|
1602
|
-
|
|
1603
|
-
Reads every hot trace sharing `rootId` (a request's trace and the jobs it queued) with their steps. Runs on the
|
|
1604
|
-
given `db`, so tenant policies apply: only an unrestricted connection (table owner, tests) sees every tenant's rows.
|
|
1605
|
-
|
|
1606
1436
|
### Types
|
|
1607
1437
|
|
|
1608
1438
|
**`FlowStepMeta`** — Trace metadata for one documented flow-step: its `path:symbol` graph node id and the per-argument capture projections.
|
|
@@ -1623,24 +1453,6 @@ type ExternalStepReport = z.infer<typeof externalStepReportSchema>
|
|
|
1623
1453
|
interface ExternalRecordResult
|
|
1624
1454
|
```
|
|
1625
1455
|
|
|
1626
|
-
**`TraceStepNode`** — One step of a trace. `ref` is the flow step's `path:symbol`, or `external:<name>` for a recorded or point-event step.
|
|
1627
|
-
|
|
1628
|
-
```typescript
|
|
1629
|
-
interface TraceStepNode
|
|
1630
|
-
```
|
|
1631
|
-
|
|
1632
|
-
**`TraceNode`** — One trace of the tree, with its steps ordered by `seq`.
|
|
1633
|
-
|
|
1634
|
-
```typescript
|
|
1635
|
-
interface TraceNode
|
|
1636
|
-
```
|
|
1637
|
-
|
|
1638
|
-
**`TraceTree`** — The traces that share a root id, ordered by when they opened.
|
|
1639
|
-
|
|
1640
|
-
```typescript
|
|
1641
|
-
interface TraceTree
|
|
1642
|
-
```
|
|
1643
|
-
|
|
1644
1456
|
## data
|
|
1645
1457
|
|
|
1646
1458
|
### `tap`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ResolvedDoor } from '../../core/config/load.js';
|
|
2
|
+
/** The framework door a tenant-column queue table's claim, reap, heartbeat and complete run through. */
|
|
3
|
+
export declare function queueDoorName(table: string): string;
|
|
4
|
+
/** A queue only selects and updates its rows: it never deletes one. */
|
|
5
|
+
export declare function queueFrameworkDoor(table: string, database: string): ResolvedDoor;
|
|
6
|
+
/**
|
|
7
|
+
* The queue doors pipework declares: one per registered queue table with a
|
|
8
|
+
* tenant column, where the default database sets `rls.platformRole`. Queue
|
|
9
|
+
* tables register when a worker surface or graph is constructed, so ask after
|
|
10
|
+
* the app's modules are loaded.
|
|
11
|
+
*/
|
|
12
|
+
export declare function queueFrameworkDoors(config: {
|
|
13
|
+
defaultDatabaseName(): string;
|
|
14
|
+
database(name?: string): {
|
|
15
|
+
readonly rls?: {
|
|
16
|
+
readonly platformRole?: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
};
|
|
19
|
+
}): Record<string, ResolvedDoor>;
|
|
20
|
+
//# sourceMappingURL=queue-door.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-door.d.ts","sourceRoot":"","sources":["../../../src/async/jobs/queue-door.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAI7D,wGAAwG;AACxG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CAMhF;AAKD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,mBAAmB,IAAI,MAAM,CAAA;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,GAAG,CAAC,EAAE;YAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,SAAS,CAAA;KAAE,CAAA;CAC3F,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAa/B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { queueDefinitions } from './table.js';
|
|
2
|
+
/** The framework door a tenant-column queue table's claim, reap, heartbeat and complete run through. */
|
|
3
|
+
export function queueDoorName(table) {
|
|
4
|
+
return `pipework.queue.${table}`;
|
|
5
|
+
}
|
|
6
|
+
/** A queue only selects and updates its rows: it never deletes one. */
|
|
7
|
+
export function queueFrameworkDoor(table, database) {
|
|
8
|
+
return Object.freeze({
|
|
9
|
+
name: queueDoorName(table), table, database,
|
|
10
|
+
reason: 'the queue claims, reaps and completes jobs across tenants',
|
|
11
|
+
framework: true, ops: ['select', 'update'],
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
const hasTenant = (definition) => Object.values(definition.$fields).some(field => field._meta.tenant === true);
|
|
15
|
+
/**
|
|
16
|
+
* The queue doors pipework declares: one per registered queue table with a
|
|
17
|
+
* tenant column, where the default database sets `rls.platformRole`. Queue
|
|
18
|
+
* tables register when a worker surface or graph is constructed, so ask after
|
|
19
|
+
* the app's modules are loaded.
|
|
20
|
+
*/
|
|
21
|
+
export function queueFrameworkDoors(config) {
|
|
22
|
+
const out = {};
|
|
23
|
+
let database;
|
|
24
|
+
try {
|
|
25
|
+
database = config.defaultDatabaseName();
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
if (config.database(database).rls?.platformRole === undefined)
|
|
31
|
+
return out;
|
|
32
|
+
for (const [table, definition] of queueDefinitions()) {
|
|
33
|
+
if (hasTenant(definition))
|
|
34
|
+
out[queueDoorName(table)] = queueFrameworkDoor(table, database);
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=queue-door.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-door.js","sourceRoot":"","sources":["../../../src/async/jobs/queue-door.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,wGAAwG;AACxG,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,kBAAkB,KAAK,EAAE,CAAA;AAClC,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,kBAAkB,CAAC,KAAa,EAAE,QAAgB;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ;QAC3C,MAAM,EAAE,2DAA2D;QACnE,SAAS,EAAE,IAAa,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAU;KAC7D,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,UAAwB,EAAW,EAAE,CACtD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,CAAA;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAGnC;IACC,MAAM,GAAG,GAAiC,EAAE,CAAA;IAC5C,IAAI,QAAgB,CAAA;IACpB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,CAAC,mBAAmB,EAAE,CAAA;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,YAAY,KAAK,SAAS;QAAE,OAAO,GAAG,CAAA;IACzE,KAAK,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,gBAAgB,EAAE,EAAE,CAAC;QACrD,IAAI,SAAS,CAAC,UAAU,CAAC;YAAE,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC5F,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -141,6 +141,11 @@ export interface QueueTotals {
|
|
|
141
141
|
export interface Queue {
|
|
142
142
|
/** The queue table as a pipe.define() definition — `pipework generate` emits its DDL. */
|
|
143
143
|
readonly definition: DefinedTable;
|
|
144
|
+
/**
|
|
145
|
+
* The framework door (`pipework.queue.<table>`) that claim, reap, heartbeat and complete need on a platform-mode
|
|
146
|
+
* database; null when the queue has no `exclusion.tenantColumn`, whose table is not row-secured by tenant.
|
|
147
|
+
*/
|
|
148
|
+
readonly door: string | null;
|
|
144
149
|
enqueue(db: DB, opts: EnqueueOptions): Promise<string>;
|
|
145
150
|
/** Claims the next eligible job (of one of `types`, when given), retrying transient conflicts until clean. The signal ends the retry loop on shutdown — claim resolves null promptly. */
|
|
146
151
|
claim(db: DB, workerId: string, signal?: AbortSignal, types?: readonly string[], release?: string | null): Promise<ClaimedJob | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/async/jobs/queue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAO,MAAM,wBAAwB,CAAA;AAGrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/async/jobs/queue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAO,MAAM,wBAAwB,CAAA;AAGrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU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AQ,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IACxF,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnD,+HAA+H;IAC/H,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,YAAY,EAAE,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACrG,oIAAoI;IACpI,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACnD,gJAAgJ;IAChJ,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACnE,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAClD,aAAa,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;IAC9C,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACrD,aAAa,IAAI,IAAI,CAAA;CACtB;AA6BD,wBAAgB,WAAW,CAAC,MAAM,GAAE,WAAgB,GAAG,KAAK,CAshB3D"}
|
package/dist/async/jobs/queue.js
CHANGED
|
@@ -8,6 +8,7 @@ import { resolveExclusion, exclusionClaimClause } from './exclusion.js';
|
|
|
8
8
|
import { openClaim, closeClaim, parseClaims } from './claims.js';
|
|
9
9
|
import { serializeError } from './serialize-error.js';
|
|
10
10
|
import { queueDefinition, registerProgressColumn } from './table.js';
|
|
11
|
+
import { queueDoorName } from './queue-door.js';
|
|
11
12
|
import { getContext } from '../../request/context/store.js';
|
|
12
13
|
import { resolveActorId } from '../../data/write/audit/actor.js';
|
|
13
14
|
import { getBaseLogger } from '../../core/logging/index.js';
|
|
@@ -469,6 +470,7 @@ export function createQueue(config = {}) {
|
|
|
469
470
|
const sched = createScheduler({ enqueue }, tableQ);
|
|
470
471
|
return {
|
|
471
472
|
definition,
|
|
473
|
+
door: exclusion?.tenantColumn !== undefined ? queueDoorName(table) : null,
|
|
472
474
|
onDeadLetter(listener) {
|
|
473
475
|
deadLetterListeners.add(listener);
|
|
474
476
|
return () => { deadLetterListeners.delete(listener); };
|