@fuzdev/fuz_app 0.161.0 → 0.162.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 (63) hide show
  1. package/dist/auth/CLAUDE.md +16 -8
  2. package/dist/auth/account_action_specs.d.ts +173 -35
  3. package/dist/auth/account_action_specs.d.ts.map +1 -1
  4. package/dist/auth/account_action_specs.js +10 -7
  5. package/dist/auth/account_route_schema.d.ts +293 -46
  6. package/dist/auth/account_route_schema.d.ts.map +1 -1
  7. package/dist/auth/account_route_schema.js +5 -4
  8. package/dist/auth/account_schema.d.ts +489 -103
  9. package/dist/auth/account_schema.d.ts.map +1 -1
  10. package/dist/auth/account_schema.js +67 -47
  11. package/dist/auth/admin_action_specs.d.ts +1753 -240
  12. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  13. package/dist/auth/admin_action_specs.js +29 -25
  14. package/dist/auth/audit_emitter.d.ts +8 -3
  15. package/dist/auth/audit_emitter.d.ts.map +1 -1
  16. package/dist/auth/audit_emitter.js +32 -9
  17. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  18. package/dist/auth/audit_log_queries.js +4 -3
  19. package/dist/auth/audit_log_schema.d.ts +786 -259
  20. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  21. package/dist/auth/audit_log_schema.js +188 -201
  22. package/dist/auth/audit_log_schema_fuz.d.ts +17 -3
  23. package/dist/auth/audit_log_schema_fuz.d.ts.map +1 -1
  24. package/dist/auth/audit_log_schema_fuz.js +17 -4
  25. package/dist/auth/credential_type_schema.d.ts +1 -1
  26. package/dist/auth/invite_schema.d.ts +98 -26
  27. package/dist/auth/invite_schema.d.ts.map +1 -1
  28. package/dist/auth/invite_schema.js +21 -14
  29. package/dist/auth/migrations.d.ts.map +1 -1
  30. package/dist/auth/migrations.js +27 -0
  31. package/dist/auth/role_grant_offer_action_specs.d.ts +72 -72
  32. package/dist/auth/role_grant_offer_notifications.d.ts +60 -60
  33. package/dist/auth/role_grant_offer_schema.d.ts +6 -6
  34. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
  35. package/dist/auth/role_grant_offer_schema.js +8 -8
  36. package/dist/dev/setup.d.ts +14 -7
  37. package/dist/dev/setup.d.ts.map +1 -1
  38. package/dist/dev/setup.js +11 -6
  39. package/dist/primitive_schemas.d.ts +1 -4
  40. package/dist/primitive_schemas.d.ts.map +1 -1
  41. package/dist/primitive_schemas.js +1 -5
  42. package/dist/primitive_schemas_fuz.d.ts +36 -2
  43. package/dist/primitive_schemas_fuz.d.ts.map +1 -1
  44. package/dist/primitive_schemas_fuz.js +34 -3
  45. package/dist/testing/CLAUDE.md +7 -3
  46. package/dist/testing/app_server.d.ts +3 -1
  47. package/dist/testing/app_server.d.ts.map +1 -1
  48. package/dist/testing/app_server.js +6 -2
  49. package/dist/testing/audit_drift_guard.d.ts.map +1 -1
  50. package/dist/testing/audit_drift_guard.js +12 -13
  51. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  52. package/dist/testing/cross_backend/identity_parity.js +4 -2
  53. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  54. package/dist/testing/cross_backend/session_cap.js +4 -3
  55. package/dist/testing/db_entities.d.ts +3 -1
  56. package/dist/testing/db_entities.d.ts.map +1 -1
  57. package/dist/testing/db_entities.js +4 -2
  58. package/dist/testing/integration.d.ts.map +1 -1
  59. package/dist/testing/integration.js +3 -2
  60. package/dist/zod.d.ts +2 -1
  61. package/dist/zod.d.ts.map +1 -1
  62. package/dist/zod.js +6 -2
  63. package/package.json +1 -1
@@ -4,19 +4,33 @@
4
4
  * schemas written in fuz_schema.
5
5
  *
