@fuzdev/fuz_app 0.60.0 → 0.62.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/CLAUDE.md +28 -22
- package/dist/auth/CLAUDE.md +4 -4
- package/dist/server/app_server.d.ts +54 -6
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +32 -4
- package/dist/testing/CLAUDE.md +8 -8
- package/dist/ui/AccountSessions.svelte +21 -6
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +32 -25
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAuditLog.svelte +3 -3
- package/dist/ui/AdminInvites.svelte +20 -15
- package/dist/ui/AdminOverview.svelte +19 -21
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +3 -3
- package/dist/ui/AdminSessions.svelte +19 -21
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSettings.svelte +1 -3
- package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +123 -69
- package/dist/ui/ConfirmButton.svelte +82 -24
- package/dist/ui/ConfirmButton.svelte.d.ts +8 -34
- package/dist/ui/ConfirmButton.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +6 -4
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +4 -4
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +10 -6
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +17 -7
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.js +32 -33
- package/dist/ui/admin_accounts_state.svelte.d.ts +48 -17
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +58 -76
- package/dist/ui/admin_invites_state.svelte.d.ts +14 -7
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_invites_state.svelte.js +32 -48
- package/dist/ui/admin_sessions_state.svelte.d.ts +15 -8
- package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_sessions_state.svelte.js +30 -47
- package/dist/ui/app_settings_state.svelte.d.ts +8 -3
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/app_settings_state.svelte.js +19 -27
- package/dist/ui/async_slot.svelte.d.ts +173 -0
- package/dist/ui/async_slot.svelte.d.ts.map +1 -0
- package/dist/ui/async_slot.svelte.js +241 -0
- package/dist/ui/audit_log_state.svelte.d.ts +8 -2
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +19 -18
- package/dist/ui/keyed_async_slot.svelte.d.ts +139 -0
- package/dist/ui/keyed_async_slot.svelte.d.ts.map +1 -0
- package/dist/ui/keyed_async_slot.svelte.js +177 -0
- package/dist/ui/role_grant_offers_state.svelte.d.ts +39 -7
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +34 -15
- package/dist/ui/table_state.svelte.d.ts +10 -7
- package/dist/ui/table_state.svelte.d.ts.map +1 -1
- package/dist/ui/table_state.svelte.js +11 -8
- package/package.json +1 -1
- package/dist/ui/loadable.svelte.d.ts +0 -60
- package/dist/ui/loadable.svelte.d.ts.map +0 -1
- package/dist/ui/loadable.svelte.js +0 -80
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Confirmation popover wrapping `PopoverButton`.
|
|
3
|
-
*
|
|
4
|
-
* Clicking the trigger opens a popover with a confirm button.
|
|
5
|
-
* On confirm, calls `onconfirm` and hides the popover (controlled
|
|
6
|
-
* by `hide_on_confirm`). Defaults to `position="left"`.
|
|
7
|
-
*
|
|
8
|
-
* Snippets (`children`, `popover_content`, `popover_button_content`)
|
|
9
|
-
* receive both the `Popover` instance and a `confirm` callback.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```svelte
|
|
13
|
-
* <ConfirmButton
|
|
14
|
-
* onconfirm={() => delete_item(item.id)}
|
|
15
|
-
* title="delete item"
|
|
16
|
-
* disabled={deleting}
|
|
17
|
-
* >
|
|
18
|
-
* {#snippet children(_popover, _confirm)}
|
|
19
|
-
* {deleting ? 'deleting…' : 'delete'}
|
|
20
|
-
* {/snippet}
|
|
21
|
-
* </ConfirmButton>
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```svelte
|
|
26
|
-
* <!-- custom confirm button content -->
|
|
27
|
-
* <ConfirmButton onconfirm={handle_revoke} class="icon_button plain" title="revoke">
|
|
28
|
-
* revoke
|
|
29
|
-
* {#snippet popover_button_content()}revoke{/snippet}
|
|
30
|
-
* </ConfirmButton>
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @module
|
|
34
|
-
*/
|
|
35
1
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
36
2
|
import type { ComponentProps, Snippet } from 'svelte';
|
|
37
3
|
import type { OmitStrict } from '@fuzdev/fuz_util/types.js';
|
|
@@ -47,6 +13,14 @@ type $$ComponentProps = OmitStrict<ComponentProps<typeof PopoverButton>, 'popove
|
|
|
47
13
|
popover_button_content?: Snippet<[popover: Popover, confirm: () => void]> | undefined;
|
|
48
14
|
/** Unlike on `PopoverButton` this has a `confirm` arg */
|
|
49
15
|
children?: Snippet<[popover: Popover, confirm: () => void]> | undefined;
|
|
16
|
+
/** Simple string content for the trigger. Mutually exclusive with `children`. */
|
|
17
|
+
label?: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* When `true`, the trigger is disabled and a spinner overlays the
|
|
20
|
+
* content (mirrors `PendingButton`). The label / children stay
|
|
21
|
+
* rendered underneath so the button keeps its size.
|
|
22
|
+
*/
|
|
23
|
+
pending?: boolean | undefined;
|
|
50
24
|
};
|
|
51
25
|
declare const ConfirmButton: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
52
26
|
type ConfirmButton = ReturnType<typeof ConfirmButton>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmButton.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/ConfirmButton.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfirmButton.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/ConfirmButton.svelte"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAC,cAAc,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AACpD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AAI1D,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAEhD,KAAK,gBAAgB,GAAI,UAAU,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,EAAE,iBAAiB,GAAG,UAAU,CAAC,GACxG,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IACtD,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAChE,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,yEAAyE;IACzE,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IAC/E,qCAAqC;IACrC,sBAAsB,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IACtF,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IACxE,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B,CAAC;AAgGJ,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<div class="open-signup-toggle">
|
|
20
20
|
{#if !app_settings.has_rpc}
|
|
21
21
|
<p class="text_50">rpc adapter not wired</p>
|
|
22
|
-
{:else if app_settings.loading}
|
|
22
|
+
{:else if app_settings.list.loading}
|
|
23
23
|
<p class="text_50">loading settings...</p>
|
|
24
24
|
{:else if app_settings.settings}
|
|
25
25
|
<label class="row">
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
type="checkbox"
|
|
28
28
|
class="mr_lg"
|
|
29
29
|
checked={app_settings.settings.open_signup}
|
|
30
|
-
disabled={app_settings.
|
|
30
|
+
disabled={app_settings.update.loading}
|
|
31
31
|
onchange={() => app_settings.update_open_signup(!app_settings.settings!.open_signup)}
|
|
32
32
|
/>
|
|
33
33
|
<div>
|
|
@@ -42,7 +42,9 @@
|
|
|
42
42
|
</div>
|
|
43
43
|
</label>
|
|
44
44
|
{/if}
|
|
45
|
-
{#if app_settings.error}
|
|
46
|
-
<p class="color_c_50">{app_settings.error}</p>
|
|
45
|
+
{#if app_settings.list.error}
|
|
46
|
+
<p class="color_c_50">{app_settings.list.error}</p>
|
|
47
|
+
{:else if app_settings.update.error}
|
|
48
|
+
<p class="color_c_50">{app_settings.update.error}</p>
|
|
47
49
|
{/if}
|
|
48
50
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenSignupToggle.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/OpenSignupToggle.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OpenSignupToggle.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/OpenSignupToggle.svelte"],"names":[],"mappings":"AAiDA,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAKD,QAAA,MAAM,gBAAgB;;kBAA+E,CAAC;AACpF,KAAK,gBAAgB,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,eAAe,gBAAgB,CAAC"}
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
let message = $state.raw('');
|
|
59
59
|
let local_error: string | null = $state.raw(null);
|
|
60
60
|
|
|
61
|
-
const submitting = $derived(role_grant_offers.loading);
|
|
61
|
+
const submitting = $derived(role_grant_offers.create.loading);
|
|
62
62
|
|
|
63
63
|
const surface_error = (reason: string | null): string | null => {
|
|
64
64
|
switch (reason) {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
form_state.focus('role');
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
const offer = await role_grant_offers.
|
|
87
|
+
const offer = await role_grant_offers.submit_create({
|
|
88
88
|
to_account_id,
|
|
89
89
|
to_actor_id,
|
|
90
90
|
role: selected_role,
|
|
@@ -98,12 +98,12 @@
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
// Structured error data carries the reason; fall back to raw error string.
|
|
101
|
-
const data = role_grant_offers.error_data as
|
|
101
|
+
const data = role_grant_offers.create.error_data as
|
|
102
102
|
| {data?: {reason?: string}; reason?: string}
|
|
103
103
|
| null
|
|
104
104
|
| undefined;
|
|
105
105
|
const reason = data?.data?.reason ?? data?.reason ?? null;
|
|
106
|
-
local_error = surface_error(reason) ?? role_grant_offers.error;
|
|
106
|
+
local_error = surface_error(reason) ?? role_grant_offers.create.error;
|
|
107
107
|
};
|
|
108
108
|
</script>
|
|
109
109
|
|
|
@@ -82,10 +82,10 @@
|
|
|
82
82
|
<section>
|
|
83
83
|
<h2>offer history</h2>
|
|
84
84
|
|
|
85
|
-
{#if role_grant_offers.loading}
|
|
85
|
+
{#if role_grant_offers.list_history.loading}
|
|
86
86
|
<p class="text_50">loading history...</p>
|
|
87
|
-
{:else if role_grant_offers.error}
|
|
88
|
-
<p class="color_c_50">{role_grant_offers.error}</p>
|
|
87
|
+
{:else if role_grant_offers.list_history.error}
|
|
88
|
+
<p class="color_c_50">{role_grant_offers.list_history.error}</p>
|
|
89
89
|
{:else}
|
|
90
90
|
<Datatable {columns} rows={role_grant_offers.history} height="400px" row_key="id">
|
|
91
91
|
{#snippet cell(column, row)}
|
|
@@ -48,8 +48,12 @@
|
|
|
48
48
|
<section class="role-grant-offer-inbox">
|
|
49
49
|
<h2>pending offers</h2>
|
|
50
50
|
|
|
51
|
-
{#if role_grant_offers.error}
|
|
52
|
-
<p class="color_c_50">
|
|
51
|
+
{#if role_grant_offers.list.error || role_grant_offers.accept.error || role_grant_offers.decline.error}
|
|
52
|
+
<p class="color_c_50">
|
|
53
|
+
{role_grant_offers.list.error ??
|
|
54
|
+
role_grant_offers.accept.error ??
|
|
55
|
+
role_grant_offers.decline.error}
|
|
56
|
+
</p>
|
|
53
57
|
{/if}
|
|
54
58
|
|
|
55
59
|
{#if role_grant_offers.incoming.length === 0}
|
|
@@ -76,9 +80,9 @@
|
|
|
76
80
|
|
|
77
81
|
<div class="row gap_sm">
|
|
78
82
|
<PendingButton
|
|
79
|
-
pending={role_grant_offers.loading}
|
|
80
|
-
disabled={role_grant_offers.loading}
|
|
81
|
-
onclick={() => role_grant_offers.
|
|
83
|
+
pending={role_grant_offers.accept.loading}
|
|
84
|
+
disabled={role_grant_offers.accept.loading}
|
|
85
|
+
onclick={() => role_grant_offers.submit_accept(offer.id)}
|
|
82
86
|
class="color_b"
|
|
83
87
|
>
|
|
84
88
|
accept
|
|
@@ -89,7 +93,7 @@
|
|
|
89
93
|
position="bottom"
|
|
90
94
|
onconfirm={() => {
|
|
91
95
|
const reason = decline_reasons.get(offer.id) ?? '';
|
|
92
|
-
void role_grant_offers.
|
|
96
|
+
void role_grant_offers.submit_decline(offer.id, reason || null);
|
|
93
97
|
decline_reasons.delete(offer.id);
|
|
94
98
|
}}
|
|
95
99
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoleGrantOfferInbox.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/RoleGrantOfferInbox.svelte"],"names":[],"mappings":"AAmBA,OAAO,EAA4C,KAAK,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE7F,KAAK,gBAAgB,GAAI;IACxB,uEAAuE;IACvE,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,+DAA+D;IAC/D,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACvC,CAAC;
|
|
1
|
+
{"version":3,"file":"RoleGrantOfferInbox.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/RoleGrantOfferInbox.svelte"],"names":[],"mappings":"AAmBA,OAAO,EAA4C,KAAK,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE7F,KAAK,gBAAgB,GAAI;IACxB,uEAAuE;IACvE,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,+DAA+D;IAC/D,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACvC,CAAC;AA+FH,QAAA,MAAM,mBAAmB,sDAAwC,CAAC;AAClE,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reactive state for managing the authenticated account's auth sessions on a
|
|
3
|
-
* settings page. Reads and mutations flow through a narrow RPC adapter
|
|
4
|
-
*
|
|
3
|
+
* settings page. Reads and mutations flow through a narrow RPC adapter backed
|
|
4
|
+
* by `auth/account_actions.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Holds two `AsyncSlot`s — `list` for the fetch, `revoke_all` for the bulk
|
|
7
|
+
* revoke — plus one `KeyedAsyncSlot<string, void>` (`revoke`) keyed by
|
|
8
|
+
* `session_id` for per-row revoke (independent supersession across
|
|
9
|
+
* concurrent rows; per-row error surfacing). Method names use the
|
|
10
|
+
* `submit_*` prefix to avoid slot-name collisions.
|
|
5
11
|
*
|
|
6
12
|
* @module
|
|
7
13
|
*/
|
|
8
|
-
import {
|
|
14
|
+
import { AsyncSlot } from './async_slot.svelte.js';
|
|
15
|
+
import { KeyedAsyncSlot } from './keyed_async_slot.svelte.js';
|
|
9
16
|
import type { AuthSessionJson } from '../auth/account_schema.js';
|
|
10
17
|
/**
|
|
11
18
|
* Narrow RPC surface consumed by `AccountSessionsState`. Consumers adapt their
|
|
@@ -50,15 +57,18 @@ export interface AccountSessionsStateOptions {
|
|
|
50
57
|
*/
|
|
51
58
|
get_rpc?: () => AccountSessionsRpc | null;
|
|
52
59
|
}
|
|
53
|
-
export declare class AccountSessionsState
|
|
60
|
+
export declare class AccountSessionsState {
|
|
54
61
|
#private;
|
|
62
|
+
readonly list: AsyncSlot<void, string>;
|
|
63
|
+
readonly revoke: KeyedAsyncSlot<string, void, string>;
|
|
64
|
+
readonly revoke_all: AsyncSlot<void, string>;
|
|
55
65
|
sessions: Array<AuthSessionJson>;
|
|
56
66
|
readonly active_count: number;
|
|
57
67
|
constructor(options?: AccountSessionsStateOptions);
|
|
58
|
-
/** True when an RPC adapter is wired. `fetch` / `
|
|
68
|
+
/** True when an RPC adapter is wired. `fetch` / `submit_revoke` / `submit_revoke_all` no-op without it. */
|
|
59
69
|
get has_rpc(): boolean;
|
|
60
70
|
fetch(): Promise<void>;
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
submit_revoke(id: string): Promise<void>;
|
|
72
|
+
submit_revoke_all(): Promise<void>;
|
|
63
73
|
}
|
|
64
74
|
//# sourceMappingURL=account_sessions_state.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_sessions_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/account_sessions_state.svelte.ts"],"names":[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CAAC,EAAE,2BAA2B;IAIjD,2GAA2G;IAC3G,IAAI,OAAO,IAAI,OAAO,CAErB;IAQK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAOtB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAUxC"}
|
|
@@ -1,66 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reactive state for managing the authenticated account's auth sessions on a
|
|
3
|
-
* settings page. Reads and mutations flow through a narrow RPC adapter
|
|
4
|
-
*
|
|
3
|
+
* settings page. Reads and mutations flow through a narrow RPC adapter backed
|
|
4
|
+
* by `auth/account_actions.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Holds two `AsyncSlot`s — `list` for the fetch, `revoke_all` for the bulk
|
|
7
|
+
* revoke — plus one `KeyedAsyncSlot<string, void>` (`revoke`) keyed by
|
|
8
|
+
* `session_id` for per-row revoke (independent supersession across
|
|
9
|
+
* concurrent rows; per-row error surfacing). Method names use the
|
|
10
|
+
* `submit_*` prefix to avoid slot-name collisions.
|
|
5
11
|
*
|
|
6
12
|
* @module
|
|
7
13
|
*/
|
|
8
14
|
import { create_context } from '@fuzdev/fuz_ui/context_helpers.js';
|
|
9
|
-
import {
|
|
15
|
+
import { AsyncSlot } from './async_slot.svelte.js';
|
|
16
|
+
import { KeyedAsyncSlot } from './keyed_async_slot.svelte.js';
|
|
10
17
|
/**
|
|
11
18
|
* Svelte context carrying the reactive `AccountSessionsRpc` accessor. Mirrors
|
|
12
19
|
* the admin-side RPC contexts. Unset context falls back to `() => null` so
|
|
13
20
|
* components render the usual "rpc adapter not wired" state.
|
|
14
21
|
*/
|
|
15
22
|
export const account_sessions_rpc_context = create_context(() => () => null);
|
|
16
|
-
export class AccountSessionsState
|
|
23
|
+
export class AccountSessionsState {
|
|
17
24
|
#get_rpc;
|
|
25
|
+
list = new AsyncSlot();
|
|
26
|
+
revoke = new KeyedAsyncSlot();
|
|
27
|
+
revoke_all = new AsyncSlot();
|
|
18
28
|
sessions = $state.raw([]);
|
|
19
29
|
active_count = $derived(this.sessions.length);
|
|
20
30
|
constructor(options) {
|
|
21
|
-
super();
|
|
22
31
|
this.#get_rpc = options?.get_rpc ?? (() => null);
|
|
23
32
|
}
|
|
24
|
-
/** True when an RPC adapter is wired. `fetch` / `
|
|
33
|
+
/** True when an RPC adapter is wired. `fetch` / `submit_revoke` / `submit_revoke_all` no-op without it. */
|
|
25
34
|
get has_rpc() {
|
|
26
35
|
return this.#get_rpc() !== null;
|
|
27
36
|
}
|
|
28
|
-
|
|
37
|
+
#require_rpc() {
|
|
29
38
|
const rpc = this.#get_rpc();
|
|
30
|
-
if (!rpc)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
if (!rpc)
|
|
40
|
+
throw new Error('rpc adapter not wired');
|
|
41
|
+
return rpc;
|
|
42
|
+
}
|
|
43
|
+
async fetch() {
|
|
44
|
+
await this.list.run(async () => {
|
|
45
|
+
const { sessions } = await this.#require_rpc().list();
|
|
36
46
|
this.sessions = sessions;
|
|
37
47
|
});
|
|
38
48
|
}
|
|
39
|
-
async
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.error = 'rpc adapter not wired';
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
await this.run(async () => {
|
|
46
|
-
await rpc.revoke({ session_id: id });
|
|
49
|
+
async submit_revoke(id) {
|
|
50
|
+
await this.revoke.run(id, async () => {
|
|
51
|
+
await this.#require_rpc().revoke({ session_id: id });
|
|
47
52
|
});
|
|
48
|
-
if (
|
|
53
|
+
if (this.revoke.succeeded(id))
|
|
49
54
|
await this.fetch();
|
|
50
|
-
}
|
|
51
55
|
}
|
|
52
|
-
async
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.error = 'rpc adapter not wired';
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
await this.run(async () => {
|
|
59
|
-
await rpc.revoke_all();
|
|
56
|
+
async submit_revoke_all() {
|
|
57
|
+
await this.revoke_all.run(async () => {
|
|
58
|
+
await this.#require_rpc().revoke_all();
|
|
60
59
|
});
|
|
61
|
-
if (
|
|
60
|
+
if (this.revoke_all.succeeded) {
|
|
62
61
|
// Current session is now revoked — next API call will 401.
|
|
63
|
-
// Clear local
|
|
62
|
+
// Clear the local sessions cache so the UI shows the login page.
|
|
64
63
|
this.sessions = [];
|
|
65
64
|
}
|
|
66
65
|
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reactive state for admin account management.
|
|
3
3
|
*
|
|
4
|
+
* Holds one fetch `AsyncSlot` (`list`) plus three `KeyedAsyncSlot`s —
|
|
5
|
+
* `grant` (offer creation, keyed by `account_id:role` or
|
|
6
|
+
* `account_id:role:to_actor_id`), `revoke` (role_grant revoke, keyed
|
|
7
|
+
* by `role_grant_id`), `retract` (offer retraction, keyed by
|
|
8
|
+
* `offer_id`). Per-row supersession is correct (clicking row B no
|
|
9
|
+
* longer aborts row A) and `error(key)` surfaces failure per-row.
|
|
10
|
+
* Method names use the `submit_*` prefix to avoid slot-name
|
|
11
|
+
* collisions.
|
|
12
|
+
*
|
|
4
13
|
* @module
|
|
5
14
|
*/
|
|
6
|
-
import { SvelteSet } from 'svelte/reactivity';
|
|
7
15
|
import type { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
8
|
-
import {
|
|
16
|
+
import { AsyncSlot } from './async_slot.svelte.js';
|
|
17
|
+
import { KeyedAsyncSlot } from './keyed_async_slot.svelte.js';
|
|
9
18
|
import type { AdminAccountEntryJson } from '../auth/account_schema.js';
|
|
10
19
|
import type { RoleName } from '../auth/role_schema.js';
|
|
11
20
|
import type { RoleGrantOfferJson } from '../auth/role_grant_offer_schema.js';
|
|
@@ -62,13 +71,38 @@ export interface AdminAccountsStateOptions {
|
|
|
62
71
|
*/
|
|
63
72
|
get_rpc?: () => AdminAccountsRpc | null;
|
|
64
73
|
}
|
|
65
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Compose the `grant` keyed-slot key for an offer. Account-grain offers
|
|
76
|
+
* key on `${account_id}:${role}`; actor-targeted offers add the actor
|
|
77
|
+
* suffix so the two variants can be in flight simultaneously without
|
|
78
|
+
* colliding on per-row spinners.
|
|
79
|
+
*/
|
|
80
|
+
export declare const grant_key: (account_id: Uuid, role: RoleName, to_actor_id?: Uuid | null) => string;
|
|
81
|
+
export declare class AdminAccountsState {
|
|
66
82
|
#private;
|
|
83
|
+
readonly list: AsyncSlot<void, string>;
|
|
84
|
+
readonly grant: KeyedAsyncSlot<string, {
|
|
85
|
+
id: string & import("zod").$brand<"Uuid">;
|
|
86
|
+
from_actor_id: string & import("zod").$brand<"Uuid">;
|
|
87
|
+
to_account_id: string & import("zod").$brand<"Uuid">;
|
|
88
|
+
to_actor_id: (string & import("zod").$brand<"Uuid">) | null;
|
|
89
|
+
role: string;
|
|
90
|
+
scope_kind: string | null;
|
|
91
|
+
scope_id: (string & import("zod").$brand<"Uuid">) | null;
|
|
92
|
+
message: string | null;
|
|
93
|
+
created_at: string;
|
|
94
|
+
expires_at: string;
|
|
95
|
+
accepted_at: string | null;
|
|
96
|
+
declined_at: string | null;
|
|
97
|
+
decline_reason: string | null;
|
|
98
|
+
retracted_at: string | null;
|
|
99
|
+
superseded_at: string | null;
|
|
100
|
+
resulting_role_grant_id: (string & import("zod").$brand<"Uuid">) | null;
|
|
101
|
+
}, string>;
|
|
102
|
+
readonly revoke: KeyedAsyncSlot<string & import("zod").$brand<"Uuid">, void, string>;
|
|
103
|
+
readonly retract: KeyedAsyncSlot<string & import("zod").$brand<"Uuid">, void, string>;
|
|
67
104
|
accounts: Array<AdminAccountEntryJson>;
|
|
68
105
|
grantable_roles: Array<RoleName>;
|
|
69
|
-
readonly granting_keys: SvelteSet<string>;
|
|
70
|
-
readonly revoking_ids: SvelteSet<string>;
|
|
71
|
-
readonly retracting_ids: SvelteSet<string>;
|
|
72
106
|
readonly account_count: number;
|
|
73
107
|
constructor(options?: AdminAccountsStateOptions);
|
|
74
108
|
/**
|
|
@@ -88,16 +122,13 @@ export declare class AdminAccountsState extends Loadable {
|
|
|
88
122
|
* across those calls.
|
|
89
123
|
*
|
|
90
124
|
* `to_actor_id` (optional) narrows the offer to a specific actor on
|
|
91
|
-
* `account_id`; the
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* No-op when the rpc adapter is absent; `error` is set to a descriptive
|
|
98
|
-
* message so the UI surfaces the misconfiguration.
|
|
125
|
+
* `account_id`; the keyed-slot key stays at `account_id:role` for the
|
|
126
|
+
* account-grain default (so existing consumers keep working) and
|
|
127
|
+
* becomes `account_id:role:to_actor_id` when actor-targeted, so the
|
|
128
|
+
* two variants can be in flight without colliding on the per-row
|
|
129
|
+
* spinner.
|
|
99
130
|
*/
|
|
100
|
-
|
|
131
|
+
submit_grant(account_id: Uuid, role: RoleName, to_actor_id?: Uuid | null): Promise<RoleGrantOfferJson | undefined>;
|
|
101
132
|
/**
|
|
102
133
|
* Revoke an active role_grant via the `role_grant_revoke` RPC.
|
|
103
134
|
*
|
|
@@ -107,7 +138,7 @@ export declare class AdminAccountsState extends Loadable {
|
|
|
107
138
|
* The optional `reason` is stamped on `role_grant.revoked_reason` and
|
|
108
139
|
* surfaced on the revokee's WS notification.
|
|
109
140
|
*/
|
|
110
|
-
|
|
141
|
+
submit_revoke(actor_id: Uuid, role_grant_id: Uuid, reason?: string | null): Promise<void>;
|
|
111
142
|
/**
|
|
112
143
|
* Retract a pending offer the admin issued via the `role_grant_offer_retract`
|
|
113
144
|
* RPC. The action handles auth, audit, and the
|
|
@@ -116,6 +147,6 @@ export declare class AdminAccountsState extends Loadable {
|
|
|
116
147
|
* After success, refetches the listing so `pending_offers` drops the
|
|
117
148
|
* row and the "+ {role}" button un-hides.
|
|
118
149
|
*/
|
|
119
|
-
|
|
150
|
+
submit_retract(offer_id: Uuid): Promise<void>;
|
|
120
151
|
}
|
|
121
152
|
//# sourceMappingURL=admin_accounts_state.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_accounts_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_accounts_state.svelte.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"admin_accounts_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_accounts_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACX,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,0CAA0C,CAAC;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,gBAAgB;IAChC,aAAa,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrD,aAAa,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrD,iBAAiB,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC9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