Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed numerous vulnerabilities and deprecations #650

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions examples/basic-todo/app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Import express and co
var express = require('express');
var bodyParser = require('body-parser');
var app = express();

// Load config for RethinkDB and express
var config = require(__dirname+"/config.js")

// Import rethinkdbdash
//var thinky = require('thinky')(config.rethinkdb);
var thinky = require('thinky')(config.rethinkdb);
var thinky = require('../../lib/thinky')(config.rethinkdb);
var r = thinky.r;
var type = thinky.type;

Expand All @@ -25,7 +24,7 @@ Todo.ensureIndex("createdAt");


app.use(express.static(__dirname + '/public'));
app.use(bodyParser());
app.use(express);

app.route('/todo/get').get(get);
app.route('/todo/new').put(create);
Expand Down
2 changes: 0 additions & 2 deletions examples/basic-todo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
, "private": true
, "dependencies": {
"express": "4.17.1"
, "body-parser": "1.0.2"
, "thinky": "~1.15.6"
}
}
Binary file added examples/blog/.DS_Store
Binary file not shown.
11 changes: 4 additions & 7 deletions examples/blog/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,32 @@ var express = require('express');
var routes = require('./routes');
var api = require('./routes/api');
var config = require('./config.js');
var bodyParser = require('body-parser');
var serveStatic = require('serve-static')

var app = express();


app.use(serveStatic('public', {'index': ['index.html', 'index.htm']}))
//app.use(express.static(__dirname + '/public'));
//app.use(bodyParser());

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
app.use(express.urlencoded({ extended: false }))
// // parse application/json
app.use(bodyParser.json())
app.use(express.json())

app.set('views', __dirname + '/views');
app.set('view options', { layout: false });
app.engine('jade', require('jade').__express);
app.engine('pug', require('pug').__express);


/*
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.set('view engine', 'pug');
app.set('view options', {
layout: false
});
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.static(__dirname + '/public'));
app.use(app.router);
Expand Down
18 changes: 8 additions & 10 deletions examples/blog/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"name": "thinky-blog-example"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"express": "~4.17.1"
, "body-parser": "~1.4.3"
, "jade": "~1.3.1"
, "serve-static": "~1.5.3"
, "thinky": "~ 1.15.6"
}
"name": "thinky-blog-example",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "^4.17.1",
"pug": "^3.0.2",
"serve-static": "^1.14.1"
}
}
2 changes: 1 addition & 1 deletion examples/blog/routes/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Import
var config = require(__dirname+'/../config.js');
var thinky = require('thinky')(config);
var thinky = require('../../../lib/thinky')(config);
var r = thinky.r;
var type = thinky.type;

Expand Down
4 changes: 2 additions & 2 deletions examples/blog/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
exports.index = function(req, res){
res.render('index.jade');
res.render('index.pug');
};

exports.partials = function (req, res) {
var name = req.params.name;
res.render('partials/' + name + ".jade");
res.render('partials/' + name + ".pug");
};
2 changes: 1 addition & 1 deletion examples/blog/thinky.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var thinky = require('thinky');
var thinky = require('../../lib/thinky');
var config = require('./config');

// Initialize thinky
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"bugs": {
"url": "https://github.com/neumino/thinky/issues"
},
"dependencies":{
"rethinkdbdash": "~2.3.0",
"dependencies": {
"bluebird": "~2.10.2",
"validator": "~3.34.0"
"rethinkdbdash": "~2.3.0",
"validator": "^13.7.0"
},
"devDependencies": {
"mocha": "~1.21.5"
"mocha": "^9.1.3"
}
}
30 changes: 15 additions & 15 deletions test/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: str,
num: num
})
Expand All @@ -64,7 +64,7 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: num,
num: num
})
Expand All @@ -79,7 +79,7 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: str,
num: num
})
Expand All @@ -95,11 +95,11 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
id: str
})
doc.save().then(function(result) {
doc2 = new Model({
var doc2 = new Model({
id: str
})
doc2.save().then(function(r) {
Expand All @@ -117,20 +117,20 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: str,
num: num
})
assert.equal(doc.isSaved(), false);
assert.equal(doc.setSaved());
doc.setSaved()
assert.equal(doc.isSaved(), true);
});

it('Save when the table is not yet ready', function(done){
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: str,
num: num
})
Expand All @@ -143,7 +143,7 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: str,
num: num
})
Expand All @@ -155,7 +155,7 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: str,
num: num
})
Expand All @@ -171,7 +171,7 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: str,
num: num
})
Expand All @@ -191,7 +191,7 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: str,
num: num
})
Expand All @@ -213,7 +213,7 @@ describe('save', function() {
var str = util.s8();
var num = util.random();

doc = new Model({
var doc = new Model({
str: str,
num: num
})
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('save', function() {
}).error(done)
});
it('Point - ReQL point', function(done){
Model = thinky.createModel(modelNames[0], {
var Model = thinky.createModel(modelNames[0], {
id: String,
point: type.point()
})
Expand Down Expand Up @@ -491,7 +491,7 @@ describe('save', function() {
});
it('new should create instances of Document for joined documents too', function() {
var docValues = {str: util.s8(), num: util.random(), otherDoc: {str: util.s8(), num: util.random()}}
doc = new Model(docValues);
var doc = new Model(docValues);
assert.equal(doc._getModel()._name, Model.getTableName())
assert.equal(doc.otherDoc._getModel()._name, OtherModel.getTableName())
});
Expand Down