@substrat-run/kernel 0.162.0 → 0.164.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attachment-bytes.d.ts +121 -0
- package/dist/attachment-bytes.d.ts.map +1 -0
- package/dist/attachment-bytes.js +94 -0
- package/dist/attachment-bytes.js.map +1 -0
- package/dist/attachment-sweep.d.ts +2 -1
- package/dist/attachment-sweep.d.ts.map +1 -1
- package/dist/attachment-sweep.js +1 -1
- package/dist/attachment-sweep.js.map +1 -1
- package/dist/attachment-text.d.ts +1 -1
- package/dist/attachment-text.d.ts.map +1 -1
- package/dist/attachment-text.js +1 -1
- package/dist/attachment-text.js.map +1 -1
- package/dist/billing-retention.js +1 -1
- package/dist/billing-retention.js.map +1 -1
- package/dist/connection-context.d.ts +69 -0
- package/dist/connection-context.d.ts.map +1 -0
- package/dist/connection-context.js +19 -0
- package/dist/connection-context.js.map +1 -0
- package/dist/connection-landings.d.ts +8 -0
- package/dist/connection-landings.d.ts.map +1 -1
- package/dist/connection-landings.js +5 -1
- package/dist/connection-landings.js.map +1 -1
- package/dist/connector-transport.d.ts +313 -0
- package/dist/connector-transport.d.ts.map +1 -0
- package/dist/connector-transport.js +66 -0
- package/dist/connector-transport.js.map +1 -0
- package/dist/deadline-fetch.d.ts +1 -1
- package/dist/deadline-fetch.d.ts.map +1 -1
- package/dist/findings.js +1 -1
- package/dist/findings.js.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/job-run.d.ts +2 -1
- package/dist/job-run.d.ts.map +1 -1
- package/dist/job-run.js +2 -1
- package/dist/job-run.js.map +1 -1
- package/dist/live-read.d.ts +258 -0
- package/dist/live-read.d.ts.map +1 -0
- package/dist/live-read.js +101 -0
- package/dist/live-read.js.map +1 -0
- package/dist/membership-executor.d.ts +2 -1
- package/dist/membership-executor.d.ts.map +1 -1
- package/dist/membership-executor.js.map +1 -1
- package/dist/meter-days.js +1 -1
- package/dist/meter-days.js.map +1 -1
- package/dist/migration-digest.d.ts +1 -1
- package/dist/migration-digest.d.ts.map +1 -1
- package/dist/migration-digest.js +1 -1
- package/dist/migration-digest.js.map +1 -1
- package/dist/platform-sweep.d.ts +22 -4
- package/dist/platform-sweep.d.ts.map +1 -1
- package/dist/platform-sweep.js +69 -26
- package/dist/platform-sweep.js.map +1 -1
- package/dist/promote-review.d.ts +42 -4
- package/dist/promote-review.d.ts.map +1 -1
- package/dist/promote-review.js +43 -15
- package/dist/promote-review.js.map +1 -1
- package/dist/request-rollup.js +1 -1
- package/dist/request-rollup.js.map +1 -1
- package/dist/reserved-roles.d.ts +12 -0
- package/dist/reserved-roles.d.ts.map +1 -1
- package/dist/reserved-roles.js +22 -3
- package/dist/reserved-roles.js.map +1 -1
- package/dist/retention.d.ts +106 -0
- package/dist/retention.d.ts.map +1 -0
- package/dist/retention.js +131 -0
- package/dist/retention.js.map +1 -0
- package/dist/scope-host.d.ts +23 -791
- package/dist/scope-host.d.ts.map +1 -1
- package/dist/scope-host.js +1 -385
- package/dist/scope-host.js.map +1 -1
- package/dist/storage-gauge.js +1 -1
- package/dist/storage-gauge.js.map +1 -1
- package/dist/upload-link.d.ts +1 -1
- package/dist/upload-link.d.ts.map +1 -1
- package/dist/upload-link.js +1 -1
- package/dist/upload-link.js.map +1 -1
- package/dist/wire-nonce.d.ts +80 -0
- package/dist/wire-nonce.d.ts.map +1 -0
- package/dist/wire-nonce.js +126 -0
- package/dist/wire-nonce.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { type EntityRef, type PermissionKey, type PrincipalId, type ScopeId, type TenantId } from '@substrat-run/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* The live-read surface (#938): one `Upgrade` in, one long-lived subscription out.
|
|
4
|
+
*
|
|
5
|
+
* **What crosses it is an invalidation, never a payload.** A frame names the event
|
|
6
|
+
* type and the `(entityType, entityId)` it was about, and the client re-reads that
|
|
7
|
+
* entity through the ordinary operation it already calls. That is what keeps the
|
|
8
|
+
* change feed from quietly becoming a second, ungoverned read API: every field a
|
|
9
|
+
* subscriber ever sees came back through the declared read surface, with that read's
|
|
10
|
+
* own permission check, its own field-level omissions and its own PII handling.
|
|
11
|
+
*
|
|
12
|
+
* **Every frame is filtered per subscriber, after the commit and after the check.**
|
|
13
|
+
* The host offers each committed event to each subscriber and delivers it only if
|
|
14
|
+
* that subscriber passes the entity type's declared `liveTargets.readPermission` ON
|
|
15
|
+
* THAT ENTITY — the same walk `ctx.check(key, entityRef)` makes, through the same
|
|
16
|
+
* evaluator, so an entity-narrowed grant decides a push exactly as it decides a read.
|
|
17
|
+
* An entity type no module declared reaches nobody. Knowing that a row exists and
|
|
18
|
+
* changed at 14:02 is information about that row, so "the body was empty" is not a
|
|
19
|
+
* defence: the filter runs whether or not there is a payload to withhold.
|
|
20
|
+
*
|
|
21
|
+
* A subscription may be narrowed `within` one entity (#1853), which only removes frames.
|
|
22
|
+
* Two built roots replace the per-row check with one about the ROOT, and their subscribers
|
|
23
|
+
* are sent bare `LiveNudge` frames that name no entity: `checkedWithin`, whose principal must
|
|
24
|
+
* pass a stated key on the root at the handshake and again on every pass that has something
|
|
25
|
+
* to send (#938), and `vouchedWithin`, which the vertical asserts once and nothing re-checks
|
|
26
|
+
* (#1853). Which to use is on `checkedWithin`.
|
|
27
|
+
*
|
|
28
|
+
* **Generic over the runtime's request and response, because the kernel names
|
|
29
|
+
* neither.** This package has one dependency and no DOM or workers lib
|
|
30
|
+
* (`docs/architecture/dependency-policy.md`), which is why `FetchLike` (`connector-transport.ts`) describes
|
|
31
|
+
* a `fetch` structurally rather than importing one. The same rule applies here, and it
|
|
32
|
+
* is load-bearing in the other direction too: what a caller gets back must be the
|
|
33
|
+
* runtime's OWN response object, because a Worker's handler has to return one. A
|
|
34
|
+
* structural stand-in would describe it correctly and still not be returnable. So the
|
|
35
|
+
* type travels through instead of being restated — `CloudflareScopeHost` binds it to
|
|
36
|
+
* the real `Request`/`Response`, and code holding the bare contract gets `unknown` back
|
|
37
|
+
* and narrows at its own mount point, where it knows which host it is on.
|
|
38
|
+
*/
|
|
39
|
+
export interface LiveReadSurface<Req extends LiveUpgradeRequest = LiveUpgradeRequest, Res = unknown> {
|
|
40
|
+
/**
|
|
41
|
+
* Accept a WebSocket `Upgrade` and subscribe the principal to the scope's changes.
|
|
42
|
+
*
|
|
43
|
+
* The caller is the vertical, and it has already done the one thing this surface
|
|
44
|
+
* cannot do for itself: resolved WHO is asking. The principal is an authenticated
|
|
45
|
+
* fact the vertical's session carries, exactly as it is for an `invoke` — this
|
|
46
|
+
* surface trusts it the same way and no further, which is why every frame is still
|
|
47
|
+
* checked against it individually rather than a subscription being authorized once.
|
|
48
|
+
*
|
|
49
|
+
* Returns the 101 to hand back to the client, or a refusal to return as-is: a
|
|
50
|
+
* request that is not an upgrade gets 426, and one arriving over a hop that cannot
|
|
51
|
+
* carry a socket gets a refusal naming that, so the client can fall back to polling
|
|
52
|
+
* KNOWINGLY. Neither is thrown, because both are answers to a client rather than
|
|
53
|
+
* faults of the caller.
|
|
54
|
+
*/
|
|
55
|
+
subscribe(input: {
|
|
56
|
+
tenantId: TenantId;
|
|
57
|
+
scopeId: ScopeId;
|
|
58
|
+
/** WHO is subscribing — resolved by the vertical from its own session, never by the client. */
|
|
59
|
+
principal: PrincipalId;
|
|
60
|
+
/** The upgrade request as it arrived, carried whole so the host reads its own headers. */
|
|
61
|
+
request: Req;
|
|
62
|
+
/**
|
|
63
|
+
* Narrow the feed to one entity and what hangs beneath it (#1853).
|
|
64
|
+
*
|
|
65
|
+
* A frame is then delivered only if its entity IS this one or reaches it upward
|
|
66
|
+
* through live declared `parent` edges (what `ctx.link` / `ctx.relink` write) — the
|
|
67
|
+
* walk `ctx.check` makes, rooted here instead of at a grant.
|
|
68
|
+
*
|
|
69
|
+
* - **An `EntityRef` narrows and nothing else.** The principal's own per-frame
|
|
70
|
+
* `liveTargets` check still runs; `within` is ANDed with it, so it can only take
|
|
71
|
+
* frames away. A screen watching one conversation passes it to stop hearing the
|
|
72
|
+
* rest of the desk.
|
|
73
|
+
* - **A `vouchedWithin(…)` value replaces the principal's check.** For a subscriber
|
|
74
|
+
* confined by something other than a grant — a widget visitor holding a session
|
|
75
|
+
* token the vertical has just redeemed. The vertical asserts access to the root,
|
|
76
|
+
* the same trust it already extends in naming `principal`, and the scope's walk is
|
|
77
|
+
* the whole filter. Such a subscriber receives `LiveNudge` frames only, which name
|
|
78
|
+
* no event type and no entity.
|
|
79
|
+
* - **A `checkedWithin(…)` value replaces the per-row check with one on the root**
|
|
80
|
+
* (#938). The principal must pass the stated key on the root, at the handshake (a
|
|
81
|
+
* `403` otherwise) and again on every pass that has a row beneath it to announce,
|
|
82
|
+
* so a grant withdrawn, or a root moved out from under it, closes the socket
|
|
83
|
+
* instead of nudging it. `LiveNudge` frames only, as for a vouched root.
|
|
84
|
+
*
|
|
85
|
+
* **Freshness (Codex #2077 r5).** A decision is reused within a pass only while the
|
|
86
|
+
* scope has had no write and nothing it holds has reached its `expires_at` since the
|
|
87
|
+
* decision. It is never reused while the scope reads its permissions from the directory.
|
|
88
|
+
* Both are checked against the clock immediately before each send. A change that lands
|
|
89
|
+
* while a check is still being evaluated can let that one frame through. Frames name
|
|
90
|
+
* nothing the subscriber could not read when checked, and the next frame, pass and poll
|
|
91
|
+
* see the change: a push is a hint at most one evaluation stale.
|
|
92
|
+
*/
|
|
93
|
+
within?: EntityRef | VouchedWithin | CheckedWithin;
|
|
94
|
+
/**
|
|
95
|
+
* When the credential that proved `principal` stops being valid (ISO 8601), so the
|
|
96
|
+
* socket never outlives it (#938). Pass the session's or the bearer's expiry
|
|
97
|
+
* (`AuthSubject.expiresAt`). A handshake at or past it is refused, and the scope closes
|
|
98
|
+
* the socket (`1008`) on its first pass at or past it, before sending anything on that
|
|
99
|
+
* pass. Absent: the socket lives until either end closes it, as before.
|
|
100
|
+
*/
|
|
101
|
+
expiresAt?: string;
|
|
102
|
+
}): Promise<Res>;
|
|
103
|
+
}
|
|
104
|
+
/** The brand only `vouchedWithin` can apply — a literal cannot type-check as one. */
|
|
105
|
+
declare const vouchedBrand: unique symbol;
|
|
106
|
+
/**
|
|
107
|
+
* A `within` root the VERTICAL vouches the subscriber may watch, in place of the
|
|
108
|
+
* principal's own grants (#1853). Built only by `vouchedWithin`.
|
|
109
|
+
*/
|
|
110
|
+
export interface VouchedWithin {
|
|
111
|
+
readonly [vouchedBrand]: true;
|
|
112
|
+
readonly entity: EntityRef;
|
|
113
|
+
/** Why the vertical vouches — what it checked. Required, and kept on the subscription. */
|
|
114
|
+
readonly because: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Vouch that the subscriber may watch `entity` and everything beneath it, though the
|
|
118
|
+
* principal it subscribes as holds no read on it.
|
|
119
|
+
*
|
|
120
|
+
* The one way to reach the replacing mode, so every use is greppable and none is an
|
|
121
|
+
* accident: an object literal is refused by the type checker, and anything not built
|
|
122
|
+
* here is refused by the host at run time (`isVouchedWithin`). Call it only after the
|
|
123
|
+
* vertical itself has proven access — for ticket0's widget, by redeeming the session
|
|
124
|
+
* token for the session it names.
|
|
125
|
+
*
|
|
126
|
+
* What it costs the subscriber is detail: a vouched feed carries `LiveNudge` frames, so
|
|
127
|
+
* the scope never tells it which entity changed or how. Root it at an entity whose
|
|
128
|
+
* subtree holds only what the subscriber may see — the walk is the whole filter.
|
|
129
|
+
*/
|
|
130
|
+
export declare function vouchedWithin(entity: EntityRef, opts: {
|
|
131
|
+
because: string;
|
|
132
|
+
}): VouchedWithin;
|
|
133
|
+
/** Was this value built by `vouchedWithin`? A host asks before it drops the principal's check. */
|
|
134
|
+
export declare function isVouchedWithin(value: unknown): value is VouchedWithin;
|
|
135
|
+
/** The brand only `checkedWithin` can apply. */
|
|
136
|
+
declare const checkedBrand: unique symbol;
|
|
137
|
+
/**
|
|
138
|
+
* A `within` root the PRINCIPAL must be allowed `permission` on, re-checked for as long
|
|
139
|
+
* as the socket is open (#938). Built only by `checkedWithin`.
|
|
140
|
+
*/
|
|
141
|
+
export interface CheckedWithin {
|
|
142
|
+
readonly [checkedBrand]: true;
|
|
143
|
+
readonly entity: EntityRef;
|
|
144
|
+
readonly permission: PermissionKey;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Watch `entity` and everything beneath it, for as long as the subscriber may
|
|
148
|
+
* `permission` on `entity` itself.
|
|
149
|
+
*
|
|
150
|
+
* For a subscriber whose grant reaches the ROOT but not each row under it the way a
|
|
151
|
+
* `liveTargets` key would: ticket0's portal customer holds `conversation:read-own` on
|
|
152
|
+
* their contact, which reaches the conversation's public thread, while the per-row key
|
|
153
|
+
* on a message is the staff read. Rooted at an entity whose subtree is exactly what that
|
|
154
|
+
* key's read returns, the walk is the row filter and the key is the gate.
|
|
155
|
+
*
|
|
156
|
+
* The gate is asked at the handshake (`403` if it refuses) and again, once per socket,
|
|
157
|
+
* on every post-commit pass that has a row beneath the root to announce. A refusal or a
|
|
158
|
+
* check that throws closes the socket (`1008`) and sends nothing on that pass, so a
|
|
159
|
+
* revoked grant, a principal who is gone, or a root relinked out of the grant's reach
|
|
160
|
+
* ends the subscription instead of nudging it, and the client's reconnect meets the
|
|
161
|
+
* handshake's `403`. A pass with nothing beneath the root asks nothing, so an idle
|
|
162
|
+
* subscription costs no checks.
|
|
163
|
+
*
|
|
164
|
+
* **`checkedWithin` or `vouchedWithin`?** Use `checkedWithin` whenever the subscriber is
|
|
165
|
+
* a principal with a grant that reaches the root: authority leaves with the grant. Use
|
|
166
|
+
* `vouchedWithin` only when there is no such grant to ask, as for ticket0's widget
|
|
167
|
+
* visitor, who holds a session token rather than a principal of their own. A vouched
|
|
168
|
+
* socket is asserted once, so a token revoked mid-socket keeps receiving content-free
|
|
169
|
+
* nudges until the socket closes. That is known and accepted for the widget: the nudge
|
|
170
|
+
* names nothing, and every re-read it causes is checked again.
|
|
171
|
+
*
|
|
172
|
+
* Both send `LiveNudge` frames only: the subscriber may not read each row, so it is
|
|
173
|
+
* never told which one changed. Only rows of a type some module declared in
|
|
174
|
+
* `liveTargets` are announced, as for every other subscriber.
|
|
175
|
+
*/
|
|
176
|
+
export declare function checkedWithin(entity: EntityRef, permission: string): CheckedWithin;
|
|
177
|
+
/** Was this value built by `checkedWithin`? */
|
|
178
|
+
export declare function isCheckedWithin(value: unknown): value is CheckedWithin;
|
|
179
|
+
/**
|
|
180
|
+
* Is this request asking to be upgraded to a WebSocket?
|
|
181
|
+
*
|
|
182
|
+
* Paired with `LIVE_MODE_HEADER` (`@substrat-run/contracts`) because a vertical's live
|
|
183
|
+
* route asks it first, before anything else it decides: only a WebSocket handshake is a
|
|
184
|
+
* live read, and a browser always sends `Origin` on one, so everything past this check
|
|
185
|
+
* can trust that a missing `Origin` did not come from a browser page. A plain GET with a
|
|
186
|
+
* cookie on it cannot.
|
|
187
|
+
*/
|
|
188
|
+
export declare function isUpgradeRequest(request: LiveUpgradeRequest): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* The only thing this surface needs of an incoming request: its headers.
|
|
191
|
+
*
|
|
192
|
+
* Narrow on purpose. A live-read door reads `Upgrade` to know what is being asked for
|
|
193
|
+
* and `cf-connecting-o2o` to know whether this hop can carry it, and nothing else — it
|
|
194
|
+
* does not route on the path, read the body, or care about the method. Describing
|
|
195
|
+
* exactly that much is what lets a test drive the door with a two-line object instead
|
|
196
|
+
* of constructing a runtime request.
|
|
197
|
+
*/
|
|
198
|
+
export interface LiveUpgradeRequest {
|
|
199
|
+
readonly headers: {
|
|
200
|
+
get(name: string): string | null;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* One frame on a live read (#938) — the wire shape, so both ends name it once.
|
|
205
|
+
*
|
|
206
|
+
* Deliberately not the outbox envelope. An envelope carries the payload, the
|
|
207
|
+
* authorization chain, the impersonation stamp and the PII class, and none of those
|
|
208
|
+
* belong on a channel whose contract is "re-read it yourself". What a subscriber
|
|
209
|
+
* needs in order to act is what is here: which entity changed, and what happened to it.
|
|
210
|
+
*/
|
|
211
|
+
export interface LiveChange {
|
|
212
|
+
/** Always `'change'` today; a field rather than an assumption, so a second kind can be added. */
|
|
213
|
+
readonly kind: 'change';
|
|
214
|
+
/**
|
|
215
|
+
* The event id — a ULID, so frames sort and a repeat is recognisable.
|
|
216
|
+
*
|
|
217
|
+
* **Not a gap detector, and a client must not use it as one.** ULIDs are ordered but
|
|
218
|
+
* not contiguous, so "the next id is not the one after this" says nothing on its own.
|
|
219
|
+
* More to the point, gaps here are the NORMAL case and the deliberate one: the
|
|
220
|
+
* permission filter withholds every event this subscriber may not read, so the ids it
|
|
221
|
+
* receives are a sparse subset of what the scope emitted, by design. A client
|
|
222
|
+
* inferring missed updates from the spacing would be reading someone else's
|
|
223
|
+
* entitlements as its own packet loss.
|
|
224
|
+
*
|
|
225
|
+
* What it is good for: ordering frames that arrive out of order, and discarding one
|
|
226
|
+
* it has already acted on. Detecting a genuinely missed update would need an
|
|
227
|
+
* authorized contiguous cursor — a per-subscriber sequence, counted after the filter —
|
|
228
|
+
* which this protocol does not have and should not grow by accident.
|
|
229
|
+
*/
|
|
230
|
+
readonly id: string;
|
|
231
|
+
/** The emitted event type, e.g. `'ticket0/message-posted'`. */
|
|
232
|
+
readonly type: string;
|
|
233
|
+
readonly entityType: string;
|
|
234
|
+
readonly entityId: string;
|
|
235
|
+
/** When the event was emitted (ISO 8601), i.e. the emitting operation's instant. */
|
|
236
|
+
readonly at: string;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* What a vouched or checked subscriber is told (#1853, #938): something beneath its root
|
|
240
|
+
* changed, and nothing else.
|
|
241
|
+
*
|
|
242
|
+
* No event type and no entity, deliberately. Such a subscriber holds no read on the
|
|
243
|
+
* entities its frames are about — the vertical vouched for the ROOT, or the principal was
|
|
244
|
+
* checked on the root alone, and the scope cannot know which rows under it the vertical's
|
|
245
|
+
* own read would show. Naming the type
|
|
246
|
+
* or the id would tell it what it never asked to read. The client re-reads, as it does
|
|
247
|
+
* on a `LiveChange`.
|
|
248
|
+
*/
|
|
249
|
+
export interface LiveNudge {
|
|
250
|
+
readonly kind: 'nudge';
|
|
251
|
+
/** The event id, as on `LiveChange` — for ordering and de-duplication only. */
|
|
252
|
+
readonly id: string;
|
|
253
|
+
readonly at: string;
|
|
254
|
+
}
|
|
255
|
+
/** Any frame a live read sends. */
|
|
256
|
+
export type LiveFrame = LiveChange | LiveNudge;
|
|
257
|
+
export {};
|
|
258
|
+
//# sourceMappingURL=live-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-read.d.ts","sourceRoot":"","sources":["../src/live-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACd,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,eAAe,CAAC,GAAG,SAAS,kBAAkB,GAAG,kBAAkB,EAAE,GAAG,GAAG,OAAO;IACjG;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,KAAK,EAAE;QACf,QAAQ,EAAE,QAAQ,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,+FAA+F;QAC/F,SAAS,EAAE,WAAW,CAAC;QACvB,0FAA0F;QAC1F,OAAO,EAAE,GAAG,CAAC;QACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA8BG;QACH,MAAM,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,aAAa,CAAC;QACnD;;;;;;WAMG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAClB;AAED,qFAAqF;AACrF,OAAO,CAAC,MAAM,YAAY,EAAE,OAAO,MAAM,CAAC;AAa1C;;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AI,EAAE,QAAQ,CAAC;IACxB;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,oFAAoF;IACpF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,mCAAmC;AACnC,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { permissionKey, substratError, } from '@substrat-run/contracts';
|
|
2
|
+
const VOUCHED = Symbol('substrat.live.vouched-within');
|
|
3
|
+
/** A frozen value carrying `mark`, non-enumerable, so a spread copy or a literal never does. */
|
|
4
|
+
function branded(value, mark) {
|
|
5
|
+
Object.defineProperty(value, mark, { value: true, enumerable: false });
|
|
6
|
+
return Object.freeze(value);
|
|
7
|
+
}
|
|
8
|
+
function hasBrand(value, mark) {
|
|
9
|
+
return typeof value === 'object' && value !== null && value[mark] === true;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Vouch that the subscriber may watch `entity` and everything beneath it, though the
|
|
13
|
+
* principal it subscribes as holds no read on it.
|
|
14
|
+
*
|
|
15
|
+
* The one way to reach the replacing mode, so every use is greppable and none is an
|
|
16
|
+
* accident: an object literal is refused by the type checker, and anything not built
|
|
17
|
+
* here is refused by the host at run time (`isVouchedWithin`). Call it only after the
|
|
18
|
+
* vertical itself has proven access — for ticket0's widget, by redeeming the session
|
|
19
|
+
* token for the session it names.
|
|
20
|
+
*
|
|
21
|
+
* What it costs the subscriber is detail: a vouched feed carries `LiveNudge` frames, so
|
|
22
|
+
* the scope never tells it which entity changed or how. Root it at an entity whose
|
|
23
|
+
* subtree holds only what the subscriber may see — the walk is the whole filter.
|
|
24
|
+
*/
|
|
25
|
+
export function vouchedWithin(entity, opts) {
|
|
26
|
+
if (!entity?.entityType || !entity?.entityId) {
|
|
27
|
+
throw substratError('validation_failed', 'vouchedWithin needs an entity with a type and an id');
|
|
28
|
+
}
|
|
29
|
+
if (!opts?.because?.trim()) {
|
|
30
|
+
throw substratError('validation_failed', 'vouchedWithin needs a reason: what the vertical checked');
|
|
31
|
+
}
|
|
32
|
+
return branded({ entity: { entityType: entity.entityType, entityId: entity.entityId }, because: opts.because }, VOUCHED);
|
|
33
|
+
}
|
|
34
|
+
/** Was this value built by `vouchedWithin`? A host asks before it drops the principal's check. */
|
|
35
|
+
export function isVouchedWithin(value) {
|
|
36
|
+
return hasBrand(value, VOUCHED);
|
|
37
|
+
}
|
|
38
|
+
const CHECKED = Symbol('substrat.live.checked-within');
|
|
39
|
+
/**
|
|
40
|
+
* Watch `entity` and everything beneath it, for as long as the subscriber may
|
|
41
|
+
* `permission` on `entity` itself.
|
|
42
|
+
*
|
|
43
|
+
* For a subscriber whose grant reaches the ROOT but not each row under it the way a
|
|
44
|
+
* `liveTargets` key would: ticket0's portal customer holds `conversation:read-own` on
|
|
45
|
+
* their contact, which reaches the conversation's public thread, while the per-row key
|
|
46
|
+
* on a message is the staff read. Rooted at an entity whose subtree is exactly what that
|
|
47
|
+
* key's read returns, the walk is the row filter and the key is the gate.
|
|
48
|
+
*
|
|
49
|
+
* The gate is asked at the handshake (`403` if it refuses) and again, once per socket,
|
|
50
|
+
* on every post-commit pass that has a row beneath the root to announce. A refusal or a
|
|
51
|
+
* check that throws closes the socket (`1008`) and sends nothing on that pass, so a
|
|
52
|
+
* revoked grant, a principal who is gone, or a root relinked out of the grant's reach
|
|
53
|
+
* ends the subscription instead of nudging it, and the client's reconnect meets the
|
|
54
|
+
* handshake's `403`. A pass with nothing beneath the root asks nothing, so an idle
|
|
55
|
+
* subscription costs no checks.
|
|
56
|
+
*
|
|
57
|
+
* **`checkedWithin` or `vouchedWithin`?** Use `checkedWithin` whenever the subscriber is
|
|
58
|
+
* a principal with a grant that reaches the root: authority leaves with the grant. Use
|
|
59
|
+
* `vouchedWithin` only when there is no such grant to ask, as for ticket0's widget
|
|
60
|
+
* visitor, who holds a session token rather than a principal of their own. A vouched
|
|
61
|
+
* socket is asserted once, so a token revoked mid-socket keeps receiving content-free
|
|
62
|
+
* nudges until the socket closes. That is known and accepted for the widget: the nudge
|
|
63
|
+
* names nothing, and every re-read it causes is checked again.
|
|
64
|
+
*
|
|
65
|
+
* Both send `LiveNudge` frames only: the subscriber may not read each row, so it is
|
|
66
|
+
* never told which one changed. Only rows of a type some module declared in
|
|
67
|
+
* `liveTargets` are announced, as for every other subscriber.
|
|
68
|
+
*/
|
|
69
|
+
export function checkedWithin(entity, permission) {
|
|
70
|
+
if (!entity?.entityType || !entity?.entityId) {
|
|
71
|
+
throw substratError('validation_failed', 'checkedWithin needs an entity with a type and an id');
|
|
72
|
+
}
|
|
73
|
+
const key = permissionKey.safeParse(permission);
|
|
74
|
+
if (!key.success)
|
|
75
|
+
throw substratError('validation_failed', 'checkedWithin needs a permission key');
|
|
76
|
+
return branded({ entity: { entityType: entity.entityType, entityId: entity.entityId }, permission: key.data }, CHECKED);
|
|
77
|
+
}
|
|
78
|
+
/** Was this value built by `checkedWithin`? */
|
|
79
|
+
export function isCheckedWithin(value) {
|
|
80
|
+
return hasBrand(value, CHECKED);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Is this request asking to be upgraded to a WebSocket?
|
|
84
|
+
*
|
|
85
|
+
* Paired with `LIVE_MODE_HEADER` (`@substrat-run/contracts`) because a vertical's live
|
|
86
|
+
* route asks it first, before anything else it decides: only a WebSocket handshake is a
|
|
87
|
+
* live read, and a browser always sends `Origin` on one, so everything past this check
|
|
88
|
+
* can trust that a missing `Origin` did not come from a browser page. A plain GET with a
|
|
89
|
+
* cookie on it cannot.
|
|
90
|
+
*/
|
|
91
|
+
export function isUpgradeRequest(request) {
|
|
92
|
+
// `Upgrade` is a comma-separated protocol list (RFC 9110 §7.8), e.g. `h2c, websocket`,
|
|
93
|
+
// and protocol names compare case-insensitively. Browsers send `websocket` alone, but
|
|
94
|
+
// they are not the only clients. A whole token must match: `websocketx` is not one.
|
|
95
|
+
// Accepting a list is safe for the Origin rule that follows: `fetch()` cannot set
|
|
96
|
+
// `Upgrade` at all, so only a real WebSocket client reaches it.
|
|
97
|
+
return (request.headers.get('Upgrade') ?? '')
|
|
98
|
+
.split(',')
|
|
99
|
+
.some((token) => token.trim().toLowerCase() === 'websocket');
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=live-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-read.js","sourceRoot":"","sources":["../src/live-read.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,GAMd,MAAM,yBAAyB,CAAC;AA2GjC,MAAM,OAAO,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAC;AAEvD,gGAAgG;AAChG,SAAS,OAAO,CAAI,KAAa,EAAE,IAAY;IAC7C,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAiB,CAAC;AAC9C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,IAAY;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAiC,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;AAC1G,CAAC;AAaD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAA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AE,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1H,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA2B;IAC1D,uFAAuF;IACvF,sFAAsF;IACtF,oFAAoF;IACpF,kFAAkF;IAClF,gEAAgE;IAChE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;SAC1C,KAAK,CAAC,GAAG,CAAC;SACV,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z, type EntityRef, type PlatformActorId } from '@substrat-run/contracts';
|
|
2
|
-
import {
|
|
2
|
+
import type { ExecutorRetryPolicy } from './connector-transport.js';
|
|
3
|
+
import { type ScopeHost } from './scope-host.js';
|
|
3
4
|
/** What the add path consumes, and the version it reads. */
|
|
4
5
|
export declare const MEMBER_ADD_REQUESTED = "member.add-requested";
|
|
5
6
|
/** What the remove path consumes, and the version it reads. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership-executor.d.ts","sourceRoot":"","sources":["../src/membership-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,CAAC,EAED,KAAK,SAAS,EAGd,KAAK,eAAe,EAErB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,
|
|
1
|
+
{"version":3,"file":"membership-executor.d.ts","sourceRoot":"","sources":["../src/membership-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,CAAC,EAED,KAAK,SAAS,EAGd,KAAK,eAAe,EAErB,MAAM,yBAAyB,CA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mB,EAAE,CAAC;IACnC,IAAI,MAA0B,CAAC;IAC/B,GAAG,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,MAAM,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC;IACxC,CAAC,QAAQ,MAAM,EAAE;IACjB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/meter-days.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { meterDay, meterDayTake, } from '@substrat-run/contracts';
|
|
2
|
-
import { assertRowLimit } from './
|
|
2
|
+
import { assertRowLimit } from './retention.js';
|
|
3
3
|
import { pruneBillingDays, pushDayWindow } from './billing-retention.js';
|
|
4
4
|
import { countScope, emptyScopeCounts, foldMeterReading, isLive, skuOrder, } from './meters.js';
|
|
5
5
|
/**
|
package/dist/meter-days.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter-days.js","sourceRoot":"","sources":["../src/meter-days.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,YAAY,GASb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"meter-days.js","sourceRoot":"","sources":["../src/meter-days.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,YAAY,GASb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,EACN,QAAQ,GAIT,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;GA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CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;mBACvC,EACf,MAAM,CASL,CAAC;IACJ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACpB,YAAY,CAAC,KAAK,CAAC;QACjB,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,WAAW,EAAE,CAAC,CAAC,YAAY;QAC3B,OAAO,EAAE,CAAC,CAAC,QAAQ;QACnB,OAAO,EAAE,CAAC,CAAC,YAAY;QACvB,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,YAAY,EAAE,CAAC,CAAC,aAAa;QAC7B,YAAY,EAAE,CAAC,CAAC,aAAa;KAC9B,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAiB,EAAE,KAAa,EAAE,KAAa,EAAE,MAAqB;IACtG,OAAO,gBAAgB,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,2BAA2B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAC7H,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { moduleMigrations } from './module-migrations.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { SqlMigration } from './scope-host.js';
|
|
3
3
|
/**
|
|
4
4
|
* What a scope's migration journal records beside each version, and the check that reads it
|
|
5
5
|
* (#2066). Shared by both adapters, so the rule and the sentence an operator reads are one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-digest.d.ts","sourceRoot":"","sources":["../src/migration-digest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"migration-digest.d.ts","sourceRoot":"","sources":["../src/migration-digest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,KAAK,E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AC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAEtE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,OAAO,GAChB,MAAM,GAAG,IAAI,CAgBf"}
|
package/dist/migration-digest.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { substratError, tokenizeSql } from '@substrat-run/contracts';
|
|
2
2
|
import { moduleMigrations } from './module-migrations.js';
|
|
3
3
|
import { assertNoSpineReference, assertNoSpineWrite } from './spine-guard.js';
|
|
4
|
-
import { attachmentSha256 } from './
|
|
4
|
+
import { attachmentSha256 } from './attachment-bytes.js';
|
|
5
5
|
/**
|
|
6
6
|
* What a scope's migration journal records beside each version, and the check that reads it
|
|
7
7
|
* (#2066). Shared by both adapters, so the rule and the sentence an operator reads are one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-digest.js","sourceRoot":"","sources":["../src/migration-digest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"migration-digest.js","sourceRoot":"","sources":["../src/migration-digest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,C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AQ,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,UAAU,IAAI,QAAQ,KAAK,uBAAuB;QAAE,OAAO,IAAI,CAAC;IACxH,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,wFAAwF;QACxF,0DAA0D;QAC1D,OAAO,CACL,yFAAyF;YACzF,6CAA6C,UAAU,sCAAsC;YAC7F,oCAAoC,CACrC,CAAC;IACJ,CAAC;IACD,OAAO,CACL,uEAAuE,QAAQ,IAAI;QACnF,qBAAqB,UAAU,6DAA6D;QAC5F,qGAAqG,CACtG,CAAC;AACJ,CAAC"}
|
package/dist/platform-sweep.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { AccessLogEntry, ConnectionId, MigrationProgress, MigrationStraggler, PlatformActorId, Scope, ScopeId, TenantId, DrainedEvent } from '@substrat-run/contracts';
|
|
1
|
+
import type { AccessLogEntry, Connection, ConnectionId, MigrationProgress, MigrationStraggler, PlatformActorId, Scope, ScopeId, TenantId, DrainedEvent } from '@substrat-run/contracts';
|
|
2
2
|
import type { EdgeHealthReport, ExportReadInput, ExportedBatch, ImportBatch, ImportResult, ImportState, ManifestImports, WantedEvent } from '@substrat-run/contracts';
|
|
3
|
-
import type { ExecutorDrainReport,
|
|
3
|
+
import type { ExecutorDrainReport, HostAdmin, OpsFailureInput, ReconcileOutcome, ScopeHost, SweepRunInput } from './scope-host.js';
|
|
4
4
|
import type { FindingPruneReport } from './findings.js';
|
|
5
5
|
import { type RequestDayCount } from './request-rollup.js';
|
|
6
|
+
import { type FetchLike } from './connector-transport.js';
|
|
7
|
+
import { type TelemetryPruneReport } from './retention.js';
|
|
6
8
|
import type { ScheduleSweepReport } from './schedule-state.js';
|
|
7
9
|
import { ORPHAN_SWEEP_DRY_RUN_WINDOW_MS, type OrphanSweepReport } from './attachment-sweep.js';
|
|
8
10
|
import { type ConnectionLandingOptionsInput } from './connection-landings.js';
|
|
@@ -101,7 +103,7 @@ export interface EventSink {
|
|
|
101
103
|
export interface PlatformSweepOptions {
|
|
102
104
|
/**
|
|
103
105
|
* The durable sweep record (#1232): called once per unit outcome — each
|
|
104
|
-
* connection
|
|
106
|
+
* connection polled/skipped/failed (a cadence wait writes nothing), each schedule run — with the signals stamp
|
|
105
107
|
* the frame can honestly carry. UNSET ⇒ the pass records nothing, exactly as
|
|
106
108
|
* before the seam existed. Sync fire-and-forget: a recorder that throws must
|
|
107
109
|
* never sink the pass, so callers hand in a closure that swallows its own
|
|
@@ -114,12 +116,28 @@ export interface PlatformSweepOptions {
|
|
|
114
116
|
fetch: FetchLike;
|
|
115
117
|
/** provider slug → its reconcile sweeper. A connection whose provider is absent is skipped. */
|
|
116
118
|
sweepers: Record<string, ConnectorSweeper>;
|
|
119
|
+
/** Provider poll interval in minutes. Absent providers poll on every pass. */
|
|
120
|
+
sweepEveryMinutes?: Record<string, number>;
|
|
121
|
+
/**
|
|
122
|
+
* The sweeper for a connection `sweepers` has no entry for (a vertical-defined provider, whose
|
|
123
|
+
* sweeper is built per connection). Asked only when the record has none; absent, such a
|
|
124
|
+
* connection is skipped, as before.
|
|
125
|
+
*/
|
|
126
|
+
sweeperFor?: (connection: Connection) => ConnectorSweeper | undefined;
|
|
117
127
|
/**
|
|
118
128
|
* #2316: grant and bind each live connection from the landings its vertical's running version
|
|
119
129
|
* declares, before it is swept. UNSET skips the step, and a connection is swept on whatever
|
|
120
130
|
* bindings it already has, as before.
|
|
121
131
|
*/
|
|
122
132
|
connectionLandings?: ConnectionLandingOptionsInput;
|
|
133
|
+
/**
|
|
134
|
+
* #2316: staff's ledger row for a connection sweep that failed. The connection's sweep row is read
|
|
135
|
+
* by its tenant, so it says only what became of the sweep, with counts, under the platform's
|
|
136
|
+
* reference; the failure's own text (a provider's answer, a landing refusal) is filed here under
|
|
137
|
+
* the same reference with no tenant (`withheldStaffFailure`). Fire-and-forget, as `recordSweepRun`.
|
|
138
|
+
* UNSET ⇒ the text stays in the report's `errors`, as before.
|
|
139
|
+
*/
|
|
140
|
+
recordFailure?: (entry: Omit<OpsFailureInput, 'actor'>) => void;
|
|
123
141
|
/** Max scope drains / connection sweeps in flight at once. Default 8. */
|
|
124
142
|
concurrency?: number;
|
|
125
143
|
/**
|
|
@@ -425,7 +443,7 @@ export interface PlatformSweepReport {
|
|
|
425
443
|
drainTotals: ExecutorDrainReport;
|
|
426
444
|
/** Connections a sweeper ran for. */
|
|
427
445
|
connectionsSwept: number;
|
|
428
|
-
/** Connections skipped — revoked,
|
|
446
|
+
/** Connections skipped — revoked, without a sweeper, or not yet due. */
|
|
429
447
|
connectionsSkipped: number;
|
|
430
448
|
/**
|
|
431
449
|
* #2316: what the landing step granted and bound from declarations, summed over connections, or
|