Skip to content

Commit

Permalink
3.0.0-alpha.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry committed Feb 27, 2016
1 parent 8bf87a0 commit 0a3b8a9
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 46 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
##### 3.0.0-alpha.4 - 26 February 2016

###### Other
- Finished JSDoc comments

##### 3.0.0-alpha.3 - 26 February 2016

###### Backwards compatible API changes
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
# Names should be added to this file as:
# [commit count] Name <email address>
1 InternalFX <[email protected]>
45 Jason Dobry <[email protected]>
48 Jason Dobry <[email protected]>
2 Ollie Relph <[email protected]>
44 changes: 22 additions & 22 deletions dist/js-data-rethinkdb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js-data-rethinkdb.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "js-data-rethinkdb",
"description": "RethinkDB adapter for js-data.",
"version": "3.0.0-alpha.3",
"version": "3.0.0-alpha.4",
"homepage": "https://github.com/js-data/js-data-rethinkdb",
"repository": {
"type": "git",
Expand Down Expand Up @@ -60,7 +60,7 @@
"coveralls": "2.11.8",
"ink-docstrap": "1.1.2",
"istanbul": "0.4.2",
"js-data-adapter-tests": "^2.0.0-alpha.8",
"js-data-adapter-tests": "^2.0.0-alpha.9",
"jsdoc": "3.4.0",
"mocha": "2.4.5",
"rollup": "0.25.4",
Expand Down
40 changes: 20 additions & 20 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
return this.r.db(isUndefined(opts.db) ? this.db : opts.db)
},

selectTable (Resource, opts) {
return this.selectDb(opts).table(Resource.table || underscore(Resource.name))
selectTable (mapper, opts) {
return this.selectDb(opts).table(mapper.table || underscore(mapper.name))
},

filterSequence (sequence, params) {
Expand Down Expand Up @@ -673,7 +673,7 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
},

/**
* TODO
* Return the foreignKey from the given record for the provided relationship.
*
* There may be reasons why you may want to override this method, like when
* the id of the parent doesn't exactly match up to the key on the child.
Expand All @@ -682,18 +682,18 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
* @method
* @return {*}
*/
makeHasManyForeignKey (Resource, def, record) {
makeHasManyForeignKey (mapper, def, record) {
return def.getForeignKey(record)
},

/**
* TODO
* Load a hasMany relationship.
*
* @name RethinkDBAdapter#loadHasMany
* @method
* @return {Promise}
*/
loadHasMany (Resource, def, records, __opts) {
loadHasMany (mapper, def, records, __opts) {
const self = this
let singular = false

Expand All @@ -702,7 +702,7 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
records = [records]
}
const IDs = records.map(function (record) {
return self.makeHasManyForeignKey(Resource, def, record)
return self.makeHasManyForeignKey(mapper, def, record)
})
const query = {}
const criteria = query[def.foreignKey] = {}
Expand All @@ -722,7 +722,7 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
attached = relatedItems
} else {
relatedItems.forEach(function (relatedItem) {
if (get(relatedItem, def.foreignKey) === record[Resource.idAttribute]) {
if (get(relatedItem, def.foreignKey) === record[mapper.idAttribute]) {
attached.push(relatedItem)
}
})
Expand All @@ -733,17 +733,17 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
},

/**
* TODO
* Load a hasOne relationship.
*
* @name RethinkDBAdapter#loadHasOne
* @method
* @return {Promise}
*/
loadHasOne (Resource, def, records, __opts) {
loadHasOne (mapper, def, records, __opts) {
if (isObject(records) && !isArray(records)) {
records = [records]
}
return this.loadHasMany(Resource, def, records, __opts).then(function () {
return this.loadHasMany(mapper, def, records, __opts).then(function () {
records.forEach(function (record) {
const relatedData = def.getLocalField(record)
if (isArray(relatedData) && relatedData.length) {
Expand All @@ -754,18 +754,18 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
},

/**
* TODO
* Return the foreignKey from the given record for the provided relationship.
*
* @name RethinkDBAdapter#makeBelongsToForeignKey
* @method
* @return {*}
*/
makeBelongsToForeignKey (Resource, def, record) {
makeBelongsToForeignKey (mapper, def, record) {
return def.getForeignKey(record)
},

/**
* TODO
* Load a belongsTo relationship.
*
* @name RethinkDBAdapter#loadBelongsTo
* @method
Expand Down Expand Up @@ -815,7 +815,7 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
* @param {boolean} [opts.raw=false] Whether to return a more detailed
* response object.
* @param {Object} [opts.runOpts] Options to pass to r#run.
* @param {string[]} [opts.with=[]] TODO
* @param {string[]} [opts.with=[]] Relations to eager load.
* @return {Promise}
*/
find (mapper, id, opts) {
Expand Down Expand Up @@ -846,9 +846,9 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
op = opts.op = 'beforeFind'
return resolve(self[op](mapper, id, opts))
}).then(function () {
op = opts.op = 'find'
self.dbg(op, id, opts)
return self.selectTable(mapper, opts).get(id).run(self.getOpt('runOpts', opts))
op = opts.op = 'find'
self.dbg(op, id, opts)
return self.selectTable(mapper, opts).get(id).run(self.getOpt('runOpts', opts))
}).then(function (_record) {
if (!_record) {
return
Expand Down Expand Up @@ -924,7 +924,7 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
* @param {boolean} [opts.raw=false] Whether to return a more detailed
* response object.
* @param {Object} [opts.runOpts] Options to pass to r#run.
* @param {string[]} [opts.with=[]] TODO
* @param {string[]} [opts.with=[]] Relations to eager load.
* @return {Promise}
*/
findAll (mapper, query, opts) {
Expand Down Expand Up @@ -1060,7 +1060,7 @@ addHiddenPropsToTarget(RethinkDBAdapter.prototype, {
},

/**
* TODO
* Logging utility method.
*
* @name RethinkDBAdapter#log
* @method
Expand Down

0 comments on commit 0a3b8a9

Please sign in to comment.