Skip to content

Commit ad8b498

Browse files
authored
Merge pull request #564 from nkitku/v5.0-dev
V5.0 dev
2 parents 45b508a + 52120fd commit ad8b498

File tree

170 files changed

+15602
-12431
lines changed

Some content is hidden

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

170 files changed

+15602
-12431
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_style = space
8+
indent_size = 2
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
max_line_length = off
14+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 0 additions & 36 deletions
This file was deleted.

.gitignore

100644100755
Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,19 @@
1-
node_modules/
1+
2+
# IDE
3+
/.idea
4+
/.awcache
5+
/.vscode/*.code-workspace
6+
/.vscode/settings.json
7+
8+
# misc
9+
npm-debug.log
10+
# folders
11+
/dist
12+
/node_modules
213
docs/_build/
314
__pycache__/
4-
*.pyc
5-
lib-cov
6-
*.seed
7-
*.log
8-
*.csv
9-
*.dat
10-
*.out
11-
*.pid
12-
*.gz
13-
*.iml
1415

15-
.idea
16-
.jshint
16+
# files
1717
.DS_Store
18-
19-
pids
20-
logs
21-
results
22-
23-
lib/dockerImage/keys
24-
coverage
25-
npm-debug.log*~
26-
\#*\#
27-
/.emacs.desktop
28-
/.emacs.desktop.lock
29-
.elc
30-
auto-save-list
31-
tramp
32-
.\#*
33-
34-
# Org-mode
35-
.org-id-locations
36-
*_archive
18+
*.pyc
19+
/aio

.npmignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"endOfLine": "lf"
5+
}

.travis.yml

100644100755
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
language: node_js
22

33
node_js:
4-
- 6
5-
- 7
64
- 8
7-
- 9
85
- 10
6+
- 12
97

108
sudo: false

.vscode/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# VSCode Configuration
2+
3+
This folder contains opt-in [Workspace Settings](https://code.visualstudio.com/docs/getstarted/settings) and [Extension Recommendations](https://code.visualstudio.com/docs/editor/extension-gallery#_workspace-recommended-extensions) that our team recommends using when working on this repository.
4+
5+
## Usage
6+
7+
To use the recommended settings follow the steps below:
8+
9+
- copy `.vscode/recommended-settings.json` to `.vscode/settings.json`
10+
- restart the editor
11+
12+
If you already have your custom workspace settings you should instead manually merge the file content.
13+
14+
This isn't an automatic process so you will need to repeat it when settings are updated.
15+
16+
To see the recommended extensions select "Extensions: Show Recommended Extensions" in the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).
17+
18+
## Editing `.vscode/recommended-settings.json`
19+
20+
If you wish to add extra configuration items please keep in mind any settings you add here will be used by many users.
21+
22+
Try to keep these settings to things that help facilitate the development process and avoid altering the user workflow whenever possible.

.vscode/extensions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": [
7+
"editorconfig.editorconfig",
8+
"esbenp.prettier-vscode",
9+
"ms-vscode.vscode-typescript-tslint-plugin"
10+
]
11+
}

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Mocha Tests",
8+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
9+
"args": [
10+
"--require",
11+
"ts-node/register",
12+
"-u",
13+
"tdd",
14+
"--timeout",
15+
"999999",
16+
"--colors",
17+
"--recursive",
18+
"${workspaceFolder}/test/**/*.spec.ts"
19+
],
20+
"internalConsoleOptions": "openOnSessionStart"
21+
}
22+
]
23+
}

.vscode/recommended-settings.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"files.exclude": {
3+
"**/.git": true,
4+
"**/.DS_Store": true,
5+
"**/node_modules": true,
6+
"dist": true
7+
},
8+
"files.watcherExclude": {
9+
"**/.git/**": true,
10+
"**/node_modules/**": true,
11+
"**/dist/**": true
12+
},
13+
"search.exclude": {
14+
"**/node_modules": true,
15+
"**/dist": true
16+
},
17+
"editor.formatOnSave": false,
18+
"typescript.format.enable": false,
19+
"editor.formatOnPaste": false,
20+
"[typescript]": {
21+
"editor.formatOnSave": true,
22+
"editor.codeActionsOnSave": {
23+
"source.organizeImports": true,
24+
"source.fixAll.tslint": true
25+
}
26+
},
27+
"[json]": {
28+
"editor.formatOnSave": true
29+
},
30+
"[jsonc]": {
31+
"editor.formatOnSave": true
32+
},
33+
"[javascript]": {
34+
"editor.formatOnSave": true
35+
},
36+
"prettier.singleQuote": true,
37+
"prettier.trailingComma": "all",
38+
"prettier.printWidth": 80
39+
}

