UNPKG

realm

Version:

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

1,215 lines (1,210 loc) 60.5 kB
//////////////////////////////////////////////////////////////////////////// // // Copyright 2024 Realm Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////// import { Decimal128, ObjectId, UUID } from "bson"; import { AppCacheMode, AuthProvider, ClientResetMode, DataType, Float, HttpMethod, LoggerLevel, MetadataMode, ProgressDirection, PropertyType, ProxyType, SchemaMode, Status, SyncErrorAction, SyncSessionConnectionState, SyncSessionState, SyncSessionStopPolicy, SyncSubscriptionSetState, SyncUserState, TableType, WatchStreamState, } from "../dist/core"; export * from "../dist/core"; // Utilities export type AppError = Error & { code: number }; export type CppErrorCode = Error & { code: number; category: string }; // WeakRef polyfill for Hermes. export class WeakRef<T extends object> { constructor(obj: T); deref(): T | undefined; } export const enum Int64Type {} // This shouldn't need to be exported, but rollup complains if it isn't. export type Int64 = Int64Type; export const Int64: { add(a: Int64, b: Int64): Int64; equals(a: Int64, b: Int64 | number | string): boolean; isInt(a: unknown): a is Int64; numToInt(a: number): Int64; strToInt(a: string): Int64; intToNum(a: Int64): number; }; // Mixed types export type Mixed = | null | Int64 | boolean | Float | number | string | ArrayBuffer | Timestamp | Decimal128 | ObjectId | UUID | ObjLink | ObjKey; export type MixedArg = | null | Obj | Geospatial | Int64 | boolean | Float | number | string | ArrayBuffer | Timestamp | Decimal128 | ObjectId | UUID | ObjLink | ObjKey; export type EJson = null | string | number | boolean | EJson[] | { [name: string]: EJson }; // Opaque types (including Key types) /** Using an empty enum to express a nominal type */ export enum Schema {} /** Using an empty enum to express a nominal type */ export enum Group {} /** Using an empty enum to express a nominal type */ export enum AuditInterface {} /** Using an empty enum to express a nominal type */ export enum ColKey {} /** Using an empty enum to express a nominal type */ export enum ObjKey {} /** Using an empty enum to express a nominal type */ export enum TableKey {} // Records export type Property = { name: string; publicName: string; type: PropertyType; objectType: string; linkOriginPropertyName: string; /** @default false */ isPrimary: boolean; /** @default false */ isIndexed: boolean; /** @default false */ isFulltextIndexed: boolean; columnKey: ColKey; }; export type Property_Relaxed = { name: string; publicName?: string; type: PropertyType; objectType?: string; linkOriginPropertyName?: string; /** @default false */ isPrimary?: boolean; /** @default false */ isIndexed?: boolean; /** @default false */ isFulltextIndexed?: boolean; columnKey?: ColKey; }; export type VersionId = { /** * @deprecated Add `version` to your opt-in list (under `records/VersionID/fields/`) to use this. * @default 0x7FFF_FFFF_FFFF_FFFF */ version: Int64; /** * @deprecated Add `index` to your opt-in list (under `records/VersionID/fields/`) to use this. * @default 0 */ index: number; }; export type VersionId_Relaxed = { /** * @deprecated Add `version` to your opt-in list (under `records/VersionID/fields/`) to use this. * @default 0x7FFF_FFFF_FFFF_FFFF */ version?: Int64; /** * @deprecated Add `index` to your opt-in list (under `records/VersionID/fields/`) to use this. * @default 0 */ index?: number; }; export type ObjectSchema = { name: string; persistedProperties: Array<Property>; computedProperties: Array<Property>; primaryKey: string; tableKey: TableKey; /** @default TopLevel */ tableType: TableType; /** @deprecated Add `alias` to your opt-in list (under `records/ObjectSchema/fields/`) to use this. */ alias: string; }; export type ObjectSchema_Relaxed = { name: string; persistedProperties?: Array<Property_Relaxed>; computedProperties?: Array<Property_Relaxed>; primaryKey?: string; tableKey?: TableKey; /** @default TopLevel */ tableType?: TableType; /** @deprecated Add `alias` to your opt-in list (under `records/ObjectSchema/fields/`) to use this. */ alias?: string; }; export type GeoPoint = { longitude: number; latitude: number; /** @default std::numeric_limits<double>::quiet_NaN() */ altitude: number; }; export type GeoPoint_Relaxed = { longitude: number; latitude: number; /** @default std::numeric_limits<double>::quiet_NaN() */ altitude?: number; }; export type GeoCircle = { radiusRadians: number; center: GeoPoint; }; export type GeoCircle_Relaxed = { radiusRadians: number; center: GeoPoint_Relaxed; }; export type GeoBox = { lo: GeoPoint; hi: GeoPoint; }; export type GeoBox_Relaxed = { lo: GeoPoint_Relaxed; hi: GeoPoint_Relaxed; }; export type GeoPolygon = { points: Array<Array<GeoPoint>>; }; export type GeoPolygon_Relaxed = { points: Array<Array<GeoPoint_Relaxed>>; }; export type RealmConfig = { path: string; /** @default false */ cache: boolean; encryptionKey: ArrayBuffer; fifoFilesFallbackPath: string; /** @default false */ inMemory: boolean; schema: undefined | Array<ObjectSchema>; /** @default -1 */ schemaVersion: Int64; /** @default SchemaMode::Automatic */ schemaMode: SchemaMode; /** @default false */ disableFormatUpgrade: boolean; syncConfig: null | SyncConfig; /** @default false */ forceSyncHistory: boolean; /** @default false */ automaticallyHandleBacklinksInMigrations: boolean; }; export type RealmConfig_Relaxed = { path: string; /** @default false */ cache?: boolean; encryptionKey?: ArrayBuffer; fifoFilesFallbackPath?: string; /** @default false */ inMemory?: boolean; schema?: undefined | Array<ObjectSchema_Relaxed>; /** @default -1 */ schemaVersion?: Int64; /** @default SchemaMode::Automatic */ schemaMode?: SchemaMode; /** @default false */ disableFormatUpgrade?: boolean; syncConfig?: null | SyncConfig_Relaxed; /** @default false */ forceSyncHistory?: boolean; migrationFunction?: null | ((old_realm: Realm, new_realm: Realm) => void); initializationFunction?: null | ((realm: Realm) => void); shouldCompactOnLaunchFunction?: null | ((total_bytes: Int64, used_bytes: Int64) => boolean); /** @default false */ automaticallyHandleBacklinksInMigrations?: boolean; }; export type UserIdentity = { id: string; providerType: string; }; export type UserIdentity_Relaxed = { id: string; providerType: string; }; export type UserApiKey = { id: ObjectId; key: undefined | string; name: string; disabled: boolean; }; export type UserApiKey_Relaxed = { id: ObjectId; key?: undefined | string; name: string; disabled: boolean; }; export type SyncProxyConfig = { address: string; port: number; type: ProxyType; }; export type SyncProxyConfig_Relaxed = { address: string; port: number; type: ProxyType; }; export type SyncConfig = { user: SyncUser; partitionValue: string; /** @default AfterChangesUploaded */ stopPolicy: SyncSessionStopPolicy; /** @default false */ flxSyncRequested: boolean; customHttpHeaders: Record<string, string>; /** @default true */ clientValidateSsl: boolean; sslTrustCertificatePath: undefined | string; sslVerifyCallback: null | SslVerifyCallback; /** @default ClientResyncMode::Manual; */ clientResyncMode: ClientResetMode; /** @default false */ cancelWaitsOnNonfatalError: boolean; proxyConfig: undefined | SyncProxyConfig; }; export type SyncConfig_Relaxed = { user: SyncUser; partitionValue?: string; /** @default AfterChangesUploaded */ stopPolicy?: SyncSessionStopPolicy; /** @default false */ flxSyncRequested?: boolean; errorHandler?: null | ((session: SyncSession, error: SyncError) => void); customHttpHeaders?: Record<string, string>; /** @default true */ clientValidateSsl?: boolean; sslTrustCertificatePath?: undefined | string; sslVerifyCallback?: null | SslVerifyCallback; /** @default ClientResyncMode::Manual; */ clientResyncMode?: ClientResetMode; notifyBeforeClientReset?: null | ((before_frozen: Realm) => void); notifyAfterClientReset?: null | ((before_frozen: Realm, after: ThreadSafeReference, did_recover: boolean) => void); /** @default false */ cancelWaitsOnNonfatalError?: boolean; proxyConfig?: undefined | SyncProxyConfig_Relaxed; }; export type SyncSubscription = { id: ObjectId; createdAt: Timestamp; updatedAt: Timestamp; name: undefined | string; objectClassName: string; queryString: string; }; export type SyncSubscription_Relaxed = { id: ObjectId; createdAt: Timestamp; updatedAt: Timestamp; name?: undefined | string; objectClassName: string; queryString: string; }; export type ObjectChangeSet = { isDeleted: boolean; changedColumns: Array<ColKey>; }; export type ObjectChangeSet_Relaxed = { isDeleted: boolean; changedColumns: Array<ColKey>; }; export type CollectionChangeSetMove = { /** @deprecated Add `from` to your opt-in list (under `records/CollectionChangeSetMove/fields/`) to use this. */ from: number; /** @deprecated Add `to` to your opt-in list (under `records/CollectionChangeSetMove/fields/`) to use this. */ to: number; }; export type CollectionChangeSetMove_Relaxed = { /** @deprecated Add `from` to your opt-in list (under `records/CollectionChangeSetMove/fields/`) to use this. */ from: number; /** @deprecated Add `to` to your opt-in list (under `records/CollectionChangeSetMove/fields/`) to use this. */ to: number; }; export type CollectionChangeSet = { deletions: IndexSet; insertions: IndexSet; modifications: IndexSet; modificationsNew: IndexSet; /** @deprecated Add `moves` to your opt-in list (under `records/CollectionChangeSet/fields/`) to use this. */ moves: Array<CollectionChangeSetMove>; /** @deprecated Add `collection_root_was_deleted` to your opt-in list (under `records/CollectionChangeSet/fields/`) to use this. */ collectionRootWasDeleted: boolean; /** @deprecated Add `collection_was_cleared` to your opt-in list (under `records/CollectionChangeSet/fields/`) to use this. */ collectionWasCleared: boolean; }; export type CollectionChangeSet_Relaxed = { deletions: IndexSet; insertions: IndexSet; modifications: IndexSet; modificationsNew: IndexSet; /** @deprecated Add `moves` to your opt-in list (under `records/CollectionChangeSet/fields/`) to use this. */ moves: Array<CollectionChangeSetMove_Relaxed>; /** @deprecated Add `collection_root_was_deleted` to your opt-in list (under `records/CollectionChangeSet/fields/`) to use this. */ collectionRootWasDeleted: boolean; /** @deprecated Add `collection_was_cleared` to your opt-in list (under `records/CollectionChangeSet/fields/`) to use this. */ collectionWasCleared: boolean; }; export type DictionaryChangeSet = { deletions: Array<Mixed>; insertions: Array<Mixed>; modifications: Array<Mixed>; /** @deprecated Add `collection_root_was_deleted` to your opt-in list (under `records/DictionaryChangeSet/fields/`) to use this. */ collectionRootWasDeleted: boolean; }; export type DictionaryChangeSet_Relaxed = { deletions: Array<MixedArg>; insertions: Array<MixedArg>; modifications: Array<MixedArg>; /** @deprecated Add `collection_root_was_deleted` to your opt-in list (under `records/DictionaryChangeSet/fields/`) to use this. */ collectionRootWasDeleted: boolean; }; export type BindingContext = Record<string, never>; export type BindingContext_Relaxed = { didChange?: null | ((r: Realm) => void); beforeNotify?: null | ((r: Realm) => void); schemaDidChange?: null | ((r: Realm) => void); }; export type SyncClientTimeouts = { /** * @deprecated Add `connect_timeout` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 120000 */ connectTimeout: Int64; /** * @deprecated Add `connection_linger_time` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 30000 */ connectionLingerTime: Int64; /** * @deprecated Add `ping_keepalive_period` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 60000 */ pingKeepalivePeriod: Int64; /** * @deprecated Add `pong_keepalive_timeout` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 120000 */ pongKeepaliveTimeout: Int64; /** * @deprecated Add `fast_reconnect_limit` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 60000 */ fastReconnectLimit: Int64; }; export type SyncClientTimeouts_Relaxed = { /** * @deprecated Add `connect_timeout` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 120000 */ connectTimeout?: Int64; /** * @deprecated Add `connection_linger_time` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 30000 */ connectionLingerTime?: Int64; /** * @deprecated Add `ping_keepalive_period` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 60000 */ pingKeepalivePeriod?: Int64; /** * @deprecated Add `pong_keepalive_timeout` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 120000 */ pongKeepaliveTimeout?: Int64; /** * @deprecated Add `fast_reconnect_limit` to your opt-in list (under `records/SyncClientTimeouts/fields/`) to use this. * @default 60000 */ fastReconnectLimit?: Int64; }; export type SyncClientConfig = { baseFilePath: string; /** @default MetadataMode::Encryption */ metadataMode: MetadataMode; customEncryptionKey: undefined | ArrayBuffer; /** @deprecated Add `logger_factory` to your opt-in list (under `records/SyncClientConfig/fields/`) to use this. */ loggerFactory: null | LoggerFactory; /** * @deprecated Add `log_level` to your opt-in list (under `records/SyncClientConfig/fields/`) to use this. * @default LoggerLevel::info */ logLevel: LoggerLevel; /** @default false */ multiplexSessions: boolean; userAgentBindingInfo: string; /** @deprecated Add `user_agent_application_info` to your opt-in list (under `records/SyncClientConfig/fields/`) to use this. */ userAgentApplicationInfo: string; /** @deprecated Add `timeouts` to your opt-in list (under `records/SyncClientConfig/fields/`) to use this. */ timeouts: SyncClientTimeouts; }; export type SyncClientConfig_Relaxed = { baseFilePath: string; /** @default MetadataMode::Encryption */ metadataMode?: MetadataMode; customEncryptionKey?: undefined | ArrayBuffer; /** @deprecated Add `logger_factory` to your opt-in list (under `records/SyncClientConfig/fields/`) to use this. */ loggerFactory?: null | LoggerFactory; /** * @deprecated Add `log_level` to your opt-in list (under `records/SyncClientConfig/fields/`) to use this. * @default LoggerLevel::info */ logLevel?: LoggerLevel; /** @default false */ multiplexSessions?: boolean; userAgentBindingInfo?: string; /** @deprecated Add `user_agent_application_info` to your opt-in list (under `records/SyncClientConfig/fields/`) to use this. */ userAgentApplicationInfo?: string; /** @deprecated Add `timeouts` to your opt-in list (under `records/SyncClientConfig/fields/`) to use this. */ timeouts?: SyncClientTimeouts_Relaxed; }; export type SyncError = { status: Status; isFatal: boolean; simpleMessage: string; logUrl: string; userInfo: Record<string, string>; /** * @deprecated Add `is_unrecognized_by_client` to your opt-in list (under `records/SyncError/fields/`) to use this. * @default false */ isUnrecognizedByClient: boolean; isClientResetRequested: boolean; /** * @deprecated Add `server_requests_action` to your opt-in list (under `records/SyncError/fields/`) to use this. * @default NoAction */ serverRequestsAction: SyncErrorAction; compensatingWritesInfo: Array<CompensatingWriteErrorInfo>; }; export type SyncError_Relaxed = { status: Status; isFatal: boolean; simpleMessage: string; logUrl: string; userInfo: Record<string, string>; /** * @deprecated Add `is_unrecognized_by_client` to your opt-in list (under `records/SyncError/fields/`) to use this. * @default false */ isUnrecognizedByClient?: boolean; isClientResetRequested: boolean; /** * @deprecated Add `server_requests_action` to your opt-in list (under `records/SyncError/fields/`) to use this. * @default NoAction */ serverRequestsAction?: SyncErrorAction; compensatingWritesInfo: Array<CompensatingWriteErrorInfo_Relaxed>; }; export type Request = { method: HttpMethod; url: string; timeoutMs: Int64; headers: Record<string, string>; body: string; /** @deprecated Add `uses_refresh_token` to your opt-in list (under `records/Request/fields/`) to use this. */ usesRefreshToken: boolean; }; export type Request_Relaxed = { method: HttpMethod; url: string; timeoutMs: Int64; headers: Record<string, string>; body: string; /** @deprecated Add `uses_refresh_token` to your opt-in list (under `records/Request/fields/`) to use this. */ usesRefreshToken: boolean; }; export type Response = { httpStatusCode: number; customStatusCode: number; headers: Record<string, string>; body: string; }; export type Response_Relaxed = { httpStatusCode: number; customStatusCode: number; headers: Record<string, string>; body: string; }; export type DeviceInfo = { platformVersion: string; sdkVersion: string; sdk: string; deviceName: string; deviceVersion: string; frameworkName: string; frameworkVersion: string; bundleId: string; }; export type DeviceInfo_Relaxed = { platformVersion: string; sdkVersion: string; sdk: string; deviceName: string; deviceVersion: string; frameworkName: string; frameworkVersion: string; bundleId: string; }; export type AppConfig = { appId: string; transport: GenericNetworkTransport; baseUrl: undefined | string; defaultRequestTimeoutMs: undefined | Int64; deviceInfo: DeviceInfo; }; export type AppConfig_Relaxed = { appId: string; transport: GenericNetworkTransport; baseUrl?: undefined | string; defaultRequestTimeoutMs?: undefined | Int64; deviceInfo: DeviceInfo_Relaxed; }; export type CompensatingWriteErrorInfo = { objectName: string; reason: string; primaryKey: Mixed; }; export type CompensatingWriteErrorInfo_Relaxed = { objectName: string; reason: string; primaryKey: MixedArg; }; // Classes export class Helpers { private brandForHelpers; private constructor(); static getTable(r: Realm, key: TableKey): TableRef; /** @deprecated Add `get_table_by_name` to your opt-in list (under `classes/Helpers/methods/`) to use this. */ static getTableByName(r: Realm, name: string): TableRef; static getKeypathMapping(r: Realm): KeyPathMapping; /** @deprecated Add `results_from_query` to your opt-in list (under `classes/Helpers/methods/`) to use this. */ static resultsFromQuery(r: Realm, q: Query): Results; static resultsAppendQuery(results: Results, query: Query): Results; static makeObjectNotifier(r: Realm, o: Obj): ObjectNotifier; /** @deprecated Add `has_binding_context` to your opt-in list (under `classes/Helpers/methods/`) to use this. */ static hasBindingContext(r: Realm): boolean; static setBindingContext(r: Realm, methods: BindingContext_Relaxed): void; static getOrCreateObjectWithPrimaryKey(t: TableRef, pk: MixedArg): [Obj, boolean]; static makeNetworkTransport( runRequest: (request: Readonly<Request>, callback: (response: Response_Relaxed) => void) => void, ): GenericNetworkTransport; static deleteDataForObject(realm: Realm, object_type: string): void; static base64Decode(input: string): ArrayBuffer; static makeLoggerFactory(log: (level: LoggerLevel, message: Readonly<string>) => void): LoggerFactory; static makeLogger(log: (level: LoggerLevel, message: Readonly<string>) => void): Logger; static simulateSyncError( session: SyncSession, code: Readonly<number>, message: Readonly<string>, type: Readonly<string>, is_fatal: boolean, ): void; static consumeThreadSafeReferenceToSharedRealm(tsr: ThreadSafeReference): Realm; static fileExists(path: string): boolean; static eraseSubscription( subs: MutableSyncSubscriptionSet, sub_to_remove: Readonly<SyncSubscription_Relaxed>, ): boolean; static getResultsDescription(results: Readonly<Results>): string; static feedBuffer(ws: WatchStream, buffer: ArrayBuffer): void; static makeSslVerifyCallback( callback: ( server_address: Readonly<string>, server_port: number, pem_data: string, preverify_ok: number, depth: number, ) => boolean, ): SslVerifyCallback; } export class Logger { private brandForLogger; private constructor(); static setDefaultLogger(logger: Logger): void; static setDefaultLevelThreshold(level: LoggerLevel): void; /** @deprecated Add `get_default_logger` to your opt-in list (under `classes/Logger/methods/`) to use this. */ readonly defaultLogger: Logger; /** @deprecated Add `get_default_level_threshold` to your opt-in list (under `classes/Logger/methods/`) to use this. */ readonly defaultLevelThreshold: LoggerLevel; /** @deprecated Add `DOLLAR_addr` to your opt-in list (under `classes/Logger/methods/`) to use this. */ readonly $addr: number; /** @deprecated Add `DOLLAR_resetSharedPtr` to your opt-in list (under `classes/Logger/methods/`) to use this. */ $resetSharedPtr(): void; } export class ConstTableRef { private brandForConstTableRef; protected constructor(); /** @deprecated Add `is_embedded` to your opt-in list (under `classes/ConstTableRef/methods/`) to use this. */ isEmbedded(): boolean; getColumnType(column: ColKey): DataType; getLinkTarget(column: ColKey): ConstTableRef; getObject(key: ObjKey): Obj; tryGetObject(key: ObjKey): null | Obj; query(query_string: string, args: Array<MixedArg | MixedArg[]>, mapping: KeyPathMapping): Query; findPrimaryKey(pk: MixedArg): ObjKey; /** @deprecated Add `get_name` to your opt-in list (under `classes/ConstTableRef/methods/`) to use this. */ readonly name: string; /** @deprecated Add `get_column_count` to your opt-in list (under `classes/ConstTableRef/methods/`) to use this. */ readonly columnCount: number; readonly key: TableKey; [Symbol.iterator](): Iterator<Obj>; } export class TableRef extends ConstTableRef { private brandForTableRef; private constructor(); createObject(): Obj; /** @deprecated Add `create_object_with_primary_key` to your opt-in list (under `classes/TableRef/methods/`) to use this. */ createObjectWithPrimaryKey(pk: MixedArg): Obj; removeObject(key: ObjKey): void; getLinkTarget(column: ColKey): TableRef; clear(): void; getPrimaryKeyColumn(): ColKey; } export class Obj { private brandForObj; private constructor(); getAny(column: ColKey): Mixed; /** @deprecated Add `get_any_by_name` to your opt-in list (under `classes/Obj/methods/`) to use this. */ getAnyByName(column: string): Mixed; /** @deprecated Add `is_null` to your opt-in list (under `classes/Obj/methods/`) to use this. */ isNull(column: ColKey): boolean; /** @deprecated Add `is_null_by_name` to your opt-in list (under `classes/Obj/methods/`) to use this. */ isNullByName(column: string): boolean; setAny(column: ColKey, value: MixedArg): void; /** @deprecated Add `set_any_with_default` to your opt-in list (under `classes/Obj/methods/`) to use this. */ setAnyWithDefault(column: ColKey, value: MixedArg, is_default: boolean): void; getLinkedObject(column: ColKey): null | Obj; /** @deprecated Add `to_string` to your opt-in list (under `classes/Obj/methods/`) to use this. */ toString(): string; getBacklinkCount(): number; getBacklinkView(src_table: TableRef, src_col_key: ColKey): TableView; createAndSetLinkedObject(column: ColKey): Obj; readonly isValid: boolean; readonly table: TableRef; readonly key: ObjKey; /** @deprecated Add `get_link` to your opt-in list (under `classes/Obj/methods/`) to use this. */ readonly link: ObjLink; /** @deprecated Add `get_primary_key` to your opt-in list (under `classes/Obj/methods/`) to use this. */ readonly primaryKey: Mixed; } export class Transaction { private brandForTransaction; private constructor(); /** @deprecated Add `DOLLAR_addr` to your opt-in list (under `classes/Transaction/methods/`) to use this. */ readonly $addr: number; /** @deprecated Add `DOLLAR_resetSharedPtr` to your opt-in list (under `classes/Transaction/methods/`) to use this. */ $resetSharedPtr(): void; } export class ObjectStore { private brandForObjectStore; private constructor(); /** @deprecated Add `get_schema_version` to your opt-in list (under `classes/ObjectStore/methods/`) to use this. */ static getSchemaVersion(group: Group): Int64; /** @deprecated Add `set_schema_version` to your opt-in list (under `classes/ObjectStore/methods/`) to use this. */ static setSchemaVersion(group: Group, version: Int64): void; /** @deprecated Add `schema_from_group` to your opt-in list (under `classes/ObjectStore/methods/`) to use this. */ static schemaFromGroup(group: Group): Array<ObjectSchema>; } export class Timestamp { private brandForTimestamp; private constructor(); static make(seconds: Int64, nanoseconds: number): Timestamp; readonly seconds: Int64; readonly nanoseconds: number; } export class Geospatial { private brandForGeospatial; private constructor(); static makeFromCircle(circle: GeoCircle_Relaxed): Geospatial; static makeFromBox(box: GeoBox_Relaxed): Geospatial; static makeFromPolygon(polygon: GeoPolygon_Relaxed): Geospatial; } export class ObjLink { private brandForObjLink; private constructor(); /** @deprecated Add `is_null` to your opt-in list (under `classes/ObjLink/methods/`) to use this. */ readonly isNull: boolean; /** @deprecated Add `is_unresolved` to your opt-in list (under `classes/ObjLink/methods/`) to use this. */ readonly isUnresolved: boolean; readonly tableKey: TableKey; readonly objKey: ObjKey; } export class KeyPathMapping { private brandForKeyPathMapping; private constructor(); } export class Query { private brandForQuery; private constructor(); /** @deprecated Add `count` to your opt-in list (under `classes/Query/methods/`) to use this. */ count(): number; readonly table: ConstTableRef; readonly description: string; } export class SortDescriptor { private brandForSortDescriptor; private constructor(); /** @deprecated Add `make_empty` to your opt-in list (under `classes/SortDescriptor/methods/`) to use this. */ static makeEmpty(): SortDescriptor; /** @deprecated Add `make` to your opt-in list (under `classes/SortDescriptor/methods/`) to use this. */ static make(column_indices: Array<Array<ColKey>>, ascending: Array<boolean>): SortDescriptor; /** @deprecated Add `is_valid` to your opt-in list (under `classes/SortDescriptor/methods/`) to use this. */ readonly isValid: boolean; } export class TableView { private brandForTableView; private constructor(); } export class Results { private brandForResults; private constructor(); size(): number; indexOf(value: MixedArg): number; indexOfObj(obj: Obj): number; getObj(index: number): Obj; getAny(index: number): Mixed; /** @deprecated Add `get_dictionary_element` to your opt-in list (under `classes/Results/methods/`) to use this. */ getDictionaryElement(index: number): [string, Mixed]; /** @deprecated Add `filter` to your opt-in list (under `classes/Results/methods/`) to use this. */ filter(query: Query): Results; /** @deprecated Add `sort` to your opt-in list (under `classes/Results/methods/`) to use this. */ sort(order: SortDescriptor): Results; sortByNames(order: Array<[string, boolean]>): Results; /** @deprecated Add `limit` to your opt-in list (under `classes/Results/methods/`) to use this. */ limit(max_count: number): Results; snapshot(): Results; /** @deprecated Add `freeze` to your opt-in list (under `classes/Results/methods/`) to use this. */ freeze(frozen_realm: Realm): Results; max(column: ColKey): undefined | Mixed; min(column: ColKey): undefined | Mixed; average(column: ColKey): undefined | Mixed; sum(column: ColKey): undefined | Mixed; clear(): void; addNotificationCallback( cb: (changes: Readonly<CollectionChangeSet>) => void, keyPaths: undefined | Array<Array<[TableKey, ColKey]>>, ): NotificationToken; /** @deprecated Add `make_empty` to your opt-in list (under `classes/Results/methods/`) to use this. */ static makeEmpty(): Results; static fromTable(r: Realm, table: ConstTableRef): Results; static fromTableView(r: Realm, table: TableView): Results; /** @deprecated Add `is_frozen` to your opt-in list (under `classes/Results/methods/`) to use this. */ readonly isFrozen: boolean; readonly isValid: boolean; readonly query: Query; readonly objectType: string; readonly type: PropertyType; } export class Realm { private brandForRealm; private constructor(); beginTransaction(): void; commitTransaction(): void; cancelTransaction(): void; /** @deprecated Add `freeze` to your opt-in list (under `classes/Realm/methods/`) to use this. */ freeze(): Realm; /** @deprecated Add `last_seen_transaction_version` to your opt-in list (under `classes/Realm/methods/`) to use this. */ lastSeenTransactionVersion(): Int64; /** @deprecated Add `read_group` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readGroup(): Group; /** @deprecated Add `duplicate` to your opt-in list (under `classes/Realm/methods/`) to use this. */ duplicate(): Transaction; updateSchema( schema: Array<ObjectSchema_Relaxed>, version: Int64, migration_function: null | ((old_realm: Realm, new_realm: Realm) => void), initialization_function: null | ((realm: Realm) => void), in_transaction: boolean, ): void; /** @deprecated Add `enable_wait_for_change` to your opt-in list (under `classes/Realm/methods/`) to use this. */ enableWaitForChange(): void; /** @deprecated Add `wait_for_change` to your opt-in list (under `classes/Realm/methods/`) to use this. */ waitForChange(): boolean; /** @deprecated Add `wait_for_change_release` to your opt-in list (under `classes/Realm/methods/`) to use this. */ waitForChangeRelease(): void; /** @deprecated Add `refresh` to your opt-in list (under `classes/Realm/methods/`) to use this. */ refresh(): boolean; /** @deprecated Add `set_auto_refresh` to your opt-in list (under `classes/Realm/methods/`) to use this. */ setAutoRefresh(auto_refresh: boolean): void; /** @deprecated Add `notify` to your opt-in list (under `classes/Realm/methods/`) to use this. */ notify(): void; /** @deprecated Add `invalidate` to your opt-in list (under `classes/Realm/methods/`) to use this. */ invalidate(): void; compact(): boolean; /** @deprecated Add `write_copy` to your opt-in list (under `classes/Realm/methods/`) to use this. */ writeCopy(): ArrayBuffer; convert(config: RealmConfig_Relaxed): void; /** @deprecated Add `verify_thread` to your opt-in list (under `classes/Realm/methods/`) to use this. */ verifyThread(): void; /** @deprecated Add `verify_in_write` to your opt-in list (under `classes/Realm/methods/`) to use this. */ verifyInWrite(): void; verifyOpen(): void; /** @deprecated Add `verify_notifications_available` to your opt-in list (under `classes/Realm/methods/`) to use this. */ verifyNotificationsAvailable(): void; /** @deprecated Add `verify_notifications_available_maybe_throw` to your opt-in list (under `classes/Realm/methods/`) to use this. */ verifyNotificationsAvailableMaybeThrow(throw_on_error: boolean): void; createKeyPathArray(table_name: string, key_paths: Readonly<Array<string>>): Array<Array<[TableKey, ColKey]>>; close(): void; static getSharedRealm(config: RealmConfig_Relaxed): Realm; static getSynchronizedRealm(config: RealmConfig_Relaxed): AsyncOpenTask; static getSchemaVersion(config: Readonly<RealmConfig_Relaxed>): Int64; readonly config: Readonly<RealmConfig>; readonly schema: Readonly<Array<ObjectSchema>>; readonly schemaVersion: Int64; readonly isInTransaction: boolean; /** @deprecated Add `is_frozen` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readonly isFrozen: boolean; readonly isInMigration: boolean; readonly isEmpty: boolean; /** @deprecated Add `get_number_of_versions` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readonly numberOfVersions: Int64; /** @deprecated Add `read_transaction_version` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readonly readTransactionVersion: VersionId; /** @deprecated Add `current_transaction_version` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readonly currentTransactionVersion: undefined | VersionId; /** @deprecated Add `auto_refresh` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readonly autoRefresh: boolean; /** @deprecated Add `can_deliver_notifications` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readonly canDeliverNotifications: boolean; /** @deprecated Add `scheduler` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readonly scheduler: Scheduler; readonly isClosed: boolean; /** @deprecated Add `audit_context` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readonly auditContext: null | AuditInterface; readonly syncSession: null | SyncSession; readonly latestSubscriptionSet: SyncSubscriptionSet; /** @deprecated Add `get_active_subscription_set` to your opt-in list (under `classes/Realm/methods/`) to use this. */ readonly activeSubscriptionSet: SyncSubscriptionSet; readonly $addr: number; $resetSharedPtr(): void; } export class RealmCoordinator { private brandForRealmCoordinator; private constructor(); static clearAllCaches(): void; /** @deprecated Add `DOLLAR_addr` to your opt-in list (under `classes/RealmCoordinator/methods/`) to use this. */ readonly $addr: number; /** @deprecated Add `DOLLAR_resetSharedPtr` to your opt-in list (under `classes/RealmCoordinator/methods/`) to use this. */ $resetSharedPtr(): void; } export class ObjectNotifier { private brandForObjectNotifier; private constructor(); addCallback(cb: (changes: ObjectChangeSet) => void, keyPaths: undefined | Array<Array<[TableKey, ColKey]>>): Int64; /** @deprecated Add `remove_callback` to your opt-in list (under `classes/ObjectNotifier/methods/`) to use this. */ removeCallback(token: Int64): void; /** @deprecated Add `make` to your opt-in list (under `classes/ObjectNotifier/methods/`) to use this. */ static make(realm: Realm, obj: Obj): ObjectNotifier; /** @deprecated Add `DOLLAR_addr` to your opt-in list (under `classes/ObjectNotifier/methods/`) to use this. */ readonly $addr: number; /** @deprecated Add `DOLLAR_resetSharedPtr` to your opt-in list (under `classes/ObjectNotifier/methods/`) to use this. */ $resetSharedPtr(): void; } export class NotificationToken { private brandForNotificationToken; private constructor(); /** @deprecated Add `suppress_next` to your opt-in list (under `classes/NotificationToken/methods/`) to use this. */ suppressNext(): void; unregister(): void; static forObject(notifier: ObjectNotifier, token: Int64): NotificationToken; } export class IndexSet { private brandForIndexSet; private constructor(); [Symbol.iterator](): Iterator<[number, number]>; } export class Collection { private brandForCollection; protected constructor(); getAny(ndx: number): Mixed; /** @deprecated Add `find_any` to your opt-in list (under `classes/Collection/methods/`) to use this. */ findAny(value: MixedArg): number; /** @deprecated Add `verify_attached` to your opt-in list (under `classes/Collection/methods/`) to use this. */ verifyAttached(): void; /** @deprecated Add `verify_in_transaction` to your opt-in list (under `classes/Collection/methods/`) to use this. */ verifyInTransaction(): void; asResults(): Results; /** @deprecated Add `snapshot` to your opt-in list (under `classes/Collection/methods/`) to use this. */ snapshot(): Results; /** @deprecated Add `sort` to your opt-in list (under `classes/Collection/methods/`) to use this. */ sort(order: SortDescriptor): Results; /** @deprecated Add `sort_by_name` to your opt-in list (under `classes/Collection/methods/`) to use this. */ sortByName(keyPaths: Readonly<Array<[string, boolean]>>): Results; /** @deprecated Add `add_notification_callback` to your opt-in list (under `classes/Collection/methods/`) to use this. */ addNotificationCallback( cb: (changes: Readonly<CollectionChangeSet>) => void, keyPaths: undefined | Array<Array<[TableKey, ColKey]>>, ): NotificationToken; /** @deprecated Add `get_type` to your opt-in list (under `classes/Collection/methods/`) to use this. */ readonly type: PropertyType; /** @deprecated Add `get_realm` to your opt-in list (under `classes/Collection/methods/`) to use this. */ readonly realm: Realm; /** @deprecated Add `get_parent_column_key` to your opt-in list (under `classes/Collection/methods/`) to use this. */ readonly parentColumnKey: ColKey; /** @deprecated Add `get_parent_object_key` to your opt-in list (under `classes/Collection/methods/`) to use this. */ readonly parentObjectKey: ObjKey; /** @deprecated Add `get_parent_table_key` to your opt-in list (under `classes/Collection/methods/`) to use this. */ readonly parentTableKey: TableKey; readonly objectSchema: Readonly<ObjectSchema>; readonly size: number; readonly isValid: boolean; /** @deprecated Add `is_frozen` to your opt-in list (under `classes/Collection/methods/`) to use this. */ readonly isFrozen: boolean; } export class List extends Collection { private brandForList; private constructor(); /** @deprecated Add `get` to your opt-in list (under `classes/List/methods/`) to use this. */ get(ndx: number): Obj; move(source_ndx: number, dest_ndx: number): void; remove(ndx: number): void; removeAll(): void; swap(ndx1: number, ndx2: number): void; /** @deprecated Add `delete_at` to your opt-in list (under `classes/List/methods/`) to use this. */ deleteAt(ndx: number): void; deleteAll(): void; insertAny(list_ndx: number, value: MixedArg): void; insertEmbedded(ndx: number): Obj; setAny(list_ndx: number, value: MixedArg): void; setEmbedded(list_ndx: number): Obj; /** @deprecated Add `filter` to your opt-in list (under `classes/List/methods/`) to use this. */ filter(q: Query): Results; /** @deprecated Add `freeze` to your opt-in list (under `classes/List/methods/`) to use this. */ freeze(frozen_realm: Readonly<Realm>): List; /** @deprecated Add `max` to your opt-in list (under `classes/List/methods/`) to use this. */ max(): undefined | Mixed; /** @deprecated Add `max_of` to your opt-in list (under `classes/List/methods/`) to use this. */ maxOf(column: ColKey): undefined | Mixed; /** @deprecated Add `min` to your opt-in list (under `classes/List/methods/`) to use this. */ min(): undefined | Mixed; /** @deprecated Add `min_of` to your opt-in list (under `classes/List/methods/`) to use this. */ minOf(column: ColKey): undefined | Mixed; /** @deprecated Add `average` to your opt-in list (under `classes/List/methods/`) to use this. */ average(): undefined | Mixed; /** @deprecated Add `average_of` to your opt-in list (under `classes/List/methods/`) to use this. */ averageOf(column: ColKey): undefined | Mixed; /** @deprecated Add `sum` to your opt-in list (under `classes/List/methods/`) to use this. */ sum(): Mixed; /** @deprecated Add `sum_of` to your opt-in list (under `classes/List/methods/`) to use this. */ sumOf(column: ColKey): Mixed; static make(r: Realm, parent: Readonly<Obj>, col: ColKey): List; } export class Set extends Collection { private brandForSet; private constructor(); /** @deprecated Add `get` to your opt-in list (under `classes/Set/methods/`) to use this. */ get(ndx: number): Obj; insertAny(val: MixedArg): [number, boolean]; removeAny(val: MixedArg): [number, boolean]; removeAll(): void; deleteAll(): void; /** @deprecated Add `filter` to your opt-in list (under `classes/Set/methods/`) to use this. */ filter(q: Query): Results; /** @deprecated Add `max` to your opt-in list (under `classes/Set/methods/`) to use this. */ max(): undefined | Mixed; /** @deprecated Add `max_of` to your opt-in list (under `classes/Set/methods/`) to use this. */ maxOf(column: ColKey): undefined | Mixed; /** @deprecated Add `min` to your opt-in list (under `classes/Set/methods/`) to use this. */ min(): undefined | Mixed; /** @deprecated Add `min_of` to your opt-in list (under `classes/Set/methods/`) to use this. */ minOf(column: ColKey): undefined | Mixed; /** @deprecated Add `average` to your opt-in list (under `classes/Set/methods/`) to use this. */ average(): undefined | Mixed; /** @deprecated Add `average_of` to your opt-in list (under `classes/Set/methods/`) to use this. */ averageOf(column: ColKey): undefined | Mixed; /** @deprecated Add `sum` to your opt-in list (under `classes/Set/methods/`) to use this. */ sum(): Mixed; /** @deprecated Add `sum_of` to your opt-in list (under `classes/Set/methods/`) to use this. */ sumOf(column: ColKey): Mixed; static make(r: Realm, parent: Readonly<Obj>, col: ColKey): Set; } export class Dictionary extends Collection { private brandForDictionary; private constructor(); /** @deprecated Add `get` to your opt-in list (under `classes/Dictionary/methods/`) to use this. */ get(key: string): Obj; /** @deprecated Add `get_pair` to your opt-in list (under `classes/Dictionary/methods/`) to use this. */ getPair(ndx: number): [string, Mixed]; contains(key: string): boolean; /** @deprecated Add `freeze` to your opt-in list (under `classes/Dictionary/methods/`) to use this. */ freeze(frozen_realm: Readonly<Realm>): Dictionary; addKeyBasedNotificationCallback( cb: (changes: DictionaryChangeSet) => void, keyPaths: undefined | Array<Array<[TableKey, ColKey]>>, ): NotificationToken; insertAny(key: string, value: MixedArg): [number, boolean]; insertEmbedded(key: string): Obj; tryGetAny(key: string): undefined | Mixed; removeAll(): void; tryErase(key: string): boolean; static make(r: Realm, parent: Readonly<Obj>, col: ColKey): Dictionary; readonly keys: Results; readonly values: Results; [Symbol.iterator](): Iterator<[Readonly<Mixed>, Mixed]>; } export class GoogleAuthCode { private brandForGoogleAuthCode; private constructor(); static make(code: string): GoogleAuthCode; } export class GoogleIdToken { private brandForGoogleIdToken; private constructor(); static make(token: string): GoogleIdToken; } export class AppCredentials { private brandForAppCredentials; private constructor(); static facebook(access_token: Readonly<string>): AppCredentials; static anonymous(reuse_anonymous_credentials: boolean): AppCredentials; static apple(id_token: Readonly<string>): AppCredentials; static googleAuth(id_token: GoogleAuthCode): AppCredentials; static googleId(id_token: GoogleIdToken): AppCredentials; static custom(token: Readonly<string>): AppCredentials; static usernamePassword(username: string, password: string): AppCredentials; static function(serialized_payload: Readonly<Record<string, EJson>>): AppCredentials; /** @deprecated Add `function_bson` to your opt-in list (under `classes/AppCredentials/methods/`) to use this. */ static functionBson(payload: Readonly<Record<string, EJson>>): AppCredentials; static apiKey(api_key: string): AppCredentials; /** @deprecated Add `provider` to your opt-in list (under `classes/AppCredentials/methods/`) to use this. */ readonly provider: AuthProvider; /** @deprecated Add `provider_as_string` to your opt-in list (under `classes/AppCredentials/methods/`) to use this. */ readonly providerAsString: string; } export class SyncUserSubscriptionToken { private brandForSyncUserSubscriptionToken; private constructor(); } export class SyncUser { private brandForSyncUser; private constructor(); /** @deprecated Add `log_out` to your opt-in list (under `classes/SyncUser/methods/`) to use this. */ logOut(): void; sessionForOnDiskPath(path: string): null | SyncSession; subscribe(observer: () => void): SyncUserSubscriptionToken; unsubscribe(token: SyncUserSubscriptionToken): void; readonly allSessions: Array<SyncSession>; readonly isLoggedIn: boolean; readonly identity: Readonly<string>; /** @deprecated Add `provider_type` to your opt-in list (under `classes/SyncUser/methods/`) to use this. */ readonly providerType: Readonly<string>; /** @deprecated Add `local_identity` to your opt-in list (under `classes/SyncUser/methods/`) to use this. */ readonly localIdentity: Readonly<string>; readonly accessToken: string; readonly refreshToken: string; readonly deviceId: string; /** @deprecated Add `has_device_id` to your opt-in list (under `classes/SyncUser/methods/`) to use this. */ readonly hasDeviceId: boolean; readonly userProfile: UserProfile; readonly identities: Array<UserIdentity>; readonly customData: undefined | Record<string, EJson>; readonly syncManager: SyncManager; readonly state: SyncUserState; /** @deprecated Add `subscribers_count` to your opt-in list (under `classes/SyncUser/methods/`) to use this. */ readonly subscribersCount: number; /** @deprecated Add `DOLLAR_addr` to your opt-in list (under `classes/SyncUser/methods/`) to use this. */ readonly $addr: number; /** @deprecated Add `DOLLAR_resetSharedPtr` to your opt-in list (under `classes/SyncUser/methods/`) to use this. */ $resetSharedPtr(): void; } export class UserProfile { private brandForUserProfile; private constructor(); /** @deprecated Add `name` to your opt-in list (under `classes/UserProfile/methods/`) to use this. */ name(): undefined | string; /** @deprecated Add `email` to your opt-in list (under `classes/UserProfile/methods/`) to use this. */ email(): undefined | string; /** @deprecated Add `picture_url` to your opt-in list (under `classes/UserProfile/methods/`) to use this. */ pictureUrl(): undefined | string; /** @deprecated Add `first_name` to your opt-in list (under `classes/UserProfile/methods/`) to use this. */ firstName(): undefined | string; /** @deprecated Add `last_name` to your opt-in list (under `classes/UserProfile/methods/`) to use this. */ lastName(): undefined | string; /** @deprecated Add `gender` to your opt-in list (under `classes/UserProfile/methods/`) to use this. */ gender(): undefined | string; /** @deprecated Add `birthday` to your opt-in list (under `classes/UserProfile/methods/`) to use this. */ birthday(): undefined | string; /** @deprecated Add `min_age` to your opt-in list (under `classes/UserProfile/methods/`) to use this. */ minAge(): undefined | string; /** @deprecated Add `max_age` to your opt-in list (under `classes/UserProfile/methods/`) to use this. */ maxAge(): undefined | string; data(): Record<string, EJson>; } export class AppSubscriptionToken { private brandForAppSubscriptionToken; private constructor(); } export class App { private brandForApp; private constructor(); logInWithCredentials(credentials: AppCredentials): Promise<SyncUser>; /** @deprecated Add `log_out` to your opt-in list (under `classes/App/methods/`) to use this. */ logOut(): Promise<void>; logOutUser(user: SyncUser): Promise<void>; refreshCustomData(user: SyncUser): Promise<void>; linkUser(user: SyncUser, credentials: Readonly<AppCredentials>): Promise<SyncUser>; switchUser(user: SyncUser): void; removeUser(user: SyncUser): Promise<void>; deleteUser(user: SyncUser): Promise<void>; usernamePasswordProviderClient(): UsernamePasswordProviderClient; userApiKeyProviderClient(): UserApiKeyProviderClient; pushNotificationClient(service_name: Readonly<string>): PushClient; subscribe(observer: () => void): AppSubscriptionToken; unsubscribe(token: AppSubscriptionToken): void; callFunction( user: Readonly<SyncUser>, name: string, args: EJson[], service_name: undefined | string, ): Promise<Readonly<EJson>>; makeStreamingRequest(user: SyncUser, name: string, args: EJson[], service_name: undefined | string): Request; /** @deprecated Add `update_base_url` to your opt-in list (under `classes/App/methods/`) to use this. */ updateBaseUrl(base_url: undefined | string): Promise<void>; /** @deprecated Add `get_base_url` to your opt-in list (under `classes/App/methods/`) to use this. */ getBaseUrl(): string; static getApp(mode: AppCacheMode, config: AppConfig_Relaxed, sync_client_config: SyncClientConfig_Relaxed): App; /** @deprecated Add `get_cached_app` to your opt-in list (under `classes/App/methods/`) to use this. */ static getCachedApp(app_id: Readonly<string>):