@fuzdev/fuz_app 0.59.0 → 0.61.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 (151) hide show
  1. package/dist/actions/CLAUDE.md +5 -5
  2. package/dist/actions/action_codegen.d.ts +1 -1
  3. package/dist/actions/action_codegen.js +2 -2
  4. package/dist/actions/action_event_helpers.d.ts +3 -3
  5. package/dist/actions/action_event_helpers.js +8 -8
  6. package/dist/actions/action_event_types.d.ts +3 -3
  7. package/dist/actions/action_event_types.js +3 -3
  8. package/dist/actions/transports_ws_auth_guard.d.ts +2 -2
  9. package/dist/actions/transports_ws_auth_guard.js +3 -3
  10. package/dist/auth/CLAUDE.md +157 -15
  11. package/dist/auth/actor_lookup_action_specs.d.ts +127 -0
  12. package/dist/auth/actor_lookup_action_specs.d.ts.map +1 -0
  13. package/dist/auth/actor_lookup_action_specs.js +93 -0
  14. package/dist/auth/actor_lookup_actions.d.ts +19 -0
  15. package/dist/auth/actor_lookup_actions.d.ts.map +1 -0
  16. package/dist/auth/actor_lookup_actions.js +32 -0
  17. package/dist/auth/actor_lookup_queries.d.ts +44 -0
  18. package/dist/auth/actor_lookup_queries.d.ts.map +1 -0
  19. package/dist/auth/actor_lookup_queries.js +42 -0
  20. package/dist/auth/actor_search_action_specs.d.ts +166 -0
  21. package/dist/auth/actor_search_action_specs.d.ts.map +1 -0
  22. package/dist/auth/actor_search_action_specs.js +139 -0
  23. package/dist/auth/actor_search_actions.d.ts +31 -0
  24. package/dist/auth/actor_search_actions.d.ts.map +1 -0
  25. package/dist/auth/actor_search_actions.js +61 -0
  26. package/dist/auth/actor_search_queries.d.ts +75 -0
  27. package/dist/auth/actor_search_queries.d.ts.map +1 -0
  28. package/dist/auth/actor_search_queries.js +91 -0
  29. package/dist/auth/admin_actions.js +2 -2
  30. package/dist/auth/all_action_spec_registries.d.ts +55 -0
  31. package/dist/auth/all_action_spec_registries.d.ts.map +1 -0
  32. package/dist/auth/all_action_spec_registries.js +59 -0
  33. package/dist/auth/audit_emitter.d.ts +1 -1
  34. package/dist/auth/audit_emitter.js +2 -2
  35. package/dist/auth/audit_log_queries.d.ts +1 -1
  36. package/dist/auth/audit_log_queries.js +3 -3
  37. package/dist/auth/audit_log_routes.d.ts +1 -1
  38. package/dist/auth/audit_log_routes.js +1 -1
  39. package/dist/auth/audit_log_schema.d.ts +5 -5
  40. package/dist/auth/audit_log_schema.js +7 -7
  41. package/dist/auth/auth_ddl.d.ts +7 -0
  42. package/dist/auth/auth_ddl.d.ts.map +1 -1
  43. package/dist/auth/auth_ddl.js +8 -0
  44. package/dist/auth/credential_type_schema.d.ts +1 -1
  45. package/dist/auth/credential_type_schema.js +3 -3
  46. package/dist/auth/grant_path_schema.d.ts +1 -1
  47. package/dist/auth/grant_path_schema.js +3 -3
  48. package/dist/auth/migrations.d.ts +4 -4
  49. package/dist/auth/migrations.d.ts.map +1 -1
  50. package/dist/auth/migrations.js +7 -6
  51. package/dist/auth/role_grant_offer_actions.js +2 -2
  52. package/dist/auth/role_grant_offer_notifications.d.ts +2 -2
  53. package/dist/auth/role_grant_offer_notifications.js +2 -2
  54. package/dist/auth/role_grant_queries.d.ts +21 -0
  55. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  56. package/dist/auth/role_grant_queries.js +31 -0
  57. package/dist/auth/role_schema.d.ts +2 -2
  58. package/dist/auth/role_schema.js +3 -3
  59. package/dist/auth/self_service_role_actions.d.ts +1 -1
  60. package/dist/auth/self_service_role_actions.js +2 -2
  61. package/dist/auth/session_cookie.d.ts +1 -1
  62. package/dist/auth/session_cookie.js +1 -1
  63. package/dist/auth/session_middleware.d.ts +1 -1
  64. package/dist/auth/session_middleware.js +5 -5
  65. package/dist/rate_limiter.d.ts +5 -5
  66. package/dist/rate_limiter.js +6 -6
  67. package/dist/realtime/sse_auth_guard.d.ts +3 -3
  68. package/dist/realtime/sse_auth_guard.js +4 -4
  69. package/dist/server/app_backend.d.ts +3 -3
  70. package/dist/server/app_backend.js +4 -4
  71. package/dist/server/app_server.d.ts +1 -1
  72. package/dist/server/app_server.js +10 -10
  73. package/dist/testing/CLAUDE.md +22 -12
  74. package/dist/testing/admin_integration.js +4 -4
  75. package/dist/testing/app_server.d.ts +1 -1
  76. package/dist/testing/app_server.js +2 -2
  77. package/dist/testing/attack_surface.d.ts +4 -4
  78. package/dist/testing/attack_surface.js +6 -6
  79. package/dist/testing/audit_completeness.js +4 -4
  80. package/dist/testing/data_exposure.d.ts +2 -2
  81. package/dist/testing/data_exposure.js +7 -7
  82. package/dist/testing/db.d.ts +8 -8
  83. package/dist/testing/db.js +11 -11
  84. package/dist/testing/integration.js +4 -4
  85. package/dist/testing/integration_helpers.d.ts +6 -6
  86. package/dist/testing/integration_helpers.js +7 -7
  87. package/dist/testing/rate_limiting.js +4 -4
  88. package/dist/testing/round_trip.js +2 -2
  89. package/dist/testing/rpc_round_trip.js +2 -2
  90. package/dist/testing/schema_generators.d.ts.map +1 -1
  91. package/dist/testing/schema_generators.js +23 -2
  92. package/dist/testing/sse_round_trip.js +2 -2
  93. package/dist/testing/surface_invariants.d.ts +4 -4
  94. package/dist/testing/surface_invariants.js +5 -5
  95. package/dist/ui/AccountSessions.svelte +21 -6
  96. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
  97. package/dist/ui/AdminAccounts.svelte +32 -25
  98. package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
  99. package/dist/ui/AdminAuditLog.svelte +3 -3
  100. package/dist/ui/AdminInvites.svelte +20 -15
  101. package/dist/ui/AdminOverview.svelte +19 -21
  102. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  103. package/dist/ui/AdminRoleGrantHistory.svelte +3 -3
  104. package/dist/ui/AdminSessions.svelte +19 -21
  105. package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
  106. package/dist/ui/AdminSettings.svelte +1 -3
  107. package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
  108. package/dist/ui/CLAUDE.md +123 -69
  109. package/dist/ui/ConfirmButton.svelte +82 -24
  110. package/dist/ui/ConfirmButton.svelte.d.ts +8 -34
  111. package/dist/ui/ConfirmButton.svelte.d.ts.map +1 -1
  112. package/dist/ui/OpenSignupToggle.svelte +6 -4
  113. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
  114. package/dist/ui/RoleGrantOfferForm.svelte +4 -4
  115. package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
  116. package/dist/ui/RoleGrantOfferInbox.svelte +10 -6
  117. package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
  118. package/dist/ui/account_sessions_state.svelte.d.ts +17 -7
  119. package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
  120. package/dist/ui/account_sessions_state.svelte.js +32 -33
  121. package/dist/ui/admin_accounts_state.svelte.d.ts +48 -17
  122. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  123. package/dist/ui/admin_accounts_state.svelte.js +58 -76
  124. package/dist/ui/admin_invites_state.svelte.d.ts +14 -7
  125. package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
  126. package/dist/ui/admin_invites_state.svelte.js +32 -48
  127. package/dist/ui/admin_sessions_state.svelte.d.ts +15 -8
  128. package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
  129. package/dist/ui/admin_sessions_state.svelte.js +30 -47
  130. package/dist/ui/app_settings_state.svelte.d.ts +8 -3
  131. package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
  132. package/dist/ui/app_settings_state.svelte.js +19 -27
  133. package/dist/ui/async_slot.svelte.d.ts +173 -0
  134. package/dist/ui/async_slot.svelte.d.ts.map +1 -0
  135. package/dist/ui/async_slot.svelte.js +241 -0
  136. package/dist/ui/audit_log_state.svelte.d.ts +8 -2
  137. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  138. package/dist/ui/audit_log_state.svelte.js +19 -18
  139. package/dist/ui/keyed_async_slot.svelte.d.ts +139 -0
  140. package/dist/ui/keyed_async_slot.svelte.d.ts.map +1 -0
  141. package/dist/ui/keyed_async_slot.svelte.js +177 -0
  142. package/dist/ui/role_grant_offers_state.svelte.d.ts +39 -7
  143. package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
  144. package/dist/ui/role_grant_offers_state.svelte.js +34 -15
  145. package/dist/ui/table_state.svelte.d.ts +10 -7
  146. package/dist/ui/table_state.svelte.d.ts.map +1 -1
  147. package/dist/ui/table_state.svelte.js +11 -8
  148. package/package.json +1 -1
  149. package/dist/ui/loadable.svelte.d.ts +0 -60
  150. package/dist/ui/loadable.svelte.d.ts.map +0 -1
  151. package/dist/ui/loadable.svelte.js +0 -80
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * Reactive state for database table pagination and data fetching.
3
3
  *
