@navios/schedule 0.8.0 → 0.9.1
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/CHANGELOG.md +15 -0
- package/dist/src/decorators/schedulable.decorator.d.mts +4 -1
- package/dist/src/decorators/schedulable.decorator.d.mts.map +1 -1
- package/dist/src/legacy-compat/decorators/cron.decorator.d.mts +31 -0
- package/dist/src/legacy-compat/decorators/cron.decorator.d.mts.map +1 -0
- package/dist/src/legacy-compat/decorators/index.d.mts +3 -0
- package/dist/src/legacy-compat/decorators/index.d.mts.map +1 -0
- package/dist/src/legacy-compat/decorators/schedulable.decorator.d.mts +36 -0
- package/dist/src/legacy-compat/decorators/schedulable.decorator.d.mts.map +1 -0
- package/dist/src/legacy-compat/index.d.mts +26 -0
- package/dist/src/legacy-compat/index.d.mts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/index.cjs +12 -620
- package/lib/index.d.cts +8 -234
- package/lib/index.d.cts.map +1 -1
- package/lib/index.d.mts +8 -234
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs +2 -610
- package/lib/legacy-compat/index.cjs +98 -0
- package/lib/legacy-compat/index.cjs.map +1 -0
- package/lib/legacy-compat/index.d.cts +73 -0
- package/lib/legacy-compat/index.d.cts.map +1 -0
- package/lib/legacy-compat/index.d.mts +73 -0
- package/lib/legacy-compat/index.d.mts.map +1 -0
- package/lib/legacy-compat/index.mjs +73 -0
- package/lib/legacy-compat/index.mjs.map +1 -0
- package/lib/scheduler.service-BinyHmuL.cjs +676 -0
- package/lib/scheduler.service-BinyHmuL.cjs.map +1 -0
- package/lib/scheduler.service-Ccvw4fsy.d.cts +236 -0
- package/lib/scheduler.service-Ccvw4fsy.d.cts.map +1 -0
- package/lib/scheduler.service-DkyiR8iY.mjs +611 -0
- package/lib/scheduler.service-DkyiR8iY.mjs.map +1 -0
- package/lib/scheduler.service-pFh29qTy.d.mts +236 -0
- package/lib/scheduler.service-pFh29qTy.d.mts.map +1 -0
- package/package.json +13 -3
- package/src/__tests__/schedule.spec.mts +11 -9
- package/src/decorators/schedulable.decorator.mts +8 -8
- package/src/legacy-compat/decorators/cron.decorator.mts +58 -0
- package/src/legacy-compat/decorators/index.mts +2 -0
- package/src/legacy-compat/decorators/schedulable.decorator.mts +47 -0
- package/src/legacy-compat/index.mts +41 -0
- package/tsdown.config.mts +1 -1
- package/lib/index.cjs.map +0 -1
- package/lib/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.9.1] - 2026-01-02
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Legacy-Compatible Decorators**: Added new `@navios/schedule/legacy-compat` export with support for TypeScript experimental decorators
|
|
13
|
+
- `@Schedulable()` - Legacy-compatible class decorator for scheduled task services
|
|
14
|
+
- `@Cron()` - Legacy-compatible method decorator for cron job scheduling
|
|
15
|
+
- Re-exports `Schedule` constants, metadata utilities, and `SchedulerService`
|
|
16
|
+
|
|
17
|
+
## [0.9.0] - 2025-12-23
|
|
18
|
+
|
|
19
|
+
### Dependencies
|
|
20
|
+
|
|
21
|
+
- Updated to support `@navios/core` ^0.9.0
|
|
22
|
+
|
|
8
23
|
## [0.8.0] - 2025-12-21
|
|
9
24
|
|
|
10
25
|
### Dependencies
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ClassType } from '@navios/core';
|
|
2
|
+
import { Registry } from '@navios/core';
|
|
2
3
|
/**
|
|
3
4
|
* Decorator that marks a class as schedulable and makes it injectable.
|
|
4
5
|
*
|
|
@@ -24,5 +25,7 @@ import type { ClassType } from '@navios/core';
|
|
|
24
25
|
*
|
|
25
26
|
* @public
|
|
26
27
|
*/
|
|
27
|
-
export declare function Schedulable(
|
|
28
|
+
export declare function Schedulable({ registry }?: {
|
|
29
|
+
registry?: Registry;
|
|
30
|
+
}): (target: ClassType, context: ClassDecoratorContext) => ClassType;
|
|
28
31
|
//# sourceMappingURL=schedulable.decorator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedulable.decorator.d.mts","sourceRoot":"","sources":["../../../src/decorators/schedulable.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"schedulable.decorator.d.mts","sourceRoot":"","sources":["../../../src/decorators/schedulable.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAA8B,QAAQ,EAAE,MAAM,cAAc,CAAA;AAInE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAO,IAC5D,QAAQ,SAAS,EAAE,SAAS,qBAAqB,eAW1D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CronJobParams } from 'cron';
|
|
2
|
+
import { type CronOptions } from '../../decorators/cron.decorator.mjs';
|
|
3
|
+
export type { CronOptions };
|
|
4
|
+
/**
|
|
5
|
+
* Legacy-compatible Cron decorator.
|
|
6
|
+
*
|
|
7
|
+
* Works with TypeScript experimental decorators (legacy API).
|
|
8
|
+
* Marks a method to run on a cron schedule.
|
|
9
|
+
*
|
|
10
|
+
* @param cronTime - Cron expression (5 or 6 fields) or a pre-defined Schedule constant
|
|
11
|
+
* @param options - Optional configuration for the cron job
|
|
12
|
+
* @returns A method decorator compatible with legacy decorator API
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* @Schedulable()
|
|
17
|
+
* class TaskService {
|
|
18
|
+
* @Cron('0 0 * * *')
|
|
19
|
+
* async dailyTask() {
|
|
20
|
+
* console.log('Running daily task')
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* @Cron(Schedule.EveryFiveMinutes, { disabled: true })
|
|
24
|
+
* async frequentTask() {
|
|
25
|
+
* console.log('Running every 5 minutes')
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function Cron(cronTime: CronJobParams['cronTime'], options?: CronOptions): <T extends object>(target: T, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => Promise<void>>) => PropertyDescriptor | void;
|
|
31
|
+
//# sourceMappingURL=cron.decorator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/cron.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAIzC,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,qCAAqC,CAAA;AAE5C,YAAY,EAAE,WAAW,EAAE,CAAA;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,EAAE,WAAW,IAC5D,CAAC,SAAS,MAAM,EAC/B,QAAQ,CAAC,EACT,aAAa,MAAM,GAAG,MAAM,EAC5B,YAAY,uBAAuB,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,KACvD,kBAAkB,GAAG,IAAI,CAe7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/index.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ClassType, Registry } from '@navios/core';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the Schedulable decorator.
|
|
4
|
+
*/
|
|
5
|
+
export interface SchedulableOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The registry to register the service with.
|
|
8
|
+
* If not provided, the global registry will be used.
|
|
9
|
+
*/
|
|
10
|
+
registry?: Registry;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Legacy-compatible Schedulable decorator.
|
|
14
|
+
*
|
|
15
|
+
* Works with TypeScript experimental decorators (legacy API).
|
|
16
|
+
* Marks a class as schedulable and makes it injectable.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Optional configuration including the registry to use
|
|
19
|
+
* @returns A class decorator compatible with legacy decorator API
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* @Schedulable()
|
|
24
|
+
* class TaskService {
|
|
25
|
+
* @Cron('0 0 * * *')
|
|
26
|
+
* async dailyTask() {
|
|
27
|
+
* console.log('Running daily task')
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* // Register the service
|
|
32
|
+
* schedulerService.register(TaskService)
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function Schedulable(options?: SchedulableOptions): (target: ClassType) => ClassType;
|
|
36
|
+
//# sourceMappingURL=schedulable.decorator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedulable.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/schedulable.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAMvD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,IACzC,QAAQ,SAAS,eAKnC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy-compatible decorators for projects that cannot use Stage 3 decorators.
|
|
3
|
+
*
|
|
4
|
+
* These decorators use the TypeScript experimental decorator API and convert
|
|
5
|
+
* the arguments to Stage 3 format internally.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { Schedulable, Cron, Schedule } from '@navios/schedule/legacy-compat'
|
|
10
|
+
*
|
|
11
|
+
* @Schedulable()
|
|
12
|
+
* class TaskService {
|
|
13
|
+
* @Cron(Schedule.EveryMinute)
|
|
14
|
+
* async everyMinuteTask() {
|
|
15
|
+
* console.log('Running every minute')
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export { Cron, Schedulable, type CronOptions, type SchedulableOptions } from './decorators/index.mjs';
|
|
21
|
+
export { Schedule } from '../cron.constants.mjs';
|
|
22
|
+
export type { CronMetadata, ScheduleMetadata } from '../metadata/index.mjs';
|
|
23
|
+
export { getAllCronMetadata, getCronMetadata, getScheduleMetadata, extractScheduleMetadata, hasScheduleMetadata, } from '../metadata/index.mjs';
|
|
24
|
+
export { SchedulerService } from '../scheduler.service.mjs';
|
|
25
|
+
export { createClassContext, createMethodContext } from '@navios/core/legacy-compat';
|
|
26
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/legacy-compat/index.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAGrG,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGhD,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC3E,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAG3D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA"}
|