@substrat-run/kernel 0.220.0 → 0.221.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/adopt-major.d.ts +150 -0
- package/dist/adopt-major.d.ts.map +1 -0
- package/dist/adopt-major.js +150 -0
- package/dist/adopt-major.js.map +1 -0
- package/dist/app-environments.d.ts +54 -3
- package/dist/app-environments.d.ts.map +1 -1
- package/dist/app-environments.js +126 -3
- package/dist/app-environments.js.map +1 -1
- package/dist/carried-copy.d.ts.map +1 -1
- package/dist/carried-copy.js +3 -0
- package/dist/carried-copy.js.map +1 -1
- package/dist/directory-lake-keep.d.ts.map +1 -1
- package/dist/directory-lake-keep.js +1 -0
- package/dist/directory-lake-keep.js.map +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/permission-checker.d.ts.map +1 -1
- package/dist/permission-checker.js +4 -2
- package/dist/permission-checker.js.map +1 -1
- package/dist/reserved-roles.d.ts +6 -1
- package/dist/reserved-roles.d.ts.map +1 -1
- package/dist/reserved-roles.js.map +1 -1
- package/dist/schedule-due.d.ts +88 -0
- package/dist/schedule-due.d.ts.map +1 -0
- package/dist/schedule-due.js +116 -0
- package/dist/schedule-due.js.map +1 -0
- package/dist/schedule-state.d.ts +1 -1
- package/dist/schedule-state.d.ts.map +1 -1
- package/dist/schedule-state.js +6 -0
- package/dist/schedule-state.js.map +1 -1
- package/dist/scope-copy.d.ts.map +1 -1
- package/dist/scope-copy.js +7 -1
- package/dist/scope-copy.js.map +1 -1
- package/dist/scope-host.d.ts +138 -2
- package/dist/scope-host.d.ts.map +1 -1
- package/dist/scope-host.js.map +1 -1
- package/dist/scope-store.d.ts +30 -6
- package/dist/scope-store.d.ts.map +1 -1
- package/dist/scope-store.js +30 -1
- package/dist/scope-store.js.map +1 -1
- package/dist/scope-types.d.ts +107 -3
- package/dist/scope-types.d.ts.map +1 -1
- package/dist/scope-types.js +153 -2
- package/dist/scope-types.js.map +1 -1
- package/dist/store-proof.d.ts +45 -0
- package/dist/store-proof.d.ts.map +1 -0
- package/dist/store-proof.js +97 -0
- package/dist/store-proof.js.map +1 -0
- package/package.json +2 -2
package/dist/scope-types.d.ts
CHANGED
|
@@ -9,13 +9,29 @@
|
|
|
9
9
|
* surface lists. A host given no `permissions`, or a surface declaring no types, has one `home`
|
|
10
10
|
* type running every registered module, as every host does today.
|
|
11
11
|
*/
|
|
12
|
-
import { HOME_SCOPE_TYPE } from '@substrat-run/contracts';
|
|
12
|
+
import { HOME_SCOPE_TYPE, type SubstratError } from '@substrat-run/contracts';
|
|
13
13
|
export { HOME_SCOPE_TYPE };
|
|
14
|
-
/** A scope type as a host reads it off its `permissions`: a name
|
|
14
|
+
/** A scope type as a host reads it off its `permissions`: a name, the modules it runs and its roles. */
|
|
15
15
|
export interface HostScopeTypeDeclaration {
|
|
16
16
|
readonly name: string;
|
|
17
17
|
readonly modules: readonly string[];
|
|
18
|
+
/** The vertical's roles that exist on a scope of this type (#2993 part 3). Absent: none. */
|
|
19
|
+
readonly roles?: readonly string[];
|
|
20
|
+
/** The types a scope of this type may hold as children (#2995). Absent: none. */
|
|
21
|
+
readonly children?: readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* How a request may reach a scope of this type (#2995): `direct`, `parent` or both. Absent: the
|
|
24
|
+
* contract's default, `direct` for the home type and `parent` for any other.
|
|
25
|
+
*/
|
|
26
|
+
readonly accepts?: readonly ('direct' | 'parent')[];
|
|
18
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The `_substrat_meta` key a Durable Object records its scope's type under (#2993 part 3), as it
|
|
30
|
+
* records its tenant: written once at provision, read at wake. Absent is `home`, which every scope
|
|
31
|
+
* from before scope types is. It describes this store, never the data, so no dump carries it
|
|
32
|
+
* (`STORE_LOCAL_META_KEYS`): a copy's type is the one its own provision fixed.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SCOPE_TYPE_META_KEY = "scope_type";
|
|
19
35
|
/**
|
|
20
36
|
* The modules each type runs. `declared: false` is the one implicit `home` type, whose module set
|
|
21
37
|
* is every module registered (`null`), so nothing about such a host changes.
|
|
@@ -24,8 +40,19 @@ export type ScopeTypePlan = {
|
|
|
24
40
|
readonly declared: false;
|
|
25
41
|
} | {
|
|
26
42
|
readonly declared: true;
|
|
43
|
+
/** Each type's modules. */
|
|
27
44
|
readonly types: ReadonlyMap<string, ReadonlySet<string>>;
|
|
45
|
+
/** Each type's roles (#2993 part 3). */
|
|
46
|
+
readonly roles: ReadonlyMap<string, ReadonlySet<string>>;
|
|
47
|
+
/** Every role some type names: the roles a scope-role door judges by type. */
|
|
48
|
+
readonly typedRoles: ReadonlySet<string>;
|
|
49
|
+
/** Each type's child types (#2995). */
|
|
50
|
+
readonly children: ReadonlyMap<string, ReadonlySet<string>>;
|
|
51
|
+
/** How each type may be reached (#2995). */
|
|
52
|
+
readonly accepts: ReadonlyMap<string, ReadonlySet<ScopeAccess>>;
|
|
28
53
|
};
|
|
54
|
+
/** How a request reaches a scope (#2995): routed to it, or from its parent's host code through the door. */
|
|
55
|
+
export type ScopeAccess = 'direct' | 'parent';
|
|
29
56
|
/** What a host's `permissions` carries for this: its listed modules, and its types if declared. */
|
|
30
57
|
export interface ScopeTypeSource {
|
|
31
58
|
readonly modules: readonly {
|
|
@@ -37,6 +64,14 @@ export interface ScopeTypeSource {
|
|
|
37
64
|
}
|
|
38
65
|
/** The host's plan from its `permissions`. Throws, at construction, on a declaration it cannot act on. */
|
|
39
66
|
export declare function scopeTypePlanOf(permissions: ScopeTypeSource | undefined): ScopeTypePlan;
|
|
67
|
+
/**
|
|
68
|
+
* #2993 part 4: the plan of a vertical as its STORED deploy manifest declares it, for a module-less
|
|
69
|
+
* coordinator, which registers none of the vertical's modules and so has no `permissions` of its
|
|
70
|
+
* own for it. The types name the modules they run, so those are the modules listed. A manifest that
|
|
71
|
+
* declares no types, or none this reads, is the one implicit `home` type: such a coordinator then
|
|
72
|
+
* refuses every other type, as it did before the manifest carried them.
|
|
73
|
+
*/
|
|
74
|
+
export declare function scopeTypePlanOfManifest(manifestJson: string | null | undefined): ScopeTypePlan;
|
|
40
75
|
/** Whether a scope of `type` runs `moduleId`. On a host with no declared types, every module runs. */
|
|
41
76
|
export declare function scopeTypeRuns(plan: ScopeTypePlan, type: string, moduleId: string): boolean;
|
|
42
77
|
/**
|
|
@@ -53,5 +88,74 @@ export declare function provisionedScopeType(plan: ScopeTypePlan, requested: str
|
|
|
53
88
|
* operation answers with, because on this scope it is one: the scope carries none of that
|
|
54
89
|
* module's tables.
|
|
55
90
|
*/
|
|
56
|
-
export declare function operationNotInScopeType(operation: string, type: string):
|
|
91
|
+
export declare function operationNotInScopeType(operation: string, type: string): SubstratError;
|
|
92
|
+
/**
|
|
93
|
+
* Why `roleKey` may not be seated at a scope of `type` (#2993 part 3), or null. A role the vertical's
|
|
94
|
+
* types name exists only on the types that name it: seating a clinic's role on a record scope would
|
|
95
|
+
* grant keys of modules that scope does not run. Admitted: every role on a host with no declared
|
|
96
|
+
* types, and a role no type names (one the tenant defined for itself), which is left to the door's
|
|
97
|
+
* own rules, as a key a host knows nothing about is.
|
|
98
|
+
*/
|
|
99
|
+
export declare function scopeTypeRoleRefusal(plan: ScopeTypePlan, type: string, roleKey: string): string | null;
|
|
100
|
+
/** What a host reads off its directory about the scope a child is to be provisioned under. */
|
|
101
|
+
export interface ParentScopeFacts {
|
|
102
|
+
readonly tenantId: string;
|
|
103
|
+
readonly status: string;
|
|
104
|
+
readonly vertical: string | null;
|
|
105
|
+
/** The parent's recorded type, `home` for a row from before types. */
|
|
106
|
+
readonly type: string;
|
|
107
|
+
/** The parent's own parent, `null` when it has none. */
|
|
108
|
+
readonly parentScopeId: string | null;
|
|
109
|
+
/** The scope it was copied from, `null` when it is no copy. */
|
|
110
|
+
readonly forkedFrom: string | null;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Why a scope of `childType` may not be provisioned as a child of `parent` (#2995), or null. Read
|
|
114
|
+
* before the provision writes anything, by both hosts.
|
|
115
|
+
*
|
|
116
|
+
* - An unknown parent, and a parent of another tenant, are both `not_found`: a tenant learns nothing
|
|
117
|
+
* about another's scopes from the refusal (K-3).
|
|
118
|
+
* - A child runs its parent's app (`validation_failed` otherwise).
|
|
119
|
+
* - The parent is `active` and no copy (`conflict`): a copy holds no children, so deleting one never
|
|
120
|
+
* has to find any, and nothing is provisioned under a scope on its way out.
|
|
121
|
+
* - One level (`validation_failed`): a parent that is itself a child holds none.
|
|
122
|
+
* - The child's type is one the parent's type declares as a child (`validation_failed`). On a host
|
|
123
|
+
* that declares no types there is only `home`, which holds none.
|
|
124
|
+
*/
|
|
125
|
+
export declare function childScopeRefusal(plan: ScopeTypePlan, parentScopeId: string, parent: ParentScopeFacts | undefined, child: {
|
|
126
|
+
readonly tenantId: string;
|
|
127
|
+
readonly vertical: string | null;
|
|
128
|
+
readonly type: string;
|
|
129
|
+
}): SubstratError | null;
|
|
130
|
+
/**
|
|
131
|
+
* The parent a provision gives a scope, and the rule that keeps it (#2995): the link is written when
|
|
132
|
+
* the scope is first provisioned and never moves. `recorded` is the directory's value for an existing
|
|
133
|
+
* scope (`null`: no parent), or `undefined` for a new one. A re-provision restating the link, or
|
|
134
|
+
* naming none, keeps it; one naming another parent, or a parent for a scope that has none, is refused.
|
|
135
|
+
*/
|
|
136
|
+
export declare function provisionedParent(requested: string | undefined, recorded: string | null | undefined, scopeId: string): string | null;
|
|
137
|
+
/** Whether a scope of `type` admits `access`. On a host with no declared types every scope is `home`, reached directly. */
|
|
138
|
+
export declare function scopeTypeAccepts(plan: ScopeTypePlan, type: string, access: ScopeAccess): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Why a direct request (the person's own door, routed to the scope) may not reach this scope, or
|
|
141
|
+
* null (#2995). Only a scope WITH a parent is judged: a child whose type accepts `parent` only is
|
|
142
|
+
* reached through its parent. A typed scope with no parent (provisioned by staff, or a copy, which
|
|
143
|
+
* carries no link) is left as #2993 left it.
|
|
144
|
+
*/
|
|
145
|
+
export declare function directAccessRefusal(plan: ScopeTypePlan, type: string, parentScopeId: string | null, scopeId: string): SubstratError | null;
|
|
146
|
+
/**
|
|
147
|
+
* Why a call from `callerScopeId` through the child door may not reach `child`, or null (#2995).
|
|
148
|
+
* Reach follows the link: the calling scope is the child's own parent, in the same tenant. Any other
|
|
149
|
+
* scope, a sibling included, is answered `not_found`, as an unknown scope is. Then the child's type
|
|
150
|
+
* admits `parent` (`forbidden` otherwise), and the parent is `active` (`conflict`): host code of a
|
|
151
|
+
* suspended or archived parent calls nothing.
|
|
152
|
+
*/
|
|
153
|
+
export declare function childDoorRefusal(plan: ScopeTypePlan, tenantId: string, callerScopeId: string, childScopeId: string, child: {
|
|
154
|
+
readonly tenantId: string;
|
|
155
|
+
readonly type: string;
|
|
156
|
+
readonly parentScopeId: string | null;
|
|
157
|
+
} | undefined, parent: {
|
|
158
|
+
readonly tenantId: string;
|
|
159
|
+
readonly status: string;
|
|
160
|
+
} | undefined): SubstratError | null;
|
|
57
161
|
//# sourceMappingURL=scope-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-types.d.ts","sourceRoot":"","sources":["../src/scope-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"scope-types.d.ts","sourceRoot":"","sources":["../src/scope-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,eAAe,EAA4D,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExI,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,wGAAwG;AACxG,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,4FAA4F;IAC5F,QAAQ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scope-types.js
CHANGED
|
@@ -9,8 +9,15 @@
|
|
|
9
9
|
* surface lists. A host given no `permissions`, or a surface declaring no types, has one `home`
|
|
10
10
|
* type running every registered module, as every host does today.
|
|
11
11
|
*/
|
|
12
|
-
import { HOME_SCOPE_TYPE, SCOPE_TYPE_NAME, substratError } from '@substrat-run/contracts';
|
|
12
|
+
import { HOME_SCOPE_TYPE, SCOPE_TYPE_NAME, scopeTypesOfManifestJson, substratError } from '@substrat-run/contracts';
|
|
13
13
|
export { HOME_SCOPE_TYPE };
|
|
14
|
+
/**
|
|
15
|
+
* The `_substrat_meta` key a Durable Object records its scope's type under (#2993 part 3), as it
|
|
16
|
+
* records its tenant: written once at provision, read at wake. Absent is `home`, which every scope
|
|
17
|
+
* from before scope types is. It describes this store, never the data, so no dump carries it
|
|
18
|
+
* (`STORE_LOCAL_META_KEYS`): a copy's type is the one its own provision fixed.
|
|
19
|
+
*/
|
|
20
|
+
export const SCOPE_TYPE_META_KEY = 'scope_type';
|
|
14
21
|
/** The host's plan from its `permissions`. Throws, at construction, on a declaration it cannot act on. */
|
|
15
22
|
export function scopeTypePlanOf(permissions) {
|
|
16
23
|
const declared = permissions?.scopeTypes;
|
|
@@ -18,6 +25,10 @@ export function scopeTypePlanOf(permissions) {
|
|
|
18
25
|
return { declared: false };
|
|
19
26
|
const listed = new Set(permissions.modules.map((m) => m.manifest.id));
|
|
20
27
|
const types = new Map();
|
|
28
|
+
const roles = new Map();
|
|
29
|
+
const typedRoles = new Set();
|
|
30
|
+
const children = new Map();
|
|
31
|
+
const accepts = new Map();
|
|
21
32
|
for (const t of declared) {
|
|
22
33
|
if (!SCOPE_TYPE_NAME.test(t.name))
|
|
23
34
|
throw new Error(`scope type '${t.name}': a name is a lowercase slug (${SCOPE_TYPE_NAME.source})`);
|
|
@@ -29,11 +40,49 @@ export function scopeTypePlanOf(permissions) {
|
|
|
29
40
|
'A type names modules of the surface it is declared on');
|
|
30
41
|
}
|
|
31
42
|
types.set(t.name, new Set(t.modules));
|
|
43
|
+
roles.set(t.name, new Set(t.roles ?? []));
|
|
44
|
+
for (const r of t.roles ?? [])
|
|
45
|
+
typedRoles.add(r);
|
|
46
|
+
children.set(t.name, new Set(t.children ?? []));
|
|
47
|
+
accepts.set(t.name, new Set(t.accepts ?? (t.name === HOME_SCOPE_TYPE ? ['direct'] : ['parent'])));
|
|
32
48
|
}
|
|
33
49
|
if (!types.has(HOME_SCOPE_TYPE)) {
|
|
34
50
|
throw new Error(`no scope type is named '${HOME_SCOPE_TYPE}': it is the type an install provisions, and every vertical has one`);
|
|
35
51
|
}
|
|
36
|
-
|
|
52
|
+
// #2995: what a host acts on when it writes a parent link. Every child type is declared, none is
|
|
53
|
+
// the home type, and a child type holds no children of its own: one level.
|
|
54
|
+
for (const [name, kids] of children) {
|
|
55
|
+
for (const kid of kids) {
|
|
56
|
+
if (kid === HOME_SCOPE_TYPE)
|
|
57
|
+
throw new Error(`scope type '${name}' names '${HOME_SCOPE_TYPE}' as a child. The home type has no parent`);
|
|
58
|
+
if (!types.has(kid))
|
|
59
|
+
throw new Error(`scope type '${name}' names child type '${kid}', which is not declared`);
|
|
60
|
+
if ((children.get(kid)?.size ?? 0) > 0) {
|
|
61
|
+
throw new Error(`scope type '${kid}' is a child type and declares children of its own. Children are one level deep (#2995)`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { declared: true, types, roles, typedRoles, children, accepts };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* #2993 part 4: the plan of a vertical as its STORED deploy manifest declares it, for a module-less
|
|
69
|
+
* coordinator, which registers none of the vertical's modules and so has no `permissions` of its
|
|
70
|
+
* own for it. The types name the modules they run, so those are the modules listed. A manifest that
|
|
71
|
+
* declares no types, or none this reads, is the one implicit `home` type: such a coordinator then
|
|
72
|
+
* refuses every other type, as it did before the manifest carried them.
|
|
73
|
+
*/
|
|
74
|
+
export function scopeTypePlanOfManifest(manifestJson) {
|
|
75
|
+
const declared = scopeTypesOfManifestJson(manifestJson);
|
|
76
|
+
if (declared === undefined)
|
|
77
|
+
return { declared: false };
|
|
78
|
+
const modules = [...new Set(declared.flatMap((t) => t.modules))].map((id) => ({ manifest: { id } }));
|
|
79
|
+
try {
|
|
80
|
+
return scopeTypePlanOf({ modules, scopeTypes: declared });
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// A push refuses such a declaration (`pushedScopeTypeProblems`); one stored anyway is read as none.
|
|
84
|
+
return { declared: false };
|
|
85
|
+
}
|
|
37
86
|
}
|
|
38
87
|
/** Whether a scope of `type` runs `moduleId`. On a host with no declared types, every module runs. */
|
|
39
88
|
export function scopeTypeRuns(plan, type, moduleId) {
|
|
@@ -73,4 +122,106 @@ export function provisionedScopeType(plan, requested, recorded, scopeId) {
|
|
|
73
122
|
export function operationNotInScopeType(operation, type) {
|
|
74
123
|
return substratError('not_found', `unknown operation: ${operation} (a '${type}' scope does not run the module that declares it)`);
|
|
75
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Why `roleKey` may not be seated at a scope of `type` (#2993 part 3), or null. A role the vertical's
|
|
127
|
+
* types name exists only on the types that name it: seating a clinic's role on a record scope would
|
|
128
|
+
* grant keys of modules that scope does not run. Admitted: every role on a host with no declared
|
|
129
|
+
* types, and a role no type names (one the tenant defined for itself), which is left to the door's
|
|
130
|
+
* own rules, as a key a host knows nothing about is.
|
|
131
|
+
*/
|
|
132
|
+
export function scopeTypeRoleRefusal(plan, type, roleKey) {
|
|
133
|
+
if (!plan.declared || !plan.typedRoles.has(roleKey))
|
|
134
|
+
return null;
|
|
135
|
+
if (plan.roles.get(type)?.has(roleKey))
|
|
136
|
+
return null;
|
|
137
|
+
return `role '${roleKey}' does not exist on a '${type}' scope: the vertical declares it on other scope types only`;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Why a scope of `childType` may not be provisioned as a child of `parent` (#2995), or null. Read
|
|
141
|
+
* before the provision writes anything, by both hosts.
|
|
142
|
+
*
|
|
143
|
+
* - An unknown parent, and a parent of another tenant, are both `not_found`: a tenant learns nothing
|
|
144
|
+
* about another's scopes from the refusal (K-3).
|
|
145
|
+
* - A child runs its parent's app (`validation_failed` otherwise).
|
|
146
|
+
* - The parent is `active` and no copy (`conflict`): a copy holds no children, so deleting one never
|
|
147
|
+
* has to find any, and nothing is provisioned under a scope on its way out.
|
|
148
|
+
* - One level (`validation_failed`): a parent that is itself a child holds none.
|
|
149
|
+
* - The child's type is one the parent's type declares as a child (`validation_failed`). On a host
|
|
150
|
+
* that declares no types there is only `home`, which holds none.
|
|
151
|
+
*/
|
|
152
|
+
export function childScopeRefusal(plan, parentScopeId, parent, child) {
|
|
153
|
+
if (!parent || parent.tenantId !== child.tenantId) {
|
|
154
|
+
return substratError('not_found', `unknown parent scope for tenant: (${child.tenantId}, ${parentScopeId})`);
|
|
155
|
+
}
|
|
156
|
+
if (parent.vertical !== child.vertical) {
|
|
157
|
+
return substratError('validation_failed', `a child runs its parent's app: scope ${parentScopeId} runs '${parent.vertical ?? 'none'}', not '${child.vertical ?? 'none'}'`);
|
|
158
|
+
}
|
|
159
|
+
if (parent.status !== 'active') {
|
|
160
|
+
return substratError('conflict', `scope ${parentScopeId} is ${parent.status}: a child is provisioned under an active scope only`);
|
|
161
|
+
}
|
|
162
|
+
if (parent.forkedFrom !== null) {
|
|
163
|
+
return substratError('conflict', `scope ${parentScopeId} is a copy, and a copy holds no children`);
|
|
164
|
+
}
|
|
165
|
+
if (parent.parentScopeId !== null) {
|
|
166
|
+
return substratError('validation_failed', `scope ${parentScopeId} is a child itself, and children are one level deep`);
|
|
167
|
+
}
|
|
168
|
+
const allowed = plan.declared ? plan.children.get(parent.type) : undefined;
|
|
169
|
+
if (!allowed?.has(child.type)) {
|
|
170
|
+
const names = allowed && allowed.size ? [...allowed].sort().join(', ') : 'none';
|
|
171
|
+
return substratError('validation_failed', `a '${parent.type}' scope holds no '${child.type}' children (its type declares: ${names})`);
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The parent a provision gives a scope, and the rule that keeps it (#2995): the link is written when
|
|
177
|
+
* the scope is first provisioned and never moves. `recorded` is the directory's value for an existing
|
|
178
|
+
* scope (`null`: no parent), or `undefined` for a new one. A re-provision restating the link, or
|
|
179
|
+
* naming none, keeps it; one naming another parent, or a parent for a scope that has none, is refused.
|
|
180
|
+
*/
|
|
181
|
+
export function provisionedParent(requested, recorded, scopeId) {
|
|
182
|
+
if (recorded === undefined)
|
|
183
|
+
return requested ?? null;
|
|
184
|
+
if (requested !== undefined && requested !== recorded) {
|
|
185
|
+
throw substratError('conflict', recorded === null
|
|
186
|
+
? `scope ${scopeId} has no parent, and a parent link is written only when a child is provisioned`
|
|
187
|
+
: `scope ${scopeId} is a child of ${recorded}, and a scope's parent is fixed when it is provisioned`);
|
|
188
|
+
}
|
|
189
|
+
return recorded;
|
|
190
|
+
}
|
|
191
|
+
/** Whether a scope of `type` admits `access`. On a host with no declared types every scope is `home`, reached directly. */
|
|
192
|
+
export function scopeTypeAccepts(plan, type, access) {
|
|
193
|
+
if (!plan.declared)
|
|
194
|
+
return access === 'direct';
|
|
195
|
+
return plan.accepts.get(type)?.has(access) ?? false;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Why a direct request (the person's own door, routed to the scope) may not reach this scope, or
|
|
199
|
+
* null (#2995). Only a scope WITH a parent is judged: a child whose type accepts `parent` only is
|
|
200
|
+
* reached through its parent. A typed scope with no parent (provisioned by staff, or a copy, which
|
|
201
|
+
* carries no link) is left as #2993 left it.
|
|
202
|
+
*/
|
|
203
|
+
export function directAccessRefusal(plan, type, parentScopeId, scopeId) {
|
|
204
|
+
if (parentScopeId === null || scopeTypeAccepts(plan, type, 'direct'))
|
|
205
|
+
return null;
|
|
206
|
+
return substratError('forbidden', `scope ${scopeId} is a '${type}' scope, reached through its parent only`);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Why a call from `callerScopeId` through the child door may not reach `child`, or null (#2995).
|
|
210
|
+
* Reach follows the link: the calling scope is the child's own parent, in the same tenant. Any other
|
|
211
|
+
* scope, a sibling included, is answered `not_found`, as an unknown scope is. Then the child's type
|
|
212
|
+
* admits `parent` (`forbidden` otherwise), and the parent is `active` (`conflict`): host code of a
|
|
213
|
+
* suspended or archived parent calls nothing.
|
|
214
|
+
*/
|
|
215
|
+
export function childDoorRefusal(plan, tenantId, callerScopeId, childScopeId, child, parent) {
|
|
216
|
+
if (!child || child.tenantId !== tenantId || child.parentScopeId !== callerScopeId || !parent || parent.tenantId !== tenantId) {
|
|
217
|
+
return substratError('not_found', `scope ${childScopeId} is no child of scope ${callerScopeId} in tenant ${tenantId}`);
|
|
218
|
+
}
|
|
219
|
+
if (!scopeTypeAccepts(plan, child.type, 'parent')) {
|
|
220
|
+
return substratError('forbidden', `scope ${childScopeId} is a '${child.type}' scope, which does not accept calls through its parent`);
|
|
221
|
+
}
|
|
222
|
+
if (parent.status !== 'active') {
|
|
223
|
+
return substratError('conflict', `scope ${callerScopeId} is ${parent.status}, so it calls none of its children`);
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
76
227
|
//# sourceMappingURL=scope-types.js.map
|
package/dist/scope-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-types.js","sourceRoot":"","sources":["../src/scope-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"scope-types.js","sourceRoot":"","sources":["../src/scope-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,wBAAwB,EAAE,aAAa,EAAsB,MAAM,yBAAyB,CAAC;AAExI,OAAO,EAAE,eAAe,EAAE,CAAC;AAiB3B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mB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,CAAC;IACnH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type CheckSubject, type Decision, type EntityRef, type Instant, type PermissionKey, type StoreProof } from '@substrat-run/contracts';
|
|
2
|
+
import type { ScopedSql } from './scope-host.js';
|
|
3
|
+
export declare const STORE_PROOF_DDL = "\n CREATE TABLE IF NOT EXISTS _substrat_store_proofs (\n id TEXT PRIMARY KEY,\n -- SHA-256 hex of the secret. The secret itself is stored NOWHERE.\n token_hash TEXT NOT NULL UNIQUE,\n binding TEXT NOT NULL,\n operation TEXT NOT NULL,\n -- The principal whose operation checked the key, and the only one whose stub may redeem it.\n minted_by TEXT NOT NULL,\n minted_at TEXT NOT NULL,\n expires_at TEXT NOT NULL,\n -- Set by the one redemption. A spent proof is refused like an unknown one.\n redeemed_at TEXT\n );\n CREATE INDEX IF NOT EXISTS _substrat_store_proofs_expires\n ON _substrat_store_proofs (expires_at);\n";
|
|
4
|
+
/** The tables `STORE_PROOF_DDL` builds — what a copy of a scope leaves behind. */
|
|
5
|
+
export declare const STORE_PROOF_TABLE_NAMES: readonly ['_substrat_store_proofs'];
|
|
6
|
+
/** What the mint needs: the operation's own seams, and the vertical's declared store keys. */
|
|
7
|
+
export interface StoreProofVerbDeps {
|
|
8
|
+
/** RAW spine access inside the operation's own transaction. */
|
|
9
|
+
sql: ScopedSql;
|
|
10
|
+
subject: CheckSubject;
|
|
11
|
+
/** True when this context is a consumer's, whose checks allow unconditionally. */
|
|
12
|
+
consumer: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The clock read when the proof is minted, not the operation's stable instant: a proof's minute
|
|
15
|
+
* starts at its mint, so a handler that ran long before minting still hands out a whole one.
|
|
16
|
+
*/
|
|
17
|
+
now: Instant;
|
|
18
|
+
/** The operation's OWN check, so the key's pass is one of its authorizations. */
|
|
19
|
+
check: (permission: PermissionKey, entity?: EntityRef) => Promise<Decision>;
|
|
20
|
+
assertWrites: (verb: string) => void;
|
|
21
|
+
/** This invocation's minted secrets — the tripwire on its writes reads them. */
|
|
22
|
+
minted: string[];
|
|
23
|
+
/** The key the vertical declared for a store operation, or `undefined`. */
|
|
24
|
+
keyOf: (binding: string, operation: string) => string | undefined;
|
|
25
|
+
/** How long a proof lives. {@link STORE_PROOF_TTL_SECONDS} unless a host is told otherwise. */
|
|
26
|
+
ttlSeconds?: number;
|
|
27
|
+
}
|
|
28
|
+
/** `ctx.storeProof`: check the store operation's key and record a proof of it. See the file header. */
|
|
29
|
+
export declare function mintStoreProof(deps: StoreProofVerbDeps, binding: unknown, operation: unknown): Promise<StoreProof>;
|
|
30
|
+
/** The secret a caller handed the stub: the proof `ctx.storeProof` returned, or its `proof` string. */
|
|
31
|
+
export declare function storeProofSecretOf(proof: unknown): string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Spend a proof on one store call. Runs on the scope's own queue, outside any operation, so the read
|
|
34
|
+
* and the write below cannot interleave with another redemption. Refuses unless the proof names a row
|
|
35
|
+
* of this scope, for `binding`, `operation` and `principal`, unexpired and unspent.
|
|
36
|
+
*/
|
|
37
|
+
export declare function redeemStoreProof(deps: {
|
|
38
|
+
sql: ScopedSql;
|
|
39
|
+
now: Instant;
|
|
40
|
+
}, secret: unknown, expect: {
|
|
41
|
+
binding: string;
|
|
42
|
+
operation: string;
|
|
43
|
+
principal: string;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
//# sourceMappingURL=store-proof.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-proof.d.ts","sourceRoot":"","sources":["../src/store-proof.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAqCjD,eAA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CAAC,CAuBf"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { STORE_PROOF_PREFIX, STORE_PROOF_REFUSED, STORE_PROOF_TTL_SECONDS, isStoreProofShape, storeCatalogOperation, substratError, } from '@substrat-run/contracts';
|
|
2
|
+
import { toBase64url } from './base64url.js';
|
|
3
|
+
import { capabilityTokenHash } from './capability.js';
|
|
4
|
+
import { assertAllowed } from './permission-checker.js';
|
|
5
|
+
import { ulid } from './ulid.js';
|
|
6
|
+
export const STORE_PROOF_DDL = `
|
|
7
|
+
CREATE TABLE IF NOT EXISTS _substrat_store_proofs (
|
|
8
|
+
id TEXT PRIMARY KEY,
|
|
9
|
+
-- SHA-256 hex of the secret. The secret itself is stored NOWHERE.
|
|
10
|
+
token_hash TEXT NOT NULL UNIQUE,
|
|
11
|
+
binding TEXT NOT NULL,
|
|
12
|
+
operation TEXT NOT NULL,
|
|
13
|
+
-- The principal whose operation checked the key, and the only one whose stub may redeem it.
|
|
14
|
+
minted_by TEXT NOT NULL,
|
|
15
|
+
minted_at TEXT NOT NULL,
|
|
16
|
+
expires_at TEXT NOT NULL,
|
|
17
|
+
-- Set by the one redemption. A spent proof is refused like an unknown one.
|
|
18
|
+
redeemed_at TEXT
|
|
19
|
+
);
|
|
20
|
+
CREATE INDEX IF NOT EXISTS _substrat_store_proofs_expires
|
|
21
|
+
ON _substrat_store_proofs (expires_at);
|
|
22
|
+
`;
|
|
23
|
+
/** The tables `STORE_PROOF_DDL` builds — what a copy of a scope leaves behind. */
|
|
24
|
+
export const STORE_PROOF_TABLE_NAMES = ['_substrat_store_proofs'];
|
|
25
|
+
const VERB = 'ctx.storeProof';
|
|
26
|
+
const BINDING = /^[A-Z][A-Z0-9_]*$/;
|
|
27
|
+
/** A fresh proof secret: 256 bits, base64url, prefixed. Only its hash is ever stored. */
|
|
28
|
+
function mintStoreProofSecret() {
|
|
29
|
+
return STORE_PROOF_PREFIX + toBase64url(crypto.getRandomValues(new Uint8Array(32)));
|
|
30
|
+
}
|
|
31
|
+
/** `ctx.storeProof`: check the store operation's key and record a proof of it. See the file header. */
|
|
32
|
+
export async function mintStoreProof(deps, binding, operation) {
|
|
33
|
+
deps.assertWrites(VERB);
|
|
34
|
+
if (deps.consumer || deps.subject.kind !== 'principal') {
|
|
35
|
+
throw substratError('forbidden', `${VERB}: only an operation a principal called may mint a store proof — a consumer's checks allow ` +
|
|
36
|
+
'unconditionally, and a capability, a peer or a system actor has no host code to make the call', { reason: STORE_PROOF_REFUSED });
|
|
37
|
+
}
|
|
38
|
+
if (typeof binding !== 'string' || !BINDING.test(binding)) {
|
|
39
|
+
throw substratError('validation_failed', `${VERB}: '${String(binding)}' is not a store binding`);
|
|
40
|
+
}
|
|
41
|
+
if (!storeCatalogOperation.safeParse(operation).success) {
|
|
42
|
+
throw substratError('validation_failed', `${VERB}: '${String(operation)}' is not a store operation a vertical may call`);
|
|
43
|
+
}
|
|
44
|
+
const op = operation;
|
|
45
|
+
const key = deps.keyOf(binding, op);
|
|
46
|
+
if (key === undefined) {
|
|
47
|
+
throw substratError('forbidden', `${VERB}: store '${binding}' operation '${op}' has no permission key, so it cannot be called. ` +
|
|
48
|
+
'Declare it on definePermissions `stores` (K-64).', { reason: STORE_PROOF_REFUSED });
|
|
49
|
+
}
|
|
50
|
+
assertAllowed(await deps.check(key));
|
|
51
|
+
const secret = mintStoreProofSecret();
|
|
52
|
+
const ttl = deps.ttlSeconds ?? STORE_PROOF_TTL_SECONDS;
|
|
53
|
+
const expiresAt = new Date(Date.parse(deps.now) + ttl * 1000).toISOString();
|
|
54
|
+
// A proof past its expiry redeems nothing, so its row is only weight: each mint clears them.
|
|
55
|
+
deps.sql.exec('DELETE FROM _substrat_store_proofs WHERE expires_at <= ?', [deps.now]);
|
|
56
|
+
deps.sql.exec(`INSERT INTO _substrat_store_proofs (id, token_hash, binding, operation, minted_by, minted_at, expires_at)
|
|
57
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)`, [ulid(), await capabilityTokenHash(secret), binding, op, deps.subject.id, deps.now, expiresAt]);
|
|
58
|
+
deps.minted.push(secret);
|
|
59
|
+
return { proof: secret, binding, operation: op, expiresAt };
|
|
60
|
+
}
|
|
61
|
+
/** One answer for every refused redemption, so a wrong proof says nothing about which part was wrong. */
|
|
62
|
+
const refused = () => substratError('forbidden', 'store call refused: it carries no live proof an operation minted for this store operation', {
|
|
63
|
+
reason: STORE_PROOF_REFUSED,
|
|
64
|
+
});
|
|
65
|
+
/** The secret a caller handed the stub: the proof `ctx.storeProof` returned, or its `proof` string. */
|
|
66
|
+
export function storeProofSecretOf(proof) {
|
|
67
|
+
if (typeof proof === 'string')
|
|
68
|
+
return proof;
|
|
69
|
+
if (proof !== null && typeof proof === 'object' && typeof proof.proof === 'string') {
|
|
70
|
+
return proof.proof;
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Spend a proof on one store call. Runs on the scope's own queue, outside any operation, so the read
|
|
76
|
+
* and the write below cannot interleave with another redemption. Refuses unless the proof names a row
|
|
77
|
+
* of this scope, for `binding`, `operation` and `principal`, unexpired and unspent.
|
|
78
|
+
*/
|
|
79
|
+
export async function redeemStoreProof(deps, secret, expect) {
|
|
80
|
+
if (!isStoreProofShape(secret))
|
|
81
|
+
throw refused();
|
|
82
|
+
const row = deps.sql.query('SELECT id, binding, operation, minted_by, expires_at, redeemed_at FROM _substrat_store_proofs WHERE token_hash = ?', [await capabilityTokenHash(secret)])[0];
|
|
83
|
+
if (!row ||
|
|
84
|
+
row.binding !== expect.binding ||
|
|
85
|
+
row.operation !== expect.operation ||
|
|
86
|
+
row.minted_by !== expect.principal ||
|
|
87
|
+
row.redeemed_at !== null ||
|
|
88
|
+
row.expires_at <= deps.now) {
|
|
89
|
+
throw refused();
|
|
90
|
+
}
|
|
91
|
+
// The row the UPDATE returns, not `changes`: a Durable Object counts a trigger's writes in it too
|
|
92
|
+
// (a live capture's log), which would refuse a good proof after spending it.
|
|
93
|
+
const spent = deps.sql.query('UPDATE _substrat_store_proofs SET redeemed_at = ? WHERE id = ? AND redeemed_at IS NULL RETURNING id', [deps.now, row.id]);
|
|
94
|
+
if (spent.length !== 1)
|
|
95
|
+
throw refused();
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=store-proof.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-proof.js","sourceRoot":"","sources":["../src/store-proof.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,GAOd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAoCjC,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;CAgB9B,CAAC;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,wBAAwB,CAAU,CAAC;AAyB3E,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAC9B,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAEpC,yFAAyF;AACzF,SAAS,oBAAoB;IAC3B,OAAO,kBAAkB,GAAG,WAAW,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,uGAAuG;AACvG,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAwB,EAAE,OAAgB,EAAE,SAAkB;IACjG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACxB,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE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,CAAC,CAAC;IACL,IACE,CAAC,GAAG;QACJ,GAAG,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO;QAC9B,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS;QAClC,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS;QAClC,GAAG,CAAC,WAAW,KAAK,IAAI;QACxB,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,EAC1B,CAAC;QACD,MAAM,OAAO,EAAE,CAAC;IAClB,CAAC;IACD,kGAAkG;IAClG,6EAA6E;IAC7E,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAC1B,qGAAqG,EACrG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,CACnB,CAAC;IACF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,OAAO,EAAE,CAAC;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.221.0",
|
|
4
4
|
"description": "Substrat kernel contracts and services — pure TypeScript, no platform imports (D-14)",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@substrat-run/contracts": "^0.
|
|
37
|
+
"@substrat-run/contracts": "^0.218.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^22.20.5",
|