@kingsworld/plugin-cron 4.0.1-next.98a54cd → 4.0.1-next.9fe7558

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 (71) hide show
  1. package/dist/cjs/CronTask-CWQGUBCQ.d.cts +84 -0
  2. package/dist/cjs/CronTask-CWQGUBCQ.d.cts.map +1 -0
  3. package/dist/cjs/CronTaskHandler-DI4ENcPU.d.cts +30 -0
  4. package/dist/cjs/CronTaskHandler-DI4ENcPU.d.cts.map +1 -0
  5. package/dist/cjs/CronTaskHandler-DWPv3gFR.cjs +64 -0
  6. package/dist/cjs/CronTaskHandler-DWPv3gFR.cjs.map +1 -0
  7. package/dist/cjs/CronTaskStore-RmZUHmVY.d.cts +57 -0
  8. package/dist/cjs/CronTaskStore-RmZUHmVY.d.cts.map +1 -0
  9. package/dist/cjs/CronTaskTypes-8bwitvv3.d.cts +30 -0
  10. package/dist/cjs/CronTaskTypes-8bwitvv3.d.cts.map +1 -0
  11. package/dist/cjs/index.cjs +16 -31
  12. package/dist/cjs/index.cjs.map +1 -1
  13. package/dist/cjs/index.d.cts +17 -187
  14. package/dist/cjs/index.d.cts.map +1 -0
  15. package/dist/cjs/lib/CronTaskHandler.cjs +3 -36
  16. package/dist/cjs/lib/CronTaskHandler.d.cts +3 -0
  17. package/dist/cjs/lib/structures/CronTask.cjs +79 -60
  18. package/dist/cjs/lib/structures/CronTask.cjs.map +1 -1
  19. package/dist/cjs/lib/structures/CronTask.d.cts +3 -0
  20. package/dist/cjs/lib/structures/CronTaskStore.cjs +121 -132
  21. package/dist/cjs/lib/structures/CronTaskStore.cjs.map +1 -1
  22. package/dist/cjs/lib/structures/CronTaskStore.d.cts +3 -0
  23. package/dist/cjs/lib/types/CronTaskTypes.cjs +0 -2
  24. package/dist/cjs/lib/types/CronTaskTypes.d.cts +3 -0
  25. package/dist/cjs/lib/utils/normalizePattern.cjs +33 -35
  26. package/dist/cjs/lib/utils/normalizePattern.cjs.map +1 -1
  27. package/dist/cjs/lib/utils/normalizePattern.d.cts +6 -0
  28. package/dist/cjs/lib/utils/normalizePattern.d.cts.map +1 -0
  29. package/dist/cjs/register.cjs +25 -25
  30. package/dist/cjs/register.cjs.map +1 -1
  31. package/dist/cjs/register.d.cts +10 -8
  32. package/dist/cjs/register.d.cts.map +1 -0
  33. package/dist/esm/CronTask-bjAF2VtU.d.mts +83 -0
  34. package/dist/esm/CronTask-bjAF2VtU.d.mts.map +1 -0
  35. package/dist/esm/CronTaskHandler-C2NIvWlD.d.mts +29 -0
  36. package/dist/esm/CronTaskHandler-C2NIvWlD.d.mts.map +1 -0
  37. package/dist/esm/CronTaskHandler-DfpLsyA6.mjs +56 -0
  38. package/dist/esm/CronTaskHandler-DfpLsyA6.mjs.map +1 -0
  39. package/dist/esm/CronTaskStore-CYzBM1td.d.mts +56 -0
  40. package/dist/esm/CronTaskStore-CYzBM1td.d.mts.map +1 -0
  41. package/dist/esm/CronTaskTypes-BOgAse0r.d.mts +29 -0
  42. package/dist/esm/CronTaskTypes-BOgAse0r.d.mts.map +1 -0
  43. package/dist/esm/index.d.mts +17 -188
  44. package/dist/esm/index.d.mts.map +1 -0
  45. package/dist/esm/index.mjs +13 -8
  46. package/dist/esm/index.mjs.map +1 -1
  47. package/dist/esm/lib/CronTaskHandler.d.mts +2 -0
  48. package/dist/esm/lib/CronTaskHandler.mjs +2 -33
  49. package/dist/esm/lib/structures/CronTask.d.mts +2 -0
  50. package/dist/esm/lib/structures/CronTask.mjs +78 -59
  51. package/dist/esm/lib/structures/CronTask.mjs.map +1 -1
  52. package/dist/esm/lib/structures/CronTaskStore.d.mts +2 -0
  53. package/dist/esm/lib/structures/CronTaskStore.mjs +120 -131
  54. package/dist/esm/lib/structures/CronTaskStore.mjs.map +1 -1
  55. package/dist/esm/lib/types/CronTaskTypes.d.mts +2 -0
  56. package/dist/esm/lib/types/CronTaskTypes.mjs +1 -3
  57. package/dist/esm/lib/utils/normalizePattern.d.mts +5 -0
  58. package/dist/esm/lib/utils/normalizePattern.d.mts.map +1 -0
  59. package/dist/esm/lib/utils/normalizePattern.mjs +32 -35
  60. package/dist/esm/lib/utils/normalizePattern.mjs.map +1 -1
  61. package/dist/esm/register.d.mts +9 -8
  62. package/dist/esm/register.d.mts.map +1 -0
  63. package/dist/esm/register.mjs +20 -20
  64. package/dist/esm/register.mjs.map +1 -1
  65. package/package.json +4 -12
  66. package/dist/cjs/lib/CronTaskHandler.cjs.map +0 -1
  67. package/dist/cjs/lib/types/CronTaskTypes.cjs.map +0 -1
  68. package/dist/esm/chunk-2JTKI4GS.mjs +0 -8
  69. package/dist/esm/chunk-2JTKI4GS.mjs.map +0 -1
  70. package/dist/esm/lib/CronTaskHandler.mjs.map +0 -1
  71. package/dist/esm/lib/types/CronTaskTypes.mjs.map +0 -1
