@sapphire/plugin-scheduled-tasks 10.0.2-next.f9230eb.0 → 10.0.2-next.fa3aaf1.0

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 (29) hide show
  1. package/dist/cjs/index.cjs +1 -1
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/lib/ScheduledTaskHandler.cjs +11 -26
  4. package/dist/cjs/lib/ScheduledTaskHandler.cjs.map +1 -1
  5. package/dist/cjs/lib/structures/ScheduledTask.cjs +1 -4
  6. package/dist/cjs/lib/structures/ScheduledTask.cjs.map +1 -1
  7. package/dist/cjs/lib/structures/ScheduledTaskStore.cjs +2 -6
  8. package/dist/cjs/lib/structures/ScheduledTaskStore.cjs.map +1 -1
  9. package/dist/cjs/register.cjs +1 -4
  10. package/dist/cjs/register.cjs.map +1 -1
  11. package/dist/esm/chunk-ZLJD76J6.mjs +15 -0
  12. package/dist/esm/index.mjs +2 -2
  13. package/dist/esm/index.mjs.map +1 -1
  14. package/dist/esm/lib/ScheduledTaskHandler.mjs +4 -5
  15. package/dist/esm/lib/ScheduledTaskHandler.mjs.map +1 -1
  16. package/dist/esm/lib/structures/ScheduledTask.mjs +1 -1
  17. package/dist/esm/lib/structures/ScheduledTaskStore.mjs +2 -3
  18. package/dist/esm/lib/structures/ScheduledTaskStore.mjs.map +1 -1
  19. package/dist/esm/lib/types/ScheduledTaskEvents.mjs +1 -1
  20. package/dist/esm/listeners/PluginScheduledTaskError.mjs +1 -1
  21. package/dist/esm/listeners/PluginScheduledTaskNotFound.mjs +1 -1
  22. package/dist/esm/listeners/PluginScheduledTaskStrategyClientError.mjs +1 -1
  23. package/dist/esm/listeners/PluginScheduledTaskStrategyConnectError.mjs +1 -1
  24. package/dist/esm/listeners/PluginScheduledTaskStrategyWorkerError.mjs +1 -1
  25. package/dist/esm/listeners/_load.mjs +1 -1
  26. package/dist/esm/register.mjs +1 -1
  27. package/package.json +5 -5
  28. package/dist/esm/chunk-PYETHG4R.mjs +0 -29
  29. /package/dist/esm/{chunk-PYETHG4R.mjs.map → chunk-ZLJD76J6.mjs.map} +0 -0
@@ -7,7 +7,7 @@ var ScheduledTaskEvents_cjs = require('./lib/types/ScheduledTaskEvents.cjs');
7
7
  var _load_cjs = require('./listeners/_load.cjs');
8
8
 
9
9
  // src/index.ts
10
- var version = "10.0.2-next.f9230eb.0";
10
+ var version = "10.0.2-next.fa3aaf1.0";
11
11
 
