/// /// /// import { z } from 'zod'; import { DataSource } from './data-sources/data-source.js'; import { FileProperties } from './file-properties.js'; import { Readable } from 'stream'; /** * The schema for the document object. */ export declare const DocumentSchema: z.ZodObject<{ /** * A URL pointing to the document. */ url: z.ZodEffects, import("url").URL, unknown>; /** * The MIME type of the document. */ type: z.ZodString; /** * The size of the document in bytes. */ size: z.ZodOptional; /** * A hash representing the document content. */ etag: z.ZodOptional; }, "strict", z.ZodTypeAny, { url: import("url").URL; type: string; size?: number | undefined; etag?: string | undefined; }, { type: string; url?: unknown; size?: number | undefined; etag?: string | undefined; }>; /** * The document properties type. */ type DocumentSchemaProps = z.infer; /** * Builder for the document. */ declare class Builder { private props; /** * @param url The URL pointing to the content * of the document. * @returns The builder instance. */ withUrl(url: string | URL): this; /** * @param type The mime type of the document. * @returns The builder instance. */ withType(type: string): this; /** * @param size The size of the document. * @returns The builder instance. */ withSize(size: number): this; /** * @param etag The etag of the document. * @returns The builder instance. */ withEtag(etag: string): this; /** * @returns A new document instance. */ build(): Document; } /** * Represents a document that can be processed and stored. * This class describes the different attributes of a document * such that it can be seamlessly processed by the Lake GPT middlewares. */ export declare class Document { props: DocumentSchemaProps; /** * The data source associated with the document. */ private dataSource; /** * The builder class. */ static Builder: typeof Builder; /** * @param props The document properties. */ constructor(props: DocumentSchemaProps); /** * @param data An object representing the document. * This can be a JSON string or an object. * @returns A document instance. * @throws An error if the document is invalid. */ static from(data: string | object): Document; /** * @returns A unique, opaque, identifier that can be * considered unique for identifying the document. * @note The underlying implementation can change, * it should not be assumed the format of the identifier to * remain stable. */ id(): string; /** * @returns The url associated with the document * as a URL object. * @throws An error if the url is invalid. */ url(): URL; /** * @returns The filename of the document. * as a string. */ filename(): FileProperties; /** * @returns The mime type of the document. */ mimeType(): string; /** * @returns The size of the document. */ size(): number | undefined; /** * @returns The etag of the document. */ etag(): string | undefined; /** * @returns The data source object associated * with the document. */ data(): DataSource; /** * @returns A new instance consisting of a deep copy of * values associated with the current document. */ clone(): Document; /** * Creates a new document instance and stores the data associated with * the new document in the storage associated with the given URL. * @param input an object describing the attributes of the document. * @returns a new instance of a document. */ static create(input: { url: URL | string; type: string; data: Buffer | Readable; }): Promise; /** * Describes how the document should be serialized. * @returns A JSON representation of the document. */ toJSON(): { url: string; type: string; size: number | undefined; etag: string | undefined; }; } export {};