6
6
  * `AuditEventTypeName` is built from the constants the Zod one is, the
7
- * grammar and the two messages of `audit_log_schema.ts` and the bound of
8
- * `auth/name_schema.ts`, so the two can't drift apart. They give every input
7
+ * grammar and the two messages this module exports and the bound of
8
+ * `auth/name_schema.ts`, so the two can't drift apart. The constants live
9
+ * here, not beside the Zod schema, because `audit_log_schema.ts` builds its
10
+ * wire rows from these twins. They give every input
9
11
  * the same verdict and output, and write the same JSON Schema (`maxLength`
10
12
  * and `pattern`); a string both too long and off the grammar gets the one
11
13
  * length issue from this twin, as its `pipe` stops at the first failing step,
12
14
  * where the Zod one adds the grammar issue after it.
13
15
  *
14
- * The exports are `@nodocs` while the Zod schemas of the same names stay, as
16
+ * The twins are `@nodocs` while the Zod schemas of the same names stay, as
15
17
  * the docs build refuses two exports of one name.
16
18
  *
17
19
  * @module
18
20
  */
19
21
  import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
22
+ /**
23
+ * Letter start, then letters, digits, `_`, `.`, `/`, `-`. Accepts snake_case,
24
+ * dotted, and namespaced consumer conventions; rejects empty strings, leading
25
+ * separators, whitespace, and control characters. The audit event type's own
26
+ * grammar, wider than the shared name grammar (`auth/name_schema.ts`), whose
27
+ * length cap `AuditEventTypeName` takes.
28
+ */
29
+ export declare const AUDIT_EVENT_TYPE_NAME_REGEX: RegExp;
30
+ /** The message of an audit event-type name past `NAME_LENGTH_MAX`. */
31
+ export declare const AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE = "must be at most 64 characters";
32
+ /** The message of an audit event-type name off `AUDIT_EVENT_TYPE_NAME_REGEX`. */
33
+ export declare const AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE = "must start with a letter; only letters, digits, _ . / - allowed";
20
34
  /**
21
35
  * Valid audit event-type name: `AUDIT_EVENT_TYPE_NAME_REGEX`, at most
22
36
  * `NAME_LENGTH_MAX` UTF-16 code units, the twin of the Zod
@@ -1 +1 @@
1
- {"version":3,"file":"audit_log_schema_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_schema_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAgC,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAUxF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,0MAG9B,CAAC;AACF,cAAc;AACd,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,YAAY,wIAAiC,CAAC;AAC3D,cAAc;AACd,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"audit_log_schema_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_schema_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAgC,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAKxF;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,QAA+B,CAAC;AAExE,sEAAsE;AACtE,eAAO,MAAM,oCAAoC,kCAAkD,CAAC;AAEpG,iFAAiF;AACjF,eAAO,MAAM,qCAAqC,oEACgB,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,0MAG9B,CAAC;AACF,cAAc;AACd,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,YAAY,wIAAiC,CAAC;AAC3D,cAAc;AACd,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -4,14 +4,16 @@
4
4
  * schemas written in fuz_schema.
5
5
  *
6
6
  * `AuditEventTypeName` is built from the constants the Zod one is, the
7
- * grammar and the two messages of `audit_log_schema.ts` and the bound of
8
- * `auth/name_schema.ts`, so the two can't drift apart. They give every input
7
+ * grammar and the two messages this module exports and the bound of
8
+ * `auth/name_schema.ts`, so the two can't drift apart. The constants live
9
+ * here, not beside the Zod schema, because `audit_log_schema.ts` builds its
10
+ * wire rows from these twins. They give every input
9
11
  * the same verdict and output, and write the same JSON Schema (`maxLength`
10
12
  * and `pattern`); a string both too long and off the grammar gets the one
11
13
  * length issue from this twin, as its `pipe` stops at the first failing step,
12
14
  * where the Zod one adds the grammar issue after it.
13
15
  *
14
- * The exports are `@nodocs` while the Zod schemas of the same names stay, as
16
+ * The twins are `@nodocs` while the Zod schemas of the same names stay, as
15
17
  * the docs build refuses two exports of one name.
16
18
  *
17
19
  * @module
@@ -19,7 +21,18 @@
19
21
  import { message, one_of, pipe, regex } from '@fuzdev/fuz_schema/schema.ts';
20
22
  import { bounded_string } from '../primitive_schemas_fuz.js';
21
23
  import { NAME_LENGTH_MAX } from './name_schema.js';
22
- import { AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE, AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE, AUDIT_EVENT_TYPE_NAME_REGEX } from './audit_log_schema.js';
24
+ /**
25
+ * Letter start, then letters, digits, `_`, `.`, `/`, `-`. Accepts snake_case,
26
+ * dotted, and namespaced consumer conventions; rejects empty strings, leading
27
+ * separators, whitespace, and control characters. The audit event type's own
28
+ * grammar, wider than the shared name grammar (`auth/name_schema.ts`), whose
29
+ * length cap `AuditEventTypeName` takes.
30
+ */
31
+ export const AUDIT_EVENT_TYPE_NAME_REGEX = /^[A-Za-z][A-Za-z0-9_./-]*$/;
32
+ /** The message of an audit event-type name past `NAME_LENGTH_MAX`. */
33
+ export const AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE = `must be at most ${NAME_LENGTH_MAX} characters`;
34
+ /** The message of an audit event-type name off `AUDIT_EVENT_TYPE_NAME_REGEX`. */
35
+ export const AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE = 'must start with a letter; only letters, digits, _ . / - allowed';
23
36
  /**
24
37
  * Valid audit event-type name: `AUDIT_EVENT_TYPE_NAME_REGEX`, at most
25
38
  * `NAME_LENGTH_MAX` UTF-16 code units, the twin of the Zod
@@ -43,9 +43,9 @@ export declare const CREDENTIAL_TYPE_DAEMON_TOKEN = "daemon_token";
43
43
  export declare const BUILTIN_CREDENTIAL_TYPES: readonly ["session", "api_token", "daemon_token"];
44
44
  /** Zod enum for builtin credential types only. */
