Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redink

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redink - npm Package Compare versions

Comparing version 3.0.0-alpha.1 to 3.0.0-alpha.2

12

dist/Connection.js

@@ -18,3 +18,3 @@ 'use strict';

var Connection = function () {
function Connection(conn, schema, data) {
function Connection(conn, type, data) {
_classCallCheck(this, Connection);

@@ -26,4 +26,4 @@

if (!schema) {
throw new TypeError('Argument "schema" is required to instantiate a Connection.');
if (!type) {
throw new TypeError('Argument "type" is required to instantiate a Connection.');
}

@@ -35,3 +35,3 @@

this.schema = schema;
this.type = type;
this.pageInfo = data.pageInfo;

@@ -44,3 +44,3 @@ this.totalCount = data.totalCount;

return {
node: new _Node2.default(conn, schema, node),
node: new _Node2.default(conn, type, node),
cursor: cursor

@@ -109,2 +109,2 @@ };

exports.default = Connection;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Db25uZWN0aW9uLmpzIl0sIm5hbWVzIjpbIkNvbm5lY3Rpb24iLCJjb25uIiwic2NoZW1hIiwiZGF0YSIsIlR5cGVFcnJvciIsInBhZ2VJbmZvIiwidG90YWxDb3VudCIsImVkZ2VzIiwibWFwIiwibm9kZSIsImN1cnNvciIsImZuIiwiZXZlcnkiLCJzb21lIiwiaW5pdGlhbFZhbHVlIiwicmVkdWNlIiwiZm9yRWFjaCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFBQTs7Ozs7Ozs7SUFFcUJBLFU7QUFDbkIsc0JBQVlDLElBQVosRUFBa0JDLE1BQWxCLEVBQTBCQyxJQUExQixFQUFnQztBQUFBOztBQUM5QixRQUFJLENBQUNGLElBQUwsRUFBVztBQUNULFlBQU0sSUFBSUcsU0FBSixDQUFjLDBEQUFkLENBQU47QUFDRDs7QUFFRCxRQ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MuZXZlcnkoKHsgbm9kZSwgY3Vyc29yIH0pID0+IGZuKG5vZGUsIGN1cnNvcikpO1xuICB9XG5cbiAgc29tZShmbikge1xuICAgIHJldHVybiB0aGlzLmVkZ2VzLnNvbWUoKHsgbm9kZSwgY3Vyc29yIH0pID0+IGZuKG5vZGUsIGN1cnNvcikpO1xuICB9XG5cbiAgcmVkdWNlKGZuLCBpbml0aWFsVmFsdWUgPSBbXSkge1xuICAgIHJldHVybiB0aGlzLmVkZ2VzLnJlZHVjZSgoeyBub2RlLCBjdXJzb3IgfSkgPT4gZm4obm9kZSwgY3Vyc29yKSwgaW5pdGlhbFZhbHVlKTtcbiAgfVxuXG4gIGZvckVhY2goZm4pIHtcbiAgICB0aGlzLmVkZ2VzLmZvckVhY2goKHsgbm9kZSwgY3Vyc29yIH0pID0+IGZuKG5vZGUsIGN1cnNvcikpO1xuICB9XG59XG4iXX0=

@@ -13,3 +13,3 @@ 'use strict';

exports.default = function (record, schema, conn) {
exports.default = function (record, type, conn) {
var isTrue = function isTrue(check) {

@@ -34,4 +34,4 @@ return check === true;

return Promise.all(Object.keys(schema.relationships).reduce(function (prev, next) {
var relationship = schema.relationships[next];
return Promise.all(Object.keys(type.relationships).reduce(function (prev, next) {
var relationship = type.relationships[next];
var relation = relationship.relation;

@@ -66,2 +66,2 @@ var inverse = relationship.inverse;

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25zdHJhaW50cy9jcmVhdGUuanMiXSwibmFtZXMiOlsicmVjb3JkIiwic2NoZW1hIiwiY29ubiIsImlzVHJ1ZSIsImNoZWNrIiwiY2hlY2tQYXNzIiwicmVzcG9uc2UiLCJldmVyeSIsImNoZWNrTWFueVRvTWFueSIsImRhdGEiLCJmaWVsZCIsIkFycmF5IiwiaXNBcnJheSIsIkVycm9yIiwiY2hlY2tCZWxvbmdzVG8iLCJQcm9taXNlIiwiYWxsIiwiT2JqZWN0Ii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ICAgc3dpdGNoIChyZWxhdGlvbikge1xuICAgICAgY2FzZSAnaGFzTWFueSc6XG4gICAgICAgIC8vIGNoZWNrIHJlbGF0aW9uc2hpcCB3aXRoIG9yaWdpbmFsIHJlbGF0aW9uIGBoYXNNYW55YFxuICAgICAgICByZXR1cm4gWy4uLnByZXYsIGlzSGFzTWFueUNvbXBsaWFudChyZWxhdGlvbnNoaXAsIGRhdGEsIGNvbm4pXTtcblxuICAgICAgY2FzZSAnaGFzT25lJzpcbiAgICAgICAgLy8gY2hlY2sgcmVsYXRpb25zaGlwIHdpdGggb3JpZ2luYWwgcmVsYXRpb24gYGhhc09uZWBcbiAgICAgICAgcmV0dXJuIFsuLi5wcmV2LCBpc0hhc09uZUNvbXBsaWFudChyZWxhdGlvbnNoaXAsIGRhdGEsIGNvbm4pXTtcblxuICAgICAgY2FzZSAnYmVsb25nc1RvJzpcbiAgICAgICAgLy8gY2hlY2sgcmVsYXRpb25zaGlwIHdpdGggb3JpZ2luYWwgcmVsYXRpb24gYGJlbG9uZ3NUb2BcbiAgICAgICAgcmV0dXJuIFsuLi5wcmV2LCBpc0JlbG9uZ3NUb0NvbXBsaWFudChyZWxhdGlvbnNoaXAsIGRhdGEsIGNvbm4pXTtcblxuICAgICAgZGVmYXVsdDpcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIHJlbGF0aW9uc2hpcCBvZiB0eXBlICcke3JlbGF0aW9ufSdgKTtcbiAgICB9XG4gIH0sIFtdKSkudGhlbihjaGVja1Bhc3MpO1xufTtcbiJdfQ==

@@ -10,3 +10,3 @@ 'use strict';

exports.default = function (relationshipObject, ids, conn) {
var schema = relationshipObject.schema;
var type = relationshipObject.type;
var _relationshipObject$i = relationshipObject.inverse;

@@ -19,6 +19,6 @@ var inverseRelation = _relationshipObject$i.relation;

case 'hasMany':
return (0, _checks.checkValidIds)(schema.type, ids, conn);
return (0, _checks.checkValidIds)(type.name, ids, conn);
case 'hasOne':
return (0, _checks.checkManyInverseHasOne)(schema.type, ids, inverseField, conn);
return (0, _checks.checkManyInverseHasOne)(type.name, ids, inverseField, conn);

@@ -30,2 +30,2 @@ case 'belongsTo':

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25zdHJhaW50cy9wdXNoLmpzIl0sIm5hbWVzIjpbInJlbGF0aW9uc2hpcE9iamVjdCIsImlkcyIsImNvbm4iLCJzY2hlbWEiLCJpbnZlcnNlIiwiaW52ZXJzZVJlbGF0aW9uIiwicmVsYXRpb24iLCJpbnZlcnNlRmllbGQiLCJmaWVsZCIsInR5cGUiLCJQcm9taXNlIiwicmVzb2x2ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7O2tCQUtlLFVBQUNBLGtCQUFELEVBQXFCQyxHQUFyQixFQUEwQkMsSUFBMUIsRUFBbUM7QUFBQSxNQUU5Q0MsTUFGOEMsR0FPNUNILGtCQVA0QyxDQUU5Q0csTUFGOEM7QUFBQSw4QkFPNUNILGtCQVA0QyxDQUc5Q0ksT0FIOEM7QUFBQSxNQUlsQ0MsZUFKa0MseUJBSTVDQyxRQUo0QztBQUFBLE1BS3JDQyxZQUxxQyx5QkFLNUNDLEtBTDRDOzs7QUFTaEQsVUFBUUgsZUFBUjtBQUNFLFNBQUssU0FBTDtBQUNFLGFBQU8sMkJBQWNGLE9BQU9NLElBQXJCLEVBQTJCUixHQUEzQixFQUFnQ0MsSUFBaEMsQ0FBUDs7QUFFRixTQUFLLFFBQUw7QUFDRSxhQUFPLG9DQUF1QkMsT0FBT00sSUFBOUIsRUFBb0NSLEdBQXBDLEVBQXlDTSxZQUF6QyxFQUF1REwsSUFBdkQsQ0FBUDs7QUFFRixTQUFLLFdBQUw7QUFDQTtBQUNFLGFBQU9RLFFBQVFDLE9BQVIsQ0FBZ0IsS0FBaEIsQ0FBUDtBQVRKO0FBV0QsQyIsImZpbGUiOiJwdXNoLmpzIiwic291cmNlc0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HJldHVybiBjaGVja1ZhbGlkSWRzKHR5cGUubmFtZSwgaWRzLCBjb25uKTtcblxuICAgIGNhc2UgJ2hhc09uZSc6XG4gICAgICByZXR1cm4gY2hlY2tNYW55SW52ZXJzZUhhc09uZSh0eXBlLm5hbWUsIGlkcywgaW52ZXJzZUZpZWxkLCBjb25uKTtcblxuICAgIGNhc2UgJ2JlbG9uZ3NUbyc6XG4gICAgZGVmYXVsdDpcbiAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoZmFsc2UpO1xuICB9XG59O1xuIl19

@@ -10,3 +10,3 @@ 'use strict';

exports.default = function (relationshipObject, id, conn) {
var schema = relationshipObject.schema;
var type = relationshipObject.type;
var relation = relationshipObject.relation;

@@ -22,6 +22,6 @@ var _relationshipObject$i = relationshipObject.inverse;

case 'hasMany':
return (0, _checks.checkValidId)(schema.type, id, conn);
return (0, _checks.checkValidId)(type.name, id, conn);
case 'hasOne':
return (0, _checks.checkInverseHasOne)(schema.type, id, inverseField, conn);
return (0, _checks.checkInverseHasOne)(type.name, id, inverseField, conn);

@@ -33,2 +33,2 @@ case 'belongsTo':

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25zdHJhaW50cy9wdXQuanMiXSwibmFtZXMiOlsicmVsYXRpb25zaGlwT2JqZWN0IiwiaWQiLCJjb25uIiwic2NoZW1hIiwicmVsYXRpb24iLCJpbnZlcnNlIiwiaW52ZXJzZVJlbGF0aW9uIiwiaW52ZXJzZUZpZWxkIiwiZmllbGQiLCJQcm9taXNlIiwicmVzb2x2ZSIsInR5cGUiXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBOztrQkFLZSxVQUFDQSxrQkFBRCxFQUFxQkMsRUFBckIsRUFBeUJDLElBQXpCLEVBQWtDO0FBQUEsTUFFN0NDLE1BRjZDLEdBUTNDSCxrQkFSMkMsQ0FFN0NHLE1BRjZDO0FBQUEsTUFHN0NDLFFBS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Vja0ludmVyc2VIYXNPbmUodHlwZS5uYW1lLCBpZCwgaW52ZXJzZUZpZWxkLCBjb25uKTtcblxuICAgIGNhc2UgJ2JlbG9uZ3NUbyc6XG4gICAgZGVmYXVsdDpcbiAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoZmFsc2UpO1xuICB9XG59O1xuIl19

@@ -11,3 +11,3 @@ 'use strict';

var inverse = relationship.inverse;
var type = relationship.type;
var name = relationship.name;
var relation = inverse.relation;

@@ -20,7 +20,7 @@ var field = inverse.field;

// check relationship with inverse relation `hasMany`
return (0, _checks.checkValidId)(type, data, conn);
return (0, _checks.checkValidId)(name, data, conn);
case 'hasOne':
// check relationship with inverse relation `hasOne`
return (0, _checks.checkInverseHasOne)(type, data, field, conn);
return (0, _checks.checkInverseHasOne)(name, data, field, conn);

@@ -31,2 +31,2 @@ default:

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb25zdHJhaW50cy91dGlscy9pc0JlbG9uZ3NUb0NvbXBsaWFudC5qcyJdLCJuYW1lcyI6WyJyZWxhdGlvbnNoaXAiLCJkYXRhIiwiY29ubiIsImludmVyc2UiLCJ0eXBlIiwicmVsYXRpb24iLCJmaWVsZCIsIkVycm9yIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTs7a0JBRWUsVUFBQ0EsWUFBRCxFQUFlQyxJQUFmLEVBQXFCQyxJQUFyQixFQUE4QjtBQUFBLE1BQ25DQyxPQURtQyxHQUNqQkgsWUFEaUIsQ0FDbkNHLE9BRG1DO0FBQUEsTUFDMUJDLElBRDBCLEdBQ2pCSixZQURpQixDQUMxQkksSUFEMEI7QUFBQSxNQUVuQ0MsUUFGbUMsR0FFZkYsT0FGZSxDQUVuQ0UsUUFGbUM7QUFBQSxNQUV6QkMsS0FGeUIsR0FFZkgsT0FGZSxDQUV6QkcsS0FGeUI7OztBQUkzQyxVQUFRRCxRQUFSO0FB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WRJZCwgY2hlY2tJbnZlcnNlSGFzT25lIH0gZnJvbSAnLi4vY2hlY2tzJztcblxuZXhwb3J0IGRlZmF1bHQgKHJlbGF0aW9uc2hpcCwgZGF0YSwgY29ubikgPT4ge1xuICBjb25zdCB7IGludmVyc2UsIG5hbWUgfSA9IHJlbGF0aW9uc2hpcDtcbiAgY29uc3QgeyByZWxhdGlvbiwgZmllbGQgfSA9IGludmVyc2U7XG5cbiAgc3dpdGNoIChyZWxhdGlvbikge1xuICAgIGNhc2UgJ2hhc01hbnknOlxuICAgICAgLy8gY2hlY2sgcmVsYXRpb25zaGlwIHdpdGggaW52ZXJzZSByZWxhdGlvbiBgaGFzTWFueWBcbiAgICAgIHJldHVybiBjaGVja1ZhbGlkSWQobmFtZSwgZGF0YSwgY29ubik7XG5cbiAgICBjYXNlICdoYXNPbmUnOlxuICAgICAgLy8gY2hlY2sgcmVsYXRpb25zaGlwIHdpdGggaW52ZXJzZSByZWxhdGlvbiBgaGFzT25lYFxuICAgICAgcmV0dXJuIGNoZWNrSW52ZXJzZUhhc09uZShuYW1lLCBkYXRhLCBmaWVsZCwgY29ubik7XG5cbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGludmVyc2UgcmVsYXRpb25zaGlwIG9mIHR5cGUgJyR7cmVsYXRpb259J2ApO1xuICB9XG59O1xuIl19

@@ -11,3 +11,3 @@ 'use strict';

var inverse = relationship.inverse;
var type = relationship.type;
var name = relationship.name;
var relation = inverse.relation;

@@ -22,7 +22,7 @@ var field = inverse.field;

// check relationship with inverse relation `hasMany`
return (0, _checks.checkValidIds)(type, data, conn);
return (0, _checks.checkValidIds)(name, data, conn);
case 'hasOne':
// check relationship with inverse relation `hasOne`
return (0, _checks.checkManyInverseHasOne)(type, data, field, conn);
return (0, _checks.checkManyInverseHasOne)(name, data, field, conn);

@@ -37,2 +37,2 @@ case 'belongsTo':

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJza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JztcblxuZXhwb3J0IGRlZmF1bHQgKHJlbGF0aW9uc2hpcCwgZGF0YSwgY29ubikgPT4ge1xuICBjb25zdCB7IGludmVyc2UsIG5hbWUgfSA9IHJlbGF0aW9uc2hpcDtcbiAgY29uc3QgeyByZWxhdGlvbiwgZmllbGQgfSA9IGludmVyc2U7XG5cbiAgaWYgKGRhdGEubGVuZ3RoID09PSAwKSByZXR1cm4gdHJ1ZTtcblxuICBzd2l0Y2ggKHJlbGF0aW9uKSB7XG4gICAgY2FzZSAnaGFzTWFueSc6XG4gICAgICAvLyBjaGVjayByZWxhdGlvbnNoaXAgd2l0aCBpbnZlcnNlIHJlbGF0aW9uIGBoYXNNYW55YFxuICAgICAgcmV0dXJuIGNoZWNrVmFsaWRJZHMobmFtZSwgZGF0YSwgY29ubik7XG5cbiAgICBjYXNlICdoYXNPbmUnOlxuICAgICAgLy8gY2hlY2sgcmVsYXRpb25zaGlwIHdpdGggaW52ZXJzZSByZWxhdGlvbiBgaGFzT25lYFxuICAgICAgcmV0dXJuIGNoZWNrTWFueUludmVyc2VIYXNPbmUobmFtZSwgZGF0YSwgZmllbGQsIGNvbm4pO1xuXG4gICAgY2FzZSAnYmVsb25nc1RvJzpcbiAgICAgIC8vIGNoZWNrIHJlbGF0aW9uc2hpcCB3aXRoIGludmVyc2UgcmVsYXRpb24gYGJlbG9uZ3NUb2BcbiAgICAgIHJldHVybiBmYWxzZTtcblxuICAgIGRlZmF1bHQ6XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoYEludmFsaWQgaW52ZXJzZSByZWxhdGlvbnNoaXAgb2YgdHlwZSAnJHtyZWxhdGlvbn0nYCk7XG4gIH1cbn07XG4iXX0=

@@ -11,3 +11,3 @@ 'use strict';

var inverse = relationship.inverse;
var type = relationship.type;
var name = relationship.name;
var relation = inverse.relation;

@@ -22,7 +22,7 @@ var field = inverse.field;

// check relationship with inverse relation `hasMany`
return (0, _checks.checkValidId)(type, data, conn);
return (0, _checks.checkValidId)(name, data, conn);
case 'hasOne':
// check relationship with inverse relation `hasOne`
return (0, _checks.checkInverseHasOne)(type, data, field, conn);
return (0, _checks.checkInverseHasOne)(name, data, field, conn);

@@ -37,2 +37,2 @@ case 'belongsTo':

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb25zdHJhaW50cy91dGlscy9pc0hhc09uZUNvbXBsaWFudC5qcyJdLCJuYW1lcyI6WyJyZWxhdGlvbnNoaXAiLCJkYXRhIiwiY29ubiIsImludmVyc2UiLCJ0eXBlIiwicmVsYXRpb24iLCJmaWVsZCIsIkVycm9yIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTs7a0JBRWUsVUFBQ0EsWUFBRCxFQUFlQyxJQUFmLEVBQXFCQyxJQUFyQixFQUE4QjtBQUFBLE1BQ25DQyxPQURtQyxHQUNqQkgsWUFEaUIsQ0FDbkNHLE9BRG1DO0FBQUEsTUFDMUJDLElBRDBCLEdBQ2pCSixZQURpQixDQUMxQkksSUFEMEI7QUFBQSxNQUVuQ0MsUUFGbUMsR0FFZkYsT0FGZSxDQUVuQ0UsUUFGbUM7QUFBQSxNQUV6QkMsS0FGeUIsR0FFZkgsT0FGZSxDQUV6QkcsS0FGeUI7OztBQUkzQyxNQUFJTCxTQUFTLEVBQWIsRUFBaUIsT0FBTyxJQUFQOztBQUVqQixVQUFRSSxRQUFSO0FBQ0UsU0FBSyxTQUFMO0FBQ0U7QUFDQSxhQUFPLDBCQUFhRCxJQUFiLEVBQW1CSCxJQUFuQixFQUF5QkMsSUFBekIsQ0FBUDs7QUFFRixTQUFLLFFBQUw7QUFDRTtBQUNBLGFBQU8sZ0NBQW1CRSxJQUFuQixFQUF5QkgsSUFBekIsRUFBK0JLLEtBQS9CLEVBQXNDSixJQUF0QyxDQUFQOztBQUVGLFNBQUssV0FBTDtBQUNFO0FBQ0EsYUFBTyxLQUFQOztBQUVGO0FBQ0UsWUFBTSxJQU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3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjaGVja1ZhbGlkSWQsIGNoZWNrSW52ZXJzZUhhc09uZSB9IGZyb20gJy4uL2NoZWNrcyc7XG5cbmV4cG9ydCBkZWZhdWx0IChyZWxhdGlvbnNoaXAsIGRhdGEsIGNvbm4pID0+IHtcbiAgY29uc3QgeyBpbnZlcnNlLCBuYW1lIH0gPSByZWxhdGlvbnNoaXA7XG4gIGNvbnN0IHsgcmVsYXRpb24sIGZpZWxkIH0gPSBpbnZlcnNlO1xuXG4gIGlmIChkYXRhID09PSAnJykgcmV0dXJuIHRydWU7XG5cbiAgc3dpdGNoIChyZWxhdGlvbikge1xuICAgIGNhc2UgJ2hhc01hbnknOlxuICAgICAgLy8gY2hlY2sgcmVsYXRpb25zaGlwIHdpdGggaW52ZXJzZSByZWxhdGlvbiBgaGFzTWFueWBcbiAgICAgIHJldHVybiBjaGVja1ZhbGlkSWQobmFtZSwgZGF0YSwgY29ubik7XG5cbiAgICBjYXNlICdoYXNPbmUnOlxuICAgICAgLy8gY2hlY2sgcmVsYXRpb25zaGlwIHdpdGggaW52ZXJzZSByZWxhdGlvbiBgaGFzT25lYFxuICAgICAgcmV0dXJuIGNoZWNrSW52ZXJzZUhhc09uZShuYW1lLCBkYXRhLCBmaWVsZCwgY29ubik7XG5cbiAgICBjYXNlICdiZWxvbmdzVG8nOlxuICAgICAgLy8gY2hlY2sgcmVsYXRpb25zaGlwIHdpdGggaW52ZXJzZSByZWxhdGlvbiBgYmVsb25nc1RvYFxuICAgICAgcmV0dXJuIGZhbHNlO1xuXG4gICAgZGVmYXVsdDpcbiAgICAgIHRocm93IG5ldyBFcnJvcihgSW52YWxpZCBpbnZlcnNlIHJlbGF0aW9uc2hpcCBvZiB0eXBlICcke3JlbGF0aW9ufSdgKTtcbiAgfVxufTtcbiJdfQ==

@@ -36,24 +36,18 @@ 'use strict';

* @class Model
* @param {Object} conn - RethinkDB connection object.
* @param {Object} conn
* @param {String} type
* @param {Schema} schema
*/
function Model(conn, type, schema) {
function Model(conn, type) {
_classCallCheck(this, Model);
if (!conn) {
throw new TypeError('A valid RethinkDB connection is required to instantiate a Node.');
throw new TypeError('Argument "conn" is required to instantiate a Model.');
}
if (!type) {
throw new TypeError('A valid type is required to instantiate a model.');
throw new TypeError('Argument "type" is required to instantiate a Model.');
}
if (!schema) {
throw new TypeError('A valid schema is required to instantiate a model.');
}
this.conn = conn;
this.type = type;
this.schema = schema;
}

@@ -97,8 +91,8 @@

var conn = this.conn;
var schema = this.schema;
var type = this.type;
var connection = (0, _utils.createConnection)(schema, _rethinkdb2.default.table(schema.type), options);
var connection = (0, _utils.createConnection)(type, _rethinkdb2.default.table(type.name), options);
return connection.run(conn).then(function (data) {
return new _Connection2.default(conn, schema, data);
return new _Connection2.default(conn, type, data);
});

@@ -150,9 +144,9 @@ }

var conn = this.conn;
var schema = this.schema;
var type = this.type;
var connection = (0, _utils.createConnection)(schema, _rethinkdb2.default.table(schema.type).getAll(value, { index: index }), options);
var connection = (0, _utils.createConnection)(type, _rethinkdb2.default.table(type.name).getAll(value, { index: index }), options);
return connection.run(conn).then(function (data) {
return new _Connection2.default(conn, schema, data);
return new _Connection2.default(conn, type, data);
});

@@ -215,12 +209,12 @@ }

var conn = this.conn;
var schema = this.schema;
var parentType = this.schema.type;
var _schema$relationships = schema.relationships[relationship];
var relatedType = _schema$relationships.type;
var relatedSchema = _schema$relationships.schema;
var relation = _schema$relationships.relation;
var inverse = _schema$relationships.inverse;
var type = this.type;
var parentName = this.type.name;
var _type$relationships$r = type.relationships[relationship];
var relatedName = _type$relationships$r.name;
var relatedSchema = _type$relationships$r.type;
var relation = _type$relationships$r.relation;
var inverse = _type$relationships$r.inverse;
var query = _rethinkdb2.default.table(relatedType);
var query = _rethinkdb2.default.table(relatedName);

@@ -231,3 +225,3 @@ if (relation === 'hasMany') {

} else {
query = query.getAll(_rethinkdb2.default.args(_rethinkdb2.default.table(parentType).get(id)(relationship)('id')));
query = query.getAll(_rethinkdb2.default.args(_rethinkdb2.default.table(parentName).get(id)(relationship)('id')));
}

@@ -240,3 +234,3 @@

query = query.get(_rethinkdb2.default.table(parentType).get(id)(relationship)('id'));
query = query.get(_rethinkdb2.default.table(parentName).get(id)(relationship)('id'));
query = (0, _utils.mergeRelationships)(query, relatedSchema, options);

@@ -271,11 +265,11 @@ query = (0, _utils.applyOptions)(query, options);

var conn = this.conn;
var schema = this.schema;
var type = this.type;
var query = _rethinkdb2.default.table(schema.type).get(id);
query = (0, _utils.mergeRelationships)(query, schema, options);
var query = _rethinkdb2.default.table(type.name).get(id);
query = (0, _utils.mergeRelationships)(query, type, options);
query = (0, _utils.applyOptions)(query, options);
return query.run(conn).then(function (data) {
return new _Node2.default(conn, schema, data);
return new _Node2.default(conn, type, data);
});

@@ -316,4 +310,4 @@ }

var conn = this.conn;
var schema = this.schema;
var type = schema.type;
var type = this.type;
var name = type.name;

@@ -326,3 +320,3 @@

return (0, _utils.normalizeRecord)(record, schema);
return (0, _utils.normalizeRecord)(record, type);
};

@@ -333,3 +327,3 @@

return _rethinkdb2.default.table(type).insert(normalizedRecord).run(conn)
return _rethinkdb2.default.table(name).insert(normalizedRecord).run(conn)

@@ -346,3 +340,3 @@ // retrieve the record that was just created

var syncRelationshipsArray = (0, _utils.syncRelationships)(record, schema, node.id);
var syncRelationshipsArray = (0, _utils.syncRelationships)(record, type, node.id);
return _rethinkdb2.default.do(syncRelationshipsArray).run(conn);

@@ -357,4 +351,4 @@ })

// check record and it's relationships for Redink constraints
return (0, _create2.default)(record, schema, conn).then(checkComplianceAndNormalizeRecord).then(createRecord);
// check record and its relationships for Redink constraints
return (0, _create2.default)(record, type, conn).then(checkComplianceAndNormalizeRecord).then(createRecord);
}

@@ -367,2 +361,2 @@ }]);

exports.default = Model;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Nb2RlbC5qcyJdLCJuYW1lcyI6WyJNb2RlbCIsImNvbm4i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WNvcmQpLnJ1bihjb25uKVxuXG4gICAgICAgIC8vIHJldHJpZXZlIHRoZSByZWNvcmQgdGhhdCB3YXMganVzdCBjcmVhdGVkXG4gICAgICAgIC50aGVuKCh7IGdlbmVyYXRlZF9rZXlzOiBrZXlzIH0pID0+IHRoaXMuZmV0Y2goa2V5c1swXSwgb3B0aW9ucykpXG5cbiAgICAgICAgLy8gY3JlYXRlIHRoZSBub2RlIGFuZCBzeW5jIGl0cyByZWxhdGlvbnNoaXBzXG4gICAgICAgIC50aGVuKG5vZGUgPT4ge1xuICAgICAgICAgIGNyZWF0ZWROb2RlID0gbm9kZTtcblxuICAgICAgICAgIGNvbnN0IHN5bmNSZWxhdGlvbnNoaXBzQXJyYXkgPSBzeW5jUmVsYXRpb25zaGlwcyhyZWNvcmQsIHNjaGVtYSwgbm9kZS5pZCk7XG4gICAgICAgICAgcmV0dXJuIHIuZG8oc3luY1JlbGF0aW9uc2hpcHNBcnJheSkucnVuKGNvbm4pO1xuICAgICAgICB9KVxuXG4gICAgICAgIC8vIHJldHVybiB0aGUgbm9kZVxuICAgICAgICAudGhlbigoKSA9PiBjcmVhdGVkTm9kZSk7XG4gICAgfTtcblxuICAgIC8vIGNoZWNrIHJlY29yZCBhbmQgaXQncyByZWxhdGlvbnNoaXBzIGZvciBSZWRpbmsgY29uc3RyYWludHNcbiAgICByZXR1cm4gaXNDcmVhdGVDb21wbGlhbnQocmVjb3JkLCBzY2hlbWEsIGNvbm4pXG4gICAgICAudGhlbihjaGVja0NvbXBsaWFuY2VBbmROb3JtYWxpemVSZWNvcmQpXG4gICAgICAudGhlbihjcmVhdGVSZWNvcmQpO1xuICB9XG59XG4iXX0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Nb2RlbC5qcyJdLCJuYW1lcyI6WyJNb2RlbCIsImNvbm4iLCJ0eXBlIiwiVHlwZUVycm9yIiwib3B0aW9ucyIsImNvbm5lY3Rpb24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gICAgICAgLnRoZW4oKCkgPT4gY3JlYXRlZE5vZGUpO1xuICAgIH07XG5cbiAgICAvLyBjaGVjayByZWNvcmQgYW5kIGl0cyByZWxhdGlvbnNoaXBzIGZvciBSZWRpbmsgY29uc3RyYWludHNcbiAgICByZXR1cm4gaXNDcmVhdGVDb21wbGlhbnQocmVjb3JkLCB0eXBlLCBjb25uKVxuICAgICAgLnRoZW4oY2hlY2tDb21wbGlhbmNlQW5kTm9ybWFsaXplUmVjb3JkKVxuICAgICAgLnRoZW4oY3JlYXRlUmVjb3JkKTtcbiAgfVxufVxuIl19

@@ -15,4 +15,4 @@ 'use strict';

exports.default = function (type, ids, field, idToRemove) {
return _rethinkdb2.default.table(type).getAll(_rethinkdb2.default.args(ids)).update(function (row) {
exports.default = function (name, ids, field, idToRemove) {
return _rethinkdb2.default.table(name).getAll(_rethinkdb2.default.args(ids)).update(function (row) {
return _defineProperty({}, field, {

@@ -25,2 +25,2 @@ id: idToRemove,

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL2FyY2hpdmVSZW1vdmVJZEZyb21NYW55UmVjb3Jkc0ZpZWxkLmpzIl0sIm5hbWVzIjpbInR5cGUiLCJpZHMiLCJmaWVsZCIsImlkVG9SZW1vdmUiLCJ0YWJsZSIsImdldEFsbCIsImFyZ3MiLCJ1cGRhdGUiLCJpZCIsIl9hcmNoaXZlZCIsIl9yZWxhdGVkIiwicm93Il0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTs7Ozs7Ozs7a0JBRWUsVUFBQ0EsSUFBRCxFQUFPQyxHQUFQLEVBQVlDLEtBQVosRUFBbUJDLFVBQW5CO0FBQUEsU0FDYixvQkFBRUMsS0FBRixDQUFRSixJQUFSLEVBQWNLLE1BQWQsQ0FBcUIsb0JBQUVDLElBQUYsQ0FBT0wsR0FBUCxDQUFyQixFQUFrQ00sTUFBbEMsQ0FBeUM7QUF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WQsQ0FBcUIsb0JBQUVDLElBQUYsQ0FBT0wsR0FBUCxDQUFyQixFQUFrQ00sTUFBbEMsQ0FBeUM7QUFBQSwrQkFDdENMLEtBRHNDLEVBQzlCO0FBQ1BNLFVBQUlMLFVBREc7QUFFUE0saUJBQVcsSUFGSjtBQUdQQyxnQkFBVUMsSUFBSVQsS0FBSixFQUFXLFVBQVg7QUFISCxLQUQ4QjtBQUFBLEdBQXpDLENBRGE7QUFBQSxDIiwiZmlsZSI6ImFyY2hpdmVSZW1vdmVJZEZyb21NYW55UmVjb3Jkc0ZpZWxkLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHIgZnJvbSAncmV0aGlua2RiJztcblxuZXhwb3J0IGRlZmF1bHQgKG5hbWUsIGlkcywgZmllbGQsIGlkVG9SZW1vdmUpID0+IChcbiAgci50YWJsZShuYW1lKS5nZXRBbGwoci5hcmdzKGlkcykpLnVwZGF0ZShyb3cgPT4gKHtcbiAgICBbZmllbGRdOiB7XG4gICAgICBpZDogaWRUb1JlbW92ZSxcbiAgICAgIF9hcmNoaXZlZDogdHJ1ZSxcbiAgICAgIF9yZWxhdGVkOiByb3coZmllbGQpKCdfcmVsYXRlZCcpLFxuICAgIH0sXG4gIH0pKVxuKTtcbiJdfQ==

@@ -15,4 +15,4 @@ 'use strict';

exports.default = function (type, id, field, idToRemove) {
return _rethinkdb2.default.table(type).get(id).update(function (row) {
exports.default = function (name, id, field, idToRemove) {
return _rethinkdb2.default.table(name).get(id).update(function (row) {
return _defineProperty({}, field, {

@@ -25,2 +25,2 @@ id: idToRemove,

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL2FyY2hpdmVSZW1vdmVJZEZyb21SZWNvcmRGaWVsZC5qcyJdLCJuYW1lcyI6WyJ0eXBlIiwiaWQiLCJmaWVsZCIsImlkVG9SZW1vdmUiLCJ0YWJsZSIsImdldCIsInVwZ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GF0ZSIsIl9hcmNoaXZlZCIsIl9yZWxhdGVkIiwicm93Il0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTs7Ozs7Ozs7a0JBRWUsVUFBQ0EsSUFBRCxFQUFPQyxFQUFQLEVBQVdDLEtBQVgsRUFBa0JDLFVBQWxCO0FBQUEsU0FDYixvQkFBRUMsS0FBRixDQUFRSixJQUFSLEVBQWNLLEdBQWQsQ0FBa0JKLEVBQWxCLEVBQXNCSyxNQUF0QixDQUE2QjtBQUFBLCtCQUMxQkosS0FEMEIsRUFDbEI7QUFDUEQsVUFBSUUsVUFERztBQUVQSSxpQkFBVyxJQUZKO0FBR1BDLGdCQUFVQyxJQUFJUCxLQUFKLEVBQVcsVUFBWDtBQUhILEtBRGtCO0FBQUEsR0FBN0IsQ0FEYTtBQUFBLEMiLCJmaWxlIjoiYXJjaGl2ZVJlbW92ZUlkRnJvbVJlY29yZEZpZWxkLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHIgZnJvbSAncmV0aGlua2RiJztcblxuZXhwb3J0IGRlZmF1bHQgKG5hbWUsIGlkLCBmaWVsZCwgaWRUb1JlbW92ZSkgPT4gKFxuICByLnRhYmxlKG5hbWUpLmdldChpZCkudXBkYXRlKHJvdyA9PiAoe1xuICAgIFtmaWVsZF06IHtcbiAgICAgIGlkOiBpZFRvUmVtb3ZlLFxuICAgICAgX2FyY2hpdmVkOiB0cnVlLFxuICAgICAgX3JlbGF0ZWQ6IHJvdyhmaWVsZCkoJ19yZWxhdGVkJyksXG4gICAgfSxcbiAgfSkpXG4pO1xuIl19

@@ -15,4 +15,4 @@ 'use strict';

exports.default = function (inverseType, inverseField, idsToUpdate, idToSplice) {
return _rethinkdb2.default.table(inverseType).getAll(_rethinkdb2.default.args(idsToUpdate)).update(function (row) {
exports.default = function (inverseName, inverseField, idsToUpdate, idToSplice) {
return _rethinkdb2.default.table(inverseName).getAll(_rethinkdb2.default.args(idsToUpdate)).update(function (row) {
return _defineProperty({}, inverseField, row(inverseField).map(function (data) {

@@ -27,2 +27,2 @@ return _rethinkdb2.default.branch(data('id').eq(idToSplice), {

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL2FyY2hpdmVTcGxpY2VJZEZyb21JbnZlcnNlRmllbGQuanMiXSwibmFtZXMiOlsiaW52ZXJzZVR5cGUiLCJpbnZlcnNlRmllbGQiLCJpZHNUb1VwZGF0ZSIsImlkVG9TcGxpY2UiLCJ0YWJsZSIsImdldEFsbCIsImFyZ3MiLCJ1cGRhdGUiLCJyb3ciLCJtYXAiLCJicmFuY2giLCJkYXRhIiwiZXEiLCJpZCIsIl9hcmNoaXZlZCIsIl9yZWxhdGVkIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTs7Ozs7Ozs7a0JBRWUsVUFBQ0EsV0FBRCxFQUFjQyxZQUFkLEVBQTRCQyxXQUE1QixFQUF5Q0MsVUFBekM7QUFBQSxTQUNiLG9CQUFFQyxLQUFGLENBQVFKLFdBQVIsRUFBcUJLLE1BQXJCLENBQTRCLG9CQUFFQyxJQUFGLENBQU9KLFdBQVAsQ0FBNUIsRUFBaURLLE1BQWpELENBQXdEO0FBQUEsK0JBQ3JETixZQURxRCxFQUN0Q08sSUFBSVAsWUFBSixFQUFrQlEsR0FBbEIsQ0FBc0I7QUFBQSxhQUNwQyxvQkFBRUMsTUFBRixDQUFTQyxLQUFLLElBQUwsRUFBV0MsRUFBWCxDQUFjVCxVQUFkLENBQVQsRUFDRTtBQUNFVSxZQUFJRixLQUFLLElBQUwsQ0FETjtBQUVFRyxtQkFBVyxJQUZiO0FBR0VDLGtCQUFVSixLQUFLLFVBQUw7QUFIWixPQURGLEVBS0tBLElBTEwsQ0FEb0M7QUFBQSxLQUF0QixDQURzQztBQUFBLEdBQXhELENBRGE7QUFBQSxDIiwiZmlsZSI6ImFyY2hpdmVTcGxpY2VJZEZyb21JbnZlc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xuICAgICkpLFxuICB9KSlcbik7XG4iXX0=

@@ -17,5 +17,5 @@ 'use strict';

exports.default = function (inverseType, inverseField, originalOldIds, originalNewIds, idToPush) {
exports.default = function (inverseName, inverseField, originalOldIds, originalNewIds, idToPush) {
return _rethinkdb2.default.do((0, _utils.getInverseIdsToUpdate)(originalOldIds, originalNewIds), function (ids) {
return _rethinkdb2.default.table(inverseType).getAll(_rethinkdb2.default.args(ids.map(function (id) {
return _rethinkdb2.default.table(inverseName).getAll(_rethinkdb2.default.args(ids.map(function (id) {
return id('id');

@@ -27,2 +27,2 @@ }))).update(function (row) {

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3B1c2hJZFRvSW52ZXJzZUZpZWxkLmpzIl0sIm5hbWVzIjpbImludmVyc2VUeXBlIiwiaW52ZXJzZUZpZWxkIiwib3JpZ2luYWxPbGRJZHMiLCJvcmlnaW5hbE5ld0lkcyIsImlkVG9QdXNoIiwiZG8iLCJ0YWJsZSIsImdldEFsbCIsImFyZ3MiLCJpZHMiLCJtYXAiLCJpZCIsInVwZGF0ZSIsInJvdyIsImFwcGVuZCJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7Ozs7QUFDQTs7Ozs7O2tCQUtlLFVBQUNBLFdBQUQsRUFBY0MsWUFBZCxFQUE0QkMsY0FBNUIsRUFBNENDLGNBQTVDLEVBQTREQyxRQUE1RDtBQUFBLFNBQ2Isb0JBQUVDLEVBQUYsQ0FDRSxrQ0FBc0JILGNBQXRCLEVBQXNDQyxjQUF0QyxDQURGLEVBQ3lEO0FBQUEsV0FDckQsb0JBQUVHLEtBQUYsQ0FBUU4sV0FBUixFQUFxQk8sTUFBckIsQ0FBNEIsb0JBQUVDLElBQUYsQ0FBT0MsSUFBSUMsR0FBSixDQUFRO0FBQUEsYUFBTUMsR0FBRyxJQUFILENBQU47QUFBQSxLQUFSLENBQVAsQ0FBNU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xOZXdJZHMsIGlkVG9QdXNoKSA9PiAoXG4gIHIuZG8oXG4gICAgZ2V0SW52ZXJzZUlkc1RvVXBkYXRlKG9yaWdpbmFsT2xkSWRzLCBvcmlnaW5hbE5ld0lkcyksIGlkcyA9PiAoXG4gICAgICByLnRhYmxlKGludmVyc2VOYW1lKS5nZXRBbGwoci5hcmdzKGlkcy5tYXAoaWQgPT4gaWQoJ2lkJykpKSkudXBkYXRlKHJvdyA9PiAoe1xuICAgICAgICBbaW52ZXJzZUZpZWxkXTogcm93KGludmVyc2VGaWVsZCkuYXBwZW5kKGNvbnZlcnRJZFRvUmVzb3VyY2VQb2ludGVyKGlkVG9QdXNoKSksXG4gICAgICB9KSlcbiAgICApXG4gIClcbik7XG4iXX0=

@@ -17,5 +17,5 @@ 'use strict';

exports.default = function (originalType, originalId, originalField, originalOldIds, originalNewIds) {
exports.default = function (originalName, originalId, originalField, originalOldIds, originalNewIds) {
return _rethinkdb2.default.do((0, _utils.getInverseIdsToUpdate)(originalOldIds, originalNewIds), function (ids) {
return _rethinkdb2.default.table(originalType).get(originalId).update(function (row) {
return _rethinkdb2.default.table(originalName).get(originalId).update(function (row) {
return _defineProperty({}, originalField, row(originalField).union((0, _rethinkdb2.default)(ids)));

@@ -25,2 +25,2 @@ });

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3B1c2hJZFRvT3JpZ2luYWxGaWVsZC5qcyJdLCJuYW1lcyI6WyJvcmlnaW5hbFR5cGUiLCJvcmlnaW5hbElkIiwib3JpZ2luYWxGaWVsZCIsIm9yaWdpbmFsT2xkSWRzIiwib3JpZ2luYWxOZXdJZHMiLCJkbyIsInRhYmxlIiwiZ2V0IiwidXBkYXRlIiwicm93IiwidW5pb24iLCJpZHMiXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBOzs7O0FBQ0E7Ozs7OztrQkFFZSxVQUFDQSxZQUFELEVBQWV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ZlcnNlSWRzVG9VcGRhdGUob3JpZ2luYWxPbGRJZHMsIG9yaWdpbmFsTmV3SWRzKSwgaWRzID0+IChcbiAgICAgIHIudGFibGUob3JpZ2luYWxOYW1lKS5nZXQob3JpZ2luYWxJZCkudXBkYXRlKHJvdyA9PiAoe1xuICAgICAgICBbb3JpZ2luYWxGaWVsZF06IHJvdyhvcmlnaW5hbEZpZWxkKS51bmlvbihyKGlkcykpLFxuICAgICAgfSkpXG4gICAgKVxuICApXG4pO1xuIl19

@@ -17,5 +17,5 @@ 'use strict';

exports.default = function (type, ids, field, idToPut) {
return _rethinkdb2.default.table(type).getAll(_rethinkdb2.default.args(ids)).update(_defineProperty({}, field, (0, _utils.convertIdToResourcePointer)(idToPut)));
exports.default = function (name, ids, field, idToPut) {
return _rethinkdb2.default.table(name).getAll(_rethinkdb2.default.args(ids)).update(_defineProperty({}, field, (0, _utils.convertIdToResourcePointer)(idToPut)));
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3B1dElkVG9NYW55UmVjb3Jkc0ZpZWxkLmpzIl0sIm5hbWVzIjpbInR5cGUiLCJpZHMiLCJmaWVsZCIsImlkVG9QdXQiLCJ0YWJsZSIsImdldEFsbCIsImFyZ3MiLCJ1cGRhdGUiXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBOzs7O0FBQ0E7Ozs7OztrQkFFZSxVQUFDQSxJQUFELEVBQU9DLEdBQVAsRUFBWUMsS0FBWixFQUFtQkMsT0FBbkI7QUFBQSxTQUNiLG9CQUFFQyxLQUFGLENBQVFKLElBQVIsRUFBY0ssTUFBZCxDQUFxQixvQkFBRUMsSUFBRixDQUFPTCxHQUFQLENBQXJCLEVBQWtDTSxNQUFsQyxxQkFDR0wsS0FESCxFQUNXLHVDQUEyQkMsT0FBM0IsQ0FEWCxFQURhO0FBQUEsQyIsImZpbGUiOiJwdXRJZFRvTWFueVJlY29yZH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1xuXG5leHBvcnQgZGVmYXVsdCAobmFtZSwgaWRzLCBmaWVsZCwgaWRUb1B1dCkgPT4gKFxuICByLnRhYmxlKG5hbWUpLmdldEFsbChyLmFyZ3MoaWRzKSkudXBkYXRlKHtcbiAgICBbZmllbGRdOiBjb252ZXJ0SWRUb1Jlc291cmNlUG9pbnRlcihpZFRvUHV0KSxcbiAgfSlcbik7XG4iXX0=

@@ -17,5 +17,5 @@ 'use strict';

exports.default = function (type, id, field, idToPut) {
return _rethinkdb2.default.table(type).get(id).update(_defineProperty({}, field, (0, _utils.convertIdToResourcePointer)(idToPut)));
exports.default = function (name, id, field, idToPut) {
return _rethinkdb2.default.table(name).get(id).update(_defineProperty({}, field, (0, _utils.convertIdToResourcePointer)(idToPut)));
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3B1dElkVG9SZWNvcmRGaWVsZC5qcyJdLCJuYW1lcyI6WyJ0eXBlIiwiaWQiLCJmaWVsZCIsImlkVG9QdXQiLCJ0YWJsZSIsImdldCIsInVwZGF0ZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7Ozs7QUFDQTs7Ozs7O2tCQUVlLFVBQUNBLElBQUQsRUFBT0MsRUFBUCxFQUFXQyxLQUFYLEVBQWtCQyxPQUFsQjtBQUFBLFNBQ2Isb0JBQUVDLEtBQUYsQ0FBUUosSUFBUixFQUFjSyxHQUFkLENBQWtCSixFQUFsQixFQUFzQkssTUFBdEIscUJBQ0dKLEtBREgsRUFDVyx1Q0FBMkJDLE9BQTNCLENBRFgsRUFEYTtBQUFBLEMiLCJmaWxlIjoicHV0SWRUb1JlY29yZEZpZWxkLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHIgZnJvbSAncmV0aGlua2RiJztcbmltcG9ydCB7IGNvbnZlcnRJZFRvUmVzb3VyY2VQb2ludGVyIH0gZnJvbSAnLi91dGlscyc7X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strict';

exports.default = function (type, id, field, idToRemove) {
return _rethinkdb2.default.table(type).get(id).update(function (row) {
exports.default = function (name, id, field, idToRemove) {
return _rethinkdb2.default.table(name).get(id).update(function (row) {
return _defineProperty({}, field, {

@@ -25,2 +25,2 @@ id: idToRemove,

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3JlbW92ZUlkRnJvbVJlY29yZEZpZWxkLmpzIl0sIm5hbWVzIjpbInR5cGUiLCJpZCIsImZpZWxkIiwiaWRUb1JlbW92ZSIsInRhYmxlIiwiZ2V0IiwidXBkYXRlIiwiX2FyY2hpdmVkIiwicm93IiwiX3JlbGF0ZWQiXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBOzs7Ozs7OztrQkFFZSxVQUFDQSxJQUFELEVBQU9DLEVBQVAsRUFBV0MsS0FBWCxFQUFrQkMsVUFBbEI7QUFBQSxTQUNiLG9CQUFFQyxLQUFGLENBQVFKLElBQVIsRUFBY0ssR0FBZCxDQUFrQkosRUFBbEIsRUFBc0JLLE1BQXRCLENBQTZCO0FBQUEsK0JBQzFCSixLQUQwQixFQUNsQjtBQUNQRCxVQUFJRSxVQURHO0FBRVBJLGlCQUFXQyxJQUFJTixLQUFKLEVBQVcsV0FBWCxDQUZKO0FBR1BPLGdCQUFVO0FBSEgsS0FEa0I7QUFBQSxHQUE3QixDQURhO0FBQUEsQyIsImZpbGUiOiJyZW1vdmVJZEZyb21SZWNvcmRGaWVsZC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCByIGZyb20gJ3JldGhpbmtkYic7XG5cbmV4cG9ydCBkZWZhdWx0ICh0eXBlLCBpZCwgZmllbGQsIGlkVG9SZW1vdmUpID0+IChcbiAgci50YWJsZSh0eXBlKS5nZXQoaWQpLnVwZGF0ZShyb3cgPT4gKHtcbiAgICBbZmllbGRdOiB7XG4gICAgICBpZDogaWRUb1JlbW92ZSxcbiAgIC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2hpdmVkJyksXG4gICAgICBfcmVsYXRlZDogZmFsc2UsXG4gICAgfSxcbiAgfSkpXG4pO1xuIl19

@@ -15,4 +15,4 @@ 'use strict';

exports.default = function (inverseType, inverseField, idsToUpdate, idToSplice) {
return _rethinkdb2.default.table(inverseType).getAll(_rethinkdb2.default.args(idsToUpdate)).update(function (row) {
exports.default = function (inverseName, inverseField, idsToUpdate, idToSplice) {
return _rethinkdb2.default.table(inverseName).getAll(_rethinkdb2.default.args(idsToUpdate)).update(function (row) {
return _defineProperty({}, inverseField, row(inverseField).map(function (data) {

@@ -27,2 +27,2 @@ return _rethinkdb2.default.branch(data('id').eq(idToSplice), {

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3NwbGljZUlkRnJvbUludmVyc2VGaWVsZC5qcyJdLCJuYW1lcyI6WyJpbnZlcnNlVHlwZSIsImludmVyc2VGaWVsZCIsImlkc1RvVXBkYXRlIiwiaWRUb1NwbGljZSIsInRhYmxlIiwiZ2V0QWxsIiwiYXJncyIsInVwZGF0ZSIsInJvdyIsIm1hcCIsImJyYW5jaCIsImRhdGEiLCJlcSIsImlkIiwiX2FyY2hpdmVkIiwiX3JlbGF0ZWQiXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBOzs7Ozs7OztrQkFFZSxVQUFDQSxXQUFELEVBQWNDLFlBQWQsRUFBNEJDLFdBQTVCLEVBQXlDQyxVQUF6QztBQUFBLFNBQ2Isb0JBQUVDLEtBQUYsQ0FBUUosV0FBUixFQUFxQkssTUFBckIsQ0FBNEIsb0JBQUVDLElBQUYsQ0FBT0osV0FBUCxDQUE1QixFQUFpREssTUFBakQsQ0FBd0Q7QUFBQSwrQkFDckROLFlBRHFELEVBQ3RDTyxJQUFJUCxZQUFKLEVBQWtCUSxHQUFsQixDQUFzQjtBQUFBLGFBQ3BDLG9CQUFFQyxNQUFGLENBQVNDLEtBQUssSUFBTCx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Lm1hcChkYXRhID0+IChcbiAgICAgIHIuYnJhbmNoKGRhdGEoJ2lkJykuZXEoaWRUb1NwbGljZSksXG4gICAgICAgIHtcbiAgICAgICAgICBpZDogZGF0YSgnaWQnKSxcbiAgICAgICAgICBfYXJjaGl2ZWQ6IGRhdGEoJ19hcmNoaXZlZCcpLFxuICAgICAgICAgIF9yZWxhdGVkOiBmYWxzZSxcbiAgICAgICAgfSwgZGF0YVxuICAgICAgKVxuICAgICkpLFxuICB9KSlcbik7XG4iXX0=

@@ -15,4 +15,4 @@ 'use strict';

exports.default = function (originalType, originalField, originalId, idsToSplice) {
return _rethinkdb2.default.table(originalType).get(originalId).update(function (row) {
exports.default = function (originalName, originalField, originalId, idsToSplice) {
return _rethinkdb2.default.table(originalName).get(originalId).update(function (row) {
return _defineProperty({}, originalField, row(originalField).map(function (data) {

@@ -27,2 +27,2 @@ return _rethinkdb2.default.branch((0, _rethinkdb2.default)(idsToSplice).contains(data('id')), {

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9xdWVyaWVzL3NwbGljZUlkRnJvbU9yaWdpbmFsRmllbGQuanMiXSwibmFtZXMiOlsib3JpZ2luYWxUeXBlIiwib3JpZ2luYWxGaWVsZCIsIm9yaWdpbmFsSWQiLCJpZHNUb1NwbGljZSIsInRhYmxlIiwiZ2V0IiwidXBkYXRlIiwicm93IiwibWFwIiwiYnJhbmNoIiwiY29udGFpbnMiLCJkYXRhIiwiaWQiLCJfYXJjaGl2ZWQiLCJfcmVsYXRlZCJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7Ozs7Ozs7O2tCQUVlLFVBQUNBLFlBQUQsRUFBZUMsYUFBZixFQUE4QkMsVUFBOUIsRUFBMENDLFdBQTFDO0FBQUEsU0FDYixvQkFBRUMsS0FBRixDQUFRSixZQUFSLEVBQXNCSyxHQUF0QixDQUEwQkgsVUFBMUIsRUFBc0NJLE1BQXRDL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+IChcbiAgci50YWJsZShvcmlnaW5hbE5hbWUpLmdldChvcmlnaW5hbElkKS51cGRhdGUocm93ID0+ICh7XG4gICAgW29yaWdpbmFsRmllbGRdOiByb3cob3JpZ2luYWxGaWVsZCkubWFwKGRhdGEgPT4gKFxuICAgICAgci5icmFuY2gocihpZHNUb1NwbGljZSkuY29udGFpbnMoZGF0YSgnaWQnKSksXG4gICAgICAgIHtcbiAgICAgICAgICBpZDogZGF0YSgnaWQnKSxcbiAgICAgICAgICBfYXJjaGl2ZWQ6IGRhdGEoJ19hcmNoaXZlZCcpLFxuICAgICAgICAgIF9yZWxhdGVkOiBmYWxzZSxcbiAgICAgICAgfSwgZGF0YVxuICAgICAgKVxuICAgICkpLFxuICB9KSlcbik7XG4iXX0=

@@ -49,3 +49,3 @@ 'use strict';

* @param {String} [options.password='']
* @param {Object} [options.schemas={}]
* @param {Object} [options.schema={}]
* @param {Boolean} [options.verbse=false]

@@ -63,4 +63,4 @@ * @param {Number} [options.port=28015]

var password = _ref$password === undefined ? '' : _ref$password;
var _ref$schemas = _ref.schemas;
var schemas = _ref$schemas === undefined ? {} : _ref$schemas;
var _ref$schema = _ref.schema;
var schema = _ref$schema === undefined ? {} : _ref$schema;
var _ref$verbose = _ref.verbose;

@@ -77,3 +77,3 @@ var verbose = _ref$verbose === undefined ? false : _ref$verbose;

this.password = password;
this.schemas = schemas;
this.schema = schema;
this.verbose = verbose;

@@ -87,3 +87,3 @@ this.port = port;

/**
* Connects to the RethinkDB database, registers the schemas, and configures indices.
* Connects to the RethinkDB database, registers the schema, and configures indices.
*

@@ -112,3 +112,3 @@ * @async

return _this.conn = conn;
}).then(this.registerSchemas.bind(this)).then(this.configureIndices.bind(this));
}).then(this.registerSchema.bind(this)).then(this.configureIndices.bind(this));
}

@@ -135,9 +135,7 @@

/**
* Registers Redink schemas. In other words, this completes the schema graph by hydrating inverse
* relationships where necessary. After finishing the graph, it ensures that all proper tables are
* created with each schema `type` as the table name.
* Registers the schema and creates a new model for each type.
*
* @private
* @method registerSchemas
* @param {Object} schemas - Redink schemas.
* @method registerSchema
* @param {Object} schema
* @return {Promise<Object>}

@@ -147,57 +145,21 @@ */

}, {
key: 'registerSchemas',
value: function registerSchemas() {
key: 'registerSchema',
value: function registerSchema() {
var _this2 = this;
var conn = this.conn;
var schemas = this.schemas;
var schema = this.schema;
var db = this.db;
var visitSchemas = this.visitSchemas;
var types = [];
var names = [];
var newSchemas = _extends({}, schemas);
schema.types.forEach(function (type) {
var name = type.name;
/**
* First pass: visit each schema and invoke every `hasMany`, `hasOne`, and `belongsTo`
* relationship function. Along the way, add each schema type to `types`.
*/
visitSchemas(newSchemas, {
enterSchema: function enterSchema(_ref2) {
var type = _ref2.type;
return !types.includes(type) && types.push(type);
},
enterRelationship: function enterRelationship(_ref3) {
var type = _ref3.type;
var field = _ref3.field;
var relationship = _ref3.relationship;
if (typeof relationship !== 'function') {
throw new TypeError('Tried registering the \'' + type + '\' schema\'s \'' + field + '\' relationship, but it wasn\'t a ' + 'function. Please use \'hasMany\', \'belongsTo\', or \'hasOne\' from ' + '\'redink/schema\'.');
}
if (!names.includes(name)) names.push(name);
newSchemas[type].relationships[field] = relationship(field);
}
});
/**
* Second pass: hydrate every inverse relationship in the schema graph.
*/
visitSchemas(newSchemas, {
enterRelationship: function enterRelationship(_ref4) {
var type = _ref4.relationship.type;
return (0, _utils.hydrateInverse)(newSchemas, type);
}
});
/**
* Third pass: add a schema key to every relationship and build up the indices registry.
*/
visitSchemas(newSchemas, {
enterRelationship: function enterRelationship(_ref5) {
var type = _ref5.type;
var field = _ref5.field;
var relationship = _ref5.relationship;
type.relationships.forEach(function (relationship) {
var relation = relationship.relation;
var relatedType = relationship.type;
var relatedName = relationship.name;
var _relationship$inverse = relationship.inverse;

@@ -208,13 +170,11 @@ var inverseRelation = _relationship$inverse.relation;

newSchemas[type].relationships[field].schema = newSchemas[relatedType];
if ((0, _utils.requiresIndex)(relation, inverseRelation)) {
if (!_this2.indices[relatedType]) _this2.indices[relatedType] = {};
_this2.indices[relatedType][inverseField] = true;
if (!_this2.indices[relatedName]) _this2.indices[relatedName] = {};
_this2.indices[relatedName][inverseField] = true;
}
}
});
});
// ensure that the schemas will never be mutated
this.schemas = Object.freeze(newSchemas);
// ensure that the schema will never be mutated
this.schema = Object.freeze(schema);

@@ -226,4 +186,4 @@ // create missing tables

.then(function (tables) {
var missingTables = types.filter(function (type) {
return !tables.includes(type);
var missingTables = names.filter(function (name) {
return !tables.includes(name);
});

@@ -238,4 +198,4 @@

.then(function () {
types.forEach(function (type) {
_this2.models[type] = new _Model2.default(conn, type, _this2.schemas[type]);
names.forEach(function (name) {
_this2.models[name] = new _Model2.default(conn, _this2.schema.types[name]);
});

@@ -246,43 +206,6 @@ });

/**
* Walks through each schema, and calls `actions.enterSchema` upon entering each schema and calls
* `actions.enterRelationship` upon entering each relationship of that schema.
*
* @param {Object} schemas
* @param {Object} [actions={}]
* @param {Function} [actions.enterSchema]
* @param {Function} [actions.enterRelationship]
*/
}, {
key: 'visitSchemas',
value: function visitSchemas(schemas) {
var actions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var keys = Object.keys;
keys(schemas).forEach(function (type) {
var schema = schemas[type];
if (typeof actions.enterSchema === 'function') {
actions.enterSchema({ type: type, schema: schema });
}
keys(schema.relationships).forEach(function (field) {
if (typeof actions.enterRelationship === 'function') {
actions.enterRelationship({
relationship: schema.relationships[field],
type: type,
schema: schema,
field: field
});
}
});
});
}
/**
* Determines which indices are missing on `table` and creates them.
*
* @private
* @method reconcileMissingTableIndices
* @method reconcileMissingIndices
* @param {String} table - The table to reconcile missing indices on.

@@ -293,4 +216,4 @@ * @return {Promise<Array>}

}, {
key: 'reconcileMissingTableIndices',
value: function reconcileMissingTableIndices(table) {
key: 'reconcileMissingIndices',
value: function reconcileMissingIndices(table) {
var conn = this.conn;

@@ -354,3 +277,3 @@ var indices = this.indices;

return _bluebird2.default.props(keys(indices).reduce(function (prev, next) {
return _extends({}, prev, _defineProperty({}, next, _this3.reconcileMissingTableIndices(next)));
return _extends({}, prev, _defineProperty({}, next, _this3.reconcileMissingIndices(next)));
}, {})).then(function (reconciledTables) {

@@ -387,15 +310,15 @@ if (verbose) {

for (var _len = arguments.length, types = Array(_len), _key = 0; _key < _len; _key++) {
types[_key] = arguments[_key];
for (var _len = arguments.length, names = Array(_len), _key = 0; _key < _len; _key++) {
names[_key] = arguments[_key];
}
if (types.length === 0) {
if (names.length === 0) {
throw new TypeError('A defined type is required to access a Model instance.');
}
if (types.length === 1) {
var model = this.models[types[0]];
if (names.length === 1) {
var model = this.models[names[0]];
if (!model) {
throw new Error('Tried accessing a model with type \'' + types[0] + '\', but no such model was ever registered.');
throw new Error('Tried accessing a model with type \'' + names[0] + '\', but no such model was ever registered.');
}

@@ -406,3 +329,3 @@

var models = types.reduce(function (prev, type) {
var models = names.reduce(function (prev, type) {
var _destructureAlias = (0, _utils.destructureAlias)(type);

@@ -428,2 +351,2 @@

exports.default = Redink;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9SZWRpbmsuanMiXSwibmFtZXMiOlsiREVGQVVMVF9SRVRISU5LREJfUE9SVCIsIlJlZGluayIsImRiIiwiaG9zdCIsInVzZXIiLCJwYXNzd29yZCIsInNjaGVtYXMiLCJ2ZXJib3NlIiwicG9ydCIsImluZGljZXMiLCJtb2RlbHMiLCJvcHRpb25zIiwiY29ubmVjdCIsInRoZW4iLCJjb25uIiwicmVnaXN0ZXJTY2hlbWFzIiwiY29uZmlndXJlSW5kaWNlcyIsIkVycm9yIiwiY2xvc2UiLCJ2aXNpdFNjaGVtYXMiLCJ0eXBlcyIsIm5ld1NjaGVtYXMiLCJlbnRlclNjaGVtYSIsInR5cGUiLCJpbmNsdWRlcyIsInB1c2giLCJlbnRlclJlbGF0aW9uc2hpcCIsImZpZWxkIiwicmVsYXRpb25zaGlwIiwiVHlwZUVycm9yIiwicmVsYXRpb25zaGlwcy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Ghpcy5tb2RlbHNbdHlwZXNbMF1dO1xuXG4gICAgICBpZiAoIW1vZGVsKSB7XG4gICAgICAgIHRocm93IG5ldyBFcnJvcihcbiAgICAgICAgICBgVHJpZWQgYWNjZXNzaW5nIGEgbW9kZWwgd2l0aCB0eXBlICcke3R5cGVzWzBdfScsIGJ1dCBubyBzdWNoIG1vZGVsIHdhcyBldmVyIHJlZ2lzdGVyZWQuYFxuICAgICAgICApO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gbW9kZWw7XG4gICAgfVxuXG4gICAgY29uc3QgbW9kZWxzID0gdHlwZXMucmVkdWNlKChwcmV2LCB0eXBlKSA9PiB7XG4gICAgICBjb25zdCB7IG1vZGVsLCBhbGlhcyB9ID0gZGVzdHJ1Y3R1cmVBbGlhcyh0eXBlKTtcblxuICAgICAgcmV0dXJuIHtcbiAgICAgICAgLi4ucHJldixcbiAgICAgICAgW3R5cGVdOiB7XG4gICAgICAgICAgbW9kZWw6IHRoaXMubW9kZWxzW21vZGVsXSxcbiAgICAgICAgICBhbGlhcyxcbiAgICAgICAgfSxcbiAgICAgIH07XG4gICAgfSwge30pO1xuXG4gICAgcmV0dXJuIG5ldyBNb2RlbEFycmF5KG1vZGVscyk7XG4gIH1cbn1cbiJdfQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9SZWRpbmsuanMiXSwibmFtZXMiOlsiREVGQVVMVF9SRVRISU5LREJfUE9SVCIsIlJlZGluayIsImRiIiwiaG9zdCIsInVzZXIiLCJwYXNzd29yZCIsInNjaGVtYSIsInZlcmJvc2UiLCJwb3J0IiwiaW5kaWNlcyIsIm1vZGVscyIsIm9wdGlvbnMiLCJjb25uZWN0IiwidGhlbiIsImNvbm4iLCJyZWdpc3RlclNjaGVtYSIsImNvbmZpZ3VyZUluZGljZXMiLCJFcnJvciIsImNsb3NlIiwibmFtZXMiLCJ0eXBlcyIsImZvckVhY2giLCJuYW1lIiw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B9O1xuICAgIH0sIHt9KTtcblxuICAgIHJldHVybiBuZXcgTW9kZWxBcnJheShtb2RlbHMpO1xuICB9XG59XG4iXX0=

@@ -30,3 +30,3 @@ 'use strict';

var Relationship = function () {
function Relationship(conn, parentSchema, field) {
function Relationship(conn, parentType, field) {
var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;

@@ -36,9 +36,9 @@

var _parentSchema$relatio = parentSchema.relationships[field];
var schema = _parentSchema$relatio.schema;
var relation = _parentSchema$relatio.relation;
var inverse = _parentSchema$relatio.inverse;
var _parentType$relations = parentType.relationships[field];
var type = _parentType$relations.type;
var relation = _parentType$relations.relation;
var inverse = _parentType$relations.inverse;
this.schema = schema;
this.type = type;
this.field = field;

@@ -53,3 +53,3 @@ this.relation = relation;

if (isHasManyRelationshipHydrated(data)) {
this.data = new _Connection2.default(conn, schema, data);
this.data = new _Connection2.default(conn, type, data);
this.isHydrated = true;

@@ -62,3 +62,3 @@ } else {

if (data) {
this.data = new _Node2.default(conn, schema, data);
this.data = new _Node2.default(conn, type, data);
} else {

@@ -91,2 +91,2 @@ this.data = null;

exports.default = Relationship;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9SZWxhdGlvbnNoaXAuanMiXSwibmFtZXMiOlsiaXNIYXNNYW55UmVsYXRpb25zaGlwSHlkcmF0ZWQiLCJkYXRhIiwiT2JqZWN0Iiwia2V5cyIsImluY2x1ZGVzIiwiUmVsYXRpb25zaGlwIiwiY29ubiIsInBhcmVudFNjaGVtYSIsImZpZWxkIiwicmVsYXRpb25zaGlwcyIsInNjaGVtYSIsInJlbGF0aW9uIiwiaW52ZXJzZSIsIl9hcmNoaXZlZCIsIl9yZWxhdGVkIiwiaXNIeWRyYXRlZCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBOzs7O0FBQ0E7Ozs7QUFDQTs7Ozs7O0FBRUEsSUFBTUEsZ0NBQWdDLF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NBcmNoaXZlZCgpIHtcbiAgICByZXR1cm4gdGhpcy5fYXJjaGl2ZWQ7XG4gIH1cblxuICBpc1JlbGF0ZWQoKSB7XG4gICAgcmV0dXJuIHRoaXMuX3JlbGF0ZWQ7XG4gIH1cbn1cbiJdfQ==

@@ -56,4 +56,4 @@ 'use strict';

var nodeToCursor = function nodeToCursor(type, node) {
return _rethinkdb2.default.add(type, ':', node.typeOf().eq('OBJECT').branch(node('id'), null)).do(_rbtoa2.default);
var nodeToCursor = function nodeToCursor(name, node) {
return _rethinkdb2.default.add(name, ':', node.typeOf().eq('OBJECT').branch(node('id'), null)).do(_rbtoa2.default);
};

@@ -73,5 +73,5 @@

exports.default = function (schema, sequence) {
exports.default = function (type, sequence) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var type = schema.type;
var name = type.name;

@@ -86,3 +86,3 @@ var after = void 0,

edges = (0, _mergeRelationships2.default)(edges, schema, options);
edges = (0, _mergeRelationships2.default)(edges, type, options);

@@ -167,3 +167,3 @@ if ((0, _hasOwnProperty2.default)(options, 'filter')) {

node: node,
cursor: nodeToCursor(type, node)
cursor: nodeToCursor(name, node)
};

@@ -184,2 +184,2 @@ }).coerceTo('array');

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9jcmVhdGVDb25uZWN0aW9uLmpzIl0sIm5hbWVzIjpbImluZGV4T2ZEYXR1bSIsInNlcXVlbmNlIiwiZGF0dW0iLCJvZmZzZXRzT2YiLCJjb2VyY2VUbyIsImRvIiwib2Zmc2V0cyIsImNvdW50IiwiZ3QiLCJicmFuY2giLCJkZWNvZGVDdXJzb3IiLCJjdXJzb3IiLCJkZWNvZGVkIiwiQnVmZmVyIiwiZnJvbSIsIlN0cmluZyIsInRvU3RyaW5nIiwic3BsaXQiLCJsZW5ndGgiLCJkZWNvZGVkQ3Vyc29yVG9EYXR1bSIsImRlY29kZWRDdXJzb3Ii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ZXh0UGFnZSxcbiAgICB9LFxuICB9KTtcbn07XG4iXX0=

@@ -11,3 +11,3 @@ 'use strict';

var initial = {
var initialValue = {
_meta: {

@@ -18,13 +18,12 @@ _archived: true

exports.default = function (resource) {
return Object.keys(resource._relationships).reduce(function (prev, curr) {
var _resource$relationshi = resource.relationship(curr);
exports.default = function (node) {
return node.relationships.reduce(function (prev, relationship) {
var relation = relationship.relation;
var field = relationship.field;
var inverseRelation = relationship.inverse.relation;
var relation = _resource$relationshi.relation;
var inverseRelation = _resource$relationshi.inverse.relation;
if (relation === 'hasOne' && inverseRelation === 'belongsTo') {
return _extends({}, prev, {
relationships: _extends({}, prev.relationships, _defineProperty({}, curr, _extends({}, prev.relationships[curr], {
relationships: _extends({}, prev.relationships, _defineProperty({}, field, _extends({}, prev.relationships[field], {
_archived: true

@@ -36,4 +35,4 @@ })))

return prev;
}, initial);
}, initialValue);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9nZXRBcmNoaXZlT3JpZ2luYWxVcGRhdGVPYmplY3QuanMiXSwibmFtZXMiOlsiaW5pdGlhbCIsIl9tZXRhIiwiX2FyY2hpdmVkIiwicmVzb3VyY2UiLCJPYmplY3QiLCJrZXlzIiwiX3JlbGF0aW9uc2hpcHMiLCJyZWR1Y2UiLCJwcmV2IiwiY3VyciIsInJlbGF0aW9uc2hpcCIsInJlbGF0aW9uIiwiaW52ZXJzZVJlbGF0aW9uIiwiaW52ZXJzZSIsInJlbGF0aW9uc2hpcHMiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSxJQUFNQSxVQUFVO0FBQ2RDLFNBQU87QUFDTEMsZUFBVztBQUROO0FBRE8sQ0FBaEI7O2tCQU1lLFVBQUNDLFFBQUQ7QUFBQSxTQUNiQyxPQUFPQyxJQUFQLENBQVlGLFNBQVNHLGNBQXJCLEVBQXFDQyxNQUFyQyxDQUE0QyxVQUF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');
Object.defineProperty(exports, 'hydrateInverse', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_hydrateInverse).default;
}
});
var _isDataValidForSpliceAndPush = require('./isDataValidForSpliceAndPush');

@@ -108,2 +99,2 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9pbmRleC5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0Il0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztpREFBU0EsTzs7Ozs7Ozs7O3FEQUNBQSxPOzs7Ozs7Ozs7cURBQ0FBLE87Ozs7Ozs7OzttRUFDQUEsTzs7Ozs7Ozs7O21EQUNBQSxPOzs7Ozs7Ozs7bURBQ0FBLE87Ozs7Ozs7OztnRUFDQUEsTzs7Ozs7Ozs7O3VEQUNBQSxPOzs7Ozs7Ozs7b0RBQ0FBLE87Ozs7Ozs7OztrREFDQUEsTzs7Ozs7Ozs7O3NEQUNBQSxPIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBhcHBseU9wdGlvbnMgfSBmcm9tICcuL2FwcGx5T3B0aW9ucyc7XG5leHBvcnQgeyBkZWZhdWx0IGFzIGNyZWF0ZUNvbm5lY3Rpb24gfSBmcm9tICcuL2NyZWF0ZUNvbm5lY3Rpb24nO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBkZXN0cnVjdHVyZUFsaWFzIH0gZnJvbSAnLi9kZXN0cnVjdHVyZUFsaWFzJztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgZ2V0QXJjaGl2ZU9yaWdpbmFsVXBkYXRlT2JqZWN0IH0gZnJvbSAnLi9nZXRBcmNoaXZlT3JpZ2luYWxVcGRhdGVPYmplY3QnO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBoYXNPd25Qcm9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mF1bHQgYXMgYXBwbHlPcHRpb25zIH0gZnJvbSAnLi9hcHBseU9wdGlvbnMnO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBjcmVhdGVDb25uZWN0aW9uIH0gZnJvbSAnLi9jcmVhdGVDb25uZWN0aW9uJztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgZGVzdHJ1Y3R1cmVBbGlhcyB9IGZyb20gJy4vZGVzdHJ1Y3R1cmVBbGlhcyc7XG5leHBvcnQgeyBkZWZhdWx0IGFzIGdldEFyY2hpdmVPcmlnaW5hbFVwZGF0ZU9iamVjdCB9IGZyb20gJy4vZ2V0QXJjaGl2ZU9yaWdpbmFsVXBkYXRlT2JqZWN0JztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgaGFzT3duUHJvcGVydHkgfSBmcm9tICcuL2hhc093blByb3BlcnR5JztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgaXNEYXRhVmFsaWRGb3JTcGxpY2VBbmRQdXNoIH0gZnJvbSAnLi9pc0RhdGFWYWxpZEZvclNwbGljZUFuZFB1c2gnO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBtZXJnZVJlbGF0aW9uc2hpcHMgfSBmcm9tICcuL21lcmdlUmVsYXRpb25zaGlwcyc7XG5leHBvcnQgeyBkZWZhdWx0IGFzIG5vcm1hbGl6ZVJlY29yZCB9IGZyb20gJy4vbm9ybWFsaXplUmVjb3JkJztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgcmVxdWlyZXNJbmRleCB9IGZyb20gJy4vcmVxdWlyZXNJbmRleCc7XG5leHBvcnQgeyBkZWZhdWx0IGFzIHN5bmNSZWxhdGlvbnNoaXBzIH0gZnJvbSAnLi9zeW5jUmVsYXRpb25zaGlwcyc7XG4iXX0=

@@ -31,12 +31,12 @@ 'use strict';

var mergeWithIndex = function mergeWithIndex(table, schema, record, field, index, options) {
var mergeWithIndex = function mergeWithIndex(table, type, record, field, index, options) {
var edges = table.getAll(record('id'), { index: index });
return _defineProperty({}, field, (0, _createConnection2.default)(schema, edges, options));
return _defineProperty({}, field, (0, _createConnection2.default)(type, edges, options));
};
var mergeWithManyRecords = function mergeWithManyRecords(table, schema, record, field, options) {
var mergeWithManyRecords = function mergeWithManyRecords(table, type, record, field, options) {
var edges = table.getAll(_rethinkdb2.default.args(record(field)('id')));
return _defineProperty({}, field, (0, _createConnection2.default)(schema, edges, options));
return _defineProperty({}, field, (0, _createConnection2.default)(type, edges, options));
};

@@ -54,3 +54,3 @@

/**
* Determines which relationships to sideload in the table based off the schema's relationships
* Determines which relationships to sideload in the table based off the type's relationships
* and `options.include`.

@@ -81,3 +81,3 @@ *

* @param {Object} table
* @param {Object} schema
* @param {Type} type
* @param {Object} options

@@ -87,6 +87,6 @@ * @returns {Function}

exports.default = function (table, schema, options) {
exports.default = function (table, type, options) {
if (!(0, _hasOwnProperty2.default)(options, 'include')) return table;
var relationships = schema.relationships;
var relationships = type.relationships;

@@ -100,8 +100,8 @@ var fields = Object.keys(relationships);

var _relationships$field = relationships[field];
var type = _relationships$field.type;
var name = _relationships$field.name;
var relation = _relationships$field.relation;
var inverse = _relationships$field.inverse;
var relatedSchema = _relationships$field.schema;
var relatedType = _relationships$field.type;
var relatedTable = _rethinkdb2.default.table(type);
var relatedTable = _rethinkdb2.default.table(name);
var inverseField = inverse.field;

@@ -112,6 +112,6 @@ var fieldOptions = options.include[field];

if ((0, _requiresIndex2.default)(relation, inverse.relation)) {
return mergeWithIndex(relatedTable, relatedSchema, record, field, inverseField, fieldOptions);
return mergeWithIndex(relatedTable, relatedType, record, field, inverseField, fieldOptions);
}
return record.hasFields(field).branch(mergeWithManyRecords(relatedTable, relatedSchema, record, field, fieldOptions), {});
return record.hasFields(field).branch(mergeWithManyRecords(relatedTable, relatedType, record, field, fieldOptions), {});
}

@@ -128,2 +128,2 @@

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9tZXJnZVJl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G5cbiAgICBpZiAocmVsYXRpb24gPT09ICdoYXNNYW55Jykge1xuICAgICAgaWYgKHJlcXVpcmVzSW5kZXgocmVsYXRpb24sIGludmVyc2UucmVsYXRpb24pKSB7XG4gICAgICAgIHJldHVybiBtZXJnZVdpdGhJbmRleChcbiAgICAgICAgICByZWxhdGVkVGFibGUsXG4gICAgICAgICAgcmVsYXRlZFNjaGVtYSxcbiAgICAgICAgICByZWNvcmQsXG4gICAgICAgICAgZmllbGQsXG4gICAgICAgICAgaW52ZXJzZUZpZWxkLFxuICAgICAgICAgIGZpZWxkT3B0aW9ucyxcbiAgICAgICAgKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHJlY29yZC5oYXNGaWVsZHMoZmllbGQpLmJyYW5jaChcbiAgICAgICAgbWVyZ2VXaXRoTWFueVJlY29yZHMoXG4gICAgICAgICAgcmVsYXRlZFRhYmxlLFxuICAgICAgICAgIHJlbGF0ZWRTY2hlbWEsXG4gICAgICAgICAgcmVjb3JkLFxuICAgICAgICAgIGZpZWxkLFxuICAgICAgICAgIGZpZWxkT3B0aW9ucyxcbiAgICAgICAgKSxcbiAgICAgICAge30sXG4gICAgICApO1xuICAgIH1cblxuICAgIHJldHVybiByZWNvcmQuaGFzRmllbGRzKGZpZWxkKS5icmFuY2goXG4gICAgICBtZXJnZVdpdGhTaW5nbGVSZWNvcmQoXG4gICAgICAgIHJlbGF0ZWRUYWJsZSxcbiAgICAgICAgcmVjb3JkLFxuICAgICAgICBmaWVsZCxcbiAgICAgICAgZmllbGRPcHRpb25zLFxuICAgICAgKSxcbiAgICAgIHt9LFxuICAgICk7XG4gIH0pKSk7XG5cbiAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lXG4gIHRhYmxlID0gdGFibGUubWVyZ2UoZmllbGRzVG9NZXJnZSk7XG5cbiAgcmV0dXJuIHRhYmxlO1xufTtcbiJdfQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzI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ICdoYXNNYW55Jykge1xuICAgICAgaWYgKHJlcXVpcmVzSW5kZXgocmVsYXRpb24sIGludmVyc2UucmVsYXRpb24pKSB7XG4gICAgICAgIHJldHVybiBtZXJnZVdpdGhJbmRleChcbiAgICAgICAgICByZWxhdGVkVGFibGUsXG4gICAgICAgICAgcmVsYXRlZFR5cGUsXG4gICAgICAgICAgcmVjb3JkLFxuICAgICAgICAgIGZpZWxkLFxuICAgICAgICAgIGludmVyc2VGaWVsZCxcbiAgICAgICAgICBmaWVsZE9wdGlvbnMsXG4gICAgICAgICk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiByZWNvcmQuaGFzRmllbGRzKGZpZWxkKS5icmFuY2goXG4gICAgICAgIG1lcmdlV2l0aE1hbnlSZWNvcmRzKFxuICAgICAgICAgIHJlbGF0ZWRUYWJsZSxcbiAgICAgICAgICByZWxhdGVkVHlwZSxcbiAgICAgICAgICByZWNvcmQsXG4gICAgICAgICAgZmllbGQsXG4gICAgICAgICAgZmllbGRPcHRpb25zLFxuICAgICAgICApLFxuICAgICAgICB7fSxcbiAgICAgICk7XG4gICAgfVxuXG4gICAgcmV0dXJuIHJlY29yZC5oYXNGaWVsZHMoZmllbGQpLmJyYW5jaChcbiAgICAgIG1lcmdlV2l0aFNpbmdsZVJlY29yZChcbiAgICAgICAgcmVsYXRlZFRhYmxlLFxuICAgICAgICByZWNvcmQsXG4gICAgICAgIGZpZWxkLFxuICAgICAgICBmaWVsZE9wdGlvbnMsXG4gICAgICApLFxuICAgICAge30sXG4gICAgKTtcbiAgfSkpKTtcblxuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmVcbiAgdGFibGUgPSB0YWJsZS5tZXJnZShmaWVsZHNUb01lcmdlKTtcblxuICByZXR1cm4gdGFibGU7XG59O1xuIl19

@@ -16,3 +16,3 @@ 'use strict';

exports.default = function (record, schema) {
exports.default = function (record, type) {
var normalizedRecord = _extends({}, record, {

@@ -38,4 +38,4 @@ _meta: {

Object.keys(schema.relationships).forEach(function (relationship) {
var relationshipObject = schema.relationships[relationship];
Object.keys(type.relationships).forEach(function (relationship) {
var relationshipObject = type.relationships[relationship];
var field = relationshipObject.field;

@@ -66,2 +66,2 @@ var relation = relationshipObject.relation;

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9ub3JtYWxpemVSZWNvcmQuanMiXSwibmFtZXMiOlsicmVjb3JkIiwic2NoZW1hIiwibm9ybWFsaXplZFJlY29yZCIsIl9tZXRhIiwiX2FyY2hpdmVkIiwibm9ybWFsaXplIiwiaWQiLCJfcmVsYXRlZCIsIm5vcm1hbGl6ZU1hbnkiLCJpZHMiLCJtYXAiLCJPYmplY3QiLCJrZXlzIiwicmVsYXRpb25zaGlwcyIsImZvckVhY2giLCJyZWxhdGlvbnNoaXBPYmplY3QiLCJyZWxhdGlvbnNoaXAiLCJmaWVsZCIsInJlbGF0aW9uIiwiaW52ZXJzZSIsImRhdGEiLCJFcnJvciJdLCJtYXBwaW5ncyI6Ijs7Ozs7O2tRQUFBOzs7QUFDQTs7Ozs7O2tCQUVlLFVBQUNBLE1BQUQsRUFBU0MsTUFBVCxFQUFvQjtBQUNqQyxNQUFNQyxnQ0FDREYsTUFEQztBQUVKRyxXQUFPO0FBQ0xDLGlCQUFXO0FBRE47QUFGSCxJQUFOOztBQU9BLE1BQU1DLFlBQVksU0FBWkEsU0FBWSxDQUFDQyxFQUFEO0FBQUEsV0FBUztBQUN6QkEsWUFEeUI7QUFFekJGLGlCQUFXLEtBRmM7QUFHekJHLGdCQUFVO0FBSGUsS0FBVDtBQUFBLEdBQWxCOztBQU1BLE1BQU1DLGdCQUFnQixTQUFoQkEsYUFBZ0IsQ0FBQ0MsR0FBRDtBQUFBLFdBQVNBLElBQUlDLEdBQUosQ0FBUTtBQUFBLGFBQU1MLFVBQVVDLEVBQVYsQ0FBTjtBQUFBLEtBQVIsQ0FBVDtBQUFBLEdBQ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bnNoaXBzW3JlbGF0aW9uc2hpcF07XG4gICAgY29uc3QgeyBmaWVsZCwgcmVsYXRpb24sIGludmVyc2UgfSA9IHJlbGF0aW9uc2hpcE9iamVjdDtcbiAgICBjb25zdCBkYXRhID0gcmVjb3JkW2ZpZWxkXTtcblxuICAgIGlmIChoYXNPd25Qcm9wZXJ0eShyZWNvcmQsIGZpZWxkKSkge1xuICAgICAgc3dpdGNoIChyZWxhdGlvbikge1xuICAgICAgICBjYXNlICdoYXNNYW55JzpcbiAgICAgICAgICBpZiAoaW52ZXJzZS5yZWxhdGlvbiA9PT0gJ2hhc01hbnknKSBub3JtYWxpemVkUmVjb3JkW2ZpZWxkXSA9IG5vcm1hbGl6ZU1hbnkoZGF0YSk7XG4gICAgICAgICAgZWxzZSBkZWxldGUgbm9ybWFsaXplZFJlY29yZFtmaWVsZF07XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnaGFzT25lJzpcbiAgICAgICAgY2FzZSAnYmVsb25nc1RvJzpcbiAgICAgICAgICBpZiAoIWRhdGEpIG5vcm1hbGl6ZWRSZWNvcmRbZmllbGRdID0gZGF0YTtcbiAgICAgICAgICBlbHNlIG5vcm1hbGl6ZWRSZWNvcmRbZmllbGRdID0gbm9ybWFsaXplKGRhdGEpO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgICAgICAgYFRyaWVkIHRvIG5vcm1hbGl6ZSByZWNvcmQgd2l0aCBhbiBpbnZhbGlkIHJlbGF0aW9uc2hpcCBvZiB0eXBlICcke3JlbGF0aW9ufSdgXG4gICAgICAgICAgKTtcbiAgICAgIH1cbiAgICB9XG4gIH0pO1xuXG4gIHJldHVybiBub3JtYWxpemVkUmVjb3JkO1xufTtcbiJdfQ==

@@ -15,12 +15,10 @@ 'use strict';

/* eslint-disable no-param-reassign */
exports.default = function (record, schema, id) {
exports.default = function (record, type, id) {
var syncRelationshipsArray = [];
Object.keys(schema.relationships).forEach(function (relationship) {
var relationshipObject = schema.relationships[relationship];
var field = relationshipObject.field;
var relation = relationshipObject.relation;
var inverse = relationshipObject.inverse;
var inverseType = inverse.type;
type.relationships.forEach(function (relationship) {
var field = relationship.field;
var relation = relationship.relation;
var inverse = relationship.inverse;
var inverseName = inverse.name;
var inverseField = inverse.field;

@@ -37,7 +35,7 @@ var inverseRelation = inverse.relation;

var dataCoercedToArray = Array.isArray(data) ? data : [data];
queryToPush = (0, _queries.pushIdToInverseField)(inverseType, inverseField, [], dataCoercedToArray, id);
queryToPush = (0, _queries.pushIdToInverseField)(inverseName, inverseField, [], dataCoercedToArray, id);
}
if (inverseRelation === 'hasOne') {
queryToPush = relation === 'hasMany' ? (0, _queries.putIdToManyRecordsField)(inverseType, data, inverseField, id) : (0, _queries.putIdToRecordField)(inverseType, data, inverseField, id);
queryToPush = relation === 'hasMany' ? (0, _queries.putIdToManyRecordsField)(inverseName, data, inverseField, id) : (0, _queries.putIdToRecordField)(inverseName, data, inverseField, id);
}

@@ -51,2 +49,2 @@

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9zeW5jUmVsYXRpb25zaGlwcy5qcyJdLCJuYW1lcyI6WyJyZWNvcmQiLCJzY2hlbWEiLCJpZCIsInN5bmNSZWxhdGlvbnNoaXBzQXJyYXkiLCJPYmplY3QiLCJrZXlzIiwicmVsYXRpb25zaGlwcyIsImZvckVhY2giLCJyZWxhdGlvbnNoaXBPYmplY3QiLCJyZWxhdGlvbnNoaXAiLCJmaWVsZCIsInJlbGF0aW9uIiwiaW52ZXJzZSIsImludmVyc2VUeXBlIiwidHlwZSIsImludmVyc2VGaWVsZCIsImludmVyc2VSZWxhdGlvbiIsImRhdGEiLCJxdWVyeVRvUHVzaCIsImRhdGFDb2VyY2VkVG9BcnJheSIsIkFycmF5IiwiaXNBcnJheSIsInB1c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TtcblxuICByZXR1cm4gc3luY1JlbGF0aW9uc2hpcHNBcnJheTtcbn07XG4iXX0=
{
"name": "redink",
"version": "3.0.0-alpha.1",
"version": "3.0.0-alpha.2",
"description": "RethinkDB model layer",
"main": "dist/index.js",
"license": "MIT",
"author": "Dylan Slack",
"repository": "directlyio/redink",
"contributors": [
"Miguel Oller",
"CJ Brewer",
"Eric Bukowski"
],
"keywords": [
"RethinkDB",
"ORM"
],
"scripts": {

@@ -13,28 +25,8 @@ "build": "npm run clean && mkdirp dist && babel src --out-dir dist",

"test:lint": "eslint src test",
"test:src": "nyc ava && nyc report --reporter=lcov",
"test:src": "ava",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/directlyio/redink.git"
},
"keywords": [
"RethinkDB",
"ORM"
],
"author": "Dylan Slack",
"contributors": [
"Miguel Oller",
"CJ Brewer",
"Eric Bukowski"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/directlyio/redink/issues"
},
"homepage": "https://github.com/directlyio/redink#readme",
"dependencies": {
"bluebird": "^3.4.6",
"chalk": "^1.1.3",
"debug": "^2.2.0",
"rethinkdb": "^2.3.2"

@@ -50,4 +42,4 @@ },

"babel-preset-stage-0": "^6.16.0",
"cohere": "^1.0.0",
"doctrine": "^1.5.0",
"dotenv": "^2.0.0",
"eslint": "^3.0.1",

@@ -61,3 +53,2 @@ "eslint-config-airbnb": "^9.0.1",

"nyc": "^7.0.0",
"redink-schema": "0.0.1",
"rimraf": "^2.5.3"

@@ -64,0 +55,0 @@ },

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc