js-data-rethinkdb
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
@@ -0,1 +1,33 @@ | ||
##### 3.0.0-beta.2 - 29 April 2016 | ||
###### Breaking changes | ||
- How you must now import in ES2015: | ||
```js | ||
import RethinkDBAdapter from 'js-data-rethinkdb' | ||
const adapter = new RethinkDBAdapter() | ||
``` | ||
or | ||
```js | ||
import {RethinkDBAdapter, version} from 'js-data-rethinkdb' | ||
console.log(version) | ||
const adapter = new RethinkDBAdapter() | ||
``` | ||
- How you must now import in ES5: | ||
```js | ||
var JSDataRethinkDB = require('js-data-rethinkdb') | ||
var RethinkDBAdapter = JSDataRethinkDB.RethinkDBAdapter | ||
var adapter = new RethinkDBAdapter() | ||
``` | ||
- `OPERATORS` is now an export, not a static property of the `RethinkDBAdapter` class. | ||
- Moved some `dist` files to `release` to reduce noise | ||
###### Other | ||
- Upgraded dependencies | ||
- Improved JSDoc comments | ||
- Now using js-data JSDoc template | ||
##### 3.0.0-beta.1 - 17 April 2016 | ||
@@ -2,0 +34,0 @@ |
@@ -6,13 +6,8 @@ 'use strict'; | ||
var jsData = require('js-data'); | ||
var Adapter = require('js-data-adapter'); | ||
var Adapter__default = _interopDefault(Adapter); | ||
var jsDataAdapter = require('js-data-adapter'); | ||
var rethinkdbdash = _interopDefault(require('rethinkdbdash')); | ||
var underscore = _interopDefault(require('mout/string/underscore')); | ||
var withoutRelations = function withoutRelations(mapper, props) { | ||
return jsData.utils.omit(props, mapper.relationFields || []); | ||
}; | ||
var __super__ = jsDataAdapter.Adapter.prototype; | ||
var __super__ = Adapter__default.prototype; | ||
var DEFAULTS = { | ||
@@ -98,3 +93,3 @@ /** | ||
* | ||
* @name RethinkDBAdapter.OPERATORS | ||
* @name module:js-data-rethinkdb.OPERATORS | ||
* @property {Function} == Equality operator. | ||
@@ -156,2 +151,4 @@ * @property {Function} != Inequality operator. | ||
Object.freeze(OPERATORS); | ||
/** | ||
@@ -179,14 +176,17 @@ * RethinkDBAdapter class. | ||
* @extends Adapter | ||
* @param {Object} [opts] Configuration opts. | ||
* @param {string} [opts.authKey=""] RethinkDB authorization key. | ||
* @param {number} [opts.bufferSize=10] Buffer size for connection pool. | ||
* @param {Object} [opts] Configuration options. | ||
* @param {string} [opts.authKey=""] See {@link RethinkDBAdapter#authKey}. | ||
* @param {number} [opts.bufferSize=10] See {@link RethinkDBAdapter#bufferSize}. | ||
* @param {string} [opts.db="test"] Default database. | ||
* @param {boolean} [opts.debug=false] Whether to log debugging information. | ||
* @param {string} [opts.host="localhost"] RethinkDB host. | ||
* @param {number} [opts.max=50] Maximum connections in pool. | ||
* @param {number} [opts.min=10] Minimum connections in pool. | ||
* @param {Object} [opts.operators] Override the default predicate functions for | ||
* specified operators. | ||
* @param {number} [opts.port=28015] RethinkDB port. | ||
* @param {boolean} [opts.raw=false] Whether to return a more detailed response object. | ||
* @param {boolean} [opts.debug=false] See {@link Adapter#debug}. | ||
* @param {Object} [opts.deleteOpts={}] See {@link RethinkDBAdapter#deleteOpts}. | ||
* @param {string} [opts.host="localhost"] See {@link RethinkDBAdapter#host}. | ||
* @param {Object} [opts.insertOpts={}] See {@link RethinkDBAdapter#insertOpts}. | ||
* @param {number} [opts.max=50] See {@link RethinkDBAdapter#max}. | ||
* @param {number} [opts.min=10] See {@link RethinkDBAdapter#min}. | ||
* @param {Object} [opts.operators] See {@link RethinkDBAdapter#operators}. | ||
* @param {number} [opts.port=28015] See {@link RethinkDBAdapter#port}. | ||
* @param {boolean} [opts.raw=false] See {@link Adapter#raw}. | ||
* @param {Object} [opts.runOpts={}] See {@link RethinkDBAdapter#runOpts}. | ||
* @param {Object} [opts.updateOpts={}] See {@link RethinkDBAdapter#updateOpts}. | ||
*/ | ||
@@ -198,3 +198,3 @@ function RethinkDBAdapter(opts) { | ||
jsData.utils.fillIn(opts, DEFAULTS); | ||
Adapter__default.call(self, opts); | ||
jsDataAdapter.Adapter.call(self, opts); | ||
@@ -250,2 +250,4 @@ /** | ||
jsData.utils.fillIn(self.operators, OPERATORS); | ||
/** | ||
@@ -265,3 +267,3 @@ * The rethinkdbdash instance used by this adapter. Use this directly when you | ||
// Setup prototype inheritance from Adapter | ||
RethinkDBAdapter.prototype = Object.create(Adapter__default.prototype, { | ||
RethinkDBAdapter.prototype = Object.create(jsDataAdapter.Adapter.prototype, { | ||
constructor: { | ||
@@ -277,3 +279,3 @@ value: RethinkDBAdapter, | ||
configurable: true, | ||
value: Adapter__default | ||
value: jsDataAdapter.Adapter | ||
}); | ||
@@ -284,36 +286,23 @@ | ||
* | ||
* @example <caption>Using the ES2015 class syntax.</caption> | ||
* class MyRethinkDBAdapter extends RethinkDBAdapter {...} | ||
* const adapter = new MyRethinkDBAdapter() | ||
* | ||
* @example <caption>Using {@link RethinkDBAdapter.extend}.</caption> | ||
* var instanceProps = {...} | ||
* var classProps = {...} | ||
* | ||
* var MyRethinkDBAdapter = RethinkDBAdapter.extend(instanceProps, classProps) | ||
* var adapter = new MyRethinkDBAdapter() | ||
* | ||
* @name RethinkDBAdapter.extend | ||
* @method | ||
* @param {Object} [instanceProps] Properties that will be added to the | ||
* prototype of the RethinkDBAdapter. | ||
* prototype of the Subclass. | ||
* @param {Object} [classProps] Properties that will be added as static | ||
* properties to the RethinkDBAdapter itself. | ||
* @return {Object} RethinkDBAdapter of `RethinkDBAdapter`. | ||
* properties to the Subclass itself. | ||
* @return {Constructor} Subclass of `RethinkDBAdapter`. | ||
*/ | ||
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, { | ||
@@ -429,3 +418,3 @@ _handleErrors: function _handleErrors(cursor) { | ||
return self.selectTable(mapper, opts).get(id).update(withoutRelations(mapper, props), updateOpts).run(self.getOpt('runOpts', opts)).then(function (cursor) { | ||
return self.selectTable(mapper, opts).get(id).update(jsDataAdapter.withoutRelations(mapper, props), updateOpts).run(self.getOpt('runOpts', opts)).then(function (cursor) { | ||
var record = void 0; | ||
@@ -450,3 +439,3 @@ self._handleErrors(cursor); | ||
return self.filterSequence(self.selectTable(mapper, opts), query).update(withoutRelations(mapper, props), updateOpts).run(self.getOpt('runOpts', opts)).then(function (cursor) { | ||
return self.filterSequence(self.selectTable(mapper, opts), query).update(jsDataAdapter.withoutRelations(mapper, props), updateOpts).run(self.getOpt('runOpts', opts)).then(function (cursor) { | ||
var records = []; | ||
@@ -521,3 +510,3 @@ self._handleErrors(cursor); | ||
jsData.utils.forOwn(query, function (config, keyword) { | ||
if (Adapter.reserved.indexOf(keyword) === -1) { | ||
if (jsDataAdapter.reserved.indexOf(keyword) === -1) { | ||
if (jsData.utils.isObject(config)) { | ||
@@ -886,3 +875,3 @@ query.where[keyword] = config; | ||
var ownOps = this.operators || {}; | ||
return jsData.utils.isUndefined(opts.operators[operator]) ? ownOps[operator] || OPERATORS[operator] : opts.operators[operator]; | ||
return jsData.utils.isUndefined(opts.operators[operator]) ? ownOps[operator] : opts.operators[operator]; | ||
}, | ||
@@ -1011,3 +1000,28 @@ | ||
module.exports = RethinkDBAdapter; | ||
/** | ||
* Details of the current version of the `js-data-rethinkdb` module. | ||
* | ||
* @name module:js-data-rethinkdb.version | ||
* @type {Object} | ||
* @property {string} version.full The full semver value. | ||
* @property {number} version.major The major version number. | ||
* @property {number} version.minor The minor version number. | ||
* @property {number} version.patch The patch version number. | ||
* @property {(string|boolean)} version.alpha The alpha version value, | ||
* otherwise `false` if the current version is not alpha. | ||
* @property {(string|boolean)} version.beta The beta version value, | ||
* otherwise `false` if the current version is not beta. | ||
*/ | ||
var version = { | ||
beta: 2, | ||
full: '3.0.0-beta.2', | ||
major: 3, | ||
minor: 0, | ||
patch: 0 | ||
}; | ||
exports.OPERATORS = OPERATORS; | ||
exports.RethinkDBAdapter = RethinkDBAdapter; | ||
exports.version = version; | ||
exports['default'] = RethinkDBAdapter; | ||
//# sourceMappingURL=js-data-rethinkdb.js.map |
{ | ||
"name": "js-data-rethinkdb", | ||
"description": "RethinkDB adapter for js-data.", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"homepage": "https://github.com/js-data/js-data-rethinkdb", | ||
@@ -13,2 +13,9 @@ "repository": { | ||
"main": "./dist/js-data-rethinkdb.js", | ||
"typings": "./dist/js-data-rethinkdb.d.ts", | ||
"files": [ | ||
"dist/", | ||
"src/", | ||
"AUTHORS", | ||
"CONTRIBUTORS" | ||
], | ||
"keywords": [ | ||
@@ -34,8 +41,9 @@ "data", | ||
"afterEach" | ||
] | ||
], | ||
"ignore": ["dist/"] | ||
}, | ||
"scripts": { | ||
"lint": "repo-tools lint src/index.js mocha.start.js test/**/*.js scripts/**.js rollup.config.js", | ||
"lint": "repo-tools lint \"**/*.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", | ||
"doc": "jsdoc -c conf.json src node_modules/js-data-adapter/src", | ||
"watch": "watch \"npm run bundle\" src/", | ||
@@ -46,31 +54,24 @@ "build": "npm run lint && npm run bundle", | ||
"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 | codecov || true" | ||
"release": "npm test && npm run doc && repo-tools updates && repo-tools changelog && repo-tools authors", | ||
"ci": "npm run test && cat coverage/lcov.info | codecov" | ||
}, | ||
"dependencies": { | ||
"js-data-adapter": "~0.3.0", | ||
"js-data-adapter": "~0.6.0", | ||
"mout": "1.0.0" | ||
}, | ||
"peerDependencies": { | ||
"js-data": "^3.0.0-beta.1", | ||
"js-data": "^3.0.0-beta.3", | ||
"rethinkdbdash": ">=1.15.0" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "6.7.6", | ||
"babel-polyfill": "6.7.4", | ||
"babel-preset-es2015-rollup": "1.1.1", | ||
"chai": "3.5.0", | ||
"ink-docstrap": "1.1.4", | ||
"istanbul": "0.4.3", | ||
"js-data-adapter-tests": "^2.0.0-alpha.15", | ||
"js-data-repo-tools": "0.3.0", | ||
"jsdoc": "3.4.0", | ||
"mocha": "2.4.5", | ||
"rollup": "0.25.8", | ||
"js-data-repo-tools": "0.5.0", | ||
"rollup": "0.26.1", | ||
"rollup-plugin-babel": "2.4.0", | ||
"sinon": "1.17.3", | ||
"source-map-support": "0.4.0", | ||
"watch": "0.17.1" | ||
"watch": "0.18.0" | ||
} | ||
} |
@@ -10,73 +10,17 @@ <img src="https://raw.githubusercontent.com/js-data/js-data/master/js-data.png" alt="js-data logo" title="js-data" align="right" width="96" height="96" /> | ||
[![Coverage Status][cov_b]][cov_l] | ||
[![Codacy][cod_b]][cod_l] | ||
RethinkDB adapter for [js-data](http://www.js-data.io/). | ||
To get started, visit __[http://js-data.io](http://www.js-data.io)__. | ||
To get started, visit __[http://js-data.io](http://www.js-data.io/docs/js-data-rethinkdb)__. | ||
## Table of contents | ||
## Links | ||
* [Quick start](#quick-start) | ||
* [Example App](#example-app) | ||
* [Guides and Tutorials](#guides-and-tutorials) | ||
* [API Reference Docs](#api-reference-docs) | ||
* [Community](#community) | ||
* [Support](#support) | ||
* [Contributing](#contributing) | ||
* [License](#license) | ||
* [Quick start](http://www.js-data.io/docs/home#quick-start) - Get started in 5 minutes | ||
* [Guides and Tutorials](http://www.js-data.io/docs/home) - Learn how to use JSData | ||
* [`RethinkDBAdapter` Guide](http://www.js-data.io/docs/js-data-rethinkdb) - Learn how to use `RethinkDBAdapter` | ||
* [API Reference Docs](http://api.js-data.io) - Explore components, methods, options, etc. | ||
* [Community & Support](http://js-data.io/docs/community) - Find solutions and chat with the community | ||
* [General Contributing Guide](http://js-data.io/docs/contributing) - Give back and move the project forward | ||
* [Contributing to js-data-rethinkdb](https://github.com/js-data/js-data-rethinkdb/blob/master/.github/CONTRIBUTING.md) | ||
## Quick Start | ||
`npm install --save js-data js-data-rethinkdb rethinkdbdash`. | ||
```js | ||
// Use Container instead of DataStore on the server | ||
import {Container} from 'js-data' | ||
import RethinkDBAdapter from 'js-data-rethinkdb' | ||
// Create a store to hold your Mappers | ||
const store = new Container() | ||
// Create an instance of RethinkDBAdapter with default settings | ||
const adapter = new RethinkDBAdapter() | ||
// Mappers in "store" will use the RethinkDB adapter by default | ||
store.registerAdapter('rethinkdb', adapter, { default: true }) | ||
// Create a Mapper that maps to a "user" table | ||
store.defineMapper('user') | ||
``` | ||
```js | ||
async function findAllAdminUsers () { | ||
// Find all users where "user.role" == "admin" | ||
return await store.findAll('user', { | ||
role: 'admin' | ||
}) | ||
} | ||
``` | ||
## Example App | ||
[js-data-examples/server/rethinkdb](https://github.com/js-data/js-data-examples/tree/master/server/rethinkdb) | ||
## Guides and Tutorials | ||
[Get started at http://js-data.io](http://js-data.io) | ||
## API Reference Docs | ||
[Visit http://api.js-data.io](http://api.js-data.io). | ||
## Community | ||
[Explore the Community](http://js-data.io/docs/community). | ||
## Support | ||
[Find out how to Get Support](http://js-data.io/docs/support). | ||
## Contributing | ||
[Read the Contributing Guide](http://js-data.io/docs/contributing). | ||
## License | ||
@@ -96,9 +40,7 @@ | ||
[npm_l]: https://www.npmjs.org/package/js-data-rethinkdb | ||
[circle_b]: https://img.shields.io/circleci/project/js-data/js-data-rethinkdb/master.svg?style=flat | ||
[circle_l]: https://circleci.com/gh/js-data/js-data-rethinkdb/tree/master | ||
[circle_b]: https://img.shields.io/circleci/project/js-data/js-data-rethinkdb.svg?style=flat | ||
[circle_l]: https://circleci.com/gh/js-data/js-data-rethinkdb | ||
[dn_b]: https://img.shields.io/npm/dm/js-data-rethinkdb.svg?style=flat | ||
[dn_l]: https://www.npmjs.org/package/js-data-rethinkdb | ||
[cov_b]: https://img.shields.io/coveralls/js-data/js-data-rethinkdb/master.svg?style=flat | ||
[cov_l]: https://coveralls.io/github/js-data/js-data-rethinkdb?branch=master | ||
[cod_b]: https://img.shields.io/codacy/69206fcb0df6462ca559610af32fd1fb.svg | ||
[cod_l]: https://www.codacy.com/app/jasondobry/js-data-rethinkdb/dashboard | ||
[cov_b]: https://img.shields.io/codecov/c/github/js-data/js-data-rethinkdb.svg?style=flat | ||
[cov_l]: https://codecov.io/github/js-data/js-data-rethinkdb |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
130114
9
1907
0
10
45
+ Addedjs-data-adapter@0.6.2(transitive)
- Removedjs-data-adapter@0.3.0(transitive)
Updatedjs-data-adapter@~0.6.0