@shivaedev/admin 0.5.0 → 0.7.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.
Files changed (62) hide show
  1. package/README.md +27 -16
  2. package/dist/client/UsersTable.d.ts +5 -4
  3. package/dist/client/UsersTable.d.ts.map +1 -1
  4. package/dist/client/UsersTable.js +13 -14
  5. package/dist/client/UsersTable.js.map +1 -1
  6. package/dist/client/UsersView.d.ts +5 -4
  7. package/dist/client/UsersView.d.ts.map +1 -1
  8. package/dist/client/UsersView.js +6 -6
  9. package/dist/client/UsersView.js.map +1 -1
  10. package/dist/jobs/keys.d.ts +5 -5
  11. package/dist/jobs/keys.js +1 -1
  12. package/dist/jobs/keys.js.map +1 -1
  13. package/dist/jobs/page.d.ts +42 -41
  14. package/dist/jobs/page.d.ts.map +1 -1
  15. package/dist/jobs/page.js +4 -2
  16. package/dist/jobs/page.js.map +1 -1
  17. package/dist/jobs/retryPage.d.ts +14 -13
  18. package/dist/jobs/retryPage.d.ts.map +1 -1
  19. package/dist/jobs/retryPage.js +4 -2
  20. package/dist/jobs/retryPage.js.map +1 -1
  21. package/dist/page.d.ts +11 -7
  22. package/dist/page.d.ts.map +1 -1
  23. package/dist/page.js +6 -2
  24. package/dist/page.js.map +1 -1
  25. package/dist/permissions.d.ts +26 -5
  26. package/dist/permissions.d.ts.map +1 -1
  27. package/dist/permissions.js +7 -3
  28. package/dist/permissions.js.map +1 -1
  29. package/dist/server/jobsHandlers.d.ts +7 -7
  30. package/dist/server/jobsHandlers.d.ts.map +1 -1
  31. package/dist/server/jobsHandlersWithRetry.d.ts +2 -2
  32. package/dist/server/jobsHandlersWithRetry.d.ts.map +1 -1
  33. package/dist/server/users.d.ts +46 -0
  34. package/dist/server/users.d.ts.map +1 -0
  35. package/dist/server/users.js +67 -0
  36. package/dist/server/users.js.map +1 -0
  37. package/dist/server/usersHandlers.d.ts +3 -1
  38. package/dist/server/usersHandlers.d.ts.map +1 -1
  39. package/dist/server/usersHandlers.js +13 -12
  40. package/dist/server/usersHandlers.js.map +1 -1
  41. package/dist/users/page.d.ts +19 -18
  42. package/dist/users/page.d.ts.map +1 -1
  43. package/dist/users/page.js +30 -26
  44. package/dist/users/page.js.map +1 -1
  45. package/dist/users/roles.d.ts +33 -0
  46. package/dist/users/roles.d.ts.map +1 -0
  47. package/dist/users/roles.js +16 -0
  48. package/dist/users/roles.js.map +1 -0
  49. package/package.json +12 -9
  50. package/src/client/UsersTable.tsx +48 -51
  51. package/src/client/UsersView.ts +10 -9
  52. package/src/jobs/keys.ts +1 -1
  53. package/src/jobs/page.ts +4 -2
  54. package/src/jobs/retryPage.ts +4 -2
  55. package/src/page.ts +15 -7
  56. package/src/permissions.ts +6 -3
  57. package/src/server/jobsHandlers.ts +2 -2
  58. package/src/server/jobsHandlersWithRetry.ts +1 -1
  59. package/src/server/users.ts +76 -0
  60. package/src/server/usersHandlers.ts +19 -13
  61. package/src/users/page.ts +31 -26
  62. package/src/users/roles.ts +20 -0
package/README.md CHANGED
@@ -7,24 +7,26 @@ Admin tooling starts with an explicit list of pages and the operations each page
7
7
  ```ts
8
8
  const Jobs = adminPage({
9
9
  id: "jobs",
10
+ permission: JobsPermission,
10
11
  route: { path: "/admin/jobs", title: "Jobs" },
11
12
  contract: contract("admin.jobs", { queries: [Failed] }),
12
13
  });
13
14
  const Admin = adminRegistry(Jobs);
14
15
  ```
15
16
 
16
- The page exposes `admin.jobs.failed` and the generated `admin.jobs.$changes` subscription. Both require `AdminPermission`, which checks the `OpenAdmin` permission (`admin.open`). A query-only contract has no command. The application grants this permission to its chosen roles.
17
+ 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.
17
18
 
18
19
  ## Use native contracts and Layers
19
20
 
20
- Install `@shivaedev/admin` with `effect`, `react` and `@effect/atom-react`. Declare each page's queries, commands and streams with `@shivaedev/effect-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`.
21
+ Install `@shivaedev/admin` with `effect`, `react` and `@effect/atom-react`. 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`.
21
22
 
22
23
  ```ts
23
24
  import { Schema } from "effect";
