@fuzdev/fuz_app 0.52.0 → 0.53.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.
Files changed (247) hide show
  1. package/dist/actions/CLAUDE.md +29 -9
  2. package/dist/actions/action_codegen.d.ts +10 -35
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +13 -42
  5. package/dist/actions/action_peer.d.ts.map +1 -1
  6. package/dist/actions/action_peer.js +0 -9
  7. package/dist/actions/action_registry.d.ts +0 -4
  8. package/dist/actions/action_registry.d.ts.map +1 -1
  9. package/dist/actions/action_registry.js +4 -10
  10. package/dist/actions/action_rpc.d.ts +16 -0
  11. package/dist/actions/action_rpc.d.ts.map +1 -1
  12. package/dist/actions/action_rpc.js +41 -20
  13. package/dist/actions/action_spec.d.ts +54 -5
  14. package/dist/actions/action_spec.d.ts.map +1 -1
  15. package/dist/actions/action_spec.js +21 -5
  16. package/dist/actions/frontend_rpc_client.d.ts +1 -9
  17. package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
  18. package/dist/actions/frontend_rpc_client.js +1 -9
  19. package/dist/actions/register_action_ws.d.ts +16 -0
  20. package/dist/actions/register_action_ws.d.ts.map +1 -1
  21. package/dist/actions/register_action_ws.js +41 -1
  22. package/dist/actions/request_tracker.svelte.d.ts +10 -15
  23. package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
  24. package/dist/actions/request_tracker.svelte.js +10 -15
  25. package/dist/actions/rpc_client.d.ts +0 -1
  26. package/dist/actions/rpc_client.d.ts.map +1 -1
  27. package/dist/actions/rpc_client.js +3 -17
  28. package/dist/actions/socket.svelte.d.ts +0 -1
  29. package/dist/actions/socket.svelte.d.ts.map +1 -1
  30. package/dist/actions/socket.svelte.js +0 -1
  31. package/dist/actions/transports.d.ts +4 -3
  32. package/dist/actions/transports.d.ts.map +1 -1
  33. package/dist/actions/transports.js +4 -13
  34. package/dist/actions/transports_ws_auth_guard.d.ts +0 -2
  35. package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
  36. package/dist/actions/transports_ws_auth_guard.js +0 -2
  37. package/dist/actions/transports_ws_backend.d.ts.map +1 -1
  38. package/dist/actions/transports_ws_backend.js +0 -9
  39. package/dist/auth/CLAUDE.md +24 -14
  40. package/dist/auth/account_queries.d.ts +0 -3
  41. package/dist/auth/account_queries.d.ts.map +1 -1
  42. package/dist/auth/account_queries.js +0 -3
  43. package/dist/auth/admin_action_specs.d.ts +5 -0
  44. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  45. package/dist/auth/admin_action_specs.js +5 -0
  46. package/dist/auth/api_token_queries.d.ts +0 -1
  47. package/dist/auth/api_token_queries.d.ts.map +1 -1
  48. package/dist/auth/api_token_queries.js +0 -1
  49. package/dist/auth/audit_log_queries.d.ts +0 -1
  50. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  51. package/dist/auth/audit_log_queries.js +0 -1
  52. package/dist/auth/audit_log_routes.d.ts +2 -2
  53. package/dist/auth/audit_log_routes.js +2 -2
  54. package/dist/auth/invite_queries.d.ts +0 -1
  55. package/dist/auth/invite_queries.d.ts.map +1 -1
  56. package/dist/auth/invite_queries.js +0 -1
  57. package/dist/auth/permit_offer_action_specs.d.ts +1 -0
  58. package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
  59. package/dist/auth/permit_offer_action_specs.js +1 -0
  60. package/dist/auth/permit_offer_queries.d.ts +0 -1
  61. package/dist/auth/permit_offer_queries.d.ts.map +1 -1
  62. package/dist/auth/permit_offer_queries.js +0 -1
  63. package/dist/auth/permit_queries.d.ts +0 -1
  64. package/dist/auth/permit_queries.d.ts.map +1 -1
  65. package/dist/auth/permit_queries.js +0 -1
  66. package/dist/auth/session_lifecycle.d.ts +0 -1
  67. package/dist/auth/session_lifecycle.d.ts.map +1 -1
  68. package/dist/auth/session_lifecycle.js +0 -1
  69. package/dist/auth/session_middleware.d.ts +0 -4
  70. package/dist/auth/session_middleware.d.ts.map +1 -1
  71. package/dist/auth/session_middleware.js +0 -4
  72. package/dist/cli/config.d.ts +0 -3
  73. package/dist/cli/config.d.ts.map +1 -1
  74. package/dist/cli/config.js +0 -3
  75. package/dist/cli/daemon.d.ts +1 -1
  76. package/dist/cli/daemon.js +1 -1
  77. package/dist/db/create_db.d.ts +0 -1
  78. package/dist/db/create_db.d.ts.map +1 -1
  79. package/dist/db/create_db.js +0 -1
  80. package/dist/db/db.d.ts +0 -4
  81. package/dist/db/db.d.ts.map +1 -1
  82. package/dist/db/db.js +0 -4
  83. package/dist/db/db_pg.d.ts +2 -2
  84. package/dist/db/db_pg.js +2 -2
  85. package/dist/db/db_pglite.d.ts +1 -2
  86. package/dist/db/db_pglite.d.ts.map +1 -1
  87. package/dist/db/db_pglite.js +1 -2
  88. package/dist/db/migrate.d.ts +0 -1
  89. package/dist/db/migrate.d.ts.map +1 -1
  90. package/dist/db/migrate.js +0 -1
  91. package/dist/dev/setup.d.ts +0 -3
  92. package/dist/dev/setup.d.ts.map +1 -1
  93. package/dist/dev/setup.js +0 -3
  94. package/dist/env/load.d.ts +0 -2
  95. package/dist/env/load.d.ts.map +1 -1
  96. package/dist/env/load.js +0 -2
  97. package/dist/hono_context.d.ts +2 -5
  98. package/dist/hono_context.d.ts.map +1 -1
  99. package/dist/hono_context.js +2 -5
  100. package/dist/http/common_routes.d.ts +0 -8
  101. package/dist/http/common_routes.d.ts.map +1 -1
  102. package/dist/http/common_routes.js +0 -8
  103. package/dist/http/db_routes.d.ts +0 -3
  104. package/dist/http/db_routes.d.ts.map +1 -1
  105. package/dist/http/db_routes.js +0 -3
  106. package/dist/http/error_schemas.d.ts +12 -11
  107. package/dist/http/error_schemas.d.ts.map +1 -1
  108. package/dist/http/error_schemas.js +11 -7
  109. package/dist/http/jsonrpc_errors.d.ts +0 -6
  110. package/dist/http/jsonrpc_errors.d.ts.map +1 -1
  111. package/dist/http/jsonrpc_errors.js +0 -6
  112. package/dist/http/origin.d.ts +6 -13
  113. package/dist/http/origin.d.ts.map +1 -1
  114. package/dist/http/origin.js +7 -14
  115. package/dist/http/proxy.d.ts +1 -7
  116. package/dist/http/proxy.d.ts.map +1 -1
  117. package/dist/http/proxy.js +1 -7
  118. package/dist/http/route_spec.d.ts +13 -35
  119. package/dist/http/route_spec.d.ts.map +1 -1
  120. package/dist/http/route_spec.js +10 -22
  121. package/dist/http/schema_helpers.d.ts +0 -4
  122. package/dist/http/schema_helpers.d.ts.map +1 -1
  123. package/dist/http/schema_helpers.js +0 -4
  124. package/dist/http/surface.d.ts +2 -12
  125. package/dist/http/surface.d.ts.map +1 -1
  126. package/dist/http/surface.js +1 -12
  127. package/dist/rate_limiter.d.ts +16 -0
  128. package/dist/rate_limiter.d.ts.map +1 -1
  129. package/dist/rate_limiter.js +26 -0
  130. package/dist/realtime/sse.d.ts +0 -1
  131. package/dist/realtime/sse.d.ts.map +1 -1
  132. package/dist/realtime/sse.js +0 -1
  133. package/dist/realtime/subscriber_registry.d.ts +0 -3
  134. package/dist/realtime/subscriber_registry.d.ts.map +1 -1
  135. package/dist/realtime/subscriber_registry.js +0 -3
  136. package/dist/runtime/fs.d.ts +1 -4
  137. package/dist/runtime/fs.d.ts.map +1 -1
  138. package/dist/runtime/fs.js +1 -4
  139. package/dist/runtime/mock.d.ts +0 -3
  140. package/dist/runtime/mock.d.ts.map +1 -1
  141. package/dist/runtime/mock.js +0 -3
  142. package/dist/server/app_server.d.ts +27 -5
  143. package/dist/server/app_server.d.ts.map +1 -1
  144. package/dist/server/app_server.js +19 -7
  145. package/dist/server/startup.d.ts +0 -2
  146. package/dist/server/startup.d.ts.map +1 -1
  147. package/dist/server/startup.js +0 -2
  148. package/dist/server/static.d.ts +0 -1
  149. package/dist/server/static.d.ts.map +1 -1
  150. package/dist/server/static.js +0 -1
  151. package/dist/server/validate_nginx.d.ts +0 -3
  152. package/dist/server/validate_nginx.d.ts.map +1 -1
  153. package/dist/server/validate_nginx.js +0 -3
  154. package/dist/testing/CLAUDE.md +1 -1
  155. package/dist/testing/admin_integration.d.ts +0 -1
  156. package/dist/testing/admin_integration.d.ts.map +1 -1
  157. package/dist/testing/admin_integration.js +3 -6
  158. package/dist/testing/adversarial_404.d.ts +0 -2
  159. package/dist/testing/adversarial_404.d.ts.map +1 -1
  160. package/dist/testing/adversarial_404.js +0 -2
  161. package/dist/testing/adversarial_headers.d.ts +0 -1
  162. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  163. package/dist/testing/adversarial_headers.js +0 -1
  164. package/dist/testing/adversarial_input.d.ts +0 -2
  165. package/dist/testing/adversarial_input.d.ts.map +1 -1
  166. package/dist/testing/adversarial_input.js +0 -2
  167. package/dist/testing/app_server.d.ts +22 -0
  168. package/dist/testing/app_server.d.ts.map +1 -1
  169. package/dist/testing/app_server.js +2 -4
  170. package/dist/testing/assertions.d.ts +0 -4
  171. package/dist/testing/assertions.d.ts.map +1 -1
  172. package/dist/testing/assertions.js +0 -4
  173. package/dist/testing/attack_surface.d.ts +0 -4
  174. package/dist/testing/attack_surface.d.ts.map +1 -1
  175. package/dist/testing/attack_surface.js +0 -4
  176. package/dist/testing/audit_completeness.d.ts +0 -1
  177. package/dist/testing/audit_completeness.d.ts.map +1 -1
  178. package/dist/testing/audit_completeness.js +0 -1
  179. package/dist/testing/auth_apps.d.ts +2 -10
  180. package/dist/testing/auth_apps.d.ts.map +1 -1
  181. package/dist/testing/auth_apps.js +2 -10
  182. package/dist/testing/data_exposure.d.ts +0 -11
  183. package/dist/testing/data_exposure.d.ts.map +1 -1
  184. package/dist/testing/data_exposure.js +0 -11
  185. package/dist/testing/db.d.ts +0 -6
  186. package/dist/testing/db.d.ts.map +1 -1
  187. package/dist/testing/db.js +0 -6
  188. package/dist/testing/error_coverage.d.ts +0 -14
  189. package/dist/testing/error_coverage.d.ts.map +1 -1
  190. package/dist/testing/error_coverage.js +0 -14
  191. package/dist/testing/integration.d.ts +0 -1
  192. package/dist/testing/integration.d.ts.map +1 -1
  193. package/dist/testing/integration.js +0 -1
  194. package/dist/testing/integration_helpers.d.ts +1 -36
  195. package/dist/testing/integration_helpers.d.ts.map +1 -1
  196. package/dist/testing/integration_helpers.js +1 -43
  197. package/dist/testing/middleware.d.ts +0 -10
  198. package/dist/testing/middleware.d.ts.map +1 -1
  199. package/dist/testing/middleware.js +0 -10
  200. package/dist/testing/mock_fs.d.ts +0 -2
  201. package/dist/testing/mock_fs.d.ts.map +1 -1
  202. package/dist/testing/mock_fs.js +0 -2
  203. package/dist/testing/rate_limiting.d.ts +0 -1
  204. package/dist/testing/rate_limiting.d.ts.map +1 -1
  205. package/dist/testing/rate_limiting.js +0 -1
  206. package/dist/testing/round_trip.d.ts +0 -2
  207. package/dist/testing/round_trip.d.ts.map +1 -1
  208. package/dist/testing/round_trip.js +0 -2
  209. package/dist/testing/rpc_attack_surface.d.ts +0 -2
  210. package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
  211. package/dist/testing/rpc_attack_surface.js +0 -2
  212. package/dist/testing/rpc_helpers.d.ts +0 -6
  213. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  214. package/dist/testing/rpc_helpers.js +0 -6
  215. package/dist/testing/rpc_round_trip.d.ts +0 -2
  216. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  217. package/dist/testing/rpc_round_trip.js +0 -2
  218. package/dist/testing/schema_generators.d.ts +0 -3
  219. package/dist/testing/schema_generators.d.ts.map +1 -1
  220. package/dist/testing/schema_generators.js +17 -3
  221. package/dist/testing/sse_round_trip.d.ts +0 -1
  222. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  223. package/dist/testing/sse_round_trip.js +0 -1
  224. package/dist/testing/standard.d.ts +0 -2
  225. package/dist/testing/standard.d.ts.map +1 -1
  226. package/dist/testing/standard.js +0 -2
  227. package/dist/testing/stubs.d.ts +3 -5
  228. package/dist/testing/stubs.d.ts.map +1 -1
  229. package/dist/testing/stubs.js +5 -5
  230. package/dist/testing/surface_invariants.d.ts +0 -3
  231. package/dist/testing/surface_invariants.d.ts.map +1 -1
  232. package/dist/testing/surface_invariants.js +0 -3
  233. package/dist/ui/CLAUDE.md +1 -1
  234. package/dist/ui/audit_log_state.svelte.js +1 -1
  235. package/dist/ui/position_helpers.d.ts +0 -3
  236. package/dist/ui/position_helpers.d.ts.map +1 -1
  237. package/dist/ui/position_helpers.js +0 -3
  238. package/dist/ui/sidebar_state.svelte.d.ts +1 -2
  239. package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
  240. package/dist/ui/sidebar_state.svelte.js +1 -2
  241. package/dist/ui/ui_fetch.d.ts +1 -7
  242. package/dist/ui/ui_fetch.d.ts.map +1 -1
  243. package/dist/ui/ui_fetch.js +1 -7
  244. package/dist/ui/ui_format.d.ts +2 -14
  245. package/dist/ui/ui_format.d.ts.map +1 -1
  246. package/dist/ui/ui_format.js +2 -14
  247. package/package.json +2 -2
