import { Models } from './models'; import { Channel, ActionableChannel, ResolvedChannel } from './channel'; import { Query } from './query'; /** * Payload type representing a key-value pair with string keys and any values. */ type Payload = { [key: string]: any; }; /** * Headers type representing a key-value pair with string keys and string values. */ type Headers = { [key: string]: string; }; /** * Realtime event response structure with generic payload type. */ type RealtimeResponseEvent = { /** * List of event names associated with the response. */ events: string[]; /** * List of channel names associated with the response. */ channels: string[]; /** * Timestamp indicating the time of the event. */ timestamp: string; /** * Payload containing event-specific data. */ payload: T; /** * Subscription IDs this event matches (from backend, optional). */ subscriptions?: string[]; }; /** * Type representing upload progress information. */ type UploadProgress = { /** * Identifier for the upload progress. */ $id: string; /** * Current progress of the upload (in percentage). */ progress: number; /** * Total size uploaded (in bytes) during the upload process. */ sizeUploaded: number; /** * Total number of chunks that need to be uploaded. */ chunksTotal: number; /** * Number of chunks that have been successfully uploaded. */ chunksUploaded: number; }; /** * Exception thrown by the package */ declare class RevenexxException extends Error { /** * The error code associated with the exception. */ code: number; /** * The response string associated with the exception. */ response: string; /** * Error type. * See [Error Types](https://revenexx.com/docs/response-codes#errorTypes) for more information. */ type: string; /** * Initializes a Revenexx Exception. * * @param {string} message - The error message. * @param {number} code - The error code. Default is 0. * @param {string} type - The error type. Default is an empty string. * @param {string} response - The response string. Default is an empty string. */ constructor(message: string, code?: number, type?: string, response?: string); } /** * Client that handles requests to Revenexx */ declare class Client { static CHUNK_SIZE: number; /** * Holds configuration such as project. */ config: { endpoint: string; endpointRealtime: string; tenant: string; market: string; apikeyauth: string; bearerauth: string; }; /** * Custom headers for API requests. */ headers: Headers; /** * Set Endpoint * * Your project endpoint * * @param {string} endpoint * * @returns {this} */ setEndpoint(endpoint: string): this; /** * Set Realtime Endpoint * * @param {string} endpointRealtime * * @returns {this} */ setEndpointRealtime(endpointRealtime: string): this; /** * Set Tenant * * The tenant slug your requests are scoped to, sent as the * X-Revenexx-Tenant header on every request. * * @param value string * * @return {this} */ setTenant(value: string): this; /** * Set Market * * The active market slug to scope requests to, sent as the * X-Revenexx-Market header. Optional — omit it to see only global rows. * * @param value string * * @return {this} */ setMarket(value: string): this; /** * Set ApiKeyAuth * * A gateway-managed scoped API key (rvxk_…). * * @param value string * * @return {this} */ setApiKeyAuth(value: string): this; /** * Set BearerAuth * * A Zitadel-issued JWT (Cockpit / interactive callers). * * @param value string * * @return {this} */ setBearerAuth(value: string): this; private realtime; /** * Subscribes to Revenexx events and passes you the payload in realtime. * * @deprecated Use the Realtime service instead. * @see Realtime * * @param {string|string[]|Channel|ActionableChannel|ResolvedChannel|(Channel|ActionableChannel|ResolvedChannel)[]} channels * Channel to subscribe - pass a single channel as a string or Channel builder instance, or multiple with an array. * * Possible channels are: * - account * - collections * - collections.[ID] * - collections.[ID].documents * - documents * - documents.[ID] * - files * - files.[ID] * - executions * - executions.[ID] * - functions.[ID] * - teams * - teams.[ID] * - memberships * - memberships.[ID] * * You can also use Channel builders: * - Channel.database('db').collection('col').document('doc').create() * - Channel.bucket('bucket').file('file').update() * - Channel.function('func').execution('exec').delete() * - Channel.team('team').create() * - Channel.membership('membership').update() * @param {(payload: RealtimeMessage) => void} callback Is called on every realtime update. * @returns {() => void} Unsubscribes from events. */ subscribe(channels: string | string[] | Channel | ActionableChannel | ResolvedChannel | (Channel | ActionableChannel | ResolvedChannel)[], callback: (payload: RealtimeResponseEvent) => void, queries?: (string | Query)[]): () => void; prepareRequest(method: string, url: URL, headers?: Headers, params?: Payload): { uri: string; options: RequestInit; }; chunkedUpload(method: string, url: URL, headers: Headers | undefined, originalPayload: Payload | undefined, onProgress: (progress: UploadProgress) => void): Promise; ping(): Promise; call(method: string, url: URL, headers?: Headers, params?: Payload, responseType?: string): Promise; /** * Recursively renames an argument's DECLARED keys to their snake_case wire * names, using a map generated from the API contract. Free-form subtrees * (metadata / user_data — keys absent from the map, with no `children`) are * passed through untouched, so user data is never mangled. For arrays the * same element map is applied to every item. */ static toWireKeys(value: any, map: Record): any; static flatten(data: Payload, prefix?: string): Payload; } export { Client, RevenexxException }; export { Query } from './query'; export type { Models, Payload, UploadProgress }; export type { RealtimeResponseEvent }; export type { QueryTypes, QueryTypesList } from './query';