@shivaedev/jobs 0.24.0 → 0.26.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 (168) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +49 -24
  3. package/dist/server/adapters/batchClockOffset.d.ts +4 -0
  4. package/dist/server/adapters/batchClockOffset.d.ts.map +1 -0
  5. package/dist/server/adapters/batchClockOffset.js +16 -0
  6. package/dist/server/adapters/batchClockOffset.js.map +1 -0
  7. package/dist/server/adapters/clientErrorReporter.d.ts +3 -0
  8. package/dist/server/adapters/clientErrorReporter.d.ts.map +1 -0
  9. package/dist/server/adapters/clientErrorReporter.js +8 -0
  10. package/dist/server/adapters/clientErrorReporter.js.map +1 -0
  11. package/dist/server/adapters/installSchema.d.ts +5 -0
  12. package/dist/server/adapters/installSchema.d.ts.map +1 -0
  13. package/dist/server/adapters/installSchema.js +57 -0
  14. package/dist/server/adapters/installSchema.js.map +1 -0
  15. package/dist/server/adapters/registerWorker.d.ts +5 -0
  16. package/dist/server/adapters/registerWorker.d.ts.map +1 -0
  17. package/dist/server/{internal → adapters}/registerWorker.js +5 -4
  18. package/dist/server/adapters/registerWorker.js.map +1 -0
  19. package/dist/server/{internal → adapters}/runSchemaPlan.d.ts.map +1 -1
  20. package/dist/server/{internal → adapters}/runSchemaPlan.js.map +1 -1
  21. package/dist/server/{internal → adapters}/schemaIndexBuilds.d.ts.map +1 -1
  22. package/dist/server/{internal → adapters}/schemaIndexBuilds.js.map +1 -1
  23. package/dist/server/{internal → adapters}/testingExpirations.d.ts.map +1 -1
  24. package/dist/server/{internal → adapters}/testingExpirations.js.map +1 -1
  25. package/dist/server/{internal → adapters}/transactionDb.d.ts.map +1 -1
  26. package/dist/server/{internal → adapters}/transactionDb.js.map +1 -1
  27. package/dist/server/adapters/workerDiagnostics.d.ts +3 -0
  28. package/dist/server/adapters/workerDiagnostics.d.ts.map +1 -0
  29. package/dist/server/adapters/workerDiagnostics.js +24 -0
  30. package/dist/server/adapters/workerDiagnostics.js.map +1 -0
  31. package/dist/server/client.d.ts +0 -1
  32. package/dist/server/client.d.ts.map +1 -1
  33. package/dist/server/client.js +1 -2
  34. package/dist/server/client.js.map +1 -1
  35. package/dist/server/defaultClientFactory.d.ts +3 -0
  36. package/dist/server/defaultClientFactory.d.ts.map +1 -0
  37. package/dist/server/{internal/nativeClient.js → defaultClientFactory.js} +2 -2
  38. package/dist/server/defaultClientFactory.js.map +1 -0
  39. package/dist/server/defineSchedule.d.ts +3 -0
  40. package/dist/server/defineSchedule.d.ts.map +1 -0
  41. package/dist/server/{internal/scheduleDefinition.js → defineSchedule.js} +2 -2
  42. package/dist/server/defineSchedule.js.map +1 -0
  43. package/dist/server/definition.d.ts +1 -2
  44. package/dist/server/definition.d.ts.map +1 -1
  45. package/dist/server/definition.js +2 -7
  46. package/dist/server/definition.js.map +1 -1
  47. package/dist/server/error.d.ts +17 -7
  48. package/dist/server/error.d.ts.map +1 -1
  49. package/dist/server/error.js +11 -3
  50. package/dist/server/error.js.map +1 -1
  51. package/dist/server/health.d.ts +1 -0
  52. package/dist/server/health.d.ts.map +1 -1
  53. package/dist/server/internal/adapters/testingFetches.d.ts +7 -0
  54. package/dist/server/internal/adapters/testingFetches.d.ts.map +1 -0
  55. package/dist/server/internal/adapters/testingFetches.js +30 -0
  56. package/dist/server/internal/adapters/testingFetches.js.map +1 -0
  57. package/dist/server/internal/batchHandler.d.ts +1 -2
  58. package/dist/server/internal/batchHandler.d.ts.map +1 -1
  59. package/dist/server/internal/batchHandler.js +18 -6
  60. package/dist/server/internal/batchHandler.js.map +1 -1
  61. package/dist/server/internal/deadLetterResolutionPlan.d.ts +2 -0
  62. package/dist/server/internal/deadLetterResolutionPlan.d.ts.map +1 -0
  63. package/dist/server/internal/deadLetterResolutionPlan.js +28 -0
  64. package/dist/server/internal/deadLetterResolutionPlan.js.map +1 -0
  65. package/dist/server/internal/enqueueFor.d.ts.map +1 -1
  66. package/dist/server/internal/enqueueFor.js +2 -2
  67. package/dist/server/internal/enqueueFor.js.map +1 -1
  68. package/dist/server/internal/jobControl.d.ts.map +1 -1
  69. package/dist/server/internal/jobControl.js +2 -1
  70. package/dist/server/internal/jobControl.js.map +1 -1
  71. package/dist/server/internal/jobStorePlans.d.ts +2 -0
  72. package/dist/server/internal/jobStorePlans.d.ts.map +1 -0
  73. package/dist/server/internal/jobStorePlans.js +6 -0
  74. package/dist/server/internal/jobStorePlans.js.map +1 -0
  75. package/dist/server/internal/lifecycle.d.ts +1 -1
  76. package/dist/server/internal/lifecycle.d.ts.map +1 -1
  77. package/dist/server/internal/lifecycle.js +5 -3
  78. package/dist/server/internal/lifecycle.js.map +1 -1
  79. package/dist/server/internal/listJobs.d.ts.map +1 -1
  80. package/dist/server/internal/listJobs.js +3 -2
  81. package/dist/server/internal/listJobs.js.map +1 -1
  82. package/dist/server/internal/register.d.ts +1 -2
  83. package/dist/server/internal/register.d.ts.map +1 -1
  84. package/dist/server/internal/register.js +8 -8
  85. package/dist/server/internal/register.js.map +1 -1
  86. package/dist/server/internal/registerReleasedJobs.d.ts +1 -2
  87. package/dist/server/internal/registerReleasedJobs.d.ts.map +1 -1
  88. package/dist/server/internal/registerReleasedJobs.js +3 -3
  89. package/dist/server/internal/registerReleasedJobs.js.map +1 -1
  90. package/dist/server/internal/runQueueWorker.d.ts +1 -1
  91. package/dist/server/internal/runQueueWorker.d.ts.map +1 -1
  92. package/dist/server/internal/runQueueWorker.js +4 -3
  93. package/dist/server/internal/runQueueWorker.js.map +1 -1
  94. package/dist/server/internal/storedRows.js +1 -1
  95. package/dist/server/internal/storedRows.js.map +1 -1
  96. package/dist/server/internal/testingClient.d.ts.map +1 -1
  97. package/dist/server/internal/testingClient.js +1 -1
  98. package/dist/server/internal/testingClient.js.map +1 -1
  99. package/dist/server/internal/testingWaits.d.ts +16 -0
  100. package/dist/server/internal/testingWaits.d.ts.map +1 -0
  101. package/dist/server/internal/testingWaits.js +56 -0
  102. package/dist/server/internal/testingWaits.js.map +1 -0
  103. package/dist/server/internal/waitForBatchExpiry.d.ts +1 -1
  104. package/dist/server/internal/waitForBatchExpiry.d.ts.map +1 -1
  105. package/dist/server/internal/waitForBatchExpiry.js +2 -4
  106. package/dist/server/internal/waitForBatchExpiry.js.map +1 -1
  107. package/dist/server/schema.d.ts.map +1 -1
  108. package/dist/server/schema.js +11 -53
  109. package/dist/server/schema.js.map +1 -1
  110. package/dist/server/service.d.ts +3 -3
  111. package/dist/server/service.d.ts.map +1 -1
  112. package/dist/server/service.js +6 -10
  113. package/dist/server/service.js.map +1 -1
  114. package/dist/server/testing.d.ts +5 -0
  115. package/dist/server/testing.d.ts.map +1 -1
  116. package/dist/server/testing.js +7 -2
  117. package/dist/server/testing.js.map +1 -1
  118. package/package.json +4 -4
  119. package/src/server/adapters/batchClockOffset.ts +17 -0
  120. package/src/server/adapters/clientErrorReporter.ts +8 -0
  121. package/src/server/adapters/installSchema.ts +68 -0
  122. package/src/server/{internal → adapters}/registerWorker.ts +8 -9
  123. package/src/server/adapters/workerDiagnostics.ts +28 -0
  124. package/src/server/client.ts +0 -3
  125. package/src/server/{internal/nativeClient.ts → defaultClientFactory.ts} +1 -1
  126. package/src/server/{internal/scheduleDefinition.ts → defineSchedule.ts} +1 -1
  127. package/src/server/definition.ts +2 -8
  128. package/src/server/error.ts +16 -3
  129. package/src/server/health.ts +1 -0
  130. package/src/server/internal/adapters/testingFetches.ts +36 -0
  131. package/src/server/internal/batchHandler.ts +20 -12
  132. package/src/server/internal/deadLetterResolutionPlan.ts +28 -0
  133. package/src/server/internal/enqueueFor.ts +2 -2
  134. package/src/server/internal/jobControl.ts +2 -1
  135. package/src/server/internal/jobStorePlans.ts +6 -0
  136. package/src/server/internal/lifecycle.ts +6 -3
  137. package/src/server/internal/listJobs.ts +11 -3
  138. package/src/server/internal/register.ts +7 -22
  139. package/src/server/internal/registerReleasedJobs.ts +2 -6
  140. package/src/server/internal/runQueueWorker.ts +5 -3
  141. package/src/server/internal/storedRows.ts +1 -1
  142. package/src/server/internal/testingClient.ts +1 -1
  143. package/src/server/internal/testingWaits.ts +98 -0
  144. package/src/server/internal/waitForBatchExpiry.ts +7 -4
  145. package/src/server/schema.ts +14 -65
  146. package/src/server/service.ts +12 -21
  147. package/src/server/testing.ts +11 -2
  148. package/dist/server/internal/nativeClient.d.ts +0 -3
  149. package/dist/server/internal/nativeClient.d.ts.map +0 -1
  150. package/dist/server/internal/nativeClient.js.map +0 -1
  151. package/dist/server/internal/registerWorker.d.ts +0 -6
  152. package/dist/server/internal/registerWorker.d.ts.map +0 -1
  153. package/dist/server/internal/registerWorker.js.map +0 -1
  154. package/dist/server/internal/scheduleDefinition.d.ts +0 -3
  155. package/dist/server/internal/scheduleDefinition.d.ts.map +0 -1
  156. package/dist/server/internal/scheduleDefinition.js.map +0 -1
  157. /package/dist/server/{internal → adapters}/runSchemaPlan.d.ts +0 -0
  158. /package/dist/server/{internal → adapters}/runSchemaPlan.js +0 -0
  159. /package/dist/server/{internal → adapters}/schemaIndexBuilds.d.ts +0 -0
  160. /package/dist/server/{internal → adapters}/schemaIndexBuilds.js +0 -0
  161. /package/dist/server/{internal → adapters}/testingExpirations.d.ts +0 -0
  162. /package/dist/server/{internal → adapters}/testingExpirations.js +0 -0
  163. /package/dist/server/{internal → adapters}/transactionDb.d.ts +0 -0
  164. /package/dist/server/{internal → adapters}/transactionDb.js +0 -0
  165. /package/src/server/{internal → adapters}/runSchemaPlan.ts +0 -0
  166. /package/src/server/{internal → adapters}/schemaIndexBuilds.ts +0 -0
  167. /package/src/server/{internal → adapters}/testingExpirations.ts +0 -0
  168. /package/src/server/{internal → adapters}/transactionDb.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.26.0 - 2026-10-31
