@grace-js/grace
Version:
An opinionated API framework
24 lines • 1.51 kB
TypeScript
import { z } from 'zod';
export type FileSize = {
value: number;
unit: 'B' | 'KB' | 'MB' | 'GB' | 'TB';
};
export type FileMimeType = MaybeArray<string | 'image' | 'image/jpeg' | 'image/png' | 'image/gif' | 'image/tiff' | 'image/x-icon' | 'image/svg' | 'image/webp' | 'image/avif' | 'audio' | 'audio/mpeg' | 'audio/x-ms-wma' | 'audio/vnd.rn-realaudio' | 'audio/x-wav' | 'video' | 'video/mpeg' | 'video/mp4' | 'video/quicktime' | 'video/x-ms-wmv' | 'video/x-msvideo' | 'video/x-flv' | 'video/webm' | 'text' | 'text/css' | 'text/csv' | 'text/html' | 'text/javascript' | 'text/plain' | 'text/xml' | 'application' | 'application/ogg' | 'application/pdf' | 'application/xhtml' | 'application/html' | 'application/json' | 'application/ld+json' | 'application/xml' | 'application/zip'>;
export type MaybeArray<T> = T | T[];
export interface GraceFile {
mimetype?: FileMimeType;
minimumSize?: FileSize;
maximumSize?: FileSize;
}
export interface GraceFiles extends GraceFile {
minimumFiles?: number;
maximumFiles?: number;
}
export declare function convertToBytes(fileSize: FileSize): number;
export declare function validateFile(options: GraceFile, value: any): boolean;
export declare const zg: {
file: (options: GraceFile) => z.ZodType<File, z.ZodTypeDef, File>;
files: (options: GraceFiles) => z.ZodArray<z.ZodType<File, z.ZodTypeDef, File>, "many">;
base64: (options: GraceFile) => z.ZodEffects<z.ZodString, string, string>;
} & typeof z;
//# sourceMappingURL=zod.d.ts.map