onecore 0.6.7 → 0.6.9

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 CHANGED
@@ -1973,49 +1973,15 @@ interface Logger {
1973
1973
  name: Name;
1974
1974
  level: number;
1975
1975
  map: LogMap;
1976
- constants?: SimpleMap;
1977
-
1978
- trace(
1979
- msg: string,
1980
- m?: SimpleMap,
1981
- ctx?: any
1982
- ): void;
1983
-
1984
- debug(
1985
- msg: string,
1986
- m?: SimpleMap,
1987
- ctx?: any
1988
- ): void;
1989
-
1990
- info(
1991
- msg: string,
1992
- m?: SimpleMap,
1993
- ctx?: any
1994
- ): void;
1995
-
1996
- warn(
1997
- msg: string,
1998
- m?: SimpleMap,
1999
- ctx?: any
2000
- ): void;
2001
-
2002
- error(
2003
- msg: string,
2004
- m?: SimpleMap,
2005
- ctx?: any
2006
- ): void;
2007
-
2008
- panic(
2009
- msg: string,
2010
- m?: SimpleMap,
2011
- ctx?: any
2012
- ): void;
2013
-
2014
- fatal(
2015
- msg: string,
2016
- m?: SimpleMap,
2017
- ctx?: any
2018
- ): void;
1976
+ constants?: Context;
1977
+
1978
+ trace(msg: string, context?: Context, ctx?: any): void;
1979
+ debug(msg: string, context?: Context, ctx?: any): void;
1980
+ info(msg: string, context?: Context, ctx?: any): void;
1981
+ warn(msg: string, context?: Context, ctx?: any): void;
1982
+ error(msg: string, context?: Context, ctx?: any): void;
1983
+ panic(msg: string, context?: Context, ctx?: any): void;
1984
+ fatal(msg: string, context?: Context, ctx?: any): void;
2019
1985
 
2020
1986
  isLevelEnabled(level: number): boolean;
2021
1987
  isTraceEnabled(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onecore",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "onecore",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/db.ts CHANGED
@@ -20,6 +20,9 @@ export interface Executor {
20
20
  execute(sql: string, args?: any[]): Promise<number>
21
21
  executeBatch(statements: Statement[], requireFirstAffected?: boolean): Promise<number>
22
22
  query<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[]): Promise<T[]>
23
+ queryOne<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[]): Promise<T | null>
24
+ executeScalar<T>(sql: string, args?: any[]): Promise<T | null>
25
+ count(sql: string, args?: any[]): Promise<number>
23
26
  }
24
27
  export interface Transaction extends Executor {
25
28
  commit(): Promise<void>
package/src/job.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DateRange, Filter, SearchResult, TimeRange } from "./model";
1
+ import { DateRange, Filter, TimeRange } from "./model";
2
2
 
