diff --git a/packages/authentication-client/package.json b/packages/authentication-client/package.json index c435b4106..dd7f76861 100644 --- a/packages/authentication-client/package.json +++ b/packages/authentication-client/package.json @@ -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", diff --git a/packages/authentication-local/package.json b/packages/authentication-local/package.json index 907c54919..da2702fdc 100644 --- a/packages/authentication-local/package.json +++ b/packages/authentication-local/package.json @@ -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", diff --git a/packages/authentication-oauth/package.json b/packages/authentication-oauth/package.json index eff0fb7e0..89e78d97c 100644 --- a/packages/authentication-oauth/package.json +++ b/packages/authentication-oauth/package.json @@ -42,6 +42,7 @@ "@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", @@ -49,7 +50,6 @@ "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", diff --git a/packages/authentication-oauth/src/index.ts b/packages/authentication-oauth/src/index.ts index 9ba753b7f..366bfbae3 100644 --- a/packages/authentication-oauth/src/index.ts +++ b/packages/authentication-oauth/src/index.ts @@ -24,13 +24,13 @@ 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'; @@ -38,7 +38,7 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => { host += ':' + port; } } - + const grant = merge({ defaults: { path, @@ -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}`; diff --git a/packages/authentication/package.json b/packages/authentication/package.json index be7d624cf..b7580179e 100644 --- a/packages/authentication/package.json +++ b/packages/authentication/package.json @@ -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", @@ -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", diff --git a/packages/authentication/src/service.ts b/packages/authentication/src/service.ts index fc4b88de4..d6261be64 100644 --- a/packages/authentication/src/service.ts +++ b/packages/authentication/src/service.ts @@ -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); diff --git a/packages/configuration/package.json b/packages/configuration/package.json index 11273c490..a99dacdc8 100644 --- a/packages/configuration/package.json +++ b/packages/configuration/package.json @@ -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", diff --git a/packages/configuration/src/index.ts b/packages/configuration/src/index.ts index 36e1ed15b..4f6079a56 100644 --- a/packages/configuration/src/index.ts +++ b/packages/configuration/src/index.ts @@ -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) ? [] : {}; @@ -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; diff --git a/packages/feathers/lib/application.js b/packages/feathers/lib/application.js index ec81c78ca..92e89cf16 100644 --- a/packages/feathers/lib/application.js +++ b/packages/feathers/lib/application.js @@ -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); } @@ -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;