@substrat-run/contracts 0.133.0 → 0.135.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/capability.d.ts +111 -1
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +90 -1
- package/dist/capability.js.map +1 -1
- package/dist/control-plane.d.ts +4 -0
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +2 -0
- package/dist/control-plane.js.map +1 -1
- package/dist/deploy.d.ts +2 -0
- package/dist/deploy.d.ts.map +1 -1
- package/dist/events.d.ts +76 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +17 -0
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/model.d.ts +17 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +2 -0
- package/dist/model.js.map +1 -1
- package/dist/operations.d.ts +17 -3
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js.map +1 -1
- package/dist/refusal.d.ts +87 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +93 -0
- package/dist/refusal.js.map +1 -0
- package/package.json +1 -1
package/dist/refusal.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { actor } from './events.js';
|
|
3
|
+
import { impersonationStamp } from './impersonation.js';
|
|
4
|
+
import { scopeId, tenantId } from './ids.js';
|
|
5
|
+
import { lifecycleActorKind } from './lifecycle-flow.js';
|
|
6
|
+
/**
|
|
7
|
+
* The read side of the refusal log (#1745) — a scope-local record of every lifecycle move
|
|
8
|
+
* `assertTransition` refused and the operation failed with, written on the failure path as
|
|
9
|
+
* a write of its own AFTER the rollback it is evidence of.
|
|
10
|
+
*
|
|
11
|
+
* The denial log's sibling, and read the same way (`permissionDenial` / `denialFilter`):
|
|
12
|
+
* a denial is the permission model disagreeing with an actor, a refusal is the lifecycle
|
|
13
|
+
* disagreeing with one. `lifecycleFlow` already counts these per (from, attempted) for the
|
|
14
|
+
* process map; this is the row read beneath that count — WHICH record, WHO, in WHICH call —
|
|
15
|
+
* so a red stub reaches the requests that drew it.
|
|
16
|
+
*
|
|
17
|
+
* The same two properties hold as for denials: the volume is actor-influenceable (a client
|
|
18
|
+
* retrying an illegal move mints a row per attempt), and the window is a storage bound,
|
|
19
|
+
* not a retention promise — rows drain rather than expire.
|
|
20
|
+
*/
|
|
21
|
+
/** How many refusal rows an unbounded read returns — a screenful, newest-first. */
|
|
22
|
+
export const DEFAULT_REFUSAL_LIMIT = 50;
|
|
23
|
+
/** The hard ceiling on one page of refusal rows. */
|
|
24
|
+
export const REFUSAL_LIMIT_MAX = 200;
|
|
25
|
+
/**
|
|
26
|
+
* One recorded refusal.
|
|
27
|
+
*
|
|
28
|
+
* `kind` is `'transition'` for every row today; a K-38 guard refusal is the next kind,
|
|
29
|
+
* recorded in the same table. It is read as text rather than a closed enum so a reader
|
|
30
|
+
* built now does not reject the row a later kernel writes.
|
|
31
|
+
*/
|
|
32
|
+
export const refusalRecord = z.object({
|
|
33
|
+
/** ULID — chronological, so it is also the sort key. */
|
|
34
|
+
id: z.string().min(1),
|
|
35
|
+
kind: z.string().min(1),
|
|
36
|
+
/**
|
|
37
|
+
* The problem code the operation failed with — `invalid_transition` for a transition
|
|
38
|
+
* refusal, which is the `reason` on the 409 the caller received. Null for a kind this
|
|
39
|
+
* reader does not know the code of.
|
|
40
|
+
*/
|
|
41
|
+
reason: z.string().nullable(),
|
|
42
|
+
/** WHO attempted the move: a principal, a `{ system }` module, a `{ connection }`, … */
|
|
43
|
+
actor,
|
|
44
|
+
/** The actor's kind, read off its stored shape — what the process map counts by. */
|
|
45
|
+
actorKind: lifecycleActorKind,
|
|
46
|
+
tenantId,
|
|
47
|
+
scopeId: scopeId.nullable(),
|
|
48
|
+
/** The record the move was refused on. Null when the caller of `assertTransition` did not name it. */
|
|
49
|
+
entityType: z.string().nullable(),
|
|
50
|
+
entityId: z.string().nullable(),
|
|
51
|
+
/** The state the record was in. */
|
|
52
|
+
fromState: z.string(),
|
|
53
|
+
/** Where the operation leads where it IS legal; null when that is not one state. */
|
|
54
|
+
attemptedState: z.string().nullable(),
|
|
55
|
+
/** The lifecycle's operation — what the edge is keyed by. */
|
|
56
|
+
operation: z.string(),
|
|
57
|
+
/** The `invoke()` string the call ran as. The same as `operation` for every caller today. */
|
|
58
|
+
invokedOperation: z.string().nullable(),
|
|
59
|
+
/** The staff actor and session behind the attempt (K-42), or null for the ordinary case. */
|
|
60
|
+
impersonation: impersonationStamp.nullable(),
|
|
61
|
+
/** The invocation the refusal happened during — the join to the rest of its request. */
|
|
62
|
+
invocationId: z.string().nullable(),
|
|
63
|
+
/** ISO 8601. */
|
|
64
|
+
at: z.string().min(1),
|
|
65
|
+
drainedAt: z.string().nullable(),
|
|
66
|
+
/**
|
|
67
|
+
* Why this row could not be read whole — ABSENT on every row the kernel wrote. Same rule
|
|
68
|
+
* as `permissionDenial.decodeError` (#1636): an undecodable actor or impersonation reads
|
|
69
|
+
* as its empty value beside this, rather than taking the page down.
|
|
70
|
+
*/
|
|
71
|
+
decodeError: z.string().min(1).optional(),
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* What narrows a refusal read. Every field is an exact match except the `since`/`until`
|
|
75
|
+
* bounds on `at` (inclusive lower, exclusive upper) — the denial filter's convention, so
|
|
76
|
+
* adjacent windows tile.
|
|
77
|
+
*
|
|
78
|
+
* `actor` takes the LOGICAL actor, as `denialFilter.actor` does: a bare principal ULID or
|
|
79
|
+
* the object form for any other kind. The stored encoding is the reader's problem.
|
|
80
|
+
*/
|
|
81
|
+
export const refusalFilter = z.object({
|
|
82
|
+
entityType: z.string().min(1).optional(),
|
|
83
|
+
entityId: z.string().min(1).optional(),
|
|
84
|
+
actor: z.string().min(1).optional(),
|
|
85
|
+
operation: z.string().min(1).optional(),
|
|
86
|
+
invocationId: z.string().min(1).optional(),
|
|
87
|
+
/** ISO 8601, inclusive. */
|
|
88
|
+
since: z.string().min(1).optional(),
|
|
89
|
+
/** ISO 8601, exclusive. */
|
|
90
|
+
until: z.string().min(1).optional(),
|
|
91
|
+
limit: z.number().int().min(1).max(REFUSAL_LIMIT_MAX).optional(),
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=refusal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refusal.js","sourceRoot":"","sources":["../src/refusal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACxC,oDAAoD;AACpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,wDAAwD;IACxD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB;;;;OAIG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,wFAAwF;IACxF,KAAK;IACL,oFAAoF;IACpF,SAAS,EAAE,kBAAkB;IAC7B,QAAQ;IACR,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE;IAC3B,sGAAsG;IACtG,UAAU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,EAAE;IACvC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1C,2BAA2B;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,2BAA2B;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE;CACjE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.135.0",
|
|
4
4
|
"description": "Substrat kernel contract schemas — Zod is the source of truth (master plan D-22); OAS/JSON Schema are emitted artifacts",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|