25
+ import { JobsPermission } from "@shivaedev/admin/permissions.ts";
24
26
  import { adminPage } from "@shivaedev/admin/page.ts";
25
27
  import { adminRegistry } from "@shivaedev/admin/registry.ts";
26
- import { contract } from "@shivaedev/effect-contract/contract.ts";
27
- import { query } from "@shivaedev/effect-contract/operation.ts";
28
+ import { contract } from "@shivaedev/contract/contract.ts";
29
+ import { query } from "@shivaedev/contract/operation.ts";
28
30
 
29
31
  const Failed = query("failed", {
30
32
  reads: () => [],
@@ -32,6 +34,7 @@ const Failed = query("failed", {
32
34
  });
33
35
  const Jobs = adminPage({
34
36
  id: "jobs",
37
+ permission: JobsPermission,
35
38
  route: { path: "/admin/jobs", title: "Jobs" },
36
39
  contract: contract("admin.jobs", { queries: [Failed] }),
37
40
  });
@@ -45,8 +48,8 @@ Register server handler Layers by page id:
45
48
  ```ts
46
49
  import { Effect, Layer } from "effect";
47
50
  import { registerAdmin } from "@shivaedev/admin/server/registerAdmin.ts";
48
- import { AdminPermission, OpenAdmin } from "@shivaedev/admin/permissions.ts";
49
- import { permissionLayer } from "@shivaedev/platform/server/rpc-server/permissions.ts";
51
+ import { JobsPermission, ReadJobs } from "@shivaedev/admin/permissions.ts";
52
+ import { permissionLayer } from "@shivaedev/identity/server/permissions.ts";
50
53
 
51
54
  const registration = registerAdmin(Admin, {
52
55
  jobs: Jobs.contract.application.toLayer({
@@ -54,11 +57,11 @@ const registration = registerAdmin(Admin, {
54
57
  }),
55
58
  });
56
59
  const handlers = registration.handlers.pipe(
57
- Layer.provideMerge(permissionLayer(AdminPermission, sessions)),
60
+ Layer.provideMerge(permissionLayer(JobsPermission, sessions)),
58
61
  );
59
62
  ```
60
63
 
61
- Declare application roles with `@shivaedev/access`, grant `OpenAdmin` explicitly, and supply that role set through Platform's session or auth configuration.
64
+ 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`.
62
65
 
63
66
  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.
64
67
 
@@ -91,7 +94,7 @@ const registration = registerAdmin(Admin, {
91
94
 
92
95
  The queries are `admin.jobs.health`, `admin.jobs.counts`, `admin.jobs.failed`, `admin.jobs.deadLettered` and `admin.jobs.job`. Counts take `{ queue }`; listings take `{ queue, limit, cursor? }` and return `{ jobs, next }`, where `next` is an `Option<string>`. Job lookup takes `{ queue, id }` and returns `Option<Job>`. Each job carries its queue, decoded payload, state, attempt and retry counts, output and timestamps. Dead-letter listings also carry `sourceId` and `sourceOutput`. Timestamps use UTC `DateTime` values; the RPC encodes timestamps as strings and Options as nullable values. The queue's original codec encodes and decodes its payload across RPC, preserving its service requirements.
93
96
 
94
- 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 effect-pg-boss 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.
97
+ 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.
95
98
 
96
99
  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. PostgreSQL stories exercise these queries through serialized `/rpc` requests, including pagination, transformed payloads, missing jobs, queue restrictions and permission enforcement. The application supplies the Jobs view and mounts the registration on its existing RPC host.
97
100
 
@@ -110,15 +113,17 @@ const registration = registerAdmin(Admin, {
110
113
  });
111
114
  ```
112
115
 
113
- This variant adds only `admin.jobs.retry`, taking `{ queue, id }` and returning void. It requires `OpenAdmin`, through the same page middleware. The handler uses effect-pg-boss'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.
116
+ 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.
114
117
 
115
118
  A successful bound retry invalidates health, the affected queue's counts and both listings, and the original job's detail. PostgreSQL stories mount these query atoms, retry through authenticated serialized RPC, and observe refetching and a second worker execution. Health retains the runtime monitor's refresh timing.
116
119
 
117
120
  ## Built-in Users page
118
121
 
119
- `UsersPage` from `@shivaedev/admin/users/page.ts` declares `/admin/users`. Add it to the same registry as Jobs and register `users: usersHandlers` from `@shivaedev/admin/server/usersHandlers.ts`. The handlers use the application's existing Effect SQL client against Better Auth's default PostgreSQL `user` table, with the admin plugin's `role` column. They do not create another user store. Custom Better Auth table or column names are not supported by these handlers.
122
+ 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.
120
123
 
121
- Bind `UsersPage.contract` to the registry's native AtomRpc client, then mount the package view in the application's admin shell. The view uses semantic HTML and Tailwind utility classes; Tailwind applications include `@source "../../node_modules/@shivaedev/admin/src/client";` in `src/client/entry.css`, as the starter does:
124
+ Each user stores one role string accepted by `AppAccess.Role`. Each role declares an explicit permission list in application code. The Users area assigns roles; it does not edit their grants.
125
+
126
+ Bind the page's contract to the registry's native AtomRpc client, then mount the view in the application's admin shell. Tailwind applications include `@source "../../node_modules/@shivaedev/admin/src/client";` in `src/client/entry.css`:
122
127
 
123
128
  ```tsx
124
129
  import { UsersView } from "@shivaedev/admin/client/UsersView.ts";
@@ -126,11 +131,17 @@ import { UsersView } from "@shivaedev/admin/client/UsersView.ts";
126
131
  const users = bind(UsersPage.contract, Client);
127
132
  const changeRole = Client.runtime.fn(users.changeRole.run);
128
133
 
129
- <UsersView list={users.list.query} changeRole={changeRole} />;
134
+ <UsersView roles={AppAccess.Role.literals} list={users.list.query} changeRole={changeRole} />;
130
135
  ```
131
136
 
132
- `admin.users.list` takes `{ limit, cursor? }` (1–100 users), returns `{ users, next, canChangeRoles }`, and orders pages by user id. Each user has id, name, email, roles and a UTC sign-up time. All reads and subscriptions require `OpenAdmin`. Callers granted `ChangeUserRoles` (`users.roles.change`) from Platform's `rpc/userRoles.ts` see role controls. `admin.users.changeRole` takes `{ userId, role, grant }` for Platform's `user`, `admin` and `owner` roles. It returns typed `Forbidden` without that permission, `LastOwner` when revoking the final owner, and `NotFound` for a missing user. Role changes preserve other roles, invalidate the list after commit, and emit an Effect log with actor id, target id, role, action and timestamp. There is no durable audit-history store.
137
+ `admin.users.list` takes `{ limit, cursor? }` (1–100 users) and returns `{ users, next, canChangeRoles }` ordered by user id. Each user has id, name, email, role and a UTC sign-up time. The page's operations and generated subscription require `ReadUsers` (`users.read`), enforced by `UsersPermission`. Supply `permissionLayer(UsersPermission, sessions)` alongside the application's other handler Layers.
138
+
139
+ `admin.users.changeRole` takes `{ userId, role }`; its role Schema is the application's declared role union. The handler also requires `AssignRoles` (`roles.assign`). The view shows a role select only to callers with that permission. Role writes serialize in a transaction and return `LastRoleAssigner` if replacing the final holder's role would remove `roles.assign`, regardless of the role's name. A missing user returns `NotFound`. Changes invalidate the list after commit and emit an Effect log with actor id, target id, role and timestamp.
140
+
141
+ 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`.
142
+
143
+ Keep Better Auth cookie caching disabled so requests see current permissions. Route role writes through this operation to retain the final-assigner policy. The starter disables Better Auth's `/admin/set-role`, `/admin/update-user` and `/admin/create-user` browser endpoints; its server-side bootstrap API remains available.
133
144
 
134
- Keep Better Auth cookie caching disabled so requests see current roles. Applications must route role writes through this operation to retain its permission and last-owner policy. The starter disables Better Auth's `/admin/set-role`, `/admin/update-user` and `/admin/create-user` browser endpoints; its server-side bootstrap API remains available.
145
+ ## Client permission routes
135
146
 
136
- The starter mounts Users beside Jobs and bootstraps new administrators with both `admin` and `owner`. Existing generated apps receive this wiring through `pnpm dlx @shivaedev/create-app@latest update` after release; review conflicts and install dependencies. For an existing database with no owner, bootstrap a new administrator with `pnpm admin:create`.
147
+ `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. The starter uses this path for Users, Jobs and note statistics.
@@ -1,10 +1,11 @@
1
- import { type ChangeRoleInput } from "@shivaedev/platform/rpc/userRoles.ts";
2
1
  import type { UsersList } from "#users/page.ts";
3
- interface RoleControls {
4
- readonly dispatch: (input: typeof ChangeRoleInput.Type) => void;
2
+ import type { ChangeRoleInput } from "#users/roles.ts";
3
+ interface RoleControls<TRole extends string> {
4
+ readonly dispatch: (input: ChangeRoleInput<TRole>) => void;
5
5
  readonly pending: boolean;
6
+ readonly roles: readonly TRole[];
6
7
  }
7
- export declare function UsersTable({ data, ...controls }: RoleControls & {
8
+ export declare function UsersTable<TRole extends string>({ data, ...controls }: RoleControls<TRole> & {
8
9
  readonly data: typeof UsersList.Type;
9
10
  }): import("react").JSX.Element;
10
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"UsersTable.d.ts","sourceRoot":"","sources":["../../src/client/UsersTable.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,eAAe,EAAY,MAAM,sCAAsC,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,UAAU,YAAY;IACrB,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,eAAe,CAAC,IAAI,KAAK,IAAI,CAAC;IAChE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAuFD,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,EAAE,YAAY,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,SAAS,CAAC,IAAI,CAAA;CAAE,+BAOxG"}
1
+ {"version":3,"file":"UsersTable.d.ts","sourceRoot":"","sources":["../../src/client/UsersTable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAW,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,UAAU,YAAY,CAAC,KAAK,SAAS,MAAM;IAC1C,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC;CACjC;AAuED,wBAAgB,UAAU,CAAC,KAAK,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,SAAS,CAAC,IAAI,CAAA;CAAE,+BAOrI"}
@@ -1,25 +1,24 @@
1
1
  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
- import { UserRole } from "@shivaedev/platform/rpc/userRoles.ts";
5
- function UserHeaders() {
6
- return (_jsx("tr", { children: ["Name", "Email", "Roles", "Signed up"].map((label) => (_jsx("th", { className: "whitespace-nowrap p-3", scope: "col", children: label }, label))) }));
7
- }
8
- function RoleCheckbox({ user, role, pending, dispatch }) {
9
- return (_jsxs("label", { className: "mr-3 inline-flex gap-1", children: [_jsx("input", { "aria-label": `${role} for ${user.email}`, checked: user.roles.includes(role), disabled: pending, onChange: (event) => dispatch({ grant: event.target.checked, role, userId: user.id }), type: "checkbox" }), role] }));
10
- }
11
- function UserRoles({ user, canChangeRoles, dispatch, pending, }) {
12
- return (_jsxs("div", { children: [_jsx("p", { children: user.roles.join(", ") || "No roles" }), canChangeRoles
13
- ? UserRole.literals.map((role) => _jsx(RoleCheckbox, { dispatch: dispatch, pending: pending, role: role, user: user }, role))
14
- : null] }));
4
+ function UserRole({ user, canChangeRoles, roles, pending, dispatch, }) {
5
+ return canChangeRoles ? (_jsx("select", { "aria-label": `Role for ${user.email}`, className: "rounded-md border bg-background p-2", disabled: pending, onChange: (event) => {
6
+ const role = roles.find((candidate) => candidate === event.target.value);
7
+ if (role !== undefined) {
8
+ dispatch({ role, userId: user.id });
9
+ }
10
+ }, value: user.role, children: roles.map((role) => (_jsx("option", { value: role, children: role }, role))) })) : (user.role);
15
11
  }
16
- function UserRow({ user, ...controls }) {
17
- 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(UserRoles, { ...controls, user: user }) }), _jsx("td", { className: "whitespace-nowrap p-3", children: _jsx("time", { dateTime: DateTime.formatIso(user.createdAt), children: DateTime.formatIso(user.createdAt) }) })] }));
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 p-3", children: _jsx("time", { dateTime: DateTime.formatIso(user.createdAt), children: DateTime.formatIso(user.createdAt) }) })] }));
18
14
  }
19
15
  function UserRows({ data, ...controls }) {
20
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 }))) })] }) }));
21
17
  }
