@fuzdev/fuz_app 0.43.0 → 0.45.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 +108 -5
- package/dist/actions/action_event.d.ts +10 -1
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -0
- package/dist/actions/broadcast_api.d.ts +1 -1
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.d.ts +128 -0
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -0
- package/dist/actions/frontend_rpc_client.js +86 -0
- package/dist/actions/rpc_client.d.ts +86 -60
- package/dist/actions/rpc_client.d.ts.map +1 -1
- package/dist/actions/rpc_client.js +102 -80
- package/dist/auth/CLAUDE.md +24 -13
- package/dist/auth/self_service_role_action_specs.d.ts +20 -48
- package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
- package/dist/auth/self_service_role_action_specs.js +22 -44
- package/dist/auth/self_service_role_actions.d.ts +9 -9
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +48 -53
- package/dist/auth/standard_action_specs.d.ts +31 -0
- package/dist/auth/standard_action_specs.d.ts.map +1 -0
- package/dist/auth/standard_action_specs.js +36 -0
- package/dist/testing/ws_round_trip.d.ts +1 -1
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +10 -11
- package/dist/ui/admin_accounts_state.svelte.d.ts +20 -41
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_invites_state.svelte.d.ts +9 -18
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +41 -29
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +28 -31
- package/dist/ui/admin_sessions_state.svelte.d.ts +3 -2
- package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/app_settings_state.svelte.d.ts +5 -10
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +6 -18
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Unified self-service role toggle RPC action.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* One static `request_response` action — `self_service_role_set` — that
|
|
5
|
+
* takes `{role, enabled}` and toggles a global permit on the caller for an
|
|
6
|
+
* allowlisted role. Idempotent in both directions: re-enabling an
|
|
7
|
+
* already-held role returns `changed: false`; disabling a role the caller
|
|
8
|
+
* doesn't hold returns `changed: false`.
|
|
9
9
|
*
|
|
10
10
|
* The factory takes an `eligible_roles` allowlist (validated against the
|
|
11
11
|
* supplied `roles.role_options` at factory time so typos surface at startup
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* part of the documented schema surface and is round-trip-validated by
|
|
20
20
|
* `query_audit_log`.
|
|
21
21
|
*
|
|
22
|
-
* Static method
|
|
23
|
-
* so
|
|
22
|
+
* Static method name — `role` lives in the input, not the method name —
|
|
23
|
+
* so the spec is codegen-compatible (`satisfies RequestResponseActionSpec`)
|
|
24
24
|
* and the surface stays constant as consumers add eligible roles. Mirrors
|
|
25
25
|
* the existing `permit_offer_create({role})` precedent rather than
|
|
26
26
|
* generating per-role methods.
|
|
@@ -35,14 +35,14 @@ import { rpc_action } from '../actions/action_rpc.js';
|
|
|
35
35
|
import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
|
|
36
36
|
import { query_grant_permit, query_permit_find_active_for_actor, query_permit_has_role, query_revoke_permit, } from './permit_queries.js';
|
|
37
37
|
import { audit_log_fire_and_forget } from './audit_log_queries.js';
|
|
38
|
-
import { ERROR_ROLE_NOT_SELF_SERVICE_ELIGIBLE,
|
|
38
|
+
import { ERROR_ROLE_NOT_SELF_SERVICE_ELIGIBLE, self_service_role_set_action_spec, } from './self_service_role_action_specs.js';
|
|
39
39
|
const require_request_auth = (auth) => {
|
|
40
40
|
if (!auth)
|
|
41
41
|
throw new Error('unreachable: action auth guard did not enforce authentication');
|
|
42
42
|
return auth;
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
* Build the self-service role
|
|
45
|
+
* Build the unified self-service role toggle RPC action.
|
|
46
46
|
*
|
|
47
47
|
* @param deps - `SelfServiceRoleActionDeps` slice of `AppDeps` (`log`, `on_audit_event`, optional `audit_log_config`)
|
|
48
48
|
* @param options - eligible-role allowlist plus optional role schema for typo-checking
|
|
@@ -65,45 +65,43 @@ export const create_self_service_role_actions = (deps, options) => {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
const
|
|
68
|
+
const handler = async (input, ctx) => {
|
|
69
69
|
const auth = require_request_auth(ctx.auth);
|
|
70
70
|
reject_if_ineligible(input.role);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
if (input.enabled) {
|
|
72
|
+
// Pre-check for idempotent re-grant. `query_grant_permit` is itself
|
|
73
|
+
// idempotent (returns the existing permit instead of inserting), but
|
|
74
|
+
// it doesn't signal "already existed" vs "newly inserted" — so we
|
|
75
|
+
// peek first. The TOCTOU window is benign for self-service: two
|
|
76
|
+
// concurrent grants both observe "no permit", both call
|
|
77
|
+
// `query_grant_permit`, and one collapses onto the other inside the
|
|
78
|
+
// query's `ON CONFLICT DO NOTHING`. Worst case both responses report
|
|
79
|
+
// `changed: true`; the DB still ends up with exactly one permit.
|
|
80
|
+
const already = await query_permit_has_role(ctx, auth.actor.id, input.role);
|
|
81
|
+
if (already) {
|
|
82
|
+
return { ok: true, enabled: true, changed: false };
|
|
83
|
+
}
|
|
84
|
+
const permit = await query_grant_permit(ctx, {
|
|
85
|
+
actor_id: auth.actor.id,
|
|
86
|
+
role: input.role,
|
|
87
|
+
scope_id: null,
|
|
88
|
+
expires_at: null,
|
|
89
|
+
granted_by: auth.actor.id,
|
|
90
|
+
});
|
|
91
|
+
void audit_log_fire_and_forget(ctx, {
|
|
92
|
+
event_type: 'permit_grant',
|
|
93
|
+
actor_id: auth.actor.id,
|
|
94
|
+
account_id: auth.account.id,
|
|
95
|
+
ip: ctx.client_ip,
|
|
96
|
+
metadata: {
|
|
97
|
+
role: permit.role,
|
|
98
|
+
permit_id: permit.id,
|
|
99
|
+
scope_id: permit.scope_id,
|
|
100
|
+
self_service: true,
|
|
101
|
+
},
|
|
102
|
+
}, deps);
|
|
103
|
+
return { ok: true, enabled: true, changed: true };
|
|
82
104
|
}
|
|
83
|
-
const permit = await query_grant_permit(ctx, {
|
|
84
|
-
actor_id: auth.actor.id,
|
|
85
|
-
role: input.role,
|
|
86
|
-
scope_id: null,
|
|
87
|
-
expires_at: null,
|
|
88
|
-
granted_by: auth.actor.id,
|
|
89
|
-
});
|
|
90
|
-
void audit_log_fire_and_forget(ctx, {
|
|
91
|
-
event_type: 'permit_grant',
|
|
92
|
-
actor_id: auth.actor.id,
|
|
93
|
-
account_id: auth.account.id,
|
|
94
|
-
ip: ctx.client_ip,
|
|
95
|
-
metadata: {
|
|
96
|
-
role: permit.role,
|
|
97
|
-
permit_id: permit.id,
|
|
98
|
-
scope_id: permit.scope_id,
|
|
99
|
-
self_service: true,
|
|
100
|
-
},
|
|
101
|
-
}, deps);
|
|
102
|
-
return { ok: true, granted: true, permit_id: permit.id };
|
|
103
|
-
};
|
|
104
|
-
const revoke_handler = async (input, ctx) => {
|
|
105
|
-
const auth = require_request_auth(ctx.auth);
|
|
106
|
-
reject_if_ineligible(input.role);
|
|
107
105
|
// Find an active global permit for this (actor, role). No dedicated
|
|
108
106
|
// query exists, but `query_permit_find_active_for_actor` returns the
|
|
109
107
|
// short list of every active permit and we filter in JS — fewer
|
|
@@ -111,12 +109,12 @@ export const create_self_service_role_actions = (deps, options) => {
|
|
|
111
109
|
const active = await query_permit_find_active_for_actor(ctx, auth.actor.id);
|
|
112
110
|
const target = active.find((p) => p.role === input.role && p.scope_id === null);
|
|
113
111
|
if (!target) {
|
|
114
|
-
return { ok: true,
|
|
112
|
+
return { ok: true, enabled: false, changed: false };
|
|
115
113
|
}
|
|
116
114
|
const result = await query_revoke_permit(ctx, target.id, auth.actor.id, auth.actor.id);
|
|
117
115
|
if (!result) {
|
|
118
116
|
// Raced with another revoker — treat as already revoked.
|
|
119
|
-
return { ok: true,
|
|
117
|
+
return { ok: true, enabled: false, changed: false };
|
|
120
118
|
}
|
|
121
119
|
void audit_log_fire_and_forget(ctx, {
|
|
122
120
|
event_type: 'permit_revoke',
|
|
@@ -130,10 +128,7 @@ export const create_self_service_role_actions = (deps, options) => {
|
|
|
130
128
|
self_service: true,
|
|
131
129
|
},
|
|
132
130
|
}, deps);
|
|
133
|
-
return { ok: true,
|
|
131
|
+
return { ok: true, enabled: false, changed: true };
|
|
134
132
|
};
|
|
135
|
-
return [
|
|
136
|
-
rpc_action(self_service_role_grant_action_spec, grant_handler),
|
|
137
|
-
rpc_action(self_service_role_revoke_action_spec, revoke_handler),
|
|
138
|
-
];
|
|
133
|
+
return [rpc_action(self_service_role_set_action_spec, handler)];
|
|
139
134
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aggregate spec list mirroring `create_standard_rpc_actions` on the backend.
|
|
3
|
+
*
|
|
4
|
+
* `create_standard_rpc_actions` (in `./standard_rpc_actions.js`) bundles three
|
|
5
|
+
* action registries into one mounted RPC surface: admin + permit_offer +
|
|
6
|
+
* account. Frontends mounting that surface need the matching spec list to
|
|
7
|
+
* feed `create_rpc_client` so the typed Proxy knows about every standard
|
|
8
|
+
* method.
|
|
9
|
+
*
|
|
10
|
+
* Without this aggregate, every consumer spreads three (or four with
|
|
11
|
+
* self-service roles) `all_*_action_specs` imports at the typed-client
|
|
12
|
+
* site, the codegen-sources table, and any other registry construction —
|
|
13
|
+
* a triplicate that drifts silently on either side.
|
|
14
|
+
*
|
|
15
|
+
* Self-service role specs are **not** included — they're opt-in (require
|
|
16
|
+
* `eligible_roles` configuration) and not bundled into
|
|
17
|
+
* `create_standard_rpc_actions`. Consumers that mount them spread
|
|
18
|
+
* `all_self_service_role_action_specs` separately.
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
import type { RequestResponseActionSpec } from '../actions/action_spec.js';
|
|
23
|
+
/**
|
|
24
|
+
* Combined spec registry for the standard RPC surface (admin +
|
|
25
|
+
* permit_offer + account). Symmetric with `create_standard_rpc_actions`.
|
|
26
|
+
*
|
|
27
|
+
* Spec count is the sum of the three sub-registries. Adding a method to
|
|
28
|
+
* any sub-registry surfaces here automatically.
|
|
29
|
+
*/
|
|
30
|
+
export declare const all_standard_action_specs: ReadonlyArray<RequestResponseActionSpec>;
|
|
31
|
+
//# sourceMappingURL=standard_action_specs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/standard_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AAKzE;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAAa,CAAC,yBAAyB,CAI9E,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aggregate spec list mirroring `create_standard_rpc_actions` on the backend.
|
|
3
|
+
*
|
|
4
|
+
* `create_standard_rpc_actions` (in `./standard_rpc_actions.js`) bundles three
|
|
5
|
+
* action registries into one mounted RPC surface: admin + permit_offer +
|
|
6
|
+
* account. Frontends mounting that surface need the matching spec list to
|
|
7
|
+
* feed `create_rpc_client` so the typed Proxy knows about every standard
|
|
8
|
+
* method.
|
|
9
|
+
*
|
|
10
|
+
* Without this aggregate, every consumer spreads three (or four with
|
|
11
|
+
* self-service roles) `all_*_action_specs` imports at the typed-client
|
|
12
|
+
* site, the codegen-sources table, and any other registry construction —
|
|
13
|
+
* a triplicate that drifts silently on either side.
|
|
14
|
+
*
|
|
15
|
+
* Self-service role specs are **not** included — they're opt-in (require
|
|
16
|
+
* `eligible_roles` configuration) and not bundled into
|
|
17
|
+
* `create_standard_rpc_actions`. Consumers that mount them spread
|
|
18
|
+
* `all_self_service_role_action_specs` separately.
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
import { all_admin_action_specs } from './admin_action_specs.js';
|
|
23
|
+
import { all_permit_offer_action_specs } from './permit_offer_action_specs.js';
|
|
24
|
+
import { all_account_action_specs } from './account_action_specs.js';
|
|
25
|
+
/**
|
|
26
|
+
* Combined spec registry for the standard RPC surface (admin +
|
|
27
|
+
* permit_offer + account). Symmetric with `create_standard_rpc_actions`.
|
|
28
|
+
*
|
|
29
|
+
* Spec count is the sum of the three sub-registries. Adding a method to
|
|
30
|
+
* any sub-registry surfaces here automatically.
|
|
31
|
+
*/
|
|
32
|
+
export const all_standard_action_specs = [
|
|
33
|
+
...all_admin_action_specs,
|
|
34
|
+
...all_permit_offer_action_specs,
|
|
35
|
+
...all_account_action_specs,
|
|
36
|
+
];
|
|
@@ -267,7 +267,7 @@ export declare const keeper_identity: () => WsConnectIdentity;
|
|
|
267
267
|
* await client.wait_for(is_notification('tx_run_created'));
|
|
268
268
|
* ```
|
|
269
269
|
*/
|
|
270
|
-
export declare const build_broadcast_api: <TApi>(options: {
|
|
270
|
+
export declare const build_broadcast_api: <TApi extends object>(options: {
|
|
271
271
|
harness: WsTestHarness;
|
|
272
272
|
specs: ReadonlyArray<ActionSpecUnion>;
|
|
273
273
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HANGED
|
@@ -267,17 +267,16 @@ destructive actions.
|
|
|
267
267
|
(`get`, `update`). Fields: `settings`, `updating`. Single mutation
|
|
268
268
|
`update_open_signup(boolean)`.
|
|
269
269
|
- `admin_rpc_adapters.ts` (plain `.ts`, no reactive state) — bundled
|
|
270
|
-
wiring for the four admin RPC contexts. `create_admin_rpc_adapters(
|
|
271
|
-
takes
|
|
272
|
-
|
|
273
|
-
audit_log, app_settings}` adapter
|
|
274
|
-
calls `set` on all
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
`admin_rpc_adapters.test.ts` fixtures.
|
|
270
|
+
wiring for the four admin RPC contexts. `create_admin_rpc_adapters(api)`
|
|
271
|
+
takes the typed throwing Proxy from `create_frontend_rpc_client` (or
|
|
272
|
+
any object satisfying the `AdminRpcApi` interface) and returns
|
|
273
|
+
`{admin_accounts, admin_invites, audit_log, app_settings}` adapter
|
|
274
|
+
objects. `provide_admin_rpc_contexts(adapters)` calls `set` on all
|
|
275
|
+
four contexts in one shot. One line at the admin shell layout:
|
|
276
|
+
`provide_admin_rpc_contexts(create_admin_rpc_adapters(api))`.
|
|
277
|
+
Method-name mapping is in the module TSDoc (`grant_permit` →
|
|
278
|
+
`permit_offer_create`, `retract_offer` → `permit_offer_retract`, etc.)
|
|
279
|
+
and the `admin_rpc_adapters.test.ts` fixtures.
|
|
281
280
|
|
|
282
281
|
## RPC adapter contexts
|
|
283
282
|
|
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { SvelteSet } from 'svelte/reactivity';
|
|
7
|
+
import type { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
7
8
|
import { Loadable } from './loadable.svelte.js';
|
|
8
9
|
import type { AdminAccountEntryJson } from '../auth/account_schema.js';
|
|
9
|
-
import type {
|
|
10
|
+
import type { RoleName } from '../auth/role_schema.js';
|
|
10
11
|
import type { PermitOfferJson } from '../auth/permit_offer_schema.js';
|
|
12
|
+
import type { AdminAccountListOutput, AdminSessionListOutput, AdminSessionRevokeAllInput, AdminSessionRevokeAllOutput, AdminTokenRevokeAllInput, AdminTokenRevokeAllOutput } from '../auth/admin_action_specs.js';
|
|
13
|
+
import type { PermitOfferCreateInput, PermitOfferCreateOutput, PermitOfferOkOutput, PermitRevokeInput, PermitRevokeOutput } from '../auth/permit_offer_action_specs.js';
|
|
11
14
|
/**
|
|
12
15
|
* Narrow RPC surface consumed by `AdminAccountsState`. Consumers adapt their
|
|
13
16
|
* typed RPC client (e.g. a `create_rpc_client` Proxy) to this shape — the
|
|
@@ -21,44 +24,20 @@ import type { PermitOfferJson } from '../auth/permit_offer_schema.js';
|
|
|
21
24
|
* `admin_session_revoke_all` and `admin_token_revoke_all`. Without the
|
|
22
25
|
* adapter the state class cannot fetch, grant, revoke, retract, or
|
|
23
26
|
* revoke-all sessions/tokens.
|
|
27
|
+
*
|
|
28
|
+
* Method signatures track the underlying action specs — `Uuid`-branded ids
|
|
29
|
+
* propagate from the wire through the state class to the components. The
|
|
30
|
+
* adapter built by `create_admin_rpc_adapters` therefore needs zero casts
|
|
31
|
+
* to bridge to the typed throwing Proxy.
|
|
24
32
|
*/
|
|
25
33
|
export interface AdminAccountsRpc {
|
|
26
|
-
list_accounts: () => Promise<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
grant_permit: (params: {
|
|
34
|
-
to_account_id: string;
|
|
35
|
-
role: string;
|
|
36
|
-
}) => Promise<{
|
|
37
|
-
offer: PermitOfferJson;
|
|
38
|
-
}>;
|
|
39
|
-
revoke_permit: (params: {
|
|
40
|
-
actor_id: string;
|
|
41
|
-
permit_id: string;
|
|
42
|
-
reason?: string | null;
|
|
43
|
-
}) => Promise<{
|
|
44
|
-
ok: true;
|
|
45
|
-
revoked: true;
|
|
46
|
-
}>;
|
|
47
|
-
retract_offer: (offer_id: string) => Promise<{
|
|
48
|
-
ok: true;
|
|
49
|
-
}>;
|
|
50
|
-
session_revoke_all: (params: {
|
|
51
|
-
account_id: string;
|
|
52
|
-
}) => Promise<{
|
|
53
|
-
ok: true;
|
|
54
|
-
count: number;
|
|
55
|
-
}>;
|
|
56
|
-
token_revoke_all: (params: {
|
|
57
|
-
account_id: string;
|
|
58
|
-
}) => Promise<{
|
|
59
|
-
ok: true;
|
|
60
|
-
count: number;
|
|
61
|
-
}>;
|
|
34
|
+
list_accounts: () => Promise<AdminAccountListOutput>;
|
|
35
|
+
list_sessions: () => Promise<AdminSessionListOutput>;
|
|
36
|
+
grant_permit: (params: PermitOfferCreateInput) => Promise<PermitOfferCreateOutput>;
|
|
37
|
+
revoke_permit: (params: PermitRevokeInput) => Promise<PermitRevokeOutput>;
|
|
38
|
+
retract_offer: (offer_id: Uuid) => Promise<PermitOfferOkOutput>;
|
|
39
|
+
session_revoke_all: (params: AdminSessionRevokeAllInput) => Promise<AdminSessionRevokeAllOutput>;
|
|
40
|
+
token_revoke_all: (params: AdminTokenRevokeAllInput) => Promise<AdminTokenRevokeAllOutput>;
|
|
62
41
|
}
|
|
63
42
|
/**
|
|
64
43
|
* Svelte context carrying the reactive `AdminAccountsRpc` accessor. The
|
|
@@ -86,7 +65,7 @@ export interface AdminAccountsStateOptions {
|
|
|
86
65
|
export declare class AdminAccountsState extends Loadable {
|
|
87
66
|
#private;
|
|
88
67
|
accounts: Array<AdminAccountEntryJson>;
|
|
89
|
-
grantable_roles: Array<
|
|
68
|
+
grantable_roles: Array<RoleName>;
|
|
90
69
|
readonly granting_keys: SvelteSet<string>;
|
|
91
70
|
readonly revoking_ids: SvelteSet<string>;
|
|
92
71
|
readonly retracting_ids: SvelteSet<string>;
|
|
@@ -111,7 +90,7 @@ export declare class AdminAccountsState extends Loadable {
|
|
|
111
90
|
* No-op when the rpc adapter is absent; `error` is set to a descriptive
|
|
112
91
|
* message so the UI surfaces the misconfiguration.
|
|
113
92
|
*/
|
|
114
|
-
grant_permit(account_id:
|
|
93
|
+
grant_permit(account_id: Uuid, role: RoleName): Promise<PermitOfferJson | undefined>;
|
|
115
94
|
/**
|
|
116
95
|
* Revoke an active permit via the `permit_revoke` RPC.
|
|
117
96
|
*
|
|
@@ -121,7 +100,7 @@ export declare class AdminAccountsState extends Loadable {
|
|
|
121
100
|
* The optional `reason` is stamped on `permit.revoked_reason` and
|
|
122
101
|
* surfaced on the revokee's WS notification.
|
|
123
102
|
*/
|
|
124
|
-
revoke_permit(actor_id:
|
|
103
|
+
revoke_permit(actor_id: Uuid, permit_id: Uuid, reason?: string | null): Promise<void>;
|
|
125
104
|
/**
|
|
126
105
|
* Retract a pending offer the admin issued via the `permit_offer_retract`
|
|
127
106
|
* RPC. The action handles auth, audit, and the
|
|
@@ -130,6 +109,6 @@ export declare class AdminAccountsState extends Loadable {
|
|
|
130
109
|
* After success, refetches the listing so `pending_offers` drops the
|
|
131
110
|
* row and the "+ {role}" button un-hides.
|
|
132
111
|
*/
|
|
133
|
-
retract_offer(offer_id:
|
|
112
|
+
retract_offer(offer_id: Uuid): Promise<void>;
|
|
134
113
|
}
|
|
135
114
|
//# 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;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;
|
|
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;;;;GAIG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AA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AM,gBAAgB,GAAG,IAAI,CAAC;CACxC;AAED,qBAAa,kBAAmB,SAAQ,QAAQ;;IAG/C,QAAQ,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAkB;IACxD,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAkB;IAClD,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC,MAAM,CAAC,CAAmB;IAC5D,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,CAAmB;IAC3D,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAC,MAAM,CAAC,CAAmB;IAE7D,QAAQ,CAAC,aAAa,SAAkC;gBAE5C,OAAO,CAAC,EAAE,yBAAyB;IAK/C;;;OAGG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAa5B;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAqB1F;;;;;;;;OAQG;IACG,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB3F;;;;;;;OAOG;IACG,aAAa,CAAC,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBlD"}
|
|
@@ -8,30 +8,21 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
import { SvelteSet } from 'svelte/reactivity';
|
|
11
|
+
import type { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
11
12
|
import { Loadable } from './loadable.svelte.js';
|
|
12
|
-
import type {
|
|
13
|
+
import type { InviteWithUsernamesJson } from '../auth/invite_schema.js';
|
|
14
|
+
import type { InviteCreateInput, InviteCreateOutput, InviteDeleteInput, InviteDeleteOutput, InviteListOutput } from '../auth/admin_action_specs.js';
|
|
13
15
|
/**
|
|
14
16
|
* Narrow RPC surface consumed by `AdminInvitesState`. Consumers adapt their
|
|
15
17
|
* typed RPC client to this shape. `error.data.reason` on thrown errors
|
|
16
18
|
* carries the `ERROR_INVITE_*` constant — handled by the caller when
|
|
17
|
-
* user-friendly messages are needed.
|
|
19
|
+
* user-friendly messages are needed. Method signatures track the wire
|
|
20
|
+
* spec types directly so the adapter needs no casts.
|
|
18
21
|
*/
|
|
19
22
|
export interface AdminInvitesRpc {
|
|
20
|
-
list: () => Promise<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
create: (params: {
|
|
24
|
-
email?: string | null;
|
|
25
|
-
username?: string | null;
|
|
26
|
-
}) => Promise<{
|
|
27
|
-
ok: true;
|
|
28
|
-
invite: InviteJson;
|
|
29
|
-
}>;
|
|
30
|
-
delete: (params: {
|
|
31
|
-
invite_id: string;
|
|
32
|
-
}) => Promise<{
|
|
33
|
-
ok: true;
|
|
34
|
-
}>;
|
|
23
|
+
list: () => Promise<InviteListOutput>;
|
|
24
|
+
create: (params: InviteCreateInput) => Promise<InviteCreateOutput>;
|
|
25
|
+
delete: (params: InviteDeleteInput) => Promise<InviteDeleteOutput>;
|
|
35
26
|
}
|
|
36
27
|
/**
|
|
37
28
|
* Svelte context carrying the reactive `AdminInvitesRpc` accessor. Mirrors
|
|
@@ -60,6 +51,6 @@ export declare class AdminInvitesState extends Loadable {
|
|
|
60
51
|
get has_rpc(): boolean;
|
|
61
52
|
fetch(): Promise<void>;
|
|
62
53
|
create_invite(email?: string, username?: string): Promise<boolean>;
|
|
63
|
-
delete_invite(id:
|
|
54
|
+
delete_invite(id: Uuid): Promise<void>;
|
|
64
55
|
}
|
|
65
56
|
//# sourceMappingURL=admin_invites_state.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_invites_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_invites_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"admin_invites_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_invites_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,MAAM,+BAA+B,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACnE,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACnE;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB;qBAAwB,eAAe,GAAG,IAAI;yBAAtB,eAAe,GAAG,IAAI,wBAAtB,eAAe,GAAG,IAAI;CAEnF,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;CACvC;AAED,qBAAa,iBAAkB,SAAQ,QAAQ;;IAG9C,OAAO,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAkB;IACzD,QAAQ,UAAqB;IAC7B,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,CAAmB;IAE3D,QAAQ,CAAC,YAAY,SAAiC;IACtD,QAAQ,CAAC,eAAe,SAA8D;gBAE1E,OAAO,CAAC,EAAE,wBAAwB;IAK9C,6DAA6D;IAC7D,IAAI,OAAO,IAAI,OAAO,CAErB;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAYtB,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAoBlE,aAAa,CAAC,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAgB5C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Admin RPC adapter helpers for consumer UIs.
|
|
3
3
|
*
|
|
4
|
-
* Bridges a typed
|
|
4
|
+
* Bridges a typed throwing RPC client to the four narrow admin RPC
|
|
5
5
|
* interfaces the state classes consume — `AdminAccountsRpc`,
|
|
6
6
|
* `AdminInvitesRpc`, `AuditLogRpc`, `AppSettingsRpc`. Two calls at the
|
|
7
7
|
* admin shell layout wire everything.
|
|
@@ -16,44 +16,57 @@
|
|
|
16
16
|
* and backend factory names diverge by design.
|
|
17
17
|
*
|
|
18
18
|
* ```ts
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* provide_admin_rpc_contexts(create_admin_rpc_adapters(rpc_call));
|
|
19
|
+
* // `api` is the typed throwing Proxy from `create_frontend_rpc_client`.
|
|
20
|
+
* provide_admin_rpc_contexts(create_admin_rpc_adapters(api));
|
|
22
21
|
* ```
|
|
23
22
|
*
|
|
24
|
-
*
|
|
25
|
-
* the
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `AdminRpcCall` directly instead.
|
|
23
|
+
* The throwing Proxy spreads the JSON-RPC `{code, message, data?}` onto
|
|
24
|
+
* the thrown `Error` so form components (e.g. `PermitOfferForm.svelte`)
|
|
25
|
+
* can match on `error.data?.reason` via `ERROR_OFFER_*` constants —
|
|
26
|
+
* optional chaining is required because JSON-RPC `data` is spec-level
|
|
27
|
+
* optional. Consumers that need a custom unwrap strategy can construct
|
|
28
|
+
* their own object satisfying `AdminRpcApi` and pass it directly.
|
|
31
29
|
*
|
|
32
30
|
* No `.svelte.ts` suffix — this module holds no reactive state, only
|
|
33
31
|
* method-name mappings.
|
|
34
32
|
*
|
|
35
33
|
* @module
|
|
36
34
|
*/
|
|
37
|
-
import type {
|
|
35
|
+
import type { AdminAccountListOutput, AdminSessionListOutput, AdminSessionRevokeAllInput, AdminSessionRevokeAllOutput, AdminTokenRevokeAllInput, AdminTokenRevokeAllOutput, AuditLogListInput, AuditLogListOutput, AuditLogPermitHistoryInput, AuditLogPermitHistoryOutput, InviteCreateInput, InviteCreateOutput, InviteDeleteInput, InviteDeleteOutput, InviteListOutput, AppSettingsGetOutput, AppSettingsUpdateInput, AppSettingsUpdateOutput } from '../auth/admin_action_specs.js';
|
|
36
|
+
import type { PermitOfferCreateInput, PermitOfferCreateOutput, PermitOfferRetractInput, PermitOfferOkOutput, PermitRevokeInput, PermitRevokeOutput } from '../auth/permit_offer_action_specs.js';
|
|
38
37
|
import { type AdminAccountsRpc } from './admin_accounts_state.svelte.js';
|
|
39
38
|
import { type AdminInvitesRpc } from './admin_invites_state.svelte.js';
|
|
40
39
|
import { type AuditLogRpc } from './audit_log_state.svelte.js';
|
|
41
40
|
import { type AppSettingsRpc } from './app_settings_state.svelte.js';
|
|
42
41
|
import { type FormatScope } from './format_scope.js';
|
|
43
42
|
/**
|
|
44
|
-
*
|
|
43
|
+
* The wire-method surface this module needs from the typed throwing RPC
|
|
44
|
+
* client. Every method returns the unwrapped value or throws an `Error`
|
|
45
|
+
* carrying the JSON-RPC `{code, message, data?}` shape — i.e. the
|
|
46
|
+
* `ThrowingApi<...>` view of the corresponding action specs.
|
|
45
47
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* The generic is load-bearing: contextual typing lets the narrow
|
|
52
|
-
* `Admin*Rpc` return types flow into `TOutput` so adapter methods typecheck
|
|
53
|
-
* without explicit casts.
|
|
48
|
+
* Consumers pass the typed throwing Proxy returned by
|
|
49
|
+
* `create_frontend_rpc_client` directly. Structural typing means any
|
|
50
|
+
* superset (e.g. the consumer's full `ThrowingApi<ActionsApi>`) is
|
|
51
|
+
* assignable as long as these methods are present at these signatures.
|
|
54
52
|
*/
|
|
55
|
-
export
|
|
56
|
-
|
|
53
|
+
export interface AdminRpcApi {
|
|
54
|
+
admin_account_list: () => Promise<AdminAccountListOutput>;
|
|
55
|
+
admin_session_list: () => Promise<AdminSessionListOutput>;
|
|
56
|
+
admin_session_revoke_all: (input: AdminSessionRevokeAllInput) => Promise<AdminSessionRevokeAllOutput>;
|
|
57
|
+
admin_token_revoke_all: (input: AdminTokenRevokeAllInput) => Promise<AdminTokenRevokeAllOutput>;
|
|
58
|
+
audit_log_list: (input?: AuditLogListInput) => Promise<AuditLogListOutput>;
|
|
59
|
+
audit_log_permit_history: (input?: AuditLogPermitHistoryInput) => Promise<AuditLogPermitHistoryOutput>;
|
|
60
|
+
invite_list: () => Promise<InviteListOutput>;
|
|
61
|
+
invite_create: (input: InviteCreateInput) => Promise<InviteCreateOutput>;
|
|
62
|
+
invite_delete: (input: InviteDeleteInput) => Promise<InviteDeleteOutput>;
|
|
63
|
+
app_settings_get: () => Promise<AppSettingsGetOutput>;
|
|
64
|
+
app_settings_update: (input: AppSettingsUpdateInput) => Promise<AppSettingsUpdateOutput>;
|
|
65
|
+
permit_offer_create: (input: PermitOfferCreateInput) => Promise<PermitOfferCreateOutput>;
|
|
66
|
+
permit_offer_retract: (input: PermitOfferRetractInput) => Promise<PermitOfferOkOutput>;
|
|
67
|
+
permit_revoke: (input: PermitRevokeInput) => Promise<PermitRevokeOutput>;
|
|
68
|
+
}
|
|
69
|
+
/** The four admin RPC adapters assembled from a shared `api`. */
|
|
57
70
|
export interface AdminRpcAdapters {
|
|
58
71
|
admin_accounts: AdminAccountsRpc;
|
|
59
72
|
admin_invites: AdminInvitesRpc;
|
|
@@ -61,7 +74,7 @@ export interface AdminRpcAdapters {
|
|
|
61
74
|
app_settings: AppSettingsRpc;
|
|
62
75
|
}
|
|
63
76
|
/**
|
|
64
|
-
* Build the four admin RPC adapters from a
|
|
77
|
+
* Build the four admin RPC adapters from a typed throwing RPC client.
|
|
65
78
|
*
|
|
66
79
|
* Method-name mapping:
|
|
67
80
|
*
|
|
@@ -82,12 +95,11 @@ export interface AdminRpcAdapters {
|
|
|
82
95
|
* | `app_settings.get` | `app_settings_get` |
|
|
83
96
|
* | `app_settings.update` | `app_settings_update` |
|
|
84
97
|
*
|
|
85
|
-
* All four adapter factories call through the same `
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* admin surfaces they mount.
|
|
98
|
+
* All four adapter factories call through the same `api` — consumers
|
|
99
|
+
* pass the typed throwing Proxy from `create_frontend_rpc_client` once,
|
|
100
|
+
* regardless of how many admin surfaces they mount.
|
|
89
101
|
*/
|
|
90
|
-
export declare const create_admin_rpc_adapters: (
|
|
102
|
+
export declare const create_admin_rpc_adapters: (api: AdminRpcApi) => AdminRpcAdapters;
|
|
91
103
|
/** Optional knobs alongside the adapters when wiring admin contexts. */
|
|
92
104
|
export interface ProvideAdminRpcContextsOptions {
|
|
93
105
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_rpc_adapters.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_rpc_adapters.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"admin_rpc_adapters.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_rpc_adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,2B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