File tree Expand file tree Collapse file tree 4 files changed +83
-1
lines changed Expand file tree Collapse file tree 4 files changed +83
-1
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 33 "version" : " 1.0.1" ,
44 "description" : " postgreSQL storage plugin for Errsole" ,
55 "main" : " lib/index.js" ,
6+ "types" : " types/index.d.ts" ,
67 "scripts" : {
78 "test" : " jest --coverage" ,
89 "coveralls" : " jest --coverage && cat ./coverage/lcov.info | coveralls"
2425 "pg" : " ^8.12.0"
2526 },
2627 "files" : [
27- " lib/index.js"
28+ " lib" ,
29+ " types"
2830 ],
2931 "devDependencies" : {
3032 "@jest/globals" : " ^29.7.0" ,
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-postgres' {
2+ import { PoolConfig } from 'pg' ;
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 ErrsolePostgres {
42+ constructor ( options : PoolConfig ) ;
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 ErrsolePostgres ;
65+ }
You can’t perform that action at this time.
0 commit comments