@fuzdev/fuz_app 0.49.0 → 0.51.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 (97) hide show
  1. package/dist/actions/CLAUDE.md +56 -21
  2. package/dist/actions/action_codegen.d.ts +60 -34
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +80 -46
  5. package/dist/actions/action_registry.d.ts +1 -1
  6. package/dist/actions/action_registry.js +1 -1
  7. package/dist/actions/action_spec.d.ts +1 -1
  8. package/dist/actions/action_spec.js +1 -1
  9. package/dist/actions/action_types.d.ts +4 -4
  10. package/dist/actions/action_types.js +4 -4
  11. package/dist/actions/cancel.d.ts +13 -11
  12. package/dist/actions/cancel.d.ts.map +1 -1
  13. package/dist/actions/cancel.js +13 -11
  14. package/dist/actions/frontend_rpc_client.d.ts +9 -0
  15. package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
  16. package/dist/actions/heartbeat.d.ts +11 -8
  17. package/dist/actions/heartbeat.d.ts.map +1 -1
  18. package/dist/actions/heartbeat.js +11 -8
  19. package/dist/actions/protocol.d.ts +47 -0
  20. package/dist/actions/protocol.d.ts.map +1 -0
  21. package/dist/actions/protocol.js +46 -0
  22. package/dist/actions/register_action_ws.d.ts +5 -4
  23. package/dist/actions/register_action_ws.d.ts.map +1 -1
  24. package/dist/actions/register_action_ws.js +2 -2
  25. package/dist/auth/account_action_specs.d.ts +1 -1
  26. package/dist/auth/account_action_specs.js +1 -1
  27. package/dist/auth/account_actions.d.ts +2 -2
  28. package/dist/auth/account_actions.js +2 -2
  29. package/dist/auth/account_routes.d.ts +3 -3
  30. package/dist/auth/account_routes.js +3 -3
  31. package/dist/auth/account_schema.d.ts +1 -1
  32. package/dist/auth/account_schema.js +1 -1
  33. package/dist/auth/admin_action_specs.d.ts +1 -1
  34. package/dist/auth/admin_action_specs.js +1 -1
  35. package/dist/auth/admin_actions.d.ts +2 -2
  36. package/dist/auth/admin_actions.js +2 -2
  37. package/dist/auth/api_token.d.ts +1 -1
  38. package/dist/auth/api_token.js +1 -1
  39. package/dist/auth/audit_log_routes.d.ts +1 -1
  40. package/dist/auth/audit_log_routes.js +1 -1
  41. package/dist/auth/audit_log_schema.d.ts +1 -1
  42. package/dist/auth/daemon_token.d.ts +1 -1
  43. package/dist/auth/daemon_token.js +1 -1
  44. package/dist/auth/daemon_token_middleware.d.ts +1 -1
  45. package/dist/auth/daemon_token_middleware.js +1 -1
  46. package/dist/auth/ddl.d.ts +1 -1
  47. package/dist/auth/ddl.js +1 -1
  48. package/dist/auth/password.d.ts +1 -1
  49. package/dist/auth/password.js +1 -1
  50. package/dist/auth/permit_offer_action_specs.d.ts +1 -1
  51. package/dist/auth/permit_offer_action_specs.js +1 -1
  52. package/dist/auth/permit_offer_actions.d.ts +1 -1
  53. package/dist/auth/permit_offer_actions.js +1 -1
  54. package/dist/auth/route_guards.d.ts +1 -1
  55. package/dist/auth/route_guards.js +1 -1
  56. package/dist/auth/self_service_role_action_specs.d.ts +1 -1
  57. package/dist/auth/self_service_role_action_specs.js +1 -1
  58. package/dist/auth/self_service_role_actions.d.ts +1 -1
  59. package/dist/auth/self_service_role_actions.js +1 -1
  60. package/dist/auth/session_queries.d.ts +1 -1
  61. package/dist/auth/session_queries.js +1 -1
  62. package/dist/auth/signup_routes.d.ts +1 -1
  63. package/dist/auth/signup_routes.js +1 -1
  64. package/dist/auth/standard_action_specs.d.ts +1 -1
  65. package/dist/auth/standard_action_specs.js +1 -1
  66. package/dist/cli/util.d.ts +1 -1
  67. package/dist/cli/util.js +1 -1
  68. package/dist/db/create_db.d.ts +2 -2
  69. package/dist/db/create_db.js +2 -2
  70. package/dist/db/db.d.ts +3 -3
  71. package/dist/db/db.js +3 -3
  72. package/dist/hono_context.d.ts +1 -1
  73. package/dist/hono_context.js +1 -1
  74. package/dist/http/jsonrpc_errors.d.ts +2 -2
  75. package/dist/http/jsonrpc_errors.js +2 -2
  76. package/dist/http/jsonrpc_helpers.d.ts +2 -2
  77. package/dist/http/jsonrpc_helpers.js +2 -2
  78. package/dist/http/middleware_spec.d.ts +1 -1
  79. package/dist/http/middleware_spec.js +1 -1
  80. package/dist/http/origin.d.ts +1 -1
  81. package/dist/http/origin.js +1 -1
  82. package/dist/http/schema_helpers.d.ts +1 -1
  83. package/dist/http/schema_helpers.js +1 -1
  84. package/dist/http/surface.d.ts +1 -1
  85. package/dist/http/surface.js +1 -1
  86. package/dist/runtime/deno.d.ts +1 -1
  87. package/dist/runtime/deno.js +1 -1
  88. package/dist/runtime/node.d.ts +1 -1
  89. package/dist/runtime/node.js +1 -1
  90. package/dist/testing/rpc_attack_surface.js +1 -1
  91. package/dist/testing/rpc_helpers.js +1 -1
  92. package/dist/testing/ws_round_trip.js +1 -1
  93. package/dist/ui/account_sessions_state.svelte.d.ts +2 -2
  94. package/dist/ui/account_sessions_state.svelte.js +1 -1
  95. package/dist/ui/admin_rpc_adapters.d.ts +1 -1
  96. package/dist/ui/admin_rpc_adapters.js +1 -1
  97. package/package.json +1 -1
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Both `pg` and `@electric-sql/pglite` are optional peer dependencies,
10
10
  * dynamically imported only when needed. For direct driver construction
