UNPKG

@lusc/fastmail-masked-email

Version:

A library for creating, deleting, and updating Fastmail masked emails

247 lines (245 loc) 9.35 kB
import { type z } from 'zod'; export declare const sessionResponseSchema: z.ZodObject<{ state: z.ZodString; apiUrl: z.ZodString; capabilities: z.ZodObject<{ 'urn:ietf:params:jmap:core': z.ZodObject<{ maxConcurrentUpload: z.ZodNumber; maxConcurrentRequests: z.ZodNumber; maxSizeRequest: z.ZodNumber; maxObjectsInGet: z.ZodNumber; maxCallsInRequest: z.ZodNumber; maxSizeUpload: z.ZodNumber; maxObjectsInSet: z.ZodNumber; collationAlgorithms: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { maxConcurrentUpload: number; maxConcurrentRequests: number; maxSizeRequest: number; maxObjectsInGet: number; maxCallsInRequest: number; maxSizeUpload: number; maxObjectsInSet: number; collationAlgorithms: string[]; }, { maxConcurrentUpload: number; maxConcurrentRequests: number; maxSizeRequest: number; maxObjectsInGet: number; maxCallsInRequest: number; maxSizeUpload: number; maxObjectsInSet: number; collationAlgorithms: string[]; }>; 'https://www.fastmail.com/dev/maskedemail': z.ZodRecord<z.ZodString, z.ZodUnknown>; }, "strip", z.ZodTypeAny, { 'urn:ietf:params:jmap:core': { maxConcurrentUpload: number; maxConcurrentRequests: number; maxSizeRequest: number; maxObjectsInGet: number; maxCallsInRequest: number; maxSizeUpload: number; maxObjectsInSet: number; collationAlgorithms: string[]; }; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }, { 'urn:ietf:params:jmap:core': { maxConcurrentUpload: number; maxConcurrentRequests: number; maxSizeRequest: number; maxObjectsInGet: number; maxCallsInRequest: number; maxSizeUpload: number; maxObjectsInSet: number; collationAlgorithms: string[]; }; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }>; accounts: z.ZodRecord<z.ZodString, z.ZodObject<{ name: z.ZodString; isPersonal: z.ZodBoolean; accountCapabilities: z.ZodObject<{ 'urn:ietf:params:jmap:core': z.ZodRecord<z.ZodString, z.ZodUnknown>; 'https://www.fastmail.com/dev/maskedemail': z.ZodRecord<z.ZodString, z.ZodUnknown>; }, "strip", z.ZodTypeAny, { 'urn:ietf:params:jmap:core': Record<string, unknown>; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }, { 'urn:ietf:params:jmap:core': Record<string, unknown>; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }>; isReadOnly: z.ZodBoolean; }, "strip", z.ZodTypeAny, { name: string; isPersonal: boolean; accountCapabilities: { 'urn:ietf:params:jmap:core': Record<string, unknown>; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }; isReadOnly: boolean; }, { name: string; isPersonal: boolean; accountCapabilities: { 'urn:ietf:params:jmap:core': Record<string, unknown>; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }; isReadOnly: boolean; }>>; eventSourceUrl: z.ZodString; downloadUrl: z.ZodString; uploadUrl: z.ZodString; username: z.ZodString; primaryAccounts: z.ZodRecord<z.ZodString, z.ZodString>; }, "strip", z.ZodTypeAny, { state: string; apiUrl: string; capabilities: { 'urn:ietf:params:jmap:core': { maxConcurrentUpload: number; maxConcurrentRequests: number; maxSizeRequest: number; maxObjectsInGet: number; maxCallsInRequest: number; maxSizeUpload: number; maxObjectsInSet: number; collationAlgorithms: string[]; }; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }; accounts: Record<string, { name: string; isPersonal: boolean; accountCapabilities: { 'urn:ietf:params:jmap:core': Record<string, unknown>; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }; isReadOnly: boolean; }>; eventSourceUrl: string; downloadUrl: string; uploadUrl: string; username: string; primaryAccounts: Record<string, string>; }, { state: string; apiUrl: string; capabilities: { 'urn:ietf:params:jmap:core': { maxConcurrentUpload: number; maxConcurrentRequests: number; maxSizeRequest: number; maxObjectsInGet: number; maxCallsInRequest: number; maxSizeUpload: number; maxObjectsInSet: number; collationAlgorithms: string[]; }; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }; accounts: Record<string, { name: string; isPersonal: boolean; accountCapabilities: { 'urn:ietf:params:jmap:core': Record<string, unknown>; 'https://www.fastmail.com/dev/maskedemail': Record<string, unknown>; }; isReadOnly: boolean; }>; eventSourceUrl: string; downloadUrl: string; uploadUrl: string; username: string; primaryAccounts: Record<string, string>; }>; export type Session = { apiToken: string; apiUrl: string; accountId: string; capabilities: string[]; }; export declare const maskedEmailStateSchema: z.ZodEnum<["enabled", "disabled", "pending", "deleted"]>; /** * Represents the state of a masked email address. * * The state of a masked email address can be one of the following: * - enabled * - The address is active and receiving mail normally. * - disabled * - The address is active, but mail is sent straight to trash. * - deleted * - The address is inactive; any mail sent to the address is bounced. * - pending * - The initial state. Once set to anything else, it cannot be set back to pending. * - If a message is received by an address in the "pending" state, it will automatically be converted to "enabled". * - Pending email addresses are automatically deleted 24h after creation. * @see {@link https://www.fastmail.com/developer/maskedemail/} */ export type MaskedEmailState = z.infer<typeof maskedEmailStateSchema>; export declare const optionsSchema: z.ZodEffects<z.ZodObject<{ /** The description to set fpr the masked email */ description: z.ZodOptional<z.ZodString>; /** The domain to be associated with the masked email */ forDomain: z.ZodOptional<z.ZodString>; /** * The state to set for the masked email * @defaultValue 'enabled' * @see {@link MaskedEmailState} for valid values * */ state: z.ZodDefault<z.ZodEnum<["enabled", "disabled", "pending", "deleted"]>>; }, "strip", z.ZodTypeAny, { state: "enabled" | "disabled" | "pending" | "deleted"; description?: string | undefined; forDomain?: string | undefined; }, { state?: "enabled" | "disabled" | "pending" | "deleted" | undefined; description?: string | undefined; forDomain?: string | undefined; }>, { state: "enabled" | "disabled" | "pending" | "deleted"; description?: string | undefined; forDomain?: string | undefined; }, { state?: "enabled" | "disabled" | "pending" | "deleted" | undefined; description?: string | undefined; forDomain?: string | undefined; }>; export type Options = z.input<typeof optionsSchema>; export declare const createOptionsSchema: z.ZodIntersection<z.ZodEffects<z.ZodObject<{ /** The description to set fpr the masked email */ description: z.ZodOptional<z.ZodString>; /** The domain to be associated with the masked email */ forDomain: z.ZodOptional<z.ZodString>; /** * The state to set for the masked email * @defaultValue 'enabled' * @see {@link MaskedEmailState} for valid values * */ state: z.ZodDefault<z.ZodEnum<["enabled", "disabled", "pending", "deleted"]>>; }, "strip", z.ZodTypeAny, { state: "enabled" | "disabled" | "pending" | "deleted"; description?: string | undefined; forDomain?: string | undefined; }, { state?: "enabled" | "disabled" | "pending" | "deleted" | undefined; description?: string | undefined; forDomain?: string | undefined; }>, { state: "enabled" | "disabled" | "pending" | "deleted"; description?: string | undefined; forDomain?: string | undefined; }, { state?: "enabled" | "disabled" | "pending" | "deleted" | undefined; description?: string | undefined; forDomain?: string | undefined; }>, z.ZodObject<{ /** If supplied, the server-assigned email will start with the given prefix. */ emailPrefix: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { emailPrefix?: string | undefined; }, { emailPrefix?: string | undefined; }>>; export type CreateOptions = z.input<typeof createOptionsSchema>;