@shivaedev/jobs 0.31.0 → 0.32.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 (191) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +57 -26
  3. package/dist/server/adapters/inspection.d.ts +5 -0
  4. package/dist/server/adapters/inspection.d.ts.map +1 -0
  5. package/dist/server/adapters/inspection.js +25 -0
  6. package/dist/server/adapters/inspection.js.map +1 -0
  7. package/dist/server/adapters/inspectionChanges.d.ts +7 -0
  8. package/dist/server/adapters/inspectionChanges.d.ts.map +1 -0
  9. package/dist/server/adapters/inspectionChanges.js +23 -0
  10. package/dist/server/adapters/inspectionChanges.js.map +1 -0
  11. package/dist/server/adapters/inspectionDeferrals.d.ts +10 -0
  12. package/dist/server/adapters/inspectionDeferrals.d.ts.map +1 -0
  13. package/dist/server/adapters/inspectionDeferrals.js +13 -0
  14. package/dist/server/adapters/inspectionDeferrals.js.map +1 -0
  15. package/dist/server/adapters/inspectionJobs.d.ts +50 -0
  16. package/dist/server/adapters/inspectionJobs.d.ts.map +1 -0
  17. package/dist/server/adapters/inspectionJobs.js +21 -0
  18. package/dist/server/adapters/inspectionJobs.js.map +1 -0
  19. package/dist/server/adapters/inspectionOperation.d.ts +3 -0
  20. package/dist/server/adapters/inspectionOperation.d.ts.map +1 -0
  21. package/dist/server/adapters/inspectionOperation.js +6 -0
  22. package/dist/server/adapters/inspectionOperation.js.map +1 -0
  23. package/dist/server/adapters/inspectionPlan.d.ts +3 -0
  24. package/dist/server/adapters/inspectionPlan.d.ts.map +1 -0
  25. package/dist/server/adapters/inspectionPlan.js +20 -0
  26. package/dist/server/adapters/inspectionPlan.js.map +1 -0
  27. package/dist/server/adapters/inspectionReads.d.ts +59 -0
  28. package/dist/server/adapters/inspectionReads.d.ts.map +1 -0
  29. package/dist/server/adapters/inspectionReads.js +44 -0
  30. package/dist/server/adapters/inspectionReads.js.map +1 -0
  31. package/dist/server/adapters/inspectionSnapshot.d.ts +6 -0
  32. package/dist/server/adapters/inspectionSnapshot.d.ts.map +1 -0
  33. package/dist/server/{internal/testingSnapshot.js → adapters/inspectionSnapshot.js} +9 -7
  34. package/dist/server/adapters/inspectionSnapshot.js.map +1 -0
  35. package/dist/server/adapters/jobEngine.d.ts.map +1 -1
  36. package/dist/server/adapters/jobEngine.js +0 -4
  37. package/dist/server/adapters/jobEngine.js.map +1 -1
  38. package/dist/server/adapters/payloadIdentity.d.ts +3 -0
  39. package/dist/server/adapters/payloadIdentity.d.ts.map +1 -0
  40. package/dist/server/adapters/payloadIdentity.js +14 -0
  41. package/dist/server/adapters/payloadIdentity.js.map +1 -0
  42. package/dist/server/{internal/testingSignal.d.ts → adapters/queueSignal.d.ts} +2 -2
  43. package/dist/server/adapters/queueSignal.d.ts.map +1 -0
  44. package/dist/server/{internal/testingSignal.js → adapters/queueSignal.js} +2 -2
  45. package/dist/server/adapters/queueSignal.js.map +1 -0
  46. package/dist/server/adapters/testingClient.d.ts +1 -2
  47. package/dist/server/adapters/testingClient.d.ts.map +1 -1
  48. package/dist/server/adapters/testingClient.js +23 -45
  49. package/dist/server/adapters/testingClient.js.map +1 -1
  50. package/dist/server/adapters/testingController.d.ts +57 -12
  51. package/dist/server/adapters/testingController.d.ts.map +1 -1
  52. package/dist/server/adapters/testingController.js +28 -18
  53. package/dist/server/adapters/testingController.js.map +1 -1
  54. package/dist/server/adapters/testingDueNow.js +1 -1
  55. package/dist/server/adapters/testingDueNow.js.map +1 -1
  56. package/dist/server/adapters/testingEngine.d.ts.map +1 -1
  57. package/dist/server/adapters/testingEngine.js +0 -11
  58. package/dist/server/adapters/testingEngine.js.map +1 -1
  59. package/dist/server/adapters/testingInspectionClient.d.ts +5 -0
  60. package/dist/server/adapters/testingInspectionClient.d.ts.map +1 -0
  61. package/dist/server/adapters/testingInspectionClient.js +52 -0
  62. package/dist/server/adapters/testingInspectionClient.js.map +1 -0
  63. package/dist/server/client.d.ts +3 -0
  64. package/dist/server/client.d.ts.map +1 -1
  65. package/dist/server/clientOptions.d.ts +0 -1
  66. package/dist/server/clientOptions.d.ts.map +1 -1
  67. package/dist/server/definition.d.ts +12 -11
  68. package/dist/server/definition.d.ts.map +1 -1
  69. package/dist/server/definition.js +2 -1
  70. package/dist/server/definition.js.map +1 -1
  71. package/dist/server/engineClient.d.ts +0 -5
  72. package/dist/server/engineClient.d.ts.map +1 -1
  73. package/dist/server/enqueueOptions.d.ts +6 -0
  74. package/dist/server/enqueueOptions.d.ts.map +1 -1
  75. package/dist/server/error.d.ts +1 -1
  76. package/dist/server/error.d.ts.map +1 -1
  77. package/dist/server/error.js.map +1 -1
  78. package/dist/server/inspection.d.ts +102 -0
  79. package/dist/server/inspection.d.ts.map +1 -0
  80. package/dist/server/inspection.js +30 -0
  81. package/dist/server/inspection.js.map +1 -0
  82. package/dist/server/internal/adapters/testingFetches.d.ts +2 -2
  83. package/dist/server/internal/adapters/testingFetches.d.ts.map +1 -1
  84. package/dist/server/internal/adapters/testingFetches.js.map +1 -1
  85. package/dist/server/internal/deferral.d.ts +0 -2
  86. package/dist/server/internal/deferral.d.ts.map +1 -1
  87. package/dist/server/internal/deferral.js +0 -1
  88. package/dist/server/internal/deferral.js.map +1 -1
  89. package/dist/server/internal/engine.d.ts +0 -5
  90. package/dist/server/internal/engine.d.ts.map +1 -1
  91. package/dist/server/internal/engine.js.map +1 -1
  92. package/dist/server/internal/enqueueFor.d.ts.map +1 -1
  93. package/dist/server/internal/enqueueFor.js +11 -1
  94. package/dist/server/internal/enqueueFor.js.map +1 -1
  95. package/dist/server/internal/jobStorePlans.d.ts.map +1 -1
  96. package/dist/server/internal/jobStorePlans.js +2 -1
  97. package/dist/server/internal/jobStorePlans.js.map +1 -1
  98. package/dist/server/internal/makeService.d.ts.map +1 -1
  99. package/dist/server/internal/makeService.js +7 -6
  100. package/dist/server/internal/makeService.js.map +1 -1
  101. package/dist/server/internal/register.d.ts.map +1 -1
  102. package/dist/server/internal/register.js +0 -4
  103. package/dist/server/internal/register.js.map +1 -1
  104. package/dist/server/internal/testingIdle.d.ts +3 -2
  105. package/dist/server/internal/testingIdle.d.ts.map +1 -1
  106. package/dist/server/internal/testingIdle.js +5 -25
  107. package/dist/server/internal/testingIdle.js.map +1 -1
  108. package/dist/server/internal/testingOperation.d.ts +5 -0
  109. package/dist/server/internal/testingOperation.d.ts.map +1 -0
  110. package/dist/server/internal/testingOperation.js +12 -0
  111. package/dist/server/internal/testingOperation.js.map +1 -0
  112. package/dist/server/internal/testingSchedules.d.ts +8 -5
  113. package/dist/server/internal/testingSchedules.d.ts.map +1 -1
  114. package/dist/server/internal/testingSchedules.js +14 -9
  115. package/dist/server/internal/testingSchedules.js.map +1 -1
  116. package/dist/server/internal/testingWaits.d.ts +7 -4
  117. package/dist/server/internal/testingWaits.d.ts.map +1 -1
  118. package/dist/server/internal/testingWaits.js +5 -6
  119. package/dist/server/internal/testingWaits.js.map +1 -1
  120. package/dist/server/schema.d.ts.map +1 -1
  121. package/dist/server/schema.js +5 -0
  122. package/dist/server/schema.js.map +1 -1
  123. package/dist/server/service.d.ts +4 -4
  124. package/dist/server/service.d.ts.map +1 -1
  125. package/dist/server/service.js +1 -0
  126. package/dist/server/service.js.map +1 -1
  127. package/dist/server/testing.d.ts +60 -25
  128. package/dist/server/testing.d.ts.map +1 -1
  129. package/dist/server/testing.js.map +1 -1
  130. package/package.json +6 -6
  131. package/src/server/adapters/inspection.ts +31 -0
  132. package/src/server/adapters/inspectionChanges.ts +31 -0
  133. package/src/server/{internal/testingDeferrals.ts → adapters/inspectionDeferrals.ts} +10 -12
  134. package/src/server/adapters/inspectionJobs.ts +28 -0
  135. package/src/server/adapters/inspectionOperation.ts +6 -0
  136. package/src/server/adapters/inspectionPlan.ts +21 -0
  137. package/src/server/adapters/inspectionReads.ts +55 -0
  138. package/src/server/{internal/testingSnapshot.ts → adapters/inspectionSnapshot.ts} +15 -17
  139. package/src/server/adapters/jobEngine.ts +0 -4
  140. package/src/server/adapters/payloadIdentity.ts +15 -0
  141. package/src/server/{internal/testingSignal.ts → adapters/queueSignal.ts} +1 -1
  142. package/src/server/adapters/testingClient.ts +9 -30
  143. package/src/server/adapters/testingController.ts +37 -21
  144. package/src/server/adapters/testingDueNow.ts +1 -1
  145. package/src/server/adapters/testingEngine.ts +0 -13
  146. package/src/server/adapters/testingInspectionClient.ts +70 -0
  147. package/src/server/client.ts +3 -0
  148. package/src/server/clientOptions.ts +0 -1
  149. package/src/server/definition.ts +18 -12
  150. package/src/server/engineClient.ts +0 -2
  151. package/src/server/enqueueOptions.ts +5 -0
  152. package/src/server/error.ts +1 -0
  153. package/src/server/inspection.ts +50 -0
  154. package/src/server/internal/adapters/testingFetches.ts +2 -2
  155. package/src/server/internal/deferral.ts +0 -2
  156. package/src/server/internal/engine.ts +0 -6
  157. package/src/server/internal/enqueueFor.ts +14 -1
  158. package/src/server/internal/jobStorePlans.ts +2 -1
  159. package/src/server/internal/makeService.ts +7 -6
  160. package/src/server/internal/register.ts +0 -4
  161. package/src/server/internal/testingIdle.ts +7 -30
  162. package/src/server/internal/testingOperation.ts +18 -0
  163. package/src/server/internal/testingSchedules.ts +28 -16
  164. package/src/server/internal/testingWaits.ts +10 -11
  165. package/src/server/schema.ts +5 -0
  166. package/src/server/service.ts +5 -2
  167. package/src/server/testing.ts +1 -12
  168. package/dist/server/adapters/observeTestingSettlements.d.ts +0 -6
  169. package/dist/server/adapters/observeTestingSettlements.d.ts.map +0 -1
  170. package/dist/server/adapters/observeTestingSettlements.js +0 -35
  171. package/dist/server/adapters/observeTestingSettlements.js.map +0 -1
  172. package/dist/server/internal/testingDeferrals.d.ts +0 -10
  173. package/dist/server/internal/testingDeferrals.d.ts.map +0 -1
  174. package/dist/server/internal/testingDeferrals.js +0 -15
  175. package/dist/server/internal/testingDeferrals.js.map +0 -1
  176. package/dist/server/internal/testingReadout.d.ts +0 -10
  177. package/dist/server/internal/testingReadout.d.ts.map +0 -1
  178. package/dist/server/internal/testingReadout.js +0 -13
  179. package/dist/server/internal/testingReadout.js.map +0 -1
  180. package/dist/server/internal/testingRegistrations.d.ts +0 -4
  181. package/dist/server/internal/testingRegistrations.d.ts.map +0 -1
  182. package/dist/server/internal/testingRegistrations.js +0 -8
  183. package/dist/server/internal/testingRegistrations.js.map +0 -1
  184. package/dist/server/internal/testingSignal.d.ts.map +0 -1
  185. package/dist/server/internal/testingSignal.js.map +0 -1
  186. package/dist/server/internal/testingSnapshot.d.ts +0 -6
  187. package/dist/server/internal/testingSnapshot.d.ts.map +0 -1
  188. package/dist/server/internal/testingSnapshot.js.map +0 -1
  189. package/src/server/adapters/observeTestingSettlements.ts +0 -36
  190. package/src/server/internal/testingReadout.ts +0 -25
  191. package/src/server/internal/testingRegistrations.ts +0 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.32.0 - 2026-11-03
