@volcanicminds/backend 0.2.39 → 0.2.40
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/dist/index.js +43 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/api/auth/controller/auth.js +18 -1
- package/dist/lib/api/auth/controller/auth.js.map +1 -1
- package/dist/lib/api/auth/routes.js +27 -0
- package/dist/lib/api/auth/routes.js.map +1 -1
- package/dist/lib/api/token/controller/token.js +114 -0
- package/dist/lib/api/token/controller/token.js.map +1 -0
- package/dist/lib/api/token/routes.js +170 -0
- package/dist/lib/api/token/routes.js.map +1 -0
- package/dist/lib/hooks/onRequest.js +28 -10
- package/dist/lib/hooks/onRequest.js.map +1 -1
- package/dist/lib/schemas/auth.js +2 -0
- package/dist/lib/schemas/auth.js.map +1 -0
- package/dist/lib/schemas/common.js +33 -0
- package/dist/lib/schemas/common.js.map +1 -0
- package/dist/lib/schemas/token.js +39 -0
- package/dist/lib/schemas/token.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.ts +48 -5
- package/lib/api/auth/controller/auth.ts +15 -0
- package/lib/api/auth/routes.ts +27 -0
- package/lib/api/token/controller/token.ts +99 -0
- package/lib/api/token/routes.ts +168 -0
- package/lib/hooks/onRequest.ts +32 -12
- package/lib/schemas/auth.ts +0 -0
- package/lib/schemas/common.ts +31 -0
- package/lib/schemas/token.ts +37 -0
- package/package.json +1 -1
- package/types/global.d.ts +28 -4
package/package.json
CHANGED
package/types/global.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export interface AuthenticatedUser {
|
|
|
7
7
|
roles: Role[]
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export interface AuthenticatedToken {
|
|
11
|
+
getId(): any
|
|
12
|
+
name: string
|
|
13
|
+
roles: Role[]
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
export interface Role {
|
|
11
17
|
code: string
|
|
12
18
|
name: string
|
|
@@ -69,6 +75,7 @@ export interface ConfiguredRoute {
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
export interface UserManagement {
|
|
78
|
+
isValidUser(data: any): boolean
|
|
72
79
|
createUser(data: any): any | null
|
|
73
80
|
resetExternalId(data: any): any | null
|
|
74
81
|
updateUserById(id: string, user: any): any | null
|
|
@@ -81,16 +88,32 @@ export interface UserManagement {
|
|
|
81
88
|
retrieveUserByPassword(email: string, password: string): any | null
|
|
82
89
|
changePassword(email: string, password: string, oldPassword: string): any | null
|
|
83
90
|
forgotPassword(email: string): any | null
|
|
84
|
-
userConfirmation(user: any)
|
|
85
91
|
resetPassword(user: any, password: string): any | null
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
userConfirmation(user: any)
|
|
93
|
+
blockUserById(id: string, reason: string): any | null
|
|
94
|
+
unblockUserById(id: string): any | null
|
|
95
|
+
countQuery(data: any): any | null
|
|
96
|
+
findQuery(data: any): any | null
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface TokenManagement {
|
|
100
|
+
isValidToken(data: any): boolean
|
|
101
|
+
createToken(data: any): any | null
|
|
102
|
+
resetExternalId(id: string): any | null
|
|
103
|
+
updateTokenById(id: string, token: any): any | null
|
|
104
|
+
retrieveTokenById(id: string): any | null
|
|
105
|
+
retrieveTokenByExternalId(id: string): any | null
|
|
106
|
+
blockTokenById(id: string, reason: string): any | null
|
|
107
|
+
unblockTokenById(id: string): any | null
|
|
108
|
+
countQuery(data: any): any | null
|
|
109
|
+
findQuery(data: any): any | null
|
|
110
|
+
removeTokenById(id: string): any | null
|
|
89
111
|
}
|
|
90
112
|
|
|
91
113
|
declare module 'fastify' {
|
|
92
114
|
export interface FastifyRequest {
|
|
93
115
|
user?: AuthenticatedUser
|
|
116
|
+
token?: AuthenticatedToken
|
|
94
117
|
startedAt?: Date
|
|
95
118
|
data(): Data
|
|
96
119
|
parameters(): Data
|
|
@@ -105,6 +128,7 @@ declare module 'fastify' {
|
|
|
105
128
|
|
|
106
129
|
export interface FastifyRequest extends FastifyRequest {
|
|
107
130
|
user?: AuthenticatedUser
|
|
131
|
+
token?: AuthenticatedToken
|
|
108
132
|
startedAt?: Date
|
|
109
133
|
data(): Data
|
|
110
134
|
parameters(): Data
|