4
+
5
+ ### Added
6
+
7
+ - Jobs dead-letter entries and admin Jobs RPC responses carry `sourceQueue`, the name of the original queue.
8
+ - The testing controller's `untilJob(queue, id, state)` waits on the controller's change signal until a job reaches a state and returns it with its data decoded through the queue's Schema.
9
+ - The testing controller's `fetchesPass(queue, n)` completes once `n` worker fetches on the queue that began after the wait have finished, so a story can show a job stayed untaken without sleeping.
10
+ - Both waits give up after `within` (default 20 seconds of wall time, unaffected by a `TestClock`) with `PgBossWaitError`, whose message names what the wait expected and what it last saw.
11
+ - Jobs encode and decode durable payloads through Effect's JSON codec, so native `Schema.Redacted` fields reach workers with their real values.
12
+
13
+ ### Changed
14
+
15
+ - The testing controller's `waitForChange` also wakes after each worker fetch that claims nothing, so a kit waiting on it re-reads once per poll.
16
+ - Generated starters import schedule definitions and the default queue client factory from their defining modules.
17
+
18
+ ### Fixed
19
+
20
+ - Report ambient runtime workarounds in core code: runners over Clock, Config and Random, unsafe clock reads, cryptographic randomness, performance time, process state and scheduling. Entry points, tool configs, adapters and test-support retain their boundary role for these checks.
21
+ - Run pg-boss callbacks through adapters that capture the worker Layer's Effect context, preserving application services in job handlers.
22
+ - Keep a claimed job running until its translated expiry deadline when the host timer wakes early, including deadlines with fractional milliseconds from PostgreSQL.
23
+ - Successful jobs clear their dead-letter copies in the completion transaction. Copies of unretried jobs and failed retries remain listed. Schema installation also clears copies whose retained source already completed.
24
+ - Job inspection and worker logs mask native `Redacted` values and fields recognized by the errors package's sensitive-key policy. The admin Jobs page carries masked inspection data over RPC without re-encoding it through the payload schema.
25
+ - Report exported type aliases of imports, value aliases with `typeof` annotations or local const chains, object facades and unchanged forwarding functions, with repairs naming their defining modules. Keep wrappers that transform inputs, add steps, supply defaults or declare overloads.
26
+
27
+ ### Breaking
28
+
29
+ - Repositories upgrading Quality must repair the newly reported ambient access or record existing adoption debt with `quality baseline write --rule biome/plugin`, then lower it as repairs land.
30
+ - `createApp` reads secret bytes from Effect's Crypto service. Applications embedding this Effect must provide `Crypto.Crypto`, for example with `NodeServices.layer` or `NodeCrypto.layer` from `@effect/platform-node`. The create-app command already provides it.
31
+ - The pg-boss testing-expiration bridge moved from `@shivaedev/jobs/server/internal/testingExpirations.ts` to `@shivaedev/jobs/server/adapters/testingExpirations.ts`. Consumers importing that internal path must import the adapter path instead.
32
+ - Consumers constructing `DeadLetteredJob` values or admin dead-letter responses must supply `sourceQueue`. Applications using `migrate: false` must run `installPgBossSchema` during upgrade to install the completion trigger.
33
+ - Jobs `getJob`, `failedJobs` and `deadLetteredJobs`, and admin Jobs RPC results, now return masked `data: unknown` instead of a typed worker payload. Consumers must treat this as diagnostic data and narrow it before reading fields; obtain operational payloads in queue handlers. Admin RPC no longer applies the queue's payload encoding or requires its encoding services for results.
34
+ - Quality: the gate now rejects imported second names even when they use type aliases, value annotations, object facades or forwarding functions. Import from the defining module and remove the second name; existing facade debt can be recorded at adoption. Import `USAGE` from `cli/messages.ts` instead of `cli/args.ts`.
35
+ - Jobs: import `defaultClientFactory` from `@shivaedev/jobs/server/defaultClientFactory.ts` instead of `server/client.ts`. Import `defineSchedule` from `@shivaedev/jobs/server/defineSchedule.ts` instead of `server/definition.ts`. The removed `server/internal/nativeClient.ts` and `server/internal/scheduleDefinition.ts` exports migrate to those same modules as `defaultClientFactory` and `defineSchedule`. The default factory now exposes its native pg-boss return type; type custom factory mocks against `PgBossClient` or `PgBossClientFactory` from `server/client.ts`.
36
+ - React: import `resumeSignal`, `ResumeOptions`, `ResumeSource` and `ResumeWindow` from `@shivaedev/contract/resume.ts`; `@shivaedev/react/resumeSignal.ts` is removed.
37
+ - Work Board: import `Identity` from `path/Identity.ts`, view state helpers from `browser/views/state.ts`, `isMarkdown` from `path/isMarkdown.ts`, and `processes` from `server/processOwnership.ts`. The forwarding `server/views/state.ts` and `server/integration/processes.ts` modules are removed. Replace the removed `attention` facade with imports of `managedRequestReceipt` from `server/attention/managedRequestReceipt.ts`, `attentionProjection` from `server/attention/projection.ts`, and `RequestReceipt` from `attention/RequestReceipt.ts`. Replace the removed `publication` facade with direct imports from `server/responses/publicationDirectory.ts`. Import `Changes` from `server/files/changes.ts`, `MarkdownFile` from `server/files/list.ts`, `Snapshot` from `server/search/snapshot.ts`, metadata document/model/diagnostic/parsed types from `integration/metadata.ts`, `InboxProjection` from `browser/views/schema.ts` instead of `AttentionProjection`, `SourceFailure` from `diagnostics/source.ts`, and `WorkspaceOptions` from `server/workspace.ts` instead of the integration facades. Metadata types are also removed from `server/metadata/model.ts` and `server/metadata/parse.ts`; import them from `integration/metadata.ts`.
38
+ - Work Fleet: import `WAIT_EXIT`, `WaitState`, `WaitOutcome` and `settled` from `host/waitOutcome.ts` instead of `host/wait.ts`; import `fleetRecords` from `fleetRecords.ts` instead of `operations.ts`.
39
+
40
+ ## 0.25.0 - 2026-10-31
41
+
42
+ ### Fixed
43
+
44
+ - Measure claimed-job expiry, remaining budgets and interrupted-batch settlement waits against PostgreSQL time, independent of the runtime clock's date.
45
+ - Include the original failure's tag and redacted message in settle errors.
46
+
47
+ ### Breaking
48
+
49
+ - Worker clients must expose `getDb()` so jobs can read their PostgreSQL clock once per batch. Custom client factories must supply it; producer-only clients are unchanged.
50
+ - `jobContext(job, deadline)` now requires a deadline in runtime Clock milliseconds. Callers constructing contexts must first measure the remaining expiry against the database clock, then add that duration to the runtime Clock time.
51
+
3
52
  ## 0.24.0 - 2026-10-31
