@fuzdev/fuz_app 0.44.0 → 0.46.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 +65 -39
- 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/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +14 -4
- 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 +95 -23
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +48 -23
- package/dist/actions/rpc_client.d.ts +56 -86
- package/dist/actions/rpc_client.d.ts.map +1 -1
- package/dist/actions/rpc_client.js +51 -106
- 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 +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;AAC9C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACX,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,gBAAgB;IAChC,aAAa,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrD,aAAa,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACrD,YAAY,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACnF,aAAa,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC1E,aAAa,EAAE,CAAC,QAAQ,EAAE,IAAI,KAAK,OAAO,CAAC,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;;;;;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,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACX,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAA6B,KAAK,gBAAgB,EAAC,MAAM,kCAAkC,CAAC;AACnG,OAAO,EAA4B,KAAK,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAwB,KAAK,WAAW,EAAC,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAA2B,KAAK,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EAAuB,KAAK,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAEzE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAW;IAC3B,kBAAkB,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC1D,kBAAkB,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,C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W,KAAG,gBAuB3D,CAAC;AAEH,wEAAwE;AACxE,MAAM,WAAW,8BAA8B;IAC9C;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,0BAA0B,GACtC,UAAU,gBAAgB,EAC1B,UAAU,8BAA8B,KACtC,IASF,CAAC"}
|
|
@@ -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,18 +16,16 @@
|
|
|
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.
|
|
@@ -40,7 +38,7 @@ import { audit_log_rpc_context } from './audit_log_state.svelte.js';
|
|
|
40
38
|
import { app_settings_rpc_context } from './app_settings_state.svelte.js';
|
|
41
39
|
import { format_scope_context } from './format_scope.js';
|
|
42
40
|
/**
|
|
43
|
-
* Build the four admin RPC adapters from a
|
|
41
|
+
* Build the four admin RPC adapters from a typed throwing RPC client.
|
|
44
42
|
*
|
|
45
43
|
* Method-name mapping:
|
|
46
44
|
*
|
|
@@ -61,33 +59,32 @@ import { format_scope_context } from './format_scope.js';
|
|
|
61
59
|
* | `app_settings.get` | `app_settings_get` |
|
|
62
60
|
* | `app_settings.update` | `app_settings_update` |
|
|
63
61
|
*
|
|
64
|
-
* All four adapter factories call through the same `
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* admin surfaces they mount.
|
|
62
|
+
* All four adapter factories call through the same `api` — consumers
|
|
63
|
+
* pass the typed throwing Proxy from `create_frontend_rpc_client` once,
|
|
64
|
+
* regardless of how many admin surfaces they mount.
|
|
68
65
|
*/
|
|
69
|
-
export const create_admin_rpc_adapters = (
|
|
66
|
+
export const create_admin_rpc_adapters = (api) => ({
|
|
70
67
|
admin_accounts: {
|
|
71
|
-
list_accounts: () =>
|
|
72
|
-
list_sessions: () =>
|
|
73
|
-
grant_permit: (params) =>
|
|
74
|
-
revoke_permit: (params) =>
|
|
75
|
-
retract_offer: (offer_id) =>
|
|
76
|
-
session_revoke_all: (params) =>
|
|
77
|
-
token_revoke_all: (params) =>
|
|
68
|
+
list_accounts: () => api.admin_account_list(),
|
|
69
|
+
list_sessions: () => api.admin_session_list(),
|
|
70
|
+
grant_permit: (params) => api.permit_offer_create(params),
|
|
71
|
+
revoke_permit: (params) => api.permit_revoke(params),
|
|
72
|
+
retract_offer: (offer_id) => api.permit_offer_retract({ offer_id }),
|
|
73
|
+
session_revoke_all: (params) => api.admin_session_revoke_all(params),
|
|
74
|
+
token_revoke_all: (params) => api.admin_token_revoke_all(params),
|
|
78
75
|
},
|
|
79
76
|
admin_invites: {
|
|
80
|
-
list: () =>
|
|
81
|
-
create: (params) =>
|
|
82
|
-
delete: (params) =>
|
|
77
|
+
list: () => api.invite_list(),
|
|
78
|
+
create: (params) => api.invite_create(params),
|
|
79
|
+
delete: (params) => api.invite_delete(params),
|
|
83
80
|
},
|
|
84
81
|
audit_log: {
|
|
85
|
-
list: (options) =>
|
|
86
|
-
permit_history: (params) =>
|
|
82
|
+
list: (options) => api.audit_log_list(options ?? {}),
|
|
83
|
+
permit_history: (params) => api.audit_log_permit_history(params ?? {}),
|
|
87
84
|
},
|
|
88
85
|
app_settings: {
|
|
89
|
-
get: () =>
|
|
90
|
-
update: (params) =>
|
|
86
|
+
get: () => api.app_settings_get(),
|
|
87
|
+
update: (params) => api.app_settings_update(params),
|
|
91
88
|
},
|
|
92
89
|
});
|
|
93
90
|
/**
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
11
|
import { SvelteSet } from 'svelte/reactivity';
|
|
12
|
+
import type { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
12
13
|
import { Loadable } from './loadable.svelte.js';
|
|
13
14
|
import type { AdminAccountsRpc } from './admin_accounts_state.svelte.js';
|
|
14
15
|
import type { AdminSessionJson } from '../auth/audit_log_schema.js';
|
|
@@ -38,7 +39,7 @@ export declare class AdminSessionsState extends Loadable {
|
|
|
38
39
|
/** True when an RPC adapter is wired. `fetch` and the revoke controls no-op without it. */
|
|
39
40
|
get has_rpc(): boolean;
|
|
40
41
|
fetch(): Promise<void>;
|
|
41
|
-
revoke_all_for_account(account_id:
|
|
42
|
-
revoke_all_tokens_for_account(account_id:
|
|
42
|
+
revoke_all_for_account(account_id: Uuid): Promise<void>;
|
|
43
|
+
revoke_all_tokens_for_account(account_id: Uuid): Promise<void>;
|
|
43
44
|
}
|
|
44
45
|
//# sourceMappingURL=admin_sessions_state.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_sessions_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_sessions_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"admin_sessions_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_sessions_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,gBAAgB,GAAG,IAAI,CAAC;CACxC;AAED,qBAAa,kBAAmB,SAAQ,QAAQ;;IAG/C,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAkB;IACnD,QAAQ,CAAC,oBAAoB,EAAE,SAAS,CAAC,MAAM,CAAC,CAAmB;IACnE,QAAQ,CAAC,0BAA0B,EAAE,SAAS,CAAC,MAAM,CAAC,CAAmB;IAEzE,QAAQ,CAAC,YAAY,SAAkC;gBAE3C,OAAO,CAAC,EAAE,yBAAyB;IAK/C,2FAA2F;IAC3F,IAAI,OAAO,IAAI,OAAO,CAErB;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAYtB,sBAAsB,CAAC,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBvD,6BAA6B,CAAC,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBpE"}
|
|
@@ -9,20 +9,15 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Loadable } from './loadable.svelte.js';
|
|
11
11
|
import type { AppSettingsWithUsernameJson } from '../auth/app_settings_schema.js';
|
|
12
|
+
import type { AppSettingsGetOutput, AppSettingsUpdateInput, AppSettingsUpdateOutput } from '../auth/admin_action_specs.js';
|
|
12
13
|
/**
|
|
13
14
|
* Narrow RPC surface consumed by `AppSettingsState`. Consumers adapt their
|
|
14
|
-
* typed RPC client to this shape.
|
|
15
|
+
* typed RPC client to this shape. Method signatures track the wire spec
|
|
16
|
+
* inputs/outputs directly so the adapter needs no casts.
|
|
15
17
|
*/
|
|
16
18
|
export interface AppSettingsRpc {
|
|
17
|
-
get: () => Promise<
|
|
18
|
-
|
|
19
|
-
}>;
|
|
20
|
-
update: (params: {
|
|
21
|
-
open_signup: boolean;
|
|
22
|
-
}) => Promise<{
|
|
23
|
-
ok: true;
|
|
24
|
-
settings: AppSettingsWithUsernameJson;
|
|
25
|
-
}>;
|
|
19
|
+
get: () => Promise<AppSettingsGetOutput>;
|
|
20
|
+
update: (params: AppSettingsUpdateInput) => Promise<AppSettingsUpdateOutput>;
|
|
26
21
|
}
|
|
27
22
|
/**
|
|
28
23
|
* Svelte context carrying the reactive `AppSettingsRpc` accessor. Mirrors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_settings_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/app_settings_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"app_settings_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/app_settings_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EACX,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,MAAM,+BAA+B,CAAC;AAEvC;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACzC,MAAM,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC7E;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;qBAAwB,cAAc,GAAG,IAAI;yBAArB,cAAc,GAAG,IAAI,wBAArB,cAAc,GAAG,IAAI;CAEjF,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,cAAc,GAAG,IAAI,CAAC;CACtC;AAED,qBAAa,gBAAiB,SAAQ,QAAQ;;IAG7C,QAAQ,EAAE,2BAA2B,GAAG,IAAI,CAAoB;IAChE,QAAQ,UAAqB;gBAEjB,OAAO,CAAC,EAAE,uBAAuB;IAK7C,6DAA6D;IAC7D,IAAI,OAAO,IAAI,OAAO,CAErB;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAYtB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBvD"}
|
|
@@ -10,28 +10,16 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { Loadable } from './loadable.svelte.js';
|
|
12
12
|
import type { AuditLogEventWithUsernamesJson, PermitHistoryEventJson } from '../auth/audit_log_schema.js';
|
|
13
|
-
|
|
14
|
-
export interface AuditLogFetchOptions {
|
|
15
|
-
event_type?: string;
|
|
16
|
-
account_id?: string;
|
|
17
|
-
limit?: number;
|
|
18
|
-
offset?: number;
|
|
19
|
-
since_seq?: number;
|
|
20
|
-
}
|
|
13
|
+
import type { AuditLogListInput, AuditLogListOutput, AuditLogPermitHistoryInput, AuditLogPermitHistoryOutput } from '../auth/admin_action_specs.js';
|
|
21
14
|
/**
|
|
22
15
|
* Narrow RPC surface consumed by `AuditLogState`. Consumers adapt their typed
|
|
23
16
|
* RPC client to this shape. Mirrors `AdminAccountsRpc` / `AdminInvitesRpc`.
|
|
17
|
+
* Method signatures track the wire spec inputs/outputs directly so the
|
|
18
|
+
* adapter needs no casts.
|
|
24
19
|
*/
|
|
25
20
|
export interface AuditLogRpc {
|
|
26
|
-
list: (
|
|
27
|
-
|
|
28
|
-
}>;
|
|
29
|
-
permit_history: (params?: {
|
|
30
|
-
limit?: number;
|
|
31
|
-
offset?: number;
|
|
32
|
-
}) => Promise<{
|
|
33
|
-
events: Array<PermitHistoryEventJson>;
|
|
34
|
-
}>;
|
|
21
|
+
list: (input?: AuditLogListInput) => Promise<AuditLogListOutput>;
|
|
22
|
+
permit_history: (input?: AuditLogPermitHistoryInput) => Promise<AuditLogPermitHistoryOutput>;
|
|
35
23
|
}
|
|
36
24
|
/**
|
|
37
25
|
* Svelte context carrying the reactive `AuditLogRpc` accessor. Mirrors
|
|
@@ -60,7 +48,7 @@ export declare class AuditLogState extends Loadable {
|
|
|
60
48
|
constructor(options?: AuditLogStateOptions);
|
|
61
49
|
/** True when an RPC adapter is wired. `fetch`/`fetch_permit_history` no-op without it. */
|
|
62
50
|
get has_rpc(): boolean;
|
|
63
|
-
fetch(options?:
|
|
51
|
+
fetch(options?: AuditLogListInput): Promise<void>;
|
|
64
52
|
fetch_permit_history(limit?: number, offset?: number): Promise<void>;
|
|
65
53
|
/**
|
|
66
54
|
* Connect to the SSE stream for realtime audit events.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_log_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/audit_log_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAEX,8BAA8B,EAC9B,sBAAsB,EACtB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"audit_log_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/audit_log_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAEX,8BAA8B,EAC9B,sBAAsB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,2BAA2B,EAC3B,MAAM,+BAA+B,CAAC;AAGvC;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjE,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE,0BAA0B,KAAK,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC7F;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB;qBAAwB,WAAW,GAAG,IAAI;yBAAlB,WAAW,GAAG,IAAI,wBAAlB,WAAW,GAAG,IAAI;CAAmB,CAAC;AAEhG,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACnC,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAc,SAAQ,QAAQ;;IAG1C,MAAM,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAkB;IAC/D,qBAAqB,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAkB;IAEtE,QAAQ,CAAC,KAAK,SAAgC;IA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