@feathersjs/authentication-local 5.0.0-pre.15 → 5.0.0-pre.18
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 +27 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/lib/hooks/hash-password.d.ts +1 -1
- package/lib/hooks/hash-password.js +1 -1
- package/lib/hooks/hash-password.js.map +1 -1
- package/lib/hooks/protect.js +21 -19
- package/lib/hooks/protect.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/package.json +17 -17
- package/src/hooks/hash-password.ts +1 -1
- package/src/hooks/protect.ts +20 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
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.18](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.17...v5.0.0-pre.18) (2022-04-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @feathersjs/authentication-local
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [5.0.0-pre.17](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.16...v5.0.0-pre.17) (2022-02-15)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **hooks:** Allow all built-in hooks to be used the async and regular way ([#2559](https://github.com/feathersjs/feathers/issues/2559)) ([8f9f631](https://github.com/feathersjs/feathers/commit/8f9f631e0ce89de349207db72def84e7ab496a4a))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [5.0.0-pre.16](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.15...v5.0.0-pre.16) (2022-01-12)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @feathersjs/authentication-local
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
# [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
|
|
7
34
|
|
|
8
35
|
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @feathersjs/authentication-local
|
|
2
2
|
|
|
3
3
|
[](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI)
|
|
4
|
-
[](https://david-dm.org/feathersjs/feathers?path=packages/authentication-local)
|
|
5
4
|
[](https://www.npmjs.com/package/@feathersjs/authentication-local)
|
|
5
|
+
[](https://discord.gg/qa8kez8QBx)
|
|
6
6
|
|
|
7
7
|
> Local username and password authentication strategy for Feathers authentication
|
|
8
8
|
|
|
@@ -18,6 +18,6 @@ Refer to the [Feathers local authentication API documentation](https://docs.feat
|
|
|
18
18
|
|
|
19
19
|
## License
|
|
20
20
|
|
|
21
|
-
Copyright (c)
|
|
21
|
+
Copyright (c) 2022 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
|
|
22
22
|
|
|
23
23
|
Licensed under the [MIT license](LICENSE).
|
|
@@ -3,4 +3,4 @@ export interface HashPasswordOptions {
|
|
|
3
3
|
authentication?: string;
|
|
4
4
|
strategy?: string;
|
|
5
5
|
}
|
|
6
|
-
export default function hashPassword(field: string, options?: HashPasswordOptions): (context: HookContext, next?: NextFunction) => Promise<
|
|
6
|
+
export default function hashPassword(field: string, options?: HashPasswordOptions): (context: HookContext, next?: NextFunction) => Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash-password.js","sourceRoot":"","sources":["../../src/hooks/hash-password.ts"],"names":[],"mappings":";;;;;AAAA,qDAA6B;AAC7B,qDAA6B;AAC7B,iEAAyC;AACzC,+CAAgD;AAChD,iDAAkD;AAIlD,MAAM,KAAK,GAAG,IAAA,qBA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AAa,IAAI,OAAO,aAAa,CAAC,YAAY,KAAK,UAAU,EAAE;gBACtE,MAAM,IAAI,mBAAU,CAAC,mBAAmB,QAAQ,6BAA6B,CAAC,CAAC;aAChF;YAED,MAAM,iBAAiB,GAAG,KAAK,EAAE,IAAS,EAAE,EAAE;gBAC5C,MAAM,QAAQ,GAAG,IAAA,aAAG,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAElC,IAAI,QAAQ,KAAK,SAAS,EAAE;oBAC1B,KAAK,CAAC,aAAa,KAAK,qCAAqC,CAAC,CAAC;oBAC/D,OAAO,IAAI,CAAC;iBACb;gBAED,MAAM,cAAc,GAAW,MAAM,aAAa,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAElF,OAAO,IAAA,aAAG,EAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;YACrD,CAAC,CAAA;YAED,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;gBACnF,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC;SACjC;QAED,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC9B,OAAO,IAAI,EAAE,CAAC;SACf;IACH,CAAC,CAAC;AACJ,CAAC;AA3CD,+BA2CC"}
|
package/lib/hooks/protect.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
7
|
-
exports.default = (...fields) =>
|
|
7
|
+
exports.default = (...fields) => {
|
|
8
8
|
const o = (current) => {
|
|
9
9
|
if (typeof current === 'object' && !Array.isArray(current)) {
|
|
10
10
|
const data = typeof current.toJSON === 'function'
|
|
@@ -13,25 +13,27 @@ exports.default = (...fields) => async (context, next) => {
|
|
|
13
13
|
}
|
|
14
14
|
return current;
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const result = context.dispatch || context.result;
|
|
20
|
-
if (result) {
|
|
21
|
-
if (Array.isArray(result)) {
|
|
22
|
-
context.dispatch = result.map(o);
|
|
16
|
+
return async (context, next) => {
|
|
17
|
+
if (typeof next === 'function') {
|
|
18
|
+
await next();
|
|
23
19
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const result = context.dispatch || context.result;
|
|
21
|
+
if (result) {
|
|
22
|
+
if (Array.isArray(result)) {
|
|
23
|
+
context.dispatch = result.map(o);
|
|
24
|
+
}
|
|
25
|
+
else if (result.data && context.method === 'find') {
|
|
26
|
+
context.dispatch = Object.assign({}, result, {
|
|
27
|
+
data: result.data.map(o)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
context.dispatch = o(result);
|
|
32
|
+
}
|
|
33
|
+
if (context.params && context.params.provider) {
|
|
34
|
+
context.result = context.dispatch;
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
|
-
|
|
30
|
-
context.dispatch = o(result);
|
|
31
|
-
}
|
|
32
|
-
if (context.params && context.params.provider) {
|
|
33
|
-
context.result = context.dispatch;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
37
|
+
};
|
|
36
38
|
};
|
|
37
39
|
//# sourceMappingURL=protect.js.map
|
package/lib/hooks/protect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protect.js","sourceRoot":"","sources":["../../src/hooks/protect.ts"],"names":[],"mappings":";;;;;AAAA,uDAA+B;AAG/B,kBAAe,CAAC,GAAG,MAAgB,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"protect.js","sourceRoot":"","sources":["../../src/hooks/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gBAC7C,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;aACnC;SACF;IACH,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import hashPassword from './hooks/hash-password';
|
|
2
2
|
export declare const hooks: {
|
|
3
3
|
hashPassword: typeof hashPassword;
|
|
4
|
-
protect: (...fields: string[]) => (context: import("@feathersjs/feathers/lib").HookContext<import("@feathersjs/feathers/lib").Application<any, any>, any>, next?: import("@feathersjs/hooks
|
|
4
|
+
protect: (...fields: string[]) => (context: import("@feathersjs/feathers/lib").HookContext<import("@feathersjs/feathers/lib").Application<any, any>, any>, next?: import("@feathersjs/hooks").NextFunction) => Promise<void>;
|
|
5
5
|
};
|
|
6
6
|
export { LocalStrategy } from './strategy';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/authentication-local",
|
|
3
3
|
"description": "Local authentication strategy for @feathers/authentication",
|
|
4
|
-
"version": "5.0.0-pre.
|
|
4
|
+
"version": "5.0.0-pre.18",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git://github.com/feathersjs/feathers.git"
|
|
19
|
+
"url": "git://github.com/feathersjs/feathers.git",
|
|
20
|
+
"directory": "packages/authentication-local"
|
|
20
21
|
},
|
|
21
22
|
"author": {
|
|
22
23
|
"name": "Feathers contributors",
|
|
@@ -42,8 +43,7 @@
|
|
|
42
43
|
"scripts": {
|
|
43
44
|
"prepublish": "npm run compile",
|
|
44
45
|
"compile": "shx rm -rf lib/ && tsc",
|
|
45
|
-
"test": "
|
|
46
|
-
"mocha": "mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
|
|
46
|
+
"test": "mocha --config ../../.mocharc.json --recursive test/**.test.ts test/**/*.test.ts"
|
|
47
47
|
},
|
|
48
48
|
"directories": {
|
|
49
49
|
"lib": "lib"
|
|
@@ -52,23 +52,23 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@feathersjs/authentication": "^5.0.0-pre.
|
|
56
|
-
"@feathersjs/commons": "^5.0.0-pre.
|
|
57
|
-
"@feathersjs/errors": "^5.0.0-pre.
|
|
58
|
-
"@feathersjs/feathers": "^5.0.0-pre.
|
|
55
|
+
"@feathersjs/authentication": "^5.0.0-pre.18",
|
|
56
|
+
"@feathersjs/commons": "^5.0.0-pre.18",
|
|
57
|
+
"@feathersjs/errors": "^5.0.0-pre.18",
|
|
58
|
+
"@feathersjs/feathers": "^5.0.0-pre.18",
|
|
59
59
|
"bcryptjs": "^2.4.3",
|
|
60
60
|
"lodash": "^4.17.21"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@feathersjs/memory": "^5.0.0-pre.
|
|
63
|
+
"@feathersjs/memory": "^5.0.0-pre.18",
|
|
64
64
|
"@types/bcryptjs": "^2.4.2",
|
|
65
|
-
"@types/lodash": "^4.14.
|
|
66
|
-
"@types/mocha": "^9.
|
|
67
|
-
"@types/node": "^
|
|
68
|
-
"mocha": "^9.
|
|
69
|
-
"shx": "^0.3.
|
|
70
|
-
"ts-node": "^10.
|
|
71
|
-
"typescript": "^4.
|
|
65
|
+
"@types/lodash": "^4.14.181",
|
|
66
|
+
"@types/mocha": "^9.1.0",
|
|
67
|
+
"@types/node": "^17.0.23",
|
|
68
|
+
"mocha": "^9.2.2",
|
|
69
|
+
"shx": "^0.3.4",
|
|
70
|
+
"ts-node": "^10.7.0",
|
|
71
|
+
"typescript": "^4.6.3"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "c0b7b67d872dcd6b6d94e4587f21332c8a519b50"
|
|
74
74
|
}
|
package/src/hooks/protect.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
2
|
import { HookContext, NextFunction } from '@feathersjs/feathers';
|
|
3
3
|
|
|
4
|
-
export default (...fields: string[]) =>
|
|
4
|
+
export default (...fields: string[]) => {
|
|
5
5
|
const o = (current: any) => {
|
|
6
6
|
if (typeof current === 'object' && !Array.isArray(current)) {
|
|
7
7
|
const data = typeof current.toJSON === 'function'
|
|
@@ -13,25 +13,27 @@ export default (...fields: string[]) => async (context: HookContext, next?: Next
|
|
|
13
13
|
return current;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
return async (context: HookContext, next?: NextFunction) => {
|
|
17
|
+
if (typeof next === 'function') {
|
|
18
|
+
await next();
|
|
19
|
+
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
const result = context.dispatch || context.result;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
if (result) {
|
|
24
|
+
if (Array.isArray(result)) {
|
|
25
|
+
context.dispatch = result.map(o);
|
|
26
|
+
} else if (result.data && context.method === 'find') {
|
|
27
|
+
context.dispatch = Object.assign({}, result, {
|
|
28
|
+
data: result.data.map(o)
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
context.dispatch = o(result);
|
|
32
|
+
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
if (context.params && context.params.provider) {
|
|
35
|
+
context.result = context.dispatch;
|
|
36
|
+
}
|
|
35
37
|
}
|
|
36
|
-
}
|
|
38
|
+
};
|
|
37
39
|
};
|