From ee3791c8212e4ef18c18b250b8a791e920df2c77 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Wed, 16 May 2018 10:46:32 +0200 Subject: [PATCH] Using lengthy names for classes --- docs/collection.js | 4 ++ docs/jsdoc-template | 2 +- docs/list.js | 2 + docs/object.js | 3 ++ docs/permission.js | 11 ++++ docs/realm.js | 46 ++++++++-------- docs/results.js | 2 + docs/sync.js | 124 ++++++++++++++++++++++++-------------------- 8 files changed, 112 insertions(+), 82 deletions(-) diff --git a/docs/collection.js b/docs/collection.js index fe791327..35050bc3 100644 --- a/docs/collection.js +++ b/docs/collection.js @@ -29,6 +29,8 @@ * objects which matched the query when the enumeration is begun, even if some of them are * deleted or modified to be excluded by the filter during the enumeration. * + * @class + * @name Realm.Collection * @memberof Realm * @since 0.11.0 */ @@ -458,6 +460,7 @@ class Collection { /** * This is an ES6 iterator. * @typedef Realm.Collection~Iterator + * @memberof Realm.Collection * @property {function} next - Returns an object with two properties: * - `done` – `true` if the iterator is done iterating through items in the collection, * otherwise `false` @@ -477,5 +480,6 @@ class Collection { * separate by dots, **or** an array with two items: `[propertyName, reverse]`. * * @typedef Realm.Collection~SortDescriptor + * @memberof Realm.Collection * @type {string|Array} */ diff --git a/docs/jsdoc-template b/docs/jsdoc-template index 4e014653..441d8a45 160000 --- a/docs/jsdoc-template +++ b/docs/jsdoc-template @@ -1 +1 @@ -Subproject commit 4e014653f07066eb8652b1920a75969c5bc6e3f8 +Subproject commit 441d8a45eb39d454ea612251bf2adb60473ede70 diff --git a/docs/list.js b/docs/list.js index 500e4e4c..877333b1 100644 --- a/docs/list.js +++ b/docs/list.js @@ -26,6 +26,8 @@ * Realm#write write} transaction. * * @extends Realm.Collection + * @class + * @name Realm.List * @memberof Realm */ class List extends Collection { diff --git a/docs/object.js b/docs/object.js index 83cc33a5..cae9c430 100644 --- a/docs/object.js +++ b/docs/object.js @@ -21,6 +21,9 @@ * was specified that does **not** inherit from this class. * @memberof Realm * @since 0.12.0 + * @class + * @name Realm.Object + * @memberof Realm */ class Object { /** diff --git a/docs/permission.js b/docs/permission.js index e1ed63d4..afc43e12 100644 --- a/docs/permission.js +++ b/docs/permission.js @@ -28,6 +28,9 @@ * materialized for the affected Realm files and the affected user. * Once the request has been processed, the Status, StatusMessage, and * ErrorCode will be updated accordingly. + * @class + * @name Realm.Sync.User.PermissionChange + * @memberof Realm.Sync.User */ class PermissionChange { @@ -104,6 +107,9 @@ class PermissionChange { * with users you wish to grant permissions to. * If the request has failed, statusMessage will be updated with relevant information about the * failure and statusCode will be set. + * @class + * @name Realm.Sync.User.PermissionOffer + * @memberof Realm.Sync.User */ class PermissionOffer { /** @@ -184,6 +190,9 @@ class PermissionOffer { * to connect to the Realm. * If the request has failed, the statusMessage will be updated with relevant information about the * failure and statusCode will be set. + * @class + * @name Realm.Sync.User.PermissionOfferResponse + * @memberof Realm.Sync.User */ class PermissionOfferResponse { /** @@ -241,6 +250,8 @@ class PermissionOfferResponse { * left undocumented here. * @since 2.3.0 * + * @class + * @name Realm.Sync.Permission * @memberof Realm.Sync */ class Permission { diff --git a/docs/realm.js b/docs/realm.js index e0a0ddde..752a6c57 100644 --- a/docs/realm.js +++ b/docs/realm.js @@ -18,9 +18,11 @@ /** * A Realm instance represents a Realm database. + * * ```js * const Realm = require('realm'); * ``` + * */ class Realm { /** @@ -284,32 +286,25 @@ class Realm { * @param {ArrayBuffer|ArrayBufferView} [encryptionKey] - Optional 64-byte encryption key to encrypt the new file with. */ writeCopyTo(path, encryptionKey) {} + + /** + * Get the current schema version of the Realm at the given path. + * @param {string} path - The path to the file where the + * Realm database is stored. + * @param {ArrayBuffer|ArrayBufferView} [encryptionKey] - Required only when + * accessing encrypted Realms. + * @throws {Error} When passing an invalid or non-matching encryption key. + * @returns {number} version of the schema, or `-1` if no Realm exists at `path`. + */ + static schemaVersion(path, encryptionKey) {} + + /** + * Delete the Realm file for the given configuration. + * @param {Realm~Configuration} config + * @throws {Error} If anything in the provided `config` is invalid. + */ + static deleteFile(config) {} } - -/** - * Get the current schema version of the Realm at the given path. - * @param {string} path - The path to the file where the - * Realm database is stored. - * @param {ArrayBuffer|ArrayBufferView} [encryptionKey] - Required only when - * accessing encrypted Realms. - * @throws {Error} When passing an invalid or non-matching encryption key. - * @returns {number} version of the schema, or `-1` if no Realm exists at `path`. - */ -Realm.schemaVersion = function(path, encryptionKey) {}; - -/** - * Delete the Realm file for the given configuration. - * @param {Realm~Configuration} config - * @throws {Error} If anything in the provided `config` is invalid. - */ -Realm.deleteFile = function(config) {}; - -/** - * The default path where to create and access the Realm file. - * @type {string} - */ -Realm.defaultPath; - /** * This describes the different options used to create a {@link Realm} instance. * @typedef Realm~Configuration @@ -496,3 +491,4 @@ Realm.defaultPath; * any object of this type from inside the same Realm, and will always be _optional_ * (meaning it may also be assigned `null` or `undefined`). */ + diff --git a/docs/results.js b/docs/results.js index 245cda4e..00420d0e 100644 --- a/docs/results.js +++ b/docs/results.js @@ -24,6 +24,8 @@ * (and listener callbacks added through {@link Realm.Results#addListener addListener()} * will thus never be called). * + * @class + * @name Realm.Results * @extends Realm.Collection * @memberof Realm */ diff --git a/docs/sync.js b/docs/sync.js index c292c61d..ff218669 100644 --- a/docs/sync.js +++ b/docs/sync.js @@ -25,6 +25,7 @@ * is a {Realm~Configuration} which refers to it. You can open it as a local, read-only Realm, and * copy objects to a new synced Realm. * + * @name Realm.Sync * @memberof Realm */ class Sync { @@ -129,6 +130,8 @@ class Sync { * resolved). The Realms supplied by the change event do not need to be * explicitly closed. * + * @class + * @name Realm.Sync.ChangeEvent * @memberof Realm.Sync */ class ChangeEvent { @@ -187,6 +190,8 @@ class ChangeEvent { /** * Class that describes authentication errors in the Realm Object Server + * @class + * @name Realm.Sync.AuthError * @memberof Realm.Sync */ class AuthError extends Error { @@ -205,6 +210,8 @@ class AuthError extends Error { /** * Describes an error when an incompatible synced Realm is opened. The old version of the Realm can be accessed in readonly mode using the configuration() member + * @class + * @name Realm.Sync.IncompatibleSyncedRealmError * @memberof Realm.Sync */ class IncompatibleSyncedRealmError { @@ -222,6 +229,8 @@ class IncompatibleSyncedRealmError { /** * Class for logging in and managing Sync users. + * @class + * @name Realm.Sync.User * @memberof Realm.Sync */ class User { @@ -466,6 +475,8 @@ class User { * client (and a local Realm file on disk), and the server (and a remote Realm at a given URL stored on a Realm Object Server). * Sessions are always created by the SDK and vended out through various APIs. The lifespans of sessions * associated with Realms are managed automatically. + * @class + * @name Realm.Sync.Session * @memberof Realm.Sync */ class Session { @@ -523,6 +534,8 @@ class Session { /** * An object encapsulating partial sync subscriptions. + * @class + * @name Realm.Sync.Subscription * @memberof Realm.Sync */ class Subscription { @@ -646,8 +659,8 @@ class Worker { } /** - * Class for creating custom Data Connectors. Only available in the Enterprise Edition. - * + * Custom Data Connectors. + * @name Realm.Sync.Adapter * @memberof Realm.Sync */ class Adapter { @@ -666,6 +679,59 @@ class Adapter { /** * Get the Array of current instructions for the given Realm. * @param {string} path - the path for the Realm being monitored + * + * The following Instructions can be returned. Each instruction object has + * a `type` property which is one of the following types. For each type below we list the other properties + * that will exist in the instruction object. + * @type {(INSERT|SET|DELETE|CLEAR|CHANGE_IDENTITY|LIST_SET|LIST_INSERT|LIST_ERASE|LIST_CLEAR|ADD_TYPE|ADD_PROPERTY)} + * @property INSERT - insert a new object + * - `object_type` - type of the object being inserted + * - `identity` - primary key value or row index for the object + * - `values` - map of property names and property values for the object to insert + * @property SET - set property values for an existing object + * - `object_type` - type of the object + * - `identity` - primary key value or row index for the object + * - `values` - map of property names and property values to update for the object + * @property DELETE - delete an exising object + * - `object_type` - type of the object + * - `identity` - primary key value or row index for the object + * @property CLEAR - delete all objects of a given type + * - `object_type` - type of the object + * @property LIST_SET - set the object at a given list index to an object + * - `object_type` - type of the object + * - `identity` - primary key for the object + * - `property` - property name for the list property to mutate + * - `list_index` - list index to set + * - `object_identity` - primary key or row number of the object being set + * @property LIST_INSERT - insert an object in the list at the given index + * - `object_type` - type of the object + * - `identity` - primary key for the object + * - `property` - property name for the list property to mutate + * - `list_index` - list index at which to insert + * - `object_identity` - primary key or row number of the object to insert + * @property LIST_ERASE - erase an object in the list at the given index - this removes the object + * from the list but the object will still exist in the Realm + * - `object_type` - type of the object + * - `identity` - primary key for the object + * - `property` - property name for the list property to mutate + * - `list_index` - list index which should be erased + * @property LIST_CLEAR - clear a list removing all objects - objects are not deleted from the Realm + * - `object_type` - type of the object + * - `identity` - primary key for the object + * - `property` - property name for the list property to clear + * @property ADD_TYPE - add a new type + * - `object_type` - name of the type + * - `primary_key` - name of primary key property for this type + * - `properties` - Property map as described in {@link Realm~ObjectSchema} + * @property ADD_PROPERTIES - add properties to an existing type + * - `object_type` - name of the type + * - `properties` - Property map as described in {@link Realm~ObjectSchema} + * @property CHANGE_IDENTITY - change the row index for an existing object - not called for objects + * with primary keys + * - `object_type` - type fo the object + * - `identity` - old row value for the object + * - `new_identity` - new row value for the object + * * @returns {Array(instructions)} or {undefined} if all transactions have been processed */ current(path) {} @@ -692,57 +758,3 @@ class Adapter { close() {} } -/** - * The following Instructions can be returned by `Adapter.current(path)`. Each instruction object has - * a `type` property which is one of the following types. For each type below we list the other properties - * that will exist in the instruction object. - * @typedef Realm.Sync.Adapter~Instruction - * @type {(INSERT|SET|DELETE|CLEAR|CHANGE_IDENTITY|LIST_SET|LIST_INSERT|LIST_ERASE|LIST_CLEAR|ADD_TYPE|ADD_PROPERTY)} - * @property INSERT - insert a new object - * - `object_type` - type of the object being inserted - * - `identity` - primary key value or row index for the object - * - `values` - map of property names and property values for the object to insert - * @property SET - set property values for an existing object - * - `object_type` - type of the object - * - `identity` - primary key value or row index for the object - * - `values` - map of property names and property values to update for the object - * @property DELETE - delete an exising object - * - `object_type` - type of the object - * - `identity` - primary key value or row index for the object - * @property CLEAR - delete all objects of a given type - * - `object_type` - type of the object - * @property LIST_SET - set the object at a given list index to an object - * - `object_type` - type of the object - * - `identity` - primary key for the object - * - `property` - property name for the list property to mutate - * - `list_index` - list index to set - * - `object_identity` - primary key or row number of the object being set - * @property LIST_INSERT - insert an object in the list at the given index - * - `object_type` - type of the object - * - `identity` - primary key for the object - * - `property` - property name for the list property to mutate - * - `list_index` - list index at which to insert - * - `object_identity` - primary key or row number of the object to insert - * @property LIST_ERASE - erase an object in the list at the given index - this removes the object - * from the list but the object will still exist in the Realm - * - `object_type` - type of the object - * - `identity` - primary key for the object - * - `property` - property name for the list property to mutate - * - `list_index` - list index which should be erased - * @property LIST_CLEAR - clear a list removing all objects - objects are not deleted from the Realm - * - `object_type` - type of the object - * - `identity` - primary key for the object - * - `property` - property name for the list property to clear - * @property ADD_TYPE - add a new type - * - `object_type` - name of the type - * - `primary_key` - name of primary key property for this type - * - `properties` - Property map as described in {@link Realm~ObjectSchema} - * @property ADD_PROPERTIES - add properties to an existing type - * - `object_type` - name of the type - * - `properties` - Property map as described in {@link Realm~ObjectSchema} - * @property CHANGE_IDENTITY - change the row index for an existing object - not called for objects - * with primary keys - * - `object_type` - type fo the object - * - `identity` - old row value for the object - * - `new_identity` - new row value for the object - */