create-warlock 1.0.16 → 2.0.3
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/package.json +1 -1
- package/templates/warlock/package.json +59 -59
- package/templates/warlock/src/app/users/controllers/profile/change-password.ts +5 -5
- package/templates/warlock/src/app/users/routes.ts +0 -7
- package/templates/warlock/src/app/utils/router.ts +2 -2
- package/templates/warlock/warlock.config.ts +1 -2
package/package.json
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
2
|
+
"name": "app-nme",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "warlock dev",
|
|
7
|
+
"build": "tsc && warlock build",
|
|
8
|
+
"prod": "warlock start",
|
|
9
|
+
"postman": "warlock postman",
|
|
10
|
+
"migrate": "warlock migrate",
|
|
11
|
+
"migrate.fresh": "warlock migrate --fresh",
|
|
12
|
+
"migrate.list": "warlock migrate --list",
|
|
13
|
+
"jwt": "warlock jwt.generate",
|
|
14
|
+
"test": "warlock test.init && vitest",
|
|
15
|
+
"prod.start": "yarn build && yarn prod",
|
|
16
|
+
"serve": "yarn build && nohup warlock start > /dev/null 2>&1",
|
|
17
|
+
"lint": "npx eslint --fix -c ./.eslintrc.json ./src --max-warnings=0",
|
|
18
|
+
"format": "npx prettier --write ./src/**/*.{js,jsx,ts,tsx,css,md,json} --config ./.prettierrc.json",
|
|
19
|
+
"tsc": "npx tsc --noEmit"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@mongez/collection": "^1.2.0",
|
|
23
|
+
"@mongez/encryption": "^1.0.4",
|
|
24
|
+
"@mongez/fs": "^3.0.5",
|
|
25
|
+
"@mongez/reinforcements": "^2.3.10",
|
|
26
|
+
"@mongez/localization": "^3.0.0",
|
|
27
|
+
"@mongez/dotenv": "^1.1.9",
|
|
28
|
+
"@mongez/config": "^1.0.26",
|
|
29
|
+
"@mongez/supportive-is": "^2.0.3",
|
|
30
|
+
"@warlock.js/auth": "2.0.3",
|
|
31
|
+
"@warlock.js/cache": "2.0.3",
|
|
32
|
+
"@warlock.js/cascade": "2.0.3",
|
|
33
|
+
"@warlock.js/core": "2.0.3",
|
|
34
|
+
"@warlock.js/logger": "2.0.3",
|
|
35
|
+
"dayjs": "^1.11.10"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"eslint": "^8.53.0",
|
|
39
|
+
"@types/react": "^18.3.3",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
41
|
+
"@typescript-eslint/parser": "^6.11.0",
|
|
42
|
+
"eslint-config-prettier": "^9.0.0",
|
|
43
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
44
|
+
"eslint-plugin-unused-imports": "^3.0.0",
|
|
45
|
+
"@mongez/huskier": "^2.0.0",
|
|
46
|
+
"prettier": "^3.2.5",
|
|
47
|
+
"prettier-plugin-organize-imports": "^3.2.4",
|
|
48
|
+
"typescript": "^5.4.5",
|
|
49
|
+
"vite": "^5.2.8",
|
|
50
|
+
"vitest": "^1.5.0"
|
|
51
|
+
},
|
|
52
|
+
"huskier": {
|
|
53
|
+
"hooks": {
|
|
54
|
+
"pre-commit": [
|
|
55
|
+
"yarn format",
|
|
56
|
+
"yarn lint",
|
|
57
|
+
"yarn tsc"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
}
|
|
61
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { v, type Request, type Response } from "@warlock.js/core";
|
|
2
2
|
import type { User } from "app/users/models/user";
|
|
3
3
|
|
|
4
4
|
export default async function changePassword(
|
|
@@ -15,10 +15,10 @@ export default async function changePassword(
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
changePassword.validation = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
18
|
+
schema: v.object({
|
|
19
|
+
password: v.string().minLength(8).required(),
|
|
20
|
+
confirmPassword: v.string().required().matches("password"),
|
|
21
|
+
}),
|
|
22
22
|
validate: (request: Request<User>, response: Response) => {
|
|
23
23
|
const user = request.user;
|
|
24
24
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { guestLogin } from "@warlock.js/auth";
|
|
2
1
|
import { router } from "@warlock.js/core";
|
|
3
2
|
import {
|
|
4
|
-
adminPath,
|
|
5
3
|
guarded,
|
|
6
4
|
guardedAdmin,
|
|
7
5
|
guardedGuest,
|
|
@@ -21,11 +19,6 @@ import myProfile from "./controllers/profile/my-profile";
|
|
|
21
19
|
import updateProfile from "./controllers/profile/update-profile";
|
|
22
20
|
import { restfulUsers } from "./controllers/restful-users";
|
|
23
21
|
|
|
24
|
-
// guest login
|
|
25
|
-
// If you are going to use guest as a user type, you can use this route
|
|
26
|
-
// otherwise, you can remove this route, also you may remove the guest model from the src/config/auth.ts config file
|
|
27
|
-
router.post([adminPath("/login/guests"), "/login/guests"], guestLogin);
|
|
28
|
-
|
|
29
22
|
// admin auth
|
|
30
23
|
guardedGuestAdmin(() => {
|
|
31
24
|
router.post("/login", adminLogin);
|
|
@@ -53,7 +53,7 @@ export const guardedGuest = (callback: RouterGroupCallback) => {
|
|
|
53
53
|
return router.group(
|
|
54
54
|
{
|
|
55
55
|
name: "guarded.guest",
|
|
56
|
-
middleware: [authMiddleware(
|
|
56
|
+
middleware: [authMiddleware()],
|
|
57
57
|
},
|
|
58
58
|
callback,
|
|
59
59
|
);
|
|
@@ -67,7 +67,7 @@ export const guardedGuestAdmin = (callback: RouterGroupCallback) => {
|
|
|
67
67
|
router.group(
|
|
68
68
|
{
|
|
69
69
|
name: "guarded.guest",
|
|
70
|
-
middleware: [authMiddleware(
|
|
70
|
+
middleware: [authMiddleware()],
|
|
71
71
|
},
|
|
72
72
|
callback,
|
|
73
73
|
);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { registerJWTSecretGeneratorCommand } from "@warlock.js/auth";
|
|
2
2
|
import { defineConfig } from "@warlock.js/core";
|
|
3
|
-
import { registerPostmanCommand } from "@warlock.js/postman";
|
|
4
3
|
|
|
5
4
|
export default defineConfig({
|
|
6
5
|
cli: {
|
|
7
|
-
commands: [
|
|
6
|
+
commands: [registerJWTSecretGeneratorCommand()],
|
|
8
7
|
},
|
|
9
8
|
});
|