@kingsworld/plugin-cron 5.0.0-next.e2560b0 → 5.0.0-pr-407.31c4495

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 (79) hide show
  1. package/dist/{esm/CronTask-BRxg3jbY.d.mts → CronTask-ZNM8cdWX.d.mts} +18 -15
  2. package/dist/CronTask-ZNM8cdWX.d.mts.map +1 -0
  3. package/dist/{esm/CronTaskHandler-BnLFnUd9.d.mts → CronTaskHandler-kTcROO_P.d.mts} +7 -5
  4. package/dist/CronTaskHandler-kTcROO_P.d.mts.map +1 -0
  5. package/dist/{esm/CronTaskStore-OcB-CF8h.d.mts → CronTaskStore-UolcmAmj.d.mts} +2 -5
  6. package/dist/CronTaskStore-UolcmAmj.d.mts.map +1 -0
  7. package/dist/{esm/CronTaskTypes-DYOJOqEY.d.mts → CronTaskTypes-BRnD-V2d.d.mts} +7 -5
  8. package/dist/CronTaskTypes-BRnD-V2d.d.mts.map +1 -0
  9. package/dist/{esm/index.d.mts → index.d.mts} +6 -6
  10. package/dist/index.d.mts.map +1 -0
  11. package/dist/{esm/index.mjs → index.mjs} +3 -3
  12. package/dist/index.mjs.map +1 -0
  13. package/dist/lib/CronTaskHandler.d.mts +2 -0
  14. package/dist/lib/CronTaskHandler.mjs +31 -0
  15. package/dist/lib/CronTaskHandler.mjs.map +1 -0
  16. package/dist/lib/structures/CronTask.d.mts +2 -0
  17. package/dist/{esm/lib → lib}/structures/CronTask.mjs +15 -10
  18. package/dist/lib/structures/CronTask.mjs.map +1 -0
  19. package/dist/lib/structures/CronTaskStore.d.mts +2 -0
  20. package/dist/{esm/lib → lib}/structures/CronTaskStore.mjs +1 -4
  21. package/dist/lib/structures/CronTaskStore.mjs.map +1 -0
  22. package/dist/lib/types/CronTaskTypes.d.mts +2 -0
  23. package/dist/lib/utils/normalizePattern.d.mts.map +1 -0
  24. package/dist/lib/utils/normalizePattern.mjs.map +1 -0
  25. package/dist/register.d.mts.map +1 -0
  26. package/dist/{esm/register.mjs → register.mjs} +1 -1
  27. package/dist/register.mjs.map +1 -0
  28. package/package.json +13 -23
  29. package/dist/cjs/CronTaskHandler-fVZWiMAa.cjs +0 -58
  30. package/dist/cjs/CronTaskHandler-fVZWiMAa.cjs.map +0 -1
  31. package/dist/cjs/index.cjs +0 -21
  32. package/dist/cjs/index.cjs.map +0 -1
  33. package/dist/cjs/index.d.cts +0 -27
  34. package/dist/cjs/index.d.cts.map +0 -1
  35. package/dist/cjs/lib/CronTaskHandler.cjs +0 -6
  36. package/dist/cjs/lib/CronTaskHandler.d.cts +0 -26
  37. package/dist/cjs/lib/CronTaskHandler.d.cts.map +0 -1
  38. package/dist/cjs/lib/structures/CronTask.cjs +0 -85
  39. package/dist/cjs/lib/structures/CronTask.cjs.map +0 -1
  40. package/dist/cjs/lib/structures/CronTask.d.cts +0 -80
  41. package/dist/cjs/lib/structures/CronTask.d.cts.map +0 -1
  42. package/dist/cjs/lib/structures/CronTaskStore.cjs +0 -127
  43. package/dist/cjs/lib/structures/CronTaskStore.cjs.map +0 -1
  44. package/dist/cjs/lib/structures/CronTaskStore.d.cts +0 -53
  45. package/dist/cjs/lib/structures/CronTaskStore.d.cts.map +0 -1
  46. package/dist/cjs/lib/types/CronTaskTypes.cjs +0 -2
  47. package/dist/cjs/lib/types/CronTaskTypes.d.cts +0 -26
  48. package/dist/cjs/lib/types/CronTaskTypes.d.cts.map +0 -1
  49. package/dist/cjs/lib/utils/normalizePattern.cjs +0 -41
  50. package/dist/cjs/lib/utils/normalizePattern.cjs.map +0 -1
  51. package/dist/cjs/lib/utils/normalizePattern.d.cts +0 -3
  52. package/dist/cjs/lib/utils/normalizePattern.d.cts.map +0 -1
  53. package/dist/cjs/register.cjs +0 -31
  54. package/dist/cjs/register.cjs.map +0 -1
  55. package/dist/cjs/register.d.cts +0 -11
  56. package/dist/cjs/register.d.cts.map +0 -1
  57. package/dist/esm/CronTask-BRxg3jbY.d.mts.map +0 -1
  58. package/dist/esm/CronTaskHandler-BnLFnUd9.d.mts.map +0 -1
  59. package/dist/esm/CronTaskHandler-DL6DRegu.mjs +0 -51
  60. package/dist/esm/CronTaskHandler-DL6DRegu.mjs.map +0 -1
  61. package/dist/esm/CronTaskStore-OcB-CF8h.d.mts.map +0 -1
  62. package/dist/esm/CronTaskTypes-DYOJOqEY.d.mts.map +0 -1
  63. package/dist/esm/index.d.mts.map +0 -1
  64. package/dist/esm/index.mjs.map +0 -1
  65. package/dist/esm/lib/CronTaskHandler.d.mts +0 -2
  66. package/dist/esm/lib/CronTaskHandler.mjs +0 -3
  67. package/dist/esm/lib/structures/CronTask.d.mts +0 -2
  68. package/dist/esm/lib/structures/CronTask.mjs.map +0 -1
  69. package/dist/esm/lib/structures/CronTaskStore.d.mts +0 -2
  70. package/dist/esm/lib/structures/CronTaskStore.mjs.map +0 -1
  71. package/dist/esm/lib/types/CronTaskTypes.d.mts +0 -2
  72. package/dist/esm/lib/utils/normalizePattern.d.mts.map +0 -1
  73. package/dist/esm/lib/utils/normalizePattern.mjs.map +0 -1
  74. package/dist/esm/register.d.mts.map +0 -1
  75. package/dist/esm/register.mjs.map +0 -1
  76. /package/dist/{esm/lib → lib}/types/CronTaskTypes.mjs +0 -0
  77. /package/dist/{esm/lib → lib}/utils/normalizePattern.d.mts +0 -0
  78. /package/dist/{esm/lib → lib}/utils/normalizePattern.mjs +0 -0
  79. /package/dist/{esm/register.d.mts → register.d.mts} +0 -0