12
12
  Object.defineProperty(exports, "loadListeners", {
13
13
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,qBAAqB;AA8BvB,IAAM,UAAkB","sourcesContent":["import type { ScheduledTaskHandler } from './lib/ScheduledTaskHandler';\nimport type { ScheduledTaskStore } from './lib/structures/ScheduledTaskStore';\nimport type { ScheduledTaskHandlerOptions } from './lib/types/ScheduledTaskTypes';\n\nexport * from './lib/ScheduledTaskHandler';\nexport * from './lib/structures/ScheduledTask';\nexport * from './lib/structures/ScheduledTaskStore';\nexport * from './lib/types/ScheduledTaskEvents';\nexport type * from './lib/types/ScheduledTaskTypes';\n\nexport { loadListeners } from './listeners/_load';\n\ndeclare module '@sapphire/pieces' {\n\tinterface Container {\n\t\ttasks: ScheduledTaskHandler;\n\t}\n\n\tinterface StoreRegistryEntries {\n\t\t'scheduled-tasks': ScheduledTaskStore;\n\t}\n}\n\ndeclare module 'discord.js' {\n\texport interface ClientOptions {\n\t\ttasks: ScheduledTaskHandlerOptions;\n\t\t/**\n\t\t * If the the pre-included scheduled task error listeners should be loaded\n\t\t * @default true\n\t\t */\n\t\tloadScheduledTaskErrorListeners?: boolean;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-scheduled-tasks](https://github.com/sapphiredev/plugins/blob/main/packages/scheduled-tasks) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '10.0.2-next.f9230eb.0';\n"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,qBAAqB;AA8BvB,IAAM,UAAkB","sourcesContent":["import type { ScheduledTaskHandler } from './lib/ScheduledTaskHandler';\nimport type { ScheduledTaskStore } from './lib/structures/ScheduledTaskStore';\nimport type { ScheduledTaskHandlerOptions } from './lib/types/ScheduledTaskTypes';\n\nexport * from './lib/ScheduledTaskHandler';\nexport * from './lib/structures/ScheduledTask';\nexport * from './lib/structures/ScheduledTaskStore';\nexport * from './lib/types/ScheduledTaskEvents';\nexport type * from './lib/types/ScheduledTaskTypes';\n\nexport { loadListeners } from './listeners/_load';\n\ndeclare module '@sapphire/pieces' {\n\tinterface Container {\n\t\ttasks: ScheduledTaskHandler;\n\t}\n\n\tinterface StoreRegistryEntries {\n\t\t'scheduled-tasks': ScheduledTaskStore;\n\t}\n}\n\ndeclare module 'discord.js' {\n\texport interface ClientOptions {\n\t\ttasks: ScheduledTaskHandlerOptions;\n\t\t/**\n\t\t * If the the pre-included scheduled task error listeners should be loaded\n\t\t * @default true\n\t\t */\n\t\tloadScheduledTaskErrorListeners?: boolean;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-scheduled-tasks](https://github.com/sapphiredev/plugins/blob/main/packages/scheduled-tasks) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '10.0.2-next.fa3aaf1.0';\n"]}
@@ -7,30 +7,16 @@ var ScheduledTaskEvents_cjs = require('./types/ScheduledTaskEvents.cjs');
7
7
  var utilities = require('@sapphire/utilities');
8
8
 
9
9
  var __defProp = Object.defineProperty;
10
+ var __typeError = (msg) => {
11
+ throw TypeError(msg);
12
+ };
10
13
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
14
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
12
- var __publicField = (obj, key, value) => {
13
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
14
- return value;
15
- };
16
- var __accessCheck = (obj, member, msg) => {
17
- if (!member.has(obj))
18
- throw TypeError("Cannot " + msg);
19
- };
20
- var __privateGet = (obj, member, getter) => {
21
- __accessCheck(obj, member, "read from private field");
22
- return getter ? getter.call(obj) : member.get(obj);
23
- };
24
- var __privateAdd = (obj, member, value) => {
25
- if (member.has(obj))
26
- throw TypeError("Cannot add the same private member more than once");
27
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
28
- };
29
- var __privateSet = (obj, member, value, setter) => {
30
- __accessCheck(obj, member, "write to private field");
31
- setter ? setter.call(obj, value) : member.set(obj, value);
32
- return value;
33
- };
15
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
16
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
17
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
18
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
19
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
34
20
  var _client, _worker;
35
21
  var _ScheduledTaskHandler = class _ScheduledTaskHandler {
36
22
  constructor(options) {
@@ -42,8 +28,8 @@ var _ScheduledTaskHandler = class _ScheduledTaskHandler {
42
28
  * The name of the queue associated with the scheduled task handler.
43
29
  */
44
30
  __publicField(this, "queue");
45
- __privateAdd(this, _client, void 0);
46
- __privateAdd(this, _worker, void 0);
31
+ __privateAdd(this, _client);
32
+ __privateAdd(this, _worker);
47
33
  this.queue = options.queue ?? "scheduled-tasks";
48
34
  this.options = options.bull;
49
35
  __privateSet(this, _client, new bullmq.Queue(this.queue, this.options));
@@ -172,8 +158,7 @@ var _ScheduledTaskHandler = class _ScheduledTaskHandler {
172
158
  */
173
159
  async get(id) {
174
160
  const job = await __privateGet(this, _client).getJob(id);
175
- if (utilities.isNullish(job))
176
- return void 0;
161
+ if (utilities.isNullish(job)) return void 0;
177
162
  return job;
178
163
  }
179
164
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/ScheduledTaskHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,WAAW,cAAc;AAClC,SAAS,iBAAiB;AAC1B,SAAc,OAAO,QAA6C,4BAA4B;AAE9F,SAAS,2BAA2B;AAgBpC,SAAS,iBAAiB;AApB1B;AAsBO,IAAM,wBAAN,MAAM,sBAAqB;AAAA,EAc1B,YAAY,SAAsC;AAVzD;AAAA;AAAA;AAAA,wBAAgB;AAKhB;AAAA;AAAA;AAAA,wBAAgB;AAEhB;AACA;AAGC,SAAK,QAAQ,QAAQ,SAAS;AAC9B,SAAK,UAAU,QAAQ;AAEvB,uBAAK,SAAU,IAAI,MAAM,KAAK,OAAO,KAAK,OAAO;AACjD,uBAAK,SAAU,IAAI;AAAA,MAClB,KAAK;AAAA;AAAA,MACL,OAAO,QAAQ,KAAK,IAAI,EAAE,MAAM,IAAI,MAA4B,SAAS,IAAI,KAAK,CAAC;AAAA,MACnF,EAAE,YAAY,KAAK,QAAQ,WAAW;AAAA,IACvC;AAEA,uBAAK,SAAQ,GAAG,SAAS,CAAC,UAAU;AACnC,UAAI,qBAAqB,KAAK,GAAG;AAChC,kBAAU,OAAO,KAAK,oBAAoB,kCAAkC,KAAK;AAAA,MAClF,OAAO;AACN,kBAAU,OAAO,KAAK,oBAAoB,mCAAmC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AAM,QAAQ,KAAK,MAAM,IAAI,KAAK,IAAI;AAEtC,QAAI,CAAC,OAAO;AACX,gBAAU,OAAO,KAAK,oBAAoB,uBAAuB,UAAU,OAAO;AAElF,aAAO;AAAA,IACR;AAEA,UAAM,SAAS,MAAM,OAAO,UAAU,YAAY;AACjD,gBAAU,OAAO,KAAK,oBAAoB,kBAAkB,OAAO,OAAO;AAE1E,YAAM,YAAY,IAAI,UAAU;AAChC,YAAM,gBAAgB,MAAM,MAAM,IAAI,OAAO;AAC7C,YAAM,EAAE,SAAS,IAAI,UAAU,KAAK;AAEpC,gBAAU,OAAO,KAAK,oBAAoB,sBAAsB,OAAO,SAAS,eAAe,QAAQ;AAEvG,aAAO;AAAA,IACR,CAAC;AAED,WAAO,WAAW,CAAC,UAAU,UAAU,OAAO,KAAK,oBAAoB,oBAAoB,OAAO,OAAO,OAAO,CAAC;AAEjH,UAAM,QAAQ,OAAO,SAAS,IAAI;AAElC,cAAU,OAAO,KAAK,oBAAoB,uBAAuB,OAAO,OAAO,OAAO;AAEtF,WAAO;AAAA,EACR;AAAA,EAEA,IAAY,QAA4B;AACvC,WAAO,UAAU,OAAO,OAAO,IAAI,iBAAiB;AAAA,EACrD;AAAA,EAEQ,YAAY,MAAiE;AACpF,QAAI,OAAO,SAAS,UAAU;AAC7B,aAAO,EAAE,MAAM,MAAM,SAAS,OAAU;AAAA,IACzC;AAEA,QAAI,aAAa,MAAM;AACtB,aAAO,EAAE,MAAM,KAAK,MAAM,SAAS,KAAK,QAAQ;AAAA,IACjD;AAEA,WAAO,EAAE,MAAM,KAAK,MAAM,SAAS,OAAU;AAAA,EAC9C;AACD;AAtNC;AACA;AAZiC;AAA3B,IAAM,uBAAN","sourcesContent":["import { container, Result } from '@sapphire/framework';\nimport { Stopwatch } from '@sapphire/stopwatch';\nimport { Job, Queue, Worker, type JobsOptions, type QueueOptions, isNotConnectionError } from 'bullmq';\nimport type { ScheduledTaskStore } from './structures/ScheduledTaskStore';\nimport { ScheduledTaskEvents } from './types/ScheduledTaskEvents';\nimport type {\n\tBullClient,\n\tScheduledTaskCreateRepeatedTask,\n\tScheduledTaskHandlerOptions,\n\tScheduledTaskListOptions,\n\tScheduledTaskListRepeatedOptions,\n\tScheduledTaskListRepeatedReturnType,\n\tScheduledTasksResolvable,\n\tScheduledTasksKeys,\n\tScheduledTasksTaskOptions,\n\tScheduledTasksKeysNoPayload,\n\tScheduledTasksJob,\n\tScheduledTasksResolvablePayload,\n\tScheduledTasksPayload\n} from './types/ScheduledTaskTypes';\nimport { isNullish } from '@sapphire/utilities';\n\nexport class ScheduledTaskHandler {\n\t/**\n\t * The queue options for the scheduled task handler.\n\t */\n\tpublic readonly options: QueueOptions;\n\n\t/**\n\t * The name of the queue associated with the scheduled task handler.\n\t */\n\tpublic readonly queue: string;\n\n\t#client: BullClient;\n\t#worker: Worker;\n\n\tpublic constructor(options: ScheduledTaskHandlerOptions) {\n\t\tthis.queue = options.queue ?? 'scheduled-tasks';\n\t\tthis.options = options.bull;\n\n\t\tthis.#client = new Queue(this.queue, this.options);\n\t\tthis.#worker = new Worker(\n\t\t\tthis.queue, //\n\t\t\tasync (job) => this.run({ name: job.name as ScheduledTasksKeys, payload: job.data }),\n\t\t\t{ connection: this.options.connection }\n\t\t);\n\n\t\tthis.#client.on('error', (error) => {\n\t\t\tif (isNotConnectionError(error)) {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyClientError, error);\n\t\t\t} else {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyConnectError, error);\n\t\t\t}\n\t\t});\n\t\tthis.#worker.on('error', (error) => {\n\t\t\tif (isNotConnectionError(error)) {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyWorkerError, error);\n\t\t\t} else {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyConnectError, error);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic get client(): BullClient {\n\t\treturn this.#client;\n\t}\n\n\t/**\n\t * Closes the internal client and worker.\n\t */\n\tpublic async close(): Promise<void> {\n\t\tawait Promise.all([\n\t\t\tthis.#client.close(), //\n\t\t\tthis.#worker.close()\n\t\t]);\n\t}\n\n\t/**\n\t * Creates a scheduled task.\n\t *\n\t * @param task - The task to be scheduled.\n\t * @param options - The options for the task.\n\t */\n\tpublic async create<T extends ScheduledTasksResolvable>(\n\t\ttask: T, //\n\t\toptions?: ScheduledTasksTaskOptions | number\n\t): Promise<ScheduledTasksJob<T>> {\n\t\tconst { name: taskName, payload } = this.resolveTask(task);\n\n\t\tif (isNullish(options)) {\n\t\t\treturn this.#client.add(taskName, payload) as Promise<ScheduledTasksJob<T>>;\n\t\t}\n\n\t\tif (typeof options === 'number') {\n\t\t\toptions = {\n\t\t\t\trepeated: false,\n\t\t\t\tdelay: options\n\t\t\t};\n\t\t}\n\n\t\tconst { repeated, pattern, interval, delay, customJobOptions, timezone } = options;\n\t\tlet jobOptions: JobsOptions = {\n\t\t\tdelay,\n\t\t\t...customJobOptions\n\t\t};\n\n\t\tif (repeated) {\n\t\t\tjobOptions = {\n\t\t\t\t...jobOptions,\n\t\t\t\trepeat: interval //\n\t\t\t\t\t? { every: interval }\n\t\t\t\t\t: { pattern, tz: timezone }\n\t\t\t};\n\t\t}\n\n\t\treturn this.#client.add(taskName, payload, jobOptions) as Promise<ScheduledTasksJob<T>>;\n\t}\n\n\t/**\n\t * Creates repeated tasks.\n\t *\n\t * @param tasks - An optional array of tasks to create. If not provided, it will create tasks based on the stored repeated tasks.\n\t */\n\tpublic async createRepeated(tasks?: ScheduledTaskCreateRepeatedTask[]): Promise<void> {\n\t\tif (tasks === undefined) {\n\t\t\tconst repeatedTasks: ScheduledTaskCreateRepeatedTask[] = this.store.repeatedTasks.map((piece) => ({\n\t\t\t\tname: piece.name as ScheduledTasksKeysNoPayload,\n\t\t\t\toptions: {\n\t\t\t\t\trepeated: true,\n\t\t\t\t\t...(piece.interval\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tinterval: piece.interval,\n\t\t\t\t\t\t\t\tcustomJobOptions: piece.customJobOptions\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tpattern: piece.pattern!,\n\t\t\t\t\t\t\t\ttimezone: piece.timezone,\n\t\t\t\t\t\t\t\tcustomJobOptions: piece.customJobOptions\n\t\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\ttasks = repeatedTasks;\n\t\t}\n\n\t\tfor (const task of tasks) {\n\t\t\tawait this.create(task.name, task.options);\n\t\t}\n\t}\n\n\t/**\n\t * Deletes a scheduled task by its ID.\n\t *\n\t * @param id - The ID of the task to delete.\n\t */\n\tpublic async delete(id: string): Promise<void> {\n\t\tconst job = (await this.get(id as ScheduledTasksKeys)) as unknown as Job<unknown> | undefined;\n\t\treturn job?.remove();\n\t}\n\n\t/**\n\t * Retrieves a list of scheduled tasks based on the provided options.\n\t *\n\t * @param options - The options for filtering the list of scheduled tasks.\n\t */\n\tpublic list(options: ScheduledTaskListOptions): Promise<Job<unknown>[]> {\n\t\tconst { types, start, end, asc } = options;\n\n\t\treturn this.#client.getJobs(types, start, end, asc);\n\t}\n\n\t/**\n\t * Retrieves a list of repeated scheduled tasks based on the provided options.\n\t *\n\t * @param options - The options for filtering the list of repeated scheduled tasks.\n\t */\n\tpublic listRepeated(options: ScheduledTaskListRepeatedOptions): Promise<ScheduledTaskListRepeatedReturnType> {\n\t\tconst { start, end, asc } = options;\n\n\t\treturn this.#client.getRepeatableJobs(start, end, asc);\n\t}\n\n\t/**\n\t * Retrieves a scheduled task by its ID.\n\t *\n\t * @param id - The ID of the scheduled task to retrieve.\n\t */\n\tpublic async get<T extends ScheduledTasksKeys>(id: T): Promise<Job<ScheduledTasksPayload<T>> | undefined> {\n\t\tconst job = await this.#client.getJob(id);\n\t\tif (isNullish(job)) return undefined;\n\n\t\treturn job as Job<ScheduledTasksPayload<T>>;\n\t}\n\n\t/**\n\t * Runs a scheduled task with the given name and payload.\n\t *\n\t * @param task - The name of the scheduled task to run.\n\t *\n\t * @remarks `undefined` will be returned if the task was not found.\n\t */\n\tpublic async run(task: ScheduledTasksResolvable): Promise<number | null | undefined> {\n\t\tconst { name: taskName, payload } = this.resolveTask(task);\n\t\tconst piece = this.store.get(task.name);\n\n\t\tif (!piece) {\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskNotFound, taskName, payload);\n\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst result = await Result.fromAsync(async () => {\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskRun, piece, payload);\n\n\t\t\tconst stopwatch = new Stopwatch();\n\t\t\tconst taskRunResult = await piece.run(payload);\n\t\t\tconst { duration } = stopwatch.stop();\n\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskSuccess, piece, payload, taskRunResult, duration);\n\n\t\t\treturn duration;\n\t\t});\n\n\t\tresult.inspectErr((error) => container.client.emit(ScheduledTaskEvents.ScheduledTaskError, error, piece, payload));\n\n\t\tconst value = result.unwrapOr(null);\n\n\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskFinished, piece, value, payload);\n\n\t\treturn value;\n\t}\n\n\tprivate get store(): ScheduledTaskStore {\n\t\treturn container.client.stores.get('scheduled-tasks');\n\t}\n\n\tprivate resolveTask(task: ScheduledTasksResolvable): ScheduledTasksResolvablePayload {\n\t\tif (typeof task === 'string') {\n\t\t\treturn { name: task, payload: undefined };\n\t\t}\n\n\t\tif ('payload' in task) {\n\t\t\treturn { name: task.name, payload: task.payload };\n\t\t}\n\n\t\treturn { name: task.name, payload: undefined };\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/ScheduledTaskHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,SAAS,WAAW,cAAc;AAClC,SAAS,iBAAiB;AAC1B,SAAc,OAAO,QAA6C,4BAA4B;AAE9F,SAAS,2B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AAO,SAAS,IAAI;AAElC,cAAU,OAAO,KAAK,oBAAoB,uBAAuB,OAAO,OAAO,OAAO;AAEtF,WAAO;AAAA,EACR;AAAA,EAEA,IAAY,QAA4B;AACvC,WAAO,UAAU,OAAO,OAAO,IAAI,iBAAiB;AAAA,EACrD;AAAA,EAEQ,YAAY,MAAiE;AACpF,QAAI,OAAO,SAAS,UAAU;AAC7B,aAAO,EAAE,MAAM,MAAM,SAAS,OAAU;AAAA,IACzC;AAEA,QAAI,aAAa,MAAM;AACtB,aAAO,EAAE,MAAM,KAAK,MAAM,SAAS,KAAK,QAAQ;AAAA,IACjD;AAEA,WAAO,EAAE,MAAM,KAAK,MAAM,SAAS,OAAU;AAAA,EAC9C;AACD;AAtNC;AACA;AAZiC;AAA3B,IAAM,uBAAN","sourcesContent":["import { container, Result } from '@sapphire/framework';\nimport { Stopwatch } from '@sapphire/stopwatch';\nimport { Job, Queue, Worker, type JobsOptions, type QueueOptions, isNotConnectionError } from 'bullmq';\nimport type { ScheduledTaskStore } from './structures/ScheduledTaskStore';\nimport { ScheduledTaskEvents } from './types/ScheduledTaskEvents';\nimport type {\n\tBullClient,\n\tScheduledTaskCreateRepeatedTask,\n\tScheduledTaskHandlerOptions,\n\tScheduledTaskListOptions,\n\tScheduledTaskListRepeatedOptions,\n\tScheduledTaskListRepeatedReturnType,\n\tScheduledTasksResolvable,\n\tScheduledTasksKeys,\n\tScheduledTasksTaskOptions,\n\tScheduledTasksKeysNoPayload,\n\tScheduledTasksJob,\n\tScheduledTasksResolvablePayload,\n\tScheduledTasksPayload\n} from './types/ScheduledTaskTypes';\nimport { isNullish } from '@sapphire/utilities';\n\nexport class ScheduledTaskHandler {\n\t/**\n\t * The queue options for the scheduled task handler.\n\t */\n\tpublic readonly options: QueueOptions;\n\n\t/**\n\t * The name of the queue associated with the scheduled task handler.\n\t */\n\tpublic readonly queue: string;\n\n\t#client: BullClient;\n\t#worker: Worker;\n\n\tpublic constructor(options: ScheduledTaskHandlerOptions) {\n\t\tthis.queue = options.queue ?? 'scheduled-tasks';\n\t\tthis.options = options.bull;\n\n\t\tthis.#client = new Queue(this.queue, this.options);\n\t\tthis.#worker = new Worker(\n\t\t\tthis.queue, //\n\t\t\tasync (job) => this.run({ name: job.name as ScheduledTasksKeys, payload: job.data }),\n\t\t\t{ connection: this.options.connection }\n\t\t);\n\n\t\tthis.#client.on('error', (error) => {\n\t\t\tif (isNotConnectionError(error)) {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyClientError, error);\n\t\t\t} else {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyConnectError, error);\n\t\t\t}\n\t\t});\n\t\tthis.#worker.on('error', (error) => {\n\t\t\tif (isNotConnectionError(error)) {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyWorkerError, error);\n\t\t\t} else {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyConnectError, error);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic get client(): BullClient {\n\t\treturn this.#client;\n\t}\n\n\t/**\n\t * Closes the internal client and worker.\n\t */\n\tpublic async close(): Promise<void> {\n\t\tawait Promise.all([\n\t\t\tthis.#client.close(), //\n\t\t\tthis.#worker.close()\n\t\t]);\n\t}\n\n\t/**\n\t * Creates a scheduled task.\n\t *\n\t * @param task - The task to be scheduled.\n\t * @param options - The options for the task.\n\t */\n\tpublic async create<T extends ScheduledTasksResolvable>(\n\t\ttask: T, //\n\t\toptions?: ScheduledTasksTaskOptions | number\n\t): Promise<ScheduledTasksJob<T>> {\n\t\tconst { name: taskName, payload } = this.resolveTask(task);\n\n\t\tif (isNullish(options)) {\n\t\t\treturn this.#client.add(taskName, payload) as Promise<ScheduledTasksJob<T>>;\n\t\t}\n\n\t\tif (typeof options === 'number') {\n\t\t\toptions = {\n\t\t\t\trepeated: false,\n\t\t\t\tdelay: options\n\t\t\t};\n\t\t}\n\n\t\tconst { repeated, pattern, interval, delay, customJobOptions, timezone } = options;\n\t\tlet jobOptions: JobsOptions = {\n\t\t\tdelay,\n\t\t\t...customJobOptions\n\t\t};\n\n\t\tif (repeated) {\n\t\t\tjobOptions = {\n\t\t\t\t...jobOptions,\n\t\t\t\trepeat: interval //\n\t\t\t\t\t? { every: interval }\n\t\t\t\t\t: { pattern, tz: timezone }\n\t\t\t};\n\t\t}\n\n\t\treturn this.#client.add(taskName, payload, jobOptions) as Promise<ScheduledTasksJob<T>>;\n\t}\n\n\t/**\n\t * Creates repeated tasks.\n\t *\n\t * @param tasks - An optional array of tasks to create. If not provided, it will create tasks based on the stored repeated tasks.\n\t */\n\tpublic async createRepeated(tasks?: ScheduledTaskCreateRepeatedTask[]): Promise<void> {\n\t\tif (tasks === undefined) {\n\t\t\tconst repeatedTasks: ScheduledTaskCreateRepeatedTask[] = this.store.repeatedTasks.map((piece) => ({\n\t\t\t\tname: piece.name as ScheduledTasksKeysNoPayload,\n\t\t\t\toptions: {\n\t\t\t\t\trepeated: true,\n\t\t\t\t\t...(piece.interval\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tinterval: piece.interval,\n\t\t\t\t\t\t\t\tcustomJobOptions: piece.customJobOptions\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tpattern: piece.pattern!,\n\t\t\t\t\t\t\t\ttimezone: piece.timezone,\n\t\t\t\t\t\t\t\tcustomJobOptions: piece.customJobOptions\n\t\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\ttasks = repeatedTasks;\n\t\t}\n\n\t\tfor (const task of tasks) {\n\t\t\tawait this.create(task.name, task.options);\n\t\t}\n\t}\n\n\t/**\n\t * Deletes a scheduled task by its ID.\n\t *\n\t * @param id - The ID of the task to delete.\n\t */\n\tpublic async delete(id: string): Promise<void> {\n\t\tconst job = (await this.get(id as ScheduledTasksKeys)) as unknown as Job<unknown> | undefined;\n\t\treturn job?.remove();\n\t}\n\n\t/**\n\t * Retrieves a list of scheduled tasks based on the provided options.\n\t *\n\t * @param options - The options for filtering the list of scheduled tasks.\n\t */\n\tpublic list(options: ScheduledTaskListOptions): Promise<Job<unknown>[]> {\n\t\tconst { types, start, end, asc } = options;\n\n\t\treturn this.#client.getJobs(types, start, end, asc);\n\t}\n\n\t/**\n\t * Retrieves a list of repeated scheduled tasks based on the provided options.\n\t *\n\t * @param options - The options for filtering the list of repeated scheduled tasks.\n\t */\n\tpublic listRepeated(options: ScheduledTaskListRepeatedOptions): Promise<ScheduledTaskListRepeatedReturnType> {\n\t\tconst { start, end, asc } = options;\n\n\t\treturn this.#client.getRepeatableJobs(start, end, asc);\n\t}\n\n\t/**\n\t * Retrieves a scheduled task by its ID.\n\t *\n\t * @param id - The ID of the scheduled task to retrieve.\n\t */\n\tpublic async get<T extends ScheduledTasksKeys>(id: T): Promise<Job<ScheduledTasksPayload<T>> | undefined> {\n\t\tconst job = await this.#client.getJob(id);\n\t\tif (isNullish(job)) return undefined;\n\n\t\treturn job as Job<ScheduledTasksPayload<T>>;\n\t}\n\n\t/**\n\t * Runs a scheduled task with the given name and payload.\n\t *\n\t * @param task - The name of the scheduled task to run.\n\t *\n\t * @remarks `undefined` will be returned if the task was not found.\n\t */\n\tpublic async run(task: ScheduledTasksResolvable): Promise<number | null | undefined> {\n\t\tconst { name: taskName, payload } = this.resolveTask(task);\n\t\tconst piece = this.store.get(task.name);\n\n\t\tif (!piece) {\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskNotFound, taskName, payload);\n\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst result = await Result.fromAsync(async () => {\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskRun, piece, payload);\n\n\t\t\tconst stopwatch = new Stopwatch();\n\t\t\tconst taskRunResult = await piece.run(payload);\n\t\t\tconst { duration } = stopwatch.stop();\n\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskSuccess, piece, payload, taskRunResult, duration);\n\n\t\t\treturn duration;\n\t\t});\n\n\t\tresult.inspectErr((error) => container.client.emit(ScheduledTaskEvents.ScheduledTaskError, error, piece, payload));\n\n\t\tconst value = result.unwrapOr(null);\n\n\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskFinished, piece, value, payload);\n\n\t\treturn value;\n\t}\n\n\tprivate get store(): ScheduledTaskStore {\n\t\treturn container.client.stores.get('scheduled-tasks');\n\t}\n\n\tprivate resolveTask(task: ScheduledTasksResolvable): ScheduledTasksResolvablePayload {\n\t\tif (typeof task === 'string') {\n\t\t\treturn { name: task, payload: undefined };\n\t\t}\n\n\t\tif ('payload' in task) {\n\t\t\treturn { name: task.name, payload: task.payload };\n\t\t}\n\n\t\treturn { name: task.name, payload: undefined };\n\t}\n}\n"]}
@@ -5,10 +5,7 @@ var pieces = require('@sapphire/pieces');
5
5
  var __defProp = Object.defineProperty;
6
6
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
7
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __publicField = (obj, key, value) => {
9
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
10
- return value;
11
- };
8
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
12
9
  var _ScheduledTask = class _ScheduledTask extends pieces.Piece {
13
10
  constructor(context, options) {
14
11
  super(context, options);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/structures/ScheduledTask.ts"],"names":[],"mappings":";;;;;;;;;AAAA,SAAS,aAAa;AASf,IAAe,iBAAf,MAAe,uBAGZ,MAAkC;AAAA,EAMpC,YAAY,SAAsC,SAA+B;AACvF,UAAM,SAAS,OAAO;AANvB,wBAAgB;AAChB,wBAAgB;AAChB,wBAAgB;AAChB,wBAAgB;AAIf,SAAK,WAAW,QAAQ,YAAY;AACpC,SAAK,UAAU,QAAQ,WAAW;AAClC,SAAK,mBAAmB,QAAQ;AAChC,SAAK,WAAW,QAAQ,YAAY;AAAA,EACrC;AAGD;AAf4C;AAHrC,IAAe,gBAAf","sourcesContent":["import { Piece } from '@sapphire/pieces';\nimport type { Awaitable } from '@sapphire/utilities';\nimport type { JobsOptions } from 'bullmq';\nimport type { ScheduledTasksKeys, ScheduledTasksPayload } from '../types/ScheduledTaskTypes';\n\n/**\n * Represents a scheduled task that can be run at a specified interval or pattern.\n * @abstract\n */\nexport abstract class ScheduledTask<\n\tTask extends ScheduledTasksKeys = ScheduledTasksKeys, //\n\tOptions extends ScheduledTask.Options = ScheduledTask.Options\n> extends Piece<Options, 'scheduled-tasks'> {\n\tpublic readonly interval: number | null;\n\tpublic readonly pattern: string | null;\n\tpublic readonly timezone: string;\n\tpublic readonly customJobOptions?: ScheduledTaskCustomJobOptions;\n\n\tpublic constructor(context: ScheduledTask.LoaderContext, options: ScheduledTaskOptions) {\n\t\tsuper(context, options);\n\t\tthis.interval = options.interval ?? null;\n\t\tthis.pattern = options.pattern ?? null;\n\t\tthis.customJobOptions = options.customJobOptions;\n\t\tthis.timezone = options.timezone ?? 'UTC';\n\t}\n\n\tpublic abstract run(payload: ScheduledTasksPayload<Task>): Awaitable<unknown>;\n}\n\n/**\n * Options for configuring a scheduled task.\n */\nexport interface ScheduledTaskOptions extends Piece.Options {\n\t/**\n\t * The interval (in milliseconds) at which the task should run.\n\t */\n\tinterval?: number | null;\n\t/**\n\t * A cron pattern specifying when the task should run.\n\t */\n\tpattern?: string | null;\n\t/**\n\t * Custom options to pass to the job scheduler.\n\t */\n\tcustomJobOptions?: ScheduledTaskCustomJobOptions;\n\n\t/**\n\t * The timezone to use for the task.\n\t * @default 'UTC'\n\t */\n\ttimezone?: string | null;\n}\n\n/**\n * Custom options for a job in a scheduled task.\n */\nexport type ScheduledTaskCustomJobOptions = Omit<JobsOptions, 'repeat'>;\n\n/**\n * The namespace for {@link ScheduledTask}.\n */\nexport namespace ScheduledTask {\n\t/**\n\t * The options for a {@link ScheduledTask}.\n\t */\n\texport type Options = ScheduledTaskOptions;\n\n\t/**\n\t * The context for a {@link ScheduledTask}.\n\t * @deprecated Use {@linkcode LoaderContext} instead.\n\t */\n\texport type Context = LoaderContext;\n\texport type LoaderContext = Piece.LoaderContext<'scheduled-tasks'>;\n\texport type JSON = Piece.JSON;\n\texport type LocationJSON = Piece.LocationJSON;\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/structures/ScheduledTask.ts"],"names":[],"mappings":";;;;;;AAAA,SAAS,aAAa;AASf,IAAe,iBAAf,MAAe,uBAGZ,MAAkC;AAAA,EAMpC,YAAY,SAAsC,SAA+B;AACvF,UAAM,SAAS,OAAO;AANvB,wBAAgB;AAChB,wBAAgB;AAChB,wBAAgB;AAChB,wBAAgB;AAIf,SAAK,WAAW,QAAQ,YAAY;AACpC,SAAK,UAAU,QAAQ,WAAW;AAClC,SAAK,mBAAmB,QAAQ;AAChC,SAAK,WAAW,QAAQ,YAAY;AAAA,EACrC;AAGD;AAf4C;AAHrC,IAAe,gBAAf","sourcesContent":["import { Piece } from '@sapphire/pieces';\nimport type { Awaitable } from '@sapphire/utilities';\nimport type { JobsOptions } from 'bullmq';\nimport type { ScheduledTasksKeys, ScheduledTasksPayload } from '../types/ScheduledTaskTypes';\n\n/**\n * Represents a scheduled task that can be run at a specified interval or pattern.\n * @abstract\n */\nexport abstract class ScheduledTask<\n\tTask extends ScheduledTasksKeys = ScheduledTasksKeys, //\n\tOptions extends ScheduledTask.Options = ScheduledTask.Options\n> extends Piece<Options, 'scheduled-tasks'> {\n\tpublic readonly interval: number | null;\n\tpublic readonly pattern: string | null;\n\tpublic readonly timezone: string;\n\tpublic readonly customJobOptions?: ScheduledTaskCustomJobOptions;\n\n\tpublic constructor(context: ScheduledTask.LoaderContext, options: ScheduledTaskOptions) {\n\t\tsuper(context, options);\n\t\tthis.interval = options.interval ?? null;\n\t\tthis.pattern = options.pattern ?? null;\n\t\tthis.customJobOptions = options.customJobOptions;\n\t\tthis.timezone = options.timezone ?? 'UTC';\n\t}\n\n\tpublic abstract run(payload: ScheduledTasksPayload<Task>): Awaitable<unknown>;\n}\n\n/**\n * Options for configuring a scheduled task.\n */\nexport interface ScheduledTaskOptions extends Piece.Options {\n\t/**\n\t * The interval (in milliseconds) at which the task should run.\n\t */\n\tinterval?: number | null;\n\t/**\n\t * A cron pattern specifying when the task should run.\n\t */\n\tpattern?: string | null;\n\t/**\n\t * Custom options to pass to the job scheduler.\n\t */\n\tcustomJobOptions?: ScheduledTaskCustomJobOptions;\n\n\t/**\n\t * The timezone to use for the task.\n\t * @default 'UTC'\n\t */\n\ttimezone?: string | null;\n}\n\n/**\n * Custom options for a job in a scheduled task.\n */\nexport type ScheduledTaskCustomJobOptions = Omit<JobsOptions, 'repeat'>;\n\n/**\n * The namespace for {@link ScheduledTask}.\n */\nexport namespace ScheduledTask {\n\t/**\n\t * The options for a {@link ScheduledTask}.\n\t */\n\texport type Options = ScheduledTaskOptions;\n\n\t/**\n\t * The context for a {@link ScheduledTask}.\n\t * @deprecated Use {@linkcode LoaderContext} instead.\n\t */\n\texport type Context = LoaderContext;\n\texport type LoaderContext = Piece.LoaderContext<'scheduled-tasks'>;\n\texport type JSON = Piece.JSON;\n\texport type LocationJSON = Piece.LocationJSON;\n}\n"]}
@@ -6,10 +6,7 @@ var ScheduledTask_cjs = require('./ScheduledTask.cjs');
6
6
  var __defProp = Object.defineProperty;
7
7
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __publicField = (obj, key, value) => {
10
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
- return value;
12
- };
9
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
10
  var _ScheduledTaskStore = class _ScheduledTaskStore extends pieces.Store {
14
11
  constructor() {
15
12
  super(ScheduledTask_cjs.ScheduledTask, { name: "scheduled-tasks" });
@@ -23,8 +20,7 @@ var _ScheduledTaskStore = class _ScheduledTaskStore extends pieces.Store {
23
20
  }
24
21
  delete(key) {
25
22
  const index = this.repeatedTasks.findIndex((task) => task.name === key);
26
- if (index !== -1)
27
- this.repeatedTasks.splice(index, 1);
23
+ if (index !== -1) this.repeatedTasks.splice(index, 1);
28
24
  return super.delete(key);
29
25
  }
30
26
  clear() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/structures/ScheduledTaskStore.ts"],"names":[],"mappings":";;;;;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAKvB,IAAM,sBAAN,MAAM,4BAA2B,MAAwC;AAAA,EAGxE,cAAc;AACpB,UAAM,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAHjD,wBAAgB,iBAAiC,CAAC;AAAA,EAIlD;AAAA,EAEgB,IAAI,KAAa,OAA4B;AAC5D,QAAI,MAAM,aAAa,QAAQ,MAAM,YAAY,MAAM;AACtD,WAAK,cAAc,KAAK,KAAK;AAAA,IAC9B;AAEA,WAAO,MAAM,IAAI,KAAK,KAAK;AAAA,EAC5B;AAAA,EAEgB,OAAO,KAAsB;AAC5C,UAAM,QAAQ,KAAK,cAAc,UAAU,CAAC,SAAS,KAAK,SAAS,GAAG;AAGtE,QAAI,UAAU;AAAI,WAAK,cAAc,OAAO,OAAO,CAAC;AAEpD,WAAO,MAAM,OAAO,GAAG;AAAA,EACxB;AAAA,EAEgB,QAAc;AAC7B,SAAK,cAAc,SAAS;AAC5B,WAAO,MAAM,MAAM;AAAA,EACpB;AACD;AA5BgF;AAAzE,IAAM,qBAAN","sourcesContent":["import { Store } from '@sapphire/pieces';\nimport { ScheduledTask } from './ScheduledTask';\n\n/**\n * A store for managing scheduled tasks.\n */\nexport class ScheduledTaskStore extends Store<ScheduledTask, 'scheduled-tasks'> {\n\tpublic readonly repeatedTasks: ScheduledTask[] = [];\n\n\tpublic constructor() {\n\t\tsuper(ScheduledTask, { name: 'scheduled-tasks' });\n\t}\n\n\tpublic override set(key: string, value: ScheduledTask): this {\n\t\tif (value.interval !== null || value.pattern !== null) {\n\t\t\tthis.repeatedTasks.push(value);\n\t\t}\n\n\t\treturn super.set(key, value);\n\t}\n\n\tpublic override delete(key: string): boolean {\n\t\tconst index = this.repeatedTasks.findIndex((task) => task.name === key);\n\n\t\t// If the scheduled task was found, remove it\n\t\tif (index !== -1) this.repeatedTasks.splice(index, 1);\n\n\t\treturn super.delete(key);\n\t}\n\n\tpublic override clear(): void {\n\t\tthis.repeatedTasks.length = 0;\n\t\treturn super.clear();\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/structures/ScheduledTaskStore.ts"],"names":[],"mappings":";;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAKvB,IAAM,sBAAN,MAAM,4BAA2B,MAAwC;AAAA,EAGxE,cAAc;AACpB,UAAM,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAHjD,wBAAgB,iBAAiC,CAAC;AAAA,EAIlD;AAAA,EAEgB,IAAI,KAAa,OAA4B;AAC5D,QAAI,MAAM,aAAa,QAAQ,MAAM,YAAY,MAAM;AACtD,WAAK,cAAc,KAAK,KAAK;AAAA,IAC9B;AAEA,WAAO,MAAM,IAAI,KAAK,KAAK;AAAA,EAC5B;AAAA,EAEgB,OAAO,KAAsB;AAC5C,UAAM,QAAQ,KAAK,cAAc,UAAU,CAAC,SAAS,KAAK,SAAS,GAAG;AAGtE,QAAI,UAAU,GAAI,MAAK,cAAc,OAAO,OAAO,CAAC;AAEpD,WAAO,MAAM,OAAO,GAAG;AAAA,EACxB;AAAA,EAEgB,QAAc;AAC7B,SAAK,cAAc,SAAS;AAC5B,WAAO,MAAM,MAAM;AAAA,EACpB;AACD;AA5BgF;AAAzE,IAAM,qBAAN","sourcesContent":["import { Store } from '@sapphire/pieces';\nimport { ScheduledTask } from './ScheduledTask';\n\n/**\n * A store for managing scheduled tasks.\n */\nexport class ScheduledTaskStore extends Store<ScheduledTask, 'scheduled-tasks'> {\n\tpublic readonly repeatedTasks: ScheduledTask[] = [];\n\n\tpublic constructor() {\n\t\tsuper(ScheduledTask, { name: 'scheduled-tasks' });\n\t}\n\n\tpublic override set(key: string, value: ScheduledTask): this {\n\t\tif (value.interval !== null || value.pattern !== null) {\n\t\t\tthis.repeatedTasks.push(value);\n\t\t}\n\n\t\treturn super.set(key, value);\n\t}\n\n\tpublic override delete(key: string): boolean {\n\t\tconst index = this.repeatedTasks.findIndex((task) => task.name === key);\n\n\t\t// If the scheduled task was found, remove it\n\t\tif (index !== -1) this.repeatedTasks.splice(index, 1);\n\n\t\treturn super.delete(key);\n\t}\n\n\tpublic override clear(): void {\n\t\tthis.repeatedTasks.length = 0;\n\t\treturn super.clear();\n\t}\n}\n"]}
@@ -6,10 +6,7 @@ var framework = require('@sapphire/framework');
6
6
  var __defProp = Object.defineProperty;
7
7
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __publicField = (obj, key, value) => {
10
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
- return value;
12
- };
9
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
10
  var _ScheduledTasksPlugin = class _ScheduledTasksPlugin extends framework.Plugin {
14
11
  constructor() {
15
12
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO;AAEP,SAAS,WAAW,QAAQ,oBAAoB,WAAW,2BAA2B,sBAAsB;AAE5G,SAAS,eAAe,sBAAsB,0BAA0B;AAMjE,IAAM,wBAAN,MAAM,8BAA6B,OAAO;AAAA,EAA1C;AAAA;AACN,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAIP,QAAe,yBAAyB,EAAwB,SAA8B;AAC7F,cAAU,QAAQ,IAAI,qBAAqB,QAAQ,KAAK;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA,EAKA,QAAe,kBAAkB,EAAwB,SAA8B;AACtF,SAAK,OAAO,SAAS,IAAI,mBAAmB,CAAC;AAE7C,QAAI,QAAQ,oCAAoC,OAAO;AACtD,oBAAc;AAAA,IACf;AAAA,EACD;AAAA;AAAA;AAAA;AAAA,EAKA,QAAe,SAAS,IAA8B;AACrD,SAAK,UAAU,MAAM,eAAe;AAAA,EACrC;AACD;AA1BiD;AAA1C,IAAM,uBAAN;AA4BP,eAAe,QAAQ;AAAA,EACtB,qBAAqB,yBAAyB;AAAA,EAC9C;AACD;AAEA,eAAe,QAAQ,+BAA+B,qBAAqB,kBAAkB,GAAG,mCAAmC;AAEnI,eAAe,QAAQ,sBAAsB,qBAAqB,SAAS,GAAG,0BAA0B","sourcesContent":["import './index';\n\nimport { container, Plugin, postInitialization, postLogin, preGenericsInitialization, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { loadListeners, ScheduledTaskHandler, ScheduledTaskStore } from './index';\n\n/**\n * A plugin for scheduling tasks in a SapphireClient.\n * @since 1.0.0\n */\nexport class ScheduledTasksPlugin extends Plugin {\n\tpublic service: string | undefined;\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [preGenericsInitialization](this: SapphireClient, options: ClientOptions): void {\n\t\tcontainer.tasks = new ScheduledTaskHandler(options.tasks);\n\t}\n\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postInitialization](this: SapphireClient, options: ClientOptions): void {\n\t\tthis.stores.register(new ScheduledTaskStore());\n\n\t\tif (options.loadScheduledTaskErrorListeners !== false) {\n\t\t\tloadListeners();\n\t\t}\n\t}\n\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postLogin](this: SapphireClient): void {\n\t\tvoid container.tasks.createRepeated();\n\t}\n}\n\nSapphireClient.plugins.registerPreGenericsInitializationHook(\n\tScheduledTasksPlugin[preGenericsInitialization],\n\t'Scheduled-Task-PreGenericsInitialization'\n);\n\nSapphireClient.plugins.registerPostInitializationHook(ScheduledTasksPlugin[postInitialization], 'Scheduled-Task-PostInitialization');\n\nSapphireClient.plugins.registerPostLoginHook(ScheduledTasksPlugin[postLogin], 'Scheduled-Task-PostLogin');\n"]}
1
+ {"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO;AAEP,SAAS,WAAW,QAAQ,oBAAoB,WAAW,2BAA2B,sBAAsB;AAE5G,SAAS,eAAe,sBAAsB,0BAA0B;AAMjE,IAAM,wBAAN,MAAM,8BAA6B,OAAO;AAAA,EAA1C;AAAA;AACN,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAIP,QAAe,yBAAyB,EAAwB,SAA8B;AAC7F,cAAU,QAAQ,IAAI,qBAAqB,QAAQ,KAAK;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA,EAKA,QAAe,kBAAkB,EAAwB,SAA8B;AACtF,SAAK,OAAO,SAAS,IAAI,mBAAmB,CAAC;AAE7C,QAAI,QAAQ,oCAAoC,OAAO;AACtD,oBAAc;AAAA,IACf;AAAA,EACD;AAAA;AAAA;AAAA;AAAA,EAKA,QAAe,SAAS,IAA8B;AACrD,SAAK,UAAU,MAAM,eAAe;AAAA,EACrC;AACD;AA1BiD;AAA1C,IAAM,uBAAN;AA4BP,eAAe,QAAQ;AAAA,EACtB,qBAAqB,yBAAyB;AAAA,EAC9C;AACD;AAEA,eAAe,QAAQ,+BAA+B,qBAAqB,kBAAkB,GAAG,mCAAmC;AAEnI,eAAe,QAAQ,sBAAsB,qBAAqB,SAAS,GAAG,0BAA0B","sourcesContent":["import './index';\n\nimport { container, Plugin, postInitialization, postLogin, preGenericsInitialization, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { loadListeners, ScheduledTaskHandler, ScheduledTaskStore } from './index';\n\n/**\n * A plugin for scheduling tasks in a SapphireClient.\n * @since 1.0.0\n */\nexport class ScheduledTasksPlugin extends Plugin {\n\tpublic service: string | undefined;\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [preGenericsInitialization](this: SapphireClient, options: ClientOptions): void {\n\t\tcontainer.tasks = new ScheduledTaskHandler(options.tasks);\n\t}\n\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postInitialization](this: SapphireClient, options: ClientOptions): void {\n\t\tthis.stores.register(new ScheduledTaskStore());\n\n\t\tif (options.loadScheduledTaskErrorListeners !== false) {\n\t\t\tloadListeners();\n\t\t}\n\t}\n\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postLogin](this: SapphireClient): void {\n\t\tvoid container.tasks.createRepeated();\n\t}\n}\n\nSapphireClient.plugins.registerPreGenericsInitializationHook(\n\tScheduledTasksPlugin[preGenericsInitialization],\n\t'Scheduled-Task-PreGenericsInitialization'\n);\n\nSapphireClient.plugins.registerPostInitializationHook(ScheduledTasksPlugin[postInitialization], 'Scheduled-Task-PostInitialization');\n\nSapphireClient.plugins.registerPostLoginHook(ScheduledTasksPlugin[postLogin], 'Scheduled-Task-PostLogin');\n"]}
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
4
+ };
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
9
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
10
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
11
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
12
+
13
+ export { __name, __privateAdd, __privateGet, __privateSet, __publicField };
14
+ //# sourceMappingURL=out.js.map
15
+ //# sourceMappingURL=chunk-ZLJD76J6.mjs.map
@@ -1,11 +1,11 @@
1
- import './chunk-PYETHG4R.mjs';
1
+ import './chunk-ZLJD76J6.mjs';
2
2
  export * from './lib/ScheduledTaskHandler.mjs';
3
3
  export * from './lib/structures/ScheduledTask.mjs';
4
4
  export * from './lib/structures/ScheduledTaskStore.mjs';
5
5
  export * from './lib/types/ScheduledTaskEvents.mjs';
6
6
  export { loadListeners } from './listeners/_load.mjs';
7
7
 
8
- var version = "10.0.2-next.f9230eb.0";
8
+ var version = "10.0.2-next.fa3aaf1.0";
9
9
 
10
10
  export { version };
11
11
  //# sourceMappingURL=out.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,qBAAqB;AA8BvB,IAAM,UAAkB","sourcesContent":["import type { ScheduledTaskHandler } from './lib/ScheduledTaskHandler';\nimport type { ScheduledTaskStore } from './lib/structures/ScheduledTaskStore';\nimport type { ScheduledTaskHandlerOptions } from './lib/types/ScheduledTaskTypes';\n\nexport * from './lib/ScheduledTaskHandler';\nexport * from './lib/structures/ScheduledTask';\nexport * from './lib/structures/ScheduledTaskStore';\nexport * from './lib/types/ScheduledTaskEvents';\nexport type * from './lib/types/ScheduledTaskTypes';\n\nexport { loadListeners } from './listeners/_load';\n\ndeclare module '@sapphire/pieces' {\n\tinterface Container {\n\t\ttasks: ScheduledTaskHandler;\n\t}\n\n\tinterface StoreRegistryEntries {\n\t\t'scheduled-tasks': ScheduledTaskStore;\n\t}\n}\n\ndeclare module 'discord.js' {\n\texport interface ClientOptions {\n\t\ttasks: ScheduledTaskHandlerOptions;\n\t\t/**\n\t\t * If the the pre-included scheduled task error listeners should be loaded\n\t\t * @default true\n\t\t */\n\t\tloadScheduledTaskErrorListeners?: boolean;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-scheduled-tasks](https://github.com/sapphiredev/plugins/blob/main/packages/scheduled-tasks) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '10.0.2-next.f9230eb.0';\n"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,qBAAqB;AA8BvB,IAAM,UAAkB","sourcesContent":["import type { ScheduledTaskHandler } from './lib/ScheduledTaskHandler';\nimport type { ScheduledTaskStore } from './lib/structures/ScheduledTaskStore';\nimport type { ScheduledTaskHandlerOptions } from './lib/types/ScheduledTaskTypes';\n\nexport * from './lib/ScheduledTaskHandler';\nexport * from './lib/structures/ScheduledTask';\nexport * from './lib/structures/ScheduledTaskStore';\nexport * from './lib/types/ScheduledTaskEvents';\nexport type * from './lib/types/ScheduledTaskTypes';\n\nexport { loadListeners } from './listeners/_load';\n\ndeclare module '@sapphire/pieces' {\n\tinterface Container {\n\t\ttasks: ScheduledTaskHandler;\n\t}\n\n\tinterface StoreRegistryEntries {\n\t\t'scheduled-tasks': ScheduledTaskStore;\n\t}\n}\n\ndeclare module 'discord.js' {\n\texport interface ClientOptions {\n\t\ttasks: ScheduledTaskHandlerOptions;\n\t\t/**\n\t\t * If the the pre-included scheduled task error listeners should be loaded\n\t\t * @default true\n\t\t */\n\t\tloadScheduledTaskErrorListeners?: boolean;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-scheduled-tasks](https://github.com/sapphiredev/plugins/blob/main/packages/scheduled-tasks) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '10.0.2-next.fa3aaf1.0';\n"]}
@@ -1,4 +1,4 @@
1
- import { __name, __publicField, __privateAdd, __privateSet, __privateGet } from '../chunk-PYETHG4R.mjs';
1
+ import { __name, __publicField, __privateAdd, __privateSet, __privateGet } from '../chunk-ZLJD76J6.mjs';
2
2
  import { container, Result } from '@sapphire/framework';
3
3
  import { Stopwatch } from '@sapphire/stopwatch';
4
4
  import { Queue, Worker, isNotConnectionError } from 'bullmq';
@@ -16,8 +16,8 @@ var _ScheduledTaskHandler = class _ScheduledTaskHandler {
16
16
  * The name of the queue associated with the scheduled task handler.
17
17
  */
18
18
  __publicField(this, "queue");
19
- __privateAdd(this, _client, void 0);
20
- __privateAdd(this, _worker, void 0);
19
+ __privateAdd(this, _client);
20
+ __privateAdd(this, _worker);
21
21
  this.queue = options.queue ?? "scheduled-tasks";
22
22
  this.options = options.bull;
23
23
  __privateSet(this, _client, new Queue(this.queue, this.options));
@@ -146,8 +146,7 @@ var _ScheduledTaskHandler = class _ScheduledTaskHandler {
146
146
  */
147
147
  async get(id) {
148
148
  const job = await __privateGet(this, _client).getJob(id);
149
- if (isNullish(job))
150
- return void 0;
149
+ if (isNullish(job)) return void 0;
151
150
  return job;
152
151
  }
153
152
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/ScheduledTaskHandler.ts"],"names":[],"mappings":";;;;;;;;;AAAA,SAAS,WAAW,cAAc;AAClC,SAAS,iBAAiB;AAC1B,SAAc,OAAO,QAA6C,4BAA4B;AAE9F,SAAS,2BAA2B;AAgBpC,SAAS,iBAAiB;AApB1B;AAsBO,IAAM,wBAAN,MAAM,sBAAqB;AAAA,EAc1B,YAAY,SAAsC;AAVzD;AAAA;AAAA;AAAA,wBAAgB;AAKhB;AAAA;AAAA;AAAA,wBAAgB;AAEhB;AACA;AAGC,SAAK,QAAQ,QAAQ,SAAS;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ACpF,QAAI,OAAO,SAAS,UAAU;AAC7B,aAAO,EAAE,MAAM,MAAM,SAAS,OAAU;AAAA,IACzC;AAEA,QAAI,aAAa,MAAM;AACtB,aAAO,EAAE,MAAM,KAAK,MAAM,SAAS,KAAK,QAAQ;AAAA,IACjD;AAEA,WAAO,EAAE,MAAM,KAAK,MAAM,SAAS,OAAU;AAAA,EAC9C;AACD;AAtNC;AACA;AAZiC;AAA3B,IAAM,uBAAN","sourcesContent":["import { container, Result } from '@sapphire/framework';\nimport { Stopwatch } from '@sapphire/stopwatch';\nimport { Job, Queue, Worker, type JobsOptions, type QueueOptions, isNotConnectionError } from 'bullmq';\nimport type { ScheduledTaskStore } from './structures/ScheduledTaskStore';\nimport { ScheduledTaskEvents } from './types/ScheduledTaskEvents';\nimport type {\n\tBullClient,\n\tScheduledTaskCreateRepeatedTask,\n\tScheduledTaskHandlerOptions,\n\tScheduledTaskListOptions,\n\tScheduledTaskListRepeatedOptions,\n\tScheduledTaskListRepeatedReturnType,\n\tScheduledTasksResolvable,\n\tScheduledTasksKeys,\n\tScheduledTasksTaskOptions,\n\tScheduledTasksKeysNoPayload,\n\tScheduledTasksJob,\n\tScheduledTasksResolvablePayload,\n\tScheduledTasksPayload\n} from './types/ScheduledTaskTypes';\nimport { isNullish } from '@sapphire/utilities';\n\nexport class ScheduledTaskHandler {\n\t/**\n\t * The queue options for the scheduled task handler.\n\t */\n\tpublic readonly options: QueueOptions;\n\n\t/**\n\t * The name of the queue associated with the scheduled task handler.\n\t */\n\tpublic readonly queue: string;\n\n\t#client: BullClient;\n\t#worker: Worker;\n\n\tpublic constructor(options: ScheduledTaskHandlerOptions) {\n\t\tthis.queue = options.queue ?? 'scheduled-tasks';\n\t\tthis.options = options.bull;\n\n\t\tthis.#client = new Queue(this.queue, this.options);\n\t\tthis.#worker = new Worker(\n\t\t\tthis.queue, //\n\t\t\tasync (job) => this.run({ name: job.name as ScheduledTasksKeys, payload: job.data }),\n\t\t\t{ connection: this.options.connection }\n\t\t);\n\n\t\tthis.#client.on('error', (error) => {\n\t\t\tif (isNotConnectionError(error)) {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyClientError, error);\n\t\t\t} else {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyConnectError, error);\n\t\t\t}\n\t\t});\n\t\tthis.#worker.on('error', (error) => {\n\t\t\tif (isNotConnectionError(error)) {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyWorkerError, error);\n\t\t\t} else {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyConnectError, error);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic get client(): BullClient {\n\t\treturn this.#client;\n\t}\n\n\t/**\n\t * Closes the internal client and worker.\n\t */\n\tpublic async close(): Promise<void> {\n\t\tawait Promise.all([\n\t\t\tthis.#client.close(), //\n\t\t\tthis.#worker.close()\n\t\t]);\n\t}\n\n\t/**\n\t * Creates a scheduled task.\n\t *\n\t * @param task - The task to be scheduled.\n\t * @param options - The options for the task.\n\t */\n\tpublic async create<T extends ScheduledTasksResolvable>(\n\t\ttask: T, //\n\t\toptions?: ScheduledTasksTaskOptions | number\n\t): Promise<ScheduledTasksJob<T>> {\n\t\tconst { name: taskName, payload } = this.resolveTask(task);\n\n\t\tif (isNullish(options)) {\n\t\t\treturn this.#client.add(taskName, payload) as Promise<ScheduledTasksJob<T>>;\n\t\t}\n\n\t\tif (typeof options === 'number') {\n\t\t\toptions = {\n\t\t\t\trepeated: false,\n\t\t\t\tdelay: options\n\t\t\t};\n\t\t}\n\n\t\tconst { repeated, pattern, interval, delay, customJobOptions, timezone } = options;\n\t\tlet jobOptions: JobsOptions = {\n\t\t\tdelay,\n\t\t\t...customJobOptions\n\t\t};\n\n\t\tif (repeated) {\n\t\t\tjobOptions = {\n\t\t\t\t...jobOptions,\n\t\t\t\trepeat: interval //\n\t\t\t\t\t? { every: interval }\n\t\t\t\t\t: { pattern, tz: timezone }\n\t\t\t};\n\t\t}\n\n\t\treturn this.#client.add(taskName, payload, jobOptions) as Promise<ScheduledTasksJob<T>>;\n\t}\n\n\t/**\n\t * Creates repeated tasks.\n\t *\n\t * @param tasks - An optional array of tasks to create. If not provided, it will create tasks based on the stored repeated tasks.\n\t */\n\tpublic async createRepeated(tasks?: ScheduledTaskCreateRepeatedTask[]): Promise<void> {\n\t\tif (tasks === undefined) {\n\t\t\tconst repeatedTasks: ScheduledTaskCreateRepeatedTask[] = this.store.repeatedTasks.map((piece) => ({\n\t\t\t\tname: piece.name as ScheduledTasksKeysNoPayload,\n\t\t\t\toptions: {\n\t\t\t\t\trepeated: true,\n\t\t\t\t\t...(piece.interval\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tinterval: piece.interval,\n\t\t\t\t\t\t\t\tcustomJobOptions: piece.customJobOptions\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tpattern: piece.pattern!,\n\t\t\t\t\t\t\t\ttimezone: piece.timezone,\n\t\t\t\t\t\t\t\tcustomJobOptions: piece.customJobOptions\n\t\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\ttasks = repeatedTasks;\n\t\t}\n\n\t\tfor (const task of tasks) {\n\t\t\tawait this.create(task.name, task.options);\n\t\t}\n\t}\n\n\t/**\n\t * Deletes a scheduled task by its ID.\n\t *\n\t * @param id - The ID of the task to delete.\n\t */\n\tpublic async delete(id: string): Promise<void> {\n\t\tconst job = (await this.get(id as ScheduledTasksKeys)) as unknown as Job<unknown> | undefined;\n\t\treturn job?.remove();\n\t}\n\n\t/**\n\t * Retrieves a list of scheduled tasks based on the provided options.\n\t *\n\t * @param options - The options for filtering the list of scheduled tasks.\n\t */\n\tpublic list(options: ScheduledTaskListOptions): Promise<Job<unknown>[]> {\n\t\tconst { types, start, end, asc } = options;\n\n\t\treturn this.#client.getJobs(types, start, end, asc);\n\t}\n\n\t/**\n\t * Retrieves a list of repeated scheduled tasks based on the provided options.\n\t *\n\t * @param options - The options for filtering the list of repeated scheduled tasks.\n\t */\n\tpublic listRepeated(options: ScheduledTaskListRepeatedOptions): Promise<ScheduledTaskListRepeatedReturnType> {\n\t\tconst { start, end, asc } = options;\n\n\t\treturn this.#client.getRepeatableJobs(start, end, asc);\n\t}\n\n\t/**\n\t * Retrieves a scheduled task by its ID.\n\t *\n\t * @param id - The ID of the scheduled task to retrieve.\n\t */\n\tpublic async get<T extends ScheduledTasksKeys>(id: T): Promise<Job<ScheduledTasksPayload<T>> | undefined> {\n\t\tconst job = await this.#client.getJob(id);\n\t\tif (isNullish(job)) return undefined;\n\n\t\treturn job as Job<ScheduledTasksPayload<T>>;\n\t}\n\n\t/**\n\t * Runs a scheduled task with the given name and payload.\n\t *\n\t * @param task - The name of the scheduled task to run.\n\t *\n\t * @remarks `undefined` will be returned if the task was not found.\n\t */\n\tpublic async run(task: ScheduledTasksResolvable): Promise<number | null | undefined> {\n\t\tconst { name: taskName, payload } = this.resolveTask(task);\n\t\tconst piece = this.store.get(task.name);\n\n\t\tif (!piece) {\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskNotFound, taskName, payload);\n\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst result = await Result.fromAsync(async () => {\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskRun, piece, payload);\n\n\t\t\tconst stopwatch = new Stopwatch();\n\t\t\tconst taskRunResult = await piece.run(payload);\n\t\t\tconst { duration } = stopwatch.stop();\n\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskSuccess, piece, payload, taskRunResult, duration);\n\n\t\t\treturn duration;\n\t\t});\n\n\t\tresult.inspectErr((error) => container.client.emit(ScheduledTaskEvents.ScheduledTaskError, error, piece, payload));\n\n\t\tconst value = result.unwrapOr(null);\n\n\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskFinished, piece, value, payload);\n\n\t\treturn value;\n\t}\n\n\tprivate get store(): ScheduledTaskStore {\n\t\treturn container.client.stores.get('scheduled-tasks');\n\t}\n\n\tprivate resolveTask(task: ScheduledTasksResolvable): ScheduledTasksResolvablePayload {\n\t\tif (typeof task === 'string') {\n\t\t\treturn { name: task, payload: undefined };\n\t\t}\n\n\t\tif ('payload' in task) {\n\t\t\treturn { name: task.name, payload: task.payload };\n\t\t}\n\n\t\treturn { name: task.name, payload: undefined };\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/ScheduledTaskHandler.ts"],"names":[],"mappings":";;;;;;;;;AAAA,SAAS,WAAW,cAAc;AAClC,SAAS,iBAAiB;AAC1B,SAAc,OAAO,QAA6C,4BAA4B;AAE9F,SAAS,2BAA2B;AAgBpC,SAAS,iBAAiB;AApB1B;AAsBO,IAAM,wBAAN,MAAM,sBAAqB;AAAA,EAc1B,YAAY,SAAsC;AAVzD;AAAA;AAAA;AAAA,wBAAgB;AAKhB;AAAA;AAAA;AAAA,wBAAgB;AAEhB;AACA;AAGC,SAAK,QAAQ,QAAQ,SAAS;AAC9B,SAAK,UAAU,QAAQ;AAEvB,uBAAK,SAAU,IAAI,MAAM,KAAK,OAAO,KAAK,OAAO;AACjD,uBAAK,SAAU,IAAI;AAAA,MAClB,KAAK;AAAA;AAAA,MACL,OAAO,QAAQ,KAAK,IAAI,EAAE,MAAM,IAAI,MAA4B,SAAS,IAAI,KAAK,CAAC;AAAA,MACnF,EAAE,YAAY,KAAK,QAAQ,WAAW;AAAA,IACvC;AAEA,uBAAK,SAAQ,GAAG,SAAS,CAAC,UAAU;AACnC,UAAI,qBAAqB,KAAK,GAAG;AAChC,kBAAU,OAAO,KAAK,oBAAoB,kCAAkC,KAAK;AAAA,MAClF,OAAO;AACN,kBAAU,OAAO,KAAK,oBAAoB,mCAAmC,KAAK;AAAA,MACnF;AAAA,IACD,CAAC;AACD,uBAAK,SAAQ,GAAG,SAAS,CAAC,UAAU;AACnC,UAAI,qBAAqB,KAAK,GAAG;AACh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AAO;AAElF,aAAO;AAAA,IACR;AAEA,UAAM,SAAS,MAAM,OAAO,UAAU,YAAY;AACjD,gBAAU,OAAO,KAAK,oBAAoB,kBAAkB,OAAO,OAAO;AAE1E,YAAM,YAAY,IAAI,UAAU;AAChC,YAAM,gBAAgB,MAAM,MAAM,IAAI,OAAO;AAC7C,YAAM,EAAE,SAAS,IAAI,UAAU,KAAK;AAEpC,gBAAU,OAAO,KAAK,oBAAoB,sBAAsB,OAAO,SAAS,eAAe,QAAQ;AAEvG,aAAO;AAAA,IACR,CAAC;AAED,WAAO,WAAW,CAAC,UAAU,UAAU,OAAO,KAAK,oBAAoB,oBAAoB,OAAO,OAAO,OAAO,CAAC;AAEjH,UAAM,QAAQ,OAAO,SAAS,IAAI;AAElC,cAAU,OAAO,KAAK,oBAAoB,uBAAuB,OAAO,OAAO,OAAO;AAEtF,WAAO;AAAA,EACR;AAAA,EAEA,IAAY,QAA4B;AACvC,WAAO,UAAU,OAAO,OAAO,IAAI,iBAAiB;AAAA,EACrD;AAAA,EAEQ,YAAY,MAAiE;AACpF,QAAI,OAAO,SAAS,UAAU;AAC7B,aAAO,EAAE,MAAM,MAAM,SAAS,OAAU;AAAA,IACzC;AAEA,QAAI,aAAa,MAAM;AACtB,aAAO,EAAE,MAAM,KAAK,MAAM,SAAS,KAAK,QAAQ;AAAA,IACjD;AAEA,WAAO,EAAE,MAAM,KAAK,MAAM,SAAS,OAAU;AAAA,EAC9C;AACD;AAtNC;AACA;AAZiC;AAA3B,IAAM,uBAAN","sourcesContent":["import { container, Result } from '@sapphire/framework';\nimport { Stopwatch } from '@sapphire/stopwatch';\nimport { Job, Queue, Worker, type JobsOptions, type QueueOptions, isNotConnectionError } from 'bullmq';\nimport type { ScheduledTaskStore } from './structures/ScheduledTaskStore';\nimport { ScheduledTaskEvents } from './types/ScheduledTaskEvents';\nimport type {\n\tBullClient,\n\tScheduledTaskCreateRepeatedTask,\n\tScheduledTaskHandlerOptions,\n\tScheduledTaskListOptions,\n\tScheduledTaskListRepeatedOptions,\n\tScheduledTaskListRepeatedReturnType,\n\tScheduledTasksResolvable,\n\tScheduledTasksKeys,\n\tScheduledTasksTaskOptions,\n\tScheduledTasksKeysNoPayload,\n\tScheduledTasksJob,\n\tScheduledTasksResolvablePayload,\n\tScheduledTasksPayload\n} from './types/ScheduledTaskTypes';\nimport { isNullish } from '@sapphire/utilities';\n\nexport class ScheduledTaskHandler {\n\t/**\n\t * The queue options for the scheduled task handler.\n\t */\n\tpublic readonly options: QueueOptions;\n\n\t/**\n\t * The name of the queue associated with the scheduled task handler.\n\t */\n\tpublic readonly queue: string;\n\n\t#client: BullClient;\n\t#worker: Worker;\n\n\tpublic constructor(options: ScheduledTaskHandlerOptions) {\n\t\tthis.queue = options.queue ?? 'scheduled-tasks';\n\t\tthis.options = options.bull;\n\n\t\tthis.#client = new Queue(this.queue, this.options);\n\t\tthis.#worker = new Worker(\n\t\t\tthis.queue, //\n\t\t\tasync (job) => this.run({ name: job.name as ScheduledTasksKeys, payload: job.data }),\n\t\t\t{ connection: this.options.connection }\n\t\t);\n\n\t\tthis.#client.on('error', (error) => {\n\t\t\tif (isNotConnectionError(error)) {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyClientError, error);\n\t\t\t} else {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyConnectError, error);\n\t\t\t}\n\t\t});\n\t\tthis.#worker.on('error', (error) => {\n\t\t\tif (isNotConnectionError(error)) {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyWorkerError, error);\n\t\t\t} else {\n\t\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskStrategyConnectError, error);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic get client(): BullClient {\n\t\treturn this.#client;\n\t}\n\n\t/**\n\t * Closes the internal client and worker.\n\t */\n\tpublic async close(): Promise<void> {\n\t\tawait Promise.all([\n\t\t\tthis.#client.close(), //\n\t\t\tthis.#worker.close()\n\t\t]);\n\t}\n\n\t/**\n\t * Creates a scheduled task.\n\t *\n\t * @param task - The task to be scheduled.\n\t * @param options - The options for the task.\n\t */\n\tpublic async create<T extends ScheduledTasksResolvable>(\n\t\ttask: T, //\n\t\toptions?: ScheduledTasksTaskOptions | number\n\t): Promise<ScheduledTasksJob<T>> {\n\t\tconst { name: taskName, payload } = this.resolveTask(task);\n\n\t\tif (isNullish(options)) {\n\t\t\treturn this.#client.add(taskName, payload) as Promise<ScheduledTasksJob<T>>;\n\t\t}\n\n\t\tif (typeof options === 'number') {\n\t\t\toptions = {\n\t\t\t\trepeated: false,\n\t\t\t\tdelay: options\n\t\t\t};\n\t\t}\n\n\t\tconst { repeated, pattern, interval, delay, customJobOptions, timezone } = options;\n\t\tlet jobOptions: JobsOptions = {\n\t\t\tdelay,\n\t\t\t...customJobOptions\n\t\t};\n\n\t\tif (repeated) {\n\t\t\tjobOptions = {\n\t\t\t\t...jobOptions,\n\t\t\t\trepeat: interval //\n\t\t\t\t\t? { every: interval }\n\t\t\t\t\t: { pattern, tz: timezone }\n\t\t\t};\n\t\t}\n\n\t\treturn this.#client.add(taskName, payload, jobOptions) as Promise<ScheduledTasksJob<T>>;\n\t}\n\n\t/**\n\t * Creates repeated tasks.\n\t *\n\t * @param tasks - An optional array of tasks to create. If not provided, it will create tasks based on the stored repeated tasks.\n\t */\n\tpublic async createRepeated(tasks?: ScheduledTaskCreateRepeatedTask[]): Promise<void> {\n\t\tif (tasks === undefined) {\n\t\t\tconst repeatedTasks: ScheduledTaskCreateRepeatedTask[] = this.store.repeatedTasks.map((piece) => ({\n\t\t\t\tname: piece.name as ScheduledTasksKeysNoPayload,\n\t\t\t\toptions: {\n\t\t\t\t\trepeated: true,\n\t\t\t\t\t...(piece.interval\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tinterval: piece.interval,\n\t\t\t\t\t\t\t\tcustomJobOptions: piece.customJobOptions\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tpattern: piece.pattern!,\n\t\t\t\t\t\t\t\ttimezone: piece.timezone,\n\t\t\t\t\t\t\t\tcustomJobOptions: piece.customJobOptions\n\t\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}));\n\n\t\t\ttasks = repeatedTasks;\n\t\t}\n\n\t\tfor (const task of tasks) {\n\t\t\tawait this.create(task.name, task.options);\n\t\t}\n\t}\n\n\t/**\n\t * Deletes a scheduled task by its ID.\n\t *\n\t * @param id - The ID of the task to delete.\n\t */\n\tpublic async delete(id: string): Promise<void> {\n\t\tconst job = (await this.get(id as ScheduledTasksKeys)) as unknown as Job<unknown> | undefined;\n\t\treturn job?.remove();\n\t}\n\n\t/**\n\t * Retrieves a list of scheduled tasks based on the provided options.\n\t *\n\t * @param options - The options for filtering the list of scheduled tasks.\n\t */\n\tpublic list(options: ScheduledTaskListOptions): Promise<Job<unknown>[]> {\n\t\tconst { types, start, end, asc } = options;\n\n\t\treturn this.#client.getJobs(types, start, end, asc);\n\t}\n\n\t/**\n\t * Retrieves a list of repeated scheduled tasks based on the provided options.\n\t *\n\t * @param options - The options for filtering the list of repeated scheduled tasks.\n\t */\n\tpublic listRepeated(options: ScheduledTaskListRepeatedOptions): Promise<ScheduledTaskListRepeatedReturnType> {\n\t\tconst { start, end, asc } = options;\n\n\t\treturn this.#client.getRepeatableJobs(start, end, asc);\n\t}\n\n\t/**\n\t * Retrieves a scheduled task by its ID.\n\t *\n\t * @param id - The ID of the scheduled task to retrieve.\n\t */\n\tpublic async get<T extends ScheduledTasksKeys>(id: T): Promise<Job<ScheduledTasksPayload<T>> | undefined> {\n\t\tconst job = await this.#client.getJob(id);\n\t\tif (isNullish(job)) return undefined;\n\n\t\treturn job as Job<ScheduledTasksPayload<T>>;\n\t}\n\n\t/**\n\t * Runs a scheduled task with the given name and payload.\n\t *\n\t * @param task - The name of the scheduled task to run.\n\t *\n\t * @remarks `undefined` will be returned if the task was not found.\n\t */\n\tpublic async run(task: ScheduledTasksResolvable): Promise<number | null | undefined> {\n\t\tconst { name: taskName, payload } = this.resolveTask(task);\n\t\tconst piece = this.store.get(task.name);\n\n\t\tif (!piece) {\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskNotFound, taskName, payload);\n\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst result = await Result.fromAsync(async () => {\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskRun, piece, payload);\n\n\t\t\tconst stopwatch = new Stopwatch();\n\t\t\tconst taskRunResult = await piece.run(payload);\n\t\t\tconst { duration } = stopwatch.stop();\n\n\t\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskSuccess, piece, payload, taskRunResult, duration);\n\n\t\t\treturn duration;\n\t\t});\n\n\t\tresult.inspectErr((error) => container.client.emit(ScheduledTaskEvents.ScheduledTaskError, error, piece, payload));\n\n\t\tconst value = result.unwrapOr(null);\n\n\t\tcontainer.client.emit(ScheduledTaskEvents.ScheduledTaskFinished, piece, value, payload);\n\n\t\treturn value;\n\t}\n\n\tprivate get store(): ScheduledTaskStore {\n\t\treturn container.client.stores.get('scheduled-tasks');\n\t}\n\n\tprivate resolveTask(task: ScheduledTasksResolvable): ScheduledTasksResolvablePayload {\n\t\tif (typeof task === 'string') {\n\t\t\treturn { name: task, payload: undefined };\n\t\t}\n\n\t\tif ('payload' in task) {\n\t\t\treturn { name: task.name, payload: task.payload };\n\t\t}\n\n\t\treturn { name: task.name, payload: undefined };\n\t}\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { __name, __publicField } from '../../chunk-PYETHG4R.mjs';
1
+ import { __name, __publicField } from '../../chunk-ZLJD76J6.mjs';
2
2
  import { Piece } from '@sapphire/pieces';
3
3
 
4
4
  var _ScheduledTask = class _ScheduledTask extends Piece {
@@ -1,4 +1,4 @@
1
- import { __name, __publicField } from '../../chunk-PYETHG4R.mjs';
1
+ import { __name, __publicField } from '../../chunk-ZLJD76J6.mjs';
2
2
  import { Store } from '@sapphire/pieces';
3
3
  import { ScheduledTask } from './ScheduledTask.mjs';
4
4
 
@@ -15,8 +15,7 @@ var _ScheduledTaskStore = class _ScheduledTaskStore extends Store {
15
15
  }
16
16
  delete(key) {
17
17
  const index = this.repeatedTasks.findIndex((task) => task.name === key);
18
- if (index !== -1)
19
- this.repeatedTasks.splice(index, 1);
18
+ if (index !== -1) this.repeatedTasks.splice(index, 1);
20
19
  return super.delete(key);
21
20
  }
22
21
  clear() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/structures/ScheduledTaskStore.ts"],"names":[],"mappings":";;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAKvB,IAAM,sBAAN,MAAM,4BAA2B,MAAwC;AAAA,EAGxE,cAAc;AACpB,UAAM,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAHjD,wBAAgB,iBAAiC,CAAC;AAAA,EAIlD;AAAA,EAEgB,IAAI,KAAa,OAA4B;AAC5D,QAAI,MAAM,aAAa,QAAQ,MAAM,YAAY,MAAM;AACtD,WAAK,cAAc,KAAK,KAAK;AAAA,IAC9B;AAEA,WAAO,MAAM,IAAI,KAAK,KAAK;AAAA,EAC5B;AAAA,EAEgB,OAAO,KAAsB;AAC5C,UAAM,QAAQ,KAAK,cAAc,UAAU,CAAC,SAAS,KAAK,SAAS,GAAG;AAGtE,QAAI,UAAU;AAAI,WAAK,cAAc,OAAO,OAAO,CAAC;AAEpD,WAAO,MAAM,OAAO,GAAG;AAAA,EACxB;AAAA,EAEgB,QAAc;AAC7B,SAAK,cAAc,SAAS;AAC5B,WAAO,MAAM,MAAM;AAAA,EACpB;AACD;AA5BgF;AAAzE,IAAM,qBAAN","sourcesContent":["import { Store } from '@sapphire/pieces';\nimport { ScheduledTask } from './ScheduledTask';\n\n/**\n * A store for managing scheduled tasks.\n */\nexport class ScheduledTaskStore extends Store<ScheduledTask, 'scheduled-tasks'> {\n\tpublic readonly repeatedTasks: ScheduledTask[] = [];\n\n\tpublic constructor() {\n\t\tsuper(ScheduledTask, { name: 'scheduled-tasks' });\n\t}\n\n\tpublic override set(key: string, value: ScheduledTask): this {\n\t\tif (value.interval !== null || value.pattern !== null) {\n\t\t\tthis.repeatedTasks.push(value);\n\t\t}\n\n\t\treturn super.set(key, value);\n\t}\n\n\tpublic override delete(key: string): boolean {\n\t\tconst index = this.repeatedTasks.findIndex((task) => task.name === key);\n\n\t\t// If the scheduled task was found, remove it\n\t\tif (index !== -1) this.repeatedTasks.splice(index, 1);\n\n\t\treturn super.delete(key);\n\t}\n\n\tpublic override clear(): void {\n\t\tthis.repeatedTasks.length = 0;\n\t\treturn super.clear();\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/structures/ScheduledTaskStore.ts"],"names":[],"mappings":";;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAKvB,IAAM,sBAAN,MAAM,4BAA2B,MAAwC;AAAA,EAGxE,cAAc;AACpB,UAAM,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAHjD,wBAAgB,iBAAiC,CAAC;AAAA,EAIlD;AAAA,EAEgB,IAAI,KAAa,OAA4B;AAC5D,QAAI,MAAM,aAAa,QAAQ,MAAM,YAAY,MAAM;AACtD,WAAK,cAAc,KAAK,KAAK;AAAA,IAC9B;AAEA,WAAO,MAAM,IAAI,KAAK,KAAK;AAAA,EAC5B;AAAA,EAEgB,OAAO,KAAsB;AAC5C,UAAM,QAAQ,KAAK,cAAc,UAAU,CAAC,SAAS,KAAK,SAAS,GAAG;AAGtE,QAAI,UAAU,GAAI,MAAK,cAAc,OAAO,OAAO,CAAC;AAEpD,WAAO,MAAM,OAAO,GAAG;AAAA,EACxB;AAAA,EAEgB,QAAc;AAC7B,SAAK,cAAc,SAAS;AAC5B,WAAO,MAAM,MAAM;AAAA,EACpB;AACD;AA5BgF;AAAzE,IAAM,qBAAN","sourcesContent":["import { Store } from '@sapphire/pieces';\nimport { ScheduledTask } from './ScheduledTask';\n\n/**\n * A store for managing scheduled tasks.\n */\nexport class ScheduledTaskStore extends Store<ScheduledTask, 'scheduled-tasks'> {\n\tpublic readonly repeatedTasks: ScheduledTask[] = [];\n\n\tpublic constructor() {\n\t\tsuper(ScheduledTask, { name: 'scheduled-tasks' });\n\t}\n\n\tpublic override set(key: string, value: ScheduledTask): this {\n\t\tif (value.interval !== null || value.pattern !== null) {\n\t\t\tthis.repeatedTasks.push(value);\n\t\t}\n\n\t\treturn super.set(key, value);\n\t}\n\n\tpublic override delete(key: string): boolean {\n\t\tconst index = this.repeatedTasks.findIndex((task) => task.name === key);\n\n\t\t// If the scheduled task was found, remove it\n\t\tif (index !== -1) this.repeatedTasks.splice(index, 1);\n\n\t\treturn super.delete(key);\n\t}\n\n\tpublic override clear(): void {\n\t\tthis.repeatedTasks.length = 0;\n\t\treturn super.clear();\n\t}\n}\n"]}
@@ -1,4 +1,4 @@
1
- import '../../chunk-PYETHG4R.mjs';
1
+ import '../../chunk-ZLJD76J6.mjs';
2
2
  import '../structures/ScheduledTask.mjs';
3
3
 
4
4
  var ScheduledTaskEvents = {
@@ -1,4 +1,4 @@
1
- import { __name } from '../chunk-PYETHG4R.mjs';
1
+ import { __name } from '../chunk-ZLJD76J6.mjs';
2
2
  import { Listener } from '@sapphire/framework';
3
3
  import { ScheduledTaskEvents } from '../lib/types/ScheduledTaskEvents.mjs';
4
4
  import '../lib/structures/ScheduledTask.mjs';
@@ -1,4 +1,4 @@
1
- import { __name } from '../chunk-PYETHG4R.mjs';
1
+ import { __name } from '../chunk-ZLJD76J6.mjs';
2
2
  import { Listener } from '@sapphire/framework';
3
3
  import { ScheduledTaskEvents } from '../lib/types/ScheduledTaskEvents.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { __name } from '../chunk-PYETHG4R.mjs';
1
+ import { __name } from '../chunk-ZLJD76J6.mjs';
2
2
  import { Listener } from '@sapphire/framework';
3
3
  import { ScheduledTaskEvents } from '../lib/types/ScheduledTaskEvents.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { __name } from '../chunk-PYETHG4R.mjs';
1
+ import { __name } from '../chunk-ZLJD76J6.mjs';
2
2
  import { Listener } from '@sapphire/framework';
3
3
  import { ScheduledTaskEvents } from '../lib/types/ScheduledTaskEvents.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { __name } from '../chunk-PYETHG4R.mjs';
1
+ import { __name } from '../chunk-ZLJD76J6.mjs';
2
2
  import { Listener } from '@sapphire/framework';
3
3
  import { ScheduledTaskEvents } from '../lib/types/ScheduledTaskEvents.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { __name } from '../chunk-PYETHG4R.mjs';
1
+ import { __name } from '../chunk-ZLJD76J6.mjs';
2
2
  import { container } from '@sapphire/pieces';
3
3
  import { PluginListener } from './PluginScheduledTaskError.mjs';
4
4
  import { PluginListener as PluginListener$1 } from './PluginScheduledTaskNotFound.mjs';
@@ -1,4 +1,4 @@
1
- import { __name, __publicField } from './chunk-PYETHG4R.mjs';
1
+ import { __name, __publicField } from './chunk-ZLJD76J6.mjs';
2
2
  import { ScheduledTaskHandler, ScheduledTaskStore, loadListeners } from './index.mjs';
3
3
  import { SapphireClient, preGenericsInitialization, postInitialization, postLogin, Plugin, container } from '@sapphire/framework';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/plugin-scheduled-tasks",
3
- "version": "10.0.2-next.f9230eb.0",
3
+ "version": "10.0.2-next.fa3aaf1.0",
4
4
  "description": "Plugin for @sapphire/framework to have scheduled tasks",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -50,15 +50,15 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@sapphire/stopwatch": "^1.5.2",
53
- "@sapphire/utilities": "^3.15.3",
54
- "bullmq": "5.7.8"
53
+ "@sapphire/utilities": "^3.16.2",
54
+ "bullmq": "5.7.15"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@favware/cliff-jumper": "^3.0.3",
58
58
  "@favware/rollup-type-bundler": "^3.3.0",
59
59
  "concurrently": "^8.2.2",
60
- "tsup": "^8.0.2",
61
- "tsx": "^4.9.1",
60
+ "tsup": "^8.1.0",
61
+ "tsx": "^4.15.1",
62
62
  "typedoc": "^0.25.13",
63
63
  "typedoc-json-parser": "^10.0.0",
64
64
  "typescript": "^5.4.5"
@@ -1,29 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __publicField = (obj, key, value) => {
5
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
- return value;
7
- };
8
- var __accessCheck = (obj, member, msg) => {
9
- if (!member.has(obj))
10
- throw TypeError("Cannot " + msg);
11
- };
12
- var __privateGet = (obj, member, getter) => {
13
- __accessCheck(obj, member, "read from private field");
14
- return getter ? getter.call(obj) : member.get(obj);
15
- };
16
- var __privateAdd = (obj, member, value) => {
17
- if (member.has(obj))
18
- throw TypeError("Cannot add the same private member more than once");
19
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
20
- };
21
- var __privateSet = (obj, member, value, setter) => {
22
- __accessCheck(obj, member, "write to private field");
23
- setter ? setter.call(obj, value) : member.set(obj, value);
24
- return value;
25
- };
26
-
27
- export { __name, __privateAdd, __privateGet, __privateSet, __publicField };
28
- //# sourceMappingURL=out.js.map
29
- //# sourceMappingURL=chunk-PYETHG4R.mjs.map