@substrat-run/adapter-cloudflare 0.161.0 → 0.163.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/control-plane-do.d.ts +119 -15
- package/dist/control-plane-do.d.ts.map +1 -1
- package/dist/control-plane-do.js +292 -41
- package/dist/control-plane-do.js.map +1 -1
- package/dist/host.d.ts +103 -16
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +329 -163
- package/dist/host.js.map +1 -1
- package/dist/scope-do.d.ts +63 -0
- package/dist/scope-do.d.ts.map +1 -1
- package/dist/scope-do.js +307 -124
- package/dist/scope-do.js.map +1 -1
- package/package.json +9 -9
package/dist/scope-do.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DurableObject } from 'cloudflare:workers';
|
|
2
|
+
import { type TenantId } from '@substrat-run/contracts';
|
|
2
3
|
import { type DeclaredPermissions, type SwitchSql, type ModuleRegistration, type OperationHandler } from '@substrat-run/kernel';
|
|
3
4
|
import { type DoReply } from './do-reply.js';
|
|
4
5
|
import { splitSqlStatements } from '@substrat-run/kernel';
|
|
@@ -42,6 +43,68 @@ export interface ScopeDoEnv {
|
|
|
42
43
|
}
|
|
43
44
|
/** #2016: how a tenant reads against a scope's record (`ScopeDO.tenantVerdict`). */
|
|
44
45
|
export type TenantVerdict = 'recorded' | 'inferred' | 'foreign' | 'unknown';
|
|
46
|
+
/**
|
|
47
|
+
* #2531: what a unit that writes a role set judges it with, beyond what this scope holds: the
|
|
48
|
+
* reservations of the caller's host (its registered modules and its `permissions`). This class's own
|
|
49
|
+
* are joined in the unit. The set itself is the one the unit writes.
|
|
50
|
+
*/
|
|
51
|
+
export type RoleJudge = {
|
|
52
|
+
reserved: string[];
|
|
53
|
+
declared: string[];
|
|
54
|
+
};
|
|
55
|
+
/** A role row as `applyProjection` writes it. */
|
|
56
|
+
type ProjectedRoleRow = {
|
|
57
|
+
role_key: string;
|
|
58
|
+
permissions: string;
|
|
59
|
+
source: string;
|
|
60
|
+
holder?: 'person' | 'system' | null;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* #2555: the directory's current permission state for one scope, as a fan-out projects it
|
|
64
|
+
* (`tenantProjection` and the vertical's connection keys), written by a control-plane-full load in
|
|
65
|
+
* its own transaction after the dump's rows are in. The roles are judged there against the state
|
|
66
|
+
* the dump has just brought, with `judge`'s reservations joined with the class's.
|
|
67
|
+
*/
|
|
68
|
+
export type LoadProjection = {
|
|
69
|
+
tenantId: TenantId;
|
|
70
|
+
roles: ProjectedRoleRow[];
|
|
71
|
+
tuples: {
|
|
72
|
+
subject: string;
|
|
73
|
+
relation: string;
|
|
74
|
+
object: string;
|
|
75
|
+
expires_at: string | null;
|
|
76
|
+
revoked_at: string | null;
|
|
77
|
+
}[];
|
|
78
|
+
entitlements: {
|
|
79
|
+
entitlement_key: string;
|
|
80
|
+
expires_at: string | null;
|
|
81
|
+
quota: number | null;
|
|
82
|
+
plan: string | null;
|
|
83
|
+
}[];
|
|
84
|
+
identities: {
|
|
85
|
+
provider: string;
|
|
86
|
+
external_id: string;
|
|
87
|
+
principal_id: string;
|
|
88
|
+
scope_id: string | null;
|
|
89
|
+
}[];
|
|
90
|
+
connectionKeys: {
|
|
91
|
+
connection_id: string;
|
|
92
|
+
provider: string;
|
|
93
|
+
key_id: string;
|
|
94
|
+
public_key: string;
|
|
95
|
+
}[];
|
|
96
|
+
judge: RoleJudge;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* #2531: a load's role repair, judged and written in the load's own transaction after the dump's
|
|
100
|
+
* rows are in: the vertical's role set for `tenantId`, projected as `projectRolesLocal` projects it.
|
|
101
|
+
* #2555's second step can pass the directory's set through the same field.
|
|
102
|
+
*/
|
|
103
|
+
export type LoadRoleRepair = {
|
|
104
|
+
tenantId: TenantId;
|
|
105
|
+
roles: ProjectedRoleRow[];
|
|
106
|
+
judge: RoleJudge;
|
|
107
|
+
};
|
|
45
108
|
/**
|
|
46
109
|
* What a capability attachment verb (#1686) answers: its value, or its failure as DATA —
|
|
47
110
|
* `invoke`'s envelope discipline, since a throw across the RPC keeps only its message.
|
package/dist/scope-do.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAmDL,KAAK,QAAQ,EAWd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EA+DL,KAAK,mBAAmB,EASxB,KAAK,SAAS,EAsBd,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EAyHtB,MAAM,sBAAsB,CAAC;AAoD9B,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAwBL,kBAAkB,EAiFnB,MAAM,sBAAsB,CAAC;AA2B9B;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AAoFD,oFAAoF;AACpF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAgB5E;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AASnE,iDAAiD;AACjD,KAAK,gBAAgB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;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