11
- * without auto-detection, use `db_pg.ts` or `db_pglite.ts`.
11
+ * without auto-detection, use `db/db_pg.ts` or `db/db_pglite.ts`.
12
12
  *
13
13
  * @module
14
14
  */
@@ -22,7 +22,7 @@ import { create_pglite_db } from './db_pglite.js';
22
22
  * know which driver is in use.
23
23
  *
24
24
  * For direct driver construction without URL routing, import
25
- * `create_pg_db` from `db_pg.ts` or `create_pglite_db` from `db_pglite.ts`.
25
+ * `create_pg_db` from `db/db_pg.ts` or `create_pglite_db` from `db/db_pglite.ts`.
26
26
  *
27
27
  * @param database_url - connection URL (`postgres://`, `postgresql://`, `file://`, or `memory://`)
28
28
  * @returns database instance, close callback, type, and display name
package/dist/db/db.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * Both `pg.Pool` and `@electric-sql/pglite` satisfy this interface.
6
6
  *
7
7
  * Transaction safety is provided by an injected `transaction` callback —
8
- * the driver adapters (`db_pg.ts`, `db_pglite.ts`) supply the driver-appropriate
8
+ * the driver adapters (`db/db_pg.ts`, `db/db_pglite.ts`) supply the driver-appropriate
9
9
  * implementation. Close is handled externally (returned alongside the Db
10
10
  * as `DbDriverResult`), not as a method on this class.
11
11
  *
