From 508a547898c856cea957c8551a6bd1cfb249be00 Mon Sep 17 00:00:00 2001 From: Morten Krogh Date: Fri, 22 Sep 2017 12:40:34 +0200 Subject: [PATCH] Typescript definition for ssl_verify_callback. --- lib/index.d.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 941fe647..76106fe4 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -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; - + /** * @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; - + /** * @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; - + logout(): void; openManagementRealm(): Realm; retrieveAccount(provider: string, username: string): Promise; @@ -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