@eggjs/schedule-plugin 4.0.2-beta.1 → 4.0.2-beta.2
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PrototypeUtil } from "@eggjs/core-decorator";
|
|
2
|
+
import { importResolve } from "@eggjs/utils";
|
|
2
3
|
|
|
3
4
|
//#region src/lib/ScheduleManager.ts
|
|
4
5
|
/**
|
|
@@ -22,7 +23,7 @@ var ScheduleManager = class {
|
|
|
22
23
|
* Unregister a single schedule by prototype
|
|
23
24
|
*/
|
|
24
25
|
unregister(proto) {
|
|
25
|
-
const key = proto.getMetaData(PrototypeUtil.FILE_PATH);
|
|
26
|
+
const key = importResolve(proto.getMetaData(PrototypeUtil.FILE_PATH));
|
|
26
27
|
if (this.registeredSchedules.has(key)) {
|
|
27
28
|
this.app.scheduleWorker.unregisterSchedule(key);
|
|
28
29
|
this.registeredSchedules.delete(key);
|
|
@@ -3,6 +3,7 @@ import { eggScheduleAdapterFactory } from "./EggScheduleAdapter.js";
|
|
|
3
3
|
import { ScheduleMetadata } from "@eggjs/schedule-decorator";
|
|
4
4
|
import { debuglog } from "node:util";
|
|
5
5
|
import { PrototypeUtil } from "@eggjs/core-decorator";
|
|
6
|
+
import { importResolve } from "@eggjs/utils";
|
|
6
7
|
|
|
7
8
|
//#region src/lib/ScheduleWorkerRegister.ts
|
|
8
9
|
const debug = debuglog("egg/tegg/plugin/schedule/ScheduleWorkerRegister");
|
|
@@ -14,14 +15,15 @@ var ScheduleWorkerRegister = class {
|
|
|
14
15
|
register(proto, metadata) {
|
|
15
16
|
const task = eggScheduleAdapterFactory(proto, metadata);
|
|
16
17
|
const schedule = EggScheduleMetadataConvertor.convertToEggSchedule(metadata);
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
18
|
+
const rawKey = proto.getMetaData(PrototypeUtil.FILE_PATH);
|
|
19
|
+
if (!rawKey) throw new Error(`schedule prototype: ${proto.name} missing FILE_PATH metadata`);
|
|
20
|
+
const key = importResolve(rawKey);
|
|
19
21
|
this.scheduleManager.register(proto, {
|
|
20
22
|
schedule,
|
|
21
23
|
task,
|
|
22
24
|
key
|
|
23
25
|
});
|
|
24
|
-
debug("register schedule %s, config: %j", key, schedule);
|
|
26
|
+
debug("register schedule %s (raw: %s), config: %j", key, rawKey, schedule);
|
|
25
27
|
}
|
|
26
28
|
};
|
|
27
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/schedule-plugin",
|
|
3
|
-
"version": "4.0.2-beta.
|
|
3
|
+
"version": "4.0.2-beta.2",
|
|
4
4
|
"description": "schedule decorator plugin for egg",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"egg",
|
|
@@ -44,28 +44,29 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@eggjs/core-decorator": "4.0.2-beta.
|
|
48
|
-
"@eggjs/lifecycle": "4.0.2-beta.
|
|
49
|
-
"@eggjs/
|
|
50
|
-
"@eggjs/
|
|
51
|
-
"@eggjs/
|
|
52
|
-
"@eggjs/tegg-loader": "4.0.2-beta.
|
|
53
|
-
"@eggjs/tegg-runtime": "4.0.2-beta.
|
|
47
|
+
"@eggjs/core-decorator": "4.0.2-beta.2",
|
|
48
|
+
"@eggjs/lifecycle": "4.0.2-beta.2",
|
|
49
|
+
"@eggjs/metadata": "4.0.2-beta.2",
|
|
50
|
+
"@eggjs/module-common": "4.0.2-beta.2",
|
|
51
|
+
"@eggjs/schedule-decorator": "4.0.2-beta.2",
|
|
52
|
+
"@eggjs/tegg-loader": "4.0.2-beta.2",
|
|
53
|
+
"@eggjs/tegg-runtime": "4.0.2-beta.2",
|
|
54
|
+
"@eggjs/utils": "5.0.2-beta.2"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@types/node": "^24.10.2",
|
|
57
58
|
"typescript": "^5.9.3",
|
|
59
|
+
"@eggjs/mock": "7.0.2-beta.2",
|
|
58
60
|
"@eggjs/module-test-util": "4.0.0-beta.29",
|
|
59
|
-
"@eggjs/
|
|
60
|
-
"@eggjs/tegg": "4.0.2-beta.
|
|
61
|
-
"@eggjs/tegg-
|
|
62
|
-
"@eggjs/tegg-
|
|
63
|
-
"
|
|
64
|
-
"egg": "4.1.2-beta.1"
|
|
61
|
+
"@eggjs/tegg": "4.0.2-beta.2",
|
|
62
|
+
"@eggjs/tegg-common-util": "4.0.2-beta.2",
|
|
63
|
+
"@eggjs/tegg-config": "4.0.2-beta.2",
|
|
64
|
+
"@eggjs/tegg-plugin": "4.0.2-beta.2",
|
|
65
|
+
"egg": "4.1.2-beta.2"
|
|
65
66
|
},
|
|
66
67
|
"peerDependencies": {
|
|
67
|
-
"@eggjs/tegg-plugin": "4.0.2-beta.
|
|
68
|
-
"egg": "4.1.2-beta.
|
|
68
|
+
"@eggjs/tegg-plugin": "4.0.2-beta.2",
|
|
69
|
+
"egg": "4.1.2-beta.2"
|
|
69
70
|
},
|
|
70
71
|
"engines": {
|
|
71
72
|
"node": ">=22.18.0"
|