@kingsworld/plugin-cron 5.0.0-next.460a2d1 → 5.0.0-next.607e203

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.
Files changed (66) hide show
  1. package/dist/cjs/{CronTaskHandler-D94YuXWl.cjs → CronTaskHandler-fVZWiMAa.cjs} +10 -10
  2. package/dist/cjs/CronTaskHandler-fVZWiMAa.cjs.map +1 -0
  3. package/dist/cjs/index.cjs +3 -3
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +6 -6
  6. package/dist/cjs/index.d.cts.map +1 -1
  7. package/dist/cjs/lib/CronTaskHandler.cjs +1 -1
  8. package/dist/cjs/lib/CronTaskHandler.d.cts +27 -2
  9. package/dist/cjs/lib/CronTaskHandler.d.cts.map +1 -0
  10. package/dist/cjs/lib/structures/CronTask.cjs +15 -10
  11. package/dist/cjs/lib/structures/CronTask.cjs.map +1 -1
  12. package/dist/cjs/lib/structures/CronTask.d.cts +86 -2
  13. package/dist/cjs/lib/structures/CronTask.d.cts.map +1 -0
  14. package/dist/cjs/lib/structures/CronTaskStore.cjs +1 -4
  15. package/dist/cjs/lib/structures/CronTaskStore.cjs.map +1 -1
  16. package/dist/cjs/lib/structures/CronTaskStore.d.cts +49 -2
  17. package/dist/cjs/lib/structures/CronTaskStore.d.cts.map +1 -0
  18. package/dist/cjs/lib/types/CronTaskTypes.d.cts +27 -2
  19. package/dist/cjs/lib/types/CronTaskTypes.d.cts.map +1 -0
  20. package/dist/cjs/lib/utils/normalizePattern.cjs.map +1 -1
  21. package/dist/cjs/register.cjs +1 -1
  22. package/dist/cjs/register.cjs.map +1 -1
  23. package/dist/cjs/register.d.cts.map +1 -1
  24. package/dist/{cjs/CronTask-DHhctNBr.d.cts → esm/CronTask-yw_82mkr.d.mts} +22 -16
  25. package/dist/esm/CronTask-yw_82mkr.d.mts.map +1 -0
  26. package/dist/esm/{CronTaskHandler-B-JlxyTe.mjs → CronTaskHandler-DL6DRegu.mjs} +10 -10
  27. package/dist/esm/CronTaskHandler-DL6DRegu.mjs.map +1 -0
  28. package/dist/{cjs/CronTaskHandler-vuZq_6em.d.cts → esm/CronTaskHandler-kTcROO_P.d.mts} +7 -6
  29. package/dist/esm/CronTaskHandler-kTcROO_P.d.mts.map +1 -0
  30. package/dist/esm/{CronTaskStore-OcB-CF8h.d.mts → CronTaskStore-Cxdru_tz.d.mts} +2 -5
  31. package/dist/esm/CronTaskStore-Cxdru_tz.d.mts.map +1 -0
  32. package/dist/esm/{CronTaskTypes-DYOJOqEY.d.mts → CronTaskTypes-BRnD-V2d.d.mts} +7 -5
  33. package/dist/esm/CronTaskTypes-BRnD-V2d.d.mts.map +1 -0
  34. package/dist/esm/index.d.mts +6 -6
  35. package/dist/esm/index.d.mts.map +1 -1
  36. package/dist/esm/index.mjs +3 -3
  37. package/dist/esm/index.mjs.map +1 -1
  38. package/dist/esm/lib/CronTaskHandler.d.mts +1 -1
  39. package/dist/esm/lib/CronTaskHandler.mjs +1 -1
  40. package/dist/esm/lib/structures/CronTask.d.mts +1 -1
  41. package/dist/esm/lib/structures/CronTask.mjs +15 -10
  42. package/dist/esm/lib/structures/CronTask.mjs.map +1 -1
  43. package/dist/esm/lib/structures/CronTaskStore.d.mts +1 -1
  44. package/dist/esm/lib/structures/CronTaskStore.mjs +1 -4
  45. package/dist/esm/lib/structures/CronTaskStore.mjs.map +1 -1
  46. package/dist/esm/lib/types/CronTaskTypes.d.mts +1 -1
  47. package/dist/esm/lib/utils/normalizePattern.d.mts.map +1 -1
  48. package/dist/esm/lib/utils/normalizePattern.mjs.map +1 -1
  49. package/dist/esm/register.d.mts.map +1 -1
  50. package/dist/esm/register.mjs +1 -1
  51. package/dist/esm/register.mjs.map +1 -1
  52. package/package.json +6 -4
  53. package/dist/cjs/CronTask-DHhctNBr.d.cts.map +0 -1
  54. package/dist/cjs/CronTaskHandler-D94YuXWl.cjs.map +0 -1
  55. package/dist/cjs/CronTaskHandler-vuZq_6em.d.cts.map +0 -1
  56. package/dist/cjs/CronTaskStore-BF1lvPJM.d.cts +0 -54
  57. package/dist/cjs/CronTaskStore-BF1lvPJM.d.cts.map +0 -1
  58. package/dist/cjs/CronTaskTypes-DOfUFMbV.d.cts +0 -27
  59. package/dist/cjs/CronTaskTypes-DOfUFMbV.d.cts.map +0 -1
  60. package/dist/esm/CronTask-BRxg3jbY.d.mts +0 -80
  61. package/dist/esm/CronTask-BRxg3jbY.d.mts.map +0 -1
  62. package/dist/esm/CronTaskHandler-B-JlxyTe.mjs.map +0 -1
  63. package/dist/esm/CronTaskHandler-BnLFnUd9.d.mts +0 -26
  64. package/dist/esm/CronTaskHandler-BnLFnUd9.d.mts.map +0 -1
  65. package/dist/esm/CronTaskStore-OcB-CF8h.d.mts.map +0 -1
  66. package/dist/esm/CronTaskTypes-DYOJOqEY.d.mts.map +0 -1
