@sapphire/plugin-scheduled-tasks 10.0.1-next.3fd39ed.0 → 10.0.1-next.79dff88.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.
package/dist/cjs/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var ScheduledTaskTypes_cjs = require('./lib/types/ScheduledTaskTypes.cjs');
|
|
|
8
8
|
var _load_cjs = require('./listeners/_load.cjs');
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
|
-
var version = "10.0.1-next.
|
|
11
|
+
var version = "10.0.1-next.79dff88.0";
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, 'loadListeners', {
|
|
14
14
|
enumerable: true,
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,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 * 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.1-next.
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,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 * 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.1-next.79dff88.0';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/types/ScheduledTaskTypes.ts"],"names":[],"mappings":";AAAA,OAAkE","sourcesContent":["import { Queue, type JobState, type QueueOptions, type Job } from 'bullmq';\nimport type { ScheduledTaskCustomJobOptions } from '../structures/ScheduledTask';\n\n/**\n * Options for a scheduled task handler.\n */\nexport interface ScheduledTaskHandlerOptions {\n\tqueue?: string;\n\tbull: QueueOptions;\n}\n\n/**\n * Options for listing repeated scheduled tasks.\n */\nexport interface ScheduledTaskListRepeatedOptions {\n\tstart?: number;\n\tend?: number;\n\tasc?: boolean;\n}\n\n/**\n * Options for listing scheduled tasks.\n */\nexport interface ScheduledTaskListOptions extends ScheduledTaskListRepeatedOptions {\n\ttypes: JobState[];\n}\n\n/**\n * A Bull queue client that can be used to schedule and manage scheduled tasks.\n */\nexport type BullClient = Queue<unknown>;\n\n/**\n * The return type of the `getRepeatableJobs` method of a Bull client.\n * If the return type of `getRepeatableJobs` is a Promise, this type extracts the resolved type.\n */\nexport type ScheduledTaskListRepeatedReturnType = ReturnType<BullClient['getRepeatableJobs']> extends Promise<infer U> ? U : never;\n\n/**\n * Options for a scheduled task.\n */\nexport type ScheduledTasksTaskOptions = {\n\trepeated: boolean;\n} & (\n\t| { delay: number; interval?: never; pattern?: never; timezone?: never; customJobOptions?: ScheduledTaskCustomJobOptions }\n\t| { delay?: never; interval: number; pattern?: never; timezone?: never; customJobOptions?: ScheduledTaskCustomJobOptions }\n\t| { delay?: never; interval?: never; pattern: string; timezone: string; customJobOptions?: ScheduledTaskCustomJobOptions }\n);\n\n/**\n * Represents a scheduled task that will be repeated at a specified interval.\n */\nexport interface ScheduledTaskCreateRepeatedTask {\n\tname: ScheduledTasksKeysNoPayload;\n\toptions: ScheduledTasksTaskOptions;\n}\n\n/**\n * The registered tasks and their payload types. When registering new ones, it is recommended to use\n * [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation) so\n * custom ones are registered.\n *\n * @remarks\n * - If the type is `never` or `undefined`, that means that there is no payload associated with that task.\n * - If the type is a union that contains `undefined`, then the payload will be optional.\n *\n * @example\n * ```typescript\n * declare module '@sapphire/plugin-scheduled-tasks' {\n * interface ScheduledTasks {\n * // A task named `Mute` which requires no payload:\n * Mute: never;\n *\n * // A task named `Unmute` which requires a payload with a `userId` property:\n * Unmute: {\n * userId: string;\n * };\n *\n * // A task named `Ban` which has a payload with an optional `moderatorId` property:\n * LogAction: {\n * moderatorId?: string;\n * };\n * }\n * }\n * ```\n */\nexport interface ScheduledTasks {}\n\n/**\n * The keys of {@link ScheduledTasks}.\n */\nexport type ScheduledTasksKeys = keyof ScheduledTasks;\n\n/**\n * The keys of {@link ScheduledTasks} with an optional or no payload.\n */\nexport type ScheduledTasksKeysNoPayload = {\n\t[K in ScheduledTasksKeys]: ScheduledTasks[K] extends never //\n\t\t? K\n\t\t: undefined extends ScheduledTasks[K] // Check if the type is a union that contains `undefined`\n\t\t\t? K\n\t\t\t: never;\n}[ScheduledTasksKeys];\n\n/**\n * The payload type of a {@link ScheduledTasks} entry.\n */\nexport type ScheduledTasksPayload<\n\tK extends ScheduledTasksKeys = ScheduledTasksKeys //\n> = ScheduledTasksKeys extends never // Need to check `never` due to empty interfaces\n\t? undefined\n\t: ScheduledTasks[K] extends never // If the value is `never`, then there is no payload\n\t\t? undefined\n\t\t: ScheduledTasks[K];\n\n/**\n * An entry in {@link ScheduledTasks} that has no payload.\n */\ninterface ScheduledTasksResolvableNoPayload<\n\tK extends ScheduledTasksKeysNoPayload = ScheduledTasksKeysNoPayload //\n> {\n\tname: K;\n}\n\n/**\n * An entry in {@link ScheduledTasks} with it's associated payload.\n */\nexport interface ScheduledTasksResolvablePayload<\n\tK extends ScheduledTasksKeys = ScheduledTasksKeys //\n> {\n\tname: K;\n\tpayload: ScheduledTasksPayload<K>;\n}\n\nexport type ScheduledTasksResolvable =\n\t| ScheduledTasksKeysNoPayload //\n\t| ScheduledTasksResolvableNoPayload\n\t| ScheduledTasksResolvablePayload;\n\nexport type ScheduledTasksJob<T>
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/types/ScheduledTaskTypes.ts"],"names":[],"mappings":";AAAA,OAAkE","sourcesContent":["import { Queue, type JobState, type QueueOptions, type Job } from 'bullmq';\nimport type { ScheduledTaskCustomJobOptions } from '../structures/ScheduledTask';\n\n/**\n * Options for a scheduled task handler.\n */\nexport interface ScheduledTaskHandlerOptions {\n\tqueue?: string;\n\tbull: QueueOptions;\n}\n\n/**\n * Options for listing repeated scheduled tasks.\n */\nexport interface ScheduledTaskListRepeatedOptions {\n\tstart?: number;\n\tend?: number;\n\tasc?: boolean;\n}\n\n/**\n * Options for listing scheduled tasks.\n */\nexport interface ScheduledTaskListOptions extends ScheduledTaskListRepeatedOptions {\n\ttypes: JobState[];\n}\n\n/**\n * A Bull queue client that can be used to schedule and manage scheduled tasks.\n */\nexport type BullClient = Queue<unknown>;\n\n/**\n * The return type of the `getRepeatableJobs` method of a Bull client.\n * If the return type of `getRepeatableJobs` is a Promise, this type extracts the resolved type.\n */\nexport type ScheduledTaskListRepeatedReturnType = ReturnType<BullClient['getRepeatableJobs']> extends Promise<infer U> ? U : never;\n\n/**\n * Options for a scheduled task.\n */\nexport type ScheduledTasksTaskOptions = {\n\trepeated: boolean;\n} & (\n\t| { delay: number; interval?: never; pattern?: never; timezone?: never; customJobOptions?: ScheduledTaskCustomJobOptions }\n\t| { delay?: never; interval: number; pattern?: never; timezone?: never; customJobOptions?: ScheduledTaskCustomJobOptions }\n\t| { delay?: never; interval?: never; pattern: string; timezone: string; customJobOptions?: ScheduledTaskCustomJobOptions }\n);\n\n/**\n * Represents a scheduled task that will be repeated at a specified interval.\n */\nexport interface ScheduledTaskCreateRepeatedTask {\n\tname: ScheduledTasksKeysNoPayload;\n\toptions: ScheduledTasksTaskOptions;\n}\n\n/**\n * The registered tasks and their payload types. When registering new ones, it is recommended to use\n * [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation) so\n * custom ones are registered.\n *\n * @remarks\n * - If the type is `never` or `undefined`, that means that there is no payload associated with that task.\n * - If the type is a union that contains `undefined`, then the payload will be optional.\n *\n * @example\n * ```typescript\n * declare module '@sapphire/plugin-scheduled-tasks' {\n * interface ScheduledTasks {\n * // A task named `Mute` which requires no payload:\n * Mute: never;\n *\n * // A task named `Unmute` which requires a payload with a `userId` property:\n * Unmute: {\n * userId: string;\n * };\n *\n * // A task named `Ban` which has a payload with an optional `moderatorId` property:\n * LogAction: {\n * moderatorId?: string;\n * };\n * }\n * }\n * ```\n */\nexport interface ScheduledTasks {}\n\n/**\n * The keys of {@link ScheduledTasks}.\n */\nexport type ScheduledTasksKeys = keyof ScheduledTasks;\n\n/**\n * The keys of {@link ScheduledTasks} with an optional or no payload.\n */\nexport type ScheduledTasksKeysNoPayload = {\n\t[K in ScheduledTasksKeys]: ScheduledTasks[K] extends never //\n\t\t? K\n\t\t: undefined extends ScheduledTasks[K] // Check if the type is a union that contains `undefined`\n\t\t\t? K\n\t\t\t: never;\n}[ScheduledTasksKeys];\n\n/**\n * The payload type of a {@link ScheduledTasks} entry.\n */\nexport type ScheduledTasksPayload<\n\tK extends ScheduledTasksKeys = ScheduledTasksKeys //\n> = ScheduledTasksKeys extends never // Need to check `never` due to empty interfaces\n\t? undefined\n\t: ScheduledTasks[K] extends never // If the value is `never`, then there is no payload\n\t\t? undefined\n\t\t: ScheduledTasks[K];\n\n/**\n * An entry in {@link ScheduledTasks} that has no payload.\n */\ninterface ScheduledTasksResolvableNoPayload<\n\tK extends ScheduledTasksKeysNoPayload = ScheduledTasksKeysNoPayload //\n> {\n\tname: K;\n}\n\n/**\n * An entry in {@link ScheduledTasks} with it's associated payload.\n */\nexport interface ScheduledTasksResolvablePayload<\n\tK extends ScheduledTasksKeys = ScheduledTasksKeys //\n> {\n\tname: K;\n\tpayload: ScheduledTasksPayload<K>;\n}\n\nexport type ScheduledTasksResolvable =\n\t| ScheduledTasksKeysNoPayload //\n\t| ScheduledTasksResolvableNoPayload\n\t| ScheduledTasksResolvablePayload;\n\nexport type ScheduledTasksJob<T> =\n\tT extends ScheduledTasksResolvableNoPayload<infer R>\n\t\t? Job<ScheduledTasksPayload<R>>\n\t\t: T extends ScheduledTasksResolvablePayload<infer R>\n\t\t\t? Job<ScheduledTasksPayload<R>>\n\t\t\t: Job<undefined>;\n"]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export * from './lib/types/ScheduledTaskEvents.mjs';
|
|
|
6
6
|
export * from './lib/types/ScheduledTaskTypes.mjs';
|
|
7
7
|
export { loadListeners } from './listeners/_load.mjs';
|
|
8
8
|
|
|
9
|
-
var version = "10.0.1-next.
|
|
9
|
+
var version = "10.0.1-next.79dff88.0";
|
|
10
10
|
|
|
11
11
|
export { version };
|
|
12
12
|
//# sourceMappingURL=out.js.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,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 * 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.1-next.
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,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 * 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.1-next.79dff88.0';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/types/ScheduledTaskTypes.ts"],"names":[],"mappings":";AAAA,OAAkE","sourcesContent":["import { Queue, type JobState, type QueueOptions, type Job } from 'bullmq';\nimport type { ScheduledTaskCustomJobOptions } from '../structures/ScheduledTask';\n\n/**\n * Options for a scheduled task handler.\n */\nexport interface ScheduledTaskHandlerOptions {\n\tqueue?: string;\n\tbull: QueueOptions;\n}\n\n/**\n * Options for listing repeated scheduled tasks.\n */\nexport interface ScheduledTaskListRepeatedOptions {\n\tstart?: number;\n\tend?: number;\n\tasc?: boolean;\n}\n\n/**\n * Options for listing scheduled tasks.\n */\nexport interface ScheduledTaskListOptions extends ScheduledTaskListRepeatedOptions {\n\ttypes: JobState[];\n}\n\n/**\n * A Bull queue client that can be used to schedule and manage scheduled tasks.\n */\nexport type BullClient = Queue<unknown>;\n\n/**\n * The return type of the `getRepeatableJobs` method of a Bull client.\n * If the return type of `getRepeatableJobs` is a Promise, this type extracts the resolved type.\n */\nexport type ScheduledTaskListRepeatedReturnType = ReturnType<BullClient['getRepeatableJobs']> extends Promise<infer U> ? U : never;\n\n/**\n * Options for a scheduled task.\n */\nexport type ScheduledTasksTaskOptions = {\n\trepeated: boolean;\n} & (\n\t| { delay: number; interval?: never; pattern?: never; timezone?: never; customJobOptions?: ScheduledTaskCustomJobOptions }\n\t| { delay?: never; interval: number; pattern?: never; timezone?: never; customJobOptions?: ScheduledTaskCustomJobOptions }\n\t| { delay?: never; interval?: never; pattern: string; timezone: string; customJobOptions?: ScheduledTaskCustomJobOptions }\n);\n\n/**\n * Represents a scheduled task that will be repeated at a specified interval.\n */\nexport interface ScheduledTaskCreateRepeatedTask {\n\tname: ScheduledTasksKeysNoPayload;\n\toptions: ScheduledTasksTaskOptions;\n}\n\n/**\n * The registered tasks and their payload types. When registering new ones, it is recommended to use\n * [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation) so\n * custom ones are registered.\n *\n * @remarks\n * - If the type is `never` or `undefined`, that means that there is no payload associated with that task.\n * - If the type is a union that contains `undefined`, then the payload will be optional.\n *\n * @example\n * ```typescript\n * declare module '@sapphire/plugin-scheduled-tasks' {\n * interface ScheduledTasks {\n * // A task named `Mute` which requires no payload:\n * Mute: never;\n *\n * // A task named `Unmute` which requires a payload with a `userId` property:\n * Unmute: {\n * userId: string;\n * };\n *\n * // A task named `Ban` which has a payload with an optional `moderatorId` property:\n * LogAction: {\n * moderatorId?: string;\n * };\n * }\n * }\n * ```\n */\nexport interface ScheduledTasks {}\n\n/**\n * The keys of {@link ScheduledTasks}.\n */\nexport type ScheduledTasksKeys = keyof ScheduledTasks;\n\n/**\n * The keys of {@link ScheduledTasks} with an optional or no payload.\n */\nexport type ScheduledTasksKeysNoPayload = {\n\t[K in ScheduledTasksKeys]: ScheduledTasks[K] extends never //\n\t\t? K\n\t\t: undefined extends ScheduledTasks[K] // Check if the type is a union that contains `undefined`\n\t\t\t? K\n\t\t\t: never;\n}[ScheduledTasksKeys];\n\n/**\n * The payload type of a {@link ScheduledTasks} entry.\n */\nexport type ScheduledTasksPayload<\n\tK extends ScheduledTasksKeys = ScheduledTasksKeys //\n> = ScheduledTasksKeys extends never // Need to check `never` due to empty interfaces\n\t? undefined\n\t: ScheduledTasks[K] extends never // If the value is `never`, then there is no payload\n\t\t? undefined\n\t\t: ScheduledTasks[K];\n\n/**\n * An entry in {@link ScheduledTasks} that has no payload.\n */\ninterface ScheduledTasksResolvableNoPayload<\n\tK extends ScheduledTasksKeysNoPayload = ScheduledTasksKeysNoPayload //\n> {\n\tname: K;\n}\n\n/**\n * An entry in {@link ScheduledTasks} with it's associated payload.\n */\nexport interface ScheduledTasksResolvablePayload<\n\tK extends ScheduledTasksKeys = ScheduledTasksKeys //\n> {\n\tname: K;\n\tpayload: ScheduledTasksPayload<K>;\n}\n\nexport type ScheduledTasksResolvable =\n\t| ScheduledTasksKeysNoPayload //\n\t| ScheduledTasksResolvableNoPayload\n\t| ScheduledTasksResolvablePayload;\n\nexport type ScheduledTasksJob<T>
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/types/ScheduledTaskTypes.ts"],"names":[],"mappings":";AAAA,OAAkE","sourcesContent":["import { Queue, type JobState, type QueueOptions, type Job } from 'bullmq';\nimport type { ScheduledTaskCustomJobOptions } from '../structures/ScheduledTask';\n\n/**\n * Options for a scheduled task handler.\n */\nexport interface ScheduledTaskHandlerOptions {\n\tqueue?: string;\n\tbull: QueueOptions;\n}\n\n/**\n * Options for listing repeated scheduled tasks.\n */\nexport interface ScheduledTaskListRepeatedOptions {\n\tstart?: number;\n\tend?: number;\n\tasc?: boolean;\n}\n\n/**\n * Options for listing scheduled tasks.\n */\nexport interface ScheduledTaskListOptions extends ScheduledTaskListRepeatedOptions {\n\ttypes: JobState[];\n}\n\n/**\n * A Bull queue client that can be used to schedule and manage scheduled tasks.\n */\nexport type BullClient = Queue<unknown>;\n\n/**\n * The return type of the `getRepeatableJobs` method of a Bull client.\n * If the return type of `getRepeatableJobs` is a Promise, this type extracts the resolved type.\n */\nexport type ScheduledTaskListRepeatedReturnType = ReturnType<BullClient['getRepeatableJobs']> extends Promise<infer U> ? U : never;\n\n/**\n * Options for a scheduled task.\n */\nexport type ScheduledTasksTaskOptions = {\n\trepeated: boolean;\n} & (\n\t| { delay: number; interval?: never; pattern?: never; timezone?: never; customJobOptions?: ScheduledTaskCustomJobOptions }\n\t| { delay?: never; interval: number; pattern?: never; timezone?: never; customJobOptions?: ScheduledTaskCustomJobOptions }\n\t| { delay?: never; interval?: never; pattern: string; timezone: string; customJobOptions?: ScheduledTaskCustomJobOptions }\n);\n\n/**\n * Represents a scheduled task that will be repeated at a specified interval.\n */\nexport interface ScheduledTaskCreateRepeatedTask {\n\tname: ScheduledTasksKeysNoPayload;\n\toptions: ScheduledTasksTaskOptions;\n}\n\n/**\n * The registered tasks and their payload types. When registering new ones, it is recommended to use\n * [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation) so\n * custom ones are registered.\n *\n * @remarks\n * - If the type is `never` or `undefined`, that means that there is no payload associated with that task.\n * - If the type is a union that contains `undefined`, then the payload will be optional.\n *\n * @example\n * ```typescript\n * declare module '@sapphire/plugin-scheduled-tasks' {\n * interface ScheduledTasks {\n * // A task named `Mute` which requires no payload:\n * Mute: never;\n *\n * // A task named `Unmute` which requires a payload with a `userId` property:\n * Unmute: {\n * userId: string;\n * };\n *\n * // A task named `Ban` which has a payload with an optional `moderatorId` property:\n * LogAction: {\n * moderatorId?: string;\n * };\n * }\n * }\n * ```\n */\nexport interface ScheduledTasks {}\n\n/**\n * The keys of {@link ScheduledTasks}.\n */\nexport type ScheduledTasksKeys = keyof ScheduledTasks;\n\n/**\n * The keys of {@link ScheduledTasks} with an optional or no payload.\n */\nexport type ScheduledTasksKeysNoPayload = {\n\t[K in ScheduledTasksKeys]: ScheduledTasks[K] extends never //\n\t\t? K\n\t\t: undefined extends ScheduledTasks[K] // Check if the type is a union that contains `undefined`\n\t\t\t? K\n\t\t\t: never;\n}[ScheduledTasksKeys];\n\n/**\n * The payload type of a {@link ScheduledTasks} entry.\n */\nexport type ScheduledTasksPayload<\n\tK extends ScheduledTasksKeys = ScheduledTasksKeys //\n> = ScheduledTasksKeys extends never // Need to check `never` due to empty interfaces\n\t? undefined\n\t: ScheduledTasks[K] extends never // If the value is `never`, then there is no payload\n\t\t? undefined\n\t\t: ScheduledTasks[K];\n\n/**\n * An entry in {@link ScheduledTasks} that has no payload.\n */\ninterface ScheduledTasksResolvableNoPayload<\n\tK extends ScheduledTasksKeysNoPayload = ScheduledTasksKeysNoPayload //\n> {\n\tname: K;\n}\n\n/**\n * An entry in {@link ScheduledTasks} with it's associated payload.\n */\nexport interface ScheduledTasksResolvablePayload<\n\tK extends ScheduledTasksKeys = ScheduledTasksKeys //\n> {\n\tname: K;\n\tpayload: ScheduledTasksPayload<K>;\n}\n\nexport type ScheduledTasksResolvable =\n\t| ScheduledTasksKeysNoPayload //\n\t| ScheduledTasksResolvableNoPayload\n\t| ScheduledTasksResolvablePayload;\n\nexport type ScheduledTasksJob<T> =\n\tT extends ScheduledTasksResolvableNoPayload<infer R>\n\t\t? Job<ScheduledTasksPayload<R>>\n\t\t: T extends ScheduledTasksResolvablePayload<infer R>\n\t\t\t? Job<ScheduledTasksPayload<R>>\n\t\t\t: Job<undefined>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/plugin-scheduled-tasks",
|
|
3
|
-
"version": "10.0.1-next.
|
|
3
|
+
"version": "10.0.1-next.79dff88.0",
|
|
4
4
|
"description": "Plugin for @sapphire/framework to have scheduled tasks",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@sapphire/stopwatch": "^1.5.1",
|
|
52
|
-
"@sapphire/utilities": "^3.
|
|
53
|
-
"bullmq": "5.1.
|
|
52
|
+
"@sapphire/utilities": "^3.15.2",
|
|
53
|
+
"bullmq": "5.1.1",
|
|
54
54
|
"tslib": "^2.6.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"concurrently": "^8.2.2",
|
|
60
60
|
"tsup": "^8.0.1",
|
|
61
61
|
"tsx": "^4.7.0",
|
|
62
|
-
"typedoc": "^0.25.
|
|
62
|
+
"typedoc": "^0.25.7",
|
|
63
63
|
"typedoc-json-parser": "^9.0.1",
|
|
64
64
|
"typescript": "^5.3.3"
|
|
65
65
|
},
|