From 31dd8d0d1f66782676a9117f521579468c0a6430 Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Wed, 29 Jun 2016 12:56:23 -0700 Subject: [PATCH] 3.0.0-beta.7 --- dist/js-data-rethinkdb.js | 6 ++++-- dist/js-data-rethinkdb.js.map | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dist/js-data-rethinkdb.js b/dist/js-data-rethinkdb.js index 3e9de03..ebb9a73 100644 --- a/dist/js-data-rethinkdb.js +++ b/dist/js-data-rethinkdb.js @@ -1,5 +1,7 @@ 'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); + function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var jsData = require('js-data'); @@ -1109,8 +1111,8 @@ jsData.utils.addHiddenPropsToTarget(RethinkDBAdapter.prototype, { * otherwise `false` if the current version is not beta. */ var version = { - beta: 6, - full: '3.0.0-beta.6', + beta: 7, + full: '3.0.0-beta.7', major: 3, minor: 0, patch: 0 diff --git a/dist/js-data-rethinkdb.js.map b/dist/js-data-rethinkdb.js.map index 6bf87eb..fd759ec 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 {\n Adapter,\n reserved\n} from 'js-data-adapter'\nimport rethinkdbdash from 'rethinkdbdash'\nimport underscore from 'mout/string/underscore'\n\nconst __super__ = Adapter.prototype\n\nconst R_OPTS_DEFAULTS = {\n db: 'test'\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 module:js-data-rethinkdb.OPERATORS\n * @property {Function} = Equality operator.\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 */\nexport const OPERATORS = {\n '=': equal,\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\nObject.freeze(OPERATORS)\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 options.\n * @param {boolean} [opts.debug=false] See {@link Adapter#debug}.\n * @param {Object} [opts.deleteOpts={}] See {@link RethinkDBAdapter#deleteOpts}.\n * @param {Object} [opts.insertOpts={}] See {@link RethinkDBAdapter#insertOpts}.\n * @param {Object} [opts.operators={@link module:js-data-rethinkdb.OPERATORS}] See {@link RethinkDBAdapter#operators}.\n * @param {Object} [opts.r] See {@link RethinkDBAdapter#r}.\n * @param {boolean} [opts.raw=false] See {@link Adapter#raw}.\n * @param {Object} [opts.rOpts={}] See {@link RethinkDBAdapter#rOpts}.\n * @param {Object} [opts.runOpts={}] See {@link RethinkDBAdapter#runOpts}.\n * @param {Object} [opts.updateOpts={}] See {@link RethinkDBAdapter#updateOpts}.\n */\nexport function RethinkDBAdapter (opts) {\n utils.classCallCheck(this, RethinkDBAdapter)\n opts || (opts = {})\n\n // Setup non-enumerable properties\n Object.defineProperties(this, {\n /**\n * The rethinkdbdash instance used by this adapter. Use this directly when\n * you need to write custom queries.\n *\n * @example Use default instance.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter()\n * adapter.r.dbDrop('foo').then(...)\n *\n * @example Configure default instance.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter({\n * rOpts: {\n * user: 'myUser',\n * password: 'myPassword'\n * }\n * })\n * adapter.r.dbDrop('foo').then(...)\n *\n * @example Provide a custom instance.\n * import rethinkdbdash from 'rethinkdbdash'\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const r = rethinkdbdash()\n * const adapter = new RethinkDBAdapter({\n * r: r\n * })\n * adapter.r.dbDrop('foo').then(...)\n *\n * @name RethinkDBAdapter#r\n * @type {Object}\n */\n r: {\n writable: true,\n value: undefined\n },\n databases: {\n value: {}\n },\n indices: {\n value: {}\n },\n tables: {\n value: {}\n }\n })\n\n Adapter.call(this, opts)\n\n /**\n * Default options to pass to r#insert.\n *\n * @name RethinkDBAdapter#insertOpts\n * @type {Object}\n * @default {}\n */\n this.insertOpts || (this.insertOpts = {})\n utils.fillIn(this.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 this.updateOpts || (this.updateOpts = {})\n utils.fillIn(this.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 this.deleteOpts || (this.deleteOpts = {})\n utils.fillIn(this.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 this.runOpts || (this.runOpts = {})\n utils.fillIn(this.runOpts, RUN_OPTS_DEFAULTS)\n\n /**\n * Override the default predicate functions for the specified operators.\n *\n * @name RethinkDBAdapter#operators\n * @type {Object}\n * @default {}\n */\n this.operators || (this.operators = {})\n utils.fillIn(this.operators, OPERATORS)\n\n /**\n * Options to pass to a new `rethinkdbdash` instance, if one was not provided\n * at {@link RethinkDBAdapter#r}. See the [rethinkdbdash README][readme] for\n * instance options.\n *\n * [readme]: https://github.com/neumino/rethinkdbdash#importing-the-driver\n *\n * @example Connect to localhost:8080, and let the driver find other instances.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter({\n * rOpts: {\n * discovery: true\n * }\n * })\n *\n * @example Connect to and only to localhost:8080.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter()\n *\n * @example Do not create a connection pool.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter({\n * rOpts: {\n * pool: false\n * }\n * })\n *\n * @example Connect to a cluster seeding from `192.168.0.100`, `192.168.0.101`, `192.168.0.102`.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter({\n * rOpts: {\n * servers: [\n * { host: '192.168.0.100', port: 28015 },\n * { host: '192.168.0.101', port: 28015 },\n * { host: '192.168.0.102', port: 28015 }\n * ]\n * }\n * })\n *\n * @name RethinkDBAdapter#rOpts\n * @see https://github.com/neumino/rethinkdbdash#importing-the-driver\n * @type {Object}\n */\n this.rOpts || (this.rOpts = {})\n utils.fillIn(this.rOpts, R_OPTS_DEFAULTS)\n\n this.r || (this.r = rethinkdbdash(this.rOpts))\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 * @example Using the ES2015 class syntax.\n * class MyRethinkDBAdapter extends RethinkDBAdapter {...}\n * const adapter = new MyRethinkDBAdapter()\n *\n * @example Using {@link RethinkDBAdapter.extend}.\n * var instanceProps = {...}\n * var classProps = {...}\n *\n * var MyRethinkDBAdapter = RethinkDBAdapter.extend(instanceProps, classProps)\n * var adapter = new MyRethinkDBAdapter()\n *\n * @method RethinkDBAdapter.extend\n * @static\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the subclass.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the subclass itself.\n * @return {Constructor} Subclass of `RethinkDBAdapter`.\n */\nRethinkDBAdapter.extend = utils.extend\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 opts || (opts = {})\n query || (query = {})\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .count()\n .run(this.getOpt('runOpts', opts))\n .then((count) => [count, {}])\n },\n\n _create (mapper, props, opts) {\n props || (props = {})\n opts || (opts = {})\n\n const insertOpts = this.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n\n return this.selectTable(mapper, opts)\n .insert(props, insertOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n this._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 props || (props = {})\n opts || (opts = {})\n\n const insertOpts = this.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n\n return this.selectTable(mapper, opts)\n .insert(props, insertOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n this._handleErrors(cursor)\n let records = []\n if (cursor && cursor.changes && cursor.changes.length && cursor.changes) {\n records = cursor.changes.map((change) => change.new_val)\n }\n return [records, cursor]\n })\n },\n\n _destroy (mapper, id, opts) {\n opts || (opts = {})\n\n return this.selectTable(mapper, opts)\n .get(id)\n .delete(this.getOpt('deleteOpts', opts))\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n this._handleErrors(cursor)\n return [undefined, cursor]\n })\n },\n\n _destroyAll (mapper, query, opts) {\n query || (query = {})\n opts || (opts = {})\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .delete(this.getOpt('deleteOpts', opts))\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n this._handleErrors(cursor)\n return [undefined, cursor]\n })\n },\n\n _find (mapper, id, opts) {\n opts || (opts = {})\n\n return this.selectTable(mapper, opts)\n .get(id)\n .run(this.getOpt('runOpts', opts))\n .then((record) => [record, {}])\n },\n\n _findAll (mapper, query, opts) {\n opts || (opts = {})\n query || (query = {})\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .run(this.getOpt('runOpts', opts))\n .then((records) => [records, {}])\n },\n\n _sum (mapper, field, query, opts) {\n if (!utils.isString(field)) {\n throw new Error('field must be a string!')\n }\n opts || (opts = {})\n query || (query = {})\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .sum(field)\n .run(this.getOpt('runOpts', opts))\n .then((sum) => [sum, {}])\n },\n\n _update (mapper, id, props, opts) {\n props || (props = {})\n opts || (opts = {})\n\n const updateOpts = this.getOpt('updateOpts', opts)\n updateOpts.returnChanges = true\n\n return this.selectTable(mapper, opts)\n .get(id)\n .update(props, updateOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n let record\n this._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 props || (props = {})\n query || (query = {})\n opts || (opts = {})\n\n const updateOpts = this.getOpt('updateOpts', opts)\n updateOpts.returnChanges = true\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .update(props, updateOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n let records = []\n this._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length) {\n records = cursor.changes.map((change) => change.new_val)\n }\n return [records, cursor]\n })\n },\n\n _updateMany (mapper, records, opts) {\n records || (records = [])\n opts || (opts = {})\n\n const insertOpts = this.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n insertOpts.conflict = 'update'\n\n return this.selectTable(mapper, opts)\n .insert(records, insertOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n records = []\n this._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length) {\n records = cursor.changes.map((change) => change.new_val)\n }\n return [records, cursor]\n })\n },\n\n _applyWhereFromObject (where) {\n const fields = []\n const ops = []\n const predicates = []\n utils.forOwn(where, (clause, field) => {\n if (!utils.isObject(clause)) {\n clause = {\n '==': clause\n }\n }\n utils.forOwn(clause, (expr, op) => {\n fields.push(field)\n ops.push(op)\n predicates.push(expr)\n })\n })\n return {\n fields,\n ops,\n predicates\n }\n },\n\n _applyWhereFromArray (where) {\n const groups = []\n where.forEach((_where, i) => {\n if (utils.isString(_where)) {\n return\n }\n const prev = where[i - 1]\n const parser = utils.isArray(_where) ? this._applyWhereFromArray : this._applyWhereFromObject\n const group = parser.call(this, _where)\n if (prev === 'or') {\n group.isOr = true\n }\n groups.push(group)\n })\n groups.isArray = true\n return groups\n },\n\n _testObjectGroup (rql, group, row, opts) {\n let i\n const r = this.r\n const fields = group.fields\n const ops = group.ops\n const predicates = group.predicates\n const len = ops.length\n for (i = 0; i < len; i++) {\n let op = ops[i]\n const isOr = op.charAt(0) === '|'\n op = isOr ? op.substr(1) : op\n const predicateFn = this.getOperator(op, opts)\n if (predicateFn) {\n const predicateResult = predicateFn(r, row, fields[i], predicates[i])\n if (isOr) {\n rql = rql ? rql.or(predicateResult) : predicateResult\n } else {\n rql = rql ? rql.and(predicateResult) : predicateResult\n }\n } else {\n throw new Error(`Operator ${op} not supported!`)\n }\n }\n return rql\n },\n\n _testArrayGroup (rql, groups, row, opts) {\n let i\n const len = groups.length\n for (i = 0; i < len; i++) {\n const group = groups[i]\n let subQuery\n if (group.isArray) {\n subQuery = this._testArrayGroup(rql, group, row, opts)\n } else {\n subQuery = this._testObjectGroup(null, group, row, opts)\n }\n if (groups[i - 1]) {\n if (group.isOr) {\n rql = rql.or(subQuery)\n } else {\n rql = rql.and(subQuery)\n }\n } else {\n rql = rql ? rql.and(subQuery) : subQuery\n }\n }\n return rql\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 r = this.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, (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 let groups\n\n if (utils.isObject(query.where) && Object.keys(query.where).length !== 0) {\n groups = this._applyWhereFromArray([query.where])\n } else if (utils.isArray(query.where)) {\n groups = this._applyWhereFromArray(query.where)\n }\n\n if (groups) {\n rql = rql.filter((row) => this._testArrayGroup(null, groups, row, opts) || true)\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 selectDb (opts) {\n return this.r.db(utils.isUndefined(opts.db) ? this.rOpts.db : opts.db)\n },\n\n selectTable (mapper, opts) {\n return this.selectDb(opts).table(mapper.table || underscore(mapper.name))\n },\n\n waitForDb (opts) {\n opts || (opts = {})\n const db = utils.isUndefined(opts.db) ? this.rOpts.db : opts.db\n if (!this.databases[db]) {\n this.databases[db] = this.r.branch(\n this.r.dbList().contains(db),\n true,\n this.r.dbCreate(db)\n ).run()\n }\n return this.databases[db]\n },\n\n waitForTable (mapper, opts) {\n opts || (opts = {})\n const table = utils.isString(mapper) ? mapper : (mapper.table || underscore(mapper.name))\n let db = utils.isUndefined(opts.db) ? this.rOpts.db : opts.db\n return this.waitForDb(opts).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, opts) {\n opts || (opts = {})\n let db = utils.isUndefined(opts.db) ? this.rOpts.db : opts.db\n return this.waitForDb(opts).then(() => this.waitForTable(table, opts)).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 opts || (opts = {})\n query || (query = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.count.call(this, mapper, query, opts))\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 props || (props = {})\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.create.call(this, mapper, props, opts))\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 props || (props = {})\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.createMany.call(this, mapper, props, opts))\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 opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.destroy.call(this, mapper, id, opts))\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 opts || (opts = {})\n query || (query = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.destroyAll.call(this, mapper, query, opts))\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 opts || (opts = {})\n opts.with || (opts.with = [])\n\n const relationList = mapper.relationList || []\n let tasks = [this.waitForTable(mapper, opts)]\n\n relationList.forEach((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(this.waitForIndex(mapper.table || underscore(mapper.name), def.foreignKey, opts))\n } else {\n tasks.push(this.waitForIndex(relationDef.table || underscore(relationDef.name), def.foreignKey, opts))\n }\n }\n })\n return Promise.all(tasks).then(() => __super__.find.call(this, mapper, id, opts))\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 opts || (opts = {})\n opts.with || (opts.with = [])\n query || (query = {})\n\n const relationList = mapper.relationList || []\n let tasks = [this.waitForTable(mapper, opts)]\n\n relationList.forEach((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(this.waitForIndex(mapper.table || underscore(mapper.name), def.foreignKey, opts))\n } else {\n tasks.push(this.waitForIndex(relationDef.table || underscore(relationDef.name), def.foreignKey, opts))\n }\n }\n })\n return Promise.all(tasks).then(() => __super__.findAll.call(this, mapper, query, opts))\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] : 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 opts || (opts = {})\n query || (query = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.sum.call(this, mapper, field, query, opts))\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 props || (props = {})\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.update.call(this, mapper, id, props, opts))\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 props || (props = {})\n query || (query = {})\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.updateAll.call(this, mapper, props, query, opts))\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 records || (records = [])\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.updateMany.call(this, mapper, records, opts))\n }\n})\n\n/**\n * Details of the current version of the `js-data-rethinkdb` module.\n *\n * @example ES2015 modules import\n * import {version} from 'js-data-rethinkdb'\n * console.log(version.full)\n *\n * @example CommonJS import\n * var version = require('js-data-rethinkdb').version\n * console.log(version.full)\n *\n * @name module:js-data-rethinkdb.version\n * @type {Object}\n * @property {string} version.full The full semver value.\n * @property {number} version.major The major version number.\n * @property {number} version.minor The minor version number.\n * @property {number} version.patch The patch version number.\n * @property {(string|boolean)} version.alpha The alpha version value,\n * otherwise `false` if the current version is not alpha.\n * @property {(string|boolean)} version.beta The beta version value,\n * otherwise `false` if the current version is not beta.\n */\nexport const version = '<%= version %>'\n\n/**\n * {@link RethinkDBAdapter} class.\n *\n * @example ES2015 modules import\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter()\n *\n * @example CommonJS import\n * var RethinkDBAdapter = require('js-data-rethinkdb').RethinkDBAdapter\n * var adapter = new RethinkDBAdapter()\n *\n * @name module:js-data-rethinkdb.RethinkDBAdapter\n * @see RethinkDBAdapter\n * @type {Constructor}\n */\n\n/**\n * Registered as `js-data-rethinkdb` in NPM.\n *\n * @example Install from NPM\n * npm i --save js-data-rethinkdb@beta js-data@beta rethinkdbdash\n *\n * @example ES2015 modules import\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter()\n *\n * @example CommonJS import\n * var RethinkDBAdapter = require('js-data-rethinkdb').RethinkDBAdapter\n * var adapter = new RethinkDBAdapter()\n *\n * @module js-data-rethinkdb\n */\n"],"names":["Adapter","utils","reserved"],"mappings":";;;;;;;;;AAQA,IAAM,YAAYA,sBAAQ,SAA1B;;AAEA,IAAM,kBAAkB;MAClB;CADN;AAGA,IAAM,uBAAuB,EAA7B;AACA,IAAM,uBAAuB,EAA7B;AACA,IAAM,uBAAuB,EAA7B;AACA,IAAM,oBAAoB,EAA1B;;AAEA,IAAM,QAAQ,SAAR,KAAQ,CAAU,CAAV,EAAa,GAAb,EAAkB,KAAlB,EAAyB,KAAzB,EAAgC;SACrC,IAAI,KAAJ,EAAW,OAAX,CAAmB,IAAnB,EAAyB,EAAzB,CAA4B,KAA5B,CAAP;CADF;;AAIA,IAAM,WAAW,SAAX,QAAW,CAAU,CAAV,EAAa,GAAb,EAAkB,KAAlB,EAAyB,KAAzB,EAAgC;SACxC,IAAI,KAAJ,EAAW,OAAX,CAAmB,IAAnB,EAAyB,EAAzB,CAA4B,KAA5B,CAAP;CADF;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,AAAO,IAAM,YAAY;OAClB,KADkB;QAEjB,KAFiB;SAGhB,KAHgB;QAIjB,QAJiB;SAKhB,QALgB;OAMlB,WAAU,CAAV,EAAa,GAAb,EAAkB,KAAlB,EAAyB,KAAzB,EAAgC;WAC5B,IAAI,KAAJ,EAAW,OAAX,CAAmB,IAAnB,EAAyB,EAAzB,CAA4B,KAA5B,CAAP;GAPqB;QASjB,WAAU,CAAV,EAAa,GAAb,EAAkB,KAAlB,EA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B;;;gBACrB,UAAU,EAAtB;aACS,OAAO,EAAhB;;WAEO,KAAK,YAAL,CAAkB,MAAlB,EAA0B,IAA1B,EACJ,IADI,CACC;aAAM,UAAU,UAAV,CAAqB,IAArB,UAAgC,MAAhC,EAAwC,OAAxC,EAAiD,IAAjD,CAAN;KADD,CAAP;;CAnuBJ;;;;;;;;;;;;;;;;;;;;;;;;AA8vBA,AAAO,IAAM,UAAU,gBAAhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":null,"sources":["../src/index.js"],"sourcesContent":["import {utils} from 'js-data'\nimport {\n Adapter,\n reserved\n} from 'js-data-adapter'\nimport rethinkdbdash from 'rethinkdbdash'\nimport underscore from 'mout/string/underscore'\n\nconst __super__ = Adapter.prototype\n\nconst R_OPTS_DEFAULTS = {\n db: 'test'\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 module:js-data-rethinkdb.OPERATORS\n * @property {Function} = Equality operator.\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 */\nexport const OPERATORS = {\n '=': equal,\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\nObject.freeze(OPERATORS)\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 options.\n * @param {boolean} [opts.debug=false] See {@link Adapter#debug}.\n * @param {Object} [opts.deleteOpts={}] See {@link RethinkDBAdapter#deleteOpts}.\n * @param {Object} [opts.insertOpts={}] See {@link RethinkDBAdapter#insertOpts}.\n * @param {Object} [opts.operators={@link module:js-data-rethinkdb.OPERATORS}] See {@link RethinkDBAdapter#operators}.\n * @param {Object} [opts.r] See {@link RethinkDBAdapter#r}.\n * @param {boolean} [opts.raw=false] See {@link Adapter#raw}.\n * @param {Object} [opts.rOpts={}] See {@link RethinkDBAdapter#rOpts}.\n * @param {Object} [opts.runOpts={}] See {@link RethinkDBAdapter#runOpts}.\n * @param {Object} [opts.updateOpts={}] See {@link RethinkDBAdapter#updateOpts}.\n */\nexport function RethinkDBAdapter (opts) {\n utils.classCallCheck(this, RethinkDBAdapter)\n opts || (opts = {})\n\n // Setup non-enumerable properties\n Object.defineProperties(this, {\n /**\n * The rethinkdbdash instance used by this adapter. Use this directly when\n * you need to write custom queries.\n *\n * @example Use default instance.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter()\n * adapter.r.dbDrop('foo').then(...)\n *\n * @example Configure default instance.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter({\n * rOpts: {\n * user: 'myUser',\n * password: 'myPassword'\n * }\n * })\n * adapter.r.dbDrop('foo').then(...)\n *\n * @example Provide a custom instance.\n * import rethinkdbdash from 'rethinkdbdash'\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const r = rethinkdbdash()\n * const adapter = new RethinkDBAdapter({\n * r: r\n * })\n * adapter.r.dbDrop('foo').then(...)\n *\n * @name RethinkDBAdapter#r\n * @type {Object}\n */\n r: {\n writable: true,\n value: undefined\n },\n databases: {\n value: {}\n },\n indices: {\n value: {}\n },\n tables: {\n value: {}\n }\n })\n\n Adapter.call(this, opts)\n\n /**\n * Default options to pass to r#insert.\n *\n * @name RethinkDBAdapter#insertOpts\n * @type {Object}\n * @default {}\n */\n this.insertOpts || (this.insertOpts = {})\n utils.fillIn(this.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 this.updateOpts || (this.updateOpts = {})\n utils.fillIn(this.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 this.deleteOpts || (this.deleteOpts = {})\n utils.fillIn(this.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 this.runOpts || (this.runOpts = {})\n utils.fillIn(this.runOpts, RUN_OPTS_DEFAULTS)\n\n /**\n * Override the default predicate functions for the specified operators.\n *\n * @name RethinkDBAdapter#operators\n * @type {Object}\n * @default {}\n */\n this.operators || (this.operators = {})\n utils.fillIn(this.operators, OPERATORS)\n\n /**\n * Options to pass to a new `rethinkdbdash` instance, if one was not provided\n * at {@link RethinkDBAdapter#r}. See the [rethinkdbdash README][readme] for\n * instance options.\n *\n * [readme]: https://github.com/neumino/rethinkdbdash#importing-the-driver\n *\n * @example Connect to localhost:8080, and let the driver find other instances.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter({\n * rOpts: {\n * discovery: true\n * }\n * })\n *\n * @example Connect to and only to localhost:8080.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter()\n *\n * @example Do not create a connection pool.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter({\n * rOpts: {\n * pool: false\n * }\n * })\n *\n * @example Connect to a cluster seeding from `192.168.0.100`, `192.168.0.101`, `192.168.0.102`.\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter({\n * rOpts: {\n * servers: [\n * { host: '192.168.0.100', port: 28015 },\n * { host: '192.168.0.101', port: 28015 },\n * { host: '192.168.0.102', port: 28015 }\n * ]\n * }\n * })\n *\n * @name RethinkDBAdapter#rOpts\n * @see https://github.com/neumino/rethinkdbdash#importing-the-driver\n * @type {Object}\n */\n this.rOpts || (this.rOpts = {})\n utils.fillIn(this.rOpts, R_OPTS_DEFAULTS)\n\n this.r || (this.r = rethinkdbdash(this.rOpts))\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 * @example Using the ES2015 class syntax.\n * class MyRethinkDBAdapter extends RethinkDBAdapter {...}\n * const adapter = new MyRethinkDBAdapter()\n *\n * @example Using {@link RethinkDBAdapter.extend}.\n * var instanceProps = {...}\n * var classProps = {...}\n *\n * var MyRethinkDBAdapter = RethinkDBAdapter.extend(instanceProps, classProps)\n * var adapter = new MyRethinkDBAdapter()\n *\n * @method RethinkDBAdapter.extend\n * @static\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the subclass.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the subclass itself.\n * @return {Constructor} Subclass of `RethinkDBAdapter`.\n */\nRethinkDBAdapter.extend = utils.extend\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 opts || (opts = {})\n query || (query = {})\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .count()\n .run(this.getOpt('runOpts', opts))\n .then((count) => [count, {}])\n },\n\n _create (mapper, props, opts) {\n props || (props = {})\n opts || (opts = {})\n\n const insertOpts = this.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n\n return this.selectTable(mapper, opts)\n .insert(props, insertOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n this._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 props || (props = {})\n opts || (opts = {})\n\n const insertOpts = this.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n\n return this.selectTable(mapper, opts)\n .insert(props, insertOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n this._handleErrors(cursor)\n let records = []\n if (cursor && cursor.changes && cursor.changes.length && cursor.changes) {\n records = cursor.changes.map((change) => change.new_val)\n }\n return [records, cursor]\n })\n },\n\n _destroy (mapper, id, opts) {\n opts || (opts = {})\n\n return this.selectTable(mapper, opts)\n .get(id)\n .delete(this.getOpt('deleteOpts', opts))\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n this._handleErrors(cursor)\n return [undefined, cursor]\n })\n },\n\n _destroyAll (mapper, query, opts) {\n query || (query = {})\n opts || (opts = {})\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .delete(this.getOpt('deleteOpts', opts))\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n this._handleErrors(cursor)\n return [undefined, cursor]\n })\n },\n\n _find (mapper, id, opts) {\n opts || (opts = {})\n\n return this.selectTable(mapper, opts)\n .get(id)\n .run(this.getOpt('runOpts', opts))\n .then((record) => [record, {}])\n },\n\n _findAll (mapper, query, opts) {\n opts || (opts = {})\n query || (query = {})\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .run(this.getOpt('runOpts', opts))\n .then((records) => [records, {}])\n },\n\n _sum (mapper, field, query, opts) {\n if (!utils.isString(field)) {\n throw new Error('field must be a string!')\n }\n opts || (opts = {})\n query || (query = {})\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .sum(field)\n .run(this.getOpt('runOpts', opts))\n .then((sum) => [sum, {}])\n },\n\n _update (mapper, id, props, opts) {\n props || (props = {})\n opts || (opts = {})\n\n const updateOpts = this.getOpt('updateOpts', opts)\n updateOpts.returnChanges = true\n\n return this.selectTable(mapper, opts)\n .get(id)\n .update(props, updateOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n let record\n this._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 props || (props = {})\n query || (query = {})\n opts || (opts = {})\n\n const updateOpts = this.getOpt('updateOpts', opts)\n updateOpts.returnChanges = true\n\n return this.filterSequence(this.selectTable(mapper, opts), query)\n .update(props, updateOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n let records = []\n this._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length) {\n records = cursor.changes.map((change) => change.new_val)\n }\n return [records, cursor]\n })\n },\n\n _updateMany (mapper, records, opts) {\n records || (records = [])\n opts || (opts = {})\n\n const insertOpts = this.getOpt('insertOpts', opts)\n insertOpts.returnChanges = true\n insertOpts.conflict = 'update'\n\n return this.selectTable(mapper, opts)\n .insert(records, insertOpts)\n .run(this.getOpt('runOpts', opts))\n .then((cursor) => {\n records = []\n this._handleErrors(cursor)\n if (cursor && cursor.changes && cursor.changes.length) {\n records = cursor.changes.map((change) => change.new_val)\n }\n return [records, cursor]\n })\n },\n\n _applyWhereFromObject (where) {\n const fields = []\n const ops = []\n const predicates = []\n utils.forOwn(where, (clause, field) => {\n if (!utils.isObject(clause)) {\n clause = {\n '==': clause\n }\n }\n utils.forOwn(clause, (expr, op) => {\n fields.push(field)\n ops.push(op)\n predicates.push(expr)\n })\n })\n return {\n fields,\n ops,\n predicates\n }\n },\n\n _applyWhereFromArray (where) {\n const groups = []\n where.forEach((_where, i) => {\n if (utils.isString(_where)) {\n return\n }\n const prev = where[i - 1]\n const parser = utils.isArray(_where) ? this._applyWhereFromArray : this._applyWhereFromObject\n const group = parser.call(this, _where)\n if (prev === 'or') {\n group.isOr = true\n }\n groups.push(group)\n })\n groups.isArray = true\n return groups\n },\n\n _testObjectGroup (rql, group, row, opts) {\n let i\n const r = this.r\n const fields = group.fields\n const ops = group.ops\n const predicates = group.predicates\n const len = ops.length\n for (i = 0; i < len; i++) {\n let op = ops[i]\n const isOr = op.charAt(0) === '|'\n op = isOr ? op.substr(1) : op\n const predicateFn = this.getOperator(op, opts)\n if (predicateFn) {\n const predicateResult = predicateFn(r, row, fields[i], predicates[i])\n if (isOr) {\n rql = rql ? rql.or(predicateResult) : predicateResult\n } else {\n rql = rql ? rql.and(predicateResult) : predicateResult\n }\n } else {\n throw new Error(`Operator ${op} not supported!`)\n }\n }\n return rql\n },\n\n _testArrayGroup (rql, groups, row, opts) {\n let i\n const len = groups.length\n for (i = 0; i < len; i++) {\n const group = groups[i]\n let subQuery\n if (group.isArray) {\n subQuery = this._testArrayGroup(rql, group, row, opts)\n } else {\n subQuery = this._testObjectGroup(null, group, row, opts)\n }\n if (groups[i - 1]) {\n if (group.isOr) {\n rql = rql.or(subQuery)\n } else {\n rql = rql.and(subQuery)\n }\n } else {\n rql = rql ? rql.and(subQuery) : subQuery\n }\n }\n return rql\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 r = this.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, (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 let groups\n\n if (utils.isObject(query.where) && Object.keys(query.where).length !== 0) {\n groups = this._applyWhereFromArray([query.where])\n } else if (utils.isArray(query.where)) {\n groups = this._applyWhereFromArray(query.where)\n }\n\n if (groups) {\n rql = rql.filter((row) => this._testArrayGroup(null, groups, row, opts) || true)\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 selectDb (opts) {\n return this.r.db(utils.isUndefined(opts.db) ? this.rOpts.db : opts.db)\n },\n\n selectTable (mapper, opts) {\n return this.selectDb(opts).table(mapper.table || underscore(mapper.name))\n },\n\n waitForDb (opts) {\n opts || (opts = {})\n const db = utils.isUndefined(opts.db) ? this.rOpts.db : opts.db\n if (!this.databases[db]) {\n this.databases[db] = this.r.branch(\n this.r.dbList().contains(db),\n true,\n this.r.dbCreate(db)\n ).run()\n }\n return this.databases[db]\n },\n\n waitForTable (mapper, opts) {\n opts || (opts = {})\n const table = utils.isString(mapper) ? mapper : (mapper.table || underscore(mapper.name))\n let db = utils.isUndefined(opts.db) ? this.rOpts.db : opts.db\n return this.waitForDb(opts).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, opts) {\n opts || (opts = {})\n let db = utils.isUndefined(opts.db) ? this.rOpts.db : opts.db\n return this.waitForDb(opts).then(() => this.waitForTable(table, opts)).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 opts || (opts = {})\n query || (query = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.count.call(this, mapper, query, opts))\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 props || (props = {})\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.create.call(this, mapper, props, opts))\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 props || (props = {})\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.createMany.call(this, mapper, props, opts))\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 opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.destroy.call(this, mapper, id, opts))\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 opts || (opts = {})\n query || (query = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.destroyAll.call(this, mapper, query, opts))\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 opts || (opts = {})\n opts.with || (opts.with = [])\n\n const relationList = mapper.relationList || []\n let tasks = [this.waitForTable(mapper, opts)]\n\n relationList.forEach((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(this.waitForIndex(mapper.table || underscore(mapper.name), def.foreignKey, opts))\n } else {\n tasks.push(this.waitForIndex(relationDef.table || underscore(relationDef.name), def.foreignKey, opts))\n }\n }\n })\n return Promise.all(tasks).then(() => __super__.find.call(this, mapper, id, opts))\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 opts || (opts = {})\n opts.with || (opts.with = [])\n query || (query = {})\n\n const relationList = mapper.relationList || []\n let tasks = [this.waitForTable(mapper, opts)]\n\n relationList.forEach((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(this.waitForIndex(mapper.table || underscore(mapper.name), def.foreignKey, opts))\n } else {\n tasks.push(this.waitForIndex(relationDef.table || underscore(relationDef.name), def.foreignKey, opts))\n }\n }\n })\n return Promise.all(tasks).then(() => __super__.findAll.call(this, mapper, query, opts))\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] : 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 opts || (opts = {})\n query || (query = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.sum.call(this, mapper, field, query, opts))\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 props || (props = {})\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.update.call(this, mapper, id, props, opts))\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 props || (props = {})\n query || (query = {})\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.updateAll.call(this, mapper, props, query, opts))\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 records || (records = [])\n opts || (opts = {})\n\n return this.waitForTable(mapper, opts)\n .then(() => __super__.updateMany.call(this, mapper, records, opts))\n }\n})\n\n/**\n * Details of the current version of the `js-data-rethinkdb` module.\n *\n * @example ES2015 modules import\n * import {version} from 'js-data-rethinkdb'\n * console.log(version.full)\n *\n * @example CommonJS import\n * var version = require('js-data-rethinkdb').version\n * console.log(version.full)\n *\n * @name module:js-data-rethinkdb.version\n * @type {Object}\n * @property {string} version.full The full semver value.\n * @property {number} version.major The major version number.\n * @property {number} version.minor The minor version number.\n * @property {number} version.patch The patch version number.\n * @property {(string|boolean)} version.alpha The alpha version value,\n * otherwise `false` if the current version is not alpha.\n * @property {(string|boolean)} version.beta The beta version value,\n * otherwise `false` if the current version is not beta.\n */\nexport const version = '<%= version %>'\n\n/**\n * {@link RethinkDBAdapter} class.\n *\n * @example ES2015 modules import\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter()\n *\n * @example CommonJS import\n * var RethinkDBAdapter = require('js-data-rethinkdb').RethinkDBAdapter\n * var adapter = new RethinkDBAdapter()\n *\n * @name module:js-data-rethinkdb.RethinkDBAdapter\n * @see RethinkDBAdapter\n * @type {Constructor}\n */\n\n/**\n * Registered as `js-data-rethinkdb` in NPM.\n *\n * @example Install from NPM\n * npm i --save js-data-rethinkdb@beta js-data@beta rethinkdbdash\n *\n * @example ES2015 modules import\n * import {RethinkDBAdapter} from 'js-data-rethinkdb'\n * const adapter = new RethinkDBAdapter()\n *\n * @example CommonJS import\n * var RethinkDBAdapter = require('js-data-rethinkdb').RethinkDBAdapter\n * var adapter = new RethinkDBAdapter()\n *\n * @module js-data-rethinkdb\n */\n"],"names":["Adapter","utils","reserved"],"mappings":";;;;;;;;;;;AAQA,IAAM,YAAYA,sBAAQ,SAA1B;;AAEA,IAAM,kBAAkB;MAClB;CADN;AAGA,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