New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rethinkdbdash

Package Overview
Dependencies
Maintainers
1
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rethinkdbdash - npm Package Compare versions

Comparing version 1.15.3 to 1.16.0

lib/stream.js

64

lib/connection.js

@@ -9,2 +9,3 @@ var net = require('net');

var Cursor = require(__dirname+"/cursor.js");
var Stream = require(__dirname+"/stream.js");

@@ -142,2 +143,3 @@ var protodef = require(__dirname+"/protodef.js");

var cursor;
var stream;
var currentResolve, currentReject;

@@ -198,3 +200,4 @@ var datum;

if ((Array.isArray(datum)) && (self.options[token].cursor === true)) {
if ((Array.isArray(datum)) &&
((self.options[token].cursor === true || self.r._options.cursor === true))) {
cursor = new Cursor(self, token, self.options[token], 'cursor');

@@ -213,2 +216,19 @@ if (self.options[token].profile === true) {

}
else if ((Array.isArray(datum)) &&
((self.options[token].stream === true || self.r._options.stream === true))) {
cursor = new Cursor(self, token, self.options[token], 'cursor');
stream = new Stream(cursor);
if (self.options[token].profile === true) {
self.resolveMap[token]({
profile: response.p,
result: stream
});
}
else {
self.resolveMap[token](stream);
}
cursor._push({done: true, response: { r: datum }});
}
else {

@@ -233,3 +253,3 @@ if (self.options[token].profile === true) {

}
else if (type === responseTypes.SUCCESS_FEED) {
else if ((type === responseTypes.SUCCESS_FEED) || (type === responseTypes.SUCCESS_ATOM_FEED)) {
if (typeof self.resolveMap[token] === "function") {

@@ -242,5 +262,12 @@ // We save the current resolve function because we are going to call cursor._fetch before resuming the user's yield

//Handle stream: true
if (!self.cursors[token]) { //No cursor, let's create one
self.cursors[token] = true;
cursor = new Cursor(self, token, self.options[token], 'feed');
if (type === responseTypes.SUCCESS_ATOM_FEED) {
cursor = new Cursor(self, token, self.options[token], 'atomFeed');
}
else {
cursor = new Cursor(self, token, self.options[token], 'feed');
}
cursor._push({done: false, response: response});

@@ -279,3 +306,3 @@ if (self.options[token].profile === true) {

if (self.options[token].cursor === true) {
if ((self.options[token].cursor === true || self.r._options.cursor === true)) {
// Return a cursor

@@ -292,2 +319,14 @@ if (self.options[token].profile === true) {

}
else if ((self.options[token].stream === true || self.r._options.stream === true)) {
stream = new Stream(cursor);
if (self.options[token].profile === true) {
currentResolve({
profile: response.p,
result: stream
});
}
else {
currentResolve(stream);
}
}
else {

@@ -326,3 +365,3 @@ // When we get SUCCESS_SEQUENCE, we will delete self.options[token]

if (self.options[token].cursor === true) {
if ((self.options[token].cursor === true || self.r._options.cursor === true)) {
if (self.options[token].profile === true) {

@@ -341,2 +380,17 @@ currentResolve({

}
else if ((self.options[token].stream === true || self.r._options.stream === true)) {
stream = new Stream(cursor);
if (self.options[token].profile === true) {
currentResolve({
profile: response.p,
result: stream
});
}
else {
currentResolve(stream);
}
// We need to keep the options in the else statement, so we clean it inside the if/else blocks
delete self.options[token];
}
else {

@@ -343,0 +397,0 @@ cursor.toArray().then(function(result) {

13

lib/cursor.js

@@ -19,3 +19,3 @@ var Promise = require("bluebird");

this._closeAsap = false; // Close as soon as the next batch arrive
if (type === 'feed') {
if ((type === 'feed') || (type === 'atomFeed')) {
this.toArray = function() {

@@ -33,2 +33,5 @@ throw new Error("The `toArray` method is not available on feeds.")

}
else if (this._type === 'atomFeed') {
return '[object AtomFeed]'
}
else {

@@ -39,5 +42,9 @@ return '[object Cursor]'

Cursor.prototype.getType = function() {
return this._type;
}
Cursor.prototype.toJSON = function() {
if (this._type === 'feed') {
return "You cannot serialize to JSON a feed. Retrieve data from the cursor with `each` or `next`."
if ((this._type === 'feed') || (this._type === 'atomFeed')) {
throw "You cannot serialize to JSON a feed. Retrieve data from the feed with `each` or `next`."
}

@@ -44,0 +51,0 @@ else {

@@ -166,3 +166,4 @@ var helper = require(__dirname+"/helper.js");

DESC: true,
ASC: true
ASC: true,
RANGE: true
}

@@ -204,4 +205,4 @@ var nonPrefix = {};

WITH_FIELDS: "withFields",
CONCATMAP: "concatMap",
ORDERBY: "orderBy",
CONCAT_MAP: "concatMap",
ORDER_BY: "orderBy",
DESC: "desc",

@@ -283,3 +284,3 @@ ASC: "asc",

BRANCH: "branch",
FOREACH: "forEach",
FOR_EACH: "forEach",
ERROR: "error",

@@ -289,3 +290,3 @@ DEFAULT: "default",

COERCE_TO: "coerceTo",
TYPEOF: "typeOf",
TYPE_OF: "typeOf",
INFO: "info",

@@ -312,3 +313,10 @@ JSON: "json",

POLYGON_SUB: "polygonSub",
UUID: "uuid"
UUID: "uuid",
RANGE: "range",
TO_JSON_STRING: "toJSON",
CONFIG: "config",
STATUS: "status",
WAIT: "wait",
RECONFIGURE: "reconfigure",
REBALANCE: "rebalance"
}

@@ -405,3 +413,3 @@ var typeToString = {};

if ((term[1].length === 0) || (term[1][0][0] !== termTypes.DB)) {
if ((term.length === 1) || (term[1].length === 0) || (term[1][0][0] !== termTypes.DB)) {
var underline = Array.isArray(frames) && (frames.length === 0);

@@ -667,3 +675,41 @@ if (Array.isArray(frames)) currentFrame = frames.shift();

return result;
}
},
WAIT: function(term, index, father, frames, options) {
var result = {
str: "",
car: ""
}
var backtrace, underline, currentFrame;
if (term.length === 1 || term[1].length === 0) {
backtrace = generateWithoutPrefixBacktrace(term, index, father, frames, options);
result.str = backtrace.str;
result.car = backtrace.car;
}
else {
backtrace = generateNormalBacktrace(term, index, father, frames, options);
result.str = backtrace.str;
result.car = backtrace.car;
}
return result;
},
MAP: function(term, index, father, frames, options) {
var result = {
str: "",
car: ""
}
var backtrace, underline, currentFrame;
if (term.length > 1 && term[1].length > 2) {
backtrace = generateWithoutPrefixBacktrace(term, index, father, frames, options);
result.str = backtrace.str;
result.car = backtrace.car;
}
else {
backtrace = generateNormalBacktrace(term, index, father, frames, options);
result.str = backtrace.str;
result.car = backtrace.car;
}
return result;
},
}

@@ -673,2 +719,5 @@ _specialType.TABLE_CREATE = _specialType.TABLE;

_specialType.TABLE_LIST = _specialType.TABLE;
_specialType.RECONFIGURE = _specialType.WAIT;
_specialType.REBALANCE = _specialType.WAIT;
_specialType.BRACKET = _specialType.GET_FIELD;

@@ -820,2 +869,7 @@ var specialType = {};

}
backtrace = makeOptargs(term, i, term, frames, options, currentFrame)
result.str += backtrace.str;
result.car += backtrace.car;
carify(result, ")", underline);

@@ -867,1 +921,2 @@

module.exports.generateBacktrace = generateBacktrace;

@@ -8,2 +8,3 @@ var Promise = require("bluebird");

var Pool = require(__dirname+"/pool.js");
var termTypes = require(__dirname+"/protodef.js").Term.TermType;

@@ -260,3 +261,9 @@ function r(options) {

Term.prototype._arityRange(arguments, 0, 1, 'r.error', this);
return new Term(this).error(errorStr);
var term = new Term(this);
term._query.push(termTypes.ERROR);
if (errorStr !== undefined) {
term._query.push([new Term(this).expr(errorStr)._query]);
}
return term;
}

@@ -291,6 +298,6 @@ r.prototype.json = function(json) {

}
r.prototype.binary = function() {
r.prototype.binary = function(bin) {
Term.prototype._arity(arguments, 1, 'r.binary', this);
var term = new Term(this);
return term.binary.call(term, arguments[0]);
return term.binary(bin);
}

@@ -322,7 +329,32 @@ r.prototype.uuid = function() {

}
r.prototype.geojson = function() {
r.prototype.geojson = function(value) {
Term.prototype._arity(arguments, 1, 'r.geojson', this);
var term = new Term(this);
return term.geojson.call(term, arguments[0]);
return term.geojson(value);
}
r.prototype.range = function() {
Term.prototype._arityRange(arguments, 1, 2, 'r.range', this);
var term = new Term(this);
return term.range.apply(term, helper.toArray(arguments));
}
r.prototype.wait = function() {
Term.prototype._arity(arguments, 0, 'r.wait', this);
var term = new Term(this);
return term.wait();
}
r.prototype.reconfigure = function(config) {
Term.prototype._arity(arguments, 1, 'r.reconfigure', this);
var term = new Term(this);
return term.reconfigure(config);
}
r.prototype.rebalance = function(config) {
Term.prototype._arity(arguments, 0, 'r.rebalance', this);
var term = new Term(this);
return term.rebalance();
}
r.prototype.map = function() {
Term.prototype._arityRange(arguments, 1, Infinity, 'r.map', this);
var term = new Term(this);
return term.map.apply(term, helper.toArray(arguments));
};

@@ -333,3 +365,3 @@

function main (options) {
function main(options) {
var _r = new r();

@@ -339,4 +371,7 @@

if (options.pool !== false) _r.createPool(options);
_r._options = {};
if (options.cursor === true) _r._options.cursor = true;
if (options.stream === true) _r._options.stream = true;
return _r;
}
module.exports = main;

@@ -26,3 +26,5 @@ var Promise = require('bluebird');

timeout: options.timeout || this._r._timeoutConnect,
authKey: options.authKey || this._r._authKey
authKey: options.authKey || this._r._authKey,
cursor: options.cursor || false,
stream: options.stream || false
}

@@ -29,0 +31,0 @@

@@ -45,2 +45,3 @@ // DO NOT EDIT

WAIT_COMPLETE: 4,
SUCCESS_ATOM_FEED: 6,
CLIENT_ERROR: 16,

@@ -117,4 +118,4 @@ COMPILE_ERROR: 17,

FILTER: 39,
CONCATMAP: 40,
ORDERBY: 41,
CONCAT_MAP: 40,
ORDER_BY: 41,
DISTINCT: 42,

@@ -130,2 +131,3 @@ COUNT: 43,

ZIP: 72,
RANGE: 173,
INSERT_AT: 82,

@@ -136,3 +138,3 @@ DELETE_AT: 83,

COERCE_TO: 51,
TYPEOF: 52,
TYPE_OF: 52,
UPDATE: 53,

@@ -148,2 +150,7 @@ DELETE: 54,

TABLE_LIST: 62,
CONFIG: 174,
STATUS: 175,
WAIT: 177,
RECONFIGURE: 176,
REBALANCE: 179,
SYNC: 138,

@@ -160,3 +167,3 @@ INDEX_CREATE: 75,

ALL: 67,
FOREACH: 68,
FOR_EACH: 68,
FUNC: 69,

@@ -172,2 +179,3 @@ ASC: 73,

JSON: 98,
TO_JSON_STRING: 172,
ISO8601: 99,

@@ -174,0 +182,0 @@ TO_ISO8601: 100,

{
"name": "rethinkdbdash",
"version": "1.15.3",
"version": "1.16.0",
"description": "A Node.js driver for RethinkDB with promises and a connection pool",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -46,3 +46,3 @@ rethinkdbdash

app.use(function *(){
var result = yield r.table("foo").get("bar").run();
var result = yield r.table("foo").get("bar");

@@ -67,3 +67,3 @@ this.body = JSON.stringify(result);

try{
result = yield r.table("foo").get("bar").run();
result = yield r.table("foo").get("bar");
console.log(JSON.stringify(result, null, 2));

@@ -96,3 +96,3 @@ }

This section references all the differences. For all the other methods not
mentionned here, please refer to the
mentioned here, please refer to the
[official driver's documentation](http://www.rethinkdb.com/api/javascript/).

@@ -119,3 +119,3 @@

max: <number>, // maximum number of connections in the pool, default 1000
timeout: <number>, // number of seconds for a connections to be opened, default 20
timeout: <number>, // number of seconds for a connection to be opened, default 20
timeoutError: <number>, // wait time before reconnecting in case of an error (in ms), default 1000

@@ -125,2 +125,4 @@ timeoutGb: <number>, // how long the pool keep a connection that hasn't been used (in ms), default 60*60*1000

silent: <boolean> // console.error errors (default false)
cursor: <boolean> // if you want a cursor by default instead of an array or feed, default false
stream: <boolean> // if you want a stream by default instead of an array or feed, default false
}

@@ -135,3 +137,6 @@ ```

Rethinkdbdash implements `then`, `catch` and `error` as a shortcut for `run().then/catch/error`. So if you use
`yield`, you basically do not have to call `run` at the end of a query.
#### Connection pool ####

@@ -196,3 +201,3 @@

Rethinkdbdash automatically coerce cursor to arrays. If you need a raw cursor, you can call the
`run` command with the option `{cursor: true}`.
`run` command with the option `{cursor: true}` or import the driver with `{cursor: true}`.

@@ -208,6 +213,23 @@ ```js

console.log(JSON.stringify(result)) // print [1, 2, 3]
```
#### Stream ####
Rethinkdbdash automatically coerce cursor to arrays. If you need a stream, you can call the
`run` command with the option `{stream: true}` or import the driver with `{stream: true}`.
```js
var result = yield r.expr([1, 2, 3]).run()
console.log(JSON.stringify(result)) // print [1, 2, 3]
// Or with a cursor
var cursor = yield r.expr([1, 2, 3]).run({cursor: true})
var result = yield cursor.toArray();
console.log(JSON.stringify(result)) // print [1, 2, 3]
```
_Note_: Make sure to not pass the option `cursor: true` or a cursor will be returned.
#### Errors ####

@@ -214,0 +236,0 @@ - Better backtraces

@@ -51,6 +51,7 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run(connection);
assert.deepEqual(result, {created:1});
assert.equal(result.config_changes.length, 1);
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run(connection);
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -73,6 +74,6 @@ result = yield r.db(dbName).table(tableName).insert(eval('['+new Array(100).join('{}, ')+'{}]')).run(connection);

var result = yield r.dbCreate(dbName).run(connection);
assert.deepEqual(result, {created: 1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run(connection);
assert.deepEqual(result, {created: 1});
assert.equal(result.tables_created, 1);

@@ -99,6 +100,6 @@ result = yield connection.close();

var result = yield r.dbCreate(dbName).run(connection);
assert.deepEqual(result, {created: 1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run(connection);
assert.deepEqual(result, {created: 1});
assert.equal(result.tables_created, 1);

@@ -232,6 +233,6 @@ connection.use(dbName);

try {
result = yield r.expr(1).run(connection, {db: "db"});
result = yield r.expr(1).run(connection, {foo: "bar"});
}
catch(e) {
if (e.message === "Unrecognized option `db` in `run`. Available options are useOutdated <bool>, durability <string>, noreply <bool>, timeFormat <string>, groupFormat: <string>, profile <bool>, binaryFormat <bool>, cursor <bool>.") {
if (e.message === "Unrecognized option `foo` in `run`. Available options are useOutdated <bool>, durability <string>, noreply <bool>, timeFormat <string>, groupFormat: <string>, profile <bool>, binaryFormat <bool>, cursor <bool>, stream <bool>.") {
done();

@@ -238,0 +239,0 @@ }

@@ -19,6 +19,6 @@ var config = require(__dirname+'/config.js');

var result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);
var result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -293,2 +293,3 @@ done();

catch(e) {
console.log(e);
done(e);

@@ -295,0 +296,0 @@ }

@@ -126,6 +126,6 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1})
assert.equal(result.dbs_created, 1)
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1})
assert.equal(result.tables_created, 1)

@@ -156,6 +156,7 @@ result = yield r.expr([{foo: "bar"}, {foo: "foo"}]).forEach(function(doc) {

})
It("`default` should work", function* (done) {
It("`r.range(x)` should work", function* (done) {
try {
var result = yield r.expr({a:1})("b").default("Hello").run();
assert.equal(result, "Hello");
var result = yield r.range(10).run();
assert.deepEqual(result, [0,1,2,3,4,5,6,7,8,9]);

@@ -165,18 +166,58 @@ done();

catch(e) {
console.log(e);
done(e);
}
})
It("`error` is not defined after a term", function* (done) {
It("`r.range(x, y)` should work", function* (done) {
try {
result = yield r.expr(1).error("error").run();
var result = yield r.range(3,10).run();
assert.deepEqual(result, [3,4,5,6,7,8,9]);
done();
}
catch(e) {
if (e.message === "`error` is not defined after:\nr.expr(1)") {
done()
console.log(e);
done(e);
}
})
It("`r.range(1,2,3)` should throw - arity", function* (done) {
try {
var result = yield r.range(1,2,3).run()
done(new Error("Was expecting an error"));
}
catch(e) {
if (e.message.match(/^`r.range` takes at most 2 arguments, 3 provided/) !== null) {
done();
}
else {
done(e)
done(e);
}
}
})
It("`r.range()` should throw - arity", function* (done) {
try {
var result = yield r.range().run()
done(new Error("Was expecting an error"));
}
catch(e) {
if (e.message.match(/^`r.range` takes at least 1 argument, 0 provided/) !== null) {
done();
}
else {
done(e);
}
}
})
It("`default` should work", function* (done) {
try {
var result = yield r.expr({a:1})("b").default("Hello").run();
assert.equal(result, "Hello");
done();
}
catch(e) {
done(e);
}
})
It("`default` should throw if no argument has been given", function* (done) {

@@ -312,2 +353,31 @@ try{

})
It("`toJSON` and `toJsonString` should work", function* (done) {
try {
var result = yield r.expr({a:1}).toJSON().run();
assert.equal(result, '{"a":1}');
var result = yield r.expr({a:1}).toJsonString().run();
assert.equal(result, '{"a":1}');
done();
}
catch(e) {
done(e);
}
})
It("`toJSON` should throw if an argument is provided", function* (done) {
try {
var result = yield r.expr({a:1}).toJSON('foo').run();
done(new Error("Expecting error..."));
}
catch(e) {
if (e.message.match(/^`toJSON` takes 0 argument, 1 provided/) !== null) {
done()
}
else {
done(e)
}
}
})
It("`args` should work", function* (done) {

@@ -314,0 +384,0 @@ try {

@@ -14,8 +14,2 @@ var config = require('./config.js');

function It(testName, generatorFn) {
it(testName, function(done) {
Promise.coroutine(generatorFn)(done);
})
}
It("Init for `cursor.js`", function* (done) {

@@ -28,5 +22,5 @@ try {

result = yield r.dbCreate(dbName).run()
assert.deepEqual(result, {created:1});
result = yield [r.db(dbName).tableCreate(tableName).run(), r.db(dbName).tableCreate(tableName2).run()]
assert.deepEqual(result, [{created:1}, {created:1}]);
assert.equal(result.dbs_created, 1);
result = yield [r.db(dbName).tableCreate(tableName)('tables_created').run(), r.db(dbName).tableCreate(tableName2)('tables_created').run()]
assert.deepEqual(result, [1, 1]);
done();

@@ -387,3 +381,28 @@ }

assert.equal(feed.toString(), '[object Feed]');
feed.close();
done();
}
catch(e) {
done(e);
}
})
It("`changes` should work with squash: true", function* (done) {
try {
feed = yield r.db(dbName).table(tableName).changes({squash: true}).run();
assert(feed);
assert.equal(feed.toString(), '[object Feed]');
feed.close();
done();
}
catch(e) {
done(e);
}
})
It("`get.changes` should return a feed", function* (done) {
try {
feed = yield r.db(dbName).table(tableName).get(1).changes().run();
assert(feed);
assert.equal(feed.toString(), '[object AtomFeed]');
feed.close();
done();

@@ -395,3 +414,4 @@ }

})
It("`next` should work on feed", function* (done) {
It("`next` should work on a feed", function* (done) {
try {

@@ -418,2 +438,25 @@ feed = yield r.db(dbName).table(tableName2).changes().run();

})
It("`next` should work on an atom feed", function* (done) {
try {
var idValue = uuid();
feed = yield r.db(dbName).table(tableName2).get(idValue).changes().run();
setImmediate(function() {
r.db(dbName).table(tableName2).insert({id: idValue}).run();
})
assert(feed);
var i=0;
var change = yield feed.next();
assert.deepEqual(change, {new_val: null});
change = yield feed.next();
assert.deepEqual(change, {new_val: {id: idValue}, old_val: null});
feed.close();
done();
}
catch(e) {
done(e);
}
})
It("`close` should work on feed", function* (done) {

@@ -515,1 +558,14 @@ try {

})
It("Import with cursor as default", function* (done) {
var r1 = require('../lib')({cursor: true, host: config.host, port: config.port, authKey: config.authKey, buffer: config.buffer, max: config.max});
var i=0;
try {
cursor = yield r1.db(dbName).table(tableName).run();
assert.equal(cursor.toString(), '[object Cursor]');
done();
}
catch(e) {
done(e);
}
})

@@ -18,6 +18,6 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -613,6 +613,7 @@ done();

catch(e) {
if (e.message.match(/^Expected type OBJECT but found STRING in/)) {
if (e.message.match(/^Cannot call `keys` on objects of type `STRING` in/)) {
done();
}
else {
console.log(e);
done(e);

@@ -619,0 +620,0 @@ }

@@ -10,4 +10,33 @@ var config = require(__dirname+'/config.js');

var uuid = util.uuid;
var dbName, tableName;
var dbName, tableName, result;
It("Init for `extra.js`", function* (done) {
try {
dbName = uuid();
tableName = uuid(); // Big table to test partial sequence
result = yield r.dbCreate(dbName).run()
assert.equal(result.dbs_created, 1);
//yield r.db(dbName).wait().run()
result = yield r.db(dbName).tableCreate(tableName)('tables_created').run();
assert.deepEqual(result, 1);
done();
}
catch(e) {
console.log(e);
done(e);
}
})
It("Change the default database on the fly in run", function* (done) {
try {
result = yield r.tableList().run({db: dbName})
assert.deepEqual(result, [tableName]);
done();
}
catch(e) {
console.log(e);
done(e);
}
})
It("Anonymous function should throw if they return undefined", function* (done) {

@@ -37,1 +66,30 @@ try {

})
It("yield a query should work - 1", function* (done) {
try {
var result = yield r.expr(1);
assert.equal(result, 1);
var result = yield r.expr(1).add(3);
assert.equal(result, 4);
done();
}
catch(e) {
done(e);
}
})
It("yield a query should work - 2", function* (done) {
try {
var result = yield r.expr(1).add("foo");
done(new Error("Was expecting an error"));
}
catch(e) {
if (e.message.match(/Expected type NUMBER but found STRING/)) {
done();
}
else {
done(e);
}
}
})

@@ -19,6 +19,6 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -25,0 +25,0 @@ result = yield r.db(dbName).table(tableName).indexCreate("location", {geo: true}).run();

@@ -19,6 +19,6 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -25,0 +25,0 @@ result = yield r.db(dbName).table(tableName).insert([{val:1}, {val: 2}, {val: 3}]).run();

@@ -40,3 +40,3 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);

@@ -120,3 +120,3 @@ done();

result = yield r.dbDrop(dbName).run();
assert.deepEqual(result, {dropped:1});
assert.deepEqual(result.dbs_dropped, 1);

@@ -123,0 +123,0 @@ done();

@@ -17,3 +17,3 @@ var config = require(__dirname+'/config.js');

var result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);

@@ -43,3 +43,3 @@ done();

result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -75,3 +75,3 @@ result = yield r.db(dbName).tableList().run();

result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -89,3 +89,3 @@ done();

result = yield r.db(dbName).tableCreate(tableName, {primaryKey: "foo"}).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -106,3 +106,3 @@ result = yield r.db(dbName).table(tableName).info().run();

result = yield r.db(dbName).tableCreate(tableName, {durability: "soft", primaryKey: "foo"}).run();
assert.deepEqual(result, {created:1}); // We can't really check other parameters...
assert.equal(result.tables_created, 1); // We can't really check other parameters...

@@ -163,3 +163,3 @@ result = yield r.db(dbName).table(tableName).info().run();

result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -169,3 +169,3 @@ result = yield r.db(dbName).tableList().run();

result = yield r.db(dbName).tableDrop(tableName).run();
assert.deepEqual(result, {dropped:1});
assert.equal(result.tables_dropped, 1);

@@ -212,6 +212,6 @@ result = yield r.db(dbName).tableList().run();

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created: 1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created: 1});
assert.equal(result.tables_created, 1);

@@ -218,0 +218,0 @@ result = yield r.db(dbName).table(tableName).indexCreate("newField").run();

@@ -99,6 +99,6 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -105,0 +105,0 @@ result = yield r.db(dbName).table(tableName).insert(eval('['+new Array(10000).join('{}, ')+'{}]')).run();

@@ -20,6 +20,6 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -40,3 +40,4 @@ result = yield r.db(dbName).table(tableName).insert(eval('['+new Array(100).join('{}, ')+'{}]')).run();

result = yield r.db(dbName).info().run();
assert.deepEqual(result, {name: dbName, type: "DB"});
assert.equal(result.name, dbName);
assert.equal(result.type, 'DB');

@@ -53,3 +54,6 @@ done();

result = yield r.db(dbName).table(tableName).info().run();
assert.deepEqual(result, {db:{name: dbName,type:"DB"},indexes:[],name: tableName, primary_key:"id",type:"TABLE"})
assert.equal(result.name, tableName)
assert.equal(result.type, 'TABLE')
assert.equal(result.primary_key, 'id')
assert.equal(result.db.name, dbName)

@@ -56,0 +60,0 @@ result = yield r.db(dbName).table(tableName).run();

@@ -22,3 +22,3 @@ var config = require(__dirname+'/config.js');

r.dbCreate(dbName).run().then(function(result) {
assert.deepEqual(result, {created: 1});
assert.equal(result.dbs_created, 1);
done();

@@ -34,3 +34,3 @@ }).error(function(error) {

r.db(dbName).tableCreate(tableName).run().then(function(result) {
assert.deepEqual(result, {created: 1});
assert.equal(result.tables_created, 1);
done();

@@ -37,0 +37,0 @@ }).error(function(error) {

@@ -19,6 +19,6 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -74,3 +74,3 @@ result = yield r.db(dbName).table(tableName).insert(eval('['+new Array(100).join('{}, ')+'{}]')).run();

catch(e) {
if (e.message.match(/^`map` takes 1 argument, 0 provided after/) ){
if (e.message.match(/^`map` takes at least 1 argument, 0 provided after/) ){
done()

@@ -212,6 +212,6 @@ }

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created: 1});
assert.deepEqual(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created: 1});
assert.equal(result.tables_created, 1);

@@ -218,0 +218,0 @@ result = yield r.db(dbName).table(tableName).insert([{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")},{a: r.js("Math.random()")}]).run();

@@ -19,6 +19,6 @@ var config = require(__dirname+'/config.js');

result = yield r.dbCreate(dbName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.deepEqual(result, {created:1});
assert.equal(result.tables_created, 1);

@@ -25,0 +25,0 @@ done();

@@ -15,3 +15,3 @@ var Promise = require('bluebird');

//query = 'r.table("foo").add(1).add(1).add("hello-super-long-string").add("another-long-string").add("one-last-string").map( function(doc) { return r.expr([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]).map(function(test) { return test("b").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").mul(test("b")).merge({ firstName: "xxxxxx", lastName: "yyyy", email: "xxxxx@yyyy.com", phone: "xxx-xxx-xxxx" }); }).add(2).map(function(doc) { return doc.add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string").add("hello-super-long-string").add("another-long-string").add("one-last-string") }); })';
query = 'r.db(dbName).table(tableName).orderBy(r.asc("foo")).add(1)';
query = 'r.expr([1,2,3]).map(function(v) { return v}).add(1)';
Promise.coroutine(function* () {

@@ -18,0 +18,0 @@ try {

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

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