@feathersjs/authentication 5.0.0-pre.30 → 5.0.0-pre.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/service.d.ts +1 -1
- package/lib/service.js +10 -9
- package/lib/service.js.map +1 -1
- package/package.json +9 -8
- package/src/service.ts +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-pre.31](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.30...v5.0.0-pre.31) (2022-10-12)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **cli:** Generate full client test suite and improve typed client ([#2788](https://github.com/feathersjs/feathers/issues/2788)) ([57119b6](https://github.com/feathersjs/feathers/commit/57119b6bb2797f7297cf054268a248c093ecd538))
|
|
11
|
+
|
|
6
12
|
# [5.0.0-pre.30](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.29...v5.0.0-pre.30) (2022-10-07)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/lib/service.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthenticationBase, AuthenticationResult, AuthenticationRequest, AuthenticationParams } from './core';
|
|
2
1
|
import '@feathersjs/transport-commons';
|
|
3
2
|
import { ServiceMethods, ServiceAddons } from '@feathersjs/feathers';
|
|
3
|
+
import { AuthenticationBase, AuthenticationResult, AuthenticationRequest, AuthenticationParams } from './core';
|
|
4
4
|
declare module '@feathersjs/feathers/lib/declarations' {
|
|
5
5
|
interface FeathersApplication<Services, Settings> {
|
|
6
6
|
/**
|
package/lib/service.js
CHANGED
|
@@ -6,16 +6,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.AuthenticationService = void 0;
|
|
7
7
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
8
8
|
const errors_1 = require("@feathersjs/errors");
|
|
9
|
-
const core_1 = require("./core");
|
|
10
|
-
const hooks_1 = require("./hooks");
|
|
11
9
|
require("@feathersjs/transport-commons");
|
|
12
10
|
const commons_1 = require("@feathersjs/commons");
|
|
13
11
|
const schema_1 = require("@feathersjs/schema");
|
|
14
12
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
13
|
+
const hooks_1 = require("@feathersjs/hooks");
|
|
14
|
+
const core_1 = require("./core");
|
|
15
|
+
const hooks_2 = require("./hooks");
|
|
15
16
|
const debug = (0, commons_1.createDebug)('@feathersjs/authentication/service');
|
|
16
17
|
class AuthenticationService extends core_1.AuthenticationBase {
|
|
17
18
|
constructor(app, configKey = 'authentication', options = {}) {
|
|
18
19
|
super(app, configKey, options);
|
|
20
|
+
(0, hooks_1.hooks)(this, {
|
|
21
|
+
create: [(0, schema_1.resolveDispatch)(), (0, hooks_2.connection)('login'), (0, hooks_2.event)('login')],
|
|
22
|
+
remove: [(0, schema_1.resolveDispatch)(), (0, hooks_2.connection)('logout'), (0, hooks_2.event)('logout')]
|
|
23
|
+
});
|
|
24
|
+
this.app.on('disconnect', async (connection) => {
|
|
25
|
+
await this.handleConnection('disconnect', connection);
|
|
26
|
+
});
|
|
19
27
|
if (typeof app.defaultAuthentication !== 'function') {
|
|
20
28
|
app.defaultAuthentication = function (location) {
|
|
21
29
|
const configKey = app.get('defaultAuthentication');
|
|
@@ -130,13 +138,6 @@ class AuthenticationService extends core_1.AuthenticationBase {
|
|
|
130
138
|
throw new Error(`The '${service}' service does not have an 'id' property and no 'entityId' option is set.`);
|
|
131
139
|
}
|
|
132
140
|
}
|
|
133
|
-
this.hooks({
|
|
134
|
-
create: [(0, schema_1.resolveDispatch)(), (0, hooks_1.connection)('login'), (0, hooks_1.event)('login')],
|
|
135
|
-
remove: [(0, schema_1.resolveDispatch)(), (0, hooks_1.connection)('logout'), (0, hooks_1.event)('logout')]
|
|
136
|
-
});
|
|
137
|
-
this.app.on('disconnect', async (connection) => {
|
|
138
|
-
await this.handleConnection('disconnect', connection);
|
|
139
|
-
});
|
|
140
141
|
if (typeof this.publish === 'function') {
|
|
141
142
|
this.publish(() => null);
|
|
142
143
|
}
|
package/lib/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAgC;AAChC,+CAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAgC;AAChC,+CAAqD;AACrD,yCAAsC;AACtC,iDAAiD;AAEjD,+CAAoD;AACpD,gEAAuC;AACvC,6CAAyC;AAEzC,iCAA8G;AAC9G,mCAA2C;AAE3C,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,oCAAoC,CAAC,CAAA;AAwB/D,MAAa,qBACX,SAAQ,yBAAkB;IAG1B,YAAY,GAAQ,EAAE,SAAS,GAAG,gBAAgB,EAAE,OAAO,GAAG,EAAE;QAC9D,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAE9B,IAAA,aAAK,EAAC,IAAI,EAAE;YACV,MAAM,EAAE,CAAC,IAAA,wBAAe,GAAE,EAAE,IAAA,kBAAU,EAAC,OAAO,CAAC,EAAE,IAAA,aAAK,EAAC,OAAO,CAAC,CAAC;YAChE,MAAM,EAAE,CAAC,IAAA,wBAAe,GAAE,EAAE,IAAA,kBAAU,EAAC,QAAQ,CAAC,EAAE,IAAA,aAAK,EAAC,QAAQ,CAAC,CAAC;SACnE,CAAC,CAAA;QAEF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;YAC7C,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,UAAU,CAAC,CA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xE,MAAM,IAAI,KAAK,CACb,QAAQ,OAAO,2EAA2E,CAC3F,CAAA;aACF;SACF;QAED,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,EAAE;YACtC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;SACzB;IACH,CAAC;CACF;AAtKD,sDAsKC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/authentication",
|
|
3
3
|
"description": "Add Authentication to your FeathersJS app.",
|
|
4
|
-
"version": "5.0.0-pre.
|
|
4
|
+
"version": "5.0.0-pre.31",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -53,11 +53,12 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@feathersjs/commons": "^5.0.0-pre.
|
|
57
|
-
"@feathersjs/errors": "^5.0.0-pre.
|
|
58
|
-
"@feathersjs/feathers": "^5.0.0-pre.
|
|
59
|
-
"@feathersjs/
|
|
60
|
-
"@feathersjs/
|
|
56
|
+
"@feathersjs/commons": "^5.0.0-pre.31",
|
|
57
|
+
"@feathersjs/errors": "^5.0.0-pre.31",
|
|
58
|
+
"@feathersjs/feathers": "^5.0.0-pre.31",
|
|
59
|
+
"@feathersjs/hooks": "^0.7.5",
|
|
60
|
+
"@feathersjs/schema": "^5.0.0-pre.31",
|
|
61
|
+
"@feathersjs/transport-commons": "^5.0.0-pre.31",
|
|
61
62
|
"@types/jsonwebtoken": "^8.5.9",
|
|
62
63
|
"jsonwebtoken": "^8.5.1",
|
|
63
64
|
"lodash": "^4.17.21",
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
"uuid": "^9.0.0"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"@feathersjs/memory": "^5.0.0-pre.
|
|
69
|
+
"@feathersjs/memory": "^5.0.0-pre.31",
|
|
69
70
|
"@types/lodash": "^4.14.186",
|
|
70
71
|
"@types/mocha": "^10.0.0",
|
|
71
72
|
"@types/node": "^18.8.2",
|
|
@@ -75,5 +76,5 @@
|
|
|
75
76
|
"ts-node": "^10.9.1",
|
|
76
77
|
"typescript": "^4.8.4"
|
|
77
78
|
},
|
|
78
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "4500dbeb8cea566678cf88b3313a88efd93a2ed9"
|
|
79
80
|
}
|
package/src/service.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import merge from 'lodash/merge'
|
|
2
2
|
import { NotAuthenticated } from '@feathersjs/errors'
|
|
3
|
-
import { AuthenticationBase, AuthenticationResult, AuthenticationRequest, AuthenticationParams } from './core'
|
|
4
|
-
import { connection, event } from './hooks'
|
|
5
3
|
import '@feathersjs/transport-commons'
|
|
6
4
|
import { createDebug } from '@feathersjs/commons'
|
|
7
5
|
import { ServiceMethods, ServiceAddons } from '@feathersjs/feathers'
|
|
8
6
|
import { resolveDispatch } from '@feathersjs/schema'
|
|
9
7
|
import jsonwebtoken from 'jsonwebtoken'
|
|
8
|
+
import { hooks } from '@feathersjs/hooks'
|
|
9
|
+
|
|
10
|
+
import { AuthenticationBase, AuthenticationResult, AuthenticationRequest, AuthenticationParams } from './core'
|
|
11
|
+
import { connection, event } from './hooks'
|
|
10
12
|
|
|
11
13
|
const debug = createDebug('@feathersjs/authentication/service')
|
|
12
14
|
|
|
@@ -39,6 +41,15 @@ export class AuthenticationService
|
|
|
39
41
|
constructor(app: any, configKey = 'authentication', options = {}) {
|
|
40
42
|
super(app, configKey, options)
|
|
41
43
|
|
|
44
|
+
hooks(this, {
|
|
45
|
+
create: [resolveDispatch(), connection('login'), event('login')],
|
|
46
|
+
remove: [resolveDispatch(), connection('logout'), event('logout')]
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
this.app.on('disconnect', async (connection) => {
|
|
50
|
+
await this.handleConnection('disconnect', connection)
|
|
51
|
+
})
|
|
52
|
+
|
|
42
53
|
if (typeof app.defaultAuthentication !== 'function') {
|
|
43
54
|
app.defaultAuthentication = function (location?: string) {
|
|
44
55
|
const configKey = app.get('defaultAuthentication')
|
|
@@ -185,15 +196,6 @@ export class AuthenticationService
|
|
|
185
196
|
}
|
|
186
197
|
}
|
|
187
198
|
|
|
188
|
-
this.hooks({
|
|
189
|
-
create: [resolveDispatch(), connection('login'), event('login')],
|
|
190
|
-
remove: [resolveDispatch(), connection('logout'), event('logout')]
|
|
191
|
-
} as any)
|
|
192
|
-
|
|
193
|
-
this.app.on('disconnect', async (connection) => {
|
|
194
|
-
await this.handleConnection('disconnect', connection)
|
|
195
|
-
})
|
|
196
|
-
|
|
197
199
|
if (typeof this.publish === 'function') {
|
|
198
200
|
this.publish(() => null)
|
|
199
201
|
}
|