@squiz/db-lib 1.40.1-alpha.25 → 1.40.1-alpha.26
Sign up to get free protection for your applications and to get access to all the features.
- package/.npm/_logs/{2023-07-25T03_13_14_947Z-debug-0.log → 2023-07-25T03_32_47_960Z-debug-0.log} +15 -15
- package/lib/AbstractRepository.d.ts +2 -2
- package/lib/index.js +3 -2
- package/lib/index.js.map +2 -2
- package/package.json +4 -4
- package/src/AbstractRepository.ts +3 -6
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@squiz/db-lib",
|
3
|
-
"version": "1.40.1-alpha.
|
3
|
+
"version": "1.40.1-alpha.26",
|
4
4
|
"description": "",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"scripts": {
|
@@ -27,10 +27,10 @@
|
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
29
|
"@aws-sdk/client-secrets-manager": "3.264.0",
|
30
|
-
"@squiz/dx-common-lib": "1.40.1-alpha.
|
31
|
-
"@squiz/dx-logger-lib": "1.40.1-alpha.
|
30
|
+
"@squiz/dx-common-lib": "1.40.1-alpha.26",
|
31
|
+
"@squiz/dx-logger-lib": "1.40.1-alpha.26",
|
32
32
|
"dotenv": "16.0.3",
|
33
33
|
"pg": "8.9.0"
|
34
34
|
},
|
35
|
-
"gitHead": "
|
35
|
+
"gitHead": "87300286a2c55fff6e1d30300c1745a495901733"
|
36
36
|
}
|
@@ -152,11 +152,7 @@ export abstract class AbstractRepository<SHAPE extends object, DATA_CLASS extend
|
|
152
152
|
}
|
153
153
|
}
|
154
154
|
|
155
|
-
|
156
|
-
query: string,
|
157
|
-
values: any[],
|
158
|
-
transactionClient: PoolClient | null = null,
|
159
|
-
): Promise<SHAPE[]> {
|
155
|
+
async executeQuery(query: string, values: any[], transactionClient: PoolClient | null = null): Promise<SHAPE[]> {
|
160
156
|
const rows = await this.executeQueryRaw(query, values, transactionClient);
|
161
157
|
return rows.map((a) => this.createAndHydrateModel(a));
|
162
158
|
}
|
@@ -172,13 +168,14 @@ export abstract class AbstractRepository<SHAPE extends object, DATA_CLASS extend
|
|
172
168
|
return new this.classRef(inputData);
|
173
169
|
}
|
174
170
|
|
175
|
-
async findOne(item: Partial<SHAPE
|
171
|
+
async findOne(item: Partial<SHAPE>, transactionClient?: PoolClient): Promise<SHAPE | undefined> {
|
176
172
|
const result = await this.executeQuery(
|
177
173
|
`SELECT *
|
178
174
|
FROM ${this.tableName}
|
179
175
|
WHERE ${this.createWhereStringFromPartialModel(item)}
|
180
176
|
LIMIT 1`,
|
181
177
|
Object.values(item),
|
178
|
+
transactionClient,
|
182
179
|
);
|
183
180
|
|
184
181
|
return result[0];
|