@vite-hub/schedule 0.3.1 → 0.4.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/README.md +14 -14
- package/dist/definition.js +1 -1
- package/dist/{due-BVMRQ93v.js → due-sOJvF_6Z.js} +1 -1
- package/dist/{error-diagnostics-Mpeks7J0.js → error-diagnostics-BBtYYl8j.js} +4 -0
- package/dist/{error-diagnostics-DSkCJC_L.js → error-diagnostics-CQ4BUqRe.js} +5 -1
- package/dist/index.d.ts +19 -5
- package/dist/index.js +34 -5
- package/dist/{kv-storage-iJChCS5A.js → kv-storage-2kZtP2CC.js} +2 -2
- package/dist/{kv-storage-C0KZZB6v.d.ts → kv-storage-Bm9aYLfZ.d.ts} +5 -1
- package/dist/{operation-definition-8gOe-ubD.d.ts → operation-definition-nmRu_O3V.d.ts} +5 -0
- package/dist/{operations-DwZWFIUX.js → operations-DqwmJ8MN.js} +29 -6
- package/dist/operations.d.ts +10 -1
- package/dist/operations.js +10 -7
- package/dist/os.js +1 -1
- package/dist/runtime/console.js +1 -1
- package/dist/runtime/kv.d.ts +1 -1
- package/dist/runtime/kv.js +1 -1
- package/dist/runtime/process.js +5 -5
- package/dist/runtime/state.d.ts +2 -2
- package/dist/runtime/state.js +2 -2
- package/dist/runtime/static.js +1 -1
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.js +5 -5
- package/dist/{started-Bx7MDbrl.js → started-B0pc3JY0.js} +2 -2
- package/dist/{started-BuGmnus4.js → started-Bk2Icknk.js} +3 -3
- package/dist/{started-errors-p7cu_rI7.js → started-errors-DEmYH-vp.js} +30 -23
- package/dist/{inspect-DTfAo5gS.js → started-name-ruCM1EtQ.js} +5 -1
- package/dist/{state-Do2wV4Tx.d.ts → state-CPd10SXq.d.ts} +10 -1
- package/dist/{state-B-Fuyfb4.js → state-D4SZH6zk.js} +10 -2
- package/dist/{static-DQwzzvPg.js → static-7JCga3Iu.js} +21 -6
- package/dist/{store-Df0-fzCl.d.ts → store-DeMojnXM.d.ts} +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +714 -462
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# @vite-hub/schedule
|
|
2
2
|
|
|
3
|
-
[](https://npmx.dev/package/@vite-hub/schedule)
|
|
4
|
+
[](https://npmx.dev/package/@vite-hub/schedule)
|
|
5
|
+
[](https://github.com/vite-hub/vitehub/blob/main/LICENSE)
|
|
6
|
+
[](https://vitehub.dev/docs)
|
|
7
7
|
|
|
8
8
|
`@vite-hub/schedule` discovers recurring work, generates cron output for supported hosts, and can run Static Schedule Definitions in one long-lived process.
|
|
9
9
|
|
|
@@ -15,7 +15,7 @@ Install `vite-hub` and `@vite-hub/schedule` for an application. `vite-hub` expos
|
|
|
15
15
|
pnpm add vite-hub @vite-hub/schedule
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
A file in `server/schedules/` turns Schedule on in the framework integration. Import application helpers from its feature path:
|
|
19
19
|
|
|
20
20
|
```ts
|
|
21
21
|
// vite.config.ts
|
|
@@ -23,7 +23,7 @@ import { vitehub } from "vite-hub";
|
|
|
23
23
|
import { defineConfig } from "vite";
|
|
24
24
|
|
|
25
25
|
export default defineConfig({
|
|
26
|
-
plugins: [vitehub({ host: "cloudflare"
|
|
26
|
+
plugins: [vitehub({ host: "cloudflare" })],
|
|
27
27
|
});
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -39,7 +39,7 @@ pnpm add @vite-hub/schedule
|
|
|
39
39
|
|
|
40
40
|
Direct integrations use `@vite-hub/schedule`, `@vite-hub/schedule/runtime`, and `@vite-hub/schedule/vite`. Add Vite when the project uses `hubSchedule()`. Add `@vite-hub/kv` when using the KV Schedule Run store through `@vite-hub/schedule/runtime/kv` or the generated Process Runtime. Static Schedule Definitions, memory stores, and custom `ScheduleKVStorage` implementations do not require KV.
|
|
41
41
|
|
|
42
|
-
Both packages require Node.js
|
|
42
|
+
Both packages require Node.js 24.15 or newer.
|
|
43
43
|
|
|
44
44
|
## Run one occurrence
|
|
45
45
|
|
|
@@ -106,9 +106,9 @@ Static Schedule Definitions use five-field cron expressions. The cron uses UTC u
|
|
|
106
106
|
|
|
107
107
|
The integration can generate host-specific output for Cloudflare Cron Triggers, Vercel Cron Jobs, Netlify Scheduled Functions, standalone `Deno.cron`, Nitro's Cloudflare schedule hook, and Netlify Scheduled Functions that run in Nitro's server bundle. A build writes only the output of its host: Nitro's resolved preset, or else `nitro.preset`, `NITRO_PRESET`, `SERVER_PRESET`, or `VITEHUB_HOST`. It writes the output of every host only when no host is known. Host selection, local execution, deployment proof, limits, and billing still come from the selected host. Check the [runtime and host support matrix](https://vitehub.dev/docs/frameworks-hosts/support-matrix) before deploying.
|
|
108
108
|
|
|
109
|
-
Applications that use the framework distribution
|
|
109
|
+
Applications that use the framework distribution turn Schedule on with a file in `server/schedules/`, with no `schedule` key, and import the definition helper from `vite-hub/schedule`. On Deno, the build writes standalone cron output and a `.output/main.ts` entrypoint that loads it before the Nitro server.
|
|
110
110
|
|
|
111
|
-
Nuxt projects enable Schedule with `vite-hub/nuxt` and
|
|
111
|
+
Nuxt projects enable Schedule with `vite-hub/nuxt` and a file in `server/schedules/`. The module installs the Vite integration and merges Schedule output into Nitro config.
|
|
112
112
|
|
|
113
113
|
## Start a Schedule from code
|
|
114
114
|
|
|
@@ -134,7 +134,7 @@ const [, started] = await listSchedules({ name: "reminder" });
|
|
|
134
134
|
await cancelSchedule(standUp!.id);
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
The functions return `[error, data]`. The Schedules are stored in KV, so they survive restarts and deploys. When a Definition has no `cron`, the build adds the Schedule `vitehub/started-schedules` with the cron `* * * * *`: Cloudflare wakes it with a Cron Trigger, and the Process Runtime wakes it on Node. Each wake runs the started Schedules that are due. Started Schedules need KV, and on Node the Process Runtime. `vitehub schedule
|
|
137
|
+
The functions return `[error, data]`. The Schedules are stored in KV, so they survive restarts and deploys. When a Definition has no `cron`, the build adds the Schedule `vitehub/started-schedules` with the cron `* * * * *`: Cloudflare wakes it with a Cron Trigger, and the Process Runtime wakes it on Node. Each wake runs the started Schedules that are due. Started Schedules need KV, and on Node the Process Runtime. `vitehub schedule start` and `cancel` and the Console Schedules page show and change them. `vitehub schedule list` lists them after the Static Schedule Definitions, and works without KV when no Definition can be started. Read the [server API](https://vitehub.dev/docs/schedule/server-api#start-a-schedule-from-code) for the delivery rules.
|
|
138
138
|
|
|
139
139
|
## Understand time zones
|
|
140
140
|
|
|
@@ -167,7 +167,7 @@ Vercel, Netlify, and Deno do not supply a scheduled timestamp to these entries.
|
|
|
167
167
|
|
|
168
168
|
## Run schedules in the server process
|
|
169
169
|
|
|
170
|
-
The generated Process Runtime runs each Static Schedule Definition on its cron inside the Node.js process. It records Schedule Runs in the default KV store configured by `hubKV()`. Use it on long-lived servers, one or more:
|
|
170
|
+
The generated Process Runtime runs each Static Schedule Definition on its cron inside the Node.js process. It records Schedule Runs in the default KV store configured by `hubKV()`. Use it on long-lived servers, one or more. `vitehub({ host: "node", schedule: true })` turns it on for you. With `hubSchedule()` alone, set `runtime`:
|
|
171
171
|
|
|
172
172
|
```ts
|
|
173
173
|
import { hubKV } from "@vite-hub/kv/vite";
|
|
@@ -199,7 +199,7 @@ Every server checks every Schedule. Before a server runs an occurrence, it takes
|
|
|
199
199
|
- A failed run is final, as on one server. It is not retried.
|
|
200
200
|
- When a server stops during a run, for example after a crash, its lease ends after `leaseTtlMs`. Then another server runs the occurrence, unless it has a done marker. With shared run history, the run gets a new attempt, and the stopped attempt is marked as failed. This also works when every server restarts: at start, a server reads the runs inside `catchUpMs` that are still pending or running, and tries them again.
|
|
201
201
|
|
|
202
|
-
The generated runtime keeps the leases in the `vitehub_leases` table of the Default Database, through `useLeases()` from `@vite-hub/database`. That works on Postgres, remote libSQL, and D1. A local libSQL file is safe for one server process only, because `@libsql/client` can lose writes when several processes write to one file. The server prints a warning at the first lease in that case. Without a Database, the leases stay in memory and the build
|
|
202
|
+
The generated runtime keeps the leases in the `vitehub_leases` table of the Default Database, through `useLeases()` from `@vite-hub/database`. That works on Postgres, remote libSQL, and D1. A local libSQL file is safe for one server process only, because `@libsql/client` can lose writes when several processes write to one file. The server prints a warning at the first lease in that case. Without a Database, the leases stay in memory and the build reports the hint `SCHEDULE_PROCESS_CLAIMS_IN_MEMORY` in its output and in `.vitehub/hints.json`: each server then runs every occurrence, so run one server only. The run history stays in KV. Use a KV store that all servers share, such as Upstash, so catch-up and the Console see the runs of every server.
|
|
203
203
|
|
|
204
204
|
With the Process Runtime, the default `providerOutput: "auto"` emits no host Provider Output, so the process owns Static Schedule wakes. Set `providerOutput: "standalone"` or `"nitro"` to move Static Schedule wakes to that Provider Output. `providerOutput: false` records the same wake ownership as `"auto"` in this configuration.
|
|
205
205
|
|
|
@@ -252,9 +252,9 @@ Custom stores must apply the `listRuns({ scheduleId, idPrefix, limit })` filters
|
|
|
252
252
|
|
|
253
253
|
`hubSchedule()` contributes the `schedule.runs`, `schedule.attempts`, `schedule.run`, `schedule.list`, `schedule.start`, and `schedule.cancel` operations. They are the `vitehub schedule runs <id> [--limit <n>]`, `attempts <runId>`, `run <name>`, `list [name]`, `start <name>`, and `cancel <id>` commands, and the Console runs them too. Each command accepts `--json` and `--url`. Without `--url` the command calls the dev server of the project, whose Nitro runtime owns the same stores and registry as the running app.
|
|
254
254
|
|
|
255
|
-
Set `manual: true` on a Static Schedule Definition to allow an on-demand run, then invoke it with `vitehub schedule run <name>`. The name is the discovered schedule file name. Add `--url <app-url>` to run it on a deployment that enables `console.invoke`. The command signs the call with `VITEHUB_CONSOLE_PRIVATE_KEY_<NAME>`, so a CI job needs only that secret. `vitehub secret console-key ci` prints a new key pair. Server code can call `runSchedule(name)` from `@vite-hub/schedule`. It reads the generated registry. Each manual run gets a new `srun_manual_` id.
|
|
255
|
+
Set `manual: true` on a Static Schedule Definition to allow an on-demand run, then invoke it with `vitehub schedule run <name>`. The name is the discovered schedule file name. Add `--url <app-url>` to run it on a deployment that enables `console.invoke`. The command signs the call with `VITEHUB_CONSOLE_PRIVATE_KEY_<NAME>`, so a CI job needs only that secret. `vitehub secret console-key ci` prints a new key pair. Server code can call `runSchedule(name)` from `@vite-hub/schedule`. It reads the generated registry and returns `[error, run]`. A failed handler gives a run with `status: "failed"`. An invalid `scheduledAt` or a failed run store gives `error`. An unknown name or a Definition without `manual: true` throws. Each manual run gets a new `srun_manual_` id.
|
|
256
256
|
|
|
257
|
-
Add `--at <ISO date-time>` to run it as if the cron fired at that time, for example `vitehub schedule run close-month --at 2026-01-31T23:59:00Z`. The handler gets the time as `scheduledAt`, and the run records it, so `vitehub schedule runs` lists it under that time. `runSchedule()` takes the same value as `scheduledAt`. The value needs `Z` or an offset. A value without a time zone, a date only, or a day that does not exist fails with `SCHEDULE_INVALID_SCHEDULED_AT` before the handler runs. The time is not checked against the cron. Manual runs do not advance the Process Runtime's catch-up cursor, even when their scheduled time is in the future.
|
|
257
|
+
Add `--at <ISO date-time>` to run it as if the cron fired at that time, for example `vitehub schedule run close-month --at 2026-01-31T23:59:00Z`. The handler gets the time as `scheduledAt`, and the run records it, so `vitehub schedule runs` lists it under that time. `runSchedule()` takes the same value as `scheduledAt`. The value needs `Z` or an offset. A value without a time zone, a date only, or a day that does not exist fails with `SCHEDULE_INVALID_SCHEDULED_AT` before the handler runs. `runSchedule()` returns it as `error`. The time is not checked against the cron. Manual runs do not advance the Process Runtime's catch-up cursor, even when their scheduled time is in the future.
|
|
258
258
|
|
|
259
259
|
Discovery reads `manual` as a literal boolean from directly exported Definitions. Use identifier keys or quoted keys without escape sequences. Spreads, computed keys, escaped keys, and metadata getters or methods fail with the source file and line.
|
|
260
260
|
|
package/dist/definition.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as isIanaTimeZone } from "./time-zone-SBldrUgt.js";
|
|
2
2
|
import { t as isRecord } from "./object-Da1zyPCR.js";
|
|
3
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
3
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-BBtYYl8j.js";
|
|
4
4
|
//#region src/definition.ts
|
|
5
5
|
const cronFieldPattern = /^[^\s]+$/;
|
|
6
6
|
const scheduleDefinitionKeys = /* @__PURE__ */ new Set([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-BBtYYl8j.js";
|
|
2
2
|
import { parseCronExpression } from "cron-schedule";
|
|
3
3
|
//#region src/runtime/due.ts
|
|
4
4
|
const weekdayIndexes = /* @__PURE__ */ new Map([
|
|
@@ -156,6 +156,10 @@ const scheduleErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
156
156
|
why: ({ name }) => `Schedule "${name}" has no default export of defineSchedule() with a cron and a handler.`,
|
|
157
157
|
fix: "Default-export `defineSchedule({ cron, handler })` from the Schedule file that the message names, in `server/schedules/`."
|
|
158
158
|
},
|
|
159
|
+
SCHEDULE_PROCESS_CLAIMS_IN_MEMORY: {
|
|
160
|
+
why: "The Process Runtime claims each Schedule occurrence in memory, because the app has no Database. With several server processes, each one runs every occurrence.",
|
|
161
|
+
fix: "Run one server only, or add a Postgres Database so that more than one server runs each occurrence once."
|
|
162
|
+
},
|
|
159
163
|
SCHEDULE_RUNTIME_CATCH_UP_INVALID: {
|
|
160
164
|
why: "Schedule Process Runtime catchUpMs must be a non-negative number.",
|
|
161
165
|
fix: "Set `runtime.catchUpMs` in `hubSchedule()` or in `vitehub({ schedule })` to a number of 0 or more, or remove it to use one hour (`3600000`)."
|
|
@@ -170,7 +170,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
170
170
|
},
|
|
171
171
|
INTERNAL_R0004: {
|
|
172
172
|
...dynamicError,
|
|
173
|
-
fix: "Set a larger `maxResponseBytes` on the HTTP request, such as the `
|
|
173
|
+
fix: "Set a larger `maxResponseBytes` on the HTTP request, such as the `url()` Source options, or ask the server for a smaller response."
|
|
174
174
|
},
|
|
175
175
|
INTERNAL_R0005: {
|
|
176
176
|
...dynamicError,
|
|
@@ -216,6 +216,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
216
216
|
why: ({ variable }) => `[vitehub] ${variable} must be the 43-character private key that \`vitehub secret console-key\` prints, and its name 1 to 64 of A-Z, 0-9, and _.`,
|
|
217
217
|
fix: "Set the variable that the message names to the private key that `vitehub secret console-key` prints, and name it `VITEHUB_CONSOLE_PRIVATE_KEY_<NAME>` with A-Z, 0-9, and _ in `<NAME>`."
|
|
218
218
|
},
|
|
219
|
+
INTERNAL_DEV_SERVER_NOT_FOUND: {
|
|
220
|
+
why: ({ command }) => `[vitehub] No dev server of this project is running, and --url is not set, so \`vitehub ${command}\` has no app to call.`,
|
|
221
|
+
fix: "Start the dev server of this project, such as with `pnpm dev`, or pass --url with the app URL, such as --url http://localhost:3000."
|
|
222
|
+
},
|
|
219
223
|
INTERNAL_FORGE_NOT_INSTALLED: {
|
|
220
224
|
why: ({ feature }) => `${feature} needs @vite-hub/forge, and the app did not install it.`,
|
|
221
225
|
fix: "Install Forge in your app with `pnpm add @vite-hub/forge`, then build again."
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
/// <reference path="./registry-module.d.ts" />
|
|
2
2
|
import { _ as StartScheduleOptions, a as ScheduleDefinitionRegistry, b as StartedScheduleStore, c as ScheduleRunAttemptRecord, d as ScheduleRunError, f as ScheduleRunListOptions, g as ScheduleRunStore, h as ScheduleRunStatus, l as ScheduleRunAttemptStatus, m as ScheduleRunResponse, n as ScheduleDefinition, o as ScheduleHandler, p as ScheduleRunRecord, r as ScheduleDefinitionInput, s as ScheduleRegistryDefinition, t as DiscoveredScheduleDefinition, u as ScheduleRunContext, v as StartScheduleTiming, y as StartedSchedule } from "./types-Cw5LjPuc.js";
|
|
3
3
|
import { defineSchedule } from "./definition.js";
|
|
4
|
-
import { i as RunScheduleOptions, t as KVScheduleStoreOptions } from "./store-
|
|
5
|
-
import { t as ScheduleKVStorage } from "./kv-storage-
|
|
4
|
+
import { i as RunScheduleOptions, t as KVScheduleStoreOptions } from "./store-DeMojnXM.js";
|
|
5
|
+
import { t as ScheduleKVStorage } from "./kv-storage-Bm9aYLfZ.js";
|
|
6
6
|
import { ErrorCatalog, Result, ViteHubError } from "@vite-hub/runtime";
|
|
7
|
+
//#region src/run-errors.d.ts
|
|
8
|
+
type RunScheduleErrorCodes = {
|
|
9
|
+
SCHEDULE_INVALID_SCHEDULED_AT: {
|
|
10
|
+
fix: string;
|
|
11
|
+
why: string;
|
|
12
|
+
};
|
|
13
|
+
SCHEDULE_RUN_STORE_FAILED: {
|
|
14
|
+
fix: string;
|
|
15
|
+
why: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
type RunScheduleErrorCode = keyof RunScheduleErrorCodes;
|
|
19
|
+
//#endregion
|
|
7
20
|
//#region src/run.d.ts
|
|
8
21
|
/**
|
|
9
22
|
* Runs a Static Schedule Definition that sets `manual: true` now, as if its cron fired at `scheduledAt` (default: now).
|
|
10
|
-
* It
|
|
23
|
+
* It returns `[error, run]`. A failed handler is a run with `status: "failed"`, not an error. An invalid `scheduledAt`
|
|
24
|
+
* or a failed run store is `error`. Definition loading errors, unknown names, and Definitions without `manual: true` throw.
|
|
11
25
|
*/
|
|
12
|
-
export declare function runSchedule(name: string, options?: RunScheduleOptions): Promise<ScheduleRunRecord
|
|
26
|
+
export declare function runSchedule(name: string, options?: RunScheduleOptions): Promise<Result<ScheduleRunRecord, RunScheduleErrorCode>>;
|
|
13
27
|
//#endregion
|
|
14
28
|
//#region src/started-errors.d.ts
|
|
15
29
|
type StartedScheduleErrorCodes = {
|
|
@@ -71,4 +85,4 @@ type ScheduleErrorDetails = {
|
|
|
71
85
|
valueType: ScheduleErrorValueType;
|
|
72
86
|
};
|
|
73
87
|
//#endregion
|
|
74
|
-
export { type DiscoveredScheduleDefinition, type KVScheduleStoreOptions, type RunScheduleOptions, 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 ScheduleRunListOptions, type ScheduleRunRecord, type ScheduleRunResponse, type ScheduleRunStatus, type ScheduleRunStore, type ScheduleValidationErrorCode, type StartScheduleOptions, type StartScheduleTiming, type StartedSchedule, type StartedScheduleErrorCode, type StartedScheduleStore, defineSchedule };
|
|
88
|
+
export { type DiscoveredScheduleDefinition, type KVScheduleStoreOptions, type RunScheduleErrorCode, type RunScheduleOptions, 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 ScheduleRunListOptions, type ScheduleRunRecord, type ScheduleRunResponse, type ScheduleRunStatus, type ScheduleRunStore, type ScheduleValidationErrorCode, type StartScheduleOptions, type StartScheduleTiming, type StartedSchedule, type StartedScheduleErrorCode, type StartedScheduleStore, defineSchedule };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { defineSchedule } from "./definition.js";
|
|
2
|
-
import { o as createScheduleError } from "./wait-until-Dy4Bn3ZN.js";
|
|
3
|
-
import {
|
|
4
|
-
import { i as startSchedule, n as getSchedule, r as listSchedules, t as cancelSchedule } from "./started-
|
|
2
|
+
import { o as createScheduleError, r as parseScheduledAt } from "./wait-until-Dy4Bn3ZN.js";
|
|
3
|
+
import { r as executeManualSchedule, s as resolveManualSchedule } from "./started-errors-DEmYH-vp.js";
|
|
4
|
+
import { i as startSchedule, n as getSchedule, r as listSchedules, t as cancelSchedule } from "./started-B0pc3JY0.js";
|
|
5
|
+
import { defineErrors } from "@vite-hub/runtime";
|
|
6
|
+
//#region src/run-errors.ts
|
|
7
|
+
const runScheduleErrors = /*#__PURE__*/ defineErrors({
|
|
8
|
+
docs: "https://vitehub.dev/docs/schedule/diagnostics",
|
|
9
|
+
codes: {
|
|
10
|
+
SCHEDULE_INVALID_SCHEDULED_AT: {
|
|
11
|
+
why: "`runSchedule()` got a `scheduledAt` that is not a valid date-time.",
|
|
12
|
+
fix: "Pass a valid `Date`, or an ISO 8601 date-time with `Z` or an offset, such as `2026-01-31T23:59:00Z`. Leave it out to run as of now."
|
|
13
|
+
},
|
|
14
|
+
SCHEDULE_RUN_STORE_FAILED: {
|
|
15
|
+
why: "The store of Schedule Runs failed, so the run did not start or its record is incomplete. `error.cause` has the store error.",
|
|
16
|
+
fix: "Check that the Schedule run store is reachable from this server. Before retrying, confirm that the handler did not already run or that it is safe to repeat."
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
5
21
|
//#region src/run.ts
|
|
6
22
|
const registryModule = "#vitehub/schedule/registry";
|
|
7
23
|
/** The registry that the Schedule Vite plugin generates. It loads on the first run, so importing the root stays cheap. */
|
|
@@ -18,10 +34,23 @@ async function loadRegistry() {
|
|
|
18
34
|
}
|
|
19
35
|
/**
|
|
20
36
|
* Runs a Static Schedule Definition that sets `manual: true` now, as if its cron fired at `scheduledAt` (default: now).
|
|
21
|
-
* It
|
|
37
|
+
* It returns `[error, run]`. A failed handler is a run with `status: "failed"`, not an error. An invalid `scheduledAt`
|
|
38
|
+
* or a failed run store is `error`. Definition loading errors, unknown names, and Definitions without `manual: true` throw.
|
|
22
39
|
*/
|
|
23
40
|
async function runSchedule(name, options = {}) {
|
|
24
|
-
|
|
41
|
+
const registry = await loadRegistry();
|
|
42
|
+
const definition = await resolveManualSchedule(registry, name);
|
|
43
|
+
let scheduledAt;
|
|
44
|
+
try {
|
|
45
|
+
scheduledAt = parseScheduledAt(options.scheduledAt);
|
|
46
|
+
} catch (cause) {
|
|
47
|
+
return [runScheduleErrors.SCHEDULE_INVALID_SCHEDULED_AT({ cause }), void 0];
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
return [void 0, await executeManualSchedule(definition, name, scheduledAt)];
|
|
51
|
+
} catch (cause) {
|
|
52
|
+
return [runScheduleErrors.SCHEDULE_RUN_STORE_FAILED({ cause }), void 0];
|
|
53
|
+
}
|
|
25
54
|
}
|
|
26
55
|
//#endregion
|
|
27
56
|
export { cancelSchedule, defineSchedule, getSchedule, listSchedules, runSchedule, startSchedule };
|
|
@@ -16,9 +16,9 @@ function createScheduleKVStorage(kvStore) {
|
|
|
16
16
|
return value ?? false;
|
|
17
17
|
},
|
|
18
18
|
async keys(base) {
|
|
19
|
-
const [error, value] = await kvStore.
|
|
19
|
+
const [error, value] = await kvStore.list({ prefix: base && !/[:/\\]$/.test(base) ? `${base}:` : base });
|
|
20
20
|
if (error) throw error;
|
|
21
|
-
return value ?? [];
|
|
21
|
+
return value?.keys ?? [];
|
|
22
22
|
},
|
|
23
23
|
async set(key, value) {
|
|
24
24
|
const [error] = await kvStore.set(key, value);
|
|
@@ -10,7 +10,11 @@ interface ViteHubKVStorage {
|
|
|
10
10
|
delete(key: string): Promise<readonly [unknown, unknown]>;
|
|
11
11
|
get<T = unknown>(key: string): Promise<readonly [unknown, T | null | undefined]>;
|
|
12
12
|
has(key: string): Promise<readonly [unknown, boolean | undefined]>;
|
|
13
|
-
|
|
13
|
+
list(options: {
|
|
14
|
+
prefix?: string;
|
|
15
|
+
}): Promise<readonly [unknown, {
|
|
16
|
+
keys: string[];
|
|
17
|
+
} | undefined]>;
|
|
14
18
|
set<T = unknown>(key: string, value: T): Promise<readonly [unknown, unknown]>;
|
|
15
19
|
}
|
|
16
20
|
declare function createScheduleKVStorage(kvStore: ViteHubKVStorage): ScheduleKVStorage;
|
|
@@ -115,6 +115,11 @@ interface OperationContext {
|
|
|
115
115
|
surface: "console" | "cli" | "mcp" | "agent";
|
|
116
116
|
/** Set by the host from generated build identity, never from request input or runtime NODE_ENV. */
|
|
117
117
|
development?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* The project root of a development server, for operations that read build files, such as `bundle.report`. Hosts set
|
|
120
|
+
* it only with `development`, so a deployed server never reads project files through it.
|
|
121
|
+
*/
|
|
122
|
+
projectRoot?: string;
|
|
118
123
|
env?: Record<string, unknown>;
|
|
119
124
|
waitUntil?: (task: Promise<unknown>) => void;
|
|
120
125
|
request?: Request;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i as startSchedule, r as listSchedules, t as cancelSchedule } from "./started-
|
|
5
|
-
import {
|
|
1
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-BBtYYl8j.js";
|
|
2
|
+
import { c as runScheduleFrom, o as loadStaticScheduleDefinition } from "./started-errors-DEmYH-vp.js";
|
|
3
|
+
import { i as getScheduleRunStore, n as getProcessScheduleDefinitions, o as getStartedScheduleRuntime, t as getHostScheduleInventory } from "./state-D4SZH6zk.js";
|
|
4
|
+
import { i as startSchedule, r as listSchedules, t as cancelSchedule } from "./started-B0pc3JY0.js";
|
|
5
|
+
import { n as redactInspectionText } from "./started-name-ruCM1EtQ.js";
|
|
6
6
|
//#region src/runtime/operations.ts
|
|
7
7
|
function isoDate(value) {
|
|
8
8
|
if (value === void 0) return;
|
|
@@ -164,10 +164,33 @@ const startedErrorStatus = {
|
|
|
164
164
|
function operationError(error) {
|
|
165
165
|
return withStatus(error, startedErrorStatus[error.code] ?? 500);
|
|
166
166
|
}
|
|
167
|
+
async function listStaticSchedules(filter) {
|
|
168
|
+
const inventory = getHostScheduleInventory();
|
|
169
|
+
const registry = inventory?.registry ?? {};
|
|
170
|
+
const timings = new Map([...Object.entries(inventory?.timings ?? {}), ...getProcessScheduleDefinitions() ?? []]);
|
|
171
|
+
const names = [.../* @__PURE__ */ new Set([...timings.keys(), ...Object.keys(registry)])].filter((name) => name !== "vitehub/started-schedules" && (filter === void 0 || name === filter)).sort((left, right) => left.localeCompare(right));
|
|
172
|
+
return (await Promise.all(names.map(async (name) => [name, timings.get(name) ?? await loadStaticScheduleDefinition(name, registry)]))).flatMap(([name, definition]) => definition?.cron === void 0 ? [] : [{
|
|
173
|
+
cron: definition.cron,
|
|
174
|
+
name,
|
|
175
|
+
...definition.timeZone === void 0 ? {} : { timeZone: definition.timeZone }
|
|
176
|
+
}]);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Lists the Static Schedule Definitions and the Schedules that code started. An app with only cron Schedules has no store
|
|
180
|
+
* for started Schedules, so it lists only its Definitions.
|
|
181
|
+
*/
|
|
167
182
|
async function runScheduleList(input) {
|
|
183
|
+
const definitions = await listStaticSchedules(input.name);
|
|
184
|
+
if (!getStartedScheduleRuntime()) return {
|
|
185
|
+
definitions,
|
|
186
|
+
schedules: []
|
|
187
|
+
};
|
|
168
188
|
const [error, schedules] = await listSchedules(input.name === void 0 ? {} : { name: input.name });
|
|
169
189
|
if (error) throw operationError(error);
|
|
170
|
-
return {
|
|
190
|
+
return {
|
|
191
|
+
definitions,
|
|
192
|
+
schedules: schedules.map(summarizeStartedSchedule)
|
|
193
|
+
};
|
|
171
194
|
}
|
|
172
195
|
async function runScheduleStart(input) {
|
|
173
196
|
const { name, ...options } = input;
|
package/dist/operations.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as ScheduleRunStatus, l as ScheduleRunAttemptStatus } from "./types-Cw5LjPuc.js";
|
|
2
|
-
import { t as AnyOperation } from "./operation-definition-
|
|
2
|
+
import { t as AnyOperation } from "./operation-definition-nmRu_O3V.js";
|
|
3
3
|
//#region src/runtime/operations.d.ts
|
|
4
4
|
/** Error of a run or attempt. The stack is not included. */
|
|
5
5
|
interface ScheduleRunErrorSummary {
|
|
@@ -65,8 +65,17 @@ interface StartedScheduleSummary {
|
|
|
65
65
|
payload?: unknown;
|
|
66
66
|
timeZone?: string;
|
|
67
67
|
}
|
|
68
|
+
/** Serializable view of one Static Schedule Definition, which runs on its own `cron`. */
|
|
69
|
+
interface ScheduleDefinitionSummary {
|
|
70
|
+
cron: string;
|
|
71
|
+
name: string;
|
|
72
|
+
timeZone?: string;
|
|
73
|
+
}
|
|
68
74
|
/** Result of `schedule.list`. */
|
|
69
75
|
interface ScheduleListResult {
|
|
76
|
+
/** The Static Schedule Definitions of this server, by name. */
|
|
77
|
+
definitions: ScheduleDefinitionSummary[];
|
|
78
|
+
/** The Schedules that code started with `startSchedule()`, oldest first. Empty when no Definition can be started. */
|
|
70
79
|
schedules: StartedScheduleSummary[];
|
|
71
80
|
}
|
|
72
81
|
/** Result of `schedule.start` and `schedule.cancel`. */
|
package/dist/operations.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as isRecordOrFunction } from "./object-Da1zyPCR.js";
|
|
2
|
-
import { t as internalErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
+
import { t as internalErrorDiagnostics } from "./error-diagnostics-CQ4BUqRe.js";
|
|
3
3
|
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
//#region ../internal/src/standard-schema.ts
|
|
@@ -143,7 +143,7 @@ function table(rows) {
|
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/operations.ts
|
|
146
|
-
const runtime = () => import("./operations-
|
|
146
|
+
const runtime = () => import("./operations-DqwmJ8MN.js");
|
|
147
147
|
const id = v.pipe(v.string(), v.minLength(1));
|
|
148
148
|
function formatRuns({ runs }) {
|
|
149
149
|
if (runs.length === 0) return "No runs.\n";
|
|
@@ -242,9 +242,11 @@ function timingOf(schedule) {
|
|
|
242
242
|
if (schedule.at) return `once at ${schedule.at}`;
|
|
243
243
|
return schedule.timeZone && schedule.timeZone !== "UTC" ? `${schedule.cron} (${schedule.timeZone})` : schedule.cron ?? "-";
|
|
244
244
|
}
|
|
245
|
-
function formatSchedules({ schedules }) {
|
|
246
|
-
if (schedules.length === 0) return "No
|
|
247
|
-
|
|
245
|
+
function formatSchedules({ definitions = [], schedules }) {
|
|
246
|
+
if (definitions.length === 0 && schedules.length === 0) return "No Schedules.\n";
|
|
247
|
+
const parts = [];
|
|
248
|
+
if (definitions.length > 0) parts.push(table([["SCHEDULE", "CRON"], ...definitions.map((definition) => [definition.name, definition.timeZone && definition.timeZone !== "UTC" ? `${definition.cron} (${definition.timeZone})` : definition.cron])]));
|
|
249
|
+
if (schedules.length > 0) parts.push(table([[
|
|
248
250
|
"ID",
|
|
249
251
|
"SCHEDULE",
|
|
250
252
|
"RUNS",
|
|
@@ -254,7 +256,8 @@ function formatSchedules({ schedules }) {
|
|
|
254
256
|
schedule.name,
|
|
255
257
|
timingOf(schedule),
|
|
256
258
|
schedule.createdAt
|
|
257
|
-
])])
|
|
259
|
+
])]));
|
|
260
|
+
return `${parts.join("\n\n")}\n`;
|
|
258
261
|
}
|
|
259
262
|
function formatStartedSchedule(verb) {
|
|
260
263
|
return ({ schedule }) => `${verb} ${schedule.id}: ${schedule.name}, ${timingOf(schedule)}\n`;
|
|
@@ -274,7 +277,7 @@ const scheduleOperations = [
|
|
|
274
277
|
namespace: "schedule",
|
|
275
278
|
positional: ["name"]
|
|
276
279
|
},
|
|
277
|
-
description: "List the Schedules that code started with startSchedule(), oldest first. `name` keeps
|
|
280
|
+
description: "List the Static Schedule Definitions with their cron, and the Schedules that code started with startSchedule(), oldest first. `name` keeps one Definition and its started Schedules.",
|
|
278
281
|
input: v.object({ name: v.optional(id) }),
|
|
279
282
|
kind: "read",
|
|
280
283
|
name: "schedule.list",
|
package/dist/os.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as isIanaTimeZone } from "./time-zone-SBldrUgt.js";
|
|
2
2
|
import { t as isRecord } from "./object-Da1zyPCR.js";
|
|
3
3
|
import { n as invariantError } from "./invariant-DolT9EEx.js";
|
|
4
|
-
import { r as timeZoneOffsetMinutes } from "./due-
|
|
4
|
+
import { r as timeZoneOffsetMinutes } from "./due-sOJvF_6Z.js";
|
|
5
5
|
import { defineErrors } from "@vite-hub/runtime";
|
|
6
6
|
import { parseCronExpression } from "cron-schedule";
|
|
7
7
|
import { homedir, userInfo } from "node:os";
|
package/dist/runtime/console.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as getProcessScheduleDefinitions, o as getStartedScheduleRuntime } from "../state-D4SZH6zk.js";
|
|
2
2
|
//#region src/runtime/console.ts
|
|
3
3
|
/** The Cron column of the Console: the cron, with the time zone when it is not UTC. */
|
|
4
4
|
function scheduleConsoleTiming(cron, timeZone) {
|
package/dist/runtime/kv.d.ts
CHANGED
package/dist/runtime/kv.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createScheduleKVStorage } from "../kv-storage-
|
|
1
|
+
import { t as createScheduleKVStorage } from "../kv-storage-2kZtP2CC.js";
|
|
2
2
|
import * as kvPackage from "@vite-hub/kv";
|
|
3
3
|
//#region src/runtime/kv.ts
|
|
4
4
|
const scheduleKVStorage = createScheduleKVStorage(kvPackage.kv);
|
package/dist/runtime/process.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as isRecordOrFunction } from "../object-Da1zyPCR.js";
|
|
2
|
-
import { t as scheduleErrorDiagnostics } from "../error-diagnostics-
|
|
2
|
+
import { t as scheduleErrorDiagnostics } from "../error-diagnostics-BBtYYl8j.js";
|
|
3
3
|
import { i as scheduleIdempotencyKey, o as createScheduleError } from "../wait-until-Dy4Bn3ZN.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as isScheduleDue } from "../due-
|
|
7
|
-
import { i as runStartedSchedules } from "../started-
|
|
4
|
+
import { a as executeStaticSchedule, l as toRunId } from "../started-errors-DEmYH-vp.js";
|
|
5
|
+
import { a as getScheduleRuntimeRegistry, c as registerProcessScheduleDefinitions, d as setScheduleOccurrenceClaims, f as setScheduleRunStore, i as getScheduleRunStore, p as setScheduleRuntimeRegistry, r as getScheduleOccurrenceClaims } from "../state-D4SZH6zk.js";
|
|
6
|
+
import { t as isScheduleDue } from "../due-sOJvF_6Z.js";
|
|
7
|
+
import { i as runStartedSchedules } from "../started-Bk2Icknk.js";
|
|
8
8
|
import { createMemoryLeaseStore } from "@vite-hub/runtime";
|
|
9
9
|
import { hostname } from "node:os";
|
|
10
10
|
import { onShutdown } from "@vite-hub/runtime/internal/shutdown";
|
package/dist/runtime/state.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { StartedScheduleRuntime, getProcessScheduleDefinitions, getScheduleOccurrenceClaims, getScheduleRunStore, getScheduleRuntimeRegistry, getStartedScheduleRuntime, loadScheduleDefinition, registerProcessScheduleDefinitions, resetScheduleRuntime, setScheduleOccurrenceClaims, setScheduleRunStore, setScheduleRuntimeRegistry, setStartedScheduleRuntime };
|
|
1
|
+
import { a as getScheduleRunStore, c as loadScheduleDefinition, d as setHostScheduleInventory, f as setScheduleOccurrenceClaims, h as setStartedScheduleRuntime, i as getScheduleOccurrenceClaims, l as registerProcessScheduleDefinitions, m as setScheduleRuntimeRegistry, n as getHostScheduleInventory, o as getScheduleRuntimeRegistry, p as setScheduleRunStore, r as getProcessScheduleDefinitions, s as getStartedScheduleRuntime, t as StartedScheduleRuntime, u as resetScheduleRuntime } from "../state-CPd10SXq.js";
|
|
2
|
+
export { StartedScheduleRuntime, getHostScheduleInventory, getProcessScheduleDefinitions, getScheduleOccurrenceClaims, getScheduleRunStore, getScheduleRuntimeRegistry, getStartedScheduleRuntime, loadScheduleDefinition, registerProcessScheduleDefinitions, resetScheduleRuntime, setHostScheduleInventory, setScheduleOccurrenceClaims, setScheduleRunStore, setScheduleRuntimeRegistry, setStartedScheduleRuntime };
|
package/dist/runtime/state.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { getProcessScheduleDefinitions, getScheduleOccurrenceClaims, getScheduleRunStore, getScheduleRuntimeRegistry, getStartedScheduleRuntime, loadScheduleDefinition, registerProcessScheduleDefinitions, resetScheduleRuntime, setScheduleOccurrenceClaims, setScheduleRunStore, setScheduleRuntimeRegistry, setStartedScheduleRuntime };
|
|
1
|
+
import { a as getScheduleRuntimeRegistry, c as registerProcessScheduleDefinitions, d as setScheduleOccurrenceClaims, f as setScheduleRunStore, i as getScheduleRunStore, l as resetScheduleRuntime, m as setStartedScheduleRuntime, n as getProcessScheduleDefinitions, o as getStartedScheduleRuntime, p as setScheduleRuntimeRegistry, r as getScheduleOccurrenceClaims, s as loadScheduleDefinition, t as getHostScheduleInventory, u as setHostScheduleInventory } from "../state-D4SZH6zk.js";
|
|
2
|
+
export { getHostScheduleInventory, getProcessScheduleDefinitions, getScheduleOccurrenceClaims, getScheduleRunStore, getScheduleRuntimeRegistry, getStartedScheduleRuntime, loadScheduleDefinition, registerProcessScheduleDefinitions, resetScheduleRuntime, setHostScheduleInventory, setScheduleOccurrenceClaims, setScheduleRunStore, setScheduleRuntimeRegistry, setStartedScheduleRuntime };
|
package/dist/runtime/static.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as isScheduleCronAuthorized, c as normalizeCron, d as unwrapScheduleDefinition, i as executeStaticSchedule, l as normalizeScheduleRuntimeError, n as executeCloudflareStaticSchedules, o as isTimeZoneWakeDue, r as executeMatchingStaticSchedules, s as missingScheduleDefinitionError, t as createStaticScheduleRun, u as scheduledWakeTime } from "../static-
|
|
1
|
+
import { a as isScheduleCronAuthorized, c as normalizeCron, d as unwrapScheduleDefinition, i as executeStaticSchedule, l as normalizeScheduleRuntimeError, n as executeCloudflareStaticSchedules, o as isTimeZoneWakeDue, r as executeMatchingStaticSchedules, s as missingScheduleDefinitionError, t as createStaticScheduleRun, u as scheduledWakeTime } from "../static-7JCga3Iu.js";
|
|
2
2
|
export { createStaticScheduleRun, executeCloudflareStaticSchedules, executeMatchingStaticSchedules, executeStaticSchedule, isScheduleCronAuthorized, isTimeZoneWakeDue, missingScheduleDefinitionError, normalizeCron, normalizeScheduleRuntimeError, scheduledWakeTime, unwrapScheduleDefinition };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference path="./registry-module.d.ts" />
|
|
2
2
|
import { a as ScheduleDefinitionRegistry, b as StartedScheduleStore, c as ScheduleRunAttemptRecord, f as ScheduleRunListOptions, g as ScheduleRunStore, i as ScheduleDefinitionOptions, n as ScheduleDefinition, o as ScheduleHandler, p as ScheduleRunRecord, s as ScheduleRegistryDefinition, u as ScheduleRunContext } from "./types-Cw5LjPuc.js";
|
|
3
|
-
import { a as createScheduleRun, c as runScheduleFrom, n as createKVScheduleRunStore, o as executeSchedule, r as createMemoryScheduleRunStore, s as executeStaticSchedule, t as KVScheduleStoreOptions } from "./store-
|
|
4
|
-
import { n as createScheduleKVStorage, t as ScheduleKVStorage } from "./kv-storage-
|
|
3
|
+
import { a as createScheduleRun, c as runScheduleFrom, n as createKVScheduleRunStore, o as executeSchedule, r as createMemoryScheduleRunStore, s as executeStaticSchedule, t as KVScheduleStoreOptions } from "./store-DeMojnXM.js";
|
|
4
|
+
import { n as createScheduleKVStorage, t as ScheduleKVStorage } from "./kv-storage-Bm9aYLfZ.js";
|
|
5
5
|
import { normalizeCron, unwrapScheduleDefinition } from "./runtime/static.js";
|
|
6
|
-
import {
|
|
6
|
+
import { a as getScheduleRunStore, p as setScheduleRunStore, u as resetScheduleRuntime } from "./state-CPd10SXq.js";
|
|
7
7
|
//#region src/runtime/started.d.ts
|
|
8
8
|
interface InstallStartedSchedulesOptions {
|
|
9
9
|
/**
|
package/dist/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { c as normalizeCron, d as unwrapScheduleDefinition } from "./static-
|
|
4
|
-
import { t as createScheduleKVStorage } from "./kv-storage-
|
|
5
|
-
import { i as runStartedSchedules, n as createMemoryStartedScheduleStore, r as installStartedSchedules, t as createKVStartedScheduleStore } from "./started-
|
|
1
|
+
import { a as executeStaticSchedule, c as runScheduleFrom, i as executeSchedule, n as createScheduleRun } from "./started-errors-DEmYH-vp.js";
|
|
2
|
+
import { f as setScheduleRunStore, g as createMemoryScheduleRunStore, h as createKVScheduleRunStore, i as getScheduleRunStore, l as resetScheduleRuntime } from "./state-D4SZH6zk.js";
|
|
3
|
+
import { c as normalizeCron, d as unwrapScheduleDefinition } from "./static-7JCga3Iu.js";
|
|
4
|
+
import { t as createScheduleKVStorage } from "./kv-storage-2kZtP2CC.js";
|
|
5
|
+
import { i as runStartedSchedules, n as createMemoryStartedScheduleStore, r as installStartedSchedules, t as createKVStartedScheduleStore } from "./started-Bk2Icknk.js";
|
|
6
6
|
export { createKVScheduleRunStore, createKVStartedScheduleStore, createMemoryScheduleRunStore, createMemoryStartedScheduleStore, createScheduleKVStorage, createScheduleRun, executeSchedule, executeStaticSchedule, getScheduleRunStore, installStartedSchedules, normalizeCron, resetScheduleRuntime, runScheduleFrom, runStartedSchedules, setScheduleRunStore, unwrapScheduleDefinition };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as isIanaTimeZone } from "./time-zone-SBldrUgt.js";
|
|
2
2
|
import { n as isRecordOrFunction } from "./object-Da1zyPCR.js";
|
|
3
3
|
import { r as parseScheduledAt } from "./wait-until-Dy4Bn3ZN.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { t as startedScheduleErrors, u as randomId } from "./started-errors-DEmYH-vp.js";
|
|
5
|
+
import { o as getStartedScheduleRuntime } from "./state-D4SZH6zk.js";
|
|
6
6
|
import { parseCronExpression } from "cron-schedule";
|
|
7
7
|
//#region src/started.ts
|
|
8
8
|
const optionKeys = /* @__PURE__ */ new Set([
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as isRecordOrFunction } from "./object-Da1zyPCR.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as isScheduleDue } from "./due-
|
|
2
|
+
import { i as executeSchedule, l as toRunId, t as startedScheduleErrors } from "./started-errors-DEmYH-vp.js";
|
|
3
|
+
import { _ as joinKey, m as setStartedScheduleRuntime, o as getStartedScheduleRuntime, r as getScheduleOccurrenceClaims, v as keySegments } from "./state-D4SZH6zk.js";
|
|
4
|
+
import { t as isScheduleDue } from "./due-sOJvF_6Z.js";
|
|
5
5
|
import { normalizeRuntimeDiagnosticError } from "@vite-hub/runtime";
|
|
6
6
|
//#region src/runtime/started.ts
|
|
7
7
|
const minuteMs = 6e4;
|