@@ -55,8 +55,8 @@ export declare const no_nested_transaction: DbDeps['transaction'];
55
55
  /**
56
56
  * Database wrapper providing a consistent query and transaction interface.
57
57
  *
58
- * Construct via `create_pg_db()` from `db_pg.ts` or `create_pglite_db()` from
59
- * `db_pglite.ts` for proper transaction support, or via `create_db()` for
58
+ * Construct via `create_pg_db()` from `db/db_pg.ts` or `create_pglite_db()` from
59
+ * `db/db_pglite.ts` for proper transaction support, or via `create_db()` for
60
60
  * URL-based auto-detection.
61
61
  *
62
62
  * @example
package/dist/db/db.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * Both `pg.Pool` and `@electric-sql/pglite` satisfy this interface.
6
6
  *
7
7
  * Transaction safety is provided by an injected `transaction` callback —
8
- * the driver adapters (`db_pg.ts`, `db_pglite.ts`) supply the driver-appropriate
8
+ * the driver adapters (`db/db_pg.ts`, `db/db_pglite.ts`) supply the driver-appropriate
9
9
  * implementation. Close is handled externally (returned alongside the Db
10
10
  * as `DbDriverResult`), not as a method on this class.
11
11
  *
@@ -24,8 +24,8 @@ export const no_nested_transaction = () => {
24
24
  /**
25
25
  * Database wrapper providing a consistent query and transaction interface.
26
26
  *
27
- * Construct via `create_pg_db()` from `db_pg.ts` or `create_pglite_db()` from
28
- * `db_pglite.ts` for proper transaction support, or via `create_db()` for
27
+ * Construct via `create_pg_db()` from `db/db_pg.ts` or `create_pglite_db()` from
28
+ * `db/db_pglite.ts` for proper transaction support, or via `create_db()` for
29
29
  * URL-based auto-detection.
30
30
  *
31
31
  * @example
@@ -7,7 +7,7 @@
7
7
  * Import this module once in your app to get type-safe access to
8
8
  * `auth_session_id`, `request_context`, and `credential_type` on the Hono context.
9
9
  *
10
- * In practice, this is auto-loaded by `app_server.ts` (side-effect import)
10
+ * In practice, this is auto-loaded by `server/app_server.ts` (side-effect import)
11
11
  * and transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
12
12
  * Consumers don't need a manual import unless bypassing the standard server assembly.
13
13
  *
@@ -7,7 +7,7 @@
7
7
  * Import this module once in your app to get type-safe access to
8
8
  * `auth_session_id`, `request_context`, and `credential_type` on the Hono context.
9
9
  *
10
- * In practice, this is auto-loaded by `app_server.ts` (side-effect import)
10
+ * In practice, this is auto-loaded by `server/app_server.ts` (side-effect import)
11
11
  * and transitively by auth middleware modules that import `CREDENTIAL_TYPE_KEY`.
12
12
  * Consumers don't need a manual import unless bypassing the standard server assembly.
13
13
  *
@@ -7,10 +7,10 @@
7
7
  * codes stay in consumers — add by casting `as JsonrpcErrorCode`.
8
8
  *
9
9
  * `JsonrpcErrorCode` and `JsonrpcErrorObject` types are Zod-inferred
10
- * from `jsonrpc.ts` — this module re-uses those as the single source
10
+ * from `http/jsonrpc.ts` — this module re-uses those as the single source
11
11
  * of truth.
12
12
  *
13
- * Complementary to `error_schemas.ts`: that module is declarative
13
+ * Complementary to `http/error_schemas.ts`: that module is declarative
14
14
  * (Zod schemas for surface introspection), this one is runtime
15
15
  * (throw + catch + map).
16
16
  *
@@ -7,10 +7,10 @@
7
7
  * codes stay in consumers — add by casting `as JsonrpcErrorCode`.
8
8
  *
9
9
  * `JsonrpcErrorCode` and `JsonrpcErrorObject` types are Zod-inferred
10
- * from `jsonrpc.ts` — this module re-uses those as the single source
10
+ * from `http/jsonrpc.ts` — this module re-uses those as the single source
11
11
  * of truth.
12
12
  *
13
- * Complementary to `error_schemas.ts`: that module is declarative
13
+ * Complementary to `http/error_schemas.ts`: that module is declarative
14
14
  * (Zod schemas for surface introspection), this one is runtime
15
15
  * (throw + catch + map).
16
16
  *
@@ -2,8 +2,8 @@
2
2
  * JSON-RPC message builders, type guards, and converters.
3
3
  *
4
4
  * Used by the SAES runtime (ActionEvent, ActionPeer, transports) and
5
- * the RPC endpoint dispatcher. Complements `jsonrpc.ts` (schemas) and
6
- * `jsonrpc_errors.ts` (error infrastructure).
5
+ * the RPC endpoint dispatcher. Complements `http/jsonrpc.ts` (schemas) and
6
+ * `http/jsonrpc_errors.ts` (error infrastructure).
7
7
  *
8
8
  * @module
9
9
  */
@@ -2,8 +2,8 @@
2
2
  * JSON-RPC message builders, type guards, and converters.
3
3
  *
4
4
  * Used by the SAES runtime (ActionEvent, ActionPeer, transports) and
5
- * the RPC endpoint dispatcher. Complements `jsonrpc.ts` (schemas) and
6
- * `jsonrpc_errors.ts` (error infrastructure).
5
+ * the RPC endpoint dispatcher. Complements `http/jsonrpc.ts` (schemas) and
6
+ * `http/jsonrpc_errors.ts` (error infrastructure).
7
7
  *
8
8
  * @module
9
9
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Middleware spec type — named middleware layer definition.
3
3
  *
4
- * Separated from `route_spec.ts` so middleware modules can import this
4
+ * Separated from `http/route_spec.ts` so middleware modules can import this
5
5
  * type without creating an upward dependency on routes.