45
45
  export declare const BuiltinCredentialType: z.ZodEnum<{
46
- daemon_token: "daemon_token";
47
46
  session: "session";
48
47
  api_token: "api_token";
48
+ daemon_token: "daemon_token";
49
49
  }>;
50
50
  export type BuiltinCredentialType = z.infer<typeof BuiltinCredentialType>;
51
51
  /**
@@ -6,8 +6,8 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- import { z } from 'zod';
10
- import { Uuid, Username, Email } from '../primitive_schemas.js';
9
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
10
+ import { Email, Uuid, type Username } from '../primitive_schemas_fuz.js';
11
11
  /** Invite row from the database. */
12
12
  export interface Invite {
13
13
  id: Uuid;
@@ -18,30 +18,102 @@ export interface Invite {
18
18
  created_at: string;
19
19
  created_by: Uuid | null;
20
20
  }
21
- /** Zod schema for client-safe invite data. */
22
- export declare const InviteJson: z.ZodObject<{
23
- id: 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>>;
24
- email: z.ZodNullable<z.ZodString>;
25
- username: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
26
- claimed_by: z.ZodNullable<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>>>;
27
- claimed_at: z.ZodNullable<z.ZodString>;
28
- created_at: z.ZodString;
29
- created_by: z.ZodNullable<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>>>;
30
- }, z.core.$strict>;
31
- export type InviteJson = z.infer<typeof InviteJson>;
32
- /** Zod schema for invite data with resolved creator/claimer usernames. */
33
- export declare const InviteWithUsernamesJson: z.ZodObject<{
34
- id: 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>>;
35
- email: z.ZodNullable<z.ZodString>;
36
- username: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
37
- claimed_by: z.ZodNullable<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>>>;
38
- claimed_at: z.ZodNullable<z.ZodString>;
39
- created_at: z.ZodString;
40
- created_by: z.ZodNullable<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>>>;
41
- created_by_username: z.ZodNullable<z.ZodString>;
42
- claimed_by_username: z.ZodNullable<z.ZodString>;
43
- }, z.core.$strict>;
44
- export type InviteWithUsernamesJson = z.infer<typeof InviteWithUsernamesJson>;
21
+ /**
22
+ * Client-safe invite data, a `@fuzdev/fuz_schema` schema. Its `username` is
23
+ * `UsernameCanonical`, the lowercase every creation path stores.
24
+ */
25
+ export declare const InviteJson: import("@fuzdev/fuz_schema/schema.ts").Schema<{
26
+ email: string | null;
27
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
28
+ created_at: string;
29
+ username: string | null;
30
+ claimed_by: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null;
31
+ claimed_at: string | null;
32
+ created_by: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null;
33
+ }, {
34
+ email: string | null;
35
+ id: string;
36
+ created_at: string;
37
+ username: string | null;
38
+ claimed_by: string | null;
39
+ claimed_at: string | null;
40
+ created_by: string | null;
41
+ }, "object", {
42
+ id: 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">)[]> & {
43
+ readonly '~types'?: {
44
+ readonly input: string;
45
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
46
+ } | undefined;
47
+ };
48
+ email: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
49
+ username: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<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>>>>>;
50
+ claimed_by: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null, string | null, "nullable", 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">)[]> & {
51
+ readonly '~types'?: {
52
+ readonly input: string;
53
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
54
+ } | undefined;
55
+ }>>;
56
+ claimed_at: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
57
+ created_at: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
58
+ created_by: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null, string | null, "nullable", 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">)[]> & {
59
+ readonly '~types'?: {
60
+ readonly input: string;
61
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
62
+ } | undefined;
63
+ }>>;
64
+ }>;
65
+ export type InviteJson = Infer<typeof InviteJson>;
66
+ /**
67
+ * Invite data with resolved creator/claimer usernames, a `@fuzdev/fuz_schema`
68
+ * schema. The resolved names are plain strings.
69
+ */
70
+ export declare const InviteWithUsernamesJson: import("@fuzdev/fuz_schema/schema.ts").Schema<{
71
+ email: string | null;
72
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
73
+ created_at: string;
74
+ username: string | null;
75
+ claimed_by: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null;
76
+ claimed_at: string | null;
77
+ created_by: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null;
78
+ created_by_username: string | null;
79
+ claimed_by_username: string | null;
80
+ }, {
81
+ email: string | null;
82
+ id: string;
83
+ created_at: string;
84
+ username: string | null;
85
+ claimed_by: string | null;
86
+ claimed_at: string | null;
87
+ created_by: string | null;
88
+ created_by_username: string | null;
89
+ claimed_by_username: string | null;
90
+ }, "object", {
91
+ created_by_username: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
92
+ claimed_by_username: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
93
+ id: 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">)[]> & {
94
+ readonly '~types'?: {
95
+ readonly input: string;
96
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
97
+ } | undefined;
98
+ };
99
+ email: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
100
+ username: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<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>>>>>;
101
+ claimed_by: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null, string | null, "nullable", 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">)[]> & {
102
+ readonly '~types'?: {
103
+ readonly input: string;
104
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
105
+ } | undefined;
106
+ }>>;
107
+ claimed_at: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
108
+ created_at: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
109
+ created_by: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null, string | null, "nullable", 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">)[]> & {
110
+ readonly '~types'?: {
111
+ readonly input: string;
112
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
113
+ } | undefined;
114
+ }>>;
115
+ }>;
116
+ export type InviteWithUsernamesJson = Infer<typeof InviteWithUsernamesJson>;
45
117
  /** Input for creating an invite. */