4
53
 
5
54
  ### Added
package/README.md CHANGED
@@ -50,7 +50,8 @@ export const queueNames = [emailQueue.name, cleanupSchedule.name] as const;
50
50
  The client imports `queueNames` for its queue filter, or passes `emailQueue` to the admin jobs page. Server definitions reference the same declarations:
51
51
 
52
52
  ```ts
53
- import { defineQueue, defineSchedule } from "@shivaedev/jobs/server/definition.ts";
53
+ import { defineQueue } from "@shivaedev/jobs/server/definition.ts";
54
+ import { defineSchedule } from "@shivaedev/jobs/server/defineSchedule.ts";
54
55
  import { makePgBoss } from "@shivaedev/jobs/server/service.ts";
55
56
  import { cleanupSchedule, emailQueue, queueNames } from "./queues.ts";
56
57
 
@@ -69,7 +70,7 @@ For an application on the app host of `@shivaedev/server`, register `pgBossSchem
69
70
 
70
71
  ```ts
71
72
  import { pgBossSchema } from "@shivaedev/jobs/server/schema.ts";
72
- import { appDatabase } from "@shivaedev/server/appHost.ts";
73
+ import { appDatabase } from "@shivaedev/server/appDatabase.ts";
73
74
 
74
75
  const database = appDatabase({
75
76
  migrations: {
@@ -80,7 +81,7 @@ const database = appDatabase({
80
81
  });
81
82
  ```
82
83
 
83
- The component uses `installPgBossSchema` as its only install and upgrade path. It is pending when the schema is missing or its stored version is below the installed pg-boss package's required schema version; the readiness error names the schema and both versions (`missing` for an absent version). Start every producer and worker with the same schema and `migrate: false`. Use host mode `"wait"` for services that must wait for a deployment's migration process; no additional jobs-layer wait is needed.
84
+ The component uses `installPgBossSchema` as its only install and upgrade path. It is pending when the schema is missing, its stored version is below the installed pg-boss package's required schema version, or its dead-letter resolution trigger is missing. Version errors name the schema and both versions (`missing` for an absent version); a missing trigger is named in its error. Start every producer and worker with the same schema and `migrate: false`. Use host mode `"wait"` for services that must wait for a deployment's migration process; no additional jobs-layer wait is needed.
84
85
 
85
86
  With server's `appDatabase({ migrations: { mode: "wait", release, ... } })`, each jobs Layer automatically reads sql's optional `WorkerRelease` Context service. When the database belongs to another release, it calls pg-boss `offWork` for every registered worker queue, lets active jobs finish, logs `Workers paused for another database release` once, and idles. Producers and enqueueing continue. When its release owns the marker again and old workers have drained, it registers workers through the normal path and logs `Workers resumed for database release`. Equality permits rollbacks; no version ordering or payload compatibility policy is added. Without that service, the Layer registers its workers at startup and never pauses them.
86
87
 
@@ -129,7 +130,8 @@ export const MailLive = Mail.layer;
129
130
  Define the feature's registrations in `jobs.ts`:
130
131
 