6
6
  *
7
7
  * @module
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Middleware spec type — named middleware layer definition.
3
3
  *
4
- * Separated from `route_spec.ts` so middleware modules can import this
4
+ * Separated from `http/route_spec.ts` so middleware modules can import this
5
5
  * type without creating an upward dependency on routes.
6
6
  *
7
7
  * @module
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Verifies requests are coming from expected origins/referers.
5
5
  * CSRF protection is provided by `SameSite: strict` on session cookies
6
- * (see `session_middleware.ts`). This module provides origin allowlisting
6
+ * (see `auth/session_middleware.ts`). This module provides origin allowlisting
7
7
  * for locally-running services — preventing untrusted websites from
8
8
  * making requests as the user browses the web.
9
9
  *
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Verifies requests are coming from expected origins/referers.
5
5
  * CSRF protection is provided by `SameSite: strict` on session cookies
6
- * (see `session_middleware.ts`). This module provides origin allowlisting
6
+ * (see `auth/session_middleware.ts`). This module provides origin allowlisting
7
7
  * for locally-running services — preventing untrusted websites from
8
8
  * making requests as the user browses the web.
9
9
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared pure helpers for schema introspection and middleware matching.
3
3
  *
4
- * Used by both `route_spec.ts` (input validation) and `surface.ts`
4
+ * Used by both `http/route_spec.ts` (input validation) and `http/surface.ts`
5
5
  * (attack surface generation). Extracted to avoid circular dependencies
6
6
  * between routes and middleware.
7
7
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared pure helpers for schema introspection and middleware matching.
3
3
  *
4
- * Used by both `route_spec.ts` (input validation) and `surface.ts`
4
+ * Used by both `http/route_spec.ts` (input validation) and `http/surface.ts`
5
5
  * (attack surface generation). Extracted to avoid circular dependencies
6
6
  * between routes and middleware.
7
7
  *
@@ -2,7 +2,7 @@
2
2
  * App surface generation — JSON-serializable attack surface from route and middleware specs.
3
3
  *
4
4
  * Pure schema helpers (`is_null_schema`, `schema_to_surface`, `middleware_applies`,
5
- * `merge_error_schemas`) live in `schema_helpers.ts`.
5
+ * `merge_error_schemas`) live in `http/schema_helpers.ts`.
6
6
  *
7
7
  * @module
8
8
  */
@@ -2,7 +2,7 @@
2
2
  * App surface generation — JSON-serializable attack surface from route and middleware specs.
3
3
  *
4
4
  * Pure schema helpers (`is_null_schema`, `schema_to_surface`, `middleware_applies`,
5
- * `merge_error_schemas`) live in `schema_helpers.ts`.
5
+ * `merge_error_schemas`) live in `http/schema_helpers.ts`.
6
6
  *
7
7
  * @module
8
8
  */
@@ -11,7 +11,7 @@ import type { RuntimeDeps } from './deps.js';
11
11
  /**
12
12
  * Create a runtime backed by Deno APIs.
13
13
  *
14
- * Returns an object satisfying all `*Deps` interfaces from `deps.ts`.
14
+ * Returns an object satisfying all `*Deps` interfaces from `runtime/deps.ts`.
15
15
  * Pass to shared functions that accept `EnvDeps`, `FsReadDeps`, etc.
16
16
  *
17
17
  * @param args - CLI arguments (typically `Deno.args`)
@@ -10,7 +10,7 @@
10
10
  /**
11
11
  * Create a runtime backed by Deno APIs.
12
12
  *
13
- * Returns an object satisfying all `*Deps` interfaces from `deps.ts`.
13
+ * Returns an object satisfying all `*Deps` interfaces from `runtime/deps.ts`.
14
14
  * Pass to shared functions that accept `EnvDeps`, `FsReadDeps`, etc.
15
15
  *
16
16
  * @param args - CLI arguments (typically `Deno.args`)
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Node.js implementation of `RuntimeDeps`.
3
3
  *
4
- * Provides the same interface as `deno.ts` but backed by Node.js APIs.
4
+ * Provides the same interface as `runtime/deno.ts` but backed by Node.js APIs.
5
5
  * Used for running servers in Node.js and for tests (vitest runs in Node).
6
6
  *
7
7
  * @module
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Node.js implementation of `RuntimeDeps`.
3
3
  *
4
- * Provides the same interface as `deno.ts` but backed by Node.js APIs.
4
+ * Provides the same interface as `runtime/deno.ts` but backed by Node.js APIs.
5
5
  * Used for running servers in Node.js and for tests (vitest runs in Node).
6
6
  *
7
7
  * @module
@@ -306,7 +306,7 @@ const describe_rpc_adversarial_envelopes = (options) => {
306
306
  * For each method with a non-null input schema, generates test cases
307
307
  * from the schema (wrong types, missing fields, format violations)
308
308
  * and wraps them in valid JSON-RPC envelopes. Reuses
309
- * `generate_input_test_cases` from `adversarial_input.ts`.
309
+ * `generate_input_test_cases` from `testing/adversarial_input.ts`.
310
310
  */
