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

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
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.103](https://gitlab.squiz.net/developer-experience/cmp/compare/v1.2.1-alpha.90...v1.2.1-alpha.103) (2022-08-23)
7
+
8
+ **Note:** Version bump only for package @squiz/db-lib
9
+
10
+
11
+
12
+
13
+
14
+ ## [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)
15
+
16
+ **Note:** Version bump only for package @squiz/db-lib
17
+
18
+
19
+
20
+
21
+
6
22
  ## [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
23
 
8
24
  **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;
package/lib/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from './Migrator';
4
4
  export * from './Repositories';
5
5
  export * from './getConnectionInfo';
6
6
  export * from './PostgresErrorCodes';
7
+ export { Pool } from 'pg';
package/lib/index.js CHANGED
@@ -3626,7 +3626,7 @@ var require_pg_pool = __commonJS({
3626
3626
  pool.emit("error", err, client);
3627
3627
  };
3628
3628
  }
3629
- var Pool2 = class extends EventEmitter {
3629
+ var Pool3 = class extends EventEmitter {
3630
3630
  constructor(options, Client) {
3631
3631
  super();
3632
3632
  this.options = Object.assign({}, options);
@@ -3939,7 +3939,7 @@ var require_pg_pool = __commonJS({
3939
3939
  return this._clients.length;
3940
3940
  }
3941
3941
  };
3942
- module2.exports = Pool2;
3942
+ module2.exports = Pool3;
3943
3943
  }
3944
3944
  });
3945
3945
 
@@ -4395,10 +4395,10 @@ var require_lib2 = __commonJS({
4395
4395
  var Client = require_client();
4396
4396
  var defaults = require_defaults();
4397
4397
  var Connection = require_connection();
4398
- var Pool2 = require_pg_pool();
4398
+ var Pool3 = require_pg_pool();
4399
4399
  var { DatabaseError } = require_dist();
4400
4400
  var poolFactory = (Client2) => {
4401
- return class BoundPool extends Pool2 {
4401
+ return class BoundPool extends Pool3 {
4402
4402
  constructor(options) {
4403
4403
  super(options, Client2);
4404
4404
  }
@@ -30931,6 +30931,7 @@ __export(src_exports, {
30931
30931
  AbstractRepository: () => AbstractRepository,
30932
30932
  ConnectionManager: () => ConnectionManager,
30933
30933
  Migrator: () => Migrator,
30934
+ Pool: () => import_pg2.Pool,
30934
30935
  PostgresErrorCode: () => PostgresErrorCode,
30935
30936
  getConnectionInfo: () => getConnectionInfo
30936
30937
  });
@@ -31512,11 +31513,15 @@ var PostgresErrorCode = /* @__PURE__ */ ((PostgresErrorCode2) => {
31512
31513
  PostgresErrorCode2["INDEX_CORRUPTED"] = "XX002";
31513
31514
  return PostgresErrorCode2;
31514
31515
  })(PostgresErrorCode || {});
31516
+
31517
+ // src/index.ts
31518
+ var import_pg2 = __toESM(require_lib2());
31515
31519
  // Annotate the CommonJS export names for ESM import in node:
31516
31520
  0 && (module.exports = {
31517
31521
  AbstractRepository,
31518
31522
  ConnectionManager,
31519
31523
  Migrator,
31524
+ Pool,
31520
31525
  PostgresErrorCode,
31521
31526
  getConnectionInfo
31522
31527
  });