@@ -1,32 +1,32 @@
1
1
  'use strict';
2
2
 
3
- var index_cjs = require('./index.cjs');
4
- var framework = require('@sapphire/framework');
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_CronTaskHandler = require('./CronTaskHandler-DWPv3gFR.cjs');
5
+ const require_lib_structures_CronTaskStore = require('./lib/structures/CronTaskStore.cjs');
6
+ require('./index.cjs');
7
+ let _sapphire_framework = require("@sapphire/framework");
5
8
 
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var _CronTaskPlugin = class _CronTaskPlugin extends framework.Plugin {
9
- static [framework.preGenericsInitialization](options) {
10
- framework.container.cronTasks = new index_cjs.CronTaskHandler(options.cronTasks);
11
- }
12
- static [framework.postInitialization]() {
13
- this.stores.register(new index_cjs.CronTaskStore());
14
- }
15
- static async [framework.preLogin]() {
16
- if (framework.container.cronTasks.disableSentry) return;
17
- framework.container.cronTasks.sentry = await import('@sentry/node').catch(() => void 0);
18
- }
19
- static [framework.postLogin]() {
20
- this.stores.get("cron-tasks").resumeAll();
21
- }
9
+ //#region 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
+ }
22
24
  };
23
- __name(_CronTaskPlugin, "CronTaskPlugin");
24
- var CronTaskPlugin = _CronTaskPlugin;
25
- framework.SapphireClient.plugins.registerPreGenericsInitializationHook(CronTaskPlugin[framework.preGenericsInitialization], "Cron-Task-PreGenericsInitialization");
26
- framework.SapphireClient.plugins.registerPostInitializationHook(CronTaskPlugin[framework.postInitialization], "Cron-Task-PostInitialization");
27
- framework.SapphireClient.plugins.registerPreLoginHook(CronTaskPlugin[framework.preLogin], "Cron-Task-PreLogin");
28
- framework.SapphireClient.plugins.registerPostLoginHook(CronTaskPlugin[framework.postLogin], "Cron-Task-PostLogin");
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
29
 
30
+ //#endregion
30
31
  exports.CronTaskPlugin = CronTaskPlugin;
