koatty_schedule 1.5.11 → 1.6.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.
- package/.rollup.config.js +48 -51
- package/CHANGELOG.md +5 -1
- package/dist/index.d.ts +31 -44
- package/dist/index.js +1769 -490
- package/dist/index.mjs +1756 -472
- package/dist/package.json +37 -27
- package/package.json +37 -27
package/.rollup.config.js
CHANGED
|
@@ -3,61 +3,58 @@
|
|
|
3
3
|
* @Usage:
|
|
4
4
|
* @Author: richen
|
|
5
5
|
* @Date: 2021-12-17 10:20:44
|
|
6
|
-
* @LastEditTime:
|
|
6
|
+
* @LastEditTime: 2024-11-04 22:04:45
|
|
7
7
|
*/
|
|
8
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
8
9
|
import json from "@rollup/plugin-json";
|
|
10
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
11
|
+
import { builtinModules } from 'module';
|
|
12
|
+
import del from "rollup-plugin-delete";
|
|
9
13
|
import typescript from 'rollup-plugin-typescript2';
|
|
10
14
|
// import babel from '@rollup/plugin-babel';
|
|
15
|
+
const pkg = require('./package.json');
|
|
11
16
|
|
|
12
17
|
export default [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
declaration: false,
|
|
56
|
-
declarationMap: false,
|
|
57
|
-
module: "ESNext"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
]
|
|
62
|
-
}
|
|
18
|
+
{
|
|
19
|
+
input: './src/index.ts',
|
|
20
|
+
output: [
|
|
21
|
+
{
|
|
22
|
+
format: 'cjs',
|
|
23
|
+
file: './dist/index.js',
|
|
24
|
+
banner: require('./scripts/copyright'),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
format: 'es',
|
|
28
|
+
file: './dist/index.mjs',
|
|
29
|
+
banner: require('./scripts/copyright'),
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
plugins: [
|
|
33
|
+
del({ targets: ["dist/*", "temp/*", "docs/api"] }),
|
|
34
|
+
// babel({
|
|
35
|
+
// babelHelpers: "runtime",
|
|
36
|
+
// configFile: './babel.config.js',
|
|
37
|
+
// exclude: 'node_modules/**',
|
|
38
|
+
// }),
|
|
39
|
+
json(),
|
|
40
|
+
resolve({
|
|
41
|
+
preferBuiltins: true, // 优先选择内置模块
|
|
42
|
+
}),
|
|
43
|
+
commonjs(),
|
|
44
|
+
typescript({
|
|
45
|
+
tsconfigOverride: {
|
|
46
|
+
compilerOptions: {
|
|
47
|
+
declaration: false,
|
|
48
|
+
declarationMap: false,
|
|
49
|
+
module: "ESNext"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
],
|
|
54
|
+
external: [
|
|
55
|
+
...builtinModules, // 排除 Node.js 内置模块
|
|
56
|
+
...Object.keys(pkg.dependencies || {}), // 排除 package.json 中的外部依赖
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
|
|
63
60
|
]
|
package/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
### [1.
|
|
5
|
+
### [1.6.2](https://github.com/thinkkoa/koatty_schedule/compare/v1.6.0...v1.6.2) (2024-11-07)
|
|
6
6
|
|
|
7
|
+
## [1.6.0](https://github.com/thinkkoa/koatty_schedule/compare/v1.5.11...v1.6.0) (2023-12-20)
|
|
8
|
+
|
|
9
|
+
### [1.5.11](https://github.com/thinkkoa/koatty_schedule/compare/v1.5.10...v1.5.11) (2023-07-28)
|
|
10
|
+
|
|
7
11
|
### [1.5.10](https://github.com/thinkkoa/koatty_schedule/compare/v1.5.8...v1.5.10) (2023-01-13)
|
|
8
12
|
|
|
9
13
|
### [1.5.8](https://github.com/thinkkoa/koatty_schedule/compare/v1.5.7...v1.5.8) (2022-11-03)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,47 +1,46 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @Author: richen
|
|
3
|
-
* @Date:
|
|
3
|
+
* @Date: 2024-11-07 16:50:50
|
|
4
4
|
* @License: BSD (3-Clause)
|
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
|
6
6
|
* @HomePage: https://koatty.org/
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* get instances of cacheStore
|
|
12
|
-
*
|
|
13
|
-
* @export
|
|
14
|
-
* @param {Application} app
|
|
15
|
-
* @returns {*} {CacheStore}
|
|
16
|
-
*/
|
|
17
|
-
export declare function GetScheduleLocker(app: Application): Promise<LockerInterface>;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Inject schedule job
|
|
21
|
-
*
|
|
22
|
-
* @export
|
|
23
|
-
* @param {*} target
|
|
24
|
-
*/
|
|
25
|
-
export declare function injectSchedule(target: any): void;
|
|
8
|
+
import { RedisOptions } from 'ioredis';
|
|
26
9
|
|
|
27
10
|
/**
|
|
28
11
|
* Redis-based distributed locks. Redis server config from db.ts.
|
|
29
12
|
*
|
|
30
13
|
* @export
|
|
31
14
|
* @param {string} [name] The locker name. If name is duplicated, lock sharing contention will result.
|
|
32
|
-
* @param {number} [lockTimeOut] Automatic release of lock within a limited maximum time.
|
|
33
|
-
* @param {number} [
|
|
34
|
-
* @param {number} [waitLockTimeOut] When using more than TimeOut(millisecond) still fails to get the lock and return failure.
|
|
15
|
+
* @param {number} [lockTimeOut] Automatic release of lock within a limited maximum time. default 10000
|
|
16
|
+
* @param {number} [waitLockRetry] Try to acquire lock max time. default 3
|
|
35
17
|
*
|
|
36
18
|
* @returns {MethodDecorator}
|
|
37
19
|
*/
|
|
38
|
-
export declare
|
|
20
|
+
export declare function RedLock(name?: string, options?: RedLockOptions): MethodDecorator;
|
|
39
21
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
/**
|
|
23
|
+
* @description: RedLockOptions
|
|
24
|
+
* @return {*}
|
|
25
|
+
*/
|
|
26
|
+
declare interface RedLockOptions {
|
|
27
|
+
/**
|
|
28
|
+
* lock a resource times
|
|
29
|
+
*/
|
|
30
|
+
lockTimeOut?: number;
|
|
31
|
+
/**
|
|
32
|
+
* The max number of times Redlock will attempt to lock a resource
|
|
33
|
+
*/
|
|
34
|
+
retryCount?: number;
|
|
35
|
+
/**
|
|
36
|
+
* If there is a lock timeout, renew the lock and retry execution,
|
|
37
|
+
* with a maximum of maxRetry attempts.
|
|
38
|
+
*/
|
|
39
|
+
renewCount?: number;
|
|
40
|
+
/**
|
|
41
|
+
* redis config
|
|
42
|
+
*/
|
|
43
|
+
RedisOptions: RedisOptions;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
/**
|
|
@@ -49,28 +48,16 @@ declare interface LockerInterface {
|
|
|
49
48
|
*
|
|
50
49
|
* @export
|
|
51
50
|
* @param {string} cron
|
|
51
|
+
* @param {string} _timezone
|
|
52
52
|
* * Seconds: 0-59
|
|
53
53
|
* * Minutes: 0-59
|
|
54
54
|
* * Hours: 0-23
|
|
55
55
|
* * Day of Month: 1-31
|
|
56
|
-
* * Months:
|
|
57
|
-
* * Day of Week:
|
|
58
|
-
*
|
|
59
|
-
* @returns {MethodDecorator}
|
|
60
|
-
*/
|
|
61
|
-
export declare function Scheduled(cron: string): MethodDecorator;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Redis-based distributed locks. Redis server config from db.ts.
|
|
65
|
-
*
|
|
66
|
-
* @export
|
|
67
|
-
* @param {string} [name] The locker name. If name is duplicated, lock sharing contention will result.
|
|
68
|
-
* @param {number} [lockTimeOut] Automatic release of lock within a limited maximum time.
|
|
69
|
-
* @param {number} [waitLockInterval] Try to acquire lock every interval time(millisecond).
|
|
70
|
-
* @param {number} [waitLockTimeOut] When using more than TimeOut(millisecond) still fails to get the lock and return failure.
|
|
56
|
+
* * Months: 1-12 (Jan-Dec)
|
|
57
|
+
* * Day of Week: 1-7 (Sun-Sat)
|
|
71
58
|
*
|
|
72
59
|
* @returns {MethodDecorator}
|
|
73
60
|
*/
|
|
74
|
-
export declare function
|
|
61
|
+
export declare function Scheduled(cron: string, _timezone?: string): MethodDecorator;
|
|
75
62
|
|
|
76
63
|
export { }
|