@@ -28,7 +28,7 @@ import type { Handler } from 'hono';
28
28
  * - `https://*.api.fuz.dev,http://127.0.0.1:*`
29
29
  * - `http://[::1]:*,https://*.*.corp.fuz.dev:*`
30
30
  *
31
- * @throws if any individual pattern is invalid (missing protocol, partial wildcards, etc.)
31
+ * @throws Error if any individual pattern is invalid (missing protocol, partial wildcards, etc.)
32
32
  */
33
33
  export declare const parse_allowed_origins: (env_value: string | undefined) => Array<RegExp>;
34
34
  /**
@@ -39,19 +39,12 @@ export declare const should_allow_origin: (origin: string, allowed_patterns: Arr
39
39
  /**
40
40
  * Middleware that verifies the request source against an allowlist.
41
41
  *
42
- * Origin allowlisting (not the CSRF layer — that's `SameSite: strict` cookies) that:
43
- * - Checks the Origin header first (if present)
44
- * - Falls back to Referer header (if no Origin)
45
- * - Allows requests without Origin/Referer headers (direct access, curl, etc.)
42
+ * Origin allowlisting (not the CSRF layer — that's `SameSite: strict` cookies):
43
+ * - Checks the `Origin` header first (if present)
44
+ * - Falls back to `Referer` header (if no `Origin`)
45
+ * - Allows requests without `Origin`/`Referer` headers (direct access, curl, etc.)
46
46
  *
47
- * This is useful for:
48
- * - Protecting locally-running services from being called by
49
- * untrusted websites as the user browses the web
50
- * - Restricting which domains can make requests to your API
51
- * - Preventing embedding of your service in unexpected sites
52
- * - Basic source verification for locally-running services
53
- *
54
- * @param allowed_patterns - array of compiled regex patterns from parse_allowed_origins
47
+ * @param allowed_patterns - compiled regex patterns from `parse_allowed_origins`
55
48
  */
