@pgxsinkit/server 0.2.7 → 0.3.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/README.md +7 -4
- package/dist/circuits/compile.d.ts +66 -0
- package/dist/circuits/compile.d.ts.map +1 -0
- package/dist/circuits/edge.d.ts +188 -0
- package/dist/circuits/edge.d.ts.map +1 -0
- package/dist/circuits/engine-client.d.ts +111 -0
- package/dist/circuits/engine-client.d.ts.map +1 -0
- package/dist/circuits/index.d.ts +7 -0
- package/dist/circuits/index.d.ts.map +1 -0
- package/dist/circuits/stream-token.d.ts +138 -0
- package/dist/circuits/stream-token.d.ts.map +1 -0
- package/dist/circuits/subscribe.d.ts +280 -0
- package/dist/circuits/subscribe.d.ts.map +1 -0
- package/dist/circuits/wire.d.ts +70 -0
- package/dist/circuits/wire.d.ts.map +1 -0
- package/dist/index.d.ts +36 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +801 -286
- package/dist/index.js.map +12 -8
- package/dist/mutations/plpgsql-apply.d.ts +1 -1
- package/package.json +2 -2
- package/skills/deploying/SKILL.md +74 -38
- package/src/circuits/compile.ts +301 -0
- package/src/circuits/edge.ts +386 -0
- package/src/circuits/engine-client.ts +195 -0
- package/src/circuits/index.ts +6 -0
- package/src/circuits/stream-token.ts +224 -0
- package/src/circuits/subscribe.ts +832 -0
- package/src/circuits/wire.ts +71 -0
- package/src/index.ts +136 -31
- package/src/mutations/plpgsql-apply.ts +1 -1
- package/src/router.ts +2 -2
- package/dist/electric-proxy.d.ts +0 -48
- package/dist/electric-proxy.d.ts.map +0 -1
- package/src/electric-proxy.ts +0 -474
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { type JwtClaims, type PredicateValue, type SyncTableRegistry } from "@pgxsinkit/contracts";
|
|
2
|
+
import { type EntitlementSet } from "./edge";
|
|
3
|
+
import { type CircuitsEngineClient } from "./engine-client";
|
|
4
|
+
import { type StreamGrant } from "./stream-token";
|
|
5
|
+
/**
|
|
6
|
+
* One shape a client wants to follow.
|
|
7
|
+
*
|
|
8
|
+
* A shape KEY and nothing else — deliberately (ADR-0055 decision 6). A shared-tier shape fans out to
|
|
9
|
+
* one stream per scope the subject holds, and the control plane does that expansion because it is
|
|
10
|
+
* the only side that knows the answer: it holds the entitlement set. A client naming its own scopes
|
|
11
|
+
* could only ever restate that set redundantly or contradict it, and every contradiction is a
|
|
12
|
+
* denial it then has to reconcile at boot.
|
|
13
|
+
*/
|
|
14
|
+
export interface SubscriptionRequest {
|
|
15
|
+
shapeKey: string;
|
|
16
|
+
}
|
|
17
|
+
/** A subscription the control plane granted: what to read, and where. */
|
|
18
|
+
export interface GrantedSubscription {
|
|
19
|
+
shapeKey: string;
|
|
20
|
+
scope?: readonly PredicateValue[];
|
|
21
|
+
shapeId: string;
|
|
22
|
+
/** The durable-streams path, which is what the client follows through the edge. */
|
|
23
|
+
streamPath: string;
|
|
24
|
+
}
|
|
25
|
+
/** A subscription the control plane declined, with why. */
|
|
26
|
+
export interface DeniedSubscription {
|
|
27
|
+
shapeKey: string;
|
|
28
|
+
scope?: readonly PredicateValue[];
|
|
29
|
+
reason: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SubscribeResult {
|
|
32
|
+
/** The stream token covering every granted subscription. Absent when nothing was granted. */
|
|
33
|
+
token?: string;
|
|
34
|
+
/** Seconds since the epoch. The client re-mints before this, in one request for the whole batch. */
|
|
35
|
+
expiresAt?: number;
|
|
36
|
+
granted: GrantedSubscription[];
|
|
37
|
+
denied: DeniedSubscription[];
|
|
38
|
+
}
|
|
39
|
+
export interface SubscribeOptions {
|
|
40
|
+
registry: SyncTableRegistry;
|
|
41
|
+
engine: CircuitsEngineClient;
|
|
42
|
+
/**
|
|
43
|
+
* The live entitlement set backing the SHARED tier.
|
|
44
|
+
*
|
|
45
|
+
* Optional, because a registry with no shared-tier shape has nothing to ask it. Omitting it is a
|
|
46
|
+
* statement that this deployment has none: a shared-tier subscription is then refused with that
|
|
47
|
+
* reason rather than silently permitted, so adding the first shared shape fails loudly instead of
|
|
48
|
+
* serving one subject's rows to everyone.
|
|
49
|
+
*/
|
|
50
|
+
entitlements?: EntitlementSet;
|
|
51
|
+
/** The stream-token signing key, shared with the edge — the same process holds both. */
|
|
52
|
+
key: CryptoKey;
|
|
53
|
+
/** Per-deployment override of ADR-0055's 5-minute default. */
|
|
54
|
+
ttlSeconds?: number;
|
|
55
|
+
/** Deployment-supplied runtime params, handed to `rowFilter.customPredicate` as its second argument. */
|
|
56
|
+
params?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The engine's subscription lease is shorter than this deployment's token TTL — a **configuration**
|
|
60
|
+
* fault, not a request one.
|
|
61
|
+
*
|
|
62
|
+
* The control plane renews every live claim on exactly one cadence: the token re-mint, which the
|
|
63
|
+
* client drives at `expiresAt - skew` and which therefore lands at most `ttlSeconds` apart. The
|
|
64
|
+
* engine releases a claim not renewed within `leaseSeconds` (`ELECTRIC_CIRCUITS_SHAPE_IDLE_SECS`).
|
|
65
|
+
* So a deployment whose lease window is under two TTLs has no margin at all: one refresh delayed by a
|
|
66
|
+
* retry, a redeploy, or a sleeping tab, and a live session's shape goes dormant underneath it. The
|
|
67
|
+
* factor of two is the margin for exactly one missed refresh.
|
|
68
|
+
*
|
|
69
|
+
* Refused loudly rather than papered over, because both numbers are the operator's and neither the
|
|
70
|
+
* subject nor the client can do anything about either. The routes answer 503 — "this deployment, not
|
|
71
|
+
* you" — and never a denial: a client told it lost entitlement truncates its rows.
|
|
72
|
+
*/
|
|
73
|
+
export declare class CircuitsLeaseConfigError extends Error {
|
|
74
|
+
/** The engine's `ELECTRIC_CIRCUITS_SHAPE_IDLE_SECS`, as the create response reported it. */
|
|
75
|
+
readonly leaseSeconds: number;
|
|
76
|
+
/** The stream-token TTL this control plane is configured with. */
|
|
77
|
+
readonly ttlSeconds: number;
|
|
78
|
+
constructor(leaseSeconds: number, ttlSeconds: number);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Subscribe to a batch of shapes: compile each against the registry, check entitlement, register it
|
|
82
|
+
* with the engine, and mint ONE token covering all of them.
|
|
83
|
+
*
|
|
84
|
+
* A shared-tier shape FANS OUT: one stream per scope the subject holds, so K requested shapes yield
|
|
85
|
+
* however many grants their entitlements come to. Expansion happens here rather than on the client
|
|
86
|
+
* because this is the side holding the entitlement set — see {@link SubscriptionRequest}.
|
|
87
|
+
*
|
|
88
|
+
* A partial result rather than an all-or-nothing one. A subject holding K scopes at boot may
|
|
89
|
+
* legitimately have lost one of them, and failing the whole batch on that would deny them the K-1
|
|
90
|
+
* they still hold — so a denial is reported per subscription and the rest proceed.
|
|
91
|
+
*
|
|
92
|
+
* That partiality covers AUTHORIZATION only. An engine that cannot answer — degraded, unreachable —
|
|
93
|
+
* is not a denial and must never be reported as one: a client told "not entitled" truncates that
|
|
94
|
+
* scope and unsubscribes, so reporting an outage that way would turn a transient engine fault into
|
|
95
|
+
* client-side data loss. Engine failures propagate, and the route answers 503.
|
|
96
|
+
*
|
|
97
|
+
* An entitlement set that is not `ready` joins it. It is the same shape of failure — a dependency
|
|
98
|
+
* that cannot answer right now — and the client's response to a denial is the same clear, so it
|
|
99
|
+
* propagates as {@link EntitlementsUnavailableError} and the route answers 503 too. What stays a
|
|
100
|
+
* denial is the set being absent altogether: that is a deployment's permanent configuration.
|
|
101
|
+
*
|
|
102
|
+
* Entitlement is checked HERE as well as at the edge, and the duplication is deliberate: this is
|
|
103
|
+
* what stops a shape being created and a capability minted for a scope the subject never held. The
|
|
104
|
+
* edge's check bounds how long an already-minted one keeps working.
|
|
105
|
+
*/
|
|
106
|
+
export declare function subscribeToShapes(options: SubscribeOptions, claims: JwtClaims | null, requests: readonly SubscriptionRequest[], now: number): Promise<SubscribeResult>;
|
|
107
|
+
/**
|
|
108
|
+
* The subscribe route: verified claims in, a token and stream paths out.
|
|
109
|
+
*
|
|
110
|
+
* Deliberately a POST that returns paths rather than a redirect to them. The client needs the whole
|
|
111
|
+
* batch to open K long-polls and to know when to re-mint, and a redirect would give it one stream
|
|
112
|
+
* and no expiry.
|
|
113
|
+
*/
|
|
114
|
+
export declare function createSubscribeHandler(options: SubscribeOptions & {
|
|
115
|
+
resolveAuthClaims?: (request: Request) => Promise<JwtClaims | null> | JwtClaims | null;
|
|
116
|
+
}): (request: Request) => Promise<Response>;
|
|
117
|
+
export interface RefreshResult {
|
|
118
|
+
token?: string;
|
|
119
|
+
expiresAt?: number;
|
|
120
|
+
/** Grants that survived re-authorization — see {@link refreshStreamToken} for what that is per tier. */
|
|
121
|
+
granted: StreamGrant[];
|
|
122
|
+
/**
|
|
123
|
+
* Grants the subject may no longer read as granted: a shared scope they have lost, or a private
|
|
124
|
+
* shape their current claims no longer compile to. The client truncates each and unsubscribes,
|
|
125
|
+
* then re-subscribes for whatever it is entitled to now.
|
|
126
|
+
*/
|
|
127
|
+
revoked: DeniedSubscription[];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Re-mint a stream token from an existing one (ADR-0055 decision 6).
|
|
131
|
+
*
|
|
132
|
+
* The expiring token IS the request: its signature proves this control plane issued those grants, so
|
|
133
|
+
* nothing has to be stored server-side to know what the subject held, and the edge stays stateless on
|
|
134
|
+
* both halves. Expiry is deliberately not enforced here — a token is presented for re-mint precisely
|
|
135
|
+
* because it is at or past its TTL — but the signature is, and **every grant is re-authorized**.
|
|
136
|
+
* That re-check is what makes the TTL a revocation bound rather than a formality.
|
|
137
|
+
*
|
|
138
|
+
* BOTH TIERS are re-authorized, by the question each tier's authorization actually turns on.
|
|
139
|
+
*
|
|
140
|
+
* - Shared: the live entitlement set. Its predicate is generated from the scope values, so it cannot
|
|
141
|
+
* drift with the subject; what can change is whether the subject still holds the scope.
|
|
142
|
+
* - Private: **recompile the shape with the subject's CURRENT claims** and compare the fingerprint
|
|
143
|
+
* the grant carries. A private predicate may read ANY verified claim, not only `sub`, so a subject
|
|
144
|
+
* demoted mid-session — a role dropped, a tenant changed — is still the same authenticated subject
|
|
145
|
+
* and would sail through a check that only re-verified the JWT. Re-verifying the JWT proves the
|
|
146
|
+
* bearer is still who they were; it says nothing about whether the shape they hold is still the
|
|
147
|
+
* shape their claims compile to, and only recompiling answers that.
|
|
148
|
+
*
|
|
149
|
+
* A fingerprint mismatch is a REVOCATION by design, including when the recompiled predicate would
|
|
150
|
+
* still permit the subject something. The grant names one stream, that stream serves the old
|
|
151
|
+
* predicate, and this route may not hand out a new one — the client's re-subscribe is where a new
|
|
152
|
+
* shape is created, and this route is not that. So the grant is revoked, the client re-subscribes, the
|
|
153
|
+
* control plane creates the shape its current claims compile to, and because the handle differs the
|
|
154
|
+
* client re-snapshots through ADR-0056 decision 7's must-refetch.
|
|
155
|
+
*
|
|
156
|
+
* **This is also where every surviving grant's engine claim is RENEWED** (fork ADR-0008). A claim is a
|
|
157
|
+
* lease: the engine releases one not renewed within `leaseSeconds`, because native reads terminate on
|
|
158
|
+
* durable-streams and the renewal is the only liveness signal it has. Renewing here rather than on a
|
|
159
|
+
* timer is what makes the cadence honest — this route already runs once per subject per TTL window and
|
|
160
|
+
* already decides which grants are still authorized, so the renewal covers exactly the grants that
|
|
161
|
+
* survived and costs no extra round trip. A revoked grant is deliberately NOT renewed: its lease
|
|
162
|
+
* lapses and the engine reclaims the shape.
|
|
163
|
+
*
|
|
164
|
+
* The renewal is the same create, repeated with the grant's own `claim` id. Its outcomes are in
|
|
165
|
+
* {@link renewGrantClaim}; a renewal that comes back a different handle, or 409s, revokes the grant
|
|
166
|
+
* with a re-subscribe reason rather than failing the whole re-mint.
|
|
167
|
+
*
|
|
168
|
+
* `registry` is therefore REQUIRED rather than optional: a refresh route that cannot recompile cannot
|
|
169
|
+
* re-authorize the private tier — and now cannot renew either, since the renewal IS the compiled
|
|
170
|
+
* create. `engine` is required for the same reason.
|
|
171
|
+
*
|
|
172
|
+
* Throws {@link EntitlementsUnavailableError} rather than revoking when the set cannot be consulted —
|
|
173
|
+
* the same outage-is-not-a-denial rule {@link subscribeToShapes} follows, and it matters more here:
|
|
174
|
+
* `revoked` is the wire's clear-this-scope instruction, and this route runs every few minutes for
|
|
175
|
+
* the life of every subscription. An engine that cannot answer a renewal joins it, as does a lease
|
|
176
|
+
* window this deployment's TTL does not fit inside ({@link CircuitsLeaseConfigError}).
|
|
177
|
+
*/
|
|
178
|
+
export declare function refreshStreamToken(options: Pick<SubscribeOptions, "registry" | "engine" | "entitlements" | "key" | "ttlSeconds" | "params">, claims: JwtClaims | null, expiringToken: string, now: number): Promise<RefreshResult>;
|
|
179
|
+
/**
|
|
180
|
+
* The re-mint route. Takes the expiring token, answers with a fresh one and the list of grants that
|
|
181
|
+
* did not survive re-authorization — the shared tier's against the live entitlement set, the private
|
|
182
|
+
* tier's against a recompile with the subject's current claims — and **renews the engine claim of
|
|
183
|
+
* every grant that did survive** (fork ADR-0008).
|
|
184
|
+
*
|
|
185
|
+
* `registry` for that recompile and `engine` for that renewal, both required for the reasons
|
|
186
|
+
* {@link refreshStreamToken} gives.
|
|
187
|
+
*
|
|
188
|
+
* 200 even when everything was revoked, for the same reason subscribe answers 200 on a full denial:
|
|
189
|
+
* the per-grant reasons ARE the response, and a client that lost one scope of K needs to know which.
|
|
190
|
+
*/
|
|
191
|
+
export declare function createRefreshHandler(options: Pick<SubscribeOptions, "registry" | "engine" | "entitlements" | "key" | "ttlSeconds" | "params"> & {
|
|
192
|
+
resolveAuthClaims?: (request: Request) => Promise<JwtClaims | null> | JwtClaims | null;
|
|
193
|
+
}): (request: Request) => Promise<Response>;
|
|
194
|
+
/**
|
|
195
|
+
* Give back the engine claims a token's grants acquired — the close half of subscribe.
|
|
196
|
+
*
|
|
197
|
+
* **Why this route exists.** A native `POST /shapes` with a definition the engine already holds does
|
|
198
|
+
* not create a second shape: it JOINS the existing one, under a claim of its own. Live claims are
|
|
199
|
+
* load-bearing rather than bookkeeping — one live claim blocks both dormancy and eviction, precisely
|
|
200
|
+
* because native durable-streams reads bypass the engine entirely, so a claim is the only thing that
|
|
201
|
+
* tells it a reader it cannot see still exists. Without a release, a shape waits out its whole lease
|
|
202
|
+
* window before it can go dormant, every time.
|
|
203
|
+
*
|
|
204
|
+
* **The token IS the request**, exactly as on the re-mint path: its signature proves this control
|
|
205
|
+
* plane minted these grants, so nothing has to be stored server-side to know what was acquired.
|
|
206
|
+
* Verified with `allowExpired`, and that is not a weakening — a session releases at CLOSE, which is
|
|
207
|
+
* routinely past a 5-minute TTL, and expiry bounds how long a grant keeps *working*, not what it
|
|
208
|
+
* proves was issued. A release grants its bearer nothing; the only thing it can do is give away
|
|
209
|
+
* claims that this token's own subject holds.
|
|
210
|
+
*
|
|
211
|
+
* **ONE release per GRANT, deliberately not deduplicated by `shapeId`.** Two grants naming one shape
|
|
212
|
+
* are two joins — the engine deduplicated identical definitions and counted both (ADR-0055 decision
|
|
213
|
+
* 6) — so collapsing them here would return one of two claims and leak the other permanently. Each
|
|
214
|
+
* grant releases its OWN claim (`DELETE /shapes/{id}?subscription=<claim>`), which is what makes one
|
|
215
|
+
* release distinguishable from the other at all.
|
|
216
|
+
*
|
|
217
|
+
* **Idempotent and retry-safe** (fork ADR-0008). A claim is named, so releasing it twice is releasing
|
|
218
|
+
* it once: the second `DELETE` is a no-op `200` and cannot touch another subscriber's claim. That is
|
|
219
|
+
* a change in kind from the anonymous refcount decrement this route was first written against, and it
|
|
220
|
+
* collapses the old asymmetry — a client, a proxy or an operator may repeat a release freely. A
|
|
221
|
+
* release that never arrives at all is not a permanent leak either: the claim is a LEASE, renewed on
|
|
222
|
+
* the token re-mint, so a session that crashed or was unloaded has its claims reclaimed by the engine
|
|
223
|
+
* within `leaseSeconds`. What this route buys is promptness, not correctness.
|
|
224
|
+
*
|
|
225
|
+
* Refusals are refusals, not no-ops: a bad signature or a mismatched subject answers an error rather
|
|
226
|
+
* than `{ released: 0 }`, because a token presented by anyone but its own subject is not a release,
|
|
227
|
+
* it is an attempt to drop the victim's claims.
|
|
228
|
+
*/
|
|
229
|
+
export declare function releaseStreamGrants(options: {
|
|
230
|
+
engine: CircuitsEngineClient;
|
|
231
|
+
key: CryptoKey;
|
|
232
|
+
}, claims: JwtClaims | null, token: string, now: number): Promise<{
|
|
233
|
+
released: number;
|
|
234
|
+
} | {
|
|
235
|
+
refused: string;
|
|
236
|
+
}>;
|
|
237
|
+
/**
|
|
238
|
+
* The release route: the token a session was given, back at its close.
|
|
239
|
+
*
|
|
240
|
+
* **Safe to call more than once.** Every grant releases a NAMED claim, so a repeat is the same act
|
|
241
|
+
* once (fork ADR-0008) — a duplicate close, a proxy retry or an operator replaying a request all
|
|
242
|
+
* answer 200 and change nothing. The client still sends it at most once, but that is now a matter of
|
|
243
|
+
* not making a pointless request rather than of correctness.
|
|
244
|
+
*
|
|
245
|
+
* 403 rather than 200 on a refusal — see {@link releaseStreamGrants} for why a refused release must
|
|
246
|
+
* be visible. 401 when the caller has no subject, the same rule subscribe and re-mint follow: an
|
|
247
|
+
* unauthenticated call is a credential problem, and it is the one thing here a client could fix.
|
|
248
|
+
*/
|
|
249
|
+
export declare function createReleaseHandler(options: {
|
|
250
|
+
engine: CircuitsEngineClient;
|
|
251
|
+
key: CryptoKey;
|
|
252
|
+
} & {
|
|
253
|
+
resolveAuthClaims?: (request: Request) => Promise<JwtClaims | null> | JwtClaims | null;
|
|
254
|
+
}): (request: Request) => Promise<Response>;
|
|
255
|
+
/** The control-plane paths the native read path mounts. */
|
|
256
|
+
export declare const subscribePath = "/sync/v1/subscribe";
|
|
257
|
+
export declare const refreshPath = "/sync/v1/refresh";
|
|
258
|
+
export declare const releasePath = "/sync/v1/release";
|
|
259
|
+
/**
|
|
260
|
+
* The convergence-barrier route (ADR-0056 decision 4).
|
|
261
|
+
*
|
|
262
|
+
* Proxied rather than exposed: the engine's control plane is unauthenticated by design and is not
|
|
263
|
+
* client-reachable, so surfacing the barrier on our own authenticated endpoint costs nothing and
|
|
264
|
+
* keeps the trust boundary intact.
|
|
265
|
+
*
|
|
266
|
+
* `maxAgeSeconds` may cache the answer briefly, but only a HEALTHY one. For the `pendingFlips` term
|
|
267
|
+
* staleness is safe in exactly one direction — it moves the barrier backwards, so a stale reading can
|
|
268
|
+
* only DELAY an alignment, never satisfy one falsely. `flipFailures` inverts that: a cached
|
|
269
|
+
* pre-degradation zero would let a group align against an engine that has already
|
|
270
|
+
* lost membership effects, which is precisely the alignment the term exists to refuse. So a degraded
|
|
271
|
+
* reading is never cached and never served from cache, and the cache window is exactly the bound on
|
|
272
|
+
* how long a client may align against a freshly-degraded engine — which is why the default is 0.
|
|
273
|
+
*/
|
|
274
|
+
export declare function createBarrierHandler(options: {
|
|
275
|
+
engine: CircuitsEngineClient;
|
|
276
|
+
resolveAuthClaims?: (request: Request) => Promise<JwtClaims | null> | JwtClaims | null;
|
|
277
|
+
maxAgeSeconds?: number;
|
|
278
|
+
}): (request: Request) => Promise<Response>;
|
|
279
|
+
export declare const barrierPath = "/sync/v1/barrier";
|
|
280
|
+
//# sourceMappingURL=subscribe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../src/circuits/subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAwE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGxH;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,yEAAyE;AACzE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,m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AE,oBAAoB,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,EACzD,MAAM,EAAE,SAAS,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAYrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE;IACP,MAAM,EAAE,oBAAoB,CAAC;IAC7B,GAAG,EAAE,SAAS,CAAC;CAChB,GAAG;IACF,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;CACxF,aAE4C,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAkCzE;AAED,2DAA2D;AAC3D,eAAO,MAAM,aAAa,uBAAuB,CAAC;AAClD,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAC9C,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAE9C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC5C,MAAM,EAAE,oBAAoB,CAAC;IAC7B,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;IACvF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,aAI8C,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAgBzE;AAED,eAAO,MAAM,WAAW,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Predicate } from "@pgxsinkit/contracts";
|
|
2
|
+
/**
|
|
3
|
+
* The engine's shape-creation wire contract (`POST /shapes` → `ShapeResp`), restated here for the
|
|
4
|
+
* same reason {@link Predicate} is: this is the boundary pgxsinkit commits to, and the engine's
|
|
5
|
+
* serde definitions are authoritative for it.
|
|
6
|
+
*/
|
|
7
|
+
export interface CreateShapeRequest {
|
|
8
|
+
table: string;
|
|
9
|
+
where?: Predicate;
|
|
10
|
+
/**
|
|
11
|
+
* Output projection. Omitted = the full row; the primary key is always included regardless. The
|
|
12
|
+
* predicate may reference columns outside this set, which is what lets a shape MATCH on a column it
|
|
13
|
+
* does not EMIT — the control column a pre-computed redaction splits on (ADR-0055 decision 5).
|
|
14
|
+
*
|
|
15
|
+
* This is the ENGINE's projection, not the client's. `serverOnlyColumns` are IN it: an egress
|
|
16
|
+
* `serverProjection.rowTransform` must read them, so they are fetched onto the stream on purpose and
|
|
17
|
+
* are stripped from each row at the stream edge after the transform runs (`createStreamGate`). A
|
|
18
|
+
* deployment that puts a cache between the engine and the edge is caching rows that still carry
|
|
19
|
+
* them.
|
|
20
|
+
*/
|
|
21
|
+
columns?: string[];
|
|
22
|
+
/** Skip the backfill and stream only future matching changes. Subset queries only. */
|
|
23
|
+
changesOnly?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The caller's **subscription id** — the name this claim on the shape is taken under (fork
|
|
26
|
+
* ADR-0008). Any non-empty string up to 128 bytes with no control characters, and never starting
|
|
27
|
+
* with `~` unless it is the `~` id the engine itself returned to you (the engine mints into that
|
|
28
|
+
* namespace, and refuses an unknown `~` id as forged).
|
|
29
|
+
*
|
|
30
|
+
* Optional on the WIRE, because the engine will mint one for a caller that names none. It is not
|
|
31
|
+
* optional for pgxsinkit: every call site here sends one, because an unnamed claim is a claim this
|
|
32
|
+
* control plane cannot renew idempotently — a repeat create would be indistinguishable from a
|
|
33
|
+
* second subscriber. Naming it makes the create a RENEW when repeated, and makes the release
|
|
34
|
+
* (`DELETE /shapes/{id}?subscription=…`) retry-safe.
|
|
35
|
+
*/
|
|
36
|
+
subscription?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The engine's response to a shape CREATE (`POST /shapes` → `ShapeResp`).
|
|
40
|
+
*
|
|
41
|
+
* `subscription` and `leaseSeconds` are present on a create and absent on a bare `GET /shapes/{id}`
|
|
42
|
+
* lookup, which belongs to no subscriber. This client only ever creates, so both are required here
|
|
43
|
+
* and the client refuses a create answer that omits either — see `createShape`.
|
|
44
|
+
*/
|
|
45
|
+
export interface CircuitsShapeHandle {
|
|
46
|
+
shapeId: string;
|
|
47
|
+
table: string;
|
|
48
|
+
/** Stream path on the durable-streams server, e.g. `shape/s1`. */
|
|
49
|
+
streamPath: string;
|
|
50
|
+
/** Absolute URL of that stream, as the engine resolves its durable-streams base. */
|
|
51
|
+
streamUrl: string;
|
|
52
|
+
/**
|
|
53
|
+
* The subscription this create was recorded under — echoed back, so a caller that named its own id
|
|
54
|
+
* can confirm it and a caller that named none learns the one the engine minted.
|
|
55
|
+
*/
|
|
56
|
+
subscription: string;
|
|
57
|
+
/**
|
|
58
|
+
* How long this subscription may go unrenewed before the engine releases it
|
|
59
|
+
* (`ELECTRIC_CIRCUITS_SHAPE_IDLE_SECS`, default 1800). `0` means leases never lapse, because that
|
|
60
|
+
* setting also disables dormancy.
|
|
61
|
+
*
|
|
62
|
+
* Reported rather than guessed: the renewal cadence is the deployment's to set, and a control plane
|
|
63
|
+
* that renews on a schedule the engine does not accept is a control plane whose live sessions lapse
|
|
64
|
+
* (see `CircuitsLeaseConfigError`).
|
|
65
|
+
*/
|
|
66
|
+
leaseSeconds: number;
|
|
67
|
+
/** Retention lifecycle; absent on a freshly created shape, which is always active. */
|
|
68
|
+
state?: "active" | "deactivating" | "dormant" | "reactivating";
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/circuits/wire.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,sFAAsF;IACtF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,sFAAsF;IACtF,KAAK,CAAC,EAAE,QAAQ,GAAG,cAAc,GAAG,SAAS,GAAG,cAAc,CAAC;CAChE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PgAsyncDatabase, PgQueryResultHKT } from "drizzle-orm/pg-core";
|
|
2
2
|
import type { JwtClaims, RegistryRelations, RegistryTables, SyncRuntimeStatus, SyncServerAddress, SyncTableRegistry } from "@pgxsinkit/contracts";
|
|
3
|
+
import type { EntitlementSet } from "./circuits/edge";
|
|
4
|
+
import type { CircuitsEngineClient } from "./circuits/engine-client";
|
|
3
5
|
import type { EventQueue } from "./events/queue";
|
|
4
6
|
import { type EventGate, type EventsEnqueuedHook } from "./events/route";
|
|
5
7
|
import { type StartupVerificationMode } from "./mutations/route";
|
|
@@ -33,15 +35,30 @@ export interface CreateSyncServerOptions<TRegistry extends SyncTableRegistry, TD
|
|
|
33
35
|
db: TDb;
|
|
34
36
|
resolveAuthClaims?: (request: Request) => Promise<JwtClaims | null> | JwtClaims | null;
|
|
35
37
|
/**
|
|
36
|
-
* When set, the server serves
|
|
37
|
-
*
|
|
38
|
-
*
|
|
38
|
+
* When set, the server serves the NATIVE read path's control plane (ADR-0055): subscribe, stream-token
|
|
39
|
+
* re-mint, and the engine convergence barrier. Without it, none of those routes is registered and the
|
|
40
|
+
* deployment is write-only.
|
|
41
|
+
*
|
|
42
|
+
* They share the single `resolveAuthClaims` adapter with the write path (ADR-0003), so read and write
|
|
43
|
+
* authorization cannot diverge.
|
|
39
44
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
readPath?: {
|
|
46
|
+
/** The Circuits engine's control API — never client-reachable; only this process calls it. */
|
|
47
|
+
engine: CircuitsEngineClient;
|
|
48
|
+
/**
|
|
49
|
+
* The live entitlement set backing the shared tier. Omit when the registry declares no shared
|
|
50
|
+
* shape — a shared subscription is then refused with that reason rather than silently allowed.
|
|
51
|
+
*/
|
|
52
|
+
entitlements?: EntitlementSet;
|
|
53
|
+
/** The stream-token signing key, shared with the edge. */
|
|
54
|
+
key: CryptoKey;
|
|
55
|
+
/** Per-deployment override of ADR-0055's 5-minute token lifetime. */
|
|
56
|
+
ttlSeconds?: number;
|
|
57
|
+
/** How long the barrier answer may be cached. Default 0 — see `createBarrierHandler`. */
|
|
58
|
+
barrierMaxAgeSeconds?: number;
|
|
59
|
+
/** Optional per-request extra params passed to the private tier's row filters. */
|
|
60
|
+
resolveShapeParams?: (request: Request) => Record<string, unknown> | undefined;
|
|
61
|
+
};
|
|
45
62
|
operationsLog?: {
|
|
46
63
|
enabled?: boolean;
|
|
47
64
|
};
|
|
@@ -138,8 +155,6 @@ export type { ApplyFunctionRenderOptions } from "./mutations/plpgsql-apply";
|
|
|
138
155
|
export { renderPgxsinkitUtilitiesMigration } from "./migrations/utilities";
|
|
139
156
|
export { ensureOperationsLogSchema, operationsLogRegclassTarget } from "./operations-log/ddl";
|
|
140
157
|
export { operationsLogTable } from "./operations-log/schema";
|
|
141
|
-
export { proxyElectricShapeRequest } from "./electric-proxy";
|
|
142
|
-
export type { ElectricProxyOptions } from "./electric-proxy";
|
|
143
158
|
export { readSqlState } from "./sql-state";
|
|
144
159
|
export { createEventIngestHandler, eventIngestRequiresClaims, EVENT_QUEUE_UNAVAILABLE_RETRY_AFTER_SECONDS, } from "./events/route";
|
|
145
160
|
export type { CreateEventIngestHandlerOptions, EventGate, EventGateDecision, EventGateInput, EventIngestDb, EventsEnqueuedHook, EventsEnqueuedInfo, } from "./events/route";
|
|
@@ -152,4 +167,15 @@ export type { DefineEventConsumerOptions, EventConsumer, EventConsumerBatch, Eve
|
|
|
152
167
|
export { EVENT_LANE_FINGERPRINT_PREFIX, eventLaneDdlFingerprint, eventLaneStreamNames, renderEventLaneMigration, } from "./events/ddl";
|
|
153
168
|
export { resolveEventIdentity } from "./events/identity";
|
|
154
169
|
export type { IdentityResolution } from "./events/identity";
|
|
170
|
+
export { compileShapeRequest, fingerprintShapeRequest, resolveEntryByShapeKey } from "./circuits/compile";
|
|
171
|
+
export type { CompiledShapeRequest, ShapeRequest } from "./circuits/compile";
|
|
172
|
+
export { CircuitsEngineError, createCircuitsEngineClient } from "./circuits/engine-client";
|
|
173
|
+
export type { CircuitsEngineClient, CircuitsEngineOptions } from "./circuits/engine-client";
|
|
174
|
+
export type { CircuitsShapeHandle, CreateShapeRequest } from "./circuits/wire";
|
|
175
|
+
export { DEFAULT_STREAM_TOKEN_TTL_SECONDS, findGrant, importStreamTokenKey, mintStreamToken, verifyStreamToken, } from "./circuits/stream-token";
|
|
176
|
+
export type { MintStreamTokenOptions, VerifyStreamTokenOptions, StreamGrant, StreamTokenClaims, StreamTokenVerification, } from "./circuits/stream-token";
|
|
177
|
+
export { authorizeStreamRead, createStreamGate, EntitlementsUnavailableError, readStreamToken, STREAM_READ_EXPOSED_HEADERS, } from "./circuits/edge";
|
|
178
|
+
export type { EntitlementSet, GateDecision, StreamAuthorizationOptions, StreamGateOptions } from "./circuits/edge";
|
|
179
|
+
export { barrierPath, CircuitsLeaseConfigError, createBarrierHandler, createRefreshHandler, createReleaseHandler, createSubscribeHandler, refreshPath, refreshStreamToken, releasePath, releaseStreamGrants, subscribePath, subscribeToShapes, } from "./circuits/subscribe";
|
|
180
|
+
export type { DeniedSubscription, GrantedSubscription, RefreshResult, SubscribeOptions, SubscribeResult, SubscriptionRequest, } from "./circuits/subscribe";
|
|
155
181
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAYrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAA4B,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAoB3B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;A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