Skip to content

Commit

Permalink
Cleanup. Closes #386
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Nov 10, 2018
1 parent 75dcb64 commit 7ea0eda
Show file tree
Hide file tree
Showing 61 changed files with 26 additions and 350 deletions.
23 changes: 7 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
.idea
*.iml
npm-debug.log
dump.rdb
node_modules
results.tap
results.xml
config.json
.DS_Store
*/.DS_Store
*/*/.DS_Store
._*
*/._*
*/*/._*
**/node_modules
**/package-lock.json

coverage.*
.settings
package-lock.json

**/.DS_Store
**/._*

**/*.pem
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
language: node_js

node_js:
- "8"
- "9"
- "node"
- "8"
- "10"
- "11"
- "node"

sudo: false
4 changes: 0 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,3 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

* * *

The complete list of contributors can be found at: https://github.com/hapijs/bell/graphs/contributors
4 changes: 0 additions & 4 deletions examples/arcgisonline.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Bell = require('../');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/discord.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Bell = require('../');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/facebook.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Bell = require('../');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
5 changes: 1 addition & 4 deletions examples/github.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Hapi = require('hapi');
const Bell = require('../');


// Declare internals

const internals = {};


Expand Down Expand Up @@ -35,6 +31,7 @@ internals.start = async function () {
if (!request.auth.isAuthenticated) {
return `Authentication failed due to: ${request.auth.error.message}`;
}

return '<pre>' + JSON.stringify(request.auth.credentials, null, 4) + '</pre>';
}
}
Expand Down
4 changes: 0 additions & 4 deletions examples/google.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Bell = require('../');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/linkedin.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Bell = require('../');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/meetup.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Bell = require('../');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/nest.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Bell = require('../');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/office365.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Bell = require('../');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/okta.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
'use strict';

// Load modules

const Bell = require('../');
const Boom = require('boom');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/slack.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Bell = require('../');
const Hapi = require('hapi');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/twitch.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Hapi = require('hapi');
const Bell = require('../');


// Declare internals

const internals = {};


Expand Down
4 changes: 0 additions & 4 deletions examples/twitter.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';

// Load modules

const Hapi = require('hapi');
const Bell = require('../');


// Declare internals

const internals = {};


Expand Down
5 changes: 1 addition & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
'use strict';

// Load modules

const Hoek = require('hoek');
const Joi = require('joi');

const OAuth = require('./oauth');
const Providers = require('./providers');


// Declare internals

const internals = {
simulate: false,
flexBoolean: Joi.boolean().truthy('true', 'yes', 1, '1').falsy('false', 'no', 0, '0')
Expand All @@ -20,6 +16,7 @@ const internals = {
// Utilities

exports.providers = Providers;

exports.oauth = OAuth;


Expand Down
7 changes: 3 additions & 4 deletions lib/oauth.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// Load modules

const Querystring = require('querystring');
const Url = require('url');

Expand All @@ -13,8 +11,6 @@ const Hoek = require('hoek');
const Wreck = require('wreck');


// Declare internals

const internals = {
nonceLength: 22
};
Expand Down Expand Up @@ -554,7 +550,9 @@ internals.Client.prototype.signature = function (method, baseUri, params, oauth,
if (oauth.oauth_signature_method === 'RSA-SHA1') { // RSA-SHA1 (3.4.3)
return Crypto.createSign('sha1').update(baseString).sign(this.settings.clientSecret, 'base64');
}

// HMAC-SHA1 (3.4.2)

const key = tokenSecret ? (this.settings.clientSecret + internals.encode(tokenSecret)) : this.settings.clientSecret;
return Crypto.createHmac('sha1', key).update(baseString).digest('base64');
};
Expand Down Expand Up @@ -620,6 +618,7 @@ internals.location = function (request, protocol, location) {
if (typeof location === 'function') {
return location(request) || internals.location(request, protocol);
}

if (location) {
return location + request.path;
}
Expand Down
12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,19 @@
"wordpress",
"yahoo"
],
"engines": {
"node": ">=8.9.0"
},
"dependencies": {
"boom": "7.x.x",
"bounce": "1.x.x",
"cryptiles": "4.x.x",
"hoek": "5.x.x",
"joi": "13.x.x",
"hoek": "6.x.x",
"joi": "14.x.x",
"wreck": "14.x.x"
},
"peerDependencies": {
"hapi": ">=17.0.0"
},
"devDependencies": {
"code": "5.x.x",
"hapi": "17.x.x",
"hawk": "7.x.x",
"lab": "15.x.x",
"lab": "17.x.x",
"teamwork": "3.x.x"
},
"scripts": {
Expand Down
6 changes: 0 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// Load modules

const Bell = require('../');
const Boom = require('boom');
const Code = require('code');
Expand All @@ -12,13 +10,9 @@ const Lab = require('lab');
const Mock = require('./mock');


// Declare internals

const internals = {};


// Test shortcuts

const { describe, it } = exports.lab = Lab.script();
const expect = Code.expect;

Expand Down
11 changes: 3 additions & 8 deletions test/mock.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// Load modules

const Querystring = require('querystring');

const Boom = require('boom');
Expand All @@ -12,19 +10,16 @@ const Teamwork = require('teamwork');
const Wreck = require('wreck');


// Declare internals

const internals = {
wreck: null
};


// Test shortcuts

const expect = Code.expect;


exports.CLIENT_ID_TESTER = internals.CLIENT_ID_TESTER = 'clientIdTester';

exports.CLIENT_SECRET_TESTER = internals.CLIENT_SECRET_TESTER = 'clientSecretTester';


Expand Down Expand Up @@ -259,7 +254,7 @@ exports.override = function (uri, payload) {

const override = function (method) {

return async function (dest) {
return async function (dest, ...args) {

if (dest.indexOf(uri) === 0) {
if (typeof payload === 'function') {
Expand All @@ -280,7 +275,7 @@ exports.override = function (uri, payload) {
return { res: { statusCode: 200 }, payload: typeof payload === 'string' ? payload : JSON.stringify(payload) };
}

return internals.wreck[method].apply(null, arguments);
return internals.wreck[method](dest, ...args);
};
};

Expand Down
Loading

0 comments on commit 7ea0eda

Please sign in to comment.