56
49
  export declare const verify_request_source: (allowed_patterns: Array<RegExp>) => Handler;
57
50
  //# sourceMappingURL=origin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"origin.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAIlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,GAAG,SAAS,KAAG,KAAK,CAAC,MAAM,CAO5E,CAAC;AAEP;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,EAAE,kBAAkB,KAAK,CAAC,MAAM,CAAC,KAAG,OACzC,CAAC;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qBAAqB,GAChC,kBAAkB,KAAK,CAAC,MAAM,CAAC,KAAG,OA2BlC,CAAC"}
1
+ {"version":3,"file":"origin.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAIlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,GAAG,SAAS,KAAG,KAAK,CAAC,MAAM,CAO5E,CAAC;AAEP;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,EAAE,kBAAkB,KAAK,CAAC,MAAM,CAAC,KAAG,OACzC,CAAC;AAE9C;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GAChC,kBAAkB,KAAK,CAAC,MAAM,CAAC,KAAG,OA2BlC,CAAC"}
@@ -29,7 +29,7 @@ import { ERROR_FORBIDDEN_ORIGIN, ERROR_FORBIDDEN_REFERER } from './error_schemas
29
29
  * - `https://*.api.fuz.dev,http://127.0.0.1:*`
30
30
  * - `http://[::1]:*,https://*.*.corp.fuz.dev:*`
31
31
  *
