@shivaedev/admin 0.22.0 → 0.23.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.23.0 - 2026-11-06
4
+
5
+ ### Added
6
+
7
+ - Run schedules from the admin Jobs view on retry-enabled pages, guarded by the existing jobs management permission.
8
+
9
+ ## 0.22.1 - 2026-11-06
10
+
11
+ ### Changed
12
+
13
+ - Update `@shivaedev/contract` from 0.41.0 to 0.42.0.
14
+ - Update `@shivaedev/identity` from 0.29.0 to 0.29.1.
15
+ - Update `@shivaedev/react` from 0.44.2 to 0.45.0.
16
+
3
17
  ## 0.22.0 - 2026-11-06
4
18
 
5
19
  ### Breaking
package/README.md CHANGED
@@ -194,7 +194,7 @@ const jobs = bind(JobsPage.contract, Client);
194
194
  <JobsView api={jobs} queues={JobsPage.queues} />;
195
195
  ```
196
196
 
197
- For a retry-enabled page, pass `retry={Client.runtime.fn(jobs.retry.run)}`. The view offers retry on failed originals; the server also requires `jobs.retry`. Omitting `retry` leaves the view read-only. Keep the view inside the application's admin shell and protect its route with `JobsPage.route.permission`.
197
+ For a retry-enabled page, pass `retry={Client.runtime.fn(jobs.retry.run)}`. The view offers retry on failed originals; the server also requires `jobs.retry`. Omit both action props for a read-only view. Keep the view inside the application's admin shell and protect its route with `JobsPage.route.permission`.
198
198
 
199
199
  Queue and schedule labels replace internal names in the queue picker and selected queue heading. A queue's `subject` columns select fields from its masked inspection payload; numbers display as decoded values, and missing fields display `—`. Native `Redacted` fields and sensitive keys remain masked. Failed and dead-lettered jobs use the same subject columns, with dead-letter copies under their source queue's tab rather than separate queue choices. String-only queue lists remain supported and show internal names without subject columns. `defineQueue` checks subject field names against its payload Schema; browser-safe declarations can use `SubjectColumn<typeof PayloadSchema>` from `@shivaedev/jobs/display.ts` to check columns before sharing them with the server.
200
200
 
@@ -213,10 +213,20 @@ const registration = registerAdmin(Admin, {
213
213
  });
214
214
  ```
215
215
 
216
- This variant adds only `admin.jobs.retry`, taking `{ queue, id }` and returning void. It requires `ReadJobs` (`jobs.read`) through the page middleware and `RetryJobs` (`jobs.retry`) from `@shivaedev/admin/permissions.ts` in the handler. A caller with only `jobs.read` receives `Forbidden` and the job stays failed. 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.
216
+ This variant adds `admin.jobs.retry`, taking `{ queue, id }` and returning void. It requires `ReadJobs` (`jobs.read`) through the page middleware and `RetryJobs` (`jobs.retry`) from `@shivaedev/admin/permissions.ts` in the handler. A caller with only `jobs.read` receives `Forbidden` and the job stays failed. 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.
217
217
 
218
218
  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.
219
219
 
220
+ ### Run a schedule now
221
+
222
+ The retry-enabled page also exposes `admin.jobs.runScheduleNow`, taking `{ queue }` and returning `Option<string>` with the enqueued run ID. Declare a schedule as `{ name, label?, scheduleOptions?: { key? } }` without a payload Schema, or pass its `defineSchedule` definition. The handler calls the jobs service's `runScheduleNow` and requires the same `ReadJobs` and `RetryJobs` permissions as retry. It rejects queues and schedules omitted from the page with `JobsQueueUnregistered`. The schedule's normal handler processes the run and its timetable stays unchanged.
223
+
224
+ Pass the page's schedule declarations and bound action to show **Run now** for a selected schedule:
225
+
226
+ ```tsx
227
+ <JobsView api={jobs} queues={JobsPage.queues} schedules={JobsPage.schedules} runScheduleNow={Client.runtime.fn(jobs.runScheduleNow.run)} />;
228
+ ```
229
+
220
230
  ### Built-in Users page
221
231
 
