@squiz/db-lib 1.12.0-alpha.3 → 1.12.0-alpha.32

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.
@@ -0,0 +1,39 @@
1
+ 0 verbose cli /usr/local/bin/node /usr/local/bin/npm
2
+ 1 info using npm@8.19.3
3
+ 2 info using node@v16.19.0
4
+ 3 timing npm:load:whichnode Completed in 0ms
5
+ 4 timing config:load:defaults Completed in 3ms
6
+ 5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
7
+ 6 timing config:load:builtin Completed in 1ms
8
+ 7 timing config:load:cli Completed in 2ms
9
+ 8 timing config:load:env Completed in 2ms
10
+ 9 info found workspace root at /builds/developer-experience/cmp
11
+ 10 timing config:load:file:/builds/developer-experience/cmp/.npmrc Completed in 1ms
12
+ 11 timing config:load:project Completed in 26ms
13
+ 12 timing config:load:file:/root/.npmrc Completed in 1ms
14
+ 13 timing config:load:user Completed in 1ms
15
+ 14 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
16
+ 15 timing config:load:global Completed in 0ms
17
+ 16 timing config:load:validate Completed in 1ms
18
+ 17 timing config:load:credentials Completed in 2ms
19
+ 18 timing config:load:setEnvs Completed in 1ms
20
+ 19 timing config:load Completed in 39ms
21
+ 20 timing npm:load:configload Completed in 40ms
22
+ 21 timing npm:load:mkdirpcache Completed in 1ms
23
+ 22 timing npm:load:mkdirplogs Completed in 1ms
24
+ 23 verbose title npm run compile
25
+ 24 verbose argv "run" "compile" "--"
26
+ 25 timing npm:load:setTitle Completed in 2ms
27
+ 26 timing config:load:flatten Completed in 4ms
28
+ 27 timing npm:load:display Completed in 5ms
29
+ 28 verbose logfile logs-max:10 dir:/builds/developer-experience/cmp/packages/db-lib/.npm/_logs
30
+ 29 verbose logfile /builds/developer-experience/cmp/packages/db-lib/.npm/_logs/2023-02-15T02_28_14_623Z-debug-0.log
31
+ 30 timing npm:load:logFile Completed in 4ms
32
+ 31 timing npm:load:timers Completed in 0ms
33
+ 32 timing npm:load:configScope Completed in 0ms
34
+ 33 timing npm:load Completed in 54ms
35
+ 34 silly logfile done cleaning log files
36
+ 35 timing command:run Completed in 7391ms
37
+ 36 verbose exit 0
38
+ 37 timing npm Completed in 7454ms
39
+ 38 info ok
package/jest.config.ts CHANGED
@@ -1,10 +1,13 @@
1
- import type { Config } from 'jest';
2
-
3
1
  import { config as configFunc } from 'dotenv';
4
- configFunc();
2
+ if ('error' in configFunc()) {
3
+ configFunc({ path: 'test.env' });
4
+ }
5
5
 
6
6
  // Sync object
7
- const config: Config = {
7
+ /**
8
+ * @type {import('jest').Config}
9
+ */
10
+ const config: import('jest').Config = {
8
11
  preset: 'ts-jest',
9
12
  testTimeout: 60_000,
10
13
  testEnvironment: 'node',
@@ -17,39 +17,39 @@ export type PageResult<T> = {
17
17
  };
18
18
  export type SortDirection = 'desc' | 'asc';
19
19
  export declare const DEFAULT_PAGE_SIZE = 20;
20
- export declare abstract class AbstractRepository<T extends object, ObjT extends T> implements Reader<T>, Writer<T> {
20
+ export declare abstract class AbstractRepository<SHAPE extends object, DATA_CLASS extends SHAPE> implements Reader<SHAPE>, Writer<SHAPE> {
21
21
  protected repositories: Repositories;
22
22
  protected pool: Pool;
23
23
  protected classRef: {
24
- new (data?: Record<string, unknown>): ObjT;
24
+ new (data?: Record<string, unknown>): DATA_CLASS;
25
25
  };
26
26
  protected tableName: string;
27
27
  /** object where the key is the model property name amd the value is sql column name */
28
28
  protected modelPropertyToSqlColumn: {
29
- [key in keyof T]: string;
29
+ [key in keyof SHAPE]: string;
30
30
  };
31
31
  /** object where the key is the sql column name and the value is the model property name */
32
32
  protected sqlColumnToModelProperty: {
33
33
  [key: string]: string;
34
34
  };
35
35
  constructor(repositories: Repositories, pool: Pool, tableName: string, mapping: {
36
- [key in keyof T]: string;
36
+ [key in keyof SHAPE]: string;
37
37
  }, classRef: {
38
- new (data?: Record<string, unknown>): ObjT;
38
+ new (data?: Record<string, unknown>): DATA_CLASS;
39
39
  });
40
40
  protected getConnection(): Promise<PoolClient>;
41
- create(value: ObjT, transactionClient?: PoolClient | null): Promise<T>;
42
- update(where: Partial<T>, newValue: Partial<T>, transactionClient?: PoolClient | null): Promise<T[]>;
43
- delete(where: Partial<T>, transactionClient?: PoolClient | null): Promise<number>;
44
- protected createWhereStringFromPartialModel(values: Partial<T>, initialIndex?: number): string;
41
+ create(value: DATA_CLASS, transactionClient?: PoolClient | null): Promise<SHAPE>;
42
+ update(where: Partial<SHAPE>, newValue: Partial<SHAPE>, transactionClient?: PoolClient | null): Promise<SHAPE[]>;
43
+ delete(where: Partial<SHAPE>, transactionClient?: PoolClient | null): Promise<number>;
44
+ protected createWhereStringFromPartialModel(values: Partial<SHAPE>, initialIndex?: number): string;
45
45
  protected executeQueryRaw(query: string, values: any[], transactionClient?: PoolClient | null): Promise<any[]>;
46
- protected executeQuery(query: string, values: any[], transactionClient?: PoolClient | null): Promise<T[]>;
47
- protected createAndHydrateModel(row: any): T;
48
- findOne(item: Partial<T>): Promise<T | undefined>;
49
- find(item: Partial<T>): Promise<T[]>;
50
- 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>>;
46
+ protected executeQuery(query: string, values: any[], transactionClient?: PoolClient | null): Promise<SHAPE[]>;
47
+ protected createAndHydrateModel(row: any): SHAPE;
48
+ findOne(item: Partial<SHAPE>): Promise<SHAPE | undefined>;
49
+ find(item: Partial<SHAPE>): Promise<SHAPE[]>;
50
+ findAll(): Promise<SHAPE[]>;
51
+ getCount(item?: Partial<SHAPE> | null): Promise<number>;
52
+ getPage(pageNumber: number, sortBy?: (keyof SHAPE)[], direction?: SortDirection, pageSize?: number | null, item?: Partial<SHAPE> | null): Promise<PageResult<SHAPE>>;
53
53
  getCountRaw(whereClause?: string, values?: any[], tableRef?: string): Promise<number>;
54
- getPageRaw(pageNumber: number, sortBy?: (keyof T)[], direction?: SortDirection, whereClause?: string, tableRef?: string, values?: any[], pageSize?: number | null): Promise<PageResult<T>>;
54
+ getPageRaw(pageNumber: number, sortBy?: (keyof SHAPE)[], direction?: SortDirection, whereClause?: string, tableRef?: string, values?: any[], pageSize?: number | null): Promise<PageResult<SHAPE>>;
55
55
  }
@@ -0,0 +1 @@
1
+ export {};