{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import EventEmitter from \"events\"\nimport { z } from \"zod\"\n\nimport {\n  AutomatePayloadSchema,\n  EnvSchema,\n  IpDataConfigSchema,\n  IpDataFieldsSchema,\n  IpDataResponseSchema,\n  IpHistorySchema,\n  PartialRouterConfigSchema,\n  RenewalPrioritySchema,\n  RouterConfigSchema\n} from \"./schemas\"\n\n// Export the shapes of each zod schema.\nexport type RouterEnv = z.infer<typeof EnvSchema>\nexport type RenewalPriority = z.infer<typeof RenewalPrioritySchema>\nexport type AutomatePayload = z.infer<typeof AutomatePayloadSchema>\nexport type RouterConfig = z.infer<typeof RouterConfigSchema>\nexport type IpHistory = z.infer<typeof IpHistorySchema>\nexport type IpDataConfig = z.infer<typeof IpDataConfigSchema>\nexport type IpDataFields = z.infer<typeof IpDataFieldsSchema>\nexport type IpDataResponse = z.infer<typeof IpDataResponseSchema>\nexport type PartialRouterConfig = z.input<typeof PartialRouterConfigSchema>\n\n// Export one-shot function type.\nexport type RenewIp = (config: PartialRouterConfig) => Promise<boolean>\n\n// Export the base router shape.\nexport interface RenewableRouter extends EventEmitter {\n  readonly ip: string | undefined\n  readonly lastCachedIp: string | undefined\n  readonly attempts: number\n  readonly history: IpHistory[]\n\n  init(): Promise<void>\n\n  renew(): Promise<boolean>\n\n  validateIp(ip: IpHistory | undefined): boolean\n}\n"]}