@serve.zone/interfaces 32.92.0 → 32.94.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026-11-16 - 32.94.0
4
+
5
+ ### Features
6
+
7
+ - An area refusal names the rows it refuses as data (AGL-2071, Linus rulings 212 point 3 and 216): `data.IGatewayAreaApplyState.refusal` is now the named `data.IGatewayAreaApplyRefusal`, which gains the optional member `rows`, a list of `data.IGatewayAreaApplyRefusedRow` (`{ member, id, reason }`): a list member of the refused area (never a singleton of `data.gatewayAreaSingletonMembers`), the row's id (`data.isGatewayAreaRowId`, and, as a table row id already must, without an unpaired UTF-16 surrogate) and the gateway's reason for that row, never a value of the row and never a hostname. `rows` holds 1 to `data.gatewayConnectorContract.maximumRefusalRows` (256) entries, each `(member, id, reason)` once, in no particular order, and its key is omitted, never empty or `undefined`, when the gateway names no row. A gateway names a row only when it judged that row; a gateway that could not judge names none. The bound counts entries, so a row with two reasons takes two; a gateway that refuses more entries names the first 256 in a fixed order (member order of `data.gatewayAreaMembers`, then row order of the pushed table, then reason) and starts the detail with the total count. A reason is lowercase letter words joined by single hyphens, at most `data.gatewayConnectorContract.maximumRefusalRowReasonLength` (64) characters, the form of a runtime session refusal reason, so no digit, dot or other separator can carry a hostname, an address or a count; it is judged by form only, so a new gateway reason needs no release of this package and a reader shows a reason it does not know as text (dcrouter's ownership gate states `no-managed-domain`, `provider-link-missing`, `unverified-dcrouter-zone` and `invalid-hostname` in its detail today). 256 entries keep a status document at every bound of this contract below 2 MiB, the message cap of the controller's socket server, with five refusing areas and every free-text member at its widest JSON character (1,584,299 bytes); twice as many would not. The list adds to `detail` and replaces nothing: `reason`, `detail`, `data.gatewayApplyRefusals` and every other member keep their meaning, type and bounds, a report and a stored status record without `rows` validate as before, and the list is no promise that the table applies without the named rows. The refusal was already exact-keys, so a reader built before this release refuses the whole report that carries `rows` (the `applyDesiredState` answer, the hello and every status push; Cloudly's status record and dcrouter's connector state validate the stored report on read), and a gateway learns no version of its controller to gate it on. Deployment order (Linus rulings 212 and 216): the `@serve.zone/interfaces` release with `rows` is published first; then every controller a gateway can dial (central and hub Cloudly, each shadow of its peer set) runs a Cloudly release built on it; only then is a dcrouter that writes `rows` started on that gateway. From the first report with `rows` that either side stores, neither side is deployed below its first such release: a defect is fixed by a newer release, never by a rollback. Spec: `test.gatewayapplyrefusalrows` (an `applyDesiredState` answer and a Cloudly status record without `rows`, modelled on the lab's refused report, still validate; rows at every bound; a failing case for each bound and form, an unpaired surrogate in an id included; a hostname member refused by exact keys; a status document at every bound below 2 MiB).
8
+
9
+ ## 2026-11-15 - 32.93.0
10
+
11
+ ### Features
12
+
13
+ - The operator row writer (AGL-1183, Linus rulings 117 §4 criterion 4 and §6, 121 §6 item 7, 123 D1, 166 points 2 and 4, 171): once a gateway is taken over, an administrator changes its tables one row at a time. `requests.gatewayconnector.IReq_Admin_Cloudly_GetGatewayAreaRows` (`getGatewayAreaRows`) reads one area table (revision, digest, and per row its address, compare token `digest`, `owner` and write form with every secret as `keep`, never a value), answered by `data.TGatewayAreaRowsReport`; `requests.gatewayconnector.IReq_Admin_Cloudly_WriteGatewayAreaRow` (`writeGatewayAreaRow`) puts one row or singleton value, or deletes one list row, with compare-and-swap on that digest (`data.TGatewayAreaRowWrite`), answered by `data.TGatewayAreaRowWriteReport`. Both are declared beside `takeOverGateway` and take its caller: a human administrator who signed in within the last five minutes, with neither a delegated admin temp token nor a machine identity, refused otherwise with an error naming the requirement before anything is read (the write judges it again inside its transaction); no delegated admin scope names either. Their report codes are the closed lists `data.gatewayAreaRowsRefusals` (`gateway-not-found`, `gateway-not-taken-over`) and `data.gatewayAreaRowWriteRefusals` (in judging order), all names of `data.gatewayIntentRefusals`, which gains `intent-row-stale` (the row moved since the read) and `kept-secret-unknown` (the written row keeps a secret the row does not hold: fix the row, do not re-read) after `intent-revision-stale`; a reader shows a name it does not know as text, so no reader gate is needed. The write form (`data.IGatewayAreaRowWrites`, nine `…Write` row types) replaces every secret with `data.TGatewaySealedValueWrite` (`keep` a stored version, `set` a value whose version the controller mints with `data.createGatewaySealedVersion`; a request never states a version) or `data.TGatewayVerifierWrite`. The compare token is `data.computeGatewayAreaRowDigest` (`data.createGatewayAreaRowDigestInput`, domain `data.gatewayAreaRowContract.rowDigestDomain`): it takes every sealed member by its version only and a verifier as stored, so a reader who holds every other input cannot test a guess at a sealed value against it. `data.validateGatewayAreaRowWrite` is the one check of a write's envelope and secret forms, which the controller runs before it reads and a client before it signs in; `data.projectGatewayAreaRow` and `data.resolveGatewayAreaRowWrite` project a stored row and resolve a write form, and `data.gatewayAreaSingletonMembers`, `data.isGatewayAreaMember`, `data.isGatewayAreaSingletonMember` and `data.isGatewayAreaRowId` name the row addresses. `data.gatewayAreaSecretPaths` is now the one list of where a table holds a secret: `data.listGatewayAreaSecrets` is computed from it with its output unchanged, and the row helpers walk it. Apart from the two refusal names, no shape an earlier release declared changes. Spec: `test.gatewayarearows` (method pins and no delegated scope, the refusal lists, the write form names every member, the lister against a copy of the hand-written one, the token is equal for two values under one version and moves with the version, the envelope validator, projection and resolution), `test.gatewayareas` (the computed lister equals the hand-written one over the hub fixture), `test.gatewayconnector` (the method and refusal pins).
14
+
3
15
  ## 2026-11-15 - 32.92.0
4
16
 
5
17
  ### Features
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/interfaces',
6
- version: '32.92.0',
6
+ version: '32.94.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the serve.zone ecosystem.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFNBQVM7SUFDbEIsV0FBVyxFQUFFLHVGQUF1RjtDQUNyRyxDQUFBIn0=
@@ -0,0 +1,369 @@
1
+ import type { IGatewayAcmeSettings, IGatewayAreaKeyRow, IGatewayApiTokenRow, IGatewayBlockRuleRow, IGatewayCoreMailCredentialVerifier, IGatewayCoreMailPeerRow, IGatewayDnsClientHostnameRow, IGatewayDnsDomainRow, IGatewayDnsProtectedHostnameRow, IGatewayDnsProviderRow, IGatewayDnsRecordRow, IGatewayDnsServerSettings, IGatewayDnsStaticRecordRow, IGatewayEdgeHubSettings, IGatewayEdgeRow, IGatewayHttp3Settings, IGatewayMailDomainRow, IGatewayMailIdentityRow, IGatewayMailServerSettings, IGatewayNetworkTargetRow, IGatewayRouteRow, IGatewayScramVerifier, IGatewaySmtpAccountRow, IGatewaySourceProfileRow, IGatewayTargetProfileRow, IGatewayTokenHash, TGatewayEngineConfig } from './gatewayareas.js';
2
+ import { gatewayAreaSingletonMembers } from './gatewayareas.js';
3
+ import { type TGatewayConfigArea } from './gatewayconnector.js';
4
+ import { type TSha256Digest } from './immutableimage.js';
5
+ /** A sealed member (`IGatewaySealedValue`) in a row's write form. */
6
+ export type TGatewaySealedValueWrite =
7
+ /**
8
+ * Keep the value the stored row holds at this path under this version: the form a read answers.
9
+ * A version the stored row does not hold there is refused `kept-secret-unknown`: the written row
10
+ * keeps a secret this row does not hold (a new row, a member stored `null`, another row's
11
+ * version), so the row is fixed, not read again; a row another write moved answers
12
+ * `intent-row-stale` first.
13
+ */
14
+ {
15
+ kind: 'keep';
16
+ version: string;
17
+ }
18
+ /** A new value; the controller mints its version. */
19
+ | {
20
+ kind: 'set';
21
+ value: string;
22
+ };
23
+ /** A verifier member in a row's write form; the secret it verifies never travels. */
24
+ export type TGatewayVerifierWrite<TVerifier> =
25
+ /**
26
+ * Keep the verifier the stored row holds at this path: the form a read answers. A row that holds
27
+ * none there (a new row, a member stored `null`) is refused `kept-secret-unknown`.
28
+ */
29
+ {
30
+ kind: 'keep';
31
+ }
32
+ /** A verifier the operator derived (`deriveGatewayScramVerifier`, a token's SHA-256). */
33
+ | {
34
+ kind: 'set';
35
+ verifier: TVerifier;
36
+ };
37
+ /** `IGatewayApiTokenRow` with its verifier as a keep-or-set choice. */
38
+ export interface IGatewayApiTokenRowWrite extends Omit<IGatewayApiTokenRow, 'credential'> {
39
+ credential: TGatewayVerifierWrite<IGatewayTokenHash>;
40
+ }
41
+ /** `IGatewayDnsProviderRow` with its API token as a keep-or-set choice. */
42
+ export interface IGatewayDnsProviderRowWrite extends Omit<IGatewayDnsProviderRow, 'credentials'> {
43
+ credentials: {
44
+ type: 'cloudflare';
45
+ apiToken: TGatewaySealedValueWrite;
46
+ };
47
+ }
48
+ /** `IGatewayRouteSecrets` with every set secret as a keep-or-set choice. */
49
+ export interface IGatewayRouteSecretsWrite {
50
+ tlsKey: TGatewaySealedValueWrite | null;
51
+ basicAuthUsers: TGatewaySealedValueWrite | null;
52
+ jwtSecret: TGatewaySealedValueWrite | null;
53
+ requestHeaders: TGatewaySealedValueWrite | null;
54
+ }
55
+ /** `IGatewayRouteRow` with its secrets as keep-or-set choices. */
56
+ export interface IGatewayRouteRowWrite extends Omit<IGatewayRouteRow, 'secrets'> {
57
+ secrets: IGatewayRouteSecretsWrite;
58
+ }
59
+ /** `IGatewaySourceProfileSecrets` with every set secret as a keep-or-set choice. */
60
+ export interface IGatewaySourceProfileSecretsWrite {
61
+ basicAuthUsers: TGatewaySealedValueWrite | null;
62
+ jwtSecret: TGatewaySealedValueWrite | null;
63
+ }
64
+ /** `IGatewaySourceProfileRow` with its secrets as keep-or-set choices. */
65
+ export interface IGatewaySourceProfileRowWrite extends Omit<IGatewaySourceProfileRow, 'secrets'> {
66
+ secrets: IGatewaySourceProfileSecretsWrite;
67
+ }
68
+ /** `IGatewayMailServerSettings` with its TLS key as a keep-or-set choice. */
69
+ export interface IGatewayMailServerSettingsWrite extends Omit<IGatewayMailServerSettings, 'tlsKey'> {
70
+ tlsKey: TGatewaySealedValueWrite | null;
71
+ }
72
+ /** `IGatewaySmtpAccountRow` with its verifier as a keep-or-set choice. */
73
+ export interface IGatewaySmtpAccountRowWrite extends Omit<IGatewaySmtpAccountRow, 'credential'> {
74
+ credential: TGatewayVerifierWrite<IGatewayScramVerifier>;
75
+ }
76
+ /** `IGatewayMailIdentityRow` with its verifier as a keep-or-set choice. */
77
+ export interface IGatewayMailIdentityRowWrite extends Omit<IGatewayMailIdentityRow, 'credential'> {
78
+ credential: TGatewayVerifierWrite<IGatewayScramVerifier>;
79
+ }
80
+ /** `IGatewayCoreMailPeerRow` with its verifier list as one keep-or-set choice. */
81
+ export interface IGatewayCoreMailPeerRowWrite extends Omit<IGatewayCoreMailPeerRow, 'credentials'> {
82
+ credentials: TGatewayVerifierWrite<IGatewayCoreMailCredentialVerifier[]>;
83
+ }
84
+ /** `IGatewayEdgeRow` with its tunnel secret as a keep-or-set choice. */
85
+ export interface IGatewayEdgeRowWrite extends Omit<IGatewayEdgeRow, 'secret'> {
86
+ secret: TGatewaySealedValueWrite;
87
+ }
88
+ /**
89
+ * The write form of one row of every member, by area and member: a list member's row, or a
90
+ * singleton's value. A member without secrets writes its table type unchanged.
91
+ */
92
+ export interface IGatewayAreaRowWrites {
93
+ security: {
94
+ blockRules: IGatewayBlockRuleRow;
95
+ apiTokens: IGatewayApiTokenRowWrite;
96
+ proxyPolicy: TGatewayEngineConfig | null;
97
+ };
98
+ dns: {
99
+ server: IGatewayDnsServerSettings | null;
100
+ nameservers: IGatewayAreaKeyRow;
101
+ acme: IGatewayAcmeSettings | null;
102
+ providers: IGatewayDnsProviderRowWrite;
103
+ domains: IGatewayDnsDomainRow;
104
+ records: IGatewayDnsRecordRow;
105
+ staticRecords: IGatewayDnsStaticRecordRow;
106
+ protectedHostnames: IGatewayDnsProtectedHostnameRow;
107
+ authorityZones: IGatewayAreaKeyRow;
108
+ clientHostnames: IGatewayDnsClientHostnameRow;
109
+ };
110
+ routes: {
111
+ routes: IGatewayRouteRowWrite;
112
+ sourceProfiles: IGatewaySourceProfileRowWrite;
113
+ networkTargets: IGatewayNetworkTargetRow;
114
+ targetProfiles: IGatewayTargetProfileRow;
115
+ disabledSystemRoutes: IGatewayAreaKeyRow;
116
+ http3: IGatewayHttp3Settings | null;
117
+ };
118
+ mail: {
119
+ server: IGatewayMailServerSettingsWrite;
120
+ domains: IGatewayMailDomainRow;
121
+ smtpAccounts: IGatewaySmtpAccountRowWrite;
122
+ identities: IGatewayMailIdentityRowWrite;
123
+ coreMailPeers: IGatewayCoreMailPeerRowWrite;
124
+ };
125
+ edges: {
126
+ hub: IGatewayEdgeHubSettings;
127
+ edges: IGatewayEdgeRowWrite;
128
+ };
129
+ }
130
+ /** The member names of an area (those of `IGatewayAreaContents`, which `test.gatewayarearows` pins). */
131
+ export type TGatewayAreaMember<TArea extends TGatewayConfigArea = TGatewayConfigArea> = TArea extends TGatewayConfigArea ? keyof IGatewayAreaRowWrites[TArea] & string : never;
132
+ /** A singleton member of an area. */
133
+ export type TGatewayAreaSingletonMember<TArea extends TGatewayConfigArea = TGatewayConfigArea> = TArea extends TGatewayConfigArea ? typeof gatewayAreaSingletonMembers[TArea][number] : never;
134
+ /** A list member of an area: its rows carry an `id`. */
135
+ export type TGatewayAreaListMember<TArea extends TGatewayConfigArea = TGatewayConfigArea> = TArea extends TGatewayConfigArea ? Exclude<TGatewayAreaMember<TArea>, TGatewayAreaSingletonMember<TArea>> : never;
136
+ /** Whether `memberArg` is a member of the area (`gatewayAreaMembers`). */
137
+ export declare const isGatewayAreaMember: <TArea extends TGatewayConfigArea>(areaArg: TArea, memberArg: unknown) => memberArg is TGatewayAreaMember<TArea>;
138
+ /** Whether a member of the area is a singleton, addressed with `id: null`. */
139
+ export declare const isGatewayAreaSingletonMember: (areaArg: TGatewayConfigArea, memberArg: string) => boolean;
140
+ /**
141
+ * The gateway intent refusals a row read answers in its report: the controller records no such
142
+ * gateway, or did not take it over. A caller who is not a fresh human administrator is refused
143
+ * before this (a `TypedResponseError` naming the requirement), and an area or member the contract
144
+ * does not name is the thrown connector refusal `request-invalid`; neither is a report.
145
+ */
146
+ export declare const gatewayAreaRowsRefusals: readonly ["gateway-not-found", "gateway-not-taken-over"];
147
+ /** A refusal a row read answers. */
148
+ export type TGatewayAreaRowsRefusal = typeof gatewayAreaRowsRefusals[number];
149
+ /**
150
+ * The gateway intent refusals a row write answers in its report, in the order the controller judges
151
+ * them: the gateway (`gateway-not-found`, `gateway-not-taken-over`); `row-compile-owned` (the stored
152
+ * row is a claim of the controller's records, or the put row names the controller's own gateway
153
+ * client, whose rows only the compile writes); then a write whose outcome the table already states
154
+ * answers `ok` with `revision: null`; `intent-row-stale` (the row is not the one `expectedDigest`
155
+ * names); `kept-secret-unknown`; `area-table-invalid` (the resolved table, the whole document or the
156
+ * change rule `validateGatewayAreaContentChange`); `controller-origin-unserved` and
157
+ * `lifeline-unjudged` (a routes write); `gateway-vocabulary-newer`; `intent-revision-stale` (the
158
+ * tables kept moving through the controller's attempts). A caller who is not a fresh human
159
+ * administrator and a write `validateGatewayAreaRowWrite` refuses are refused before any of them,
160
+ * and neither is a report.
161
+ */
162
+ export declare const gatewayAreaRowWriteRefusals: readonly ["gateway-not-found", "gateway-not-taken-over", "row-compile-owned", "intent-row-stale", "kept-secret-unknown", "area-table-invalid", "controller-origin-unserved", "lifeline-unjudged", "gateway-vocabulary-newer", "intent-revision-stale"];
163
+ /** A refusal a row write answers. */
164
+ export type TGatewayAreaRowWriteRefusal = typeof gatewayAreaRowWriteRefusals[number];
165
+ /** The constants of the row read and write. */
166
+ export declare const gatewayAreaRowContract: Readonly<{
167
+ /** The digest domain of `computeGatewayAreaRowDigest`. */
168
+ rowDigestDomain: "serve.zone/gateway-area-row";
169
+ }>;
170
+ /**
171
+ * The canonical JSON a row's compare token hashes (Linus ruling 171 D2): the digest domain, the
172
+ * row's address and the stored row (or singleton value) with every sealed member as its version
173
+ * only (`{ version }`), never its value; a verifier enters as stored and a `null` member as `null`.
174
+ * A version names exactly one value (a writer mints a new one for every new value), so the token
175
+ * moves with every change of the row, a secret's included, while a reader who holds every other
176
+ * input (the read answers the row and the versions) cannot test a guess at a sealed value against
177
+ * it. Throws, naming no value, for an unknown area or member, an `id` that is not `null` exactly
178
+ * for a singleton, and a row that is not strict JSON or lacks a sealed member or its version, which
179
+ * a valid table never holds.
180
+ */
181
+ export declare const createGatewayAreaRowDigestInput: (inputArg: {
182
+ area: TGatewayConfigArea;
183
+ member: string;
184
+ id: string | null;
185
+ row: unknown;
186
+ }) => string;
187
+ /**
188
+ * A row's compare token: `sha256:<hex>` of `createGatewayAreaRowDigestInput`, through Web Crypto.
189
+ * The controller answers it for every row a read answers and for the row a write leaves, and judges
190
+ * a write's `expectedDigest` against it. A reader compares it for equality only.
191
+ */
192
+ export declare const computeGatewayAreaRowDigest: (inputArg: {
193
+ area: TGatewayConfigArea;
194
+ member: string;
195
+ id: string | null;
196
+ row: unknown;
197
+ }) => Promise<TSha256Digest>;
198
+ /**
199
+ * Who a row is the author of: `compile` for a row the controller's own records compile (its claim;
200
+ * an operator write refuses it `row-compile-owned`), `operator` for every other row.
201
+ */
202
+ export type TGatewayAreaRowOwner = 'operator' | 'compile';
203
+ /** One row of a table as an administrator reads it: its address, compare token, author and write form. */
204
+ export type TGatewayAreaRowRead<TArea extends TGatewayConfigArea = TGatewayConfigArea> = TArea extends TGatewayConfigArea ? {
205
+ [TMember in TGatewayAreaMember<TArea>]: {
206
+ member: TMember;
207
+ /** The row's `id`; `null` for a singleton. */
208
+ id: TMember extends TGatewayAreaSingletonMember<TArea> ? null : string;
209
+ /**
210
+ * The compare token a write of this row names (`expectedDigest`): `computeGatewayAreaRowDigest`
211
+ * of the stored row, which takes every sealed member by its version only. A reader compares it
212
+ * for equality only.
213
+ */
214
+ digest: TSha256Digest;
215
+ owner: TGatewayAreaRowOwner;
216
+ /** The write form, every secret as `keep`: a sealed member with its version, never its value. */
217
+ row: IGatewayAreaRowWrites[TArea][TMember];
218
+ };
219
+ }[TGatewayAreaMember<TArea>] : never;
220
+ /** One area table of a taken-over gateway as an administrator reads it: revision, digest and rows. */
221
+ export interface IGatewayAreaRowsRead {
222
+ gatewayId: string;
223
+ area: TGatewayConfigArea;
224
+ /** The controller revision that wrote the table last. */
225
+ revision: number;
226
+ /** `computeGatewayAreaTableDigest` of the table: what the gateway reports applied once it applied it. */
227
+ tableDigest: TSha256Digest;
228
+ /**
229
+ * The rows of the member asked for (every member when none was): members ascending by
230
+ * `compareWireTokens`, each member's rows in the table's order (ascending by id).
231
+ */
232
+ rows: TGatewayAreaRowRead[];
233
+ }
234
+ /** A table read's answer: the table, or why there is none. No secret value. */
235
+ export type TGatewayAreaRowsReport = {
236
+ ok: true;
237
+ table: IGatewayAreaRowsRead;
238
+ } | {
239
+ ok: false;
240
+ code: TGatewayAreaRowsRefusal;
241
+ };
242
+ /**
243
+ * Put one row: create or replace a list row (its `row.id` is `id`), or replace a singleton's value
244
+ * (`id: null`; `row: null` for a nullable singleton). `expectedDigest` is the row's `digest` as the
245
+ * administrator read it, or `null` for a list row that must be absent.
246
+ */
247
+ export type TGatewayAreaRowPut = {
248
+ [TArea in TGatewayConfigArea]: {
249
+ [TMember in TGatewayAreaMember<TArea>]: {
250
+ operation: 'put';
251
+ area: TArea;
252
+ member: TMember;
253
+ id: TMember extends TGatewayAreaSingletonMember<TArea> ? null : string;
254
+ expectedDigest: TSha256Digest | null;
255
+ row: IGatewayAreaRowWrites[TArea][TMember];
256
+ };
257
+ }[TGatewayAreaMember<TArea>];
258
+ }[TGatewayConfigArea];
259
+ /** Delete one list row; `expectedDigest` is its `digest` as the administrator read it. A singleton is never deleted. */
260
+ export type TGatewayAreaRowDelete = {
261
+ [TArea in TGatewayConfigArea]: {
262
+ operation: 'delete';
263
+ area: TArea;
264
+ member: TGatewayAreaListMember<TArea>;
265
+ id: string;
266
+ expectedDigest: TSha256Digest;
267
+ };
268
+ }[TGatewayConfigArea];
269
+ /** One row-level compare-and-swap write. */
270
+ export type TGatewayAreaRowWrite = TGatewayAreaRowPut | TGatewayAreaRowDelete;
271
+ /** A sealed version a put minted, by the secret's path inside the row. */
272
+ export interface IGatewayAreaRowMintedVersion {
273
+ path: string;
274
+ version: string;
275
+ }
276
+ /** What a row write changed. */
277
+ export interface IGatewayAreaRowWritten {
278
+ gatewayId: string;
279
+ area: TGatewayConfigArea;
280
+ member: string;
281
+ id: string | null;
282
+ operation: 'put' | 'delete';
283
+ /**
284
+ * The controller revision the write appended; `null` when the table already stated what the
285
+ * write asked (the put row equals the stored one, or the deleted row is absent) and nothing was
286
+ * written.
287
+ */
288
+ revision: number | null;
289
+ /** The row's compare token now; `null` after a delete. */
290
+ digest: TSha256Digest | null;
291
+ /** The table's digest now: what the gateway reports applied once it applied the write. */
292
+ tableDigest: TSha256Digest;
293
+ /** Every sealed version this put minted, ascending by path; never a value. */
294
+ mintedVersions: IGatewayAreaRowMintedVersion[];
295
+ }
296
+ /**
297
+ * A row write's answer: what it changed, or the refusal that left every table as it was, with the
298
+ * validator lines that name why (area, member, row id, path and code; never a value).
299
+ */
300
+ export type TGatewayAreaRowWriteReport = {
301
+ ok: true;
302
+ written: IGatewayAreaRowWritten;
303
+ } | {
304
+ ok: false;
305
+ code: TGatewayAreaRowWriteRefusal;
306
+ problems: string[];
307
+ };
308
+ /**
309
+ * The one check of a row write's envelope (Linus ruling 171 section 4), which the controller runs
310
+ * before it reads anything and a client runs before it signs in: exact keys per operation, a
311
+ * configuration area and one of its members, `id` `null` exactly for a singleton (which is never
312
+ * deleted) and a row id (`isGatewayAreaRowId`) for a list member, a `sha256:` `expectedDigest`
313
+ * (`null` only for a put), and for a put a strict JSON row whose `id` is the address's (a list
314
+ * member) and whose every secret member (`gatewayAreaSecretPaths`) is `null` or one of its
315
+ * keep-or-set forms. The controller answers any problem as the thrown connector refusal
316
+ * `request-invalid`. The row's other members are the area validator's, judged with its table once
317
+ * the write is resolved. Problems name keys and paths, never a value.
318
+ */
319
+ export declare const validateGatewayAreaRowWrite: (valueArg: unknown, pathArg?: string) => string[];
320
+ /**
321
+ * A stored row (or singleton value) of a valid table in its write form, every secret as `keep`: a
322
+ * sealed member as its version, a verifier as `{ kind: 'keep' }`, a `null` member as `null`. Throws
323
+ * for a row that is not strict JSON or lacks a secret member's parent, which a valid table never
324
+ * holds.
325
+ */
326
+ export declare const projectGatewayAreaRow: <TArea extends TGatewayConfigArea, TMember extends TGatewayAreaMember<TArea>>(areaArg: TArea, memberArg: TMember, storedArg: unknown) => IGatewayAreaRowWrites[TArea][TMember];
327
+ /**
328
+ * Why a row's write form cannot be resolved, by the secret's path: `invalid-write-form` for a
329
+ * secret member that is not one of its keep-or-set forms (a write `validateGatewayAreaRowWrite`
330
+ * refuses), or `kept-secret-unknown` for a `keep` the stored row does not hold there. Never a value.
331
+ */
332
+ export interface IGatewayAreaRowWriteFormRefusal {
333
+ /** The secret's dotted path inside the row; `''` for the row as a whole. */
334
+ path: string;
335
+ code: 'invalid-write-form' | 'kept-secret-unknown';
336
+ }
337
+ /** A resolved write: the row in its stored form, and every version minted for it. */
338
+ export type TGatewayAreaRowResolution = {
339
+ ok: true;
340
+ row: unknown;
341
+ mintedVersions: IGatewayAreaRowMintedVersion[];
342
+ } | {
343
+ ok: false;
344
+ refusals: IGatewayAreaRowWriteFormRefusal[];
345
+ };
346
+ /**
347
+ * Resolves a row's write form against the row stored at the same address (`null` when there is
348
+ * none) into its stored form: a sealed `keep` becomes the stored `{ version, value }` at that path
349
+ * when the stored row holds that version there, a verifier `keep` the stored verifier when the row
350
+ * holds one; a sealed `set` becomes `{ version: mintVersionArg(), value }`, a verifier `set` the
351
+ * stated verifier; `null` stays `null`. Every other member is copied as written; the area validator
352
+ * judges the resolved row as part of its table. Judges the forms with the rule
353
+ * `validateGatewayAreaRowWrite` applies and never reads a value into a refusal. The minted
354
+ * versions are answered ascending by path. `mintVersionArg` is the writer's
355
+ * (`createGatewaySealedVersion`).
356
+ */
357
+ export declare const resolveGatewayAreaRowWrite: (inputArg: {
358
+ area: TGatewayConfigArea;
359
+ member: string;
360
+ written: unknown;
361
+ stored: unknown | null;
362
+ mintVersion: () => string;
363
+ }) => TGatewayAreaRowResolution;
364
+ /**
365
+ * A new sealed version: 22 base64url characters of 128 random bits (`IGatewaySealedValue.version`),
366
+ * drawn with Web Crypto. The writer that sets a secret mints one for every new value (Linus ruling
367
+ * 121 Q9); a version is never reused for another value.
368
+ */
369
+ export declare const createGatewaySealedVersion: () => string;