222
232
  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)` from `@shivaedev/admin/server/usersHandlers.ts`. The handlers require identity's `UserDirectory` service. Provide `betterAuthUserDirectory(AppAccess, authOptions)` from `@shivaedev/identity/server/better-auth/adapters/userDirectory.ts` with the same options used by `betterAuthMount`. Identity owns the PostgreSQL reads and role writes, including custom auth mappings. For example, `authOptions.user.modelName: "users"` makes the Users view open and page through `users`; mapped name, email, role and creation-time columns are used as well. The page reads identity's exported `userKeys.list` collection, so role changes refresh open user lists.
@@ -1,11 +1,15 @@
1
1
  import type { QueueDisplay } from "@shivaedev/jobs/display.ts";
2
- import type { JobsViewClient, RetryJob } from "./jobsTypes.ts";
2
+ import type { JobsViewClient, RetryJob, RunScheduleNow } from "./jobsTypes.ts";
3
3
  export interface JobsViewProps {
4
4
  readonly api: JobsViewClient;
5
5
  readonly queues: readonly (string | QueueDisplay)[];
6
6
  readonly retry?: RetryJob | undefined;
7
+ readonly runScheduleNow?: RunScheduleNow | undefined;
8
+ readonly schedules?: readonly {
9
+ readonly name: string;
10
+ }[];
7
11
  }
8
- export declare function JobsView({ api, queues, retry }: JobsViewProps): import("react").DetailedReactHTMLElement<{
12
+ export declare function JobsView({ api, queues, retry, schedules, runScheduleNow }: JobsViewProps): import("react").DetailedReactHTMLElement<{
9
13
  role: "alert";
10
14
  }, HTMLElement> | import("react").DetailedReactHTMLElement<{
11
15
  className: string;
@@ -1 +1 @@
1
- {"version":3,"file":"JobsView.d.ts","sourceRoot":"","sources":["../../../src/client/adapters/JobsView.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI/D,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/D,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,YAAY,CAAC,EAAE,CAAC;IACpD,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CACtC;AAED,wBAAgB,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,aAAa;;;;gBAsB7D"}
1
+ {"version":3,"file":"JobsView.d.ts","sourceRoot":"","sources":["../../../src/client/adapters/JobsView.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI/D,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG/E,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,YAAY,CAAC,EAAE,CAAC;IACpD,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1D;AAED,wBAAgB,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,EAAE,aAAa;;;;gBAyBxF"}
@@ -3,7 +3,8 @@ import { createElement, useState } from "react";
3
3
  import { useQuery } from "@shivaedev/react/client/resultState.ts";
4
4
  import { JobsHealthMetrics } from "./JobsMetrics.js";
5
5
  import { JobsQueuePicker, JobsQueueView } from "./JobsQueueView.js";
6
- export function JobsView({ api, queues, retry }) {
6
+ import { RunScheduleControl } from "./RunScheduleControl.js";
7
+ export function JobsView({ api, queues, retry, schedules, runScheduleNow }) {
7
8
  const definitions = queues.map((definition) => (typeof definition === "string" ? { name: definition } : definition));
8
9
  const [name, selectQueue] = useState(definitions[0]?.name ?? "");
9
10
  const queue = definitions.find((candidate) => candidate.name === name);
@@ -14,6 +15,8 @@ export function JobsView({ api, queues, retry }) {
14
15
  }
15
16
  return createElement("div", { className: "min-w-0 space-y-8" }, createElement(JobsHealthMetrics, { state: health }), queue === undefined
16
17
  ? createElement("p", null, "No queues or schedules registered.")
17
- : createElement("div", { className: "min-w-0 space-y-6" }, createElement(JobsQueuePicker, { queues: definitions, select: selectQueue, value: name }), createElement(JobsQueueView, { api, key: name, label: queue.label, queue: name, retry, subject: queue.subject })));
18
+ : createElement("div", { className: "min-w-0 space-y-6" }, createElement(JobsQueuePicker, { queues: definitions, select: selectQueue, value: name }), runScheduleNow !== undefined && schedules?.some((schedule) => schedule.name === name)
19
+ ? createElement(RunScheduleControl, { key: `run-${name}`, queue: name, run: runScheduleNow })
20
+ : null, createElement(JobsQueueView, { api, key: name, label: queue.label, queue: name, retry, subject: queue.subject })));
18
21
  }
19
22
  //# sourceMappingURL=JobsView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JobsView.js","sourceRoot":"","sources":["../../../src/client/adapters/JobsView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAmB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAC;AASrE,MAAM,UAAU,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAiB;IAC7D,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,OAAO,UAAU,KAAK,QAAQ,C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AAK,CAAC,OAAO,EAAE,CAAC,CAChH,CACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { RunScheduleNow } from "./jobsTypes.ts";
2
+ export declare function RunScheduleControl({ queue, run }: {
3
+ readonly queue: string;
4
+ readonly run: RunScheduleNow;
5
+ }): import("react").JSX.Element;
6
+ //# sourceMappingURL=RunScheduleControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunScheduleControl.d.ts","sourceRoot":"","sources":["../../../src/client/adapters/RunScheduleControl.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAA;CAAE,+BAa1G"}
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Option } from "effect";
3
+ import { useAction } from "@shivaedev/react/client/resultState.ts";
4
+ import { JobButton } from "./JobButton.js";
5
+ export function RunScheduleControl({ queue, run }) {
6
+ const action = useAction(run);
7
+ const failure = Option.isSome(action.cause) ? _jsx("p", { role: "alert", children: "Could not run this schedule." }) : null;
8
+ const status = Option.isSome(action.data) ? _jsx("p", { role: "status", children: Option.isSome(action.data.value) ? "Run requested." : "No run enqueued." }) : null;
9
+ return (_jsxs("div", { className: "space-y-2", children: [_jsx(JobButton, { disabled: action.pending, onClick: () => action.dispatch({ queue }), children: action.pending ? "Requesting…" : "Run now" }), failure, status] }));
10
+ }
11
+ //# sourceMappingURL=RunScheduleControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunScheduleControl.js","sourceRoot":"","sources":["../../../src/client/adapters/RunScheduleControl.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAC;AAG5C,MAAM,UAAU,kBAAkB,CAAC,EAAE,KAAK,EAAE,GAAG,EAA4D;IAC1G,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAG,IAAI,EAAC,OAAO,6CAAiC,CAAC,CAAC,CAAC,IAAI,CAAC;IACtG,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAG,IAAI,EAAC,QAAQ,YAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,kBAAkB,GAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACnJ,OAAO,CACN,eAAK,SAAS,EAAC,WAAW,aACzB,KAAC,SAAS,IAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,YAC5E,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,GAChC,EACX,OAAO,EACP,MAAM,IACF,CACN,CAAC;AACH,CAAC"}
@@ -31,5 +31,8 @@ export interface JobsViewClient {
31
31
  readonly job: Query<JobId, Option.Option<Job>>;
32
32
  }
33
33
  export type RetryJob = Atom.AtomResultFn<JobId, void, unknown>;
34
+ export type RunScheduleNow = Atom.AtomResultFn<{
35
+ readonly queue: string;
36
+ }, Option.Option<string>, unknown>;
34
37
  export {};
35
38
  //# sourceMappingURL=jobsTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file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C;CAC/C;AACD,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAE/D,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC"}
@@ -3,6 +3,9 @@ import type { QueueDisplay } from "@shivaedev/jobs/display.ts";
3
3
  import type { JobsQueue } from "./schemas.ts";
4
4
  export type JobsEntry = (JobsQueue | {
5
5
  readonly name: string;
6
+ readonly scheduleOptions?: {
7
+ readonly key?: string;
8
+ };
6
9
  }) & QueueDisplay;
7
10
  export type JobsPayload<TEntry extends JobsEntry> = [TEntry] extends [never] ? typeof Schema.Never : TEntry extends JobsQueue ? TEntry["schema"] : typeof Schema.Null;
8
11
  export declare function jobsQueue<TEntry extends JobsEntry>(entry: TEntry): {
@@ -1 +1 @@
1
- {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/jobs/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG,CAAC,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,YAAY,CAAC;AAE/E,MAAM,MAAM,WAAW,CAAC,MAAM,SAAS,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GACzE,OAAO,MAAM,CAAC,KAAK,GACnB,MAAM,SAAS,SAAS,GACvB,MAAM,CAAC,QAAQ,CAAC,GAChB,OAAO,MAAM,CAAC,IAAI,CAAC;AAEvB,wBAAgB,SAAS,CAAC,MAAM,SAAS,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/jobs/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG,CAAC,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;QAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,GAAG,YAAY,CAAC;AAErI,MAAM,MAAM,WAAW,CAAC,MAAM,SAAS,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GACzE,OAAO,MAAM,CAAC,KAAK,GACnB,MAAM,SAAS,SAAS,GACvB,MAAM,CAAC,QAAQ,CAAC,GAChB,OAAO,MAAM,CAAC,IAAI,CAAC;AAEvB,wBAAgB,SAAS,CAAC,MAAM,SAAS,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC"}
@@ -319,7 +319,7 @@ export declare function jobsPage<const TQueues extends readonly JobsEntry[]>(...
319
319
  "~ClientError": never;
320
320
  error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
321
321
  requiredForClient: false;
322
- }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.failed", Schema.Struct<{
322
+ }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.deadLettered", Schema.Struct<{
323
323
  cursor: Schema.optionalKey<Schema.String>;
324
324
  limit: Schema.Number;
325
325
  queue: Schema.String;
@@ -339,6 +339,12 @@ export declare function jobsPage<const TQueues extends readonly JobsEntry[]>(...
339
339
  readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
340
340
  readonly data: Schema.Unknown;
341
341
  readonly queue: Schema.Literal<string>;
342
+ readonly sourceId: Schema.OptionFromNullOr<Schema.String>;
343
+ readonly sourceOutput: Schema.NullOr<Schema.Struct<{
344
+ readonly _tag: Schema.withDecodingDefaultKey<Schema.String, never>;
345
+ readonly message: Schema.decodeTo<Schema.String, Schema.String, never, never>;
346
+ }>>;
347
+ readonly sourceQueue: Schema.Literal<string>;
342
348
  }>[]>>;
343
349
  readonly next: Schema.OptionFromNullOr<Schema.String>;
344
350
  }>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("#jobs/schemas.ts").JobsUnavailable | typeof import("#jobs/schemas.ts").JobsPayloadInvalid | typeof import("#jobs/schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: Effect.Effect<A, E, R>, request: {
@@ -349,7 +355,7 @@ export declare function jobsPage<const TQueues extends readonly JobsEntry[]>(...
349
355
  "~ClientError": never;
350
356
  error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
351
357
  requiredForClient: false;
352
- }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.deadLettered", Schema.Struct<{
358
+ }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.failed", Schema.Struct<{
353
359
  cursor: Schema.optionalKey<Schema.String>;
354
360
  limit: Schema.Number;
355
361
  queue: Schema.String;
@@ -369,12 +375,6 @@ export declare function jobsPage<const TQueues extends readonly JobsEntry[]>(...
369
375
  readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
370
376
  readonly data: Schema.Unknown;
371
377
  readonly queue: Schema.Literal<string>;
372
- readonly sourceId: Schema.OptionFromNullOr<Schema.String>;
373
- readonly sourceOutput: Schema.NullOr<Schema.Struct<{
374
- readonly _tag: Schema.withDecodingDefaultKey<Schema.String, never>;
375
- readonly message: Schema.decodeTo<Schema.String, Schema.String, never, never>;
376
- }>>;
377
- readonly sourceQueue: Schema.Literal<string>;
378
378
  }>[]>>;
379
379
  readonly next: Schema.OptionFromNullOr<Schema.String>;
380
380
  }>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("#jobs/schemas.ts").JobsUnavailable | typeof import("#jobs/schemas.ts").JobsPayloadInvalid | typeof import("#jobs/schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: Effect.Effect<A, E, R>, request: {
@@ -385,6 +385,28 @@ export declare function jobsPage<const TQueues extends readonly JobsEntry[]>(...
385
385
  "~ClientError": never;
386
386
  error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
387
387
  requiredForClient: false;
388
+ }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.health", Schema.Void, Schema.Struct<{
389
+ readonly activeTotal: Schema.Number;
390
+ readonly deadLetteredTotal: Schema.Number;
391
+ readonly failedTotal: Schema.Number;
392
+ readonly jobs: Schema.$Array<Schema.Struct<{
393
+ readonly activeCount: Schema.Number;
394
+ readonly deadLetteredCount: Schema.Number;
395
+ readonly failedCount: Schema.Number;
396
+ readonly name: Schema.String;
397
+ readonly queuedCount: Schema.Number;
398
+ readonly readyCount: Schema.Number;
399
+ }>>;
400
+ readonly queuedTotal: Schema.Number;
401
+ readonly readyTotal: Schema.Number;
402
+ }>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("#jobs/schemas.ts").JobsUnavailable | typeof import("#jobs/schemas.ts").JobsPayloadInvalid | typeof import("#jobs/schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: Effect.Effect<A, E, R>, request: {
403
+ readonly rpc: import("effect/rpc/Rpc").Any;
404
+ readonly payload: unknown;
405
+ }) => Effect.Effect<A, E | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy | import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied | import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired | import("effect/Types").unhandled, R>> & {
406
+ "~effect/rpc/RpcMiddleware": "~effect/rpc/RpcMiddleware";
407
+ "~ClientError": never;
408
+ error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
409
+ requiredForClient: false;
388
410
  }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.job", Schema.Struct<{
389
411
  id: Schema.String;
390
412
  queue: Schema.String;
@@ -411,28 +433,6 @@ export declare function jobsPage<const TQueues extends readonly JobsEntry[]>(...
411
433
  "~ClientError": never;
412
434
  error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
413
435
  requiredForClient: false;
414
- }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.health", Schema.Void, Schema.Struct<{
415
- readonly activeTotal: Schema.Number;
416
- readonly deadLetteredTotal: Schema.Number;
417
- readonly failedTotal: Schema.Number;
418
- readonly jobs: Schema.$Array<Schema.Struct<{
419
- readonly activeCount: Schema.Number;
420
- readonly deadLetteredCount: Schema.Number;
421
- readonly failedCount: Schema.Number;
422
- readonly name: Schema.String;
423
- readonly queuedCount: Schema.Number;
424
- readonly readyCount: Schema.Number;
425
- }>>;
426
- readonly queuedTotal: Schema.Number;
427
- readonly readyTotal: Schema.Number;
428
- }>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("#jobs/schemas.ts").JobsUnavailable | typeof import("#jobs/schemas.ts").JobsPayloadInvalid | typeof import("#jobs/schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: Effect.Effect<A, E, R>, request: {
429
- readonly rpc: import("effect/rpc/Rpc").Any;
430
- readonly payload: unknown;
431
- }) => Effect.Effect<A, E | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy | import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied | import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired | import("effect/Types").unhandled, R>> & {
432
- "~effect/rpc/RpcMiddleware": "~effect/rpc/RpcMiddleware";
433
- "~ClientError": never;
434
- error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
435
- requiredForClient: false;
436
436
  }), never>, readonly [], undefined>;
437
437
  } & {
438
438
  queues: TQueues;
@@ -187,33 +187,15 @@ export declare function jobsPageWithRetry<const TQueues extends readonly JobsEnt
187
187
  readonly JobsUnavailable: typeof import("./schemas.ts").JobsUnavailable;
188
188
  readonly Forbidden: typeof Forbidden;
189
189
  readonly JobsNotFailed: typeof JobsNotFailed;
190
- }>>], import("effect/rpc/Rpc").Rpc<"admin.jobs.job", Schema.Struct<{
191
- id: Schema.String;
190
+ }>>, NoInfer<import("@shivaedev/contract/operation.ts").Command<"runScheduleNow", Schema.Struct<{
192
191
  queue: Schema.String;
193
- }>, Schema.OptionFromNullOr<Schema.Union<Schema.Struct<{
194
- readonly attempt: Schema.Number;
195
- readonly completedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
196
- readonly createdOn: Schema.DateTimeUtcFromString;
197
- readonly id: Schema.String;
198
- readonly output: Schema.NullOr<Schema.Struct<{
199
- readonly _tag: Schema.withDecodingDefaultKey<Schema.String, never>;
200
- readonly message: Schema.decodeTo<Schema.String, Schema.String, never, never>;
201
- }>>;
202
- readonly retryCount: Schema.Number;
203
- readonly retryLimit: Schema.Number;
204
- readonly startedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
205
- readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
206
- readonly data: Schema.Unknown;
207
- readonly queue: Schema.Literal<string>;
208
- }>[]>>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: import("effect/Effect").Effect<A, E, R>, request: {
209
- readonly rpc: import("effect/rpc/Rpc").Any;
210
- readonly payload: unknown;
211
- }) => import("effect/Effect").Effect<A, E | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy | import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied | import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired | import("effect/Types").unhandled, R>> & {
212
- "~effect/rpc/RpcMiddleware": "~effect/rpc/RpcMiddleware";
213
- "~ClientError": never;
214
- error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
215
- requiredForClient: false;
216
- }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.$changes", Schema.Struct<{
192
+ }>, Schema.OptionFromNullOr<Schema.String>, {
193
+ readonly BadRequest: typeof import("@shivaedev/errors/taxonomy.ts").BadRequest;
194
+ readonly JobsPayloadInvalid: typeof import("./schemas.ts").JobsPayloadInvalid;
195
+ readonly JobsQueueUnregistered: typeof import("./schemas.ts").JobsQueueUnregistered;
196
+ readonly JobsUnavailable: typeof import("./schemas.ts").JobsUnavailable;
197
+ readonly Forbidden: typeof Forbidden;
198
+ }>>], import("effect/rpc/Rpc").Rpc<"admin.jobs.$changes", Schema.Struct<{
217
199
  queries: Schema.$Array<Schema.Union<readonly (Schema.Struct<{
218
200
  query: Schema.Literal<"counts">;
219
201
  payload: Schema.Struct<{
@@ -370,7 +352,12 @@ export declare function jobsPageWithRetry<const TQueues extends readonly JobsEnt
370
352
  "~ClientError": never;
371
353
  error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
372
354
  requiredForClient: false;
373
- }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.counts", Schema.Struct<{
355
+ }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.retry", Schema.Struct<{
356
+ id: Schema.String;
357
+ queue: Schema.String;
358
+ }>, Schema.Void, Schema.Union<readonly (typeof Forbidden | typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | 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.runScheduleNow", Schema.Struct<{
359
+ queue: Schema.String;
360
+ }>, Schema.OptionFromNullOr<Schema.String>, Schema.Union<readonly (typeof Forbidden | typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | 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.counts", Schema.Struct<{
374
361
  queue: Schema.String;
375
362
  }>, Schema.Struct<{
376
363
  readonly activeCount: Schema.Number;
@@ -385,29 +372,7 @@ export declare function jobsPageWithRetry<const TQueues extends readonly JobsEnt
385
372
  "~ClientError": never;
386
373
  error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
387
374
  requiredForClient: false;
388
- }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.health", Schema.Void, Schema.Struct<{
389
- readonly activeTotal: Schema.Number;
390
- readonly deadLetteredTotal: Schema.Number;
391
- readonly failedTotal: Schema.Number;
392
- readonly jobs: Schema.$Array<Schema.Struct<{
393
- readonly activeCount: Schema.Number;
394
- readonly deadLetteredCount: Schema.Number;
395
- readonly failedCount: Schema.Number;
396
- readonly name: Schema.String;
397
- readonly queuedCount: Schema.Number;
398
- readonly readyCount: Schema.Number;
399
- }>>;
400
- readonly queuedTotal: Schema.Number;
401
- readonly readyTotal: Schema.Number;
402
- }>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: import("effect/Effect").Effect<A, E, R>, request: {
403
- readonly rpc: import("effect/rpc/Rpc").Any;
404
- readonly payload: unknown;
405
- }) => import("effect/Effect").Effect<A, E | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy | import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied | import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired | import("effect/Types").unhandled, R>> & {
406
- "~effect/rpc/RpcMiddleware": "~effect/rpc/RpcMiddleware";
407
- "~ClientError": never;
408
- error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
409
- requiredForClient: false;
410
- }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.failed", Schema.Struct<{
375
+ }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.deadLettered", Schema.Struct<{
411
376
  cursor: Schema.optionalKey<Schema.String>;
412
377
  limit: Schema.Number;
413
378
  queue: Schema.String;
@@ -427,6 +392,12 @@ export declare function jobsPageWithRetry<const TQueues extends readonly JobsEnt
427
392
  readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
428
393
  readonly data: Schema.Unknown;
429
394
  readonly queue: Schema.Literal<string>;
395
+ readonly sourceId: Schema.OptionFromNullOr<Schema.String>;
396
+ readonly sourceOutput: Schema.NullOr<Schema.Struct<{
397
+ readonly _tag: Schema.withDecodingDefaultKey<Schema.String, never>;
398
+ readonly message: Schema.decodeTo<Schema.String, Schema.String, never, never>;
399
+ }>>;
400
+ readonly sourceQueue: Schema.Literal<string>;
430
401
  }>[]>>;
431
402
  readonly next: Schema.OptionFromNullOr<Schema.String>;
432
403
  }>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: import("effect/Effect").Effect<A, E, R>, request: {
@@ -437,7 +408,7 @@ export declare function jobsPageWithRetry<const TQueues extends readonly JobsEnt
437
408
  "~ClientError": never;
438
409
  error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
439
410
  requiredForClient: false;
440
- }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.deadLettered", Schema.Struct<{
411
+ }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.failed", Schema.Struct<{
441
412
  cursor: Schema.optionalKey<Schema.String>;
442
413
  limit: Schema.Number;
443
414
  queue: Schema.String;
@@ -457,12 +428,6 @@ export declare function jobsPageWithRetry<const TQueues extends readonly JobsEnt
457
428
  readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
458
429
  readonly data: Schema.Unknown;
459
430
  readonly queue: Schema.Literal<string>;
460
- readonly sourceId: Schema.OptionFromNullOr<Schema.String>;
461
- readonly sourceOutput: Schema.NullOr<Schema.Struct<{
462
- readonly _tag: Schema.withDecodingDefaultKey<Schema.String, never>;
463
- readonly message: Schema.decodeTo<Schema.String, Schema.String, never, never>;
464
- }>>;
465
- readonly sourceQueue: Schema.Literal<string>;
466
431
  }>[]>>;
467
432
  readonly next: Schema.OptionFromNullOr<Schema.String>;
468
433
  }>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: import("effect/Effect").Effect<A, E, R>, request: {
@@ -473,12 +438,58 @@ export declare function jobsPageWithRetry<const TQueues extends readonly JobsEnt
473
438
  "~ClientError": never;
474
439
  error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
475
440
  requiredForClient: false;
476
- }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.retry", Schema.Struct<{
441
+ }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.health", Schema.Void, Schema.Struct<{
442
+ readonly activeTotal: Schema.Number;
443
+ readonly deadLetteredTotal: Schema.Number;
444
+ readonly failedTotal: Schema.Number;
445
+ readonly jobs: Schema.$Array<Schema.Struct<{
446
+ readonly activeCount: Schema.Number;
447
+ readonly deadLetteredCount: Schema.Number;
448
+ readonly failedCount: Schema.Number;
449
+ readonly name: Schema.String;
450
+ readonly queuedCount: Schema.Number;
451
+ readonly readyCount: Schema.Number;
452
+ }>>;
453
+ readonly queuedTotal: Schema.Number;
454
+ readonly readyTotal: Schema.Number;
455
+ }>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: import("effect/Effect").Effect<A, E, R>, request: {
456
+ readonly rpc: import("effect/rpc/Rpc").Any;
457
+ readonly payload: unknown;
458
+ }) => import("effect/Effect").Effect<A, E | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy | import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied | import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired | import("effect/Types").unhandled, R>> & {
459
+ "~effect/rpc/RpcMiddleware": "~effect/rpc/RpcMiddleware";
460
+ "~ClientError": never;
461
+ error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
462
+ requiredForClient: false;
463
+ }), never> | import("effect/rpc/Rpc").Rpc<"admin.jobs.job", Schema.Struct<{
477
464
  id: Schema.String;
478
465
  queue: Schema.String;
479
- }>, Schema.Void, Schema.Union<readonly (typeof Forbidden | typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered | typeof JobsNotFailed)[]>, typeof JobsPermission, never>, readonly [], undefined>;
466
+ }>, Schema.OptionFromNullOr<Schema.Union<Schema.Struct<{
467
+ readonly attempt: Schema.Number;
468
+ readonly completedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
469
+ readonly createdOn: Schema.DateTimeUtcFromString;
470
+ readonly id: Schema.String;
471
+ readonly output: Schema.NullOr<Schema.Struct<{
472
+ readonly _tag: Schema.withDecodingDefaultKey<Schema.String, never>;
473
+ readonly message: Schema.decodeTo<Schema.String, Schema.String, never, never>;
474
+ }>>;
475
+ readonly retryCount: Schema.Number;
476
+ readonly retryLimit: Schema.Number;
477
+ readonly startedOn: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
478
+ readonly state: Schema.Literals<readonly ["created", "retry", "active", "completed", "cancelled", "failed"]>;
479
+ readonly data: Schema.Unknown;
480
+ readonly queue: Schema.Literal<string>;
481
+ }>[]>>, Schema.Union<readonly [Schema.Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").BadRequest | typeof import("./schemas.ts").JobsUnavailable | typeof import("./schemas.ts").JobsPayloadInvalid | typeof import("./schemas.ts").JobsQueueUnregistered)[]>, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>, typeof JobsPermission | (import("effect/Context").Reference<<A, E, R>(effect: import("effect/Effect").Effect<A, E, R>, request: {
482
+ readonly rpc: import("effect/rpc/Rpc").Any;
483
+ readonly payload: unknown;
484
+ }) => import("effect/Effect").Effect<A, E | import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy | import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied | import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired | import("effect/Types").unhandled, R>> & {
485
+ "~effect/rpc/RpcMiddleware": "~effect/rpc/RpcMiddleware";
486
+ "~ClientError": never;
487
+ error: Schema.Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
488
+ requiredForClient: false;
489
+ }), never>, readonly [], undefined>;
480
490
  } & {
481
491
  queues: TQueues;
492
+ schedules: JobsEntry[];
482
493
  };
483
494
  export {};
484
495
  //# sourceMappingURL=retryPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"retryPage.d.ts","sourceRoot":"","sources":["../../src/jobs/retryPage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AA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AAE,GAAG,MAAM,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqC/F"}
@@ -28,12 +28,23 @@ export function jobsPageWithRetry(...queues) {
28
28
  payload: { id: Schema.String, queue: Schema.String },
29
29
  rejections: { ...JobsFailures, Forbidden, JobsNotFailed },
30
30
  }),
31
+ command("runScheduleNow", {
32
+ invalidates: ({ queue }) => [
33
+ jobsKeys.health.list,
34
+ jobsKeys.counts.item(queue),
35
+ jobsKeys.failed.item(queue),
36
+ jobsKeys.deadLettered.item(queue),
37
+ ],
38
+ payload: { queue: Schema.String },
39
+ rejections: { ...JobsFailures, Forbidden },
40
+ success: Schema.OptionFromNullOr(Schema.String),
41
+ }),
31
42
  ],
32
43
  queries: page.contract.declaration.queries,
33
44
  }),
34
45
  id: page.id,
35
46
  permission: JobsPermission,
36
47
  route: page.route,
37
- }), { queues });
48
+ }), { queues, schedules: queues.filter((entry) => !("schema" in entry)) });
38
49
  }
39
50
  //# sourceMappingURL=retryPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retryPage.js","sourceRoot":"","sources":["../../src/jobs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I,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO;SAC1C,CAAC;QACF,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,UAAU,EAAE,cAAc;QAC1B,KAAK,EAAE,IAAI,CAAC,KAAK;KACjB,CAAC,EACF,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC,EAAE,CACrE,CAAC;AACH,CAAC"}
@@ -3,5 +3,5 @@ import { SessionUser } from "@shivaedev/identity/identity.ts";
3
3
  import type { PgBossService } from "@shivaedev/jobs/server/service.ts";
4
4
  import { type JobsEntry, type JobsPayload } from "#jobs/entry.ts";
5
5
  import { type jobsPageWithRetry } from "#jobs/retryPage.ts";
6
- export declare function jobsHandlersWithRetry<const TQueues extends readonly JobsEntry[], TService>(page: ReturnType<typeof jobsPageWithRetry<TQueues>>, service: Context.Service<TService, PgBossService>): import("effect/Layer").Layer<import("effect/rpc/Rpc").Handler<"admin.jobs.counts"> | import("effect/rpc/Rpc").Handler<"admin.jobs.deadLettered"> | import("effect/rpc/Rpc").Handler<"admin.jobs.failed"> | import("effect/rpc/Rpc").Handler<"admin.jobs.health"> | import("effect/rpc/Rpc").Handler<"admin.jobs.job"> | import("effect/rpc/Rpc").Handler<"admin.jobs.retry">, never, Exclude<Exclude<TService, import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope> | Exclude<Exclude<TService, import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope> | Exclude<Exclude<TService, import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope> | Exclude<Exclude<JobsPayload<TQueues[number]>["DecodingServices"], import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope> | Exclude<Exclude<JobsPayload<TQueues[number]>["DecodingServices"], import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope>>;
6
+ export declare function jobsHandlersWithRetry<const TQueues extends readonly JobsEntry[], TService>(page: ReturnType<typeof jobsPageWithRetry<TQueues>>, service: Context.Service<TService, PgBossService>): import("effect/Layer").Layer<import("effect/rpc/Rpc").Handler<"admin.jobs.counts"> | import("effect/rpc/Rpc").Handler<"admin.jobs.deadLettered"> | import("effect/rpc/Rpc").Handler<"admin.jobs.failed"> | import("effect/rpc/Rpc").Handler<"admin.jobs.health"> | import("effect/rpc/Rpc").Handler<"admin.jobs.job"> | import("effect/rpc/Rpc").Handler<"admin.jobs.retry"> | import("effect/rpc/Rpc").Handler<"admin.jobs.runScheduleNow">, never, Exclude<Exclude<TService, import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope> | Exclude<Exclude<TService, import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope> | Exclude<Exclude<TService, import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope> | Exclude<Exclude<TService, import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope> | Exclude<Exclude<JobsPayload<TQueues[number]>["DecodingServices"], import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope> | Exclude<Exclude<JobsPayload<TQueues[number]>["DecodingServices"], import("@shivaedev/identity/identity.ts").Identity | SessionUser>, import("effect/Scope").Scope>>;
7
7
  //# sourceMappingURL=jobsHandlersWithRetry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jobsHandlersWithRetry.d.ts","sourceRoot":"","sources":["../../src/server/jobsHandlersWithRetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAkB,MAAM,QAAQ,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAa,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAK3E,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,OAAO,SAAS,SAAS,SAAS,EAAE,EAAE,QAAQ,EACzF,IAAI,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC,EACnD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,wjCAsBjD"}
1
+ {"version":3,"file":"jobsHandlersWithRetry.d.ts","sourceRoot":"","sources":["../../src/server/jobsHandlersWithRetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAkB,MAAM,QAAQ,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAa,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAK3E,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,OAAO,SAAS,SAAS,SAAS,EAAE,EAAE,QAAQ,EACzF,IAAI,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC,EACnD,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,qvCAoCjD"}
@@ -25,6 +25,16 @@ export function jobsHandlersWithRetry(page, service) {
25
25
  }
26
26
  yield* jobsFailures(runtime.retry(definition, id));
27
27
  }),
28
+ "admin.jobs.runScheduleNow": ({ queue }) => Effect.gen(function* () {
29
+ yield* requirePermission(yield* SessionUser, RetryJobs);
30
+ const entries = page.queues;
31
+ const entry = entries.find((candidate) => candidate.name === queue && !("schema" in candidate));
32
+ if (entry === undefined || "schema" in entry) {
33
+ return yield* Effect.fail(new JobsQueueUnregistered({ queue }));
34
+ }
35
+ const runtime = yield* service;
36
+ return yield* runtime.runScheduleNow({ name: entry.name, scheduleOptions: entry.scheduleOptions ?? {} }).pipe(Effect.catchTag("PgBossNotFoundError", () => Effect.fail(new JobsQueueUnregistered({ queue }))), Effect.catchTag("PgBossError", (error) => jobsFailures(Effect.fail(error))));
37
+ }),
28
38
  });
29
39
  }
30
40
  //# sourceMappingURL=jobsHandlersWithRetry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jobsHandlersWithRetry.js","sourceRoot":"","sources":["../../src/server/jobsHandlersWithRetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAoC,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAA0B,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,MAAM,UAAU,qBAAqB,CACpC,IAAmD,EACnD,OAAiD;IAEjD,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC;QACxC,GAAG,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC;QAClC,kBAAkB,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CACrC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YACnB,KAAK,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;YACxD,MAAM,OAAO,GAA+B,IA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G,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,qBAAqB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAC/F,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAC3E,CAAC;QACH,CAAC,CAAC;KACH,CAAC,CAAC;AACJ,CAAC"}
@@ -105,7 +105,9 @@ export declare const SessionsPage: import("#page.ts").AdminPage & {
105
105
  "~ClientError": never;
106
106
  error: import("effect/Schema").Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
107
107
  requiredForClient: false;
108
- }), never> | import("effect/rpc/Rpc").Rpc<"identity.sessions.list", import("effect/Schema").Struct<{
108
+ }), never> | import("effect/rpc/Rpc").Rpc<"identity.sessions.revoke", import("effect/Schema").Struct<{
109
+ id: import("effect/Schema").String;
110
+ }>, import("effect/Schema").Void, import("effect/Schema").Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").NotFound | typeof import("@shivaedev/errors/taxonomy.ts").Forbidden | typeof import("@shivaedev/errors/taxonomy.ts").AuthUnavailable)[]>, typeof SessionsPermission, never> | import("effect/rpc/Rpc").Rpc<"identity.sessions.list", import("effect/Schema").Struct<{
109
111
  readonly cursor: import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
110
112
  readonly id: import("effect/Schema").String;
111
113
  readonly lastActivityAt: import("effect/Schema").DateTimeUtcFromString;
@@ -135,8 +137,6 @@ export declare const SessionsPage: import("#page.ts").AdminPage & {
135
137
  "~ClientError": never;
136
138
  error: import("effect/Schema").Union<readonly [typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied, typeof import("@shivaedev/contract/WebSocketRequired.ts").WebSocketRequired]>;
137
139
  requiredForClient: false;
138
- }), never> | import("effect/rpc/Rpc").Rpc<"identity.sessions.revoke", import("effect/Schema").Struct<{
139
- id: import("effect/Schema").String;
140
- }>, import("effect/Schema").Void, import("effect/Schema").Union<readonly (typeof import("@shivaedev/errors/taxonomy.ts").NotFound | typeof import("@shivaedev/errors/taxonomy.ts").Forbidden | typeof import("@shivaedev/errors/taxonomy.ts").AuthUnavailable)[]>, typeof SessionsPermission, never>, readonly [], undefined>;
140
+ }), never>, readonly [], undefined>;
141
141
  };
142
142
  //# sourceMappingURL=Page.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/admin",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
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": {
@@ -44,21 +44,21 @@
44
44
  "dependencies": {
45
45
  "@shivaedev/access": "0.6.0",
46
46
  "@shivaedev/changes": "0.11.0",
47
- "@shivaedev/contract": "0.41.0",
47
+ "@shivaedev/contract": "0.42.0",
48
48
  "@shivaedev/errors": "0.10.0",
49
- "@shivaedev/identity": "0.29.0",
50
- "@shivaedev/jobs": "0.40.1"
49
+ "@shivaedev/identity": "0.29.2",
50
+ "@shivaedev/jobs": "0.41.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@effect/atom-react": "4.1.0",
54
- "@shivaedev/quality": "0.67.0",
55
- "@shivaedev/rate-limit": "0.6.2",
56
- "@shivaedev/react": "0.44.2",
57
- "@shivaedev/server": "0.29.0",
58
- "@shivaedev/sql": "0.44.0",
59
- "@shivaedev/test-kits": "0.9.0",
60
- "@shivaedev/test-sql": "0.24.2",
61
- "@shivaedev/test-story": "0.43.0",
54
+ "@shivaedev/quality": "0.69.1",
55
+ "@shivaedev/rate-limit": "0.6.3",
56
+ "@shivaedev/react": "0.45.1",
57
+ "@shivaedev/server": "0.30.0",
58
+ "@shivaedev/sql": "0.45.0",
59
+ "@shivaedev/test-kits": "0.9.3",
60
+ "@shivaedev/test-sql": "0.24.3",
61
+ "@shivaedev/test-story": "0.44.2",
62
62
  "@types/node": "24.19.2",
63
63
  "@types/react": "19.3.0",
64
64
  "@types/react-dom": "19.3.0",
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "peerDependencies": {
73
73
  "@effect/atom-react": "4.1.0",
74
- "@shivaedev/react": "0.44.2",
74
+ "@shivaedev/react": "0.45.1",
75
75
  "effect": "4.1.0",
76
76
  "react": "19.3.1"
77
77
  },
@@ -4,15 +4,18 @@ import type { QueueDisplay } from "@shivaedev/jobs/display.ts";
4
4
  import { useQuery } from "@shivaedev/react/client/resultState.ts";
5
5
  import { JobsHealthMetrics } from "./JobsMetrics.tsx";
6
6
  import { JobsQueuePicker, JobsQueueView } from "./JobsQueueView.tsx";
7
- import type { JobsViewClient, RetryJob } from "./jobsTypes.ts";
7
+ import type { JobsViewClient, RetryJob, RunScheduleNow } from "./jobsTypes.ts";
8
+ import { RunScheduleControl } from "./RunScheduleControl.tsx";
8
9
 
9
10
  export interface JobsViewProps {
10
11
  readonly api: JobsViewClient;
11
12
  readonly queues: readonly (string | QueueDisplay)[];
12
13
  readonly retry?: RetryJob | undefined;
14
+ readonly runScheduleNow?: RunScheduleNow | undefined;
15
+ readonly schedules?: readonly { readonly name: string }[];
13
16
  }
14
17
 
15
- export function JobsView({ api, queues, retry }: JobsViewProps) {
18
+ export function JobsView({ api, queues, retry, schedules, runScheduleNow }: JobsViewProps) {
16
19
  const definitions = queues.map((definition) => (typeof definition === "string" ? { name: definition } : definition));
17
20
  const [name, selectQueue] = useState(definitions[0]?.name ?? "");
18
21
  const queue = definitions.find((candidate) => candidate.name === name);
@@ -31,6 +34,9 @@ export function JobsView({ api, queues, retry }: JobsViewProps) {
31
34
  "div",
32
35
  { className: "min-w-0 space-y-6" },
33
36
  createElement(JobsQueuePicker, { queues: definitions, select: selectQueue, value: name }),
37
+ runScheduleNow !== undefined && schedules?.some((schedule) => schedule.name === name)
38
+ ? createElement(RunScheduleControl, { key: `run-${name}`, queue: name, run: runScheduleNow })
39
+ : null,
34
40
  createElement(JobsQueueView, { api, key: name, label: queue.label, queue: name, retry, subject: queue.subject }),
35
41
  ),
36
42
  );
@@ -0,0 +1,19 @@
1
+ import { Option } from "effect";
2
+ import { useAction } from "@shivaedev/react/client/resultState.ts";
3
+ import { JobButton } from "./JobButton.tsx";
4
+ import type { RunScheduleNow } from "./jobsTypes.ts";
5
+
6
+ export function RunScheduleControl({ queue, run }: { readonly queue: string; readonly run: RunScheduleNow }) {
7
+ const action = useAction(run);
8
+ const failure = Option.isSome(action.cause) ? <p role="alert">Could not run this schedule.</p> : null;
9
+ const status = Option.isSome(action.data) ? <p role="status">{Option.isSome(action.data.value) ? "Run requested." : "No run enqueued."}</p> : null;
10
+ return (
11
+ <div className="space-y-2">
12
+ <JobButton disabled={action.pending} onClick={() => action.dispatch({ queue })}>
13
+ {action.pending ? "Requesting…" : "Run now"}
14
+ </JobButton>
15
+ {failure}
16
+ {status}
17
+ </div>
18
+ );
19
+ }
@@ -30,3 +30,5 @@ export interface JobsViewClient {
30
30
  readonly job: Query<JobId, Option.Option<Job>>;
31
31
  }
32
32
  export type RetryJob = Atom.AtomResultFn<JobId, void, unknown>;
33
+
34
+ export type RunScheduleNow = Atom.AtomResultFn<{ readonly queue: string }, Option.Option<string>, unknown>;
package/src/jobs/entry.ts CHANGED
@@ -2,7 +2,7 @@ import { Schema } from "effect";
2
2
  import type { QueueDisplay } from "@shivaedev/jobs/display.ts";
3
3
  import type { JobsQueue } from "./schemas.ts";
4
4
 
5
- export type JobsEntry = (JobsQueue | { readonly name: string }) & QueueDisplay;
5
+ export type JobsEntry = (JobsQueue | { readonly name: string; readonly scheduleOptions?: { readonly key?: string } }) & QueueDisplay;
6
6
 
7
7
  export type JobsPayload<TEntry extends JobsEntry> = [TEntry] extends [never]
8
8
  ? typeof Schema.Never
@@ -31,6 +31,17 @@ export function jobsPageWithRetry<const TQueues extends readonly JobsEntry[]>(..
31
31
  payload: { id: Schema.String, queue: Schema.String },
32
32
  rejections: { ...JobsFailures, Forbidden, JobsNotFailed },
33
33
  }),
34
+ command("runScheduleNow", {
35
+ invalidates: ({ queue }) => [
36
+ jobsKeys.health.list,
37
+ jobsKeys.counts.item(queue),
38
+ jobsKeys.failed.item(queue),
39
+ jobsKeys.deadLettered.item(queue),
40
+ ],
41
+ payload: { queue: Schema.String },
42
+ rejections: { ...JobsFailures, Forbidden },
43
+ success: Schema.OptionFromNullOr(Schema.String),
44
+ }),
34
45
  ],
35
46
  queries: page.contract.declaration.queries,
36
47
  }),
@@ -38,6 +49,6 @@ export function jobsPageWithRetry<const TQueues extends readonly JobsEntry[]>(..
38
49
  permission: JobsPermission,
39
50
  route: page.route,
40
51
  }),
41
- { queues },
52
+ { queues, schedules: queues.filter((entry) => !("schema" in entry)) },
42
53
  );
43
54
  }
@@ -31,5 +31,19 @@ export function jobsHandlersWithRetry<const TQueues extends readonly JobsEntry[]
31
31
  }
32
32
  yield* jobsFailures(runtime.retry(definition, id));
33
33
  }),
34
+ "admin.jobs.runScheduleNow": ({ queue }) =>
35
+ Effect.gen(function* () {
36
+ yield* requirePermission(yield* SessionUser, RetryJobs);
37
+ const entries: readonly JobsEntry[] = page.queues;
38
+ const entry = entries.find((candidate) => candidate.name === queue && !("schema" in candidate));
39
+ if (entry === undefined || "schema" in entry) {
40
+ return yield* Effect.fail(new JobsQueueUnregistered({ queue }));
41
+ }
42
+ const runtime = yield* service;
43
+ return yield* runtime.runScheduleNow({ name: entry.name, scheduleOptions: entry.scheduleOptions ?? {} }).pipe(
44
+ Effect.catchTag("PgBossNotFoundError", () => Effect.fail(new JobsQueueUnregistered({ queue }))),
45
+ Effect.catchTag("PgBossError", (error) => jobsFailures(Effect.fail(error))),
46
+ );
47
+ }),
34
48
  });
35
49
  }