@uns-kit/cron 2.0.19 → 2.0.22
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/LICENSE +21 -21
- package/README.md +77 -77
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Aljoša Vister
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Aljoša Vister
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
# @uns-kit/cron
|
|
2
|
-
|
|
3
|
-
`@uns-kit/cron` adds cron-style scheduling to the UNS runtime. It registers a `createCrontabProxy` method on `UnsProxyProcess`, emitting `cronEvent` notifications that can be bridged to MQTT topics or any downstream integration.
|
|
4
|
-
|
|
5
|
-
Note: Apps built with uns-kit are intended to be managed by the **UNS Datahub controller**.
|
|
6
|
-
|
|
7
|
-
## uns-kit in context
|
|
8
|
-
|
|
9
|
-
uns-kit is a batteries-included toolkit for Unified Namespace applications. It standardizes MQTT wiring, auth, config schemas, and scaffolding so you can focus on scheduled behaviors and domain logic. The toolkit includes:
|
|
10
|
-
|
|
11
|
-
| Package | Description |
|
|
12
|
-
| --- | --- |
|
|
13
|
-
| [`@uns-kit/core`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-core) | Base runtime utilities (UnsProxyProcess, MQTT helpers, configuration tooling, gRPC gateway support). |
|
|
14
|
-
| [`@uns-kit/api`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-api) | Express plugin that exposes HTTP endpoints, handles JWT/JWKS auth, and republishes API metadata to UNS. |
|
|
15
|
-
| [`@uns-kit/cron`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
|
|
16
|
-
| [`@uns-kit/temporal`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-temporal) | Temporal.io integration that wires workflows into UnsProxyProcess. |
|
|
17
|
-
| [`@uns-kit/cli`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cli) | Command line tool for scaffolding new UNS applications. |
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pnpm add @uns-kit/cron
|
|
23
|
-
# or
|
|
24
|
-
npm install @uns-kit/cron
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
You will also need `@uns-kit/core` in your project because the plugin augments `UnsProxyProcess`.
|
|
28
|
-
|
|
29
|
-
## Quick Start
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
import UnsProxyProcess from "@uns-kit/core/uns/uns-proxy-process";
|
|
33
|
-
import type { UnsProxyProcessWithCron } from "@uns-kit/cron";
|
|
34
|
-
import "@uns-kit/cron";
|
|
35
|
-
|
|
36
|
-
async function main() {
|
|
37
|
-
const process = new UnsProxyProcess("mqtt-broker:1883", { processName: "cron-demo" }) as UnsProxyProcessWithCron;
|
|
38
|
-
|
|
39
|
-
const cronProxy = await process.createCrontabProxy("*/5 * * * *", { event: "heartbeat" });
|
|
40
|
-
cronProxy.event.on("cronEvent", ({ event, cronExpression }) => {
|
|
41
|
-
console.log("tick", event, cronExpression);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
void main();
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Multiple schedules
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
const cronProxy = await process.createCrontabProxy([
|
|
52
|
-
{ cronExpression: "* * * * * *", event: "a" },
|
|
53
|
-
{ cronExpression: "*/10 * * * * *", event: "b" },
|
|
54
|
-
]);
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
You can also pass an array of cron strings and optional default options:
|
|
58
|
-
|
|
59
|
-
```ts
|
|
60
|
-
const cronProxy = await process.createCrontabProxy(
|
|
61
|
-
["*/5 * * * *", "*/15 * * * *"],
|
|
62
|
-
{ timezone: "UTC" },
|
|
63
|
-
);
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Scripts
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
pnpm run typecheck
|
|
70
|
-
pnpm run build
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
`build` emits ESM JavaScript and type declarations into `dist/`.
|
|
74
|
-
|
|
75
|
-
## License
|
|
76
|
-
|
|
77
|
-
MIT © Aljoša Vister
|
|
1
|
+
# @uns-kit/cron
|
|
2
|
+
|
|
3
|
+
`@uns-kit/cron` adds cron-style scheduling to the UNS runtime. It registers a `createCrontabProxy` method on `UnsProxyProcess`, emitting `cronEvent` notifications that can be bridged to MQTT topics or any downstream integration.
|
|
4
|
+
|
|
5
|
+
Note: Apps built with uns-kit are intended to be managed by the **UNS Datahub controller**.
|
|
6
|
+
|
|
7
|
+
## uns-kit in context
|
|
8
|
+
|
|
9
|
+
uns-kit is a batteries-included toolkit for Unified Namespace applications. It standardizes MQTT wiring, auth, config schemas, and scaffolding so you can focus on scheduled behaviors and domain logic. The toolkit includes:
|
|
10
|
+
|
|
11
|
+
| Package | Description |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| [`@uns-kit/core`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-core) | Base runtime utilities (UnsProxyProcess, MQTT helpers, configuration tooling, gRPC gateway support). |
|
|
14
|
+
| [`@uns-kit/api`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-api) | Express plugin that exposes HTTP endpoints, handles JWT/JWKS auth, and republishes API metadata to UNS. |
|
|
15
|
+
| [`@uns-kit/cron`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
|
|
16
|
+
| [`@uns-kit/temporal`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-temporal) | Temporal.io integration that wires workflows into UnsProxyProcess. |
|
|
17
|
+
| [`@uns-kit/cli`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cli) | Command line tool for scaffolding new UNS applications. |
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add @uns-kit/cron
|
|
23
|
+
# or
|
|
24
|
+
npm install @uns-kit/cron
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You will also need `@uns-kit/core` in your project because the plugin augments `UnsProxyProcess`.
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import UnsProxyProcess from "@uns-kit/core/uns/uns-proxy-process";
|
|
33
|
+
import type { UnsProxyProcessWithCron } from "@uns-kit/cron";
|
|
34
|
+
import "@uns-kit/cron";
|
|
35
|
+
|
|
36
|
+
async function main() {
|
|
37
|
+
const process = new UnsProxyProcess("mqtt-broker:1883", { processName: "cron-demo" }) as UnsProxyProcessWithCron;
|
|
38
|
+
|
|
39
|
+
const cronProxy = await process.createCrontabProxy("*/5 * * * *", { event: "heartbeat" });
|
|
40
|
+
cronProxy.event.on("cronEvent", ({ event, cronExpression }) => {
|
|
41
|
+
console.log("tick", event, cronExpression);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void main();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Multiple schedules
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const cronProxy = await process.createCrontabProxy([
|
|
52
|
+
{ cronExpression: "* * * * * *", event: "a" },
|
|
53
|
+
{ cronExpression: "*/10 * * * * *", event: "b" },
|
|
54
|
+
]);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
You can also pass an array of cron strings and optional default options:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
const cronProxy = await process.createCrontabProxy(
|
|
61
|
+
["*/5 * * * *", "*/15 * * * *"],
|
|
62
|
+
{ timezone: "UTC" },
|
|
63
|
+
);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Scripts
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm run typecheck
|
|
70
|
+
pnpm run build
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`build` emits ESM JavaScript and type declarations into `dist/`.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT © Aljoša Vister
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cron",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.22",
|
|
4
4
|
"description": "Cron-driven plugin for UnsProxyProcess that emits UNS events on a schedule.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"types": "dist/index.d.ts",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"node-cron": "^4.2.1",
|
|
35
|
-
"@uns-kit/core": "2.0.
|
|
35
|
+
"@uns-kit/core": "2.0.22"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsc -p tsconfig.build.json",
|