@enshou/cron 0.0.5 → 0.0.6
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/index.mjs +4 -4
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { token } from "@enshou/di";
|
|
2
2
|
//#region ../../shared/src/polyfill.ts
|
|
3
3
|
if (!Symbol.metadata) Symbol.metadata = Symbol.for("Symbol.metadata");
|
|
4
4
|
//#endregion
|
|
@@ -24,9 +24,9 @@ function Cron(pattern) {
|
|
|
24
24
|
function CronPlugin({ jobs }) {
|
|
25
25
|
return { onApplicationInit: async ({ options: { container } }) => {
|
|
26
26
|
for (const job of jobs) {
|
|
27
|
-
const
|
|
28
|
-
container.registerClass(
|
|
29
|
-
const instance = await container.resolveAsync(
|
|
27
|
+
const jobToken = token(job.name);
|
|
28
|
+
container.registerClass(jobToken, job);
|
|
29
|
+
const instance = await container.resolveAsync(jobToken);
|
|
30
30
|
const metadata = asCronMetadata(instance[Symbol.metadata]);
|
|
31
31
|
for (const [methodName, cronPattern] of metadata.jobs) {
|
|
32
32
|
const handler = instance[methodName].bind(instance);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enshou/cron",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Ivan Popov <iiivanpopov999@gmail.com>",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"@types/bun": "^1.3.14",
|
|
25
25
|
"tsdown": "^0.22.3",
|
|
26
26
|
"typescript": "^6.0.2",
|
|
27
|
-
"@enshou/core": "0.12.
|
|
28
|
-
"@enshou/di": "0.8.
|
|
27
|
+
"@enshou/core": "0.12.8",
|
|
28
|
+
"@enshou/di": "0.8.8"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@enshou/
|
|
32
|
-
"@enshou/
|
|
31
|
+
"@enshou/core": "0.12.8",
|
|
32
|
+
"@enshou/di": "0.8.8"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsdown"
|