@kingsworld/plugin-cron 5.0.0-next.f897931 → 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 (83) 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/{cjs/CronTaskHandler-vuZq_6em.d.cts → CronTaskHandler-kTcROO_P.d.mts} +7 -6
  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 +16 -26
  29. package/dist/cjs/CronTask-DHhctNBr.d.cts +0 -81
  30. package/dist/cjs/CronTask-DHhctNBr.d.cts.map +0 -1
  31. package/dist/cjs/CronTaskHandler-D94YuXWl.cjs +0 -58
  32. package/dist/cjs/CronTaskHandler-D94YuXWl.cjs.map +0 -1
  33. package/dist/cjs/CronTaskHandler-vuZq_6em.d.cts.map +0 -1
  34. package/dist/cjs/CronTaskStore-BF1lvPJM.d.cts +0 -54
  35. package/dist/cjs/CronTaskStore-BF1lvPJM.d.cts.map +0 -1
  36. package/dist/cjs/CronTaskTypes-DOfUFMbV.d.cts +0 -27
  37. package/dist/cjs/CronTaskTypes-DOfUFMbV.d.cts.map +0 -1
  38. package/dist/cjs/index.cjs +0 -21
  39. package/dist/cjs/index.cjs.map +0 -1
  40. package/dist/cjs/index.d.cts +0 -27
  41. package/dist/cjs/index.d.cts.map +0 -1
  42. package/dist/cjs/lib/CronTaskHandler.cjs +0 -6
  43. package/dist/cjs/lib/CronTaskHandler.d.cts +0 -3
  44. package/dist/cjs/lib/structures/CronTask.cjs +0 -85
  45. package/dist/cjs/lib/structures/CronTask.cjs.map +0 -1
  46. package/dist/cjs/lib/structures/CronTask.d.cts +0 -3
  47. package/dist/cjs/lib/structures/CronTaskStore.cjs +0 -127
  48. package/dist/cjs/lib/structures/CronTaskStore.cjs.map +0 -1
  49. package/dist/cjs/lib/structures/CronTaskStore.d.cts +0 -3
  50. package/dist/cjs/lib/types/CronTaskTypes.cjs +0 -2
  51. package/dist/cjs/lib/types/CronTaskTypes.d.cts +0 -3
  52. package/dist/cjs/lib/utils/normalizePattern.cjs +0 -41
  53. package/dist/cjs/lib/utils/normalizePattern.cjs.map +0 -1
  54. package/dist/cjs/lib/utils/normalizePattern.d.cts +0 -3
  55. package/dist/cjs/lib/utils/normalizePattern.d.cts.map +0 -1
  56. package/dist/cjs/register.cjs +0 -31
  57. package/dist/cjs/register.cjs.map +0 -1
  58. package/dist/cjs/register.d.cts +0 -11
  59. package/dist/cjs/register.d.cts.map +0 -1
  60. package/dist/esm/CronTask-BRxg3jbY.d.mts.map +0 -1
  61. package/dist/esm/CronTaskHandler-B-JlxyTe.mjs +0 -51
  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
  67. package/dist/esm/index.d.mts.map +0 -1
  68. package/dist/esm/index.mjs.map +0 -1
  69. package/dist/esm/lib/CronTaskHandler.d.mts +0 -2
  70. package/dist/esm/lib/CronTaskHandler.mjs +0 -3
  71. package/dist/esm/lib/structures/CronTask.d.mts +0 -2
  72. package/dist/esm/lib/structures/CronTask.mjs.map +0 -1
  73. package/dist/esm/lib/structures/CronTaskStore.d.mts +0 -2
  74. package/dist/esm/lib/structures/CronTaskStore.mjs.map +0 -1
  75. package/dist/esm/lib/types/CronTaskTypes.d.mts +0 -2
  76. package/dist/esm/lib/utils/normalizePattern.d.mts.map +0 -1
  77. package/dist/esm/lib/utils/normalizePattern.mjs.map +0 -1
  78. package/dist/esm/register.d.mts.map +0 -1
  79. package/dist/esm/register.mjs.map +0 -1
  80. /package/dist/{esm/lib → lib}/types/CronTaskTypes.mjs +0 -0
  81. /package/dist/{esm/lib → lib}/utils/normalizePattern.d.mts +0 -0
  82. /package/dist/{esm/lib → lib}/utils/normalizePattern.mjs +0 -0
  83. /package/dist/{esm/register.d.mts → register.d.mts} +0 -0