131
132
  ```ts
132
- import { defineQueue, defineSchedule } from "@shivaedev/jobs/server/definition.ts";
133
+ import { defineQueue } from "@shivaedev/jobs/server/definition.ts";
134
+ import { defineSchedule } from "@shivaedev/jobs/server/defineSchedule.ts";
133
135
  import { Effect, Schema } from "effect";
134
136
  import { Mail } from "./services.ts";
135
137
 
@@ -245,9 +247,9 @@ const IndexTitle = defineQueue({
245
247
 
246
248
  `Ingest` fetches one job at a time; `IndexTitle` keeps the default batch of ten. Configure the expiry for the work's expected duration. Increasing `localConcurrency` adds batches; it does not extend any job's window.
247
249
 
248
- The adapter enforces each queue or scheduled job's deadline using pg-boss's `startedOn` and `expireInSeconds`. It skips jobs whose window has already passed and interrupts a running Effect at its deadline. Expired jobs remain for pg-boss's expiry and retry engine. Interruption stops the rest of that batch, as described above.
250
+ The adapter enforces each queue or scheduled job's deadline using pg-boss's `startedOn` and `expireInSeconds`. It reads PostgreSQL time once per claimed batch and translates the remaining expiry to the runtime Clock, so a different runtime date does not change the budget. It skips jobs whose window has already passed and interrupts a running Effect at its deadline. Expired jobs remain for pg-boss's expiry and retry engine. Interruption stops the rest of that batch, as described above.
249
251
 
250
- An interrupted batch waits for pg-boss to release its original claims before returning successfully. Settlement reads use exponential backoff from 25 ms to 500 ms between reads, with a bound of one second after the latest fetched job's deadline, including a read that never resolves. If settlement cannot be observed within that bound, the callback fails with `PgBossError` (`operation: "settle"`, with a redacted `TimeoutError`) and logs the error through the worker's captured Effect context.
252
+ An interrupted batch waits for pg-boss to release its original claims before returning successfully. Settlement reads use exponential backoff from 25 ms to 500 ms between reads, with a bound of one second after the latest fetched job's deadline, including a read that never resolves. If settlement cannot be observed within that bound, the callback fails with `PgBossError` (`operation: "settle"`, with a redacted `TimeoutError` and its readable tag and message) and logs the error through the worker's captured Effect context.
251
253
 
252
254
  Queue handlers can yield `job.remainingBudget`, an `Effect.Effect<Duration.Duration>` that recomputes the time left at each read and clamps it to zero. Use it to size a downstream operation's timeout:
253
255
 
@@ -371,7 +373,7 @@ export const inspectEmail = (id: string) =>
371
373
 
372
374
  `counts(queue)` reads the job table directly on each call. `queuedCount` includes created and retry-waiting jobs, including future jobs; `activeCount` counts running jobs, `failedCount` counts retained failures, and `totalCount` includes retained terminal jobs. A queue has drained when queued and active counts are both zero. These counts are a snapshot, so a producer can enqueue more work after the query returns.
373
375
 
374
- `getJob(queue, id)` returns `None` when the ID is absent, or `Some` pg-boss job metadata with `data` decoded by the queue's Schema. Invalid stored data fails with `PgBossPayloadError`, and the Effect requires the Schema's decoding services. `retry(queue, id)` reuses the original ID: it makes a failed job eligible for another attempt and pulls a retry-waiting job forward to run now. Missing IDs and jobs in other states are left unchanged. It does not remove an earlier copy from the dead-letter queue.
376
+ `getJob(queue, id)` returns `None` when the ID is absent, or `Some` pg-boss job metadata with masked inspection `data: unknown`. The queue's Schema decodes the stored payload before the errors package's redactor masks native `Redacted` values and sensitive keys, including nested objects and arrays. Invalid stored data fails with `PgBossPayloadError`, and the Effect requires the Schema's decoding services. `retry(queue, id)` reuses the original ID: it makes a failed job eligible for another attempt and pulls a retry-waiting job forward to run now. Missing IDs and jobs in other states are left unchanged. Its dead-letter copies stay listed while the retry is pending or fails again; a successful completion removes those copies in the same database transaction.
375
377
 
376
378
  ### List failed and dead-lettered jobs
377
379
 
@@ -387,19 +389,19 @@ export const failedEmails = (cursor?: string) =>
387
389
  const deadLettered = yield* jobs.deadLetteredJobs(SendEmail, { limit: 20 });
388
390
  return {
389
391
  deadLettered: deadLettered.jobs.map((job) => ({ id: job.id, original: Option.getOrNull(job.sourceId), error: job.sourceOutput })),
390
- failed: failed.jobs.map((job) => ({ id: job.id, attempt: job.attempt, error: job.output, userId: job.data.userId })),
392
+ failed: failed.jobs.map((job) => ({ id: job.id, attempt: job.attempt, error: job.output, data: job.data })),
391
393
  next: Option.getOrUndefined(failed.next),
392
394
  };
393
395
  });
394
396
  ```
395
397
 
396
- `health` and `counts` say how many jobs failed; these two listings say which ones and why. `failedJobs(queue, options)` lists the queue's jobs in the `failed` state, the ones that used up their retries. `deadLetteredJobs(queue, options)` lists every job in the queue's dead-letter queue. Dead-letter entries live in the `-dlq` queue: each is a new job with its own ID that pg-boss copied there when the original failed for good. Both listings read pg-boss's `job` table on each call, through the jobs Layer's own pg-boss connection and in its configured schema, so applications never query pg-boss tables themselves. A custom client needs the native `getDb` capability for them.
398
+ `health` and `counts` say how many jobs failed; these two listings say which ones and why. `failedJobs(queue, options)` lists the queue's jobs in the `failed` state, the ones that used up their retries. `deadLetteredJobs(queue, options)` lists every job in the queue's dead-letter queue. Dead-letter entries live in the `-dlq` queue: each is a new job with its own ID that pg-boss copied there when the original failed for good. Both listings read pg-boss's `job` table on each call, through the jobs Layer's own pg-boss connection and in its configured schema, so applications never query pg-boss tables themselves. A custom client needs the native `getDb` capability for them. Automatic migration and `installPgBossSchema` install the completion trigger that clears resolved copies, including copies whose retained source already completed. Applications using `migrate: false` must run `installPgBossSchema` when upgrading.
397
399
 
398
400
  Each page holds at most `limit` jobs, newest first by creation time; a dead-letter copy is created when its original fails for good. `limit` must be a positive integer. When more jobs remain, `next` is `Some` opaque cursor; pass it back as `cursor` for the following page, and stop when `next` is `None`. Paging continues from the last job it returned, so jobs that fail while you page appear in a fresh listing instead of shifting later pages, and no job appears twice. A malformed cursor or limit fails with `SchemaError` before pg-boss is called.
399
401
 
