@nsshunt/stsdatamanagement 1.18.178 → 1.18.179
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.
- package/dist/cliworker.js +10 -17
- package/dist/cliworker.js.map +1 -1
- package/dist/commonTypes.js +11 -14
- package/dist/commonTypes.js.map +1 -1
- package/dist/dalUserManager.js +7 -11
- package/dist/dalUserManager.js.map +1 -1
- package/dist/dalUserManager.test.js +45 -51
- package/dist/dalUserManager.test.js.map +1 -1
- package/dist/databaseutils.js +19 -26
- package/dist/databaseutils.js.map +1 -1
- package/dist/datagenerator.js +26 -33
- package/dist/datagenerator.js.map +1 -1
- package/dist/dbAccessLayerManager.js +5 -9
- package/dist/dbAccessLayerManager.js.map +1 -1
- package/dist/dbaccess.js +7 -23
- package/dist/dbaccess.js.map +1 -1
- package/dist/dbbuild.test.js +42 -47
- package/dist/dbbuild.test.js.map +1 -1
- package/dist/dberrors.js +13 -22
- package/dist/dberrors.js.map +1 -1
- package/dist/pcaccesslayer-entity.test.js +166 -171
- package/dist/pcaccesslayer-entity.test.js.map +1 -1
- package/dist/pcaccesslayer.test.js +208 -213
- package/dist/pcaccesslayer.test.js.map +1 -1
- package/dist/pgaccesslayer-old.js +114 -154
- package/dist/pgaccesslayer-old.js.map +1 -1
- package/dist/pgaccesslayer.js +131 -135
- package/dist/pgaccesslayer.js.map +1 -1
- package/dist/pgpoolmanager.js +32 -39
- package/dist/pgpoolmanager.js.map +1 -1
- package/dist/pgutils.js +10 -14
- package/dist/pgutils.js.map +1 -1
- package/dist/setupdb.js +8 -14
- package/dist/setupdb.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,67 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.PGAccessLayer = void 0;
|
|
40
1
|
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const copyFrom =
|
|
47
|
-
|
|
48
|
-
|
|
2
|
+
import { StatusCodes } from 'http-status-codes';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { Redis } from "ioredis";
|
|
5
|
+
import { goptions } from '@nsshunt/stsconfig';
|
|
6
|
+
import pgcopystreams from 'pg-copy-streams';
|
|
7
|
+
const copyFrom = pgcopystreams.from;
|
|
8
|
+
import * as streamex from 'node:stream';
|
|
9
|
+
import * as fs from 'node:fs/promises';
|
|
49
10
|
const defaultConfigId = 'defaultconfig';
|
|
50
11
|
const systemUserId = 'SystemUserID';
|
|
51
|
-
class PGAccessLayer {
|
|
12
|
+
export class PGAccessLayer {
|
|
52
13
|
#options;
|
|
53
14
|
#ioredisCache = null;
|
|
54
15
|
#poolManager = null;
|
|
55
16
|
constructor(options) {
|
|
56
17
|
this.#options = options;
|
|
57
|
-
const { useRedisDatabaseCache, redisDatabaseCacheUrl } =
|
|
18
|
+
const { useRedisDatabaseCache, redisDatabaseCacheUrl } = goptions;
|
|
58
19
|
this.#poolManager = this.#options.poolManager;
|
|
59
20
|
if (useRedisDatabaseCache === true) {
|
|
60
21
|
const redisOptions = {
|
|
61
22
|
showFriendlyErrorStack: true,
|
|
62
23
|
maxRetriesPerRequest: 20
|
|
63
24
|
};
|
|
64
|
-
this.#ioredisCache = new
|
|
25
|
+
this.#ioredisCache = new Redis(redisDatabaseCacheUrl, redisOptions);
|
|
65
26
|
}
|
|
66
27
|
}
|
|
67
28
|
#LogErrorMessage(message) {
|
|
@@ -155,7 +116,7 @@ class PGAccessLayer {
|
|
|
155
116
|
}
|
|
156
117
|
async saveResource(userid, resid, data) {
|
|
157
118
|
const retVal = await this.getLatestResource(resid, false);
|
|
158
|
-
if (retVal.status !==
|
|
119
|
+
if (retVal.status !== StatusCodes.OK) {
|
|
159
120
|
return await this.createResource(userid, resid, data);
|
|
160
121
|
}
|
|
161
122
|
else {
|
|
@@ -165,7 +126,7 @@ class PGAccessLayer {
|
|
|
165
126
|
}
|
|
166
127
|
async saveResourceEx(userid, resid, data) {
|
|
167
128
|
const retVal = await this.getLatestResourceEx(resid);
|
|
168
|
-
if (retVal.status !==
|
|
129
|
+
if (retVal.status !== StatusCodes.OK) {
|
|
169
130
|
return await this.createResource(userid, resid, JSON.stringify(data));
|
|
170
131
|
}
|
|
171
132
|
else {
|
|
@@ -190,10 +151,10 @@ class PGAccessLayer {
|
|
|
190
151
|
try {
|
|
191
152
|
const { rows } = await client.query(createQuery);
|
|
192
153
|
const dbResponse = rows[0];
|
|
193
|
-
return { status:
|
|
154
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
194
155
|
}
|
|
195
156
|
catch (error) {
|
|
196
|
-
return { status:
|
|
157
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
197
158
|
}
|
|
198
159
|
finally {
|
|
199
160
|
client.release();
|
|
@@ -202,7 +163,7 @@ class PGAccessLayer {
|
|
|
202
163
|
catch (error) {
|
|
203
164
|
// Error getting the client connection from the pool
|
|
204
165
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
205
|
-
return { status:
|
|
166
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
206
167
|
}
|
|
207
168
|
}
|
|
208
169
|
async createResource(userid, resourceid, payload) {
|
|
@@ -221,15 +182,15 @@ class PGAccessLayer {
|
|
|
221
182
|
const { rows } = await client.query(createQuery, values);
|
|
222
183
|
const dbResponse = rows[0];
|
|
223
184
|
await client.query('COMMIT');
|
|
224
|
-
return { status:
|
|
185
|
+
return { status: StatusCodes.CREATED, detail: dbResponse };
|
|
225
186
|
}
|
|
226
187
|
catch (error) {
|
|
227
188
|
await client.query('ROLLBACK');
|
|
228
|
-
let err = { status:
|
|
189
|
+
let err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
229
190
|
if (error.code === '23505') {
|
|
230
|
-
err = { status:
|
|
191
|
+
err = { status: StatusCodes.CONFLICT, error: `[${fname}: resourceid [${resourceid}] already exists`, detail: error };
|
|
231
192
|
}
|
|
232
|
-
this.#LogDebugMessage(
|
|
193
|
+
this.#LogDebugMessage(chalk.red(`Error: ${JSON.stringify(error)}`));
|
|
233
194
|
return err;
|
|
234
195
|
}
|
|
235
196
|
finally {
|
|
@@ -239,7 +200,7 @@ class PGAccessLayer {
|
|
|
239
200
|
catch (error) {
|
|
240
201
|
// Error getting the client connection from the pool
|
|
241
202
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
242
|
-
return { status:
|
|
203
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
243
204
|
}
|
|
244
205
|
}
|
|
245
206
|
async beginX(readOnly) {
|
|
@@ -258,7 +219,7 @@ class PGAccessLayer {
|
|
|
258
219
|
catch (error) {
|
|
259
220
|
// Error getting the client connection from the pool
|
|
260
221
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
261
|
-
return { status:
|
|
222
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
262
223
|
}
|
|
263
224
|
}
|
|
264
225
|
async commitX(client) {
|
|
@@ -270,7 +231,7 @@ class PGAccessLayer {
|
|
|
270
231
|
catch (error) {
|
|
271
232
|
// Error getting the client connection from the pool
|
|
272
233
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
273
|
-
return { status:
|
|
234
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
274
235
|
}
|
|
275
236
|
}
|
|
276
237
|
async rollbackX(client) {
|
|
@@ -282,7 +243,7 @@ class PGAccessLayer {
|
|
|
282
243
|
catch (error) {
|
|
283
244
|
// Error getting the client connection from the pool
|
|
284
245
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
285
|
-
return { status:
|
|
246
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
286
247
|
}
|
|
287
248
|
}
|
|
288
249
|
async updateResource(userid, resourceid, resourcevnum, payload) {
|
|
@@ -306,15 +267,15 @@ class PGAccessLayer {
|
|
|
306
267
|
if (this.#ioredisCache !== null) {
|
|
307
268
|
await this.#ioredisCache.del(resourceid);
|
|
308
269
|
}
|
|
309
|
-
return { status:
|
|
270
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
310
271
|
}
|
|
311
272
|
catch (error) {
|
|
312
273
|
await client.query('ROLLBACK');
|
|
313
|
-
let err = { status:
|
|
274
|
+
let err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
314
275
|
if (error.code === 'P0002') {
|
|
315
|
-
err = { status:
|
|
276
|
+
err = { status: StatusCodes.NOT_FOUND, error: `[${fname}: resourceid [${resourceid}] and version [${resourcevnum}] not found or not current`, detail: error };
|
|
316
277
|
}
|
|
317
|
-
this.#LogDebugMessage(
|
|
278
|
+
this.#LogDebugMessage(chalk.red(`updateResource(): Error: [${JSON.stringify(err)}]`));
|
|
318
279
|
return err;
|
|
319
280
|
}
|
|
320
281
|
finally {
|
|
@@ -324,13 +285,13 @@ class PGAccessLayer {
|
|
|
324
285
|
catch (error) {
|
|
325
286
|
// Error getting the client connection from the pool
|
|
326
287
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
327
|
-
return { status:
|
|
288
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
328
289
|
}
|
|
329
290
|
}
|
|
330
291
|
async deleteLatestResource(userid, resid) {
|
|
331
292
|
const fname = 'deleteLatestResource';
|
|
332
293
|
const retVal = await this.getLatestResource(resid, false);
|
|
333
|
-
if (retVal.status !==
|
|
294
|
+
if (retVal.status !== StatusCodes.OK) {
|
|
334
295
|
return { status: retVal.status, error: `[${fname}]: Operation was not successful: [${resid}]`, detail: retVal };
|
|
335
296
|
}
|
|
336
297
|
else {
|
|
@@ -358,15 +319,15 @@ class PGAccessLayer {
|
|
|
358
319
|
if (this.#ioredisCache !== null) {
|
|
359
320
|
await this.#ioredisCache.del(resourceid);
|
|
360
321
|
}
|
|
361
|
-
return { status:
|
|
322
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
362
323
|
}
|
|
363
324
|
catch (error) {
|
|
364
325
|
await client.query('ROLLBACK');
|
|
365
|
-
let err = { status:
|
|
326
|
+
let err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
366
327
|
if (error.code === 'P0002') {
|
|
367
|
-
err = { status:
|
|
328
|
+
err = { status: StatusCodes.NOT_FOUND, error: `[${fname}: resourceid [${resourceid}] and version [${resourcevnum}] not found or not current`, detail: error };
|
|
368
329
|
}
|
|
369
|
-
this.#LogDebugMessage(
|
|
330
|
+
this.#LogDebugMessage(chalk.red(`deleteResource(): Error: [${JSON.stringify(err)}]`));
|
|
370
331
|
return err;
|
|
371
332
|
}
|
|
372
333
|
finally {
|
|
@@ -376,7 +337,7 @@ class PGAccessLayer {
|
|
|
376
337
|
catch (error) {
|
|
377
338
|
// Error getting the client connection from the pool
|
|
378
339
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
379
|
-
return { status:
|
|
340
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
380
341
|
}
|
|
381
342
|
}
|
|
382
343
|
async createEntity(userid, resourceid, resourcevnum, entityid, payload) {
|
|
@@ -396,15 +357,15 @@ class PGAccessLayer {
|
|
|
396
357
|
const { rows } = await client.query(createQuery, values);
|
|
397
358
|
const dbResponse = rows[0];
|
|
398
359
|
await client.query('COMMIT');
|
|
399
|
-
return { status:
|
|
360
|
+
return { status: StatusCodes.CREATED, detail: dbResponse };
|
|
400
361
|
}
|
|
401
362
|
catch (error) {
|
|
402
363
|
await client.query('ROLLBACK');
|
|
403
|
-
let err = { status:
|
|
364
|
+
let err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
404
365
|
if (error.code === '23505') {
|
|
405
|
-
err = { status:
|
|
366
|
+
err = { status: StatusCodes.CONFLICT, error: `[${fname}: entityid [${entityid}] already exists`, detail: error };
|
|
406
367
|
}
|
|
407
|
-
this.#LogDebugMessage(
|
|
368
|
+
this.#LogDebugMessage(chalk.red(`createEntity(): Error: [${JSON.stringify(err)}]`));
|
|
408
369
|
return err;
|
|
409
370
|
}
|
|
410
371
|
finally {
|
|
@@ -414,7 +375,7 @@ class PGAccessLayer {
|
|
|
414
375
|
catch (error) {
|
|
415
376
|
// Error getting the client connection from the pool
|
|
416
377
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
417
|
-
return { status:
|
|
378
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
418
379
|
}
|
|
419
380
|
}
|
|
420
381
|
async createEntityEx(userid, resourceid, resourcevnum, entityid, entity) {
|
|
@@ -434,15 +395,15 @@ class PGAccessLayer {
|
|
|
434
395
|
const { rows } = (await client.query(createQuery, values));
|
|
435
396
|
const dbResponse = rows[0];
|
|
436
397
|
await client.query('COMMIT');
|
|
437
|
-
return { status:
|
|
398
|
+
return { status: StatusCodes.CREATED, detail: dbResponse };
|
|
438
399
|
}
|
|
439
400
|
catch (error) {
|
|
440
401
|
await client.query('ROLLBACK');
|
|
441
|
-
let err = { status:
|
|
402
|
+
let err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
442
403
|
if (error.code === '23505') {
|
|
443
|
-
err = { status:
|
|
404
|
+
err = { status: StatusCodes.CONFLICT, error: `[${fname}: entityid [${entityid}] already exists`, detail: error };
|
|
444
405
|
}
|
|
445
|
-
this.#LogDebugMessage(
|
|
406
|
+
this.#LogDebugMessage(chalk.red(`createEntity(): Error: [${JSON.stringify(err)}]`));
|
|
446
407
|
return err;
|
|
447
408
|
}
|
|
448
409
|
finally {
|
|
@@ -452,7 +413,7 @@ class PGAccessLayer {
|
|
|
452
413
|
catch (error) {
|
|
453
414
|
// Error getting the client connection from the pool
|
|
454
415
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
455
|
-
return { status:
|
|
416
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
456
417
|
}
|
|
457
418
|
}
|
|
458
419
|
async updateEntity(userid, resourceid, resourcevnum, entityid, entityvnum, payload) {
|
|
@@ -473,15 +434,15 @@ class PGAccessLayer {
|
|
|
473
434
|
const { rows } = await client.query(createQuery, values);
|
|
474
435
|
const dbResponse = rows[0];
|
|
475
436
|
await client.query('COMMIT');
|
|
476
|
-
return { status:
|
|
437
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
477
438
|
}
|
|
478
439
|
catch (error) {
|
|
479
440
|
await client.query('ROLLBACK');
|
|
480
|
-
let err = { status:
|
|
441
|
+
let err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
481
442
|
if (error.code === 'P0002') {
|
|
482
|
-
err = { status:
|
|
443
|
+
err = { status: StatusCodes.NOT_FOUND, error: `[${fname}: resourceid [${resourceid}:${resourcevnum}], entityid [${entityid}:${entityvnum}] not found or not current`, detail: error };
|
|
483
444
|
}
|
|
484
|
-
this.#LogDebugMessage(
|
|
445
|
+
this.#LogDebugMessage(chalk.red(`updateEntity(): Error: [${JSON.stringify(err)}]`));
|
|
485
446
|
return err;
|
|
486
447
|
}
|
|
487
448
|
finally {
|
|
@@ -491,7 +452,7 @@ class PGAccessLayer {
|
|
|
491
452
|
catch (error) {
|
|
492
453
|
// Error getting the client connection from the pool
|
|
493
454
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
494
|
-
return { status:
|
|
455
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
495
456
|
}
|
|
496
457
|
}
|
|
497
458
|
async deleteEntity(userid, resourceid, resourcevnum, entityid, entityvnum) {
|
|
@@ -511,15 +472,15 @@ class PGAccessLayer {
|
|
|
511
472
|
const { rows } = await client.query(createQuery, values);
|
|
512
473
|
const dbResponse = rows[0];
|
|
513
474
|
await client.query('COMMIT');
|
|
514
|
-
return { status:
|
|
475
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
515
476
|
}
|
|
516
477
|
catch (error) {
|
|
517
478
|
await client.query('ROLLBACK');
|
|
518
|
-
let err = { status:
|
|
479
|
+
let err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
519
480
|
if (error.code === 'P0002') {
|
|
520
|
-
err = { status:
|
|
481
|
+
err = { status: StatusCodes.NOT_FOUND, error: `[${fname}: resourceid [${resourceid}:${resourcevnum}], entityid [${entityid}:${entityvnum}] not found or not current`, detail: error };
|
|
521
482
|
}
|
|
522
|
-
this.#LogDebugMessage(
|
|
483
|
+
this.#LogDebugMessage(chalk.red(`deleteEntity(): Error: [${JSON.stringify(err)}]`));
|
|
523
484
|
return err;
|
|
524
485
|
}
|
|
525
486
|
finally {
|
|
@@ -529,7 +490,7 @@ class PGAccessLayer {
|
|
|
529
490
|
catch (error) {
|
|
530
491
|
// Error getting the client connection from the pool
|
|
531
492
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
532
|
-
return { status:
|
|
493
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
533
494
|
}
|
|
534
495
|
}
|
|
535
496
|
// get single resource and all associated entities for this resource
|
|
@@ -549,7 +510,7 @@ class PGAccessLayer {
|
|
|
549
510
|
const cacheVal = await this.#ioredisCache.get(resourceid);
|
|
550
511
|
if (cacheVal !== null) {
|
|
551
512
|
const cacheResponse = JSON.parse(cacheVal);
|
|
552
|
-
return { status:
|
|
513
|
+
return { status: StatusCodes.OK, usedcache: true, detail: cacheResponse };
|
|
553
514
|
}
|
|
554
515
|
}
|
|
555
516
|
}
|
|
@@ -564,19 +525,19 @@ class PGAccessLayer {
|
|
|
564
525
|
try {
|
|
565
526
|
const { rows } = await client.query(query, values);
|
|
566
527
|
if (rows.length === 0) {
|
|
567
|
-
return { status:
|
|
528
|
+
return { status: StatusCodes.NOT_FOUND, error: `[${fname}: resourceid [${resourceid}] (current version) not found`, detail: null };
|
|
568
529
|
}
|
|
569
530
|
if (rows.length > 1) {
|
|
570
|
-
return { status:
|
|
531
|
+
return { status: StatusCodes.NOT_FOUND, error: `[${fname}: Multiple resourceid [${resourceid}](current version) exist within database. Invalid database state.`, detail: null };
|
|
571
532
|
}
|
|
572
533
|
const dbResponse = rows[0];
|
|
573
534
|
if (this.#ioredisCache !== null) {
|
|
574
535
|
this.#ioredisCache.set(resourceid, JSON.stringify(dbResponse));
|
|
575
536
|
}
|
|
576
|
-
return { status:
|
|
537
|
+
return { status: StatusCodes.OK, usedcache: false, detail: dbResponse };
|
|
577
538
|
}
|
|
578
539
|
catch (error) {
|
|
579
|
-
return { status:
|
|
540
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default;
|
|
580
541
|
}
|
|
581
542
|
finally {
|
|
582
543
|
client.release();
|
|
@@ -585,7 +546,7 @@ class PGAccessLayer {
|
|
|
585
546
|
catch (error) {
|
|
586
547
|
// Error getting the client connection from the pool
|
|
587
548
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
588
|
-
return { status:
|
|
549
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
589
550
|
}
|
|
590
551
|
}
|
|
591
552
|
// get single resource and all associated entities for this resource
|
|
@@ -609,7 +570,7 @@ class PGAccessLayer {
|
|
|
609
570
|
// raw database row
|
|
610
571
|
raw: { ...cacheedResponse },
|
|
611
572
|
// sts parsed values
|
|
612
|
-
status:
|
|
573
|
+
status: StatusCodes.OK,
|
|
613
574
|
usedcache: true,
|
|
614
575
|
detail: JSON.parse(cacheedResponse.resdesc)
|
|
615
576
|
};
|
|
@@ -623,14 +584,14 @@ class PGAccessLayer {
|
|
|
623
584
|
const { rows } = await client.query(query, values);
|
|
624
585
|
if (rows.length === 0) {
|
|
625
586
|
return {
|
|
626
|
-
status:
|
|
587
|
+
status: StatusCodes.NOT_FOUND,
|
|
627
588
|
error: `[${fname}: resourceid [${resourceid}] (current version) not found`,
|
|
628
589
|
usedcache: false
|
|
629
590
|
};
|
|
630
591
|
}
|
|
631
592
|
if (rows.length > 1) {
|
|
632
593
|
return {
|
|
633
|
-
status:
|
|
594
|
+
status: StatusCodes.NOT_FOUND,
|
|
634
595
|
error: `[${fname}: Multiple resourceid [${resourceid}](current version) exist within database. Invalid database state.`,
|
|
635
596
|
usedcache: false
|
|
636
597
|
};
|
|
@@ -645,7 +606,7 @@ class PGAccessLayer {
|
|
|
645
606
|
// raw database row
|
|
646
607
|
raw: { ...dbResponse },
|
|
647
608
|
// sts parsed values
|
|
648
|
-
status:
|
|
609
|
+
status: StatusCodes.OK,
|
|
649
610
|
usedcache: false,
|
|
650
611
|
detail: parsedDetail
|
|
651
612
|
};
|
|
@@ -654,7 +615,7 @@ class PGAccessLayer {
|
|
|
654
615
|
return {
|
|
655
616
|
// raw database row
|
|
656
617
|
raw: { ...dbResponse },
|
|
657
|
-
status:
|
|
618
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR,
|
|
658
619
|
sourceError: error,
|
|
659
620
|
error: `[${fname}]: Operation was not successful - Could not JSON.parse(dbResponse.resdesc).`,
|
|
660
621
|
usedcache: false
|
|
@@ -663,7 +624,7 @@ class PGAccessLayer {
|
|
|
663
624
|
}
|
|
664
625
|
catch (error) {
|
|
665
626
|
return {
|
|
666
|
-
status:
|
|
627
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR,
|
|
667
628
|
sourceError: error,
|
|
668
629
|
error: `[${fname}]: Operation was not successful.`,
|
|
669
630
|
usedcache: false
|
|
@@ -677,7 +638,7 @@ class PGAccessLayer {
|
|
|
677
638
|
// Error getting the client connection from the pool
|
|
678
639
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
679
640
|
return {
|
|
680
|
-
status:
|
|
641
|
+
status: StatusCodes.INTERNAL_SERVER_ERROR,
|
|
681
642
|
sourceError: error,
|
|
682
643
|
error: `[${fname}]: Operation was not successful - Fallback.`,
|
|
683
644
|
usedcache: false
|
|
@@ -702,16 +663,16 @@ class PGAccessLayer {
|
|
|
702
663
|
try {
|
|
703
664
|
const { rows } = await client.query(query, values);
|
|
704
665
|
if (rows.length === 0) {
|
|
705
|
-
return { status:
|
|
666
|
+
return { status: StatusCodes.NOT_FOUND, error: `[${fname}: resourceid [${resourceid}] (current version) not found`, detail: null };
|
|
706
667
|
}
|
|
707
668
|
if (rows.length > 1) {
|
|
708
|
-
return { status:
|
|
669
|
+
return { status: StatusCodes.NOT_FOUND, error: `[${fname}: Multiple resourceid [${resourceid}](current version) exist within database. Invalid database state.`, detail: null };
|
|
709
670
|
}
|
|
710
671
|
const dbResponse = rows[0];
|
|
711
|
-
return { status:
|
|
672
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
712
673
|
}
|
|
713
674
|
catch (error) {
|
|
714
|
-
return { status:
|
|
675
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default;
|
|
715
676
|
}
|
|
716
677
|
finally {
|
|
717
678
|
client.release();
|
|
@@ -720,7 +681,7 @@ class PGAccessLayer {
|
|
|
720
681
|
catch (error) {
|
|
721
682
|
// Error getting the client connection from the pool
|
|
722
683
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
723
|
-
return { status:
|
|
684
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
724
685
|
}
|
|
725
686
|
}
|
|
726
687
|
async getEntityEx(filters) {
|
|
@@ -740,17 +701,17 @@ class PGAccessLayer {
|
|
|
740
701
|
try {
|
|
741
702
|
const { rows } = await client.query(query, values);
|
|
742
703
|
if (rows.length === 0) {
|
|
743
|
-
return { status:
|
|
704
|
+
return { status: StatusCodes.NOT_FOUND, error: `[${fname}: resourceid [${resourceid}] (current version) not found`, detail: null };
|
|
744
705
|
}
|
|
745
706
|
if (rows.length > 1) {
|
|
746
|
-
return { status:
|
|
707
|
+
return { status: StatusCodes.NOT_FOUND, error: `[${fname}: Multiple resourceid [${resourceid}](current version) exist within database. Invalid database state.`, detail: null };
|
|
747
708
|
}
|
|
748
709
|
const dbResponse = rows[0];
|
|
749
710
|
const parsedDetail = JSON.parse(dbResponse.entvalue);
|
|
750
|
-
return { status:
|
|
711
|
+
return { status: StatusCodes.OK, detail: parsedDetail };
|
|
751
712
|
}
|
|
752
713
|
catch (error) {
|
|
753
|
-
return { status:
|
|
714
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default;
|
|
754
715
|
}
|
|
755
716
|
finally {
|
|
756
717
|
client.release();
|
|
@@ -759,7 +720,7 @@ class PGAccessLayer {
|
|
|
759
720
|
catch (error) {
|
|
760
721
|
// Error getting the client connection from the pool
|
|
761
722
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
762
|
-
return { status:
|
|
723
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
763
724
|
}
|
|
764
725
|
}
|
|
765
726
|
// get single resource and all associated entities for this resource
|
|
@@ -778,10 +739,10 @@ class PGAccessLayer {
|
|
|
778
739
|
try {
|
|
779
740
|
const { rows } = await client.query(query, values);
|
|
780
741
|
const dbResponse = rows;
|
|
781
|
-
return { status:
|
|
742
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
782
743
|
}
|
|
783
744
|
catch (error) {
|
|
784
|
-
return { status:
|
|
745
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default;
|
|
785
746
|
}
|
|
786
747
|
finally {
|
|
787
748
|
client.release();
|
|
@@ -790,7 +751,7 @@ class PGAccessLayer {
|
|
|
790
751
|
catch (error) {
|
|
791
752
|
// Error getting the client connection from the pool
|
|
792
753
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
793
|
-
return { status:
|
|
754
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
794
755
|
}
|
|
795
756
|
}
|
|
796
757
|
async getEntitiesEx(filters) {
|
|
@@ -814,11 +775,11 @@ class PGAccessLayer {
|
|
|
814
775
|
r.entvalue = obj;
|
|
815
776
|
response.push(obj);
|
|
816
777
|
});
|
|
817
|
-
return { status:
|
|
778
|
+
return { status: StatusCodes.OK, detail: response };
|
|
818
779
|
//return { status: StatusCodes.OK, detail: dbResponse };
|
|
819
780
|
}
|
|
820
781
|
catch (error) {
|
|
821
|
-
return { status:
|
|
782
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default;
|
|
822
783
|
}
|
|
823
784
|
finally {
|
|
824
785
|
client.release();
|
|
@@ -827,7 +788,7 @@ class PGAccessLayer {
|
|
|
827
788
|
catch (error) {
|
|
828
789
|
// Error getting the client connection from the pool
|
|
829
790
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
830
|
-
return { status:
|
|
791
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
831
792
|
}
|
|
832
793
|
}
|
|
833
794
|
// get current resource
|
|
@@ -846,10 +807,10 @@ class PGAccessLayer {
|
|
|
846
807
|
try {
|
|
847
808
|
const { rows } = await client.query(query, values);
|
|
848
809
|
const dbResponse = rows;
|
|
849
|
-
return { status:
|
|
810
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
850
811
|
}
|
|
851
812
|
catch (error) {
|
|
852
|
-
return { status:
|
|
813
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default;
|
|
853
814
|
}
|
|
854
815
|
finally {
|
|
855
816
|
client.release();
|
|
@@ -858,7 +819,7 @@ class PGAccessLayer {
|
|
|
858
819
|
catch (error) {
|
|
859
820
|
// Error getting the client connection from the pool
|
|
860
821
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
861
|
-
return { status:
|
|
822
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
862
823
|
}
|
|
863
824
|
}
|
|
864
825
|
async deleteResources(resname, actionuser) {
|
|
@@ -871,12 +832,12 @@ class PGAccessLayer {
|
|
|
871
832
|
await client.query('BEGIN');
|
|
872
833
|
await client.query(query, values);
|
|
873
834
|
await client.query('COMMIT');
|
|
874
|
-
return { status:
|
|
835
|
+
return { status: StatusCodes.OK };
|
|
875
836
|
}
|
|
876
837
|
catch (error) {
|
|
877
838
|
this.#LogErrorMessage(`[${fname}]: Failed to delete resources: ${error}`);
|
|
878
839
|
await client.query('ROLLBACK');
|
|
879
|
-
return { status:
|
|
840
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
880
841
|
}
|
|
881
842
|
finally {
|
|
882
843
|
client.release();
|
|
@@ -885,7 +846,7 @@ class PGAccessLayer {
|
|
|
885
846
|
catch (error) {
|
|
886
847
|
// Error getting the client connection from the pool
|
|
887
848
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
888
|
-
return { status:
|
|
849
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
889
850
|
}
|
|
890
851
|
}
|
|
891
852
|
async deleteAllResources() {
|
|
@@ -898,12 +859,12 @@ class PGAccessLayer {
|
|
|
898
859
|
await client.query('BEGIN');
|
|
899
860
|
await client.query(query);
|
|
900
861
|
await client.query('COMMIT');
|
|
901
|
-
return { status:
|
|
862
|
+
return { status: StatusCodes.OK };
|
|
902
863
|
}
|
|
903
864
|
catch (error) {
|
|
904
865
|
this.#LogErrorMessage(`[${fname}]: Failed to truncate table(s): ${error}`);
|
|
905
866
|
await client.query('ROLLBACK');
|
|
906
|
-
return { status:
|
|
867
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
907
868
|
}
|
|
908
869
|
finally {
|
|
909
870
|
client.release();
|
|
@@ -912,7 +873,7 @@ class PGAccessLayer {
|
|
|
912
873
|
catch (error) {
|
|
913
874
|
// Error getting the client connection from the pool
|
|
914
875
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
915
|
-
return { status:
|
|
876
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
916
877
|
}
|
|
917
878
|
}
|
|
918
879
|
async getTotalResources() {
|
|
@@ -924,12 +885,12 @@ class PGAccessLayer {
|
|
|
924
885
|
const query = "select count(*) from stsresource";
|
|
925
886
|
const { rows } = await client.query(query);
|
|
926
887
|
const dbResponse = rows[0];
|
|
927
|
-
return { status:
|
|
888
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
928
889
|
}
|
|
929
890
|
catch (error) {
|
|
930
891
|
this.#LogErrorMessage(`[${fname}]: Could not get count from stsresource table: ${error}`);
|
|
931
892
|
await client.query('ROLLBACK');
|
|
932
|
-
return { status:
|
|
893
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
933
894
|
}
|
|
934
895
|
finally {
|
|
935
896
|
client.release();
|
|
@@ -938,7 +899,7 @@ class PGAccessLayer {
|
|
|
938
899
|
catch (error) {
|
|
939
900
|
// Error getting the client connection from the pool
|
|
940
901
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
941
|
-
return { status:
|
|
902
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
942
903
|
}
|
|
943
904
|
}
|
|
944
905
|
async executedbscript(scriptfile) {
|
|
@@ -993,9 +954,9 @@ class PGAccessLayer {
|
|
|
993
954
|
}
|
|
994
955
|
*/
|
|
995
956
|
if (this.#ioredisCache !== null) {
|
|
996
|
-
if (
|
|
957
|
+
if (goptions.redisDatabaseCacheEndFlush === true) {
|
|
997
958
|
await this.#ioredisCache.flushall();
|
|
998
|
-
this.#LogDebugMessage(
|
|
959
|
+
this.#LogDebugMessage(chalk.magenta(`Redis cache flushed.`));
|
|
999
960
|
}
|
|
1000
961
|
await this.#ioredisCache.quit();
|
|
1001
962
|
this.#ioredisCache = null;
|
|
@@ -1069,11 +1030,11 @@ class PGAccessLayer {
|
|
|
1069
1030
|
try {
|
|
1070
1031
|
const { rows } = await client.query(createQuery);
|
|
1071
1032
|
const dbResponse = rows;
|
|
1072
|
-
return { status:
|
|
1033
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
1073
1034
|
}
|
|
1074
1035
|
catch (error) {
|
|
1075
|
-
const err = { status:
|
|
1076
|
-
this.#LogDebugMessage(
|
|
1036
|
+
const err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
1037
|
+
this.#LogDebugMessage(chalk.red(`Error: ${JSON.stringify(error)}`));
|
|
1077
1038
|
return err;
|
|
1078
1039
|
}
|
|
1079
1040
|
finally {
|
|
@@ -1083,7 +1044,7 @@ class PGAccessLayer {
|
|
|
1083
1044
|
catch (error) {
|
|
1084
1045
|
// Error getting the client connection from the pool
|
|
1085
1046
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
1086
|
-
return { status:
|
|
1047
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
1087
1048
|
}
|
|
1088
1049
|
}
|
|
1089
1050
|
async GetMonitorSummaryByServiceId(serviceId) {
|
|
@@ -1095,11 +1056,11 @@ class PGAccessLayer {
|
|
|
1095
1056
|
try {
|
|
1096
1057
|
const { rows } = await client.query(createQuery, values);
|
|
1097
1058
|
const dbResponse = rows;
|
|
1098
|
-
return { status:
|
|
1059
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
1099
1060
|
}
|
|
1100
1061
|
catch (error) {
|
|
1101
|
-
const err = { status:
|
|
1102
|
-
this.#LogDebugMessage(
|
|
1062
|
+
const err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
1063
|
+
this.#LogDebugMessage(chalk.red(`Error: ${JSON.stringify(error)}`));
|
|
1103
1064
|
return err;
|
|
1104
1065
|
}
|
|
1105
1066
|
finally {
|
|
@@ -1109,7 +1070,7 @@ class PGAccessLayer {
|
|
|
1109
1070
|
catch (error) {
|
|
1110
1071
|
// Error getting the client connection from the pool
|
|
1111
1072
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
1112
|
-
return { status:
|
|
1073
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
1113
1074
|
}
|
|
1114
1075
|
}
|
|
1115
1076
|
async GetMonitorSummaryByServiceInstanceId(serviceInstanceId) {
|
|
@@ -1121,11 +1082,11 @@ class PGAccessLayer {
|
|
|
1121
1082
|
try {
|
|
1122
1083
|
const { rows } = await client.query(createQuery, values);
|
|
1123
1084
|
const dbResponse = rows;
|
|
1124
|
-
return { status:
|
|
1085
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
1125
1086
|
}
|
|
1126
1087
|
catch (error) {
|
|
1127
|
-
const err = { status:
|
|
1128
|
-
this.#LogDebugMessage(
|
|
1088
|
+
const err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
1089
|
+
this.#LogDebugMessage(chalk.red(`Error: ${JSON.stringify(error)}`));
|
|
1129
1090
|
return err;
|
|
1130
1091
|
}
|
|
1131
1092
|
finally {
|
|
@@ -1135,7 +1096,7 @@ class PGAccessLayer {
|
|
|
1135
1096
|
catch (error) {
|
|
1136
1097
|
// Error getting the client connection from the pool
|
|
1137
1098
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
1138
|
-
return { status:
|
|
1099
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
1139
1100
|
}
|
|
1140
1101
|
}
|
|
1141
1102
|
async PurgeOldMonitorData(keepAgeSeconds) {
|
|
@@ -1147,11 +1108,11 @@ class PGAccessLayer {
|
|
|
1147
1108
|
try {
|
|
1148
1109
|
const { rows } = await client.query(createQuery, values);
|
|
1149
1110
|
const dbResponse = rows[0];
|
|
1150
|
-
return { status:
|
|
1111
|
+
return { status: StatusCodes.OK, detail: dbResponse };
|
|
1151
1112
|
}
|
|
1152
1113
|
catch (error) {
|
|
1153
|
-
const err = { status:
|
|
1154
|
-
this.#LogDebugMessage(
|
|
1114
|
+
const err = { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error }; // Set default
|
|
1115
|
+
this.#LogDebugMessage(chalk.red(`Error: ${JSON.stringify(error)}`));
|
|
1155
1116
|
return err;
|
|
1156
1117
|
}
|
|
1157
1118
|
finally {
|
|
@@ -1161,9 +1122,8 @@ class PGAccessLayer {
|
|
|
1161
1122
|
catch (error) {
|
|
1162
1123
|
// Error getting the client connection from the pool
|
|
1163
1124
|
this.#LogErrorMessage(`[${fname}]: Could not get client from pool: ${error}`);
|
|
1164
|
-
return { status:
|
|
1125
|
+
return { status: StatusCodes.INTERNAL_SERVER_ERROR, error: `[${fname}]: Operation was not successful`, detail: error };
|
|
1165
1126
|
}
|
|
1166
1127
|
}
|
|
1167
1128
|
}
|
|
1168
|
-
exports.PGAccessLayer = PGAccessLayer;
|
|
1169
1129
|
//# sourceMappingURL=pgaccesslayer-old.js.map
|