@@ -1,4 +1,4 @@
1
- import { t as CronJobOptions } from "./CronTaskTypes-DYOJOqEY.mjs";
1
+ import { t as CronJobOptions } from "./CronTaskTypes-BRnD-V2d.mjs";
2
2
  import { Piece } from "@sapphire/pieces";
3
3
  import { Cron } from "croner";
4
4
  import { Awaitable } from "@sapphire/framework";
@@ -31,50 +31,53 @@ declare abstract class CronTask<Options extends CronTask.Options = CronTask.Opti
31
31
  catch?(error: unknown, job: Cron): Awaitable<unknown>;
32
32
  /**
33
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
34
+ *
35
+ * @param message - The message to include after the prefix
36
+ * @param other - Extra parameters to pass to the logger
36
37
  * @example
37
38
  * this.info('Hello world!'); // CronTask[my-task] Hello world!
38
39
  */
39
40
  info(message: string, ...other: unknown[]): void;
40
41
  /**
41
42
  * 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
43
+ *
44
+ * @param message - The message to include after the prefix
45
+ * @param other - Extra parameters to pass to the logger
44
46
  * @example
45
47
  * this.error('Something went wrong!'); // CronTask[my-task] Something went wrong!
46
48
  */
47
49
  error(message: string, ...other: unknown[]): void;
48
50
  /**
49
51
  * 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
+ *
53
+ * @param message - The message to include after the prefix
54
+ * @param other - Extra parameters to pass to the logger
52
55
  * @example
53
56
  * this.warn('Something is not right!'); // CronTask[my-task] Something is not right!
54
57
  */
55
58
  warn(message: string, ...other: unknown[]): void;
56
59
  /**
57
60
  * 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
61
+ *
62
+ * @param message - The message to include after the prefix
63
+ * @param other - Extra parameters to pass to the logger
60
64
  * @example
61
65
  * this.debug('Something is happening!'); // CronTask[my-task] Something is happening!
62
66
  */
63
67
  debug(message: string, ...other: unknown[]): void;
64
68
  /**
65
69
  * 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
70
+ *
71
+ * @param message - The message to include after the prefix
72
+ * @param other - Extra parameters to pass to the logger
68
73
  * @example
69
74
  * this.trace('Loaded the file.'); // CronTask[my-task] Loaded the file.
70
75
  */
71
76
  trace(message: string, ...other: unknown[]): void;
72
77
  }
73
78
  declare namespace CronTask {
74
- type Options = Piece.Options & CronJobOptions;
75
- /** @deprecated Use {@linkcode LoaderContext} instead. */
76
- type Context = LoaderContext;
79
+ type Options = CronJobOptions & Piece.Options;
77
80
  type LoaderContext = Piece.LoaderContext<'cron-tasks'>;
78
81
  }
79
82
  export { CronTask as t };
80
- //# sourceMappingURL=CronTask-BRxg3jbY.d.mts.map
83
+ //# sourceMappingURL=CronTask-ZNM8cdWX.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTask-ZNM8cdWX.d.mts","names":[],"sources":["../src/lib/structures/CronTask.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;uBA0BsB,SAAS,gBAAgB,SAAS,UAAU,SAAS,iBAAiB,MAAM;EAClF,KAAK;EAED,YAAA,SAAS,SAAS,eAAe,SAAS;WAI7C,OAAO;EAEhB,SAAS,KAAK,OAAO;EAErB,OAAO,gBAAgB,KAAK,OAAO;;;;;;;;;EAUnC,KAAK,oBAAoB;;;;;;;;;EAYzB,MAAM,oBAAoB;;;;;;;;;EAY1B,KAAK,oBAAoB;;;;;;;;;EAYzB,MAAM,oBAAoB;;;;;;;;;EAY1B,MAAM,oBAAoB;;kBAKT;OACZ,UAAU,iBAAiB,MAAM;OACjC,gBAAgB,MAAM"}
@@ -1,26 +1,28 @@
1
- import { n as CronTaskHandlerOptions } from "./CronTaskTypes-DYOJOqEY.mjs";
1
+ import { n as CronTaskHandlerOptions } from "./CronTaskTypes-BRnD-V2d.mjs";
2
2
  import Sentry from "@sentry/node";
3
3
  declare class CronTaskHandler {
4
4
  /**
5
5
  * The default IANA/TZ timezone to use for all cron jobs.
6
6
  * You can override this per task, using the timezone option.
7
+ *
7
8
  * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
8
9
  */
9
10
  defaultTimezone?: CronTaskHandlerOptions['defaultTimezone'];
10
11
  /**
11
12
  * The ability to opt-out of instrumenting cron jobs with Sentry.
12
13
  * If you don't use Sentry, you can ignore this option.
14
+ *
13
15
  * @see https://docs.sentry.io/product/crons/
14
- * @default false
16
+ * @defaultValue false
15
17
  */
16
18
  disableSentry: boolean;
17
19
  /**
18
20
  * 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
+ * This is only available when [`@sentry/node`](https://www.npmjs.com/package/\@sentry/node)
22
+ * is installed and the {@link CronTaskHandler.disableSentry | `disableSentry`} option is set to false.
21
23
  */
22
24
  sentry?: typeof Sentry;
23
25
  constructor(options?: Partial<CronTaskHandlerOptions>);
24
26
  }
25
27
  export { CronTaskHandler as t };
26
- //# sourceMappingURL=CronTaskHandler-BnLFnUd9.d.mts.map
28
+ //# sourceMappingURL=CronTaskHandler-kTcROO_P.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTaskHandler-kTcROO_P.d.mts","names":[],"sources":["../src/lib/CronTaskHandler.ts"],"mappings":";;cAGa;;;;;;;EAOL,kBAAkB;;;;;;;;EASlB;;;;;;EAOA,gBAAgB;EAEJ,YAAA,UAAU,QAAQ"}
@@ -1,4 +1,4 @@
1
- import { t as CronTask } from "./CronTask-BRxg3jbY.mjs";
1
+ import { t as CronTask } from "./CronTask-ZNM8cdWX.mjs";
2
2
  import { Store } from "@sapphire/pieces";