400
- An entry carries the job's `id`, `queue`, native `state`, `retryCount`, `retryLimit` and `attempt`, the one-based number of its last started attempt (zero for a job that never started). `createdOn` is a UTC `DateTime`; `startedOn` and `completedOn` are `Option`s of UTC `DateTime`s. `output` is `JobFailure | null`, decoded through `JobFailure` from `@shivaedev/jobs/JobFailure.ts`. Handler failures store only `{ _tag: string, message: string }`, with the message redacted through `@shivaedev/errors`; stack traces, cause chains and other error fields are omitted. `null` means pg-boss stored no output. Native pg-boss failures without a tag decode with `_tag: "Error"`; decoding also redacts messages from older stored failures. Stored output that does not match the Schema fails the listing with `PgBossPayloadError`. `data` is decoded by the queue's Schema, including traced payloads; invalid stored data fails the listing with `PgBossPayloadError`, as `getJob` does, and the Effect requires the Schema's decoding services. A dead-letter entry adds `sourceId`, the original job's ID as an `Option`, and `sourceOutput`, the original's decoded `JobFailure | null`. The copy has not run, so its own `output` stays `null` and its `attempt` is zero.
402
+ An entry carries the job's `id`, `queue`, native `state`, `retryCount`, `retryLimit` and `attempt`, the one-based number of its last started attempt (zero for a job that never started). `createdOn` is a UTC `DateTime`; `startedOn` and `completedOn` are `Option`s of UTC `DateTime`s. `output` is `JobFailure | null`, decoded through `JobFailure` from `@shivaedev/jobs/JobFailure.ts`. Handler failures store only `{ _tag: string, message: string }`, with the message redacted through `@shivaedev/errors`; stack traces, cause chains and other error fields are omitted. `null` means pg-boss stored no output. Native pg-boss failures without a tag decode with `_tag: "Error"`; decoding also redacts messages from older stored failures. Stored output that does not match the Schema fails the listing with `PgBossPayloadError`. `data: unknown` is decoded by the queue's JSON codec and masked through the errors package's redactor, including traced payloads; invalid stored data fails the listing with `PgBossPayloadError`, as `getJob` does, and the Effect requires the Schema's decoding services. A dead-letter entry adds `sourceQueue`, the source queue name without the dead-letter suffix, `sourceId`, the original job's ID as an `Option`, and `sourceOutput`, the original's decoded `JobFailure | null`. The copy has not run, so its own `output` stays `null` and its `attempt` is zero.
401
403
 
402
- Pass a failed entry's `id` to `retry(queue, id)` to run that job again under its original ID; once it completes it leaves the failed listing. Dead-letter IDs belong to the `-dlq` queue, so `retry(queue, id)` does not find them and leaves them unchanged.
404
+ Pass a failed entry's `id` to `retry(queue, id)` to run that job again under its original ID; once it completes it leaves the failed listing and its copies leave the dead-letter listing. Dead-letter IDs belong to the `-dlq` queue, so `retry(queue, id)` does not find them and leaves them unchanged.
403
405
 
404
406
  ### Queue settings on startup
405
407
 
@@ -517,30 +519,39 @@ Set `retryPolicy: testRetryPolicy` through the controller to override queue and
517
519
 
518
520
  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.
519
521
 
