Typescript definition for ssl_verify_callback.

This commit is contained in:
Morten Krogh 2017-09-22 12:40:34 +02:00
parent c1e198cbab
commit 508a547898
1 changed files with 16 additions and 14 deletions

30
lib/index.d.ts vendored
View File

@ -265,25 +265,25 @@ declare namespace Realm.Sync {
readonly server: string;
readonly token: string;
static adminUser(adminToken: string, server?: string): User;
/**
* @deprecated, to be removed in future versions
*/
static login(server: string, username: string, password: string, callback: (error: any, user: User) => void): void;
static login(server: string, username: string, password: string): Promise<Realm.Sync.User>;
/**
* @deprecated, to be removed in future versions
*/
*/
static register(server: string, username: string, password: string, callback: (error: any, user: User) => void): void;
static register(server: string, username: string, password: string): Promise<Realm.Sync.User>;
/**
* @deprecated, to be removed in versions
*/
*/
static registerWithProvider(server: string, options: { provider: string, providerToken: string, userInfo: any }, callback: (error: Error | null, user: User | null) => void): void;
static registerWithProvider(server: string, options: { provider: string, providerToken: string, userInfo: any }): Promise<Realm.Sync.User>;
logout(): void;
openManagementRealm(): Realm;
retrieveAccount(provider: string, username: string): Promise<Account>;
@ -299,7 +299,7 @@ declare namespace Realm.Sync {
userId: string |
{ metadataKey: string, metadataValue: string }
};
type AccessLevel = 'none' | 'read' | 'write' | 'admin';
class Permission {
@ -310,7 +310,7 @@ declare namespace Realm.Sync {
readonly mayRead?: boolean;
readonly mayWrite?: boolean;
readonly mayManage?: boolean;
}
}
class PermissionChange {
id: string;
@ -342,19 +342,21 @@ declare namespace Realm.Sync {
}
type ErrorCallback = (message?: string, isFatal?: boolean, category?: string, code?: number) => void;
type SSLVerifyCallback = (serverAddress: string, serverPort: number, pemCertificate: string, preverifyOk: number, depth: number) => boolean;
interface SyncConfiguration {
user: User;
url: string;
validate_ssl?: boolean;
ssl_trust_certificate_path?: string;
ssl_verify_callback?: SSLVerifyCallback;
error?: ErrorCallback;
}
type ProgressNotificationCallback = (transferred: number, transferable: number) => void;
type ProgressDirection = 'download' | 'upload';
type ProgressMode = 'reportIndefinitely' | 'forCurrentlyOutstandingWork';
/**
* Session
* @see { @link https://realm.io/docs/javascript/latest/api/Realm.Sync.Session.html }
@ -394,7 +396,7 @@ declare namespace Realm.Sync {
function removeListener(regex: string, name: string, changeCallback: (changeEvent: ChangeEvent) => void): void;
function setLogLevel(logLevel: 'all' | 'trace' | 'debug' | 'detail' | 'info' | 'warn' | 'error' | 'fatal' | 'off'): void;
function setFeatureToken(token: string): void;
/**
* @deprecated, to be removed in 2.0
*/
@ -458,19 +460,19 @@ declare class Realm {
*/
static schemaVersion(path: string, encryptionKey?: ArrayBuffer | ArrayBufferView): number;
/**
* Open a realm asynchronously with a promise. If the realm is synced, it will be fully synchronized before it is available.
* @param {Configuration} config
* @param {Configuration} config
*/
static open(config: Realm.Configuration): ProgressPromise;
/**
* @deprecated in favor of `Realm.open`
* Open a realm asynchronously with a callback. If the realm is synced, it will be fully synchronized before it is available.
* @param {Configuration} config
* @param {Configuration} config
* @param {Function} callback will be called when the realm is ready.
* @param {ProgressNotificationCallback} progressCallback? a progress notification callback for 'download' direction and 'forCurrentlyOutstandingWork' mode
* @param {ProgressNotificationCallback} progressCallback? a progress notification callback for 'download' direction and 'forCurrentlyOutstandingWork' mode
*/
static openAsync(config: Realm.Configuration, callback: (error: any, realm: Realm) => void, progressCallback?: Realm.Sync.ProgressNotificationCallback): void