@vite-hub/schedule 0.0.0 → 0.0.2

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.
@@ -0,0 +1,59 @@
1
+ import { parseCronExpression } from "cron-schedule";
2
+ //#region src/runtime/due.ts
3
+ const weekdayIndexes = new Map([
4
+ ["Sun", 0],
5
+ ["Mon", 1],
6
+ ["Tue", 2],
7
+ ["Wed", 3],
8
+ ["Thu", 4],
9
+ ["Fri", 5],
10
+ ["Sat", 6]
11
+ ]);
12
+ function scheduleDateFields(scheduledAt, timeZone) {
13
+ if (!timeZone) return {
14
+ day: scheduledAt.getUTCDate(),
15
+ hour: scheduledAt.getUTCHours(),
16
+ minute: scheduledAt.getUTCMinutes(),
17
+ month: scheduledAt.getUTCMonth(),
18
+ weekday: scheduledAt.getUTCDay()
19
+ };
20
+ const parts = new Intl.DateTimeFormat("en-US", {
21
+ day: "numeric",
22
+ hour: "numeric",
23
+ hourCycle: "h23",
24
+ minute: "numeric",
25
+ month: "numeric",
26
+ timeZone,
27
+ weekday: "short"
28
+ }).formatToParts(scheduledAt);
29
+ const values = new Map(parts.map((part) => [part.type, part.value]));
30
+ const weekday = weekdayIndexes.get(values.get("weekday") || "");
31
+ const day = Number(values.get("day"));
32
+ const hour = Number(values.get("hour"));
33
+ const minute = Number(values.get("minute"));
34
+ const month = Number(values.get("month")) - 1;
35
+ if (weekday === void 0 || [
36
+ day,
37
+ hour,
38
+ minute,
39
+ month
40
+ ].some((value) => !Number.isInteger(value))) throw new TypeError(`Runtime Schedule time zone could not resolve calendar fields: ${timeZone}`);
41
+ return {
42
+ day,
43
+ hour,
44
+ minute,
45
+ month,
46
+ weekday
47
+ };
48
+ }
49
+ function isRuntimeScheduleDue(schedule, scheduledAt) {
50
+ if (scheduledAt.getUTCSeconds() !== 0 || scheduledAt.getUTCMilliseconds() !== 0) return false;
51
+ if (schedule.cron.trim().split(/\s+/).length !== 5) throw new TypeError(`Runtime Schedule "${schedule.id}" must use a five-field cron expression.`);
52
+ const cron = parseCronExpression(schedule.cron);
53
+ const { day, hour, minute, month, weekday } = scheduleDateFields(scheduledAt, schedule.timeZone);
54
+ if (!cron.minutes.includes(minute) || !cron.hours.includes(hour) || !cron.months.includes(month)) return false;
55
+ if (cron.days.length !== 31 && cron.weekdays.length !== 7) return cron.days.includes(day) || cron.weekdays.includes(weekday);
56
+ return cron.days.includes(day) && cron.weekdays.includes(weekday);
57
+ }
58
+ //#endregion
59
+ export { isRuntimeScheduleDue as t };
@@ -0,0 +1,211 @@
1
+ import { h as invalidScheduleValueDetails, i as loadScheduleDefinition, m as createScheduleError, n as getScheduleRunStore, p as assertRuntimeScheduleId, t as getRuntimeScheduleStore } from "./state-BcEhBV8v.js";
2
+ import { t as isRuntimeScheduleDue } from "./due-Bbh4yIxq.js";
3
+ import { t as createLocalWaitUntil } from "./wait-until-CR-JjIOb.js";
4
+ //#region ../internal/src/runtime/random.ts
5
+ function randomId(prefix) {
6
+ const body = `${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
7
+ return prefix ? `${prefix}_${body}` : body;
8
+ }
9
+ //#endregion
10
+ //#region src/runtime/execute.ts
11
+ function assertRuntimeExecuteOptionsObject(options) {
12
+ if (typeof options !== "object" || options === null || Array.isArray(options)) throw createScheduleError("SCHEDULE_INVALID_INPUT", { details: invalidScheduleValueDetails("options", options) });
13
+ }
14
+ function normalizeRunSource(source) {
15
+ return source ?? "direct";
16
+ }
17
+ function toRunId(source, scheduleId, scheduledAt) {
18
+ return `srun_${normalizeRunSource(source)}_${encodeURIComponent(scheduleId)}_${scheduledAt.toISOString()}`;
19
+ }
20
+ function validateScheduledAt(scheduledAt) {
21
+ if (!(scheduledAt instanceof Date) || Number.isNaN(scheduledAt.getTime())) throw createScheduleError("SCHEDULE_INVALID_SCHEDULED_AT", { details: invalidScheduleValueDetails("scheduledAt", scheduledAt) });
22
+ return scheduledAt;
23
+ }
24
+ function toRunError(error) {
25
+ if (error instanceof Error) return {
26
+ message: error.message,
27
+ name: error.name,
28
+ stack: error.stack
29
+ };
30
+ return { message: String(error) };
31
+ }
32
+ function requireUpdatedRun(run) {
33
+ if (!run) throw createScheduleError("SCHEDULE_RUN_NOT_FOUND");
34
+ return run;
35
+ }
36
+ async function createOrGetRun(options) {
37
+ const store = options.runStore ?? getScheduleRunStore();
38
+ const id = toRunId(options.source, options.scheduleId, options.scheduledAt);
39
+ const existing = await store.getRun(id);
40
+ if (existing) return {
41
+ created: false,
42
+ run: existing
43
+ };
44
+ const now = /* @__PURE__ */ new Date();
45
+ const runInput = {
46
+ attemptCount: 0,
47
+ createdAt: now,
48
+ id,
49
+ scheduleId: options.scheduleId,
50
+ scheduledAt: options.scheduledAt,
51
+ status: "pending",
52
+ target: options.target,
53
+ updatedAt: now
54
+ };
55
+ try {
56
+ return {
57
+ created: true,
58
+ run: await store.createRun(runInput)
59
+ };
60
+ } catch (error) {
61
+ const run = await store.getRun(id);
62
+ if (run) return {
63
+ created: false,
64
+ run
65
+ };
66
+ throw error;
67
+ }
68
+ }
69
+ async function startAttempt(run, store = getScheduleRunStore()) {
70
+ const now = /* @__PURE__ */ new Date();
71
+ const attempt = await store.createAttempt({
72
+ createdAt: now,
73
+ id: randomId("satt"),
74
+ runId: run.id,
75
+ startedAt: now,
76
+ status: "running",
77
+ updatedAt: now
78
+ });
79
+ await store.updateRun(run.id, {
80
+ attemptCount: run.attemptCount + 1,
81
+ startedAt: run.startedAt ?? now,
82
+ status: "running",
83
+ updatedAt: now
84
+ });
85
+ return attempt;
86
+ }
87
+ function toHandlerContext(run, attempt, input, waitUntil) {
88
+ return {
89
+ attemptId: attempt.id,
90
+ id: run.id,
91
+ ...input !== void 0 ? { input } : {},
92
+ runId: run.id,
93
+ scheduleId: run.scheduleId,
94
+ scheduledAt: run.scheduledAt,
95
+ target: run.target,
96
+ waitUntil
97
+ };
98
+ }
99
+ async function completeRun(run, attempt, store = getScheduleRunStore()) {
100
+ const now = /* @__PURE__ */ new Date();
101
+ await store.updateAttempt(attempt.id, {
102
+ completedAt: now,
103
+ status: "succeeded",
104
+ updatedAt: now
105
+ });
106
+ return requireUpdatedRun(await store.updateRun(run.id, {
107
+ completedAt: now,
108
+ status: "succeeded",
109
+ updatedAt: now
110
+ }));
111
+ }
112
+ async function failRun(run, attempt, error, store = getScheduleRunStore()) {
113
+ const now = /* @__PURE__ */ new Date();
114
+ const serializedError = toRunError(error);
115
+ await store.updateAttempt(attempt.id, {
116
+ completedAt: now,
117
+ error: serializedError,
118
+ status: "failed",
119
+ updatedAt: now
120
+ });
121
+ return requireUpdatedRun(await store.updateRun(run.id, {
122
+ completedAt: now,
123
+ error: serializedError,
124
+ status: "failed",
125
+ updatedAt: now
126
+ }));
127
+ }
128
+ async function createScheduleRun(options) {
129
+ const scheduledAt = validateScheduledAt(options.scheduledAt ?? /* @__PURE__ */ new Date());
130
+ return (await createOrGetRun({
131
+ ...options,
132
+ scheduledAt
133
+ })).run;
134
+ }
135
+ async function executeSchedule(options) {
136
+ const scheduledAt = validateScheduledAt(options.scheduledAt ?? /* @__PURE__ */ new Date());
137
+ const { created, run } = await createOrGetRun({
138
+ ...options,
139
+ scheduledAt
140
+ });
141
+ if (!created) return run;
142
+ const runStore = options.runStore ?? getScheduleRunStore();
143
+ const attempt = await startAttempt(run, runStore);
144
+ const localWaitUntil = createLocalWaitUntil();
145
+ const waitUntil = options.waitUntil ?? localWaitUntil.waitUntil;
146
+ try {
147
+ await options.definition.handler(toHandlerContext(run, attempt, options.input, waitUntil));
148
+ if (!options.waitUntil) await localWaitUntil.flush();
149
+ return await completeRun(run, attempt, runStore);
150
+ } catch (error) {
151
+ if (!options.waitUntil) try {
152
+ await localWaitUntil.flush();
153
+ } catch {}
154
+ await failRun(run, attempt, error, runStore);
155
+ throw error;
156
+ }
157
+ }
158
+ async function executeStaticSchedule(options) {
159
+ return await executeSchedule({
160
+ definition: options.definition,
161
+ scheduleId: options.name,
162
+ source: "static",
163
+ scheduledAt: options.scheduledAt,
164
+ target: options.name,
165
+ waitUntil: options.waitUntil
166
+ });
167
+ }
168
+ async function loadRequiredRuntimeSchedule(id, store = getRuntimeScheduleStore()) {
169
+ const schedule = await store.get(id);
170
+ if (!schedule) throw createScheduleError("SCHEDULE_NOT_FOUND");
171
+ return schedule;
172
+ }
173
+ async function executeRuntimeSchedule(options) {
174
+ const runtimeOptions = typeof options === "string" ? { id: options } : options;
175
+ assertRuntimeExecuteOptionsObject(runtimeOptions);
176
+ assertRuntimeScheduleId(runtimeOptions.id);
177
+ const id = runtimeOptions.id;
178
+ const scheduledAt = validateScheduledAt(runtimeOptions.scheduledAt ?? /* @__PURE__ */ new Date());
179
+ const runtimeScheduleStore = runtimeOptions.runtimeScheduleStore;
180
+ const scheduleRunStore = runtimeOptions.scheduleRunStore;
181
+ const existingRun = await (scheduleRunStore ?? getScheduleRunStore()).getRun(toRunId("runtime", id, scheduledAt));
182
+ if (existingRun) return existingRun;
183
+ const schedule = await loadRequiredRuntimeSchedule(id, runtimeScheduleStore);
184
+ if (!schedule.enabled) throw createScheduleError("SCHEDULE_DISABLED");
185
+ if (runtimeOptions.requireDue && !isRuntimeScheduleDue(schedule, scheduledAt)) throw createScheduleError("SCHEDULE_NOT_DUE");
186
+ const definition = await loadScheduleDefinition(schedule.target);
187
+ if (!definition) throw createScheduleError("SCHEDULE_TARGET_NOT_FOUND");
188
+ if (definition.options?.allowRuntimeSchedules !== true) throw createScheduleError("SCHEDULE_TARGET_NOT_ELIGIBLE");
189
+ return await executeSchedule({
190
+ definition,
191
+ input: schedule.input,
192
+ runStore: scheduleRunStore,
193
+ scheduleId: schedule.id,
194
+ source: "runtime",
195
+ scheduledAt,
196
+ target: schedule.target,
197
+ waitUntil: runtimeOptions.waitUntil
198
+ });
199
+ }
200
+ async function executeRuntimeScheduleWake(input, options) {
201
+ await executeRuntimeSchedule({
202
+ id: input.scheduleId,
203
+ requireDue: true,
204
+ runtimeScheduleStore: options.runtimeScheduleStore,
205
+ scheduledAt: input.scheduledAt,
206
+ scheduleRunStore: options.scheduleRunStore,
207
+ waitUntil: options.waitUntil
208
+ });
209
+ }
210
+ //#endregion
211
+ export { executeStaticSchedule as a, executeSchedule as i, executeRuntimeSchedule as n, randomId as o, executeRuntimeScheduleWake as r, createScheduleRun as t };
@@ -0,0 +1,63 @@
1
+ /// <reference path="./registry-module.d.ts" />
2
+ import { C as ScheduleTargetName, S as ScheduleTargetDefinitionInput, _ as ScheduleRunError, a as RuntimeScheduleStore, b as ScheduleRunStore, c as ScheduleDefinition, d as ScheduleDefinitionRegistry, f as ScheduleHandler, g as ScheduleRunContext, h as ScheduleRunAttemptStatus, i as RuntimeScheduleRecord, l as ScheduleDefinitionInput, m as ScheduleRunAttemptRecord, n as RuntimeScheduleCreateInput, o as RuntimeScheduleUpdateInput, p as ScheduleRegistryDefinition, r as RuntimeScheduleMetadata, t as DiscoveredScheduleDefinition, v as ScheduleRunRecord, x as ScheduleTargetDefinition, y as ScheduleRunStatus } from "./types-Bcje4dLV.js";
3
+ import { defineSchedule, defineScheduleTarget } from "./definition.js";
4
+ import { a as createMemoryRuntimeScheduleStore, c as validateRuntimeScheduleCron, i as createKVScheduleRunStore, n as ScheduleKVStorage, o as createMemoryScheduleRunStore, r as createKVRuntimeScheduleStore, s as schedules, t as KVScheduleStoreOptions } from "./store-D2zUgEDc.js";
5
+ import { getRuntimeScheduleStore, getScheduleRunStore, getScheduleRuntimeRegistry, loadScheduleDefinition, resetScheduleRuntime, setRuntimeScheduleStore, setScheduleRunStore, setScheduleRuntimeRegistry } from "./runtime/state.js";
6
+ import { ViteHubError } from "@vite-hub/runtime";
7
+
8
+ //#region src/discovery.d.ts
9
+ declare function discoverScheduleDefinitions(options: {
10
+ mode?: "vite-suffix";
11
+ rootDir: string;
12
+ scanDirs?: string[];
13
+ serverRootDir?: string;
14
+ } | {
15
+ mode: "server-schedules";
16
+ scanDirs: string[];
17
+ }): DiscoveredScheduleDefinition[];
18
+ //#endregion
19
+ //#region src/runtime/execute.d.ts
20
+ interface ExecuteScheduleOptions {
21
+ definition: ScheduleRegistryDefinition;
22
+ input?: unknown;
23
+ runStore?: ScheduleRunStore;
24
+ scheduleId: string;
25
+ source?: "direct" | "runtime" | "static";
26
+ scheduledAt?: Date;
27
+ target: ScheduleTargetName;
28
+ waitUntil?: (promise: PromiseLike<unknown>) => void;
29
+ }
30
+ interface ExecuteStaticScheduleOptions {
31
+ cron: string;
32
+ definition: ScheduleDefinition;
33
+ name: string;
34
+ scheduledAt?: Date;
35
+ waitUntil?: (promise: PromiseLike<unknown>) => void;
36
+ }
37
+ interface ExecuteRuntimeScheduleOptions {
38
+ id: string;
39
+ requireDue?: boolean;
40
+ runtimeScheduleStore?: RuntimeScheduleStore;
41
+ scheduledAt?: Date;
42
+ scheduleRunStore?: ScheduleRunStore;
43
+ waitUntil?: (promise: PromiseLike<unknown>) => void;
44
+ }
45
+ declare function createScheduleRun(options: Omit<ExecuteScheduleOptions, "definition" | "waitUntil">): Promise<ScheduleRunRecord>;
46
+ declare function executeSchedule(options: ExecuteScheduleOptions): Promise<ScheduleRunRecord>;
47
+ declare function executeStaticSchedule(options: ExecuteStaticScheduleOptions): Promise<ScheduleRunRecord>;
48
+ declare function executeRuntimeSchedule(options: ExecuteRuntimeScheduleOptions | string): Promise<ScheduleRunRecord>;
49
+ //#endregion
50
+ //#region src/errors.d.ts
51
+ declare const scheduleErrorCodes: readonly ["SCHEDULE_ALREADY_EXISTS", "SCHEDULE_DISABLED", "SCHEDULE_INVALID_CRON", "SCHEDULE_INVALID_ENABLED", "SCHEDULE_INVALID_ID", "SCHEDULE_INVALID_INPUT", "SCHEDULE_INVALID_SCHEDULED_AT", "SCHEDULE_INVALID_TARGET", "SCHEDULE_INVALID_TIME_ZONE", "SCHEDULE_NOT_DUE", "SCHEDULE_NOT_FOUND", "SCHEDULE_RUN_NOT_FOUND", "SCHEDULE_TARGET_NOT_ELIGIBLE", "SCHEDULE_TARGET_NOT_FOUND"];
52
+ declare const scheduleErrorFields: readonly ["cron", "enabled", "id", "input", "options", "scheduledAt", "target", "timeZone"];
53
+ declare const scheduleErrorValueTypes: readonly ["array", "bigint", "boolean", "date", "function", "null", "number", "object", "string", "symbol", "undefined", "unknown"];
54
+ type ScheduleErrorCode = typeof scheduleErrorCodes[number];
55
+ type ScheduleErrorField = typeof scheduleErrorFields[number];
56
+ type ScheduleErrorValueType = typeof scheduleErrorValueTypes[number];
57
+ type ScheduleValidationErrorCode = Extract<ScheduleErrorCode, `SCHEDULE_INVALID_${string}`>;
58
+ type ScheduleErrorDetails = {
59
+ field: ScheduleErrorField;
60
+ valueType: ScheduleErrorValueType;
61
+ };
62
+ //#endregion
63
+ export { type DiscoveredScheduleDefinition, type KVScheduleStoreOptions, type RuntimeScheduleCreateInput, type RuntimeScheduleMetadata, type RuntimeScheduleRecord, type RuntimeScheduleStore, type RuntimeScheduleUpdateInput, type ScheduleDefinition, type ScheduleDefinitionInput, type ScheduleDefinitionRegistry, type ScheduleErrorCode, type ScheduleErrorDetails, type ScheduleErrorField, type ScheduleErrorValueType, type ScheduleHandler, type ScheduleKVStorage, type ScheduleRegistryDefinition, type ScheduleRunAttemptRecord, type ScheduleRunAttemptStatus, type ScheduleRunContext, type ScheduleRunError, type ScheduleRunRecord, type ScheduleRunStatus, type ScheduleRunStore, type ScheduleTargetDefinition, type ScheduleTargetDefinitionInput, type ScheduleTargetName, type ScheduleValidationErrorCode, createKVRuntimeScheduleStore, createKVScheduleRunStore, createMemoryRuntimeScheduleStore, createMemoryScheduleRunStore, createScheduleRun, defineSchedule, defineScheduleTarget, discoverScheduleDefinitions, executeRuntimeSchedule, executeSchedule, executeStaticSchedule, getRuntimeScheduleStore, getScheduleRunStore, getScheduleRuntimeRegistry, loadScheduleDefinition, resetScheduleRuntime, schedules, setRuntimeScheduleStore, setScheduleRunStore, setScheduleRuntimeRegistry, validateRuntimeScheduleCron };
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import { defineSchedule, defineScheduleTarget } from "./definition.js";
2
+ import { t as discoverScheduleDefinitions } from "./discovery-MXY52MTU.js";
3
+ import { a as executeStaticSchedule, i as executeSchedule, n as executeRuntimeSchedule, t as createScheduleRun } from "./execute-BnR8oEKq.js";
4
+ import { a as resetScheduleRuntime, c as setScheduleRuntimeRegistry, d as createMemoryRuntimeScheduleStore, f as createMemoryScheduleRunStore, i as loadScheduleDefinition, l as createKVRuntimeScheduleStore, n as getScheduleRunStore, o as setRuntimeScheduleStore, r as getScheduleRuntimeRegistry, s as setScheduleRunStore, t as getRuntimeScheduleStore, u as createKVScheduleRunStore } from "./state-BcEhBV8v.js";
5
+ import { n as validateRuntimeScheduleCron, t as schedules } from "./client-B3cyh-BG.js";
6
+ export { createKVRuntimeScheduleStore, createKVScheduleRunStore, createMemoryRuntimeScheduleStore, createMemoryScheduleRunStore, createScheduleRun, defineSchedule, defineScheduleTarget, discoverScheduleDefinitions, executeRuntimeSchedule, executeSchedule, executeStaticSchedule, getRuntimeScheduleStore, getScheduleRunStore, getScheduleRuntimeRegistry, loadScheduleDefinition, resetScheduleRuntime, schedules, setRuntimeScheduleStore, setScheduleRunStore, setScheduleRuntimeRegistry, validateRuntimeScheduleCron };
package/dist/nuxt.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { ScheduleVitePluginOptions } from "./vite.js";
2
+
3
+ //#region src/nuxt.d.ts
4
+ interface ScheduleNuxtModuleOptions extends ScheduleVitePluginOptions {}
5
+ type NuxtLike = {
6
+ hook?: (name: "nitro:config", handler: (nitroConfig: Record<string, unknown>) => void | Promise<void>) => void;
7
+ options: {
8
+ dev?: boolean;
9
+ nitro?: Record<string, unknown>;
10
+ rootDir?: string;
11
+ srcDir?: string;
12
+ vite?: {
13
+ plugins?: unknown[];
14
+ };
15
+ };
16
+ };
17
+ declare function viteHubScheduleNuxtModule(options?: ScheduleNuxtModuleOptions, nuxt?: NuxtLike): void;
18
+ //#endregion
19
+ export { ScheduleNuxtModuleOptions, viteHubScheduleNuxtModule as default };
package/dist/nuxt.js ADDED
@@ -0,0 +1,25 @@
1
+ import { n as hubSchedule, t as createScheduleNitroConfig } from "./vite-Dfeg9ZY3.js";
2
+ //#region src/nuxt.ts
3
+ function isScheduleVitePlugin(value) {
4
+ return Boolean(value && typeof value === "object" && value.name === "@vite-hub/schedule/vite");
5
+ }
6
+ function viteHubScheduleNuxtModule(options = {}, nuxt) {
7
+ if (!nuxt) return;
8
+ nuxt.options.vite ??= {};
9
+ const plugins = Array.isArray(nuxt.options.vite.plugins) ? nuxt.options.vite.plugins : [];
10
+ if (!plugins.some(isScheduleVitePlugin)) plugins.push(hubSchedule(options));
11
+ nuxt.options.vite.plugins = plugins;
12
+ nuxt.hook?.("nitro:config", async (nitroConfig) => {
13
+ const rootDir = nuxt.options.rootDir || process.cwd();
14
+ const nitro = await createScheduleNitroConfig({
15
+ ...options,
16
+ command: nuxt.options.dev ? "serve" : "build",
17
+ nitro: nitroConfig,
18
+ projectRoot: options.projectRoot || rootDir,
19
+ root: nuxt.options.srcDir || rootDir
20
+ });
21
+ if (nitro) Object.assign(nitroConfig, nitro);
22
+ });
23
+ }
24
+ //#endregion
25
+ export { viteHubScheduleNuxtModule as default };
@@ -0,0 +1,9 @@
1
+ declare module "#vitehub/schedule/registry" {
2
+ const registry: import("@vite-hub/schedule").ScheduleDefinitionRegistry
3
+ export default registry
4
+ }
5
+
6
+ declare module "#vitehub/schedule/targets" {
7
+ export const scheduleTargetNames: import("@vite-hub/schedule").ScheduleTargetName[]
8
+ export type ScheduleTargetName = import("@vite-hub/schedule").ScheduleTargetName
9
+ }
@@ -0,0 +1,26 @@
1
+ import { a as RuntimeScheduleStore, b as ScheduleRunStore, d as ScheduleDefinitionRegistry, i as RuntimeScheduleRecord, s as RuntimeScheduleWake } from "../types-Bcje4dLV.js";
2
+
3
+ //#region src/runtime/driver.d.ts
4
+ interface RuntimeScheduleWakeDriverContext {
5
+ reportError(error: unknown): void;
6
+ wake(input: RuntimeScheduleWake): Promise<void>;
7
+ }
8
+ interface RuntimeScheduleWakeDriver {
9
+ close?(): Promise<void> | void;
10
+ reconcile(schedules: readonly RuntimeScheduleRecord[]): Promise<void>;
11
+ }
12
+ type RuntimeScheduleWakeDriverFactory = (context: RuntimeScheduleWakeDriverContext) => Promise<RuntimeScheduleWakeDriver> | RuntimeScheduleWakeDriver;
13
+ interface InstallScheduleRuntimeOptions {
14
+ createDriver: RuntimeScheduleWakeDriverFactory;
15
+ onError?: (error: unknown) => void;
16
+ registry: ScheduleDefinitionRegistry;
17
+ runtimeScheduleStore: RuntimeScheduleStore;
18
+ scheduleRunStore: ScheduleRunStore;
19
+ staticRegistry?: ScheduleDefinitionRegistry;
20
+ }
21
+ interface ScheduleRuntimeController {
22
+ close(): Promise<void>;
23
+ }
24
+ declare function installScheduleRuntime(options: InstallScheduleRuntimeOptions): Promise<ScheduleRuntimeController>;
25
+ //#endregion
26
+ export { InstallScheduleRuntimeOptions, type RuntimeScheduleWake, RuntimeScheduleWakeDriver, RuntimeScheduleWakeDriverContext, RuntimeScheduleWakeDriverFactory, ScheduleRuntimeController, installScheduleRuntime };