@substrat-run/contracts 0.9.0 → 0.11.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/connections.d.ts +91 -0
- package/dist/connections.d.ts.map +1 -0
- package/dist/connections.js +94 -0
- package/dist/connections.js.map +1 -0
- package/dist/control-plane.d.ts +8 -0
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +8 -0
- package/dist/control-plane.js.map +1 -1
- package/dist/events.d.ts +17 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +12 -1
- 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/permission.d.ts +41 -0
- package/dist/permission.d.ts.map +1 -1
- package/dist/permission.js +34 -1
- package/dist/permission.js.map +1 -1
- package/dist/routing.d.ts +2 -2
- package/dist/tenancy.d.ts +13 -5
- package/dist/tenancy.d.ts.map +1 -1
- package/dist/tenancy.js +22 -2
- package/dist/tenancy.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const connectionId: z.core.$ZodBranded<z.ZodString, "ConnectionId", "out">;
|
|
3
|
+
export type ConnectionId = z.infer<typeof connectionId>;
|
|
4
|
+
/** Vertical vocabulary, like `scope.vertical`: 'scrive', 'fortnox', 'visma'. */
|
|
5
|
+
export declare const connectionProvider: z.ZodString;
|
|
6
|
+
export declare const connectionStatus: z.ZodEnum<{
|
|
7
|
+
error: "error";
|
|
8
|
+
active: "active";
|
|
9
|
+
expired: "expired";
|
|
10
|
+
revoked: "revoked";
|
|
11
|
+
}>;
|
|
12
|
+
export type ConnectionStatus = z.infer<typeof connectionStatus>;
|
|
13
|
+
/**
|
|
14
|
+
* A connection as the directory holds it.
|
|
15
|
+
*
|
|
16
|
+
* Keyed on **(tenant, vertical, provider)** rather than tenant alone
|
|
17
|
+
* (connections.md §3.1.1): a vertical is a blast-radius boundary (D-30) and
|
|
18
|
+
* verticals are built by different companies (D-33), so one vendor's host code
|
|
19
|
+
* must not reach a credential another vendor connected. It also matches how
|
|
20
|
+
* OAuth issues clients — two vendors acting for one tenant hold two clients.
|
|
21
|
+
*/
|
|
22
|
+
export declare const connection: z.ZodObject<{
|
|
23
|
+
id: z.core.$ZodBranded<z.ZodString, "ConnectionId", "out">;
|
|
24
|
+
tenantId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
|
|
25
|
+
vertical: z.ZodString;
|
|
26
|
+
provider: z.ZodString;
|
|
27
|
+
label: z.ZodString;
|
|
28
|
+
status: z.ZodEnum<{
|
|
29
|
+
error: "error";
|
|
30
|
+
active: "active";
|
|
31
|
+
expired: "expired";
|
|
32
|
+
revoked: "revoked";
|
|
33
|
+
}>;
|
|
34
|
+
externalAccountRef: z.ZodNullable<z.ZodString>;
|
|
35
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
36
|
+
expiresAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
37
|
+
lastOkAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
38
|
+
lastError: z.ZodNullable<z.ZodString>;
|
|
39
|
+
lastErrorAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
40
|
+
createdBy: z.ZodString;
|
|
41
|
+
createdAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
42
|
+
revokedAt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type Connection = z.infer<typeof connection>;
|
|
45
|
+
/**
|
|
46
|
+
* The credential, as the caller supplies it.
|
|
47
|
+
*
|
|
48
|
+
* Deliberately an opaque string map rather than a typed OAuth shape: an API-token
|
|
49
|
+
* provider carries `{ token }`, OAuth2 carries `{ accessToken, refreshToken }`,
|
|
50
|
+
* and mTLS carries something else again. The hub seals the whole map and never
|
|
51
|
+
* interprets it — interpreting it is the connector's job, and a typed union here
|
|
52
|
+
* would make the kernel learn each provider, which is precisely the coupling
|
|
53
|
+
* D-18's triage rule keeps out.
|
|
54
|
+
*/
|
|
55
|
+
export declare const connectionSecret: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
56
|
+
export type ConnectionSecret = z.infer<typeof connectionSecret>;
|
|
57
|
+
export declare const createConnectionInput: z.ZodObject<{
|
|
58
|
+
id: z.core.$ZodBranded<z.ZodString, "ConnectionId", "out">;
|
|
59
|
+
tenantId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
|
|
60
|
+
vertical: z.ZodString;
|
|
61
|
+
provider: z.ZodString;
|
|
62
|
+
label: z.ZodString;
|
|
63
|
+
externalAccountRef: z.ZodOptional<z.ZodString>;
|
|
64
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
65
|
+
expiresAt: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
66
|
+
secret: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
export type CreateConnectionInput = z.input<typeof createConnectionInput>;
|
|
69
|
+
export declare const connectionFilter: z.ZodObject<{
|
|
70
|
+
tenantId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "TenantId", "out">>;
|
|
71
|
+
vertical: z.ZodOptional<z.ZodString>;
|
|
72
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
73
|
+
includeRevoked: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
export type ConnectionFilter = z.infer<typeof connectionFilter>;
|
|
76
|
+
/**
|
|
77
|
+
* A connection with its credential opened — what a connector receives, and the
|
|
78
|
+
* only shape in the system that carries plaintext.
|
|
79
|
+
*
|
|
80
|
+
* Never returned by an audited `HostAdmin` read, never logged, never serialized
|
|
81
|
+
* into an event. It exists for the duration of one connector call.
|
|
82
|
+
*/
|
|
83
|
+
export interface OpenConnection {
|
|
84
|
+
id: ConnectionId;
|
|
85
|
+
tenantId: string;
|
|
86
|
+
vertical: string;
|
|
87
|
+
provider: string;
|
|
88
|
+
secret: ConnectionSecret;
|
|
89
|
+
expiresAt: string | null;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=connections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,YAAY,wDAAiD,CAAC;AAC3E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,aAIiC,CAAC;AAEjE,eAAO,MAAM,gBAAgB;;;;;EAS3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;iBA0BrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,uCAA0C,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAUhC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,eAAO,MAAM,gBAAgB;;;;;iBAM3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,YAAY,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { instant, tenantId } from './ids.js';
|
|
3
|
+
/**
|
|
4
|
+
* The integrations hub's connection store (#101, design/connections.md §3).
|
|
5
|
+
*
|
|
6
|
+
* A connection is one tenant's authorization to act against one external
|
|
7
|
+
* provider, held by one vertical. Everything here is METADATA — the credential
|
|
8
|
+
* itself never appears in this file, and never crosses a read path that returns
|
|
9
|
+
* these shapes.
|
|
10
|
+
*/
|
|
11
|
+
const ULID = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
12
|
+
export const connectionId = z.string().regex(ULID).brand();
|
|
13
|
+
/** Vertical vocabulary, like `scope.vertical`: 'scrive', 'fortnox', 'visma'. */
|
|
14
|
+
export const connectionProvider = z
|
|
15
|
+
.string()
|
|
16
|
+
.min(1)
|
|
17
|
+
.max(64)
|
|
18
|
+
.regex(/^[a-z0-9][a-z0-9-]*$/, 'provider is a lowercase slug');
|
|
19
|
+
export const connectionStatus = z.enum([
|
|
20
|
+
/** Usable. */
|
|
21
|
+
'active',
|
|
22
|
+
/** The provider's grant lapsed — refresh failed or the window closed. */
|
|
23
|
+
'expired',
|
|
24
|
+
/** Withdrawn deliberately. Terminal; a replacement is a new connection. */
|
|
25
|
+
'revoked',
|
|
26
|
+
/** Last use failed. Still holds a credential, so distinct from `expired`. */
|
|
27
|
+
'error',
|
|
28
|
+
]);
|
|
29
|
+
/**
|
|
30
|
+
* A connection as the directory holds it.
|
|
31
|
+
*
|
|
32
|
+
* Keyed on **(tenant, vertical, provider)** rather than tenant alone
|
|
33
|
+
* (connections.md §3.1.1): a vertical is a blast-radius boundary (D-30) and
|
|
34
|
+
* verticals are built by different companies (D-33), so one vendor's host code
|
|
35
|
+
* must not reach a credential another vendor connected. It also matches how
|
|
36
|
+
* OAuth issues clients — two vendors acting for one tenant hold two clients.
|
|
37
|
+
*/
|
|
38
|
+
export const connection = z.object({
|
|
39
|
+
id: connectionId,
|
|
40
|
+
tenantId,
|
|
41
|
+
/** The owning vertical's slug — the deployment allowed to use this. */
|
|
42
|
+
vertical: z.string().min(1),
|
|
43
|
+
provider: connectionProvider,
|
|
44
|
+
/** Human label for a console: 'Nordljus Scrive (prod)'. */
|
|
45
|
+
label: z.string().min(1),
|
|
46
|
+
status: connectionStatus,
|
|
47
|
+
/**
|
|
48
|
+
* The provider's own identifier for the account, when it has one — a Scrive
|
|
49
|
+
* company id, a Fortnox tenant. Opaque, and NOT a credential: it is what makes
|
|
50
|
+
* "which account is this?" answerable without opening the secret.
|
|
51
|
+
*/
|
|
52
|
+
externalAccountRef: z.string().nullable(),
|
|
53
|
+
/** Provider scopes/permissions the grant carries, as the provider names them. */
|
|
54
|
+
scopes: z.array(z.string()),
|
|
55
|
+
/** When the grant itself lapses (OAuth refresh-token lifetime), if known. */
|
|
56
|
+
expiresAt: instant.nullable(),
|
|
57
|
+
/** Health (§3.7) — written by the runtime, read by a console. */
|
|
58
|
+
lastOkAt: instant.nullable(),
|
|
59
|
+
lastError: z.string().nullable(),
|
|
60
|
+
lastErrorAt: instant.nullable(),
|
|
61
|
+
createdBy: z.string().min(1),
|
|
62
|
+
createdAt: instant,
|
|
63
|
+
revokedAt: instant.nullable(),
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* The credential, as the caller supplies it.
|
|
67
|
+
*
|
|
68
|
+
* Deliberately an opaque string map rather than a typed OAuth shape: an API-token
|
|
69
|
+
* provider carries `{ token }`, OAuth2 carries `{ accessToken, refreshToken }`,
|
|
70
|
+
* and mTLS carries something else again. The hub seals the whole map and never
|
|
71
|
+
* interprets it — interpreting it is the connector's job, and a typed union here
|
|
72
|
+
* would make the kernel learn each provider, which is precisely the coupling
|
|
73
|
+
* D-18's triage rule keeps out.
|
|
74
|
+
*/
|
|
75
|
+
export const connectionSecret = z.record(z.string().min(1), z.string());
|
|
76
|
+
export const createConnectionInput = z.object({
|
|
77
|
+
id: connectionId,
|
|
78
|
+
tenantId,
|
|
79
|
+
vertical: z.string().min(1),
|
|
80
|
+
provider: connectionProvider,
|
|
81
|
+
label: z.string().min(1),
|
|
82
|
+
externalAccountRef: z.string().optional(),
|
|
83
|
+
scopes: z.array(z.string()).default([]),
|
|
84
|
+
expiresAt: instant.optional(),
|
|
85
|
+
secret: connectionSecret,
|
|
86
|
+
});
|
|
87
|
+
export const connectionFilter = z.object({
|
|
88
|
+
tenantId: tenantId.optional(),
|
|
89
|
+
vertical: z.string().min(1).optional(),
|
|
90
|
+
provider: connectionProvider.optional(),
|
|
91
|
+
/** Revoked connections are evidence, not roster — excluded unless asked for. */
|
|
92
|
+
includeRevoked: z.boolean().optional(),
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=connections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connections.js","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;GAOG;AAEH,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAkB,CAAC;AAG3E,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,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C,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AAGxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,EAAE,EAAE,YAAY;IAChB,QAAQ;IACR,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAE,kBAAkB;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC,QAAQ,EAAE;IAC7B,MAAM,EAAE,gBAAgB;CACzB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,EAAE;IACvC,gFAAgF;IAChF,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC"}
|
package/dist/control-plane.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ export declare const adminAction: z.ZodEnum<{
|
|
|
28
28
|
grantEntitlement: "grantEntitlement";
|
|
29
29
|
revokeEntitlement: "revokeEntitlement";
|
|
30
30
|
linkIdentity: "linkIdentity";
|
|
31
|
+
createConnection: "createConnection";
|
|
32
|
+
updateConnectionSecret: "updateConnectionSecret";
|
|
33
|
+
revokeConnection: "revokeConnection";
|
|
34
|
+
grantToConnection: "grantToConnection";
|
|
31
35
|
}>;
|
|
32
36
|
export type AdminAction = z.infer<typeof adminAction>;
|
|
33
37
|
/**
|
|
@@ -178,6 +182,10 @@ export declare const adminLogEntry: z.ZodObject<{
|
|
|
178
182
|
grantEntitlement: "grantEntitlement";
|
|
179
183
|
revokeEntitlement: "revokeEntitlement";
|
|
180
184
|
linkIdentity: "linkIdentity";
|
|
185
|
+
createConnection: "createConnection";
|
|
186
|
+
updateConnectionSecret: "updateConnectionSecret";
|
|
187
|
+
revokeConnection: "revokeConnection";
|
|
188
|
+
grantToConnection: "grantToConnection";
|
|
181
189
|
}>;
|
|
182
190
|
tenantId: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "TenantId", "out">>;
|
|
183
191
|
scopeId: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "ScopeId", "out">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-plane.d.ts","sourceRoot":"","sources":["../src/control-plane.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"control-plane.d.ts","sourceRoot":"","sources":["../src/control-plane.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;iBAMvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY;;;EAAsC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;iBAQrB,CAAC;AACL,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;iBAUzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa;;;;iBAIxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
package/dist/control-plane.js
CHANGED
|
@@ -35,6 +35,14 @@ export const adminAction = z.enum([
|
|
|
35
35
|
'grantEntitlement', // §4.3 — the SKU flag turned on for a tenant
|
|
36
36
|
'revokeEntitlement', // §4.3
|
|
37
37
|
'linkIdentity', // D-16 — bind an external identity to a principal
|
|
38
|
+
// #101 — the integrations hub. The credential itself is NEVER in before/after:
|
|
39
|
+
// this log is append-only, so a secret written here could never be removed.
|
|
40
|
+
'createConnection',
|
|
41
|
+
'updateConnectionSecret', // OAuth refresh — logged as an event, never with the token
|
|
42
|
+
'revokeConnection',
|
|
43
|
+
// #97 — a connection may hold a permission, so granting one is a mutation the
|
|
44
|
+
// log has to be able to name.
|
|
45
|
+
'grantToConnection',
|
|
38
46
|
]);
|
|
39
47
|
/**
|
|
40
48
|
* The neutral identity seam (D-16; control-plane.md §6 "principal derivation").
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-plane.js","sourceRoot":"","sources":["../src/control-plane.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,OAAO,EACP,OAAO,EACP,KAAK,EACL,eAAe,EACf,WAAW,EACX,OAAO,EACP,QAAQ,GACT,MAAM,UAAU,CAAC;AAElB,gFAAgF;AAChF,+EAA+E;AAC/E,iFAAiF;AACjF,4CAA4C;AAE5C,2EAA2E;AAC3E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC;IAChC,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,WAAW;IACX,cAAc,EAAE,2DAA2D;IAC3E,WAAW,EAAE,wDAAwD;IACrE,sBAAsB;IACtB,kBAAkB,EAAE,wCAAwC;IAC5D,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,gBAAgB;IAChB,cAAc,EAAE,0BAA0B;IAC1C,mBAAmB,EAAE,oDAAoD;IACzE,gBAAgB,EAAE,yHAAyH;IAC3I,cAAc,EAAE,OAAO;IACvB,iBAAiB,EAAE,oDAAoD;IACvE,gBAAgB,EAAE,yDAAyD;IAC3E,cAAc,EAAE,OAAO;IACvB,gBAAgB,EAAE,OAAO;IACzB,cAAc,EAAE,OAAO;IACvB,gBAAgB;IAChB,eAAe,EAAE,uDAAuD;IACxE,kBAAkB,EAAE,6CAA6C;IACjE,mBAAmB,EAAE,OAAO;IAC5B,cAAc,EAAE,kDAAkD;
|
|
1
|
+
{"version":3,"file":"control-plane.js","sourceRoot":"","sources":["../src/control-plane.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EA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,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC3C,SAAS,EAAE,OAAO,CAAC,QAAQ,EAAE;IAC7B,EAAE,EAAE,OAAO;CACZ,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,SAAS,EAAE,WAAW;IACtB,KAAK;IACL,SAAS,EAAE,OAAO,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,oDAAoD;IAC3E,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE,WAAW;IACnB,oFAAoF;IACpF,mFAAmF;IACnF,mDAAmD;IACnD,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;IAC7B,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,6DAA6D;IAC7F,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,sBAAsB;IACrD;;;;;;;;;;;;;OAaG;IACH,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE;IAC5B,EAAE,EAAE,OAAO;CACZ,CAAC,CAAC"}
|
package/dist/events.d.ts
CHANGED
|
@@ -14,8 +14,23 @@ export declare const eventType: z.ZodString;
|
|
|
14
14
|
export declare const systemActor: z.ZodObject<{
|
|
15
15
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
16
16
|
}, z.core.$strip>;
|
|
17
|
+
/**
|
|
18
|
+
* A CONNECTOR acted — an external provider's callback, effected through a
|
|
19
|
+
* connection (#97).
|
|
20
|
+
*
|
|
21
|
+
* A third member rather than a synthetic principal, for the reason
|
|
22
|
+
* `PlatformActorId` is branded separately from `PrincipalId`: a connector that
|
|
23
|
+
* reads as a person in the audit trail is worse than one that cannot act at
|
|
24
|
+
* all. The spine has to be able to say "Scrive did this" without naming a human
|
|
25
|
+
* who did not.
|
|
26
|
+
*/
|
|
27
|
+
export declare const connectorActor: z.ZodObject<{
|
|
28
|
+
connection: z.ZodString;
|
|
29
|
+
}, z.core.$strip>;
|
|
17
30
|
export declare const actor: z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">, z.ZodObject<{
|
|
18
31
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
connection: z.ZodString;
|
|
19
34
|
}, z.core.$strip>]>;
|
|
20
35
|
export type Actor = z.infer<typeof actor>;
|
|
21
36
|
export declare const domainEventInput: z.ZodObject<{
|
|
@@ -43,6 +58,8 @@ export declare const domainEvent: z.ZodObject<{
|
|
|
43
58
|
scopeId: z.core.$ZodBranded<z.ZodString, "ScopeId", "out">;
|
|
44
59
|
actor: z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">, z.ZodObject<{
|
|
45
60
|
system: z.core.$ZodBranded<z.ZodString, "ModuleId", "out">;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
connection: z.ZodString;
|
|
46
63
|
}, z.core.$strip>]>;
|
|
47
64
|
entity: z.ZodObject<{
|
|
48
65
|
entityType: z.ZodString;
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,E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,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
package/dist/events.js
CHANGED
|
@@ -11,7 +11,18 @@ export const piiClass = z.enum(['none', 'pseudonymous', 'direct']);
|
|
|
11
11
|
// 'workorder.completed' — module-namespaced
|
|
12
12
|
export const eventType = z.string().regex(/^[a-z0-9-]+\.[a-z0-9-]+$/);
|
|
13
13
|
export const systemActor = z.object({ system: moduleId });
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* A CONNECTOR acted — an external provider's callback, effected through a
|
|
16
|
+
* connection (#97).
|
|
17
|
+
*
|
|
18
|
+
* A third member rather than a synthetic principal, for the reason
|
|
19
|
+
* `PlatformActorId` is branded separately from `PrincipalId`: a connector that
|
|
20
|
+
* reads as a person in the audit trail is worse than one that cannot act at
|
|
21
|
+
* all. The spine has to be able to say "Scrive did this" without naming a human
|
|
22
|
+
* who did not.
|
|
23
|
+
*/
|
|
24
|
+
export const connectorActor = z.object({ connection: z.string().min(1) });
|
|
25
|
+
export const actor = z.union([principalId, systemActor, connectorActor]);
|
|
15
26
|
const piiInvariant = (val, ctx) => {
|
|
16
27
|
if (val.piiClass !== 'none' && val.subjectId === undefined) {
|
|
17
28
|
ctx.addIssue({
|
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,WAAW,EACX,OAAO,EACP,QAAQ,GACT,MAAM,UAAU,CAAC;AAElB,kFAAkF;AAClF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE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EAAE,EAAE,OAAO,EAAE,uEAAuE;IACpF,IAAI,EAAE,SAAS;IACf,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC1C,UAAU,EAAE,OAAO,EAAE,oBAAoB;IACzC,QAAQ,EAAE,mEAAmE;IAC7E,OAAO,EAAE,oBAAoB;IAC7B,KAAK,EAAE,oDAAoD;IAC3D,MAAM,EAAE,SAAS;IACjB,QAAQ;IACR,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE;IACnC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC;KACD,WAAW,CAAC,YAAY,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from './ids.js';
|
|
|
21
21
|
export * from './registry.js';
|
|
22
22
|
export * from './routing.js';
|
|
23
23
|
export * from './tenancy.js';
|
|
24
|
+
export * from './connections.js';
|
|
24
25
|
export * from './control-plane.js';
|
|
25
26
|
export * from './permission.js';
|
|
26
27
|
export * from './events.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export * from './ids.js';
|
|
|
21
21
|
export * from './registry.js';
|
|
22
22
|
export * from './routing.js';
|
|
23
23
|
export * from './tenancy.js';
|
|
24
|
+
export * from './connections.js';
|
|
24
25
|
export * from './control-plane.js';
|
|
25
26
|
export * from './permission.js';
|
|
26
27
|
export * from './events.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
package/dist/permission.d.ts
CHANGED
|
@@ -34,6 +34,47 @@ export declare const roleAssignment: z.ZodObject<{
|
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
export type RoleAssignment = z.infer<typeof roleAssignment>;
|
|
37
|
+
/**
|
|
38
|
+
* Who is being checked (#97).
|
|
39
|
+
*
|
|
40
|
+
* The model already had more than one kind of subject — a principal, and the
|
|
41
|
+
* orgs it belongs to via membership. This makes the ENTRY subject polymorphic
|
|
42
|
+
* too, so a connection can hold a grant without pretending to be a person.
|
|
43
|
+
*
|
|
44
|
+
* The alternative was to mint a principal per connection and let it flow
|
|
45
|
+
* through unchanged, which is cheaper and wrong: every audit view would then
|
|
46
|
+
* show a `principal:` subject for something that is not one, which is exactly
|
|
47
|
+
* the confusion `PlatformActorId`'s separate brand exists to prevent.
|
|
48
|
+
*/
|
|
49
|
+
export declare const checkSubject: z.ZodUnion<readonly [z.ZodObject<{
|
|
50
|
+
kind: z.ZodLiteral<"principal">;
|
|
51
|
+
id: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
kind: z.ZodLiteral<"connection">;
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
}, z.core.$strip>]>;
|
|
56
|
+
export type CheckSubject = z.infer<typeof checkSubject>;
|
|
57
|
+
/** The tuple-store ref for a subject: `principal:01J…` / `connection:01J…`. */
|
|
58
|
+
export declare const subjectRef: (subject: CheckSubject) => string;
|
|
59
|
+
/**
|
|
60
|
+
* A capability granted to a CONNECTION rather than a principal (#97).
|
|
61
|
+
*
|
|
62
|
+
* Narrow by construction: a connection is keyed (tenant, vertical, provider),
|
|
63
|
+
* so granting it `protocol:record-signature` reaches only that tenant's scopes
|
|
64
|
+
* running that vertical. The blast radius of a leaked provider token is one
|
|
65
|
+
* permission on one vertical's data, and it is readable in a diff.
|
|
66
|
+
*/
|
|
67
|
+
export declare const connectionGrant: z.ZodObject<{
|
|
68
|
+
connectionId: z.ZodString;
|
|
69
|
+
permission: z.core.$ZodBranded<z.ZodString, "PermissionKey", "out">;
|
|
70
|
+
node: z.ZodObject<{
|
|
71
|
+
tenantId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
|
|
72
|
+
scopeId: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "ScopeId", "out">>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
expiresAt: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
75
|
+
grantedBy: z.core.$ZodBranded<z.ZodString, "PlatformActorId", "out">;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type ConnectionGrant = z.infer<typeof connectionGrant>;
|
|
37
78
|
export declare const capabilityGrant: z.ZodObject<{
|
|
38
79
|
principalId: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
39
80
|
permission: z.core.$ZodBranded<z.ZodString, "PermissionKey", "out">;
|
package/dist/permission.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../src/permission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../src/permission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,eAAO,MAAM,IAAI;;;iBAGf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,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;;8BAUnB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;iBAS/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/permission.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { instant, moduleId, permissionKey, principalId, scopeId, tenantId } from './ids.js';
|
|
2
|
+
import { instant, moduleId, permissionKey, platformActorId, principalId, scopeId, tenantId, } from './ids.js';
|
|
3
3
|
import { entityRef } from './events.js';
|
|
4
4
|
// ============================================================================
|
|
5
5
|
// Authored surface — what humans and agents write (design doc §4.1).
|
|
@@ -38,6 +38,39 @@ export const roleAssignment = z.object({
|
|
|
38
38
|
// `entity` narrows the grant to one entity and its declared descendants —
|
|
39
39
|
// how portal customers see only their own facilities/orders inside a shared
|
|
40
40
|
// scope (design doc §4.1, K-12). Always audited.
|
|
41
|
+
/**
|
|
42
|
+
* Who is being checked (#97).
|
|
43
|
+
*
|
|
44
|
+
* The model already had more than one kind of subject — a principal, and the
|
|
45
|
+
* orgs it belongs to via membership. This makes the ENTRY subject polymorphic
|
|
46
|
+
* too, so a connection can hold a grant without pretending to be a person.
|
|
47
|
+
*
|
|
48
|
+
* The alternative was to mint a principal per connection and let it flow
|
|
49
|
+
* through unchanged, which is cheaper and wrong: every audit view would then
|
|
50
|
+
* show a `principal:` subject for something that is not one, which is exactly
|
|
51
|
+
* the confusion `PlatformActorId`'s separate brand exists to prevent.
|
|
52
|
+
*/
|
|
53
|
+
export const checkSubject = z.union([
|
|
54
|
+
z.object({ kind: z.literal('principal'), id: principalId }),
|
|
55
|
+
z.object({ kind: z.literal('connection'), id: z.string().min(1) }),
|
|
56
|
+
]);
|
|
57
|
+
/** The tuple-store ref for a subject: `principal:01J…` / `connection:01J…`. */
|
|
58
|
+
export const subjectRef = (subject) => `${subject.kind}:${subject.id}`;
|
|
59
|
+
/**
|
|
60
|
+
* A capability granted to a CONNECTION rather than a principal (#97).
|
|
61
|
+
*
|
|
62
|
+
* Narrow by construction: a connection is keyed (tenant, vertical, provider),
|
|
63
|
+
* so granting it `protocol:record-signature` reaches only that tenant's scopes
|
|
64
|
+
* running that vertical. The blast radius of a leaked provider token is one
|
|
65
|
+
* permission on one vertical's data, and it is readable in a diff.
|
|
66
|
+
*/
|
|
67
|
+
export const connectionGrant = z.object({
|
|
68
|
+
connectionId: z.string().min(1),
|
|
69
|
+
permission: permissionKey,
|
|
70
|
+
node,
|
|
71
|
+
expiresAt: instant.optional(),
|
|
72
|
+
grantedBy: platformActorId,
|
|
73
|
+
});
|
|
41
74
|
export const capabilityGrant = z.object({
|
|
42
75
|
principalId,
|
|
43
76
|
permission: permissionKey,
|
package/dist/permission.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.js","sourceRoot":"","sources":["../src/permission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"permission.js","sourceRoot":"","sources":["../src/permission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,eAAe,EACf,WAAW,EACX,OAAO,EACP,QAAQ,GACT,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,+EAA+E;AAC/E,qEAAqE;AACrE,+EAA+E;AAE/E,wEAAwE;AACxE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ;IACR,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAGH,MAAM,C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AAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;IACtD,CAAC,CAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;QACxB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;KACrC,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QACzB,OAAO,EAAE,aAAa;QACtB,IAAI;KACL,CAAC;CACH,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,WAAW;IACX,IAAI;IACJ,WAAW,EAAE,CAAC,CAAC,KAAK,CAClB,CAAC,CAAC,MAAM,CAAC;QACP,UAAU,EAAE,aAAa;QACzB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;KACrC,CAAC,CACH;CACF,CAAC,CAAC"}
|
package/dist/routing.d.ts
CHANGED
|
@@ -58,9 +58,9 @@ export type HostnameRegion = z.infer<typeof hostnameRegion>;
|
|
|
58
58
|
* `failed` — validation or issuance failed; `note` says why
|
|
59
59
|
*/
|
|
60
60
|
export declare const hostnameStatus: z.ZodEnum<{
|
|
61
|
+
active: "active";
|
|
61
62
|
pending: "pending";
|
|
62
63
|
verifying: "verifying";
|
|
63
|
-
active: "active";
|
|
64
64
|
failed: "failed";
|
|
65
65
|
}>;
|
|
66
66
|
export type HostnameStatus = z.infer<typeof hostnameStatus>;
|
|
@@ -86,9 +86,9 @@ export declare const hostnameBinding: z.ZodObject<{
|
|
|
86
86
|
eu: "eu";
|
|
87
87
|
}>>;
|
|
88
88
|
status: z.ZodEnum<{
|
|
89
|
+
active: "active";
|
|
89
90
|
pending: "pending";
|
|
90
91
|
verifying: "verifying";
|
|
91
|
-
active: "active";
|
|
92
92
|
failed: "failed";
|
|
93
93
|
}>;
|
|
94
94
|
statusNote: z.ZodNullable<z.ZodString>;
|
package/dist/tenancy.d.ts
CHANGED
|
@@ -46,8 +46,8 @@ export declare const org: z.ZodObject<{
|
|
|
46
46
|
}, z.core.$strip>;
|
|
47
47
|
export type Org = z.infer<typeof org>;
|
|
48
48
|
export declare const createOrgInput: z.ZodObject<{
|
|
49
|
-
tenantId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
|
|
50
49
|
id: z.core.$ZodBranded<z.ZodString, "OrgId", "out">;
|
|
50
|
+
tenantId: z.core.$ZodBranded<z.ZodString, "TenantId", "out">;
|
|
51
51
|
slug: z.ZodString;
|
|
52
52
|
name: z.ZodString;
|
|
53
53
|
}, z.core.$strip>;
|
|
@@ -65,10 +65,16 @@ export declare const storageShape: z.ZodEnum<{
|
|
|
65
65
|
B: "B";
|
|
66
66
|
}>;
|
|
67
67
|
export type StorageShape = z.infer<typeof storageShape>;
|
|
68
|
-
export declare const jurisdiction: z.
|
|
68
|
+
export declare const jurisdiction: z.ZodEnum<{
|
|
69
69
|
eu: "eu";
|
|
70
|
-
|
|
70
|
+
us: "us";
|
|
71
|
+
global: "global";
|
|
72
|
+
}>;
|
|
71
73
|
export type Jurisdiction = z.infer<typeof jurisdiction>;
|
|
74
|
+
export declare const provisionableJurisdiction: z.ZodEnum<{
|
|
75
|
+
global: "global";
|
|
76
|
+
}>;
|
|
77
|
+
export type ProvisionableJurisdiction = z.infer<typeof provisionableJurisdiction>;
|
|
72
78
|
/**
|
|
73
79
|
* A scope's last *failed* migration attempt (kernel-design §5.3), or null when the
|
|
74
80
|
* last attempt succeeded and when none has run.
|
|
@@ -113,9 +119,11 @@ export declare const scope: z.ZodObject<{
|
|
|
113
119
|
A: "A";
|
|
114
120
|
B: "B";
|
|
115
121
|
}>;
|
|
116
|
-
jurisdiction: z.
|
|
122
|
+
jurisdiction: z.ZodEnum<{
|
|
117
123
|
eu: "eu";
|
|
118
|
-
|
|
124
|
+
us: "us";
|
|
125
|
+
global: "global";
|
|
126
|
+
}>;
|
|
119
127
|
vertical: z.ZodNullable<z.ZodString>;
|
|
120
128
|
verticalVersionId: z.ZodNullable<z.ZodString>;
|
|
121
129
|
schemaVersion: z.ZodString;
|
package/dist/tenancy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenancy.d.ts","sourceRoot":"","sources":["../src/tenancy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,YAAY;;;;EAA8C,CAAC;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,eAAO,MAAM,MAAM;;;;;;;;;;iBAMjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAI5C,eAAO,MAAM,iBAAiB;;;;iBAAoD,CAAC;AACnF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,GAAG;;;;;;iBAMd,CAAC;AACH,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;AAGtC,eAAO,MAAM,cAAc;;;;;iBAAiE,CAAC;AAC7F,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,WAAW;;;;;;EAMtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAGtD,eAAO,MAAM,YAAY;;;EAAqB,CAAC;AAC/C,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,C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AK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB;;;;;kBAOhB,CAAC;AACd,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgChB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC"}
|
package/dist/tenancy.js
CHANGED
|
@@ -43,8 +43,28 @@ export const scopeStatus = z.enum([
|
|
|
43
43
|
]);
|
|
44
44
|
// §5.2 of the design doc: A = DO-embedded SQLite is primary; B = DO control plane + D1
|
|
45
45
|
export const storageShape = z.enum(['A', 'B']);
|
|
46
|
-
// Fixed at provisioning; a DO can never relocate (design K-7)
|
|
47
|
-
|
|
46
|
+
// Fixed at provisioning; a DO can never relocate (design K-7). `global` is the
|
|
47
|
+
// honest name for an unconstrained scope — no regional subnamespace, placed near
|
|
48
|
+
// first access — which is what EVERY scope is today, so naming it renames nothing
|
|
49
|
+
// at runtime. It also ends the old `null`, which meant both "unconstrained" and
|
|
50
|
+
// "nobody decided" at once (K-32). `eu`/`us` name residency guarantees whose
|
|
51
|
+
// enforcement (DO jurisdiction subnamespace, Regional Services) is not built yet,
|
|
52
|
+
// so the provisioning boundary gates them — see `provisionableJurisdiction`.
|
|
53
|
+
//
|
|
54
|
+
// The full vocabulary ships now, ahead of enforcement, precisely BECAUSE this is
|
|
55
|
+
// immutable: a scope that took a value we could not name later would be a data
|
|
56
|
+
// migration rather than a config change. Widening what is ACCEPTED is additive;
|
|
57
|
+
// widening what can be STORED is not, so the storable set is complete from the start.
|
|
58
|
+
export const jurisdiction = z.enum(['eu', 'us', 'global']);
|
|
59
|
+
// Which jurisdictions the provisioning boundary currently ACCEPTS — a subset of
|
|
60
|
+
// what `jurisdiction` can store. `eu`/`us` are absent until their enforcement
|
|
61
|
+
// exists (a US isn't even a Cloudflare DO jurisdiction — it's Regional Services +
|
|
62
|
+
// a D1 location hint), because accepting them would record a residency guarantee
|
|
63
|
+
// with no mechanism behind it, which is worse than not offering it. Widen THIS
|
|
64
|
+
// list — never `jurisdiction` — when enforcement lands. Gated the same way
|
|
65
|
+
// `STANDALONE` and `ALLOW_DEV_HEADER` are: the capability is absent, not present
|
|
66
|
+
// and checked (K-31).
|
|
67
|
+
export const provisionableJurisdiction = z.enum(['global']);
|
|
48
68
|
/**
|
|
49
69
|
* A scope's last *failed* migration attempt (kernel-design §5.3), or null when the
|
|
50
70
|
* last attempt succeeded and when none has run.
|
package/dist/tenancy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenancy.js","sourceRoot":"","sources":["../src/tenancy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEnE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAGxE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,EAAE,EAAE,QAAQ;IACZ,IAAI;IACJ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,OAAO;CACnB,CAAC,CAAC;AAGH,6EAA6E;AAC7E,yEAAyE;AACzE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CA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AC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC/C,6EAA6E;IAC7E,iFAAiF;IACjF,gFAAgF;IAChF,+EAA+E;IAC/E,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,gBAAgB;IAChB,SAAS,EAAE,OAAO;CACnB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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": {
|