32
- * @throws if any individual pattern is invalid (missing protocol, partial wildcards, etc.)
32
+ * @throws Error if any individual pattern is invalid (missing protocol, partial wildcards, etc.)
33
33
  */
34
34
  export const parse_allowed_origins = (env_value) => env_value
35
35
  ? env_value
@@ -46,19 +46,12 @@ export const should_allow_origin = (origin, allowed_patterns) => allowed_pattern
46
46
  /**
47
47
  * Middleware that verifies the request source against an allowlist.
48
48
  *
49
- * Origin allowlisting (not the CSRF layer — that's `SameSite: strict` cookies) that:
50
- * - Checks the Origin header first (if present)
51
- * - Falls back to Referer header (if no Origin)
52
- * - Allows requests without Origin/Referer headers (direct access, curl, etc.)
49
+ * Origin allowlisting (not the CSRF layer — that's `SameSite: strict` cookies):
50
+ * - Checks the `Origin` header first (if present)
51
+ * - Falls back to `Referer` header (if no `Origin`)
52
+ * - Allows requests without `Origin`/`Referer` headers (direct access, curl, etc.)
53
53
  *
54
- * This is useful for:
55
- * - Protecting locally-running services from being called by
56
- * untrusted websites as the user browses the web
57
- * - Restricting which domains can make requests to your API
58
- * - Preventing embedding of your service in unexpected sites
59
- * - Basic source verification for locally-running services
60
- *
61
- * @param allowed_patterns - array of compiled regex patterns from parse_allowed_origins
54
+ * @param allowed_patterns - compiled regex patterns from `parse_allowed_origins`
62
55
  */
