refactor(cron): keep receipt hooks internal

This commit is contained in:
Peter Steinberger
2026-08-12 18:10:22 -07:00
parent 08dcfa8167
commit 193b50950c
4 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -1,4 +1,3 @@
import type { CronStoreTransactionHooks } from "../store.js";
import {
assertCronRunReceiptCurrent,
assertCronRunReceiptCurrentInDatabase,
@@ -9,6 +8,7 @@ import {
type CronRunReceiptHandle,
type CronRunReceiptStatus,
} from "../store/run-receipt-store.js";
import type { CronStoreTransactionHooks } from "../store/transaction-hooks.js";
import type { CronJob, CronRunStatus } from "../types.js";
import { resolveEffectiveJobAgentId } from "./ops-shared.js";
import type { CronServiceState } from "./state.js";
+1 -1
View File
@@ -9,9 +9,9 @@ import {
getCronJobsStoreRevision,
loadCronJobsStoreWithConfigJobs,
saveCronJobsStore,
type CronStoreTransactionHooks,
type QuarantinedCronConfigJob,
} from "../store.js";
import type { CronStoreTransactionHooks } from "../store/transaction-hooks.js";
import type { CronJob, CronStoreFile } from "../types.js";
import { computeJobNextRunAtMs, recomputeNextRuns } from "./jobs-scheduling.js";
import { assertTimeScheduleSatisfiable } from "./jobs-validation.js";
+1 -7
View File
@@ -28,6 +28,7 @@ import {
repairCronRuntimeAuthorityRows,
replaceCronRuntimeAuthorityRows,
} from "./store/runtime-authority-store.js";
import type { CronStoreTransactionHooks } from "./store/transaction-hooks.js";
import type {
CronQuarantinedJob,
LoadedCronStore,
@@ -236,13 +237,6 @@ type SaveCronStoreOptions = {
stateOnly?: boolean;
};
export type CronStoreTransactionHooks = {
/** Runs inside the authoritative write transaction before cron rows change. */
beforeWrite?: (db: DatabaseSync) => void;
/** Runs after row changes but before the same transaction commits. */
afterWrite?: (db: DatabaseSync) => void;
};
type SaveCronJobsStoreOptions = SaveCronStoreOptions & {
quarantine?: {
entries: readonly (QuarantinedCronConfigJob | CronQuarantinedJob)[];
+6
View File
@@ -0,0 +1,6 @@
import type { DatabaseSync } from "node:sqlite";
export type CronStoreTransactionHooks = {
beforeWrite?: (db: DatabaseSync) => void;
afterWrite?: (db: DatabaseSync) => void;
};