31
- //# sourceMappingURL=register.cjs.map
32
32
  //# sourceMappingURL=register.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/register.ts"],"names":["Plugin","preGenericsInitialization","container","CronTaskHandler","postInitialization","CronTaskStore","preLogin","postLogin","SapphireClient"],"mappings":";;;;;;;AAMO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,gBAAA,CAAO;AAAA,EAC1C,QAAwBC,mCAAyB,CAAA,CAAwB,OAAA,EAAwB;AAChG,IAAAC,mBAAA,CAAU,SAAA,GAAY,IAAIC,yBAAA,CAAgB,OAAA,CAAQ,SAAS,CAAA;AAAA,EAC5D;AAAA,EAEA,QAAwBC,4BAAkB,CAAA,GAAwB;AACjE,IAAA,IAAA,CAAK,MAAA,CAAO,QAAA,CAAS,IAAIC,uBAAA,EAAe,CAAA;AAAA,EACzC;AAAA,EAEA,cAA8BC,kBAAQ,CAAA,GAAwB;AAC7D,IAAA,IAAIJ,mBAAA,CAAU,UAAU,aAAA,EAAe;AACvC,IAAAA,mBAAA,CAAU,SAAA,CAAU,SAAS,MAAM,OAAO,cAAc,CAAA,CAAE,KAAA,CAAM,MAAM,MAAS,CAAA;AAAA,EAChF;AAAA,EAEA,QAAwBK,mBAAS,CAAA,GAAwB;AACxD,IAAA,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,YAAY,CAAA,CAAE,SAAA,EAAU;AAAA,EACzC;AACD,CAAA;AAjB2C,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAApC,IAAM,cAAA,GAAN;AAmBPC,wBAAA,CAAe,OAAA,CAAQ,qCAAA,CAAsC,cAAA,CAAeP,mCAAyB,GAAG,qCAAqC,CAAA;AAE7IO,wBAAA,CAAe,OAAA,CAAQ,8BAAA,CAA+B,cAAA,CAAeJ,4BAAkB,GAAG,8BAA8B,CAAA;AAExHI,wBAAA,CAAe,OAAA,CAAQ,oBAAA,CAAqB,cAAA,CAAeF,kBAAQ,GAAG,oBAAoB,CAAA;AAE1FE,wBAAA,CAAe,OAAA,CAAQ,qBAAA,CAAsB,cAAA,CAAeD,mBAAS,GAAG,qBAAqB,CAAA","file":"register.cjs","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"]}
1
+ {"version":3,"file":"register.cjs","names":[],"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,cAAA,2BAAA;CACA,QAAA,+CAAA,SAAA;EACA,8BAAA,YAAA,IAAA,wCAAA,QAAA,SAAA;CACA;CAEA,QAAA,0CAAA;EACA,KAAA,OAAA,SAAA,IAAA,mDAAA,CAAA;CACA;CAEA,cAAA,gCAAA;EACA,IAAA,8BAAA,UAAA,eAAA;EACA,8BAAA,UAAA,SAAA,MAAA,OAAA,eAAA,CAAA,YAAA,MAAA;CACA;CAEA,QAAA,iCAAA;EACA,KAAA,OAAA,IAAA,YAAA,CAAA,CAAA,UAAA;CACA;AACA;AAEA,mCAAA,QAAA,sCAAA,eAAA,gDAAA,qCAAA;AAEA,mCAAA,QAAA,+BAAA,eAAA,yCAAA,8BAAA;AAEA,mCAAA,QAAA,qBAAA,eAAA,+BAAA,oBAAA;AAEA,mCAAA,QAAA,sBAAA,eAAA,gCAAA,qBAAA"}
@@ -1,12 +1,14 @@
1
- import './index.js';
2
- import { Plugin, preGenericsInitialization, SapphireClient, postInitialization, preLogin, postLogin } from '@sapphire/framework';
3
- import { ClientOptions } from 'discord.js';
4
1
 
2
+ import { Plugin, SapphireClient, postInitialization, postLogin, preGenericsInitialization, preLogin } from "@sapphire/framework";
3
+ import { ClientOptions } from "discord.js";
4
+
5
+ //#region src/register.d.ts
5
6
  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;
7
+ static [preGenericsInitialization](this: SapphireClient, options: ClientOptions): void;
8
+ static [postInitialization](this: SapphireClient): void;
9
+ static [preLogin](this: SapphireClient): Promise<void>;
10
+ static [postLogin](this: SapphireClient): void;
10
11
  }
11
-
12
+ //#endregion
12
13
  export { CronTaskPlugin };
