@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
|
@@ -22,7 +22,10 @@ import '../assert_dev_env.js';
|
|
|
22
22
|
* @module
|
|
23
23
|
*/
|
|
24
24
|
import { z } from 'zod';
|
|
25
|
-
import {
|
|
25
|
+
import { array, literal, parse, string, strip_object } from '@fuzdev/fuz_schema/schema.ts';
|
|
26
|
+
import { USERNAME_LENGTH_MAX } from '../../primitive_schemas.js';
|
|
27
|
+
import { Uuid } from '../../primitive_schemas_fuz.js';
|
|
28
|
+
import { format_issues } from '../../schema_issues.js';
|
|
26
29
|
import { DAEMON_TOKEN_HEADER } from '../../auth/daemon_token.js';
|
|
27
30
|
import { DEFAULT_TEST_PASSWORD } from '../test_credentials.js';
|
|
28
31
|
import { create_fetch_transport } from '../transports/fetch_transport.js';
|
|
@@ -98,18 +101,18 @@ export const reconstruct_bootstrapped_handle = (serialized) => ({
|
|
|
98
101
|
});
|
|
99
102
|
/**
|
|
100
103
|
* Structural subset of `SignupOutput` the runner cares about. Looser
|
|
101
|
-
* than the canonical `auth/
|
|
104
|
+
* than the canonical `auth/signup_route_schema.ts` schema — kept local so this
|
|
102
105
|
* module doesn't pull the full auth-domain schema into its dep graph.
|
|
103
106
|
*/
|
|
104
|
-
const SignupResponseShape =
|
|
105
|
-
ok:
|
|
106
|
-
account:
|
|
107
|
-
actor:
|
|
107
|
+
const SignupResponseShape = strip_object({
|
|
108
|
+
ok: literal(true),
|
|
109
|
+
account: strip_object({ id: Uuid, username: string }),
|
|
110
|
+
actor: strip_object({ id: Uuid })
|
|
108
111
|
});
|
|
109
112
|
/** Structural subset of `account_token_create`'s output. */
|
|
110
|
-
const TokenCreateResponseShape =
|
|
111
|
-
token:
|
|
112
|
-
id:
|
|
113
|
+
const TokenCreateResponseShape = strip_object({
|
|
114
|
+
token: string,
|
|
115
|
+
id: string
|
|
113
116
|
});
|
|
114
117
|
/**
|
|
115
118
|
* Per-test username generator for the *default* `fixture.create_account()`
|
|
@@ -231,20 +234,20 @@ export const capture_migration_tracker = async (handle) => capture_via_daemon(ha
|
|
|
231
234
|
*/
|
|
232
235
|
export const EXPIRED_SESSION_OFFSET_SECONDS = -60;
|
|
233
236
|
/** Structural subset of `_testing_mint_session`'s output. */
|
|
234
|
-
const MintSessionResponseShape =
|
|
237
|
+
const MintSessionResponseShape = strip_object({ session_cookie: string });
|
|
235
238
|
/** Structural subset of `_testing_reset`'s output. */
|
|
236
|
-
const TestingResetResponseShape =
|
|
237
|
-
account:
|
|
238
|
-
actor:
|
|
239
|
-
api_token:
|
|
240
|
-
session_cookie:
|
|
241
|
-
extra_accounts:
|
|
242
|
-
account:
|
|
243
|
-
actor:
|
|
244
|
-
api_token:
|
|
245
|
-
session_cookie:
|
|
239
|
+
const TestingResetResponseShape = strip_object({
|
|
240
|
+
account: strip_object({ id: Uuid, username: string }),
|
|
241
|
+
actor: strip_object({ id: Uuid }),
|
|
242
|
+
api_token: string,
|
|
243
|
+
session_cookie: string,
|
|
244
|
+
extra_accounts: array(strip_object({
|
|
245
|
+
account: strip_object({ id: Uuid, username: string }),
|
|
246
|
+
actor: strip_object({ id: Uuid }),
|
|
247
|
+
api_token: string,
|
|
248
|
+
session_cookie: string
|
|
246
249
|
})),
|
|
247
|
-
extra_actors:
|
|
250
|
+
extra_actors: array(strip_object({ id: Uuid, name: string }))
|
|
248
251
|
});
|
|
249
252
|
/**
|
|
250
253
|
* Fire the `_testing_reset` RPC action over the keeper's daemon-token
|
|
@@ -263,19 +266,19 @@ const fire_testing_reset = async (handle, options) => {
|
|
|
263
266
|
})),
|
|
264
267
|
extra_actors: [...(options.extra_actors ?? [])]
|
|
265
268
|
}, handle.config.name, { [DAEMON_TOKEN_HEADER]: handle.daemon_token });
|
|
266
|
-
const parsed = TestingResetResponseShape
|
|
267
|
-
if (!parsed.
|
|
268
|
-
throw new Error(`_testing_reset(${handle.config.name}) returned unexpected result: ${JSON.stringify(raw)} (${parsed.
|
|
269
|
+
const parsed = parse(TestingResetResponseShape, raw);
|
|
270
|
+
if (!parsed.ok) {
|
|
271
|
+
throw new Error(`_testing_reset(${handle.config.name}) returned unexpected result: ${JSON.stringify(raw)} (${format_issues(parsed.issues)})`);
|
|
269
272
|
}
|
|
270
273
|
return {
|
|
271
274
|
keeper: {
|
|
272
|
-
account: parsed.
|
|
273
|
-
actor: parsed.
|
|
274
|
-
api_token: parsed.
|
|
275
|
-
session_cookie: parsed.
|
|
275
|
+
account: parsed.value.account,
|
|
276
|
+
actor: parsed.value.actor,
|
|
277
|
+
api_token: parsed.value.api_token,
|
|
278
|
+
session_cookie: parsed.value.session_cookie
|
|
276
279
|
},
|
|
277
|
-
extra_accounts: parsed.
|
|
278
|
-
extra_actors: parsed.
|
|
280
|
+
extra_accounts: parsed.value.extra_accounts,
|
|
281
|
+
extra_actors: parsed.value.extra_actors
|
|
279
282
|
};
|
|
280
283
|
};
|
|
281
284
|
/**
|
|
@@ -361,9 +364,9 @@ const mint_account = async (handle, options) => {
|
|
|
361
364
|
throw new Error(`signup(${handle.config.name}) failed: status=${signup_response.status} body=${body}`);
|
|
362
365
|
}
|
|
363
366
|
const signup_raw = await signup_response.json();
|
|
364
|
-
const parsed = SignupResponseShape
|
|
365
|
-
if (!parsed.
|
|
366
|
-
throw new Error(`signup(${handle.config.name}) returned unexpected body: ${JSON.stringify(signup_raw)} (${parsed.
|
|
367
|
+
const parsed = parse(SignupResponseShape, signup_raw);
|
|
368
|
+
if (!parsed.ok) {
|
|
369
|
+
throw new Error(`signup(${handle.config.name}) returned unexpected body: ${JSON.stringify(signup_raw)} (${format_issues(parsed.issues)})`);
|
|
367
370
|
}
|
|
368
371
|
const login_response = await transport(options.login_path, {
|
|
369
372
|
method: 'POST',
|
|
@@ -382,16 +385,16 @@ const mint_account = async (handle, options) => {
|
|
|
382
385
|
// ordinary account credential, so it takes full account authority; the
|
|
383
386
|
// narrowed credential is the conformance table's `scoped_token` principal.
|
|
384
387
|
const token_result = await rpc_via_transport(transport, handle.config.rpc_path, 'account_token_create', { scope: { kind: 'full' }, lifetime: { kind: 'eternal' } }, handle.config.name);
|
|
385
|
-
const token_parsed = TokenCreateResponseShape
|
|
386
|
-
if (!token_parsed.
|
|
388
|
+
const token_parsed = parse(TokenCreateResponseShape, token_result);
|
|
389
|
+
if (!token_parsed.ok) {
|
|
387
390
|
throw new Error(`account_token_create(${handle.config.name}) returned unexpected result: ${JSON.stringify(token_result)}`);
|
|
388
391
|
}
|
|
389
392
|
return {
|
|
390
393
|
transport,
|
|
391
|
-
account: parsed.
|
|
392
|
-
actor: parsed.
|
|
394
|
+
account: parsed.value.account,
|
|
395
|
+
actor: parsed.value.actor,
|
|
393
396
|
session_cookie: extract_cookie_value(transport, handle.config.cookie_name, handle.config.name),
|
|
394
|
-
api_token: token_parsed.
|
|
397
|
+
api_token: token_parsed.value.token
|
|
395
398
|
};
|
|
396
399
|
};
|
|
397
400
|
/**
|
|
@@ -562,12 +565,12 @@ export const default_cross_process_setup = (handle, options) => {
|
|
|
562
565
|
// cookie server-side over the keeper's daemon-token channel.
|
|
563
566
|
mint_expired_session: async () => {
|
|
564
567
|
const raw = await rpc_via_transport(refreshed_handle.keeper_daemon_transport, handle.config.rpc_path, '_testing_mint_session', { account_id: keeper.account.id, expires_in_seconds: EXPIRED_SESSION_OFFSET_SECONDS }, handle.config.name, { [DAEMON_TOKEN_HEADER]: handle.daemon_token });
|
|
565
|
-
const parsed = MintSessionResponseShape
|
|
566
|
-
if (!parsed.
|
|
568
|
+
const parsed = parse(MintSessionResponseShape, raw);
|
|
569
|
+
if (!parsed.ok) {
|
|
567
570
|
throw new Error(`_testing_mint_session(${handle.config.name}) returned unexpected result: ` +
|
|
568
|
-
`${JSON.stringify(raw)} (${parsed.
|
|
571
|
+
`${JSON.stringify(raw)} (${format_issues(parsed.issues)})`);
|
|
569
572
|
}
|
|
570
|
-
return `${cookie_name}=${parsed.
|
|
573
|
+
return `${cookie_name}=${parsed.value.session_cookie}`;
|
|
571
574
|
}
|
|
572
575
|
};
|
|
573
576
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import { type
|
|
2
|
+
import { type RoleRegistry } from '../../auth/role_schema.js';
|
|
3
3
|
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
4
4
|
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
5
5
|
import { type RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
@@ -189,8 +189,8 @@ export interface SpineCrossSuitesOptions {
|
|
|
189
189
|
* still runs once, from the declared surface.
|
|
190
190
|
*/
|
|
191
191
|
readonly live_rpc_endpoints?: RpcEndpointsSuiteOption;
|
|
192
|
-
/** The backend's role
|
|
193
|
-
readonly roles?:
|
|
192
|
+
/** The backend's role registry; given, the standard bundle runs its admin suite. */
|
|
193
|
+
readonly roles?: RoleRegistry;
|
|
194
194
|
/**
|
|
195
195
|
* Setup options every suite's `setup_test` starts from — a signup path the
|
|
196
196
|
* backend mounts elsewhere, `reject_unknown_audit_metadata_keys` for a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spine_suites.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/spine_suites.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwF9B,OAAO,EAA2B,KAAK,
|
|
1
|
+
{"version":3,"file":"spine_suites.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/spine_suites.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwF9B,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAmC,KAAK,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAEN,KAAK,gCAA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MAAM,8BAA8B,GAC1C,eAAe,mBAAmB,EAClC,QAAQ,aAAa,CAAC,cAAc,CAAC,KACnC,IAiCF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,sCAAsC,EAC9C,SAAS,uBAAuB,KAC9B,IAoCF,CAAC"}
|
|
@@ -14,7 +14,7 @@ import '../assert_dev_env.js';
|
|
|
14
14
|
* - `describe_data_exposure_tests`
|
|
15
15
|
*
|
|
16
16
|
* **Gated on `roles`** — included when the consumer supplies a
|
|
17
|
-
* `
|
|
17
|
+
* `RoleRegistry`:
|
|
18
18
|
*
|
|
19
19
|
* - `describe_standard_admin_integration_tests`
|
|
20
20
|
*
|
|
@@ -34,7 +34,7 @@ import '../assert_dev_env.js';
|
|
|
34
34
|
* @module
|
|
35
35
|
*/
|
|
36
36
|
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
37
|
-
import type {
|
|
37
|
+
import type { RoleRegistry } from '../../auth/role_schema.js';
|
|
38
38
|
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
39
39
|
import { type RpcSuccessFixtures } from '../rpc_round_trip.js';
|
|
40
40
|
import type { RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
@@ -70,10 +70,10 @@ export interface StandardCrossProcessTestOptions {
|
|
|
70
70
|
*/
|
|
71
71
|
rpc_endpoints: RpcEndpointsSuiteOption;
|
|
72
72
|
/**
|
|
73
|
-
* Role
|
|
73
|
+
* Role registry from `create_role_registry()`.
|
|
74
74
|
* When provided, the admin integration suite is included.
|
|
75
75
|
*/
|
|
76
|
-
roles?:
|
|
76
|
+
roles?: RoleRegistry;
|
|
77
77
|
/**
|
|
78
78
|
* Path prefix where admin routes are mounted.
|
|
79
79
|
* Default `'/api/admin'`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/standard.ts"],"names":[],"mappings":"AAA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AAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1C;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,GAAG,CAC1B,MAAM,EACN,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CACnF,CAAC;CACF;AAED;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,GACjD,SAAS,+BAA+B,KACtC,IAuCF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/token_lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/token_lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4E9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC7C,wEAAwE;IACxE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAsBD,eAAO,MAAM,mCAAmC,GAC/C,SAAS,6BAA6B,KACpC,IAmVF,CAAC"}
|
|
@@ -32,6 +32,15 @@ import '../assert_dev_env.js';
|
|
|
32
32
|
* mints and reads back whole, and one unit past it is `invalid_params`,
|
|
33
33
|
* with an astral-plane name at each side of the boundary so the two spines
|
|
34
34
|
* count the same unit.
|
|
35
|
+
* - **The scope cap** — `MAX_TOKEN_SCOPE_BYTES` counts UTF-8 bytes of the
|
|
36
|
+
* compact document on both spines, at mint and at read: a two-byte scope at
|
|
37
|
+
* the cap mints, authenticates as a bearer for a method it lists, and lists
|
|
38
|
+
* as `N methods`, though Postgres prints it past the cap, and so does an
|
|
39
|
+
* ASCII scope under the cap whose printed text is past it; one byte past the
|
|
40
|
+
* cap, far under it in UTF-16 code units, is `invalid_params` with
|
|
41
|
+
* `ERROR_TOKEN_SCOPE_INVALID`. A spine counting code units mints the one
|
|
42
|
+
* past the cap, and one measuring the printed `scope::text` fails the
|
|
43
|
+
* others closed — `unreadable` in the list, an anonymous bearer.
|
|
35
44
|
* - **A token sent beside a winning daemon token is never used** — the
|
|
36
45
|
* credential legs run daemon token → session cookie → bearer on both
|
|
37
46
|
* spines, the first that authenticates winning, so a request carrying the
|
|
@@ -49,7 +58,9 @@ import '../assert_dev_env.js';
|
|
|
49
58
|
* @module
|
|
50
59
|
*/
|
|
51
60
|
import { describe, test, assert } from 'vitest';
|
|
52
|
-
import { account_token_create_action_spec, account_token_list_action_spec, API_TOKEN_NAME_LENGTH_MAX, TokenCreateOutput, TokenListOutput } from '../../auth/account_action_specs.js';
|
|
61
|
+
import { account_token_create_action_spec, account_token_list_action_spec, API_TOKEN_NAME_LENGTH_MAX, ERROR_TOKEN_SCOPE_INVALID, TokenCreateOutput, TokenListOutput } from '../../auth/account_action_specs.js';
|
|
62
|
+
import { MAX_TOKEN_SCOPE_BYTES } from '../../auth/token_scope.js';
|
|
63
|
+
import { token_scope_methods_at_bytes } from '../token_scope_fixtures.js';
|
|
53
64
|
import { DAEMON_TOKEN_HEADER } from '../../auth/daemon_token.js';
|
|
54
65
|
import { cross_rpc_call, error_reason, expect_output } from './cross_rpc.js';
|
|
55
66
|
import { assert_iso8601_seconds } from './wire_shapes.js';
|
|
@@ -111,6 +122,28 @@ export const describe_token_lifetime_cross_tests = (options) => {
|
|
|
111
122
|
assert.ok(row, 'the minted token must appear in account_token_list');
|
|
112
123
|
assert.strictEqual(row.expires_at, null, 'the stored token must be eternal');
|
|
113
124
|
});
|
|
125
|
+
test('the scope cap counts compact UTF-8 bytes at mint and at read', async () => {
|
|
126
|
+
const fixture = await setup_test();
|
|
127
|
+
const two_byte = '\u00e9'.repeat(40);
|
|
128
|
+
const mint = (name, methods) => cross_rpc_call(fixture.transport, rpc_path, account_token_create_action_spec.method, { name, scope: { kind: 'methods', methods }, lifetime: { kind: 'eternal' } }, fixture.create_session_headers());
|
|
129
|
+
const admitted = [
|
|
130
|
+
['at-cap', token_scope_methods_at_bytes(MAX_TOKEN_SCOPE_BYTES, two_byte)],
|
|
131
|
+
['spaced', token_scope_methods_at_bytes(MAX_TOKEN_SCOPE_BYTES - 50, 'm')]
|
|
132
|
+
];
|
|
133
|
+
const listed_labels = new Map();
|
|
134
|
+
for (const [name, methods] of admitted) {
|
|
135
|
+
const minted = expect_output(await mint(name, methods), TokenCreateOutput);
|
|
136
|
+
// the resolve path reads the stored scope: the token lists its account's tokens
|
|
137
|
+
const listed = expect_output(await cross_rpc_call(fixture.fresh_transport({ origin: null }), rpc_path, account_token_list_action_spec.method, undefined, { authorization: `Bearer ${minted.token}` }), TokenListOutput);
|
|
138
|
+
for (const t of listed.tokens)
|
|
139
|
+
listed_labels.set(t.id, t.scope);
|
|
140
|
+
assert.strictEqual(listed_labels.get(minted.id), `${methods.length} methods`, `${name}: the stored scope reads back on the list`);
|
|
141
|
+
}
|
|
142
|
+
const res = await mint('over-cap', token_scope_methods_at_bytes(MAX_TOKEN_SCOPE_BYTES + 1, two_byte));
|
|
143
|
+
assert.ok(!res.ok, 'a scope one byte past the cap must be refused');
|
|
144
|
+
assert.strictEqual(res.error?.code, -32602, JSON.stringify(res.error));
|
|
145
|
+
assert.strictEqual(error_reason(res), ERROR_TOKEN_SCOPE_INVALID);
|
|
146
|
+
});
|
|
114
147
|
test('a token sent beside a winning daemon token is never used', async () => {
|
|
115
148
|
const fixture = await setup_test();
|
|
116
149
|
/** Mint a token on the keeper over its session. */
|
|
@@ -13,7 +13,9 @@ export interface TestAccountWithActor {
|
|
|
13
13
|
* so suites that don't exercise password verification can stay terse.
|
|
14
14
|
* Replaces the per-file `create_user` / `create_test_actor` /
|
|
15
15
|
* `create_test_account` helpers that had accumulated across the auth
|
|
16
|
-
* test suite.
|
|
16
|
+
* test suite. The username is stored lowercased, as every production
|
|
17
|
+
* creation path stores it and the `account_username_lowercase` CHECK
|
|
18
|
+
* requires.
|
|
17
19
|
*/
|
|
18
20
|
export declare const create_test_account_with_actor: (db: Db, options: {
|
|
19
21
|
username: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db_entities.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/db_entities.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA0B7B,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,oFAAoF;AACpF,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;CACb;AAED
|
|
1
|
+
{"version":3,"file":"db_entities.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/db_entities.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA0B7B,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,oFAAoF;AACpF,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;CACb;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,GAC1C,IAAI,EAAE,EACN,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,KACnD,OAAO,CAAC,oBAAoB,CAI7B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,6BAA6B,GACzC,IAAI,EAAE,EACN,OAAO,oBAAoB,KACzB,OAAO,CAAC,SAAS,CAA2C,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,uBAAuB,GACnC,IAAI,EAAE,EACN,YAAY,MAAM,EAClB,MAAM,MAAM,KACV,OAAO,CAAC,KAAK,CAWf,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAU,IAAI,EAAE,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CACvC,CAAC"}
|
|
@@ -25,9 +25,11 @@ import { query_create_role_grant } from '../auth/role_grant_queries.js';
|
|
|
25
25
|
* so suites that don't exercise password verification can stay terse.
|
|
26
26
|
* Replaces the per-file `create_user` / `create_test_actor` /
|
|
27
27
|
* `create_test_account` helpers that had accumulated across the auth
|
|
28
|
-
* test suite.
|
|
28
|
+
* test suite. The username is stored lowercased, as every production
|
|
29
|
+
* creation path stores it and the `account_username_lowercase` CHECK
|
|
30
|
+
* requires.
|
|
29
31
|
*/
|
|
30
|
-
export const create_test_account_with_actor = async (db, options) => query_create_account_with_actor({ db }, { username: options.username, password_hash: options.password_hash ?? 'hash' });
|
|
32
|
+
export const create_test_account_with_actor = async (db, options) => query_create_account_with_actor({ db }, { username: options.username.toLowerCase(), password_hash: options.password_hash ?? 'hash' });
|
|
31
33
|
/**
|
|
32
34
|
* Materialize a `role_grant` directly via `query_create_role_grant`,
|
|
33
35
|
* bypassing the production offer/accept consent flow.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAuB7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAkB1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAK1D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;;;;;;OASG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,kEAAkE;IAClE,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;OAIG;IACH,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IA28CF,CAAC"}
|
|
@@ -17,6 +17,7 @@ import './assert_dev_env.js';
|
|
|
17
17
|
* @module
|
|
18
18
|
*/
|
|
19
19
|
import { describe, test, assert, afterAll } from 'vitest';
|
|
20
|
+
import { parse_or_throw } from '@fuzdev/fuz_schema/schema.ts';
|
|
20
21
|
import { find_auth_route, assert_response_matches_spec, assert_no_error_info_leakage } from './integration_helpers.js';
|
|
21
22
|
import { find_rpc_action, rpc_call_for_spec, require_rpc_endpoint_path, resolve_rpc_endpoints_for_setup } from './rpc_helpers.js';
|
|
22
23
|
import { ErrorCoverageCollector, assert_error_coverage, DEFAULT_INTEGRATION_ERROR_COVERAGE } from './error_coverage.js';
|
|
@@ -291,7 +292,7 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
291
292
|
assert.strictEqual(res.status, 200);
|
|
292
293
|
const body = await res.json();
|
|
293
294
|
// Throws on any extra or missing field — drift on either backend fails.
|
|
294
|
-
LoginOutput
|
|
295
|
+
parse_or_throw(LoginOutput, body);
|
|
295
296
|
});
|
|
296
297
|
});
|
|
297
298
|
// --- 1b. Account status body (strict schema) ---
|
|
@@ -329,11 +330,11 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
329
330
|
`capability but doesn't mount the route.`);
|
|
330
331
|
const body = await res.json();
|
|
331
332
|
// Throws on any extra/missing field across account/actor/role_grants.
|
|
332
|
-
const parsed = AccountStatusOutput
|
|
333
|
+
const parsed = parse_or_throw(AccountStatusOutput, body);
|
|
333
334
|
// Single-actor keeper: actor resolved, role_grants populated.
|
|
334
335
|
assert.ok(parsed.actor, 'single-actor keeper must resolve a non-null actor');
|
|
335
336
|
assert.ok(parsed.role_grants.length > 0, 'single-actor keeper must have populated role_grants');
|
|
336
|
-
// Byte-shape gate: `
|
|
337
|
+
// Byte-shape gate: `iso_datetime` accepts a millisecond stamp too,
|
|
337
338
|
// so the schema parse above can't tell the two spines apart.
|
|
338
339
|
assert_iso8601_seconds(parsed.account.created_at, 'account.created_at');
|
|
339
340
|
for (const grant of parsed.role_grants) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The UTF-8 byte length of the compact JSON of a `methods` scope over
|
|
4
|
+
* `methods`, the unit `MAX_TOKEN_SCOPE_BYTES` counts. Method order changes the
|
|
5
|
+
* document, not its length.
|
|
6
|
+
*
|
|
7
|
+
* @param methods - the scope's method names
|
|
8
|
+
* @returns the byte length of `JSON.stringify(token_scope_methods(methods))`
|
|
9
|
+
*/
|
|
10
|
+
export declare const token_scope_methods_bytes: (methods: Array<string>) => number;
|
|
11
|
+
/**
|
|
12
|
+
* Method names whose `methods` scope document is exactly `bytes` compact UTF-8
|
|
13
|
+
* bytes: `account_token_list` (so a token over it can list its own account's
|
|
14
|
+
* tokens), names `scope_cap_<i>_<filler>` while they fit, and an ASCII pad of
|
|
15
|
+
* `x`s. A multibyte `filler` makes a document far under `bytes` in UTF-16 code
|
|
16
|
+
* units. The names hold no `:` or `,`, so the printed `jsonb` text has exactly
|
|
17
|
+
* one more byte per separator.
|
|
18
|
+
*
|
|
19
|
+
* @param bytes - the compact document's size; at least that of the first name alone
|
|
20
|
+
* @param filler - the tail of every name but the first and the pad
|
|
21
|
+
* @returns distinct method names, sorted, as the Rust spine stores them
|
|
22
|
+
*/
|
|
23
|
+
export declare const token_scope_methods_at_bytes: (bytes: number, filler: string) => Array<string>;
|
|
24
|
+
//# sourceMappingURL=token_scope_fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token_scope_fixtures.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/token_scope_fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAkB7B;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,KAAK,CAAC,MAAM,CAAC,KAAG,MACL,CAAC;AAE/D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,KAAK,CAAC,MAAM,CAWxF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Token-scope documents built to a size, for the tests of
|
|
4
|
+
* `MAX_TOKEN_SCOPE_BYTES` — hono-free, so the cross-process suites import it.
|
|
5
|
+
*
|
|
6
|
+
* The cap counts UTF-8 bytes of a document's compact JSON on both spines.
|
|
7
|
+
* `token_scope_methods_at_bytes` builds the method list whose `methods`
|
|
8
|
+
* document is exactly a given size, the same list the Rust spine's tests
|
|
9
|
+
* build, so a boundary pinned on one spine is the boundary on the other.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { to_bytes } from '@fuzdev/fuz_util/bytes.ts';
|
|
14
|
+
import { token_scope_methods } from '../auth/token_scope.js';
|
|
15
|
+
/**
|
|
16
|
+
* The UTF-8 byte length of the compact JSON of a `methods` scope over
|
|
17
|
+
* `methods`, the unit `MAX_TOKEN_SCOPE_BYTES` counts. Method order changes the
|
|
18
|
+
* document, not its length.
|
|
19
|
+
*
|
|
20
|
+
* @param methods - the scope's method names
|
|
21
|
+
* @returns the byte length of `JSON.stringify(token_scope_methods(methods))`
|
|
22
|
+
*/
|
|
23
|
+
export const token_scope_methods_bytes = (methods) => to_bytes(JSON.stringify(token_scope_methods(methods))).length;
|
|
24
|
+
/**
|
|
25
|
+
* Method names whose `methods` scope document is exactly `bytes` compact UTF-8
|
|
26
|
+
* bytes: `account_token_list` (so a token over it can list its own account's
|
|
27
|
+
* tokens), names `scope_cap_<i>_<filler>` while they fit, and an ASCII pad of
|
|
28
|
+
* `x`s. A multibyte `filler` makes a document far under `bytes` in UTF-16 code
|
|
29
|
+
* units. The names hold no `:` or `,`, so the printed `jsonb` text has exactly
|
|
30
|
+
* one more byte per separator.
|
|
31
|
+
*
|
|
32
|
+
* @param bytes - the compact document's size; at least that of the first name alone
|
|
33
|
+
* @param filler - the tail of every name but the first and the pad
|
|
34
|
+
* @returns distinct method names, sorted, as the Rust spine stores them
|
|
35
|
+
*/
|
|
36
|
+
export const token_scope_methods_at_bytes = (bytes, filler) => {
|
|
37
|
+
const methods = ['account_token_list'];
|
|
38
|
+
for (let i = 0;; i++) {
|
|
39
|
+
const next = `scope_cap_${String(i).padStart(3, '0')}_${filler}`;
|
|
40
|
+
if (token_scope_methods_bytes([...methods, next, '']) > bytes)
|
|
41
|
+
break;
|
|
42
|
+
methods.push(next);
|
|
43
|
+
}
|
|
44
|
+
const pad = bytes - token_scope_methods_bytes([...methods, '']);
|
|
45
|
+
if (pad < 0)
|
|
46
|
+
throw new Error(`no methods document is ${bytes} bytes`);
|
|
47
|
+
methods.push('x'.repeat(pad));
|
|
48
|
+
return methods;
|
|
49
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import { Uuid } from '../../
|
|
2
|
+
import { Uuid } from '../../primitive_schemas_fuz.js';
|
|
3
3
|
import type { BackendConfig } from '../cross_backend/backend_config.js';
|
|
4
4
|
import type { FetchTransport } from './fetch_transport.js';
|
|
5
5
|
/** Input for `bootstrap()`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/transports/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/transports/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwB9B,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAGtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAe3D,+BAA+B;AAC/B,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAC/B;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;KAAE,CAAC;IACtC,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,eAAe,CA8BlF,CAAC"}
|
|
@@ -18,19 +18,20 @@ import '../assert_dev_env.js';
|
|
|
18
18
|
*
|
|
19
19
|
* @module
|
|
20
20
|
*/
|
|
21
|
-
import {
|
|
22
|
-
import { Uuid } from '../../
|
|
21
|
+
import { parse, string, strip_object } from '@fuzdev/fuz_schema/schema.ts';
|
|
22
|
+
import { Uuid } from '../../primitive_schemas_fuz.js';
|
|
23
|
+
import { format_issues } from '../../schema_issues.js';
|
|
23
24
|
/**
|
|
24
25
|
* The `BootstrapOutput` envelope shape the cross-process bootstrap call
|
|
25
|
-
* cares about. Looser than the full `BootstrapOutput`
|
|
26
|
-
* `auth/
|
|
26
|
+
* cares about. Looser than the full `BootstrapOutput` schema in
|
|
27
|
+
* `auth/bootstrap_route_schema.ts` — that schema is the canonical wire shape
|
|
27
28
|
* on the server side, and this one is a structural subset the runner
|
|
28
29
|
* uses to extract the keeper identity. Kept local so cross-process
|
|
29
30
|
* testing doesn't pull the full auth-domain schema into its dep graph.
|
|
30
31
|
*/
|
|
31
|
-
const BootstrapResponse =
|
|
32
|
-
account:
|
|
33
|
-
actor:
|
|
32
|
+
const BootstrapResponse = strip_object({
|
|
33
|
+
account: strip_object({ id: Uuid, username: string }),
|
|
34
|
+
actor: strip_object({ id: Uuid })
|
|
34
35
|
});
|
|
35
36
|
/**
|
|
36
37
|
* Fire `POST {config.bootstrap_path}` and capture the keeper session.
|
|
@@ -57,14 +58,14 @@ export const bootstrap = async (options) => {
|
|
|
57
58
|
throw new Error(`bootstrap(${config.name}) failed: status=${response.status} body=${body}`);
|
|
58
59
|
}
|
|
59
60
|
const raw = await response.json();
|
|
60
|
-
const parsed = BootstrapResponse
|
|
61
|
-
if (!parsed.
|
|
62
|
-
throw new Error(`bootstrap(${config.name}) returned unexpected body: ${JSON.stringify(raw)} (${parsed.
|
|
61
|
+
const parsed = parse(BootstrapResponse, raw);
|
|
62
|
+
if (!parsed.ok) {
|
|
63
|
+
throw new Error(`bootstrap(${config.name}) returned unexpected body: ${JSON.stringify(raw)} (${format_issues(parsed.issues)})`);
|
|
63
64
|
}
|
|
64
65
|
return {
|
|
65
66
|
transport,
|
|
66
|
-
account: parsed.
|
|
67
|
-
actor: parsed.
|
|
67
|
+
account: parsed.value.account,
|
|
68
|
+
actor: parsed.value.actor,
|
|
68
69
|
cookies: transport.cookies()
|
|
69
70
|
};
|
|
70
71
|
};
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
import { resolve } from '$app/paths';
|
|
17
17
|
import PendingButton from '@fuzdev/fuz_ui/PendingButton.svelte';
|
|
18
18
|
import { autofocus } from '@fuzdev/fuz_ui/autofocus.svelte.ts';
|
|
19
|
+
import { is } from '@fuzdev/fuz_schema/schema.ts';
|
|
19
20
|
|
|
20
|
-
import {
|
|
21
|
+
import { USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN } from '../primitive_schemas.js';
|
|
22
|
+
import { Username } from '../primitive_schemas_fuz.js';
|
|
21
23
|
import { PASSWORD_LENGTH_MIN } from '../auth/password.js';
|
|
22
24
|
import { auth_state_context } from './auth_state.svelte.js';
|
|
23
25
|
import { FormState } from './form_state.svelte.js';
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
let password = $state.raw('');
|
|
41
43
|
let password_confirm = $state.raw('');
|
|
42
44
|
|
|
43
|
-
const username_valid = $derived(Username
|
|
45
|
+
const username_valid = $derived(is(Username, username));
|
|
44
46
|
const passwords_match = $derived(password === password_confirm);
|
|
45
47
|
const can_submit = $derived(
|
|
46
48
|
token.trim() &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BootstrapForm.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/BootstrapForm.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BootstrapForm.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/BootstrapForm.svelte"],"names":[],"mappings":"AA2BC,KAAK,gBAAgB,GAAI;IACxB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AA4GH,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
import { resolve } from '$app/paths';
|
|
16
16
|
import PendingButton from '@fuzdev/fuz_ui/PendingButton.svelte';
|
|
17
17
|
import { autofocus } from '@fuzdev/fuz_ui/autofocus.svelte.ts';
|
|
18
|
+
import { is } from '@fuzdev/fuz_schema/schema.ts';
|
|
18
19
|
|
|
19
|
-
import {
|
|
20
|
+
import { USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN } from '../primitive_schemas.js';
|
|
21
|
+
import { Username } from '../primitive_schemas_fuz.js';
|
|
20
22
|
import { PASSWORD_LENGTH_MIN } from '../auth/password.js';
|
|
21
23
|
import { auth_state_context } from './auth_state.svelte.js';
|
|
22
24
|
import { FormState } from './form_state.svelte.js';
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
let password = $state.raw('');
|
|
40
42
|
let password_confirm = $state.raw('');
|
|
41
43
|
|
|
42
|
-
const username_valid = $derived(Username
|
|
44
|
+
const username_valid = $derived(is(Username, username));
|
|
43
45
|
const passwords_match = $derived(password === password_confirm);
|
|
44
46
|
const can_submit = $derived(
|
|
45
47
|
username.trim() && username_valid && password.length >= PASSWORD_LENGTH_MIN && passwords_match
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignupForm.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/SignupForm.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignupForm.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/SignupForm.svelte"],"names":[],"mappings":"AA0BC,KAAK,gBAAgB,GAAI;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAuGH,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
package/dist/zod.d.ts
CHANGED
|
@@ -48,7 +48,8 @@ export declare const zod_get_schema_layers: (schema: z.ZodType) => Array<z.ZodTy
|
|
|
48
48
|
export declare const zod_get_schema_keys: <T extends z.ZodType>(schema: T) => Array<keyof z.infer<T> & string>;
|
|
49
49
|
/**
|
|
50
50
|
* Get the field schema for a key in an object schema, returning `undefined` if
|
|
51
|
-
* the schema is not an object or the key is
|
|
51
|
+
* the schema is not an object or the key is not one of its own fields (a name
|
|
52
|
+
* the shape only inherits, such as `constructor` or `toString`, included).
|
|
52
53
|
*
|
|
53
54
|
* @param schema - Zod schema (typically a `ZodObject` with possible wrappers)
|
|
54
55
|
* @param key - the property name
|
package/dist/zod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/zod.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQ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