@vite-hub/schedule 0.5.0 → 0.5.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.
Files changed (49) hide show
  1. package/dist/{console-DueeEBcM.d.ts → console-DFI1QBkP.d.ts} +0 -4
  2. package/dist/{cron-C1l3TquN.js → cron-BT3ef48f.js} +2 -4
  3. package/dist/definition.d.ts +2 -4
  4. package/dist/definition.js +4 -5
  5. package/dist/{due-n120-_nz.js → due-D-0trD1g.js} +2 -3
  6. package/dist/durability.d.ts +1 -3
  7. package/dist/durability.js +1 -2
  8. package/dist/{error-diagnostics-DTmP6baC.js → error-diagnostics-B1AaIGWP.js} +1 -2
  9. package/dist/{error-diagnostics-C0KyI408.js → error-diagnostics-kKXseq8d.js} +5 -2
  10. package/dist/index.d.ts +3 -13
  11. package/dist/index.js +5 -7
  12. package/dist/{inspect-DTfAo5gS.js → inspect-CW0qwt9p.js} +2 -4
  13. package/dist/{kv-storage-2kZtP2CC.js → kv-storage-Dsr3TL9c.js} +1 -2
  14. package/dist/{kv-storage-Bm9aYLfZ.d.ts → kv-storage-hI2IOjb5.d.ts} +0 -2
  15. package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
  16. package/dist/{operation-definition-CI2PJGqu.d.ts → operation-definition-CqZkx1Rm.d.ts} +0 -4
  17. package/dist/{operations-DlrK9mlH.js → operations-BTUQeba1.js} +7 -8
  18. package/dist/operations.d.ts +2 -6
  19. package/dist/operations.js +8 -13
  20. package/dist/os.d.ts +0 -8
  21. package/dist/os.js +13 -22
  22. package/dist/{out-BbXG-yVX.js → out-By90R-Bo.js} +3345 -2394
  23. package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-DegdyBIC.js} +2 -3
  24. package/dist/runtime/console.d.ts +2 -4
  25. package/dist/runtime/console.js +2 -3
  26. package/dist/runtime/kv.d.ts +2 -4
  27. package/dist/runtime/kv.js +2 -3
  28. package/dist/runtime/process.d.ts +1 -3
  29. package/dist/runtime/process.js +10 -13
  30. package/dist/runtime/state.d.ts +1 -1
  31. package/dist/runtime/state.js +1 -2
  32. package/dist/runtime/static.d.ts +1 -1
  33. package/dist/runtime/static.js +2 -2
  34. package/dist/runtime.d.ts +5 -7
  35. package/dist/runtime.js +5 -5
  36. package/dist/{started-BWWr7Ufw.js → started-B1Se_Iwo.js} +6 -7
  37. package/dist/{started-BXdWMdji.js → started-Bzvr4t5f.js} +6 -7
  38. package/dist/{started-errors-BMg04lL3.js → started-errors-IG9DlT2A.js} +6 -9
  39. package/dist/{started-name-DudQ0fsR.js → started-name-w6n9uDdt.js} +1 -2
  40. package/dist/{state-CJKAhskJ.d.ts → state-BDEDVlyr.d.ts} +1 -5
  41. package/dist/{state-BjWnxyhv.js → state-BZLy46UJ.js} +4 -6
  42. package/dist/{static-BgoOCoe5.js → static-Bg7Jj92L.js} +11 -18
  43. package/dist/{static-CcBWx1kU.d.ts → static-DeRvJqcQ.d.ts} +1 -5
  44. package/dist/{store-CZHZfttA.d.ts → store-CEv3cScg.d.ts} +2 -6
  45. package/dist/{time-zone-SBldrUgt.js → time-zone-pMp_g8Uu.js} +1 -2
  46. package/dist/{types-Cw5LjPuc.d.ts → types-DTVPVY5O.d.ts} +0 -2
  47. package/dist/vite.d.ts +3 -19
  48. package/dist/vite.js +1443 -918
  49. package/package.json +9 -9