4
- * Extends `Loadable` to manage paginated table data with column metadata,
5
- * row deletion, and derived pagination controls.
4
+ * Holds one `AsyncSlot` `list` (the paginated row fetch). Per-row delete
5
+ * uses plain try/catch + scalar `deleting` / `delete_error` fields (no slot
6
+ * — `delete_error` must persist past `list.run()` retries so the failure
7
+ * message stays visible while the user refetches).
6
8
  *
7
9
  * @example
8
10
  * ```ts
@@ -26,10 +28,10 @@
26
28
  * table.fetch('accounts');
27
29
  * </script>
28
30
  *
29
- * {#if table.loading}
31
+ * {#if table.list.loading}
30
32
  * <p>loading…</p>
31
- * {:else if table.error}
32
- * <p>{table.error}</p>
33
+ * {:else if table.list.error}
34
+ * <p>{table.list.error}</p>
33
35
  * {:else}
34
36
  * <p>showing {table.showing_start}–{table.showing_end} of {table.total}</p>
35
37
  * {/if}
@@ -37,12 +39,13 @@
37
39
  *
38
40
  * @module
39
41
  */
40
- import { Loadable } from './loadable.svelte.js';
42
+ import { AsyncSlot } from './async_slot.svelte.js';
41
43
  import { parse_response_error, ui_fetch } from './ui_fetch.js';
42
44
  import { format_value } from './ui_format.js';
43
45
  /** Maximum number of rows that can be fetched in a single page. */
44
46
  export const TABLE_LIMIT_MAX = 1000;
45
- export class TableState extends Loadable {
47
+ export class TableState {
48
+ list = new AsyncSlot();
46
49
  table_name = $state.raw('');
47
50
  columns = $state.raw([]);
48
51
  rows = $state.raw([]);
@@ -67,7 +70,7 @@ export class TableState extends Loadable {
67
70
  this.table_name = table_name;
68
71
  this.offset = offset;
69
72
  this.limit = Math.max(1, Math.min(TABLE_LIMIT_MAX, limit));
70
- await this.run(async () => {
73
+ await this.list.run(async () => {
71
74
  const response = await ui_fetch(`/api/db/tables/${table_name}?offset=${this.offset}&limit=${this.limit}`);
72
75
  if (!response.ok) {
73
76
  throw new Error(await parse_response_error(response, 'Failed to fetch table'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_app",
3
- "version": "0.59.0",
3
+ "version": "0.61.0",
4
4
  "description": "fullstack app library",
5
5
  "glyph": "🗝",
6
6
  "logo": "logo.svg",
@@ -1,60 +0,0 @@
1
- /**
2
- * Base reactive state class with loading/error management.
3
- *
4
- * Provides the common loading/error pattern shared by all state classes.
5
- * Subclasses add domain-specific `$state` fields and methods that call
6
- * the protected `run` helper for async operations.
7
- *
8
- * @example
9
- * ```ts
10
- * class ItemsState extends Loadable {
11
- * items: Array<Item> = $state.raw([]);
12
- *
13
- * async fetch(): Promise<void> {
14
- * await this.run(async () => {
15
- * const response = await fetch('/api/items');
16
- * if (!response.ok) throw new Error('failed to fetch');
17
- * this.items = await response.json();
18
- * });
19
- * }
20
- * }
21
- * ```
22
- *
23
- * @example
24
- * ```ts
25
- * // structured errors via map_error
26
- * class FormState extends Loadable<{field: string; message: string}> {
27
- * async submit(data: FormData): Promise<void> {
28
- * await this.run(
29
- * () => post_form(data),
30
- * (e) => ({field: 'form', message: e instanceof Error ? e.message : 'unknown'}),
31
- * );
32
- * }
33
- * }
34
- * ```
35
- *
36
- * @module
37
- */
38
- export declare class Loadable<TError = string> {
39
- loading: boolean;
40
- error: TError | null;
41
- /** The raw caught value from the last failed `run()`, for programmatic inspection. */
42
- error_data: unknown;
43
- /**
44
- * Run an async operation with loading/error handling.
45
- *
46
- * Sets `loading` to `true`, clears `error` and `error_data`, runs `fn`, catches errors.
47
- * Pass `map_error` to produce structured errors instead of strings.
48
- *
49
- * @returns the result or `undefined` if the operation failed
50
- * @mutates `this`
51
- */
52
- protected run<T>(fn: () => Promise<T>, map_error?: (e: unknown) => TError): Promise<T | undefined>;
53
- /**
54
- * Reset loading and error state. Subclasses override to clear data.
55
- *
56
- * @mutates `this`
57
- */
58
- reset(): void;
59
- }
60
- //# sourceMappingURL=loadable.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadable.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/loadable.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,qBAAa,QAAQ,CAAC,MAAM,GAAG,MAAM;IACpC,OAAO,UAAqB;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAoB;IAExC,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAoB;IAEvC;;;;;;;;OAQG;cACa,GAAG,CAAC,CAAC,EACpB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,GAChC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAiBzB;;;;OAIG;IACH,KAAK,IAAI,IAAI;CAKb"}
@@ -1,80 +0,0 @@
1
- /**
2
- * Base reactive state class with loading/error management.
3
- *
4
- * Provides the common loading/error pattern shared by all state classes.
5
- * Subclasses add domain-specific `$state` fields and methods that call
6
- * the protected `run` helper for async operations.
7
- *
8
- * @example
9
- * ```ts
10
- * class ItemsState extends Loadable {
11
- * items: Array<Item> = $state.raw([]);
12
- *
13
- * async fetch(): Promise<void> {
14
- * await this.run(async () => {
15
- * const response = await fetch('/api/items');
16
- * if (!response.ok) throw new Error('failed to fetch');
17
- * this.items = await response.json();
18
- * });
19
- * }
20
- * }
21
- * ```
22
- *
23
- * @example
24
- * ```ts
25
- * // structured errors via map_error
26
- * class FormState extends Loadable<{field: string; message: string}> {
27
- * async submit(data: FormData): Promise<void> {
28
- * await this.run(
29
- * () => post_form(data),
30
- * (e) => ({field: 'form', message: e instanceof Error ? e.message : 'unknown'}),
31
- * );
32
- * }
33
- * }
34
- * ```
35
- *
36
- * @module
37
- */
38
- export class Loadable {
39
- loading = $state.raw(false);
40
- error = $state.raw(null);
41
- /** The raw caught value from the last failed `run()`, for programmatic inspection. */
42
- error_data = $state.raw(null);
43
- /**
44
- * Run an async operation with loading/error handling.
45
- *
46
- * Sets `loading` to `true`, clears `error` and `error_data`, runs `fn`, catches errors.
47
- * Pass `map_error` to produce structured errors instead of strings.
48
- *
49
- * @returns the result or `undefined` if the operation failed
50
- * @mutates `this`
51
- */
52
- async run(fn, map_error) {
53
- this.loading = true;
54
- this.error = null;
55
- this.error_data = null;
56
- try {
57
- return await fn();
58
- }
59
- catch (e) {
60
- this.error = map_error
61
- ? map_error(e)
62
- : (e instanceof Error ? e.message : 'Request failed');
63
- this.error_data = e;
64
- return undefined;
65
- }
66
- finally {
67
- this.loading = false;
68
- }
69
- }
70
- /**
71
- * Reset loading and error state. Subclasses override to clear data.
72
- *
73
- * @mutates `this`
74
- */
75
- reset() {
76
- this.loading = false;
77
- this.error = null;
78
- this.error_data = null;
79
- }
80
- }