@@ -1,54 +0,0 @@
1
-
2
- import { t as CronTask } from "./CronTask-DHhctNBr.cjs";
3
- import { Store } from "@sapphire/pieces";
4
- declare class CronTaskStore extends Store<CronTask, 'cron-tasks'> {
5
- constructor();
6
- /**
7
- * Loops over all tasks and pauses those that are running.
8
- *
9
- * @remarks
10
- * This method will only pause tasks that:
11
- * - Are enabled
12
- * - Are currently running
13
- * - Have not been permanently stopped
14
- *
15
- * @returns CronTaskStore
16
- */
17
- pauseAll(): this;
18
- /**
19
- * Loops over all tasks and resumes those that are paused.
20
- *
21
- * @remarks
22
- * This method will only resume tasks that:
23
- * - Are enabled
24
- * - Are not currently running
25
- * - Have not been permanently stopped
26
- *
27
- * @returns CronTaskStore
28
- */
29
- resumeAll(): this;
30
- /**
31
- * Loops over all tasks and stops those that are running.
32
- *
33
- * @remarks
34
- * This method will only stop tasks that:
35
- * - Are enabled
36
- * - Have not been permanently stopped
37
- *
38
- * ⚠️ Stopping jobs is **permanent** and cannot be resumed afterwards!
39
- *
40
- * @returns CronTaskStore
41
- */
42
- stopAll(): this;
43
- set(key: string, value: CronTask): this;
44
- /**
45
- * Deletes a task from the store and stops it if it's running.
46
- */
47
- delete(key: string): boolean;
48
- /**
49
- * Stops all running cron jobs and clears the store.
50
- */
51
- clear(): void;
52
- }
53
- export { CronTaskStore as t };
54
- //# sourceMappingURL=CronTaskStore-BF1lvPJM.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskStore-BF1lvPJM.d.cts","names":[],"sources":["../../src/lib/structures/CronTaskStore.ts"],"mappings":";;;cAKa,sBAAsB,MAAM;;;;;;;;;;;;;EAgBjC;;;;;;;;;;;;EAqBA;;;;;;;;;;;;;EAsBA;EAUS,IAAI,aAAa,OAAO;;;;EAsDxB,OAAO;;;;EAYP"}
@@ -1,27 +0,0 @@
1
-
2
- import { CronOptions } from "croner";
3
- interface CronTaskHandlerOptions {
4
- /**
5
- * The default IANA timezone to use for all cron jobs.
6
- * You can override this per task, using the timezone option.
7
- */
8
- defaultTimezone?: string;
9
- /**
10
- * The ability to opt-out of instrumenting cron jobs with Sentry.
11
- * If you don't use Sentry, you can ignore this option.
12
- * @see https://docs.sentry.io/product/crons/
13
- * @default false
14
- */
15
- disableSentry: boolean;
16
- }
17
- interface CronJobOptions extends Pick<CronOptions, 'maxRuns' | 'unref' | 'timezone'> {
18
- pattern: string | Date;
19
- /**
20
- * If true, prevents the job from running if the previous execution is still in progress.
21
- * If the task has a protect method, it will be called if the job is blocked.
22
- * @default false
23
- */
24
- protect?: boolean;
25
- }
26
- export { CronTaskHandlerOptions as n, CronJobOptions as t };
27
- //# sourceMappingURL=CronTaskTypes-DOfUFMbV.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskTypes-DOfUFMbV.d.cts","names":[],"sources":["../../src/lib/types/CronTaskTypes.ts"],"mappings":";;UAEiB;;;;;EAKhB;;;;;;;EAQA;;UAGgB,uBAAuB,KAAK;EAC5C,kBAAkB;;;;;;EAMlB"}
@@ -1,80 +0,0 @@
1
- import { t as CronJobOptions } from "./CronTaskTypes-DYOJOqEY.mjs";
2
- import { Piece } from "@sapphire/pieces";
3
- import { Cron } from "croner";
4
- import { Awaitable } from "@sapphire/framework";
5
- /**
6
- * @example
7
- *
8
- * ```typescript
9
- * // ping.ts
10
- * import { CronTask } from '@kingsworld/plugin-cron';
11
- *
12
- * export class PingPong extends CronTask {
13
- * public constructor(context: CronTask.LoaderContext, options: CronTask.Options) {
14
- * super(context, {
15
- * ...options,
16
- * pattern: '* * * * *'
17
- * });
18
- * }
19
- *
20
- * public run() {
21
- * this.info('Ping Pong! 🏓'); // CronTask[ping] Ping Pong! 🏓
22
- * }
23
- * }
24
- * ```
25
- */
26
- declare abstract class CronTask<Options extends CronTask.Options = CronTask.Options> extends Piece<Options, 'cron-tasks'> {
27
- job: Cron;
28
- constructor(context: CronTask.LoaderContext, options: Options);
29
- abstract run(): Awaitable<unknown>;
30
- protect?(job: Cron): Awaitable<unknown>;
31
- catch?(error: unknown, job: Cron): Awaitable<unknown>;
32
- /**
33
- * A helper function to log messages with the `CronTask[${name}]` prefix.
34
- * @param message The message to include after the prefix
35
- * @param other Extra parameters to pass to the logger
36
- * @example
37
- * this.info('Hello world!'); // CronTask[my-task] Hello world!
38
- */
39
- info(message: string, ...other: unknown[]): void;
40
- /**
41
- * A helper function to log messages with the `CronTask[${name}]` prefix.
42
- * @param message The message to include after the prefix
43
- * @param other Extra parameters to pass to the logger
44
- * @example
45
- * this.error('Something went wrong!'); // CronTask[my-task] Something went wrong!
46
- */
47
- error(message: string, ...other: unknown[]): void;
48
- /**
49
- * A helper function to log messages with the `CronTask[${name}]` prefix.
50
- * @param message The message to include after the prefix
51
- * @param other Extra parameters to pass to the logger
52
- * @example
53
- * this.warn('Something is not right!'); // CronTask[my-task] Something is not right!
54
- */
55
- warn(message: string, ...other: unknown[]): void;
56
- /**
57
- * A helper function to log messages with the `CronTask[${name}]` prefix.
58
- * @param message The message to include after the prefix
59
- * @param other Extra parameters to pass to the logger
60
- * @example
61
- * this.debug('Something is happening!'); // CronTask[my-task] Something is happening!
62
- */
63
- debug(message: string, ...other: unknown[]): void;
64
- /**
65
- * A helper function to log messages with the `CronTask[${name}]` prefix.
66
- * @param message The message to include after the prefix
67
- * @param other Extra parameters to pass to the logger
68
- * @example
69
- * this.trace('Loaded the file.'); // CronTask[my-task] Loaded the file.
70
- */
71
- trace(message: string, ...other: unknown[]): void;
72
- }
73
- declare namespace CronTask {
74
- type Options = Piece.Options & CronJobOptions;
75
- /** @deprecated Use {@linkcode LoaderContext} instead. */
76
- type Context = LoaderContext;
77
- type LoaderContext = Piece.LoaderContext<'cron-tasks'>;
78
- }
79
- export { CronTask as t };
80
- //# sourceMappingURL=CronTask-BRxg3jbY.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTask-BRxg3jbY.d.mts","names":[],"sources":["../../src/lib/structures/CronTask.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;uBA0BA,SAAA,gBAAA,SAAA,UAAA,SAAA,iBAAA,MAAA;EAAA,KAAA;EAAA,YAAA,SAAA,SAAA,eAAA,SAAA;WAAA,OAAA;EAAA,SAAA,KAAA,OAAA;EAAA,OAAA,gBAAA,KAAA,OAAA;;;;;;;;EAAA,KAAA,oBAAA;;;;;;;;EAAA,MAAA,oBAAA;;;;;;;;EAAA,KAAA,oBAAA;;;;;;;;EAAA,MAAA,oBAAA;;;;;;;;EAAA,MAAA,oBAAA;;kBAqEA;OAAA,UAAA,MAAA,UAAA;;OAAA,UAAA;OAAA,gBAAA,MAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskHandler-B-JlxyTe.mjs","names":[],"sources":["../../src/lib/CronTaskHandler.ts"],"sourcesContent":["import type Sentry from '@sentry/node';\nimport type { CronTaskHandlerOptions } from './types/CronTaskTypes';\n\nexport class CronTaskHandler {\n\t/**\n\t * The default IANA/TZ timezone to use for all cron jobs.\n\t * You can override this per task, using the timezone option.\n\t * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n\t */\n\tpublic defaultTimezone?: CronTaskHandlerOptions['defaultTimezone'];\n\n\t/**\n\t * The ability to opt-out of instrumenting cron jobs with Sentry.\n\t * If you don't use Sentry, you can ignore this option.\n\t * @see https://docs.sentry.io/product/crons/\n\t * @default false\n\t */\n\tpublic disableSentry: boolean;\n\n\t/**\n\t * The Sentry instance to use for instrumenting cron jobs.\n\t * This is only available when [`@sentry/node`](https://www.npmjs.com/package/@sentry/node)\n\t * is installed and the {@linkcode disableSentry} option is set to false.\n\t */\n\tpublic sentry?: typeof Sentry;\n\n\tpublic constructor(options?: Partial<CronTaskHandlerOptions>) {\n\t\tthis.defaultTimezone = options?.defaultTimezone;\n\t\tthis.disableSentry = options?.disableSentry ?? false;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAA,kBAAA,MAAA;CAuBA,AAAA,YAAA,SAAA;wBAjBA;wBAQA;wBAOA;EAGA,KAAA,kBAAA,SAAA;EACA,KAAA,gBAAA,SAAA,iBAAA;CACA;AACA"}
@@ -1,26 +0,0 @@
1
- import { n as CronTaskHandlerOptions } from "./CronTaskTypes-DYOJOqEY.mjs";
2
- import Sentry from "@sentry/node";
3
- declare class CronTaskHandler {
4
- /**
5
- * The default IANA/TZ timezone to use for all cron jobs.
6
- * You can override this per task, using the timezone option.
7
- * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
8
- */
9
- defaultTimezone?: CronTaskHandlerOptions['defaultTimezone'];
10
- /**
11
- * The ability to opt-out of instrumenting cron jobs with Sentry.
12
- * If you don't use Sentry, you can ignore this option.
13
- * @see https://docs.sentry.io/product/crons/
14
- * @default false
15
- */
16
- disableSentry: boolean;
17
- /**
18
- * The Sentry instance to use for instrumenting cron jobs.
19
- * This is only available when [`@sentry/node`](https://www.npmjs.com/package/@sentry/node)
20
- * is installed and the {@linkcode disableSentry} option is set to false.
21
- */
22
- sentry?: typeof Sentry;
23
- constructor(options?: Partial<CronTaskHandlerOptions>);
24
- }
25
- export { CronTaskHandler as t };
26
- //# sourceMappingURL=CronTaskHandler-BnLFnUd9.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskHandler-BnLFnUd9.d.mts","names":[],"sources":["../../src/lib/CronTaskHandler.ts"],"mappings":";;cAGA;;;;;;EAAA,kBAAA;;;;;;;EAAA;;;;;;EAAA,gBAAA;EAAA,YAAA,UAAA,QAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskStore-OcB-CF8h.d.mts","names":[],"sources":["../../src/lib/structures/CronTaskStore.ts"],"mappings":";;cAKA,sBAAA,MAAA;EAAA;;;;;;;;;;;;EAAA;;;;;;;;;;;;EAAA;;;;;;;;;;;;;EAAA;EAAA,IAAA,aAAA,OAAA;;;;EAAA,OAAA;;;;EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskTypes-DYOJOqEY.d.mts","names":[],"sources":["../../src/lib/types/CronTaskTypes.ts"],"mappings":";UAEA;;;;;EAAA;;;;;;;EAAA;;UAgBA,uBAAA,KAAA;EAAA,kBAAA;;;;;;EAAA"}