22
18
  export function UsersTable({ data, ...controls }) {
23
- return (_jsxs("div", { className: "space-y-4", children: [data.canChangeRoles ? null : _jsx("p", { children: "Only owners can change roles." }), data.users.length === 0 ? _jsx("p", { children: "No users." }) : _jsx(UserRows, { ...controls, data: data })] }));
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
+ }
21
+ function UserHeaders() {
22
+ return (_jsx("tr", { children: ["Name", "Email", "Role", "Signed up"].map((label) => (_jsx("th", { className: "whitespace-nowrap p-3", scope: "col", children: label }, label))) }));
24
23
  }
25
24
  //# sourceMappingURL=UsersTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UsersTable.js","sourceRoot":"","sources":["../../src/client/UsersTable.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE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AC,CAAC,CAAC,oCAAgB,CAAC,CAAC,CAAC,KAAC,QAAQ,OAAK,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAI,IAC/E,CACN,CAAC;AACH,CAAC;AAED,SAAS,WAAW;IACnB,OAAO,CACN,uBACE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACtD,aAAI,SAAS,EAAC,uBAAuB,EAAa,KAAK,EAAC,KAAK,YAC3D,KAAK,IADoC,KAAK,CAE3C,CACL,CAAC,GACE,CACL,CAAC;AACH,CAAC"}
