Adding documentation, TS definition and change log.
This commit is contained in:
parent
e669a221a1
commit
f94f351bfb
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -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)
|
||||
=============================================================
|
||||
### Breaking changes
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
* @memberof Realm
|
||||
*/
|
||||
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
|
||||
* @param {string} server_url - the sync server to listen to
|
||||
|
|
|
@ -288,7 +288,7 @@ declare namespace Realm.Sync {
|
|||
openManagementRealm(): Realm;
|
||||
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>;
|
||||
offerPermissions(realmUrl: string, accessLevel: AccessLevel, expiresAt?: Date): Promise<string>;
|
||||
acceptPermissionOffer(token: string): Promise<string>
|
||||
|
@ -296,49 +296,49 @@ declare namespace Realm.Sync {
|
|||
}
|
||||
|
||||
type PermissionCondition = {
|
||||
userId: string |
|
||||
{ metadataKey: string, metadataValue: string }
|
||||
userId: string |
|
||||
{ metadataKey: string, metadataValue: string }
|
||||
};
|
||||
|
||||
type AccessLevel = 'none' | 'read' | 'write' | 'admin';
|
||||
type AccessLevel = 'none' | 'read' | 'write' | 'admin';
|
||||
|
||||
class Permission {
|
||||
readonly id: string;
|
||||
readonly updatedAt: Date;
|
||||
readonly userId: string;
|
||||
readonly path: string;
|
||||
readonly mayRead?: boolean;
|
||||
readonly mayWrite?: boolean;
|
||||
readonly mayManage?: boolean;
|
||||
readonly id: string;
|
||||
readonly updatedAt: Date;
|
||||
readonly userId: string;
|
||||
readonly path: string;
|
||||
readonly mayRead?: boolean;
|
||||
readonly mayWrite?: boolean;
|
||||
readonly mayManage?: boolean;
|
||||
}
|
||||
|
||||
class PermissionChange {
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
statusCode?: number;
|
||||
statusMessage?: string;
|
||||
userId: string;
|
||||
metadataKey?: string;
|
||||
metadataValue?: string;
|
||||
realmUrl: string;
|
||||
mayRead?: boolean;
|
||||
mayWrite?: boolean;
|
||||
mayManage?: boolean;
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
statusCode?: number;
|
||||
statusMessage?: string;
|
||||
userId: string;
|
||||
metadataKey?: string;
|
||||
metadataValue?: string;
|
||||
realmUrl: string;
|
||||
mayRead?: boolean;
|
||||
mayWrite?: boolean;
|
||||
mayManage?: boolean;
|
||||
}
|
||||
|
||||
class PermissionOffer {
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
statusCode?: number;
|
||||
statusMessage?: string;
|
||||
token?: string;
|
||||
realmUrl: string;
|
||||
mayRead?: boolean;
|
||||
mayWrite?: boolean;
|
||||
mayManage?: boolean;
|
||||
expiresAt?: Date;
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
statusCode?: number;
|
||||
statusMessage?: string;
|
||||
token?: string;
|
||||
realmUrl: string;
|
||||
mayRead?: boolean;
|
||||
mayWrite?: boolean;
|
||||
mayManage?: boolean;
|
||||
expiresAt?: Date;
|
||||
}
|
||||
|
||||
type ErrorCallback = (message?: string, isFatal?: boolean, category?: string, code?: number) => void;
|
||||
|
@ -396,6 +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;
|
||||
function initialize(): void;
|
||||
|
||||
/**
|
||||
* @deprecated, to be removed in 2.0
|
||||
|
@ -436,8 +437,8 @@ declare namespace Realm.Sync {
|
|||
}
|
||||
|
||||
|
||||
interface ProgressPromise extends Promise<Realm> {
|
||||
progress(callback: Realm.Sync.ProgressNotificationCallback) : Promise<Realm>
|
||||
interface ProgressPromise extends Promise<Realm> {
|
||||
progress(callback: Realm.Sync.ProgressNotificationCallback): Promise<Realm>
|
||||
}
|
||||
|
||||
declare class Realm {
|
||||
|
|
|
@ -651,7 +651,7 @@ void SyncClass<T>::initialize(ContextType ctx, FunctionType, ObjectType this_obj
|
|||
// setup synced realmFile paths
|
||||
ensure_directory_exists_for_file(default_realm_file_directory());
|
||||
SyncManager::shared().configure_file_system(default_realm_file_directory(), SyncManager::MetadataMode::NoEncryption);
|
||||
return_value.set(Nan::Undefined());
|
||||
return_value.set_undefined();
|
||||
}
|
||||
} // js
|
||||
} // realm
|
||||
|
|
Loading…
Reference in New Issue