4
+
5
+ ### Added
6
+
7
+ - Expose `PgBossInspection` for stored jobs, deferrals, expiry, queue diagnostics and scoped PostgreSQL queue-change signals. Jobs runtimes also expose the service through `inspection()`.
8
+ - Refresh cached queue statistics through `testing.refreshQueueStats(queue?)` before reading health.
9
+ - Read and await jobs with null payloads through `testing.jobs({ name, schema: Schema.Null })` and `testing.untilJob`.
10
+ - Queues accept `id: ["field", ...]` to derive deterministic UUIDs from the queue name and typed scalar payload parts. Repeated parts deduplicate while pg-boss retains the job. Enqueueing rejects conflicting IDs owned by a queue definition.
11
+
12
+ ### Changed
13
+
14
+ - The testing controller reads through inspection and waits on committed queue changes, including work done by another client, without production testing hooks or private settlement spies.
15
+
16
+ ### Fixed
17
+
18
+ - Apply testing expiry controls to triggered schedule runs.
19
+
20
+ ### Breaking
21
+
22
+ - Import `SnapshotQueue` and `UnfinishedJob` from `@shivaedev/jobs/server/inspection.ts` instead of `server/testing.ts`.
23
+ - Remove `__test__enableSpies` from client options. Replace `EngineClient.getSpy` waits with inspection `changes()`. Replace `getJobById(name, id)` with `storedJobs({ name }, { id })`, taking the first result; missing jobs return an empty array.
24
+ - `testing.trigger(schedule)` returns the run ID, or null when pg-boss suppresses the send, instead of void. Consumers that require an `Effect<void>` should apply `Effect.asVoid` to the result.
25
+ - Replace singleton `key: (payload) => string` callbacks with `key: ["field", ...]`, naming required string, number, boolean or null fields in the decoded payload schema. Use `key: []` for a queue-wide singleton key. To preserve application-specific normalization, put the normalized value in a payload field and name it as a part. Derived singleton key strings use typed tuples; drain existing singleton work before switching producers and workers together so old and new keys do not run concurrently.
26
+
3
27
  ## 0.31.0 - 2026-11-03
