UNPKG

@react-native-ohos/realm

Version:

Realm by MongoDB is an offline-first mobile database: an alternative to SQLite and key-value stores

126 lines (125 loc) 3.83 kB
import type { binding } from "./binding"; import type { PrimaryKey } from "./schema"; import type { Configuration } from "./Configuration"; export declare class AssertionError extends Error { /** @internal */ constructor(message?: string); } export declare class TypeAssertionError extends AssertionError { private expected; private value; /** @internal */ static deriveType(value: unknown): string; /** * Get an error message for when the target's value is of * the wrong type. Single quotes are added around the target * string if it does not already contain one. * @internal */ private static message; /** @internal */ constructor(/** @internal */ expected: string, /** @internal */ value: unknown, target?: string); /** @internal */ rename(name: string): void; } export declare class IllegalConstructorError extends Error { constructor(type: string); } export declare class TimeoutError extends Error { constructor(message: string); } export declare class SchemaParseError extends Error { /** @internal */ constructor(message: string); } export declare class ObjectSchemaParseError extends SchemaParseError { objectName: string; /** @internal */ constructor(message: string, info: { objectName: string; }); } export declare class PropertySchemaParseError extends SchemaParseError { objectName: string; propertyName: string; /** @internal */ constructor(message: string, info: { objectName: string; propertyName: string; }); } /** @internal */ export declare function fromBindingSyncError(error: binding.SyncError): SyncError; /** * An class describing a sync error. */ export declare class SyncError extends Error { name: string; isOk: boolean; /** * The error code that represents this error. */ code?: number; /** * The category of this error. * @deprecated */ category: string; reason?: string; /** * The URL to the associated server log, if available. The string will be empty * if the sync error is not initiated by the server. */ logUrl: string; /** * A record of extra user information associated with this error. */ userInfo: Record<string, string>; /** * @deprecated Check the error message instead. */ isFatal: boolean; /** @internal */ constructor(error: binding.SyncError); } /** * @deprecated Use the another {@link ClientResetMode} than {@link ClientResetMode.Manual}. * @see https://github.com/realm/realm-js/blob/main/CHANGELOG.md#1110-2022-11-01 * @see https://github.com/realm/realm-js/issues/4135 */ export declare class ClientResetError extends SyncError { name: string; config: Configuration; /** @internal */ constructor(error: binding.SyncError); } /** * An error class that indicates that one or more object changes have been reverted by the server. * This can happen when the client creates/updates objects that do not match any subscription, or performs writes on * an object it didn't have permission to access. */ export declare class CompensatingWriteError extends SyncError { /** * The array of information about each object that caused the compensating write. */ writes: CompensatingWriteInfo[]; /** @internal */ constructor(error: binding.SyncError); } /** * The details of a compensating write performed by the server. */ export type CompensatingWriteInfo = { /** * The type of the object that caused the compensating write. */ objectName: string; /** * The reason for the compensating write. */ reason: string; /** * The primary key of the object that caused the compensating write. */ primaryKey: PrimaryKey; };