File tree 4 files changed +87
-11
lines changed
4 files changed +87
-11
lines changed Original file line number Diff line number Diff line change
1
+ ** /* .d.ts
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " errsole-mysql" ,
3
- "version" : " 1.0.3 " ,
3
+ "version" : " 1.0.0 " ,
4
4
"description" : " MySQL storage plugin for Errsole" ,
5
5
"main" : " lib/index.js" ,
6
+ "types" : " types/index.d.ts" ,
6
7
"scripts" : {
7
- "test" : " jest --coverage" ,
8
- "coveralls" : " jest --coverage && cat ./coverage/lcov.info | coveralls"
8
+ "test" : " echo \" Error: no test specified\" && exit 1"
9
9
},
10
10
"keywords" : [
11
11
" errsole" ,
18
18
"license" : " MIT" ,
19
19
"dependencies" : {
20
20
"bcryptjs" : " ^2.4.3" ,
21
- "mysql2" : " ^3.10.1 " ,
21
+ "mysql2" : " ^2.3.3 " ,
22
22
"node-cron" : " ^3.0.3"
23
23
},
24
24
"files" : [
25
- " lib/index.js"
26
- ],
27
- "devDependencies" : {
28
- "@jest/globals" : " ^29.7.0" ,
29
- "coveralls" : " ^3.1.1" ,
30
- "jest" : " ^29.7.0"
31
- }
25
+ " lib" ,
26
+ " types"
27
+ ]
32
28
}
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "target" : " ES6" ,
4
+ "module" : " commonjs" ,
5
+ "strict" : true ,
6
+ "esModuleInterop" : true ,
7
+ "skipLibCheck" : true ,
8
+ "forceConsistentCasingInFileNames" : true
9
+ },
10
+ "include" : [
11
+ " lib/**/*" ,
12
+ " types/**/*"
13
+ ]
14
+ }
Original file line number Diff line number Diff line change
1
+ declare module 'errsole-mysql' {
2
+ import { PoolOptions } from 'mysql2' ;
3
+
4
+ interface Log {
5
+ id ?: number ;
6
+ hostname : string ;
7
+ pid : number ;
8
+ source : string ;
9
+ timestamp : Date ;
10
+ level : string ;
11
+ message : string ;
12
+ meta ?: string ;
13
+ }
14
+
15
+ interface LogFilter {
16
+ hostname ?: string ;
17
+ pid ?: number ;
18
+ level_json ?: { source : string ; level : string } [ ] ;
19
+ sources ?: string [ ] ;
20
+ levels ?: string [ ] ;
21
+ lt_id ?: number ;
22
+ gt_id ?: number ;
23
+ lte_timestamp ?: Date ;
24
+ gte_timestamp ?: Date ;
25
+ limit ?: number ;
26
+ }
27
+
28
+ interface Config {
29
+ id : number ;
30
+ key : string ;
31
+ value : string ;
32
+ }
33
+
34
+ interface User {
35
+ id : number ;
36
+ name : string ;
37
+ email : string ;
38
+ role : string ;
39
+ }
40
+
41
+ class ErrsoleMySQL {
42
+ constructor ( options : PoolOptions ) ;
43
+
44
+ getConfig ( key : string ) : Promise < { item : Config } > ;
45
+ setConfig ( key : string , value : string ) : Promise < { item : Config } > ;
46
+ deleteConfig ( key : string ) : Promise < { } > ;
47
+
48
+ postLogs ( logEntries : Log [ ] ) : Promise < { } > ;
49
+ getLogs ( filters ?: LogFilter ) : Promise < { items : Log [ ] } > ;
50
+ searchLogs ( searchTerms : string [ ] , filters ?: LogFilter ) : Promise < { items : Log [ ] , filters : LogFilter [ ] } > ;
51
+
52
+ getMeta ( id : number ) : Promise < { item : { id : number ; meta : string } } > ;
53
+
54
+ createUser ( user : { name : string ; email : string ; password : string ; role : string } ) : Promise < { item : User } > ;
55
+ verifyUser ( email : string , password : string ) : Promise < { item : User } > ;
56
+ getUserCount ( ) : Promise < { count : number } > ;
57
+ getAllUsers ( ) : Promise < { items : User [ ] } > ;
58
+ getUserByEmail ( email : string ) : Promise < { item : User } > ;
59
+ updateUserByEmail ( email : string , updates : Partial < User > ) : Promise < { item : User } > ;
60
+ updatePassword ( email : string , currentPassword : string , newPassword : string ) : Promise < { item : User } > ;
61
+ deleteUser ( userId : number ) : Promise < { } > ;
62
+ }
63
+
64
+ export default ErrsoleMySQL ;
65
+ }
You can’t perform that action at this time.
0 commit comments