mbkauthe 3.2.0 โ 3.2.1
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/README.md +26 -6
- package/docs/db.md +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -119,24 +119,44 @@ app.get('/admin', validateSession, checkRolePermission(['SuperAdmin']), (req, re
|
|
|
119
119
|
app.listen(3000);
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
## ๐งช Testing
|
|
123
122
|
|
|
124
|
-
|
|
123
|
+
## ๐งช Testing & Git Hooks
|
|
124
|
+
|
|
125
|
+
MBKAuthe includes comprehensive test coverage for all authentication features. **A pre-commit hook is provided to ensure code quality:**
|
|
126
|
+
|
|
127
|
+
### Pre-commit Hook (Automatic Test Runner)
|
|
128
|
+
|
|
129
|
+
- Located at `scripts/pre-commit` and `scripts/pre-commit` (Node.js, cross-platform)
|
|
130
|
+
- Starts the dev server, runs all tests, and blocks commits if any test fails
|
|
131
|
+
- The dev server is automatically stopped after tests complete
|
|
132
|
+
- Ensures you never commit code that breaks tests
|
|
133
|
+
|
|
134
|
+
### Git Hook Setup
|
|
135
|
+
|
|
136
|
+
Hooks are auto-configured every time you run `npm run dev`, `npm test`, or `npm run test:watch` (see `scripts/setup-hooks.js`).
|
|
137
|
+
|
|
138
|
+
If you ever need to manually set up hooks:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
node scripts/setup-hooks.js
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Running Tests
|
|
125
145
|
|
|
126
146
|
```bash
|
|
127
|
-
# Run all tests
|
|
147
|
+
# Run all tests (auto-configures hooks)
|
|
128
148
|
npm test
|
|
129
149
|
|
|
130
|
-
# Run tests in watch mode (auto-
|
|
150
|
+
# Run tests in watch mode (auto-configures hooks)
|
|
131
151
|
npm run test:watch
|
|
132
152
|
|
|
133
|
-
# Run with development flags
|
|
153
|
+
# Run with development flags (auto-configures hooks)
|
|
134
154
|
npm run dev
|
|
135
155
|
```
|
|
136
156
|
|
|
137
157
|
**Test Coverage:**
|
|
138
158
|
- โ
Authentication flows (login, 2FA, logout)
|
|
139
|
-
- โ
OAuth integration (GitHub)
|
|
159
|
+
- โ
OAuth integration (GitHub)
|
|
140
160
|
- โ
Session management and security
|
|
141
161
|
- โ
Role-based access control
|
|
142
162
|
- โ
API endpoints and error handling
|
package/docs/db.md
CHANGED
|
@@ -43,7 +43,7 @@ CREATE TABLE user_github (
|
|
|
43
43
|
user_name VARCHAR(50) REFERENCES "Users"("UserName"),
|
|
44
44
|
github_id VARCHAR(255) UNIQUE,
|
|
45
45
|
github_username VARCHAR(255),
|
|
46
|
-
access_token
|
|
46
|
+
access_token TEXT,
|
|
47
47
|
created_at TimeStamp WITH TIME ZONE DEFAULT NOW(),
|
|
48
48
|
updated_at TimeStamp WITH TIME ZONE DEFAULT NOW()
|
|
49
49
|
);
|
|
@@ -58,7 +58,7 @@ CREATE TABLE user_google (
|
|
|
58
58
|
user_name VARCHAR(50) REFERENCES "Users"("UserName"),
|
|
59
59
|
google_id VARCHAR(255) UNIQUE,
|
|
60
60
|
google_email VARCHAR(255),
|
|
61
|
-
access_token
|
|
61
|
+
access_token TEXT,
|
|
62
62
|
created_at TimeStamp WITH TIME ZONE DEFAULT NOW(),
|
|
63
63
|
updated_at TimeStamp WITH TIME ZONE DEFAULT NOW()
|
|
64
64
|
);
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mbkauthe",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "MBKTech's reusable authentication system for Node.js applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"dev": "cross-env test=dev nodemon index.js",
|
|
10
|
-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
11
|
-
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch"
|
|
9
|
+
"dev": "node scripts/setup-hooks.js && cross-env test=dev nodemon index.js",
|
|
10
|
+
"test": "node scripts/setup-hooks.js && node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
11
|
+
"test:watch": "node scripts/setup-hooks.js && node --experimental-vm-modules node_modules/jest/bin/jest.js --watch"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|