@@ -1,4 +1,3 @@
1
- //#region ../internal/src/inspect.d.ts
2
1
  interface ViteHubDefinitionField {
3
2
  label: string;
4
3
  value: string;
@@ -60,8 +59,6 @@ type ViteHubInspectionContributorFactory = () => ViteHubInspectionContributor |
60
59
  interface ViteHubInspectionPluginMetadata {
61
60
  inspect?: ViteHubInspectionContributor | ViteHubInspectionContributorFactory;
62
61
  }
63
- //#endregion
64
- //#region ../internal/src/console.d.ts
65
62
  type MaybePromise<T> = T | Promise<T>;
66
63
  /** Lists discovered Definitions in a sidebar and shows the selected Definition's fields. */
67
64
  interface ViteHubConsoleDefinitionCatalogView {
@@ -328,5 +325,4 @@ interface ViteHubConsoleRuntimeRecordTableSection<TOptions = void> extends ViteH
328
325
  */
329
326
  entry?: (options: TOptions) => MaybePromise<string | undefined>;
330
327
  }
331
- //#endregion
332
328
  export { ViteHubInspectionPluginMetadata as i, ViteHubConsoleRuntimeRecordTableSection as n, ViteHubDefinitionSummary as r, ViteHubConsoleRecord as t };
@@ -1,6 +1,6 @@
1
1
  import { defineDiagnostics } from "nostics";
2
2
  import { parseCronExpression } from "cron-schedule";
3
- //#region ../internal/src/invariant.ts
3
+ // ../internal/src/invariant.ts
4
4
  const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
5
5
  docsBase: "https://vitehub.dev/docs/development/diagnostics",
6
6
  codes: { INTERNAL_INVARIANT_FAILED: {
@@ -19,8 +19,7 @@ function invariantError(what) {
19
19
  function invariant(condition, what) {
20
20
  if (!condition) throw invariantError(what);
21
21
  }
22
- //#endregion
23
- //#region src/os/cron.ts
22
+ // src/os/cron.ts
24
23
  const allMonths = range(1, 12);
25
24
  const allWeekdays = range(0, 6);
26
25
  function range(first, last) {
@@ -66,5 +65,4 @@ function arithmeticStep(values) {
66
65
  const step = values[1] - values[0];
67
66
  return values.every((value, index) => index === 0 || value - values[index - 1] === step) ? step : void 0;
68
67
  }
69
- //#endregion
70
68
  export { parseCronFields as a, timesOfDay as c, isWeekdayRestricted as i, invariant as l, isDayRestricted as n, range as o, isMonthRestricted as r, runsEveryDay as s, arithmeticStep as t, invariantError as u };
@@ -1,9 +1,7 @@
1
- import { n as ScheduleDefinition, r as ScheduleDefinitionInput } from "./types-Cw5LjPuc.js";
2
- //#region src/definition.d.ts
1
+ import { n as ScheduleDefinition, r as ScheduleDefinitionInput } from "./types-DTVPVY5O.js";
3
2
  export declare function defineSchedule<TResult = unknown>(input: ScheduleDefinitionInput<TResult> & {
4
3
  cron: string;
5
4
  }): ScheduleDefinition<TResult> & {
6
5
  cron: string;
7
6
  };
8
- export declare function defineSchedule<TResult = unknown>(input: ScheduleDefinitionInput<TResult>): ScheduleDefinition<TResult>;
9
- //#endregion
7
+ export declare function defineSchedule<TResult = unknown>(input: ScheduleDefinitionInput<TResult>): ScheduleDefinition<TResult>;
@@ -1,7 +1,7 @@
1
- import { t as isIanaTimeZone } from "./time-zone-SBldrUgt.js";
2
- import { t as isRecord } from "./object-Da1zyPCR.js";
3
- import { t as scheduleErrorDiagnostics } from "./error-diagnostics-DTmP6baC.js";
4
- //#region src/definition.ts
1
+ import { t as isIanaTimeZone } from "./time-zone-pMp_g8Uu.js";
2
+ import { t as isRecord } from "./object-CAK6UYR5.js";
3
+ import { t as scheduleErrorDiagnostics } from "./error-diagnostics-B1AaIGWP.js";
4
+ // src/definition.ts
5
5
  const cronFieldPattern = /^[^\s]+$/;
6
6
  const scheduleDefinitionKeys = /* @__PURE__ */ new Set([
7
7
  "manual",
@@ -43,5 +43,4 @@ function defineSchedule(input, ...removed) {
43
43
  if (input.manual !== void 0) definition.options = { manual: input.manual };
44
44
  return definition;
45
45
  }
46
- //#endregion
47
46
  export { defineSchedule };
@@ -1,6 +1,6 @@
1
- import { t as scheduleErrorDiagnostics } from "./error-diagnostics-DTmP6baC.js";
1
+ import { t as scheduleErrorDiagnostics } from "./error-diagnostics-B1AaIGWP.js";
2
2
  import { parseCronExpression } from "cron-schedule";
3
- //#region src/runtime/due.ts
3
+ // src/runtime/due.ts
4
4
  const weekdayIndexes = /* @__PURE__ */ new Map([
5
5
  ["Sun", 0],
6
6
  ["Mon", 1],
@@ -155,5 +155,4 @@ function cronWithWeekdayNames(cron) {
155
155
  fields[4] = parseCronExpression(fields.join(" ")).weekdays.map((day) => weekdayNames[day]).join(",");
156
156
  return fields.join(" ");
157
157
  }
158
- //#endregion
159
158
  export { timeZoneOffsetMinutes as i, isScheduleDue as n, latestCronMinute as r, cronWithWeekdayNames as t };
@@ -1,5 +1,4 @@
1
1
  import { Durability, DurabilityContext } from "@vite-hub/runtime/durability";
2
- //#region src/durability.d.ts
3
2
  /** What the build passes to `scheduleDurability()`. */
4
3
  export interface ScheduleDurabilityInput {
5
4
  driver: "process";
@@ -10,5 +9,4 @@ export interface ScheduleDurabilityInput {
10
9
  * The durability of schedule claims. With SQL leases in a Postgres or remote libSQL Default Database, one instance runs
11
10
  * each occurrence. Without them, each process claims each occurrence for itself.
12
11
  */
13
- export declare function scheduleDurability(input: ScheduleDurabilityInput, context: DurabilityContext): Durability[];
14
- //#endregion
12
+ export declare function scheduleDurability(input: ScheduleDurabilityInput, context: DurabilityContext): Durability[];
@@ -1,4 +1,4 @@
1
- //#region src/durability.ts
1
+ // src/durability.ts
2
2
  /**
3
3
  * The durability of schedule claims. With SQL leases in a Postgres or remote libSQL Default Database, one instance runs
4
4
  * each occurrence. Without them, each process claims each occurrence for itself.
@@ -19,5 +19,4 @@ function scheduleDurability(input, context) {
19
19
  fix: input.leases ? "Define the Default Database with `dialect: \"postgresql\"` or a remote libSQL URL." : "Turn on Database and define a Postgres or remote libSQL Default Database. The instances then share Schedule leases."
20
20
  }];
21
21
  }
22
- //#endregion
23
22
  export { scheduleDurability };
@@ -1,5 +1,5 @@
1
1
  import { defineDiagnostics } from "nostics";
2
- //#region src/error-diagnostics.ts
2
+ // src/error-diagnostics.ts
3
3
  const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
4
4
  const scheduleErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
5
5
  docsBase: "https://vitehub.dev/docs/schedule/diagnostics",
@@ -162,5 +162,4 @@ const scheduleErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
162
162
  }
163
163
  }
164
164
  });
165
- //#endregion
166
165
  export { scheduleErrorDiagnostics as t };
@@ -1,5 +1,5 @@
1
1
  import { defineDiagnostics } from "nostics";
2
- //#region ../internal/src/error-diagnostics.ts
2
+ // ../internal/src/error-diagnostics.ts
3
3
  const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
4
4
  const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
5
5
  docsBase: "https://vitehub.dev/docs/development/diagnostics",
@@ -256,6 +256,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
256
256
  why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
257
257
  fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
258
258
  },
259
+ INTERNAL_SITE_TOKEN_TOO_LONG: {
260
+ why: ({ length, maximum }) => `The Site access token is ${length} characters, and an app accepts ${maximum}.`,
261
+ fix: "Open the app with a shorter path, or give the person and the project shorter names, so that the Site access token fits."
262
+ },
259
263
  INTERNAL_SQLITE_ARGUMENT_INVALID: {
260
264
  why: ({ value }) => value === "undefined" ? "undefined cannot be passed as argument to the database" : "Only finite numbers (not Infinity or NaN) can be passed as arguments",
261
265
  fix: "Pass query arguments as finite numbers, strings, booleans, bigints, dates, byte arrays, or null. Replace undefined with null, and check numbers with `Number.isFinite()` before the query."
@@ -270,5 +274,4 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
270
274
  }
271
275
  }
272
276
  });
273
- //#endregion
274
277
  export { internalErrorDiagnostics as t };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  /// <reference path="./registry-module.d.ts" />
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
2
  import { defineSchedule } from "./definition.js";
4
- import { i as RunScheduleOptions, t as KVScheduleStoreOptions } from "./store-CZHZfttA.js";
5
- import { t as ScheduleKVStorage } from "./kv-storage-Bm9aYLfZ.js";
3
+ import { i as RunScheduleOptions, t as KVScheduleStoreOptions } from "./store-CEv3cScg.js";
4
+ 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-DTVPVY5O.js";
5
+ import { t as ScheduleKVStorage } from "./kv-storage-hI2IOjb5.js";
6
6
  import { ErrorCatalog, Result, ViteHubError } from "@vite-hub/runtime";
7
- //#region src/run-errors.d.ts
8
7
  type RunScheduleErrorCodes = {
9
8
  SCHEDULE_INVALID_SCHEDULED_AT: {
10
9
  fix: string;
@@ -16,16 +15,12 @@ type RunScheduleErrorCodes = {
16
15
  };
17
16
  };
18
17
  type RunScheduleErrorCode = keyof RunScheduleErrorCodes;
19
- //#endregion
20
- //#region src/run.d.ts
21
18
  /**
22
19
  * Runs a Static Schedule Definition that sets `manual: true` now, as if its cron fired at `scheduledAt` (default: now).
23
20
  * It returns `[error, run]`. A failed handler is a run with `status: "failed"`, not an error. An invalid `scheduledAt`
24
21
  * or a failed run store is `error`. Definition loading errors, unknown names, and Definitions without `manual: true` throw.
25
22
  */
26
23
  export declare function runSchedule(name: string, options?: RunScheduleOptions): Promise<Result<ScheduleRunRecord, RunScheduleErrorCode>>;
27
- //#endregion
28
- //#region src/started-errors.d.ts
29
24
  type StartedScheduleErrorCodes = {
30
25
  SCHEDULE_INVALID_OPTIONS: {
31
26
  fix: string;
@@ -55,8 +50,6 @@ type StartedScheduleErrorCodes = {
55
50
  };
56
51
  };
57
52
  type StartedScheduleErrorCode = keyof StartedScheduleErrorCodes;
58
- //#endregion
59
- //#region src/started.d.ts
60
53
  /**
61
54
  * Starts the Schedule Definition `name`, which declares no `cron`, at a time that code picks: once at `at`, or on each
62
55
  * occurrence of `cron` in `timeZone` until `cancelSchedule()`. The store keeps it across restarts and deploys. The handler
@@ -71,8 +64,6 @@ export declare function listSchedules(options?: {
71
64
  }): Promise<Result<StartedSchedule[], StartedScheduleErrorCode>>;
72
65
  /** Removes a started Schedule, so it does not run again. A run that already started finishes. */
73
66
  export declare function cancelSchedule(id: string): Promise<Result<StartedSchedule, StartedScheduleErrorCode>>;
74
- //#endregion
75
- //#region src/errors.d.ts
76
67
  declare const scheduleErrorCodes: readonly ["SCHEDULE_DEFINITION_NOT_FOUND", "SCHEDULE_INVALID_CRON", "SCHEDULE_INVALID_SCHEDULED_AT", "SCHEDULE_MANUAL_RUN_DISABLED", "SCHEDULE_NOT_DUE", "SCHEDULE_RUN_NOT_FOUND"];
77
68
  declare const scheduleErrorFields: readonly ["cron", "scheduledAt"];
78
69
  declare const scheduleErrorValueTypes: readonly ["array", "bigint", "boolean", "date", "function", "null", "number", "object", "string", "symbol", "undefined", "unknown"];
@@ -84,5 +75,4 @@ type ScheduleErrorDetails = {
84
75
  field: ScheduleErrorField;
85
76
  valueType: ScheduleErrorValueType;
86
77
  };
87
- //#endregion
88
78
  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,9 +1,9 @@
1
1
  import { defineSchedule } from "./definition.js";
2
- import { S as createScheduleError, y as parseScheduledAt } from "./static-BgoOCoe5.js";
3
- import { r as executeManualSchedule, s as resolveManualSchedule } from "./started-errors-BMg04lL3.js";
4
- import { i as startSchedule, n as getSchedule, r as listSchedules, t as cancelSchedule } from "./started-BWWr7Ufw.js";
2
+ import { S as createScheduleError, y as parseScheduledAt } from "./static-Bg7Jj92L.js";
3
+ import { r as executeManualSchedule, s as resolveManualSchedule } from "./started-errors-IG9DlT2A.js";
4
+ import { i as startSchedule, n as getSchedule, r as listSchedules, t as cancelSchedule } from "./started-B1Se_Iwo.js";
5
5
  import { defineErrors } from "@vite-hub/runtime";
6
- //#region src/run-errors.ts
6
+ // src/run-errors.ts
7
7
  const runScheduleErrors = /*#__PURE__*/ defineErrors({
8
8
  docs: "https://vitehub.dev/docs/schedule/diagnostics",
9
9
  codes: {
@@ -17,8 +17,7 @@ const runScheduleErrors = /*#__PURE__*/ defineErrors({
17
17
  }
18
18
  }
19
19
  });
20
- //#endregion
21
- //#region src/run.ts
20
+ // src/run.ts
22
21
  const registryModule = "#vitehub/schedule/registry";
23
22
  async function loadRegistry() {
24
23
  try {
@@ -51,5 +50,4 @@ async function runSchedule(name, options = {}) {
51
50
  return [runScheduleErrors.SCHEDULE_RUN_STORE_FAILED({ cause }), void 0];
52
51
  }
53
52
  }
54
- //#endregion
55
53
  export { cancelSchedule, defineSchedule, getSchedule, listSchedules, runSchedule, startSchedule };
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
1
+ // ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
2
2
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
3
3
  function normalizeWindowsPath(input = "") {
4
4
  if (!input) return input;
@@ -95,8 +95,7 @@ const dirname = function(p) {
95
95
  if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
96
96
  return segments.join("/") || (isAbsolute(p) ? "/" : ".");
97
97
  };
98
- //#endregion
99
- //#region ../internal/src/inspect.ts
98
+ // ../internal/src/inspect.ts
100
99
  function relativeDefinitionFile(projectRoot, file) {
101
100
  return relative(projectRoot, file).replaceAll("\\", "/");
102
101
  }
@@ -114,5 +113,4 @@ const embeddedSecretAssignmentPattern = new RegExp(String.raw`\b([\w-]*(?:${secr
114
113
  function redactInspectionText(value) {
115
114
  return value.replace(embeddedUrlCredentialPattern, `$1${redactedInspectionValue}@`).replace(embeddedAuthorizationPattern, `$1${redactedInspectionValue}`).replace(embeddedCookiePattern, `$1${redactedInspectionValue}`).replace(embeddedBearerPattern, `Bearer ${redactedInspectionValue}`).replace(embeddedSecretAssignmentPattern, `$1${redactedInspectionValue}`);
116
115
  }
117
- //#endregion
118
116
  export { relative as a, isAbsolute as i, relativeDefinitionFile as n, resolve as o, dirname as r, redactInspectionText as t };
@@ -1,4 +1,4 @@
1
- //#region src/runtime/kv-storage.ts
1
+ // src/runtime/kv-storage.ts
2
2
  function createScheduleKVStorage(kvStore) {
3
3
  return {
4
4
  async delete(key) {
@@ -26,5 +26,4 @@ function createScheduleKVStorage(kvStore) {
26
26
  }
27
27
  };
28
28
  }
29
- //#endregion
30
29
  export { createScheduleKVStorage as t };
@@ -1,4 +1,3 @@
1
- //#region src/runtime/kv-storage.d.ts
2
1
  interface ScheduleKVStorage {
3
2
  delete(key: string): boolean | Promise<boolean> | Promise<void> | void;
4
3
  get<T = unknown>(key: string): Promise<T | null | undefined> | T | null | undefined;
@@ -18,5 +17,4 @@ interface ViteHubKVStorage {
18
17
  set<T = unknown>(key: string, value: T): Promise<readonly [unknown, unknown]>;
19
18
  }
20
19
  declare function createScheduleKVStorage(kvStore: ViteHubKVStorage): ScheduleKVStorage;
21
- //#endregion
22
20
  export { createScheduleKVStorage as n, ScheduleKVStorage as t };
@@ -1,4 +1,4 @@
1
- //#region ../internal/src/object.ts
1
+ // ../internal/src/object.ts
2
2
  /** A non-null object that is not an array. Functions do not pass. */
3
3
  function isRecord(value) {
4
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -7,5 +7,4 @@ function isRecord(value) {
7
7
  function isRecordOrFunction(value) {
8
8
  return Object(value) === value && !Array.isArray(value);
9
9
  }
10
- //#endregion
11
10
  export { isRecordOrFunction as n, isRecord as t };
@@ -1,4 +1,3 @@
1
- //#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
2
1
  /** The Standard Typed interface. This is a base type extended by other specs. */
3
2
  interface StandardTypedV1<Input = unknown, Output = Input> {
4
3
  /** The Standard properties. */
@@ -74,8 +73,6 @@ declare namespace StandardSchemaV1 {
74
73
  /** Infers the output type of a Standard. */
75
74
  type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
76
75
  }
77
- //#endregion
78
- //#region ../internal/src/operation-definition.d.ts
79
76
  /** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
80
77
  type OperationKind = "read" | "write" | "destructive";
81
78
  /** The signed-in user of a call. */
@@ -241,5 +238,4 @@ interface OperationContributionEntry {
241
238
  /** `false`: the app already has these operations at runtime. Only tools such as the CLI and `vitehub inspect` read the entry. */
242
239
  runtime?: false;
243
240
  }
244
- //#endregion
245
241
  export { OperationContributionEntry as n, AnyOperation as t };
@@ -1,10 +1,10 @@
1
- import { t as scheduleErrorDiagnostics } from "./error-diagnostics-DTmP6baC.js";
2
- import { c as runScheduleFrom, o as loadStaticScheduleDefinition } from "./started-errors-BMg04lL3.js";
3
- import "./started-name-DudQ0fsR.js";
4
- import { i as getScheduleRunStore, n as getProcessScheduleDefinitions, o as getStartedScheduleRuntime, t as getHostScheduleInventory } from "./state-BjWnxyhv.js";
5
- import { i as startSchedule, r as listSchedules, t as cancelSchedule } from "./started-BWWr7Ufw.js";
6
- import { t as redactInspectionText } from "./inspect-DTfAo5gS.js";
7
- //#region src/runtime/operations.ts
1
+ import { t as redactInspectionText } from "./inspect-CW0qwt9p.js";
2
+ import { t as scheduleErrorDiagnostics } from "./error-diagnostics-B1AaIGWP.js";
3
+ import { c as runScheduleFrom, o as loadStaticScheduleDefinition } from "./started-errors-IG9DlT2A.js";
4
+ import "./started-name-w6n9uDdt.js";
5
+ import { i as getScheduleRunStore, n as getProcessScheduleDefinitions, o as getStartedScheduleRuntime, t as getHostScheduleInventory } from "./state-BZLy46UJ.js";
6
+ import { i as startSchedule, r as listSchedules, t as cancelSchedule } from "./started-B1Se_Iwo.js";
7
+ // src/runtime/operations.ts
8
8
  function isoDate(value) {
9
9
  if (value === void 0) return;
10
10
  const date = value instanceof Date ? value : new Date(value);
@@ -200,5 +200,4 @@ async function runScheduleCancel(input) {
200
200
  if (error) throw operationError(error);
201
201
  return { schedule: summarizeStartedSchedule(schedule) };
202
202
  }
203
- //#endregion
204
203
  export { listScheduleRunAttempts, listScheduleRuns, runScheduleAttempts, runScheduleCancel, runScheduleList, runScheduleNow, runScheduleRuns, runScheduleStart, summarizeScheduleRun, summarizeScheduleRunAttempt };
@@ -1,6 +1,5 @@
1
- import { h as ScheduleRunStatus, l as ScheduleRunAttemptStatus } from "./types-Cw5LjPuc.js";
2
- import { t as AnyOperation } from "./operation-definition-CI2PJGqu.js";
3
- //#region src/runtime/operations.d.ts
1
+ import { t as AnyOperation } from "./operation-definition-CqZkx1Rm.js";
2
+ import { h as ScheduleRunStatus, l as ScheduleRunAttemptStatus } from "./types-DTVPVY5O.js";
4
3
  /** Error of a run or attempt. The stack is not included. */
5
4
  interface ScheduleRunErrorSummary {
6
5
  message: string;
@@ -82,12 +81,9 @@ interface ScheduleListResult {
82
81
  interface StartedScheduleResult {
83
82
  schedule: StartedScheduleSummary;
84
83
  }
85
- //#endregion
86
- //#region src/operations.d.ts
87
84
  /**
88
85
  * The `schedule.*` operations: runs, attempts, run, list, start, and cancel. The Console, `vitehub schedule`, and agents
89
86
  * run them.
90
87
  */
91
88
  export declare const scheduleOperations: readonly AnyOperation[];
92
- //#endregion
93
89
  export type { ScheduleAttemptsResult, ScheduleListResult, ScheduleRunResult, ScheduleRunsResult, StartedScheduleResult };
@@ -1,8 +1,8 @@
1
- import { n as isRecordOrFunction } from "./object-Da1zyPCR.js";
2
- import { t as internalErrorDiagnostics } from "./error-diagnostics-C0KyI408.js";
1
+ import { n as isRecordOrFunction } from "./object-CAK6UYR5.js";
2
+ import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
3
3
  import { toJsonSchema } from "@valibot/to-json-schema";
4
4
  import * as v from "valibot";
5
- //#region ../internal/src/standard-schema.ts
5
+ // ../internal/src/standard-schema.ts
6
6
  function readOwn(value, key) {
7
7
  if (value === null || Object(value) !== value) return;
8
8
  try {
@@ -31,8 +31,7 @@ function standardJsonSchema(schema, direction, target = "draft-2020-12", library
31
31
  return;
32
32
  }
33
33
  }
34
- //#endregion
35
- //#region ../internal/src/valibot.ts
34
+ // ../internal/src/valibot.ts
36
35
  const valibotTargets = /* @__PURE__ */ new Set([
37
36
  "draft-07",
38
37
  "draft-2020-12",
@@ -73,8 +72,7 @@ function withValibotJsonSchema(schema, options = {}) {
73
72
  }
74
73
  };
75
74
  }
76
- //#endregion
77
- //#region ../internal/src/operation-definition.ts
75
+ // ../internal/src/operation-definition.ts
78
76
  const nameFormat = /^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/;
79
77
  const kinds = /* @__PURE__ */ new Set([
80
78
  "read",
@@ -134,16 +132,14 @@ function isSectionId(section) {
134
132
  function operationInputJsonSchema(operation) {
135
133
  return standardJsonSchema(operation.input, "input") ?? { type: "object" };
136
134
  }
137
- //#endregion
138
- //#region ../internal/src/operations.ts
135
+ // ../internal/src/operations.ts
139
136
  /** Align rows of text cells in columns for CLI output. The last column is not padded. */
140
137
  function table(rows) {
141
138
  const widths = rows[0].map((_, column) => Math.max(...rows.map((row) => row[column].length)));
142
139
  return rows.map((row) => row.map((cell, column) => column === row.length - 1 ? cell : cell.padEnd(widths[column])).join(" ")).join("\n");
143
140
  }
144
- //#endregion
145
- //#region src/operations.ts
146
- const runtime = () => import("./operations-DlrK9mlH.js");
141
+ // src/operations.ts
142
+ const runtime = () => import("./operations-BTUQeba1.js");
147
143
  const id = v.pipe(v.string(), v.minLength(1));
148
144
  function formatRuns({ runs }) {
149
145
  if (runs.length === 0) return "No runs.\n";
@@ -317,5 +313,4 @@ const scheduleOperations = [
317
313
  run: async (input) => await (await runtime()).runScheduleCancel(input)
318
314
  })
319
315
  ];
320
- //#endregion
321
316
  export { scheduleOperations };
package/dist/os.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { ErrorCatalog, Result } from "@vite-hub/runtime";
2
2
  import { posix } from "node:path";
3
- //#region src/os/errors.d.ts
4
3
  /** Operating systems that `@vite-hub/schedule/os` installs timers on, as `process.platform` names them. */
5
4
  type OsSchedulePlatform = "linux" | "darwin" | "win32";
6
5
  /** `"user"` runs as the current user. `"system"` runs as root or SYSTEM and needs root or Administrator to install. */
@@ -57,8 +56,6 @@ type OsScheduleErrorCodes = {
57
56
  };
58
57
  export declare const osScheduleErrors: ErrorCatalog<OsScheduleErrorCodes>;
59
58
  type OsScheduleErrorCode = keyof OsScheduleErrorCodes;
60
- //#endregion
61
- //#region src/os/host.d.ts
62
59
  interface OsScheduleStatus {
63
60
  name: string;
64
61
  platform: OsSchedulePlatform;
@@ -93,8 +90,6 @@ interface OsScheduleRemoval {
93
90
  */
94
91
  existed: boolean;
95
92
  }
96
- //#endregion
97
- //#region src/os/schedules.d.ts
98
93
  /** Any object with `cron` and an optional `timeZone`. The result of `defineSchedule()` fits. */
99
94
  interface OsScheduleTiming {
100
95
  cron?: string;
@@ -146,8 +141,6 @@ interface OsScheduleUnit {
146
141
  status(): Promise<Result<OsScheduleStatus, OsScheduleErrorCode>>;
147
142
  uninstall(): Promise<Result<OsScheduleRemoval, OsScheduleErrorCode>>;
148
143
  }
149
- //#endregion
150
- //#region src/os.d.ts
151
144
  /**
152
145
  * Installs `schedule` as an OS timer named `name` that runs `options.command`: a systemd timer on Linux, a launchd job
153
146
  * on macOS, or a Task Scheduler task on Windows. It runs on the Schedule's `cron` in its `timeZone`, or fails with a
@@ -162,5 +155,4 @@ export declare function osScheduleStatus(name: string, target?: OsScheduleTarget
162
155
  * A timer of the same name that ViteHub did not install in this scope stays as it is, and `existed` is `false`.
163
156
  */
164
157
  export declare function uninstallOsSchedule(name: string, target?: OsScheduleTarget): Promise<Result<OsScheduleRemoval, OsScheduleErrorCode>>;
165
- //#endregion
166
158
  export type { InstallOsScheduleOptions, OsScheduleErrorCode, OsSchedulePlatform, OsScheduleRemoval, OsScheduleScope, OsScheduleStatus, OsScheduleTarget, OsScheduleTiming, OsScheduleUnit };
package/dist/os.js CHANGED
@@ -1,14 +1,14 @@
1
- import { t as isIanaTimeZone } from "./time-zone-SBldrUgt.js";
2
- import { t as isRecord } from "./object-Da1zyPCR.js";
3
- import { i as timeZoneOffsetMinutes } from "./due-n120-_nz.js";
4
- import { a as parseCronFields, c as timesOfDay, i as isWeekdayRestricted, n as isDayRestricted, o as range, r as isMonthRestricted, s as runsEveryDay, t as arithmeticStep, u as invariantError } from "./cron-C1l3TquN.js";
1
+ import { t as isRecord } from "./object-CAK6UYR5.js";
2
+ import { t as isIanaTimeZone } from "./time-zone-pMp_g8Uu.js";
3
+ import { a as parseCronFields, c as timesOfDay, i as isWeekdayRestricted, n as isDayRestricted, o as range, r as isMonthRestricted, s as runsEveryDay, t as arithmeticStep, u as invariantError } from "./cron-BT3ef48f.js";
4
+ import { i as timeZoneOffsetMinutes } from "./due-D-0trD1g.js";
5
5
  import { defineErrors } from "@vite-hub/runtime";
6
6
  import { homedir, userInfo } from "node:os";
7
7
  import { basename, dirname, join, posix, win32 } from "node:path";
8
8
  import { mkdir, readFile, realpath, rm, rmdir, writeFile } from "node:fs/promises";
9
9
  import { execFile } from "node:child_process";
10
10
  import { createHash } from "node:crypto";
11
- //#region src/os/host.ts
11
+ // src/os/host.ts
12
12
  const generatedHeader = "Generated by ViteHub (@vite-hub/schedule/os). installOsSchedule() replaces this file.";
13
13
  /** Path helpers of the target OS, so a fake Windows host gives Windows paths on Linux. */
14
14
  function pathsFor(platform) {
@@ -111,8 +111,7 @@ function createNodeHost() {
111
111
  }
112
112
  };
113
113
  }
114
- //#endregion
115
- //#region src/os/errors.ts
114
+ // src/os/errors.ts
116
115
  const platformNames = {
117
116
  darwin: "launchd",
118
117
  linux: "systemd",
@@ -163,8 +162,7 @@ const osScheduleErrors = /*#__PURE__*/ defineErrors({
163
162
  }
164
163
  }
165
164
  });
166
- //#endregion
167
- //#region src/os/time-zone.ts
165
+ // src/os/time-zone.ts
168
166
  const minuteMs = 6e4;
169
167
  const dayMs$1 = 1440 * minuteMs;
170
168
  const dayMinutes = 1440;
@@ -285,8 +283,7 @@ function machineFieldsOrError(platform, spec, host) {
285
283
  machineTimeZone: host.machineTimeZone
286
284
  }), void 0];
287
285
  }
288
- //#endregion
289
- //#region src/os/launchd.ts
286
+ // src/os/launchd.ts
290
287
  const intervalKeys = /* @__PURE__ */ new Set([
291
288
  "Minute",
292
289
  "Hour",
@@ -590,8 +587,7 @@ function createLaunchdDriver(host, scope) {
590
587
  }
591
588
  };
592
589
  }
593
- //#endregion
594
- //#region ../internal/src/systemd.ts
590
+ // ../internal/src/systemd.ts
595
591
  /** systemd expands `%` specifiers in every value, and a line break ends the setting. */
596
592
  function systemdValue(value, lineBreak) {
597
593
  if (/[\n\r]/.test(value)) lineBreak();
@@ -606,8 +602,7 @@ function systemdExecArgument(value, lineBreak) {
606
602
  function systemdAssignment(name, value, lineBreak) {
607
603
  return `"${systemdValue(`${name}=${value}`, lineBreak).replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`;
608
604
  }
609
- //#endregion
610
- //#region src/os/systemd.ts
605
+ // src/os/systemd.ts
611
606
  const weekdayNames$1 = [
612
607
  "Sun",
613
608
  "Mon",
@@ -945,8 +940,7 @@ function createSystemdDriver(host, scope) {
945
940
  }
946
941
  };
947
942
  }
948
- //#endregion
949
- //#region src/os/task-scheduler.ts
943
+ // src/os/task-scheduler.ts
950
944
  const maxTriggers = 48;
951
945
  const weekdayNames = [
952
946
  "Sunday",
@@ -1399,8 +1393,7 @@ function createTaskSchedulerDriver(host, scope) {
1399
1393
  }
1400
1394
  };
1401
1395
  }
1402
- //#endregion
1403
- //#region src/os/schedules.ts
1396
+ // src/os/schedules.ts
1404
1397
  const optionKeys = /* @__PURE__ */ new Set([
1405
1398
  "catchUp",
1406
1399
  "command",
@@ -1556,8 +1549,7 @@ function createOsSchedules(host) {
1556
1549
  uninstallOsSchedule
1557
1550
  };
1558
1551
  }
1559
- //#endregion
1560
- //#region src/os.ts
1552
+ // src/os.ts
1561
1553
  let schedules;
1562
1554
  function nodeSchedules() {
1563
1555
  schedules ??= createOsSchedules(createNodeHost());
@@ -1583,5 +1575,4 @@ function osScheduleStatus(name, target) {
1583
1575
  function uninstallOsSchedule(name, target) {
1584
1576
  return nodeSchedules().uninstallOsSchedule(name, target);
1585
1577
  }
1586
- //#endregion
1587
1578
  export { installOsSchedule, osScheduleErrors, osScheduleStatus, uninstallOsSchedule };