@zenweb/schedule 5.1.0 → 5.2.0

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,9 +1,19 @@
1
1
  import { Core, Middleware } from '@zenweb/core';
2
- import { RecurrenceRule, RecurrenceSpecDateRange, RecurrenceSpecObjLit } from 'node-schedule';
2
+ import { type Spec } from 'node-schedule';
3
3
  import { ScheduleOption } from './types.js';
4
4
  interface ScheduleMethodOption {
5
- rule: RecurrenceRule | RecurrenceSpecDateRange | RecurrenceSpecObjLit | Date | string | number;
5
+ /**
6
+ * 定时规则
7
+ */
8
+ rule: Spec;
9
+ /**
10
+ * 中间件
11
+ */
6
12
  middleware?: Middleware | Middleware[];
13
+ /**
14
+ * 自定义调用路径
15
+ */
16
+ path?: string;
7
17
  }
8
18
  /**
9
19
  * 定时任务设定
package/dist/register.js CHANGED
@@ -9,8 +9,8 @@ const scheduleDecorator = makeMethodDecorator();
9
9
  * 定时任务设定
10
10
  */
11
11
  export function schedule(opt) {
12
- return scheduleDecorator.wrap((descriptor, target) => {
13
- const path = `/${target.constructor.name}.${descriptor.handle.name}`;
12
+ return scheduleDecorator.wrap(descriptor => {
13
+ const path = opt.path || descriptor.handle.name;
14
14
  return Object.assign({ path }, descriptor, opt);
15
15
  });
16
16
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zenweb/schedule",
3
3
  "type": "module",
4
- "version": "5.1.0",
4
+ "version": "5.2.0",
5
5
  "description": "Zenweb Schedule module",
6
6
  "exports": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",