@oino-ts/db-postgresql 0.8.0 → 0.8.2
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.
|
@@ -101,7 +101,7 @@ class OINODbPostgresql extends db_1.OINODb {
|
|
|
101
101
|
this._pool = new pg_1.Pool({ host: this._params.url, database: this._params.database, port: this._params.port, user: this._params.user, password: this._params.password, ssl: ssl_enabled });
|
|
102
102
|
delete this._params.password;
|
|
103
103
|
this._pool.on("error", (err) => {
|
|
104
|
-
db_1.OINOLog.error("@
|
|
104
|
+
db_1.OINOLog.error("@oino-ts/db-postgresql", "OINODbPostgresql", ".on(error)", "Error-event", { err: err });
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
_parseFieldLength(fieldLength) {
|
|
@@ -233,7 +233,7 @@ class OINODbPostgresql extends db_1.OINODb {
|
|
|
233
233
|
}
|
|
234
234
|
catch (e) {
|
|
235
235
|
result.setError(500, "Exception connecting to database: " + e.message, "OINODbPostgresql.connect");
|
|
236
|
-
db_1.OINOLog.exception("@
|
|
236
|
+
db_1.OINOLog.exception("@oino-ts/db-postgresql", "OINODbMsSql", "connect", "Exception", { message: e.message, stack: e.stack });
|
|
237
237
|
}
|
|
238
238
|
return result;
|
|
239
239
|
}
|
|
@@ -262,7 +262,7 @@ class OINODbPostgresql extends db_1.OINODb {
|
|
|
262
262
|
}
|
|
263
263
|
catch (e) {
|
|
264
264
|
result.setError(500, "Exception validating connection: " + e.message, "OINODbPostgresql.validate");
|
|
265
|
-
db_1.OINOLog.exception("@
|
|
265
|
+
db_1.OINOLog.exception("@oino-ts/db-postgresql", "OINODbMsSql", "validate", "Exception", { message: e.message, stack: e.stack });
|
|
266
266
|
}
|
|
267
267
|
db_1.OINOBenchmark.end("OINODb", "validate");
|
|
268
268
|
return result;
|
|
@@ -375,7 +375,7 @@ WHERE col.table_catalog = '${dbName}'`;
|
|
|
375
375
|
isAutoInc: default_val.startsWith("nextval(")
|
|
376
376
|
};
|
|
377
377
|
if (api.isFieldIncluded(field_name) == false) {
|
|
378
|
-
db_1.OINOLog.info("@
|
|
378
|
+
db_1.OINOLog.info("@oino-ts/db-postgresql", "OINODbPostgresql", "initializeApiDatamodel", "Field excluded in API parameters.", { field: field_name });
|
|
379
379
|
if (field_params.isPrimaryKey) {
|
|
380
380
|
throw new Error(db_1.OINO_ERROR_PREFIX + "Primary key field excluded in API parameters: " + field_name);
|
|
381
381
|
}
|
|
@@ -405,13 +405,13 @@ WHERE col.table_catalog = '${dbName}'`;
|
|
|
405
405
|
api.datamodel.addField(new db_1.OINOStringDataField(this, field_name, sql_type, field_params, numeric_precision + numeric_scale + 1));
|
|
406
406
|
}
|
|
407
407
|
else {
|
|
408
|
-
db_1.OINOLog.info("@
|
|
408
|
+
db_1.OINOLog.info("@oino-ts/db-postgresql", "OINODbPostgresql", "initializeApiDatamodel", "Unrecognized field type treated as string", { field_name: field_name, sql_type: sql_type, field_length: field_length, field_params: field_params });
|
|
409
409
|
api.datamodel.addField(new db_1.OINOStringDataField(this, field_name, sql_type, field_params, 0));
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
await schema_res.next();
|
|
413
413
|
}
|
|
414
|
-
db_1.OINOLog.info("@
|
|
414
|
+
db_1.OINOLog.info("@oino-ts/db-postgresql", "OINODbPostgresql", "initializeApiDatamodel", "\n" + api.datamodel.printDebug("\n"));
|
|
415
415
|
return Promise.resolve();
|
|
416
416
|
}
|
|
417
417
|
}
|
|
@@ -98,7 +98,7 @@ export class OINODbPostgresql extends OINODb {
|
|
|
98
98
|
this._pool = new Pool({ host: this._params.url, database: this._params.database, port: this._params.port, user: this._params.user, password: this._params.password, ssl: ssl_enabled });
|
|
99
99
|
delete this._params.password;
|
|
100
100
|
this._pool.on("error", (err) => {
|
|
101
|
-
OINOLog.error("@
|
|
101
|
+
OINOLog.error("@oino-ts/db-postgresql", "OINODbPostgresql", ".on(error)", "Error-event", { err: err });
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
_parseFieldLength(fieldLength) {
|
|
@@ -230,7 +230,7 @@ export class OINODbPostgresql extends OINODb {
|
|
|
230
230
|
}
|
|
231
231
|
catch (e) {
|
|
232
232
|
result.setError(500, "Exception connecting to database: " + e.message, "OINODbPostgresql.connect");
|
|
233
|
-
OINOLog.exception("@
|
|
233
|
+
OINOLog.exception("@oino-ts/db-postgresql", "OINODbMsSql", "connect", "Exception", { message: e.message, stack: e.stack });
|
|
234
234
|
}
|
|
235
235
|
return result;
|
|
236
236
|
}
|
|
@@ -259,7 +259,7 @@ export class OINODbPostgresql extends OINODb {
|
|
|
259
259
|
}
|
|
260
260
|
catch (e) {
|
|
261
261
|
result.setError(500, "Exception validating connection: " + e.message, "OINODbPostgresql.validate");
|
|
262
|
-
OINOLog.exception("@
|
|
262
|
+
OINOLog.exception("@oino-ts/db-postgresql", "OINODbMsSql", "validate", "Exception", { message: e.message, stack: e.stack });
|
|
263
263
|
}
|
|
264
264
|
OINOBenchmark.end("OINODb", "validate");
|
|
265
265
|
return result;
|
|
@@ -372,7 +372,7 @@ WHERE col.table_catalog = '${dbName}'`;
|
|
|
372
372
|
isAutoInc: default_val.startsWith("nextval(")
|
|
373
373
|
};
|
|
374
374
|
if (api.isFieldIncluded(field_name) == false) {
|
|
375
|
-
OINOLog.info("@
|
|
375
|
+
OINOLog.info("@oino-ts/db-postgresql", "OINODbPostgresql", "initializeApiDatamodel", "Field excluded in API parameters.", { field: field_name });
|
|
376
376
|
if (field_params.isPrimaryKey) {
|
|
377
377
|
throw new Error(OINO_ERROR_PREFIX + "Primary key field excluded in API parameters: " + field_name);
|
|
378
378
|
}
|
|
@@ -402,13 +402,13 @@ WHERE col.table_catalog = '${dbName}'`;
|
|
|
402
402
|
api.datamodel.addField(new OINOStringDataField(this, field_name, sql_type, field_params, numeric_precision + numeric_scale + 1));
|
|
403
403
|
}
|
|
404
404
|
else {
|
|
405
|
-
OINOLog.info("@
|
|
405
|
+
OINOLog.info("@oino-ts/db-postgresql", "OINODbPostgresql", "initializeApiDatamodel", "Unrecognized field type treated as string", { field_name: field_name, sql_type: sql_type, field_length: field_length, field_params: field_params });
|
|
406
406
|
api.datamodel.addField(new OINOStringDataField(this, field_name, sql_type, field_params, 0));
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
await schema_res.next();
|
|
410
410
|
}
|
|
411
|
-
OINOLog.info("@
|
|
411
|
+
OINOLog.info("@oino-ts/db-postgresql", "OINODbPostgresql", "initializeApiDatamodel", "\n" + api.datamodel.printDebug("\n"));
|
|
412
412
|
return Promise.resolve();
|
|
413
413
|
}
|
|
414
414
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oino-ts/db-postgresql",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "OINO TS package for using Postgresql databases.",
|
|
5
5
|
"author": "Matias Kiviniemi (pragmatta)",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"module": "./dist/esm/index.js",
|
|
21
21
|
"types": "./dist/types/index.d.ts",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@oino-ts/db": "0.8.
|
|
23
|
+
"@oino-ts/db": "0.8.2",
|
|
24
24
|
"pg": "^8.11.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
package/src/OINODbPostgresql.ts
CHANGED
|
@@ -111,7 +111,7 @@ export class OINODbPostgresql extends OINODb {
|
|
|
111
111
|
delete this._params.password
|
|
112
112
|
|
|
113
113
|
this._pool.on("error", (err: any) => {
|
|
114
|
-
OINOLog.error("@
|
|
114
|
+
OINOLog.error("@oino-ts/db-postgresql", "OINODbPostgresql", ".on(error)", "Error-event", {err:err})
|
|
115
115
|
})
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -249,7 +249,7 @@ export class OINODbPostgresql extends OINODb {
|
|
|
249
249
|
|
|
250
250
|
} catch (e:any) {
|
|
251
251
|
result.setError(500, "Exception connecting to database: " + e.message, "OINODbPostgresql.connect")
|
|
252
|
-
OINOLog.exception("@
|
|
252
|
+
OINOLog.exception("@oino-ts/db-postgresql", "OINODbMsSql", "connect", "Exception", {message:e.message, stack:e.stack})
|
|
253
253
|
}
|
|
254
254
|
return result
|
|
255
255
|
}
|
|
@@ -278,7 +278,7 @@ export class OINODbPostgresql extends OINODb {
|
|
|
278
278
|
}
|
|
279
279
|
} catch (e:any) {
|
|
280
280
|
result.setError(500, "Exception validating connection: " + e.message, "OINODbPostgresql.validate")
|
|
281
|
-
OINOLog.exception("@
|
|
281
|
+
OINOLog.exception("@oino-ts/db-postgresql", "OINODbMsSql", "validate", "Exception", {message:e.message, stack:e.stack})
|
|
282
282
|
}
|
|
283
283
|
OINOBenchmark.end("OINODb", "validate")
|
|
284
284
|
return result
|
|
@@ -399,7 +399,7 @@ WHERE col.table_catalog = '${dbName}'`
|
|
|
399
399
|
isAutoInc: default_val.startsWith("nextval(")
|
|
400
400
|
}
|
|
401
401
|
if (api.isFieldIncluded(field_name) == false) {
|
|
402
|
-
OINOLog.info("@
|
|
402
|
+
OINOLog.info("@oino-ts/db-postgresql", "OINODbPostgresql", "initializeApiDatamodel", "Field excluded in API parameters.", {field:field_name})
|
|
403
403
|
if (field_params.isPrimaryKey) {
|
|
404
404
|
throw new Error(OINO_ERROR_PREFIX + "Primary key field excluded in API parameters: " + field_name)
|
|
405
405
|
}
|
|
@@ -428,13 +428,13 @@ WHERE col.table_catalog = '${dbName}'`
|
|
|
428
428
|
api.datamodel.addField(new OINOStringDataField(this, field_name, sql_type, field_params, numeric_precision + numeric_scale + 1))
|
|
429
429
|
|
|
430
430
|
} else {
|
|
431
|
-
OINOLog.info("@
|
|
431
|
+
OINOLog.info("@oino-ts/db-postgresql", "OINODbPostgresql", "initializeApiDatamodel", "Unrecognized field type treated as string", {field_name: field_name, sql_type:sql_type, field_length:field_length, field_params:field_params })
|
|
432
432
|
api.datamodel.addField(new OINOStringDataField(this, field_name, sql_type, field_params, 0))
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
await schema_res.next()
|
|
436
436
|
}
|
|
437
|
-
OINOLog.info("@
|
|
437
|
+
OINOLog.info("@oino-ts/db-postgresql", "OINODbPostgresql", "initializeApiDatamodel", "\n" + api.datamodel.printDebug("\n"))
|
|
438
438
|
return Promise.resolve()
|
|
439
439
|
}
|
|
440
440
|
}
|