diff --git a/AUTHORS b/AUTHORS index 6f2ea1e..6b68e28 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,8 +1,10 @@ # This is the official list of js-data-rethinkdb project authors. # # Names are formatted as: -# # commits Name or Organization +# Name or Organization +# # The email address is not required for organizations. +# InternalFX Jason Dobry Ollie Relph diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f83c5d..d1ca6ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +##### 3.0.0-beta.1 - 17 April 2016 + +Official v3 beta release + +###### Other +- Upgraded dependencies + ##### 3.0.0-alpha.13 - 17 March 2016 ###### Backwards incompatible API changes diff --git a/CONTRIBUTORS b/CONTRIBUTORS index cf3e162..91106f7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,9 +1,8 @@ -# People who have contributed to the js-data-rethinkdb project. +# This is the official list of js-data-rethinkdb project contributors. # -# This file is controlled by scripts/authors.js +# Names are formatted as: +# Name # -# Names should be added to this file as: -# [commit count] Name - 1 InternalFX - 55 Jason Dobry - 2 Ollie Relph +InternalFX +Jason Dobry +Ollie Relph diff --git a/dist/js-data-rethinkdb.js b/dist/js-data-rethinkdb.js index 70e551c..ccea95e 100644 --- a/dist/js-data-rethinkdb.js +++ b/dist/js-data-rethinkdb.js @@ -283,6 +283,28 @@ Object.defineProperty(RethinkDBAdapter, '__super__', { */ RethinkDBAdapter.extend = jsData.utils.extend; +/** + * Details of the current version of the `js-data-rethinkdb` module. + * + * @name RethinkDBAdapter.version + * @type {Object} + * @property {string} full The full semver value. + * @property {number} major The major version number. + * @property {number} minor The minor version number. + * @property {number} patch The patch version number. + * @property {(string|boolean)} alpha The alpha version value, otherwise `false` + * if the current version is not alpha. + * @property {(string|boolean)} beta The beta version value, otherwise `false` + * if the current version is not beta. + */ +RethinkDBAdapter.version = { + beta: 1, + full: '3.0.0-beta.1', + major: 3, + minor: 0, + patch: 0 +}; + RethinkDBAdapter.OPERATORS = OPERATORS; jsData.utils.addHiddenPropsToTarget(RethinkDBAdapter.prototype, { diff --git a/dist/js-data-rethinkdb.js.map b/dist/js-data-rethinkdb.js.map index fe03641..fa25045 100644 --- a/dist/js-data-rethinkdb.js.map +++ b/dist/js-data-rethinkdb.js.map @@ -1 +1 @@ -{"version":3,"file":"js-data-rethinkdb.js","sources":["../src/index.js"],"sourcesContent":["import {utils} from 'js-data'\nimport Adapter from 'js-data-adapter'\nimport {\n reserved\n} from 'js-data-adapter'\nimport rethinkdbdash from 'rethinkdbdash'\nimport underscore from 'mout/string/underscore'\n\nconst withoutRelations = function (mapper, props) {\n return utils.omit(props, mapper.relationFields || [])\n}\n\nconst __super__ = Adapter.prototype\n\nconst DEFAULTS = {\n /**\n * RethinkDB authorization key.\n *\n * @name RethinkDBAdapter#authKey\n * @type {string}\n */\n authKey: '',\n\n /**\n * Buffer size for connection pool.\n *\n * @name RethinkDBAdapter#bufferSize\n * @type {number}\n * @default 10\n */\n bufferSize: 10,\n\n /**\n * Default database.\n *\n * @name RethinkDBAdapter#db\n * @type {string}\n * @default \"test\"\n */\n db: 'test',\n\n /**\n * RethinkDB host.\n *\n * @name RethinkDBAdapter#host\n * @type {string}\n * @default \"localhost\"\n */\n host: 'localhost',\n\n /**\n * Minimum connections in pool.\n *\n * @name RethinkDBAdapter#min\n * @type {number}\n * @default 10\n */\n min: 10,\n\n /**\n * Maximum connections in pool.\n *\n * @name RethinkDBAdapter#max\n * @type {number}\n * @default 50\n */\n max: 50,\n\n /**\n * RethinkDB port.\n *\n * @name RethinkDBAdapter#port\n * @type {number}\n * @default 28015\n */\n port: 28015\n}\n\nconst INSERT_OPTS_DEFAULTS = {}\nconst UPDATE_OPTS_DEFAULTS = {}\nconst DELETE_OPTS_DEFAULTS = {}\nconst RUN_OPTS_DEFAULTS = {}\n\nconst equal = function (r, row, field, value) {\n return row(field).default(null).eq(value)\n}\n\nconst notEqual = function (r, row, field, value) {\n return row(field).default(null).ne(value)\n}\n\n/**\n * Default predicate functions for the filtering operators.\n *\n * @name RethinkDBAdapter.OPERATORS\n * @property {Function} == Equality operator.\n * @property {Function} != Inequality operator.\n * @property {Function} > \"Greater than\" operator.\n * @property {Function} >= \"Greater than or equal to\" operator.\n * @property {Function} < \"Less than\" operator.\n * @property {Function} <= \"Less than or equal to\" operator.\n * @property {Function} isectEmpty Operator to test that the intersection\n * between two arrays is empty.\n * @property {Function} isectNotEmpty Operator to test that the intersection\n * between two arrays is NOT empty.\n * @property {Function} in Operator to test whether a value is found in the\n * provided array.\n * @property {Function} notIn Operator to test whether a value is NOT found in\n * the provided array.\n * @property {Function} contains Operator to test whether an array contains the\n * provided value.\n * @property {Function} notContains Operator to test whether an array does NOT\n * contain the provided value.\n */\nconst OPERATORS = {\n '==': equal,\n '===': equal,\n '!=': notEqual,\n '!==': notEqual,\n '>': function (r, row, field, value) {\n return row(field).default(null).gt(value)\n },\n '>=': function (r, row, field, value) {\n return row(field).default(null).ge(value)\n },\n '<': function (r, row, field, value) {\n return row(field).default(null).lt(value)\n },\n '<=': function (r, row, field, value) {\n return row(field).default(null).le(value)\n },\n 'isectEmpty': function (r, row, field, value) {\n return row(field).default([]).setIntersection(r.expr(value).default([])).count().eq(0)\n },\n 'isectNotEmpty': function (r, row, field, value) {\n return row(field).default([]).setIntersection(r.expr(value).default([])).count().ne(0)\n },\n 'in': function (r, row, field, value) {\n return r.expr(value).default(r.expr([])).contains(row(field).default(null))\n },\n 'notIn': function (r, row, field, value) {\n return r.expr(value).default(r.expr([])).contains(row(field).default(null)).not()\n },\n 'contains': function (r, row, field, value) {\n return row(field).default([]).contains(value)\n },\n 'notContains': function (r, row, field, value) {\n return row(field).default([]).contains(value).not()\n }\n}\n\n/**\n * RethinkDBAdapter class.\n *\n * @example\n * // Use Container instead of DataStore on the server\n * import {Container} from 'js-data'\n * import RethinkDBAdapter from 'js-data-rethinkdb'\n *\n * // Create a store to hold your Mappers\n * const store = new Container()\n *\n * // Create an instance of RethinkDBAdapter with default settings\n * const adapter = new RethinkDBAdapter()\n *\n * // Mappers in \"store\" will use the RethinkDB adapter by default\n * store.registerAdapter('rethinkdb', adapter, { default: true })\n *\n * // Create a Mapper that maps to a \"user\" table\n * store.defineMapper('user')\n *\n * @class RethinkDBAdapter\n * @extends Adapter\n * @param {Object} [opts] Configuration opts.\n * @param {string} [opts.authKey=\"\"] RethinkDB authorization key.\n * @param {number} [opts.bufferSize=10] Buffer size for connection pool.\n * @param {string} [opts.db=\"test\"] Default database.\n * @param {boolean} [opts.debug=false] Whether to log debugging information.\n * @param {string} [opts.host=\"localhost\"] RethinkDB host.\n * @param {number} [opts.max=50] Maximum connections in pool.\n * @param {number} [opts.min=10] Minimum connections in pool.\n * @param {Object} [opts.operators] Override the default predicate functions for\n * specified operators.\n * @param {number} [opts.port=28015] RethinkDB port.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed response object.\n */\nfunction RethinkDBAdapter (opts) {\n const self = this\n utils.classCallCheck(self, RethinkDBAdapter)\n opts || (opts = {})\n utils.fillIn(opts, DEFAULTS)\n Adapter.call(self, opts)\n\n /**\n * Default options to pass to r#insert.\n *\n * @name RethinkDBAdapter#insertOpts\n * @type {Object}\n * @default {}\n */\n self.insertOpts || (self.insertOpts = {})\n utils.fillIn(self.insertOpts, INSERT_OPTS_DEFAULTS)\n\n /**\n * Default options to pass to r#update.\n *\n * @name RethinkDBAdapter#updateOpts\n * @type {Object}\n * @default {}\n */\n self.updateOpts || (self.updateOpts = {})\n utils.fillIn(self.updateOpts, UPDATE_OPTS_DEFAULTS)\n\n /**\n * Default options to pass to r#delete.\n *\n * @name RethinkDBAdapter#deleteOpts\n * @type {Object}\n * @default {}\n */\n self.deleteOpts || (self.deleteOpts = {})\n utils.fillIn(self.deleteOpts, DELETE_OPTS_DEFAULTS)\n\n /**\n * Default options to pass to r#run.\n *\n * @name RethinkDBAdapter#runOpts\n * @type {Object}\n * @default {}\n */\n self.runOpts || (self.runOpts = {})\n utils.fillIn(self.runOpts, RUN_OPTS_DEFAULTS)\n\n /**\n * Override the default predicate functions for specified operators.\n *\n * @name RethinkDBAdapter#operators\n * @type {Object}\n * @default {}\n */\n self.operators || (self.operators = {})\n\n /**\n * The rethinkdbdash instance used by this adapter. Use this directly when you\n * need to write custom queries.\n *\n * @name RethinkDBAdapter#r\n * @type {Object}\n */\n self.r = rethinkdbdash(opts)\n self.databases = {}\n self.tables = {}\n self.indices = {}\n}\n\n// Setup prototype inheritance from Adapter\nRethinkDBAdapter.prototype = Object.create(Adapter.prototype, {\n constructor: {\n value: RethinkDBAdapter,\n enumerable: false,\n writable: true,\n configurable: true\n }\n})\n\nObject.defineProperty(RethinkDBAdapter, '__super__', {\n configurable: true,\n value: Adapter\n})\n\n/**\n * Alternative to ES6 class syntax for extending `RethinkDBAdapter`.\n *\n * @name RethinkDBAdapter.extend\n * @method\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the RethinkDBAdapter.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the RethinkDBAdapter itself.\n * @return {Object} RethinkDBAdapter of `RethinkDBAdapter`.\n */\nRethinkDBAdapter.extend = utils.extend\n\nRethinkDBAdapter.OPERATORS = OPERATORS\n\nutils.addHiddenPropsToTarget(RethinkDBAdapter.prototype, {\n _handleErrors (cursor) {\n if (cursor && cursor.errors > 0) {\n if (cursor.first_error) {\n throw new Error(cursor.first_error)\n }\n throw new Error('Unknown RethinkDB Error')\n }\n },\n\n _count (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.filterSequence(self.selectTable(mapper, opts), query)\n .count()\n .run(self.getOpt('runOpts', opts)).then(function (count) {\n return [count, {}]\n })\n },\n\n _create (mapper, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n const insertOpts = self.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n\n return self.selectTable(mapper, opts)\n .insert(props, insertOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n self._handleErrors(cursor)\n let record\n if (cursor && cursor.changes && cursor.changes.length && cursor.changes[0].new_val) {\n record = cursor.changes[0].new_val\n }\n return [record, cursor]\n })\n },\n\n _createMany (mapper, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n const insertOpts = self.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n\n return self.selectTable(mapper, opts)\n .insert(props, insertOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n self._handleErrors(cursor)\n let records = []\n if (cursor && cursor.changes && cursor.changes.length && cursor.changes) {\n records = cursor.changes.map(function (change) {\n return change.new_val\n })\n }\n return [records, cursor]\n })\n },\n\n _destroy (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n\n return self.selectTable(mapper, opts)\n .get(id)\n .delete(self.getOpt('deleteOpts', opts))\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n self._handleErrors(cursor)\n return [undefined, cursor]\n })\n },\n\n _destroyAll (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n\n return self\n .filterSequence(self.selectTable(mapper, opts), query)\n .delete(self.getOpt('deleteOpts', opts))\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n self._handleErrors(cursor)\n return [undefined, cursor]\n })\n },\n\n _find (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n\n return self.selectTable(mapper, opts)\n .get(id)\n .run(self.getOpt('runOpts', opts)).then(function (record) {\n return [record, {}]\n })\n },\n\n _findAll (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.filterSequence(self.selectTable(mapper, opts), query)\n .run(self.getOpt('runOpts', opts)).then(function (records) {\n return [records, {}]\n })\n },\n\n _sum (mapper, field, query, opts) {\n const self = this\n if (!utils.isString(field)) {\n throw new Error('field must be a string!')\n }\n opts || (opts = {})\n query || (query = {})\n\n return self.filterSequence(self.selectTable(mapper, opts), query)\n .sum(field)\n .run(self.getOpt('runOpts', opts)).then(function (sum) {\n return [sum, {}]\n })\n },\n\n _update (mapper, id, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n const updateOpts = self.getOpt('updateOpts', opts)\n updateOpts.returnChanges = true\n\n return self.selectTable(mapper, opts)\n .get(id)\n .update(withoutRelations(mapper, props), updateOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n let record\n self._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length && cursor.changes[0].new_val) {\n record = cursor.changes[0].new_val\n } else {\n throw new Error('Not Found')\n }\n return [record, cursor]\n })\n },\n\n _updateAll (mapper, props, query, opts) {\n const self = this\n props || (props = {})\n query || (query = {})\n opts || (opts = {})\n\n const updateOpts = self.getOpt('updateOpts', opts)\n updateOpts.returnChanges = true\n\n return self.filterSequence(self.selectTable(mapper, opts), query)\n .update(withoutRelations(mapper, props), updateOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n let records = []\n self._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length) {\n records = cursor.changes.map(function (change) { return change.new_val })\n }\n return [records, cursor]\n })\n },\n\n _updateMany (mapper, records, opts) {\n const self = this\n records || (records = [])\n opts || (opts = {})\n\n const insertOpts = self.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n insertOpts.conflict = 'update'\n\n return self.selectTable(mapper, opts)\n .insert(records, insertOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n records = []\n self._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length) {\n records = cursor.changes.map(function (change) { return change.new_val })\n }\n return [records, cursor]\n })\n },\n\n selectDb (opts) {\n return this.r.db(utils.isUndefined(opts.db) ? this.db : opts.db)\n },\n\n selectTable (mapper, opts) {\n return this.selectDb(opts).table(mapper.table || underscore(mapper.name))\n },\n\n /**\n * Apply the specified selection query to the provided RQL sequence.\n *\n * @name RethinkDBAdapter#filterSequence\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n */\n filterSequence (sequence, query, opts) {\n const self = this\n const r = self.r\n\n query = utils.plainCopy(query || {})\n opts || (opts = {})\n opts.operators || (opts.operators = {})\n query.where || (query.where = {})\n query.orderBy || (query.orderBy = query.sort)\n query.orderBy || (query.orderBy = [])\n query.skip || (query.skip = query.offset)\n\n // Transform non-keyword properties to \"where\" clause configuration\n utils.forOwn(query, function (config, keyword) {\n if (reserved.indexOf(keyword) === -1) {\n if (utils.isObject(config)) {\n query.where[keyword] = config\n } else {\n query.where[keyword] = {\n '==': config\n }\n }\n delete query[keyword]\n }\n })\n\n let rql = sequence\n\n // Filter\n if (Object.keys(query.where).length !== 0) {\n // Filter sequence using filter function\n rql = rql.filter(function (row) {\n let subQuery\n // Apply filter for each field\n utils.forOwn(query.where, function (criteria, field) {\n if (!utils.isObject(criteria)) {\n criteria = { '==': criteria }\n }\n // Apply filter for each operator\n utils.forOwn(criteria, function (value, operator) {\n let isOr = false\n if (operator && operator[0] === '|') {\n operator = operator.substr(1)\n isOr = true\n }\n let predicateFn = self.getOperator(operator, opts)\n if (predicateFn) {\n const predicateResult = predicateFn(r, row, field, value)\n if (isOr) {\n subQuery = subQuery ? subQuery.or(predicateResult) : predicateResult\n } else {\n subQuery = subQuery ? subQuery.and(predicateResult) : predicateResult\n }\n } else {\n throw new Error(`Operator ${operator} not supported!`)\n }\n })\n })\n return subQuery || true\n })\n }\n\n // Sort\n if (query.orderBy) {\n if (utils.isString(query.orderBy)) {\n query.orderBy = [\n [query.orderBy, 'asc']\n ]\n }\n for (var i = 0; i < query.orderBy.length; i++) {\n if (utils.isString(query.orderBy[i])) {\n query.orderBy[i] = [query.orderBy[i], 'asc']\n }\n rql = (query.orderBy[i][1] || '').toUpperCase() === 'DESC' ? rql.orderBy(r.desc(query.orderBy[i][0])) : rql.orderBy(query.orderBy[i][0])\n }\n }\n\n // Offset\n if (query.skip) {\n rql = rql.skip(+query.skip)\n }\n\n // Limit\n if (query.limit) {\n rql = rql.limit(+query.limit)\n }\n\n return rql\n },\n\n waitForDb (opts) {\n const self = this\n opts || (opts = {})\n const db = utils.isUndefined(opts.db) ? self.db : opts.db\n if (!self.databases[db]) {\n self.databases[db] = self.r.branch(\n self.r.dbList().contains(db),\n true,\n self.r.dbCreate(db)\n ).run()\n }\n return self.databases[db]\n },\n\n waitForTable (mapper, options) {\n const table = utils.isString(mapper) ? mapper : (mapper.table || underscore(mapper.name))\n options = options || {}\n let db = utils.isUndefined(options.db) ? this.db : options.db\n return this.waitForDb(options).then(() => {\n this.tables[db] = this.tables[db] || {}\n if (!this.tables[db][table]) {\n this.tables[db][table] = this.r.branch(this.r.db(db).tableList().contains(table), true, this.r.db(db).tableCreate(table)).run()\n }\n return this.tables[db][table]\n })\n },\n\n waitForIndex (table, index, options) {\n options = options || {}\n let db = utils.isUndefined(options.db) ? this.db : options.db\n return this.waitForDb(options).then(() => this.waitForTable(table, options)).then(() => {\n this.indices[db] = this.indices[db] || {}\n this.indices[db][table] = this.indices[db][table] || {}\n if (!this.tables[db][table][index]) {\n this.tables[db][table][index] = this.r.branch(this.r.db(db).table(table).indexList().contains(index), true, this.r.db(db).table(table).indexCreate(index)).run().then(() => {\n return this.r.db(db).table(table).indexWait(index).run()\n })\n }\n return this.tables[db][table][index]\n })\n },\n\n /**\n * Return the number of records that match the selection query.\n *\n * @name RethinkDBAdapter#count\n * @method\n * @param {Object} mapper the mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n count (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.count.call(self, mapper, query, opts)\n })\n },\n\n /**\n * Create a new record.\n *\n * @name RethinkDBAdapter#create\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The record to be created.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.insertOpts] Options to pass to r#insert.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n create (mapper, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.create.call(self, mapper, props, opts)\n })\n },\n\n /**\n * Create multiple records in a single batch.\n *\n * @name RethinkDBAdapter#createMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The records to be created.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.insertOpts] Options to pass to r#insert.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n createMany (mapper, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.createMany.call(self, mapper, props, opts)\n })\n },\n\n /**\n * Destroy the record with the given primary key.\n *\n * @name RethinkDBAdapter#destroy\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to destroy.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.deleteOpts] Options to pass to r#delete.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n destroy (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.destroy.call(self, mapper, id, opts)\n })\n },\n\n /**\n * Destroy the records that match the selection query.\n *\n * @name RethinkDBAdapter#destroyAll\n * @method\n * @param {Object} mapper the mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.deleteOpts] Options to pass to r#delete.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n destroyAll (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.destroyAll.call(self, mapper, query, opts)\n })\n },\n\n /**\n * Retrieve the record with the given primary key.\n *\n * @name RethinkDBAdapter#find\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to retrieve.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n find (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.with || (opts.with = [])\n\n const relationList = mapper.relationList || []\n let tasks = [self.waitForTable(mapper, opts)]\n\n relationList.forEach(function (def) {\n const relationName = def.relation\n const relationDef = def.getRelation()\n if (!opts.with || opts.with.indexOf(relationName) === -1) {\n return\n }\n if (def.foreignKey && def.type !== 'belongsTo') {\n if (def.type === 'belongsTo') {\n tasks.push(self.waitForIndex(mapper.table || underscore(mapper.name), def.foreignKey, opts))\n } else {\n tasks.push(self.waitForIndex(relationDef.table || underscore(relationDef.name), def.foreignKey, opts))\n }\n }\n })\n return Promise.all(tasks).then(function () {\n return __super__.find.call(self, mapper, id, opts)\n })\n },\n\n /**\n * Retrieve the records that match the selection query.\n *\n * @name RethinkDBAdapter#findAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n findAll (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n opts.with || (opts.with = [])\n query || (query = {})\n\n const relationList = mapper.relationList || []\n let tasks = [self.waitForTable(mapper, opts)]\n\n relationList.forEach(function (def) {\n const relationName = def.relation\n const relationDef = def.getRelation()\n if (!opts.with || opts.with.indexOf(relationName) === -1) {\n return\n }\n if (def.foreignKey && def.type !== 'belongsTo') {\n if (def.type === 'belongsTo') {\n tasks.push(self.waitForIndex(mapper.table || underscore(mapper.name), def.foreignKey, opts))\n } else {\n tasks.push(self.waitForIndex(relationDef.table || underscore(relationDef.name), def.foreignKey, opts))\n }\n }\n })\n return Promise.all(tasks).then(function () {\n return __super__.findAll.call(self, mapper, query, opts)\n })\n },\n\n /**\n * Resolve the predicate function for the specified operator based on the\n * given options and this adapter's settings.\n *\n * @name RethinkDBAdapter#getOperator\n * @method\n * @param {string} operator The name of the operator.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @return {*} The predicate function for the specified operator.\n */\n getOperator (operator, opts) {\n opts || (opts = {})\n opts.operators || (opts.operators = {})\n let ownOps = this.operators || {}\n return utils.isUndefined(opts.operators[operator]) ? ownOps[operator] || OPERATORS[operator] : opts.operators[operator]\n },\n\n /**\n * Return the sum of the specified field of records that match the selection\n * query.\n *\n * @name RethinkDBAdapter#sum\n * @method\n * @param {Object} mapper The mapper.\n * @param {string} field The field to sum.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n sum (mapper, field, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.sum.call(self, mapper, field, query, opts)\n })\n },\n\n /**\n * Apply the given update to the record with the specified primary key.\n *\n * @name RethinkDBAdapter#update\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id The primary key of the record to be updated.\n * @param {Object} props The update to apply to the record.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.updateOpts] Options to pass to r#update.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n update (mapper, id, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.update.call(self, mapper, id, props, opts)\n })\n },\n\n /**\n * Apply the given update to all records that match the selection query.\n *\n * @name RethinkDBAdapter#updateAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The update to apply to the selected records.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @param {Object} [opts.updateOpts] Options to pass to r#update.\n * @return {Promise}\n */\n updateAll (mapper, props, query, opts) {\n const self = this\n props || (props = {})\n query || (query = {})\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.updateAll.call(self, mapper, props, query, opts)\n })\n },\n\n /**\n * Update the given records in a single batch.\n *\n * @name RethinkDBAdapter#updateMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object[]} records The records to update.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.insertOpts] Options to pass to r#insert.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n updateMany (mapper, records, opts) {\n const self = this\n records || (records = [])\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.updateMany.call(self, mapper, records, opts)\n })\n }\n})\n\nmodule.exports = RethinkDBAdapter\n"],"names":["utils","Adapter","reserved"],"mappings":";;;;;;;;;;AAQA,IAAM,mBAAmB,SAAnB,gBAAmB,CAAU,MAAV,EAAkB,KAAlB,EAAyB;SACzCA,aAAM,IAAN,CAAW,KAAX,EAAkB,OAAO,cAAP,IAAyB,EAAzB,CAAzB,CADgD;CAAzB;;AAIzB,IAAM,YAAYC,iBAAQ,SAAR;;AAElB,IAAM,WAAW;;;;;;;WAON,EAAT;;;;;;;;;cASY,EAAZ;;;;;;;;;MASI,MAAJ;;;;;;;;;QASM,WAAN;;;;;;;;;OASK,E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;cAErB,QAAQ,EAAR,CAAV,CAF+B;aAGtB,OAAO,EAAP,CAAT,CAH+B;;WAKxB,KAAK,YAAL,CAAkB,MAAlB,EAA0B,IAA1B,EAAgC,IAAhC,CAAqC,YAAY;aAC/C,UAAU,MAAV,CAAiB,IAAjB,CAAsB,IAAtB,EAA4B,MAA5B,EAAoC,EAApC,EAAwC,KAAxC,EAA+C,IAA/C,CAAP,CADsD;KAAZ,CAA5C,CAL+B;GAloBsB;;;;;;;;;;;;;;;;;;;;;;;;;;gCAmqB5C,QAAQ,OAAO,OAAO,MAAM;QAC/B,OAAO,IAAP,CAD+B;cAE3B,QAAQ,EAAR,CAAV,CAFqC;cAG3B,QAAQ,EAAR,CAAV,CAHqC;aAI5B,OAAO,EAAP,CAAT,CAJqC;;WAM9B,KAAK,YAAL,CAAkB,MAAlB,EAA0B,IAA1B,EAAgC,IAAhC,CAAqC,YAAY;aAC/C,UAAU,SAAV,CAAoB,IAApB,CAAyB,IAAzB,EAA+B,MAA/B,EAAuC,KAAvC,EAA8C,KAA9C,EAAqD,IAArD,CAAP,CADsD;KAAZ,CAA5C,CANqC;GAnqBgB;;;;;;;;;;;;;;;;;kCA4rB3C,QAAQ,SAAS,MAAM;QAC3B,OAAO,IAAP,CAD2B;gBAErB,UAAU,EAAV,CAAZ,CAFiC;aAGxB,OAAO,EAAP,CAAT,CAHiC;;WAK1B,KAAK,YAAL,CAAkB,MAAlB,EAA0B,IAA1B,EAAgC,IAAhC,CAAqC,YAAY;aAC/C,UAAU,UAAV,CAAqB,IAArB,CAA0B,IAA1B,EAAgC,MAAhC,EAAwC,OAAxC,EAAiD,IAAjD,CAAP,CADsD;KAAZ,CAA5C,CALiC;GA5rBoB;CAAzD;;AAusBA,OAAO,OAAP,GAAiB,gBAAjB"} \ No newline at end of file +{"version":3,"file":"js-data-rethinkdb.js","sources":["../src/index.js"],"sourcesContent":["import {utils} from 'js-data'\nimport Adapter from 'js-data-adapter'\nimport {\n reserved\n} from 'js-data-adapter'\nimport rethinkdbdash from 'rethinkdbdash'\nimport underscore from 'mout/string/underscore'\n\nconst withoutRelations = function (mapper, props) {\n return utils.omit(props, mapper.relationFields || [])\n}\n\nconst __super__ = Adapter.prototype\n\nconst DEFAULTS = {\n /**\n * RethinkDB authorization key.\n *\n * @name RethinkDBAdapter#authKey\n * @type {string}\n */\n authKey: '',\n\n /**\n * Buffer size for connection pool.\n *\n * @name RethinkDBAdapter#bufferSize\n * @type {number}\n * @default 10\n */\n bufferSize: 10,\n\n /**\n * Default database.\n *\n * @name RethinkDBAdapter#db\n * @type {string}\n * @default \"test\"\n */\n db: 'test',\n\n /**\n * RethinkDB host.\n *\n * @name RethinkDBAdapter#host\n * @type {string}\n * @default \"localhost\"\n */\n host: 'localhost',\n\n /**\n * Minimum connections in pool.\n *\n * @name RethinkDBAdapter#min\n * @type {number}\n * @default 10\n */\n min: 10,\n\n /**\n * Maximum connections in pool.\n *\n * @name RethinkDBAdapter#max\n * @type {number}\n * @default 50\n */\n max: 50,\n\n /**\n * RethinkDB port.\n *\n * @name RethinkDBAdapter#port\n * @type {number}\n * @default 28015\n */\n port: 28015\n}\n\nconst INSERT_OPTS_DEFAULTS = {}\nconst UPDATE_OPTS_DEFAULTS = {}\nconst DELETE_OPTS_DEFAULTS = {}\nconst RUN_OPTS_DEFAULTS = {}\n\nconst equal = function (r, row, field, value) {\n return row(field).default(null).eq(value)\n}\n\nconst notEqual = function (r, row, field, value) {\n return row(field).default(null).ne(value)\n}\n\n/**\n * Default predicate functions for the filtering operators.\n *\n * @name RethinkDBAdapter.OPERATORS\n * @property {Function} == Equality operator.\n * @property {Function} != Inequality operator.\n * @property {Function} > \"Greater than\" operator.\n * @property {Function} >= \"Greater than or equal to\" operator.\n * @property {Function} < \"Less than\" operator.\n * @property {Function} <= \"Less than or equal to\" operator.\n * @property {Function} isectEmpty Operator to test that the intersection\n * between two arrays is empty.\n * @property {Function} isectNotEmpty Operator to test that the intersection\n * between two arrays is NOT empty.\n * @property {Function} in Operator to test whether a value is found in the\n * provided array.\n * @property {Function} notIn Operator to test whether a value is NOT found in\n * the provided array.\n * @property {Function} contains Operator to test whether an array contains the\n * provided value.\n * @property {Function} notContains Operator to test whether an array does NOT\n * contain the provided value.\n */\nconst OPERATORS = {\n '==': equal,\n '===': equal,\n '!=': notEqual,\n '!==': notEqual,\n '>': function (r, row, field, value) {\n return row(field).default(null).gt(value)\n },\n '>=': function (r, row, field, value) {\n return row(field).default(null).ge(value)\n },\n '<': function (r, row, field, value) {\n return row(field).default(null).lt(value)\n },\n '<=': function (r, row, field, value) {\n return row(field).default(null).le(value)\n },\n 'isectEmpty': function (r, row, field, value) {\n return row(field).default([]).setIntersection(r.expr(value).default([])).count().eq(0)\n },\n 'isectNotEmpty': function (r, row, field, value) {\n return row(field).default([]).setIntersection(r.expr(value).default([])).count().ne(0)\n },\n 'in': function (r, row, field, value) {\n return r.expr(value).default(r.expr([])).contains(row(field).default(null))\n },\n 'notIn': function (r, row, field, value) {\n return r.expr(value).default(r.expr([])).contains(row(field).default(null)).not()\n },\n 'contains': function (r, row, field, value) {\n return row(field).default([]).contains(value)\n },\n 'notContains': function (r, row, field, value) {\n return row(field).default([]).contains(value).not()\n }\n}\n\n/**\n * RethinkDBAdapter class.\n *\n * @example\n * // Use Container instead of DataStore on the server\n * import {Container} from 'js-data'\n * import RethinkDBAdapter from 'js-data-rethinkdb'\n *\n * // Create a store to hold your Mappers\n * const store = new Container()\n *\n * // Create an instance of RethinkDBAdapter with default settings\n * const adapter = new RethinkDBAdapter()\n *\n * // Mappers in \"store\" will use the RethinkDB adapter by default\n * store.registerAdapter('rethinkdb', adapter, { default: true })\n *\n * // Create a Mapper that maps to a \"user\" table\n * store.defineMapper('user')\n *\n * @class RethinkDBAdapter\n * @extends Adapter\n * @param {Object} [opts] Configuration opts.\n * @param {string} [opts.authKey=\"\"] RethinkDB authorization key.\n * @param {number} [opts.bufferSize=10] Buffer size for connection pool.\n * @param {string} [opts.db=\"test\"] Default database.\n * @param {boolean} [opts.debug=false] Whether to log debugging information.\n * @param {string} [opts.host=\"localhost\"] RethinkDB host.\n * @param {number} [opts.max=50] Maximum connections in pool.\n * @param {number} [opts.min=10] Minimum connections in pool.\n * @param {Object} [opts.operators] Override the default predicate functions for\n * specified operators.\n * @param {number} [opts.port=28015] RethinkDB port.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed response object.\n */\nfunction RethinkDBAdapter (opts) {\n const self = this\n utils.classCallCheck(self, RethinkDBAdapter)\n opts || (opts = {})\n utils.fillIn(opts, DEFAULTS)\n Adapter.call(self, opts)\n\n /**\n * Default options to pass to r#insert.\n *\n * @name RethinkDBAdapter#insertOpts\n * @type {Object}\n * @default {}\n */\n self.insertOpts || (self.insertOpts = {})\n utils.fillIn(self.insertOpts, INSERT_OPTS_DEFAULTS)\n\n /**\n * Default options to pass to r#update.\n *\n * @name RethinkDBAdapter#updateOpts\n * @type {Object}\n * @default {}\n */\n self.updateOpts || (self.updateOpts = {})\n utils.fillIn(self.updateOpts, UPDATE_OPTS_DEFAULTS)\n\n /**\n * Default options to pass to r#delete.\n *\n * @name RethinkDBAdapter#deleteOpts\n * @type {Object}\n * @default {}\n */\n self.deleteOpts || (self.deleteOpts = {})\n utils.fillIn(self.deleteOpts, DELETE_OPTS_DEFAULTS)\n\n /**\n * Default options to pass to r#run.\n *\n * @name RethinkDBAdapter#runOpts\n * @type {Object}\n * @default {}\n */\n self.runOpts || (self.runOpts = {})\n utils.fillIn(self.runOpts, RUN_OPTS_DEFAULTS)\n\n /**\n * Override the default predicate functions for specified operators.\n *\n * @name RethinkDBAdapter#operators\n * @type {Object}\n * @default {}\n */\n self.operators || (self.operators = {})\n\n /**\n * The rethinkdbdash instance used by this adapter. Use this directly when you\n * need to write custom queries.\n *\n * @name RethinkDBAdapter#r\n * @type {Object}\n */\n self.r = rethinkdbdash(opts)\n self.databases = {}\n self.tables = {}\n self.indices = {}\n}\n\n// Setup prototype inheritance from Adapter\nRethinkDBAdapter.prototype = Object.create(Adapter.prototype, {\n constructor: {\n value: RethinkDBAdapter,\n enumerable: false,\n writable: true,\n configurable: true\n }\n})\n\nObject.defineProperty(RethinkDBAdapter, '__super__', {\n configurable: true,\n value: Adapter\n})\n\n/**\n * Alternative to ES6 class syntax for extending `RethinkDBAdapter`.\n *\n * @name RethinkDBAdapter.extend\n * @method\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the RethinkDBAdapter.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the RethinkDBAdapter itself.\n * @return {Object} RethinkDBAdapter of `RethinkDBAdapter`.\n */\nRethinkDBAdapter.extend = utils.extend\n\n/**\n * Details of the current version of the `js-data-rethinkdb` module.\n *\n * @name RethinkDBAdapter.version\n * @type {Object}\n * @property {string} full The full semver value.\n * @property {number} major The major version number.\n * @property {number} minor The minor version number.\n * @property {number} patch The patch version number.\n * @property {(string|boolean)} alpha The alpha version value, otherwise `false`\n * if the current version is not alpha.\n * @property {(string|boolean)} beta The beta version value, otherwise `false`\n * if the current version is not beta.\n */\nRethinkDBAdapter.version = '<%= version %>'\n\nRethinkDBAdapter.OPERATORS = OPERATORS\n\nutils.addHiddenPropsToTarget(RethinkDBAdapter.prototype, {\n _handleErrors (cursor) {\n if (cursor && cursor.errors > 0) {\n if (cursor.first_error) {\n throw new Error(cursor.first_error)\n }\n throw new Error('Unknown RethinkDB Error')\n }\n },\n\n _count (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.filterSequence(self.selectTable(mapper, opts), query)\n .count()\n .run(self.getOpt('runOpts', opts)).then(function (count) {\n return [count, {}]\n })\n },\n\n _create (mapper, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n const insertOpts = self.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n\n return self.selectTable(mapper, opts)\n .insert(props, insertOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n self._handleErrors(cursor)\n let record\n if (cursor && cursor.changes && cursor.changes.length && cursor.changes[0].new_val) {\n record = cursor.changes[0].new_val\n }\n return [record, cursor]\n })\n },\n\n _createMany (mapper, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n const insertOpts = self.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n\n return self.selectTable(mapper, opts)\n .insert(props, insertOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n self._handleErrors(cursor)\n let records = []\n if (cursor && cursor.changes && cursor.changes.length && cursor.changes) {\n records = cursor.changes.map(function (change) {\n return change.new_val\n })\n }\n return [records, cursor]\n })\n },\n\n _destroy (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n\n return self.selectTable(mapper, opts)\n .get(id)\n .delete(self.getOpt('deleteOpts', opts))\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n self._handleErrors(cursor)\n return [undefined, cursor]\n })\n },\n\n _destroyAll (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n\n return self\n .filterSequence(self.selectTable(mapper, opts), query)\n .delete(self.getOpt('deleteOpts', opts))\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n self._handleErrors(cursor)\n return [undefined, cursor]\n })\n },\n\n _find (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n\n return self.selectTable(mapper, opts)\n .get(id)\n .run(self.getOpt('runOpts', opts)).then(function (record) {\n return [record, {}]\n })\n },\n\n _findAll (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.filterSequence(self.selectTable(mapper, opts), query)\n .run(self.getOpt('runOpts', opts)).then(function (records) {\n return [records, {}]\n })\n },\n\n _sum (mapper, field, query, opts) {\n const self = this\n if (!utils.isString(field)) {\n throw new Error('field must be a string!')\n }\n opts || (opts = {})\n query || (query = {})\n\n return self.filterSequence(self.selectTable(mapper, opts), query)\n .sum(field)\n .run(self.getOpt('runOpts', opts)).then(function (sum) {\n return [sum, {}]\n })\n },\n\n _update (mapper, id, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n const updateOpts = self.getOpt('updateOpts', opts)\n updateOpts.returnChanges = true\n\n return self.selectTable(mapper, opts)\n .get(id)\n .update(withoutRelations(mapper, props), updateOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n let record\n self._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length && cursor.changes[0].new_val) {\n record = cursor.changes[0].new_val\n } else {\n throw new Error('Not Found')\n }\n return [record, cursor]\n })\n },\n\n _updateAll (mapper, props, query, opts) {\n const self = this\n props || (props = {})\n query || (query = {})\n opts || (opts = {})\n\n const updateOpts = self.getOpt('updateOpts', opts)\n updateOpts.returnChanges = true\n\n return self.filterSequence(self.selectTable(mapper, opts), query)\n .update(withoutRelations(mapper, props), updateOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n let records = []\n self._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length) {\n records = cursor.changes.map(function (change) { return change.new_val })\n }\n return [records, cursor]\n })\n },\n\n _updateMany (mapper, records, opts) {\n const self = this\n records || (records = [])\n opts || (opts = {})\n\n const insertOpts = self.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n insertOpts.conflict = 'update'\n\n return self.selectTable(mapper, opts)\n .insert(records, insertOpts)\n .run(self.getOpt('runOpts', opts)).then(function (cursor) {\n records = []\n self._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length) {\n records = cursor.changes.map(function (change) { return change.new_val })\n }\n return [records, cursor]\n })\n },\n\n selectDb (opts) {\n return this.r.db(utils.isUndefined(opts.db) ? this.db : opts.db)\n },\n\n selectTable (mapper, opts) {\n return this.selectDb(opts).table(mapper.table || underscore(mapper.name))\n },\n\n /**\n * Apply the specified selection query to the provided RQL sequence.\n *\n * @name RethinkDBAdapter#filterSequence\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n */\n filterSequence (sequence, query, opts) {\n const self = this\n const r = self.r\n\n query = utils.plainCopy(query || {})\n opts || (opts = {})\n opts.operators || (opts.operators = {})\n query.where || (query.where = {})\n query.orderBy || (query.orderBy = query.sort)\n query.orderBy || (query.orderBy = [])\n query.skip || (query.skip = query.offset)\n\n // Transform non-keyword properties to \"where\" clause configuration\n utils.forOwn(query, function (config, keyword) {\n if (reserved.indexOf(keyword) === -1) {\n if (utils.isObject(config)) {\n query.where[keyword] = config\n } else {\n query.where[keyword] = {\n '==': config\n }\n }\n delete query[keyword]\n }\n })\n\n let rql = sequence\n\n // Filter\n if (Object.keys(query.where).length !== 0) {\n // Filter sequence using filter function\n rql = rql.filter(function (row) {\n let subQuery\n // Apply filter for each field\n utils.forOwn(query.where, function (criteria, field) {\n if (!utils.isObject(criteria)) {\n criteria = { '==': criteria }\n }\n // Apply filter for each operator\n utils.forOwn(criteria, function (value, operator) {\n let isOr = false\n if (operator && operator[0] === '|') {\n operator = operator.substr(1)\n isOr = true\n }\n let predicateFn = self.getOperator(operator, opts)\n if (predicateFn) {\n const predicateResult = predicateFn(r, row, field, value)\n if (isOr) {\n subQuery = subQuery ? subQuery.or(predicateResult) : predicateResult\n } else {\n subQuery = subQuery ? subQuery.and(predicateResult) : predicateResult\n }\n } else {\n throw new Error(`Operator ${operator} not supported!`)\n }\n })\n })\n return subQuery || true\n })\n }\n\n // Sort\n if (query.orderBy) {\n if (utils.isString(query.orderBy)) {\n query.orderBy = [\n [query.orderBy, 'asc']\n ]\n }\n for (var i = 0; i < query.orderBy.length; i++) {\n if (utils.isString(query.orderBy[i])) {\n query.orderBy[i] = [query.orderBy[i], 'asc']\n }\n rql = (query.orderBy[i][1] || '').toUpperCase() === 'DESC' ? rql.orderBy(r.desc(query.orderBy[i][0])) : rql.orderBy(query.orderBy[i][0])\n }\n }\n\n // Offset\n if (query.skip) {\n rql = rql.skip(+query.skip)\n }\n\n // Limit\n if (query.limit) {\n rql = rql.limit(+query.limit)\n }\n\n return rql\n },\n\n waitForDb (opts) {\n const self = this\n opts || (opts = {})\n const db = utils.isUndefined(opts.db) ? self.db : opts.db\n if (!self.databases[db]) {\n self.databases[db] = self.r.branch(\n self.r.dbList().contains(db),\n true,\n self.r.dbCreate(db)\n ).run()\n }\n return self.databases[db]\n },\n\n waitForTable (mapper, options) {\n const table = utils.isString(mapper) ? mapper : (mapper.table || underscore(mapper.name))\n options = options || {}\n let db = utils.isUndefined(options.db) ? this.db : options.db\n return this.waitForDb(options).then(() => {\n this.tables[db] = this.tables[db] || {}\n if (!this.tables[db][table]) {\n this.tables[db][table] = this.r.branch(this.r.db(db).tableList().contains(table), true, this.r.db(db).tableCreate(table)).run()\n }\n return this.tables[db][table]\n })\n },\n\n waitForIndex (table, index, options) {\n options = options || {}\n let db = utils.isUndefined(options.db) ? this.db : options.db\n return this.waitForDb(options).then(() => this.waitForTable(table, options)).then(() => {\n this.indices[db] = this.indices[db] || {}\n this.indices[db][table] = this.indices[db][table] || {}\n if (!this.tables[db][table][index]) {\n this.tables[db][table][index] = this.r.branch(this.r.db(db).table(table).indexList().contains(index), true, this.r.db(db).table(table).indexCreate(index)).run().then(() => {\n return this.r.db(db).table(table).indexWait(index).run()\n })\n }\n return this.tables[db][table][index]\n })\n },\n\n /**\n * Return the number of records that match the selection query.\n *\n * @name RethinkDBAdapter#count\n * @method\n * @param {Object} mapper the mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n count (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.count.call(self, mapper, query, opts)\n })\n },\n\n /**\n * Create a new record.\n *\n * @name RethinkDBAdapter#create\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The record to be created.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.insertOpts] Options to pass to r#insert.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n create (mapper, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.create.call(self, mapper, props, opts)\n })\n },\n\n /**\n * Create multiple records in a single batch.\n *\n * @name RethinkDBAdapter#createMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The records to be created.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.insertOpts] Options to pass to r#insert.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n createMany (mapper, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.createMany.call(self, mapper, props, opts)\n })\n },\n\n /**\n * Destroy the record with the given primary key.\n *\n * @name RethinkDBAdapter#destroy\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to destroy.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.deleteOpts] Options to pass to r#delete.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n destroy (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.destroy.call(self, mapper, id, opts)\n })\n },\n\n /**\n * Destroy the records that match the selection query.\n *\n * @name RethinkDBAdapter#destroyAll\n * @method\n * @param {Object} mapper the mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.deleteOpts] Options to pass to r#delete.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n destroyAll (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.destroyAll.call(self, mapper, query, opts)\n })\n },\n\n /**\n * Retrieve the record with the given primary key.\n *\n * @name RethinkDBAdapter#find\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to retrieve.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n find (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.with || (opts.with = [])\n\n const relationList = mapper.relationList || []\n let tasks = [self.waitForTable(mapper, opts)]\n\n relationList.forEach(function (def) {\n const relationName = def.relation\n const relationDef = def.getRelation()\n if (!opts.with || opts.with.indexOf(relationName) === -1) {\n return\n }\n if (def.foreignKey && def.type !== 'belongsTo') {\n if (def.type === 'belongsTo') {\n tasks.push(self.waitForIndex(mapper.table || underscore(mapper.name), def.foreignKey, opts))\n } else {\n tasks.push(self.waitForIndex(relationDef.table || underscore(relationDef.name), def.foreignKey, opts))\n }\n }\n })\n return Promise.all(tasks).then(function () {\n return __super__.find.call(self, mapper, id, opts)\n })\n },\n\n /**\n * Retrieve the records that match the selection query.\n *\n * @name RethinkDBAdapter#findAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n findAll (mapper, query, opts) {\n const self = this\n opts || (opts = {})\n opts.with || (opts.with = [])\n query || (query = {})\n\n const relationList = mapper.relationList || []\n let tasks = [self.waitForTable(mapper, opts)]\n\n relationList.forEach(function (def) {\n const relationName = def.relation\n const relationDef = def.getRelation()\n if (!opts.with || opts.with.indexOf(relationName) === -1) {\n return\n }\n if (def.foreignKey && def.type !== 'belongsTo') {\n if (def.type === 'belongsTo') {\n tasks.push(self.waitForIndex(mapper.table || underscore(mapper.name), def.foreignKey, opts))\n } else {\n tasks.push(self.waitForIndex(relationDef.table || underscore(relationDef.name), def.foreignKey, opts))\n }\n }\n })\n return Promise.all(tasks).then(function () {\n return __super__.findAll.call(self, mapper, query, opts)\n })\n },\n\n /**\n * Resolve the predicate function for the specified operator based on the\n * given options and this adapter's settings.\n *\n * @name RethinkDBAdapter#getOperator\n * @method\n * @param {string} operator The name of the operator.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @return {*} The predicate function for the specified operator.\n */\n getOperator (operator, opts) {\n opts || (opts = {})\n opts.operators || (opts.operators = {})\n let ownOps = this.operators || {}\n return utils.isUndefined(opts.operators[operator]) ? ownOps[operator] || OPERATORS[operator] : opts.operators[operator]\n },\n\n /**\n * Return the sum of the specified field of records that match the selection\n * query.\n *\n * @name RethinkDBAdapter#sum\n * @method\n * @param {Object} mapper The mapper.\n * @param {string} field The field to sum.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n sum (mapper, field, query, opts) {\n const self = this\n opts || (opts = {})\n query || (query = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.sum.call(self, mapper, field, query, opts)\n })\n },\n\n /**\n * Apply the given update to the record with the specified primary key.\n *\n * @name RethinkDBAdapter#update\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id The primary key of the record to be updated.\n * @param {Object} props The update to apply to the record.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.updateOpts] Options to pass to r#update.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n update (mapper, id, props, opts) {\n const self = this\n props || (props = {})\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.update.call(self, mapper, id, props, opts)\n })\n },\n\n /**\n * Apply the given update to all records that match the selection query.\n *\n * @name RethinkDBAdapter#updateAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The update to apply to the selected records.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.operators] Override the default predicate functions\n * for specified operators.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @param {Object} [opts.updateOpts] Options to pass to r#update.\n * @return {Promise}\n */\n updateAll (mapper, props, query, opts) {\n const self = this\n props || (props = {})\n query || (query = {})\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.updateAll.call(self, mapper, props, query, opts)\n })\n },\n\n /**\n * Update the given records in a single batch.\n *\n * @name RethinkDBAdapter#updateMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object[]} records The records to update.\n * @param {Object} [opts] Configuration options.\n * @param {Object} [opts.insertOpts] Options to pass to r#insert.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {Object} [opts.runOpts] Options to pass to r#run.\n * @return {Promise}\n */\n updateMany (mapper, records, opts) {\n const self = this\n records || (records = [])\n opts || (opts = {})\n\n return self.waitForTable(mapper, opts).then(function () {\n return __super__.updateMany.call(self, mapper, records, opts)\n })\n }\n})\n\nmodule.exports = RethinkDBAdapter\n"],"names":["utils","Adapter","reserved"],"mappings":";;;;;;;;;;AAQA,IAAM,mBAAmB,SAAnB,gBAAmB,CAAU,MAAV,EAAkB,KAAlB,EAAyB;SACzCA,aAAM,IAAN,CAAW,KAAX,EAAkB,OAAO,cAAP,IAAyB,EAAzB,CAAzB,CADgD;CAAzB;;AAIzB,IAAM,YAAYC,iBAAQ,SAAR;;AAElB,IAAM,WAAW;;;;;;;WAON,EAAT;;;;;;;;;cASY,EAAZ;;;;;;;;;MASI,MAAJ;;;;;;;;;QASM,WAAN;;;;;;;;;OASK,EAAL;;;;;;;;;O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name": "js-data-rethinkdb", "description": "RethinkDB adapter for js-data.", - "version": "3.0.0-alpha.13", + "version": "3.0.0-beta.1", "homepage": "https://github.com/js-data/js-data-rethinkdb", "repository": { "type": "git", @@ -34,7 +34,7 @@ }, "scripts": { "lint": "repo-tools lint src/index.js mocha.start.js test/**/*.js scripts/**.js rollup.config.js", - "bundle": "rollup -c rollup.config.js -f cjs -o dist/js-data-rethinkdb.js -m dist/js-data-rethinkdb.js.map src/index.js", + "bundle": "rollup -c rollup.config.js -f cjs -o dist/js-data-rethinkdb.js -m dist/js-data-rethinkdb.js.map src/index.js && repo-tools write-version dist/js-data-rethinkdb.js", "doc": "jsdoc -c conf.json src node_modules/js-data-adapter/src && node scripts/cleanup.js", "watch": "watch \"npm run bundle\" src/", "build": "npm run lint && npm run bundle", @@ -43,29 +43,28 @@ "test": "npm run build && npm run cover", "repo-tools": "repo-tools updates && repo-tools changelog && repo-tools authors", "release": "npm test && npm run doc && npm run repo-tools", - "ci": "npm run test && cat coverage/lcov.info | coveralls || true" + "ci": "npm run test && cat coverage/lcov.info | codecov || true" }, "dependencies": { - "js-data-adapter": "0.2.3", - "mout": "0.12.0" + "js-data-adapter": "~0.3.0", + "mout": "1.0.0" }, "peerDependencies": { - "js-data": "^3.0.0-alpha.19", + "js-data": "^3.0.0-beta.1", "rethinkdbdash": ">=1.15.0" }, "devDependencies": { - "babel-core": "6.7.2", - "babel-polyfill": "6.7.2", + "babel-core": "6.7.6", + "babel-polyfill": "6.7.4", "babel-preset-es2015-rollup": "1.1.1", "chai": "3.5.0", - "coveralls": "2.11.8", "ink-docstrap": "1.1.4", - "istanbul": "0.4.2", + "istanbul": "0.4.3", "js-data-adapter-tests": "^2.0.0-alpha.15", - "js-data-repo-tools": "0.2.0", + "js-data-repo-tools": "0.3.0", "jsdoc": "3.4.0", "mocha": "2.4.5", - "rollup": "0.25.4", + "rollup": "0.25.8", "rollup-plugin-babel": "2.4.0", "sinon": "1.17.3", "source-map-support": "0.4.0", diff --git a/scripts/CONTRIBUTORS b/scripts/CONTRIBUTORS deleted file mode 100644 index f833e6e..0000000 --- a/scripts/CONTRIBUTORS +++ /dev/null @@ -1,6 +0,0 @@ -# People who have contributed to the js-data-rethinkdb project. -# -# This file is controlled by scripts/authors.js -# -# Names should be added to this file as: -# [commit count] Name diff --git a/scripts/authors.js b/scripts/authors.js deleted file mode 100644 index 5ba1712..0000000 --- a/scripts/authors.js +++ /dev/null @@ -1,46 +0,0 @@ -var fs = require('fs') -var exec = require('child_process').exec -var path = require('path') - -console.log('Writing AUTHORS file...') - -var authorsFile = fs.readFileSync(path.join(__dirname, '/AUTHORS'), { - encoding: 'utf-8' -}) -var contributorsFile = fs.readFileSync(path.join(__dirname, '/CONTRIBUTORS'), { - encoding: 'utf-8' -}) - -var tty = process.platform === 'win32' ? 'CON' : '/dev/tty' - -exec('git shortlog -s -e < ' + tty, function (err, stdout, stderr) { - if (err) { - console.error(err) - process.exit(-1) - } else { - var lines = stdout.split('\n') - var countsAndNames = lines.map(function (line) { - return line.split('\t') - }) - var names = countsAndNames.map(function (pair) { - return pair[1] - }) - - // Add to or otherwise modify "names" if necessary - - fs.writeFileSync(path.join(__dirname, '/../AUTHORS'), authorsFile + names.join('\n'), { - encoding: 'utf-8' - }) - console.log('Done!') - console.log('Writing CONTRIBUTORS file...') - - names = lines - - // Add to or otherwise modify "names" if necessary - - fs.writeFileSync(path.join(__dirname, '/../CONTRIBUTORS'), contributorsFile + names.join('\n'), { - encoding: 'utf-8' - }) - console.log('Done!') - } -}) diff --git a/src/index.js b/src/index.js index 05a0087..3355cec 100644 --- a/src/index.js +++ b/src/index.js @@ -281,6 +281,22 @@ Object.defineProperty(RethinkDBAdapter, '__super__', { */ RethinkDBAdapter.extend = utils.extend +/** + * Details of the current version of the `js-data-rethinkdb` module. + * + * @name RethinkDBAdapter.version + * @type {Object} + * @property {string} full The full semver value. + * @property {number} major The major version number. + * @property {number} minor The minor version number. + * @property {number} patch The patch version number. + * @property {(string|boolean)} alpha The alpha version value, otherwise `false` + * if the current version is not alpha. + * @property {(string|boolean)} beta The beta version value, otherwise `false` + * if the current version is not beta. + */ +RethinkDBAdapter.version = '<%= version %>' + RethinkDBAdapter.OPERATORS = OPERATORS utils.addHiddenPropsToTarget(RethinkDBAdapter.prototype, {