@fuzdev/fuz_app 0.162.0 → 0.163.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/CLAUDE.md +38 -35
- package/dist/auth/account_action_specs.d.ts +441 -115
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +47 -46
- package/dist/auth/account_route_schema.d.ts +120 -60
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +50 -36
- package/dist/auth/account_routes.js +1 -1
- package/dist/auth/account_schema.d.ts +54 -27
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +16 -18
- package/dist/auth/admin_action_specs.d.ts +20 -20
- package/dist/auth/admin_action_specs.js +2 -4
- package/dist/auth/admin_actions.d.ts +4 -4
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +3 -3
- package/dist/auth/all_cell_actions.d.ts +3 -3
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token.d.ts +4 -4
- package/dist/auth/api_token.d.ts.map +1 -1
- package/dist/auth/api_token.js +3 -3
- package/dist/auth/audit_log_schema.d.ts +28 -48
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +34 -30
- package/dist/auth/bootstrap_route_schema.d.ts +173 -50
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +35 -16
- package/dist/auth/cell_grant_action_specs.d.ts +1 -1
- package/dist/auth/cell_grant_action_specs.js +1 -1
- package/dist/auth/cell_grant_actions.d.ts +4 -4
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +1 -1
- package/dist/auth/credential_type_schema.d.ts +16 -29
- package/dist/auth/credential_type_schema.d.ts.map +1 -1
- package/dist/auth/credential_type_schema.js +14 -18
- package/dist/auth/grant_path_schema.d.ts +15 -29
- package/dist/auth/grant_path_schema.d.ts.map +1 -1
- package/dist/auth/grant_path_schema.js +13 -17
- package/dist/auth/migrations.js +1 -1
- package/dist/auth/name_schema.d.ts +7 -6
- package/dist/auth/name_schema.d.ts.map +1 -1
- package/dist/auth/name_schema.js +8 -9
- package/dist/auth/password.d.ts +15 -7
- package/dist/auth/password.d.ts.map +1 -1
- package/dist/auth/password.js +16 -9
- package/dist/auth/role_grant_offer_action_specs.js +2 -2
- package/dist/auth/role_grant_offer_actions.d.ts +4 -4
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +3 -3
- package/dist/auth/role_grant_offer_notifications.js +2 -2
- package/dist/auth/role_grant_offer_schema.d.ts +2 -2
- package/dist/auth/role_grant_offer_schema.js +2 -2
- package/dist/auth/role_schema.d.ts +47 -55
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +29 -35
- package/dist/auth/scope_kind_schema.d.ts +22 -26
- package/dist/auth/scope_kind_schema.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema.js +19 -19
- package/dist/auth/self_service_role_action_specs.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +6 -6
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +7 -6
- package/dist/auth/signup_route_schema.d.ts +71 -21
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +18 -16
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.js +1 -1
- package/dist/auth/token_lifetime.d.ts +33 -9
- package/dist/auth/token_lifetime.d.ts.map +1 -1
- package/dist/auth/token_lifetime.js +8 -7
- package/dist/auth/token_scope.d.ts +99 -25
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +57 -35
- package/dist/primitive_schemas.d.ts +2 -19
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +2 -20
- package/dist/primitive_schemas_fuz.d.ts +22 -2
- package/dist/primitive_schemas_fuz.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.js +23 -4
- package/dist/testing/CLAUDE.md +22 -5
- package/dist/testing/admin_integration.d.ts +3 -3
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +1 -1
- package/dist/testing/cross_backend/default_spine_surface.d.ts +2 -2
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +39 -6
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -3
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.d.ts +1 -1
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +45 -42
- package/dist/testing/cross_backend/spine_suites.d.ts +3 -3
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.d.ts +4 -4
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +34 -1
- package/dist/testing/integration.js +1 -1
- package/dist/testing/token_scope_fixtures.d.ts +24 -0
- package/dist/testing/token_scope_fixtures.d.ts.map +1 -0
- package/dist/testing/token_scope_fixtures.js +49 -0
- package/dist/testing/transports/bootstrap.d.ts +1 -1
- package/dist/testing/transports/bootstrap.d.ts.map +1 -1
- package/dist/testing/transports/bootstrap.js +13 -12
- package/dist/ui/BootstrapForm.svelte +4 -2
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +4 -2
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/auth/audit_log_schema_fuz.d.ts +0 -53
- package/dist/auth/audit_log_schema_fuz.d.ts.map +0 -1
- package/dist/auth/audit_log_schema_fuz.js +0 -50
- package/dist/auth/role_schema_fuz.d.ts +0 -30
- package/dist/auth/role_schema_fuz.d.ts.map +0 -1
- package/dist/auth/role_schema_fuz.js +0 -30
- package/dist/auth/scope_kind_schema_fuz.d.ts +0 -31
- package/dist/auth/scope_kind_schema_fuz.d.ts.map +0 -1
- package/dist/auth/scope_kind_schema_fuz.js +0 -31
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* `(scope_kind=NULL, scope_id=NULL)`.
|
|
16
16
|
*
|
|
17
17
|
* Open registry, no builtins. Consumers declare their kinds via
|
|
18
|
-
* `
|
|
19
|
-
* `
|
|
18
|
+
* `create_scope_kind_registry(consumer_kinds)` and pass the result to
|
|
19
|
+
* `create_role_registry` so `RoleSpec.applicable_scope_kinds` can be
|
|
20
20
|
* validated at construction time. Mirrors the open-string registry
|
|
21
21
|
* pattern used for `RoleName`, `AuditEventTypeName`, and `CredentialTypeName`.
|
|
22
22
|
*
|
|
@@ -31,33 +31,34 @@
|
|
|
31
31
|
*
|
|
32
32
|
* @module
|
|
33
33
|
*/
|
|
34
|
-
import {
|
|
34
|
+
import { format_issue, parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
35
35
|
import { create_name_schema, format_name_length_message, format_name_pattern_message } from './name_schema.js';
|
|
36
|
-
/** The message of a scope-kind name longer than `NAME_LENGTH_MAX
|
|
36
|
+
/** The message of a scope-kind name longer than `NAME_LENGTH_MAX`. */
|
|
37
37
|
export const SCOPE_KIND_NAME_LENGTH_MESSAGE = format_name_length_message('Scope-kind');
|
|
38
|
-
/** The message of a scope-kind name off `NAME_REGEX
|
|
38
|
+
/** The message of a scope-kind name off `NAME_REGEX`. */
|
|
39
39
|
export const SCOPE_KIND_NAME_PATTERN_MESSAGE = format_name_pattern_message('Scope-kind');
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Valid scope-kind name strings: a registered name, and the
|
|
42
42
|
* `scope_kind` the grant inputs take. The shared name grammar
|
|
43
43
|
* (`auth/name_schema.ts`), at most `NAME_LENGTH_MAX` UTF-16 code units, which
|
|
44
44
|
* bounds a registered name and the tag where it enters — the grant inputs
|
|
45
45
|
* (`role_grant_offer_create`, `role_grant_assign`) copy it into the row and
|
|
46
46
|
* its audit metadata — so no registry declares a kind the grant inputs would
|
|
47
|
-
* refuse. Off the grammar is the index-side `'GLOBAL'` token.
|
|
48
|
-
*
|
|
49
|
-
* `
|
|
47
|
+
* refuse. Off the grammar is the index-side `'GLOBAL'` token. A string it
|
|
48
|
+
* refuses gets `SCOPE_KIND_NAME_LENGTH_MESSAGE` or
|
|
49
|
+
* `SCOPE_KIND_NAME_PATTERN_MESSAGE`; a value that is no string, fuz_schema's
|
|
50
|
+
* message. Twin of the Rust spine's `is_valid_name`.
|
|
50
51
|
*/
|
|
51
52
|
export const ScopeKindName = create_name_schema('Scope-kind');
|
|
52
53
|
/**
|
|
53
|
-
* Create a scope-kind
|
|
54
|
+
* Create a scope-kind registry from the consumer-declared set.
|
|
54
55
|
*
|
|
55
56
|
* Open registry — no builtins. The `'GLOBAL'` token used inside the
|
|
56
57
|
* partial unique indexes on `role_grant` and `role_grant_offer` is not a
|
|
57
58
|
* registry entry (it's an index expression only), and no consumer can
|
|
58
59
|
* declare it because the regex rejects uppercase.
|
|
59
60
|
*
|
|
60
|
-
* Call once at server init. Pass the result into `
|
|
61
|
+
* Call once at server init. Pass the result into `create_role_registry`'s
|
|
61
62
|
* optional `scope_kinds` parameter so each role's
|
|
62
63
|
* `applicable_scope_kinds` entries are validated against this set at
|
|
63
64
|
* construction time. v1 keeps `applicable_scope_kinds` informative-only
|
|
@@ -66,35 +67,34 @@ export const ScopeKindName = create_name_schema('Scope-kind');
|
|
|
66
67
|
* consumer usage.
|
|
67
68
|
*
|
|
68
69
|
* @param consumer_kinds - the consumer-declared scope-kind set with optional metadata
|
|
69
|
-
* @returns `{
|
|
70
|
+
* @returns `{scope_kinds}` — the metadata map
|
|
70
71
|
*
|
|
71
72
|
* @throws Error if any `consumer_kinds` key fails `ScopeKindName` (its grammar or its length cap) or appears more than once
|
|
72
73
|
*
|
|
73
74
|
* @example
|
|
74
75
|
* ```ts
|
|
75
76
|
* // visiones
|
|
76
|
-
* const {
|
|
77
|
+
* const {scope_kinds} = create_scope_kind_registry({
|
|
77
78
|
* classroom: {description: 'A classroom — teacher and student role_grants scope here.'},
|
|
78
79
|
* });
|
|
79
80
|
* ```
|
|
80
81
|
*/
|
|
81
|
-
export const
|
|
82
|
+
export const create_scope_kind_registry = (consumer_kinds) => {
|
|
82
83
|
const names = Object.keys(consumer_kinds);
|
|
83
84
|
const seen = new Set();
|
|
84
85
|
for (const name of names) {
|
|
85
|
-
const parsed = ScopeKindName
|
|
86
|
-
if (!parsed.
|
|
87
|
-
throw new Error(`Invalid scope-kind name "${name}": ${parsed.
|
|
86
|
+
const parsed = parse(ScopeKindName, name);
|
|
87
|
+
if (!parsed.ok) {
|
|
88
|
+
throw new Error(`Invalid scope-kind name "${name}": ${format_issue(parsed.issues[0])}`);
|
|
88
89
|
}
|
|
89
90
|
if (seen.has(name)) {
|
|
90
91
|
throw new Error(`Duplicate scope-kind name "${name}"`);
|
|
91
92
|
}
|
|
92
93
|
seen.add(name);
|
|
93
94
|
}
|
|
94
|
-
const ScopeKind = names.length === 0 ? z.never() : z.enum(names);
|
|
95
95
|
const scope_kinds = new Map();
|
|
96
96
|
for (const name of names) {
|
|
97
97
|
scope_kinds.set(name, consumer_kinds[name]);
|
|
98
98
|
}
|
|
99
|
-
return {
|
|
99
|
+
return { scope_kinds };
|
|
100
100
|
};
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
11
11
|
import { boolean, literal, object } from '@fuzdev/fuz_schema/schema.ts';
|
|
12
12
|
import { ActingActor } from '../primitive_schemas_fuz.js';
|
|
13
|
-
import { RoleName } from './
|
|
13
|
+
import { RoleName } from './role_schema.js';
|
|
14
14
|
/** Error reason — caller asked to self-toggle a role outside the configured allowlist. */
|
|
15
15
|
export const ERROR_ROLE_NOT_SELF_SERVICE_ELIGIBLE = 'role_not_self_service_eligible';
|
|
16
16
|
/** Input for `self_service_role_set`, a `@fuzdev/fuz_schema` schema. */
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* @module
|
|
38
38
|
*/
|
|
39
39
|
import { type RpcAction } from '../actions/action_types.js';
|
|
40
|
-
import { type
|
|
40
|
+
import { type RoleRegistry } from './role_schema.js';
|
|
41
41
|
import type { RevokingActionFactoryDeps } from './deps.js';
|
|
42
42
|
/**
|
|
43
43
|
* Validate a deployment's self-service eligible-role set at construction.
|
|
@@ -45,7 +45,7 @@ import type { RevokingActionFactoryDeps } from './deps.js';
|
|
|
45
45
|
* Refuses a builtin role (`admin` / `keeper`) — self-toggling one would hand
|
|
46
46
|
* any account instance-wide authority, so no eligible set may name it — and a
|
|
47
47
|
* name outside the `RoleName` grammar. The same fail-loud-at-boot shape as
|
|
48
|
-
* `
|
|
48
|
+
* `create_role_registry`, which refuses a builtin name where only app roles
|
|
49
49
|
* belong. Twin of the Rust `validate_self_service_eligible_roles`.
|
|
50
50
|
*
|
|
51
51
|
* @param roles - the eligible role names
|
|
@@ -57,7 +57,7 @@ export interface SelfServiceRoleActionsOptions {
|
|
|
57
57
|
/**
|
|
58
58
|
* Optional override allowlist of role strings eligible for
|
|
59
59
|
* self-service. When omitted, eligibility is derived from
|
|
60
|
-
* `roles.role_specs` (or `
|
|
60
|
+
* `roles.role_specs` (or `builtin_role_specs` when `roles`
|
|
61
61
|
* is also omitted) by selecting every role whose
|
|
62
62
|
* `RoleSpec.grant_paths` includes `'self_service'`. Pass an empty
|
|
63
63
|
* array to lock the surface down (every call comes back as
|
|
@@ -68,11 +68,11 @@ export interface SelfServiceRoleActionsOptions {
|
|
|
68
68
|
*/
|
|
69
69
|
eligible_roles?: ReadonlyArray<string>;
|
|
70
70
|
/**
|
|
71
|
-
* Optional role
|
|
71
|
+
* Optional role registry. Drives default eligibility derivation from
|
|
72
72
|
* `RoleSpec.grant_paths` and validates the `eligible_roles` override
|
|
73
73
|
* (when supplied) against the registered role set.
|
|
74
74
|
*/
|
|
75
|
-
roles?:
|
|
75
|
+
roles?: RoleRegistry;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Build the unified self-service role toggle RPC action.
|
|
@@ -81,7 +81,7 @@ export interface SelfServiceRoleActionsOptions {
|
|
|
81
81
|
* `connection_closer`); `audit.emit` writes a success row in the request
|
|
82
82
|
* transaction and a failure row via the captured pool, and a disable closes the caller's connections gated on the role
|
|
83
83
|
* through `connection_closer`.
|
|
84
|
-
* @param options - optional eligible-role override plus optional role
|
|
84
|
+
* @param options - optional eligible-role override plus optional role registry for default-eligibility derivation
|
|
85
85
|
* @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
|
|
86
86
|
* @throws Error at factory time if any `eligible_roles` entry is missing from `options.roles.role_specs`
|
|
87
87
|
* @throws Error at factory time if the eligible set names a builtin role or an invalid role name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self_service_role_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/self_service_role_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;
|
|
1
|
+
{"version":3,"file":"self_service_role_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/self_service_role_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAIH,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGjG,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAW3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oCAAoC,GAAI,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAG,IAW9E,CAAC;AAEF,sDAAsD;AACtD,MAAM,WAAW,6BAA6B;IAC7C;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,yBAAyB,EAC/B,UAAS,6BAAkC,KACzC,KAAK,CAAC,SAAS,CA0JjB,CAAC"}
|
|
@@ -36,10 +36,11 @@
|
|
|
36
36
|
*
|
|
37
37
|
* @module
|
|
38
38
|
*/
|
|
39
|
+
import { is } from '@fuzdev/fuz_schema/schema.ts';
|
|
39
40
|
import { rpc_action } from '../actions/action_types.js';
|
|
40
41
|
import { queue_connection_close } from '../actions/connection_closer.js';
|
|
41
42
|
import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
|
|
42
|
-
import {
|
|
43
|
+
import { builtin_role_specs, is_builtin_role, list_roles_with_grant_path, RoleName } from './role_schema.js';
|
|
43
44
|
import { GRANT_PATH_SELF_SERVICE } from './grant_path_schema.js';
|
|
44
45
|
import { query_create_role_grant, query_revoke_role_grant } from './role_grant_queries.js';
|
|
45
46
|
import { is_role_grant_active } from './account_schema.js';
|
|
@@ -51,7 +52,7 @@ import { ERROR_ROLE_NOT_SELF_SERVICE_ELIGIBLE, self_service_role_set_action_spec
|
|
|
51
52
|
* Refuses a builtin role (`admin` / `keeper`) — self-toggling one would hand
|
|
52
53
|
* any account instance-wide authority, so no eligible set may name it — and a
|
|
53
54
|
* name outside the `RoleName` grammar. The same fail-loud-at-boot shape as
|
|
54
|
-
* `
|
|
55
|
+
* `create_role_registry`, which refuses a builtin name where only app roles
|
|
55
56
|
* belong. Twin of the Rust `validate_self_service_eligible_roles`.
|
|
56
57
|
*
|
|
57
58
|
* @param roles - the eligible role names
|
|
@@ -62,7 +63,7 @@ export const validate_self_service_eligible_roles = (roles) => {
|
|
|
62
63
|
if (is_builtin_role(role)) {
|
|
63
64
|
throw new Error(`self-service eligible role "${role}" is a builtin role — builtin roles are never self-service`);
|
|
64
65
|
}
|
|
65
|
-
if (!RoleName
|
|
66
|
+
if (!is(RoleName, role)) {
|
|
66
67
|
throw new Error(`self-service eligible role "${role}" is not a valid role name`);
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -74,13 +75,13 @@ export const validate_self_service_eligible_roles = (roles) => {
|
|
|
74
75
|
* `connection_closer`); `audit.emit` writes a success row in the request
|
|
75
76
|
* transaction and a failure row via the captured pool, and a disable closes the caller's connections gated on the role
|
|
76
77
|
* through `connection_closer`.
|
|
77
|
-
* @param options - optional eligible-role override plus optional role
|
|
78
|
+
* @param options - optional eligible-role override plus optional role registry for default-eligibility derivation
|
|
78
79
|
* @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
|
|
79
80
|
* @throws Error at factory time if any `eligible_roles` entry is missing from `options.roles.role_specs`
|
|
80
81
|
* @throws Error at factory time if the eligible set names a builtin role or an invalid role name
|
|
81
82
|
*/
|
|
82
83
|
export const create_self_service_role_actions = (deps, options = {}) => {
|
|
83
|
-
const role_specs = options.roles?.role_specs ??
|
|
84
|
+
const role_specs = options.roles?.role_specs ?? builtin_role_specs;
|
|
84
85
|
const eligible = options.eligible_roles
|
|
85
86
|
? new Set(options.eligible_roles)
|
|
86
87
|
: new Set(list_roles_with_grant_path(role_specs, GRANT_PATH_SELF_SERVICE));
|
|
@@ -88,7 +89,7 @@ export const create_self_service_role_actions = (deps, options = {}) => {
|
|
|
88
89
|
if (options.eligible_roles && options.roles) {
|
|
89
90
|
for (const r of eligible) {
|
|
90
91
|
if (!role_specs.has(r)) {
|
|
91
|
-
throw new Error(`create_self_service_role_actions: eligible_roles entry "${r}" is not registered in roles.role_specs — typo or missing call to
|
|
92
|
+
throw new Error(`create_self_service_role_actions: eligible_roles entry "${r}" is not registered in roles.role_specs — typo or missing call to create_role_registry`);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -11,33 +11,83 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
15
|
import type { RouteSpec } from '../http/route_spec.js';
|
|
16
|
-
/** Input for `POST /signup`. `email` is optional (absent or `null` = no email) and must match any referenced invite. */
|
|
17
|
-
export declare const SignupInput: z.ZodObject<{
|
|
18
|
-
username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
19
|
-
password: z.ZodString;
|
|
20
|
-
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
|
-
}, z.core.$strict>;
|
|
22
|
-
export type SignupInput = z.infer<typeof SignupInput>;
|
|
23
16
|
/**
|
|
24
|
-
*
|
|
17
|
+
* Input for `POST /signup`, a `@fuzdev/fuz_schema` schema. `email` is optional
|
|
18
|
+
* (absent or `null` = no email) and must match any referenced invite.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SignupInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
21
|
+
username: string;
|
|
22
|
+
password: string;
|
|
23
|
+
email?: string | null | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
username: string;
|
|
26
|
+
password: string;
|
|
27
|
+
email?: string | null | undefined;
|
|
28
|
+
}, "object", {
|
|
29
|
+
username: 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>>>;
|
|
30
|
+
password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
31
|
+
email: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null | undefined, string | null | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<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>>>>>>;
|
|
32
|
+
}>;
|
|
33
|
+
export type SignupInput = Infer<typeof SignupInput>;
|
|
34
|
+
/**
|
|
35
|
+
* Output for `POST /signup`, a `@fuzdev/fuz_schema` schema.
|
|
25
36
|
*
|
|
26
37
|
* Session cookie is the operative side effect. The returned `account` and
|
|
27
38
|
* `actor` mirror `BootstrapOutput` so cross-process per-test setup can read
|
|
28
|
-
* the per-test identity straight off the signup response.
|
|
39
|
+
* the per-test identity straight off the signup response. Its `username` is
|
|
40
|
+
* the account row's, `UsernameCanonical`.
|
|
29
41
|
*/
|
|
30
|
-
export declare const SignupOutput:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
42
|
+
export declare const SignupOutput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
43
|
+
account: {
|
|
44
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
45
|
+
username: string;
|
|
46
|
+
};
|
|
47
|
+
actor: {
|
|
48
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
49
|
+
};
|
|
50
|
+
ok: true;
|
|
51
|
+
}, {
|
|
52
|
+
account: {
|
|
53
|
+
id: string;
|
|
54
|
+
username: string;
|
|
55
|
+
};
|
|
56
|
+
actor: {
|
|
57
|
+
id: string;
|
|
58
|
+
};
|
|
59
|
+
ok: true;
|
|
60
|
+
}, "object", {
|
|
61
|
+
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
62
|
+
account: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
63
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
64
|
+
username: string;
|
|
65
|
+
}, {
|
|
66
|
+
id: string;
|
|
67
|
+
username: string;
|
|
68
|
+
}, "object", {
|
|
69
|
+
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">)[]> & {
|
|
70
|
+
readonly '~types'?: {
|
|
71
|
+
readonly input: string;
|
|
72
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
73
|
+
} | undefined;
|
|
74
|
+
};
|
|
75
|
+
username: 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>>>;
|
|
76
|
+
}>;
|
|
77
|
+
actor: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
78
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
79
|
+
}, {
|
|
80
|
+
id: string;
|
|
81
|
+
}, "object", {
|
|
82
|
+
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">)[]> & {
|
|
83
|
+
readonly '~types'?: {
|
|
84
|
+
readonly input: string;
|
|
85
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
86
|
+
} | undefined;
|
|
87
|
+
};
|
|
88
|
+
}>;
|
|
89
|
+
}>;
|
|
90
|
+
export type SignupOutput = Infer<typeof SignupOutput>;
|
|
41
91
|
/** Option inputs that shape the signup route metadata (not its handler). */
|
|
42
92
|
export interface SignupRouteShapeOptions {
|
|
43
93
|
/** Whether a per-account signup rate limiter is wired — toggles `rate_limit`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signup_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/signup_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"signup_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/signup_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAON,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQvD;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;EAItB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEtD,4EAA4E;AAC5E,MAAM,WAAW,uBAAuB;IACvC,iFAAiF;IACjF,2BAA2B,EAAE,OAAO,CAAC;CACrC;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GACrC,SAAS,uBAAuB,KAC9B,IAAI,CAAC,SAAS,EAAE,SAAS,CAe1B,CAAC"}
|
|
@@ -11,27 +11,31 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { literal, loose_object, nullable, object, one_of, optional } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
|
+
import { Email, Username, UsernameCanonical, Uuid } from '../primitive_schemas_fuz.js';
|
|
16
16
|
import { Password } from './password.js';
|
|
17
17
|
import { ERROR_NO_MATCHING_INVITE, ERROR_SIGNUP_CONFLICT, ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY } from '../http/error_schemas.js';
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Input for `POST /signup`, a `@fuzdev/fuz_schema` schema. `email` is optional
|
|
20
|
+
* (absent or `null` = no email) and must match any referenced invite.
|
|
21
|
+
*/
|
|
22
|
+
export const SignupInput = object({
|
|
20
23
|
username: Username,
|
|
21
24
|
password: Password,
|
|
22
|
-
email: Email
|
|
25
|
+
email: optional(nullable(Email))
|
|
23
26
|
});
|
|
24
27
|
/**
|
|
25
|
-
* Output for `POST /signup
|
|
28
|
+
* Output for `POST /signup`, a `@fuzdev/fuz_schema` schema.
|
|
26
29
|
*
|
|
27
30
|
* Session cookie is the operative side effect. The returned `account` and
|
|
28
31
|
* `actor` mirror `BootstrapOutput` so cross-process per-test setup can read
|
|
29
|
-
* the per-test identity straight off the signup response.
|
|
32
|
+
* the per-test identity straight off the signup response. Its `username` is
|
|
33
|
+
* the account row's, `UsernameCanonical`.
|
|
30
34
|
*/
|
|
31
|
-
export const SignupOutput =
|
|
32
|
-
ok:
|
|
33
|
-
account:
|
|
34
|
-
actor:
|
|
35
|
+
export const SignupOutput = object({
|
|
36
|
+
ok: literal(true),
|
|
37
|
+
account: object({ id: Uuid, username: UsernameCanonical }),
|
|
38
|
+
actor: object({ id: Uuid })
|
|
35
39
|
});
|
|
36
40
|
/**
|
|
37
41
|
* The `POST /signup` route shape minus its handler — pure hono-free data.
|
|
@@ -50,10 +54,8 @@ export const create_signup_route_shape = (options) => ({
|
|
|
50
54
|
output: SignupOutput,
|
|
51
55
|
rate_limit: options.signup_account_rate_limited ? 'both' : 'ip',
|
|
52
56
|
errors: {
|
|
53
|
-
400:
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
403: z.looseObject({ error: z.literal(ERROR_NO_MATCHING_INVITE) }),
|
|
57
|
-
409: z.looseObject({ error: z.literal(ERROR_SIGNUP_CONFLICT) })
|
|
57
|
+
400: loose_object({ error: one_of([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY]) }),
|
|
58
|
+
403: loose_object({ error: literal(ERROR_NO_MATCHING_INVITE) }),
|
|
59
|
+
409: loose_object({ error: literal(ERROR_SIGNUP_CONFLICT) })
|
|
58
60
|
}
|
|
59
61
|
});
|
|
@@ -56,7 +56,7 @@ export interface StandardRpcActionsDeps extends RevokingActionFactoryDeps {
|
|
|
56
56
|
* option flows to admin + role-grant-offer.
|
|
57
57
|
*
|
|
58
58
|
* @param deps - `StandardRpcActionsDeps` (`log`, `audit`, `connection_closer` from `RevokingActionFactoryDeps`; optional `notification_sender` for WS fan-out)
|
|
59
|
-
* @param options - role
|
|
59
|
+
* @param options - role registry, role-grant-offer config, account config
|
|
60
60
|
* @returns RPC actions to pass as `rpc_endpoints` or spread into `create_rpc_endpoint`
|
|
61
61
|
*/
|
|
62
62
|
export declare const create_standard_rpc_actions: (deps: StandardRpcActionsDeps, options?: StandardRpcActionsOptions) => Array<RpcAction>;
|
|
@@ -31,7 +31,7 @@ import { create_account_actions } from './account_actions.js';
|
|
|
31
31
|
* option flows to admin + role-grant-offer.
|
|
32
32
|
*
|
|
33
33
|
* @param deps - `StandardRpcActionsDeps` (`log`, `audit`, `connection_closer` from `RevokingActionFactoryDeps`; optional `notification_sender` for WS fan-out)
|
|
34
|
-
* @param options - role
|
|
34
|
+
* @param options - role registry, role-grant-offer config, account config
|
|
35
35
|
* @returns RPC actions to pass as `rpc_endpoints` or spread into `create_rpc_endpoint`
|
|
36
36
|
*/
|
|
37
37
|
export const create_standard_rpc_actions = (deps, options = {}) => [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @module
|
|
21
21
|
*/
|
|
22
|
-
import {
|
|
22
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
23
23
|
/**
|
|
24
24
|
* Upper bound on `ttl.days` — a sanity cap (100 years), not a policy ceiling.
|
|
25
25
|
* Shared with the Rust twin so out-of-range requests 400 identically on both
|
|
@@ -27,19 +27,43 @@ import { z } from 'zod';
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const TOKEN_TTL_DAYS_MAX = 36500;
|
|
29
29
|
/**
|
|
30
|
-
* Caller-provided lifetime for `account_token_create
|
|
30
|
+
* Caller-provided lifetime for `account_token_create`, a `@fuzdev/fuz_schema`
|
|
31
|
+
* schema.
|
|
31
32
|
*
|
|
32
33
|
* `eternal` mints a never-expiring token (`expires_at` NULL); `ttl` bounds it
|
|
33
34
|
* to `days` from mint time. `eternal` is deliberately the first variant so
|
|
34
35
|
* schema-driven test generators produce it by default.
|
|
35
36
|
*/
|
|
36
|
-
export declare const TokenLifetimeInput:
|
|
37
|
-
kind:
|
|
38
|
-
}
|
|
39
|
-
kind:
|
|
40
|
-
days:
|
|
41
|
-
},
|
|
42
|
-
|
|
37
|
+
export declare const TokenLifetimeInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
38
|
+
kind: "eternal";
|
|
39
|
+
} | {
|
|
40
|
+
kind: "ttl";
|
|
41
|
+
days: number;
|
|
42
|
+
}, {
|
|
43
|
+
kind: "eternal";
|
|
44
|
+
} | {
|
|
45
|
+
kind: "ttl";
|
|
46
|
+
days: number;
|
|
47
|
+
}, "variant", {
|
|
48
|
+
readonly key: "kind";
|
|
49
|
+
readonly options: readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
50
|
+
kind: "eternal";
|
|
51
|
+
}, {
|
|
52
|
+
kind: "eternal";
|
|
53
|
+
}, "object", {
|
|
54
|
+
kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"eternal", "eternal", "literal", "eternal">;
|
|
55
|
+
}>, import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
56
|
+
kind: "ttl";
|
|
57
|
+
days: number;
|
|
58
|
+
}, {
|
|
59
|
+
kind: "ttl";
|
|
60
|
+
days: number;
|
|
61
|
+
}, "object", {
|
|
62
|
+
kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"ttl", "ttl", "literal", "ttl">;
|
|
63
|
+
days: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>>;
|
|
64
|
+
}>];
|
|
65
|
+
}>;
|
|
66
|
+
export type TokenLifetimeInput = Infer<typeof TokenLifetimeInput>;
|
|
43
67
|
/**
|
|
44
68
|
* Resolve a lifetime input to the `expires_at` value the mint query stores.
|
|
45
69
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_lifetime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_lifetime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACxC,UAAU,kBAAkB,EAC5B,MAAK,IAAiB,KACpB,IAAI,GAAG,IAGT,CAAC"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @module
|
|
21
21
|
*/
|
|
22
|
-
import {
|
|
22
|
+
import { integer, literal, max_value, min_value, number, object, pipe, variant } from '@fuzdev/fuz_schema/schema.ts';
|
|
23
23
|
/**
|
|
24
24
|
* Upper bound on `ttl.days` — a sanity cap (100 years), not a policy ceiling.
|
|
25
25
|
* Shared with the Rust twin so out-of-range requests 400 identically on both
|
|
@@ -27,17 +27,18 @@ import { z } from 'zod';
|
|
|
27
27
|
*/
|
|
28
28
|
export const TOKEN_TTL_DAYS_MAX = 36_500;
|
|
29
29
|
/**
|
|
30
|
-
* Caller-provided lifetime for `account_token_create
|
|
30
|
+
* Caller-provided lifetime for `account_token_create`, a `@fuzdev/fuz_schema`
|
|
31
|
+
* schema.
|
|
31
32
|
*
|
|
32
33
|
* `eternal` mints a never-expiring token (`expires_at` NULL); `ttl` bounds it
|
|
33
34
|
* to `days` from mint time. `eternal` is deliberately the first variant so
|
|
34
35
|
* schema-driven test generators produce it by default.
|
|
35
36
|
*/
|
|
36
|
-
export const TokenLifetimeInput =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
kind:
|
|
40
|
-
days:
|
|
37
|
+
export const TokenLifetimeInput = variant('kind', [
|
|
38
|
+
object({ kind: literal('eternal') }),
|
|
39
|
+
object({
|
|
40
|
+
kind: literal('ttl'),
|
|
41
|
+
days: pipe(number, integer, min_value(1), max_value(TOKEN_TTL_DAYS_MAX))
|
|
41
42
|
})
|
|
42
43
|
]);
|
|
43
44
|
/**
|