@fuzdev/fuz_app 0.158.0 → 0.160.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/actions/CLAUDE.md +7 -2
- package/dist/actions/protocol.d.ts +7 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +19 -4
- package/dist/auth/CLAUDE.md +40 -15
- package/dist/auth/account_schema.d.ts +2 -2
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +1 -1
- package/dist/auth/audit_log_route_schema.d.ts +18 -6
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +7 -3
- package/dist/auth/credential_type_schema.d.ts +4 -4
- package/dist/auth/credential_type_schema.d.ts.map +1 -1
- package/dist/auth/credential_type_schema.js +6 -6
- package/dist/auth/grant_path_schema.d.ts +4 -4
- package/dist/auth/grant_path_schema.d.ts.map +1 -1
- package/dist/auth/grant_path_schema.js +6 -6
- package/dist/auth/request_context.js +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts +2257 -400
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +109 -102
- package/dist/auth/role_grant_offer_actions.d.ts +6 -3
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +15 -6
- package/dist/auth/role_grant_offer_ddl.d.ts +5 -4
- package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_ddl.js +5 -4
- package/dist/auth/role_grant_offer_notifications.d.ts +1364 -255
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +100 -47
- package/dist/auth/role_grant_offer_schema.d.ts +90 -22
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +40 -39
- package/dist/auth/role_schema.d.ts +15 -2
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +17 -4
- package/dist/auth/role_schema_fuz.d.ts +29 -0
- package/dist/auth/role_schema_fuz.d.ts.map +1 -0
- package/dist/auth/role_schema_fuz.js +28 -0
- package/dist/auth/scope_kind_schema.d.ts +27 -15
- package/dist/auth/scope_kind_schema.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema.js +30 -18
- package/dist/auth/scope_kind_schema_fuz.d.ts +30 -0
- package/dist/auth/scope_kind_schema_fuz.d.ts.map +1 -0
- package/dist/auth/scope_kind_schema_fuz.js +29 -0
- package/dist/auth/self_service_role_action_specs.d.ts +70 -27
- package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
- package/dist/auth/self_service_role_action_specs.js +16 -14
- package/dist/auth/token_scope.d.ts +3 -2
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +4 -3
- package/dist/http/CLAUDE.md +6 -0
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +8 -3
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +3 -2
- package/dist/server/surface_route.d.ts.map +1 -1
- package/dist/server/surface_route.js +3 -2
- package/dist/testing/CLAUDE.md +27 -16
- package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +15 -3
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +60 -17
- package/dist/testing/cross_backend/role_grant_role_grammar.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_role_grammar.js +94 -6
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -3
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +2 -1
- package/dist/ui/CLAUDE.md +4 -4
- package/dist/ui/admin_accounts_state.svelte.d.ts +8 -8
- package/dist/ui/role_grant_offers_state.svelte.d.ts +9 -9
- package/dist/ui/role_grant_offers_state.svelte.js +4 -4
- package/package.json +1 -1
package/dist/auth/role_schema.js
CHANGED
|
@@ -32,13 +32,26 @@ import { GRANT_PATH_ADMIN, GRANT_PATH_BOOTSTRAP } from './grant_path_schema.js';
|
|
|
32
32
|
*/
|
|
33
33
|
export const ROLE_NAME_LENGTH_MAX = 64;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* The grammar of a role name: runs of lowercase letters joined by single
|
|
36
|
+
* underscores, so no leading, trailing or consecutive underscores. Both
|
|
37
|
+
* `RoleName`s hold it, the Zod one here and the `@fuzdev/fuz_schema` twin in
|
|
38
|
+
* `auth/role_schema_fuz.ts`, and the sibling name grammars are the same
|
|
39
|
+
* pattern: `GRANT_PATH_NAME_REGEX`, `CREDENTIAL_TYPE_NAME_REGEX`,
|
|
40
|
+
* `SCOPE_KIND_NAME_REGEX` and `TOKEN_SURFACE_NAME_REGEX`.
|
|
41
|
+
*/
|
|
42
|
+
export const ROLE_NAME_PATTERN = /^[a-z]+(?:_[a-z]+)*$/;
|
|
43
|
+
/** The message of a role name longer than `ROLE_NAME_LENGTH_MAX`, in both `RoleName`s. */
|
|
44
|
+
export const ROLE_NAME_LENGTH_MESSAGE = `Role names must be at most ${ROLE_NAME_LENGTH_MAX} characters`;
|
|
45
|
+
/** The message of a role name outside `ROLE_NAME_PATTERN`, in both `RoleName`s. */
|
|
46
|
+
export const ROLE_NAME_PATTERN_MESSAGE = 'Role names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores';
|
|
47
|
+
/**
|
|
48
|
+
* Valid role name: lowercase letters and underscores, no leading, trailing or
|
|
49
|
+
* consecutive underscores, at most `ROLE_NAME_LENGTH_MAX` characters.
|
|
37
50
|
*/
|
|
38
51
|
export const RoleName = bounded_string({
|
|
39
52
|
max: ROLE_NAME_LENGTH_MAX,
|
|
40
|
-
max_message:
|
|
41
|
-
}).regex(
|
|
53
|
+
max_message: ROLE_NAME_LENGTH_MESSAGE
|
|
54
|
+
}).regex(ROLE_NAME_PATTERN, ROLE_NAME_PATTERN_MESSAGE);
|
|
42
55
|
// Builtin roles — provided by fuz_app, always available.
|
|
43
56
|
/** System-level role. Requires daemon token (filesystem proof). Controls the keep. */
|
|
44
57
|
export const ROLE_KEEPER = 'keeper';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@fuzdev/fuz_schema` twin of the Zod `RoleName` (`auth/role_schema.ts`),
|
|
3
|
+
* under the same name, for schemas written in fuz_schema.
|
|
4
|
+
*
|
|
5
|
+
* Both are built from the constants `role_schema.ts` exports, so the bound,
|
|
6
|
+
* the grammar and the two messages can't drift apart. They give every input
|
|
7
|
+
* the same verdict and output, and write the same JSON Schema
|
|
8
|
+
* (`maxLength` and `pattern`); a string both too long and outside the grammar
|
|
9
|
+
* gets the one length issue from this twin, as its `pipe` stops at the first
|
|
10
|
+
* failing step, where the Zod one adds the grammar issue after it.
|
|
11
|
+
*
|
|
12
|
+
* The export is `@nodocs` while the Zod `RoleName` stays, as the docs build
|
|
13
|
+
* refuses two exports of one name.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
18
|
+
/**
|
|
19
|
+
* Valid role name: lowercase letters and underscores, no leading, trailing or
|
|
20
|
+
* consecutive underscores, at most `ROLE_NAME_LENGTH_MAX` UTF-16 code units, the twin of
|
|
21
|
+
* the Zod `RoleName`. A string it refuses gets the Zod one's message; a
|
|
22
|
+
* value that is no string, fuz_schema's.
|
|
23
|
+
*
|
|
24
|
+
* @nodocs
|
|
25
|
+
*/
|
|
26
|
+
export declare const RoleName: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
27
|
+
/** @nodocs */
|
|
28
|
+
export type RoleName = Infer<typeof RoleName>;
|
|
29
|
+
//# sourceMappingURL=role_schema_fuz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role_schema_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_schema_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAwB,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAUhF;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,0MAGpB,CAAC;AACF,cAAc;AACd,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@fuzdev/fuz_schema` twin of the Zod `RoleName` (`auth/role_schema.ts`),
|
|
3
|
+
* under the same name, for schemas written in fuz_schema.
|
|
4
|
+
*
|
|
5
|
+
* Both are built from the constants `role_schema.ts` exports, so the bound,
|
|
6
|
+
* the grammar and the two messages can't drift apart. They give every input
|
|
7
|
+
* the same verdict and output, and write the same JSON Schema
|
|
8
|
+
* (`maxLength` and `pattern`); a string both too long and outside the grammar
|
|
9
|
+
* gets the one length issue from this twin, as its `pipe` stops at the first
|
|
10
|
+
* failing step, where the Zod one adds the grammar issue after it.
|
|
11
|
+
*
|
|
12
|
+
* The export is `@nodocs` while the Zod `RoleName` stays, as the docs build
|
|
13
|
+
* refuses two exports of one name.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { message, pipe, regex } from '@fuzdev/fuz_schema/schema.ts';
|
|
18
|
+
import { bounded_string } from '../primitive_schemas_fuz.js';
|
|
19
|
+
import { ROLE_NAME_LENGTH_MAX, ROLE_NAME_LENGTH_MESSAGE, ROLE_NAME_PATTERN, ROLE_NAME_PATTERN_MESSAGE } from './role_schema.js';
|
|
20
|
+
/**
|
|
21
|
+
* Valid role name: lowercase letters and underscores, no leading, trailing or
|
|
22
|
+
* consecutive underscores, at most `ROLE_NAME_LENGTH_MAX` UTF-16 code units, the twin of
|
|
23
|
+
* the Zod `RoleName`. A string it refuses gets the Zod one's message; a
|
|
24
|
+
* value that is no string, fuz_schema's.
|
|
25
|
+
*
|
|
26
|
+
* @nodocs
|
|
27
|
+
*/
|
|
28
|
+
export const RoleName = pipe(bounded_string({ max: ROLE_NAME_LENGTH_MAX, max_message: ROLE_NAME_LENGTH_MESSAGE }), message(regex(ROLE_NAME_PATTERN), ROLE_NAME_PATTERN_MESSAGE));
|
|
@@ -22,32 +22,44 @@
|
|
|
22
22
|
*
|
|
23
23
|
* The literal `'GLOBAL'` (uppercase) appears as an index expression
|
|
24
24
|
* inside the partial unique indexes on `role_grant` and `role_grant_offer`
|
|
25
|
-
* (`COALESCE(scope_kind, 'GLOBAL')`)
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* (`COALESCE(scope_kind, 'GLOBAL')`), never as a registry entry. It is off
|
|
26
|
+
* the `ScopeKindName` grammar, so no registry declares it and the grant
|
|
27
|
+
* inputs (`role_grant_offer_create`, `role_grant_assign`) refuse it: a row
|
|
28
|
+
* written through them never holds it. One written by other means could,
|
|
29
|
+
* and with the all-zeros `scope_id` it would share a global grant's index
|
|
30
|
+
* key.
|
|
29
31
|
*
|
|
30
32
|
* @module
|
|
31
33
|
*/
|
|
32
34
|
import { z } from 'zod';
|
|
33
35
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* leading or
|
|
37
|
-
* `'GLOBAL'` token.
|
|
36
|
+
* Runs of lowercase letters (a-z) joined by single underscores, the grammar
|
|
37
|
+
* of `RoleName`, `CredentialTypeName` and `GrantPathName` too. Rejects empty
|
|
38
|
+
* strings, leading, trailing or consecutive underscores, uppercase, digits,
|
|
39
|
+
* and the index-side `'GLOBAL'` token.
|
|
38
40
|
*/
|
|
39
41
|
export declare const SCOPE_KIND_NAME_REGEX: RegExp;
|
|
40
42
|
/**
|
|
41
43
|
* Maximum length of a `scope_kind`, in UTF-16 code units (what
|
|
42
|
-
* `String.length` measures; enforced by `bounded_string`).
|
|
43
|
-
*
|
|
44
|
-
*
|
|
44
|
+
* `String.length` measures; enforced by `bounded_string`). Part of the
|
|
45
|
+
* `ScopeKindName` grammar, which bounds a registered name and the tag where
|
|
46
|
+
* it enters — the grant inputs (`role_grant_offer_create`,
|
|
47
|
+
* `role_grant_assign`) copy it into the row and its audit metadata — so no
|
|
45
48
|
* registry declares a kind the grant inputs would refuse. Same value as
|
|
46
|
-
* `ROLE_NAME_LENGTH_MAX`, whose grammar the name
|
|
49
|
+
* `ROLE_NAME_LENGTH_MAX`, whose grammar the name shares, and as the Rust
|
|
47
50
|
* spine's `SCOPE_KIND_LENGTH_MAX`.
|
|
48
51
|
*/
|
|
49
52
|
export declare const SCOPE_KIND_LENGTH_MAX = 64;
|
|
50
|
-
/**
|
|
53
|
+
/** The message of a scope-kind name longer than `SCOPE_KIND_LENGTH_MAX`, in both `ScopeKindName`s. */
|
|
54
|
+
export declare const SCOPE_KIND_NAME_LENGTH_MESSAGE = "Scope-kind names must be at most 64 characters";
|
|
55
|
+
/** The message of a scope-kind name outside `SCOPE_KIND_NAME_REGEX`, in both `ScopeKindName`s. */
|
|
56
|
+
export declare const SCOPE_KIND_NAME_PATTERN_MESSAGE = "Scope-kind names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores";
|
|
57
|
+
/**
|
|
58
|
+
* Zod schema for valid scope-kind name strings: a registered name, and the
|
|
59
|
+
* `scope_kind` the grant inputs take. Twin of the Rust spine's
|
|
60
|
+
* `is_valid_scope_kind_name`, and of the `@fuzdev/fuz_schema` `ScopeKindName`
|
|
61
|
+
* in `auth/scope_kind_schema_fuz.ts`, built from the same constants.
|
|
62
|
+
*/
|
|
51
63
|
export declare const ScopeKindName: z.ZodString;
|
|
52
64
|
export type ScopeKindName = z.infer<typeof ScopeKindName>;
|
|
53
65
|
/**
|
|
@@ -78,8 +90,8 @@ export interface ScopeKindSchemaResult {
|
|
|
78
90
|
*
|
|
79
91
|
* Open registry — no builtins. The `'GLOBAL'` token used inside the
|
|
80
92
|
* partial unique indexes on `role_grant` and `role_grant_offer` is not a
|
|
81
|
-
* registry entry (it's an index expression only) and
|
|
82
|
-
*
|
|
93
|
+
* registry entry (it's an index expression only), and no consumer can
|
|
94
|
+
* declare it because the regex rejects uppercase.
|
|
83
95
|
*
|
|
84
96
|
* Call once at server init. Pass the result into `create_role_schema`'s
|
|
85
97
|
* optional `scope_kinds` parameter so each role's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope_kind_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/scope_kind_schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scope_kind_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/scope_kind_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAyB,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,sGAAsG;AACtG,eAAO,MAAM,8BAA8B,mDAAyE,CAAC;AAErH,kGAAkG;AAClG,eAAO,MAAM,+BAA+B,uHACyE,CAAC;AAEtH;;;;;GAKG;AACH,eAAO,MAAM,aAAa,aAGsC,CAAC;AACjE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACrC;;;;;OAKG;IACH,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,wBAAwB,GACpC,gBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAC3C,qBAwBF,CAAC"}
|
|
@@ -22,44 +22,56 @@
|
|
|
22
22
|
*
|
|
23
23
|
* The literal `'GLOBAL'` (uppercase) appears as an index expression
|
|
24
24
|
* inside the partial unique indexes on `role_grant` and `role_grant_offer`
|
|
25
|
-
* (`COALESCE(scope_kind, 'GLOBAL')`)
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* (`COALESCE(scope_kind, 'GLOBAL')`), never as a registry entry. It is off
|
|
26
|
+
* the `ScopeKindName` grammar, so no registry declares it and the grant
|
|
27
|
+
* inputs (`role_grant_offer_create`, `role_grant_assign`) refuse it: a row
|
|
28
|
+
* written through them never holds it. One written by other means could,
|
|
29
|
+
* and with the all-zeros `scope_id` it would share a global grant's index
|
|
30
|
+
* key.
|
|
29
31
|
*
|
|
30
32
|
* @module
|
|
31
33
|
*/
|
|
32
34
|
import { z } from 'zod';
|
|
33
35
|
import { bounded_string } from '../primitive_schemas.js';
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* leading or
|
|
38
|
-
* `'GLOBAL'` token.
|
|
37
|
+
* Runs of lowercase letters (a-z) joined by single underscores, the grammar
|
|
38
|
+
* of `RoleName`, `CredentialTypeName` and `GrantPathName` too. Rejects empty
|
|
39
|
+
* strings, leading, trailing or consecutive underscores, uppercase, digits,
|
|
40
|
+
* and the index-side `'GLOBAL'` token.
|
|
39
41
|
*/
|
|
40
|
-
export const SCOPE_KIND_NAME_REGEX = /^[a-z][a-
|
|
42
|
+
export const SCOPE_KIND_NAME_REGEX = /^[a-z]+(?:_[a-z]+)*$/;
|
|
41
43
|
/**
|
|
42
44
|
* Maximum length of a `scope_kind`, in UTF-16 code units (what
|
|
43
|
-
* `String.length` measures; enforced by `bounded_string`).
|
|
44
|
-
*
|
|
45
|
-
*
|
|
45
|
+
* `String.length` measures; enforced by `bounded_string`). Part of the
|
|
46
|
+
* `ScopeKindName` grammar, which bounds a registered name and the tag where
|
|
47
|
+
* it enters — the grant inputs (`role_grant_offer_create`,
|
|
48
|
+
* `role_grant_assign`) copy it into the row and its audit metadata — so no
|
|
46
49
|
* registry declares a kind the grant inputs would refuse. Same value as
|
|
47
|
-
* `ROLE_NAME_LENGTH_MAX`, whose grammar the name
|
|
50
|
+
* `ROLE_NAME_LENGTH_MAX`, whose grammar the name shares, and as the Rust
|
|
48
51
|
* spine's `SCOPE_KIND_LENGTH_MAX`.
|
|
49
52
|
*/
|
|
50
53
|
export const SCOPE_KIND_LENGTH_MAX = 64;
|
|
51
|
-
/**
|
|
54
|
+
/** The message of a scope-kind name longer than `SCOPE_KIND_LENGTH_MAX`, in both `ScopeKindName`s. */
|
|
55
|
+
export const SCOPE_KIND_NAME_LENGTH_MESSAGE = `Scope-kind names must be at most ${SCOPE_KIND_LENGTH_MAX} characters`;
|
|
56
|
+
/** The message of a scope-kind name outside `SCOPE_KIND_NAME_REGEX`, in both `ScopeKindName`s. */
|
|
57
|
+
export const SCOPE_KIND_NAME_PATTERN_MESSAGE = 'Scope-kind names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores';
|
|
58
|
+
/**
|
|
59
|
+
* Zod schema for valid scope-kind name strings: a registered name, and the
|
|
60
|
+
* `scope_kind` the grant inputs take. Twin of the Rust spine's
|
|
61
|
+
* `is_valid_scope_kind_name`, and of the `@fuzdev/fuz_schema` `ScopeKindName`
|
|
62
|
+
* in `auth/scope_kind_schema_fuz.ts`, built from the same constants.
|
|
63
|
+
*/
|
|
52
64
|
export const ScopeKindName = bounded_string({
|
|
53
65
|
max: SCOPE_KIND_LENGTH_MAX,
|
|
54
|
-
max_message:
|
|
55
|
-
}).regex(SCOPE_KIND_NAME_REGEX,
|
|
66
|
+
max_message: SCOPE_KIND_NAME_LENGTH_MESSAGE
|
|
67
|
+
}).regex(SCOPE_KIND_NAME_REGEX, SCOPE_KIND_NAME_PATTERN_MESSAGE);
|
|
56
68
|
/**
|
|
57
69
|
* Create a scope-kind schema from a consumer-declared registry.
|
|
58
70
|
*
|
|
59
71
|
* Open registry — no builtins. The `'GLOBAL'` token used inside the
|
|
60
72
|
* partial unique indexes on `role_grant` and `role_grant_offer` is not a
|
|
61
|
-
* registry entry (it's an index expression only) and
|
|
62
|
-
*
|
|
73
|
+
* registry entry (it's an index expression only), and no consumer can
|
|
74
|
+
* declare it because the regex rejects uppercase.
|
|
63
75
|
*
|
|
64
76
|
* Call once at server init. Pass the result into `create_role_schema`'s
|
|
65
77
|
* optional `scope_kinds` parameter so each role's
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@fuzdev/fuz_schema` twin of the Zod `ScopeKindName`
|
|
3
|
+
* (`auth/scope_kind_schema.ts`), under the same name, for schemas written in
|
|
4
|
+
* fuz_schema.
|
|
5
|
+
*
|
|
6
|
+
* Both are built from the constants `scope_kind_schema.ts` exports, so the
|
|
7
|
+
* bound, the grammar and the two messages can't drift apart. They give every
|
|
8
|
+
* input the same verdict and output, and write the same JSON Schema
|
|
9
|
+
* (`maxLength` and `pattern`); a string both too long and outside the grammar
|
|
10
|
+
* gets the one length issue from this twin, as its `pipe` stops at the first
|
|
11
|
+
* failing step, where the Zod one adds the grammar issue after it.
|
|
12
|
+
*
|
|
13
|
+
* The export is `@nodocs` while the Zod `ScopeKindName` stays, as the docs
|
|
14
|
+
* build refuses two exports of one name.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
19
|
+
/**
|
|
20
|
+
* Valid scope-kind name: runs of lowercase letters joined by single
|
|
21
|
+
* underscores, at most `SCOPE_KIND_LENGTH_MAX` UTF-16 code units, the twin of
|
|
22
|
+
* the Zod `ScopeKindName`. A string it refuses gets the Zod one's message; a
|
|
23
|
+
* value that is no string, fuz_schema's.
|
|
24
|
+
*
|
|
25
|
+
* @nodocs
|
|
26
|
+
*/
|
|
27
|
+
export declare const ScopeKindName: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
28
|
+
/** @nodocs */
|
|
29
|
+
export type ScopeKindName = Infer<typeof ScopeKindName>;
|
|
30
|
+
//# sourceMappingURL=scope_kind_schema_fuz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope_kind_schema_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/scope_kind_schema_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAwB,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAUhF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,0MAGzB,CAAC;AACF,cAAc;AACd,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@fuzdev/fuz_schema` twin of the Zod `ScopeKindName`
|
|
3
|
+
* (`auth/scope_kind_schema.ts`), under the same name, for schemas written in
|
|
4
|
+
* fuz_schema.
|
|
5
|
+
*
|
|
6
|
+
* Both are built from the constants `scope_kind_schema.ts` exports, so the
|
|
7
|
+
* bound, the grammar and the two messages can't drift apart. They give every
|
|
8
|
+
* input the same verdict and output, and write the same JSON Schema
|
|
9
|
+
* (`maxLength` and `pattern`); a string both too long and outside the grammar
|
|
10
|
+
* gets the one length issue from this twin, as its `pipe` stops at the first
|
|
11
|
+
* failing step, where the Zod one adds the grammar issue after it.
|
|
12
|
+
*
|
|
13
|
+
* The export is `@nodocs` while the Zod `ScopeKindName` stays, as the docs
|
|
14
|
+
* build refuses two exports of one name.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import { message, pipe, regex } from '@fuzdev/fuz_schema/schema.ts';
|
|
19
|
+
import { bounded_string } from '../primitive_schemas_fuz.js';
|
|
20
|
+
import { SCOPE_KIND_LENGTH_MAX, SCOPE_KIND_NAME_LENGTH_MESSAGE, SCOPE_KIND_NAME_PATTERN_MESSAGE, SCOPE_KIND_NAME_REGEX } from './scope_kind_schema.js';
|
|
21
|
+
/**
|
|
22
|
+
* Valid scope-kind name: runs of lowercase letters joined by single
|
|
23
|
+
* underscores, at most `SCOPE_KIND_LENGTH_MAX` UTF-16 code units, the twin of
|
|
24
|
+
* the Zod `ScopeKindName`. A string it refuses gets the Zod one's message; a
|
|
25
|
+
* value that is no string, fuz_schema's.
|
|
26
|
+
*
|
|
27
|
+
* @nodocs
|
|
28
|
+
*/
|
|
29
|
+
export const ScopeKindName = pipe(bounded_string({ max: SCOPE_KIND_LENGTH_MAX, max_message: SCOPE_KIND_NAME_LENGTH_MESSAGE }), message(regex(SCOPE_KIND_NAME_REGEX), SCOPE_KIND_NAME_PATTERN_MESSAGE));
|
|
@@ -7,28 +7,50 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
11
11
|
import type { RequestResponseActionSpec } from '../actions/action_spec.js';
|
|
12
12
|
/** Error reason — caller asked to self-toggle a role outside the configured allowlist. */
|
|
13
13
|
export declare const ERROR_ROLE_NOT_SELF_SERVICE_ELIGIBLE: "role_not_self_service_eligible";
|
|
14
|
-
/** Input for `self_service_role_set
|
|
15
|
-
export declare const SelfServiceRoleSetInput:
|
|
16
|
-
role:
|
|
17
|
-
enabled:
|
|
18
|
-
acting
|
|
19
|
-
},
|
|
20
|
-
|
|
14
|
+
/** Input for `self_service_role_set`, a `@fuzdev/fuz_schema` schema. */
|
|
15
|
+
export declare const SelfServiceRoleSetInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
16
|
+
role: string;
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
acting?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
role: string;
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
acting?: string | undefined;
|
|
23
|
+
}, "object", {
|
|
24
|
+
role: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
25
|
+
enabled: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>;
|
|
26
|
+
acting: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
|
|
27
|
+
readonly '~types'?: {
|
|
28
|
+
readonly input: string;
|
|
29
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
30
|
+
} | undefined;
|
|
31
|
+
}>>;
|
|
32
|
+
}>;
|
|
33
|
+
export type SelfServiceRoleSetInput = Infer<typeof SelfServiceRoleSetInput>;
|
|
21
34
|
/**
|
|
22
|
-
* Output for `self_service_role_set
|
|
23
|
-
* (always equals the input `enabled` on success).
|
|
24
|
-
* when the call mutated — re-grants / re-revokes
|
|
35
|
+
* Output for `self_service_role_set`, a `@fuzdev/fuz_schema` schema. `enabled`
|
|
36
|
+
* echoes the post-call state (always equals the input `enabled` on success).
|
|
37
|
+
* `changed` is `true` only when the call mutated — re-grants / re-revokes
|
|
38
|
+
* return `false`.
|
|
25
39
|
*/
|
|
26
|
-
export declare const SelfServiceRoleSetOutput:
|
|
27
|
-
ok:
|
|
28
|
-
enabled:
|
|
29
|
-
changed:
|
|
30
|
-
},
|
|
31
|
-
|
|
40
|
+
export declare const SelfServiceRoleSetOutput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
41
|
+
ok: true;
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
changed: boolean;
|
|
44
|
+
}, {
|
|
45
|
+
ok: true;
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
changed: boolean;
|
|
48
|
+
}, "object", {
|
|
49
|
+
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
50
|
+
enabled: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>;
|
|
51
|
+
changed: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>;
|
|
52
|
+
}>;
|
|
53
|
+
export type SelfServiceRoleSetOutput = Infer<typeof SelfServiceRoleSetOutput>;
|
|
32
54
|
/**
|
|
33
55
|
* `rate_limit: 'account'` bounds audit-row churn. The toggle is idempotent
|
|
34
56
|
* (`changed: false` re-grants/re-revokes), but every call still writes a
|
|
@@ -52,16 +74,37 @@ export declare const self_service_role_set_action_spec: {
|
|
|
52
74
|
credential_types: string[];
|
|
53
75
|
};
|
|
54
76
|
side_effects: true;
|
|
55
|
-
input:
|
|
56
|
-
role:
|
|
57
|
-
enabled:
|
|
58
|
-
acting
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
input: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
78
|
+
role: string;
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
acting?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
role: string;
|
|
83
|
+
enabled: boolean;
|
|
84
|
+
acting?: string | undefined;
|
|
85
|
+
}, "object", {
|
|
86
|
+
role: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
87
|
+
enabled: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>;
|
|
88
|
+
acting: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
|
|
89
|
+
readonly '~types'?: {
|
|
90
|
+
readonly input: string;
|
|
91
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
92
|
+
} | undefined;
|
|
93
|
+
}>>;
|
|
94
|
+
}>;
|
|
95
|
+
output: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
96
|
+
ok: true;
|
|
97
|
+
enabled: boolean;
|
|
98
|
+
changed: boolean;
|
|
99
|
+
}, {
|
|
100
|
+
ok: true;
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
changed: boolean;
|
|
103
|
+
}, "object", {
|
|
104
|
+
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
105
|
+
enabled: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>;
|
|
106
|
+
changed: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>;
|
|
107
|
+
}>;
|
|
65
108
|
async: true;
|
|
66
109
|
description: string;
|
|
67
110
|
rate_limit: "account";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self_service_role_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/self_service_role_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"self_service_role_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/self_service_role_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAA4B,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEpF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAI3E,0FAA0F;AAC1F,eAAO,MAAM,oCAAoC,EAAG,gCAAyC,CAAC;AAE9F,wEAAwE;AACxE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;EAOlC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE9E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYT,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,EAAE,aAAa,CAAC,yBAAyB,CAEvF,CAAC"}
|
|
@@ -7,28 +7,30 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { ActingActor } from '../
|
|
10
|
+
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
11
|
+
import { boolean, literal, object } from '@fuzdev/fuz_schema/schema.ts';
|
|
12
|
+
import { ActingActor } from '../primitive_schemas_fuz.js';
|
|
13
|
+
import { RoleName } from './role_schema_fuz.js';
|
|
13
14
|
/** Error reason — caller asked to self-toggle a role outside the configured allowlist. */
|
|
14
15
|
export const ERROR_ROLE_NOT_SELF_SERVICE_ELIGIBLE = 'role_not_self_service_eligible';
|
|
15
|
-
/** Input for `self_service_role_set
|
|
16
|
-
export const SelfServiceRoleSetInput =
|
|
17
|
-
role:
|
|
18
|
-
enabled:
|
|
16
|
+
/** Input for `self_service_role_set`, a `@fuzdev/fuz_schema` schema. */
|
|
17
|
+
export const SelfServiceRoleSetInput = object({
|
|
18
|
+
role: meta(RoleName, { description: 'Role to toggle. Must be in the configured allowlist.' }),
|
|
19
|
+
enabled: meta(boolean, {
|
|
19
20
|
description: 'Desired post-call state. `true` grants if not held; `false` revokes if held. Idempotent in both directions.'
|
|
20
21
|
}),
|
|
21
22
|
acting: ActingActor
|
|
22
23
|
});
|
|
23
24
|
/**
|
|
24
|
-
* Output for `self_service_role_set
|
|
25
|
-
* (always equals the input `enabled` on success).
|
|
26
|
-
* when the call mutated — re-grants / re-revokes
|
|
25
|
+
* Output for `self_service_role_set`, a `@fuzdev/fuz_schema` schema. `enabled`
|
|
26
|
+
* echoes the post-call state (always equals the input `enabled` on success).
|
|
27
|
+
* `changed` is `true` only when the call mutated — re-grants / re-revokes
|
|
28
|
+
* return `false`.
|
|
27
29
|
*/
|
|
28
|
-
export const SelfServiceRoleSetOutput =
|
|
29
|
-
ok:
|
|
30
|
-
enabled:
|
|
31
|
-
changed:
|
|
30
|
+
export const SelfServiceRoleSetOutput = object({
|
|
31
|
+
ok: literal(true),
|
|
32
|
+
enabled: boolean,
|
|
33
|
+
changed: boolean
|
|
32
34
|
});
|
|
33
35
|
/**
|
|
34
36
|
* `rate_limit: 'account'` bounds audit-row churn. The toggle is idempotent
|
|
@@ -150,8 +150,9 @@ export type TokenSurface = (typeof TOKEN_SURFACES)[number];
|
|
|
150
150
|
*/
|
|
151
151
|
export declare const is_token_surface: (value: string) => value is TokenSurface;
|
|
152
152
|
/**
|
|
153
|
-
* Name format for the identifier half of a capability string
|
|
154
|
-
*
|
|
153
|
+
* Name format for the identifier half of a capability string: runs of
|
|
154
|
+
* lowercase letters (a-z) joined by single underscores, the grammar of
|
|
155
|
+
* `RoleName` / `CredentialTypeName` / `ScopeKindName` / `GrantPathName` too.
|
|
155
156
|
*
|
|
156
157
|
* Applied to the `surface:` arm only. The `rpc:` arm's identifier is an action
|
|
157
158
|
* method name, whose vocabulary belongs to `ActionSpec` (and includes shapes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_scope.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wFAAwF;AACxF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAW,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU;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AO,MAAM,uBAAuB,GACnC,YAAY,MAAM,KAChB;IAAE,KAAK,EAAE,sBAAsB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAGxD,CAAC;AAEH,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,GAAI,OAAO,UAAU,KAAG,MAGrD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,UAAU,GAAG,IAU5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,UAAU,KAAG,MAQzD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,UAAU,GAAG,IAQtE,CAAC"}
|
package/dist/auth/token_scope.js
CHANGED
|
@@ -162,15 +162,16 @@ export const TOKEN_SURFACES = [
|
|
|
162
162
|
*/
|
|
163
163
|
export const is_token_surface = (value) => TOKEN_SURFACES.includes(value);
|
|
164
164
|
/**
|
|
165
|
-
* Name format for the identifier half of a capability string
|
|
166
|
-
*
|
|
165
|
+
* Name format for the identifier half of a capability string: runs of
|
|
166
|
+
* lowercase letters (a-z) joined by single underscores, the grammar of
|
|
167
|
+
* `RoleName` / `CredentialTypeName` / `ScopeKindName` / `GrantPathName` too.
|
|
167
168
|
*
|
|
168
169
|
* Applied to the `surface:` arm only. The `rpc:` arm's identifier is an action
|
|
169
170
|
* method name, whose vocabulary belongs to `ActionSpec` (and includes shapes
|
|
170
171
|
* like `peer/ping` this regex would refuse); the dispatcher computes it from the
|
|
171
172
|
* registered method, so nothing parses one.
|
|
172
173
|
*/
|
|
173
|
-
export const TOKEN_SURFACE_NAME_REGEX = /^[a-z][a-
|
|
174
|
+
export const TOKEN_SURFACE_NAME_REGEX = /^[a-z]+(?:_[a-z]+)*$/;
|
|
174
175
|
// Capability-string prefixes. Private: `token_scope_method_capability` builds
|
|
175
176
|
// the one capability anything computes, and `is_route_scope_capability` checks
|
|
176
177
|
// the one a route declares, so nothing outside this module concatenates these.
|
package/dist/http/CLAUDE.md
CHANGED
|
@@ -587,6 +587,12 @@ table browser; the factory is domain-agnostic.
|
|
|
587
587
|
- `GET /tables/:name` — columns + rows (paginated via `?offset`/`?limit`, limit validated to `[1, 1000]` with default 100; bytea values come back as `<N bytes>` placeholders, NULL stays NULL, column metadata untouched) + total count + `primary_key` (the single PK column, or `null` when the table has none or a composite one) + `deletable` (whether the row-`DELETE` will accept this table at all — see below)
|
|
588
588
|
- `DELETE /tables/:name/rows/:id` — delete by PK, compared typed as `"<pk>" = $1` (twinning the Rust spine — the untyped text-format param makes PG coerce the id with the PK type's input function, so the delete index-scans and follows the column type's semantics; an uncoercible id — 22P02/22003 — is the same clean 404 as a typed miss). `RETURNING "<pk>"::text` feeds the audit trail the row's canonical PK rendering. Returns 400 if the table is excluded by policy (`ERROR_TABLE_NOT_DELETABLE`) or has no single-column PK (`ERROR_TABLE_NO_PRIMARY_KEY`), 404 if row missing (`ERROR_ROW_NOT_FOUND`) or table missing/unbrowsable (`ERROR_TABLE_NOT_FOUND`), 409 on a referencing-row refusal (pg error `23503` foreign_key_violation, or `23001` restrict_violation — PG 18+ raises the latter for `ON DELETE RESTRICT`)
|
|
589
589
|
|
|
590
|
+
Every route declares `acting?: ActingActor` on its `query` (registry-time
|
|
591
|
+
invariant 2). The `{acting}`-only queries of `GET /health`, `GET /tables` and
|
|
592
|
+
the row `DELETE` are `@fuzdev/fuz_schema` `object`s over the twin
|
|
593
|
+
`ActingActor`; `GET /tables/:name`'s stays Zod, its paging params being
|
|
594
|
+
`query_int`'s Zod preprocess.
|
|
595
|
+
|
|
590
596
|
**The allowlist gates everything.** `DbRouteOptions.browsable_tables` is
|
|
591
597
|
required with no "all" escape hatch — the table list shows only listed tables,
|
|
592
598
|
and detail/`DELETE` on an unlisted table answer exactly like a table that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/db_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"db_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/db_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAiBpF;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,sDAAsD;AACtD,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAKrD,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAKrD,CAAC;AAEH;;;;;GAKG;AACH,MAAM,WAAW,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