@kingsworld/plugin-cron 4.0.2-next.fd95c4b → 5.0.0-next.1cb5d86

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 (73) hide show
  1. package/dist/cjs/{CronTaskHandler-Bq4LU7qH.cjs → CronTaskHandler-fVZWiMAa.cjs} +12 -17
  2. package/dist/cjs/CronTaskHandler-fVZWiMAa.cjs.map +1 -0
  3. package/dist/cjs/index.cjs +6 -7
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +6 -8
  6. package/dist/cjs/index.d.cts.map +1 -1
  7. package/dist/cjs/lib/CronTaskHandler.cjs +1 -1
  8. package/dist/cjs/lib/CronTaskHandler.d.cts +27 -2
  9. package/dist/cjs/lib/CronTaskHandler.d.cts.map +1 -0
  10. package/dist/cjs/lib/structures/CronTask.cjs +16 -12
  11. package/dist/cjs/lib/structures/CronTask.cjs.map +1 -1
  12. package/dist/cjs/lib/structures/CronTask.d.cts +86 -2
  13. package/dist/cjs/lib/structures/CronTask.d.cts.map +1 -0
  14. package/dist/cjs/lib/structures/CronTaskStore.cjs +4 -8
  15. package/dist/cjs/lib/structures/CronTaskStore.cjs.map +1 -1
  16. package/dist/cjs/lib/structures/CronTaskStore.d.cts +49 -2
  17. package/dist/cjs/lib/structures/CronTaskStore.d.cts.map +1 -0
  18. package/dist/cjs/lib/types/CronTaskTypes.d.cts +27 -2
  19. package/dist/cjs/lib/types/CronTaskTypes.d.cts.map +1 -0
  20. package/dist/cjs/lib/utils/normalizePattern.cjs +1 -2
  21. package/dist/cjs/lib/utils/normalizePattern.cjs.map +1 -1
  22. package/dist/cjs/lib/utils/normalizePattern.d.cts +0 -2
  23. package/dist/cjs/lib/utils/normalizePattern.d.cts.map +1 -1
  24. package/dist/cjs/register.cjs +4 -5
  25. package/dist/cjs/register.cjs.map +1 -1
  26. package/dist/cjs/register.d.cts +0 -2
  27. package/dist/cjs/register.d.cts.map +1 -1
  28. package/dist/esm/{CronTask-DFQB8iCL.d.mts → CronTask-yw_82mkr.d.mts} +21 -16
  29. package/dist/esm/CronTask-yw_82mkr.d.mts.map +1 -0
  30. package/dist/esm/{CronTaskHandler-DiH4wqma.mjs → CronTaskHandler-DL6DRegu.mjs} +11 -16
  31. package/dist/esm/CronTaskHandler-DL6DRegu.mjs.map +1 -0
  32. package/dist/esm/{CronTaskHandler-bxZeiSQD.d.mts → CronTaskHandler-kTcROO_P.d.mts} +7 -7
  33. package/dist/esm/CronTaskHandler-kTcROO_P.d.mts.map +1 -0
  34. package/dist/esm/{CronTaskStore-Ei9TVxaS.d.mts → CronTaskStore-Cxdru_tz.d.mts} +2 -7
  35. package/dist/esm/CronTaskStore-Cxdru_tz.d.mts.map +1 -0
  36. package/dist/esm/{CronTaskTypes-Dj8Ny7j5.d.mts → CronTaskTypes-BRnD-V2d.d.mts} +7 -7
  37. package/dist/esm/CronTaskTypes-BRnD-V2d.d.mts.map +1 -0
  38. package/dist/esm/index.d.mts +6 -8
  39. package/dist/esm/index.d.mts.map +1 -1
  40. package/dist/esm/index.mjs +4 -5
  41. package/dist/esm/index.mjs.map +1 -1
  42. package/dist/esm/lib/CronTaskHandler.d.mts +1 -1
  43. package/dist/esm/lib/CronTaskHandler.mjs +1 -1
  44. package/dist/esm/lib/structures/CronTask.d.mts +1 -1
  45. package/dist/esm/lib/structures/CronTask.mjs +16 -12
  46. package/dist/esm/lib/structures/CronTask.mjs.map +1 -1
  47. package/dist/esm/lib/structures/CronTaskStore.d.mts +1 -1
  48. package/dist/esm/lib/structures/CronTaskStore.mjs +2 -6
  49. package/dist/esm/lib/structures/CronTaskStore.mjs.map +1 -1
  50. package/dist/esm/lib/types/CronTaskTypes.d.mts +1 -1
  51. package/dist/esm/lib/utils/normalizePattern.d.mts +0 -2
  52. package/dist/esm/lib/utils/normalizePattern.d.mts.map +1 -1
  53. package/dist/esm/lib/utils/normalizePattern.mjs +1 -2
  54. package/dist/esm/lib/utils/normalizePattern.mjs.map +1 -1
  55. package/dist/esm/register.d.mts +0 -2
  56. package/dist/esm/register.d.mts.map +1 -1
  57. package/dist/esm/register.mjs +2 -3
  58. package/dist/esm/register.mjs.map +1 -1
  59. package/package.json +7 -5
  60. package/dist/cjs/CronTask-Cl3vuqLP.d.cts +0 -83
  61. package/dist/cjs/CronTask-Cl3vuqLP.d.cts.map +0 -1
  62. package/dist/cjs/CronTaskHandler-Bq4LU7qH.cjs.map +0 -1
  63. package/dist/cjs/CronTaskHandler-XGx_tZ1o.d.cts +0 -29
  64. package/dist/cjs/CronTaskHandler-XGx_tZ1o.d.cts.map +0 -1
  65. package/dist/cjs/CronTaskStore-BUQH8cdW.d.cts +0 -56
  66. package/dist/cjs/CronTaskStore-BUQH8cdW.d.cts.map +0 -1
  67. package/dist/cjs/CronTaskTypes-BfXWfHg6.d.cts +0 -29
  68. package/dist/cjs/CronTaskTypes-BfXWfHg6.d.cts.map +0 -1
  69. package/dist/esm/CronTask-DFQB8iCL.d.mts.map +0 -1
  70. package/dist/esm/CronTaskHandler-DiH4wqma.mjs.map +0 -1
  71. package/dist/esm/CronTaskHandler-bxZeiSQD.d.mts.map +0 -1
  72. package/dist/esm/CronTaskStore-Ei9TVxaS.d.mts.map +0 -1
  73. package/dist/esm/CronTaskTypes-Dj8Ny7j5.d.mts.map +0 -1
