@fuzdev/fuz_app 0.131.0 → 0.132.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/action_dispatcher.js +0 -1
- package/dist/actions/action_event_data.d.ts +2 -2
- package/dist/actions/action_event_types.d.ts +2 -2
- package/dist/actions/action_rpc.js +0 -1
- package/dist/actions/action_spec.d.ts +19 -19
- package/dist/actions/perform_action.js +0 -1
- package/dist/actions/register_action_ws.js +0 -1
- package/dist/actions/transports_http.d.ts +7 -0
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +18 -1
- package/dist/auth/CLAUDE.md +1 -1
- package/dist/auth/account_routes.js +1 -1
- package/dist/auth/audit_log_schema.d.ts +5 -5
- package/dist/auth/cell_action_specs.d.ts +3 -3
- package/dist/auth/credential_type_schema.d.ts +1 -1
- package/dist/auth/middleware.d.ts +13 -10
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +14 -10
- package/dist/cli/daemon.js +0 -1
- package/dist/cli/logger.js +0 -1
- package/dist/env/load.js +0 -1
- package/dist/hono_context.d.ts +1 -1
- package/dist/http/CLAUDE.md +2 -1
- package/dist/http/auth_shape.d.ts +6 -6
- package/dist/http/error_schemas.d.ts +12 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +10 -1
- package/dist/http/origin.d.ts +10 -6
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +10 -6
- package/dist/http/route_spec.d.ts +19 -12
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +33 -6
- package/dist/http/schema_helpers.d.ts +3 -1
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +3 -2
- package/dist/http/simple_request.d.ts +63 -0
- package/dist/http/simple_request.d.ts.map +1 -0
- package/dist/http/simple_request.js +84 -0
- package/dist/http/surface.js +0 -1
- package/dist/realtime/sse.js +0 -1
- package/dist/server/app_server.d.ts +2 -2
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +5 -2
- package/dist/testing/CLAUDE.md +16 -0
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +2 -1
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +14 -15
- package/dist/testing/audit_completeness.js +1 -1
- package/dist/testing/cross_backend/action_manifest.d.ts +10 -10
- package/dist/testing/cross_backend/simple_request.d.ts +11 -0
- package/dist/testing/cross_backend/simple_request.d.ts.map +1 -0
- package/dist/testing/cross_backend/simple_request.js +142 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +5 -5
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +40 -11
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +19 -7
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +3 -0
- package/dist/testing/transports/ws_client.js +0 -1
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +5 -1
- package/package.json +2 -2
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
import { JsonrpcMessageFromClientToServer, JsonrpcMessageFromServerToClient, JsonrpcNotification, JsonrpcRequest, JsonrpcResponseOrError, JsonrpcErrorResponse } from '../http/jsonrpc.js';
|
|
10
9
|
import { create_jsonrpc_error_response, create_jsonrpc_error_response_from_thrown, to_jsonrpc_message_id, is_jsonrpc_request, is_jsonrpc_notification } from '../http/jsonrpc_helpers.js';
|
|
11
10
|
import { jsonrpc_error_messages } from '../http/jsonrpc_errors.js';
|
|
12
11
|
import { to_input_params } from '../http/schema_helpers.js';
|
|
@@ -28,11 +28,11 @@ export declare const ActionEventData: z.ZodObject<{
|
|
|
28
28
|
execute: "execute";
|
|
29
29
|
}>;
|
|
30
30
|
step: z.ZodEnum<{
|
|
31
|
-
|
|
31
|
+
failed: "failed";
|
|
32
32
|
parsed: "parsed";
|
|
33
|
+
initial: "initial";
|
|
33
34
|
handling: "handling";
|
|
34
35
|
handled: "handled";
|
|
35
|
-
failed: "failed";
|
|
36
36
|
}>;
|
|
37
37
|
method: z.ZodString;
|
|
38
38
|
executor: z.ZodEnum<{
|
|
@@ -12,11 +12,11 @@ export declare const ActionExecutor: z.ZodEnum<{
|
|
|
12
12
|
}>;
|
|
13
13
|
export type ActionExecutor = z.infer<typeof ActionExecutor>;
|
|
14
14
|
export declare const ActionEventStep: z.ZodEnum<{
|
|
15
|
-
|
|
15
|
+
failed: "failed";
|
|
16
16
|
parsed: "parsed";
|
|
17
|
+
initial: "initial";
|
|
17
18
|
handling: "handling";
|
|
18
19
|
handled: "handled";
|
|
19
|
-
failed: "failed";
|
|
20
20
|
}>;
|
|
21
21
|
export type ActionEventStep = z.infer<typeof ActionEventStep>;
|
|
22
22
|
export declare const action_event_step_transitions: Record<ActionEventStep, ReadonlyArray<ActionEventStep>>;
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
import { DEV } from 'esm-env';
|
|
16
|
-
import {} from '../http/route_spec.js';
|
|
17
16
|
import { get_client_ip } from '../http/client_ip.js';
|
|
18
17
|
import { get_request_context } from '../auth/request_context.js';
|
|
19
18
|
import { ACCOUNT_ID_KEY, CREDENTIAL_TYPE_KEY, TOKEN_SCOPE_KEY, TEST_CONTEXT_PRESET_KEY } from '../hono_context.js';
|
|
@@ -51,14 +51,14 @@ export declare const ActionSpec: z.ZodObject<{
|
|
|
51
51
|
*/
|
|
52
52
|
auth: z.ZodNullable<z.ZodObject<{
|
|
53
53
|
account: z.ZodEnum<{
|
|
54
|
-
optional: "optional";
|
|
55
|
-
none: "none";
|
|
56
54
|
required: "required";
|
|
55
|
+
none: "none";
|
|
56
|
+
optional: "optional";
|
|
57
57
|
}>;
|
|
58
58
|
actor: z.ZodEnum<{
|
|
59
|
-
optional: "optional";
|
|
60
|
-
none: "none";
|
|
61
59
|
required: "required";
|
|
60
|
+
none: "none";
|
|
61
|
+
optional: "optional";
|
|
62
62
|
}>;
|
|
63
63
|
roles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
64
64
|
credential_types: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
@@ -108,9 +108,9 @@ export declare const ActionSpec: z.ZodObject<{
|
|
|
108
108
|
* dispatchers don't read it.
|
|
109
109
|
*/
|
|
110
110
|
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
111
|
+
both: "both";
|
|
111
112
|
account: "account";
|
|
112
113
|
ip: "ip";
|
|
113
|
-
both: "both";
|
|
114
114
|
}>>;
|
|
115
115
|
}, z.core.$strict>;
|
|
116
116
|
export type ActionSpec = z.infer<typeof ActionSpec>;
|
|
@@ -128,21 +128,21 @@ export declare const RequestResponseActionSpec: z.ZodObject<{
|
|
|
128
128
|
streams: z.ZodOptional<z.ZodString>;
|
|
129
129
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
130
130
|
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
131
|
+
both: "both";
|
|
131
132
|
account: "account";
|
|
132
133
|
ip: "ip";
|
|
133
|
-
both: "both";
|
|
134
134
|
}>>;
|
|
135
135
|
kind: z.ZodDefault<z.ZodLiteral<"request_response">>;
|
|
136
136
|
auth: z.ZodObject<{
|
|
137
137
|
account: z.ZodEnum<{
|
|
138
|
-
optional: "optional";
|
|
139
|
-
none: "none";
|
|
140
138
|
required: "required";
|
|
139
|
+
none: "none";
|
|
140
|
+
optional: "optional";
|
|
141
141
|
}>;
|
|
142
142
|
actor: z.ZodEnum<{
|
|
143
|
-
optional: "optional";
|
|
144
|
-
none: "none";
|
|
145
143
|
required: "required";
|
|
144
|
+
none: "none";
|
|
145
|
+
optional: "optional";
|
|
146
146
|
}>;
|
|
147
147
|
roles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
148
148
|
credential_types: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
@@ -163,9 +163,9 @@ export declare const RemoteNotificationActionSpec: z.ZodObject<{
|
|
|
163
163
|
streams: z.ZodOptional<z.ZodString>;
|
|
164
164
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
165
165
|
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
both: "both";
|
|
166
167
|
account: "account";
|
|
167
168
|
ip: "ip";
|
|
168
|
-
both: "both";
|
|
169
169
|
}>>;
|
|
170
170
|
kind: z.ZodDefault<z.ZodLiteral<"remote_notification">>;
|
|
171
171
|
auth: z.ZodDefault<z.ZodNull>;
|
|
@@ -193,9 +193,9 @@ export declare const LocalCallActionSpec: z.ZodObject<{
|
|
|
193
193
|
streams: z.ZodOptional<z.ZodString>;
|
|
194
194
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
195
195
|
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
196
|
+
both: "both";
|
|
196
197
|
account: "account";
|
|
197
198
|
ip: "ip";
|
|
198
|
-
both: "both";
|
|
199
199
|
}>>;
|
|
200
200
|
kind: z.ZodDefault<z.ZodLiteral<"local_call">>;
|
|
201
201
|
auth: z.ZodDefault<z.ZodNull>;
|
|
@@ -215,21 +215,21 @@ export declare const ActionSpecUnion: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
215
215
|
streams: z.ZodOptional<z.ZodString>;
|
|
216
216
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
217
217
|
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
218
|
+
both: "both";
|
|
218
219
|
account: "account";
|
|
219
220
|
ip: "ip";
|
|
220
|
-
both: "both";
|
|
221
221
|
}>>;
|
|
222
222
|
kind: z.ZodDefault<z.ZodLiteral<"request_response">>;
|
|
223
223
|
auth: z.ZodObject<{
|
|
224
224
|
account: z.ZodEnum<{
|
|
225
|
-
optional: "optional";
|
|
226
|
-
none: "none";
|
|
227
225
|
required: "required";
|
|
226
|
+
none: "none";
|
|
227
|
+
optional: "optional";
|
|
228
228
|
}>;
|
|
229
229
|
actor: z.ZodEnum<{
|
|
230
|
-
optional: "optional";
|
|
231
|
-
none: "none";
|
|
232
230
|
required: "required";
|
|
231
|
+
none: "none";
|
|
232
|
+
optional: "optional";
|
|
233
233
|
}>;
|
|
234
234
|
roles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
235
235
|
credential_types: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
@@ -248,9 +248,9 @@ export declare const ActionSpecUnion: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
248
248
|
streams: z.ZodOptional<z.ZodString>;
|
|
249
249
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
250
250
|
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
251
|
+
both: "both";
|
|
251
252
|
account: "account";
|
|
252
253
|
ip: "ip";
|
|
253
|
-
both: "both";
|
|
254
254
|
}>>;
|
|
255
255
|
kind: z.ZodDefault<z.ZodLiteral<"remote_notification">>;
|
|
256
256
|
auth: z.ZodDefault<z.ZodNull>;
|
|
@@ -272,9 +272,9 @@ export declare const ActionSpecUnion: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
272
272
|
streams: z.ZodOptional<z.ZodString>;
|
|
273
273
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
274
274
|
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
275
|
+
both: "both";
|
|
275
276
|
account: "account";
|
|
276
277
|
ip: "ip";
|
|
277
|
-
both: "both";
|
|
278
278
|
}>>;
|
|
279
279
|
kind: z.ZodDefault<z.ZodLiteral<"local_call">>;
|
|
280
280
|
auth: z.ZodDefault<z.ZodNull>;
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
*/
|
|
57
57
|
import { DEV } from 'esm-env';
|
|
58
58
|
import { apply_authorization_phase, has_any_scoped_role } from '../auth/request_context.js';
|
|
59
|
-
import {} from '../hono_context.js';
|
|
60
59
|
import { to_input_params } from '../http/schema_helpers.js';
|
|
61
60
|
import { dispatch_with_post_commit_rollback } from '../http/pending_effects.js';
|
|
62
61
|
import { JSONRPC_VERSION } from '../http/jsonrpc.js';
|
|
@@ -104,7 +104,6 @@ import { JsonrpcRequest } from '../http/jsonrpc.js';
|
|
|
104
104
|
import { dev_only, jsonrpc_error_messages } from '../http/jsonrpc_errors.js';
|
|
105
105
|
import { create_jsonrpc_error_response, create_jsonrpc_notification, to_jsonrpc_envelope_id, to_jsonrpc_message_id, to_jsonrpc_params, is_jsonrpc_object, is_jsonrpc_request, is_jsonrpc_request_id } from '../http/jsonrpc_helpers.js';
|
|
106
106
|
import { TOKEN_SCOPE_KEY, TEST_CONTEXT_PRESET_KEY } from '../hono_context.js';
|
|
107
|
-
import {} from './action_types.js';
|
|
108
107
|
import { compile_action_registry } from './compile_action_registry.js';
|
|
109
108
|
import { cancel_action_spec, CancelNotificationParams } from './cancel.js';
|
|
110
109
|
import { DEFAULT_WS_MAX_MESSAGE_BYTES, WS_CLOSE_INTERNAL_ERROR, WS_CLOSE_MESSAGE_TOO_BIG, WS_CLOSE_POLICY_VIOLATION, WS_CLOSE_SERVER_HEARTBEAT_TIMEOUT, WS_CLOSE_SESSION_REVOKED, WS_CLOSE_SESSION_REVOKED_REASON, utf8_length, utf8_length_over } from './transports.js';
|
|
@@ -22,6 +22,13 @@ import type { Transport, TransportSendOptions } from './transports.js';
|
|
|
22
22
|
export declare class FrontendHttpTransport implements Transport {
|
|
23
23
|
#private;
|
|
24
24
|
readonly transport_name: "frontend_http_rpc";
|
|
25
|
+
/**
|
|
26
|
+
* @param url - the JSON-RPC endpoint
|
|
27
|
+
* @param headers - extra headers, merged over the JSON `content-type` and
|
|
28
|
+
* `accept` defaults case-insensitively — a POST without
|
|
29
|
+
* `application/json` is refused (415)
|
|
30
|
+
* @param has_side_effects - when it returns `false` for a method, the call is a GET
|
|
31
|
+
*/
|
|
25
32
|
constructor(url: string, headers?: Record<string, string>, has_side_effects?: (method: string) => boolean);
|
|
26
33
|
send(message: JsonrpcRequest, options?: TransportSendOptions): Promise<JsonrpcResponseOrError>;
|
|
27
34
|
send(message: JsonrpcNotification, options?: TransportSendOptions): Promise<JsonrpcErrorResponse | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports_http.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports_http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,OAAO,EACN,oBAAoB,EAGpB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"transports_http.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports_http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,OAAO,EACN,oBAAoB,EAGpB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAQvE;;;;;;;;;;;;;GAaG;AACH,qBAAa,qBAAsB,YAAW,SAAS;;IACtD,QAAQ,CAAC,cAAc,EAAG,mBAAmB,CAAU;IAMvD;;;;;;OAMG;gBAEF,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO;IAYzC,IAAI,CACT,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,sBAAsB,CAAC;IAC5B,IAAI,CACT,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA+FvC,QAAQ,IAAI,OAAO;CAGnB"}
|
|
@@ -7,6 +7,11 @@ import { DEV } from 'esm-env';
|
|
|
7
7
|
import { ThrownJsonrpcError, jsonrpc_error_messages, http_status_to_jsonrpc_error_code, jsonrpc_error_code_to_http_status, UNKNOWN_ERROR_MESSAGE } from '../http/jsonrpc_errors.js';
|
|
8
8
|
import { create_jsonrpc_error_response, to_jsonrpc_message_id, is_jsonrpc_error_response, is_jsonrpc_response } from '../http/jsonrpc_helpers.js';
|
|
9
9
|
import { JsonrpcErrorResponse } from '../http/jsonrpc.js';
|
|
10
|
+
/** Headers every request carries unless the caller's replace them. */
|
|
11
|
+
const DEFAULT_HEADERS = {
|
|
12
|
+
'content-type': 'application/json',
|
|
13
|
+
accept: 'application/json'
|
|
14
|
+
};
|
|
10
15
|
/**
|
|
11
16
|
* Thin `fetch` adapter for the JSON-RPC endpoint. POST by default; GET when
|
|
12
17
|
* the optional `has_side_effects(method)` callback returns `false` for the
|
|
@@ -26,9 +31,21 @@ export class FrontendHttpTransport {
|
|
|
26
31
|
#url;
|
|
27
32
|
#headers;
|
|
28
33
|
#has_side_effects;
|
|
34
|
+
/**
|
|
35
|
+
* @param url - the JSON-RPC endpoint
|
|
36
|
+
* @param headers - extra headers, merged over the JSON `content-type` and
|
|
37
|
+
* `accept` defaults case-insensitively — a POST without
|
|
38
|
+
* `application/json` is refused (415)
|
|
39
|
+
* @param has_side_effects - when it returns `false` for a method, the call is a GET
|
|
40
|
+
*/
|
|
29
41
|
constructor(url, headers, has_side_effects) {
|
|
30
42
|
this.#url = url;
|
|
31
|
-
this.#headers =
|
|
43
|
+
this.#headers = { ...DEFAULT_HEADERS };
|
|
44
|
+
if (headers) {
|
|
45
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
46
|
+
this.#headers[name.toLowerCase()] = value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
32
49
|
this.#has_side_effects = has_side_effects;
|
|
33
50
|
}
|
|
34
51
|
async send(message, options) {
|
package/dist/auth/CLAUDE.md
CHANGED
|
@@ -215,7 +215,7 @@ Everything else listed under §RPC action surfaces.
|
|
|
215
215
|
|
|
216
216
|
### Middleware
|
|
217
217
|
|
|
218
|
-
- `auth/middleware.ts` — `create_auth_middleware_specs(deps, options)` assembles `[origin, session, request_context, bearer_auth]` + optional `daemon_token
|
|
218
|
+
- `auth/middleware.ts` — `create_auth_middleware_specs(deps, options)` assembles `[origin, session, request_context, bearer_auth]` + optional `daemon_token` (the content-type refusal isn't a middleware: `apply_route_specs` checks every `POST` route, see `http/simple_request.ts`). `AUTH_MIDDLEWARE_PATH` (`'/api/*'`) is where `create_app_server` mounts the stack; two assembly asserts lean on it: `assert_endpoint_in_auth_scope` (an `rpc_endpoints` / `ws_endpoints` path, or the bootstrap route under `bootstrap.route_prefix`, must sit inside it) and `assert_middleware_stack_mounted(stack_specs, middleware_specs)`, run on a `transform_middleware` result against the pre-transform stack (`[proxy, ...auth]`) — each stack spec, matched by its `handler` closure (not its spoofable `name`), mounted exactly once at its original path (`'*'` for the trusted proxy, `AUTH_MIDDLEWARE_PATH` for auth), in its original order; other specs may sit anywhere, including before the proxy and between the auth layers. The proxy is in the stack because dropping it turns every `get_client_ip` into `'unknown'`, one shared bucket for every IP-keyed limiter. The transform receives shallow copies in a fresh array, so an in-place mutation can't rewrite the originals the check reads. The check pins where those layers sit, not what added layers do — a layer you add runs with full context access. Both run in `create_test_app_surface_spec` too.
|
|
219
219
|
- `auth/request_context.ts` — `RequestContext`, `resolve_acting_actor`, `build_request_context`, predicates (`has_role`, `has_scoped_role`, `has_any_scoped_role` — the dispatcher's role gate and every builtin-role check read the **global** grant via `has_scoped_role(_, role, null)` / `has_any_scoped_role(_, roles, null)`; scope-blind `has_role` is never the gate for a builtin role), guards (`require_auth`, `require_role`, `require_credential_types`, `require_token_scope`), `token_scope_surface_denial` (the direct-call form, for surfaces that aren't route specs), `refresh_role_grants`.
|
|
220
220
|
- `auth/session_middleware.ts` — `process_session_cookie` integration, `create_session_and_set_cookie` (shared by login / signup / bootstrap; returns the token hashes of the sessions the cap evicted, which the caller closes after its commit — only login passes a cap).
|
|
221
221
|
- `auth/resolved_auth.ts` — `ResolvedAuth` (the resolved credential as one value: `account_id`, `credential_type`, `token_hash`, `api_token_id`), `get_resolved_auth(c)` (gathers it from the context keys the auth middleware set), and `revalidate_resolved_auth(deps, resolved)`, the no-touch re-read a long-lived connection runs once it is registered: session row / token row (by id) still live and still on the account, account not soft-deleted; a daemon token re-reads its account only. Reuses the middleware's own queries and predicates. Called by the WS upgrade (`actions/register_action_ws.ts`) and the audit SSE route between registering a connection pending and admitting it. Twin of the Rust `revalidate_resolved_auth`.
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @module
|
|
23
23
|
*/
|
|
24
24
|
import { clear_session_cookie, create_session_and_set_cookie } from './session_middleware.js';
|
|
25
|
-
import {
|
|
25
|
+
import { to_session_account } from './account_schema.js';
|
|
26
26
|
import { account_status_route_shape, create_account_route_shapes, DEFAULT_MAX_SESSIONS } from './account_route_schema.js';
|
|
27
27
|
import { hash_session_token, query_session_revoke_all_for_account, query_session_revoke_by_hash_unscoped } from './session_queries.js';
|
|
28
28
|
import { query_account_by_username_or_email, query_update_account_password } from './account_queries.js';
|
|
@@ -141,16 +141,16 @@ export declare const audit_metadata_schemas: Readonly<{
|
|
|
141
141
|
concurrent_change: "concurrent_change";
|
|
142
142
|
}>>;
|
|
143
143
|
credential_type: z.ZodOptional<z.ZodEnum<{
|
|
144
|
-
daemon_token: "daemon_token";
|
|
145
144
|
session: "session";
|
|
145
|
+
daemon_token: "daemon_token";
|
|
146
146
|
api_token: "api_token";
|
|
147
147
|
}>>;
|
|
148
148
|
}, z.core.$loose>>;
|
|
149
149
|
session_revoke: z.ZodObject<{
|
|
150
150
|
session_id: z.core.$ZodBranded<z.ZodString, "SessionId", "out">;
|
|
151
151
|
credential_type: z.ZodOptional<z.ZodEnum<{
|
|
152
|
-
daemon_token: "daemon_token";
|
|
153
152
|
session: "session";
|
|
153
|
+
daemon_token: "daemon_token";
|
|
154
154
|
api_token: "api_token";
|
|
155
155
|
}>>;
|
|
156
156
|
}, z.core.$loose>;
|
|
@@ -159,8 +159,8 @@ export declare const audit_metadata_schemas: Readonly<{
|
|
|
159
159
|
reason: z.ZodOptional<z.ZodString>;
|
|
160
160
|
attempted_account_id: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
161
161
|
credential_type: z.ZodOptional<z.ZodEnum<{
|
|
162
|
-
daemon_token: "daemon_token";
|
|
163
162
|
session: "session";
|
|
163
|
+
daemon_token: "daemon_token";
|
|
164
164
|
api_token: "api_token";
|
|
165
165
|
}>>;
|
|
166
166
|
}, z.core.$loose>;
|
|
@@ -168,16 +168,16 @@ export declare const audit_metadata_schemas: Readonly<{
|
|
|
168
168
|
token_id: z.ZodString;
|
|
169
169
|
name: z.ZodString;
|
|
170
170
|
credential_type: z.ZodOptional<z.ZodEnum<{
|
|
171
|
-
daemon_token: "daemon_token";
|
|
172
171
|
session: "session";
|
|
172
|
+
daemon_token: "daemon_token";
|
|
173
173
|
api_token: "api_token";
|
|
174
174
|
}>>;
|
|
175
175
|
}, z.core.$loose>;
|
|
176
176
|
token_revoke: z.ZodObject<{
|
|
177
177
|
token_id: z.ZodString;
|
|
178
178
|
credential_type: z.ZodOptional<z.ZodEnum<{
|
|
179
|
-
daemon_token: "daemon_token";
|
|
180
179
|
session: "session";
|
|
180
|
+
daemon_token: "daemon_token";
|
|
181
181
|
api_token: "api_token";
|
|
182
182
|
}>>;
|
|
183
183
|
}, z.core.$loose>;
|
|
@@ -385,8 +385,8 @@ export declare const CellListInput: z.ZodDefault<z.ZodObject<{
|
|
|
385
385
|
updated_at: "updated_at";
|
|
386
386
|
}>>;
|
|
387
387
|
order_direction: z.ZodOptional<z.ZodEnum<{
|
|
388
|
-
asc: "asc";
|
|
389
388
|
desc: "desc";
|
|
389
|
+
asc: "asc";
|
|
390
390
|
}>>;
|
|
391
391
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
392
392
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
@@ -737,8 +737,8 @@ export declare const cell_list_action_spec: {
|
|
|
737
737
|
updated_at: "updated_at";
|
|
738
738
|
}>>;
|
|
739
739
|
order_direction: z.ZodOptional<z.ZodEnum<{
|
|
740
|
-
asc: "asc";
|
|
741
740
|
desc: "desc";
|
|
741
|
+
asc: "asc";
|
|
742
742
|
}>>;
|
|
743
743
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
744
744
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1090,8 +1090,8 @@ export declare const all_cell_action_specs: readonly [{
|
|
|
1090
1090
|
updated_at: "updated_at";
|
|
1091
1091
|
}>>;
|
|
1092
1092
|
order_direction: z.ZodOptional<z.ZodEnum<{
|
|
1093
|
-
asc: "asc";
|
|
1094
1093
|
desc: "desc";
|
|
1094
|
+
asc: "asc";
|
|
1095
1095
|
}>>;
|
|
1096
1096
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
1097
1097
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
@@ -45,8 +45,8 @@ export declare const CREDENTIAL_TYPE_DAEMON_TOKEN = "daemon_token";
|
|
|
45
45
|
export declare const BUILTIN_CREDENTIAL_TYPES: readonly ["session", "api_token", "daemon_token"];
|
|
46
46
|
/** Zod enum for builtin credential types only. */
|
|
47
47
|
export declare const BuiltinCredentialType: z.ZodEnum<{
|
|
48
|
-
daemon_token: "daemon_token";
|
|
49
48
|
session: "session";
|
|
49
|
+
daemon_token: "daemon_token";
|
|
50
50
|
api_token: "api_token";
|
|
51
51
|
}>;
|
|
52
52
|
export type BuiltinCredentialType = z.infer<typeof BuiltinCredentialType>;
|
|
@@ -17,27 +17,30 @@ import type { MiddlewareSpec } from '../http/middleware_spec.js';
|
|
|
17
17
|
*
|
|
18
18
|
* `create_app_server` mounts the stack here, and refuses at assembly (via
|
|
19
19
|
* `assert_endpoint_in_auth_scope`, which `create_test_app_surface_spec` also
|
|
20
|
-
* runs) an `rpc_endpoints` or
|
|
21
|
-
* with `middleware_applies`, which follows Hono: `'/api/*'`
|
|
22
|
-
* and everything under `/api/`): an endpoint outside it would
|
|
23
|
-
* session parsing, so every call or upgrade would be
|
|
20
|
+
* runs) an `rpc_endpoints`, `ws_endpoints`, or bootstrap path the pattern does
|
|
21
|
+
* not match (tested with `middleware_applies`, which follows Hono: `'/api/*'`
|
|
22
|
+
* matches `/api` and everything under `/api/`): an endpoint outside it would
|
|
23
|
+
* get no origin check or session parsing, so every call or upgrade would be
|
|
24
|
+
* unauthenticated and any page could send it.
|
|
24
25
|
*/
|
|
25
26
|
export declare const AUTH_MIDDLEWARE_PATH = "/api/*";
|
|
26
27
|
/**
|
|
27
28
|
* Throw when an endpoint path sits outside the auth middleware's scope
|
|
28
|
-
* (`AUTH_MIDDLEWARE_PATH`) — there it would get no
|
|
29
|
-
* parsing, so every call or upgrade would be
|
|
29
|
+
* (`AUTH_MIDDLEWARE_PATH`) — there it would get no origin check and no
|
|
30
|
+
* session or bearer parsing, so every call or upgrade would be
|
|
31
|
+
* unauthenticated and any page could send it.
|
|
30
32
|
* `middleware_applies` matches the way Hono matches the middleware's pattern.
|
|
31
33
|
*
|
|
32
34
|
* `create_app_server` calls it for every `rpc_endpoints` and `ws_endpoints`
|
|
33
|
-
* path at assembly, and `create_test_app_surface_spec`
|
|
34
|
-
* surface snapshot never records an endpoint the real
|
|
35
|
+
* path and the bootstrap route at assembly, and `create_test_app_surface_spec`
|
|
36
|
+
* does the same, so a surface snapshot never records an endpoint the real
|
|
37
|
+
* server refuses.
|
|
35
38
|
*
|
|
36
39
|
* @param option - the option the path came from, named in the error
|
|
37
40
|
* @param path - the endpoint path to check
|
|
38
41
|
* @throws Error when `path` is outside `AUTH_MIDDLEWARE_PATH`
|
|
39
42
|
*/
|
|
40
|
-
export declare const assert_endpoint_in_auth_scope: (option: "rpc_endpoints" | "ws_endpoints", path: string) => void;
|
|
43
|
+
export declare const assert_endpoint_in_auth_scope: (option: "rpc_endpoints" | "ws_endpoints" | "bootstrap.route_prefix", path: string) => void;
|
|
41
44
|
/**
|
|
42
45
|
* Throw unless a middleware list still mounts every spec of the stack it was
|
|
43
46
|
* built from — the trusted-proxy spec and the auth middleware — exactly once,
|
|
@@ -84,7 +87,7 @@ export interface AuthMiddlewareOptions {
|
|
|
84
87
|
*
|
|
85
88
|
* Returns `[origin, session, request_context, bearer_auth]` middleware specs
|
|
86
89
|
* for the given path pattern. When `daemon_token_state` is provided, appends
|
|
87
|
-
* a
|
|
90
|
+
* a `daemon_token` layer. Apps can append extra entries for non-standard
|
|
88
91
|
* paths (e.g., tx's `/tx` binary endpoint).
|
|
89
92
|
*
|
|
90
93
|
* @param deps - stateless capabilities (keyring, db)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,6BAA6B,GACzC,QAAQ,eAAe,GAAG,cAAc,GAAG,wBAAwB,EACnE,MAAM,MAAM,KACV,IAQF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,+BAA+B,GAC3C,aAAa,aAAa,CAAC,cAAc,CAAC,EAC1C,kBAAkB,aAAa,CAAC,cAAc,CAAC,KAC7C,IA+BF,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;CACtC;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,OAAO,EACb,SAAS,qBAAqB,KAC5B,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CA4E/B,CAAC"}
|
package/dist/auth/middleware.js
CHANGED
|
@@ -15,21 +15,24 @@ import { middleware_applies } from '../http/schema_helpers.js';
|
|
|
15
15
|
*
|
|
16
16
|
* `create_app_server` mounts the stack here, and refuses at assembly (via
|
|
17
17
|
* `assert_endpoint_in_auth_scope`, which `create_test_app_surface_spec` also
|
|
18
|
-
* runs) an `rpc_endpoints` or
|
|
19
|
-
* with `middleware_applies`, which follows Hono: `'/api/*'`
|
|
20
|
-
* and everything under `/api/`): an endpoint outside it would
|
|
21
|
-
* session parsing, so every call or upgrade would be
|
|
18
|
+
* runs) an `rpc_endpoints`, `ws_endpoints`, or bootstrap path the pattern does
|
|
19
|
+
* not match (tested with `middleware_applies`, which follows Hono: `'/api/*'`
|
|
20
|
+
* matches `/api` and everything under `/api/`): an endpoint outside it would
|
|
21
|
+
* get no origin check or session parsing, so every call or upgrade would be
|
|
22
|
+
* unauthenticated and any page could send it.
|
|
22
23
|
*/
|
|
23
24
|
export const AUTH_MIDDLEWARE_PATH = '/api/*';
|
|
24
25
|
/**
|
|
25
26
|
* Throw when an endpoint path sits outside the auth middleware's scope
|
|
26
|
-
* (`AUTH_MIDDLEWARE_PATH`) — there it would get no
|
|
27
|
-
* parsing, so every call or upgrade would be
|
|
27
|
+
* (`AUTH_MIDDLEWARE_PATH`) — there it would get no origin check and no
|
|
28
|
+
* session or bearer parsing, so every call or upgrade would be
|
|
29
|
+
* unauthenticated and any page could send it.
|
|
28
30
|
* `middleware_applies` matches the way Hono matches the middleware's pattern.
|
|
29
31
|
*
|
|
30
32
|
* `create_app_server` calls it for every `rpc_endpoints` and `ws_endpoints`
|
|
31
|
-
* path at assembly, and `create_test_app_surface_spec`
|
|
32
|
-
* surface snapshot never records an endpoint the real
|
|
33
|
+
* path and the bootstrap route at assembly, and `create_test_app_surface_spec`
|
|
34
|
+
* does the same, so a surface snapshot never records an endpoint the real
|
|
35
|
+
* server refuses.
|
|
33
36
|
*
|
|
34
37
|
* @param option - the option the path came from, named in the error
|
|
35
38
|
* @param path - the endpoint path to check
|
|
@@ -38,7 +41,8 @@ export const AUTH_MIDDLEWARE_PATH = '/api/*';
|
|
|
38
41
|
export const assert_endpoint_in_auth_scope = (option, path) => {
|
|
39
42
|
if (!middleware_applies(AUTH_MIDDLEWARE_PATH, path)) {
|
|
40
43
|
throw new Error(`${option} path ${path} is outside the auth middleware's scope ` +
|
|
41
|
-
`(${AUTH_MIDDLEWARE_PATH}) — it would
|
|
44
|
+
`(${AUTH_MIDDLEWARE_PATH}) — it would skip the origin check and see every caller ` +
|
|
45
|
+
`as unauthenticated — mount it under /api/`);
|
|
42
46
|
}
|
|
43
47
|
};
|
|
44
48
|
/**
|
|
@@ -105,7 +109,7 @@ export const assert_middleware_stack_mounted = (stack_specs, middleware_specs) =
|
|
|
105
109
|
*
|
|
106
110
|
* Returns `[origin, session, request_context, bearer_auth]` middleware specs
|
|
107
111
|
* for the given path pattern. When `daemon_token_state` is provided, appends
|
|
108
|
-
* a
|
|
112
|
+
* a `daemon_token` layer. Apps can append extra entries for non-standard
|
|
109
113
|
* paths (e.g., tx's `/tx` binary endpoint).
|
|
110
114
|
*
|
|
111
115
|
* @param deps - stateless capabilities (keyring, db)
|
package/dist/cli/daemon.js
CHANGED
package/dist/cli/logger.js
CHANGED
package/dist/env/load.js
CHANGED
package/dist/hono_context.d.ts
CHANGED
|
@@ -24,8 +24,8 @@ import type { RequestContext } from './auth/request_context.js';
|
|
|
24
24
|
export declare const CREDENTIAL_TYPES: readonly ["session", "api_token", "daemon_token"];
|
|
25
25
|
/** Credential type — how a request was authenticated. */
|
|
26
26
|
export declare const CredentialType: z.ZodEnum<{
|
|
27
|
-
daemon_token: "daemon_token";
|
|
28
27
|
session: "session";
|
|
28
|
+
daemon_token: "daemon_token";
|
|
29
29
|
api_token: "api_token";
|
|
30
30
|
}>;
|
|
31
31
|
export type CredentialType = z.infer<typeof CredentialType>;
|
package/dist/http/CLAUDE.md
CHANGED
|
@@ -167,12 +167,13 @@ Pair every schema with the `z.infer` type export.
|
|
|
167
167
|
`merge_error_schemas(spec, middleware_errors?)` (in `http/schema_helpers.ts`)
|
|
168
168
|
merges three layers, later overrides earlier at the same status code:
|
|
169
169
|
|
|
170
|
-
1. **Derived** — from `derive_error_schemas({auth, has_input?, has_params?, has_query?, rate_limit?})`:
|
|
170
|
+
1. **Derived** — from `derive_error_schemas({auth, has_input?, has_params?, has_query?, rate_limit?, checks_content_type?})`:
|
|
171
171
|
- `has_input || has_params || has_query` → 400 `ValidationError`
|
|
172
172
|
- `auth.account === 'required'` or `auth.actor === 'required'` → 401 `ApiError`
|
|
173
173
|
- `auth.roles?.length` → 403 `PermissionError` (carries `required_roles`)
|
|
174
174
|
- `auth.credential_types?.length` → 403 `CredentialTypeRequiredError` (carries `required_credential_types`; both gates set yields `z.union([PermissionError, CredentialTypeRequiredError])`)
|
|
175
175
|
- `rate_limit` → 429 `RateLimitError`
|
|
176
|
+
- `checks_content_type` (every `POST`) → 415 `ApiError` (`unsupported_content_type`)
|
|
176
177
|
- `auth.actor !== 'none'` → widens 400 to a union with `ActorRequiredError` / `ActorNotOnAccountError` and adds 500 union of `NoActorsOnAccountError` / `AccountVanishedError`. Mirrors what the dispatcher's authorization phase actually emits on routes whose input declares `acting?: ActingActor` (per registry-time invariant 2) — so DEV-mode error-schema validation doesn't reject the auth phase's body.
|
|
177
178
|
2. **Middleware** — from `MiddlewareSpec.errors` that apply to the route's path (via `middleware_applies`)
|
|
178
179
|
3. **Explicit** — `RouteSpec.errors` — always wins
|
|
@@ -91,9 +91,9 @@ export declare const parse_acting: (value: unknown) => string | undefined;
|
|
|
91
91
|
* without an actor binding).
|
|
92
92
|
*/
|
|
93
93
|
export declare const AuthAxisState: z.ZodEnum<{
|
|
94
|
-
optional: "optional";
|
|
95
|
-
none: "none";
|
|
96
94
|
required: "required";
|
|
95
|
+
none: "none";
|
|
96
|
+
optional: "optional";
|
|
97
97
|
}>;
|
|
98
98
|
export type AuthAxisState = z.infer<typeof AuthAxisState>;
|
|
99
99
|
/**
|
|
@@ -123,14 +123,14 @@ export type AuthAxisState = z.infer<typeof AuthAxisState>;
|
|
|
123
123
|
*/
|
|
124
124
|
export declare const RouteAuth: z.ZodObject<{
|
|
125
125
|
account: z.ZodEnum<{
|
|
126
|
-
optional: "optional";
|
|
127
|
-
none: "none";
|
|
128
126
|
required: "required";
|
|
127
|
+
none: "none";
|
|
128
|
+
optional: "optional";
|
|
129
129
|
}>;
|
|
130
130
|
actor: z.ZodEnum<{
|
|
131
|
-
optional: "optional";
|
|
132
|
-
none: "none";
|
|
133
131
|
required: "required";
|
|
132
|
+
none: "none";
|
|
133
|
+
optional: "optional";
|
|
134
134
|
}>;
|
|
135
135
|
roles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
136
136
|
credential_types: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
@@ -55,6 +55,12 @@ export declare const ERROR_INVALID_CREDENTIALS: "invalid_credentials";
|
|
|
55
55
|
export declare const ERROR_PAYLOAD_TOO_LARGE: "payload_too_large";
|
|
56
56
|
/** Request origin not in allowlist. */
|
|
57
57
|
export declare const ERROR_FORBIDDEN_ORIGIN: "forbidden_origin";
|
|
58
|
+
/**
|
|
59
|
+
* A `POST` whose `Content-Type` the route refuses: anything but
|
|
60
|
+
* `application/json` on a JSON route, a CORS-safelisted type or none on a
|
|
61
|
+
* `raw_body` one. See `http/simple_request.ts`.
|
|
62
|
+
*/
|
|
63
|
+
export declare const ERROR_UNSUPPORTED_CONTENT_TYPE: "unsupported_content_type";
|
|
58
64
|
/** Bearer token failed validation (missing, malformed, or revoked). */
|
|
59
65
|
export declare const ERROR_INVALID_TOKEN: "invalid_token";
|
|
60
66
|
/** Token references a deleted account. */
|
|
@@ -290,9 +296,9 @@ export type RouteErrorSchemas = Partial<Record<number, z.ZodType>>;
|
|
|
290
296
|
* - `'both'` — both keys.
|
|
291
297
|
*/
|
|
292
298
|
export declare const RateLimitKey: z.ZodEnum<{
|
|
299
|
+
both: "both";
|
|
293
300
|
account: "account";
|
|
294
301
|
ip: "ip";
|
|
295
|
-
both: "both";
|
|
296
302
|
}>;
|
|
297
303
|
export type RateLimitKey = z.infer<typeof RateLimitKey>;
|
|
298
304
|
/**
|
|
@@ -320,6 +326,9 @@ export type RateLimitKey = z.infer<typeof RateLimitKey>;
|
|
|
320
326
|
* of `NoActorsOnAccountError` / `AccountVanishedError`. The dispatcher's
|
|
321
327
|
* authorization phase emits these whenever it tries to resolve an actor.
|
|
322
328
|
* - **rate_limit**: 429 (`RateLimitError` with `retry_after`).
|
|
329
|
+
* - **checks_content_type**: 415 (`ApiError`, `unsupported_content_type`) —
|
|
330
|
+
* every `POST` route (see `is_post_content_type_refused` in
|
|
331
|
+
* `http/simple_request.ts`).
|
|
323
332
|
*/
|
|
324
333
|
export interface DeriveErrorSchemasOptions {
|
|
325
334
|
auth: RouteAuth;
|
|
@@ -327,6 +336,7 @@ export interface DeriveErrorSchemasOptions {
|
|
|
327
336
|
has_params?: boolean;
|
|
328
337
|
has_query?: boolean;
|
|
329
338
|
rate_limit?: RateLimitKey;
|
|
339
|
+
checks_content_type?: boolean;
|
|
330
340
|
}
|
|
331
|
-
export declare const derive_error_schemas: ({ auth, has_input, has_params, has_query, rate_limit }: DeriveErrorSchemasOptions) => RouteErrorSchemas;
|
|
341
|
+
export declare const derive_error_schemas: ({ auth, has_input, has_params, has_query, rate_limit, checks_content_type }: DeriveErrorSchemasOptions) => RouteErrorSchemas;
|
|
332
342
|
//# sourceMappingURL=error_schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/error_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI9D,0CAA0C;AAC1C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,uDAAuD;AACvD,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAEpE,6CAA6C;AAC7C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAI1E,wCAAwC;AACxC,eAAO,M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