@eggjs/schedule 6.0.0-beta.15 → 6.0.0-beta.18

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/agent.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import Agent$1 from "./app/extend/agent.js";
1
+ import ScheduleAgent from "./app/extend/agent.js";
2
2
  import { ILifecycleBoot } from "egg";
3
3
 
4
4
  //#region src/agent.d.ts
5
5
  declare class Boot implements ILifecycleBoot {
6
6
  #private;
7
- constructor(agent: Agent$1);
7
+ constructor(agent: ScheduleAgent);
8
8
  configDidLoad(): Promise<void>;
9
9
  serverDidReady(): Promise<void>;
10
10
  beforeClose(): Promise<void>;
@@ -1,10 +1,10 @@
1
1
  import { BaseStrategy } from "../../lib/strategy/base.js";
2
2
  import { TimerStrategy } from "../../lib/strategy/timer.js";
3
3
  import { Schedule } from "../../lib/schedule.js";
4
- import { Agent as Agent$1 } from "egg";
4
+ import { Agent } from "egg";
5
5
 
6
6
  //#region src/app/extend/agent.d.ts
7
- declare class Agent extends Agent$1 {
7
+ declare class ScheduleAgent extends Agent {
8
8
  /**
9
9
  * @member agent#ScheduleStrategy
10
10
  */
@@ -19,4 +19,4 @@ declare class Agent extends Agent$1 {
19
19
  get schedule(): Schedule;
20
20
  }
21
21
  //#endregion
22
- export { Agent as default };
22
+ export { ScheduleAgent as default };
@@ -1,11 +1,11 @@
1
1
  import { BaseStrategy } from "../../lib/strategy/base.js";
2
2
  import { TimerStrategy } from "../../lib/strategy/timer.js";
3
3
  import { Schedule } from "../../lib/schedule.js";
4
- import { Agent as Agent$1 } from "egg";
4
+ import { Agent } from "egg";
5
5
 
6
6
  //#region src/app/extend/agent.ts
7
7
  const SCHEDULE = Symbol("agent schedule");
8
- var Agent = class extends Agent$1 {
8
+ var ScheduleAgent = class extends Agent {
9
9
  /**
10
10
  * @member agent#ScheduleStrategy
11
11
  */
@@ -29,4 +29,4 @@ var Agent = class extends Agent$1 {
29
29
  };
30
30
 
31
31
  //#endregion
32
- export { Agent as default };
32
+ export { ScheduleAgent as default };
@@ -1,16 +1,12 @@
1
1
  import { ScheduleWorker } from "../../lib/schedule_worker.js";
2
- import { Application as Application$1 } from "egg";
2
+ import { Application } from "egg";
3
3
 
4
4
  //#region src/app/extend/application.d.ts
5
- declare class Application extends Application$1 {
5
+ declare class ScheduleApplication extends Application {
6
6
  /**
7
7
  * @member app#schedule
8
8
  */
9
9
  get scheduleWorker(): ScheduleWorker;
10
- /**
11
- * For unittest only - run a specific schedule task
12
- */
13
- runSchedule?(schedulePath: string, ...args: any[]): Promise<any>;
14
10
  }
15
11
  //#endregion
16
- export { Application as default };
12
+ export { ScheduleApplication as default };
@@ -1,9 +1,9 @@
1
1
  import { ScheduleWorker } from "../../lib/schedule_worker.js";
2
- import { Application as Application$1 } from "egg";
2
+ import { Application } from "egg";
3
3
 
4
4
  //#region src/app/extend/application.ts
5
5
  const SCHEDULE_WORKER = Symbol("application scheduleWorker");
6
- var Application = class extends Application$1 {
6
+ var ScheduleApplication = class extends Application {
7
7
  /**
8
8
  * @member app#schedule
9
9
  */
@@ -15,4 +15,4 @@ var Application = class extends Application$1 {
15
15
  };
16
16
 
17
17
  //#endregion
18
- export { Application as default };
18
+ export { ScheduleApplication as default };
@@ -1,13 +1,8 @@
1
- import Application from "./application.js";
1
+ import ScheduleApplication from "./application.js";
2
2
 
3
3
  //#region src/app/extend/application.unittest.d.ts
4
- declare class ApplicationUnittest extends Application {
4
+ declare class ScheduleApplicationUnittest extends ScheduleApplication {
5
5
  runSchedule(schedulePath: string, ...args: any[]): Promise<void>;
6
6
  }
7
- declare module '@eggjs/mock' {
8
- interface MockApplication {
9
- runSchedule(schedulePath: string, ...args: any[]): Promise<any>;
10
- }
11
- }
12
7
  //#endregion
13
- export { ApplicationUnittest as default };
8
+ export { ScheduleApplicationUnittest as default };
@@ -1,11 +1,11 @@
1
- import Application from "./application.js";
1
+ import ScheduleApplication from "./application.js";
2
2
  import { debuglog } from "node:util";
3
3
  import path from "node:path";
4
4
  import { importResolve } from "@eggjs/utils";
5
5
 
6
6
  //#region src/app/extend/application.unittest.ts
7
7
  const debug = debuglog("egg/schedule/app");
8
- var ApplicationUnittest = class extends Application {
8
+ var ScheduleApplicationUnittest = class extends ScheduleApplication {
9
9
  async runSchedule(schedulePath, ...args) {
10
10
  debug("[runSchedule] start schedulePath: %o, args: %o", schedulePath, args);
11
11
  const config = this.config;
@@ -43,4 +43,4 @@ var ApplicationUnittest = class extends Application {
43
43
  };
44
44
 
45
45
  //#endregion
46
- export { ApplicationUnittest as default };
46
+ export { ScheduleApplicationUnittest as default };
package/dist/app.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import Application$1 from "./app/extend/application.js";
1
+ import ScheduleApplication from "./app/extend/application.js";
2
2
  import { ILifecycleBoot } from "egg";
3
3
 
4
4
  //#region src/app.d.ts
5
5
  declare class Boot implements ILifecycleBoot {
6
6
  #private;
7
- constructor(app: Application$1);
7
+ constructor(app: ScheduleApplication);
8
8
  configDidLoad(): Promise<void>;
9
9
  }
10
10
  //#endregion
@@ -1,6 +1,20 @@
1
+ import { ParserOptions } from "cron-parser";
1
2
  import { PartialEggConfig } from "egg";
2
3
 
3
4
  //#region src/config/config.default.d.ts
5
+ interface EggScheduleConfig {
6
+ type?: 'worker' | 'all';
7
+ interval?: string | number;
8
+ cron?: string;
9
+ cronOptions?: ParserOptions;
10
+ immediate?: boolean;
11
+ disable?: boolean;
12
+ env?: string[];
13
+ /**
14
+ * custom additional directory, full path
15
+ */
16
+ directory: string[];
17
+ }
4
18
  declare const _default: PartialEggConfig;
5
19
  //#endregion
6
- export { _default as default };
20
+ export { EggScheduleConfig, _default as default };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { EggScheduleConfig, EggScheduleItem, EggScheduleJobInfo, EggScheduleTask } from "./lib/types.js";
1
+ import { EggScheduleItem, EggScheduleJobInfo, EggScheduleTask } from "./lib/types.js";
2
2
  import { Schedule } from "./lib/schedule.js";
3
- import Agent from "./app/extend/agent.js";
3
+ import ScheduleAgent from "./app/extend/agent.js";
4
4
  import { ScheduleWorker } from "./lib/schedule_worker.js";
5
- import Application from "./app/extend/application.js";
6
- import ApplicationUnittest from "./app/extend/application.unittest.js";
7
- export { Agent, Application, ApplicationUnittest, EggScheduleConfig, EggScheduleItem, EggScheduleJobInfo, EggScheduleTask, Schedule, ScheduleWorker };
5
+ import ScheduleApplication from "./app/extend/application.js";
6
+ import ScheduleApplicationUnittest from "./app/extend/application.unittest.js";
7
+ export { ScheduleAgent as Agent, ScheduleApplication as Application, ScheduleApplicationUnittest as ApplicationUnittest, EggScheduleItem, EggScheduleJobInfo, EggScheduleTask, Schedule, ScheduleWorker };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Schedule } from "./lib/schedule.js";
2
- import Agent from "./app/extend/agent.js";
2
+ import ScheduleAgent from "./app/extend/agent.js";
3
3
  import { ScheduleWorker } from "./lib/schedule_worker.js";
4
- import Application from "./app/extend/application.js";
5
- import ApplicationUnittest from "./app/extend/application.unittest.js";
4
+ import ScheduleApplication from "./app/extend/application.js";
5
+ import ScheduleApplicationUnittest from "./app/extend/application.unittest.js";
6
6
 
7
- export { Agent, Application, ApplicationUnittest, Schedule, ScheduleWorker };
7
+ export { ScheduleAgent as Agent, ScheduleApplication as Application, ScheduleApplicationUnittest as ApplicationUnittest, Schedule, ScheduleWorker };
@@ -1,12 +1,12 @@
1
1
  import { EggScheduleItem, EggScheduleJobInfo } from "./types.js";
2
2
  import { BaseStrategy } from "./strategy/base.js";
3
- import Agent from "../app/extend/agent.js";
3
+ import ScheduleAgent from "../app/extend/agent.js";
4
4
 
5
5
  //#region src/lib/schedule.d.ts
6
6
  declare class Schedule {
7
7
  #private;
8
8
  closed: boolean;
9
- constructor(agent: Agent);
9
+ constructor(agent: ScheduleAgent);
10
10
  /**
11
11
  * register a custom Schedule Strategy
12
12
  * @param {String} type - strategy type
@@ -1,11 +1,11 @@
1
1
  import { EggScheduleItem } from "./types.js";
2
- import Application from "../app/extend/application.js";
2
+ import ScheduleApplication from "../app/extend/application.js";
3
3
 
4
4
  //#region src/lib/schedule_worker.d.ts
5
5
  declare class ScheduleWorker {
6
6
  #private;
7
7
  scheduleItems: Record<string, EggScheduleItem>;
8
- constructor(app: Application);
8
+ constructor(app: ScheduleApplication);
9
9
  init(): Promise<void>;
10
10
  registerSchedule(scheduleItem: EggScheduleItem): void;
11
11
  unregisterSchedule(key: string): void;
@@ -1,16 +1,17 @@
1
- import { EggScheduleConfig, EggScheduleJobInfo } from "../types.js";
2
- import Agent$1 from "../../app/extend/agent.js";
1
+ import { EggScheduleConfig } from "../../config/config.default.js";
2
+ import { EggScheduleJobInfo } from "../types.js";
3
+ import ScheduleAgent from "../../app/extend/agent.js";
3
4
  import { EggLogger } from "egg";
4
5
 
5
6
  //#region src/lib/strategy/base.d.ts
6
7
  declare class BaseStrategy {
7
- protected agent: Agent$1;
8
+ protected agent: ScheduleAgent;
8
9
  protected scheduleConfig: EggScheduleConfig;
9
10
  protected key: string;
10
11
  protected logger: EggLogger;
11
12
  protected closed: boolean;
12
13
  count: number;
13
- constructor(scheduleConfig: EggScheduleConfig, agent: Agent$1, key: string);
14
+ constructor(scheduleConfig: EggScheduleConfig, agent: ScheduleAgent, key: string);
14
15
  /** keep compatibility */
15
16
  get schedule(): EggScheduleConfig;
16
17
  start(): Promise<void>;
@@ -1,6 +1,6 @@
1
- import { EggScheduleConfig } from "../types.js";
1
+ import { EggScheduleConfig } from "../../config/config.default.js";
2
2
  import { BaseStrategy } from "./base.js";
3
- import Agent from "../../app/extend/agent.js";
3
+ import ScheduleAgent from "../../app/extend/agent.js";
4
4
  import { CronExpression } from "cron-parser";
5
5
  import safeTimers from "safe-timers";
6
6
 
@@ -8,7 +8,7 @@ import safeTimers from "safe-timers";
8
8
  declare abstract class TimerStrategy extends BaseStrategy {
9
9
  #private;
10
10
  protected cronInstance?: CronExpression;
11
- constructor(scheduleConfig: EggScheduleConfig, agent: Agent, key: string);
11
+ constructor(scheduleConfig: EggScheduleConfig, agent: ScheduleAgent, key: string);
12
12
  protected handler(): void;
13
13
  start(): Promise<void>;
14
14
  onJobStart(): void;
@@ -1,24 +1,6 @@
1
- import { ParserOptions } from "cron-parser";
1
+ import { EggScheduleConfig } from "../config/config.default.js";
2
2
 
3
3
  //#region src/lib/types.d.ts
4
-
5
- /**
6
- * Schedule Config
7
- * @see https://www.eggjs.org/zh-CN/basics/schedule
8
- */
9
- interface EggScheduleConfig {
10
- type?: 'worker' | 'all';
11
- interval?: string | number;
12
- cron?: string;
13
- cronOptions?: ParserOptions;
14
- immediate?: boolean;
15
- disable?: boolean;
16
- env?: string[];
17
- /**
18
- * custom additional directory, full path
19
- */
20
- directory: string[];
21
- }
22
4
  type EggScheduleTask = (ctx: any, ...args: any[]) => Promise<void>;
23
5
  interface EggScheduleItem {
24
6
  schedule: EggScheduleConfig;
@@ -35,10 +17,5 @@ interface EggScheduleJobInfo {
35
17
  message?: string;
36
18
  rt?: number;
37
19
  }
38
- declare module 'egg' {
39
- interface EggAppConfig {
40
- schedule: EggScheduleConfig;
41
- }
42
- }
43
20
  //#endregion
44
- export { EggScheduleConfig, EggScheduleItem, EggScheduleJobInfo, EggScheduleTask };
21
+ export { EggScheduleItem, EggScheduleJobInfo, EggScheduleTask };
@@ -0,0 +1,17 @@
1
+ import { EggScheduleConfig } from "./config/config.default.js";
2
+
3
+ //#region src/types.d.ts
4
+ declare module 'egg' {
5
+ interface EggAppConfig {
6
+ /**
7
+ * Schedule Config
8
+ * @see https://www.eggjs.org/zh-CN/basics/schedule
9
+ */
10
+ schedule: EggScheduleConfig;
11
+ }
12
+ }
13
+ declare module '@eggjs/mock' {
14
+ interface MockApplication {
15
+ runSchedule(schedulePath: string, ...args: any[]): Promise<any>;
16
+ }
17
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggjs/schedule",
3
- "version": "6.0.0-beta.15",
3
+ "version": "6.0.0-beta.18",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,21 +33,20 @@
33
33
  "is-type-of": "^2.2.0",
34
34
  "safe-timers": "^1.1.0",
35
35
  "utility": "^2.5.0",
36
- "@eggjs/utils": "5.0.0-beta.15"
36
+ "@eggjs/utils": "5.0.0-beta.18"
37
37
  },
38
38
  "peerDependencies": {
39
- "egg": "4.1.0-beta.15"
39
+ "egg": "4.1.0-beta.18"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/safe-timers": "^1.1.2",
43
- "egg-tracer": "^2.1.0",
44
- "oxlint": "^1.18.0",
43
+ "oxlint": "^1.19.0",
45
44
  "tsdown": "^0.15.4",
46
45
  "typescript": "5.9.2",
47
46
  "vitest": "4.0.0-beta.13",
48
- "@eggjs/bin": "8.0.0-beta.15",
49
- "@eggjs/tsconfig": "3.1.0-beta.15",
50
- "@eggjs/mock": "7.0.0-beta.15"
47
+ "@eggjs/bin": "8.0.0-beta.18",
48
+ "@eggjs/mock": "7.0.0-beta.18",
49
+ "@eggjs/tsconfig": "3.1.0-beta.18"
51
50
  },
52
51
  "author": "dead_horse",
53
52
  "license": "MIT",
@@ -68,6 +67,7 @@
68
67
  "./lib/strategy/timer": "./dist/lib/strategy/timer.js",
69
68
  "./lib/strategy/worker": "./dist/lib/strategy/worker.js",
70
69
  "./lib/types": "./dist/lib/types.js",
70
+ "./types": "./dist/types.js",
71
71
  "./package.json": "./package.json"
72
72
  },
73
73
  "files": [