@stonyx/cron 0.2.1-alpha.62 → 0.2.1-alpha.64

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 CHANGED
@@ -47,6 +47,24 @@ When a job is executed, its next trigger time is updated, and it is re-inserted
47
47
 
48
48
  > `MinHeap` is also exported as a public subpath (`@stonyx/cron/min-heap`) and can be imported directly for advanced usage.
49
49
 
50
+ ## Exports
51
+
52
+ | Import path | What it exports |
53
+ | :--- | :--- |
54
+ | `@stonyx/cron` | `Cron` (default), the interval registry above |
55
+ | `@stonyx/cron/service` | `CronService` (default), see [CronService](#cronservice) |
56
+ | `@stonyx/cron/schedule` | `computeNextRunAtMs`, `validateSchedule`, and the `Schedule` types |
57
+ | `@stonyx/cron/cron-parser` | `parseCronExpression`, `parseField`, `nextOccurrence`, `validateCronExpression` |
58
+ | `@stonyx/cron/job` | `createJob`, `updateJob`, `applyResult`, `isDue`, `markRunning`, `errorBackoffMs`, and the `Job` types |
59
+ | `@stonyx/cron/normalize` | `normalizeJobInput`, `normalizeSchedule`, `normalizePayload`, `recoverFlatParams` |
60
+ | `@stonyx/cron/run-log` | `RunLog` (default) |
61
+ | `@stonyx/cron/locked` | `locked`, `resetLock` |
62
+ | `@stonyx/cron/min-heap` | `MinHeap` (default) |
63
+
64
+ ## Samples
65
+
66
+ [`test/sample/`](https://github.com/abofs/stonyx-cron/tree/dev/test/sample) is the canonical usage reference for job definitions: legacy `Cron` intervals and every `CronService` schedule kind. It is not included in the npm package.
67
+
50
68
  ## CronService
51
69
 
52
70
  The default export above is `Cron`: a fire-and-forget interval registry. `@stonyx/cron/service` is a separate, heavier class for jobs that need CRUD, persistence, a run log and error backoff. It is not a drop-in replacement and the two do not share a scheduler.
@@ -97,9 +115,12 @@ Tracked as #35.
97
115
  Five consumer-visible changes landed with the phase split (#34). Only the first
98
116
  two are visible in the emitted `dist/service.d.ts`; the rest are runtime
99
117
  behaviour and a type-checker will not find them for you. The measured
100
- `dist/service.d.ts` delta against the previous release is exactly three things:
101
- the class gained `#private;`, `reason` narrowed, and six type declarations
102
- gained `export`. `dist/main.d.ts` is unchanged.
118
+ `dist/service.d.ts` delta against the previous release is exactly four things:
119
+ the class gained `#private;`, `reason` narrowed, five type declarations gained
120
+ `export` (`JobDueResult`, `ExecuteResult`, `ServiceStatus`, `ListOptions` and
121
+ `OnJobDueCallback`), and `SkipReason` was added as a new exported type — it did
122
+ not exist in the previous release, so it gained nothing. `HeapEntry` remains
123
+ unexported. `dist/main.d.ts` is unchanged.
103
124
 
104
125
  1. **`ExecuteResult.reason` narrowed** from `string` to `'not due' | 'already running' | 'removed'`, and gained the `'removed'` member. Comparing it against a literal outside the union, or `switch`ing on one, is now a compile error (`TS2367` / `TS2678`). Assigning it into `string | undefined` and spreading it are unaffected. The type is exported as `SkipReason`.
105
126
  2. **`CronService` is nominally typed.** It carries ECMAScript hard-private members, so the declarations emit `#private;` and a structurally hand-built test double no longer assigns to `CronService` (`TS2741: Property '#private' is missing`). The break is one-directional: `class X extends CronService` still compiles, and assigning a real `CronService` to your own hand-written interface still compiles. **Migration:** declare your own interface and depend on that instead of a `CronService`-typed mock.
package/dist/main.js CHANGED
@@ -41,8 +41,8 @@ const MAX_LOGGED_ERROR_LENGTH = 512;
41
41
  * `describeError` directly below (`:82`, `:85`), and both are INSIDE that
42
42
  * function's own `try`, so a `TypeError` from `value.replace` on a
43
43
  * non-string degrades to `'<thrown value could not be rendered>'` and the log
44
- * record is still produced. `service.ts`'s callers are not so contained: `:692`
45
- * sits in a bare `catch` with nothing above it, and `:571`'s enclosing `catch`
44
+ * record is still produced. `service.ts`'s callers are not so contained: `:700`
45
+ * sits in a bare `catch` with nothing above it, and `:579`'s enclosing `catch`
46
46
  * has nothing left to report to — so a throw there destroyed the failure
47
47
  * record outright (measured: 0 records for a job that failed). That is why
48
48
  * totality was a live defect there and is not one here.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "keywords": [
4
4
  "stonyx-module"
5
5
  ],
6
- "version": "0.2.1-alpha.62",
6
+ "version": "0.2.1-alpha.64",
7
7
  "description": "Cron/job scheduler for Stonyx framework",
8
8
  "main": "dist/main.js",
9
9
  "types": "dist/main.d.ts",
@@ -79,7 +79,7 @@
79
79
  "typescript": "^5.8.3"
80
80
  },
81
81
  "dependencies": {
82
- "stonyx": "0.2.3-beta.93"
82
+ "stonyx": "0.2.3-beta.98"
83
83
  },
84
84
  "scripts": {
85
85
  "build": "tsc",