Skip to content

Commit

Permalink
fix: Small improvements in dependencies and code sturcture (#1562)
Browse files Browse the repository at this point in the history
  • Loading branch information
vonagam authored and daffl committed Sep 21, 2019
1 parent 13b3dbd commit 42c13e2
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 21 deletions.
4 changes: 2 additions & 2 deletions packages/authentication-client/package.json
Expand Up @@ -39,15 +39,15 @@
"access": "public"
},
"dependencies": {
"@feathersjs/authentication": "^4.3.2",
"@feathersjs/commons": "^4.3.0",
"@feathersjs/errors": "^4.3.2",
"@feathersjs/feathers": "^4.3.2",
"debug": "^4.1.1"
},
"devDependencies": {
"@feathersjs/authentication": "^4.3.2",
"@feathersjs/authentication-local": "^4.3.2",
"@feathersjs/express": "^4.3.2",
"@feathersjs/feathers": "^4.3.2",
"@feathersjs/primus": "^4.3.2",
"@feathersjs/primus-client": "^4.3.2",
"@feathersjs/rest-client": "^4.3.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/authentication-local/package.json
Expand Up @@ -39,14 +39,14 @@
"access": "public"
},
"dependencies": {
"@feathersjs/authentication": "^4.3.2",
"@feathersjs/errors": "^4.3.2",
"@feathersjs/feathers": "^4.3.2",
"bcryptjs": "^2.4.3",
"debug": "^4.1.1",
"lodash": "^4.17.15"
},
"devDependencies": {
"@feathersjs/authentication": "^4.3.2",
"@feathersjs/feathers": "^4.3.2",
"@types/bcryptjs": "^2.4.2",
"@types/debug": "^4.1.5",
"@types/lodash": "^4.14.137",
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication-oauth/package.json
Expand Up @@ -42,14 +42,14 @@
"@feathersjs/authentication": "^4.3.2",
"@feathersjs/errors": "^4.3.2",
"@feathersjs/express": "^4.3.2",
"@feathersjs/feathers": "^4.3.2",
"debug": "^4.1.1",
"express-session": "^1.16.2",
"grant": "^4.6.2",
"grant-profile": "^0.0.5",
"lodash": "^4.17.15"
},
"devDependencies": {
"@feathersjs/feathers": "^4.3.2",
"@types/debug": "^4.1.5",
"@types/express": "^4.17.1",
"@types/express-session": "^1.15.14",
Expand Down
8 changes: 4 additions & 4 deletions packages/authentication-oauth/src/index.ts
Expand Up @@ -24,21 +24,21 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => {
}

const { strategyNames } = service;

// Set up all the defaults
const { path = '/oauth' } = oauth.defaults || {};
const port = app.get('port');
let host = app.get('host');
let protocol = 'https';

// Development environments commonly run on HTTP with an extended port
if (app.get('env') === 'development') {
protocol = 'http';
if (String(port) !== '80') {
host += ':' + port;
}
}

const grant = merge({
defaults: {
path,
Expand All @@ -47,7 +47,7 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => {
transport: 'session'
}
}, omit(oauth, 'redirect'));

const getUrl = (url: string) => {
const { defaults } = grant;
return `${defaults.protocol}://${defaults.host}${path}/${url}`;
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication/package.json
Expand Up @@ -40,6 +40,7 @@
},
"dependencies": {
"@feathersjs/errors": "^4.3.2",
"@feathersjs/feathers": "^4.3.2",
"@feathersjs/transport-commons": "^4.3.2",
"debug": "^4.1.1",
"jsonwebtoken": "^8.5.1",
Expand All @@ -48,7 +49,6 @@
"uuid": "^3.3.2"
},
"devDependencies": {
"@feathersjs/feathers": "^4.3.2",
"@types/debug": "^4.1.5",
"@types/jsonwebtoken": "^8.3.3",
"@types/lodash": "^4.14.137",
Expand Down
8 changes: 4 additions & 4 deletions packages/authentication/src/service.ts
Expand Up @@ -92,15 +92,15 @@ export class AuthenticationService extends AuthenticationBase implements Partial

debug('Got authentication result', authResult);

if (authResult.accessToken) {
return authResult;
}

const [ payload, jwtOptions ] = await Promise.all([
this.getPayload(authResult, params),
this.getTokenOptions(authResult, params)
]);

if (authResult.accessToken) {
return authResult;
}

debug('Creating JWT with', payload, jwtOptions);

const accessToken = await this.createAccessToken(payload, jwtOptions, params.secret);
Expand Down
2 changes: 1 addition & 1 deletion packages/configuration/package.json
Expand Up @@ -44,11 +44,11 @@
"access": "public"
},
"dependencies": {
"@feathersjs/feathers": "^4.3.2",
"config": "^3.2.2",
"debug": "^4.1.1"
},
"devDependencies": {
"@feathersjs/feathers": "^4.3.2",
"@types/config": "^0.0.34",
"@types/debug": "^4.1.5",
"@types/mocha": "^5.2.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/configuration/src/index.ts
Expand Up @@ -7,7 +7,7 @@ const debug = Debug('@feathersjs/configuration');
const separator = path.sep;

export default function init () {
return (app: Application|undefined) => {
return (app?: Application) => {
const convert = (current: any) => {
const result: { [key: string]: any } = Array.isArray(current) ? [] : {};

Expand Down Expand Up @@ -53,7 +53,7 @@ export default function init () {
Object.keys(conf).forEach(name => {
const value = conf[name];
debug(`Setting ${name} configuration value to`, value);
(app as Application).set(name, value);
app!.set(name, value);
});

return conf;
Expand Down
6 changes: 2 additions & 4 deletions packages/feathers/lib/application.js
Expand Up @@ -70,7 +70,7 @@ const application = {
const current = this.services[location];

if (typeof current === 'undefined' && typeof this.defaultService === 'function') {
return this.use(`/${location}`, this.defaultService(location))
return this.use(location, this.defaultService(location))
.service(location);
}

Expand All @@ -84,9 +84,7 @@ const application = {

const location = stripSlashes(path) || '/';
const isSubApp = typeof service.service === 'function' && service.services;
const isService = this.methods.concat('setup').some(name =>
(service && typeof service[name] === 'function')
);
const isService = this.methods.concat('setup').some(name => typeof service[name] === 'function');

if (isSubApp) {
const subApp = service;
Expand Down

0 comments on commit 42c13e2

Please sign in to comment.