311
311
  const describe_rpc_adversarial_params = (options) => {
312
312
  const { build, roles } = options;
@@ -3,7 +3,7 @@ import './assert_dev_env.js';
3
3
  * JSON-RPC test helpers — request construction, response assertion, and
4
4
  * one-shot call ergonomics.
5
5
  *
6
- * Shared by `rpc_attack_surface.ts`, `rpc_round_trip.ts`, and
6
+ * Shared by `testing/rpc_attack_surface.ts`, `testing/rpc_round_trip.ts`, and
7
7
  * consumer-facing admin/audit suites that exercise RPC methods directly.
8
8
  *
9
9
  * @module
@@ -203,7 +203,7 @@ const build_multi_role_request_context = (account_id, roles) => {
203
203
  /**
204
204
  * Stub `RequestContext` for single-role or public fakes. Hardcoded
205
205
  * ids (`acc_1` / `act_1`) mirror `create_test_request_context` in
206
- * `auth_apps.ts`.
206
+ * `testing/auth_apps.ts`.
207
207
  */
208
208
  const build_simple_request_context = (role) => ({
209
209
  account: create_test_account({ id: 'acc_1', username: 'testuser' }),
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Reactive state for managing the authenticated account's auth sessions on a
3
3
  * settings page. Reads and mutations flow through a narrow RPC adapter; the
4
- * REST routes that backed this class moved to `account_actions.ts` in the
4
+ * REST routes that backed this class moved to `auth/account_actions.ts` in the
5
5
  * 2026-04-23 RPC migration.
6
6
  *
7
7
  * @module
@@ -14,7 +14,7 @@ import type { AuthSessionJson } from '../auth/account_schema.js';
14
14
  * interfaces (`AdminAccountsRpc`, `AuditLogRpc`, `AdminInvitesRpc`).
15
15
  *
16
16
  * The three methods wrap the corresponding action specs on
17
- * `account_actions.ts`:
17
+ * `auth/account_actions.ts`:
18
18
  *
19
19
  * - `list` → `account_session_list`
20
20
  * - `revoke` → `account_session_revoke` (IDOR-guarded by `account_id` server-side)
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Reactive state for managing the authenticated account's auth sessions on a
3
3
  * settings page. Reads and mutations flow through a narrow RPC adapter; the
4
- * REST routes that backed this class moved to `account_actions.ts` in the
4
+ * REST routes that backed this class moved to `auth/account_actions.ts` in the
5
5
  * 2026-04-23 RPC migration.
6
6
  *
7
7
  * @module
@@ -21,7 +21,7 @@
21
21
  * ```
22
22
  *
23
23
  * The throwing Proxy spreads the JSON-RPC `{code, message, data?}` onto
24
- * the thrown `Error` so form components (e.g. `PermitOfferForm.svelte`)
24
+ * the thrown `Error` so form components (e.g. `ui/PermitOfferForm.svelte`)
25
25
  * can match on `error.data?.reason` via `ERROR_OFFER_*` constants —
26
26
  * optional chaining is required because JSON-RPC `data` is spec-level
27
27
  * optional. Consumers that need a custom unwrap strategy can construct
@@ -21,7 +21,7 @@
21
21
  * ```
22
22
  *
23
23
  * The throwing Proxy spreads the JSON-RPC `{code, message, data?}` onto
24
- * the thrown `Error` so form components (e.g. `PermitOfferForm.svelte`)
24
+ * the thrown `Error` so form components (e.g. `ui/PermitOfferForm.svelte`)
25
25
  * can match on `error.data?.reason` via `ERROR_OFFER_*` constants —
26
26
  * optional chaining is required because JSON-RPC `data` is spec-level
27
27
  * optional. Consumers that need a custom unwrap strategy can construct
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_app",
3
- "version": "0.49.0",
3
+ "version": "0.51.0",
4
4
  "description": "fullstack app library",
5
5
  "glyph": "🗝",
6
6
  "logo": "logo.svg",