14
+ //# sourceMappingURL=register.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.cts","names":[],"sources":["../../src/register.ts"],"mappings":";;;;;cAMa,cAAA,SAAuB,MAAA;EAAA,QACX,yBAAA,EAA2B,IAAA,EAAM,cAAA,EAAgB,OAAA,EAAS,aAAA;EAAA,QAI1D,kBAAA,EAAoB,IAAA,EAAM,cAAA;EAAA,QAIpB,QAAA,EAAU,IAAA,EAAM,cAAA,GAAc,OAAA;EAAA,QAKpC,SAAA,EAAW,IAAA,EAAM,cAAA;AAAA"}
@@ -0,0 +1,83 @@
1
+ import { t as CronJobOptions } from "./CronTaskTypes-BOgAse0r.mjs";
2
+ import { Piece } from "@sapphire/pieces";
3
+ import { Cron } from "croner";
4
+ import { Awaitable } from "@sapphire/framework";
5
+
6
+ //#region src/lib/structures/CronTask.d.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
+ declare abstract class CronTask<Options extends CronTask.Options = CronTask.Options> extends Piece<Options, 'cron-tasks'> {
29
+ job: Cron;
30
+ constructor(context: CronTask.LoaderContext, options: Options);
31
+ abstract run(): Awaitable<unknown>;
32
+ protect?(job: Cron): Awaitable<unknown>;
33
+ catch?(error: unknown, job: Cron): Awaitable<unknown>;
34
+ /**
35
+ * A helper function to log messages with the `CronTask[${name}]` prefix.
36
+ * @param message The message to include after the prefix
37
+ * @param other Extra parameters to pass to the logger
38
+ * @example
39
+ * this.info('Hello world!'); // CronTask[my-task] Hello world!
40
+ */
41
+ info(message: string, ...other: unknown[]): void;
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: string, ...other: unknown[]): void;
50
+ /**
51
+ * A helper function to log messages with the `CronTask[${name}]` prefix.
52
+ * @param message The message to include after the prefix
53
+ * @param other Extra parameters to pass to the logger
54
+ * @example
55
+ * this.warn('Something is not right!'); // CronTask[my-task] Something is not right!
56
+ */
57
+ warn(message: string, ...other: unknown[]): void;
58
+ /**
59
+ * A helper function to log messages with the `CronTask[${name}]` prefix.
60
+ * @param message The message to include after the prefix
61
+ * @param other Extra parameters to pass to the logger
62
+ * @example
63
+ * this.debug('Something is happening!'); // CronTask[my-task] Something is happening!
64
+ */
65
+ debug(message: string, ...other: unknown[]): void;
66
+ /**
67
+ * A helper function to log messages with the `CronTask[${name}]` prefix.
68
+ * @param message The message to include after the prefix
69
+ * @param other Extra parameters to pass to the logger
70
+ * @example
71
+ * this.trace('Loaded the file.'); // CronTask[my-task] Loaded the file.
72
+ */
73
+ trace(message: string, ...other: unknown[]): void;
74
+ }
75
+ declare namespace CronTask {
76
+ type Options = Piece.Options & CronJobOptions;
77
+ /** @deprecated Use {@linkcode LoaderContext} instead. */
78
+ type Context = LoaderContext;
79
+ type LoaderContext = Piece.LoaderContext<'cron-tasks'>;
80
+ }
81
+ //#endregion
82
+ export { CronTask as t };
83
+ //# sourceMappingURL=CronTask-bjAF2VtU.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTask-bjAF2VtU.d.mts","names":[],"sources":["../../src/lib/structures/CronTask.ts"],"mappings":";;;;;;;;AA0BA;;;;;;;;;;;;;;;;;;;uBAAA,QAAA,iBAAA,QAAA,CAAA,OAAA,GAAA,QAAA,CAAA,OAAA,UAAA,KAAA,CAAA,OAAA;EAAA,GAAA,EAAA,IAAA;EAAA,WAAA,CAAA,OAAA,EAAA,QAAA,CAAA,aAAA,EAAA,OAAA,EAAA,OAAA;EAAA,SAAA,GAAA,IAAA,SAAA;EAAA,OAAA,EAAA,GAAA,EAAA,IAAA,GAAA,SAAA;EAAA,KAAA,EAAA,KAAA,WAAA,GAAA,EAAA,IAAA,GAAA,SAAA;EAAA;;;;;;;EAAA,IAAA,CAAA,OAAA,aAAA,KAAA;EAAA;;;;;;;EAAA,KAAA,CAAA,OAAA,aAAA,KAAA;EAAA;;;;;;;EAAA,IAAA,CAAA,OAAA,aAAA,KAAA;EAAA;;;;;;;EAAA,KAAA,CAAA,OAAA,aAAA,KAAA;EAAA;;AAAA;AAqEA;;;;EArEA,KAAA,CAAA,OAAA,aAAA,KAAA;AAAA;AAAA,kBAqEA,QAAA;EAAA,KAAA,OAAA,GAAA,KAAA,CAAA,OAAA,GAAA,cAAA;EAAA;EAAA,KAAA,OAAA,GAAA,aAAA;EAAA,KAAA,aAAA,GAAA,KAAA,CAAA,aAAA;AAAA"}
@@ -0,0 +1,29 @@
1
+ import { n as CronTaskHandlerOptions } from "./CronTaskTypes-BOgAse0r.mjs";
2
+ import Sentry from "@sentry/node";
3
+
4
+ //#region src/lib/CronTaskHandler.d.ts
5
+ declare class CronTaskHandler {
6
+ /**
7
+ * The default IANA/TZ timezone to use for all cron jobs.
8
+ * You can override this per task, using the timezone option.
9
+ * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
10
+ */
11
+ defaultTimezone?: CronTaskHandlerOptions['defaultTimezone'];
12
+ /**
13
+ * The ability to opt-out of instrumenting cron jobs with Sentry.
14
+ * If you don't use Sentry, you can ignore this option.
15
+ * @see https://docs.sentry.io/product/crons/
16
+ * @default false
17
+ */
18
+ disableSentry: boolean;
19
+ /**
20
+ * The Sentry instance to use for instrumenting cron jobs.
21
+ * This is only available when [`@sentry/node`](https://www.npmjs.com/package/@sentry/node)
22
+ * is installed and the {@linkcode disableSentry} option is set to false.
23
+ */
24
+ sentry?: typeof Sentry;
25
+ constructor(options?: Partial<CronTaskHandlerOptions>);
26
+ }
27
+ //#endregion
28
+ export { CronTaskHandler as t };
29
+ //# sourceMappingURL=CronTaskHandler-C2NIvWlD.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTaskHandler-C2NIvWlD.d.mts","names":[],"sources":["../../src/lib/CronTaskHandler.ts"],"mappings":";;;;cAGA,eAAA;;AAAA;;;;EAAA,eAAA,GAAA,sBAAA;EAAA;;;;;;EAAA,aAAA;EAAA;;;;;EAAA,MAAA,UAAA,MAAA;EAAA,WAAA,CAAA,OAAA,GAAA,OAAA,CAAA,sBAAA;AAAA"}
@@ -0,0 +1,56 @@
1
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
2
+ function _typeof(o) {
3
+ "@babel/helpers - typeof";
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
5
+ return typeof o;
6
+ } : function(o) {
7
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
8
+ }, _typeof(o);
9
+ }
10
+
11
+ //#endregion
12
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
13
+ function toPrimitive(t, r) {
14
+ if ("object" != _typeof(t) || !t) return t;
15
+ var e = t[Symbol.toPrimitive];
16
+ if (void 0 !== e) {
17
+ var i = e.call(t, r || "default");
18
+ if ("object" != _typeof(i)) return i;
19
+ throw new TypeError("@@toPrimitive must return a primitive value.");
20
+ }
21
+ return ("string" === r ? String : Number)(t);
22
+ }
23
+
24
+ //#endregion
25
+ //#region \0@oxc-project+runtime@0.137.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
+ //#endregion
32
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
33
+ function _defineProperty(e, r, t) {
34
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
35
+ value: t,
36
+ enumerable: !0,
37
+ configurable: !0,
38
+ writable: !0
39
+ }) : e[r] = t, e;
40
+ }
41
+
42
+ //#endregion
43
+ //#region src/lib/CronTaskHandler.ts
44
+ var CronTaskHandler = class {
45
+ constructor(options) {
46
+ _defineProperty(this, "defaultTimezone", void 0);
47
+ _defineProperty(this, "disableSentry", void 0);
48
+ _defineProperty(this, "sentry", void 0);
49
+ this.defaultTimezone = options?.defaultTimezone;
50
+ this.disableSentry = options?.disableSentry ?? false;
51
+ }
52
+ };
53
+
54
+ //#endregion
55
+ export { CronTaskHandler as t };
56
+ //# sourceMappingURL=CronTaskHandler-DfpLsyA6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTaskHandler-DfpLsyA6.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"}
@@ -0,0 +1,56 @@
1
+ import { t as CronTask } from "./CronTask-bjAF2VtU.mjs";
2
+ import { Store } from "@sapphire/pieces";
3
+
4
+ //#region src/lib/structures/CronTaskStore.d.ts
5
+ declare class CronTaskStore extends Store<CronTask, 'cron-tasks'> {
6
+ constructor();
7
+ /**
8
+ * Loops over all tasks and pauses those that are running.
9
+ *
10
+ * @remarks
11
+ * This method will only pause tasks that:
12
+ * - Are enabled
13
+ * - Are currently running
14
+ * - Have not been permanently stopped
15
+ *
16
+ * @returns CronTaskStore
17
+ */
18
+ pauseAll(): this;
19
+ /**
20
+ * Loops over all tasks and resumes those that are paused.
21
+ *
22
+ * @remarks
23
+ * This method will only resume tasks that:
24
+ * - Are enabled
25
+ * - Are not currently running
26
+ * - Have not been permanently stopped
27
+ *
28
+ * @returns CronTaskStore
29
+ */
30
+ resumeAll(): this;
31
+ /**
32
+ * Loops over all tasks and stops those that are running.
33
+ *
34
+ * @remarks
35
+ * This method will only stop tasks that:
36
+ * - Are enabled
37
+ * - Have not been permanently stopped
38
+ *
39
+ * ⚠️ Stopping jobs is **permanent** and cannot be resumed afterwards!
40
+ *
41
+ * @returns CronTaskStore
42
+ */
43
+ stopAll(): this;
44
+ set(key: string, value: CronTask): this;
45
+ /**
46
+ * Deletes a task from the store and stops it if it's running.
47
+ */
48
+ delete(key: string): boolean;
49
+ /**
50
+ * Stops all running cron jobs and clears the store.
51
+ */
52
+ clear(): void;
53
+ }
54
+ //#endregion
55
+ export { CronTaskStore as t };
56
+ //# sourceMappingURL=CronTaskStore-CYzBM1td.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTaskStore-CYzBM1td.d.mts","names":[],"sources":["../../src/lib/structures/CronTaskStore.ts"],"mappings":";;;;cAKA,aAAA,SAAA,KAAA,CAAA,QAAA;EAAA,WAAA;EAAA;;;;;;;;;;;EAAA,QAAA;EAAA;;;;;;;;;;AAAA;EAAA,SAAA;;;;;;;;;;;;;EAAA,OAAA;EAAA,GAAA,CAAA,GAAA,UAAA,KAAA,EAAA,QAAA;;;;EAAA,MAAA,CAAA,GAAA;;;;EAAA,KAAA;AAAA"}
@@ -0,0 +1,29 @@
1
+ import { CronOptions } from "croner";
2
+
3
+ //#region src/lib/types/CronTaskTypes.d.ts
4
+ interface CronTaskHandlerOptions {
5
+ /**
6
+ * The default IANA timezone to use for all cron jobs.
7
+ * You can override this per task, using the timezone option.
8
+ */
9
+ defaultTimezone?: string;
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
+ interface CronJobOptions extends Pick<CronOptions, 'maxRuns' | 'unref' | 'timezone'> {
19
+ pattern: string | Date;
20
+ /**
21
+ * If true, prevents the job from running if the previous execution is still in progress.
22
+ * If the task has a protect method, it will be called if the job is blocked.
23
+ * @default false
24
+ */
25
+ protect?: boolean;
26
+ }
27
+ //#endregion
28
+ export { CronTaskHandlerOptions as n, CronJobOptions as t };
29
+ //# sourceMappingURL=CronTaskTypes-BOgAse0r.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CronTaskTypes-BOgAse0r.d.mts","names":[],"sources":["../../src/lib/types/CronTaskTypes.ts"],"mappings":";;;UAEA,sBAAA;;AAAA;;;EAAA,eAAA;EAAA;AAgBA;;;;;EAhBA,aAAA;AAAA;AAAA,UAgBA,cAAA,SAAA,IAAA,CAAA,WAAA;EAAA,OAAA,WAAA,IAAA;EAAA;;;;;EAAA,OAAA;AAAA"}
@@ -1,192 +1,21 @@
1
- import { Piece, Store } from '@sapphire/pieces';
2
- import { Awaitable } from '@sapphire/framework';
3
- import { CronOptions, Cron } from 'croner';
4
- import Sentry from '@sentry/node';
5
-
6
- interface CronTaskHandlerOptions {
7
- /**
8
- * The default IANA timezone to use for all cron jobs.
9
- * You can override this per task, using the timezone option.
10
- */
11
- defaultTimezone?: string;
12
- /**
13
- * The ability to opt-out of instrumenting cron jobs with Sentry.
14
- * If you don't use Sentry, you can ignore this option.
15
- * @see https://docs.sentry.io/product/crons/
16
- * @default false
17
- */
18
- disableSentry: boolean;
19
- }
20
- interface CronJobOptions extends Pick<CronOptions, 'maxRuns' | 'unref' | 'timezone'> {
21
- pattern: string | Date;
22
- /**
23
- * If true, prevents the job from running if the previous execution is still in progress.
24
- * If the task has a protect method, it will be called if the job is blocked.
25
- * @default false
26
- */
27
- protect?: boolean;
28
- }
29
-
30
- /**
31
- * @example
32
- *
33
- * ```typescript
34
- * // ping.ts
35
- * import { CronTask } from '@kingsworld/plugin-cron';
36
- *
37
- * export class PingPong extends CronTask {
38
- * public constructor(context: CronTask.LoaderContext, options: CronTask.Options) {
39
- * super(context, {
40
- * ...options,
41
- * pattern: '* * * * *'
42
- * });
43
- * }
44
- *
45
- * public run() {
46
- * this.info('Ping Pong! 🏓'); // CronTask[ping] Ping Pong! 🏓
47
- * }
48
- * }
49
- * ```
50
- */
51
- declare abstract class CronTask<Options extends CronTask.Options = CronTask.Options> extends Piece<Options, 'cron-tasks'> {
52
- job: Cron;
53
- constructor(context: CronTask.LoaderContext, options: Options);
54
- abstract run(): Awaitable<unknown>;
55
- protect?(job: Cron): Awaitable<unknown>;
56
- catch?(error: unknown, job: Cron): Awaitable<unknown>;
57
- /**
58
- * A helper function to log messages with the `CronTask[${name}]` prefix.
59
- * @param message The message to include after the prefix
60
- * @param other Extra parameters to pass to the logger
61
- * @example
62
- * this.info('Hello world!'); // CronTask[my-task] Hello world!
63
- */
64
- info(message: string, ...other: unknown[]): void;
65
- /**
66
- * A helper function to log messages with the `CronTask[${name}]` prefix.
67
- * @param message The message to include after the prefix
68
- * @param other Extra parameters to pass to the logger
69
- * @example
70
- * this.error('Something went wrong!'); // CronTask[my-task] Something went wrong!
71
- */
72
- error(message: string, ...other: unknown[]): void;
73
- /**
74
- * A helper function to log messages with the `CronTask[${name}]` prefix.
75
- * @param message The message to include after the prefix
76
- * @param other Extra parameters to pass to the logger
77
- * @example
78
- * this.warn('Something is not right!'); // CronTask[my-task] Something is not right!
79
- */
80
- warn(message: string, ...other: unknown[]): void;
81
- /**
82
- * A helper function to log messages with the `CronTask[${name}]` prefix.
83
- * @param message The message to include after the prefix
84
- * @param other Extra parameters to pass to the logger
85
- * @example
86
- * this.debug('Something is happening!'); // CronTask[my-task] Something is happening!
87
- */
88
- debug(message: string, ...other: unknown[]): void;
89
- /**
90
- * A helper function to log messages with the `CronTask[${name}]` prefix.
91
- * @param message The message to include after the prefix
92
- * @param other Extra parameters to pass to the logger
93
- * @example
94
- * this.trace('Loaded the file.'); // CronTask[my-task] Loaded the file.
95
- */
96
- trace(message: string, ...other: unknown[]): void;
97
- }
98
- declare namespace CronTask {
99
- type Options = Piece.Options & CronJobOptions;
100
- /** @deprecated Use {@linkcode LoaderContext} instead. */
101
- type Context = LoaderContext;
102
- type LoaderContext = Piece.LoaderContext<'cron-tasks'>;
103
- }
104
-
105
- declare class CronTaskStore extends Store<CronTask, 'cron-tasks'> {
106
- constructor();
107
- /**
108
- * Loops over all tasks and pauses those that are running.
109
- *
110
- * @remarks
111
- * This method will only pause tasks that:
112
- * - Are enabled
113
- * - Are currently running
114
- * - Have not been permanently stopped
115
- *
116
- * @returns CronTaskStore
117
- */
118
- pauseAll(): this;
119
- /**
120
- * Loops over all tasks and resumes those that are paused.
121
- *
122
- * @remarks
123
- * This method will only resume tasks that:
124
- * - Are enabled
125
- * - Are not currently running
126
- * - Have not been permanently stopped
127
- *
128
- * @returns CronTaskStore
129
- */
130
- resumeAll(): this;
131
- /**
132
- * Loops over all tasks and stops those that are running.
133
- *
134
- * @remarks
135
- * This method will only stop tasks that:
136
- * - Are enabled
137
- * - Have not been permanently stopped
138
- *
139
- * ⚠️ Stopping jobs is **permanent** and cannot be resumed afterwards!
140
- *
141
- * @returns CronTaskStore
142
- */
143
- stopAll(): this;
144
- set(key: string, value: CronTask): this;
145
- /**
146
- * Deletes a task from the store and stops it if it's running.
147
- */
148
- delete(key: string): boolean;
149
- /**
150
- * Stops all running cron jobs and clears the store.
151
- */
152
- clear(): void;
153
- }
154
-
155
- declare class CronTaskHandler {
156
- /**
157
- * The default IANA/TZ timezone to use for all cron jobs.
158
- * You can override this per task, using the timezone option.
159
- * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
160
- */
161
- defaultTimezone?: CronTaskHandlerOptions['defaultTimezone'];
162
- /**
163
- * The ability to opt-out of instrumenting cron jobs with Sentry.
164
- * If you don't use Sentry, you can ignore this option.
165
- * @see https://docs.sentry.io/product/crons/
166
- * @default false
167
- */
168
- disableSentry: boolean;
169
- /**
170
- * The Sentry instance to use for instrumenting cron jobs.
171
- * This is only available when [`@sentry/node`](https://www.npmjs.com/package/@sentry/node)
172
- * is installed and the {@linkcode disableSentry} option is set to false.
173
- */
174
- sentry?: typeof Sentry;
175
- constructor(options?: Partial<CronTaskHandlerOptions>);
176
- }
1
+ import { n as CronTaskHandlerOptions, t as CronJobOptions } from "./CronTaskTypes-BOgAse0r.mjs";
2
+ import { t as CronTask } from "./CronTask-bjAF2VtU.mjs";
3
+ import { t as CronTaskStore } from "./CronTaskStore-CYzBM1td.mjs";
4
+ import { t as CronTaskHandler } from "./CronTaskHandler-C2NIvWlD.mjs";
177
5
 
6
+ //#region src/index.d.ts
178
7
  declare module '@sapphire/pieces' {
179
- interface Container {
180
- cronTasks: CronTaskHandler;
181
- }
182
- interface StoreRegistryEntries {
183
- 'cron-tasks': CronTaskStore;
184
- }
8
+ interface Container {
9
+ cronTasks: CronTaskHandler;
10
+ }
11
+ interface StoreRegistryEntries {
12
+ 'cron-tasks': CronTaskStore;
13
+ }
185
14
  }
186
15
  declare module 'discord.js' {
187
- interface ClientOptions {
188
- cronTasks?: Partial<CronTaskHandlerOptions>;
189
- }
16
+ interface ClientOptions {
17
+ cronTasks?: Partial<CronTaskHandlerOptions>;
18
+ }
190
19
  }
191
20
  /**
192
21
  * The [@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.
@@ -195,6 +24,6 @@ declare module 'discord.js' {
195
24
  * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild
196
25
  */
197
26
  declare const version: string;
198
-
199
- export { CronTask, CronTaskHandler, CronTaskStore, version };
200
- export type { CronJobOptions, CronTaskHandlerOptions };
27
+ //#endregion
28
+ export { CronJobOptions, CronTask, CronTaskHandler, CronTaskHandlerOptions, CronTaskStore, version };
29
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;YAO0C,SAAA;IAAA,SAAA,EAAA,eAAA;EAAA;EAAA,UAAA,oBAAA;IAAA,YAAA,EAAA,aAAA;EAAA;AAAA;AAAA;EAAA,UAQb,aAAA;IAAA,SAAA,GAAA,OAAA,CAAA,sBAAA;EAAA;AAAA;;;;;;;cAgB7B,OAAA"}
@@ -1,11 +1,16 @@
1
- import './chunk-2JTKI4GS.mjs';
2
- export * from './lib/CronTaskHandler.mjs';
3
- export * from './lib/structures/CronTask.mjs';
4
- export * from './lib/structures/CronTaskStore.mjs';
5
- export * from './lib/types/CronTaskTypes.mjs';
1
+ import { t as CronTaskHandler } from "./CronTaskHandler-DfpLsyA6.mjs";
2
+ import { CronTask } from "./lib/structures/CronTask.mjs";
3
+ import { CronTaskStore } from "./lib/structures/CronTaskStore.mjs";
6
4
 
7
- var version = "4.0.1-next.98a54cd";
5
+ //#region src/index.ts
6
+ /**
7
+ * The [@kingsworld/plugin-cron](https://github.com/Kings-World/sapphire-plugins/tree/main/packages/cron) version that you are currently using.
8
+ * An example use of this is showing it of in a bot information command.
9
+ *
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
+ */
12
+ const version = "4.0.1-next.9fe7558";
8
13
 
9
- export { version };
10
- //# sourceMappingURL=index.mjs.map
14
+ //#endregion
15
+ export { CronTask, CronTaskHandler, CronTaskStore, version };
11
16
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AA+BO,IAAM,OAAA,GAAkB","file":"index.mjs","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 = '4.0.1-next.98a54cd';\n"]}
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 * 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"}
@@ -0,0 +1,2 @@
1
+ import { t as CronTaskHandler } from "../CronTaskHandler-C2NIvWlD.mjs";
2
+ export { CronTaskHandler };