Skip to content

Commit 1990797

Browse files
refactor!: Typescript refactoring, separate services, custom methods and vitepress docs (#164)
* refactor: typescript minimum valuable product * refactor: move to typescript - complete typing - update dependencies - semistandard -> eslint-typescript - start converting tests to typescript - ref #144 * test: add typings to tests and fix some bugs - identityChange had no 'field' property - tests fixes * refactor: start seperate services - add passwordField to options - propper typing * test: make nyc report working again * refactor: move to seperate services - call seperate services from main service * docs: add description to service calls * refactor: add better IDE-support - destructure create-data for better IDE support - move AuthenticationManagementService to seperate file * docs: init vuepress * refactor: remove `field` parameter - completely move `passwordField` to options * feat: separate services - Base class with publish-prevention - `useSeparateServicePaths` option - use internal service.options instead of create({ action: 'options' }) - add tests for publish - add tests for `useSeparateServicePaths` - more typings * modify client authenticate * docs: add hooks docs * small changes - export defaultOptions -> addVerification - path - rearrange useSeparateServices * several improvements - divide Service & configure functions - ensure options per Service - types: better types - chore: update dependencies - tests: add tests for separate services - tests: increase about-time to 600 * small changes - better typing (abstract _create with type) - sort actions alphabetically * docs: improvements - overview page - started services page * docs: add example * chore: rename folder "service" to "services" * docs: continue docs * feat: prepare for custom methods from feathers^5 * chore: expose services at root * docs(chore): move vuepress to vitepress * refactor: move methods to seperate folder * docs: align with PR from rma4ok * refactor: add custom methods without '_' - refactor: add import type where necessary - refactor: add newlines for function params - refactor: destructure imports * port #167 to typescript * test: fix basicSpy 'this' on function * chore: update dependencies * chore: major update dependencies & remove unnecessary packages * refactor: move defaultOptions to own file - refactor: rename configureAuth to setupAuth * refactor(methods): Promise.all tokens * types: add GetUserDataCheckProps * perf(addVerification): move promise down * perf(checkUnique): add pagination * refactor(methods): add $limit: 2 to find * test: chore - rename titles '.js' to '.ts' * chore: isDateAfterNow helper to helpers/index * test: add tests for helpers * refactor(test): reorganize test-files - move to test/hooks - move to test/methods - rename test/helpers to test/test-helpers * fix: typo identityChange * tests: test authMgmt/create, /[method], separate service - refactor: remove chai - refactor: move many try-catch - refactor: users - refactor: use [idType] * chore: min-version node@10 - remove chai - npm update * test: chore - rename tests & move idType * re-structures docs and adds new Getting Started * adds new overview and configuration chapters * addschapters process flows and service calls * after docs text review * !feat: remove 'useSeparateServices' * refactor: rename 'configure' to 'setup' * test: add custom path test to 'add-verification' * chore: move npmignore to package.files - remove babel - update badges in readme - update license year * chore: npm update * !refactor: app as first argument for constructor - BREAKING CHANGE * fix: NotifierOptions type * extended regarding feedback * refactor: remove swagger docs from constructor * docs: vuepress@next, improve service calls - move from vitepress to vuepress@next for <CodeGroup> - add logo - remove note about 'docs' of swagger - remove 'prefferedComm' because it's not used anywhere - improve `multi:true` on users-hooks * test: ensure exported members * docs: remove old stuff * chore: lint --fix * docs: add note to pre-release * !refactor: remove 'value' from custom methods & separate services - BREAKING CHANGE * fix: VerifyChanges * 4.0.0-pre.0 * Updating changelog * docs: add pre tag to install script * docs: add feathers-mailer to install script * docs: fix typo * docs: add options to service calls * docs: fix getting-started * feat: add multi support for 'add-verification' hook * docs: add vue example to example folder * fix(client): improve client and export in entry file * refactor: rename and export helpers * docs: add descriptions to type options * docs: center images * docs: comment out stuff in service calls * chore: increase codeclimate thresholds * chore: eslintignore examples * 4.0.0-pre.1 * Updating changelog * docs: init migration guide * docs: migration guide add channels note * docs: update notifier example * docs: add search * docs: add note to 'isVerified' about authenticate before * docs: fix preventChanges first param * chore: shrink helpers-folder * chore: clean test setup * refactor: more declarative methods, $limit: 2 & passwordField - rename user1, user2, user3 to declarative names - use $limit: 2 everywhere - use [passwordField] consequently * chore: update dependencies & import/order * chore: remove eslint-config-standard * ci: update coverage action to v3 * chore: update dependencies * chore: change feathers contributors as author * 4.0.0-pre.2 * Updating changelog * docs: move to vitepress * docs: move to Tabs and dismiss CodeGroup * docs: fix primary color * ci: add node v18 to matrix Co-authored-by: Onno Gabriel <[email protected]>
1 parent db795c8 commit 1990797

File tree

204 files changed

+25107
-13468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+25107
-13468
lines changed

.babelrc

-6
This file was deleted.

.codeclimate.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins:
44
checks:
55
argument-count:
66
config:
7-
threshold: 4
7+
threshold: 5
88
complex-logic:
99
config:
1010
threshold: 4
@@ -19,7 +19,7 @@ checks:
1919
threshold: 20
2020
method-lines:
2121
config:
22-
threshold: 50
22+
threshold: 100
2323
nested-control-flow:
2424
config:
2525
threshold: 4
@@ -30,3 +30,7 @@ checks:
3030
enabled: false
3131
identical-code:
3232
enabled: false
33+
34+
exclude_patterns:
35+
- "examples"
36+
- "test"

.eslintignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# don't ever lint node_modules
2+
node_modules
3+
# don't lint build output (make sure it's set to your correct build folder name)
4+
dist
5+
# don't lint nyc coverage output
6+
coverage
7+
8+
test/
9+
examples/

.eslintrc

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"node": true,
5+
"mocha": true
6+
},
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"project": "./tsconfig.json"
10+
},
11+
"plugins": [
12+
"@typescript-eslint"
13+
],
14+
"extends": [
15+
"eslint:recommended",
16+
"plugin:@typescript-eslint/recommended",
17+
"plugin:import/recommended",
18+
"plugin:import/typescript"
19+
],
20+
"rules": {
21+
"semi": ["warn", "always"],
22+
"@typescript-eslint/semi": ["warn", "always"],
23+
"@typescript-eslint/strict-boolean-expressions": ["off"],
24+
"spaced-comment": ["off"],
25+
"@typescript-eslint/consistent-type-imports": ["warn", { "prefer": "type-imports" }],
26+
// import
27+
"import/order": ["warn", { "groups": ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"] }],
28+
"import/no-duplicates": ["warn"]
29+
},
30+
"overrides": [
31+
{
32+
"files": ["test/**/*.ts"],
33+
"rules": {
34+
"@typescript-eslint/ban-ts-comment": ["off"]
35+
}
36+
}
37+
]
38+
}

.github/contributing.md

+2-10
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Before creating an issue please make sure you have checked out the docs, specifi
1010

1111
If you haven't found your answer please feel free to join our [slack channel](http://slack.feathersjs.com), create an issue on Github, or post on [Stackoverflow](http://stackoverflow.com) using the `feathers` or `feathersjs` tag. We try our best to monitor Stackoverflow but you're likely to get more immediate responses in Slack and Github.
1212

13-
Issues can be reported in the [issue tracker](https://github.com/feathersjs/feathers/issues). Since feathers combines many modules it can be hard for us to assess the root cause without knowing which modules are being used and what your configuration looks like, so **it helps us immensely if you can link to a simple example that reproduces your issue**.
13+
Issues can be reported in the [issue tracker](https://github.com/feathersjs/feathers/issues). Since feathers combines many modules it can be hard for us to assess the root cause without knowing which modules are being used and what your configuration looks like, so **it helps us immensely if you can link to a simple example that reproduces your issue**.
1414

1515
## Report a Security Concern
1616

1717
We take security very seriously at Feathers. We welcome any peer review of our 100% open source code to ensure nobody's Feathers app is ever compromised or hacked. As a web application developer you are responsible for any security breaches. We do our very best to make sure Feathers is as secure as possible by default.
1818

19-
In order to give the community time to respond and upgrade we strongly urge you report all security issues to us. Send one of the core team members a PM in [Slack](http://slack.feathersjs.com) or email us at [email protected] with details and we will respond ASAP.
19+
In order to give the community time to respond and upgrade we strongly urge you report all security issues to us. Send one of the core team members a PM in [Slack](http://slack.feathersjs.com) or e-mail us at [email protected] with details and we will respond ASAP.
2020

2121
For full details refer to our [Security docs](https://docs.feathersjs.com/SECURITY.html).
2222

@@ -34,14 +34,6 @@ Although we generally accept many PRs they can be rejected for many reasons. We
3434

3535
Before running the tests from the `test/` folder `npm test` will run ESlint. You can check your code changes individually by running `npm run lint`.
3636

37-
### ES6 compilation
38-
39-
Feathers uses [Babel](https://babeljs.io/) to leverage the latest developments of the JavaScript language. All code and samples are currently written in ES2015. To transpile the code in this repository run
40-
41-
> npm run compile
42-
43-
__Note:__ `npm test` will run the compilation automatically before the tests.
44-
4537
### Tests
4638

4739
[Mocha](http://mochajs.org/) tests are located in the `test/` folder and can be run using the `npm run mocha` or `npm test` (with ESLint and code coverage) command.

.github/workflows/node.js.yml

+7-11
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,14 @@
33

44
name: Node.js CI
55

6-
on:
7-
push:
8-
branches: [ master ]
9-
pull_request:
10-
branches: [ master ]
6+
on: [push, pull_request]
117

128
jobs:
139
test:
1410
runs-on: ubuntu-latest
15-
1611
strategy:
1712
matrix:
18-
node-version: [12.x, 14.x]
13+
node-version: [12.x, 14.x, 16.x, 18.x]
1914
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2015

2116
steps:
@@ -26,6 +21,7 @@ jobs:
2621
node-version: ${{ matrix.node-version }}
2722
- run: npm ci
2823
- run: npm test
24+
2925
coverage:
3026
needs: [ test ]
3127
name: coverage
@@ -34,10 +30,10 @@ jobs:
3430
- uses: actions/checkout@master
3531
- uses: actions/setup-node@master
3632
with:
37-
node-version: '12'
38-
- run: npm i
39-
- uses: paambaati/codeclimate-action@v2.7.5
33+
node-version: '14'
34+
- run: npm ci
35+
- uses: paambaati/codeclimate-action@v3.0.0
4036
env:
4137
CC_TEST_REPORTER_ID: ac461a4a35fe5e70a011b20969f4298ad55da3498f1efbe0019d2bc3b99cf885
4238
with:
43-
coverageCommand: npm run test
39+
coverageCommand: npm run coverage

.gitignore

+6-3
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ node_modules
3232
.lock-wscript
3333

3434
# The compiled/babelified modules
35-
lib/
35+
dist/
3636

3737
## editor
3838
.idea/
3939

40-
.vscode/
41-
.prettierrc
40+
#.vscode/
41+
.prettierrc
42+
43+
docs/.vuepress/.cache
44+
docs/.vuepress/.temp

.mocharc.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
const path = require("path");
3+
4+
module.exports = {
5+
extension: ["ts", "js"],
6+
package: path.join(__dirname, "./package.json"),
7+
ui: "bdd",
8+
spec: [
9+
"./test/**/*.test.*",
10+
],
11+
exit: true
12+
};

.npmignore

-7
This file was deleted.

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16.15.1

.nycrc

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"all": true,
3-
"include": ["src/**/*.js"],
3+
"include": [
4+
"src/**/*.js",
5+
"src/**/*.ts"
6+
],
7+
"exclude": [
8+
"coverage/**",
9+
"node_modules/**",
10+
"**/*.d.ts",
11+
"**/*.test.ts"
12+
],
13+
"sourceMap": true,
414
"reporter": ["text", "html", "lcov"]
5-
}
15+
}

.vscode/launch.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "pwa-node",
6+
"resolveSourceMapLocations": [
7+
"${workspaceFolder}/**",
8+
"!**/node_modules/**"
9+
],
10+
"request": "launch",
11+
"name": "Mocha Tests",
12+
"program": "${workspaceFolder}/node_modules/mocha/bin/mocha",
13+
"args": [
14+
"--require",
15+
"ts-node/register",
16+
"--timeout",
17+
"999999",
18+
"--colors",
19+
"--recursive"
20+
],
21+
"internalConsoleOptions": "openOnSessionStart",
22+
"env": {
23+
"NODE_ENV": "test",
24+
"TS_NODE_PROJECT": "tsconfig.test.json"
25+
},
26+
"outputCapture": "std",
27+
"skipFiles": [
28+
"<node_internals>/**"
29+
]
30+
},
31+
]
32+
}

.vscode/settings.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"search.exclude": {
4+
"**/node_modules": true,
5+
"**/public": true,
6+
"**/package-lock.json": true,
7+
"**/yarn.lock": true
8+
},
9+
"workbench.colorCustomizations": {
10+
"activityBar.background": "#520064",
11+
"titleBar.activeBackground": "#520064",
12+
"titleBar.activeForeground": "#FAFBF4"
13+
}
14+
}

CHANGELOG.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
# Changelog
22

3-
## [Unreleased](https://github.com/feathersjs-ecosystem/feathers-authentication-management/tree/HEAD)
3+
## [v4.0.0-pre.2](https://github.com/feathersjs-ecosystem/feathers-authentication-management/tree/v4.0.0-pre.2) (2022-06-19)
44

5-
[Full Changelog](https://github.com/feathersjs-ecosystem/feathers-authentication-management/compare/v3.2.0...HEAD)
5+
[Full Changelog](https://github.com/feathersjs-ecosystem/feathers-authentication-management/compare/v3.2.0...v4.0.0-pre.2)
6+
7+
## [v3.2.0](https://github.com/feathersjs-ecosystem/feathers-authentication-management/tree/v3.2.0) (2022-05-16)
8+
9+
[Full Changelog](https://github.com/feathersjs-ecosystem/feathers-authentication-management/compare/v4.0.0-pre.1...v3.2.0)
10+
11+
**Closed issues:**
12+
13+
- 4.0.0-pre.1 has un declared passport-local dependency [\#173](https://github.com/feathersjs-ecosystem/feathers-authentication-management/issues/173)
14+
- skipIsVerifiedCheck doesn't call custom notifier. [\#172](https://github.com/feathersjs-ecosystem/feathers-authentication-management/issues/172)
15+
- identityChange doesn't verify the user's password [\#171](https://github.com/feathersjs-ecosystem/feathers-authentication-management/issues/171)
616

717
**Merged pull requests:**
818

@@ -15,16 +25,6 @@
1525
- Bump y18n from 4.0.0 to 4.0.1 [\#161](https://github.com/feathersjs-ecosystem/feathers-authentication-management/pull/161) ([dependabot[bot]](https://github.com/apps/dependabot))
1626
- Update docs.md [\#160](https://github.com/feathersjs-ecosystem/feathers-authentication-management/pull/160) ([re1ro](https://github.com/re1ro))
1727

18-
## [v3.2.0](https://github.com/feathersjs-ecosystem/feathers-authentication-management/tree/v3.2.0) (2022-05-16)
19-
20-
[Full Changelog](https://github.com/feathersjs-ecosystem/feathers-authentication-management/compare/v4.0.0-pre.1...v3.2.0)
21-
22-
**Closed issues:**
23-
24-
- 4.0.0-pre.1 has un declared passport-local dependency [\#173](https://github.com/feathersjs-ecosystem/feathers-authentication-management/issues/173)
25-
- skipIsVerifiedCheck doesn't call custom notifier. [\#172](https://github.com/feathersjs-ecosystem/feathers-authentication-management/issues/172)
26-
- identityChange doesn't verify the user's password [\#171](https://github.com/feathersjs-ecosystem/feathers-authentication-management/issues/171)
27-
2828
## [v4.0.0-pre.1](https://github.com/feathersjs-ecosystem/feathers-authentication-management/tree/v4.0.0-pre.1) (2022-01-08)
2929

3030
[Full Changelog](https://github.com/feathersjs-ecosystem/feathers-authentication-management/compare/v4.0.0-pre.0...v4.0.0-pre.1)

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Feathers
3+
Copyright (c) 2022 Feathers
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
**This module is looking for maintainers, please contact us on the [Feathers Slack group](http://slack.feathersjs.com/)** (more details in [#124](https://github.com/feathersjs-ecosystem/feathers-authentication-management/issues/124))
22

3-
## feathers-authentication-management
4-
5-
[![Build Status](https://travis-ci.org/feathersjs-ecosystem/feathers-authentication-management.png?branch=master)](https://travis-ci.org/feathersjs-ecosystem/feathers-authentication-management)
6-
[![Code Climate](https://codeclimate.com/github/feathersjs-ecosystem/feathers-authentication-management/badges/gpa.svg)](https://codeclimate.com/github/feathersjs-ecosystem/feathers-authentication-management)
7-
[![Test Coverage](https://codeclimate.com/github/feathersjs-ecosystem/feathers-authentication-management/badges/coverage.svg)](https://codeclimate.com/github/feathersjs-ecosystem/feathers-authentication-management/coverage)
8-
[![Dependency Status](https://img.shields.io/david/feathersjs-ecosystem/feathers-authentication-management.svg?style=flat-square)](https://david-dm.org/feathersjs-ecosystem/feathers-authentication-management)
9-
[![Download Status](https://img.shields.io/npm/dm/feathers-authentication-management.svg?style=flat-square)](https://www.npmjs.com/package/feathers-authentication-management)
10-
3+
# feathers-authentication-management
114
**Sign up verification, forgotten password reset, and other capabilities for local authentication.**
125

13-
## Documentation
6+
<p align="center">
7+
<a href="https://feathers-a-m.netlify.app/"><img src="https://feathers-a-m.netlify.app/logo.svg" width="200"></a>
8+
</p>
149

15-
The [`master`](https://github.com/feathersjs-ecosystem/feathers-authentication-management) branch and versions >= 3.x are expected to work with [Feathers v4](https://docs.feathersjs.com/) (a.k.a. Crow).
10+
> **Please note:** You're currently looking at the `pre`-release of `feathers-authentication-management`. This is a typescript rewrite with a few changes. If you're looking for the 'old' version, please checkout the `master` branch or version `^3.1.0`.
1611
17-
Versions >= 1.x are expected to work with [Feathers v3](https://buzzard.docs.feathersjs.com/) (a.k.a. Buzzard)
12+
[![Build Status](https://img.shields.io/github/workflow/status/feathersjs-ecosystem/feathers-authentication-management/Node.js%20CI)](https://github.com/feathersjs-ecosystem/feathers-authentication-management/actions/workflows/node.js.yml?query=branch%3Amaster)
13+
[![Code Climate](https://codeclimate.com/github/feathersjs-ecosystem/feathers-authentication-management/badges/gpa.svg)](https://codeclimate.com/github/feathersjs-ecosystem/feathers-authentication-management)
14+
[![Test Coverage](https://codeclimate.com/github/feathersjs-ecosystem/feathers-authentication-management/badges/coverage.svg)](https://codeclimate.com/github/feathersjs-ecosystem/feathers-authentication-management/coverage)
15+
[![Dependency Status](https://img.shields.io/librariesio/release/npm/feathers-authentication-management)](https://libraries.io/npm/feathers-authentication-management)
16+
[![Download Status](https://img.shields.io/npm/dm/feathers-authentication-management.svg?style=flat-square)](https://www.npmjs.com/package/feathers-authentication-management)
17+
[![GitHub license](https://img.shields.io/github/license/feathersjs-ecosystem/feathers-authentication-management)](https://github.com/feathersjs-ecosystem/feathers-authentication-management/blob/master/LICENSE)
1818

19-
### Developers
19+
```bash
20+
npm i feathers-authentication-management@pre
21+
```
2022

21-
Refer to [Documentation](./docs.md).
23+
## ⭐️⭐️⭐️ Documentation
2224

23-
Read a [step-by-step guide](https://hackernoon.com/setting-up-email-verification-in-feathersjs-ce764907e4f2) created by Imre Gelens
25+
You need more information? Please have a look at our new docs at [feathers-a-m.netlify.app](https://feathers-a-m.netlify.app/).
2426

2527
### Maintainers
2628

27-
Refer to our [guidelines](./development.md).
29+
Refer to our [guidelines](./development).
2830

2931
## License
3032

0 commit comments

Comments
 (0)