@runnerpro/backend 1.6.15 → 1.6.16

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.
@@ -26,24 +26,30 @@ exports.pool = pool;
26
26
  const query = (queryText, values = []) => __awaiter(void 0, void 0, void 0, function* () {
27
27
  const client = yield pool.connect();
28
28
  const text = getParseQuery(queryText, values);
29
- const result = yield client.query({
30
- // @ts-ignore
31
- rowMode: 'json',
32
- text,
33
- // @ts-ignore
34
- values: values.flat(),
35
- });
36
- client.release();
37
- // @ts-ignore
38
- return (result.rows || []).map((row) => {
39
- const json = Object.keys(row);
40
- const aux = {};
41
- json.forEach((key) => {
29
+ try {
30
+ const result = yield client.query({
42
31
  // @ts-ignore
43
- aux[camelize(key)] = row[key];
32
+ rowMode: 'json',
33
+ text,
34
+ // @ts-ignore
35
+ values: values.flat(),
44
36
  });
45
- return aux;
46
- });
37
+ client.release();
38
+ // @ts-ignore
39
+ return (result.rows || []).map((row) => {
40
+ const json = Object.keys(row);
41
+ const aux = {};
42
+ json.forEach((key) => {
43
+ // @ts-ignore
44
+ aux[camelize(key)] = row[key];
45
+ });
46
+ return aux;
47
+ });
48
+ }
49
+ catch (error) {
50
+ client.release();
51
+ return [];
52
+ }
47
53
  });
48
54
  exports.query = query;
49
55
  const toPgArray = (arr) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,IAAI,CAAC;AAI5B,QAAA,MAAM,IAAI,iBAMR,CAAC;AAEH,QAAA,MAAM,KAAK,cAAqB,MAAM,WAAU,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,iBAsB5E,CAAC;AAEF,QAAA,MAAM,SAAS,QAAS,MAAM,EAAE,WAM/B,CAAC;AA+BF,QAAA,MAAM,UAAU,YAAmB,GAAG,mCAUrC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,IAAI,CAAC;AAI5B,QAAA,MAAM,IAAI,iBAMR,CAAC;AAEH,QAAA,MAAM,KAAK,cAAqB,MAAM,WAAU,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,iBA4B5E,CAAC;AAEF,QAAA,MAAM,SAAS,QAAS,MAAM,EAAE,WAM/B,CAAC;AA+BF,QAAA,MAAM,UAAU,YAAmB,GAAG,mCAUrC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.6.15",
3
+ "version": "1.6.16",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"