UNPKG

blade-client

Version:

Access your RONIN database via TypeScript.

92 lines (90 loc) 3.33 kB
import { T as getTriggerName, b as TRIGGER_TYPES, v as StorableObject } from "../index-D9P9itFa.js"; import { CompilerError, CompilerError as CompilerError$1, Query, StoredObject } from "blade-compiler"; //#region src/storage.d.ts /** * Determines whether the provided value is storable as a binary object, or not. * * @param value - The value to check. * * @returns A boolean indicating whether the provided value is storable, or not. */ declare const isStorableObject: (value: unknown) => boolean; /** * ## 🚧 For internal use only! 🚧 * * Process `StorableObjectValue`s contained in queries. * * @param queries - Array of queries that contain `StorableObjectValue`s. * @param upload - A function that receives `StorableObject`s and uploads them. * * @returns Queries with `StorableObjectValue`s replaced by `StoredObject`s. */ declare const processStorableObjects: (queries: Array<Query>, upload: (objects: Array<StorableObject>) => Promise<Array<StoredObject>> | Array<StoredObject>) => Promise<Array<Query>>; //#endregion //#region src/utils/errors.d.ts interface ClientErrorDetails { message: string; code: 'JSON_PARSE_ERROR' | 'TRIGGER_REQUIRED' | 'AUTH_INVALID_ACCESS' | CompilerError$1['code']; } declare class ClientError extends Error { message: ClientErrorDetails['message']; code: ClientErrorDetails['code']; constructor(details: ClientErrorDetails); } //#endregion //#region src/triggers/errors.d.ts interface ErrorDetails { name?: string; message?: string; code?: string; fields?: string[]; instructions?: string[]; } declare class TriggerError extends Error { code?: ErrorDetails['code']; fields?: ErrorDetails['fields']; instructions?: ErrorDetails['instructions']; constructor(details?: ErrorDetails); } declare class InvalidFieldsError extends TriggerError { constructor(details: ErrorDetails & { fields: string[]; reasons?: string[]; }); } declare class EmptyFieldsError extends TriggerError { constructor(details: ErrorDetails & { fields: string[]; }); } declare class ExtraneousFieldsError extends TriggerError { constructor(details: ErrorDetails & { fields: string[]; }); } declare class RecordExistsError extends TriggerError { constructor(details?: ErrorDetails); } declare class RecordNotFoundError extends TriggerError { constructor(details?: ErrorDetails); } declare class TooManyRequestsError extends TriggerError { constructor(details?: ErrorDetails); } declare class InvalidPermissionsError extends TriggerError { constructor(details?: ErrorDetails); } declare class AddNotAllowedError extends TriggerError { constructor(details?: ErrorDetails); } declare class SetNotAllowedError extends TriggerError { constructor(details?: ErrorDetails); } declare class RemoveNotAllowedError extends TriggerError { constructor(details?: ErrorDetails); } declare class MultipleWithInstructionsError extends TriggerError { constructor(); } //#endregion export { AddNotAllowedError, ClientError, CompilerError, EmptyFieldsError, ExtraneousFieldsError, InvalidFieldsError, InvalidPermissionsError, MultipleWithInstructionsError, RecordExistsError, RecordNotFoundError, RemoveNotAllowedError, SetNotAllowedError, TRIGGER_TYPES, TooManyRequestsError, TriggerError, getTriggerName, isStorableObject, processStorableObjects };