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

[WIP] Hapi 17 Support #332

Closed
wants to merge 9 commits into from
13 changes: 4 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
language: node_js

node_js:
- "4"
- "6"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add "9".

Copy link
Author

@ChristianMurphy ChristianMurphy Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

- "8"
- "node"
- 8
- 9
- node

sudo: false

env:
- HAPI_VERSION="13"
- HAPI_VERSION="14"
- HAPI_VERSION="15"
- HAPI_VERSION="16"
- HAPI_VERSION="17"

install:
- npm install -g json
- json -I -f package.json -e "this.devDependencies.hapi=\"$HAPI_VERSION\""
- npm install

6 changes: 2 additions & 4 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ that require loading a single resource. Once the handler is called, the applicat
combine **bell** with the [**hapi-auth-cookie**](https://github.com/hapijs/hapi-auth-cookie) authentication scheme plugin.

```javascript
var Hapi = require('hapi');
var server = new Hapi.Server();

server.connection({ port: 8000 });
var { Server } = require('hapi');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well use consts and other ES6 features wherever possible now.

Copy link
Author

@ChristianMurphy ChristianMurphy Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to const
Will be leveraging more ES6 features in the next few refactors.

var server = Server({ port: 8000 });

// Register bell with the server
server.register(require('bell'), function (err) {
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ Lead Maintainer: [Lois Desplat](https://github.com/ldesplat)
Twitter:

```javascript
var Hapi = require('hapi');
var server = new Hapi.Server();

server.connection({ port: 8000 });
var { Server } = require('hapi');
var server = Server({ port: 8000 });

// Register bell with the server
server.register(require('bell'), function (err) {
Expand Down
5 changes: 2 additions & 3 deletions examples/arcgisonline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ port: 8000 });
const server = Server({ port: 8000 });

server.register(Bell, (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ port: 8000 });
const server = Server({ port: 8000 });

server.register(Bell, (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ host: 'localhost', port: 3456 });
const server = Server({ host: 'localhost', port: 3456 });

server.register(Bell, (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/google.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ host: 'localhost', port: 4567 });
const server = Server({ host: 'localhost', port: 4567 });

server.register(Bell, (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/linkedin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ port: 8000 });
const server = Server({ port: 8000 });

server.register(Bell, (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/meetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ port: 8000 });
const server = Server({ port: 8000 });

server.register(Bell, (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/nest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ port: 8000 });
const server = Server({ port: 8000 });

server.register(Bell, (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/office365.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ host: 'localhost', port: 4567 });
const server = Server({ host: 'localhost', port: 4567 });

server.register(Bell, (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/okta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Boom = require('boom');

const server = new Hapi.Server();
server.connection({ port: 8000 });
const server = Server({ port: 8000 });

server.register([require('hapi-auth-cookie'), require('../')], (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ port: 8000 });
const server = Server({ port: 8000 });

server.register(Bell, (err) => {

Expand Down
7 changes: 2 additions & 5 deletions examples/twitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({
port: 8000
});
const server = Server({ port: 8000 });

server.register(Bell, (err) => {

Expand Down
5 changes: 2 additions & 3 deletions examples/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

// Load modules

const Hapi = require('hapi');
const { Server } = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');


const server = new Hapi.Server();
server.connection({ port: 8000 });
const server = Server({ port: 8000 });

server.register(Bell, (err) => {

Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ internals.schema = Joi.object({
skipProfile: internals.flexBoolean.optional().default(false),
forceHttps: internals.flexBoolean.optional().default(false),
location: Joi.alternatives().try(
Joi.func().maxArity(1),
Joi.string()
Joi.func().maxArity(1),
Joi.string()
).default(false),
runtimeStateCallback: Joi.func().optional()
});
Expand Down
8 changes: 4 additions & 4 deletions lib/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ exports.v2 = function (settings) {

reply.unstate(cookie);

const requestState = request.query.state || '';
const requestState = request.query.state || '';
if (state.nonce !== requestState.substr(0, Math.min(requestState.length, internals.nonceLength))) {
return reply(Boom.internal('Incorrect ' + name + ' state parameter'));
}
Expand Down Expand Up @@ -498,9 +498,9 @@ internals.Client.prototype.signature = function (method, baseUri, params, oauth,
normalized.sort((a, b) => {

return (a[0] < b[0] ? -1
: (a[0] > b[0] ? 1
: (a[1] < b[1] ? -1
: (a[1] > b[1] ? 1 : 0))));
: (a[0] > b[0] ? 1
: (a[1] < b[1] ? -1
: (a[1] > b[1] ? 1 : 0))));
});

let normalizedParam = '';
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@
"yahoo"
],
"engines": {
"node": ">=4.0.0"
"node": ">=8.0.0"
},
"dependencies": {
"boom": "4.2.x",
"cryptiles": "3.x.x",
"hoek": "4.x.x",
"joi": "10.x.x",
"wreck": "10.x.x"
"boom": "7.x.x",
"cryptiles": "4.x.x",
"hoek": "5.x.x",
"joi": "13.x.x",
"wreck": "14.x.x"
},
"peerDependencies": {
"hapi": ">=13.5.0"
"hapi": ">=17.0.0"
},
"devDependencies": {
"hapi": "16.x.x",
"hawk": "6.x.x",
"lab": "13.x.x",
"code": "4.x.x",
"sinon": "1.x.x"
"hapi": "17.x.x",
"hawk": "7.x.x",
"lab": "15.x.x",
"code": "5.x.x",
"sinon": "3.x.x"
},
"scripts": {
"test": "node node_modules/lab/bin/lab -t 100 -L -v",
"test-cov-html": "node node_modules/lab/bin/lab -r html -o coverage.html -L"
"test": "lab -a code -t 100 -L -v",
"test-cov-html": "lab -a code -r html -o coverage.html -L"
},
"license": "BSD-3-Clause"
}
Loading