@navios/schedule 0.9.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 +9 -0
- 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 +2 -232
- package/lib/index.d.cts.map +1 -1
- package/lib/index.d.mts +2 -232
- 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/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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["createMethodContext","Cron","OriginalCron","cronTime","options","target","propertyKey","descriptor","Error","context","originalDecorator","result","value","createClassContext","Schedulable","OriginalSchedulable","options","target","context","originalDecorator"],"sources":["../../src/legacy-compat/decorators/cron.decorator.mts","../../src/legacy-compat/decorators/schedulable.decorator.mts"],"sourcesContent":["import type { CronJobParams } from 'cron'\n\nimport { createMethodContext } from '@navios/core/legacy-compat'\n\nimport {\n Cron as OriginalCron,\n type CronOptions,\n} from '../../decorators/cron.decorator.mjs'\n\nexport type { CronOptions }\n\n/**\n * Legacy-compatible Cron decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Marks a method to run on a cron schedule.\n *\n * @param cronTime - Cron expression (5 or 6 fields) or a pre-defined Schedule constant\n * @param options - Optional configuration for the cron job\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Schedulable()\n * class TaskService {\n * @Cron('0 0 * * *')\n * async dailyTask() {\n * console.log('Running daily task')\n * }\n *\n * @Cron(Schedule.EveryFiveMinutes, { disabled: true })\n * async frequentTask() {\n * console.log('Running every 5 minutes')\n * }\n * }\n * ```\n */\nexport function Cron(cronTime: CronJobParams['cronTime'], options?: CronOptions) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: TypedPropertyDescriptor<() => Promise<void>>,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Cron decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalCron(cronTime, options)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n","import type { ClassType, Registry } from '@navios/core'\n\nimport { createClassContext } from '@navios/core/legacy-compat'\n\nimport { Schedulable as OriginalSchedulable } from '../../decorators/schedulable.decorator.mjs'\n\n/**\n * Options for the Schedulable decorator.\n */\nexport interface SchedulableOptions {\n /**\n * The registry to register the service with.\n * If not provided, the global registry will be used.\n */\n registry?: Registry\n}\n\n/**\n * Legacy-compatible Schedulable decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Marks a class as schedulable and makes it injectable.\n *\n * @param options - Optional configuration including the registry to use\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Schedulable()\n * class TaskService {\n * @Cron('0 0 * * *')\n * async dailyTask() {\n * console.log('Running daily task')\n * }\n * }\n *\n * // Register the service\n * schedulerService.register(TaskService)\n * ```\n */\nexport function Schedulable(options: SchedulableOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalSchedulable(options)\n return originalDecorator(target, context)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCA,SAAgBC,KAAKE,UAAqCC,SAAqB;AAC7E,QAAO,SACLC,QACAC,aACAC,YAAwD;AAExD,MAAI,CAACA,WACH,OAAM,IAAIC,MACR,sGAAA;EAGJ,MAAMC,8DAA8BJ,QAAQC,aAAaC,WAAAA;EAGzD,MAAMI,SAFoBT,+BAAaC,UAAUC,QAAAA,CAEhBG,WAAWK,OAAOH,QAAAA;AACnD,MAAIE,WAAWJ,WAAWK,MACxBL,YAAWK,QAAQD;AAErB,SAAOJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCfX,SAAgBO,YAAYE,UAA8B,EAAE,EAAA;AAC1D,QAAO,SAAUC,QAAiB;EAChC,MAAMC,6DAA6BD,OAAAA;AAEnC,SAD0BF,sCAAoBC,QAAAA,CACrBC,QAAQC,QAAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { a as extractScheduleMetadata, c as CronMetadata, d as getCronMetadata, n as Schedule, o as getScheduleMetadata, p as CronOptions, r as ScheduleMetadata, s as hasScheduleMetadata, t as SchedulerService, u as getAllCronMetadata } from "../scheduler.service-Ccvw4fsy.cjs";
|
|
2
|
+
import { CronJobParams } from "cron";
|
|
3
|
+
import { ClassType, Registry } from "@navios/core";
|
|
4
|
+
import { createClassContext, createMethodContext } from "@navios/core/legacy-compat";
|
|
5
|
+
|
|
6
|
+
//#region src/legacy-compat/decorators/cron.decorator.d.mts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Legacy-compatible Cron decorator.
|
|
10
|
+
*
|
|
11
|
+
* Works with TypeScript experimental decorators (legacy API).
|
|
12
|
+
* Marks a method to run on a cron schedule.
|
|
13
|
+
*
|
|
14
|
+
* @param cronTime - Cron expression (5 or 6 fields) or a pre-defined Schedule constant
|
|
15
|
+
* @param options - Optional configuration for the cron job
|
|
16
|
+
* @returns A method decorator compatible with legacy decorator API
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* @Schedulable()
|
|
21
|
+
* class TaskService {
|
|
22
|
+
* @Cron('0 0 * * *')
|
|
23
|
+
* async dailyTask() {
|
|
24
|
+
* console.log('Running daily task')
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* @Cron(Schedule.EveryFiveMinutes, { disabled: true })
|
|
28
|
+
* async frequentTask() {
|
|
29
|
+
* console.log('Running every 5 minutes')
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare function Cron(cronTime: CronJobParams['cronTime'], options?: CronOptions): <T extends object>(target: T, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => Promise<void>>) => PropertyDescriptor | void;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/legacy-compat/decorators/schedulable.decorator.d.mts
|
|
37
|
+
/**
|
|
38
|
+
* Options for the Schedulable decorator.
|
|
39
|
+
*/
|
|
40
|
+
interface SchedulableOptions {
|
|
41
|
+
/**
|
|
42
|
+
* The registry to register the service with.
|
|
43
|
+
* If not provided, the global registry will be used.
|
|
44
|
+
*/
|
|
45
|
+
registry?: Registry;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Legacy-compatible Schedulable decorator.
|
|
49
|
+
*
|
|
50
|
+
* Works with TypeScript experimental decorators (legacy API).
|
|
51
|
+
* Marks a class as schedulable and makes it injectable.
|
|
52
|
+
*
|
|
53
|
+
* @param options - Optional configuration including the registry to use
|
|
54
|
+
* @returns A class decorator compatible with legacy decorator API
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* @Schedulable()
|
|
59
|
+
* class TaskService {
|
|
60
|
+
* @Cron('0 0 * * *')
|
|
61
|
+
* async dailyTask() {
|
|
62
|
+
* console.log('Running daily task')
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
*
|
|
66
|
+
* // Register the service
|
|
67
|
+
* schedulerService.register(TaskService)
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare function Schedulable(options?: SchedulableOptions): (target: ClassType) => ClassType;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { Cron, type CronMetadata, type CronOptions, Schedulable, type SchedulableOptions, Schedule, type ScheduleMetadata, SchedulerService, createClassContext, createMethodContext, extractScheduleMetadata, getAllCronMetadata, getCronMetadata, getScheduleMetadata, hasScheduleMetadata };
|
|
73
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/legacy-compat/decorators/cron.decorator.mts","../../src/legacy-compat/decorators/schedulable.decorator.mts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAqCA;;;;;;;;;;;AC5BA;AA+BA;;;;;;;;;;;iBDHgB,IAAA,WAAe,qCAAqC,yCAExD,6CAEI,8BAA8B,mBACzC;;;;;;UCjCY,kBAAA;;AD4BjB;;;EAEY,QAAA,CAAA,ECzBC,QDyBD;;;;;;;;AC9BZ;AA+BA;;;;;;;;;;;;;;;;iBAAgB,WAAA,WAAqB,8BACV,cAAS"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { a as extractScheduleMetadata, c as CronMetadata, d as getCronMetadata, n as Schedule, o as getScheduleMetadata, p as CronOptions, r as ScheduleMetadata, s as hasScheduleMetadata, t as SchedulerService, u as getAllCronMetadata } from "../scheduler.service-pFh29qTy.mjs";
|
|
2
|
+
import { ClassType, Registry } from "@navios/core";
|
|
3
|
+
import { CronJobParams } from "cron";
|
|
4
|
+
import { createClassContext, createMethodContext } from "@navios/core/legacy-compat";
|
|
5
|
+
|
|
6
|
+
//#region src/legacy-compat/decorators/cron.decorator.d.mts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Legacy-compatible Cron decorator.
|
|
10
|
+
*
|
|
11
|
+
* Works with TypeScript experimental decorators (legacy API).
|
|
12
|
+
* Marks a method to run on a cron schedule.
|
|
13
|
+
*
|
|
14
|
+
* @param cronTime - Cron expression (5 or 6 fields) or a pre-defined Schedule constant
|
|
15
|
+
* @param options - Optional configuration for the cron job
|
|
16
|
+
* @returns A method decorator compatible with legacy decorator API
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* @Schedulable()
|
|
21
|
+
* class TaskService {
|
|
22
|
+
* @Cron('0 0 * * *')
|
|
23
|
+
* async dailyTask() {
|
|
24
|
+
* console.log('Running daily task')
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* @Cron(Schedule.EveryFiveMinutes, { disabled: true })
|
|
28
|
+
* async frequentTask() {
|
|
29
|
+
* console.log('Running every 5 minutes')
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare function Cron(cronTime: CronJobParams['cronTime'], options?: CronOptions): <T extends object>(target: T, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => Promise<void>>) => PropertyDescriptor | void;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/legacy-compat/decorators/schedulable.decorator.d.mts
|
|
37
|
+
/**
|
|
38
|
+
* Options for the Schedulable decorator.
|
|
39
|
+
*/
|
|
40
|
+
interface SchedulableOptions {
|
|
41
|
+
/**
|
|
42
|
+
* The registry to register the service with.
|
|
43
|
+
* If not provided, the global registry will be used.
|
|
44
|
+
*/
|
|
45
|
+
registry?: Registry;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Legacy-compatible Schedulable decorator.
|
|
49
|
+
*
|
|
50
|
+
* Works with TypeScript experimental decorators (legacy API).
|
|
51
|
+
* Marks a class as schedulable and makes it injectable.
|
|
52
|
+
*
|
|
53
|
+
* @param options - Optional configuration including the registry to use
|
|
54
|
+
* @returns A class decorator compatible with legacy decorator API
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* @Schedulable()
|
|
59
|
+
* class TaskService {
|
|
60
|
+
* @Cron('0 0 * * *')
|
|
61
|
+
* async dailyTask() {
|
|
62
|
+
* console.log('Running daily task')
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
*
|
|
66
|
+
* // Register the service
|
|
67
|
+
* schedulerService.register(TaskService)
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare function Schedulable(options?: SchedulableOptions): (target: ClassType) => ClassType;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { Cron, type CronMetadata, type CronOptions, Schedulable, type SchedulableOptions, Schedule, type ScheduleMetadata, SchedulerService, createClassContext, createMethodContext, extractScheduleMetadata, getAllCronMetadata, getCronMetadata, getScheduleMetadata, hasScheduleMetadata };
|
|
73
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/legacy-compat/decorators/cron.decorator.mts","../../src/legacy-compat/decorators/schedulable.decorator.mts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAqCA;;;;;;;;;;;AC5BA;AA+BA;;;;;;;;;;;iBDHgB,IAAA,WAAe,qCAAqC,yCAExD,6CAEI,8BAA8B,mBACzC;;;;;;UCjCY,kBAAA;;AD4BjB;;;EAEY,QAAA,CAAA,ECzBC,QDyBD;;;;;;;;AC9BZ;AA+BA;;;;;;;;;;;;;;;;iBAAgB,WAAA,WAAqB,8BACV,cAAS"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { c as hasScheduleMetadata, d as getCronMetadata, i as Cron$1, n as Schedule, o as extractScheduleMetadata, r as Schedulable$1, s as getScheduleMetadata, t as _SchedulerService, u as getAllCronMetadata } from "../scheduler.service-DkyiR8iY.mjs";
|
|
2
|
+
import { createClassContext, createClassContext as createClassContext$1, createMethodContext, createMethodContext as createMethodContext$1 } from "@navios/core/legacy-compat";
|
|
3
|
+
|
|
4
|
+
//#region src/legacy-compat/decorators/cron.decorator.mts
|
|
5
|
+
/**
|
|
6
|
+
* Legacy-compatible Cron decorator.
|
|
7
|
+
*
|
|
8
|
+
* Works with TypeScript experimental decorators (legacy API).
|
|
9
|
+
* Marks a method to run on a cron schedule.
|
|
10
|
+
*
|
|
11
|
+
* @param cronTime - Cron expression (5 or 6 fields) or a pre-defined Schedule constant
|
|
12
|
+
* @param options - Optional configuration for the cron job
|
|
13
|
+
* @returns A method decorator compatible with legacy decorator API
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* @Schedulable()
|
|
18
|
+
* class TaskService {
|
|
19
|
+
* @Cron('0 0 * * *')
|
|
20
|
+
* async dailyTask() {
|
|
21
|
+
* console.log('Running daily task')
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* @Cron(Schedule.EveryFiveMinutes, { disabled: true })
|
|
25
|
+
* async frequentTask() {
|
|
26
|
+
* console.log('Running every 5 minutes')
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/ function Cron(cronTime, options) {
|
|
31
|
+
return function(target, propertyKey, descriptor) {
|
|
32
|
+
if (!descriptor) throw new Error("[Navios] @Cron decorator requires a method descriptor. Make sure experimentalDecorators is enabled.");
|
|
33
|
+
const context = createMethodContext$1(target, propertyKey, descriptor);
|
|
34
|
+
const result = Cron$1(cronTime, options)(descriptor.value, context);
|
|
35
|
+
if (result !== descriptor.value) descriptor.value = result;
|
|
36
|
+
return descriptor;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/legacy-compat/decorators/schedulable.decorator.mts
|
|
42
|
+
/**
|
|
43
|
+
* Legacy-compatible Schedulable decorator.
|
|
44
|
+
*
|
|
45
|
+
* Works with TypeScript experimental decorators (legacy API).
|
|
46
|
+
* Marks a class as schedulable and makes it injectable.
|
|
47
|
+
*
|
|
48
|
+
* @param options - Optional configuration including the registry to use
|
|
49
|
+
* @returns A class decorator compatible with legacy decorator API
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* @Schedulable()
|
|
54
|
+
* class TaskService {
|
|
55
|
+
* @Cron('0 0 * * *')
|
|
56
|
+
* async dailyTask() {
|
|
57
|
+
* console.log('Running daily task')
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* // Register the service
|
|
62
|
+
* schedulerService.register(TaskService)
|
|
63
|
+
* ```
|
|
64
|
+
*/ function Schedulable(options = {}) {
|
|
65
|
+
return function(target) {
|
|
66
|
+
const context = createClassContext$1(target);
|
|
67
|
+
return Schedulable$1(options)(target, context);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { Cron, Schedulable, Schedule, _SchedulerService as SchedulerService, createClassContext, createMethodContext, extractScheduleMetadata, getAllCronMetadata, getCronMetadata, getScheduleMetadata, hasScheduleMetadata };
|
|
73
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["createMethodContext","Cron","OriginalCron","cronTime","options","target","propertyKey","descriptor","Error","context","originalDecorator","result","value","createClassContext","Schedulable","OriginalSchedulable","options","target","context","originalDecorator"],"sources":["../../src/legacy-compat/decorators/cron.decorator.mts","../../src/legacy-compat/decorators/schedulable.decorator.mts"],"sourcesContent":["import type { CronJobParams } from 'cron'\n\nimport { createMethodContext } from '@navios/core/legacy-compat'\n\nimport {\n Cron as OriginalCron,\n type CronOptions,\n} from '../../decorators/cron.decorator.mjs'\n\nexport type { CronOptions }\n\n/**\n * Legacy-compatible Cron decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Marks a method to run on a cron schedule.\n *\n * @param cronTime - Cron expression (5 or 6 fields) or a pre-defined Schedule constant\n * @param options - Optional configuration for the cron job\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Schedulable()\n * class TaskService {\n * @Cron('0 0 * * *')\n * async dailyTask() {\n * console.log('Running daily task')\n * }\n *\n * @Cron(Schedule.EveryFiveMinutes, { disabled: true })\n * async frequentTask() {\n * console.log('Running every 5 minutes')\n * }\n * }\n * ```\n */\nexport function Cron(cronTime: CronJobParams['cronTime'], options?: CronOptions) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: TypedPropertyDescriptor<() => Promise<void>>,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Cron decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalCron(cronTime, options)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n","import type { ClassType, Registry } from '@navios/core'\n\nimport { createClassContext } from '@navios/core/legacy-compat'\n\nimport { Schedulable as OriginalSchedulable } from '../../decorators/schedulable.decorator.mjs'\n\n/**\n * Options for the Schedulable decorator.\n */\nexport interface SchedulableOptions {\n /**\n * The registry to register the service with.\n * If not provided, the global registry will be used.\n */\n registry?: Registry\n}\n\n/**\n * Legacy-compatible Schedulable decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Marks a class as schedulable and makes it injectable.\n *\n * @param options - Optional configuration including the registry to use\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Schedulable()\n * class TaskService {\n * @Cron('0 0 * * *')\n * async dailyTask() {\n * console.log('Running daily task')\n * }\n * }\n *\n * // Register the service\n * schedulerService.register(TaskService)\n * ```\n */\nexport function Schedulable(options: SchedulableOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalSchedulable(options)\n return originalDecorator(target, context)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCA,SAAgBC,KAAKE,UAAqCC,SAAqB;AAC7E,QAAO,SACLC,QACAC,aACAC,YAAwD;AAExD,MAAI,CAACA,WACH,OAAM,IAAIC,MACR,sGAAA;EAGJ,MAAMC,UAAUT,sBAAoBK,QAAQC,aAAaC,WAAAA;EAGzD,MAAMI,SAFoBT,OAAaC,UAAUC,QAAAA,CAEhBG,WAAWK,OAAOH,QAAAA;AACnD,MAAIE,WAAWJ,WAAWK,MACxBL,YAAWK,QAAQD;AAErB,SAAOJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCfX,SAAgBO,YAAYE,UAA8B,EAAE,EAAA;AAC1D,QAAO,SAAUC,QAAiB;EAChC,MAAMC,UAAUL,qBAAmBI,OAAAA;AAEnC,SAD0BF,cAAoBC,QAAAA,CACrBC,QAAQC,QAAAA"}
|