@eggjs/schedule-decorator 4.0.0-beta.35 → 4.0.0-beta.36
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/builder/ScheduleMetaBuilder.d.ts +11 -6
- package/dist/builder/ScheduleMetaBuilder.js +24 -21
- package/dist/builder/index.d.ts +1 -1
- package/dist/builder/index.js +3 -2
- package/dist/decorator/Schedule.d.ts +6 -2
- package/dist/decorator/Schedule.js +21 -19
- package/dist/decorator/index.d.ts +1 -1
- package/dist/decorator/index.js +3 -2
- package/dist/index.d.ts +11 -5
- package/dist/index.js +12 -6
- package/dist/model/ScheduleMetadata.d.ts +13 -9
- package/dist/model/ScheduleMetadata.js +22 -20
- package/dist/model/index.d.ts +1 -1
- package/dist/util/ScheduleInfoUtil.d.ts +12 -8
- package/dist/util/ScheduleInfoUtil.js +27 -23
- package/dist/util/ScheduleMetadataUtil.d.ts +10 -5
- package/dist/util/ScheduleMetadataUtil.js +15 -12
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.js +4 -3
- package/package.json +26 -30
- package/dist/model/index.js +0 -2
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ScheduleMetadata } from "../model/ScheduleMetadata.js";
|
|
2
|
+
import "../model/index.js";
|
|
3
|
+
import { EggProtoImplClass } from "@eggjs/tegg-types";
|
|
4
|
+
|
|
5
|
+
//#region src/builder/ScheduleMetaBuilder.d.ts
|
|
6
|
+
declare class ScheduleMetaBuilder {
|
|
7
|
+
private readonly clazz;
|
|
8
|
+
constructor(clazz: EggProtoImplClass);
|
|
9
|
+
build(): ScheduleMetadata<object>;
|
|
7
10
|
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ScheduleMetaBuilder };
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { ScheduleMetadata } from "../model/
|
|
2
|
-
import { ScheduleInfoUtil } from "../util/
|
|
1
|
+
import { ScheduleMetadata } from "../model/ScheduleMetadata.js";
|
|
2
|
+
import { ScheduleInfoUtil } from "../util/ScheduleInfoUtil.js";
|
|
3
|
+
import "../util/index.js";
|
|
4
|
+
|
|
5
|
+
//#region src/builder/ScheduleMetaBuilder.ts
|
|
3
6
|
const DEFAULT_SCHEDULE_OPTIONS = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
immediate: false,
|
|
8
|
+
disable: false,
|
|
9
|
+
env: void 0
|
|
7
10
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
var ScheduleMetaBuilder = class {
|
|
12
|
+
clazz;
|
|
13
|
+
constructor(clazz) {
|
|
14
|
+
this.clazz = clazz;
|
|
15
|
+
}
|
|
16
|
+
build() {
|
|
17
|
+
const params = ScheduleInfoUtil.getScheduleParams(this.clazz);
|
|
18
|
+
if (!params) throw new Error(`class ${this.clazz.name} is not a schedule`);
|
|
19
|
+
const options = ScheduleInfoUtil.getScheduleOptions(this.clazz);
|
|
20
|
+
const scheduleOptions = Object.assign({}, DEFAULT_SCHEDULE_OPTIONS, options);
|
|
21
|
+
return new ScheduleMetadata(params.type, params.scheduleData, scheduleOptions.immediate, scheduleOptions.disable, scheduleOptions.env);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { ScheduleMetaBuilder };
|
package/dist/builder/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { ScheduleMetaBuilder } from "./ScheduleMetaBuilder.js";
|
package/dist/builder/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ScheduleMetaBuilder } from "./ScheduleMetaBuilder.js";
|
|
2
|
+
|
|
3
|
+
export { };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { EggProtoImplClass, ScheduleOptions, ScheduleParams, ScheduleSubscriber } from "@eggjs/tegg-types";
|
|
2
|
+
|
|
3
|
+
//#region src/decorator/Schedule.d.ts
|
|
4
|
+
declare function Schedule<T>(param: ScheduleParams<T>, options?: ScheduleOptions): (clazz: EggProtoImplClass<ScheduleSubscriber>) => void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Schedule };
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { ScheduleInfoUtil } from "../util/ScheduleInfoUtil.js";
|
|
2
|
+
import "../util/index.js";
|
|
3
|
+
import { PrototypeUtil, SingletonProto } from "@eggjs/core-decorator";
|
|
4
|
+
import { AccessLevel } from "@eggjs/tegg-types";
|
|
5
|
+
import { StackUtil } from "@eggjs/tegg-common-util";
|
|
6
|
+
|
|
7
|
+
//#region src/decorator/Schedule.ts
|
|
8
|
+
function Schedule(param, options) {
|
|
9
|
+
return function(clazz) {
|
|
10
|
+
ScheduleInfoUtil.setIsSchedule(true, clazz);
|
|
11
|
+
ScheduleInfoUtil.setScheduleParams(param, clazz);
|
|
12
|
+
if (options) ScheduleInfoUtil.setScheduleOptions(options, clazz);
|
|
13
|
+
SingletonProto({
|
|
14
|
+
name: clazz.name,
|
|
15
|
+
accessLevel: AccessLevel.PUBLIC
|
|
16
|
+
})(clazz);
|
|
17
|
+
PrototypeUtil.setFilePath(clazz, StackUtil.getCalleeFromStack(false, 5));
|
|
18
|
+
};
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Schedule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { Schedule } from "./Schedule.js";
|
package/dist/decorator/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Schedule } from "./Schedule.js";
|
|
2
|
+
|
|
3
|
+
export { };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ScheduleMetadata } from "./model/ScheduleMetadata.js";
|
|
2
|
+
import "./model/index.js";
|
|
3
|
+
import { ScheduleMetaBuilder } from "./builder/ScheduleMetaBuilder.js";
|
|
4
|
+
import "./builder/index.js";
|
|
5
|
+
import { Schedule } from "./decorator/Schedule.js";
|
|
6
|
+
import "./decorator/index.js";
|
|
7
|
+
import { ScheduleInfoUtil } from "./util/ScheduleInfoUtil.js";
|
|
8
|
+
import { ScheduleMetadataUtil } from "./util/ScheduleMetadataUtil.js";
|
|
9
|
+
import "./util/index.js";
|
|
10
|
+
export * from "@eggjs/tegg-types/schedule";
|
|
11
|
+
export { Schedule, ScheduleInfoUtil, ScheduleMetaBuilder, ScheduleMetadata, ScheduleMetadataUtil };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ScheduleMetadata } from "./model/ScheduleMetadata.js";
|
|
2
|
+
import { ScheduleInfoUtil } from "./util/ScheduleInfoUtil.js";
|
|
3
|
+
import { ScheduleMetadataUtil } from "./util/ScheduleMetadataUtil.js";
|
|
4
|
+
import "./util/index.js";
|
|
5
|
+
import { ScheduleMetaBuilder } from "./builder/ScheduleMetaBuilder.js";
|
|
6
|
+
import "./builder/index.js";
|
|
7
|
+
import { Schedule } from "./decorator/Schedule.js";
|
|
8
|
+
import "./decorator/index.js";
|
|
9
|
+
|
|
10
|
+
export * from "@eggjs/tegg-types/schedule"
|
|
11
|
+
|
|
12
|
+
export { Schedule, ScheduleInfoUtil, ScheduleMetaBuilder, ScheduleMetadata, ScheduleMetadataUtil };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { ScheduleTypeLike } from "@eggjs/tegg-types";
|
|
2
|
+
|
|
3
|
+
//#region src/model/ScheduleMetadata.d.ts
|
|
4
|
+
declare class ScheduleMetadata<T> {
|
|
5
|
+
type: ScheduleTypeLike;
|
|
6
|
+
scheduleData: T;
|
|
7
|
+
immediate: boolean;
|
|
8
|
+
disable: boolean;
|
|
9
|
+
env?: string[];
|
|
10
|
+
constructor(type: ScheduleTypeLike, data: T, immediate: boolean, disable: boolean, env?: string[]);
|
|
11
|
+
shouldRegister(env: string): boolean;
|
|
10
12
|
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ScheduleMetadata };
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
1
|
+
//#region src/model/ScheduleMetadata.ts
|
|
2
|
+
var ScheduleMetadata = class {
|
|
3
|
+
type;
|
|
4
|
+
scheduleData;
|
|
5
|
+
immediate;
|
|
6
|
+
disable;
|
|
7
|
+
env;
|
|
8
|
+
constructor(type, data, immediate, disable, env) {
|
|
9
|
+
this.type = type;
|
|
10
|
+
this.scheduleData = data;
|
|
11
|
+
this.immediate = immediate;
|
|
12
|
+
this.disable = disable;
|
|
13
|
+
this.env = env;
|
|
14
|
+
}
|
|
15
|
+
shouldRegister(env) {
|
|
16
|
+
if (!this.env) return true;
|
|
17
|
+
return this.env.includes(env);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ScheduleMetadata };
|
package/dist/model/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { ScheduleMetadata } from "./ScheduleMetadata.js";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { EggProtoImplClass, ScheduleOptions, ScheduleParams } from "@eggjs/tegg-types";
|
|
2
|
+
|
|
3
|
+
//#region src/util/ScheduleInfoUtil.d.ts
|
|
4
|
+
declare class ScheduleInfoUtil {
|
|
5
|
+
static isSchedule(clazz: EggProtoImplClass): boolean;
|
|
6
|
+
static setIsSchedule(isSchedule: boolean, clazz: EggProtoImplClass): void;
|
|
7
|
+
static setScheduleParams<T>(scheduleParams: ScheduleParams<T>, clazz: EggProtoImplClass): void;
|
|
8
|
+
static setScheduleOptions(scheduleParams: ScheduleOptions, clazz: EggProtoImplClass): void;
|
|
9
|
+
static getScheduleOptions(clazz: EggProtoImplClass): ScheduleOptions | undefined;
|
|
10
|
+
static getScheduleParams(clazz: EggProtoImplClass): ScheduleParams<object> | undefined;
|
|
9
11
|
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ScheduleInfoUtil };
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { MetadataUtil } from
|
|
2
|
-
import { IS_SCHEDULE,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { MetadataUtil } from "@eggjs/core-decorator";
|
|
2
|
+
import { IS_SCHEDULE, SCHEDULE_OPTIONS, SCHEDULE_PARAMS } from "@eggjs/tegg-types";
|
|
3
|
+
|
|
4
|
+
//#region src/util/ScheduleInfoUtil.ts
|
|
5
|
+
var ScheduleInfoUtil = class {
|
|
6
|
+
static isSchedule(clazz) {
|
|
7
|
+
return MetadataUtil.getBooleanMetaData(IS_SCHEDULE, clazz);
|
|
8
|
+
}
|
|
9
|
+
static setIsSchedule(isSchedule, clazz) {
|
|
10
|
+
MetadataUtil.defineMetaData(IS_SCHEDULE, isSchedule, clazz);
|
|
11
|
+
}
|
|
12
|
+
static setScheduleParams(scheduleParams, clazz) {
|
|
13
|
+
MetadataUtil.defineMetaData(SCHEDULE_PARAMS, scheduleParams, clazz);
|
|
14
|
+
}
|
|
15
|
+
static setScheduleOptions(scheduleParams, clazz) {
|
|
16
|
+
MetadataUtil.defineMetaData(SCHEDULE_OPTIONS, scheduleParams, clazz);
|
|
17
|
+
}
|
|
18
|
+
static getScheduleOptions(clazz) {
|
|
19
|
+
return MetadataUtil.getMetaData(SCHEDULE_OPTIONS, clazz);
|
|
20
|
+
}
|
|
21
|
+
static getScheduleParams(clazz) {
|
|
22
|
+
return MetadataUtil.getMetaData(SCHEDULE_PARAMS, clazz);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ScheduleInfoUtil };
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ScheduleMetadata } from "../model/ScheduleMetadata.js";
|
|
2
|
+
import "../model/index.js";
|
|
3
|
+
import { EggProtoImplClass } from "@eggjs/tegg-types";
|
|
4
|
+
|
|
5
|
+
//#region src/util/ScheduleMetadataUtil.d.ts
|
|
6
|
+
declare class ScheduleMetadataUtil {
|
|
7
|
+
static setScheduleMetadata(clazz: EggProtoImplClass, metaData: ScheduleMetadata<object>): void;
|
|
8
|
+
static getScheduleMetadata(clazz: EggProtoImplClass): ScheduleMetadata<object> | undefined;
|
|
6
9
|
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ScheduleMetadataUtil };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { MetadataUtil } from
|
|
2
|
-
import { SCHEDULE_METADATA } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
1
|
+
import { MetadataUtil } from "@eggjs/core-decorator";
|
|
2
|
+
import { SCHEDULE_METADATA } from "@eggjs/tegg-types";
|
|
3
|
+
|
|
4
|
+
//#region src/util/ScheduleMetadataUtil.ts
|
|
5
|
+
var ScheduleMetadataUtil = class {
|
|
6
|
+
static setScheduleMetadata(clazz, metaData) {
|
|
7
|
+
MetadataUtil.defineMetaData(SCHEDULE_METADATA, metaData, clazz);
|
|
8
|
+
}
|
|
9
|
+
static getScheduleMetadata(clazz) {
|
|
10
|
+
return MetadataUtil.getMetaData(SCHEDULE_METADATA, clazz);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { ScheduleMetadataUtil };
|
package/dist/util/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ScheduleInfoUtil } from "./ScheduleInfoUtil.js";
|
|
2
|
+
import { ScheduleMetadataUtil } from "./ScheduleMetadataUtil.js";
|
package/dist/util/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ScheduleInfoUtil } from "./ScheduleInfoUtil.js";
|
|
2
|
+
import { ScheduleMetadataUtil } from "./ScheduleMetadataUtil.js";
|
|
3
|
+
|
|
4
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,55 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/schedule-decorator",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.36",
|
|
4
4
|
"description": "tegg schedule decorator",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": "./dist/index.js",
|
|
8
|
-
"./package.json": "./package.json"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
],
|
|
13
5
|
"keywords": [
|
|
14
6
|
"egg",
|
|
15
|
-
"typescript",
|
|
16
7
|
"runtime",
|
|
17
|
-
"tegg"
|
|
8
|
+
"tegg",
|
|
9
|
+
"typescript"
|
|
18
10
|
],
|
|
19
|
-
"author": "killagu <killa123@126.com>",
|
|
20
|
-
"license": "MIT",
|
|
21
11
|
"homepage": "https://github.com/eggjs/egg/tree/next/tegg/core/schedule-decorator",
|
|
22
12
|
"bugs": {
|
|
23
13
|
"url": "https://github.com/eggjs/egg/issues"
|
|
24
14
|
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "killagu <killa123@126.com>",
|
|
25
17
|
"repository": {
|
|
26
18
|
"type": "git",
|
|
27
19
|
"url": "git+https://github.com/eggjs/egg.git",
|
|
28
20
|
"directory": "tegg/core/schedule-decorator"
|
|
29
21
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"module": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": "./dist/index.js",
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
32
35
|
},
|
|
33
36
|
"dependencies": {
|
|
34
|
-
"@eggjs/
|
|
35
|
-
"@eggjs/
|
|
36
|
-
"@eggjs/tegg-
|
|
37
|
+
"@eggjs/core-decorator": "4.0.0-beta.36",
|
|
38
|
+
"@eggjs/tegg-common-util": "4.0.0-beta.36",
|
|
39
|
+
"@eggjs/tegg-types": "4.0.0-beta.36"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^24.10.
|
|
40
|
-
"typescript": "^5.9.3"
|
|
41
|
-
"tsdown": "^0.17.0",
|
|
42
|
-
"unplugin-unused": "^0.5.4"
|
|
42
|
+
"@types/node": "^24.10.2",
|
|
43
|
+
"typescript": "^5.9.3"
|
|
43
44
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=22.18.0"
|
|
46
47
|
},
|
|
47
|
-
"main": "./dist/index.js",
|
|
48
|
-
"module": "./dist/index.js",
|
|
49
|
-
"types": "./dist/index.d.ts",
|
|
50
48
|
"scripts": {
|
|
51
|
-
"
|
|
52
|
-
"build": "tsdown && npm run clean && tsc -p tsconfig.build.json",
|
|
53
|
-
"typecheck": "tsc --noEmit"
|
|
49
|
+
"typecheck": "tsgo --noEmit"
|
|
54
50
|
}
|
|
55
51
|
}
|
package/dist/model/index.js
DELETED