4
28
 
5
29
  ### Added
package/README.md CHANGED
@@ -260,19 +260,37 @@ const PullRequestJobs = defineQueue({
260
260
  Schema.TaggedStruct("Reconcile", { pullRequestId: Schema.NumberFromString }),
261
261
  ]),
262
262
  queue: { policy: "singleton" },
263
- key: ({ pullRequestId }) => `pr:${pullRequestId.toFixed(0)}`,
263
+ key: ["pullRequestId"],
264
264
  worker: { batchSize: 1, localConcurrency: 3 },
265
265
  });
266
266
 
267
267
  const refresh = Effect.flatMap(Jobs, (jobs) => jobs.enqueue(PullRequestJobs, { _tag: "Refresh", pullRequestId: 42 }));
268
268
  ```
269
269
 
270
- `queue.policy` accepts pg-boss's policy literals and rejects typos. The `singleton` policy requires `key: (payload) => string`. The callback sees the decoded payload, so `pullRequestId` is a number. `enqueue` supplies pg-boss's `singletonKey` automatically; callers cannot supply a conflicting key in send options.
270
+ `queue.policy` accepts pg-boss's policy literals and rejects typos. The `singleton` policy requires `key: ["field", ...]`. Each part names a required scalar field in the decoded payload schema, so `pullRequestId` contributes its numeric value. `enqueue` supplies pg-boss's `singletonKey` automatically; callers cannot supply a conflicting key in send options.
271
271
 
272
272
  PostgreSQL guarantees one active job per key across workers, including different job kinds in this queue. Different keys can run in parallel when workers have capacity. A job waiting to retry frees its key for another job; exhausting retries sends it to the dead-letter queue and leaves the key available.
273
273
 
274
274
  Singleton guarantees one active job per key, not order. Ordering stays the application's job. Keep handlers idempotent and write state only when the source is newer than what is stored, so an older event or retry cannot overwrite newer state.
275
275
 
276
+ ### Deterministic job IDs
277
+
278
+ Declare the payload fields that identify a job:
279
+
280
+ ```ts
281
+ const Revisions = defineQueue({
282
+ name: "revisions",
283
+ schema: Schema.Struct({ tenant: Schema.String, revision: Schema.NumberFromString, note: Schema.String }),
284
+ id: ["tenant", "revision"],
285
+ key: ["tenant"],
286
+ queue: { policy: "singleton" },
287
+ });
288
+ ```
289
+
290
+ `id` derives a deterministic UUID from the queue name and its ordered payload parts. Enqueuing the same parts again returns `None` while pg-boss retains that job, even if other fields change. Different queue names have separate identities. Here, different revisions create separate jobs while sharing the tenant's singleton key. Callers cannot pass an `id` or `singletonKey` that the queue owns.
291
+
292
+ Both declarations accept fields whose decoded values are strings, numbers, booleans or null. Parts preserve value types and field boundaries, including separators in strings. An empty list gives every payload the same identity within the queue. Omit `id` to keep pg-boss's generated IDs or caller-supplied IDs. Identity is separate from tracing metadata.
293
+
276
294
  ### Size batches against expiry
277
295
 
278
296
  pg-boss marks every job in a fetched batch active together. Each job's expiry window starts at its stored `startedOn`, including time waiting for earlier handlers. Size each queue's batch so its sequential work fits within that window; use a small batch for long-running work and keep the default for short work:
@@ -402,6 +420,16 @@ export const readJobCounts = Effect.gen(function* () {
402
420
 
403
421
  `health([{ name: "cleanup-mail" }])` reads only the supplied queues, in order, even when another runtime registered them. Omitting the argument keeps the Layer's registered names. Admin pages use this to include worker-only schedules without registering those schedules in the request runtime.
404
422
 
423
+ ### Inspect stored work
424
+
425
+ `PgBossInspection` from `@shivaedev/jobs/server/inspection.ts` exposes the shared read service used by admin pages and the testing controller. Provide `PgBossInspection.layer` with your `pgBossLayer`, or obtain the same reads from a configured jobs runtime with `yield* jobs.inspection()`.
426
+
427
+ `storedJobs(queue, options?)` reads native stored metadata and encoded payloads. `jobs(queue, options?)` decodes stored payloads through the supplied queue Schema and includes native state, `startAfter`, `expireInSeconds`, `startedOn` and `keepUntil`. These reads include unredacted payloads; keep them inside trusted server code. The admin-facing `getJob`, `failedJobs` and `deadLetteredJobs` reads retain their payload redaction. `deferred(queue)` reads stored RetryAt reasons and requested times, while `snapshot(queues)` lists unfinished work with future RetryAt attempts marked `deferred`. `counts`, `health`, `queue`, `schedules`, `schemaVersion` and `busy` serve queue diagnostics and controller readouts.
428
+
429
+ `changes(queue?)` acquires a scoped PostgreSQL listener and returns `revision` and `waitForChange(after)`. Capture its revision before reading, then wait against that revision to avoid missing a change between the read and the wait. The signal wakes for committed job changes from any client, optionally filtered to one queue. It is a hint to read again, not a durable event log. The caller owns the listener's scope.
430
+
431
+ Automatic migration and `installPgBossSchema` install the queue-change trigger. Applications using `migrate: false` run `installPgBossSchema` before using change signals. Custom clients need `getDb().listen` to subscribe.
432
+
405
433
  ### Administer queues and schedules
406
434
 
407
435
  `unschedule(schedule)` removes the registration named by the schedule definition and its `scheduleOptions.key` (the empty key by default). Other keys for that queue stay registered. A missing registration fails with `PgBossNotFoundError`, carrying `operation: "unschedule"`, `queue` and `key`.
@@ -527,7 +555,7 @@ Include every target queue in `jobs`, as either a worker or a producer-only defi
527
555
 
528
556
  `linkedWorkerSpans(sender, spans)` from `@shivaedev/jobs/server/testing.ts` reads native recorded Effect spans and returns the pg-boss consumer spans whose links match both the sender's `traceId` and `spanId`. It returns every matching attempt, including retries, and no matches before a worker runs. An untraced job has no sender link. Settle the workers before reading their completed attempts; this readout does not wait or read queue storage.
529
557
 
530
- `testing.ts` gives story kits a controller for one real pg-boss client. Create a fresh controller per runtime, pass its `clientFactory` to `pgBossLayer`, and keep that Layer scoped as usual. `jobs(queue, options?)` returns jobs-owned `Job` metadata with `data` decoded through the queue's Schema, including traced payloads. Invalid durable data fails with `PgBossPayloadError`; decoding services remain in the Effect's requirements.
558
+ `testing.ts` gives story kits a controller for one real pg-boss client. Create a fresh controller per runtime, pass its `clientFactory` to `pgBossLayer`, and keep that Layer scoped as usual. `jobs(queue, options?)` returns jobs-owned `Job` metadata with `data` decoded through the queue's Schema, including traced payloads. For a scheduled run with no payload, pass `{ name: Cleanup.name, schema: Schema.Null }` to read `data: null`. Invalid durable data fails with `PgBossPayloadError`; decoding services remain in the Effect's requirements.
531
559
 
532
560
  This producer story uses the `SendEmail` definition and `Jobs` service from above. `databaseUrl` points to the story's PostgreSQL database:
533
561
 
@@ -563,13 +591,15 @@ emailStories.it("decodes the queued email", [], function* ({ enqueue, testing })
563
591
 
564
592
  Set `retryPolicy: testRetryPolicy` through the controller to override queue and send settings with `retryDelay: 0` and `retryBackoff: false`. A failing worker can then exhaust its native retries without production backoff. The policy applies to subsequently sent jobs; it does not rewrite jobs already stored.
565
593
 
566
- `schedules()` lists registered schedules as `{ name, cron, timezone }` entries from PostgreSQL. `trigger(schedule)` takes a schedule definition, such as `Cleanup`, and enqueues one run now using its stored schedule data and options. Register `Cleanup.run(effect)` in the testing Layer first, then yield `testing.trigger(Cleanup)` and `testing.waitForIdle` before observing the Effect's result. An unregistered schedule fails with `PgBossTestingError` (`operation: "trigger"`).
594
+ `schedules()` lists registered schedules as `{ name, cron, timezone }` entries from PostgreSQL. `trigger(schedule)` takes a schedule definition, such as `Cleanup`, and enqueues one run now using its stored schedule data and options. It returns the run ID, or null when pg-boss suppresses the send. Register `Cleanup.run(effect)` in the testing Layer first, then yield `testing.trigger(Cleanup)` and `testing.waitForIdle` before observing the Effect's result. An unregistered schedule fails with `PgBossTestingError` (`operation: "trigger"`).
595
+
596
+ `refreshQueueStats(queue?)` requests a native pg-boss supervisor pass for one queue, or all queues when omitted, before reading cached counts through the jobs service's `health`. Like the service method, it performs native queue maintenance and respects pg-boss monitor intervals and backoff.
567
597
 
568
598
  `failNextSend(queue)` arms one send failure for that queue. The next valid `enqueue` fails with the usual typed `PgBossError` (`operation: "enqueue"`); the following send proceeds normally.
569
599
 
570
600
  `expireAfter(queue, n)` takes a positive attempt count: configure it before enqueueing to limit subsequent jobs to `n` attempts. Each successful send keeps its own expiry rule; later changes and duplicate-ID sends do not alter pending jobs. Earlier attempts run the handler normally; on attempt `n`, the controller expires the claimed job instead of invoking its handler. PostgreSQL supervision performs the terminal failure and dead lettering. A job that succeeds earlier completes normally.
571
601
 
572
- `expireIn(queue, duration)` takes an Effect `Duration.Input`, such as `"1 second"`, and sets the expiry of subsequent sends, rounded up to whole seconds. Durations below one second or nonfinite durations fail with `PgBossTestingError` (`operation: "expireIn"`). Earlier sends retain their expiry, and later calls and duplicate-ID sends do not change stored jobs. It can be combined with `expireAfter`: one sets each attempt's time budget, the other limits attempts. A stuck handler is interrupted at its deadline, and the same worker can fetch its retry after pg-boss fails the attempt. The testing expiry hooks support pg-boss schema version 46.
602
+ `expireIn(queue, duration)` takes an Effect `Duration.Input`, such as `"1 second"`, and sets the expiry of subsequent sends, rounded up to whole seconds. Durations below one second or nonfinite durations fail with `PgBossTestingError` (`operation: "expireIn"`). Earlier sends retain their expiry, and later calls and duplicate-ID sends do not change stored jobs. Both expiry controls also apply to runs sent by `trigger(schedule)`. It can be combined with `expireAfter`: one sets each attempt's time budget, the other limits attempts. A stuck handler is interrupted at its deadline, and the same worker can fetch its retry after pg-boss fails the attempt. The testing expiry hooks support pg-boss schema version 46.
573
603
 
574
604
  `runDueNow(queue)` makes future jobs in the queue's `created` or `retry` state due at the database's current time and wakes local workers. It includes delayed sends (`startAfter`), native retries and `RetryAt` deferrals. Yield `waitForIdle` afterwards before observing handler results; future jobs do not hold that wait open. It leaves active and terminal jobs and other queues unchanged.
575
605
 
@@ -583,7 +613,7 @@ Set `retryPolicy: testRetryPolicy` through the controller to override queue and
583
613
 
584
614
  A kit can also capture `revision` before reading jobs and yield `waitForChange(revision)` when its condition is unmet. The wait resumes after a local send, settlement or worker fetch, and when a local worker returns to idle as `waitForIdle` defines it, including terminal native worker timeouts. It also resumes immediately if a change occurred between the read and the wait. This signal observes the controller's client; external clients, future scheduled work and external database writes need their own wake source. Stories should retain a bounded test timeout.
585
615
 
586
- `untilJob(queue, id, state)` waits that way for one job: it reads the job, waits for the next change when the job is in another state, and returns the job with `data` decoded through the queue's Schema once it reaches `state`. `fetchesPass(queue, n)` completes once `n` worker fetches on the queue that began after the wait started have finished, whether or not they claimed anything, so a story can show that a job stayed untaken by fetches that could have claimed it. Each fetch also counts as a change for `waitForChange`. Both waits give up after `within` (default 20 seconds) of wall time, which a story's `TestClock` does not move, and fail with `PgBossWaitError`, whose message names what the wait expected and what it last saw:
616
+ `untilJob(queue, id, state)` waits that way for one job: it reads the job, waits for the next change when the job is in another state, and returns the job with `data` decoded through the queue's Schema once it reaches `state`. It also accepts `{ name, schema: Schema.Null }` for a triggered schedule's run. `fetchesPass(queue, n)` completes once `n` worker fetches on the queue that began after the wait started have finished, whether or not they claimed anything, so a story can show that a job stayed untaken by fetches that could have claimed it. Each fetch also counts as a change for `waitForChange`. Both waits give up after `within` (default 20 seconds) of wall time, which a story's `TestClock` does not move, and fail with `PgBossWaitError`, whose message names what the wait expected and what it last saw:
587
617
 
588
618
  ```ts