46
118
  export interface CreateInviteInput {
47
119
  email?: Email | null;
@@ -1 +1 @@
1
- {"version":3,"file":"invite_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/invite_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhE,oCAAoC;AACpC,MAAM,WAAW,MAAM;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,8CAA8C;AAC9C,eAAO,MAAM,UAAU;;;;;;;;kBAQrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,0EAA0E;AAC1E,eAAO,MAAM,uBAAuB;;;;;;;;;;kBAGlC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E,oCAAoC;AACpC,MAAM,WAAW,iBAAiB;IACjC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB"}
1
+ {"version":3,"file":"invite_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/invite_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA4B,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEpF,OAAO,EACN,KAAK,EAGL,IAAI,EACJ,KAAK,QAAQ,EACb,MAAM,6BAA6B,CAAC;AAErC,oCAAoC;AACpC,MAAM,WAAW,MAAM;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE5E,oCAAoC;AACpC,MAAM,WAAW,iBAAiB;IACjC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB"}
@@ -6,20 +6,27 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- import { z } from 'zod';
10
- import { Uuid, Username, Email } from '../primitive_schemas.js';
11
- /** Zod schema for client-safe invite data. */
12
- export const InviteJson = z.strictObject({
9
+ import { nullable, object, string } from '@fuzdev/fuz_schema/schema.ts';
10
+ import { Email, Timestamp, UsernameCanonical, Uuid } from '../primitive_schemas_fuz.js';
11
+ /**
12
+ * Client-safe invite data, a `@fuzdev/fuz_schema` schema. Its `username` is
13
+ * `UsernameCanonical`, the lowercase every creation path stores.
14
+ */
15
+ export const InviteJson = object({
13
16
  id: Uuid,
14
- email: Email.nullable(),
15
- username: Username.nullable(),
16
- claimed_by: Uuid.nullable(),
17
- claimed_at: z.string().nullable(),
18
- created_at: z.string(),
19
- created_by: Uuid.nullable()
17
+ email: nullable(Email),
18
+ username: nullable(UsernameCanonical),
19
+ claimed_by: nullable(Uuid),
20
+ claimed_at: nullable(Timestamp),
21
+ created_at: Timestamp,
22
+ created_by: nullable(Uuid)
20
23
  });
21
- /** Zod schema for invite data with resolved creator/claimer usernames. */
22
- export const InviteWithUsernamesJson = InviteJson.extend({
23
- created_by_username: z.string().nullable(),
24
- claimed_by_username: z.string().nullable()
24
+ /**
25
+ * Invite data with resolved creator/claimer usernames, a `@fuzdev/fuz_schema`
26
+ * schema. The resolved names are plain strings.
27
+ */
28
+ export const InviteWithUsernamesJson = object({
29
+ ...InviteJson.def,
30
+ created_by_username: nullable(string),
31
+ claimed_by_username: nullable(string)
25
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"migrations.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AA+BH,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,kBAAkB,CAAC;AAqO1B;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,kBAG/B,CAAC"}
1
+ {"version":3,"file":"migrations.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AA+BH,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,kBAAkB,CAAC;AAkQ1B;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,kBAG/B,CAAC"}
@@ -257,6 +257,33 @@ const AUTH_MIGRATIONS = [
257
257
  AND superseded_at IS NULL
258
258
  AND expire_audited_at IS NULL`);
259
259
  }
260
+ },
261
+ // Every `account.username` lowercase, as `Username` canonicalizes every
262
+ // name production creates, so the wire's username (`UsernameCanonical`)
263
+ // is the stored one and the case-insensitive unique index reads the same
264
+ // value as the column.
265
+ //
266
+ // `ADD CONSTRAINT … CHECK` validates the rows already there: a database
267
+ // holding a username with an uppercase letter (one written outside the
268
+ // creation paths, by hand or by a harness) fails the migration on
269
+ // `check_violation`, and the chain's transaction rolls back. Lowercase
270
+ // those rows (`UPDATE account SET username = lower(username)`, which the
271
+ // unique index on `LOWER(username)` keeps from colliding) and migrate
272
+ // again. Idempotent without PL/pgSQL, as `role_grant_scope_kind_paired`:
273
+ // probe `information_schema.table_constraints`, then add only if absent.
274
+ {
275
+ name: 'account_username_lowercase',
276
+ up: async (db) => {
277
+ const existing = await db.query(`SELECT 1 FROM information_schema.table_constraints
278
+ WHERE table_schema = 'public'
279
+ AND table_name = 'account'
280
+ AND constraint_name = 'account_username_lowercase'`);
281
+ if (existing.length === 0) {
282
+ await db.query(`ALTER TABLE account
283
+ ADD CONSTRAINT account_username_lowercase
284
+ CHECK (username = lower(username))`);
285
+ }
286
+ }
260
287
  }
261
288
  ];
262
289
  /**