@fabrika/control-contract 0.5.3 → 0.5.5
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/package.json +4 -4
- package/src/index.ts +39 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/control-contract",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"zod": "^3.25.76",
|
|
28
|
-
"@fabrika/auth-core": "0.5.
|
|
29
|
-
"@fabrika/app": "0.5.
|
|
30
|
-
"@fabrika/provider-contract": "0.5.
|
|
28
|
+
"@fabrika/auth-core": "0.5.5",
|
|
29
|
+
"@fabrika/app": "0.5.5",
|
|
30
|
+
"@fabrika/provider-contract": "0.5.5"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EndpointKind, EndpointMethod } from '@fabrika/auth-core'
|
|
1
2
|
import type { JsonValue, ProviderEnvelope } from '@fabrika/provider-contract'
|
|
2
3
|
import { z } from 'zod'
|
|
3
4
|
|
|
@@ -224,6 +225,8 @@ export interface AppEnvDto {
|
|
|
224
225
|
* sites declare and the database code its migrations declare. Listed whether or not the environment is protected.
|
|
225
226
|
*/
|
|
226
227
|
deviationSubjects: DeviationSubjectDto[]
|
|
228
|
+
/** The published snapshot's endpoints as the outside reaches them, most exposed first; empty until a run publishes one. */
|
|
229
|
+
surface: SurfaceEndpointDto[]
|
|
227
230
|
namespaceId: string | null
|
|
228
231
|
provider: string
|
|
229
232
|
target: ProviderEnvelopeDto
|
|
@@ -239,6 +242,27 @@ export interface DeviationSubjectDto {
|
|
|
239
242
|
steps: string[]
|
|
240
243
|
}
|
|
241
244
|
|
|
245
|
+
/** Who reaches an endpoint, most exposed first. */
|
|
246
|
+
export const SURFACE_REACHES = ['anyone', 'link', 'app', 'machine', 'human'] as const
|
|
247
|
+
|
|
248
|
+
/** An endpoint is listed under its most exposed caller: `anyone` for an anonymous kind, `app` for an `app:<id>` caller. */
|
|
249
|
+
export type SurfaceReach = (typeof SURFACE_REACHES)[number]
|
|
250
|
+
|
|
251
|
+
/** One endpoint of a published snapshot, in the approval's words. */
|
|
252
|
+
export interface SurfaceEndpointDto {
|
|
253
|
+
id: string
|
|
254
|
+
method: EndpointMethod
|
|
255
|
+
path: string
|
|
256
|
+
kind: EndpointKind
|
|
257
|
+
reach: SurfaceReach
|
|
258
|
+
/** Every caller kind the endpoint admits; empty for an anonymous kind. */
|
|
259
|
+
callers: string[]
|
|
260
|
+
/** What a caller must hold: `who are members` or `` with `notes.read` (on `note`) ``; null for an anonymous kind. */
|
|
261
|
+
requirement: string | null
|
|
262
|
+
/** What else opens the endpoint: another origin, a file it answers, a body limit, a form's protection, a signature. */
|
|
263
|
+
notes: string[]
|
|
264
|
+
}
|
|
265
|
+
|
|
242
266
|
export interface PutAppEnvRequest {
|
|
243
267
|
domain?: string | null
|
|
244
268
|
publicOrigin?: string | null
|
|
@@ -459,19 +483,23 @@ export interface RunDto {
|
|
|
459
483
|
}
|
|
460
484
|
|
|
461
485
|
/**
|
|
462
|
-
* One plain-language line of an access change
|
|
463
|
-
*
|
|
486
|
+
* One plain-language line of an access change. `effect` is `widens` when it can grant access the baseline did not,
|
|
487
|
+
* `narrows` when it can only take access away, and `neutral` when it admits no one new and takes nothing away.
|
|
488
|
+
* `review: 'closer'` marks a step off the paved road (declared reach, database code) or a change the diff cannot classify.
|
|
464
489
|
*/
|
|
465
490
|
export interface AccessChangeDto {
|
|
466
|
-
|
|
491
|
+
effect: 'widens' | 'narrows' | 'neutral'
|
|
467
492
|
line: string
|
|
468
493
|
review?: 'closer'
|
|
494
|
+
/** The line opens an endpoint to the pages on the origins the environment lists; `ApprovalDto.crossOrigins` names them. */
|
|
495
|
+
environmentOrigins?: true
|
|
469
496
|
}
|
|
470
497
|
|
|
471
498
|
/** A run's access change against its environment's active snapshot (ADR-0050 §3). */
|
|
472
499
|
export interface ApprovalDto {
|
|
473
500
|
run: RunDto
|
|
474
|
-
|
|
501
|
+
/** `none`: no line. `no-widening`: lines that narrow or leave access unchanged; it publishes at once. */
|
|
502
|
+
outcome: 'none' | 'no-widening' | 'widening'
|
|
475
503
|
changes: AccessChangeDto[]
|
|
476
504
|
/** The digest of the run's snapshot and of the active one it was compared with: an approval is bound to both. */
|
|
477
505
|
candidateDigest: string
|
|
@@ -479,6 +507,13 @@ export interface ApprovalDto {
|
|
|
479
507
|
/** The published run the change was compared with; null when nothing was published. */
|
|
480
508
|
baselineRunId: string | null
|
|
481
509
|
protected: boolean
|
|
510
|
+
/**
|
|
511
|
+
* The environment's cross-origin list as it stands now: the pages an endpoint the contract opens to the environment's
|
|
512
|
+
* list answers. It is set on the environment, takes effect at once, and no approval covers it (ADR-0050). Only on one
|
|
513
|
+
* approval read while the run waits for a decision, its environment exists and a line has `environmentOrigins`;
|
|
514
|
+
* empty when the environment lists none.
|
|
515
|
+
*/
|
|
516
|
+
crossOrigins?: string[]
|
|
482
517
|
/** The human who approved it, once one did. */
|
|
483
518
|
approval: { principalId: string; label: string; approvedAt: number } | null
|
|
484
519
|
}
|