@@ -1,12 +1,13 @@
1
1
  import type * as AsyncResult from "effect/reactivity/AsyncResult";
2
2
  import type * as Atom from "effect/reactivity/Atom";
3
- import type { ChangeRoleInput, UserListInput } from "@shivaedev/platform/rpc/userRoles.ts";
4
3
  import type { UsersList } from "#users/page.ts";
5
- export interface UsersViewProps {
6
- readonly changeRole: Atom.AtomResultFn<typeof ChangeRoleInput.Type, void, unknown>;
4
+ import type { ChangeRoleInput, UserListInput } from "#users/roles.ts";
5
+ export interface UsersViewProps<TRole extends string> {
6
+ readonly changeRole: Atom.AtomResultFn<ChangeRoleInput<TRole>, void, unknown>;
7
7
  readonly list: (input: typeof UserListInput.Type) => Atom.Atom<AsyncResult.AsyncResult<typeof UsersList.Type, unknown>>;
8
+ readonly roles: readonly TRole[];
8
9
  }
9
- export declare function UsersView({ list, changeRole }: UsersViewProps): import("react").DetailedReactHTMLElement<{
10
+ export declare function UsersView<TRole extends string>({ list, changeRole, roles }: UsersViewProps<TRole>): import("react").DetailedReactHTMLElement<{
10
11
  "aria-label": string;
11
12
  className: string;
12
13
  }, HTMLElement>;
@@ -1 +1 @@
1
- {"version":3,"file":"UsersView.d.ts","sourceRoot":"","sources":["../../src/client/UsersView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,KAA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CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC;CACjC;AAaD,wBAAgB,SAAS,CAAC,KAAK,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC;;;gBA6CjG"}
@@ -1,24 +1,24 @@
1
1
  import { Cause, Option, Predicate } from "effect";
2
2
  import { createElement, useState } from "react";
3
- import { useAction, useQuery } from "@shivaedev/effect-react/client/resultState.ts";
3
+ import { useAction, useQuery } from "@shivaedev/react/client/resultState.ts";
4
4
  import { UsersTable } from "./UsersTable.js";
5
5
  function failure(cause) {
6
6
  const error = Option.getOrUndefined(Cause.findErrorOption(cause));
7
- if (Predicate.isTagged(error, "LastOwner")) {
8
- return "The last owner cannot be demoted. Grant owner to another user first.";
7
+ if (Predicate.isTagged(error, "LastRoleAssigner")) {
8
+ return "The last user who can assign roles cannot be removed. Assign another user permission to change roles first.";
9
9
  }
10
10
  if (Predicate.isTagged(error, "Forbidden")) {
11
- return "Owner role required to change roles.";
11
+ return "Permission required to assign roles.";
12
12
  }
13
13
  return "Could not change the role. Try again.";
14
14
  }
15
- export function UsersView({ list, changeRole }) {
15
+ export function UsersView({ list, changeRole, roles }) {
16
16
  const [cursors, setCursors] = useState([]);
17
17
  const cursor = cursors.at(-1);
18
18
  const state = useQuery(list({ ...(cursor === undefined ? {} : { cursor }), limit: 20 }));
19
19
  const action = useAction(changeRole);
20
20
  const data = Option.getOrUndefined(state.data);
21
- return createElement("section", { "aria-label": "App users", className: "space-y-4" }, createElement("button", { className: "rounded-md border px-3 py-2 disabled:opacity-50", disabled: state.pending, onClick: state.refresh, type: "button" }, "Refresh users"), state.pending ? createElement("p", { role: "status" }, "Loading users…") : null, Option.isSome(state.cause) ? createElement("p", { role: "alert" }, "Could not load users. Try refreshing.") : null, Option.isSome(action.cause) ? createElement("p", { role: "alert" }, failure(action.cause.value)) : null, data === undefined ? null : createElement(UsersTable, { data, dispatch: action.dispatch, pending: action.pending }), data === undefined
21
+ return createElement("section", { "aria-label": "App users", className: "space-y-4" }, createElement("button", { className: "rounded-md border px-3 py-2 disabled:opacity-50", disabled: state.pending, onClick: state.refresh, type: "button" }, "Refresh users"), state.pending ? createElement("p", { role: "status" }, "Loading users…") : null, Option.isSome(state.cause) ? createElement("p", { role: "alert" }, "Could not load users. Try refreshing.") : null, Option.isSome(action.cause) ? createElement("p", { role: "alert" }, failure(action.cause.value)) : null, data === undefined ? null : createElement(UsersTable, { data, dispatch: action.dispatch, pending: action.pending, roles }), data === undefined
22
22
  ? null
23
23
  : createElement("nav", { "aria-label": "User pages", className: "flex gap-4" }, createElement("button", {
24
24
  className: "rounded-md border px-3 py-2 disabled:opacity-50",
@@ -1 +1 @@
1
- {"version":3,"file":"UsersView.js","sourceRoot":"","sources":["../../src/client/UsersView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGpF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAO9C,SAAS,OAAO,CAAC,KAA2B;IAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAClE,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC;QAC5C,OAAO,sEAAsE,CAAC;IAC/E,CAAC;IACD,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC;QAC5C,OAAO,sCAAsC,CAAC;IAC/C,CAAC;IACD,OAAO,uCAAuC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,UAAU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C,EAAE,CAAC,CAAC,CAAC,CAAC;YAC/C,IAAI,EAAE,QAAQ;SACd,EACD,gBAAgB,CAChB,EACD,aAAa,CACZ,QAAQ,EACR;YACC,SAAS,EAAE,iDAAiD;YAC5D,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO;YACnD,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;YAC9E,IAAI,EAAE,QAAQ;SACd,EACD,YAAY,CACZ,CACD,CACH,CAAC;AACH,CAAC"}
@@ -1,8 +1,8 @@
1
1
  export declare const jobsKeys: {
2
- counts: import("@shivaedev/effect-contract/keys.ts").Collection<"admin.jobs.counts", string>;
3
- deadLettered: import("@shivaedev/effect-contract/keys.ts").Collection<"admin.jobs.deadLettered", string>;
4
- failed: import("@shivaedev/effect-contract/keys.ts").Collection<"admin.jobs.failed", string>;
5
- health: import("@shivaedev/effect-contract/keys.ts").Collection<"admin.jobs.health", string>;
6
- job: (queue: string) => import("@shivaedev/effect-contract/keys.ts").Collection<`admin.jobs.job.${string}`, string>;
2
+ counts: import("@shivaedev/contract/keys.ts").Collection<"admin.jobs.counts", string>;
3
+ deadLettered: import("@shivaedev/contract/keys.ts").Collection<"admin.jobs.deadLettered", string>;
4
+ failed: import("@shivaedev/contract/keys.ts").Collection<"admin.jobs.failed", string>;
5
+ health: import("@shivaedev/contract/keys.ts").Collection<"admin.jobs.health", string>;
6
+ job: (queue: string) => import("@shivaedev/contract/keys.ts").Collection<`admin.jobs.job.${string}`, string>;
7
7
  };
8
8
  //# sourceMappingURL=keys.d.ts.map
package/dist/jobs/keys.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { collection } from "@shivaedev/effect-contract/keys.ts";
2
+ import { collection } from "@shivaedev/contract/keys.ts";
3
3
  export const jobsKeys = {
4
4
  counts: collection("admin.jobs.counts", Schema.String),
5
5
  deadLettered: collection("admin.jobs.deadLettered", Schema.String),
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/jobs/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,MAAM,EAAE,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC;IACtD,YAAY,EAAE,UAAU,CAAC,yBAAyB,EAAE,MAAM,CAAC,MAAM,CAAC;IAClE,MAAM,EAAE,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC;IACtD,MAAM,EAAE,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC;IACtD,GAAG,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,UAAU,CAAC,kBAAkB,KAAK,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC;CAC5E,CAAC"}
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/jobs/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,MAAM,EAAE,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC;IACtD,YAAY,EAAE,UAAU,CAAC,yBAAyB,EAAE,MAAM,CAAC,MAAM,CAAC;IAClE,MAAM,EAAE,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC;IACtD,MAAM,EAAE,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC;IACtD,GAAG,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,UAAU,CAAC,kBAAkB,KAAK,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC;CAC5E,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { Schema } from "effect";
2
+ import { JobsPermission } from "#permissions.ts";
2
3
  import { type JobsQueue } from "./schemas.ts";
3
4
  export declare function jobsPage<const TQueues extends readonly JobsQueue[]>(...queues: TQueues): import("#page.ts").AdminPage & {
4
5
  readonly id: "jobs";
5
- readonly contract: import("@shivaedev/effect-contract/contract.ts").Contract<"admin.jobs", readonly [NoInfer<import("@shivaedev/effect-contract/operation.ts").Query<"health", Schema.Void, Schema.Struct<{
6
+ readonly contract: import("@shivaedev/contract/contract.ts").Contract<"admin.jobs", readonly [NoInfer<import("@shivaedev/contract/operation.ts").Query<"health", Schema.Void, Schema.Struct<{
6
7
  readonly activeTotal: Schema.Number;
7
8
  readonly deadLetteredTotal: Schema.Number;
8
9
  readonly failedTotal: Schema.Number;
@@ -20,7 +21,7 @@ export declare function jobsPage<const TQueues extends readonly JobsQueue[]>(...
20
21
  JobsPayloadInvalid: typeof import("./schemas.ts").JobsPayloadInvalid;
21
22
  JobsQueueUnregistered: typeof import("./schemas.ts").JobsQueueUnregistered;
22
23
  JobsUnavailable: typeof import("./schemas.ts").JobsUnavailable;
23
- }>>, NoInfer<import("@shivaedev/effect-contract/operation.ts").Query<"counts", Schema.Struct<{
24
+ }>>, NoInfer<import("@shivaedev/contract/operation.ts").Query<"counts", Schema.Struct<{
24
25
  queue: Schema.String;
25
26
  }>, Schema.Struct<{
26
27
  readonly activeCount: Schema.Number;
@@ -31,7 +32,7 @@ export declare function jobsPage<const TQueues extends readonly JobsQueue[]>(...
31
32
  JobsPayloadInvalid: typeof import("./schemas.ts").JobsPayloadInvalid;
32
33
  JobsQueueUnregistered: typeof import("./schemas.ts").JobsQueueUnregistered;
33
34
  JobsUnavailable: typeof import("./schemas.ts").JobsUnavailable;
34
- }>>, NoInfer<import("@shivaedev/effect-contract/operation.ts").Query<"failed", Schema.Struct<{
35
+ }>>, NoInfer<import("@shivaedev/contract/operation.ts").Query<"failed", Schema.Struct<{
35
36
  cursor: Schema.optionalKey<Schema.String>;
36
37
  limit: Schema.Number;
37
38
  queue: Schema.String;
@@ -54,7 +55,7 @@ export declare function jobsPage<const TQueues extends readonly JobsQueue[]>(...
54
55
  JobsPayloadInvalid: typeof import("./schemas.ts").JobsPayloadInvalid;
55
56
  JobsQueueUnregistered: typeof import("./schemas.ts").JobsQueueUnregistered;
56
57
  JobsUnavailable: typeof import("./schemas.ts").JobsUnavailable;
57
- }>>, NoInfer<import("@shivaedev/effect-contract/operation.ts").Query<"deadLettered", Schema.Struct<{
58
+ }>>, NoInfer<import("@shivaedev/contract/operation.ts").Query<"deadLettered", Schema.Struct<{
58
59
  cursor: Schema.optionalKey<Schema.String>;
59
60
  limit: Schema.Number;
60
61
  queue: Schema.String;
@@ -79,7 +80,7 @@ export declare function jobsPage<const TQueues extends readonly JobsQueue[]>(...
79
80
  JobsPayloadInvalid: typeof import("./schemas.ts").JobsPayloadInvalid;
80
81
  JobsQueueUnregistered: typeof import("./schemas.ts").JobsQueueUnregistered;
81
82
  JobsUnavailable: typeof import("./schemas.ts").JobsUnavailable;
82
- }>>, NoInfer<import("@shivaedev/effect-contract/operation.ts").Query<"job", Schema.Struct<{
83
+ }>>, NoInfer<import("@shivaedev/contract/operation.ts").Query<"job", Schema.Struct<{
83
84
  id: Schema.String;
84
85
  queue: Schema.String;
85
86
  }>, Schema.OptionFromNullOr<Schema.Union<Schema.Struct<{
@@ -98,7 +99,22 @@ export declare function jobsPage<const TQueues extends readonly JobsQueue[]>(...
98
99
  JobsPayloadInvalid: typeof import("./schemas.ts").JobsPayloadInvalid;
99
100
  JobsQueueUnregistered: typeof import("./schemas.ts").JobsQueueUnregistered;
100
101
  JobsUnavailable: typeof import("./schemas.ts").JobsUnavailable;
101
- }>>], readonly [], import("effect/rpc/Rpc").Rpc<"admin.jobs.$changes", Schema.Struct<{
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: TQueues[number]["schema"];
116
+ readonly queue: Schema.Literal<string>;
117
+ }>[]>>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.$changes", Schema.Struct<{
102
118
  queries: Schema.$Array<Schema.Union<readonly (Schema.Struct<{
103
119
  query: Schema.Literal<"counts">;
104
120
  payload: Schema.Struct<{
@@ -140,14 +156,28 @@ export declare function jobsPage<const TQueues extends readonly JobsQueue[]>(...
140
156
  }>]>>;
141
157
  }>, Schema.Struct<{
142
158
  readonly _tag: Schema.Literal<"Resync">;
143
- }>]>, Schema.Never>, Schema.Never, typeof import("../permissions.ts").AdminPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.counts", Schema.Struct<{
159
+ }>]>, Schema.Never>, Schema.Never, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.counts", Schema.Struct<{
144
160
  queue: Schema.String;
145
161
  }>, Schema.Struct<{
146
162
  readonly activeCount: Schema.Number;
147
163
  readonly failedCount: Schema.Number;
148
164
  readonly queuedCount: Schema.Number;
149
165
  readonly totalCount: Schema.Number;
150
- }>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("../permissions.ts").AdminPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.deadLettered", Schema.Struct<{
166
+ }>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.health", Schema.Void, Schema.Struct<{
167
+ readonly activeTotal: Schema.Number;
168
+ readonly deadLetteredTotal: Schema.Number;
169
+ readonly failedTotal: Schema.Number;
170
+ readonly jobs: Schema.$Array<Schema.Struct<{
171
+ readonly activeCount: Schema.Number;
172
+ readonly deadLetteredCount: Schema.Number;
173
+ readonly failedCount: Schema.Number;
174
+ readonly name: Schema.String;
175
+ readonly queuedCount: Schema.Number;
176
+ readonly readyCount: Schema.Number;
177
+ }>>;
178
+ readonly queuedTotal: Schema.Number;
179
+ readonly readyTotal: Schema.Number;
180
+ }>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.failed", Schema.Struct<{
151
181
  cursor: Schema.optionalKey<Schema.String>;
152
182
  limit: Schema.Number;
153
183
  queue: Schema.String;
@@ -164,11 +194,9 @@ export declare function jobsPage<const TQueues extends readonly JobsQueue[]>(...
164
194
  readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
165
195
  readonly data: TQueues[number]["schema"];
166
196
  readonly queue: Schema.Literal<string>;
167
- readonly sourceId: Schema.OptionFromNullOr<Schema.String>;
168
- readonly sourceOutput: Schema.Unknown;
169
197
  }>[]>>;
170
198
  readonly next: Schema.OptionFromNullOr<Schema.String>;
171
- }>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("../permissions.ts").AdminPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.failed", Schema.Struct<{
199
+ }>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof JobsPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.deadLettered", Schema.Struct<{
172
200
  cursor: Schema.optionalKey<Schema.String>;
173
201
  limit: Schema.Number;
174
202
  queue: Schema.String;
@@ -185,38 +213,11 @@ export declare function jobsPage<const TQueues extends readonly JobsQueue[]>(...
185
213
  readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
186
214
  readonly data: TQueues[number]["schema"];
187
215
  readonly queue: Schema.Literal<string>;
216
+ readonly sourceId: Schema.OptionFromNullOr<Schema.String>;
217
+ readonly sourceOutput: Schema.Unknown;
188
218
  }>[]>>;
189
219
  readonly next: Schema.OptionFromNullOr<Schema.String>;
190
- }>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("../permissions.ts").AdminPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.health", Schema.Void, Schema.Struct<{
191
- readonly activeTotal: Schema.Number;
192
- readonly deadLetteredTotal: Schema.Number;
193
- readonly failedTotal: Schema.Number;
194
- readonly jobs: Schema.$Array<Schema.Struct<{
195
- readonly activeCount: Schema.Number;
196
- readonly deadLetteredCount: Schema.Number;
197
- readonly failedCount: Schema.Number;
198
- readonly name: Schema.String;
199
- readonly queuedCount: Schema.Number;
200
- readonly readyCount: Schema.Number;
201
- }>>;
202
- readonly queuedTotal: Schema.Number;
203
- readonly readyTotal: Schema.Number;
204
- }>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("../permissions.ts").AdminPermission, never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.job", Schema.Struct<{
205
- id: Schema.String;
206
- queue: Schema.String;
207
- }>, Schema.OptionFromNullOr<Schema.Union<Schema.Struct<{
208
- readonly attempt: Schema.Number;
209
- readonly completedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
210
- readonly createdOn: Schema.DateTimeUtcFromString;
211
- readonly id: Schema.String;
212
- readonly output: Schema.Unknown;
213
- readonly retryCount: Schema.Number;
214
- readonly retryLimit: Schema.Number;
215
- readonly startedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
216
- readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
217
- readonly data: TQueues[number]["schema"];
218
- readonly queue: Schema.Literal<string>;
219
- }>[]>>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("../permissions.ts").AdminPermission, never>, readonly [], undefined>;
220
+ }>, Schema.Union<readonly (typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof JobsPermission, never>, readonly [], undefined>;
220
221
  } & {
221
222
  queues: TQueues;
222
223
  };
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/jobs/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAgD,KAAK,SAAS,EAA+C,MAAM,cAAc,CAAC;AAEzI,wBAAgB,QAAQ,CAAC,KAAK,CAAC,OAAO,SAAS,SAAS,SAAS,EAAE,EAAE,GAAG,MAAM,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCtF"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/jobs/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAgD,KAAK,SAAS,EAA+C,MAAM,cAAc,CAAC;AAEzI,wBAAgB,QAAQ,CAAC,KAAK,CAAC,OAAO,SAAS,SAAS,SAAS,EAAE,EAAE,GAAG,MAAM,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCtF"}
package/dist/jobs/page.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Schema } from "effect";
2
- import { contract } from "@shivaedev/effect-contract/contract.ts";
3
- import { query } from "@shivaedev/effect-contract/operation.ts";
2
+ import { contract } from "@shivaedev/contract/contract.ts";
3
+ import { query } from "@shivaedev/contract/operation.ts";
4
4
  import { adminPage } from "#page.ts";
5
+ import { JobsPermission } from "#permissions.ts";
5
6
  import { jobsKeys } from "./keys.js";
6
7
  import { deadLetteredSchema, JobsFailures, JobsHealth, jobPage, jobSchema, PageFields, QueueCounts } from "./schemas.js";
7
8
  export function jobsPage(...queues) {
@@ -38,6 +39,7 @@ export function jobsPage(...queues) {
38
39
  ],
39
40
  }),
40
41
  id: "jobs",
42
+ permission: JobsPermission,
41
43
  route: { path: "/admin/jobs", title: "Jobs" },
42
44
  });
43
45
  return Object.assign(page, { queues });
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/jobs/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,UAAU,EAAkB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEzI,MAAM,UAAU,QAAQ,CAA6C,GAAG,MAAe;IACtF,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAsB,EAAE,EAAE,CAAC,SAAS,CAA4B,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9G,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAsB,EAAE,EAAE,CAAC,kBAAkB,CAA4B,KAAK,CAAC,CAAC,CAAC,CAAC;IAChI,MAAM,IAAI,GAAG,SAAS,CAAC;QACtB,QAAQ,EAAE,QAAQ,CAAC,YAAY,EAAE;YAChC,OAAO,EAAE;gBACR,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC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