/** * Plugin system for extending ChainedDate with custom methods * * @example * ```ts * import { extend } from 'ts-time-utils/plugins'; * import { ChainedDate } from 'ts-time-utils/chain'; * * // Define plugin methods * extend('myPlugin', { * nextMonday(this: ChainedDate): ChainedDate { * const day = this.weekday(); * const daysUntilMonday = day === 0 ? 1 : 8 - day; * return this.add(daysUntilMonday, 'days'); * } * }); * * // Use plugin methods * chain(new Date()).nextMonday().format('YYYY-MM-DD'); * ``` */ /** * Plugin function type - methods receive ChainedDate instance as `this` */ export type PluginFunction = (this: any, ...args: any[]) => any; /** * Plugin definition - map of method names to functions */ export interface Plugin { [methodName: string]: PluginFunction; } /** * Extend ChainedDate with custom methods * * @param pluginName - Unique name for the plugin * @param methods - Object mapping method names to functions * * @example * ```ts * extend('businessDays', { * addBusinessDays(this: ChainedDate, days: number): ChainedDate { * let current = this.clone(); * let remaining = days; * * while (remaining > 0) { * current = current.add(1, 'days'); * if (current.isWeekday()) remaining--; * } * * return current; * } * }); * * chain(new Date()).addBusinessDays(5); * ``` */ export declare function extend(pluginName: string, methods: Plugin): void; /** * Remove a plugin and its methods from ChainedDate * * @param pluginName - Name of the plugin to uninstall * * @example * ```ts * uninstall('businessDays'); * ``` */ export declare function uninstall(pluginName: string): void; /** * Get list of all registered plugin names * * @returns Array of plugin names * * @example * ```ts * getRegisteredPlugins(); // ['businessDays', 'myPlugin'] * ``` */ export declare function getRegisteredPlugins(): string[]; /** * Get list of methods provided by a plugin * * @param pluginName - Name of the plugin * @returns Array of method names, or empty array if plugin not found * * @example * ```ts * getPluginMethods('businessDays'); // ['addBusinessDays', 'subtractBusinessDays'] * ``` */ export declare function getPluginMethods(pluginName: string): string[]; /** * Check if a plugin is registered * * @param pluginName - Name of the plugin * @returns True if plugin is registered * * @example * ```ts * isPluginRegistered('businessDays'); // true * ``` */ export declare function isPluginRegistered(pluginName: string): boolean; /** * Declare plugin methods for TypeScript support * * Use module augmentation to add type definitions for your plugin methods: * * @example * ```ts * import { ChainedDate } from 'ts-time-utils/chain'; * * declare module 'ts-time-utils/chain' { * interface ChainedDate { * addBusinessDays(days: number): ChainedDate; * subtractBusinessDays(days: number): ChainedDate; * } * } * ``` */ export interface PluginDeclaration { } //# sourceMappingURL=plugins.d.ts.map