@fuzdev/fuz_app 0.159.0 → 0.161.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 (85) hide show
  1. package/dist/actions/CLAUDE.md +7 -2
  2. package/dist/actions/protocol.d.ts +7 -0
  3. package/dist/actions/protocol.d.ts.map +1 -1
  4. package/dist/actions/protocol.js +19 -4
  5. package/dist/auth/CLAUDE.md +47 -24
  6. package/dist/auth/account_schema.d.ts +2 -2
  7. package/dist/auth/account_schema.d.ts.map +1 -1
  8. package/dist/auth/account_schema.js +1 -1
  9. package/dist/auth/actor_lookup_action_specs.d.ts +7 -7
  10. package/dist/auth/actor_search_action_specs.d.ts +6 -6
  11. package/dist/auth/admin_action_specs.d.ts +1051 -321
  12. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  13. package/dist/auth/admin_action_specs.js +150 -166
  14. package/dist/auth/app_settings_schema.d.ts +46 -23
  15. package/dist/auth/app_settings_schema.d.ts.map +1 -1
  16. package/dist/auth/app_settings_schema.js +12 -15
  17. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  18. package/dist/auth/audit_log_schema.d.ts +14 -3
  19. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  20. package/dist/auth/audit_log_schema.js +20 -7
  21. package/dist/auth/audit_log_schema_fuz.d.ts +39 -0
  22. package/dist/auth/audit_log_schema_fuz.d.ts.map +1 -0
  23. package/dist/auth/audit_log_schema_fuz.js +37 -0
  24. package/dist/auth/credential_type_schema.d.ts +4 -7
  25. package/dist/auth/credential_type_schema.d.ts.map +1 -1
  26. package/dist/auth/credential_type_schema.js +6 -10
  27. package/dist/auth/grant_path_schema.d.ts +4 -7
  28. package/dist/auth/grant_path_schema.d.ts.map +1 -1
  29. package/dist/auth/grant_path_schema.js +6 -10
  30. package/dist/auth/name_schema.d.ts +63 -0
  31. package/dist/auth/name_schema.d.ts.map +1 -0
  32. package/dist/auth/name_schema.js +65 -0
  33. package/dist/auth/request_context.d.ts.map +1 -1
  34. package/dist/auth/request_context.js +2 -1
  35. package/dist/auth/role_grant_offer_action_specs.d.ts +2257 -400
  36. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  37. package/dist/auth/role_grant_offer_action_specs.js +104 -100
  38. package/dist/auth/role_grant_offer_actions.d.ts +6 -3
  39. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  40. package/dist/auth/role_grant_offer_actions.js +15 -6
  41. package/dist/auth/role_grant_offer_notifications.d.ts +1364 -255
  42. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  43. package/dist/auth/role_grant_offer_notifications.js +100 -47
  44. package/dist/auth/role_grant_offer_schema.d.ts +90 -22
  45. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
  46. package/dist/auth/role_grant_offer_schema.js +40 -39
  47. package/dist/auth/role_schema.d.ts +14 -25
  48. package/dist/auth/role_schema.d.ts.map +1 -1
  49. package/dist/auth/role_schema.js +15 -29
  50. package/dist/auth/role_schema_fuz.d.ts +4 -3
  51. package/dist/auth/role_schema_fuz.d.ts.map +1 -1
  52. package/dist/auth/role_schema_fuz.js +7 -5
  53. package/dist/auth/scope_kind_schema.d.ts +13 -21
  54. package/dist/auth/scope_kind_schema.d.ts.map +1 -1
  55. package/dist/auth/scope_kind_schema.js +15 -26
  56. package/dist/auth/scope_kind_schema_fuz.d.ts +31 -0
  57. package/dist/auth/scope_kind_schema_fuz.d.ts.map +1 -0
  58. package/dist/auth/scope_kind_schema_fuz.js +31 -0
  59. package/dist/auth/self_service_role_action_specs.d.ts +2 -2
  60. package/dist/auth/token_scope.d.ts +7 -13
  61. package/dist/auth/token_scope.d.ts.map +1 -1
  62. package/dist/auth/token_scope.js +9 -14
  63. package/dist/primitive_schemas.d.ts +46 -0
  64. package/dist/primitive_schemas.d.ts.map +1 -1
  65. package/dist/primitive_schemas.js +39 -14
  66. package/dist/primitive_schemas_fuz.d.ts +35 -7
  67. package/dist/primitive_schemas_fuz.d.ts.map +1 -1
  68. package/dist/primitive_schemas_fuz.js +30 -6
  69. package/dist/testing/CLAUDE.md +19 -11
  70. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -1
  71. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  72. package/dist/testing/cross_backend/identity_parity.js +20 -11
  73. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +15 -3
  74. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  75. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +60 -17
  76. package/dist/testing/cross_backend/role_grant_role_grammar.d.ts.map +1 -1
  77. package/dist/testing/cross_backend/role_grant_role_grammar.js +8 -15
  78. package/dist/testing/cross_backend/spine_suites.d.ts +4 -3
  79. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  80. package/dist/testing/cross_backend/spine_suites.js +2 -1
  81. package/dist/ui/CLAUDE.md +4 -4
  82. package/dist/ui/admin_accounts_state.svelte.d.ts +8 -8
  83. package/dist/ui/role_grant_offers_state.svelte.d.ts +9 -9
  84. package/dist/ui/role_grant_offers_state.svelte.js +4 -4
  85. package/package.json +1 -1