@@ -1,58 +0,0 @@
1
- 'use strict';
2
-
3
- // \0@oxc-project+runtime@0.156.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.156.0/helpers/esm/toPrimitive.js
14
- function toPrimitive(t, r) {
15
- if ("object" != _typeof(t) || !t) return t;
16
- var e = t[Symbol.toPrimitive];
17
- if (void 0 !== e) {
18
- var i = e.call(t, r || "default");
19
- if ("object" != _typeof(i)) return i;
20
- throw new TypeError("@@toPrimitive must return a primitive value.");
21
- }
22
- return ("string" === r ? String : Number)(t);
23
- }
24
-
25
- // \0@oxc-project+runtime@0.156.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.156.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-D94YuXWl.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskHandler-D94YuXWl.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,kBAAA,MAAA;CAuBA,AAAA,YAAA,SAAA;wBAjBA;wBAQA;wBAOA;EAGA,KAAA,kBAAA,SAAA;EACA,KAAA,gBAAA,SAAA,iBAAA;CACA;AACA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskHandler-vuZq_6em.d.cts","names":[],"sources":["../../src/lib/CronTaskHandler.ts"],"mappings":";;;cAGa;;;;;;EAML,kBAAkB;;;;;;;EAQlB;;;;;;EAOA,gBAAgB;EAEJ,YAAA,UAAU,QAAQ"}
@@ -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,21 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_CronTaskHandler = require("./CronTaskHandler-D94YuXWl.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.f897931";
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,UAAA"}
@@ -1,27 +0,0 @@
1
-
2
- import { t as CronTaskStore } from "./CronTaskStore-BF1lvPJM.cjs";
3
- import { t as CronTaskHandler } from "./CronTaskHandler-vuZq_6em.cjs";
4
- import { n as CronTaskHandlerOptions, t as CronJobOptions } from "./CronTaskTypes-DOfUFMbV.cjs";
5
- import { t as CronTask } from "./CronTask-DHhctNBr.cjs";
6
- declare module '@sapphire/pieces' {
7
- interface Container {
8
- cronTasks: CronTaskHandler;
9
- }
10
- interface StoreRegistryEntries {
11
- 'cron-tasks': CronTaskStore;
12
- }
13
- }
14
- declare module 'discord.js' {
15
- interface ClientOptions {
16
- cronTasks?: Partial<CronTaskHandlerOptions>;
17
- }
18
- }
19
- /**
20
- * The [@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.
21
- * An example use of this is showing it of in a bot information command.
22
- *
23
- * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild
24
- */
25
- export declare const version: string;
26
- export { CronJobOptions, CronTask, CronTaskHandler, CronTaskHandlerOptions, CronTaskStore };
27
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;YAUW;IACT,WAAW;;YAGF;IACT,cAAc;;;;YAKE;IAChB,YAAY,QAAQ;;;;;;;;;qBAUT"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_CronTaskHandler = require("../CronTaskHandler-D94YuXWl.cjs");
5
-
6
- exports.CronTaskHandler = require_CronTaskHandler.CronTaskHandler;
@@ -1,3 +0,0 @@
1
-
2
- import { t as CronTaskHandler } from "../CronTaskHandler-vuZq_6em.cjs";
3
- export { CronTaskHandler };
@@ -1,85 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- let _sapphire_pieces = require("@sapphire/pieces");
5
-
6
- // src/lib/structures/CronTask.ts
7
- /**
8
- * @example
9
- *
10
- * ```typescript
11
- * // ping.ts
12
- * import { CronTask } from '@kingsworld/plugin-cron';
13
- *
14
- * export class PingPong extends CronTask {
15
- * public constructor(context: CronTask.LoaderContext, options: CronTask.Options) {
16
- * super(context, {
17
- * ...options,
18
- * pattern: '* * * * *'
19
- * });
20
- * }
21
- *
22
- * public run() {
23
- * this.info('Ping Pong! 🏓'); // CronTask[ping] Ping Pong! 🏓
24
- * }
25
- * }
26
- * ```
27
- */
28
- var CronTask = class extends _sapphire_pieces.Piece {
29
- constructor(context, options) {
30
- super(context, options);
31
- }
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, ...other) {
40
- this.container.logger.info(`CronTask[${this.name}] ${message}`, ...other);
41
- }
42
- /**
43
- * A helper function to log messages with the `CronTask[${name}]` prefix.
44
- * @param message The message to include after the prefix
45
- * @param other Extra parameters to pass to the logger
46
- * @example
47
- * this.error('Something went wrong!'); // CronTask[my-task] Something went wrong!
48
- */
49
- error(message, ...other) {
50
- this.container.logger.error(`CronTask[${this.name}] ${message}`, ...other);
51
- }
52
- /**
53
- * A helper function to log messages with the `CronTask[${name}]` prefix.
54
- * @param message The message to include after the prefix
55
- * @param other Extra parameters to pass to the logger
56
- * @example
57
- * this.warn('Something is not right!'); // CronTask[my-task] Something is not right!
58
- */
59
- warn(message, ...other) {
60
- this.container.logger.warn(`CronTask[${this.name}] ${message}`, ...other);
61
- }
62
- /**
63
- * A helper function to log messages with the `CronTask[${name}]` prefix.
64
- * @param message The message to include after the prefix
65
- * @param other Extra parameters to pass to the logger
66
- * @example
67
- * this.debug('Something is happening!'); // CronTask[my-task] Something is happening!
68
- */
69
- debug(message, ...other) {
70
- this.container.logger.debug(`CronTask[${this.name}] ${message}`, ...other);
71
- }
72
- /**
73
- * A helper function to log messages with the `CronTask[${name}]` prefix.
74
- * @param message The message to include after the prefix
75
- * @param other Extra parameters to pass to the logger
76
- * @example
77
- * this.trace('Loaded the file.'); // CronTask[my-task] Loaded the file.
78
- */
79
- trace(message, ...other) {
80
- this.container.logger.trace(`CronTask[${this.name}] ${message}`, ...other);
81
- }
82
- };
83
-
84
- exports.CronTask = CronTask;
85
- //# sourceMappingURL=CronTask.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTask.cjs","names":["Piece"],"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 * @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 * @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 * @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 * @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 * @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 namespace CronTask {\n\texport type Options = Piece.Options & CronJobOptions;\n\t/** @deprecated Use {@linkcode LoaderContext} instead. */\n\texport type Context = LoaderContext;\n\texport type LoaderContext = Piece.LoaderContext<'cron-tasks'>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAA,WAAA,cAAAA,uBAAA;CAGA,AAAA,YAAA,SAAA,SAAA;EACA,MAAA,SAAA,OAAA;CACA;;;;;;;;CAeA,AAAA,KAAA,SAAA,GAAA,OAAA;EACA,KAAA,UAAA,OAAA,KAAA,YAAA,KAAA,KAAA,IAAA,WAAA,GAAA,KAAA;CACA;;;;;;;;CASA,AAAA,MAAA,SAAA,GAAA,OAAA;EACA,KAAA,UAAA,OAAA,MAAA,YAAA,KAAA,KAAA,IAAA,WAAA,GAAA,KAAA;CACA;;;;;;;;CASA,AAAA,KAAA,SAAA,GAAA,OAAA;EACA,KAAA,UAAA,OAAA,KAAA,YAAA,KAAA,KAAA,IAAA,WAAA,GAAA,KAAA;CACA;;;;;;;;CASA,AAAA,MAAA,SAAA,GAAA,OAAA;EACA,KAAA,UAAA,OAAA,MAAA,YAAA,KAAA,KAAA,IAAA,WAAA,GAAA,KAAA;CACA;;;;;;;;CASA,AAAA,MAAA,SAAA,GAAA,OAAA;EACA,KAAA,UAAA,OAAA,MAAA,YAAA,KAAA,KAAA,IAAA,WAAA,GAAA,KAAA;CACA;AACA"}
@@ -1,3 +0,0 @@
1
-
2
- import { t as CronTask } from "../../CronTask-DHhctNBr.cjs";
3
- export { CronTask };
@@ -1,127 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_lib_structures_CronTask = require("./CronTask.cjs");
5
- const require_lib_utils_normalizePattern = require("../utils/normalizePattern.cjs");
6
- let _sapphire_pieces = require("@sapphire/pieces");
7
- let croner = require("croner");
8
-
9
- // src/lib/structures/CronTaskStore.ts
10
- var CronTaskStore = class extends _sapphire_pieces.Store {
11
- constructor() {
12
- super(require_lib_structures_CronTask.CronTask, { name: "cron-tasks" });
13
- }
14
- /**
15
- * Loops over all tasks and pauses those that are running.
16
- *
17
- * @remarks
18
- * This method will only pause tasks that:
19
- * - Are enabled
20
- * - Are currently running
21
- * - Have not been permanently stopped
22
- *
23
- * @returns CronTaskStore
24
- */
25
- pauseAll() {
26
- for (const task of this.values()) {
27
- if (!task.enabled || !task.job.isRunning()) continue;
28
- task.job.pause();
29
- }
30
- _sapphire_pieces.Store.logger?.(`[STORE => ${this.name}] [PAUSE] Paused all cronjob tasks.`);
31
- return this;
32
- }
33
- /**
34
- * Loops over all tasks and resumes those that are paused.
35
- *
36
- * @remarks
37
- * This method will only resume tasks that:
38
- * - Are enabled
39
- * - Are not currently running
40
- * - Have not been permanently stopped
41
- *
42
- * @returns CronTaskStore
43
- */
44
- resumeAll() {
45
- for (const task of this.values()) {
46
- if (!task.enabled || task.job.isRunning() || task.job.isStopped()) continue;
47
- task.job.resume();
48
- }
49
- _sapphire_pieces.Store.logger?.(`[STORE => ${this.name}] [RESUME] Resumed all cronjob tasks.`);
50
- return this;
51
- }
52
- /**
53
- * Loops over all tasks and stops those that are running.
54
- *
55
- * @remarks
56
- * This method will only stop tasks that:
57
- * - Are enabled
58
- * - Have not been permanently stopped
59
- *
60
- * ⚠️ Stopping jobs is **permanent** and cannot be resumed afterwards!
61
- *
62
- * @returns CronTaskStore
63
- */
64
- stopAll() {
65
- for (const task of this.values()) {
66
- if (!task.enabled || task.job.isStopped()) continue;
67
- task.job.stop();
68
- }
69
- _sapphire_pieces.Store.logger?.(`[STORE => ${this.name}] [STOP] Stopped all cronjob tasks.`);
70
- return this;
71
- }
72
- set(key, value) {
73
- const { pattern, timezone, protect, ...options } = value.options;
74
- const { sentry, defaultTimezone } = this.container.cronTasks;
75
- if (this.has(key)) {
76
- _sapphire_pieces.Store.logger?.(`[STORE => ${this.name}] [SET] Stopping existing cronjob task before creating a new one.`);
77
- this.get(key)?.job.stop();
78
- }
79
- const timeZone = timezone ?? defaultTimezone;
80
- try {
81
- _sapphire_pieces.Store.logger?.(`[STORE => ${this.name}] [SET] Creating cronjob for ${key} with '${pattern}' as the pattern and '${timeZone}' for the timezone`);
82
- value.job = new croner.Cron(pattern, {
83
- name: key,
84
- timezone: timeZone,
85
- paused: true,
86
- protect: value.protect?.bind(value) ?? protect,
87
- catch: (error) => {
88
- value.error("Encountered an error while running the cron job", error);
89
- sentry?.captureException(error);
90
- value.catch?.bind(value)(error, value.job);
91
- },
92
- ...options
93
- }, async () => {
94
- if (sentry && typeof pattern === "string" && !pattern.includes(":")) await sentry.withMonitor(key, value.run.bind(value), {
95
- schedule: {
96
- type: "crontab",
97
- value: require_lib_utils_normalizePattern.normalizePattern(pattern)
98
- },
99
- timezone: timeZone
100
- });
101
- else await value.run.bind(value)();
102
- });
103
- } catch (error) {
104
- value.error("Encountered an error while creating the cron job", error);
105
- value.unload();
106
- }
107
- return super.set(key, value);
108
- }
109
- /**
110
- * Deletes a task from the store and stops it if it's running.
111
- */
112
- delete(key) {
113
- const task = this.get(key);
114
- if (task && !task.job.isStopped()) task.job.stop();
115
- return super.delete(key);
116
- }
117
- /**
118
- * Stops all running cron jobs and clears the store.
119
- */
120
- clear() {
121
- this.stopAll();
122
- return super.clear();
123
- }
124
- };
125
-
126
- exports.CronTaskStore = CronTaskStore;
127
- //# sourceMappingURL=CronTaskStore.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskStore.cjs","names":["Store","CronTask","Cron","normalizePattern"],"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 *\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 *\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 *\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\treturn super.clear();\n\t}\n}\n"],"mappings":";;;;;;;;;AAKA,IAAA,gBAAA,cAAAA,uBAAA;CACA,AAAA,cAAA;EACA,MAAAC,0CAAA,EAAA,MAAA,aAAA,CAAA;CACA;;;;;;;;;;;;CAaA,AAAA,WAAA;EACA,KAAA,MAAA,QAAA,KAAA,OAAA,GAAA;GACA,IAAA,CAAA,KAAA,WAAA,CAAA,KAAA,IAAA,UAAA,GAAA;GACA,KAAA,IAAA,MAAA;EACA;EAEA,uBAAA,SAAA,aAAA,KAAA,KAAA,oCAAA;EACA,OAAA;CACA;;;;;;;;;;;;CAaA,AAAA,YAAA;EACA,KAAA,MAAA,QAAA,KAAA,OAAA,GAAA;GACA,IAAA,CAAA,KAAA,WAAA,KAAA,IAAA,UAAA,KAAA,KAAA,IAAA,UAAA,GAAA;GACA,KAAA,IAAA,OAAA;EACA;EAEA,uBAAA,SAAA,aAAA,KAAA,KAAA,sCAAA;EACA,OAAA;CACA;;;;;;;;;;;;;CAcA,AAAA,UAAA;EACA,KAAA,MAAA,QAAA,KAAA,OAAA,GAAA;GACA,IAAA,CAAA,KAAA,WAAA,KAAA,IAAA,UAAA,GAAA;GACA,KAAA,IAAA,KAAA;EACA;EAEA,uBAAA,SAAA,aAAA,KAAA,KAAA,oCAAA;EACA,OAAA;CACA;CAEA,AAAA,IAAA,KAAA,OAAA;EACA,MAAA,EAAA,SAAA,UAAA,SAAA,GAAA,YAAA,MAAA;EACA,MAAA,EAAA,QAAA,oBAAA,KAAA,UAAA;EAGA,IAAA,KAAA,IAAA,GAAA,GAAA;GACA,uBAAA,SAAA,aAAA,KAAA,KAAA,kEAAA;GACA,KAAA,IAAA,GAAA,CAAA,EAAA,IAAA,KAAA;EACA;EAEA,MAAA,WAAA,YAAA;EAEA,IAAA;GACA,uBAAA,SACA,aAAA,KAAA,KAAA,+BAAA,IAAA,SAAA,QAAA,wBAAA,SAAA,mBACA;GAEA,MAAA,MAAA,IAAAC,YACA,SACA;IACA,MAAA;IACA,UAAA;IACA,QAAA;IACA,SAAA,MAAA,SAAA,KAAA,KAAA,KAAA;IACA,QAAA,UAAA;KACA,MAAA,MAAA,mDAAA,KAAA;KACA,QAAA,iBAAA,KAAA;KACA,MAAA,OAAA,KAAA,KAAA,CAAA,CAAA,OAAA,MAAA,GAAA;IACA;IACA,GAAA;GACA,GACA,YAAA;IAEA,IAAA,UAAA,OAAA,YAAA,YAAA,CAAA,QAAA,SAAA,GAAA,GACA,MAAA,OAAA,YAAA,KAAA,MAAA,IAAA,KAAA,KAAA,GAAA;KACA,UAAA;MAAA,MAAA;MAAA,OAAAC,oDAAA,OAAA;KAAA;KACA,UAAA;IACA,CAAA;SAEA,MAAA,MAAA,IAAA,KAAA,KAAA,CAAA,CAAA;GAEA,CACA;EACA,SAAA,OAAA;GACA,MAAA,MAAA,oDAAA,KAAA;GACA,AAAA,MAAA,OAAA;EACA;EAEA,OAAA,MAAA,IAAA,KAAA,KAAA;CACA;;;;CAKA,AAAA,OAAA,KAAA;EACA,MAAA,OAAA,KAAA,IAAA,GAAA;EACA,IAAA,QAAA,CAAA,KAAA,IAAA,UAAA,GACA,KAAA,IAAA,KAAA;EAGA,OAAA,MAAA,OAAA,GAAA;CACA;;;;CAKA,AAAA,QAAA;EACA,KAAA,QAAA;EACA,OAAA,MAAA,MAAA;CACA;AACA"}
@@ -1,3 +0,0 @@
1
-
2
- import { t as CronTaskStore } from "../../CronTaskStore-BF1lvPJM.cjs";
3
- export { CronTaskStore };
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1,3 +0,0 @@
1
-
2
- import { n as CronTaskHandlerOptions, t as CronJobOptions } from "../../CronTaskTypes-DOfUFMbV.cjs";
3
- export { CronJobOptions, CronTaskHandlerOptions };
@@ -1,41 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- // src/lib/utils/normalizePattern.ts
5
- const predefined = {
6
- "@annually": "0 0 1 1 *",
7
- "@yearly": "0 0 1 1 *",
8
- "@monthly": "0 0 1 * *",
9
- "@weekly": "0 0 * * 0",
10
- "@daily": "0 0 * * *",
11
- "@hourly": "0 * * * *"
12
- };
13
- const cronTokens = {
14
- jan: 1,
15
- feb: 2,
16
- mar: 3,
17
- apr: 4,
18
- may: 5,
19
- jun: 6,
20
- jul: 7,
21
- aug: 8,
22
- sep: 9,
23
- oct: 10,
24
- nov: 11,
25
- dec: 12,
26
- sun: 0,
27
- mon: 1,
28
- tue: 2,
29
- wed: 3,
30
- thu: 4,
31
- fri: 5,
32
- sat: 6
33
- };
34
- const tokensRegex = new RegExp(Object.keys(cronTokens).join("|"), "g");
35
- function normalizePattern(pattern) {
36
- if (Reflect.has(predefined, pattern)) return Reflect.get(predefined, pattern);
37
- return pattern.replaceAll(tokensRegex, (match) => String(Reflect.get(cronTokens, match)));
38
- }
39
-
40
- exports.normalizePattern = normalizePattern;
41
- //# sourceMappingURL=normalizePattern.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizePattern.cjs","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,MAAA,aAAA;CACA,aAAA;CACA,WAAA;CACA,YAAA;CACA,WAAA;CACA,UAAA;CACA,WAAA;AACA;AAEA,MAAA,aAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;CACA,KAAA;AACA;AAEA,MAAA,cAAA,IAAA,OAAA,OAAA,KAAA,UAAA,CAAA,CAAA,KAAA,GAAA,GAAA,GAAA;AAEA,SAAA,iBAAA,SAAA;CACA,IAAA,QAAA,IAAA,YAAA,OAAA,GAAA,OAAA,QAAA,IAAA,YAAA,OAAA;CACA,OAAA,QAAA,WAAA,cAAA,UAAA,OAAA,QAAA,IAAA,YAAA,KAAA,CAAA,CAAA;AACA"}
@@ -1,3 +0,0 @@
1
-
2
- export declare function normalizePattern(pattern: string): string;
3
- //# sourceMappingURL=normalizePattern.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizePattern.d.cts","names":[],"sources":["../../../../src/lib/utils/normalizePattern.ts"],"mappings":";A,wBAuCgB,iBAAiB"}
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_CronTaskHandler = require("./CronTaskHandler-D94YuXWl.cjs");
5
- const require_lib_structures_CronTaskStore = require("./lib/structures/CronTaskStore.cjs");
6
- require("./index.cjs");
7
- let _sapphire_framework = require("@sapphire/framework");
8
-
9
- // src/register.ts
10
- var CronTaskPlugin = class extends _sapphire_framework.Plugin {
11
- static [_sapphire_framework.preGenericsInitialization](options) {
12
- _sapphire_framework.container.cronTasks = new require_CronTaskHandler.CronTaskHandler(options.cronTasks);
13
- }
14
- static [_sapphire_framework.postInitialization]() {
15
- this.stores.register(new require_lib_structures_CronTaskStore.CronTaskStore());
16
- }
17
- static async [_sapphire_framework.preLogin]() {
18
- if (_sapphire_framework.container.cronTasks.disableSentry) return;
19
- _sapphire_framework.container.cronTasks.sentry = await import("@sentry/node").catch(() => void 0);
20
- }
21
- static [_sapphire_framework.postLogin]() {
22
- this.stores.get("cron-tasks").resumeAll();
23
- }
24
- };
25
- _sapphire_framework.SapphireClient.plugins.registerPreGenericsInitializationHook(CronTaskPlugin[_sapphire_framework.preGenericsInitialization], "Cron-Task-PreGenericsInitialization");
26
- _sapphire_framework.SapphireClient.plugins.registerPostInitializationHook(CronTaskPlugin[_sapphire_framework.postInitialization], "Cron-Task-PostInitialization");
27
- _sapphire_framework.SapphireClient.plugins.registerPreLoginHook(CronTaskPlugin[_sapphire_framework.preLogin], "Cron-Task-PreLogin");
28
- _sapphire_framework.SapphireClient.plugins.registerPostLoginHook(CronTaskPlugin[_sapphire_framework.postLogin], "Cron-Task-PostLogin");
29
-
30
- exports.CronTaskPlugin = CronTaskPlugin;
31
- //# sourceMappingURL=register.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.cjs","names":["Plugin","preGenericsInitialization","CronTaskHandler","postInitialization","CronTaskStore","preLogin","container","postLogin","SapphireClient"],"sources":["../../src/register.ts"],"sourcesContent":["import './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\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":";;;;;;;;;AAMA,IAAA,iBAAA,cAAAA,2BAAA;CACA,QAAAC,+CAAA,SAAA;EACA,8BAAA,YAAA,IAAAC,wCAAA,QAAA,SAAA;CACA;CAEA,QAAAC,0CAAA;EACA,KAAA,OAAA,SAAA,IAAAC,mDAAA,CAAA;CACA;CAEA,cAAAC,gCAAA;EACA,IAAAC,8BAAA,UAAA,eAAA;EACA,8BAAA,UAAA,SAAA,MAAA,OAAA,eAAA,CAAA,YAAA,MAAA;CACA;CAEA,QAAAC,iCAAA;EACA,KAAA,OAAA,IAAA,YAAA,CAAA,CAAA,UAAA;CACA;AACA;AAEAC,mCAAA,QAAA,sCAAA,eAAAP,gDAAA,qCAAA;AAEAO,mCAAA,QAAA,+BAAA,eAAAL,yCAAA,8BAAA;AAEAK,mCAAA,QAAA,qBAAA,eAAAH,+BAAA,oBAAA;AAEAG,mCAAA,QAAA,sBAAA,eAAAD,gCAAA,qBAAA"}
@@ -1,11 +0,0 @@
1
-
2
- import "./index.cjs";
3
- import { Plugin, SapphireClient, postInitialization, postLogin, preGenericsInitialization, preLogin } from "@sapphire/framework";
4
- import { ClientOptions } from "discord.js";
5
- export declare class CronTaskPlugin extends Plugin {
6
- static [preGenericsInitialization](this: SapphireClient, options: ClientOptions): void;
7
- static [postInitialization](this: SapphireClient): void;
8
- static [preLogin](this: SapphireClient): Promise<void>;
9
- static [postLogin](this: SapphireClient): void;
10
- }
11
- //# sourceMappingURL=register.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.cts","names":[],"sources":["../../src/register.ts"],"mappings":";;;;qBAMa,uBAAuB;UACX,2BAA2B,MAAM,gBAAgB,SAAS;UAI1D,oBAAoB,MAAM;UAIpB,UAAU,MAAM,iBAAc;UAKpC,WAAW,MAAM"}
@@ -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"}