589
619
  yield* testing.untilJob(SendEmail, id, "completed", { within: "5 seconds" });
@@ -594,26 +624,27 @@ yield* testing.untilJob(SendEmail, id, "completed", { within: "5 seconds" });
594
624
 
595
625
  Import the module that defines the name; the package has no root entry.
596
626
 
597
- | Module | Public names |
598
- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
599
- | `@shivaedev/jobs/display.ts` | `QueueDisplay`, `SubjectColumn` |
600
- | `@shivaedev/jobs/server/definition.ts` | `defineQueue`, `jobContext`, `RetryAt`; `DefineQueueOptions`, `DefineScheduleOptions`, `JobContext`, `JobPayloadSchema`, `JobRegistration`, `QueueDefinition`, `QueueWorker`, `RegistrationRequirements`, `ScheduleDefinition`, `ScheduledWorker` |
601
- | `@shivaedev/jobs/server/service.ts` | `makePgBoss`, `pgBossLayer`; `PgBossDefinition`, `PgBossLayerOptions`, `PgBossOptions`, `PgBossService` |
602
- | `@shivaedev/jobs/server/PgBoss.ts` | `PgBoss`: the shared client Context service. |
603
- | `@shivaedev/jobs/server/schema.ts` | `installPgBossSchema`, `pgBossSchema`; `PgBossSchemaOptions` |
604
- | `@shivaedev/jobs/server/health.ts` | `deadLetterQueueName`; `DeadLetteredJob`, `JobPage`, `JobPageOptions`, `JobsHealth`, `ListedJob`, `QueueCounts`, `QueueHealth` |
605
- | `@shivaedev/jobs/server/error.ts` | `PgBossError`, `PgBossNotFoundError`, `PgBossPayloadError`, `PgBossQueueNamesError`, `PgBossQueueOptionsError`, `PgBossClientOptionsError`, `PgBossTestingError`, `PgBossWaitError`, `toPgBossError`; `PgBossOperation` |
606
- | `@shivaedev/jobs/server/queueOptions.ts` | `QueueOptions`, `QueuePolicy`, `RetryOptions` |
607
- | `@shivaedev/jobs/server/workerOptions.ts` | `WorkerOptions`, `GroupConcurrencyConfig` |
608
- | `@shivaedev/jobs/server/enqueueOptions.ts` | `EnqueueOptions`, `ScheduleOptions` |
609
- | `@shivaedev/jobs/server/job.ts` | `Job`, `JobState`, `WorkerJob` |
610
- | `@shivaedev/jobs/server/clientOptions.ts` | `ClientOptions`, `StopOptions`, `Clock`, `ReindexOptions`, `IndexBloatOptions` |
611
- | `@shivaedev/jobs/server/ClientDatabase.ts` | `ClientDatabase` |
612
- | `@shivaedev/jobs/server/engineClient.ts` | `EngineClient`, `EngineSchedule` |
613
- | `@shivaedev/jobs/server/client.ts` | `PgBossClient`, `PgBossClientFactory` |
614
- | `@shivaedev/jobs/server/testing.ts` | `makePgBossTesting`, `testRetryPolicy`; `PgBossTesting`, `PgBossTestingOptions`, `PgBossTestingWaitOptions`, `SnapshotQueue`, `UnfinishedJob` |
615
- | `@shivaedev/jobs/server/defineSchedule.ts` | `defineSchedule` |
616
- | `@shivaedev/jobs/server/adapters/defaultClientFactory.ts` | `defaultClientFactory` |
627
+ | Module | Public names |
628
+ | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
629
+ | `@shivaedev/jobs/display.ts` | `QueueDisplay`, `SubjectColumn` |
630
+ | `@shivaedev/jobs/server/definition.ts` | `defineQueue`, `jobContext`, `RetryAt`; `DefineQueueOptions`, `DefineScheduleOptions`, `JobContext`, `JobPayloadSchema`, `JobRegistration`, `PayloadParts`, `QueueDefinition`, `QueueWorker`, `RegistrationRequirements`, `ScheduleDefinition`, `ScheduledWorker` |
631
+ | `@shivaedev/jobs/server/service.ts` | `makePgBoss`, `pgBossLayer`; `PgBossDefinition`, `PgBossLayerOptions`, `PgBossOptions`, `PgBossService` |
632
+ | `@shivaedev/jobs/server/PgBoss.ts` | `PgBoss`: the shared client Context service. |
633
+ | `@shivaedev/jobs/server/schema.ts` | `installPgBossSchema`, `pgBossSchema`; `PgBossSchemaOptions` |
634
+ | `@shivaedev/jobs/server/health.ts` | `deadLetterQueueName`; `DeadLetteredJob`, `JobPage`, `JobPageOptions`, `JobsHealth`, `ListedJob`, `QueueCounts`, `QueueHealth` |
635
+ | `@shivaedev/jobs/server/error.ts` | `PgBossError`, `PgBossNotFoundError`, `PgBossPayloadError`, `PgBossQueueNamesError`, `PgBossQueueOptionsError`, `PgBossClientOptionsError`, `PgBossTestingError`, `PgBossWaitError`, `toPgBossError`; `PgBossOperation` |
636
+ | `@shivaedev/jobs/server/queueOptions.ts` | `QueueOptions`, `QueuePolicy`, `RetryOptions` |
637
+ | `@shivaedev/jobs/server/workerOptions.ts` | `WorkerOptions`, `GroupConcurrencyConfig` |
638
+ | `@shivaedev/jobs/server/enqueueOptions.ts` | `EnqueueOptions`, `QueueEnqueueOptions`, `ScheduleOptions` |
639
+ | `@shivaedev/jobs/server/job.ts` | `Job`, `JobState`, `WorkerJob` |
640
+ | `@shivaedev/jobs/server/clientOptions.ts` | `ClientOptions`, `StopOptions`, `Clock`, `ReindexOptions`, `IndexBloatOptions` |
641
+ | `@shivaedev/jobs/server/ClientDatabase.ts` | `ClientDatabase` |
642
+ | `@shivaedev/jobs/server/engineClient.ts` | `EngineClient`, `EngineSchedule` |
643
+ | `@shivaedev/jobs/server/client.ts` | `PgBossClient`, `PgBossClientFactory` |
644
+ | `@shivaedev/jobs/server/inspection.ts` | `PgBossInspection`; `PgBossInspectionService` |
645
+ | `@shivaedev/jobs/server/testing.ts` | `makePgBossTesting`, `testRetryPolicy`; `PgBossTesting`, `PgBossTestingOptions`, `PgBossTestingWaitOptions` |
646
+ | `@shivaedev/jobs/server/defineSchedule.ts` | `defineSchedule` |
647
+ | `@shivaedev/jobs/server/adapters/defaultClientFactory.ts` | `defaultClientFactory` |
617
648
 