522
+ `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:
523
+
524
+ ```ts
525
+ yield* testing.untilJob(SendEmail, id, "completed", { within: "5 seconds" });
526
+ // Gave up after 5s waiting until job <id> in send-email is completed; last seen: retry
527
+ ```
528
+
520
529
  ### API
521
530
 
522
531
  Import the module that defines the name; the package has no root entry.
523
532
 
524
- | Module | Public names |
525
- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
526
- | `@shivaedev/jobs/server/definition.ts` | `defineQueue`, `defineSchedule`, `jobContext`, `RetryAt`; `DefineQueueOptions`, `DefineScheduleOptions`, `JobContext`, `JobPayloadSchema`, `JobRegistration`, `QueueDefinition`, `QueueOptions`, `QueuePolicy`, `QueueWorker`, `RegistrationRequirements`, `ScheduleDefinition`, `ScheduledWorker` |
527
- | `@shivaedev/jobs/server/service.ts` | `makePgBoss`, `pgBossLayer`; `PgBossDefinition`, `PgBossLayerOptions`, `PgBossOptions`, `PgBossService` |
528
- | `@shivaedev/jobs/server/PgBoss.ts` | `PgBoss`: the shared client Context service. |
529
- | `@shivaedev/jobs/server/schema.ts` | `installPgBossSchema`, `pgBossSchema`; `PgBossSchemaOptions` |
530
- | `@shivaedev/jobs/server/health.ts` | `deadLetterQueueName`; `DeadLetteredJob`, `JobPage`, `JobPageOptions`, `JobsHealth`, `ListedJob`, `QueueCounts`, `QueueHealth` |
531
- | `@shivaedev/jobs/server/error.ts` | `PgBossError`, `PgBossPayloadError`, `PgBossQueueNamesError`, `PgBossQueueOptionsError`, `PgBossClientOptionsError`, `PgBossTestingError`, `toPgBossError`; `PgBossOperation` |
532
- | `@shivaedev/jobs/server/client.ts` | `defaultClientFactory`; `PgBossClient`, `PgBossClientFactory` |
533
- | `@shivaedev/jobs/server/testing.ts` | `makePgBossTesting`, `testRetryPolicy`; `PgBossTesting`, `PgBossTestingOptions`, `SnapshotQueue`, `UnfinishedJob` |
533
+ | Module | Public names |
534
+ | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
535
+ | `@shivaedev/jobs/server/definition.ts` | `defineQueue`, `jobContext`, `RetryAt`; `DefineQueueOptions`, `DefineScheduleOptions`, `JobContext`, `JobPayloadSchema`, `JobRegistration`, `QueueDefinition`, `QueueOptions`, `QueuePolicy`, `QueueWorker`, `RegistrationRequirements`, `ScheduleDefinition`, `ScheduledWorker` |
536
+ | `@shivaedev/jobs/server/service.ts` | `makePgBoss`, `pgBossLayer`; `PgBossDefinition`, `PgBossLayerOptions`, `PgBossOptions`, `PgBossService` |
537
+ | `@shivaedev/jobs/server/PgBoss.ts` | `PgBoss`: the shared client Context service. |
538
+ | `@shivaedev/jobs/server/schema.ts` | `installPgBossSchema`, `pgBossSchema`; `PgBossSchemaOptions` |
539
+ | `@shivaedev/jobs/server/health.ts` | `deadLetterQueueName`; `DeadLetteredJob`, `JobPage`, `JobPageOptions`, `JobsHealth`, `ListedJob`, `QueueCounts`, `QueueHealth` |
540
+ | `@shivaedev/jobs/server/error.ts` | `PgBossError`, `PgBossPayloadError`, `PgBossQueueNamesError`, `PgBossQueueOptionsError`, `PgBossClientOptionsError`, `PgBossTestingError`, `PgBossWaitError`, `toPgBossError`; `PgBossOperation` |
541
+ | `@shivaedev/jobs/server/client.ts` | `PgBossClient`, `PgBossClientFactory` |
542
+ | `@shivaedev/jobs/server/testing.ts` | `makePgBossTesting`, `testRetryPolicy`; `PgBossTesting`, `PgBossTestingOptions`, `PgBossTestingWaitOptions`, `SnapshotQueue`, `UnfinishedJob` |
543
+ | `@shivaedev/jobs/server/defineSchedule.ts` | `defineSchedule` |
544
+ | `@shivaedev/jobs/server/defaultClientFactory.ts` | `defaultClientFactory` |
534
545
 
535
546
  The definition options keep the pg-boss names: `queue` uses `QueueOptions` (`Queue` except `name` and `deadLetter`, with literal `QueuePolicy` values and `maxDeferrals`), `worker` uses `WorkOptions`, and a schedule's `schedule` uses `ScheduleOptions`. A queue also requires `name` and `schema`; a schedule requires `name` and `cron`.
536
547
 
537
- `Jobs.layer(options)` accepts pg-boss `ConstructorOptions` plus the adapter's own options. Custom clients must supply native `complete` and `fail` capabilities to register queue or schedule workers; missing settlement capabilities fail Layer acquisition with a registration `PgBossError`. Producer-only clients do not need them. Custom clients can also supply the optional native capabilities `findJobs`, `retry`, `update`, `getDb` and `updateQueue` for lookup, retry, live counts and listings, deferral and reconciliation; a requested operation fails with `PgBossError` if its required capability is absent.
548
+ `Jobs.layer(options)` accepts pg-boss `ConstructorOptions` plus the adapter's own options. Custom clients must supply native `complete` and `fail` capabilities to register queue or schedule workers; missing settlement capabilities fail Layer acquisition with a registration `PgBossError`. Workers also require `getDb()` to read the PostgreSQL clock when a batch arrives. Producer-only clients do not need these capabilities. Custom clients can also supply the optional native capabilities `findJobs`, `retry`, `update`, `getDb` and `updateQueue` for lookup, retry, live counts and listings, deferral and reconciliation; a requested operation fails with `PgBossError` if its required capability is absent.
538
549
 
539
550
  `onError` handles pg-boss client `error` events using the services captured by the Layer. Only the owning jobs service is supplied automatically; a handler using another jobs definition still requires that definition's Layer.
540
551
 
541
- Worker registration always requests `includeMetadata: true`, including when `worker` supplies `includeMetadata: false`; custom clients must return pg-boss's `startedOn` metadata. When calling `jobContext` directly, reading `remainingBudget` requires that same metadata.
552
+ Worker registration always requests `includeMetadata: true`, including when `worker` supplies `includeMetadata: false`; custom clients must return pg-boss's `startedOn` metadata. Direct callers use `jobContext(job, deadline)`, where `deadline` is in runtime Clock milliseconds: measure the remaining expiry against PostgreSQL time, then add it to the runtime Clock time. Registered workers receive that translation automatically.
542
553
 
543
- `PgBossError` has `operation`, optional `queue` and a `Redacted` `original`. Its message names the operation, the queue and the original error's class and `code`, such as a PostgreSQL SQLSTATE, but never the original message, which can quote payloads or connection strings. A registration failure names the queue it was preparing. `PgBossPayloadError` has `direction`, `queue` and a `Redacted` `original`. Those fields distinguish the pg-boss operation from the payload boundary.
554
+ `PgBossError` has `operation`, optional `queue` and a `Redacted` `original`. Its message names the operation and the queue. For `settle`, it includes the original failure's tag and message through the same redaction as stored job failures. Other operations show only the original error's class and `code`, such as a PostgreSQL SQLSTATE, because the original message can quote payloads or connection strings. A registration failure names the queue it was preparing. `PgBossPayloadError` has `direction`, `queue` and a `Redacted` `original`. Those fields distinguish the pg-boss operation from the payload boundary.
544
555
 
545
556
  ### Install, setup and limits
546
557
 
@@ -553,3 +564,17 @@ The package requires Node.js 24 or later and PostgreSQL. `effect` and `pg-boss`
553
564
  `connectionString` configures pg-boss's own `pg` Pool, separately from the application's Effect SQL pool, and pg-boss's driver decides how its `sslmode` behaves. Set the TLS mode in that URL; the [framework database connection security guide](https://github.com/ShivaeDev/platform/blob/main/docs/framework/quickstart.md#database-connection-security) compares the drivers and the application's connection paths.
554
565
 
555
566
  Provide the database connection and job registrations at the application runtime boundary. Application services own the domain work and provider calls; pg-boss owns queue execution. When `SqlClient` is provided and a SQL transaction is active, `enqueue` uses pg-boss’s per-call `db` option on that transaction’s connection. The application write and queued jobs commit or roll back together. The jobs client and SQL client must use the same PostgreSQL database. Outside a transaction, enqueueing keeps using the jobs client as usual. To keep enqueueing independent of an application transaction, move it after the transaction returns and handle its failure separately.
567
+
568
+ ### Secret payload fields
569
+
570
+ Use native `Schema.Redacted` or `Schema.RedactedFromValue` for fields such as one-time links. Jobs uses Effect's JSON codec at the durable boundary, so PostgreSQL stores the real value and the worker receives a `Redacted` value it can unwrap with `Redacted.value`. This masks inspection data; it does not encrypt queue storage.
571
+
572
+ ```ts
573
+ const Confirmation = defineQueue({
574
+ name: "confirmation",
575
+ schema: Schema.Struct({ href: Schema.Redacted(Schema.String) }),
576
+ });
577
+ const sendConfirmation = Confirmation.handle(({ href }) => sendMail(Redacted.value(href)));
578
+ ```
579
+
580
+ `getJob`, `failedJobs` and `deadLetteredJobs` expose masked diagnostic data, without recoverable `Redacted` wrappers. Worker log messages and annotations use the errors package's redaction policy too. Keep secrets wrapped when logging or constructing errors; unwrapping a value into arbitrary text removes its sensitivity marker. The existing errors redactor bounds diagnostic depth, collection size and text length.
@@ -0,0 +1,4 @@
1
+ import { Effect } from "effect";
2
+ import type { PgBossClient } from "#client.ts";
3
+ export declare const batchClockOffset: (client: PgBossClient, schema: string, name: string) => Effect.Effect<number, import("#error.ts").PgBossError, never>;
4
+ //# sourceMappingURL=batchClockOffset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batchClockOffset.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/batchClockOffset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,eAAO,MAAM,gBAAgB,uHAW3B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Clock, Effect } from "effect";
2
+ import { toPgBossError } from "#error.ts";
3
+ import { quotedSchema } from "#internal/storedRows.ts";
4
+ export const batchClockOffset = Effect.fnUntraced(function* (client, schema, name) {
5
+ const { rows } = yield* Effect.tryPromise({
6
+ catch: (error) => toPgBossError("settle", error, name),
7
+ try: () => {
8
+ if (client.getDb === undefined) {
9
+ throw new TypeError("This pg-boss client does not expose its database clock");
10
+ }
11
+ return client.getDb().executeSql(`SELECT EXTRACT(EPOCH FROM ${quotedSchema(schema)}.job_now()) * 1000 AS now`);
12
+ },
13
+ });
14
+ return (yield* Clock.currentTimeMillis) - Number(rows[0].now);
15
+ });
16
+ //# sourceMappingURL=batchClockOffset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batchClockOffset.js","sourceRoot":"","sources":["../../../src/server/adapters/batchClockOffset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAoB,EAAE,MAAc,EAAE,IAAY;IAC9G,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QACzC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC;QACtD,GAAG,EAAE,GAAG,EAAE;YACT,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBAChC,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC,CAAC;YAC/E,CAAC;YACD,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,6BAA6B,YAAY,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;QAChH,CAAC;KACD,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Effect } from "effect";
2
+ export declare const clientErrorReporter: <R>(report: (error: Error) => Effect.Effect<unknown, never, R>) => Effect.Effect<(error: Error) => void, never, R>;
3
+ //# sourceMappingURL=clientErrorReporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientErrorReporter.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/clientErrorReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,mBAAmB,GAAgC,CAAC,kBAAkB,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,2BAE7G,KAAK,KAAG,IAAI,WAG1B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Effect } from "effect";
2
+ export const clientErrorReporter = Effect.fnUntraced(function* (report) {
3
+ const run = Effect.runPromiseWith(yield* Effect.context());
4
+ return (error) => {
5
+ void run(Effect.exit(report(error)));
6
+ };
7
+ });
8
+ //# sourceMappingURL=clientErrorReporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientErrorReporter.js","sourceRoot":"","sources":["../../../src/server/adapters/clientErrorReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAK,MAA0D;IAC5H,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,EAAK,CAAC,CAAC;IAC9D,OAAO,CAAC,KAAY,EAAQ,EAAE;QAC7B,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Effect } from "effect";
2
+ import { SqlClient } from "effect/sql";
3
+ import type { PgBossSchemaOptions } from "#schema.ts";
4
+ export declare const installSchema: (options: PgBossSchemaOptions) => Effect.Effect<void, unknown, import("effect/Scope").Scope | SqlClient.SqlClient>;
5
+ //# sourceMappingURL=installSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installSchema.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/installSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA+CtD,eAAO,MAAM,aAAa,oHAcxB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { SqlClient } from "effect/sql";
3
+ import { getConstructionPlans, getMigrationPlans, PgBoss } from "pg-boss";
4
+ import pgBossPackage from "pg-boss/package.json" with { type: "json" };
5
+ import { jobStorePlans } from "#internal/jobStorePlans.ts";
6
+ import { runSchemaPlan } from "./runSchemaPlan.js";
7
+ import { resumeSchemaIndexes } from "./schemaIndexBuilds.js";
8
+ const Partitions = Schema.Array(Schema.Struct({
9
+ policy: Schema.String,
10
+ tableName: Schema.String,
11
+ }));
12
+ async function installNativeSchema(connection, options, run) {
13
+ const schema = options.schema ?? "pgboss";
14
+ const construction = getConstructionPlans(schema);
15
+ const client = new PgBoss({
16
+ db: { executeSql: async (text, values = []) => ({ rows: Array.from(await run(connection.executeUnprepared(text, values, undefined))) }) },
17
+ schema,
18
+ });
19
+ if (!(await client.isInstalled())) {
20
+ await runSchemaPlan(connection, construction, run);
21
+ return;
22
+ }
23
+ const version = await client.schemaVersion();
24
+ if (version === null) {
25
+ throw new Error("The pg-boss version table is empty");
26
+ }
27
+ if (version > pgBossPackage.pgboss.schema) {
28
+ return;
29
+ }
30
+ if (version >= 27) {
31
+ await resumeSchemaIndexes(client, schema);
32
+ }
33
+ if (version < pgBossPackage.pgboss.schema) {
34
+ const partitionTables = Schema.decodeUnknownSync(Partitions)(await run(connection.executeUnprepared(`SELECT table_name AS "tableName", policy FROM ${schema}.queue WHERE partition = true`, [], undefined)));
35
+ await runSchemaPlan(connection, getMigrationPlans(schema, version, { partitionTables: Array.from(partitionTables) }), run, {
36
+ schema,
37
+ version: pgBossPackage.pgboss.schema,
38
+ });
39
+ await resumeSchemaIndexes(client, schema);
40
+ }
41
+ }
42
+ export const installSchema = Effect.fnUntraced(function* (options) {
43
+ const sql = yield* SqlClient.SqlClient;
44
+ const connection = yield* sql.reserve;
45
+ const run = Effect.runPromiseWith(yield* Effect.context());
46
+ yield* Effect.tryPromise({
47
+ catch: (error) => error,
48
+ try: async (signal) => {
49
+ const execute = (effect) => run(effect, { signal });
50
+ await installNativeSchema(connection, options, execute);
51
+ },
52
+ });
53
+ for (const plan of jobStorePlans(options.schema ?? "pgboss")) {
54
+ yield* connection.executeRaw(plan, []);
55
+ }
56
+ });
57
+ //# sourceMappingURL=installSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installSchema.js","sourceRoot":"","sources":["../../../src/server/adapters/installSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,aAAa,MAAM,sBAAsB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAC9B,MAAM,CAAC,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM;CACxB,CAAC,CACF,CAAC;AACF,KAAK,UAAU,mBAAmB,CACjC,UAAsB,EACtB,OAA4B,EAC5B,GAAsD;IAEtD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC;IAC1C,MAAM,YAAY,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACzB,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE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BAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,OAA4B;IACrF,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC;IACvC,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;IACtC,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,EAAS,CAAC,CAAC;IAClE,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;QACxB,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;QACvB,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACrB,MAAM,OAAO,GAAe,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YAChE,MAAM,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACzD,CAAC;KACD,CAAC,CAAC;IACH,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC,EAAE,CAAC;QAC9D,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACxC,CAAC;AACF,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Effect, Scope } from "effect";
2
+ import type { Job, WorkOptions } from "pg-boss";
3
+ import type { PgBossClient } from "#client.ts";
4
+ export declare const registerWorker: <R>(client: PgBossClient, name: string, options: WorkOptions, run: (job: Job<unknown>, deadline: number) => Effect.Effect<unknown, unknown, R>, scope: Scope.Scope, schema: string, maxDeferrals: number, graceful: boolean) => Effect.Effect<string, import("#error.ts").PgBossError, R>;
5
+ //# sourceMappingURL=registerWorker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerWorker.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/registerWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO/C,eAAO,MAAM,cAAc,GAAgC,CAAC,uEAIhD,GAAG,CAAC,OAAO,CAAC,YAAY,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,2IAkC/E,CAAC"}
@@ -4,17 +4,18 @@ import { batchHandler } from "#internal/batchHandler.ts";
4
4
  import { deferrableAttempt } from "#internal/deferrableAttempt.ts";
5
5
  import { retryWake } from "#internal/retryWake.ts";
6
6
  import { traceJob } from "#internal/tracing.ts";
7
- export const registerWorker = Effect.fnUntraced(function* (client, name, options, run, scope, schema, maxDeferrals, context, execute, graceful) {
7
+ export const registerWorker = Effect.fnUntraced(function* (client, name, options, run, scope, schema, maxDeferrals, graceful) {
8
+ const execute = Effect.runPromiseWith(yield* Effect.context());
8
9
  const fibers = yield* Scope.fork(scope);
9
- function runJob(job) {
10
- return Effect.provide(traceJob(deferrableAttempt(run(job), client, schema, job, maxDeferrals), job, name), context);
10
+ function runJob(job, deadline) {
11
+ return traceJob(deferrableAttempt(run(job, deadline), client, schema, job, maxDeferrals), job, name);
11
12
  }
12
13
  function afterFailure(attempt) {
13
14
  return retryWake(client, name, attempt.id, registration).pipe(Effect.forkIn(fibers), Effect.asVoid);
14
15
  }
15
16
  const handle = yield* Effect.try({
16
17
  catch: (error) => toPgBossError("register", error, name),
17
- try: () => batchHandler(client, name, runJob, afterFailure),
18
+ try: () => batchHandler(client, name, schema, runJob, afterFailure),
18
19
  });
19
20
  const registration = yield* Effect.try({
20
21
  catch: (error) => toPgBossError("register", error, name),
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerWorker.js","sourceRoot":"","sources":["../../../src/server/adapters/registerWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EACxD,MAAoB,EACpB,IAAY,EACZ,OAAoB,EACpB,GAAgF,EAChF,KAAkB,EAClB,MAAc,EACd,YAAoB,EACpB,QAAiB;IAEjB,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,EAAK,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,SAAS,MAAM,CAAC,GAAiB,EAAE,QAAgB;QAClD,OAAO,QAAQ,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACtG,CAAC;IACD,SAAS,YAAY,CAAC,OAAqB;QAC1C,OAAO,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,M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D,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;KACvD,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CACtC,CAAC;IACF,OAAO,EAAE,CAAC;AACX,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runSchemaPlan.d.ts","sourceRoot":"","sources":["../../../src/server/internal/runSchemaPlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG3D,wBAAsB,aAAa,CAClC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EACtD,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC7D,OAAO,CAAC,IAAI,CAAC,CAsBf"}
1
+ {"version":3,"file":"runSchemaPlan.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/runSchemaPlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG3D,wBAAsB,aAAa,CAClC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,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,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACnH,kFAAkF;IAClF,MAAM,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,iBAAiB,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC1G,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,KAAK,MAAM,SAAS,IAAI,QAAQ,EAAE,CAAC;YAClC,MAAM,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;QACjD,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"schemaIndexBuilds.d.ts","sourceRoot":"","sources":["../../../src/server/internal/schemaIndexBuilds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAmBtC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAQzI;AAED,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBvF"}
1
+ {"version":3,"file":"schemaIndexBuilds.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/schemaIndexBuilds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAmBtC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAA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,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAChI,CAAC;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"testingExpirations.d.ts","sourceRoot":"","sources":["../../../src/server/internal/testingExpirations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAExD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM;IAG/C,WAAW,QAAQ,GAAG,CAAC,OAAO,CAAC;IAC/B,IAAI,OAAO,MAAM,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,WAAW,WAAW,YAAY,MAAM,GAAG,SAAS;EAwBvG"}
1
+ {"version":3,"file":"testingExpirations.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/testingExpirations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAExD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM;IAG/C,WAAW,QAAQ,GAAG,CAAC,OAAO,CAAC;IAC/B,IAAI,OAAO,MAAM,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,WAAW,WAAW,YAAY,MAAM,GAAG,SAAS;EAwBvG"}
@@ -1 +1 @@
1
- {"version":3,"file":"testingExpirations.js","sourceRoot":"","sources":["../../../src/server/internal/testingExpirations.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAChD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuC,CAAC;IACjE,OAAO;QACN,WAAW,EAAE,CAAC,GAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;QAC1E,IAAI,CAAC,IAAY,EAAE,IAA+B,EAAE,OAAoB,EAAE,QAA4B;YACrG,IAAI,QAAQ,KAAK,SA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C7B,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"transactionDb.d.ts","sourceRoot":"","sources":["../../../src/server/internal/transactionDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAczD,CAAC"}
1
+ {"version":3,"file":"transactionDb.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/transactionDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAczD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"transactionDb.js","sourceRoot":"","sources":["../../../src/server/internal/transactionDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,MAAM,CAAC,MAAM,aAAa,GAAqC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClF,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7D,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC9E,IAAI,MAA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C,KAAK,CAAC;IACvC,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,EAAS,CAAC,CAAC;IAClE,OAAO;QACN,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;KACjI,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Effect } from "effect";
2
+ export declare function workerDiagnostics<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, Exclude<R, never>>;
3
+ //# sourceMappingURL=workerDiagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerDiagnostics.d.ts","sourceRoot":"","sources":["../../../src/server/adapters/workerDiagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAsB,MAAM,QAAQ,CAAC;AAuB7D,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,0CAIxE"}
@@ -0,0 +1,24 @@
1
+ import { Context, Effect, Logger, References } from "effect";
2
+ import { redact } from "@shivaedev/errors/redact.ts";
3
+ import { redactDiagnosticCause } from "@shivaedev/errors/redactCause.ts";
4
+ import { isSensitiveKey, REDACTED } from "@shivaedev/errors/sensitive.ts";
5
+ function maskedLogger(logger) {
6
+ return Logger.make((options) => {
7
+ const context = options.fiber.context;
8
+ const annotations = Object.fromEntries(Object.entries(options.fiber.getRef(References.CurrentLogAnnotations)).map(([key, value]) => [
9
+ key,
10
+ isSensitiveKey(key) ? REDACTED : redact(value),
11
+ ]));
12
+ options.fiber.setContext(Context.add(context, References.CurrentLogAnnotations, annotations));
13
+ try {
14
+ return logger.log({ ...options, cause: redactDiagnosticCause(options.cause), message: redact(options.message) });
15
+ }
16
+ finally {
17
+ options.fiber.setContext(context);
18
+ }
19
+ });
20
+ }
21
+ export function workerDiagnostics(effect) {
22
+ return Effect.flatMap(Logger.CurrentLoggers, (loggers) => Effect.provideService(effect, Logger.CurrentLoggers, new Set([...loggers].map(maskedLogger))));
23
+ }
24
+ //# sourceMappingURL=workerDiagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerDiagnostics.js","sourceRoot":"","sources":["../../../src/server/adapters/workerDiagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1E,SAAS,YAAY,CAAC,MAAuC;IAC5D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QACtC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CACrC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;YAC5F,GAAG;YACH,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9C,CAAC,CACF,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC,CAAC;QAC9F,IAAI,CAAC;YACJ,OAAO,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAClH,CAAC;gBAAS,CAAC;YACV,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAU,MAA8B;IACxE,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CACxD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAC7F,CAAC;AACH,CAAC"}
@@ -21,5 +21,4 @@ export interface PgBossClient {
21
21
  readonly work: (name: string, options: WorkOptions, handler: (jobs: readonly Job<unknown>[]) => Promise<unknown>) => Promise<string>;
22
22
  }
23
23
  export type PgBossClientFactory = (options: ConstructorOptions) => PgBossClient;
24
- export declare const defaultClientFactory: PgBossClientFactory;
25
24
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/server/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,GAAG,EACH,eAAe,EACf,MAAM,EACN,KAAK,EACL,WAAW,EACX,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,QAAQ,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AAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClH,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACrG,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IAC7C,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACrI;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,YAAY,CAAC"}
@@ -1,3 +1,2 @@
1
- import { nativeClient } from "#internal/nativeClient.ts";
2
- export const defaultClientFactory = nativeClient;
1
+ export {};
3
2
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/server/client.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AA0BzD,MAAM,CAAC,MAAM,oBAAoB,GAAwB,YAAY,CAAC"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/server/client.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { type ConstructorOptions, PgBoss } from "pg-boss";
2
+ export declare function defaultClientFactory(options: ConstructorOptions): PgBoss;
3
+ //# sourceMappingURL=defaultClientFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultClientFactory.d.ts","sourceRoot":"","sources":["../../src/server/defaultClientFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,UA0B/D"}
@@ -1,6 +1,6 @@
1
1
  import { Socket } from "node:net";
2
2
  import { PgBoss } from "pg-boss";
3
- export function nativeClient(options) {
3
+ export function defaultClientFactory(options) {
4
4
  const disconnected = new Set();
5
5
  const config = {
6
6
  ...options,
@@ -25,4 +25,4 @@ export function nativeClient(options) {
25
25
  };
26
26
  return client;
27
27
  }
28
- //# sourceMappingURL=nativeClient.js.map
28
+ //# sourceMappingURL=defaultClientFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultClientFactory.js","sourceRoot":"","sources":["../../src/server/defaultClientFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAA2B,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,UAAU,oBAAoB,CAAC,OAA2B;IAC/D,MAAM,YAAY,GAAG,IAAI,GAAG,EAAiB,CAAC;IAC9C,MAAM,MAAM,GAAG;QACd,GAAG,OAAO;QACV,MAAM,EAAE,GAAG,EAAE;YACZ,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;YAC5B,MAAM,MAAM,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAC5C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;gBACzB,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC5B,OAAO,EAAE,CAAC;YACX,CAAC,CAAC,CACF,CAAC;YACF,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACzB,OAAO,MAAM,CAAC;QACf,CAAC;KACD,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,WAAW,EAAE,EAAE;QACnC,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC;QACxB,0EAA0E;QAC1E,IAAI,WAAW,EAAE,KAAK,KAAK,KAAK,EAAE,CAAC;YAClC,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;QACtC,CAAC;IACF,CAAC,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC"}