CHANGELOG.md

100644100755
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## Changelog
22

3+
### 5.0.0
4+
* BREAKING: Remove support for node v6
5+
* BREAKING: Remove support for callbacks only support native Promises
6+
* new: Rewrote in TypeScript
7+
* new: Switch from Eslint to Tslint
8+
* new: added .vscode folder for recommend extensions and recommend setting required for development
9+
* new: added suitable TypeScript Interfaces for various Objects
10+
311
### 4.0.0
412
* BREAKING: Set server_error Code to 500
513
* BREAKING: Remove support for node v4

LICENSE

100644100755
File mode changed.

TODO

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
Todo:
3+
✔ Add a todo
4+
✔ A Basic Rewrite of library in TypeScript
5+
✔ A Basic Rewrite of tests in TypeScript
6+
☐ Add examples for nestjs, expressjs, koa and others
7+
☐ Add Migration guide
8+
☐ Review all Docs

index.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export * from './lib/errors';
2+
export * from './lib/grant-types';
3+
export * from './lib/handlers';
4+
export * from './lib/interfaces';
5+
export { Request } from './lib/request';
6+
export { Response } from './lib/response';
7+
export * from './lib/response-types';
8+
export { OAuth2Server } from './lib/server';
9+
export * from './lib/token-types';
10+
export * from './lib/validator/is';

lib/constants/common.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export const MILLISECONDS_PER_SECOND = 1_000;
2+
export const SECONDS_PER_MINUTE = 60;
3+
export const MINUTES_PER_HOUR = 60;
4+
export const HOURS_PER_DAY = 24;
5+
export const DAYS_PER_WEEK = 7;
6+
export const MONTHS_PER_YEAR = 12;
7+
8+
export const SECOND = MILLISECONDS_PER_SECOND;
9+
export const MINUTE = SECONDS_PER_MINUTE * SECOND;
10+
export const HOUR = MINUTES_PER_HOUR * MINUTE;
11+
export const DAY = HOURS_PER_DAY * HOUR;
12+
export const WEEK = DAYS_PER_WEEK * DAY;

lib/constants/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './common';

lib/errors/access-denied-error.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

lib/errors/access-denied-error.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { OAuthError } from './oauth-error';
2+
3+
/**
4+
* Constructor.
5+
*
6+
* "The resource owner or authorization server denied the request"
7+
*
8+
* @see https://tools.ietf.org/html/rfc6749#section-4.1.2.1
9+
*/
10+
11+
export class AccessDeniedError extends OAuthError {
12+
constructor(message: string | Error = '', properties?: any) {
13+
super(message, { code: 400, name: 'access_denied', ...properties });
14+
}
15+
}

lib/errors/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export { AccessDeniedError } from './access-denied-error';
2+
export { InsufficientScopeError } from './insufficient-scope-error';
3+
export { InvalidArgumentError } from './invalid-argument-error';
4+
export { InvalidClientError } from './invalid-client-error';
5+
export { InvalidGrantError } from './invalid-grant-error';
6+
export { InvalidRequestError } from './invalid-request-error';
7+
export { InvalidScopeError } from './invalid-scope-error';
8+
export { InvalidTokenError } from './invalid-token-error';
9+
export { OAuthError } from './oauth-error';
10+
export { ServerError } from './server-error';
11+
export { UnauthorizedClientError } from './unauthorized-client-error';
12+
export { UnauthorizedRequestError } from './unauthorized-request-error';
13+
export { UnsupportedGrantTypeError } from './unsupported-grant-type-error';
14+
export { UnsupportedResponseTypeError } from './unsupported-response-type-error';

0 commit comments

Comments
 (0)