Skip to content

Commit 42c13e2

Browse files
vonagamdaffl
authored andcommitted
fix: Small improvements in dependencies and code sturcture (#1562)
1 parent 13b3dbd commit 42c13e2

File tree

9 files changed

+19
-21
lines changed

9 files changed

+19
-21
lines changed

packages/authentication-client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
"access": "public"
4040
},
4141
"dependencies": {
42+
"@feathersjs/authentication": "^4.3.2",
4243
"@feathersjs/commons": "^4.3.0",
4344
"@feathersjs/errors": "^4.3.2",
45+
"@feathersjs/feathers": "^4.3.2",
4446
"debug": "^4.1.1"
4547
},
4648
"devDependencies": {
47-
"@feathersjs/authentication": "^4.3.2",
4849
"@feathersjs/authentication-local": "^4.3.2",
4950
"@feathersjs/express": "^4.3.2",
50-
"@feathersjs/feathers": "^4.3.2",
5151
"@feathersjs/primus": "^4.3.2",
5252
"@feathersjs/primus-client": "^4.3.2",
5353
"@feathersjs/rest-client": "^4.3.2",

packages/authentication-local/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
"access": "public"
4040
},
4141
"dependencies": {
42+
"@feathersjs/authentication": "^4.3.2",
4243
"@feathersjs/errors": "^4.3.2",
44+
"@feathersjs/feathers": "^4.3.2",
4345
"bcryptjs": "^2.4.3",
4446
"debug": "^4.1.1",
4547
"lodash": "^4.17.15"
4648
},
4749
"devDependencies": {
48-
"@feathersjs/authentication": "^4.3.2",
49-
"@feathersjs/feathers": "^4.3.2",
5050
"@types/bcryptjs": "^2.4.2",
5151
"@types/debug": "^4.1.5",
5252
"@types/lodash": "^4.14.137",

packages/authentication-oauth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
"@feathersjs/authentication": "^4.3.2",
4343
"@feathersjs/errors": "^4.3.2",
4444
"@feathersjs/express": "^4.3.2",
45+
"@feathersjs/feathers": "^4.3.2",
4546
"debug": "^4.1.1",
4647
"express-session": "^1.16.2",
4748
"grant": "^4.6.2",
4849
"grant-profile": "^0.0.5",
4950
"lodash": "^4.17.15"
5051
},
5152
"devDependencies": {
52-
"@feathersjs/feathers": "^4.3.2",
5353
"@types/debug": "^4.1.5",
5454
"@types/express": "^4.17.1",
5555
"@types/express-session": "^1.15.14",

packages/authentication-oauth/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => {
2424
}
2525

2626
const { strategyNames } = service;
27-
27+
2828
// Set up all the defaults
2929
const { path = '/oauth' } = oauth.defaults || {};
3030
const port = app.get('port');
3131
let host = app.get('host');
3232
let protocol = 'https';
33-
33+
3434
// Development environments commonly run on HTTP with an extended port
3535
if (app.get('env') === 'development') {
3636
protocol = 'http';
3737
if (String(port) !== '80') {
3838
host += ':' + port;
3939
}
4040
}
41-
41+
4242
const grant = merge({
4343
defaults: {
4444
path,
@@ -47,7 +47,7 @@ export const setup = (options: OauthSetupSettings) => (app: Application) => {
4747
transport: 'session'
4848
}
4949
}, omit(oauth, 'redirect'));
50-
50+
5151
const getUrl = (url: string) => {
5252
const { defaults } = grant;
5353
return `${defaults.protocol}://${defaults.host}${path}/${url}`;

packages/authentication/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
},
4141
"dependencies": {
4242
"@feathersjs/errors": "^4.3.2",
43+
"@feathersjs/feathers": "^4.3.2",
4344
"@feathersjs/transport-commons": "^4.3.2",
4445
"debug": "^4.1.1",
4546
"jsonwebtoken": "^8.5.1",
@@ -48,7 +49,6 @@
4849
"uuid": "^3.3.2"
4950
},
5051
"devDependencies": {
51-
"@feathersjs/feathers": "^4.3.2",
5252
"@types/debug": "^4.1.5",
5353
"@types/jsonwebtoken": "^8.3.3",
5454
"@types/lodash": "^4.14.137",

packages/authentication/src/service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ export class AuthenticationService extends AuthenticationBase implements Partial
9292

9393
debug('Got authentication result', authResult);
9494

95+
if (authResult.accessToken) {
96+
return authResult;
97+
}
98+
9599
const [ payload, jwtOptions ] = await Promise.all([
96100
this.getPayload(authResult, params),
97101
this.getTokenOptions(authResult, params)
98102
]);
99103

100-
if (authResult.accessToken) {
101-
return authResult;
102-
}
103-
104104
debug('Creating JWT with', payload, jwtOptions);
105105

106106
const accessToken = await this.createAccessToken(payload, jwtOptions, params.secret);

packages/configuration/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
"access": "public"
4545
},
4646
"dependencies": {
47+
"@feathersjs/feathers": "^4.3.2",
4748
"config": "^3.2.2",
4849
"debug": "^4.1.1"
4950
},
5051
"devDependencies": {
51-
"@feathersjs/feathers": "^4.3.2",
5252
"@types/config": "^0.0.34",
5353
"@types/debug": "^4.1.5",
5454
"@types/mocha": "^5.2.7",

packages/configuration/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const debug = Debug('@feathersjs/configuration');
77
const separator = path.sep;
88

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

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

5959
return conf;

packages/feathers/lib/application.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const application = {
7070
const current = this.services[location];
7171

7272
if (typeof current === 'undefined' && typeof this.defaultService === 'function') {
73-
return this.use(`/${location}`, this.defaultService(location))
73+
return this.use(location, this.defaultService(location))
7474
.service(location);
7575
}
7676

@@ -84,9 +84,7 @@ const application = {
8484

8585
const location = stripSlashes(path) || '/';
8686
const isSubApp = typeof service.service === 'function' && service.services;
87-
const isService = this.methods.concat('setup').some(name =>
88-
(service && typeof service[name] === 'function')
89-
);
87+
const isService = this.methods.concat('setup').some(name => typeof service[name] === 'function');
9088

9189
if (isSubApp) {
9290
const subApp = service;

0 commit comments

Comments
 (0)