Adding documentation, TS definition and change log.

This commit is contained in:
Kenneth Geisshirt 2017-09-27 17:53:09 +02:00
parent e669a221a1
commit f94f351bfb
4 changed files with 72 additions and 54 deletions

View File

@ -1,3 +1,15 @@
x.x.x Release notes (yyyy-MM-dd)
=============================================================
### Breaking changes
* `Realm.Sync.initialize()` must be called prior to any interaction with any Realm Object Server.
### Enhancements
* None.
### Bug fixes
* None.
2.0.0 Release notes (2017-9-26) 2.0.0 Release notes (2017-9-26)
============================================================= =============================================================
### Breaking changes ### Breaking changes

View File

@ -20,6 +20,11 @@
* @memberof Realm * @memberof Realm
*/ */
class Sync { class Sync {
/**
* Initialize the interaction with Realm Object Server. It should only be called once.
*/
static initialize() {}
/** /**
* Add a sync listener to listen to changes across multiple Realms * Add a sync listener to listen to changes across multiple Realms
* @param {string} server_url - the sync server to listen to * @param {string} server_url - the sync server to listen to

5
lib/index.d.ts vendored
View File

@ -288,7 +288,7 @@ declare namespace Realm.Sync {
openManagementRealm(): Realm; openManagementRealm(): Realm;
retrieveAccount(provider: string, username: string): Promise<Account>; retrieveAccount(provider: string, username: string): Promise<Account>;
getGrantedPermissions(recipient: 'any' | 'currentUser' | 'otherUser'): Results<Permission>; getGrantedPermissions(recipient: 'any' | 'currentUser' | 'otherUser'): Results<Permission>;
applyPermissions(condition: PermissionCondition, realmUrl: string, accessLevel: AccessLevel): Promise<PermissionChange>; applyPermissions(condition: PermissionCondition, realmUrl: string, accessLevel: AccessLevel): Promise<PermissionChange>;
offerPermissions(realmUrl: string, accessLevel: AccessLevel, expiresAt?: Date): Promise<string>; offerPermissions(realmUrl: string, accessLevel: AccessLevel, expiresAt?: Date): Promise<string>;
acceptPermissionOffer(token: string): Promise<string> acceptPermissionOffer(token: string): Promise<string>
@ -300,7 +300,7 @@ declare namespace Realm.Sync {
{ metadataKey: string, metadataValue: string } { metadataKey: string, metadataValue: string }
}; };
type AccessLevel = 'none' | 'read' | 'write' | 'admin'; type AccessLevel = 'none' | 'read' | 'write' | 'admin';
class Permission { class Permission {
readonly id: string; readonly id: string;
@ -396,6 +396,7 @@ declare namespace Realm.Sync {
function removeListener(regex: string, name: string, changeCallback: (changeEvent: ChangeEvent) => void): void; 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 setLogLevel(logLevel: 'all' | 'trace' | 'debug' | 'detail' | 'info' | 'warn' | 'error' | 'fatal' | 'off'): void;
function setFeatureToken(token: string): void; function setFeatureToken(token: string): void;
function initialize(): void;
/** /**
* @deprecated, to be removed in 2.0 * @deprecated, to be removed in 2.0

View File

@ -651,7 +651,7 @@ void SyncClass<T>::initialize(ContextType ctx, FunctionType, ObjectType this_obj
// setup synced realmFile paths // setup synced realmFile paths
ensure_directory_exists_for_file(default_realm_file_directory()); ensure_directory_exists_for_file(default_realm_file_directory());
SyncManager::shared().configure_file_system(default_realm_file_directory(), SyncManager::MetadataMode::NoEncryption); SyncManager::shared().configure_file_system(default_realm_file_directory(), SyncManager::MetadataMode::NoEncryption);
return_value.set(Nan::Undefined()); return_value.set_undefined();
} }
} // js } // js
} // realm } // realm