@nwire/cron 0.10.0 → 0.11.0
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/dist/cron.d.ts +3 -3
- package/dist/cron.js +3 -2
- package/package.json +4 -3
package/dist/cron.d.ts
CHANGED
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
* deployments run cron in ONE process.
|
|
8
8
|
*/
|
|
9
9
|
import { Cron } from "croner";
|
|
10
|
-
import type {
|
|
10
|
+
import type { App } from "@nwire/app";
|
|
11
11
|
export type CronScheduleEntry = string | {
|
|
12
12
|
readonly action: string;
|
|
13
13
|
readonly input?: unknown;
|
|
14
14
|
readonly tenant?: string;
|
|
15
15
|
};
|
|
16
16
|
export interface CronWireOptions {
|
|
17
|
-
readonly apps: readonly
|
|
17
|
+
readonly apps: readonly App[];
|
|
18
18
|
readonly schedule: Readonly<Record<string, CronScheduleEntry>>;
|
|
19
19
|
readonly timezone?: string;
|
|
20
20
|
}
|
|
21
21
|
export interface CronWire {
|
|
22
|
-
readonly apps: readonly
|
|
22
|
+
readonly apps: readonly App[];
|
|
23
23
|
readonly schedules: readonly Cron[];
|
|
24
24
|
start(): Promise<void>;
|
|
25
25
|
stop(): Promise<void>;
|
package/dist/cron.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* deployments run cron in ONE process.
|
|
8
8
|
*/
|
|
9
9
|
import { Cron } from "croner";
|
|
10
|
+
import { forgeDispatcher } from "@nwire/forge";
|
|
10
11
|
import { seedEnvelope } from "@nwire/envelope";
|
|
11
12
|
export function createCronWire(options) {
|
|
12
13
|
const instances = options.apps;
|
|
@@ -25,7 +26,7 @@ export function createCronWire(options) {
|
|
|
25
26
|
const { owner, action } = located;
|
|
26
27
|
const cron = new Cron(expr, { timezone: options.timezone, protect: true }, async () => {
|
|
27
28
|
const envelope = seedEnvelope({ tenant: spec.tenant });
|
|
28
|
-
await owner.dispatch(action, spec.input ?? {}, envelope);
|
|
29
|
+
await forgeDispatcher(owner).dispatch(action, spec.input ?? {}, envelope);
|
|
29
30
|
});
|
|
30
31
|
schedules.push(cron);
|
|
31
32
|
}
|
|
@@ -40,7 +41,7 @@ export function createCronWire(options) {
|
|
|
40
41
|
}
|
|
41
42
|
function locateAction(apps, name) {
|
|
42
43
|
for (const app of apps) {
|
|
43
|
-
const action = app
|
|
44
|
+
const action = forgeDispatcher(app).findActionByName(name);
|
|
44
45
|
if (action)
|
|
45
46
|
return { owner: app, action };
|
|
46
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nwire/cron",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Nwire — cron interface factory. Dispatch actions on a schedule (croner-backed).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cron",
|
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"croner": "^9.1.0",
|
|
32
|
-
"@nwire/
|
|
33
|
-
"@nwire/
|
|
32
|
+
"@nwire/envelope": "0.11.0",
|
|
33
|
+
"@nwire/app": "0.11.0",
|
|
34
|
+
"@nwire/forge": "0.11.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/node": "^22.19.9",
|