@creator.co/wapi 1.2.4 → 1.2.6
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/.github/workflows/npmpublish.yml +1 -1
- package/README.md +216 -5
- package/dist/index.d.ts +15 -0
- package/dist/index.js.map +1 -1
- package/dist/jest.config.js +1 -1
- package/dist/jest.config.js.map +1 -1
- package/dist/package.json +13 -2
- package/dist/src/API/Request.d.ts +45 -82
- package/dist/src/API/Request.js +49 -77
- package/dist/src/API/Request.js.map +1 -1
- package/dist/src/API/Response.d.ts +94 -163
- package/dist/src/API/Response.js +101 -161
- package/dist/src/API/Response.js.map +1 -1
- package/dist/src/API/Utils.d.ts +21 -42
- package/dist/src/API/Utils.js +22 -43
- package/dist/src/API/Utils.js.map +1 -1
- package/dist/src/BaseEvent/EventProcessor.d.ts +32 -55
- package/dist/src/BaseEvent/EventProcessor.js +30 -38
- package/dist/src/BaseEvent/EventProcessor.js.map +1 -1
- package/dist/src/BaseEvent/Process.d.ts +20 -43
- package/dist/src/BaseEvent/Process.js +16 -27
- package/dist/src/BaseEvent/Process.js.map +1 -1
- package/dist/src/BaseEvent/Transaction.d.ts +104 -2
- package/dist/src/BaseEvent/Transaction.js +196 -41
- package/dist/src/BaseEvent/Transaction.js.map +1 -1
- package/dist/src/Config/Configuration.d.ts +48 -66
- package/dist/src/Config/Configuration.js +25 -42
- package/dist/src/Config/Configuration.js.map +1 -1
- package/dist/src/Config/EnvironmentVar.d.ts +30 -57
- package/dist/src/Config/EnvironmentVar.js +28 -41
- package/dist/src/Config/EnvironmentVar.js.map +1 -1
- package/dist/src/Crypto/Crypto.d.ts +17 -35
- package/dist/src/Crypto/Crypto.js +12 -21
- package/dist/src/Crypto/Crypto.js.map +1 -1
- package/dist/src/Crypto/JWT.d.ts +21 -32
- package/dist/src/Crypto/JWT.js +14 -22
- package/dist/src/Crypto/JWT.js.map +1 -1
- package/dist/src/Database/Database.d.ts +18 -0
- package/dist/src/Database/Database.js +18 -0
- package/dist/src/Database/Database.js.map +1 -0
- package/dist/src/Database/DatabaseManager.d.ts +32 -0
- package/dist/src/Database/DatabaseManager.js +50 -0
- package/dist/src/Database/DatabaseManager.js.map +1 -0
- package/dist/src/Database/DatabaseTransaction.d.ts +65 -0
- package/dist/src/Database/DatabaseTransaction.js +183 -0
- package/dist/src/Database/DatabaseTransaction.js.map +1 -0
- package/dist/src/Database/integrations/knex/KnexDatabase.d.ts +22 -0
- package/dist/src/Database/integrations/knex/KnexDatabase.js +108 -0
- package/dist/src/Database/integrations/knex/KnexDatabase.js.map +1 -0
- package/dist/src/Database/integrations/knex/KnexTransaction.d.ts +37 -0
- package/dist/src/Database/integrations/knex/KnexTransaction.js +60 -0
- package/dist/src/Database/integrations/knex/KnexTransaction.js.map +1 -0
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.d.ts +30 -0
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.js +108 -0
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.js.map +1 -0
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.d.ts +37 -0
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.js +60 -0
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.js.map +1 -0
- package/dist/src/Globals.d.ts +26 -94
- package/dist/src/Globals.js +26 -95
- package/dist/src/Globals.js.map +1 -1
- package/dist/src/Logger/Logger.d.ts +82 -105
- package/dist/src/Logger/Logger.js +111 -136
- package/dist/src/Logger/Logger.js.map +1 -1
- package/dist/src/Mailer/Mailer.d.ts +39 -75
- package/dist/src/Mailer/Mailer.js +36 -65
- package/dist/src/Mailer/Mailer.js.map +1 -1
- package/dist/src/Publisher/Publisher.d.ts +17 -25
- package/dist/src/Publisher/Publisher.js +21 -32
- package/dist/src/Publisher/Publisher.js.map +1 -1
- package/dist/src/Server/RouteResolver.d.ts +14 -22
- package/dist/src/Server/RouteResolver.js +21 -34
- package/dist/src/Server/RouteResolver.js.map +1 -1
- package/dist/src/Server/Router.d.ts +72 -51
- package/dist/src/Server/Router.js +8 -17
- package/dist/src/Server/Router.js.map +1 -1
- package/dist/src/Server/lib/ContainerServer.d.ts +15 -31
- package/dist/src/Server/lib/ContainerServer.js +13 -28
- package/dist/src/Server/lib/ContainerServer.js.map +1 -1
- package/dist/src/Server/lib/Server.d.ts +17 -32
- package/dist/src/Server/lib/Server.js +18 -28
- package/dist/src/Server/lib/Server.js.map +1 -1
- package/dist/src/Server/lib/container/GenericHandler.d.ts +5 -0
- package/dist/src/Server/lib/container/GenericHandler.js +16 -3
- package/dist/src/Server/lib/container/GenericHandler.js.map +1 -1
- package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +22 -37
- package/dist/src/Server/lib/container/GenericHandlerEvent.js +29 -41
- package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +1 -1
- package/dist/src/Server/lib/container/HealthHandler.d.ts +6 -0
- package/dist/src/Server/lib/container/HealthHandler.js +6 -0
- package/dist/src/Server/lib/container/HealthHandler.js.map +1 -1
- package/dist/src/Server/lib/container/Proxy.d.ts +24 -52
- package/dist/src/Server/lib/container/Proxy.js +52 -52
- package/dist/src/Server/lib/container/Proxy.js.map +1 -1
- package/dist/src/Server/lib/container/Utils.d.ts +6 -10
- package/dist/src/Server/lib/container/Utils.js +6 -10
- package/dist/src/Server/lib/container/Utils.js.map +1 -1
- package/dist/src/Validation/Validator.d.ts +9 -13
- package/dist/src/Validation/Validator.js +8 -12
- package/dist/src/Validation/Validator.js.map +1 -1
- package/index.ts +15 -0
- package/jest.config.ts +1 -1
- package/package.json +13 -2
- package/src/API/Request.ts +66 -84
- package/src/API/Response.ts +144 -203
- package/src/API/Utils.ts +28 -44
- package/src/BaseEvent/EventProcessor.ts +52 -77
- package/src/BaseEvent/Process.ts +27 -52
- package/src/BaseEvent/Transaction.ts +147 -27
- package/src/Config/Configuration.ts +59 -76
- package/src/Config/EnvironmentVar.ts +39 -62
- package/src/Crypto/Crypto.ts +20 -36
- package/src/Crypto/JWT.ts +31 -35
- package/src/Database/Database.ts +19 -0
- package/src/Database/DatabaseManager.ts +51 -0
- package/src/Database/DatabaseTransaction.ts +118 -0
- package/src/Database/integrations/knex/KnexDatabase.ts +47 -0
- package/src/Database/integrations/knex/KnexTransaction.ts +51 -0
- package/src/Database/integrations/pgsql/PostgresDatabase.ts +49 -0
- package/src/Database/integrations/pgsql/PostgresTransaction.ts +54 -0
- package/src/Database/types.d.ts +49 -0
- package/src/Globals.ts +28 -96
- package/src/Logger/Logger.ts +141 -160
- package/src/Mailer/Mailer.ts +43 -76
- package/src/Publisher/Publisher.ts +31 -40
- package/src/Server/RouteResolver.ts +31 -52
- package/src/Server/Router.ts +75 -54
- package/src/Server/lib/ContainerServer.ts +20 -32
- package/src/Server/lib/Server.ts +19 -34
- package/src/Server/lib/container/GenericHandler.ts +17 -3
- package/src/Server/lib/container/GenericHandlerEvent.ts +44 -54
- package/src/Server/lib/container/HealthHandler.ts +6 -0
- package/src/Server/lib/container/Proxy.ts +39 -58
- package/src/Server/lib/container/Utils.ts +7 -10
- package/src/Validation/Validator.ts +11 -13
- package/tests/API/Response.test.ts +55 -56
- package/tests/BaseEvent/EventProcessor.test.ts +49 -50
- package/tests/BaseEvent/Process.test.ts +2 -2
- package/tests/BaseEvent/Transaction.test.ts +102 -44
- package/tests/Config/Config.test.ts +27 -27
- package/tests/Config/EnvironmentVar.test.ts +54 -18
- package/tests/Database/DatabaseManager.test.ts +55 -0
- package/tests/Database/integrations/knex/KnexDatabase.test.ts +53 -0
- package/tests/Database/integrations/knex/KnexTransaction.test.ts +133 -0
- package/tests/Database/integrations/pg/PostgresDatabase.test.ts +50 -0
- package/tests/Database/integrations/pg/PostgresTransaction.test.ts +51 -0
- package/tests/Publisher/Publisher.test.ts +3 -3
- package/tests/Server/lib/ContainerServer.test.ts +21 -22
- package/tests/Server/lib/container/GenericHandler.test.ts +31 -32
- package/tests/Server/lib/container/GenericHandlerEvent.test.ts +2 -2
- package/tests/Server/lib/container/HealthHandler.test.ts +6 -7
- package/tests/Server/lib/container/Proxy.test.ts +37 -35
- package/tsconfig.json +6 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.PostgresDatabase = void 0;
|
|
55
|
+
var pg_1 = require("pg");
|
|
56
|
+
var PostgresTransaction_1 = require("./PostgresTransaction");
|
|
57
|
+
var Database_1 = require("../../Database");
|
|
58
|
+
/**
|
|
59
|
+
* Represents a Postgres database connection.
|
|
60
|
+
* @extends Database<PostgresTransaction>
|
|
61
|
+
*/
|
|
62
|
+
var PostgresDatabase = /** @class */ (function (_super) {
|
|
63
|
+
__extends(PostgresDatabase, _super);
|
|
64
|
+
/**
|
|
65
|
+
* Constructs a new instance of the class with the given database configuration.
|
|
66
|
+
* @param {DbConfig<'pg'>} config - The configuration object for the PostgreSQL database.
|
|
67
|
+
* @returns None
|
|
68
|
+
*/
|
|
69
|
+
function PostgresDatabase(config) {
|
|
70
|
+
var _this = _super.call(this, config) || this;
|
|
71
|
+
_this.client = new PostgresDatabase.pgProvider({
|
|
72
|
+
host: config.host,
|
|
73
|
+
port: config.port,
|
|
74
|
+
user: config.username,
|
|
75
|
+
password: config.password,
|
|
76
|
+
database: config.database,
|
|
77
|
+
max: config.maxConnections,
|
|
78
|
+
});
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Initiates a new transaction in the PostgreSQL database.
|
|
83
|
+
* @returns {Promise<PostgresTransaction>} A promise that resolves to a PostgresTransaction object representing the new transaction.
|
|
84
|
+
*/
|
|
85
|
+
PostgresDatabase.prototype.transaction = function () {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
var delegate;
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
switch (_a.label) {
|
|
90
|
+
case 0: return [4 /*yield*/, this.client.connect()];
|
|
91
|
+
case 1:
|
|
92
|
+
delegate = _a.sent();
|
|
93
|
+
return [4 /*yield*/, delegate.query('BEGIN')];
|
|
94
|
+
case 2:
|
|
95
|
+
_a.sent();
|
|
96
|
+
return [2 /*return*/, PostgresTransaction_1.PostgresTransactionImpl.wrapDelegate(delegate, this)];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* A private static property that represents a connection pool for a PostgreSQL database.
|
|
103
|
+
*/
|
|
104
|
+
PostgresDatabase.pgProvider = pg_1.Pool;
|
|
105
|
+
return PostgresDatabase;
|
|
106
|
+
}(Database_1.Database));
|
|
107
|
+
exports.PostgresDatabase = PostgresDatabase;
|
|
108
|
+
//# sourceMappingURL=PostgresDatabase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostgresDatabase.js","sourceRoot":"","sources":["../../../../../src/Database/integrations/pgsql/PostgresDatabase.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yBAAyB;AAEzB,6DAAoF;AACpF,2CAAyC;AAGzC;;;GAGG;AACH;IAAsC,oCAA6B;IAYjE;;;;OAIG;IACH,0BAAmB,MAAsB;QAAzC,YACE,kBAAM,MAAM,CAAC,SASd;QARC,KAAI,CAAC,MAAM,GAAG,IAAI,gBAAgB,CAAC,UAAU,CAAC;YAC5C,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,GAAG,EAAE,MAAM,CAAC,cAAc;SAC3B,CAAC,CAAA;;IACJ,CAAC;IAED;;;OAGG;IACmB,sCAAW,GAAjC;;;;;4BACmB,qBAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAA;;wBAAtC,QAAQ,GAAG,SAA2B;wBAC5C,qBAAM,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EAAA;;wBAA7B,SAA6B,CAAA;wBAC7B,sBAAO,6CAAuB,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAA;;;;KAC5D;IApCD;;OAEG;IACY,2BAAU,GAAG,SAAI,CAAA;IAkClC,uBAAC;CAAA,AAtCD,CAAsC,mBAAQ,GAsC7C;AAtCY,4CAAgB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PoolClient } from 'pg';
|
|
2
|
+
import { PostgresDatabase } from './PostgresDatabase';
|
|
3
|
+
import { DatabaseTransaction } from '../../DatabaseTransaction';
|
|
4
|
+
/**
|
|
5
|
+
* A type alias representing a Postgres transaction. It extends the `PostgresTransactionImpl`
|
|
6
|
+
* interface and includes the `PoolClient` interface.
|
|
7
|
+
*/
|
|
8
|
+
export type PostgresTransaction = PostgresTransactionImpl & PoolClient;
|
|
9
|
+
/**
|
|
10
|
+
* Represents a transaction in a Postgres database.
|
|
11
|
+
*/
|
|
12
|
+
export declare class PostgresTransactionImpl extends DatabaseTransaction {
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new instance of the private class.
|
|
15
|
+
* @param {PoolClient} delegate - The delegate object.
|
|
16
|
+
* @param {PostgresDatabase} database - The database object.
|
|
17
|
+
* @returns None
|
|
18
|
+
*/
|
|
19
|
+
private constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Static factory method for creating a new instance, wrapping a delegate PoolClient.
|
|
22
|
+
* @param {PoolClient} delegate - The delegate client to wrap.
|
|
23
|
+
* @param {PostgresDatabase} database - The PostgresDatabase instance associated with the transaction.
|
|
24
|
+
* @returns {PostgresTransaction} - A wrapped PostgresTransaction instance.
|
|
25
|
+
*/
|
|
26
|
+
static wrapDelegate(delegate: PoolClient, database: PostgresDatabase): PostgresTransaction;
|
|
27
|
+
/**
|
|
28
|
+
* Commits the current transaction.
|
|
29
|
+
* @returns A promise that resolves when the commit is successful.
|
|
30
|
+
*/
|
|
31
|
+
protected doCommit(): any;
|
|
32
|
+
/**
|
|
33
|
+
* Performs a rollback operation in the database.
|
|
34
|
+
* @returns A promise that resolves when the rollback operation is completed.
|
|
35
|
+
*/
|
|
36
|
+
protected doRollback(): any;
|
|
37
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.PostgresTransactionImpl = void 0;
|
|
19
|
+
var DatabaseTransaction_1 = require("../../DatabaseTransaction");
|
|
20
|
+
/**
|
|
21
|
+
* Represents a transaction in a Postgres database.
|
|
22
|
+
*/
|
|
23
|
+
var PostgresTransactionImpl = /** @class */ (function (_super) {
|
|
24
|
+
__extends(PostgresTransactionImpl, _super);
|
|
25
|
+
/**
|
|
26
|
+
* Constructs a new instance of the private class.
|
|
27
|
+
* @param {PoolClient} delegate - The delegate object.
|
|
28
|
+
* @param {PostgresDatabase} database - The database object.
|
|
29
|
+
* @returns None
|
|
30
|
+
*/
|
|
31
|
+
function PostgresTransactionImpl(delegate, database) {
|
|
32
|
+
return _super.call(this, delegate, database) || this;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Static factory method for creating a new instance, wrapping a delegate PoolClient.
|
|
36
|
+
* @param {PoolClient} delegate - The delegate client to wrap.
|
|
37
|
+
* @param {PostgresDatabase} database - The PostgresDatabase instance associated with the transaction.
|
|
38
|
+
* @returns {PostgresTransaction} - A wrapped PostgresTransaction instance.
|
|
39
|
+
*/
|
|
40
|
+
PostgresTransactionImpl.wrapDelegate = function (delegate, database) {
|
|
41
|
+
return DatabaseTransaction_1.DatabaseTransaction.wrapInstance(new PostgresTransactionImpl(delegate, database));
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Commits the current transaction.
|
|
45
|
+
* @returns A promise that resolves when the commit is successful.
|
|
46
|
+
*/
|
|
47
|
+
PostgresTransactionImpl.prototype.doCommit = function () {
|
|
48
|
+
return this.delegate.query('COMMIT');
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Performs a rollback operation in the database.
|
|
52
|
+
* @returns A promise that resolves when the rollback operation is completed.
|
|
53
|
+
*/
|
|
54
|
+
PostgresTransactionImpl.prototype.doRollback = function () {
|
|
55
|
+
return this.delegate.query('ROLLBACK');
|
|
56
|
+
};
|
|
57
|
+
return PostgresTransactionImpl;
|
|
58
|
+
}(DatabaseTransaction_1.DatabaseTransaction));
|
|
59
|
+
exports.PostgresTransactionImpl = PostgresTransactionImpl;
|
|
60
|
+
//# sourceMappingURL=PostgresTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostgresTransaction.js","sourceRoot":"","sources":["../../../../../src/Database/integrations/pgsql/PostgresTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAGA,iEAA+D;AAQ/D;;GAEG;AACH;IAA6C,2CAAmB;IAC9D;;;;;OAKG;IACH,iCAAoB,QAAoB,EAAE,QAA0B;eAClE,kBAAM,QAAQ,EAAE,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACW,oCAAY,GAA1B,UACE,QAAoB,EACpB,QAA0B;QAE1B,OAAO,yCAAmB,CAAC,YAAY,CAAC,IAAI,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAQ,CAAA;IACjG,CAAC;IAED;;;OAGG;IACO,0CAAQ,GAAlB;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IACtC,CAAC;IAED;;;OAGG;IACO,4CAAU,GAApB;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC;IACH,8BAAC;AAAD,CAAC,AAvCD,CAA6C,yCAAmB,GAuC/D;AAvCY,0DAAuB"}
|
package/dist/src/Globals.d.ts
CHANGED
|
@@ -1,161 +1,93 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @class Globals
|
|
6
|
-
* @typedef {Globals}
|
|
2
|
+
* Class containing global constants and configurations for the application.
|
|
7
3
|
*/
|
|
8
4
|
export default class Globals {
|
|
9
5
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
* @static
|
|
14
|
-
* @type {string}
|
|
6
|
+
* A constant string representing an error message for input validation failure.
|
|
15
7
|
*/
|
|
16
8
|
static ErrorResponseValidationFail: string;
|
|
17
9
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
* @static
|
|
22
|
-
* @type {string}
|
|
10
|
+
* A constant string representing an error response for an invalid server response.
|
|
23
11
|
*/
|
|
24
12
|
static ErrorResponseInvalidServerResponse: string;
|
|
25
13
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
* @static
|
|
30
|
-
* @type {string}
|
|
14
|
+
* The error message for an unhandled error when processing a request.
|
|
31
15
|
*/
|
|
32
16
|
static ErrorResponseUnhandledError: string;
|
|
33
17
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
* @static
|
|
38
|
-
* @type {string}
|
|
18
|
+
* A static string representing an error response when there are no records to be processed.
|
|
39
19
|
*/
|
|
40
20
|
static ErrorResponseNoRecords: string;
|
|
41
21
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
45
|
-
* @static
|
|
22
|
+
* Represents an error code for a missing parameter.
|
|
46
23
|
* @type {string}
|
|
47
24
|
*/
|
|
48
25
|
static ErrorCode_MissingParam: string;
|
|
49
26
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* @public
|
|
53
|
-
* @static
|
|
27
|
+
* Represents an error code for invalid input.
|
|
54
28
|
* @type {string}
|
|
55
29
|
*/
|
|
56
30
|
static ErrorCode_InvalidInput: string;
|
|
57
31
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @public
|
|
61
|
-
* @static
|
|
32
|
+
* Represents an error code for an API error.
|
|
62
33
|
* @type {string}
|
|
63
34
|
*/
|
|
64
35
|
static ErrorCode_APIError: string;
|
|
65
36
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @public
|
|
69
|
-
* @static
|
|
37
|
+
* Represents the error code for when there are no records found.
|
|
70
38
|
* @type {string}
|
|
71
39
|
*/
|
|
72
40
|
static ErrorCode_NoRecords: string;
|
|
73
41
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @
|
|
78
|
-
* @type {*}
|
|
42
|
+
* Retrieves the default port number for HTTP listeners.
|
|
43
|
+
* The port number is obtained from the environment variable "PORT" and parsed as an integer.
|
|
44
|
+
* If the environment variable is not set or cannot be parsed as an integer, the default port number 9000 is used.
|
|
45
|
+
* @returns {number} - The default port number for HTTP listeners.
|
|
79
46
|
*/
|
|
80
47
|
static Listener_HTTP_DefaultPort: number;
|
|
81
48
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* @public
|
|
85
|
-
* @static
|
|
86
|
-
* @type {string}
|
|
49
|
+
* The default host for the HTTP listener.
|
|
87
50
|
*/
|
|
88
51
|
static Listener_HTTP_DefaultHost: string;
|
|
89
52
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* @public
|
|
93
|
-
* @static
|
|
53
|
+
* The HTTP proxy route listener for all routes.
|
|
94
54
|
* @type {string}
|
|
95
55
|
*/
|
|
96
56
|
static Listener_HTTP_ProxyRoute: string;
|
|
97
57
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @public
|
|
101
|
-
* @static
|
|
102
|
-
* @type {*}
|
|
58
|
+
* Retrieves the default timeout value for HTTP listeners.
|
|
59
|
+
* @returns {number} The default timeout value in milliseconds.
|
|
103
60
|
*/
|
|
104
61
|
static Listener_HTTP_DefaultTimeout: number;
|
|
105
62
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* @public
|
|
109
|
-
* @static
|
|
110
|
-
* @type {*}
|
|
63
|
+
* The default health check route for the HTTP listener.
|
|
64
|
+
* @type {string}
|
|
111
65
|
*/
|
|
112
66
|
static Listener_HTTP_DefaultHealthCheckRoute: string;
|
|
113
67
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* @public
|
|
117
|
-
* @static
|
|
118
|
-
* @type {string}
|
|
68
|
+
* The response message for an exception that occurred during request execution in the Proxy.
|
|
119
69
|
*/
|
|
120
70
|
static Resp_MSG_EXCEPTION: string;
|
|
121
71
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* @public
|
|
125
|
-
* @static
|
|
126
|
-
* @type {string}
|
|
72
|
+
* The response code for an exception that occurred during execution.
|
|
127
73
|
*/
|
|
128
74
|
static Resp_CODE_EXCEPTION: string;
|
|
129
75
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* @public
|
|
133
|
-
* @static
|
|
134
|
-
* @type {number}
|
|
76
|
+
* The HTTP response status code for an exception scenario.
|
|
135
77
|
*/
|
|
136
78
|
static Resp_STATUSCODE_EXCEPTION: number;
|
|
137
79
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* @public
|
|
141
|
-
* @static
|
|
142
|
-
* @type {string}
|
|
80
|
+
* The error message for an invalid response from the server.
|
|
143
81
|
*/
|
|
144
82
|
static Resp_MSG_INVALIDRESP: string;
|
|
145
83
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* @public
|
|
149
|
-
* @static
|
|
150
|
-
* @type {string}
|
|
84
|
+
* Represents the response code for an invalid response.
|
|
151
85
|
*/
|
|
152
86
|
static Resp_CODE_INVALIDRESP: string;
|
|
153
87
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* @public
|
|
157
|
-
* @static
|
|
88
|
+
* The HTTP response status code for an invalid response.
|
|
158
89
|
* @type {number}
|
|
90
|
+
* @default 400
|
|
159
91
|
*/
|
|
160
92
|
static Resp_STATUSCODE_INVALIDRESP: number;
|
|
161
93
|
}
|
package/dist/src/Globals.js
CHANGED
|
@@ -5,166 +5,97 @@ var Utils_1 = require("./API/Utils");
|
|
|
5
5
|
// important for dev env to load .env file
|
|
6
6
|
dotenv.config();
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @export
|
|
11
|
-
* @class Globals
|
|
12
|
-
* @typedef {Globals}
|
|
8
|
+
* Class containing global constants and configurations for the application.
|
|
13
9
|
*/
|
|
14
10
|
var Globals = /** @class */ (function () {
|
|
15
11
|
function Globals() {
|
|
16
12
|
}
|
|
17
13
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
* @static
|
|
22
|
-
* @type {string}
|
|
14
|
+
* A constant string representing an error message for input validation failure.
|
|
23
15
|
*/
|
|
24
16
|
Globals.ErrorResponseValidationFail = 'Input validation failed: '; //400
|
|
25
17
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
* @static
|
|
30
|
-
* @type {string}
|
|
18
|
+
* A constant string representing an error response for an invalid server response.
|
|
31
19
|
*/
|
|
32
20
|
Globals.ErrorResponseInvalidServerResponse = 'No valid response, this is a system error.'; //400
|
|
33
21
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
* @static
|
|
38
|
-
* @type {string}
|
|
22
|
+
* The error message for an unhandled error when processing a request.
|
|
39
23
|
*/
|
|
40
24
|
Globals.ErrorResponseUnhandledError = 'Unhandled error when processing request.'; //400
|
|
41
25
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
45
|
-
* @static
|
|
46
|
-
* @type {string}
|
|
26
|
+
* A static string representing an error response when there are no records to be processed.
|
|
47
27
|
*/
|
|
48
28
|
Globals.ErrorResponseNoRecords = 'No events to be processed.'; //400
|
|
49
29
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* @public
|
|
53
|
-
* @static
|
|
30
|
+
* Represents an error code for a missing parameter.
|
|
54
31
|
* @type {string}
|
|
55
32
|
*/
|
|
56
33
|
Globals.ErrorCode_MissingParam = 'MISSING_PARAM';
|
|
57
34
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @public
|
|
61
|
-
* @static
|
|
35
|
+
* Represents an error code for invalid input.
|
|
62
36
|
* @type {string}
|
|
63
37
|
*/
|
|
64
38
|
Globals.ErrorCode_InvalidInput = 'INVALID_INPUT';
|
|
65
39
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @public
|
|
69
|
-
* @static
|
|
40
|
+
* Represents an error code for an API error.
|
|
70
41
|
* @type {string}
|
|
71
42
|
*/
|
|
72
43
|
Globals.ErrorCode_APIError = 'API_ERROR';
|
|
73
44
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* @public
|
|
77
|
-
* @static
|
|
45
|
+
* Represents the error code for when there are no records found.
|
|
78
46
|
* @type {string}
|
|
79
47
|
*/
|
|
80
48
|
Globals.ErrorCode_NoRecords = 'EMPTY_EVENT';
|
|
81
49
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @
|
|
86
|
-
* @type {*}
|
|
50
|
+
* Retrieves the default port number for HTTP listeners.
|
|
51
|
+
* The port number is obtained from the environment variable "PORT" and parsed as an integer.
|
|
52
|
+
* If the environment variable is not set or cannot be parsed as an integer, the default port number 9000 is used.
|
|
53
|
+
* @returns {number} - The default port number for HTTP listeners.
|
|
87
54
|
*/
|
|
88
55
|
Globals.Listener_HTTP_DefaultPort = Utils_1.default.parseIntNullIfNaN(process.env.PORT) || 9000;
|
|
89
56
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* @public
|
|
93
|
-
* @static
|
|
94
|
-
* @type {string}
|
|
57
|
+
* The default host for the HTTP listener.
|
|
95
58
|
*/
|
|
96
59
|
Globals.Listener_HTTP_DefaultHost = 'localhost';
|
|
97
60
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @public
|
|
101
|
-
* @static
|
|
61
|
+
* The HTTP proxy route listener for all routes.
|
|
102
62
|
* @type {string}
|
|
103
63
|
*/
|
|
104
64
|
Globals.Listener_HTTP_ProxyRoute = '*';
|
|
105
65
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* @public
|
|
109
|
-
* @static
|
|
110
|
-
* @type {*}
|
|
66
|
+
* Retrieves the default timeout value for HTTP listeners.
|
|
67
|
+
* @returns {number} The default timeout value in milliseconds.
|
|
111
68
|
*/
|
|
112
69
|
Globals.Listener_HTTP_DefaultTimeout = Utils_1.default.parseIntNullIfNaN(process.env.TIMEOUT) || 30000;
|
|
113
70
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* @public
|
|
117
|
-
* @static
|
|
118
|
-
* @type {*}
|
|
71
|
+
* The default health check route for the HTTP listener.
|
|
72
|
+
* @type {string}
|
|
119
73
|
*/
|
|
120
74
|
Globals.Listener_HTTP_DefaultHealthCheckRoute = process.env.HEALTH_ROUTE || '/health';
|
|
121
|
-
//Resps
|
|
122
75
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* @public
|
|
126
|
-
* @static
|
|
127
|
-
* @type {string}
|
|
76
|
+
* The response message for an exception that occurred during request execution in the Proxy.
|
|
128
77
|
*/
|
|
129
78
|
Globals.Resp_MSG_EXCEPTION = '[Proxy]: Exception during request execution!';
|
|
130
79
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* @public
|
|
134
|
-
* @static
|
|
135
|
-
* @type {string}
|
|
80
|
+
* The response code for an exception that occurred during execution.
|
|
136
81
|
*/
|
|
137
82
|
Globals.Resp_CODE_EXCEPTION = 'EXEC_EXCEPTION';
|
|
138
83
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* @public
|
|
142
|
-
* @static
|
|
143
|
-
* @type {number}
|
|
84
|
+
* The HTTP response status code for an exception scenario.
|
|
144
85
|
*/
|
|
145
86
|
Globals.Resp_STATUSCODE_EXCEPTION = 502;
|
|
146
87
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* @public
|
|
150
|
-
* @static
|
|
151
|
-
* @type {string}
|
|
88
|
+
* The error message for an invalid response from the server.
|
|
152
89
|
*/
|
|
153
90
|
Globals.Resp_MSG_INVALIDRESP = '[Proxy]: Invalid response from server!';
|
|
154
91
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* @public
|
|
158
|
-
* @static
|
|
159
|
-
* @type {string}
|
|
92
|
+
* Represents the response code for an invalid response.
|
|
160
93
|
*/
|
|
161
94
|
Globals.Resp_CODE_INVALIDRESP = 'EMPTY_RESPONSE';
|
|
162
95
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* @public
|
|
166
|
-
* @static
|
|
96
|
+
* The HTTP response status code for an invalid response.
|
|
167
97
|
* @type {number}
|
|
98
|
+
* @default 400
|
|
168
99
|
*/
|
|
169
100
|
Globals.Resp_STATUSCODE_INVALIDRESP = 400;
|
|
170
101
|
return Globals;
|
package/dist/src/Globals.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Globals.js","sourceRoot":"","sources":["../../src/Globals.ts"],"names":[],"mappings":";;AAAA,+BAAgC;AAEhC,qCAA+B;AAE/B,0CAA0C;AAC1C,MAAM,CAAC,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"Globals.js","sourceRoot":"","sources":["../../src/Globals.ts"],"names":[],"mappings":";;AAAA,+BAAgC;AAEhC,qCAA+B;AAE/B,0CAA0C;AAC1C,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf;;GAEG;AACH;IAAA;IA4FA,CAAC;IA3FC;;OAEG;IACW,mCAA2B,GAAG,2BAA2B,CAAA,CAAC,KAAK;IAC7E;;OAEG;IACW,0CAAkC,GAAG,4CAA4C,CAAA,CAAC,KAAK;IACrG;;OAEG;IACW,mCAA2B,GAAG,0CAA0C,CAAA,CAAC,KAAK;IAC5F;;OAEG;IACW,8BAAsB,GAAG,4BAA4B,CAAA,CAAC,KAAK;IACzE;;;OAGG;IACW,8BAAsB,GAAG,eAAe,CAAA;IACtD;;;OAGG;IACW,8BAAsB,GAAG,eAAe,CAAA;IACtD;;;OAGG;IACW,0BAAkB,GAAG,WAAW,CAAA;IAC9C;;;OAGG;IACW,2BAAmB,GAAG,aAAa,CAAA;IAEjD;;;;;OAKG;IACW,iCAAyB,GAAG,eAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA;IAC3F;;OAEG;IACW,iCAAyB,GAAG,WAAW,CAAA;IACrD;;;OAGG;IACW,gCAAwB,GAAG,GAAG,CAAA;IAC5C;;;OAGG;IACW,oCAA4B,GAAG,eAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAA;IAClG;;;OAGG;IACW,6CAAqC,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,SAAS,CAAA;IAE3F;;OAEG;IACW,0BAAkB,GAAG,8CAA8C,CAAA;IACjF;;OAEG;IACW,2BAAmB,GAAG,gBAAgB,CAAA;IACpD;;OAEG;IACW,iCAAyB,GAAG,GAAG,CAAA;IAE7C;;OAEG;IACW,4BAAoB,GAAG,wCAAwC,CAAA;IAC7E;;OAEG;IACW,6BAAqB,GAAG,gBAAgB,CAAA;IACtD;;;;OAIG;IACW,mCAA2B,GAAG,GAAG,CAAA;IACjD,cAAC;CAAA,AA5FD,IA4FC;kBA5FoB,OAAO"}
|