@fuzdev/fuz_app 0.44.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 +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/broadcast_api.d.ts +1 -1
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.d.ts +73 -19
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +43 -18
- package/dist/actions/rpc_client.d.ts +44 -82
- 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,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,8B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