@shivaedev/admin 0.8.0 → 0.8.1
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/README.md +42 -30
- package/dist/client/UsersTable.js +3 -3
- package/dist/jobs/page.d.ts +30 -30
- package/dist/jobs/retryPage.d.ts +5 -5
- package/package.json +6 -6
- package/src/client/UsersTable.tsx +3 -3
package/README.md
CHANGED
|
@@ -4,21 +4,29 @@ Admin tooling starts with an explicit list of pages and the operations each page
|
|
|
4
4
|
|
|
5
5
|
## Declare the tools operators can use
|
|
6
6
|
|
|
7
|
+
Operators need one place to find the tools an application exposes, and an admin operation that forgot its permission check is a public operation. Here each admin page names its permission once, and every operation on the page, including its generated change subscription, requires it.
|
|
8
|
+
|
|
7
9
|
```ts
|
|
8
10
|
const Jobs = adminPage({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
id: "jobs",
|
|
12
|
+
permission: JobsPermission,
|
|
13
|
+
route: { path: "/admin/jobs", title: "Jobs" },
|
|
14
|
+
contract: contract("admin.jobs", { queries: [Failed] }),
|
|
13
15
|
});
|
|
14
16
|
const Admin = adminRegistry(Jobs);
|
|
15
17
|
```
|
|
16
18
|
|
|
17
19
|
The page exposes `admin.jobs.failed` and the generated `admin.jobs.$changes` subscription. Both require `JobsPermission`, which checks `ReadJobs` (`jobs.read`). A query-only contract has no command. The application grants this permission to its chosen roles.
|
|
18
20
|
|
|
19
|
-
##
|
|
21
|
+
## Using it
|
|
22
|
+
|
|
23
|
+
### How to think about it
|
|
24
|
+
|
|
25
|
+
An admin page is a native `@shivaedev/contract` contract plus a stable id, route metadata and one permission middleware. The page applies that middleware to every operation in its contract, so no admin operation exists without a permission check. The registry merges the pages into one native RPC group, and server registration pairs each page id with the handler Layer the application writes. Everything else, from the admin shell and its views to session policy and the RPC host, stays with the application.
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
### Declare pages and the registry
|
|
28
|
+
|
|
29
|
+
Declare each page's queries, commands and streams with `@shivaedev/contract`, then pass its native contract to `adminPage`. The stable id identifies the page at server registration; route metadata belongs to the application's view. Author RPC namespaces in the contract name, such as `admin.jobs`.
|
|
22
30
|
|
|
23
31
|
```ts
|
|
24
32
|
import { Schema } from "effect";
|
|
@@ -29,14 +37,14 @@ import { contract } from "@shivaedev/contract/contract.ts";
|
|
|
29
37
|
import { query } from "@shivaedev/contract/operation.ts";
|
|
30
38
|
|
|
31
39
|
const Failed = query("failed", {
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
reads: () => [],
|
|
41
|
+
success: Schema.Array(Schema.String),
|
|
34
42
|
});
|
|
35
43
|
const Jobs = adminPage({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
id: "jobs",
|
|
45
|
+
permission: JobsPermission,
|
|
46
|
+
route: { path: "/admin/jobs", title: "Jobs" },
|
|
47
|
+
contract: contract("admin.jobs", { queries: [Failed] }),
|
|
40
48
|
});
|
|
41
49
|
const Admin = adminRegistry(Jobs);
|
|
42
50
|
```
|
|
@@ -52,22 +60,18 @@ import { JobsPermission, ReadJobs } from "@shivaedev/admin/permissions.ts";
|
|
|
52
60
|
import { permissionLayer } from "@shivaedev/identity/server/permissions.ts";
|
|
53
61
|
|
|
54
62
|
const registration = registerAdmin(Admin, {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
jobs: Jobs.contract.application.toLayer({
|
|
64
|
+
"admin.jobs.failed": () => Effect.succeed(["mail-42"]),
|
|
65
|
+
}),
|
|
58
66
|
});
|
|
59
|
-
const handlers = registration.handlers.pipe(
|
|
60
|
-
Layer.provideMerge(permissionLayer(JobsPermission, sessions)),
|
|
61
|
-
);
|
|
67
|
+
const handlers = registration.handlers.pipe(Layer.provideMerge(permissionLayer(JobsPermission, sessions)));
|
|
62
68
|
```
|
|
63
69
|
|
|
64
70
|
Declare application roles with `@shivaedev/access`, grant the relevant domain permissions explicitly, and supply that role set through the session or auth configuration of `@shivaedev/identity`.
|
|
65
71
|
|
|
66
72
|
Pass `registration.group` and `handlers` to the existing application's RPC host on `/rpc`, merging them with its other groups and Layers as needed. The Platform host supplies generated change handlers; registration requires the page's application handlers. Handler Layer errors and service requirements remain inferred. Missing or extra page ids fail at registration; TypeScript also checks each Layer provides the handlers for its page.
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## Built-in Jobs page
|
|
74
|
+
### Built-in Jobs page
|
|
71
75
|
|
|
72
76
|
Share each queue's name and payload Schema with the browser declaration. The page exposes only the queues passed to `jobsPage`; a queue registered with the jobs runtime is not automatically available to operators.
|
|
73
77
|
|
|
@@ -88,7 +92,7 @@ import { jobsHandlers } from "@shivaedev/admin/server/jobsHandlers.ts";
|
|
|
88
92
|
import { registerAdmin } from "@shivaedev/admin/server/registerAdmin.ts";
|
|
89
93
|
|
|
90
94
|
const registration = registerAdmin(Admin, {
|
|
91
|
-
|
|
95
|
+
jobs: jobsHandlers(JobsPage, JobsService),
|
|
92
96
|
});
|
|
93
97
|
```
|
|
94
98
|
|
|
@@ -98,9 +102,9 @@ Schedule definitions from `defineSchedule` can be passed beside queues. A browse
|
|
|
98
102
|
|
|
99
103
|
Health filters the runtime's monitor snapshot to the page's queues and recomputes totals from those queues. It has the same refresh timing as jobs health. Unregistered names, including dead-letter queue names passed directly, fail with `JobsQueueUnregistered`. Stored payload decoding failures become `JobsPayloadInvalid`; jobs operation failures become `JobsUnavailable`, carrying the operation name. These declared failures do not expose the original database error.
|
|
100
104
|
|
|
101
|
-
The default `jobsPage` declares no commands, and its bound client has no retry operation. Handler registration performs no jobs read, and a failed jobs request leaves other pages available.
|
|
105
|
+
The default `jobsPage` declares no commands, and its bound client has no retry operation. Handler registration performs no jobs read, and a failed jobs request leaves other pages available. The application supplies the Jobs view and mounts the registration on its existing RPC host.
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
#### Declare retry explicitly
|
|
104
108
|
|
|
105
109
|
Use `jobsPageWithRetry` and `jobsHandlersWithRetry` when administrators should be able to retry failed original jobs:
|
|
106
110
|
|
|
@@ -111,15 +115,15 @@ import { jobsHandlersWithRetry } from "@shivaedev/admin/server/jobsHandlersWithR
|
|
|
111
115
|
const JobsPage = jobsPageWithRetry({ name: "mail", schema: MailPayload });
|
|
112
116
|
const Admin = adminRegistry(JobsPage);
|
|
113
117
|
const registration = registerAdmin(Admin, {
|
|
114
|
-
|
|
118
|
+
jobs: jobsHandlersWithRetry(JobsPage, JobsService),
|
|
115
119
|
});
|
|
116
120
|
```
|
|
117
121
|
|
|
118
122
|
This variant adds only `admin.jobs.retry`, taking `{ queue, id }` and returning void. It requires `ReadJobs`, through the same page middleware. The handler uses the jobs package's existing retry for a failed job in a declared queue. Missing jobs and jobs in other states fail with `JobsNotFailed`; unregistered queue names, including dead-letter queues, fail with `JobsQueueUnregistered`. A dead-letter copy's id cannot retry its original.
|
|
119
123
|
|
|
120
|
-
A successful bound retry invalidates health, the affected queue's counts and both listings, and the original job's detail.
|
|
124
|
+
A successful bound retry invalidates health, the affected queue's counts and both listings, and the original job's detail. Health retains the runtime monitor's refresh timing.
|
|
121
125
|
|
|
122
|
-
|
|
126
|
+
### Built-in Users page
|
|
123
127
|
|
|
124
128
|
Call `usersPage(AppAccess)` from `@shivaedev/admin/users/page.ts` with the application's code-defined role set. Add the returned page to the same registry as Jobs and register `users: usersHandlers(UsersPage, AppAccess)` from `@shivaedev/admin/server/usersHandlers.ts`. The handlers use the application's existing Effect SQL client against Better Auth's default PostgreSQL `user` table and its `role` column. Custom table or column names are not supported.
|
|
125
129
|
|
|
@@ -142,8 +146,16 @@ const changeRole = Client.runtime.fn(users.changeRole.run);
|
|
|
142
146
|
|
|
143
147
|
Applications can call `listUsers(AppAccess, input)` and `changeUserRole(AppAccess, input)` from `@shivaedev/admin/server/users.ts` on the server. These enforce their respective domain permissions using `SessionUser`.
|
|
144
148
|
|
|
145
|
-
Keep Better Auth cookie caching disabled so requests see current permissions. Route role writes through this operation to retain the final-assigner policy.
|
|
149
|
+
Keep Better Auth cookie caching disabled so requests see current permissions. Route role writes through this operation to retain the final-assigner policy: the policy covers only `admin.users.changeRole`, so disable Better Auth's `/admin/set-role`, `/admin/update-user` and `/admin/create-user` browser endpoints, which write roles outside it. Better Auth's server-side APIs stay available for trusted code such as a bootstrap command.
|
|
150
|
+
|
|
151
|
+
### Client permission routes
|
|
152
|
+
|
|
153
|
+
`adminPage` requires a permission middleware, including for custom pages. It applies that middleware to the whole contract and exposes its permission as `page.route.permission`. Set the React route's `staticData.permission` to that value. Use `permissionGuard` from `@shivaedev/react/permissionGuard.ts` in protected routes' `beforeLoad` and wrap the router in `PermissionBoundary` from `@shivaedev/react/client/permissionBoundary.ts` with the session and one application fallback.
|
|
154
|
+
|
|
155
|
+
### Install and limits
|
|
156
|
+
|
|
157
|
+
Install `@shivaedev/admin` with `effect`, `react` and `@effect/atom-react` as peers. The package has no root entry; import the module that defines the name.
|
|
146
158
|
|
|
147
|
-
|
|
159
|
+
Page declarations and the registry are browser-safe and add no transport. Server registration lives under `/server`, and the built-in Users view under `/client` uses React. Applications own route composition and styling.
|
|
148
160
|
|
|
149
|
-
|
|
161
|
+
This package declares the permission middleware and does not resolve sessions. `permissionLayer` from `@shivaedev/identity/server/permissions.ts` resolves each request's session through the session policy the application supplies, then checks the page's permission.
|
|
@@ -2,7 +2,7 @@ import { createElement as _createElement } from "react";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { DateTime } from "effect";
|
|
4
4
|
function UserRole({ user, canChangeRoles, roles, pending, dispatch, }) {
|
|
5
|
-
return canChangeRoles ? (_jsx("select", { "aria-label": `Role for ${user.email}`, className: "rounded-md border
|
|
5
|
+
return canChangeRoles ? (_jsx("select", { "aria-label": `Role for ${user.email}`, className: "bg-background rounded-md border p-2", disabled: pending, onChange: (event) => {
|
|
6
6
|
const role = roles.find((candidate) => candidate === event.target.value);
|
|
7
7
|
if (role !== undefined) {
|
|
8
8
|
dispatch({ role, userId: user.id });
|
|
@@ -10,7 +10,7 @@ function UserRole({ user, canChangeRoles, roles, pending, dispatch, }) {
|
|
|
10
10
|
}, value: user.role, children: roles.map((role) => (_jsx("option", { value: role, children: role }, role))) })) : (user.role);
|
|
11
11
|
}
|
|
12
12
|
function UserRow({ user, canChangeRoles, ...controls }) {
|
|
13
|
-
return (_jsxs("tr", { className: "border-b", children: [_jsx("td", { className: "p-3", children: user.name }), _jsx("td", { className: "p-3", children: user.email }), _jsx("td", { className: "p-3", children: _jsx(UserRole, { ...controls, canChangeRoles: canChangeRoles, user: user }) }), _jsx("td", { className: "whitespace-nowrap
|
|
13
|
+
return (_jsxs("tr", { className: "border-b", children: [_jsx("td", { className: "p-3", children: user.name }), _jsx("td", { className: "p-3", children: user.email }), _jsx("td", { className: "p-3", children: _jsx(UserRole, { ...controls, canChangeRoles: canChangeRoles, user: user }) }), _jsx("td", { className: "p-3 whitespace-nowrap", children: _jsx("time", { dateTime: DateTime.formatIso(user.createdAt), children: DateTime.formatIso(user.createdAt) }) })] }));
|
|
14
14
|
}
|
|
15
15
|
function UserRows({ data, ...controls }) {
|
|
16
16
|
return (_jsx("div", { className: "overflow-x-auto rounded-md border", children: _jsxs("table", { className: "w-full text-left text-sm", children: [_jsx("caption", { className: "sr-only", children: "App users and roles" }), _jsx("thead", { className: "bg-muted", children: _jsx(UserHeaders, {}) }), _jsx("tbody", { children: data.users.map((user) => (_createElement(UserRow, { ...controls, canChangeRoles: data.canChangeRoles, key: user.id, user: user }))) })] }) }));
|
|
@@ -19,6 +19,6 @@ export function UsersTable({ data, ...controls }) {
|
|
|
19
19
|
return (_jsxs("div", { className: "space-y-4", children: [data.canChangeRoles ? null : _jsx("p", { children: "Permission to assign roles is required to change roles." }), data.users.length === 0 ? _jsx("p", { children: "No users." }) : _jsx(UserRows, { ...controls, data: data })] }));
|
|
20
20
|
}
|
|
21
21
|
function UserHeaders() {
|
|
22
|
-
return (_jsx("tr", { children: ["Name", "Email", "Role", "Signed up"].map((label) => (_jsx("th", { className: "whitespace-nowrap
|
|
22
|
+
return (_jsx("tr", { children: ["Name", "Email", "Role", "Signed up"].map((label) => (_jsx("th", { className: "p-3 whitespace-nowrap", scope: "col", children: label }, label))) }));
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=UsersTable.js.map
|
package/dist/jobs/page.d.ts
CHANGED
|
@@ -99,7 +99,22 @@ export declare function jobsPage<const TQueues extends readonly JobsEntry[]>(...
|
|
|
99
99
|
JobsPayloadInvalid: typeof import("./schemas.ts").JobsPayloadInvalid;
|
|
100
100
|
JobsQueueUnregistered: typeof import("./schemas.ts").JobsQueueUnregistered;
|
|
101
101
|
JobsUnavailable: typeof import("./schemas.ts").JobsUnavailable;
|
|
102
|
-
}>>], readonly [], import("effect/rpc/Rpc").Rpc<"admin.jobs
|
|
102
|
+
}>>], readonly [], import("effect/rpc/Rpc").Rpc<"admin.jobs.job", Schema.Struct<{
|
|
103
|
+
id: Schema.String;
|
|
104
|
+
queue: Schema.String;
|
|
105
|
+
}>, Schema.OptionFromNullOr<Schema.Union<Schema.Struct<{
|
|
106
|
+
readonly attempt: Schema.Number;
|
|
107
|
+
readonly completedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
|
|
108
|
+
readonly createdOn: Schema.DateTimeUtcFromString;
|
|
109
|
+
readonly id: Schema.String;
|
|
110
|
+
readonly output: Schema.Unknown;
|
|
111
|
+
readonly retryCount: Schema.Number;
|
|
112
|
+
readonly retryLimit: Schema.Number;
|
|
113
|
+
readonly startedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
|
|
114
|
+
readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
|
|
115
|
+
readonly data: JobsPayload<TQueues[number]>;
|
|
116
|
+
readonly queue: Schema.Literal<string>;
|
|
117
|
+
}>[]>>, Schema.Union<readonly [Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.$changes", Schema.Struct<{
|
|
103
118
|
queries: Schema.$Array<Schema.Union<readonly (Schema.Struct<{
|
|
104
119
|
query: Schema.Literal<"counts">;
|
|
105
120
|
payload: Schema.Struct<{
|
|
@@ -154,6 +169,20 @@ export declare function jobsPage<const TQueues extends readonly JobsEntry[]>(...
|
|
|
154
169
|
readonly failedCount: Schema.Number;
|
|
155
170
|
readonly queuedCount: Schema.Number;
|
|
156
171
|
readonly totalCount: Schema.Number;
|
|
172
|
+
}>, Schema.Union<readonly [Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.health", Schema.Void, Schema.Struct<{
|
|
173
|
+
readonly activeTotal: Schema.Number;
|
|
174
|
+
readonly deadLetteredTotal: Schema.Number;
|
|
175
|
+
readonly failedTotal: Schema.Number;
|
|
176
|
+
readonly jobs: Schema.$Array<Schema.Struct<{
|
|
177
|
+
readonly activeCount: Schema.Number;
|
|
178
|
+
readonly deadLetteredCount: Schema.Number;
|
|
179
|
+
readonly failedCount: Schema.Number;
|
|
180
|
+
readonly name: Schema.String;
|
|
181
|
+
readonly queuedCount: Schema.Number;
|
|
182
|
+
readonly readyCount: Schema.Number;
|
|
183
|
+
}>>;
|
|
184
|
+
readonly queuedTotal: Schema.Number;
|
|
185
|
+
readonly readyTotal: Schema.Number;
|
|
157
186
|
}>, Schema.Union<readonly [Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.failed", Schema.Struct<{
|
|
158
187
|
cursor: Schema.optionalKey<Schema.String>;
|
|
159
188
|
limit: Schema.Number;
|
|
@@ -194,35 +223,6 @@ export declare function jobsPage<const TQueues extends readonly JobsEntry[]>(...
|
|
|
194
223
|
readonly sourceOutput: Schema.Unknown;
|
|
195
224
|
}>[]>>;
|
|
196
225
|
readonly next: Schema.OptionFromNullOr<Schema.String>;
|
|
197
|
-
}>, Schema.Union<readonly [Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.job", Schema.Struct<{
|
|
198
|
-
id: Schema.String;
|
|
199
|
-
queue: Schema.String;
|
|
200
|
-
}>, Schema.OptionFromNullOr<Schema.Union<Schema.Struct<{
|
|
201
|
-
readonly attempt: Schema.Number;
|
|
202
|
-
readonly completedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
|
|
203
|
-
readonly createdOn: Schema.DateTimeUtcFromString;
|
|
204
|
-
readonly id: Schema.String;
|
|
205
|
-
readonly output: Schema.Unknown;
|
|
206
|
-
readonly retryCount: Schema.Number;
|
|
207
|
-
readonly retryLimit: Schema.Number;
|
|
208
|
-
readonly startedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
|
|
209
|
-
readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
|
|
210
|
-
readonly data: JobsPayload<TQueues[number]>;
|
|
211
|
-
readonly queue: Schema.Literal<string>;
|
|
212
|
-
}>[]>>, Schema.Union<readonly [Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.health", Schema.Void, Schema.Struct<{
|
|
213
|
-
readonly activeTotal: Schema.Number;
|
|
214
|
-
readonly deadLetteredTotal: Schema.Number;
|
|
215
|
-
readonly failedTotal: Schema.Number;
|
|
216
|
-
readonly jobs: Schema.$Array<Schema.Struct<{
|
|
217
|
-
readonly activeCount: Schema.Number;
|
|
218
|
-
readonly deadLetteredCount: Schema.Number;
|
|
219
|
-
readonly failedCount: Schema.Number;
|
|
220
|
-
readonly name: Schema.String;
|
|
221
|
-
readonly queuedCount: Schema.Number;
|
|
222
|
-
readonly readyCount: Schema.Number;
|
|
223
|
-
}>>;
|
|
224
|
-
readonly queuedTotal: Schema.Number;
|
|
225
|
-
readonly readyTotal: Schema.Number;
|
|
226
226
|
}>, Schema.Union<readonly [Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission, never>, readonly [], undefined>;
|
|
227
227
|
} & {
|
|
228
228
|
queues: TQueues;
|
package/dist/jobs/retryPage.d.ts
CHANGED
|
@@ -161,7 +161,10 @@ export declare function jobsPageWithRetry<const TQueues extends readonly JobsEnt
|
|
|
161
161
|
readonly queryIndexes: Schema.optional<Schema.$Array<Schema.Number>>;
|
|
162
162
|
}>, Schema.Struct<{
|
|
163
163
|
readonly _tag: Schema.Literal<"Resync">;
|
|
164
|
-
}>]>, Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>>, Schema.Never, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.
|
|
164
|
+
}>]>, Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>>, Schema.Never, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.retry", Schema.Struct<{
|
|
165
|
+
id: Schema.String;
|
|
166
|
+
queue: Schema.String;
|
|
167
|
+
}>, Schema.Void, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered | typeof JobsNotFailed)[]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.counts", Schema.Struct<{
|
|
165
168
|
queue: Schema.String;
|
|
166
169
|
}>, Schema.Struct<{
|
|
167
170
|
readonly activeCount: Schema.Number;
|
|
@@ -237,10 +240,7 @@ export declare function jobsPageWithRetry<const TQueues extends readonly JobsEnt
|
|
|
237
240
|
readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
|
|
238
241
|
readonly data: import("./entry.ts").JobsPayload<[...TQueues][number]>;
|
|
239
242
|
readonly queue: Schema.Literal<string>;
|
|
240
|
-
}>[]>>, Schema.Union<readonly [Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission, never
|
|
241
|
-
id: Schema.String;
|
|
242
|
-
queue: Schema.String;
|
|
243
|
-
}>, Schema.Void, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered | typeof JobsNotFailed)[]>, typeof JobsPermission, never>, readonly [], undefined>;
|
|
243
|
+
}>[]>>, Schema.Union<readonly [Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission, never>, readonly [], undefined>;
|
|
244
244
|
} & {
|
|
245
245
|
queues: TQueues;
|
|
246
246
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/admin",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Explicit admin page contracts and a protected native Effect RPC registry",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/admin#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@shivaedev/access": "0.1.1",
|
|
45
45
|
"@shivaedev/changes": "0.5.0",
|
|
46
|
-
"@shivaedev/contract": "0.19.
|
|
46
|
+
"@shivaedev/contract": "0.19.1",
|
|
47
47
|
"@shivaedev/errors": "0.1.0",
|
|
48
|
-
"@shivaedev/identity": "0.3.
|
|
48
|
+
"@shivaedev/identity": "0.3.1",
|
|
49
49
|
"@shivaedev/jobs": "0.22.0",
|
|
50
|
-
"@shivaedev/react": "0.21.
|
|
50
|
+
"@shivaedev/react": "0.21.1",
|
|
51
51
|
"@shivaedev/sql": "0.24.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@effect/atom-react": "4.0.5",
|
|
55
|
-
"@shivaedev/quality": "0.
|
|
56
|
-
"@shivaedev/server": "0.3.
|
|
55
|
+
"@shivaedev/quality": "0.44.0",
|
|
56
|
+
"@shivaedev/server": "0.3.1",
|
|
57
57
|
"@shivaedev/test-sql": "0.10.2",
|
|
58
58
|
"@shivaedev/test-story": "0.22.0",
|
|
59
59
|
"@types/node": "24.19.2",
|
|
@@ -21,7 +21,7 @@ function UserRole<TRole extends string>({
|
|
|
21
21
|
return canChangeRoles ? (
|
|
22
22
|
<select
|
|
23
23
|
aria-label={`Role for ${user.email}`}
|
|
24
|
-
className="rounded-md border
|
|
24
|
+
className="bg-background rounded-md border p-2"
|
|
25
25
|
disabled={pending}
|
|
26
26
|
onChange={(event) => {
|
|
27
27
|
const role = roles.find((candidate) => candidate === event.target.value);
|
|
@@ -54,7 +54,7 @@ function UserRow<TRole extends string>({
|
|
|
54
54
|
<td className="p-3">
|
|
55
55
|
<UserRole {...controls} canChangeRoles={canChangeRoles} user={user} />
|
|
56
56
|
</td>
|
|
57
|
-
<td className="whitespace-nowrap
|
|
57
|
+
<td className="p-3 whitespace-nowrap">
|
|
58
58
|
<time dateTime={DateTime.formatIso(user.createdAt)}>{DateTime.formatIso(user.createdAt)}</time>
|
|
59
59
|
</td>
|
|
60
60
|
</tr>
|
|
@@ -90,7 +90,7 @@ function UserHeaders() {
|
|
|
90
90
|
return (
|
|
91
91
|
<tr>
|
|
92
92
|
{["Name", "Email", "Role", "Signed up"].map((label) => (
|
|
93
|
-
<th className="whitespace-nowrap
|
|
93
|
+
<th className="p-3 whitespace-nowrap" key={label} scope="col">
|
|
94
94
|
{label}
|
|
95
95
|
</th>
|
|
96
96
|
))}
|