@fuzdev/fuz_app 0.157.0 → 0.159.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.
Files changed (71) hide show
  1. package/dist/actions/CLAUDE.md +1 -0
  2. package/dist/actions/compile_action_registry.d.ts +5 -1
  3. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  4. package/dist/actions/compile_action_registry.js +8 -1
  5. package/dist/auth/CLAUDE.md +11 -6
  6. package/dist/auth/actor_lookup_action_specs.d.ts +184 -40
  7. package/dist/auth/actor_lookup_action_specs.d.ts.map +1 -1
  8. package/dist/auth/actor_lookup_action_specs.js +16 -14
  9. package/dist/auth/actor_search_action_specs.d.ts +180 -40
  10. package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
  11. package/dist/auth/actor_search_action_specs.js +12 -15
  12. package/dist/auth/audit_log_route_schema.d.ts +18 -6
  13. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  14. package/dist/auth/audit_log_route_schema.js +7 -3
  15. package/dist/auth/credential_type_schema.d.ts +4 -4
  16. package/dist/auth/credential_type_schema.d.ts.map +1 -1
  17. package/dist/auth/credential_type_schema.js +6 -6
  18. package/dist/auth/grant_path_schema.d.ts +4 -4
  19. package/dist/auth/grant_path_schema.d.ts.map +1 -1
  20. package/dist/auth/grant_path_schema.js +6 -6
  21. package/dist/auth/request_context.js +1 -1
  22. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  23. package/dist/auth/role_grant_offer_action_specs.js +9 -6
  24. package/dist/auth/role_grant_offer_ddl.d.ts +5 -4
  25. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  26. package/dist/auth/role_grant_offer_ddl.js +5 -4
  27. package/dist/auth/role_schema.d.ts +15 -2
  28. package/dist/auth/role_schema.d.ts.map +1 -1
  29. package/dist/auth/role_schema.js +17 -4
  30. package/dist/auth/role_schema_fuz.d.ts +29 -0
  31. package/dist/auth/role_schema_fuz.d.ts.map +1 -0
  32. package/dist/auth/role_schema_fuz.js +28 -0
  33. package/dist/auth/scope_kind_schema.d.ts +22 -15
  34. package/dist/auth/scope_kind_schema.d.ts.map +1 -1
  35. package/dist/auth/scope_kind_schema.js +24 -17
  36. package/dist/auth/self_service_role_action_specs.d.ts +70 -27
  37. package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
  38. package/dist/auth/self_service_role_action_specs.js +16 -14
  39. package/dist/auth/token_scope.d.ts +3 -2
  40. package/dist/auth/token_scope.d.ts.map +1 -1
  41. package/dist/auth/token_scope.js +4 -3
  42. package/dist/http/CLAUDE.md +19 -6
  43. package/dist/http/db_routes.d.ts.map +1 -1
  44. package/dist/http/db_routes.js +8 -3
  45. package/dist/http/error_schemas.d.ts +5 -2
  46. package/dist/http/error_schemas.d.ts.map +1 -1
  47. package/dist/http/route_spec.d.ts +7 -4
  48. package/dist/http/route_spec.d.ts.map +1 -1
  49. package/dist/http/route_spec.js +26 -5
  50. package/dist/http/schema_helpers.d.ts +21 -3
  51. package/dist/http/schema_helpers.d.ts.map +1 -1
  52. package/dist/http/schema_helpers.js +34 -4
  53. package/dist/http/surface.d.ts +2 -0
  54. package/dist/http/surface.d.ts.map +1 -1
  55. package/dist/http/surface.js +6 -2
  56. package/dist/primitive_schemas.d.ts +1 -1
  57. package/dist/primitive_schemas.d.ts.map +1 -1
  58. package/dist/primitive_schemas_fuz.d.ts +19 -4
  59. package/dist/primitive_schemas_fuz.d.ts.map +1 -1
  60. package/dist/primitive_schemas_fuz.js +22 -4
  61. package/dist/schema_issues.d.ts +11 -0
  62. package/dist/schema_issues.d.ts.map +1 -1
  63. package/dist/schema_issues.js +15 -0
  64. package/dist/server/serve_fact_route.d.ts.map +1 -1
  65. package/dist/server/serve_fact_route.js +3 -2
  66. package/dist/server/surface_route.d.ts.map +1 -1
  67. package/dist/server/surface_route.js +3 -2
  68. package/dist/testing/CLAUDE.md +12 -8
  69. package/dist/testing/cross_backend/role_grant_role_grammar.d.ts.map +1 -1
  70. package/dist/testing/cross_backend/role_grant_role_grammar.js +94 -6
  71. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_offer_ddl.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_offer_ddl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,mHAAmH;AACnH,eAAO,MAAM,oCAAoC,yCAAyC,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,wCAAwC,WAAW,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,4QAkBmB,CAAC;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,8DAQhC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,oCAAoC,QAMI,CAAC;AAKtD,eAAO,MAAM,uBAAuB,qzCAkClC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qCAAqC,2XAYpB,CAAC;AAE/B,+EAA+E;AAC/E,eAAO,MAAM,4BAA4B,kOAMX,CAAC"}