@@ -96,6 +96,12 @@ export const bounded_string = (options) => {
96
96
  export const USERNAME_LENGTH_MIN = 3;
97
97
  /** Maximum username length (matches GitHub's limit). The grammar is ASCII, so units and characters agree. */
98
98
  export const USERNAME_LENGTH_MAX = 39;
99
+ /**
100
+ * The creation username's grammar: a letter, then letters, digits, `_` or
101
+ * `-`, ending in a letter or digit. ASCII, so it needs at least two
102
+ * characters, and `Username` bounds the length beside it.
103
+ */
104
+ export const USERNAME_REGEX = /^[a-zA-Z][0-9a-zA-Z_-]*[0-9a-zA-Z]$/;
99
105
  /** Maximum length for username input on login/lookup, in UTF-16 code units, measured before trimming — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
100
106
  export const USERNAME_PROVIDED_LENGTH_MAX = 255;
101
107
  /**
@@ -109,7 +115,7 @@ export const USERNAME_PROVIDED_LENGTH_MAX = 255;
109
115
  * `LOWER(username) = LOWER($1)` lookup contract simple.
110
116
  */
111
117
  export const Username = bounded_string({ min: USERNAME_LENGTH_MIN, max: USERNAME_LENGTH_MAX })
112
- .regex(/^[a-zA-Z][0-9a-zA-Z_-]*[0-9a-zA-Z]$/)
118
+ .regex(USERNAME_REGEX)
113
119
  .transform((s) => s.toLowerCase());
114
120
  /**
115
121
  * Username submitted for login or lookup — minimal validation for forward-compatibility if format rules change.
@@ -137,10 +143,11 @@ export const UsernameProvided = bounded_string({ min: 1, max: USERNAME_PROVIDED_
137
143
  export const EMAIL_LENGTH_MAX = 254;
138
144
  /**
139
145
  * Loose email shape `local@domain.tld`: a non-empty local part, exactly one
140
- * `@`, a domain with an interior dot (a non-empty label on each side), and
141
- * no whitespace. Accepts `a@b.c` (single-char TLDs are fine) and
142
- * `user+tag@a.co`; rejects `notanemail`, `@x.com`, `user@`, `user@host`, and
143
- * any whitespace.
146
+ * `@`, a domain that holds a `.` and neither starts nor ends with one, and
147
+ * no whitespace. Accepts `a@b.c` (single-char TLDs are fine), `a@b..c` and
148
+ * `user+tag@a.co`; rejects `notanemail`, `@x.com`, `user@`, `user@host`,
149
+ * `a@.b.c`, `a@b.c.`, and any whitespace. The Rust spine's `is_valid_email`
150
+ * is the same rule.
144
151
  *
145
152
  * The negated class excludes `\s` **plus** U+0085 (NEL): JS's `\s` omits
146
153
  * U+0085 but Unicode `White_Space` (Rust's `char::is_whitespace`) includes
@@ -148,10 +155,31 @@ export const EMAIL_LENGTH_MAX = 254;
148
155
  * (The Rust side correspondingly also rejects U+FEFF, which JS `\s` treats as
149
156
  * whitespace but Unicode `White_Space` does not — so both spines reject
150
157
  * exactly `White_Space ∪ {U+FEFF}`.)
158
+ *
159
+ * Linear in the input's length: the `@` can match only the first `@`, and the
160
+ * `\.` only the domain's first `.`, since the classes before each exclude it,
161
+ * so the tail after the `\.` is scanned once. The domain spelled
162
+ * `[^\s\u0085@.][^\s\u0085@]*\.[^\s\u0085@]*[^\s\u0085@.]`, the same
163
+ * language, is quadratic: it tries every `.` as the split.
151
164
  */
152
- const EMAIL_REGEX = /^[^\s\u0085@]+@[^\s\u0085@]+\.[^\s\u0085@]+$/;
165
+ export const EMAIL_REGEX = /^[^\s\u0085@]+@[^\s\u0085@.]+\.[^\s\u0085@]*[^\s\u0085@.]$/;
166
+ /** The message of an email over `EMAIL_LENGTH_MAX` bytes, on either schema library's `Email`. */
167
+ export const EMAIL_LENGTH_MESSAGE = `Email must be at most ${EMAIL_LENGTH_MAX} bytes`;
153
168
  /** UTF-8 encoder for the `EMAIL_LENGTH_MAX` byte (octet) bound. */
154
169
  const utf8_encoder = new TextEncoder();
170
+ /**
171
+ * Whether `s` is at most `EMAIL_LENGTH_MAX` bytes in UTF-8, the bound both
172
+ * `Email` schemas check.
173
+ *
174
+ * `s.length` (UTF-16 units) is a cheap upper bound that short-circuits the
175
+ * `encode` on absurd inputs: a valid (<= 254-byte) address is necessarily
176
+ * <= 254 code units, so it never refuses one — the byte count is the real
177
+ * RFC-5321 octet bound, matching the Rust spine's `s.len()`.
178
+ *
179
+ * @param s - the address
180
+ * @returns `true` when the address is within the byte bound
181
+ */
182
+ export const is_email_within_length_max = (s) => s.length <= EMAIL_LENGTH_MAX && utf8_encoder.encode(s).length <= EMAIL_LENGTH_MAX;
155
183
  /**
156
184
  * Email validation. Every current consumer pairs it with `Username` (signup,
157
185
  * invites, audit log), so the two live together with the other Zod
@@ -169,17 +197,14 @@ const utf8_encoder = new TextEncoder();
169
197
  * transform: case is preserved and surrounding whitespace is rejected (not
170
198
  * trimmed), so storage is verbatim and the case-insensitive lookup rides the
171
199
  * DB-side `LOWER(email)`.
200
+ *
201
+ * The byte bound runs first and aborts, so an address past it gets the
202
+ * length issue alone and is never read by the regex.
172
203
  */
173
204
  export const Email = z
174
205
  .string()
175
- .regex(EMAIL_REGEX)
176
- // `s.length` (UTF-16 units) is a cheap upper bound that short-circuits the
177
- // `encode` on absurd inputs: a valid (<= 254-byte) address is necessarily
178
- // <= 254 code units, so this never rejects one — the byte count is the real
179
- // RFC-5321 octet bound, matching the Rust spine's `s.len()`.
180
- .refine((s) => s.length <= EMAIL_LENGTH_MAX && utf8_encoder.encode(s).length <= EMAIL_LENGTH_MAX, {
181
- message: `Email must be at most ${EMAIL_LENGTH_MAX} bytes`
182
- });
206
+ .refine(is_email_within_length_max, { message: EMAIL_LENGTH_MESSAGE, abort: true })
207
+ .regex(EMAIL_REGEX);
183
208
  /** Returns a new random (v4) `Uuid`. */
184
209
  export const create_uuid = () => crypto.randomUUID();
185
210
  /**
@@ -1,8 +1,8 @@
1
1
  /**
2
- * `@fuzdev/fuz_schema` twins of the Zod `bounded_string`, `Uuid`,
3
- * `UuidWithDefault` (`primitive_schemas.ts`), and `ActingActor`
4
- * (`http/auth_shape.ts`), under the same names, for schemas written in
5
- * fuz_schema.
2
+ * `@fuzdev/fuz_schema` twins of the Zod `bounded_string`, `Username`,
3
+ * `Email`, `Uuid`, `UuidWithDefault` (`primitive_schemas.ts`), and
4
+ * `ActingActor` (`http/auth_shape.ts`), under the same names, for schemas
5
+ * written in fuz_schema.
6
6
  *
7
7
  * The output type is shared: the Zod `Uuid` outputs fuz_schema's
8
8
  * `Branded<string, 'Uuid'>` too, so a value parsed by either twin goes where
@@ -32,6 +32,34 @@ import { type BoundedStringOptions } from './primitive_schemas.js';
32
32
  * @nodocs
33
33
  */
34
34
  export declare const bounded_string: (options: BoundedStringOptions) => PipeSchema<string, typeof string>;
35
+ /**
36
+ * Username for account creation, the twin of the Zod `Username`: the same
37
+ * bounds and grammar, output in lowercase. Every input gets the same verdict
38
+ * and output from both; a string outside the bounds and off the grammar gets
39
+ * the length issue alone, where Zod adds the grammar issue after it.
40
+ *
41
+ * @nodocs
42
+ */
43
+ export declare const Username: PipeSchema<string, PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
44
+ /** @nodocs */
45
+ export type Username = Infer<typeof Username>;
46
+ /**
47
+ * Email validation, the twin of the Zod `Email`: `EMAIL_REGEX` and at most
48
+ * `EMAIL_LENGTH_MAX` UTF-8 bytes, no transform. The `max_length` ahead of the
49
+ * grammar refuses a string past the bound in UTF-16 code units, which is past
50
+ * it in bytes too, before the regex reads it, and the `check` after it the
51
+ * multibyte address within the units but past the bytes, both with
52
+ * `EMAIL_LENGTH_MESSAGE`. Every input gets the same verdict and output from
53
+ * both; a string past the bound in code units gets the length issue as a
54
+ * `max_length`, where Zod gives a `check`, and one within the bound in code
55
+ * units but past it in bytes and off the grammar gets the grammar issue, where
56
+ * Zod gives the length one.
57
+ *
58
+ * @nodocs
59
+ */
60
+ export declare const Email: PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
61
+ /** @nodocs */
62
+ export type Email = Infer<typeof Email>;
35
63
  /**
36
64
  * Branded UUID schema: a UUID of RFC 9562 in either case, output in
37
65
  * lowercase, the form Postgres renders a `uuid` in and every id the server
@@ -40,7 +68,7 @@ export declare const bounded_string: (options: BoundedStringOptions) => PipeSche
40
68
  *
41
69
  * @nodocs
42
70
  */
43
- export declare const Uuid: 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">)[]> & {
71
+ export declare const Uuid: 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<"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"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case">)[]> & {
44
72
  readonly '~types'?: {
45
73
  readonly input: string;
46
74
  readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
@@ -53,7 +81,7 @@ export type Uuid = Infer<typeof Uuid>;
53
81
  *
54
82
  * @nodocs
55
83
  */
56
- export declare const UuidWithDefault: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string | undefined, "with_default_fn", import("@fuzdev/fuz_schema/schema.ts").SchemaDefaultFnDef<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">)[]> & {
84
+ export declare const UuidWithDefault: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string | undefined, "with_default_fn", import("@fuzdev/fuz_schema/schema.ts").SchemaDefaultFnDef<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<"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"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case">)[]> & {
57
85
  readonly '~types'?: {
58
86
  readonly input: string;
59
87
  readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
@@ -71,7 +99,7 @@ export declare const ACTING_ACTOR_DESCRIPTION = "Actor on the authenticated acco
71
99
  *
72
100
  * @nodocs
73
101
  */
74
- export declare const ActingActor: 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">)[]> & {
102
+ export declare const ActingActor: 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<"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"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case">)[]> & {
75
103
  readonly '~types'?: {
76
104
  readonly input: string;
77
105
  readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"primitive_schemas_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAON,MAAM,EAIN,KAAK,KAAK,EACV,KAAK,UAAU,EACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAe,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEhF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAC1B,SAAS,oBAAoB,KAC3B,UAAU,CAAC,MAAM,EAAE,OAAO,MAAM,CAKlC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI;;;;;CAAmD,CAAC;AACrE,cAAc;AACd,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;GAAqC,CAAC;AAClE,cAAc;AACd,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE5D,wDAAwD;AACxD,eAAO,MAAM,wBAAwB,0HACmF,CAAC;AAEzH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;GAAkE,CAAC;AAC3F,cAAc;AACd,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"primitive_schemas_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EASN,MAAM,EAIN,KAAK,KAAK,EACV,KAAK,UAAU,EACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EASN,KAAK,oBAAoB,EACzB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAC1B,SAAS,oBAAoB,KAC3B,UAAU,CAAC,MAAM,EAAE,OAAO,MAAM,CAKlC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,4HAIpB,CAAC;AACF,cAAc;AACd,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,wGAKjB,CAAC;AACF,cAAc;AACd,MAAM,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI;;;;;CAAmD,CAAC;AACrE,cAAc;AACd,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;GAAqC,CAAC;AAClE,cAAc;AACd,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE5D,wDAAwD;AACxD,eAAO,MAAM,wBAAwB,0HACmF,CAAC;AAEzH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;GAAkE,CAAC;AAC3F,cAAc;AACd,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  /**
2
- * `@fuzdev/fuz_schema` twins of the Zod `bounded_string`, `Uuid`,
3
- * `UuidWithDefault` (`primitive_schemas.ts`), and `ActingActor`
4
- * (`http/auth_shape.ts`), under the same names, for schemas written in
5
- * fuz_schema.
2
+ * `@fuzdev/fuz_schema` twins of the Zod `bounded_string`, `Username`,
3
+ * `Email`, `Uuid`, `UuidWithDefault` (`primitive_schemas.ts`), and
4
+ * `ActingActor` (`http/auth_shape.ts`), under the same names, for schemas
5
+ * written in fuz_schema.
6
6
  *
7
7
  * The output type is shared: the Zod `Uuid` outputs fuz_schema's
8
8
  * `Branded<string, 'Uuid'>` too, so a value parsed by either twin goes where
@@ -18,8 +18,8 @@
18
18
  * @module
19
19
  */
20
20
  import { meta } from '@fuzdev/fuz_schema/meta.ts';
21
- import { brand, max_length, message, min_length, optional, pipe, string, to_lower_case, uuid, with_default_fn } from '@fuzdev/fuz_schema/schema.ts';
22
- import { create_uuid } from './primitive_schemas.js';
21
+ import { brand, check, max_length, message, min_length, optional, pipe, regex, string, to_lower_case, uuid, with_default_fn } from '@fuzdev/fuz_schema/schema.ts';
22
+ import { create_uuid, EMAIL_LENGTH_MAX, EMAIL_LENGTH_MESSAGE, EMAIL_REGEX, is_email_within_length_max, USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN, USERNAME_REGEX } from './primitive_schemas.js';
23
23
  /**
24
24
  * A string schema whose length is bounded in UTF-16 code units, the twin of
25
25
  * the Zod `bounded_string`: fuz_schema's `min_length` / `max_length` read
@@ -37,6 +37,30 @@ export const bounded_string = (options) => {
37
37
  const max_step = max_message === undefined ? max_length(max) : message(max_length(max), max_message);
38
38
  return min === undefined ? pipe(string, max_step) : pipe(string, min_length(min), max_step);
39
39
  };
40
+ /**
41
+ * Username for account creation, the twin of the Zod `Username`: the same
42
+ * bounds and grammar, output in lowercase. Every input gets the same verdict
43
+ * and output from both; a string outside the bounds and off the grammar gets
44
+ * the length issue alone, where Zod adds the grammar issue after it.
45
+ *
46
+ * @nodocs
47
+ */
48
+ export const Username = pipe(bounded_string({ min: USERNAME_LENGTH_MIN, max: USERNAME_LENGTH_MAX }), regex(USERNAME_REGEX), to_lower_case);
49
+ /**
50
+ * Email validation, the twin of the Zod `Email`: `EMAIL_REGEX` and at most
51
+ * `EMAIL_LENGTH_MAX` UTF-8 bytes, no transform. The `max_length` ahead of the
52
+ * grammar refuses a string past the bound in UTF-16 code units, which is past
53
+ * it in bytes too, before the regex reads it, and the `check` after it the
54
+ * multibyte address within the units but past the bytes, both with
55
+ * `EMAIL_LENGTH_MESSAGE`. Every input gets the same verdict and output from
56
+ * both; a string past the bound in code units gets the length issue as a
57
+ * `max_length`, where Zod gives a `check`, and one within the bound in code
58
+ * units but past it in bytes and off the grammar gets the grammar issue, where
59
+ * Zod gives the length one.
60
+ *
61
+ * @nodocs
62
+ */
63
+ export const Email = pipe(string, message(max_length(EMAIL_LENGTH_MAX), EMAIL_LENGTH_MESSAGE), regex(EMAIL_REGEX), message(check(is_email_within_length_max), EMAIL_LENGTH_MESSAGE));
40
64
  /**
41
65
  * Branded UUID schema: a UUID of RFC 9562 in either case, output in
42
66
  * lowercase, the form Postgres renders a `uuid` in and every id the server
@@ -1625,19 +1625,26 @@ globalSetup handle.
1625
1625
  ### `cross_backend/role_grant_offer_notification_ws.ts` — `describe_role_grant_offer_notification_ws_tests`
1626
1626
 
1627
1627
  Real-upgrade coverage of the consentful-role-grants WS notification fan-out —
1628
- the seven server-initiated notifications (`received` → recipient,
1628
+ the server-initiated notifications (`received` → recipient,
1629
1629
  `accepted`/`declined` → grantor, `retracted` → recipient, flat
1630
- `role_grant_revoke` → revokee, and `role_grant_offer_supersede` → each
1631
- superseded sibling's grantor on **both** the accept- and revoke-cascade paths).
1630
+ `role_grant_revoked` → revokee, global and scoped, and
1631
+ `role_grant_offer_supersede` → each superseded sibling's grantor on **both**
1632
+ the accept- and revoke-cascade paths).
1632
1633
  `describe_role_grant_offer_notification_ws_tests({setup_test, capabilities,
1633
- base_url, ws_path, ws_required_roles?})` opens the affected counterparty's socket
1634
+ base_url, ws_path, ws_required_roles?, scoped_role?, scope_kind?})` opens the
1635
+ affected counterparty's socket
1634
1636
  (`create_admitted_ws_transport` — a targeted notification reaches only an
1635
1637
  admitted connection, and the handshake alone doesn't say it is one), drives the
1636
1638
  lifecycle RPC over `fixture.transport`, then
1637
- strict-parses the delivered frame against its canonical params schema from
1638
- `auth/role_grant_offer_notifications.ts` (the guard against serialization drift —
1639
- field / null / datetime / the flat revoke shape / the supersede `reason` +
1640
- `cause_id`). Every case also opens a **bystander** — a third account's
1639
+ strict-parses the delivered frame against its canonical `@fuzdev/fuz_schema`
1640
+ params schema from `auth/role_grant_offer_notifications.ts` (`parse_or_throw`;
1641
+ the guard against serialization drift — field / null / datetime / the flat
1642
+ revoke shape with its `scope_kind` and `scope_id` / the supersede `reason` +
1643
+ `cause_id`). The scoped-revoke case has the keeper assign `scoped_role`
1644
+ (default `SPINE_PARTICIPANT_ROLE`; `spine_suites` passes
1645
+ `suite_roles.conferral`) in a `scope_kind` scope (default `'space'`, `null`
1646
+ for a builtin role, which skips the case), revokes it, and holds the frame to
1647
+ that pair. Every case also opens a **bystander** — a third account's
1641
1648
  admitted socket, party to nothing the case drives — and once the targeted
1642
1649
  frame has landed sends a `heartbeat` on it and asserts it received nothing
1643
1650
  but the answers to its own requests. The barrier is what makes the silence
@@ -2704,10 +2711,11 @@ USERNAME_LENGTH_MAX]` = `[3, 39]` boundary edges (just-outside → 400,
2704
2711
  `_`/`-` accepted), catching an off-by-one or position bug in the TS Zod
2705
2712
  `.min/.max/.regex` vs the Rust byte-scan `is_valid_username_for_creation`.
2706
2713
  - **Email format (creation)** — the optional signup `email` validated to the
2707
- loose `local@domain.tld` shape (TS `Email` `^[^\s\u0085@]+@[^\s\u0085@]+\.[^\s\u0085@]+$` + 254-byte
2714
+ loose `local@domain.tld` shape (TS `Email`, `EMAIL_REGEX` + 254-byte
2708
2715
  bound, Rust `is_valid_email`): malformed (no `@` / no domain dot / empty
2709
- side / dot at a domain edge / whitespace / over-length) → 400, well-formed →
2710
- 403 no-invite. Accepted siblings include the single-char-TLD `a@b.c` that
2716
+ side / dot at a domain edge, beside another dot inside it too / whitespace /
2717
+ over-length) → 400, well-formed → 403 no-invite. Accepted siblings include
2718
+ the single-char-TLD `a@b.c` and the consecutive dots inside a domain that
2711
2719
  Zod's `z.email()` rejects — the deliberately-looser shared rule. **Closed a
2712
2720
  real divergence**: the Rust spine previously length-checked the email only,
2713
2721
  accepting any non-empty string TS rejected.
@@ -45,7 +45,7 @@ export interface SpineRpcEndpointsOptions {
45
45
  /**
46
46
  * WS notification sender threaded into the role-grant-offer sub-factory for
47
47
  * server-initiated fan-out (`role_grant_offer_received` / `_accepted` /
48
- * `_declined` / `_retracted` / `_supersede`, flat `role_grant_revoke`).
48
+ * `_declined` / `_retracted` / `_supersede`, flat `role_grant_revoked`).
49
49
  *
50
50
  * **Shared-instance trap.** Pass the SAME `ConnectionRegistry`
51
51
  * instance the WS endpoint registers connections against — the registry
@@ -1 +1 @@
1
- {"version":3,"file":"identity_parity.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/identity_parity.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAoH9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAyB5C,uDAAuD;AACvD,MAAM,WAAW,8BAA8B;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AA8JD,eAAO,MAAM,oCAAoC,GAChD,SAAS,8BAA8B,KACrC,IAieF,CAAC"}
1
+ {"version":3,"file":"identity_parity.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/identity_parity.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqH9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAyB5C,uDAAuD;AACvD,MAAM,WAAW,8BAA8B;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAsKD,eAAO,MAAM,oCAAoC,GAChD,SAAS,8BAA8B,KACrC,IAieF,CAAC"}
@@ -75,9 +75,10 @@ import '../assert_dev_env.js';
75
75
  * bootstrap completed.
76
76
  *
77
77
  * **Email format (creation):** the optional signup `email` is validated to a
78
- * loose `local@domain.tld` shape on both spines — TS `Email`
79
- * (`^[^\s\u0085@]+@[^\s\u0085@]+\.[^\s\u0085@]+$` plus a 254-byte (RFC 5321 octet) length bound; whitespace `White_Space ∪ {U+FEFF}`), Rust the
80
- * hand-rolled `is_valid_email`. A malformed email → 400, a well-formed one →
78
+ * loose `local@domain.tld` shape on both spines — TS `Email` (`EMAIL_REGEX`:
79
+ * a non-empty local part, one `@`, a domain holding a `.` at neither of its
80
+ * edges, no whitespace — `White_Space ∪ {U+FEFF}` — plus a 254-byte (RFC 5321
81
+ * octet) length bound), Rust the hand-rolled `is_valid_email`. A malformed email → 400, a well-formed one →
81
82
  * 403 no-matching-invite (the same accept/reject settle the username tables
82
83
  * use). The accepted siblings include the single-char-TLD `a@b.c` that Zod's
83
84
  * `z.email()` would reject — the deliberately-looser rule both spines now
@@ -195,14 +196,15 @@ const USERNAME_FORMAT_CASES = [
195
196
  ];
196
197
  /**
197
198
  * Signup email-format cases for the loose `Email` shape `local@domain.tld`
198
- * (TS `^[^\s\u0085@]+@[^\s\u0085@]+\.[^\s\u0085@]+$` plus the 254 length bound; Rust the
199
- * hand-rolled `is_valid_email`). The rejected cases each violate the shape at
200
- * a different point — no `@`, no dot in the domain, empty local/domain, a dot
201
- * at a domain edge, surrounding whitespace, over the length bound — so a
202
- * backend policing only one of them is caught. The accepted siblings are the
203
- * don't-over-reject control and include the shapes Zod's `z.email()` rejects
204
- * but our looser rule accepts — single-char TLD `a@b.c` and consecutive dots
205
- * `a..b@c.d` — pinning the deliberately-looser shared rule in both directions.
199
+ * (TS `EMAIL_REGEX` plus the 254 length bound; Rust the hand-rolled
200
+ * `is_valid_email`). The rejected cases each violate the shape at a different
201
+ * point — no `@`, no dot in the domain, empty local/domain, a dot at a domain
202
+ * edge (beside another dot inside the domain too), surrounding whitespace,
203
+ * over the length bound — so a backend policing only one of them is caught.
204
+ * The accepted siblings are the don't-over-reject control and include the
205
+ * shapes Zod's `z.email()` rejects but our looser rule accepts — single-char
206
+ * TLD `a@b.c` and consecutive dots `a..b@c.d` and `a@b..c` — pinning the
207
+ * deliberately-looser shared rule in both directions.
206
208
  * Every case rides a valid username so the rejection (or the 403 no-invite
207
209
  * settle) isolates the email.
208
210
  */
@@ -213,6 +215,8 @@ const SIGNUP_EMAIL_CASES = [
213
215
  { email: 'user@', label: 'empty domain', status: 400 },
214
216
  { email: 'user@.com', label: 'domain starts with a dot', status: 400 },
215
217
  { email: 'user@com.', label: 'domain ends with a dot', status: 400 },
218
+ { email: 'user@.example.com', label: 'multi-label domain starts with a dot', status: 400 },
219
+ { email: 'user@example.com.', label: 'multi-label domain ends with a dot', status: 400 },
216
220
  { email: 'a@@b.c', label: 'two @', status: 400 },
217
221
  { email: ' user@example.com', label: 'leading whitespace', status: 400 },
218
222
  { email: 'user@example.com ', label: 'trailing whitespace', status: 400 },
@@ -251,6 +255,11 @@ const SIGNUP_EMAIL_CASES = [
251
255
  label: 'consecutive dots (looser than z.email)',
252
256
  status: VALID_USERNAME_NO_INVITE_STATUS
253
257
  },
258
+ {
259
+ email: 'user@example..com',
260
+ label: 'consecutive dots inside the domain (looser than z.email)',
261
+ status: VALID_USERNAME_NO_INVITE_STATUS
262
+ },
254
263
  {
255
264
  email: 'user+tag@example.co.uk',
256
265
  label: 'plus-tag + multi-label',
@@ -16,12 +16,24 @@ export interface RoleGrantOfferNotificationWsTestOptions extends WsEndpointTarge
16
16
  * that close instead of the notification frame.
17
17
  */
18
18
  readonly ws_required_roles?: ReadonlyArray<string>;
19
+ /**
20
+ * The role the scoped-revoke case assigns in a scope and revokes — one the
21
+ * backend's registry holds with the `admin` grant path. Default
22
+ * `SPINE_PARTICIPANT_ROLE`, the spine's own.
23
+ */
24
+ readonly scoped_role?: string;
25
+ /**
26
+ * A scope kind `scoped_role` applies to, for the scoped-revoke case; `null`
27
+ * skips that case. Default `'space'` (the spine participant's), or `null`
28
+ * for a builtin role, which is global-only.
29
+ */
30
+ readonly scope_kind?: string | null;
19
31
  }
20
32
  /**
21
- * Register the role-grant-offer WS notification suite — seven cases over a real
33
+ * Register the role-grant-offer WS notification suite — cases over a real
22
34
  * upgrade, one per server-initiated notification (received / accepted /
23
- * declined / retracted / revoke + supersede on both the accept and revoke
24
- * cascades). Each opens the affected counterparty's socket, drives the
35
+ * declined / retracted / revoke, global and scoped, + supersede on both the
36
+ * accept and revoke cascades). Each opens the affected counterparty's socket, drives the
25
37
  * lifecycle RPC, and strict-parses the delivered frame against its canonical
26
38
  * params schema. Gated on `capabilities.ws`.
27
39
  */
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_offer_notification_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_notification_ws.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAkF9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AAKtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAmB,KAAK,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAKjG,2EAA2E;AAC3E,MAAM,WAAW,uCAAwC,SAAQ,gBAAgB;IAChF,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACnD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,+CAA+C,GAC3D,SAAS,uCAAuC,KAC9C,IAgbF,CAAC"}
1
+ {"version":3,"file":"role_grant_offer_notification_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_notification_ws.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAsF9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AAKtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAmB,KAAK,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAKjG,2EAA2E;AAC3E,MAAM,WAAW,uCAAwC,SAAQ,gBAAgB;IAChF,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,+CAA+C,GAC3D,SAAS,uCAAuC,KAC9C,IA6eF,CAAC"}