@fuzdev/fuz_app 0.161.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 +47 -36
- package/dist/auth/account_action_specs.d.ts +614 -150
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +56 -52
- package/dist/auth/account_route_schema.d.ts +401 -94
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +54 -39
- package/dist/auth/account_routes.js +1 -1
- package/dist/auth/account_schema.d.ts +531 -118
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +76 -58
- package/dist/auth/admin_action_specs.d.ts +1753 -240
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +28 -26
- 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_emitter.d.ts +8 -3
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +32 -9
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +4 -3
- package/dist/auth/audit_log_schema.d.ts +798 -291
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +192 -201
- 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/invite_schema.d.ts +98 -26
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +21 -14
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +28 -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.d.ts +72 -72
- 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.d.ts +60 -60
- package/dist/auth/role_grant_offer_notifications.js +2 -2
- package/dist/auth/role_grant_offer_schema.d.ts +8 -8
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +10 -10
- 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/dev/setup.d.ts +14 -7
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +11 -6
- package/dist/primitive_schemas.d.ts +2 -22
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +2 -24
- package/dist/primitive_schemas_fuz.d.ts +56 -2
- package/dist/primitive_schemas_fuz.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.js +54 -4
- package/dist/testing/CLAUDE.md +29 -8
- 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/app_server.d.ts +3 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +6 -2
- package/dist/testing/audit_drift_guard.d.ts.map +1 -1
- package/dist/testing/audit_drift_guard.js +12 -13
- 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 +43 -8
- 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/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +4 -3
- 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/db_entities.d.ts +3 -1
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +4 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -3
- 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/dist/zod.d.ts +2 -1
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +6 -2
- package/package.json +1 -1
- package/dist/auth/audit_log_schema_fuz.d.ts +0 -39
- package/dist/auth/audit_log_schema_fuz.d.ts.map +0 -1
- package/dist/auth/audit_log_schema_fuz.js +0 -37
- 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
|
@@ -11,50 +11,69 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import { array, boolean, integer, literal, loose_object, min_value, nullable, number, object, one_of, optional, pipe } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
15
|
import { ActorSummaryJson, RoleGrantSummaryJson, SessionAccountJson } from './account_schema.js';
|
|
16
|
-
import { UsernameProvided } from '../
|
|
16
|
+
import { UsernameCanonical, UsernameProvided } from '../primitive_schemas_fuz.js';
|
|
17
17
|
import { Password, PasswordProvided } from './password.js';
|
|
18
18
|
import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INVALID_CREDENTIALS, ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY } from '../http/error_schemas.js';
|
|
19
|
-
/** Input for `GET /api/account/status`. No parameters — caller is the subject. */
|
|
20
|
-
export const AccountStatusInput =
|
|
21
|
-
/** Output for `GET /api/account/status
|
|
22
|
-
export const AccountStatusOutput =
|
|
19
|
+
/** Input for `GET /api/account/status`, `literal(null)`. No parameters — caller is the subject. */
|
|
20
|
+
export const AccountStatusInput = literal(null);
|
|
21
|
+
/** Output for `GET /api/account/status`, a `@fuzdev/fuz_schema` schema. */
|
|
22
|
+
export const AccountStatusOutput = object({
|
|
23
23
|
account: SessionAccountJson,
|
|
24
|
-
actor:
|
|
25
|
-
role_grants:
|
|
24
|
+
actor: nullable(ActorSummaryJson),
|
|
25
|
+
role_grants: array(RoleGrantSummaryJson)
|
|
26
26
|
});
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Error body for `GET /api/account/status` on the unauthenticated path, a
|
|
29
|
+
* `@fuzdev/fuz_schema` schema.
|
|
30
|
+
*/
|
|
31
|
+
export const AccountStatusUnauthenticatedError = loose_object({
|
|
32
|
+
error: literal(ERROR_AUTHENTICATION_REQUIRED),
|
|
33
|
+
bootstrap_available: optional(boolean)
|
|
31
34
|
});
|
|
32
|
-
/**
|
|
33
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Input for `POST /login`, a `@fuzdev/fuz_schema` schema. Accepts a username
|
|
37
|
+
* or email in the `username` field.
|
|
38
|
+
*/
|
|
39
|
+
export const LoginInput = object({
|
|
34
40
|
username: UsernameProvided,
|
|
35
41
|
password: PasswordProvided
|
|
36
42
|
});
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Output for `POST /login`, a `@fuzdev/fuz_schema` schema. Session cookie is
|
|
45
|
+
* the operative side effect.
|
|
46
|
+
*/
|
|
47
|
+
export const LoginOutput = object({
|
|
48
|
+
ok: literal(true)
|
|
40
49
|
});
|
|
41
|
-
/** Input for `POST /logout`. Session identity flows through the cookie. */
|
|
42
|
-
export const LogoutInput =
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
/** Input for `POST /logout`, `literal(null)`. Session identity flows through the cookie. */
|
|
51
|
+
export const LogoutInput = literal(null);
|
|
52
|
+
/**
|
|
53
|
+
* Output for `POST /logout`, a `@fuzdev/fuz_schema` schema. Includes the
|
|
54
|
+
* revoked account's username for UI redraw, as the account row holds it.
|
|
55
|
+
*/
|
|
56
|
+
export const LogoutOutput = object({
|
|
57
|
+
ok: literal(true),
|
|
58
|
+
username: UsernameCanonical
|
|
47
59
|
});
|
|
48
|
-
/**
|
|
49
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Input for `POST /password`, a `@fuzdev/fuz_schema` schema.
|
|
62
|
+
* `current_password` is minimally validated; `new_password` enforces the full
|
|
63
|
+
* policy.
|
|
64
|
+
*/
|
|
65
|
+
export const PasswordChangeInput = object({
|
|
50
66
|
current_password: PasswordProvided,
|
|
51
67
|
new_password: Password
|
|
52
68
|
});
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Output for `POST /password`, a `@fuzdev/fuz_schema` schema. Counts are
|
|
71
|
+
* returned so the UI can summarize the revoke-all cascade.
|
|
72
|
+
*/
|
|
73
|
+
export const PasswordChangeOutput = object({
|
|
74
|
+
ok: literal(true),
|
|
75
|
+
sessions_revoked: pipe(number, integer, min_value(0)),
|
|
76
|
+
tokens_revoked: pipe(number, integer, min_value(0))
|
|
58
77
|
});
|
|
59
78
|
/**
|
|
60
79
|
* Default maximum sessions per account.
|
|
@@ -118,8 +137,8 @@ export const create_account_route_shapes = (options) => [
|
|
|
118
137
|
required_scope: 'surface:account_verify'
|
|
119
138
|
},
|
|
120
139
|
description: 'Session-validity probe for nginx auth_request (empty body; 200, 401, or 403 for a narrowed token)',
|
|
121
|
-
input:
|
|
122
|
-
output:
|
|
140
|
+
input: literal(null),
|
|
141
|
+
output: literal(null)
|
|
123
142
|
},
|
|
124
143
|
{
|
|
125
144
|
method: 'POST',
|
|
@@ -135,10 +154,8 @@ export const create_account_route_shapes = (options) => [
|
|
|
135
154
|
// database connection.
|
|
136
155
|
transaction: false,
|
|
137
156
|
errors: {
|
|
138
|
-
400:
|
|
139
|
-
|
|
140
|
-
}),
|
|
141
|
-
401: z.looseObject({ error: z.literal(ERROR_INVALID_CREDENTIALS) })
|
|
157
|
+
400: loose_object({ error: one_of([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY]) }),
|
|
158
|
+
401: loose_object({ error: literal(ERROR_INVALID_CREDENTIALS) })
|
|
142
159
|
}
|
|
143
160
|
},
|
|
144
161
|
{
|
|
@@ -167,9 +184,7 @@ export const create_account_route_shapes = (options) => [
|
|
|
167
184
|
// Argon2 verify and hash, hold no database connection.
|
|
168
185
|
transaction: false,
|
|
169
186
|
errors: {
|
|
170
|
-
400:
|
|
171
|
-
error: z.enum([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY])
|
|
172
|
-
})
|
|
187
|
+
400: loose_object({ error: one_of([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY]) })
|
|
173
188
|
}
|
|
174
189
|
}
|
|
175
190
|
];
|
|
@@ -227,7 +227,7 @@ export const create_account_route_specs = (deps, options) => {
|
|
|
227
227
|
// parse time — the validated value lands canonical in
|
|
228
228
|
// `c.var.validated_input`, so the per-account rate-limit key,
|
|
229
229
|
// DB lookup, and audit metadata see one form. See
|
|
230
|
-
// `
|
|
230
|
+
// `primitive_schemas_fuz.ts` for the schema-layer canonicalization.
|
|
231
231
|
const { username, password: pw } = get_route_input(c);
|
|
232
232
|
// DB lookup first so we can key the per-account rate limit by a canonical value
|
|
233
233
|
// (account.id) rather than the submitted identifier. Otherwise an attacker could
|