1
+ {"version":3,"file":"role_grant_offer_ddl.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_offer_ddl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,mHAAmH;AACnH,eAAO,MAAM,oCAAoC,yCAAyC,CAAC;AAE3F;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC,WAAW,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,4QAkBmB,CAAC;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,8DAQhC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,oCAAoC,QAMI,CAAC;AAKtD,eAAO,MAAM,uBAAuB,qzCAkClC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qCAAqC,2XAYpB,CAAC;AAE/B,+EAA+E;AAC/E,eAAO,MAAM,4BAA4B,kOAMX,CAAC"}
@@ -18,10 +18,11 @@ import { iso8601_timestamp_expr, qualify_columns } from '../db/sql_columns.js';
18
18
  /** Sentinel UUID used inside the partial unique indexes to collapse `scope_id IS NULL` into a comparable value. */
19
19
  export const ROLE_GRANT_OFFER_SCOPE_SENTINEL_UUID = '00000000-0000-0000-0000-000000000000';
20
20
  /**
21
- * Index-side token for the global case in the partial unique index. Uppercase
22
- * so it cannot collide with consumer-declared `ScopeKindName` values (which
23
- * are lowercase by regex). Never appears as a column value — column-level
24
- * `scope_kind = NULL` and `scope_id = NULL` together encode the global case.
21
+ * Index-side token for the global case in the partial unique index.
22
+ * Uppercase, so it is off the `ScopeKindName` grammar: no registry declares
23
+ * it, and the grant inputs refuse it, so no row they write holds it.
24
+ * Column-level `scope_kind = NULL` and `scope_id = NULL` together encode the
25
+ * global case.
25
26
  */
26
27
  export const ROLE_GRANT_OFFER_SCOPE_KIND_GLOBAL_TOKEN = 'GLOBAL';
27
28
  /**
@@ -32,8 +32,21 @@ import type { ScopeKindSchemaResult } from './scope_kind_schema.js';
32
32
  */
33
33
  export declare const ROLE_NAME_LENGTH_MAX = 64;
34
34
  /**
35
- * Valid role name: lowercase letters and underscores, no leading/trailing
36
- * underscore, at most `ROLE_NAME_LENGTH_MAX` characters.
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 declare const ROLE_NAME_PATTERN: RegExp;
43
+ /** The message of a role name longer than `ROLE_NAME_LENGTH_MAX`, in both `RoleName`s. */
44
+ export declare const ROLE_NAME_LENGTH_MESSAGE = "Role names must be at most 64 characters";
45
+ /** The message of a role name outside `ROLE_NAME_PATTERN`, in both `RoleName`s. */
46
+ export declare 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 declare const RoleName: z.ZodString;
39
52
  export type RoleName = z.infer<typeof RoleName>;
