From fb988ca0f7e451c6e920cd82436e808171529885 Mon Sep 17 00:00:00 2001 From: Randall Tombaugh Date: Mon, 13 Aug 2018 13:19:35 -1000 Subject: [PATCH] move to latest boom and superagent versions --- lib/index.js | 20 ++++++++++---------- package.json | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/index.js b/lib/index.js index 2963b9c..bea362a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -7,7 +7,7 @@ exports.fromServer = exports.fromRestify = fromServer; var app = new (require('express'))(); app.get('/', function (req, res) { - res.send('Hello, world'); + res.send('Hello, world'); }); module.exports = app; @@ -41,13 +41,13 @@ function render(options, cb, render) { cb(null, (ctx, req, res) => { res.writeHead(200, { 'Content-Type': 'text/html' }); var html = render(options.script); - res.end(html); - }); -} + res.end(html); + }); +} /* async (dynamic context) => { - return "Hello, world!"; + return "Hello, world!"; } */ exports.cs = function (options, cb) { @@ -121,7 +121,7 @@ function createRouteNormalizationRx(claims) { var name = claims.jtn ? claims.jtn.replace(SANITIZE_RX, '\\$&') : ''; - + if (claims.url_format === USE_SHARED_DOMAIN) { return new RegExp(`^\/api/run/${container}/(?:${name}\/?)?`); } @@ -174,9 +174,9 @@ function attachStorageHelpers(context) { qs: { path: path }, json: true, }, function (err, res, body) { - if (err) return cb(Boom.wrap(err, 502)); + if (err) return cb(Boom.boomify(err, { statusCode: 502 })); if (res.statusCode === 404 && Object.hasOwnProperty.call(options, 'defaultValue')) return cb(null, options.defaultValue); - if (res.statusCode >= 400) return cb(Boom.create(res.statusCode, body && body.message)); + if (res.statusCode >= 400) return cb(new Boom(body && body.message, { statusCode: res.statusCode })); cb(null, body); }); @@ -209,8 +209,8 @@ function attachStorageHelpers(context) { qs: { path: path }, body: data, }, function (err, res, body) { - if (err) return cb(Boom.wrap(err, 502)); - if (res.statusCode >= 400) return cb(Boom.create(res.statusCode, body && body.message)); + if (err) return cb(Boom.boomify(err, { statusCode: 502 })); + if (res.statusCode >= 400) return cb(new Boom(body && body.message, { statusCode: res.statusCode })); cb(null); }); diff --git a/package.json b/package.json index db0bb04..0047be8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webtask-tools", - "version": "3.3.0", + "version": "3.4.0", "description": "Tools to facilitate working in a webtask context", "main": "./lib/index.js", "scripts": { @@ -24,10 +24,10 @@ "homepage": "https://github.com/auth0/webtask-tools#readme", "devDependencies": {}, "dependencies": { - "boom": "^2.7.2", + "boom": "^7.2.0", "jsonwebtoken": "^5.7.0", "pug": "^0.1.0", "safe-buffer": "^5.0.1", - "superagent": "^1.8.3" + "superagent": "^3.8.3" } }