3
3
  export interface Attachment {
4
4
  originalFilename: string;
@@ -7,37 +7,6 @@ export interface Attachment {
7
7
  size: number;
8
8
  }
9
9
 
10
- export interface Article {
11
- id: string
12
- slug: string
13
- title: string
14
- description?: string
15
- publishedAt?: Date
16
- tags?: string[]
17
- thumbnail?: string
18
- status?: string
19
- createdAt?: Date
20
- authorId?: string
21
- savedAt?: Date
22
- }
23
- export interface ArticleFilter extends Filter {
24
- id?: string
25
- slug?: string
26
- title?: string
27
- description?: string
28
- status?: string
29
- publishedAt: TimeRange
30
- tags?: string[]
31
- authorId?: string
32
- userId?: string
33
- isSaved?: boolean
34
- }
35
- export interface ArticleRepository {
36
- search(filter: ArticleFilter, limit: number, page?: number, fields?: string[]): Promise<SearchResult<Article>>
37
- load(slug: string, userId?: string): Promise<Article | null>
38
- getIdBySlug(slug: string): Promise<string>
39
- }
40
-
41
10
  export interface Achievement {
42
11
  subject: string;
43
12
  description: string;
@@ -46,17 +15,7 @@ export interface Skill {
46
15
  skill: string;
47
16
  hirable: boolean;
48
17
  }
49
- export interface UserFilter extends Filter {
50
- userId?: string;
51
- username?: string;
52
- email?: string;
53
- displayName?: string;
54
- dateOfBirth?: DateRange;
55
- status?: string[]|string;
56
- interests?: string[];
57
- skills?: Skill[];
58
- achievements?: Achievement[];
59
- }
18
+
60
19
  export interface RoleFilter extends Filter {
61
20
  roleId?: string;
62
21
  roleName?: string;
@@ -91,35 +50,50 @@ export interface ReviewCommentFilter extends Filter {
91
50
  time?: DateRange;
92
51
  updatedAt?: DateRange;
93
52
  }
94
- export interface Info {
95
- id: string;
96
- rate: number;
97
- rate1: number;
98
- rate2: number;
99
- rate3: number;
100
- rate4: number;
101
- rate5: number;
102
- count: number;
103
- score: number;
53
+
54
+ export interface Rate {
55
+ rate: number
56
+ rate1: number
57
+ rate2: number
58
+ rate3: number
59
+ rate4: number
60
+ rate5: number
104
61
  }
105
- export interface Info10 {
106
- id: string;
107
- rate: number;
108
- rate1: number;
109
- rate2: number;
110
- rate3: number;
111
- rate4: number;
112
- rate5: number;
113
- rate6: number;
114
- rate7: number;
115
- rate8: number;
116
- rate9: number;
117
- rate10: number;
118
- count: number;
119
- score: number;
62
+
63
+ export interface Article {
64
+ id: string
65
+ slug: string
66
+ title: string
67
+ description?: string
68
+ publishedAt?: Date
69
+ tags?: string[]
70
+ thumbnail?: string
71
+ status?: string
72
+ createdAt?: Date
73
+ authorId?: string
74
+ savedAt?: Date
120
75
  }
121
- export interface InfoRepository<ID> {
122
- exist(id: ID, ctx?: any): Promise<boolean>;
76
+
77
+ export interface User {
78
+ id: string
79
+ username: string
80
+ email?: string
81
+ phone?: string
82
+ dateOfBirth?: Date
83
+ displayName?: string
84
+ status?: string
85
+ imageURL?: string
86
+ coverURL?: string
87
+ headline?: string
88
+ bio?: string
89
+ website?: string
90
+ occupation?: string
91
+ company?: string
92
+ location?: string
93
+
94
+ followedAt?: Date
95
+ followerCount?: number
96
+ followingCount?: number
123
97
  }
124
98
 
125
99
  export interface Company {
@@ -153,8 +127,11 @@ export interface Job {
153
127
  skills?: string[]
154
128
  minSalary?: number
155
129
  maxSalary?: number
156
- companyId?: string
157
130
  status: string
131
+ companyId?: string
132
+ companyName?: string
133
+ logo?: string
134
+ savedAt?: Date
158
135
  }
159
136
  export interface JobFilter extends Filter {
160
137
  id?: string
@@ -169,4 +146,6 @@ export interface JobFilter extends Filter {
169
146
  applicantCount?: number
170
147
  companyId?: string
171
148
  status?: string
149
+ userId?: string
150
+ isSaved?: boolean
172
151
  }
package/src/logger.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export interface NumberMap {
2
2
  [key: string]: number;
3
3
  }
4
- export interface SimpleMap {
4
+ export interface Context {
5
5
  [key: string]: string | number | boolean | Date;
6
6
  }
7
7
  export interface LogMap {
@@ -17,7 +17,7 @@ export interface LogMapConfig {
17
17
  export interface Config {
18
18
  level?: string;
19
19
  map?: LogMapConfig;
20
- constants?: SimpleMap;
20
+ constants?: Context;
21
21
  name?: Name;
22
22
  }
23
23
  export type LogConf = Config;
@@ -37,14 +37,14 @@ export interface Logger {
37
37
  name: Name;
38
38
  level: number;
39
39
  map: LogMap;
40
- constants?: SimpleMap;
41
- trace(msg: string, m?: SimpleMap, ctx?: any): void;
42
- debug(msg: string, m?: SimpleMap, ctx?: any): void;
43
- info(msg: string, m?: SimpleMap, ctx?: any): void;
44
- warn(msg: string, m?: SimpleMap, ctx?: any): void;
45
- error(msg: string, m?: SimpleMap, ctx?: any): void;
46
- panic(msg: string, m?: SimpleMap, ctx?: any): void;
47
- fatal(msg: string, m?: SimpleMap, ctx?: any): void;
40
+ constants?: Context;
41
+ trace(msg: string, context?: Context, ctx?: any): void;
42
+ debug(msg: string, context?: Context, ctx?: any): void;
43
+ info(msg: string, context?: Context, ctx?: any): void;
44
+ warn(msg: string, context?: Context, ctx?: any): void;
45
+ error(msg: string, context?: Context, ctx?: any): void;
46
+ panic(msg: string, context?: Context, ctx?: any): void;
47
+ fatal(msg: string, context?: Context, ctx?: any): void;
48
48
  isLevelEnabled(level: number): boolean;
49
49
  isTraceEnabled(): boolean;
50
50
  isDebugEnabled(): boolean;
package/src/metadata.ts CHANGED
@@ -37,6 +37,8 @@ export interface Attribute {
37
37
  createdAt?: boolean;
38
38
  updatedAt?: boolean;
39
39
  length?: number;
40
+ eq?: number | Date | string;
41
+ ne?: number | Date | string;
40
42
  min?: number | Date | string;
41
43
  max?: number | Date | string;
42
44
  gt?: number | Date | string;