3
3
  declare class CronTaskStore extends Store<CronTask, 'cron-tasks'> {
4
4
  constructor();
@@ -10,7 +10,6 @@ declare class CronTaskStore extends Store<CronTask, 'cron-tasks'> {
10
10
  * - Are enabled
11
11
  * - Are currently running
12
12
  * - Have not been permanently stopped
13
- *
14
13
  * @returns CronTaskStore
15
14
  */
16
15
  pauseAll(): this;
@@ -22,7 +21,6 @@ declare class CronTaskStore extends Store<CronTask, 'cron-tasks'> {
22
21
  * - Are enabled
23
22
  * - Are not currently running
24
23
  * - Have not been permanently stopped
25
- *
26
24
  * @returns CronTaskStore
27
25
  */
28
26
  resumeAll(): this;
@@ -35,7 +33,6 @@ declare class CronTaskStore extends Store<CronTask, 'cron-tasks'> {
35
33
  * - Have not been permanently stopped
36
34
  *
37
35
  * ⚠️ Stopping jobs is **permanent** and cannot be resumed afterwards!
38
- *
39
36
  * @returns CronTaskStore
40
37
  */
41
38
  stopAll(): this;
@@ -50,4 +47,4 @@ declare class CronTaskStore extends Store<CronTask, 'cron-tasks'> {
50
47
  clear(): void;
51
48
  }
52
49
  export { CronTaskStore as t };
53
- //# sourceMappingURL=CronTaskStore-OcB-CF8h.d.mts.map
50
+ //# sourceMappingURL=CronTaskStore-UolcmAmj.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTaskStore-UolcmAmj.d.mts","names":[],"sources":["../src/lib/structures/CronTaskStore.ts"],"mappings":";;cAKa,sBAAsB,MAAM;;;;;;;;;;;;EAejC;;;;;;;;;;;EAoBA;;;;;;;;;;;;EAqBA;EAUS,IAAI,aAAa,OAAO;;;;EAsDxB,OAAO;;;;EAYP"}
@@ -8,19 +8,21 @@ interface CronTaskHandlerOptions {
8
8
  /**
9
9
  * The ability to opt-out of instrumenting cron jobs with Sentry.
10
10
  * If you don't use Sentry, you can ignore this option.
11
+ *
11
12
  * @see https://docs.sentry.io/product/crons/
12
- * @default false
13
+ * @defaultValue false
13
14
  */
14
15
  disableSentry: boolean;
15
16
  }
16
- interface CronJobOptions extends Pick<CronOptions, 'maxRuns' | 'unref' | 'timezone'> {
17
- pattern: string | Date;
17
+ interface CronJobOptions extends Pick<CronOptions, 'maxRuns' | 'timezone' | 'unref'> {
18
+ pattern: Date | string;
18
19
  /**
19
20
  * If true, prevents the job from running if the previous execution is still in progress.
20
21
  * If the task has a protect method, it will be called if the job is blocked.
21
- * @default false
22
+ *
23
+ * @defaultValue false
22
24
  */
23
25
  protect?: boolean;
24
26
  }
25
27
  export { CronTaskHandlerOptions as n, CronJobOptions as t };
26
- //# sourceMappingURL=CronTaskTypes-DYOJOqEY.d.mts.map
28
+ //# sourceMappingURL=CronTaskTypes-BRnD-V2d.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTaskTypes-BRnD-V2d.d.mts","names":[],"sources":["../src/lib/types/CronTaskTypes.ts"],"mappings":";UAEiB;;;;;EAKhB;;;;;;;;EASA;;UAGgB,uBAAuB,KAAK;EAC5C,SAAS;;;;;;;EAOT"}
@@ -1,7 +1,7 @@
1
- import { t as CronTaskStore } from "./CronTaskStore-OcB-CF8h.mjs";
2
- import { t as CronTaskHandler } from "./CronTaskHandler-BnLFnUd9.mjs";
3
- import { n as CronTaskHandlerOptions, t as CronJobOptions } from "./CronTaskTypes-DYOJOqEY.mjs";
4
- import { t as CronTask } from "./CronTask-BRxg3jbY.mjs";
1
+ import { t as CronTaskStore } from "./CronTaskStore-UolcmAmj.mjs";
2
+ import { t as CronTaskHandler } from "./CronTaskHandler-kTcROO_P.mjs";
3
+ import { n as CronTaskHandlerOptions, t as CronJobOptions } from "./CronTaskTypes-BRnD-V2d.mjs";
4
+ import { t as CronTask } from "./CronTask-ZNM8cdWX.mjs";
5
5
  declare module '@sapphire/pieces' {
6
6
  interface Container {
7
7
  cronTasks: CronTaskHandler;
@@ -16,11 +16,11 @@ declare module 'discord.js' {
16
16
  }
17
17
  }
18
18
  /**
19
- * The [@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.
19
+ * The [\@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.
20
20
  * An example use of this is showing it of in a bot information command.
21
21
  *
22
22
  * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild
23
23
  */
24
24
  export declare const version: string;
25
- export { CronJobOptions, CronTask, CronTaskHandler, CronTaskHandlerOptions, CronTaskStore };
25
+ export { type CronJobOptions, CronTask, CronTaskHandler, type CronTaskHandlerOptions, CronTaskStore };
26
26
  //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;YAUW;IACT,WAAW;;YAGF;IACT,cAAc;;;;YAKE;IAChB,YAAY,QAAQ;;;;;;;;;qBAWT"}
@@ -1,15 +1,15 @@
1
- import { t as CronTaskHandler } from "./CronTaskHandler-DL6DRegu.mjs";
1
+ import { CronTaskHandler } from "./lib/CronTaskHandler.mjs";
2
2
  import { CronTask } from "./lib/structures/CronTask.mjs";
3
3
  import { CronTaskStore } from "./lib/structures/CronTaskStore.mjs";
4
4
 
5
5
  // src/index.ts
6
6
  /**
7
- * The [@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.
7
+ * The [\@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.
8
8
  * An example use of this is showing it of in a bot information command.
9
9
  *
10
10
  * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild
11
11
  */
12
- const version = "5.0.0-next.e2560b0";
12
+ const version = "5.0.0-pr-407.31c4495";
13
13
 
14
14
  export { CronTask, CronTaskHandler, CronTaskStore, version };
15
15
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { CronTaskStore } from './lib/structures/CronTaskStore';\nimport type { CronTaskHandler } from './lib/CronTaskHandler';\nimport type { CronTaskHandlerOptions } from './lib/types/CronTaskTypes';\n\nexport * from './lib/CronTaskHandler';\nexport * from './lib/structures/CronTask';\nexport * from './lib/structures/CronTaskStore';\nexport type * from './lib/types/CronTaskTypes';\n\ndeclare module '@sapphire/pieces' {\n\tinterface Container {\n\t\tcronTasks: CronTaskHandler;\n\t}\n\n\tinterface StoreRegistryEntries {\n\t\t'cron-tasks': CronTaskStore;\n\t}\n}\n\ndeclare module 'discord.js' {\n\texport interface ClientOptions {\n\t\tcronTasks?: Partial<CronTaskHandlerOptions>;\n\t}\n}\n\n/**\n * The [\\@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '[VI]{{inject}}[/VI]';\n"],"mappings":";;;;;;;;;;;AAgCA,MAAa,UAAkB"}
@@ -0,0 +1,2 @@
1
+ import { t as CronTaskHandler } from "../CronTaskHandler-kTcROO_P.mjs";
2
+ export { CronTaskHandler };
@@ -0,0 +1,31 @@
1
+ // src/lib/CronTaskHandler.ts
2
+ var CronTaskHandler = class {
3
+ /**
4
+ * The default IANA/TZ timezone to use for all cron jobs.
5
+ * You can override this per task, using the timezone option.
6
+ *
7
+ * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
8
+ */
9
+ 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
+ *
14
+ * @see https://docs.sentry.io/product/crons/
15
+ * @defaultValue false
16
+ */
17
+ disableSentry;
18
+ /**
19
+ * The Sentry instance to use for instrumenting cron jobs.
20
+ * This is only available when [`@sentry/node`](https://www.npmjs.com/package/\@sentry/node)
21
+ * is installed and the {@link CronTaskHandler.disableSentry | `disableSentry`} option is set to false.
22
+ */
23
+ sentry;
24
+ constructor(options) {
25
+ this.defaultTimezone = options?.defaultTimezone;
26
+ this.disableSentry = options?.disableSentry ?? false;
27
+ }
28
+ };
29
+
30
+ export { CronTaskHandler };
31
+ //# sourceMappingURL=CronTaskHandler.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTaskHandler.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 *\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 *\n\t * @see https://docs.sentry.io/product/crons/\n\t * @defaultValue 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 {@link CronTaskHandler.disableSentry | `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,kBAAb,MAA6B;;;;;;;CAOrB;;;;;;;;CASA;;;;;;CAOA;CAEA,YAAY,SAA2C;EAC7D,KAAK,kBAAkB,SAAS;EAChC,KAAK,gBAAgB,SAAS,iBAAiB;CAChD;AACD"}
@@ -0,0 +1,2 @@
1
+ import { t as CronTask } from "../../CronTask-ZNM8cdWX.mjs";
2
+ export { CronTask };
@@ -28,8 +28,9 @@ var CronTask = class extends Piece {
28
28
  }
29
29
  /**
30
30
  * A helper function to log messages with the `CronTask[${name}]` prefix.
31
- * @param message The message to include after the prefix
32
- * @param other Extra parameters to pass to the logger
31
+ *
32
+ * @param message - The message to include after the prefix
33
+ * @param other - Extra parameters to pass to the logger
33
34
  * @example
34
35
  * this.info('Hello world!'); // CronTask[my-task] Hello world!
35
36
  */
@@ -38,8 +39,9 @@ var CronTask = class extends Piece {
38
39
  }
39
40
  /**
40
41
  * A helper function to log messages with the `CronTask[${name}]` prefix.
41
- * @param message The message to include after the prefix
42
- * @param other Extra parameters to pass to the logger
42
+ *
43
+ * @param message - The message to include after the prefix
44
+ * @param other - Extra parameters to pass to the logger
43
45
  * @example
44
46
  * this.error('Something went wrong!'); // CronTask[my-task] Something went wrong!
45
47
  */
@@ -48,8 +50,9 @@ var CronTask = class extends Piece {
48
50
  }
49
51
  /**
50
52
  * A helper function to log messages with the `CronTask[${name}]` prefix.
51
- * @param message The message to include after the prefix
52
- * @param other Extra parameters to pass to the logger
53
+ *
54
+ * @param message - The message to include after the prefix
55
+ * @param other - Extra parameters to pass to the logger
53
56
  * @example
54
57
  * this.warn('Something is not right!'); // CronTask[my-task] Something is not right!
55
58
  */
@@ -58,8 +61,9 @@ var CronTask = class extends Piece {
58
61
  }
59
62
  /**
60
63
  * A helper function to log messages with the `CronTask[${name}]` prefix.
61
- * @param message The message to include after the prefix
62
- * @param other Extra parameters to pass to the logger
64
+ *
65
+ * @param message - The message to include after the prefix
66
+ * @param other - Extra parameters to pass to the logger
63
67
  * @example
64
68
  * this.debug('Something is happening!'); // CronTask[my-task] Something is happening!
65
69
  */
@@ -68,8 +72,9 @@ var CronTask = class extends Piece {
68
72
  }
69
73
  /**
70
74
  * A helper function to log messages with the `CronTask[${name}]` prefix.
71
- * @param message The message to include after the prefix
72
- * @param other Extra parameters to pass to the logger
75
+ *
76
+ * @param message - The message to include after the prefix
77
+ * @param other - Extra parameters to pass to the logger
73
78
  * @example
74
79
  * this.trace('Loaded the file.'); // CronTask[my-task] Loaded the file.
75
80
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTask.mjs","names":[],"sources":["../../../src/lib/structures/CronTask.ts"],"sourcesContent":["import type { Awaitable } from '@sapphire/framework';\nimport { Piece } from '@sapphire/pieces';\nimport type { Cron } from 'croner';\nimport type { CronJobOptions } from '../types/CronTaskTypes';\n\n/**\n * @example\n *\n * ```typescript\n * // ping.ts\n * import { CronTask } from '@kingsworld/plugin-cron';\n *\n * export class PingPong extends CronTask {\n * \tpublic constructor(context: CronTask.LoaderContext, options: CronTask.Options) {\n * \t\tsuper(context, {\n * \t\t\t...options,\n * \t\t\tpattern: '* * * * *'\n * \t\t});\n * \t}\n *\n * \tpublic run() {\n * \t\tthis.info('Ping Pong! 🏓'); // CronTask[ping] Ping Pong! 🏓\n * \t}\n * }\n * ```\n */\nexport abstract class CronTask<Options extends CronTask.Options = CronTask.Options> extends Piece<Options, 'cron-tasks'> {\n\tdeclare public job: Cron;\n\n\tpublic constructor(context: CronTask.LoaderContext, options: Options) {\n\t\tsuper(context, options);\n\t}\n\n\tpublic abstract run(): Awaitable<unknown>;\n\n\tpublic protect?(job: Cron): Awaitable<unknown>;\n\n\tpublic catch?(error: unknown, job: Cron): Awaitable<unknown>;\n\n\t/**\n\t * A helper function to log messages with the `CronTask[${name}]` prefix.\n\t *\n\t * @param message - The message to include after the prefix\n\t * @param other - Extra parameters to pass to the logger\n\t * @example\n\t * this.info('Hello world!'); // CronTask[my-task] Hello world!\n\t */\n\tpublic info(message: string, ...other: unknown[]) {\n\t\tthis.container.logger.info(`CronTask[${this.name}] ${message}`, ...other);\n\t}\n\n\t/**\n\t * A helper function to log messages with the `CronTask[${name}]` prefix.\n\t *\n\t * @param message - The message to include after the prefix\n\t * @param other - Extra parameters to pass to the logger\n\t * @example\n\t * this.error('Something went wrong!'); // CronTask[my-task] Something went wrong!\n\t */\n\tpublic error(message: string, ...other: unknown[]) {\n\t\tthis.container.logger.error(`CronTask[${this.name}] ${message}`, ...other);\n\t}\n\n\t/**\n\t * A helper function to log messages with the `CronTask[${name}]` prefix.\n\t *\n\t * @param message - The message to include after the prefix\n\t * @param other - Extra parameters to pass to the logger\n\t * @example\n\t * this.warn('Something is not right!'); // CronTask[my-task] Something is not right!\n\t */\n\tpublic warn(message: string, ...other: unknown[]) {\n\t\tthis.container.logger.warn(`CronTask[${this.name}] ${message}`, ...other);\n\t}\n\n\t/**\n\t * A helper function to log messages with the `CronTask[${name}]` prefix.\n\t *\n\t * @param message - The message to include after the prefix\n\t * @param other - Extra parameters to pass to the logger\n\t * @example\n\t * this.debug('Something is happening!'); // CronTask[my-task] Something is happening!\n\t */\n\tpublic debug(message: string, ...other: unknown[]) {\n\t\tthis.container.logger.debug(`CronTask[${this.name}] ${message}`, ...other);\n\t}\n\n\t/**\n\t * A helper function to log messages with the `CronTask[${name}]` prefix.\n\t *\n\t * @param message - The message to include after the prefix\n\t * @param other - Extra parameters to pass to the logger\n\t * @example\n\t * this.trace('Loaded the file.'); // CronTask[my-task] Loaded the file.\n\t */\n\tpublic trace(message: string, ...other: unknown[]) {\n\t\tthis.container.logger.trace(`CronTask[${this.name}] ${message}`, ...other);\n\t}\n}\n\nexport declare namespace CronTask {\n\texport type Options = CronJobOptions & Piece.Options;\n\texport type LoaderContext = Piece.LoaderContext<'cron-tasks'>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAsB,WAAtB,cAA4F,MAA6B;CAGjH,YAAY,SAAiC,SAAkB;EACrE,MAAM,SAAS,OAAO;CACvB;;;;;;;;;CAgBO,KAAK,SAAiB,GAAG,OAAkB;EACjD,KAAK,UAAU,OAAO,KAAK,YAAY,KAAK,KAAK,IAAI,WAAW,GAAG,KAAK;CACzE;;;;;;;;;CAUO,MAAM,SAAiB,GAAG,OAAkB;EAClD,KAAK,UAAU,OAAO,MAAM,YAAY,KAAK,KAAK,IAAI,WAAW,GAAG,KAAK;CAC1E;;;;;;;;;CAUO,KAAK,SAAiB,GAAG,OAAkB;EACjD,KAAK,UAAU,OAAO,KAAK,YAAY,KAAK,KAAK,IAAI,WAAW,GAAG,KAAK;CACzE;;;;;;;;;CAUO,MAAM,SAAiB,GAAG,OAAkB;EAClD,KAAK,UAAU,OAAO,MAAM,YAAY,KAAK,KAAK,IAAI,WAAW,GAAG,KAAK;CAC1E;;;;;;;;;CAUO,MAAM,SAAiB,GAAG,OAAkB;EAClD,KAAK,UAAU,OAAO,MAAM,YAAY,KAAK,KAAK,IAAI,WAAW,GAAG,KAAK;CAC1E;AACD"}
@@ -0,0 +1,2 @@
1
+ import { t as CronTaskStore } from "../../CronTaskStore-UolcmAmj.mjs";
2
+ export { CronTaskStore };
@@ -16,7 +16,6 @@ var CronTaskStore = class extends Store {
16
16
  * - Are enabled
17
17
  * - Are currently running
18
18
  * - Have not been permanently stopped
19
- *
20
19
  * @returns CronTaskStore
21
20
  */
22
21
  pauseAll() {
@@ -35,7 +34,6 @@ var CronTaskStore = class extends Store {
35
34
  * - Are enabled
36
35
  * - Are not currently running
37
36
  * - Have not been permanently stopped
38
- *
39
37
  * @returns CronTaskStore
40
38
  */
41
39
  resumeAll() {
@@ -55,7 +53,6 @@ var CronTaskStore = class extends Store {
55
53
  * - Have not been permanently stopped
56
54
  *
57
55
  * ⚠️ Stopping jobs is **permanent** and cannot be resumed afterwards!
58
- *
59
56
  * @returns CronTaskStore
60
57
  */
61
58
  stopAll() {
@@ -116,7 +113,7 @@ var CronTaskStore = class extends Store {
116
113
  */
117
114
  clear() {
118
115
  this.stopAll();
119
- return super.clear();
116
+ super.clear();
120
117
  }
121
118
  };
122
119
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTaskStore.mjs","names":[],"sources":["../../../src/lib/structures/CronTaskStore.ts"],"sourcesContent":["import { Store } from '@sapphire/pieces';\nimport { Cron } from 'croner';\nimport { CronTask } from './CronTask';\nimport { normalizePattern } from '../utils/normalizePattern';\n\nexport class CronTaskStore extends Store<CronTask, 'cron-tasks'> {\n\tpublic constructor() {\n\t\tsuper(CronTask, { name: 'cron-tasks' });\n\t}\n\n\t/**\n\t * Loops over all tasks and pauses those that are running.\n\t *\n\t * @remarks\n\t * This method will only pause tasks that:\n\t * - Are enabled\n\t * - Are currently running\n\t * - Have not been permanently stopped\n\t * @returns CronTaskStore\n\t */\n\tpublic pauseAll() {\n\t\tfor (const task of this.values()) {\n\t\t\tif (!task.enabled || !task.job.isRunning()) continue;\n\t\t\ttask.job.pause();\n\t\t}\n\n\t\tStore.logger?.(`[STORE => ${this.name}] [PAUSE] Paused all cronjob tasks.`);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Loops over all tasks and resumes those that are paused.\n\t *\n\t * @remarks\n\t * This method will only resume tasks that:\n\t * - Are enabled\n\t * - Are not currently running\n\t * - Have not been permanently stopped\n\t * @returns CronTaskStore\n\t */\n\tpublic resumeAll() {\n\t\tfor (const task of this.values()) {\n\t\t\tif (!task.enabled || task.job.isRunning() || task.job.isStopped()) continue;\n\t\t\ttask.job.resume();\n\t\t}\n\n\t\tStore.logger?.(`[STORE => ${this.name}] [RESUME] Resumed all cronjob tasks.`);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Loops over all tasks and stops those that are running.\n\t *\n\t * @remarks\n\t * This method will only stop tasks that:\n\t * - Are enabled\n\t * - Have not been permanently stopped\n\t *\n\t * ⚠️ Stopping jobs is **permanent** and cannot be resumed afterwards!\n\t * @returns CronTaskStore\n\t */\n\tpublic stopAll() {\n\t\tfor (const task of this.values()) {\n\t\t\tif (!task.enabled || task.job.isStopped()) continue;\n\t\t\ttask.job.stop();\n\t\t}\n\n\t\tStore.logger?.(`[STORE => ${this.name}] [STOP] Stopped all cronjob tasks.`);\n\t\treturn this;\n\t}\n\n\tpublic override set(key: string, value: CronTask): this {\n\t\tconst { pattern, timezone, protect, ...options } = value.options;\n\t\tconst { sentry, defaultTimezone } = this.container.cronTasks;\n\n\t\t// if a task with the same key already exists, stop it before creating a new one\n\t\tif (this.has(key)) {\n\t\t\tStore.logger?.(`[STORE => ${this.name}] [SET] Stopping existing cronjob task before creating a new one.`);\n\t\t\tthis.get(key)?.job.stop();\n\t\t}\n\n\t\tconst timeZone = timezone ?? defaultTimezone;\n\n\t\ttry {\n\t\t\tStore.logger?.(\n\t\t\t\t`[STORE => ${this.name}] [SET] Creating cronjob for ${key} with '${pattern}' as the pattern and '${timeZone}' for the timezone`\n\t\t\t);\n\n\t\t\tvalue.job = new Cron(\n\t\t\t\tpattern,\n\t\t\t\t{\n\t\t\t\t\tname: key,\n\t\t\t\t\ttimezone: timeZone,\n\t\t\t\t\tpaused: true, // we start the job manually once the client is ready\n\t\t\t\t\tprotect: value.protect?.bind(value) ?? protect,\n\t\t\t\t\tcatch: (error) => {\n\t\t\t\t\t\tvalue.error('Encountered an error while running the cron job', error);\n\t\t\t\t\t\tsentry?.captureException(error);\n\t\t\t\t\t\tvalue.catch?.bind(value)(error, value.job);\n\t\t\t\t\t},\n\t\t\t\t\t...options\n\t\t\t\t},\n\t\t\t\tasync () => {\n\t\t\t\t\t// we only want to monitor cron patterns and not single-use tasks that croner supports\n\t\t\t\t\tif (sentry && typeof pattern === 'string' && !pattern.includes(':')) {\n\t\t\t\t\t\tawait sentry.withMonitor(key, value.run.bind(value), {\n\t\t\t\t\t\t\tschedule: { type: 'crontab', value: normalizePattern(pattern) },\n\t\t\t\t\t\t\ttimezone: timeZone\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tawait value.run.bind(value)();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tvalue.error('Encountered an error while creating the cron job', error);\n\t\t\tvoid value.unload();\n\t\t}\n\n\t\treturn super.set(key, value);\n\t}\n\n\t/**\n\t * Deletes a task from the store and stops it if it's running.\n\t */\n\tpublic override delete(key: string) {\n\t\tconst task = this.get(key);\n\t\tif (task && !task.job.isStopped()) {\n\t\t\ttask.job.stop();\n\t\t}\n\n\t\treturn super.delete(key);\n\t}\n\n\t/**\n\t * Stops all running cron jobs and clears the store.\n\t */\n\tpublic override clear() {\n\t\tthis.stopAll();\n\t\tsuper.clear();\n\t}\n}\n"],"mappings":";;;;;;AAKA,IAAa,gBAAb,cAAmC,MAA8B;CACzD,cAAc;EACpB,MAAM,UAAU,EAAE,MAAM,aAAa,CAAC;CACvC;;;;;;;;;;;CAYO,WAAW;EACjB,KAAK,MAAM,QAAQ,KAAK,OAAO,GAAG;GACjC,IAAI,CAAC,KAAK,WAAW,CAAC,KAAK,IAAI,UAAU,GAAG;GAC5C,KAAK,IAAI,MAAM;EAChB;EAEA,MAAM,SAAS,aAAa,KAAK,KAAK,oCAAoC;EAC1E,OAAO;CACR;;;;;;;;;;;CAYO,YAAY;EAClB,KAAK,MAAM,QAAQ,KAAK,OAAO,GAAG;GACjC,IAAI,CAAC,KAAK,WAAW,KAAK,IAAI,UAAU,KAAK,KAAK,IAAI,UAAU,GAAG;GACnE,KAAK,IAAI,OAAO;EACjB;EAEA,MAAM,SAAS,aAAa,KAAK,KAAK,sCAAsC;EAC5E,OAAO;CACR;;;;;;;;;;;;CAaO,UAAU;EAChB,KAAK,MAAM,QAAQ,KAAK,OAAO,GAAG;GACjC,IAAI,CAAC,KAAK,WAAW,KAAK,IAAI,UAAU,GAAG;GAC3C,KAAK,IAAI,KAAK;EACf;EAEA,MAAM,SAAS,aAAa,KAAK,KAAK,oCAAoC;EAC1E,OAAO;CACR;CAEgB,IAAI,KAAa,OAAuB;EACvD,MAAM,EAAE,SAAS,UAAU,SAAS,GAAG,YAAY,MAAM;EACzD,MAAM,EAAE,QAAQ,oBAAoB,KAAK,UAAU;EAGnD,IAAI,KAAK,IAAI,GAAG,GAAG;GAClB,MAAM,SAAS,aAAa,KAAK,KAAK,kEAAkE;GACxG,KAAK,IAAI,GAAG,CAAC,EAAE,IAAI,KAAK;EACzB;EAEA,MAAM,WAAW,YAAY;EAE7B,IAAI;GACH,MAAM,SACL,aAAa,KAAK,KAAK,+BAA+B,IAAI,SAAS,QAAQ,wBAAwB,SAAS,mBAC7G;GAEA,MAAM,MAAM,IAAI,KACf,SACA;IACC,MAAM;IACN,UAAU;IACV,QAAQ;IACR,SAAS,MAAM,SAAS,KAAK,KAAK,KAAK;IACvC,QAAQ,UAAU;KACjB,MAAM,MAAM,mDAAmD,KAAK;KACpE,QAAQ,iBAAiB,KAAK;KAC9B,MAAM,OAAO,KAAK,KAAK,CAAC,CAAC,OAAO,MAAM,GAAG;IAC1C;IACA,GAAG;GACJ,GACA,YAAY;IAEX,IAAI,UAAU,OAAO,YAAY,YAAY,CAAC,QAAQ,SAAS,GAAG,GACjE,MAAM,OAAO,YAAY,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG;KACpD,UAAU;MAAE,MAAM;MAAW,OAAO,iBAAiB,OAAO;KAAE;KAC9D,UAAU;IACX,CAAC;SAED,MAAM,MAAM,IAAI,KAAK,KAAK,CAAC,CAAC;GAE9B,CACD;EACD,SAAS,OAAO;GACf,MAAM,MAAM,oDAAoD,KAAK;GAChE,MAAM,OAAO;EACnB;EAEA,OAAO,MAAM,IAAI,KAAK,KAAK;CAC5B;;;;CAKgB,OAAO,KAAa;EACnC,MAAM,OAAO,KAAK,IAAI,GAAG;EACzB,IAAI,QAAQ,CAAC,KAAK,IAAI,UAAU,GAC/B,KAAK,IAAI,KAAK;EAGf,OAAO,MAAM,OAAO,GAAG;CACxB;;;;CAKgB,QAAQ;EACvB,KAAK,QAAQ;EACb,MAAM,MAAM;CACb;AACD"}
@@ -0,0 +1,2 @@
1
+ import { n as CronTaskHandlerOptions, t as CronJobOptions } from "../../CronTaskTypes-BRnD-V2d.mjs";
2
+ export { CronJobOptions, CronTaskHandlerOptions };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizePattern.d.mts","names":[],"sources":["../../../src/lib/utils/normalizePattern.ts"],"mappings":"A,wBAuCgB,iBAAiB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizePattern.mjs","names":[],"sources":["../../../src/lib/utils/normalizePattern.ts"],"sourcesContent":["/*\n * Credits to Sapphire for this\n * https://github.com/sapphiredev/utilities/blob/main/packages/cron/src/lib/constants.ts#L26-L57\n * https://github.com/sapphiredev/utilities/blob/main/packages/cron/src/lib/Cron.ts#L91\n */\n\nconst predefined = {\n\t'@annually': '0 0 1 1 *',\n\t'@yearly': '0 0 1 1 *',\n\t'@monthly': '0 0 1 * *',\n\t'@weekly': '0 0 * * 0',\n\t'@daily': '0 0 * * *',\n\t'@hourly': '0 * * * *'\n} as const;\n\nconst cronTokens: Record<string, number> = {\n\tjan: 1,\n\tfeb: 2,\n\tmar: 3,\n\tapr: 4,\n\tmay: 5,\n\tjun: 6,\n\tjul: 7,\n\taug: 8,\n\tsep: 9,\n\toct: 10,\n\tnov: 11,\n\tdec: 12,\n\tsun: 0,\n\tmon: 1,\n\ttue: 2,\n\twed: 3,\n\tthu: 4,\n\tfri: 5,\n\tsat: 6\n} as const;\n\nconst tokensRegex = new RegExp(Object.keys(cronTokens).join('|'), 'g');\n\nexport function normalizePattern(pattern: string): string {\n\tif (Reflect.has(predefined, pattern)) return Reflect.get(predefined, pattern);\n\treturn pattern.replaceAll(tokensRegex, (match) => String(Reflect.get(cronTokens, match)));\n}\n"],"mappings":";AAMA,MAAM,aAAa;CAClB,aAAa;CACb,WAAW;CACX,YAAY;CACZ,WAAW;CACX,UAAU;CACV,WAAW;AACZ;AAEA,MAAM,aAAqC;CAC1C,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;AACN;AAEA,MAAM,cAAc,IAAI,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,KAAK,GAAG,GAAG,GAAG;AAErE,SAAgB,iBAAiB,SAAyB;CACzD,IAAI,QAAQ,IAAI,YAAY,OAAO,GAAG,OAAO,QAAQ,IAAI,YAAY,OAAO;CAC5E,OAAO,QAAQ,WAAW,cAAc,UAAU,OAAO,QAAQ,IAAI,YAAY,KAAK,CAAC,CAAC;AACzF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.mts","names":[],"sources":["../src/register.ts"],"mappings":";;;qBAOa,uBAAuB;UACX,2BAA2B,MAAM,gBAAgB,SAAS;UAI1D,oBAAoB,MAAM;UAIpB,UAAU,MAAM,iBAAc;UAMpC,WAAW,MAAM"}
@@ -1,4 +1,4 @@
1
- import { t as CronTaskHandler } from "./CronTaskHandler-DL6DRegu.mjs";
1
+ import { CronTaskHandler } from "./lib/CronTaskHandler.mjs";
2
2
  import { CronTaskStore } from "./lib/structures/CronTaskStore.mjs";
3
3
  import "./index.mjs";
4
4
  import { Plugin, SapphireClient, container, postInitialization, postLogin, preGenericsInitialization, preLogin } from "@sapphire/framework";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.mjs","names":[],"sources":["../src/register.ts"],"sourcesContent":["/* eslint-disable import-x/no-duplicates */\nimport './index';\n\nimport { container, Plugin, postInitialization, postLogin, preGenericsInitialization, preLogin, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { CronTaskHandler, CronTaskStore } from './index';\n\nexport class CronTaskPlugin extends Plugin {\n\tpublic static override [preGenericsInitialization](this: SapphireClient, options: ClientOptions) {\n\t\tcontainer.cronTasks = new CronTaskHandler(options.cronTasks);\n\t}\n\n\tpublic static override [postInitialization](this: SapphireClient) {\n\t\tthis.stores.register(new CronTaskStore());\n\t}\n\n\tpublic static override async [preLogin](this: SapphireClient) {\n\t\tif (container.cronTasks.disableSentry) return;\n\t\t// eslint-disable-next-line require-atomic-updates\n\t\tcontainer.cronTasks.sentry = await import('@sentry/node').catch(() => undefined);\n\t}\n\n\tpublic static override [postLogin](this: SapphireClient) {\n\t\tthis.stores.get('cron-tasks').resumeAll();\n\t}\n}\n\nSapphireClient.plugins.registerPreGenericsInitializationHook(CronTaskPlugin[preGenericsInitialization], 'Cron-Task-PreGenericsInitialization');\n\nSapphireClient.plugins.registerPostInitializationHook(CronTaskPlugin[postInitialization], 'Cron-Task-PostInitialization');\n\nSapphireClient.plugins.registerPreLoginHook(CronTaskPlugin[preLogin], 'Cron-Task-PreLogin');\n\nSapphireClient.plugins.registerPostLoginHook(CronTaskPlugin[postLogin], 'Cron-Task-PostLogin');\n"],"mappings":";;;;;;AAOA,IAAa,iBAAb,cAAoC,OAAO;CAC1C,QAAwB,2BAAiD,SAAwB;EAChG,UAAU,YAAY,IAAI,gBAAgB,QAAQ,SAAS;CAC5D;CAEA,QAAwB,sBAA0C;EACjE,KAAK,OAAO,SAAS,IAAI,cAAc,CAAC;CACzC;CAEA,cAA8B,YAAgC;EAC7D,IAAI,UAAU,UAAU,eAAe;EAEvC,UAAU,UAAU,SAAS,MAAM,OAAO,eAAe,CAAC,YAAY,MAAS;CAChF;CAEA,QAAwB,aAAiC;EACxD,KAAK,OAAO,IAAI,YAAY,CAAC,CAAC,UAAU;CACzC;AACD;AAEA,eAAe,QAAQ,sCAAsC,eAAe,4BAA4B,qCAAqC;AAE7I,eAAe,QAAQ,+BAA+B,eAAe,qBAAqB,8BAA8B;AAExH,eAAe,QAAQ,qBAAqB,eAAe,WAAW,oBAAoB;AAE1F,eAAe,QAAQ,sBAAsB,eAAe,YAAY,qBAAqB"}
package/package.json CHANGED
@@ -1,37 +1,25 @@
1
1
  {
2
2
  "name": "@kingsworld/plugin-cron",
3
3
  "description": "A simple @sapphire/framework plugin that aims to make use of the croner package and allow users to make cron jobs within their Sapphire discord bot.",
4
- "version": "5.0.0-next.e2560b0",
4
+ "version": "5.0.0-pr-407.31c4495",
5
5
  "author": "Seren_Modz 21 <seren@kings-world.net>",
6
6
  "license": "MIT",
7
- "main": "dist/cjs/index.cjs",
8
- "module": "dist/esm/index.mjs",
9
- "types": "dist/cjs/index.d.cts",
7
+ "type": "module",
8
+ "main": "dist/index.mjs",
9
+ "module": "dist/index.mjs",
10
+ "types": "dist/index.d.mts",
10
11
  "exports": {
11
12
  ".": {
12
- "import": {
13
- "types": "./dist/esm/index.d.mts",
14
- "default": "./dist/esm/index.mjs"
15
- },
16
- "require": {
17
- "types": "./dist/cjs/index.d.cts",
18
- "default": "./dist/cjs/index.cjs"
19
- }
13
+ "types": "./dist/index.d.mts",
14
+ "default": "./dist/index.mjs"
20
15
  },
21
16
  "./register": {
22
- "import": {
23
- "types": "./dist/esm/register.d.mts",
24
- "default": "./dist/esm/register.mjs"
25
- },
26
- "require": {
27
- "types": "./dist/cjs/register.d.cts",
28
- "default": "./dist/cjs/register.cjs"
29
- }
17
+ "types": "./dist/register.d.mts",
18
+ "default": "./dist/register.mjs"
30
19
  }
31
20
  },
32
21
  "sideEffects": [
33
- "./dist/cjs/register.cjs",
34
- "./dist/esm/register.mjs"
22
+ "./dist/register.mjs"
35
23
  ],
36
24
  "scripts": {
37
25
  "build": "tsdown --config-loader unrun",
@@ -45,6 +33,8 @@
45
33
  },
46
34
  "devDependencies": {
47
35
  "@favware/cliff-jumper": "6.1.0",
36
+ "@sapphire/framework": "5.5.1",
37
+ "@sapphire/pieces": "4.4.1",
48
38
  "@sentry/node": "11.14.0",
49
39
  "@types/node": "24.19.2",
50
40
  "tsdown": "0.23.7",
@@ -79,6 +69,6 @@
79
69
  "access": "public"
80
70
  },
81
71
  "engines": {
82
- "node": ">=v18"
72
+ "node": ">=v24"
83
73
  }
84
74
  }
@@ -1,58 +0,0 @@
1
- 'use strict';
2
-
3
- // \0@oxc-project+runtime@0.158.0/helpers/esm/typeof.js
4
- function _typeof(o) {
5
- "@babel/helpers - typeof";
6
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
7
- return typeof o;
8
- } : function(o) {
9
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10
- }, _typeof(o);
11
- }
12
-
13
- // \0@oxc-project+runtime@0.158.0/helpers/esm/toPrimitive.js
14
- function toPrimitive(t, e) {
15
- if ("object" != _typeof(t) || !t) return t;
16
- var r;
17
- if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
18
- var i = r.call(t, e || "default");
19
- if ("object" != _typeof(i)) return i;
20
- throw new TypeError("@@toPrimitive must return a primitive value.");
21
- }
22
- return ("string" === e ? String : Number)(t);
23
- }
24
-
25
- // \0@oxc-project+runtime@0.158.0/helpers/esm/toPropertyKey.js
26
- function toPropertyKey(t) {
27
- var i = toPrimitive(t, "string");
28
- return "symbol" == _typeof(i) ? i : i + "";
29
- }
30
-
31
- // \0@oxc-project+runtime@0.158.0/helpers/esm/defineProperty.js
32
- function _defineProperty(e, r, t) {
33
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
34
- value: t,
35
- enumerable: !0,
36
- configurable: !0,
37
- writable: !0
38
- }) : e[r] = t, e;
39
- }
40
-
41
- // src/lib/CronTaskHandler.ts
42
- var CronTaskHandler = class {
43
- constructor(options) {
44
- _defineProperty(this, "defaultTimezone", void 0);
45
- _defineProperty(this, "disableSentry", void 0);
46
- _defineProperty(this, "sentry", void 0);
47
- this.defaultTimezone = options?.defaultTimezone;
48
- this.disableSentry = options?.disableSentry ?? false;
49
- }
50
- };
51
-
52
- Object.defineProperty(exports, "CronTaskHandler", {
53
- enumerable: true,
54
- get: function () {
55
- return CronTaskHandler;
56
- }
57
- });
58
- //# sourceMappingURL=CronTaskHandler-fVZWiMAa.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskHandler-fVZWiMAa.cjs","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,kBAAb,MAA6B;CAuBrB,YAAY,SAA2C;wBAjBvD;wBAQA;wBAOA;EAGN,KAAK,kBAAkB,SAAS;EAChC,KAAK,gBAAgB,SAAS,iBAAiB;CAChD;AACD"}
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_CronTaskHandler = require("./CronTaskHandler-fVZWiMAa.cjs");
5
- const require_lib_structures_CronTask = require("./lib/structures/CronTask.cjs");
6
- const require_lib_structures_CronTaskStore = require("./lib/structures/CronTaskStore.cjs");
7
-
8
- // src/index.ts
9
- /**
10
- * The [@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.
11
- * An example use of this is showing it of in a bot information command.
12
- *
13
- * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild
14
- */
15
- const version = "5.0.0-next.e2560b0";
16
-
17
- exports.CronTask = require_lib_structures_CronTask.CronTask;
18
- exports.CronTaskHandler = require_CronTaskHandler.CronTaskHandler;
19
- exports.CronTaskStore = require_lib_structures_CronTaskStore.CronTaskStore;
20
- exports.version = version;
21
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import type { CronTaskStore } from './lib/structures/CronTaskStore';\nimport type { CronTaskHandler } from './lib/CronTaskHandler';\nimport type { CronTaskHandlerOptions } from './lib/types/CronTaskTypes';\n\nexport * from './lib/CronTaskHandler';\nexport * from './lib/structures/CronTask';\nexport * from './lib/structures/CronTaskStore';\nexport * from './lib/types/CronTaskTypes';\n\ndeclare module '@sapphire/pieces' {\n\tinterface Container {\n\t\tcronTasks: CronTaskHandler;\n\t}\n\n\tinterface StoreRegistryEntries {\n\t\t'cron-tasks': CronTaskStore;\n\t}\n}\n\ndeclare module 'discord.js' {\n\texport interface ClientOptions {\n\t\tcronTasks?: Partial<CronTaskHandlerOptions>;\n\t}\n}\n\n/**\n * The [@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\nexport const version: string = '[VI]{{inject}}[/VI]';\n"],"mappings":";;;;;;;;;;;;;;AA+BA,MAAa,UAAkB"}