@squiz/db-lib 1.2.1-alpha.107 → 1.2.1-alpha.87

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -3,134 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.2.1-alpha.107](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.107) (2022-09-21)
7
-
8
- **Note:** Version bump only for package @squiz/db-lib
9
-
10
-
11
-
12
-
13
-
14
- ## [1.2.1-alpha.106](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.106) (2022-09-02)
15
-
16
- **Note:** Version bump only for package @squiz/db-lib
17
-
18
-
19
-
20
-
21
-
22
- ## [1.2.1-alpha.105](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.105) (2022-08-26)
23
-
24
- **Note:** Version bump only for package @squiz/db-lib
25
-
26
-
27
-
28
-
29
-
30
- ## [1.2.1-alpha.104](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.104) (2022-08-23)
31
-
32
- **Note:** Version bump only for package @squiz/db-lib
33
-
34
-
35
-
36
-
37
-
38
- ## [1.2.1-alpha.103](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.103) (2022-08-23)
39
-
40
- **Note:** Version bump only for package @squiz/db-lib
41
-
42
-
43
-
44
-
45
-
46
- ## [1.2.1-alpha.102](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.102) (2022-08-23)
47
-
48
- **Note:** Version bump only for package @squiz/db-lib
49
-
50
-
51
-
52
-
53
-
54
- ## [1.2.1-alpha.101](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.101) (2022-08-19)
55
-
56
- **Note:** Version bump only for package @squiz/db-lib
57
-
58
-
59
-
60
-
61
-
62
- ## [1.2.1-alpha.100](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.100) (2022-08-18)
63
-
64
- **Note:** Version bump only for package @squiz/db-lib
65
-
66
-
67
-
68
-
69
-
70
- ## [1.2.1-alpha.99](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.99) (2022-08-18)
71
-
72
- **Note:** Version bump only for package @squiz/db-lib
73
-
74
-
75
-
76
-
77
-
78
- ## [1.2.1-alpha.98](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.98) (2022-08-17)
79
-
80
- **Note:** Version bump only for package @squiz/db-lib
81
-
82
-
83
-
84
-
85
-
86
- ## [1.2.1-alpha.97](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.97) (2022-08-17)
87
-
88
- **Note:** Version bump only for package @squiz/db-lib
89
-
90
-
91
-
92
-
93
-
94
- ## [1.2.1-alpha.96](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.96) (2022-08-12)
95
-
96
- **Note:** Version bump only for package @squiz/db-lib
97
-
98
-
99
-
100
-
101
-
102
- ## [1.2.1-alpha.95](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.95) (2022-08-10)
103
-
104
- **Note:** Version bump only for package @squiz/db-lib
105
-
106
-
107
-
108
-
109
-
110
- ## [1.2.1-alpha.90](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.89...v1.2.1-alpha.90) (2022-08-05)
111
-
112
- **Note:** Version bump only for package @squiz/db-lib
113
-
114
-
115
-
116
-
117
-
118
- ## [1.2.1-alpha.89](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.88...v1.2.1-alpha.89) (2022-08-05)
119
-
120
- **Note:** Version bump only for package @squiz/db-lib
121
-
122
-
123
-
124
-
125
-
126
- ## [1.2.1-alpha.88](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.67...v1.2.1-alpha.88) (2022-08-05)
127
-
128
- **Note:** Version bump only for package @squiz/db-lib
129
-
130
-
131
-
132
-
133
-
134
6
  ## [1.2.1-alpha.87](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.67...v1.2.1-alpha.87) (2022-08-05)
135
7
 
136
8
  **Note:** Version bump only for package @squiz/db-lib
@@ -10,44 +10,32 @@ export interface Writer<T> {
10
10
  delete(where: Partial<T>): Promise<number>;
11
11
  }
12
12
  export declare type Repository<T> = Reader<T> & Writer<T>;
13
- export declare type PageResult<T> = {
14
- items: T[];
15
- totalCount: number;
16
- pageSize: number;
17
- };
18
- export declare type SortDirection = 'desc' | 'asc';
19
- export declare const DEFAULT_PAGE_SIZE = 20;
20
- export declare abstract class AbstractRepository<T, ObjT extends T> implements Reader<T>, Writer<T> {
13
+ export declare abstract class AbstractRepository<T> implements Reader<T>, Writer<T> {
21
14
  protected repositories: Repositories;
22
15
  protected pool: Pool;
23
16
  protected classRef: {
24
- new (data?: Record<string, unknown>): ObjT;
17
+ new (): T;
25
18
  };
26
19
  protected tableName: string;
27
- /** object where the key is the model property name amd the value is sql column name */
28
20
  protected modelPropertyToSqlColumn: {
29
21
  [key in keyof T]: string;
30
22
  };
31
- /** object where the key is the sql column name and the value is the model property name */
32
23
  protected sqlColumnToModelProperty: {
33
- [key: string]: string;
24
+ [key: string]: keyof T;
34
25
  };
35
26
  constructor(repositories: Repositories, pool: Pool, tableName: string, mapping: {
36
27
  [key in keyof T]: string;
37
28
  }, classRef: {
38
- new (data?: Record<string, unknown>): ObjT;
29
+ new (): T;
39
30
  });
40
31
  protected getConnection(): Promise<PoolClient>;
41
- create(value: ObjT, transactionClient?: PoolClient | null): Promise<T>;
32
+ create(value: Partial<T>, transactionClient?: PoolClient | null): Promise<T>;
42
33
  update(where: Partial<T>, newValue: Partial<T>, transactionClient?: PoolClient | null): Promise<T[]>;
43
34
  delete(where: Partial<T>, transactionClient?: PoolClient | null): Promise<number>;
44
35
  protected createWhereStringFromPartialModel(values: Partial<T>, initialIndex?: number): string;
45
- protected executeQueryRaw(query: string, values: any[], transactionClient?: PoolClient | null): Promise<any[]>;
46
36
  protected executeQuery(query: string, values: any[], transactionClient?: PoolClient | null): Promise<T[]>;
47
37
  protected createAndHydrateModel(row: any): T;
48
38
  findOne(item: Partial<T>): Promise<T | undefined>;
49
39
  find(item: Partial<T>): Promise<T[]>;
50
40
  findAll(): Promise<T[]>;
51
- getCount(item?: Partial<T> | null): Promise<number>;
52
- getPage(pageNumber: number, sortBy?: (keyof T)[], direction?: SortDirection, pageSize?: number | null, item?: Partial<T> | null): Promise<PageResult<T>>;
53
41
  }
package/lib/index.d.ts CHANGED
@@ -3,5 +3,3 @@ export * from './ConnectionManager';
3
3
  export * from './Migrator';
4
4
  export * from './Repositories';
5
5
  export * from './getConnectionInfo';
6
- export * from './PostgresErrorCodes';
7
- export { Pool } from 'pg';