@fuzdev/fuz_app 0.163.0 → 0.165.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/README.md +2 -1
- 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 +4 -0
- package/dist/actions/action_spec.d.ts +3 -3
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/auth/CLAUDE.md +1 -1
- package/dist/auth/account_route_schema.d.ts +3 -27
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +6 -20
- package/dist/auth/admin_action_specs.d.ts +56 -56
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +4 -5
- package/dist/auth/audit_log_schema.d.ts +18 -18
- package/dist/auth/bootstrap_route_schema.d.ts +1 -30
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +3 -8
- package/dist/auth/daemon_token.d.ts +4 -4
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token.js +3 -3
- package/dist/auth/daemon_token_middleware.d.ts +1 -1
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +5 -5
- package/dist/auth/middleware.js +4 -4
- package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +3 -7
- package/dist/db/CLAUDE.md +2 -1
- package/dist/db/file_fact_url.d.ts +11 -6
- package/dist/db/file_fact_url.d.ts.map +1 -1
- package/dist/db/file_fact_url.js +5 -5
- package/dist/db/schema_ready.d.ts +0 -5
- package/dist/db/schema_ready.d.ts.map +1 -1
- package/dist/db/schema_ready.js +0 -5
- package/dist/http/CLAUDE.md +105 -71
- package/dist/http/auth_shape.d.ts +48 -29
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +12 -85
- package/dist/http/body_limit.d.ts +12 -0
- package/dist/http/body_limit.d.ts.map +1 -1
- package/dist/http/body_limit.js +15 -0
- package/dist/http/body_limit_schema.d.ts +20 -0
- package/dist/http/body_limit_schema.d.ts.map +1 -0
- package/dist/http/body_limit_schema.js +20 -0
- 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 +11 -14
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +59 -69
- package/dist/http/dev_route_error_check.d.ts +70 -0
- package/dist/http/dev_route_error_check.d.ts.map +1 -0
- package/dist/http/dev_route_error_check.js +119 -0
- package/dist/http/error_schemas.d.ts +365 -189
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +256 -149
- package/dist/http/health_schema.d.ts +10 -6
- package/dist/http/health_schema.d.ts.map +1 -1
- package/dist/http/health_schema.js +3 -3
- package/dist/http/middleware_spec.d.ts +8 -3
- package/dist/http/middleware_spec.d.ts.map +1 -1
- package/dist/http/origin.d.ts +12 -43
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +10 -6
- package/dist/http/route_error_check.d.ts +179 -0
- package/dist/http/route_error_check.d.ts.map +1 -0
- package/dist/http/route_error_check.js +283 -0
- package/dist/http/route_errors.d.ts +80 -0
- package/dist/http/route_errors.d.ts.map +1 -0
- package/dist/http/route_errors.js +83 -0
- package/dist/http/route_spec.d.ts +33 -17
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +48 -62
- package/dist/http/schema_helpers.d.ts +15 -34
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +11 -47
- package/dist/http/surface.d.ts +19 -12
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +25 -38
- package/dist/http/surface_query.d.ts +11 -2
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +7 -1
- package/dist/primitive_schemas_fuz.d.ts +17 -3
- package/dist/primitive_schemas_fuz.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.js +13 -3
- package/dist/rate_limiter.d.ts +13 -0
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +20 -2
- package/dist/schema_issues.d.ts +29 -11
- package/dist/schema_issues.d.ts.map +1 -1
- package/dist/schema_issues.js +11 -10
- package/dist/schema_meta.d.ts +8 -1
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +2 -1
- package/dist/server/app_server.d.ts +3 -1
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +24 -10
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +8 -31
- package/dist/server/surface_route.d.ts.map +1 -1
- package/dist/server/surface_route.js +5 -6
- package/dist/server/x_accel.d.ts +12 -7
- package/dist/server/x_accel.d.ts.map +1 -1
- package/dist/server/x_accel.js +7 -9
- package/dist/testing/CLAUDE.md +105 -61
- package/dist/testing/admin_integration.js +2 -2
- package/dist/testing/adversarial_404.d.ts +4 -18
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +20 -52
- package/dist/testing/adversarial_headers.d.ts +3 -4
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -6
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +20 -19
- package/dist/testing/assertions.d.ts +46 -14
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +73 -16
- package/dist/testing/attack_surface.d.ts +17 -35
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +36 -95
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +2 -1
- package/dist/testing/cross_backend/action_manifest.d.ts +126 -56
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +11 -11
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_crud.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_crud.js +2 -1
- package/dist/testing/cross_backend/conformance_table.js +1 -1
- package/dist/testing/cross_backend/fact_serving.js +3 -3
- package/dist/testing/cross_backend/in_process_setup.d.ts +7 -3
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +11 -4
- package/dist/testing/cross_backend/origin_conformance.d.ts +278 -102
- package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_conformance.js +21 -21
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +7 -1
- package/dist/testing/cross_backend/setup.d.ts +13 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +24 -7
- package/dist/testing/cross_backend/spine_suites.d.ts +3 -2
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +5 -2
- package/dist/testing/cross_backend/standard.d.ts +31 -0
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +9 -3
- package/dist/testing/cross_backend/testing_origin_check.d.ts +147 -71
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +16 -13
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +70 -27
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/data_exposure.d.ts +7 -0
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +8 -7
- package/dist/testing/error_coverage.d.ts +53 -61
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +86 -119
- package/dist/testing/integration.d.ts +28 -1
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +54 -29
- package/dist/testing/integration_helpers.d.ts +37 -9
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +75 -40
- package/dist/testing/middleware.d.ts +3 -5
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +5 -4
- package/dist/testing/middleware_gate_probes.d.ts +90 -0
- package/dist/testing/middleware_gate_probes.d.ts.map +1 -0
- package/dist/testing/middleware_gate_probes.js +179 -0
- package/dist/testing/rate_limiting.d.ts +1 -1
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +5 -4
- package/dist/testing/round_trip.d.ts +7 -0
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +8 -5
- package/dist/testing/schema_generators.d.ts +40 -11
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +71 -17
- package/dist/testing/stubs.d.ts +10 -1
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +15 -5
- package/dist/testing/surface_invariants.d.ts +36 -115
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +106 -269
- package/dist/testing/transports/raw_http.d.ts +10 -2
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +10 -4
- package/dist/ui/CLAUDE.md +4 -2
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +2 -8
- package/dist/ui/backend_probe.svelte.js +3 -3
- package/dist/ui/table_state.svelte.d.ts.map +1 -1
- package/dist/ui/table_state.svelte.js +1 -8
- package/dist/ui/ui_fetch.d.ts +12 -2
- package/dist/ui/ui_fetch.d.ts.map +1 -1
- package/dist/ui/ui_fetch.js +22 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,8 @@ const {app} = await create_app_server({backend, ...});
|
|
|
45
45
|
Deno.serve({port: PORT, hostname: HOST}, app.fetch);
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
See [CLAUDE.md](CLAUDE.md) for more usage patterns and the AI-generated docs
|
|
48
|
+
See [CLAUDE.md](CLAUDE.md) for more usage patterns and the AI-generated docs,
|
|
49
|
+
and the [fuz-stack skill](https://docs.fuz.dev/skills/fuz-stack) for coding conventions shared across the Fuz stack.
|
|
49
50
|
|
|
50
51
|
## Contributing
|
|
51
52
|
|
|
@@ -12,8 +12,8 @@ import { JsonrpcRequest, JsonrpcResponseOrError, JsonrpcNotification, JsonrpcErr
|
|
|
12
12
|
import { ActionExecutor } from './action_event_types.js';
|
|
13
13
|
export declare const ActionEventData: z.ZodObject<{
|
|
14
14
|
kind: z.ZodEnum<{
|
|
15
|
-
request_response: "request_response";
|
|
16
15
|
remote_notification: "remote_notification";
|
|
16
|
+
request_response: "request_response";
|
|
17
17
|
local_call: "local_call";
|
|
18
18
|
}>;
|
|
19
19
|
phase: z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_rpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAgB1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACxC,sDAAsD;IACtD,IAAI,EA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S,wBAAwB,KAAG,KAAK,CAAC,SAAS,CA2NtF,CAAC"}
|
|
@@ -213,6 +213,8 @@ export const create_rpc_endpoint = (options) => {
|
|
|
213
213
|
// the dispatcher reads the resolved credential per action, so the
|
|
214
214
|
// endpoint stays inside the auth middleware's scope however it mounts
|
|
215
215
|
reads_credential: true,
|
|
216
|
+
// answers JSON-RPC envelopes, not REST bodies
|
|
217
|
+
jsonrpc: true,
|
|
216
218
|
handler: post_handler,
|
|
217
219
|
description: `JSON-RPC 2.0 endpoint — ${actions.length} method${actions.length === 1 ? '' : 's'}`,
|
|
218
220
|
input: z.null(), // dispatcher owns body parsing; rpc_endpoints surface has the real schemas
|
|
@@ -224,6 +226,8 @@ export const create_rpc_endpoint = (options) => {
|
|
|
224
226
|
path: endpoint_path,
|
|
225
227
|
auth: { account: 'none', actor: 'none' }, // per-action auth inside dispatcher
|
|
226
228
|
reads_credential: true,
|
|
229
|
+
// answers JSON-RPC envelopes, not REST bodies
|
|
230
|
+
jsonrpc: true,
|
|
227
231
|
handler: get_handler,
|
|
228
232
|
description: `JSON-RPC 2.0 endpoint (side-effect-free reads) — ${actions.length} method${actions.length === 1 ? '' : 's'}`,
|
|
229
233
|
input: z.null(), // params from query string, validated by dispatcher
|
|
@@ -18,23 +18,23 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { z } from 'zod';
|
|
20
20
|
import type { void as fuz_void } from '@fuzdev/fuz_schema/schema.ts';
|
|
21
|
-
import type { RateLimitKey } from '../
|
|
21
|
+
import type { RateLimitKey } from '../rate_limiter.js';
|
|
22
22
|
import type { RouteAuth } from '../http/auth_shape.js';
|
|
23
23
|
import type { ValidationSchema } from '../schema_issues.js';
|
|
24
24
|
/** The action kinds, in declaration order — what `ActionKind` and `is_action_spec` read. */
|
|
25
25
|
export declare const ACTION_KINDS: readonly ["request_response", "remote_notification", "local_call"];
|
|
26
26
|
export declare const ActionKind: z.ZodEnum<{
|
|
27
|
-
request_response: "request_response";
|
|
28
27
|
remote_notification: "remote_notification";
|
|
28
|
+
request_response: "request_response";
|
|
29
29
|
local_call: "local_call";
|
|
30
30
|
}>;
|
|
31
31
|
export type ActionKind = z.infer<typeof ActionKind>;
|
|
32
32
|
/** Which side initiates an action — what `ActionInitiator` reads. */
|
|
33
33
|
export declare const ACTION_INITIATORS: readonly ["frontend", "backend", "both"];
|
|
34
34
|
export declare const ActionInitiator: z.ZodEnum<{
|
|
35
|
-
both: "both";
|
|
36
35
|
frontend: "frontend";
|
|
37
36
|
backend: "backend";
|
|
37
|
+
both: "both";
|
|
38
38
|
}>;
|
|
39
39
|
export type ActionInitiator = z.infer<typeof ActionInitiator>;
|
|
40
40
|
/** The fields every action spec carries; each kind narrows some of them. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_spec.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"action_spec.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,4FAA4F;AAC5F,eAAO,MAAM,YAAY,oEAAqE,CAAC;AAC/F,e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C;IACpC,KAAK,EAAE,IAAI,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACtD,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;CACX;AAED,gDAAgD;AAChD,MAAM,MAAM,eAAe,GAC1B,yBAAyB,GAAG,4BAA4B,GAAG,mBAAmB,CAAC;AAEhF,wGAAwG;AACxG,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,eAKK,CAAC;AAE/D,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,gJAUtB,CAAC;AACX,eAAO,MAAM,gBAAgB;;;;;;;;;;EAA8B,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/auth/CLAUDE.md
CHANGED
|
@@ -199,7 +199,7 @@ counted, the request proceeds — so the count is how a lost row is seen.
|
|
|
199
199
|
- `auth/bootstrap_routes.ts` — `POST /bootstrap` + `check_bootstrap_status`; `BootstrapStatus` runtime ref.
|
|
200
200
|
- `auth/signup_routes.ts` — `POST /signup` (open or invite-gated).
|
|
201
201
|
- `auth/audit_log_routes.ts` — optional `GET /audit/stream` (SSE); list/history are on the RPC surface. Takes `stream: {registry, log}` (an `AuditLogSse` satisfies it). The handler admits the stream in two phases — register pending on the `SseRegistry`, re-read the credential (`revalidate_resolved_auth`) and the acting actor's role grants, admit — so a revocation racing the request opens no stream: 401 / 403 from the re-reads, or a 200 whose body is the connect comment alone when the pending registration was closed.
|
|
202
|
-
- `auth/auth_guard_resolver.ts` — `fuz_auth_guard_resolver` injected into `apply_route_specs` so the framework stays auth-agnostic. Maps each `RouteAuth` axis to a guard and is the single site every route spec traverses, so it also carries the two invariants the
|
|
202
|
+
- `auth/auth_guard_resolver.ts` — `fuz_auth_guard_resolver` injected into `apply_route_specs` so the framework stays auth-agnostic. Maps each `RouteAuth` axis to a guard and is the single site every route spec traverses, so it also carries the two invariants the auth shape alone can't (a `required_scope` that isn't a well-formed capability, and one on an unrestricted route).
|
|
203
203
|
|
|
204
204
|
**Hono-free route shapes.** Each cookie/SSE-coupled route module has a sibling
|
|
205
205
|
`*_route_schema.ts` (`account_route_schema.ts`, `signup_route_schema.ts`,
|
|
@@ -163,21 +163,6 @@ export declare const AccountStatusOutput: import("@fuzdev/fuz_schema/schema.ts")
|
|
|
163
163
|
}>>;
|
|
164
164
|
}>;
|
|
165
165
|
export type AccountStatusOutput = Infer<typeof AccountStatusOutput>;
|
|
166
|
-
/**
|
|
167
|
-
* Error body for `GET /api/account/status` on the unauthenticated path, a
|
|
168
|
-
* `@fuzdev/fuz_schema` schema.
|
|
169
|
-
*/
|
|
170
|
-
export declare const AccountStatusUnauthenticatedError: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
171
|
-
error: "authentication_required";
|
|
172
|
-
bootstrap_available?: boolean | undefined;
|
|
173
|
-
} & Record<string, unknown>, {
|
|
174
|
-
error: "authentication_required";
|
|
175
|
-
bootstrap_available?: boolean | undefined;
|
|
176
|
-
} & Record<string, unknown>, "loose_object", {
|
|
177
|
-
error: import("@fuzdev/fuz_schema/schema.ts").Schema<"authentication_required", "authentication_required", "literal", "authentication_required">;
|
|
178
|
-
bootstrap_available: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean | undefined, boolean | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>>>;
|
|
179
|
-
}>;
|
|
180
|
-
export type AccountStatusUnauthenticatedError = Infer<typeof AccountStatusUnauthenticatedError>;
|
|
181
166
|
/**
|
|
182
167
|
* Input for `POST /login`, a `@fuzdev/fuz_schema` schema. Accepts a username
|
|
183
168
|
* or email in the `username` field.
|
|
@@ -437,18 +422,9 @@ export declare const account_status_route_shape: {
|
|
|
437
422
|
}>>;
|
|
438
423
|
}>>;
|
|
439
424
|
}>;
|
|
440
|
-
errors: {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
bootstrap_available?: boolean | undefined;
|
|
444
|
-
} & Record<string, unknown>, {
|
|
445
|
-
error: "authentication_required";
|
|
446
|
-
bootstrap_available?: boolean | undefined;
|
|
447
|
-
} & Record<string, unknown>, "loose_object", {
|
|
448
|
-
error: import("@fuzdev/fuz_schema/schema.ts").Schema<"authentication_required", "authentication_required", "literal", "authentication_required">;
|
|
449
|
-
bootstrap_available: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean | undefined, boolean | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>>>;
|
|
450
|
-
}>;
|
|
451
|
-
};
|
|
425
|
+
errors: import("../http/error_schemas.js").RestErrorDef<401, "authentication_required", {
|
|
426
|
+
readonly bootstrap_available: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean | undefined, boolean | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>>>;
|
|
427
|
+
}>[];
|
|
452
428
|
};
|
|
453
429
|
/** Option inputs that shape the account route metadata (not its handlers). */
|
|
454
430
|
export interface AccountRouteShapeOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"account_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAMvD,m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AAI,CAAC;AAEtC,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWD,CAAC;AAEvC,8EAA8E;AAC9E,MAAM,WAAW,wBAAwB;IACxC,8FAA8F;IAC9F,0BAA0B,EAAE,OAAO,CAAC;CACpC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,GACvC,SAAS,wBAAwB,KAC/B,CACF,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,EAC1B,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,EAC1B,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,EAC1B,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CA6D1B,CAAC"}
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import { array,
|
|
14
|
+
import { array, integer, literal, min_value, nullable, number, object, pipe } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
15
|
import { ActorSummaryJson, RoleGrantSummaryJson, SessionAccountJson } from './account_schema.js';
|
|
16
16
|
import { UsernameCanonical, UsernameProvided } from '../primitive_schemas_fuz.js';
|
|
17
17
|
import { Password, PasswordProvided } from './password.js';
|
|
18
|
-
import {
|
|
18
|
+
import { REST_AUTHENTICATION_REQUIRED_BOOTSTRAP, REST_INVALID_CREDENTIALS } from '../http/error_schemas.js';
|
|
19
19
|
/** Input for `GET /api/account/status`, `literal(null)`. No parameters — caller is the subject. */
|
|
20
20
|
export const AccountStatusInput = literal(null);
|
|
21
21
|
/** Output for `GET /api/account/status`, a `@fuzdev/fuz_schema` schema. */
|
|
@@ -24,14 +24,6 @@ export const AccountStatusOutput = object({
|
|
|
24
24
|
actor: nullable(ActorSummaryJson),
|
|
25
25
|
role_grants: array(RoleGrantSummaryJson)
|
|
26
26
|
});
|
|
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)
|
|
34
|
-
});
|
|
35
27
|
/**
|
|
36
28
|
* Input for `POST /login`, a `@fuzdev/fuz_schema` schema. Accepts a username
|
|
37
29
|
* or email in the `username` field.
|
|
@@ -110,9 +102,7 @@ export const account_status_route_shape = {
|
|
|
110
102
|
description: 'Current account info (unauthenticated: 401 with bootstrap status)',
|
|
111
103
|
input: AccountStatusInput,
|
|
112
104
|
output: AccountStatusOutput,
|
|
113
|
-
errors:
|
|
114
|
-
401: AccountStatusUnauthenticatedError
|
|
115
|
-
}
|
|
105
|
+
errors: [REST_AUTHENTICATION_REQUIRED_BOOTSTRAP]
|
|
116
106
|
};
|
|
117
107
|
/**
|
|
118
108
|
* The four account route shapes (`/verify`, `/login`, `/logout`, `/password`)
|
|
@@ -153,10 +143,7 @@ export const create_account_route_shapes = (options) => [
|
|
|
153
143
|
// so a reservation waiting for a slot, and the Argon2 verify, hold no
|
|
154
144
|
// database connection.
|
|
155
145
|
transaction: false,
|
|
156
|
-
errors:
|
|
157
|
-
400: loose_object({ error: one_of([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY]) }),
|
|
158
|
-
401: loose_object({ error: literal(ERROR_INVALID_CREDENTIALS) })
|
|
159
|
-
}
|
|
146
|
+
errors: [REST_INVALID_CREDENTIALS]
|
|
160
147
|
},
|
|
161
148
|
{
|
|
162
149
|
method: 'POST',
|
|
@@ -183,8 +170,7 @@ export const create_account_route_shapes = (options) => [
|
|
|
183
170
|
// and the revocations, so a reservation waiting for a slot, and the
|
|
184
171
|
// Argon2 verify and hash, hold no database connection.
|
|
185
172
|
transaction: false,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
173
|
+
// a wrong current password answers `invalid_credentials`, as login does
|
|
174
|
+
errors: [REST_INVALID_CREDENTIALS]
|
|
189
175
|
}
|
|
190
176
|
];
|