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

nothinkdb

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nothinkdb - npm Package Compare versions

Comparing version 0.5.25 to 0.5.26

51

lib/Environment.js

@@ -7,5 +7,22 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* eslint no-shadow: 0 */
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _lodash = require('lodash');

@@ -19,8 +36,8 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { return step("next", value); }, function (err) { return step("throw", err); }); } } return step("next"); }); }; }
/* eslint no-shadow: 0 */
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var debug = require('debug')('nothinkdb:Environment');

@@ -31,5 +48,3 @@

var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, Environment);
(0, _classCallCheck3.default)(this, Environment);
var _options$Table = options.Table;

@@ -42,3 +57,3 @@ var Table = _options$Table === undefined ? _Table3.default : _options$Table;

_createClass(Environment, [{
(0, _createClass3.default)(Environment, [{
key: 'createTable',

@@ -48,3 +63,2 @@ value: function createTable(options) {

if (this.hasTable(tableName)) {

@@ -77,6 +91,6 @@ debug('[createTable] tableName: \'' + tableName + '\' is already defined');

value: function () {
var ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee3(connection) {
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(connection) {
var _this = this;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {

@@ -86,5 +100,5 @@ switch (_context3.prev = _context3.next) {

_context3.next = 2;
return Promise.all(_lodash2.default.map(this.tables, function () {
var ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(table) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
return _promise2.default.all(_lodash2.default.map(this.tables, function () {
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(table) {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {

@@ -100,4 +114,4 @@ switch (_context2.prev = _context2.next) {

return connection().then(function () {
var ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(connection) {
return regeneratorRuntime.wrap(function _callee$(_context) {
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(connection) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -120,3 +134,2 @@ switch (_context.prev = _context.next) {

}));
return function (_x4) {

@@ -142,3 +155,2 @@ return ref.apply(this, arguments);

}));
return function (_x3) {

@@ -164,3 +176,2 @@ return ref.apply(this, arguments);

}]);
return Environment;

@@ -167,0 +178,0 @@ }();

@@ -7,4 +7,10 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _assert = require('assert');

@@ -14,8 +20,8 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Link = function () {
_createClass(Link, null, [{
(0, _createClass3.default)(Link, null, [{
key: 'validateLinkData',

@@ -34,5 +40,3 @@ value: function validateLinkData(linkData) {

var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
_classCallCheck(this, Link);
(0, _classCallCheck3.default)(this, Link);
var left = options.left;

@@ -39,0 +43,0 @@ var right = options.right;

'use strict';
var _defineProperty = require('babel-runtime/core-js/object/define-property');
var _defineProperty2 = _interopRequireDefault2(_defineProperty);
var _keys = require('babel-runtime/core-js/object/keys');
var _keys2 = _interopRequireDefault2(_keys);
function _interopRequireDefault2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
Object.defineProperty(exports, "__esModule", {

@@ -10,5 +20,6 @@ value: true

Object.keys(_relations).forEach(function (key) {
(0, _keys2.default)(_relations).forEach(function (key) {
if (key === "default") return;
Object.defineProperty(exports, key, {
(0, _defineProperty2.default)(exports, key, {
enumerable: true,

@@ -21,4 +32,2 @@ get: function get() {

require('babel-polyfill');
var _Table2 = require('./Table');

@@ -36,3 +45,5 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}

@@ -39,0 +50,0 @@ exports.Table = _Table3.default;

@@ -7,4 +7,10 @@ 'use strict';

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
exports.hasOne = hasOne;

@@ -31,7 +37,8 @@ exports.belongsTo = belongsTo;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* eslint no-shadow: 0 */
/* eslint no-shadow: 0 */
function parseOptions(options) {

@@ -41,3 +48,3 @@ return _lodash2.default.chain(options).omitBy(function (value, key) {

}).reduce(function (memo, value, key) {
return _defineProperty({}, key.slice(1), value);
return (0, _defineProperty3.default)({}, key.slice(1), value);
}, {}).value();

@@ -51,3 +58,2 @@ }

function getIndex(rowOrPk) {

@@ -77,3 +83,2 @@ var index = void 0;

var query = left.table.query().getAll(index, { index: left.field });

@@ -93,3 +98,3 @@ query = apply(query);

return right.table.get(onePk).do(function (rightRow) {
return left.table.update(otherPk, _defineProperty({}, left.field, rightRow(right.field)));
return left.table.update(otherPk, (0, _defineProperty3.default)({}, left.field, rightRow(right.field)));
});

@@ -101,3 +106,3 @@ }

return left.table.update(otherPk, _defineProperty({}, left.field, null));
return left.table.update(otherPk, (0, _defineProperty3.default)({}, left.field, null));
}

@@ -131,3 +136,2 @@

function getIndex(rowOrPk) {

@@ -159,3 +163,2 @@ var index = void 0;

var query = right.table.query().getAll(index, { index: right.field });

@@ -175,3 +178,3 @@ query = apply(query);

return right.table.get(otherPk).do(function (rightRow) {
return left.table.update(onePk, _defineProperty({}, left.field, rightRow(right.field)));
return left.table.update(onePk, (0, _defineProperty3.default)({}, left.field, rightRow(right.field)));
});

@@ -183,3 +186,3 @@ }

return left.table.update(onePk, _defineProperty({}, left.field, null));
return left.table.update(onePk, (0, _defineProperty3.default)({}, left.field, null));
}

@@ -213,3 +216,2 @@

function getIndex(rowOrPk) {

@@ -241,3 +243,2 @@ var index = void 0;

var query = left.table.query();

@@ -259,3 +260,3 @@ query = query.getAll(index, { index: left.field });

return right.table.get(onePk).do(function (rightRow) {
return left.table.update(otherPk, _defineProperty({}, left.field, rightRow(right.field)));
return left.table.update(otherPk, (0, _defineProperty3.default)({}, left.field, rightRow(right.field)));
});

@@ -267,3 +268,3 @@ }

return left.table.update(otherPk, _defineProperty({}, left.field, null));
return left.table.update(otherPk, (0, _defineProperty3.default)({}, left.field, null));
}

@@ -297,3 +298,3 @@

var _link = _slicedToArray(link, 2);
var _link = (0, _slicedToArray3.default)(link, 2);

@@ -336,3 +337,2 @@ var link1 = _link[0];

var targetIdsQuery = relationTable.query().getAll(index, { index: link1.left.field }).hasFields(link2.left.field);

@@ -363,3 +363,3 @@

return relationTable.create((_relationTable$create = {}, _defineProperty(_relationTable$create, link1.left.field, onePk), _defineProperty(_relationTable$create, link2.left.field, otherPk), _relationTable$create));
return relationTable.create((_relationTable$create = {}, (0, _defineProperty3.default)(_relationTable$create, link1.left.field, onePk), (0, _defineProperty3.default)(_relationTable$create, link2.left.field, otherPk), _relationTable$create));
});

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

relation = relationTable.create((_relationTable$create2 = {}, _defineProperty(_relationTable$create2, link1.left.field, onePk), _defineProperty(_relationTable$create2, link2.left.field, otherPk), _relationTable$create2));
relation = relationTable.create((_relationTable$create2 = {}, (0, _defineProperty3.default)(_relationTable$create2, link1.left.field, onePk), (0, _defineProperty3.default)(_relationTable$create2, link2.left.field, otherPk), _relationTable$create2));
}

@@ -394,3 +394,3 @@ return relationTable.insert(relation, { conflict: 'replace' });

} else {
query = query.filter(_defineProperty({}, link2.left.field, otherPk));
query = query.filter((0, _defineProperty3.default)({}, link2.left.field, otherPk));
}

@@ -397,0 +397,0 @@ }

@@ -15,3 +15,5 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}

@@ -18,0 +20,0 @@ var schema = {

@@ -7,7 +7,34 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* eslint no-shadow: 0, no-param-reassign: 0 */
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends3 = require('babel-runtime/helpers/extends');
var _extends4 = _interopRequireDefault(_extends3);
var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _rethinkdb = require('rethinkdb');

@@ -33,20 +60,13 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var debug = require('debug')('nothinkdb'); /* eslint no-shadow: 0, no-param-reassign: 0 */
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { return step("next", value); }, function (err) { return step("throw", err); }); } } return step("next"); }); }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var debug = require('debug')('nothinkdb');
var Table = function () {
function Table() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
(0, _classCallCheck3.default)(this, Table);
_classCallCheck(this, Table);
var _Joi$attempt = _joi2.default.attempt(options, {

@@ -78,3 +98,3 @@ tableName: _joi2.default.string().required(),

_createClass(Table, [{
(0, _createClass3.default)(Table, [{
key: 'metaFields',

@@ -161,4 +181,4 @@ value: function metaFields(metaKey) {

value: function () {
var ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(connection) {
return regeneratorRuntime.wrap(function _callee$(_context) {
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(connection) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -194,4 +214,4 @@ switch (_context.prev = _context.next) {

value: function () {
var ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(connection) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(connection) {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {

@@ -220,11 +240,11 @@ switch (_context2.prev = _context2.next) {

value: function () {
var ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee3(connection) {
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(connection) {
var _this = this;
var indexFields;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
indexFields = [].concat(_toConsumableArray(this.metaFields('index')), _toConsumableArray(this.metaFields('unique')));
indexFields = [].concat((0, _toConsumableArray3.default)(this.metaFields('index')), (0, _toConsumableArray3.default)(this.metaFields('unique')));
_context3.next = 3;

@@ -235,3 +255,3 @@ return indexFields.reduce(function (promise, indexName) {

});
}, Promise.resolve());
}, _promise2.default.resolve());

@@ -244,3 +264,3 @@ case 3:

});
}, Promise.resolve());
}, _promise2.default.resolve());

@@ -264,4 +284,4 @@ case 5:

value: function () {
var ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee4(connection, indexName, option) {
return regeneratorRuntime.wrap(function _callee4$(_context4) {
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(connection, indexName, option) {
return _regenerator2.default.wrap(function _callee4$(_context4) {
while (1) {

@@ -313,3 +333,3 @@ switch (_context4.prev = _context4.next) {

var insertData = _extends({}, data);
var insertData = (0, _extends4.default)({}, data);
if (this.hasField('createdAt')) {

@@ -338,3 +358,3 @@ insertData.createdAt = _rethinkdb2.default.now();

var updateData = _extends({}, data);
var updateData = (0, _extends4.default)({}, data);
if (this.hasField('updatedAt')) {

@@ -346,3 +366,3 @@ updateData.updatedAt = _rethinkdb2.default.now();

var selectionQuery = _lodash2.default.isArray(pk) ? (_query2 = _this3.query()).getAll.apply(_query2, _toConsumableArray(pk)) : _this3.query().get(pk);
var selectionQuery = _lodash2.default.isArray(pk) ? (_query2 = _this3.query()).getAll.apply(_query2, (0, _toConsumableArray3.default)(pk)) : _this3.query().get(pk);
return selectionQuery.update.apply(selectionQuery, [updateData].concat(options));

@@ -408,3 +428,3 @@ });

return _extends({}, joinObject, _defineProperty({}, key, relatedQuery));
return (0, _extends4.default)({}, joinObject, (0, _defineProperty3.default)({}, key, relatedQuery));
}, {}).value();

@@ -452,3 +472,2 @@ });

}]);
return Table;

@@ -455,0 +474,0 @@ }();

{
"name": "nothinkdb",
"version": "0.5.25",
"version": "0.5.26",
"description": "Functional toolkit for rethinkdb",

@@ -11,3 +11,3 @@ "main": "lib/nothinkdb.js",

"test": "mocha --compilers js:babel-register --timeout 20000 ./src/**/__tests__/*-test.js",
"build": "babel --ignore *-test.js -d lib src",
"build": "babel --ignore *-test.js -d lib src && babel -d lib lib",
"clean": "rimraf lib",

@@ -39,7 +39,5 @@ "lint": "eslint src",

"babel-plugin-transform-runtime": "^6.9.0",
"babel-polyfill": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.9.0",
"babel-runtime": "^6.9.0",
"chai": "^3.4.1",

@@ -54,2 +52,3 @@ "eslint": "^2.10.2",

"dependencies": {
"babel-runtime": "^6.9.0",
"debug": "^2.2.0",

@@ -56,0 +55,0 @@ "joi": "^7.2.3",

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