63
56
  export const verify_request_source = (allowed_patterns) => (c, next) => {
64
57
  // Check origin header (preferred, sent by browsers for CORS requests).
@@ -106,7 +99,7 @@ export const verify_request_source = (allowed_patterns) => (c, next) => {
106
99
  * like `[::ffff:127.0.0.1]` will be normalized to `[::ffff:7f00:1]`. IPv6 zone
107
100
  * identifiers (e.g., `%eth0`) are not supported.
108
101
  *
109
- * @throws if pattern format is invalid
102
+ * @throws Error if pattern format is invalid
110
103
  */
111
104
  const origin_pattern_to_regexp = (pattern) => {
112
105
  // Quick validation: no paths, query strings, or fragments allowed
@@ -18,8 +18,6 @@ import type { MiddlewareSpec } from './middleware_spec.js';
18
18
  * - Lowercases for case-insensitive IPv6 comparison
19
19
  * - Idempotent: calling twice produces the same result
20
20
  * - Safe on non-IP strings: `normalize_ip('unknown')` returns `'unknown'`
21
- *
22
- * @param ip - IP address string to normalize
23
21
  */
24
22
  export declare const normalize_ip: (ip: string) => string;
25
23
  /**
@@ -53,16 +51,13 @@ export type ParsedProxy = {
53
51
  * CIDR prefixes are validated against address family bounds.
54
52
  *
55
53
  * @param entry - IP address or CIDR notation
56
- * @throws on invalid IP, invalid CIDR network, or NaN/negative/over-range prefix
54
+ * @throws Error on invalid IP, invalid CIDR network, or NaN/negative/over-range prefix
57
55
  */
58
56
  export declare const parse_proxy_entry: (entry: string) => ParsedProxy;
59
57
  /**
60
58
  * Check whether `ip` matches any entry in the trusted proxy list.
61
59
  *
62
60
  * Normalizes `ip` before matching (lowercase, IPv4-mapped IPv6 stripped).
63
- *
64
- * @param ip - the IP address to check
65
- * @param proxies - parsed proxy entries
66
61
  */
67
62
  export declare const is_trusted_ip: (ip: string, proxies: Array<ParsedProxy>) => boolean;
68
63
  /**
@@ -102,7 +97,6 @@ export declare const create_proxy_middleware: (options: ProxyOptions) => Middlew
102
97
  * Apply before auth middleware so `client_ip` is available for rate limiting.
103
98
  *
104
99
  * @param options - trusted proxy configuration
105
- * @throws Error if any entry in `options.trusted_proxies` is invalid (delegates to `create_proxy_middleware`)
106
100
  */
107
101
  export declare const create_proxy_middleware_spec: (options: ProxyOptions) => MiddlewareSpec;
108
102
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/proxy.ts"],"names":[],"m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;AAQF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAC7B,eAAe,MAAM,EACrB,SAAS,KAAK,CAAC,WAAW,CAAC,KACzB,MAAM,GAAG,SAiBX,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,YAAY,KAAG,iBAyC/D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,YAAY,KAAG,cAInE,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,GAAG,OAAO,KAAG,MAAyC,CAAC"}
@@ -16,8 +16,6 @@ import { convertIPv4ToBinary, convertIPv6ToBinary, distinctRemoteAddr } from 'ho
16
16
  * - Lowercases for case-insensitive IPv6 comparison
17
17
  * - Idempotent: calling twice produces the same result
18
18
  * - Safe on non-IP strings: `normalize_ip('unknown')` returns `'unknown'`
19
- *
20
- * @param ip - IP address string to normalize
21
19
  */
22
20
  export const normalize_ip = (ip) => {
23
21
  const lowered = ip.toLowerCase();
@@ -36,7 +34,7 @@ export const normalize_ip = (ip) => {
36
34
  * CIDR prefixes are validated against address family bounds.
37
35
  *
38
36
  * @param entry - IP address or CIDR notation
39
- * @throws on invalid IP, invalid CIDR network, or NaN/negative/over-range prefix
37
+ * @throws Error on invalid IP, invalid CIDR network, or NaN/negative/over-range prefix
40
38
  */
41
39
  export const parse_proxy_entry = (entry) => {
42
40
  const slash_index = entry.indexOf('/');
@@ -97,9 +95,6 @@ const cidr_contains = (ip_binary, network, prefix, total_bits) => {
97
95
  * Check whether `ip` matches any entry in the trusted proxy list.
98
96
  *
99
97
  * Normalizes `ip` before matching (lowercase, IPv4-mapped IPv6 stripped).
100
- *
101
- * @param ip - the IP address to check
102
- * @param proxies - parsed proxy entries
103
98
  */
104
99
  export const is_trusted_ip = (ip, proxies) => {
105
100
  const normalized = normalize_ip(ip);
@@ -227,7 +222,6 @@ export const create_proxy_middleware = (options) => {
227
222
  * Apply before auth middleware so `client_ip` is available for rate limiting.
228
223
  *
229
224
  * @param options - trusted proxy configuration
230
- * @throws Error if any entry in `options.trusted_proxies` is invalid (delegates to `create_proxy_middleware`)
231
225
  */
232
226
  export const create_proxy_middleware_spec = (options) => ({
233
227
  name: 'trusted_proxy',
@@ -46,15 +46,11 @@ export type AuthGuardResolver = (auth: RouteAuth) => Array<MiddlewareHandler>;
46
46
  export type RouteMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
47
47
  /**
48
48
  * Per-request deps provided by the framework to route handlers.
49
- *
50
- * `db` is transaction-scoped for mutation routes and pool-level for reads.
51
- * `background_db` is always pool-level — use it for fire-and-forget effects
52
- * that must outlive the transaction.
53
49
  */
54
50
  export interface RouteContext {
55
51
  /** Transaction-scoped for mutations, pool-level for reads. */
56
52
  db: Db;
57
- /** Always pool-level — for fire-and-forget effects that outlive the transaction. */
53
+ /** Always pool-level — for fire-and-forget effects that must outlive the transaction. */
58
54
  background_db: Db;
59
55
  /** Fire-and-forget side effects — push here for post-response flushing. */
60
56
  pending_effects: Array<Promise<void>>;
@@ -76,20 +72,14 @@ export type RouteHandler = (c: Context, route: RouteContext) => Response | Promi
76
72
  export interface RouteSpec {
77
73
  method: RouteMethod;
78
74
  path: string;
79
- /**
80
- * Auth requirement for this route.
81
- *
82
- * `{type: 'none'}` means the route is open to all clients including non-browser
83
- * callers (CLI, scripts) — no auth guards are applied.
84
- */
85
75
  auth: RouteAuth;
86
76
  handler: RouteHandler;
87
77
  description: string;
88
78
  /**
89
79
  * URL path parameter schema. Use `z.strictObject()` with string fields matching `:param` segments.
90
80
  *
91
- * TODO @action-system-review `params` is HTTP-specific SAES encodes everything in
92
- * `input`. When saes-rpc lands, this may move to `ActionRouteOptions` only.
81
+ * REST-only actions dispatch through a single JSON-RPC endpoint and encode
82
+ * everything in `input`, so `params` doesn't appear on `ActionSpec`.
93
83
  */
94
84
  params?: z.ZodObject;
95
85
  /** URL query parameter schema. Use `z.strictObject()` with string fields. */
@@ -131,38 +121,30 @@ export interface RouteSpec {
131
121
  /**
132
122
  * Get validated input from the Hono context.
133
123
  *
134
- * Call this in route handlers after the input validation middleware has run.
135
- * The type parameter should match the route's `input` schema.
136
- *
137
- * @returns the validated request body
124
+ * Call after the input validation middleware has run. The type parameter
125
+ * should match the route's `input` schema.
138
126
  */
139
127
  export declare const get_route_input: <T>(c: Context) => T;
140
128
  /**
141
129
  * Get validated URL path params from the Hono context.
142
130
  *
143
- * Call this in route handlers after the params validation middleware has run.
144
- * The type parameter should match the route's `params` schema.
145
- *
146
- * TODO @action-system-review Make typesafe — derive `T` from the `params` schema on the
147
- * route spec so the type parameter isn't manually specified.
131
+ * Call after the params validation middleware has run. The type parameter
132
+ * should match the route's `params` schema.
148
133
  *
149
- * @returns the validated path parameters
134
+ * TODO derive `T` from the route spec so the type parameter isn't manually
135
+ * specified — same applies to `get_route_input` / `get_route_query`.
150
136
  */
151
137
  export declare const get_route_params: <T>(c: Context) => T;
152
138
  /**
153
139
  * Get validated URL query params from the Hono context.
154
140
  *
155
- * Call this in route handlers after the query validation middleware has run.
156
- * The type parameter should match the route's `query` schema.
157
- *
158
- * @returns the validated query parameters
141
+ * Call after the query validation middleware has run. The type parameter
142
+ * should match the route's `query` schema.
159
143
  */
160
144
  export declare const get_route_query: <T>(c: Context) => T;
161
145
  /**
162
146
  * Apply named middleware specs to a Hono app.
163
147
  *
164
- * @param app - the Hono app
165
- * @param specs - middleware specs to apply
166
148
  * @mutates `app`
167
149
  */
168
150
  export declare const apply_middleware_specs: (app: Hono, specs: Array<MiddlewareSpec>) => void;
@@ -179,11 +161,8 @@ export declare const apply_middleware_specs: (app: Hono, specs: Array<Middleware
179
161
  * - `background_db`: always pool-level
180
162
  * - `pending_effects`: fire-and-forget effect queue
181
163
  *
182
- * @param app - the Hono app
183
- * @param specs - route specs to apply
184
164
  * @param resolve_auth_guards - maps `RouteAuth` to middleware — use `fuz_auth_guard_resolver` from `auth/route_guards.ts`
185
- * @param log - the logger instance
186
- * @param db - database instance for transaction wrapping and `RouteContext`
165
+ * @param db - used for transaction wrapping and `RouteContext`
187
166
  * @mutates `app`
188
167
  * @throws Error if two specs share the same `method` + `path` (each combination must be unique)
189
168
  */
@@ -192,8 +171,7 @@ export declare const apply_route_specs: (app: Hono, specs: Array<RouteSpec>, res
192
171
  * Prepend a prefix to all route spec paths.
193
172
  *
194
173
  * @param prefix - the path prefix (e.g. `/api/account`)
195
- * @param specs - route specs to prefix
196
- * @returns new array of specs with prefixed paths
174
+ * @returns a new array — the input specs are not mutated
197
175
  */
198
176
  export declare const prefix_route_specs: (prefix: string, specs: Array<RouteSpec>) => Array<RouteSpec>;
199
177
  //# sourceMappingURL=route_spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"route_spec.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/route_spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAW,IAAI,EAAE,iBAAiB,EAAC,MAAM,MAAM,CAAC;AACpE,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAKjB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAClB;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GACd;IAAC,IAAI,EAAE,eAAe,CAAA;CAAC,GACvB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAC5B;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,CAAC;AAEpB;;;;;;GAMG;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AAU,CAAC,EAAE,YAAY,CAAC;IAC1B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,GAAG,OAAO,KAAG,CAE/C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAE,GAAG,OAAO,KAAG,CAEhD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,GAAG,OAAO,KAAG,CAE/C,CAAC;AA8IF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,KAAK,IAAI,EAAE,OAAO,KAAK,CAAC,cAAc,CAAC,KAAG,IAIhF,CAAC;AAgCF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,GAC7B,KAAK,IAAI,EACT,OAAO,KAAK,CAAC,SAAS,CAAC,EACvB,qBAAqB,iBAAiB,EACtC,KAAK,MAAM,EACX,IAAI,EAAE,KACJ,IAsCF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,OAAO,KAAK,CAAC,SAAS,CAAC,KAAG,KAAK,CAAC,SAAS,CAK3F,CAAC"}
@@ -19,10 +19,8 @@ import { is_null_schema, merge_error_schemas } from './schema_helpers.js';
19
19
  /**
20
20
  * Get validated input from the Hono context.
21
21
  *
22
- * Call this in route handlers after the input validation middleware has run.
23
- * The type parameter should match the route's `input` schema.
24
- *
25
- * @returns the validated request body
22
+ * Call after the input validation middleware has run. The type parameter
23
+ * should match the route's `input` schema.
26
24
  */
27
25
  export const get_route_input = (c) => {
28
26
  return c.get('validated_input');
@@ -30,13 +28,11 @@ export const get_route_input = (c) => {
30
28
  /**
31
29
  * Get validated URL path params from the Hono context.
32
30
  *
33
- * Call this in route handlers after the params validation middleware has run.
34
- * The type parameter should match the route's `params` schema.
35
- *
36
- * TODO @action-system-review Make typesafe — derive `T` from the `params` schema on the
37
- * route spec so the type parameter isn't manually specified.
31
+ * Call after the params validation middleware has run. The type parameter
32
+ * should match the route's `params` schema.
38
33
  *
39
- * @returns the validated path parameters
34
+ * TODO derive `T` from the route spec so the type parameter isn't manually
35
+ * specified — same applies to `get_route_input` / `get_route_query`.
40
36
  */
41
37
  export const get_route_params = (c) => {
42
38
  return c.get('validated_params');
@@ -44,10 +40,8 @@ export const get_route_params = (c) => {
44
40
  /**
45
41
  * Get validated URL query params from the Hono context.
46
42
  *
47
- * Call this in route handlers after the query validation middleware has run.
48
- * The type parameter should match the route's `query` schema.
49
- *
50
- * @returns the validated query parameters
43
+ * Call after the query validation middleware has run. The type parameter
44
+ * should match the route's `query` schema.
51
45
  */
52
46
  export const get_route_query = (c) => {
53
47
  return c.get('validated_query');
@@ -188,8 +182,6 @@ const wrap_output_validation = (handler, output_schema, error_schemas, log) => {
188
182
  /**
189
183
  * Apply named middleware specs to a Hono app.
190
184
  *
191
- * @param app - the Hono app
192
- * @param specs - middleware specs to apply
193
185
  * @mutates `app`
194
186
  */
195
187
  export const apply_middleware_specs = (app, specs) => {
@@ -238,11 +230,8 @@ const wrap_error_catch = (handler, log) => {
238
230
  * - `background_db`: always pool-level
239
231
  * - `pending_effects`: fire-and-forget effect queue
240
232
  *
241
- * @param app - the Hono app
242
- * @param specs - route specs to apply
243
233
  * @param resolve_auth_guards - maps `RouteAuth` to middleware — use `fuz_auth_guard_resolver` from `auth/route_guards.ts`
244
- * @param log - the logger instance
245
- * @param db - database instance for transaction wrapping and `RouteContext`
234
+ * @param db - used for transaction wrapping and `RouteContext`
246
235
  * @mutates `app`
247
236
  * @throws Error if two specs share the same `method` + `path` (each combination must be unique)
248
237
  */
@@ -276,8 +265,7 @@ export const apply_route_specs = (app, specs, resolve_auth_guards, log, db) => {
276
265
  * Prepend a prefix to all route spec paths.
277
266
  *
278
267
  * @param prefix - the path prefix (e.g. `/api/account`)
279
- * @param specs - route specs to prefix
280
- * @returns new array of specs with prefixed paths
268
+ * @returns a new array — the input specs are not mutated
281
269
  */
282
270
  export const prefix_route_specs = (prefix, specs) => {
283
271
  return specs.map((spec) => ({
@@ -47,9 +47,6 @@ export declare const schema_to_surface: (schema: z.ZodType) => unknown;
47
47
  * - `/api/*` matches `/api/anything`
48
48
  * - `/api/tx/*` matches `/api/tx/runs` but not `/api/account/login`
49
49
  * - Exact match: `/health` matches `/health`
50
- *
51
- * @param mw_path - the middleware path pattern
52
- * @param route_path - the route path
53
50
  */
54
51
  export declare const middleware_applies: (mw_path: string, route_path: string) => boolean;
55
52
  /**
@@ -59,7 +56,6 @@ export declare const middleware_applies: (mw_path: string, route_path: string) =
59
56
  * Later layers override earlier ones for the same status code.
60
57
  *
61
58
  * @param spec - the route spec (needs `auth`, `input`, `params`, `rate_limit`, `errors`)
62
- * @param middleware_errors - optional middleware error schemas
63
59
  * @returns merged error schemas, or `null` if empty
64
60
  */
65
61
  export declare const merge_error_schemas: (spec: {
@@ -1 +1 @@
1
- {"version":3,"file":"schema_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/schema_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAuB,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAEnG;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,OAAsC,CAAC;AAE1F;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,OAAsC,CAAC;AAE1F;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,QAAQ,CAAC,CAAC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CAAC,CAAC,OAAO,KAAG,OAQrD,CAAC;AAoBF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,EAAE,YAAY,MAAM,KAAG,OAQxE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM;IACL,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC3B,EACD,oBAAoB,iBAAiB,GAAG,IAAI,KAC1C,iBAAiB,GAAG,IAUtB,CAAC"}
@@ -76,9 +76,6 @@ const strip_json_schema_noise = (value) => {
76
76
  * - `/api/*` matches `/api/anything`
77
77
  * - `/api/tx/*` matches `/api/tx/runs` but not `/api/account/login`
78
78
  * - Exact match: `/health` matches `/health`
79
- *
80
- * @param mw_path - the middleware path pattern
81
- * @param route_path - the route path
82
79
  */
83
80
  export const middleware_applies = (mw_path, route_path) => {
84
81
  if (mw_path === '*')
@@ -98,7 +95,6 @@ export const middleware_applies = (mw_path, route_path) => {
98
95
  * Later layers override earlier ones for the same status code.
99
96
  *
100
97
  * @param spec - the route spec (needs `auth`, `input`, `params`, `rate_limit`, `errors`)
101
- * @param middleware_errors - optional middleware error schemas
102
98
  * @returns merged error schemas, or `null` if empty
103
99
  */
104
100
  export const merge_error_schemas = (spec, middleware_errors) => {
@@ -70,6 +70,8 @@ export interface AppSurfaceRpcMethod {
70
70
  output_schema: unknown;
71
71
  side_effects: boolean;
72
72
  description: string;
73
+ /** Rate limit key declared on the action spec. `null` when not rate-limited. */
74
+ rate_limit_key: RateLimitKey | null;
73
75
  }
74
76
  /** An RPC endpoint in the generated attack surface (JSON-serializable). */
75
77
  export interface AppSurfaceRpcEndpoint {
@@ -120,8 +122,6 @@ export interface GenerateAppSurfaceOptions {
120
122
  /**
121
123
  * Collect error schemas from all middleware that applies to a route path.
122
124
  *
123
- * @param middleware - the middleware specs
124
- * @param route_path - the route path to match against
125
125
  * @returns merged middleware error schemas, or `null` if none
126
126
  */
127
127
  export declare const collect_middleware_errors: (middleware: Array<MiddlewareSpec>, route_path: string) => RouteErrorSchemas | null;
@@ -129,29 +129,19 @@ export declare const collect_middleware_errors: (middleware: Array<MiddlewareSpe
129
129
  * Convert env schema to surface entries using `.meta()` metadata.
130
130
  *
131
131
  * @param schema - Zod object schema with `.meta()` on fields
132
- * @returns array of env surface entries
133
132
  */
134
133
  export declare const env_schema_to_surface: (schema: z.ZodObject) => Array<AppSurfaceEnv>;
135
134
  /**
136
135
  * Convert SSE event specs to surface entries.
137
- *
138
- * @param event_specs - event specs to convert
139
- * @returns array of event surface entries
140
136
  */
141
137
  export declare const events_to_surface: (event_specs: Array<EventSpec>) => Array<AppSurfaceEvent>;
142
138
  /**
143
139
  * Generate a JSON-serializable attack surface from middleware, route specs,
144
140
  * and optional env/event metadata.
145
- *
146
- * @param options - the surface generation options
147
- * @returns the attack surface
148
141
  */
149
142
  export declare const generate_app_surface: (options: GenerateAppSurfaceOptions) => AppSurface;
150
143
  /**
151
144
  * Create an `AppSurfaceSpec` — the surface bundled with its source specs.
152
- *
153
- * @param options - the surface generation options
154
- * @returns the surface spec with surface and raw specs
155
145
  */
156
146
  export declare const create_app_surface_spec: (options: GenerateAppSurfaceOptions) => AppSurfaceSpec;
157
147
  //# sourceMappingURL=surface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"surface.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/surface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAA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AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,yBAAyB,KAAG,cAQ5E,CAAC"}
@@ -13,8 +13,6 @@ import { schema_to_surface, middleware_applies, merge_error_schemas, is_null_sch
13
13
  /**
14
14
  * Collect error schemas from all middleware that applies to a route path.
15
15
  *
16
- * @param middleware - the middleware specs
17
- * @param route_path - the route path to match against
18
16
  * @returns merged middleware error schemas, or `null` if none
19
17
  */
20
18
  export const collect_middleware_errors = (middleware, route_path) => {
@@ -30,7 +28,6 @@ export const collect_middleware_errors = (middleware, route_path) => {
30
28
  * Convert env schema to surface entries using `.meta()` metadata.
31
29
  *
32
30
  * @param schema - Zod object schema with `.meta()` on fields
33
- * @returns array of env surface entries
34
31
  */
35
32
  export const env_schema_to_surface = (schema) => {
36
33
  const entries = [];
@@ -50,9 +47,6 @@ export const env_schema_to_surface = (schema) => {
50
47
  };
51
48
  /**
52
49
  * Convert SSE event specs to surface entries.
53
- *
54
- * @param event_specs - event specs to convert
55
- * @returns array of event surface entries
56
50
  */
57
51
  export const events_to_surface = (event_specs) => {
58
52
  return event_specs.map((spec) => ({
@@ -65,9 +59,6 @@ export const events_to_surface = (event_specs) => {
65
59
  /**
66
60
  * Generate a JSON-serializable attack surface from middleware, route specs,
67
61
  * and optional env/event metadata.
68
- *
69
- * @param options - the surface generation options
70
- * @returns the attack surface
71
62
  */
72
63
  export const generate_app_surface = (options) => {
73
64
  const { route_specs, middleware_specs, env_schema, event_specs, rpc_endpoints } = options;
@@ -147,6 +138,7 @@ export const generate_app_surface = (options) => {
147
138
  output_schema: schema_to_surface(a.spec.output),
148
139
  side_effects: a.spec.side_effects,
149
140
  description: a.spec.description,
141
+ rate_limit_key: a.spec.rate_limit ?? null,
150
142
  })),
151
143
  }))
152
144
  : [],
@@ -156,9 +148,6 @@ export const generate_app_surface = (options) => {
156
148
  };
157
149
  /**
158
150
  * Create an `AppSurfaceSpec` — the surface bundled with its source specs.
159
- *
160
- * @param options - the surface generation options
161
- * @returns the surface spec with surface and raw specs
162
151
  */
163
152
  export const create_app_surface_spec = (options) => {
164
153
  const surface = generate_app_surface(options);
@@ -46,6 +46,22 @@ export interface RateLimiterOptions {
46
46
  export declare const DEFAULT_LOGIN_IP_RATE_LIMIT: RateLimiterOptions;
47
47
  /** Default options for per-account login rate limiting: 10 attempts per 30 minutes. */
48
48
  export declare const DEFAULT_LOGIN_ACCOUNT_RATE_LIMIT: RateLimiterOptions;
49
+ /**
50
+ * Default options for per-IP action-dispatcher rate limiting: 600 attempts
51
+ * per 15 minutes. Shared by the HTTP RPC and WebSocket action dispatchers
52
+ * (one budget per action, not per transport). Permissive — catches runaway
53
+ * scripts and egregious oracle probes, but well above human or normal
54
+ * automation pace. Tighten downstream for stricter deployments.
55
+ */
56
+ export declare const DEFAULT_ACTION_IP_RATE_LIMIT: RateLimiterOptions;
57
+ /**
58
+ * Default options for per-actor action-dispatcher rate limiting: 1200
59
+ * attempts per 15 minutes. Shared by the HTTP RPC and WebSocket action
60
+ * dispatchers. Permissive — sustained ~80/min is well above any human
61
+ * admin workflow; an oracle probing 10k addresses still finishes in
62
+ * ~2 hours, slow enough to surface in audit. Tighten downstream.
63
+ */
64
+ export declare const DEFAULT_ACTION_ACCOUNT_RATE_LIMIT: RateLimiterOptions;
49
65
  /**
50
66
  * Result of a rate limit check or record operation.
51
67
  */
@@ -1 +1 @@
1
- {"version":3,"file":"rate_limiter.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/rate_limiter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAKlC;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,SAAU,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,mBAAmB,EAAE,MAAM,CAAC;IAC5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OAKG;IACH,OAAO,CAAC,GAAG,GAAE,MAAmB,GAAG,IAAI;IAgBvC;;;;OAIG;IACH,OAAO,IAAI,IAAI;CAMf;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,OAAO,CAAC,kBAAkB,CAAC,KAAG,WAE3E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GAAI,GAAG,OAAO,EAAE,aAAa,MAAM,KAAG,QAI7E,CAAC"}
@@ -30,6 +30,32 @@ export const DEFAULT_LOGIN_ACCOUNT_RATE_LIMIT = {
30
30
  cleanup_interval_ms: 5 * 60_000,
31
31
  max_keys: DEFAULT_RATE_LIMITER_MAX_KEYS,
32
32
  };
33
+ /**
34
+ * Default options for per-IP action-dispatcher rate limiting: 600 attempts
35
+ * per 15 minutes. Shared by the HTTP RPC and WebSocket action dispatchers
36
+ * (one budget per action, not per transport). Permissive — catches runaway
37
+ * scripts and egregious oracle probes, but well above human or normal
38
+ * automation pace. Tighten downstream for stricter deployments.
39
+ */
40
+ export const DEFAULT_ACTION_IP_RATE_LIMIT = {
41
+ max_attempts: 600,
42
+ window_ms: 15 * 60_000,
43
+ cleanup_interval_ms: 5 * 60_000,
44
+ max_keys: DEFAULT_RATE_LIMITER_MAX_KEYS,
45
+ };
46
+ /**
47
+ * Default options for per-actor action-dispatcher rate limiting: 1200
48
+ * attempts per 15 minutes. Shared by the HTTP RPC and WebSocket action
49
+ * dispatchers. Permissive — sustained ~80/min is well above any human
50
+ * admin workflow; an oracle probing 10k addresses still finishes in
51
+ * ~2 hours, slow enough to surface in audit. Tighten downstream.
52
+ */
53
+ export const DEFAULT_ACTION_ACCOUNT_RATE_LIMIT = {
54
+ max_attempts: 1200,
55
+ window_ms: 15 * 60_000,
56
+ cleanup_interval_ms: 5 * 60_000,
57
+ max_keys: DEFAULT_RATE_LIMITER_MAX_KEYS,
58
+ };
33
59
  /**
34
60
  * In-memory sliding window rate limiter.
35
61
  *
@@ -46,7 +46,6 @@ export interface SseNotification {
46
46
  * Uses `hono_stream.write()` directly (not `writeSSE`) to avoid
47
47
  * Hono's HTML callback resolution — keeps the same `data: JSON\n\n` format.
48
48
  *
49
- * @param c - Hono context
50
49
  * @param log - logger for serialization and `on_close` listener errors
51
50
  * @returns object with the streaming `Response` and an `SseStream` controller
52
51
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sse.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACrC,mDAAmD;IACnD,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACxB,6CAA6C;IAC7C,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,wBAAwB;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,+FAA+F;IAC/F,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,GAAG,OAAO,EAC9C,GAAG,OAAO,EACV,KAAK,MAAM,KACT;IAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;CAiD3C,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,qBAAqB,oBAAoB,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eAAe;IAC/B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,GAAG,OAAO,EAC9C,GAAG,OAAO,EACV,KAAK,MAAM,KACT;IAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;CAiD3C,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACzB,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;IAClB,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GAAI,CAAC,SAAS,eAAe,EACrE,aAAa;IAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;CAAC,EAC5D,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,KAAK,MAAM,KACT;IAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;CAmBhD,CAAC"}
@@ -20,7 +20,6 @@ import { DEV } from 'esm-env';
20
20
  * Uses `hono_stream.write()` directly (not `writeSSE`) to avoid
21
21
  * Hono's HTML callback resolution — keeps the same `data: JSON\n\n` format.
22
22
  *
23
- * @param c - Hono context
24
23
  * @param log - logger for serialization and `on_close` listener errors
25
24
  * @returns object with the streaming `Response` and an `SseStream` controller
26
25
  */
@@ -111,9 +111,6 @@ export declare class SubscriberRegistry<T> {
111
111
  *
112
112
  * Subscribers with no channel filter receive all broadcasts.
113
113
  * Subscribers with a channel filter only receive matching broadcasts.
114
- *
115
- * @param channel - the channel to broadcast on
116
- * @param data - the data to send
117
114
  */
118
115
  broadcast(channel: string, data: T): void;
119
116
  /**