@squiz/db-lib 1.2.1-alpha.101 → 1.2.1-alpha.102

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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.102](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.102) (2022-08-23)
7
+
8
+ **Note:** Version bump only for package @squiz/db-lib
9
+
10
+
11
+
12
+
13
+
6
14
  ## [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)
7
15
 
8
16
  **Note:** Version bump only for package @squiz/db-lib
@@ -10,11 +10,11 @@ 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 abstract class AbstractRepository<T> implements Reader<T>, Writer<T> {
13
+ export declare abstract class AbstractRepository<T, ObjT extends T> implements Reader<T>, Writer<T> {
14
14
  protected repositories: Repositories;
15
15
  protected pool: Pool;
16
16
  protected classRef: {
17
- new (data?: Record<string, unknown>): T;
17
+ new (data?: Record<string, unknown>): ObjT;
18
18
  };
19
19
  protected tableName: string;
20
20
  /** object where the key is the model property name amd the value is sql column name */
@@ -28,10 +28,10 @@ export declare abstract class AbstractRepository<T> implements Reader<T>, Writer
28
28
  constructor(repositories: Repositories, pool: Pool, tableName: string, mapping: {
29
29
  [key in keyof T]: string;
30
30
  }, classRef: {
31
- new (data?: Record<string, unknown>): T;
31
+ new (data?: Record<string, unknown>): ObjT;
32
32
  });
33
33
  protected getConnection(): Promise<PoolClient>;
34
- create(value: Partial<T>, transactionClient?: PoolClient | null): Promise<T>;
34
+ create(value: ObjT, transactionClient?: PoolClient | null): Promise<T>;
35
35
  update(where: Partial<T>, newValue: Partial<T>, transactionClient?: PoolClient | null): Promise<T[]>;
36
36
  delete(where: Partial<T>, transactionClient?: PoolClient | null): Promise<number>;
37
37
  protected createWhereStringFromPartialModel(values: Partial<T>, initialIndex?: number): string;