618
649
  Jobs declares its public types independently of pg-boss. The option fields keep their familiar names: `queue` uses `QueueOptions`, including literal `QueuePolicy` values and `maxDeferrals`; `worker` uses `WorkerOptions`; a schedule's `schedule` uses `ScheduleOptions`; enqueueing uses `EnqueueOptions`. A queue also requires `name` and `schema`; a schedule requires `name` and `cron`.
619
650
 
@@ -0,0 +1,5 @@
1
+ import { Effect } from "effect";
2
+ import type { PgBossClient } from "#server/client.ts";
3
+ import type { PgBossInspectionService } from "#server/inspection.ts";
4
+ export declare function inspection(client: PgBossClient, schema?: string): Effect.Effect<PgBossInspectionService>;
5
+ //# sourceMappingURL=inspection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspection.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/inspection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AASrE,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,SAAW,GAAG,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAkB1G"}
@@ -0,0 +1,25 @@
1
+ import { Effect } from "effect";
2
+ import { jobEngine } from "#server/adapters/jobEngine.ts";
3
+ import { countsFor } from "#server/internal/countsFor.ts";
4
+ import { JobEngine } from "#server/internal/engine.ts";
5
+ import { healthFor } from "#server/internal/healthFor.ts";
6
+ import { jobControl } from "#server/internal/jobControl.ts";
7
+ import { jobListings } from "#server/internal/jobListings.ts";
8
+ import { inspectionChanges } from "./inspectionChanges.js";
9
+ import { inspectionReads } from "./inspectionReads.js";
10
+ export function inspection(client, schema = "pgboss") {
11
+ const engine = jobEngine(client, schema);
12
+ return Effect.gen(function* () {
13
+ const listings = yield* jobListings;
14
+ const { getJob } = yield* jobControl;
15
+ return {
16
+ ...inspectionReads(client, schema),
17
+ ...listings,
18
+ changes: (queue) => inspectionChanges(client, schema, queue?.name),
19
+ counts: (queue) => countsFor(client, schema, queue.name),
20
+ getJob,
21
+ health: (queues) => healthFor(client, queues.map((queue) => queue.name)),
22
+ };
23
+ }).pipe(Effect.provideService(JobEngine, engine));
24
+ }
25
+ //# sourceMappingURL=inspection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspection.js","sourceRoot":"","sources":["../../../src/server/adapters/inspection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,UAAU,CAAC,MAAoB,EAAE,MAAM,GAAG,QAAQ;IACjE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC;QACpC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC;QACrC,OAAO;YACN,GAAG,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC;YAClC,GAAG,QAAQ;YACX,OAAO,EAAE,CAAC,KAAiC,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC;YAC9F,MAAM,EAAE,CAAC,KAAgC,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC;YACnF,MAAM;YACN,MAAM,EAAE,CAAC,MAA4C,EAAE,EAAE,CACxD,SAAS,CACR,MAAM,EACN,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CACjC;SACF,CAAC;IACH,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Effect } from "effect";
2
+ import type { PgBossClient } from "#server/client.ts";
3
+ export declare const inspectionChanges: (client: PgBossClient, schema: string, queue?: string | undefined) => Effect.Effect<{
4
+ revision: Effect.Effect<number, never, never>;
5
+ waitForChange: (after: number) => Effect.Effect<number>;
6
+ }, import("#server/error.ts").PgBossError, import("effect/Scope").Scope>;
7
+ //# sourceMappingURL=inspectionChanges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionChanges.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/inspectionChanges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,eAAO,MAAM,iBAAiB;;;wEAwB5B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Effect } from "effect";
2
+ import { inspectionChannel } from "#server/adapters/inspectionPlan.ts";
3
+ import { toPgBossError } from "#server/error.ts";
4
+ import { queueSignal } from "./queueSignal.js";
5
+ export const inspectionChanges = Effect.fnUntraced(function* (client, schema, queue) {
6
+ const signal = queueSignal();
7
+ yield* Effect.acquireRelease(Effect.tryPromise({
8
+ catch: (error) => toPgBossError("inspect", error, queue),
9
+ try: () => {
10
+ const db = client.getDb?.();
11
+ if (db?.listen === undefined) {
12
+ throw new TypeError("This pg-boss client does not support listen");
13
+ }
14
+ return db.listen(inspectionChannel(schema), (name) => {
15
+ if (queue === undefined || name === queue) {
16
+ signal.changed();
17
+ }
18
+ }, signal.changed);
19
+ },
20
+ }), (listener) => Effect.promise(() => listener.close()));
21
+ return { revision: signal.revision, waitForChange: signal.waitForChange };
22
+ });
23
+ //# sourceMappingURL=inspectionChanges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionChanges.js","sourceRoot":"","sources":["../../../src/server/adapters/inspectionChanges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAoB,EAAE,MAAc,EAAE,KAAc;IACjH,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,KAAK,CAAC,CAAC,MAAM,CAAC,cAAc,CAC3B,MAAM,CAAC,UAAU,CAAC;QACjB,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC;QACxD,GAAG,EAAE,GAAG,EAAE;YACT,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;YAC5B,IAAI,EAAE,EAAE,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,IAAI,SAAS,CAAC,6CAA6C,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,EAAE,CAAC,MAAM,CACf,iBAAiB,CAAC,MAAM,CAAC,EACzB,CAAC,IAAI,EAAE,EAAE;gBACR,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;oBAC3C,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,CAAC;YACF,CAAC,EACD,MAAM,CAAC,OAAO,CACd,CAAC;QACH,CAAC;KACD,CAAC,EACF,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CACpD,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;AAC3E,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { DateTime, Effect } from "effect";
2
+ import type { PgBossClient } from "#server/client.ts";
3
+ import type { QueueDefinition } from "#server/definition.ts";
4
+ export declare function inspectionDeferrals(client: PgBossClient): {
5
+ deferred: (queue: Pick<QueueDefinition, "name">) => Effect.Effect<{
6
+ at: DateTime.Utc;
7
+ reason: string;
8
+ }[], import("../error.ts").PgBossError, never>;
9
+ };
10
+ //# sourceMappingURL=inspectionDeferrals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionDeferrals.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/inspectionDeferrals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY;IAGtD,QAAQ,UAAU,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;;;;EAUhD"}
@@ -0,0 +1,13 @@
1
+ import { DateTime, Effect } from "effect";
2
+ import { deferralOf } from "#server/internal/deferral.ts";
3
+ import { inspectionJobs } from "./inspectionJobs.js";
4
+ export function inspectionDeferrals(client) {
5
+ const { storedJobs } = inspectionJobs(client);
6
+ return {
7
+ deferred: (queue) => storedJobs(queue).pipe(Effect.map((jobs) => jobs.flatMap((job) => {
8
+ const deferral = job.state === "retry" && job.startedOn === null ? deferralOf(job) : undefined;
9
+ return deferral === undefined ? [] : [{ at: DateTime.makeUnsafe(job.startAfter), reason: deferral.reason }];
10
+ }))),
11
+ };
12
+ }
13
+ //# sourceMappingURL=inspectionDeferrals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionDeferrals.js","sourceRoot":"","sources":["../../../src/server/adapters/inspectionDeferrals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,UAAU,mBAAmB,CAAC,MAAoB;IACvD,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO;QACN,QAAQ,EAAE,CAAC,KAAoC,EAAE,EAAE,CAClD,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CACrB,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACnB,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACpB,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,KAAK,OAAO,IAAI,GAAG,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC/F,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7G,CAAC,CAAC,CACF,CACD;KACF,CAAC;AACH,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { Effect, type Schema } from "effect";
2
+ import type { JobReadOptions, PgBossClient } from "#server/client.ts";
3
+ import type { JobPayloadSchema } from "#server/definition.ts";
4
+ export declare function inspectionJobs(client: PgBossClient): {
5
+ jobs: <TName extends string, TPayload extends JobPayloadSchema | typeof Schema.Null>(queue: {
6
+ readonly name: TName;
7
+ readonly schema: TPayload;
8
+ }, options?: JobReadOptions) => Effect.Effect<{
9
+ expireInSeconds: number;
10
+ groupId?: string | null;
11
+ groupTier?: string | null;
12
+ heartbeatSeconds: number | null;
13
+ id: string;
14
+ name: string;
15
+ retryCount: number;
16
+ signal: AbortSignal;
17
+ blocked: boolean;
18
+ blocking: boolean;
19
+ completedOn: Date | null;
20
+ createdOn: Date;
21
+ deadLetter: string;
22
+ deleteAfterSeconds: number;
23
+ heartbeatOn: Date | null;
24
+ keepUntil: Date;
25
+ output: object | null;
26
+ pendingDependencies: number;
27
+ policy: string;
28
+ priority: number;
29
+ retryBackoff: boolean;
30
+ retryDelay: number;
31
+ retryDelayMax?: number;
32
+ retryLimit: number;
33
+ singletonKey: string | null;
34
+ singletonOn: Date | null;
35
+ sourceCreatedOn: Date | null;
36
+ sourceId: string | null;
37
+ sourceName: string | null;
38
+ sourceOutput: object | null;
39
+ sourceRetryCount: number | null;
40
+ sourceRootId: string | null;
41
+ startAfter: Date;
42
+ startedOn: Date | null;
43
+ state: import("../job.ts").JobState;
44
+ data: TPayload["Type"];
45
+ }[], import("#server/error.ts").PgBossError | import("#server/error.ts").PgBossPayloadError, TPayload["DecodingServices"]>;
46
+ storedJobs: (queue: {
47
+ readonly name: string;
48
+ }, options?: JobReadOptions) => Effect.Effect<readonly import("../job.ts").Job<unknown>[], import("#server/error.ts").PgBossError, never>;
49
+ };
50
+ //# sourceMappingURL=inspectionJobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionJobs.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/inspectionJobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY;WAYpC,KAAK,SAAS,MAAM,EAAE,QAAQ,SAAS,gBAAgB,GAAG,OAAO,MAAM,CAAC,IAAI,SAClF;QAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAA;KAAE,YAChD,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAbE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,YAAY,cAAc;EAoB9E"}
@@ -0,0 +1,21 @@
1
+ import { Effect } from "effect";
2
+ import { toPgBossError } from "#server/error.ts";
3
+ import { decodeStoredData } from "#server/internal/storedRows.ts";
4
+ export function inspectionJobs(client) {
5
+ function storedJobs(queue, options) {
6
+ return Effect.tryPromise({
7
+ catch: (error) => toPgBossError("inspect", error, queue.name),
8
+ try: () => {
9
+ if (client.findJobs === undefined) {
10
+ throw new TypeError("This pg-boss client does not support findJobs");
11
+ }
12
+ return client.findJobs(queue.name, options);
13
+ },
14
+ });
15
+ }
16
+ function jobs(queue, options) {
17
+ return storedJobs(queue, options).pipe(Effect.flatMap((rows) => Effect.forEach(rows, (job) => decodeStoredData(queue, job.data).pipe(Effect.map((data) => ({ ...job, data }))))));
18
+ }
19
+ return { jobs, storedJobs };
20
+ }
21
+ //# sourceMappingURL=inspectionJobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionJobs.js","sourceRoot":"","sources":["../../../src/server/adapters/inspectionJobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,MAAM,QAAQ,CAAC;AAG7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,MAAM,UAAU,cAAc,CAAC,MAAoB;IAClD,SAAS,UAAU,CAAC,KAAgC,EAAE,OAAwB;QAC7E,OAAO,MAAM,CAAC,UAAU,CAAC;YACxB,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;YAC7D,GAAG,EAAE,GAAG,EAAE;gBACT,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;oBACnC,MAAM,IAAI,SAAS,CAAC,+CAA+C,CAAC,CAAC;gBACtE,CAAC;gBACD,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC7C,CAAC;SACD,CAAC,CAAC;IACJ,CAAC;IACD,SAAS,IAAI,CACZ,KAA0D,EAC1D,OAAwB;QAExB,OAAO,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CACrC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACzI,CAAC;IACH,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Effect } from "effect";
2
+ export declare function inspectionOperation<A>(run: () => Promise<A>, queue?: string): Effect.Effect<A, import("#server/error.ts").PgBossError, never>;
3
+ //# sourceMappingURL=inspectionOperation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionOperation.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/inspectionOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,mEAE3E"}
@@ -0,0 +1,6 @@
1
+ import { Effect } from "effect";
2
+ import { toPgBossError } from "#server/error.ts";
3
+ export function inspectionOperation(run, queue) {
4
+ return Effect.tryPromise({ catch: (error) => toPgBossError("inspect", error, queue), try: run });
5
+ }
6
+ //# sourceMappingURL=inspectionOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionOperation.js","sourceRoot":"","sources":["../../../src/server/adapters/inspectionOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,UAAU,mBAAmB,CAAI,GAAqB,EAAE,KAAc;IAC3E,OAAO,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AAClG,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function inspectionChannel(schema: string): string;
2
+ export declare function inspectionPlan(schema: string): string;
3
+ //# sourceMappingURL=inspectionPlan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionPlan.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/inspectionPlan.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAcrD"}
@@ -0,0 +1,20 @@
1
+ import { quotedSchema } from "#server/internal/storedRows.ts";
2
+ export function inspectionChannel(schema) {
3
+ return `jobs:${schema}`;
4
+ }
5
+ export function inspectionPlan(schema) {
6
+ const quoted = quotedSchema(schema);
7
+ const channel = inspectionChannel(schema).replaceAll("'", "''");
8
+ const body = `BEGIN
9
+ CREATE OR REPLACE FUNCTION ${quoted}.effect_job_changed() RETURNS trigger LANGUAGE plpgsql AS $body$
10
+ BEGIN
11
+ PERFORM pg_notify('${channel}', COALESCE(NEW.name, OLD.name));
12
+ RETURN NULL;
13
+ END
14
+ $body$;
15
+ CREATE OR REPLACE TRIGGER effect_job_changed AFTER INSERT OR UPDATE OR DELETE ON ${quoted}.job
16
+ FOR EACH ROW EXECUTE FUNCTION ${quoted}.effect_job_changed();
17
+ END`;
18
+ return `DO '${body.replaceAll("'", "''")}'`;
19
+ }
20
+ //# sourceMappingURL=inspectionPlan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionPlan.js","sourceRoot":"","sources":["../../../src/server/adapters/inspectionPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC/C,OAAO,QAAQ,MAAM,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAc;IAC5C,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG;8BACgB,MAAM;;uBAEb,OAAO;;;;oFAIsD,MAAM;iCACzD,MAAM;KAClC,CAAC;IACL,OAAO,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { Schema } from "effect";
2
+ import type { PgBossClient } from "#server/client.ts";
3
+ import type { QueueDefinition } from "#server/definition.ts";
4
+ export declare function inspectionReads(client: PgBossClient, schema: string): {
5
+ jobs: <TName extends string, TPayload extends import("#server/definition.ts").JobPayloadSchema | typeof Schema.Null>(queue: {
6
+ readonly name: TName;
7
+ readonly schema: TPayload;
8
+ }, options?: import("#server/client.ts").JobReadOptions) => import("effect/Effect").Effect<{
9
+ expireInSeconds: number;
10
+ groupId?: string | null;
11
+ groupTier?: string | null;
12
+ heartbeatSeconds: number | null;
13
+ id: string;
14
+ name: string;
15
+ retryCount: number;
16
+ signal: AbortSignal;
17
+ blocked: boolean;
18
+ blocking: boolean;
19
+ completedOn: Date | null;
20
+ createdOn: Date;
21
+ deadLetter: string;
22
+ deleteAfterSeconds: number;
23
+ heartbeatOn: Date | null;
24
+ keepUntil: Date;
25
+ output: object | null;
26
+ pendingDependencies: number;
27
+ policy: string;
28
+ priority: number;
29
+ retryBackoff: boolean;
30
+ retryDelay: number;
31
+ retryDelayMax?: number;
32
+ retryLimit: number;
33
+ singletonKey: string | null;
34
+ singletonOn: Date | null;
35
+ sourceCreatedOn: Date | null;
36
+ sourceId: string | null;
37
+ sourceName: string | null;
38
+ sourceOutput: object | null;
39
+ sourceRetryCount: number | null;
40
+ sourceRootId: string | null;
41
+ startAfter: Date;
42
+ startedOn: Date | null;
43
+ state: import("../job.ts").JobState;
44
+ data: TPayload["Type"];
45
+ }[], import("../error.ts").PgBossError | import("../error.ts").PgBossPayloadError, TPayload["DecodingServices"]>;
46
+ storedJobs: (queue: {
47
+ readonly name: string;
48
+ }, options?: import("#server/client.ts").JobReadOptions) => import("effect/Effect").Effect<readonly import("../job.ts").Job<unknown>[], import("../error.ts").PgBossError, never>;
49
+ deferred: (queue: Pick<QueueDefinition, "name">) => import("effect/Effect").Effect<{
50
+ at: import("effect/DateTime").Utc;
51
+ reason: string;
52
+ }[], import("../error.ts").PgBossError, never>;
53
+ busy: (queues: readonly Pick<QueueDefinition, "name">[]) => import("effect/Effect").Effect<boolean, import("../error.ts").PgBossError, never>;
54
+ queue: (queue: Pick<QueueDefinition, "name">) => import("effect/Effect").Effect<import("#server/client.ts").ClientQueue | null, import("../error.ts").PgBossError, never>;
55
+ schedules: (name?: string, key?: string) => import("effect/Effect").Effect<import("../engineClient.ts").EngineSchedule[], import("../error.ts").PgBossError, never>;
56
+ schemaVersion: () => import("effect/Effect").Effect<number | null, import("../error.ts").PgBossError, never>;
57
+ snapshot: <const TQueues extends readonly import("../inspection.ts").SnapshotQueue[]>(queues: TQueues) => import("effect/Effect").Effect<readonly import("../inspection.ts").UnfinishedJob<TQueues[number]>[], import("../error.ts").PgBossPayloadError | import("../error.ts").PgBossError, TQueues[number]["schema"]["DecodingServices"]>;
58
+ };
59
+ //# sourceMappingURL=inspectionReads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionReads.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/inspectionReads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAWnD,SAAS,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,EAAE;mBAaxC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;uBACzB,MAAM,QAAQ,MAAM;;;EAmBxC"}
@@ -0,0 +1,44 @@
1
+ import { Schema } from "effect";
2
+ import { inspectionDeferrals } from "#server/adapters/inspectionDeferrals.ts";
3
+ import { inspectionJobs } from "#server/adapters/inspectionJobs.ts";
4
+ import { inspectionOperation } from "#server/adapters/inspectionOperation.ts";
5
+ import { inspectionSnapshot } from "#server/adapters/inspectionSnapshot.ts";
6
+ import { quotedSchema } from "#server/internal/storedRows.ts";
7
+ const Busy = Schema.Struct({ busy: Schema.Boolean });
8
+ export function inspectionReads(client, schema) {
9
+ const quoted = quotedSchema(schema);
10
+ function query(text, values) {
11
+ const db = client.getDb?.();
12
+ if (db === undefined) {
13
+ throw new TypeError("This pg-boss client does not support getDb");
14
+ }
15
+ return db.executeSql(text, values);
16
+ }
17
+ return {
18
+ ...inspectionDeferrals(client),
19
+ busy: (queues) => inspectionOperation(async () => {
20
+ const { rows } = await query(`/* jobs inspection busy */ SELECT EXISTS (
21
+ SELECT 1 FROM ${quoted}.job WHERE name = ANY($1::text[]) AND (
22
+ (state < 'active' AND NOT blocked AND start_after <= ${quoted}.job_now()) OR state = 'active'
23
+ )
24
+ ) AS busy`, [queues.map(({ name }) => name)]);
25
+ return Schema.decodeUnknownSync(Busy)(rows[0]).busy;
26
+ }),
27
+ ...inspectionJobs(client),
28
+ queue: (queue) => inspectionOperation(() => client.getQueue(queue.name), queue.name),
29
+ schedules: (name, key) => inspectionOperation(() => {
30
+ if (client.getSchedules === undefined) {
31
+ throw new TypeError("This pg-boss client does not support getSchedules");
32
+ }
33
+ return client.getSchedules(name, key);
34
+ }),
35
+ schemaVersion: () => inspectionOperation(() => {
36
+ if (client.schemaVersion === undefined) {
37
+ throw new TypeError("This pg-boss client does not support schemaVersion");
38
+ }
39
+ return client.schemaVersion();
40
+ }),
41
+ snapshot: inspectionSnapshot(() => client, () => schema),
42
+ };
43
+ }
44
+ //# sourceMappingURL=inspectionReads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionReads.js","sourceRoot":"","sources":["../../../src/server/adapters/inspectionReads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;AACrD,MAAM,UAAU,eAAe,CAAC,MAAoB,EAAE,MAAc;IACnE,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,SAAS,KAAK,CAAC,IAAY,EAAE,MAAkB;QAC9C,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;QAC5B,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IACD,OAAO;QACN,GAAG,mBAAmB,CAAC,MAAM,CAAC;QAC9B,IAAI,EAAE,CAAC,MAAgD,EAAE,EAAE,CAC1D,mBAAmB,CAAC,KAAK,IAAI,EAAE;YAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAC3B;oBACe,MAAM;4DACkC,MAAM;;aAErD,EACR,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAChC,CAAC;YACF,OAAO,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACrD,CAAC,CAAC;QACH,GAAG,cAAc,CAAC,MAAM,CAAC;QACzB,KAAK,EAAE,CAAC,KAAoC,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC;QACnH,SAAS,EAAE,CAAC,IAAa,EAAE,GAAY,EAAE,EAAE,CAC1C,mBAAmB,CAAC,GAAG,EAAE;YACxB,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;gBACvC,MAAM,IAAI,SAAS,CAAC,mDAAmD,CAAC,CAAC;YAC1E,CAAC;YACD,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACvC,CAAC,CAAC;QACH,aAAa,EAAE,GAAG,EAAE,CACnB,mBAAmB,CAAC,GAAG,EAAE;YACxB,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;gBACxC,MAAM,IAAI,SAAS,CAAC,oDAAoD,CAAC,CAAC;YAC3E,CAAC;YACD,OAAO,MAAM,CAAC,aAAa,EAAE,CAAC;QAC/B,CAAC,CAAC;QACH,QAAQ,EAAE,kBAAkB,CAC3B,GAAG,EAAE,CAAC,MAAM,EACZ,GAAG,EAAE,CAAC,MAAM,CACZ;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Effect } from "effect";
2
+ import type { PgBossClient } from "#server/client.ts";
3
+ import type { PgBossError, PgBossPayloadError } from "#server/error.ts";
4
+ import type { SnapshotQueue, UnfinishedJob } from "#server/inspection.ts";
5
+ export declare function inspectionSnapshot(client: () => PgBossClient, schema: () => string): <const TQueues extends readonly SnapshotQueue[]>(queues: TQueues) => Effect.Effect<readonly UnfinishedJob<TQueues[number]>[], PgBossPayloadError | PgBossError, TQueues[number]["schema"]["DecodingServices"]>;
6
+ //# sourceMappingURL=inspectionSnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectionSnapshot.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/inspectionSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAa1E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,YAAY,EAAE,MAAM,EAAE,MAAM,MAAM,IAC1E,KAAK,CAAC,OAAO,SAAS,SAAS,aAAa,EAAE,UAC7C,OAAO,KACb,MAAM,CAAC,MAAM,CAAC,SAAS,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,kBAAkB,GAAG,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAiC5I"}