@@ -1 +1 @@
1
- {"version":3,"file":"role_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEN,KAAK,0BAA0B,EAC/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGN,KAAK,qBAAqB,EAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,QAAQ,aAMpB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAIhD,sFAAsF;AACtF,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC,iEAAiE;AACjE,eAAO,MAAM,UAAU,UAAU,CAAC;AAElC,+CAA+C;AAC/C,eAAO,MAAM,aAAa,8BAAqC,CAAC;AAEhE,yCAAyC;AACzC,eAAO,MAAM,WAAW;;;EAAwB,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,IAAI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ACZ,YAAY,MAAM,KAChB,OAGF,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,0BAA0B,GACtC,YAAY,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,EACzC,YAAY,MAAM,KAChB,KAAK,CAAC,MAAM,CAMd,CAAC"}
@@ -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
- * Valid role name: lowercase letters and underscores, no leading/trailing
36
- * underscore, at most `ROLE_NAME_LENGTH_MAX` characters.
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: `Role names must be at most ${ROLE_NAME_LENGTH_MAX} characters`
41
- }).regex(/^[a-z][a-z_]*[a-z]$|^[a-z]$/, 'Role names must be lowercase letters and underscores (a-z_), no leading/trailing underscore');
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,39 @@
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')`) — never as a column value, never
26
- * as a registry entry. The uppercase form is structurally distinct
27
- * from any consumer-declared kind (which match the lowercase
28
- * `ScopeKindName` regex), so it cannot collide.
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
- * Letter (lowercase a-z) start and end (or single letter), with letters
35
- * and underscores in between. Mirrors `RoleName`. Rejects empty strings,
36
- * leading or trailing underscores, uppercase, digits, and the index-side
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`). Bounds the tag where it enters
43
- * — the grant inputs (`role_grant_offer_create`, `role_grant_assign`) copy it
44
- * into the row and its audit metadata — and a registered name, so no
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 mirrors, and as the Rust
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
- /** Zod schema for valid scope-kind name strings. */
53
+ /**
54
+ * Zod schema for valid scope-kind name strings: a registered name, and the
55
+ * `scope_kind` the grant inputs take. Twin of the Rust spine's
56
+ * `is_valid_scope_kind_name`.
57
+ */
51
58
  export declare const ScopeKindName: z.ZodString;
52
59
  export type ScopeKindName = z.infer<typeof ScopeKindName>;
53
60
  /**
@@ -78,8 +85,8 @@ export interface ScopeKindSchemaResult {
78
85
  *
79
86
  * Open registry — no builtins. The `'GLOBAL'` token used inside the
80
87
  * partial unique indexes on `role_grant` and `role_grant_offer` is not a
81
- * registry entry (it's an index expression only) and cannot collide
82
- * with consumer-declared kinds because the regex rejects uppercase.
88
+ * registry entry (it's an index expression only), and no consumer can
89
+ * declare it because the regex rejects uppercase.
83
90
  *
84
91
  * Call once at server init. Pass the result into `create_role_schema`'s
85
92
  * 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAgC,CAAC;AAEnE;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,oDAAoD;AACpD,eAAO,MAAM,aAAa,aAMzB,CAAC;AACF,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"}
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;;;;GAIG;AACH,eAAO,MAAM,aAAa,aAMzB,CAAC;AACF,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,51 @@
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')`) — never as a column value, never
26
- * as a registry entry. The uppercase form is structurally distinct
27
- * from any consumer-declared kind (which match the lowercase
28
- * `ScopeKindName` regex), so it cannot collide.
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
- * Letter (lowercase a-z) start and end (or single letter), with letters
36
- * and underscores in between. Mirrors `RoleName`. Rejects empty strings,
37
- * leading or trailing underscores, uppercase, digits, and the index-side
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-z_]*[a-z]$|^[a-z]$/;
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`). Bounds the tag where it enters
44
- * — the grant inputs (`role_grant_offer_create`, `role_grant_assign`) copy it
45
- * into the row and its audit metadata — and a registered name, so no
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 mirrors, and as the Rust
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
- /** Zod schema for valid scope-kind name strings. */
54
+ /**
55
+ * Zod schema for valid scope-kind name strings: a registered name, and the
56
+ * `scope_kind` the grant inputs take. Twin of the Rust spine's
57
+ * `is_valid_scope_kind_name`.
58
+ */
52
59
  export const ScopeKindName = bounded_string({
53
60
  max: SCOPE_KIND_LENGTH_MAX,
54
61
  max_message: `Scope-kind names must be at most ${SCOPE_KIND_LENGTH_MAX} characters`
55
- }).regex(SCOPE_KIND_NAME_REGEX, 'Scope-kind names must be lowercase letters and underscores (a-z_), no leading/trailing underscore');
62
+ }).regex(SCOPE_KIND_NAME_REGEX, 'Scope-kind names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores');
56
63
  /**
57
64
  * Create a scope-kind schema from a consumer-declared registry.
58
65
  *
59
66
  * Open registry — no builtins. The `'GLOBAL'` token used inside the
60
67
  * partial unique indexes on `role_grant` and `role_grant_offer` is not a
61
- * registry entry (it's an index expression only) and cannot collide
62
- * with consumer-declared kinds because the regex rejects uppercase.
68
+ * registry entry (it's an index expression only), and no consumer can
69
+ * declare it because the regex rejects uppercase.
63
70
  *
64
71
  * Call once at server init. Pass the result into `create_role_schema`'s
65
72
  * optional `scope_kinds` parameter so each role's
@@ -7,28 +7,50 @@
7
7
  *
8
8
  * @module
9
9
  */
10
- import { z } from 'zod';
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: z.ZodObject<{
16
- role: z.ZodString;
17
- enabled: z.ZodBoolean;
18
- acting: z.ZodOptional<z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>>;
19
- }, z.core.$strict>;
20
- export type SelfServiceRoleSetInput = z.infer<typeof SelfServiceRoleSetInput>;
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`. `enabled` echoes the post-call state
23
- * (always equals the input `enabled` on success). `changed` is `true` only
24
- * when the call mutated — re-grants / re-revokes return `false`.
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: z.ZodObject<{
27
- ok: z.ZodLiteral<true>;
28
- enabled: z.ZodBoolean;
29
- changed: z.ZodBoolean;
30
- }, z.core.$strict>;
31
- export type SelfServiceRoleSetOutput = z.infer<typeof SelfServiceRoleSetOutput>;
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: z.ZodObject<{
56
- role: z.ZodString;
57
- enabled: z.ZodBoolean;
58
- acting: z.ZodOptional<z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>>;
59
- }, z.core.$strict>;
60
- output: z.ZodObject<{
61
- ok: z.ZodLiteral<true>;
62
- enabled: z.ZodBoolean;
63
- changed: z.ZodBoolean;
64
- }, z.core.$strict>;
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;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAI3E,0FAA0F;AAC1F,eAAO,MAAM,oCAAoC,EAAG,gCAAyC,CAAC;AAE9F,yCAAyC;AACzC,eAAO,MAAM,uBAAuB;;;;kBAOlC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;kBAInC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;CAYT,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,EAAE,aAAa,CAAC,yBAAyB,CAEvF,CAAC"}
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 { z } from 'zod';
11
- import { RoleName } from './role_schema.js';
12
- import { ActingActor } from '../http/auth_shape.js';
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 = z.strictObject({
17
- role: RoleName.meta({ description: 'Role to toggle. Must be in the configured allowlist.' }),
18
- enabled: z.boolean().meta({
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`. `enabled` echoes the post-call state
25
- * (always equals the input `enabled` on success). `changed` is `true` only
26
- * when the call mutated — re-grants / re-revokes return `false`.
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 = z.strictObject({
29
- ok: z.literal(true),
30
- enabled: z.boolean(),
31
- changed: z.boolean()
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. Mirrors
154
- * `RoleName` / `CredentialTypeName` / `ScopeKindName`.
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":["../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,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"}
@@ -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. Mirrors
166
- * `RoleName` / `CredentialTypeName` / `ScopeKindName`.
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-z_]*[a-z]$|^[a-z]$/;
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.
@@ -60,10 +60,14 @@ consumers.
60
60
 
61
61
  Every schema field takes a Zod or a `@fuzdev/fuz_schema` schema
62
62
  (`ValidationSchema`, `schema_issues.ts`), validated through `parse_any`, its
63
- refusals answered with `to_wire_issues`'s `WireIssue`s either way. A fuz_schema
64
- `params` or `query` must be an object schema under any wrappers
65
- (`get_schema_entries`); `apply_route_specs` throws naming the route on one that
66
- isn't. Input/output naming mirrors SAES `ActionSpec`. Use a strict object for
63
+ refusals answered with `to_wire_issues`'s `WireIssue`s either way. A slot
64
+ holding a value of neither library throws at registration, naming the route
65
+ and the slot (`assert_validation_schema`) — in an assembled app, surface
66
+ generation (`schema_to_surface`) reads most slots first and throws the same
67
+ refusal; `params`, `query` and an `errors` entry
68
+ may be absent. A fuz_schema `params` or `query` must be an object schema
69
+ under any wrappers (`get_schema_entries`); `apply_route_specs` throws naming
70
+ the route on one that isn't. Input/output naming mirrors SAES `ActionSpec`. Use a strict object for
67
71
  inputs — `z.strictObject()` or fuz_schema's `object` — the surface diagnostic
68
72
  warns on non-strict objects because unknown keys are silently stripped by Zod
69
73
  4's default `z.object()` (and by fuz_schema's `strip_object`, kept by its
@@ -178,7 +182,9 @@ Pair every schema with the `z.infer` type export.
178
182
  ### Three-layer error-schema merge
179
183
 
180
184
  `merge_error_schemas(spec, middleware_errors?)` (in `http/schema_helpers.ts`)
181
- merges three layers, later overrides earlier at the same status code:
185
+ merges three layers, later overrides earlier at the same status code; an
186
+ entry left `undefined` is absent (`strip_undefined_error_schemas`), so it
187
+ overrides nothing:
182
188
 
183
189
  1. **Derived** — from `derive_error_schemas({auth, has_input?, has_params?, has_query?, rate_limit?, checks_content_type?})`:
184
190
  - `has_input || has_params || has_query` → 400 `ValidationError`
@@ -249,10 +255,11 @@ Key helpers:
249
255
  - `json_has_own_proto_key(value)` — whether any object in a parsed JSON value has an own `__proto__` key, by an iterative walk (no recursion — `JSON.parse` nests deeper than the call stack); the dispatcher refuses such params with `ERROR_PARAMS_PROTO_KEY`. Twin of the Rust `fuz_http::json_has_own_proto_key`
250
256
  - `safe_parse_dropping_unknown_keys(schema, value)` — the forward-compatible read of a remote-authored payload, Zod or fuz_schema, returning `parse_any`'s `{ok, value}` / `{ok: false, issues}`: while every issue is an unknown key (`unknown_key_targets`), strips them from a copy and reparses — after the first parse that reports unknown keys, one schema-guided pass deletes every key a strict fuz_schema `object` doesn't name anywhere the schema reaches (entries, array items, record values, the `variant` option), as a fuz_schema parse reports at most a hundred issues; a key under a fuz_schema `union` is never stripped (the union fails as one issue of its own), and a later `pipe` stage is stripped only as reported — until nothing is left to strip, capped at `UNKNOWN_KEY_PASSES_MAX` passes (the last failure returned past it); any other issue still fails. A Zod union of strict objects reports the key and is stripped, a fuz_schema `union` reports one issue of its own and is not. Used for response `result`s (`ActionEvent`) and peer replies (`peer/ping`); matches serde's ignore-unknown-fields default on the Rust spine
251
257
  - `is_strict_object_schema(schema)` — detects `z.strictObject()` by checking `schema.def.catchall instanceof z.ZodNever`, or a fuz_schema `object` (not `strip_object` / `loose_object`); a fuz_schema `pipe` is read through to its first schema when no stage is a `transform` (so a refined `object` reads strict), while any Zod `ZodPipe` — even `O.pipe(O)` with no transform — reads not strict
252
- - `schema_to_surface(schema, {io?, source?, on_unrepresentable?}?)` — Zod or fuz_schema → JSON Schema (`z.toJSONSchema` or fuz_schema's `to_json_schema`, by `is_schema`), on the side `io` names (`'output'` by default), with `$schema` and `default` keys stripped recursively (defaults may be non-deterministic; `$schema` is snapshot noise). `null` for a null or void schema. A part JSON Schema can't say (an output-side transform, a `z.custom()`, a fuz_schema `check`) is left out or written as `{}` (`unrepresentable: 'any'`) and reported to `on_unrepresentable`; a schema with nothing describable (`{}` from a schema other than `z.unknown()` / `z.any()`) or one an emitter refuses outright throws, prefixed with `source` — so a root-level transform output (`z.unknown().transform(f)` included), `z.custom()` or `z.date()` fails server assembly. It never answers `null` for a failure, which would read as "no input" and drop the schema from every suite that reads the surface
258
+ - `schema_to_surface(schema, {io?, source?, on_unrepresentable?}?)` — throws first on a value of neither library (`assert_validation_schema`, naming `source`, so an assembled app's slot of neither library fails boot as registration would refuse it, not as an unwritable JSON Schema); Zod or fuz_schema → JSON Schema (`z.toJSONSchema` or fuz_schema's `to_json_schema`, by `is_schema`), on the side `io` names (`'output'` by default), with `$schema` and `default` keys stripped recursively (defaults may be non-deterministic; `$schema` is snapshot noise). `null` for a null or void schema. A part JSON Schema can't say (an output-side transform, a `z.custom()`, a fuz_schema `check`) is left out or written as `{}` (`unrepresentable: 'any'`) and reported to `on_unrepresentable`; a schema with nothing describable (`{}` from a schema other than `z.unknown()` / `z.any()`) or one an emitter refuses outright throws, prefixed with `source` — so a root-level transform output (`z.unknown().transform(f)` included), `z.custom()` or `z.date()` fails server assembly. It never answers `null` for a failure, which would read as "no input" and drop the schema from every suite that reads the surface
253
259
  - `middleware_applies(mw_path, route_path)` — Hono pattern matching: `'*'`, exact, `'/api/*'` prefix (handles `prefix.slice(0, -1)` so `/api/*` also matches the bare `/api`)
254
260
  - `middleware_spec_applies(spec, route_path)` — the layer runs on the route: its `path` applies and none of its `carve_outs` does; what surface generation merges middleware errors by
255
261
  - `merge_error_schemas(spec, middleware_errors?)` — the three-layer merge described above
262
+ - `strip_undefined_error_schemas(errors)` — an error-schema map without its `undefined` entries, what the merge and `collect_middleware_errors` read each layer through
256
263
 
257
264
  ## Surface Generation
258
265
 
@@ -580,6 +587,12 @@ table browser; the factory is domain-agnostic.
580
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)
581
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`)
582
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
+
583
596
  **The allowlist gates everything.** `DbRouteOptions.browsable_tables` is
584
597
  required with no "all" escape hatch — the table list shows only listed tables,
585
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;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,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;;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