@@ -1,4 +1,2 @@
1
- //#region src/lib/utils/normalizePattern.d.ts
2
1
  export declare function normalizePattern(pattern: string): string;
3
- //#endregion
4
2
  //# sourceMappingURL=normalizePattern.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalizePattern.d.mts","names":[],"sources":["../../../../src/lib/utils/normalizePattern.ts"],"mappings":";wBAuCA,iBAAA"}
1
+ {"version":3,"file":"normalizePattern.d.mts","names":[],"sources":["../../../../src/lib/utils/normalizePattern.ts"],"mappings":"A,wBAuCgB,iBAAiB"}
@@ -1,4 +1,4 @@
1
- //#region src/lib/utils/normalizePattern.ts
1
+ // src/lib/utils/normalizePattern.ts
2
2
  const predefined = {
3
3
  "@annually": "0 0 1 1 *",
4
4
  "@yearly": "0 0 1 1 *",
@@ -34,6 +34,5 @@ function normalizePattern(pattern) {
34
34
  return pattern.replaceAll(tokensRegex, (match) => String(Reflect.get(cronTokens, match)));
35
35
  }
36
36
 
37
- //#endregion
38
37
  export { normalizePattern };
39
38
  //# sourceMappingURL=normalizePattern.mjs.map
@@ -1 +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,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
+ {"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"}
@@ -1,12 +1,10 @@
1
1
  import "./index.mjs";
2
2
  import { Plugin, SapphireClient, postInitialization, postLogin, preGenericsInitialization, preLogin } from "@sapphire/framework";
3
3
  import { ClientOptions } from "discord.js";
4
- //#region src/register.d.ts
5
4
  export declare class CronTaskPlugin extends Plugin {
6
5
  static [preGenericsInitialization](this: SapphireClient, options: ClientOptions): void;
7
6
  static [postInitialization](this: SapphireClient): void;
8
7
  static [preLogin](this: SapphireClient): Promise<void>;
9
8
  static [postLogin](this: SapphireClient): void;
10
9
  }
11
- //#endregion
12
10
  //# sourceMappingURL=register.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.mts","names":[],"sources":["../../src/register.ts"],"mappings":";;;;qBAMA,uBAAA;UAAA,2BAAA,MAAA,gBAAA,SAAA;UAAA,oBAAA,MAAA;UAAA,UAAA,MAAA,iBAAA;UAAA,WAAA,MAAA"}
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,9 +1,9 @@
1
- import { t as CronTaskHandler } from "./CronTaskHandler-DiH4wqma.mjs";
1
+ import { t as CronTaskHandler } from "./CronTaskHandler-DL6DRegu.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";
5
5
 
6
- //#region src/register.ts
6
+ // src/register.ts
7
7
  var CronTaskPlugin = class extends Plugin {
8
8
  static [preGenericsInitialization](options) {
9
9
  container.cronTasks = new CronTaskHandler(options.cronTasks);
@@ -24,6 +24,5 @@ SapphireClient.plugins.registerPostInitializationHook(CronTaskPlugin[postInitial
24
24
  SapphireClient.plugins.registerPreLoginHook(CronTaskPlugin[preLogin], "Cron-Task-PreLogin");
25
25
  SapphireClient.plugins.registerPostLoginHook(CronTaskPlugin[postLogin], "Cron-Task-PostLogin");
26
26
 
27
- //#endregion
28
27
  export { CronTaskPlugin };
29
28
  //# sourceMappingURL=register.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.mjs","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,OAAA;CACA,QAAA,2BAAA,SAAA;EACA,UAAA,YAAA,IAAA,gBAAA,QAAA,SAAA;CACA;CAEA,QAAA,sBAAA;EACA,KAAA,OAAA,SAAA,IAAA,cAAA,CAAA;CACA;CAEA,cAAA,YAAA;EACA,IAAA,UAAA,UAAA,eAAA;EACA,UAAA,UAAA,SAAA,MAAA,OAAA,eAAA,CAAA,YAAA,MAAA;CACA;CAEA,QAAA,aAAA;EACA,KAAA,OAAA,IAAA,YAAA,CAAA,CAAA,UAAA;CACA;AACA;AAEA,eAAA,QAAA,sCAAA,eAAA,4BAAA,qCAAA;AAEA,eAAA,QAAA,+BAAA,eAAA,qBAAA,8BAAA;AAEA,eAAA,QAAA,qBAAA,eAAA,WAAA,oBAAA;AAEA,eAAA,QAAA,sBAAA,eAAA,YAAA,qBAAA"}
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,7 +1,7 @@
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": "4.0.2-next.fd95c4b",
4
+ "version": "5.0.0-next.1cb5d86",
5
5
  "author": "Seren_Modz 21 <seren@kings-world.net>",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.cjs",
@@ -41,13 +41,15 @@
41
41
  "check-update": "cliff-jumper --dry-run"
42
42
  },
43
43
  "dependencies": {
44
- "croner": "^10.0.1"
44
+ "croner": "^11.0.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@favware/cliff-jumper": "6.1.0",
48
- "@sentry/node": "10.76.2",
49
- "@types/node": "24.19.1",
50
- "tsdown": "0.23.0",
48
+ "@sapphire/framework": "5.5.1",
49
+ "@sapphire/pieces": "4.4.1",
50
+ "@sentry/node": "11.17.0",
51
+ "@types/node": "24.19.3",
52
+ "tsdown": "0.23.7",
51
53
  "typescript": "6.0.3"
52
54
  },
53
55
  "homepage": "https://github.com/Kings-World/sapphire-plugins",
@@ -1,83 +0,0 @@
1
-
2
- import { t as CronJobOptions } from "./CronTaskTypes-BfXWfHg6.cjs";
3
- import { Piece } from "@sapphire/pieces";
4
- import { Awaitable } from "@sapphire/framework";
5
- import { Cron } from "croner";
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-Cl3vuqLP.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTask-Cl3vuqLP.d.cts","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;;;;;;;;EASnC,KAAK,oBAAoB;;;;;;;;EAWzB,MAAM,oBAAoB;;;;;;;;EAW1B,KAAK,oBAAoB;;;;;;;;EAWzB,MAAM,oBAAoB;;;;;;;;EAW1B,MAAM,oBAAoB;;kBAKjB;OACJ,UAAU,MAAM,UAAU;;OAE1B,UAAU;OACV,gBAAgB,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskHandler-Bq4LU7qH.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,29 +0,0 @@
1
-
2
- import { n as CronTaskHandlerOptions } from "./CronTaskTypes-BfXWfHg6.cjs";
3
- import Sentry from "@sentry/node";
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-XGx_tZ1o.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskHandler-XGx_tZ1o.d.cts","names":[],"sources":["../../src/lib/CronTaskHandler.ts"],"mappings":";;;;cAGa;;;;;;EAML,kBAAkB;;;;;;;EAQlB;;;;;;EAOA,gBAAgB;EAEJ,YAAA,UAAU,QAAQ"}
@@ -1,56 +0,0 @@
1
-
2
- import { t as CronTask } from "./CronTask-Cl3vuqLP.cjs";
3
- import { Store } from "@sapphire/pieces";
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-BUQH8cdW.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskStore-BUQH8cdW.d.cts","names":[],"sources":["../../src/lib/structures/CronTaskStore.ts"],"mappings":";;;;cAKa,sBAAsB,MAAM;;;;;;;;;;;;;EAgBjC;;;;;;;;;;;;EAqBA;;;;;;;;;;;;;EAsBA;EAUS,IAAI,aAAa,OAAO;;;;EAsDxB,OAAO;;;;EAYP"}
@@ -1,29 +0,0 @@
1
-
2
- import { CronOptions } from "croner";
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-BfXWfHg6.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskTypes-BfXWfHg6.d.cts","names":[],"sources":["../../src/lib/types/CronTaskTypes.ts"],"mappings":";;;UAEiB;;;;;EAKhB;;;;;;;EAQA;;UAGgB,uBAAuB,KAAK;EAC5C,kBAAkB;;;;;;EAMlB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTask-DFQB8iCL.d.mts","names":[],"sources":["../../src/lib/structures/CronTask.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;uBA0BA,SAAA,gBAAA,SAAA,UAAA,SAAA,iBAAA,MAAA;EAAA,KAAA;EAAA,YAAA,SAAA,SAAA,eAAA,SAAA;WAAA,OAAA;EAAA,SAAA,KAAA,OAAA;EAAA,OAAA,gBAAA,KAAA,OAAA;;;;;;;;EAAA,KAAA,oBAAA;;;;;;;;EAAA,MAAA,oBAAA;;;;;;;;EAAA,KAAA,oBAAA;;;;;;;;EAAA,MAAA,oBAAA;;;;;;;;EAAA,MAAA,oBAAA;;kBAqEA;OAAA,UAAA,MAAA,UAAA;;OAAA,UAAA;OAAA,gBAAA,MAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskHandler-DiH4wqma.mjs","names":[],"sources":["../../src/lib/CronTaskHandler.ts"],"sourcesContent":["import type Sentry from '@sentry/node';\nimport type { CronTaskHandlerOptions } from './types/CronTaskTypes';\n\nexport class CronTaskHandler {\n\t/**\n\t * The default IANA/TZ timezone to use for all cron jobs.\n\t * You can override this per task, using the timezone option.\n\t * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n\t */\n\tpublic defaultTimezone?: CronTaskHandlerOptions['defaultTimezone'];\n\n\t/**\n\t * The ability to opt-out of instrumenting cron jobs with Sentry.\n\t * If you don't use Sentry, you can ignore this option.\n\t * @see https://docs.sentry.io/product/crons/\n\t * @default false\n\t */\n\tpublic disableSentry: boolean;\n\n\t/**\n\t * The Sentry instance to use for instrumenting cron jobs.\n\t * This is only available when [`@sentry/node`](https://www.npmjs.com/package/@sentry/node)\n\t * is installed and the {@linkcode disableSentry} option is set to false.\n\t */\n\tpublic sentry?: typeof Sentry;\n\n\tpublic constructor(options?: Partial<CronTaskHandlerOptions>) {\n\t\tthis.defaultTimezone = options?.defaultTimezone;\n\t\tthis.disableSentry = options?.disableSentry ?? false;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAA,kBAAA,MAAA;CAuBA,AAAA,YAAA,SAAA;wBAjBA;wBAQA;wBAOA;EAGA,KAAA,kBAAA,SAAA;EACA,KAAA,gBAAA,SAAA,iBAAA;CACA;AACA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskHandler-bxZeiSQD.d.mts","names":[],"sources":["../../src/lib/CronTaskHandler.ts"],"mappings":";;;cAGA;;;;;;EAAA,kBAAA;;;;;;;EAAA;;;;;;EAAA,gBAAA;EAAA,YAAA,UAAA,QAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskStore-Ei9TVxaS.d.mts","names":[],"sources":["../../src/lib/structures/CronTaskStore.ts"],"mappings":";;;cAKA,sBAAA,MAAA;EAAA;;;;;;;;;;;;EAAA;;;;;;;;;;;;EAAA;;;;;;;;;;;;;EAAA;EAAA,IAAA,aAAA,OAAA;;;;EAAA,OAAA;;;;EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CronTaskTypes-Dj8Ny7j5.d.mts","names":[],"sources":["../../src/lib/types/CronTaskTypes.ts"],"mappings":";;UAEA;;;;;EAAA;;;;;;;EAAA;;UAgBA,uBAAA,KAAA;EAAA,kBAAA;;;;;;EAAA"}