@ultimat3/jobs 22.6.2 → 22.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/jobs",
3
- "version": "22.6.2",
3
+ "version": "22.7.1",
4
4
  "description": "Durable background work: steps, transactional outbox, cron tasks, one driver interface",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,10 +32,10 @@
32
32
  "test": "bun test"
33
33
  },
34
34
  "dependencies": {
35
- "@ultimat3/core": "22.6.2",
36
- "@ultimat3/db": "22.6.2",
37
- "@ultimat3/entity": "22.6.2",
38
- "@ultimat3/schema": "22.6.2",
39
- "@ultimat3/time": "22.6.2"
35
+ "@ultimat3/core": "22.7.1",
36
+ "@ultimat3/db": "22.7.1",
37
+ "@ultimat3/entity": "22.7.1",
38
+ "@ultimat3/schema": "22.7.1",
39
+ "@ultimat3/time": "22.7.1"
40
40
  }
41
41
  }
package/src/index.ts CHANGED
@@ -308,7 +308,7 @@ export type {
308
308
  TaskHandle,
309
309
  TaskJobResult,
310
310
  } from './task';
311
- export { getTask, isTaskHandle, registeredTasks, resetTasks, task } from './task';
311
+ export { getTask, isTaskHandle, registeredTasks, resetTasks, restoreTasks, task } from './task';
312
312
  /**
313
313
  * The tenant a job's body runs under. The TYPE only: `NO_JOB_TENANT`, `jobRunActor` and
314
314
  * `jobTenantFor` stay unexported. The first would be a second spelling of `'none'` (axiom 1 — the
package/src/task.ts CHANGED
@@ -259,3 +259,13 @@ export function resetTasks(): void {
259
259
  registry.clear();
260
260
  anonymous = 0;
261
261
  }
262
+
263
+ /**
264
+ * Put the registry back to exactly `handles` — `@ultimat3/testing`'s between-files restore, so a
265
+ * task one test file registers in a test body does not fire in the next file's scheduler round.
266
+ * Each handle keeps the name it was registered under.
267
+ */
268
+ export function restoreTasks(handles: readonly TaskHandle[]): void {
269
+ registry.clear();
270
+ for (const handle of handles) registry.set(handle.name, handle);
271
+ }