@fuzdev/fuz_app 0.165.0 → 0.166.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/actions/CLAUDE.md +2 -2
- package/dist/actions/action_event_data.d.ts +1 -1
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +24 -15
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/perform_action.d.ts +2 -1
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/auth/account_action_specs.d.ts +8 -8
- package/dist/auth/account_route_schema.d.ts +197 -164
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +19 -17
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +285 -294
- package/dist/auth/admin_action_specs.d.ts +64 -64
- package/dist/auth/audit_log_route_schema.d.ts +16 -8
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +4 -3
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +112 -111
- package/dist/auth/audit_log_schema.d.ts +22 -22
- package/dist/auth/bootstrap_route_schema.d.ts +46 -69
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +8 -7
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +100 -98
- package/dist/auth/role_grant_offer_action_specs.d.ts +4 -4
- package/dist/auth/signup_route_schema.d.ts +9 -4
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +5 -3
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +170 -170
- package/dist/http/CLAUDE.md +48 -3
- package/dist/http/common_routes.d.ts +1 -1
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +13 -11
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +25 -28
- package/dist/http/error_schemas.d.ts +5 -1
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +5 -1
- package/dist/http/route_result.d.ts +101 -0
- package/dist/http/route_result.d.ts.map +1 -0
- package/dist/http/route_result.js +56 -0
- package/dist/http/route_spec.d.ts +110 -6
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +82 -14
- package/dist/rate_limiter.d.ts +0 -9
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +0 -15
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +23 -21
- package/dist/server/surface_route.d.ts +1 -1
- package/dist/server/surface_route.d.ts.map +1 -1
- package/dist/server/surface_route.js +4 -2
- package/dist/testing/CLAUDE.md +5 -3
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +12 -7
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +3 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +2 -6
- package/dist/testing/stubs.d.ts +14 -3
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +21 -6
- package/package.json +1 -1
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Split from `bootstrap_routes.ts` so the route's declared shape (method,
|
|
5
5
|
* path, auth, input/output/error schemas) is importable **without** the
|
|
6
6
|
* hono-coupled handler (which sets a session cookie and reads the client
|
|
7
|
-
* IP off the Hono context). `create_bootstrap_route_specs`
|
|
8
|
-
* `bootstrap_route_shape`
|
|
9
|
-
* builder (`create_test_app_surface_spec`)
|
|
7
|
+
* IP off the Hono context). `create_bootstrap_route_specs` attaches the live
|
|
8
|
+
* handler to `bootstrap_route_shape` (`attach_route_handler`); the test surface
|
|
9
|
+
* builder (`create_test_app_surface_spec`) attaches a stub handler so
|
|
10
10
|
* attack-surface generation reads the real shape without pulling the
|
|
11
11
|
* in-process Hono app onto cross-process consumers. Single source of truth —
|
|
12
12
|
* the shape can't drift between the live route and the surface.
|
|
@@ -17,6 +17,7 @@ import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
|
17
17
|
import { literal, max_length, min_length, object, pipe, string } from '@fuzdev/fuz_schema/schema.ts';
|
|
18
18
|
import { Username, UsernameCanonical, Uuid } from '../primitive_schemas_fuz.js';
|
|
19
19
|
import { Password } from './password.js';
|
|
20
|
+
import { define_route_shape } from '../http/route_spec.js';
|
|
20
21
|
import { REST_ALREADY_BOOTSTRAPPED, REST_INVALID_TOKEN, REST_TOKEN_FILE_MISSING } from '../http/error_schemas.js';
|
|
21
22
|
/**
|
|
22
23
|
* The longest `token` `POST /bootstrap` takes, in UTF-16 code units: the token
|
|
@@ -52,11 +53,11 @@ export const BootstrapOutput = object({
|
|
|
52
53
|
});
|
|
53
54
|
/**
|
|
54
55
|
* The `POST /bootstrap` route shape minus its handler — pure hono-free data.
|
|
55
|
-
* `create_bootstrap_route_specs`
|
|
56
|
-
* surface generation
|
|
56
|
+
* `create_bootstrap_route_specs` attaches the live handler to it
|
|
57
|
+
* (`attach_route_handler`); surface generation attaches a stub (handlers are never run
|
|
57
58
|
* during surface assembly, only the shape is read).
|
|
58
59
|
*/
|
|
59
|
-
export const bootstrap_route_shape = {
|
|
60
|
+
export const bootstrap_route_shape = define_route_shape({
|
|
60
61
|
method: 'POST',
|
|
61
62
|
path: '/bootstrap',
|
|
62
63
|
auth: { account: 'none', actor: 'none' },
|
|
@@ -67,4 +68,4 @@ export const bootstrap_route_shape = {
|
|
|
67
68
|
output: BootstrapOutput,
|
|
68
69
|
rate_limit: 'ip',
|
|
69
70
|
errors: [REST_INVALID_TOKEN, REST_ALREADY_BOOTSTRAPPED, REST_TOKEN_FILE_MISSING]
|
|
70
|
-
};
|
|
71
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bootstrap_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"bootstrap_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bootstrap_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAI9F,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAUlD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACrC,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,8EAA8E;IAC9E,gBAAgB,EAAE,eAAe,CAAC;IAClC;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E;;;;;;;;;;OAUG;IACH,yBAAyB,EAAE,WAAW,GAAG,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,kFAAkF;IAClF,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACxD,+EAA+E;IAC/E,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,wBAAwB,EAC9B,SAAS;IAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,KACpC,OAAO,CAAC,eAAe,CAyBzB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,gBAAgB,EACtB,SAAS,qBAAqB,KAC5B,KAAK,CAAC,SAAS,CA6HjB,CAAC"}
|
|
@@ -10,11 +10,12 @@ import { to_error_message } from '@fuzdev/fuz_util/error.ts';
|
|
|
10
10
|
import { create_session_and_set_cookie } from './session_middleware.js';
|
|
11
11
|
import { bootstrap_account, read_bootstrap_token } from './bootstrap_account.js';
|
|
12
12
|
import { bootstrap_route_shape } from './bootstrap_route_schema.js';
|
|
13
|
-
import { get_route_input } from '../http/route_spec.js';
|
|
13
|
+
import { attach_route_handler, get_route_input } from '../http/route_spec.js';
|
|
14
|
+
import { route_fail, route_ok } from '../http/route_result.js';
|
|
14
15
|
import { get_client_ip } from '../http/client_ip.js';
|
|
15
16
|
import { rate_limit_ip_key } from '../http/ip_canonical.js';
|
|
16
|
-
import {
|
|
17
|
-
import { ERROR_ALREADY_BOOTSTRAPPED, ERROR_TOKEN_FILE_MISSING } from '../http/error_schemas.js';
|
|
17
|
+
import { reserve_optional } from '../rate_limiter.js';
|
|
18
|
+
import { ERROR_ALREADY_BOOTSTRAPPED, ERROR_TOKEN_FILE_MISSING, REST_ALREADY_BOOTSTRAPPED, REST_INVALID_TOKEN, REST_RATE_LIMIT_EXCEEDED, REST_TOKEN_FILE_MISSING } from '../http/error_schemas.js';
|
|
18
19
|
/**
|
|
19
20
|
* Check bootstrap availability at startup.
|
|
20
21
|
*
|
|
@@ -68,107 +69,108 @@ export const create_bootstrap_route_specs = (deps, options) => {
|
|
|
68
69
|
const { session_options, bootstrap_status, on_bootstrap, bootstrap_ip_rate_limiter } = options;
|
|
69
70
|
const { token_path } = bootstrap_status;
|
|
70
71
|
return [
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
bootstrap_status.available = false;
|
|
116
|
-
ip_reserved.reservation.record();
|
|
117
|
-
await deps.audit.emit(route, {
|
|
118
|
-
event_type: 'bootstrap',
|
|
119
|
-
outcome: 'failure',
|
|
120
|
-
ip: get_client_ip(c),
|
|
121
|
-
metadata: { error: result.error }
|
|
122
|
-
});
|
|
123
|
-
return c.json({ error: result.error }, result.status);
|
|
124
|
-
}
|
|
125
|
-
// Successful bootstrap — update state immediately. Nothing is
|
|
126
|
-
// reset: bootstrap has no account-grain bucket to forgive (it
|
|
127
|
-
// predates any account), and the IP bucket is never refunded on
|
|
128
|
-
// success (see `RateLimiter.reset`). So this is the one auth
|
|
129
|
-
// surface where a success clears nothing at all. Bootstrap is
|
|
130
|
-
// one-shot, so at most `max_attempts - 1` residual entries
|
|
131
|
-
// survive — and they sit on this route's own limiter, not
|
|
132
|
-
// login's, so a fumbled token can't spend the operator's login
|
|
133
|
-
// budget on a deployment where their account is the only one.
|
|
134
|
-
bootstrap_status.available = false;
|
|
135
|
-
await create_session_and_set_cookie({
|
|
136
|
-
keyring,
|
|
137
|
-
deps: { db: route.db },
|
|
138
|
-
c,
|
|
139
|
-
account_id: result.account.id,
|
|
140
|
-
session_options
|
|
141
|
-
});
|
|
142
|
-
if (on_bootstrap) {
|
|
143
|
-
try {
|
|
144
|
-
await on_bootstrap(result, c);
|
|
145
|
-
}
|
|
146
|
-
catch (err) {
|
|
147
|
-
deps.log.error(`on_bootstrap callback failed: ${to_error_message(err)}`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
72
|
+
attach_route_handler(bootstrap_route_shape, async (c, route) => {
|
|
73
|
+
// Short-circuit if bootstrap already completed or surface-only mounted.
|
|
74
|
+
// In 'surface_only' mode `bootstrap_status.token_path === null` and
|
|
75
|
+
// `available === false`; in 'live' mode after success `available` flips
|
|
76
|
+
// to `false`. Either way the wire shape is 403 ALREADY_BOOTSTRAPPED.
|
|
77
|
+
if (!bootstrap_status.available || token_path === null) {
|
|
78
|
+
return route_fail(REST_ALREADY_BOOTSTRAPPED);
|
|
79
|
+
}
|
|
80
|
+
// Per-IP rate limit (before any token/DB work). Reserved, not
|
|
81
|
+
// checked: the attempt counts against the cap until it settles, so
|
|
82
|
+
// a concurrent burst of token guesses can't all pass before any of
|
|
83
|
+
// it records. The `finally` releases it unless a failure recorded it.
|
|
84
|
+
// keyed by the address's rate-limit key (an IPv6 client's /64)
|
|
85
|
+
const ip_key = bootstrap_ip_rate_limiter ? rate_limit_ip_key(get_client_ip(c)) : null;
|
|
86
|
+
const ip_reserved = await reserve_optional(bootstrap_ip_rate_limiter, ip_key, {
|
|
87
|
+
signal: c.req.raw.signal
|
|
88
|
+
});
|
|
89
|
+
if (!ip_reserved.ok) {
|
|
90
|
+
return route_fail(REST_RATE_LIMIT_EXCEEDED, { retry_after: ip_reserved.retry_after });
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const input = get_route_input(c);
|
|
94
|
+
// `transaction: false` makes `route.db` the pool. `bootstrap_account`
|
|
95
|
+
// manages its own transaction internally.
|
|
96
|
+
const result = await bootstrap_account({
|
|
97
|
+
db: route.db,
|
|
98
|
+
token_path,
|
|
99
|
+
read_secure_file: deps.read_secure_file,
|
|
100
|
+
delete_file: deps.delete_file,
|
|
101
|
+
password: deps.password,
|
|
102
|
+
log: deps.log
|
|
103
|
+
}, input.token, input);
|
|
104
|
+
if (!result.ok) {
|
|
105
|
+
// An unreadable token file closes the window. Bootstrap cannot
|
|
106
|
+
// succeed without one, and `check_bootstrap_status` already reads
|
|
107
|
+
// an unreadable file as unavailable at startup — so leaving the
|
|
108
|
+
// flag set means the two disagree, and every later request takes
|
|
109
|
+
// this leg and writes another audit row. The limiter would bound
|
|
110
|
+
// that channel; closing it ends it, and stops `/status`
|
|
111
|
+
// advertising a window that can't be walked through. Twin of the
|
|
112
|
+
// Rust spine's `bootstrap_handler`, which does the same.
|
|
113
|
+
if (result.error === ERROR_TOKEN_FILE_MISSING)
|
|
114
|
+
bootstrap_status.available = false;
|
|
115
|
+
ip_reserved.reservation.record();
|
|
150
116
|
await deps.audit.emit(route, {
|
|
151
117
|
event_type: 'bootstrap',
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
118
|
+
outcome: 'failure',
|
|
119
|
+
ip: get_client_ip(c),
|
|
120
|
+
metadata: { error: result.error }
|
|
155
121
|
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
122
|
+
return route_fail(result.error === ERROR_ALREADY_BOOTSTRAPPED
|
|
123
|
+
? REST_ALREADY_BOOTSTRAPPED
|
|
124
|
+
: result.error === ERROR_TOKEN_FILE_MISSING
|
|
125
|
+
? REST_TOKEN_FILE_MISSING
|
|
126
|
+
: REST_INVALID_TOKEN);
|
|
127
|
+
}
|
|
128
|
+
// Successful bootstrap — update state immediately. Nothing is
|
|
129
|
+
// reset: bootstrap has no account-grain bucket to forgive (it
|
|
130
|
+
// predates any account), and the IP bucket is never refunded on
|
|
131
|
+
// success (see `RateLimiter.reset`). So this is the one auth
|
|
132
|
+
// surface where a success clears nothing at all. Bootstrap is
|
|
133
|
+
// one-shot, so at most `max_attempts - 1` residual entries
|
|
134
|
+
// survive — and they sit on this route's own limiter, not
|
|
135
|
+
// login's, so a fumbled token can't spend the operator's login
|
|
136
|
+
// budget on a deployment where their account is the only one.
|
|
137
|
+
bootstrap_status.available = false;
|
|
138
|
+
await create_session_and_set_cookie({
|
|
139
|
+
keyring,
|
|
140
|
+
deps: { db: route.db },
|
|
141
|
+
c,
|
|
142
|
+
account_id: result.account.id,
|
|
143
|
+
session_options
|
|
144
|
+
});
|
|
145
|
+
if (on_bootstrap) {
|
|
146
|
+
try {
|
|
147
|
+
await on_bootstrap(result, c);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
deps.log.error(`on_bootstrap callback failed: ${to_error_message(err)}`);
|
|
161
151
|
}
|
|
162
|
-
return c.json({
|
|
163
|
-
ok: true,
|
|
164
|
-
account: { id: result.account.id, username: result.account.username },
|
|
165
|
-
actor: { id: result.actor.id }
|
|
166
|
-
});
|
|
167
152
|
}
|
|
168
|
-
|
|
169
|
-
|
|
153
|
+
await deps.audit.emit(route, {
|
|
154
|
+
event_type: 'bootstrap',
|
|
155
|
+
actor_id: result.actor.id,
|
|
156
|
+
account_id: result.account.id,
|
|
157
|
+
ip: get_client_ip(c)
|
|
158
|
+
});
|
|
159
|
+
// CRITICAL: If token file deletion failed, throw to force operator attention.
|
|
160
|
+
// All success work (session, on_bootstrap, audit) has completed above.
|
|
161
|
+
// The error response alerts the operator to delete the token file manually.
|
|
162
|
+
if (!result.token_file_deleted) {
|
|
163
|
+
throw new Error(`Bootstrap succeeded but token file was not deleted at ${token_path}. Delete it manually and log in.`);
|
|
170
164
|
}
|
|
165
|
+
return route_ok({
|
|
166
|
+
ok: true,
|
|
167
|
+
account: { id: result.account.id, username: result.account.username },
|
|
168
|
+
actor: { id: result.actor.id }
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
ip_reserved.reservation.release();
|
|
171
173
|
}
|
|
172
|
-
}
|
|
174
|
+
})
|
|
173
175
|
];
|
|
174
176
|
};
|
|
@@ -1232,11 +1232,11 @@ export declare const RoleGrantAssignInput: import("@fuzdev/fuz_schema/schema.ts"
|
|
|
1232
1232
|
export type RoleGrantAssignInput = Infer<typeof RoleGrantAssignInput>;
|
|
1233
1233
|
/** Output for `role_grant_assign`, a `@fuzdev/fuz_schema` schema. */
|
|
1234
1234
|
export declare const RoleGrantAssignOutput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
1235
|
-
role_grant_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
1236
1235
|
ok: true;
|
|
1236
|
+
role_grant_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
1237
1237
|
}, {
|
|
1238
|
-
role_grant_id: string;
|
|
1239
1238
|
ok: true;
|
|
1239
|
+
role_grant_id: string;
|
|
1240
1240
|
}, "object", {
|
|
1241
1241
|
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
1242
1242
|
role_grant_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">)[]> & {
|
|
@@ -2484,11 +2484,11 @@ export declare const role_grant_assign_action_spec: {
|
|
|
2484
2484
|
}>>;
|
|
2485
2485
|
}>>;
|
|
2486
2486
|
output: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
2487
|
-
role_grant_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
2488
2487
|
ok: true;
|
|
2488
|
+
role_grant_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
2489
2489
|
}, {
|
|
2490
|
-
role_grant_id: string;
|
|
2491
2490
|
ok: true;
|
|
2491
|
+
role_grant_id: string;
|
|
2492
2492
|
}, "object", {
|
|
2493
2493
|
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
2494
2494
|
role_grant_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">)[]> & {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
14
|
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
|
-
import type
|
|
15
|
+
import { type RouteShape } from '../http/route_spec.js';
|
|
16
|
+
import { REST_NO_MATCHING_INVITE, REST_SIGNUP_CONFLICT } from '../http/error_schemas.js';
|
|
16
17
|
/**
|
|
17
18
|
* Input for `POST /signup`, a `@fuzdev/fuz_schema` schema. `email` is optional
|
|
18
19
|
* (absent or `null` = no email) and must match any referenced invite.
|
|
@@ -95,9 +96,13 @@ export interface SignupRouteShapeOptions {
|
|
|
95
96
|
}
|
|
96
97
|
/**
|
|
97
98
|
* The `POST /signup` route shape minus its handler — pure hono-free data.
|
|
98
|
-
* `create_signup_route_specs`
|
|
99
|
-
* cross-process surface builders
|
|
99
|
+
* `create_signup_route_specs` attaches the live handler to it
|
|
100
|
+
* (`attach_route_handler`); cross-process surface builders attach a stub
|
|
101
|
+
* (`stub_route_spec`). Single source
|
|
100
102
|
* of truth — the shape can't drift between the live route and the surface.
|
|
101
103
|
*/
|
|
102
|
-
export declare const create_signup_route_shape: (options: SignupRouteShapeOptions) =>
|
|
104
|
+
export declare const create_signup_route_shape: (options: SignupRouteShapeOptions) => RouteShape<readonly [typeof REST_NO_MATCHING_INVITE, typeof REST_SIGNUP_CONFLICT], typeof SignupOutput, {
|
|
105
|
+
account: "none";
|
|
106
|
+
actor: "none";
|
|
107
|
+
}, "both" | "ip">;
|
|
103
108
|
//# sourceMappingURL=signup_route_schema.d.ts.map
|
|
@@ -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,EAAuC,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAK/F,OAAO,KAAK,EAAE,
|
|
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,EAAuC,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAK/F,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEzF;;;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;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,SAAS,uBAAuB,KAC9B,UAAU,CACZ,SAAS,CAAC,OAAO,uBAAuB,EAAE,OAAO,oBAAoB,CAAC,EACtE,OAAO,YAAY,EACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAClC,MAAM,GAAG,IAAI,CAaX,CAAC"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { literal, nullable, object, optional } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
15
|
import { Email, Username, UsernameCanonical, Uuid } from '../primitive_schemas_fuz.js';
|
|
16
16
|
import { Password } from './password.js';
|
|
17
|
+
import { define_route_shape } from '../http/route_spec.js';
|
|
17
18
|
import { REST_NO_MATCHING_INVITE, REST_SIGNUP_CONFLICT } from '../http/error_schemas.js';
|
|
18
19
|
/**
|
|
19
20
|
* Input for `POST /signup`, a `@fuzdev/fuz_schema` schema. `email` is optional
|
|
@@ -39,11 +40,12 @@ export const SignupOutput = object({
|
|
|
39
40
|
});
|
|
40
41
|
/**
|
|
41
42
|
* The `POST /signup` route shape minus its handler — pure hono-free data.
|
|
42
|
-
* `create_signup_route_specs`
|
|
43
|
-
* cross-process surface builders
|
|
43
|
+
* `create_signup_route_specs` attaches the live handler to it
|
|
44
|
+
* (`attach_route_handler`); cross-process surface builders attach a stub
|
|
45
|
+
* (`stub_route_spec`). Single source
|
|
44
46
|
* of truth — the shape can't drift between the live route and the surface.
|
|
45
47
|
*/
|
|
46
|
-
export const create_signup_route_shape = (options) => ({
|
|
48
|
+
export const create_signup_route_shape = (options) => define_route_shape({
|
|
47
49
|
method: 'POST',
|
|
48
50
|
path: '/signup',
|
|
49
51
|
auth: { account: 'none', actor: 'none' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signup_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/signup_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,OAAO,
|
|
1
|
+
{"version":3,"file":"signup_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/signup_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAI9F,OAAO,EAAoB,KAAK,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AACnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAOlD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAGnE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IAClE;;;;;;;;;OASG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,6FAA6F;IAC7F,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAID;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACrC,MAAM,gBAAgB,EACtB,SAAS,kBAAkB,KACzB,KAAK,CAAC,SAAS,CAqNjB,CAAC"}
|