@creator.co/wapi 1.2.3 → 1.2.5

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.
Files changed (121) hide show
  1. package/.github/workflows/npmpublish.yml +2 -5
  2. package/README.md +1 -3
  3. package/dist/index.d.ts +11 -0
  4. package/dist/index.js +24 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/jest.config.d.ts +3 -0
  7. package/dist/jest.config.js +34 -0
  8. package/dist/jest.config.js.map +1 -0
  9. package/dist/package.json +70 -0
  10. package/dist/src/API/Request.d.ts +140 -0
  11. package/dist/src/API/Request.js +182 -0
  12. package/dist/src/API/Request.js.map +1 -0
  13. package/dist/src/API/Response.d.ts +256 -0
  14. package/dist/src/API/Response.js +398 -0
  15. package/dist/src/API/Response.js.map +1 -0
  16. package/dist/src/API/Utils.d.ts +63 -0
  17. package/dist/src/API/Utils.js +104 -0
  18. package/dist/src/API/Utils.js.map +1 -0
  19. package/dist/src/BaseEvent/EventProcessor.d.ts +81 -0
  20. package/dist/src/BaseEvent/EventProcessor.js +182 -0
  21. package/dist/src/BaseEvent/EventProcessor.js.map +1 -0
  22. package/dist/src/BaseEvent/Process.d.ts +74 -0
  23. package/dist/src/BaseEvent/Process.js +142 -0
  24. package/dist/src/BaseEvent/Process.js.map +1 -0
  25. package/dist/src/BaseEvent/Transaction.d.ts +39 -0
  26. package/dist/src/BaseEvent/Transaction.js +354 -0
  27. package/dist/src/BaseEvent/Transaction.js.map +1 -0
  28. package/dist/src/Config/Configuration.d.ts +131 -0
  29. package/dist/src/Config/Configuration.js +153 -0
  30. package/dist/src/Config/Configuration.js.map +1 -0
  31. package/dist/src/Config/EnvironmentVar.d.ts +101 -0
  32. package/dist/src/Config/EnvironmentVar.js +213 -0
  33. package/dist/src/Config/EnvironmentVar.js.map +1 -0
  34. package/dist/src/Crypto/Crypto.d.ts +57 -0
  35. package/dist/src/Crypto/Crypto.js +126 -0
  36. package/dist/src/Crypto/Crypto.js.map +1 -0
  37. package/dist/src/Crypto/JWT.d.ts +64 -0
  38. package/dist/src/Crypto/JWT.js +74 -0
  39. package/dist/src/Crypto/JWT.js.map +1 -0
  40. package/dist/src/Database/Database.d.ts +18 -0
  41. package/dist/src/Database/Database.js +18 -0
  42. package/dist/src/Database/Database.js.map +1 -0
  43. package/dist/src/Database/DatabaseManager.d.ts +32 -0
  44. package/dist/src/Database/DatabaseManager.js +50 -0
  45. package/dist/src/Database/DatabaseManager.js.map +1 -0
  46. package/dist/src/Database/DatabaseTransaction.d.ts +65 -0
  47. package/dist/src/Database/DatabaseTransaction.js +183 -0
  48. package/dist/src/Database/DatabaseTransaction.js.map +1 -0
  49. package/dist/src/Database/integrations/knex/KnexDatabase.d.ts +22 -0
  50. package/dist/src/Database/integrations/knex/KnexDatabase.js +108 -0
  51. package/dist/src/Database/integrations/knex/KnexDatabase.js.map +1 -0
  52. package/dist/src/Database/integrations/knex/KnexTransaction.d.ts +37 -0
  53. package/dist/src/Database/integrations/knex/KnexTransaction.js +60 -0
  54. package/dist/src/Database/integrations/knex/KnexTransaction.js.map +1 -0
  55. package/dist/src/Database/integrations/pgsql/PostgresDatabase.d.ts +30 -0
  56. package/dist/src/Database/integrations/pgsql/PostgresDatabase.js +108 -0
  57. package/dist/src/Database/integrations/pgsql/PostgresDatabase.js.map +1 -0
  58. package/dist/src/Database/integrations/pgsql/PostgresTransaction.d.ts +37 -0
  59. package/dist/src/Database/integrations/pgsql/PostgresTransaction.js +60 -0
  60. package/dist/src/Database/integrations/pgsql/PostgresTransaction.js.map +1 -0
  61. package/dist/src/Globals.d.ts +161 -0
  62. package/dist/src/Globals.js +173 -0
  63. package/dist/src/Globals.js.map +1 -0
  64. package/dist/src/Logger/Logger.d.ts +180 -0
  65. package/dist/src/Logger/Logger.js +412 -0
  66. package/dist/src/Logger/Logger.js.map +1 -0
  67. package/dist/src/Mailer/Mailer.d.ts +107 -0
  68. package/dist/src/Mailer/Mailer.js +313 -0
  69. package/dist/src/Mailer/Mailer.js.map +1 -0
  70. package/dist/src/Publisher/Publisher.d.ts +47 -0
  71. package/dist/src/Publisher/Publisher.js +141 -0
  72. package/dist/src/Publisher/Publisher.js.map +1 -0
  73. package/dist/src/Server/RouteResolver.d.ts +41 -0
  74. package/dist/src/Server/RouteResolver.js +135 -0
  75. package/dist/src/Server/RouteResolver.js.map +1 -0
  76. package/dist/src/Server/Router.d.ts +104 -0
  77. package/dist/src/Server/Router.js +45 -0
  78. package/dist/src/Server/Router.js.map +1 -0
  79. package/dist/src/Server/lib/ContainerServer.d.ts +58 -0
  80. package/dist/src/Server/lib/ContainerServer.js +143 -0
  81. package/dist/src/Server/lib/ContainerServer.js.map +1 -0
  82. package/dist/src/Server/lib/Server.d.ts +60 -0
  83. package/dist/src/Server/lib/Server.js +137 -0
  84. package/dist/src/Server/lib/Server.js.map +1 -0
  85. package/dist/src/Server/lib/container/GenericHandler.d.ts +4 -0
  86. package/dist/src/Server/lib/container/GenericHandler.js +138 -0
  87. package/dist/src/Server/lib/container/GenericHandler.js.map +1 -0
  88. package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +67 -0
  89. package/dist/src/Server/lib/container/GenericHandlerEvent.js +189 -0
  90. package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +1 -0
  91. package/dist/src/Server/lib/container/HealthHandler.d.ts +3 -0
  92. package/dist/src/Server/lib/container/HealthHandler.js +45 -0
  93. package/dist/src/Server/lib/container/HealthHandler.js.map +1 -0
  94. package/dist/src/Server/lib/container/Proxy.d.ts +95 -0
  95. package/dist/src/Server/lib/container/Proxy.js +202 -0
  96. package/dist/src/Server/lib/container/Proxy.js.map +1 -0
  97. package/dist/src/Server/lib/container/Utils.d.ts +18 -0
  98. package/dist/src/Server/lib/container/Utils.js +84 -0
  99. package/dist/src/Server/lib/container/Utils.js.map +1 -0
  100. package/dist/src/Validation/Validator.d.ts +21 -0
  101. package/dist/src/Validation/Validator.js +48 -0
  102. package/dist/src/Validation/Validator.js.map +1 -0
  103. package/jest.config.ts +2 -9
  104. package/package.json +10 -4
  105. package/src/BaseEvent/Transaction.ts +48 -18
  106. package/src/Database/Database.ts +19 -0
  107. package/src/Database/DatabaseManager.ts +51 -0
  108. package/src/Database/DatabaseTransaction.ts +118 -0
  109. package/src/Database/integrations/knex/KnexDatabase.ts +47 -0
  110. package/src/Database/integrations/knex/KnexTransaction.ts +51 -0
  111. package/src/Database/integrations/pgsql/PostgresDatabase.ts +49 -0
  112. package/src/Database/integrations/pgsql/PostgresTransaction.ts +54 -0
  113. package/src/Database/types.d.ts +49 -0
  114. package/src/Server/lib/container/Proxy.ts +2 -1
  115. package/tests/BaseEvent/Transaction.test.ts +59 -0
  116. package/tests/Database/DatabaseManager.test.ts +55 -0
  117. package/tests/Database/integrations/knex/KnexDatabase.test.ts +53 -0
  118. package/tests/Database/integrations/knex/KnexTransaction.test.ts +133 -0
  119. package/tests/Database/integrations/pg/PostgresDatabase.test.ts +50 -0
  120. package/tests/Database/integrations/pg/PostgresTransaction.test.ts +51 -0
  121. package/tsconfig.json +5 -0
@@ -0,0 +1,37 @@
1
+ import { Knex } from 'knex';
2
+ import { KnexDatabase } from './KnexDatabase';
3
+ import { DatabaseTransaction } from '../../DatabaseTransaction';
4
+ /**
5
+ * A type alias for a Knex transaction object.
6
+ * @typedef {KnexTransactionImpl & Knex.Transaction} KnexTransaction
7
+ */
8
+ export type KnexTransaction = KnexTransactionImpl & Knex.Transaction;
9
+ /**
10
+ * Implementation of a Knex transaction that extends the DatabaseTransaction class.
11
+ */
12
+ export declare class KnexTransactionImpl extends DatabaseTransaction {
13
+ /**
14
+ * Constructs a new instance of the private class.
15
+ * @param {Knex.Transaction} delegate - The delegate transaction object.
16
+ * @param {KnexDatabase} database - The database object.
17
+ * @returns None
18
+ */
19
+ private constructor();
20
+ /**
21
+ * Wraps a delegate transaction object with a custom implementation of the KnexTransaction interface.
22
+ * @param {Knex.Transaction} delegate - The delegate transaction object to wrap.
23
+ * @param {KnexDatabase} database - The KnexDatabase instance associated with the transaction.
24
+ * @returns {KnexTransaction} - The wrapped transaction object.
25
+ */
26
+ static wrapDelegate(delegate: Knex.Transaction, database: KnexDatabase): KnexTransaction;
27
+ /**
28
+ * Commits the changes made by the delegate object.
29
+ * @returns None
30
+ */
31
+ protected doCommit(): any;
32
+ /**
33
+ * Performs a rollback operation by calling the rollback method of the delegate object.
34
+ * @returns None
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.KnexTransactionImpl = void 0;
19
+ var DatabaseTransaction_1 = require("../../DatabaseTransaction");
20
+ /**
21
+ * Implementation of a Knex transaction that extends the DatabaseTransaction class.
22
+ */
23
+ var KnexTransactionImpl = /** @class */ (function (_super) {
24
+ __extends(KnexTransactionImpl, _super);
25
+ /**
26
+ * Constructs a new instance of the private class.
27
+ * @param {Knex.Transaction} delegate - The delegate transaction object.
28
+ * @param {KnexDatabase} database - The database object.
29
+ * @returns None
30
+ */
31
+ function KnexTransactionImpl(delegate, database) {
32
+ return _super.call(this, delegate, database) || this;
33
+ }
34
+ /**
35
+ * Wraps a delegate transaction object with a custom implementation of the KnexTransaction interface.
36
+ * @param {Knex.Transaction} delegate - The delegate transaction object to wrap.
37
+ * @param {KnexDatabase} database - The KnexDatabase instance associated with the transaction.
38
+ * @returns {KnexTransaction} - The wrapped transaction object.
39
+ */
40
+ KnexTransactionImpl.wrapDelegate = function (delegate, database) {
41
+ return DatabaseTransaction_1.DatabaseTransaction.wrapInstance(new KnexTransactionImpl(delegate, database));
42
+ };
43
+ /**
44
+ * Commits the changes made by the delegate object.
45
+ * @returns None
46
+ */
47
+ KnexTransactionImpl.prototype.doCommit = function () {
48
+ return this.delegate.commit();
49
+ };
50
+ /**
51
+ * Performs a rollback operation by calling the rollback method of the delegate object.
52
+ * @returns None
53
+ */
54
+ KnexTransactionImpl.prototype.doRollback = function () {
55
+ return this.delegate.rollback();
56
+ };
57
+ return KnexTransactionImpl;
58
+ }(DatabaseTransaction_1.DatabaseTransaction));
59
+ exports.KnexTransactionImpl = KnexTransactionImpl;
60
+ //# sourceMappingURL=KnexTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnexTransaction.js","sourceRoot":"","sources":["../../../../../src/Database/integrations/knex/KnexTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAGA,iEAA+D;AAQ/D;;GAEG;AACH;IAAyC,uCAAmB;IAC1D;;;;;OAKG;IACH,6BAAoB,QAA0B,EAAE,QAAsB;eACpE,kBAAM,QAAQ,EAAE,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACW,gCAAY,GAA1B,UAA2B,QAA0B,EAAE,QAAsB;QAC3E,OAAO,yCAAmB,CAAC,YAAY,CAAC,IAAI,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAQ,CAAA;IAC7F,CAAC;IAED;;;OAGG;IACO,sCAAQ,GAAlB;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAA;IAC/B,CAAC;IAED;;;OAGG;IACO,wCAAU,GAApB;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAA;IACjC,CAAC;IACH,0BAAC;AAAD,CAAC,AApCD,CAAyC,yCAAmB,GAoC3D;AApCY,kDAAmB"}
@@ -0,0 +1,30 @@
1
+ import { PostgresTransaction } from './PostgresTransaction';
2
+ import { Database } from '../../Database';
3
+ import type { DbConfig } from '../../types';
4
+ /**
5
+ * Represents a Postgres database connection.
6
+ * @extends Database<PostgresTransaction>
7
+ */
8
+ export declare class PostgresDatabase extends Database<PostgresTransaction> {
9
+ /**
10
+ * A private static property that represents a connection pool for a PostgreSQL database.
11
+ */
12
+ private static pgProvider;
13
+ /**
14
+ * The client property represents a connection pool to a database.
15
+ * @private
16
+ * @type {Pool}
17
+ */
18
+ private client;
19
+ /**
20
+ * Constructs a new instance of the class with the given database configuration.
21
+ * @param {DbConfig<'pg'>} config - The configuration object for the PostgreSQL database.
22
+ * @returns None
23
+ */
24
+ constructor(config: DbConfig<'pg'>);
25
+ /**
26
+ * Initiates a new transaction in the PostgreSQL database.
27
+ * @returns {Promise<PostgresTransaction>} A promise that resolves to a PostgresTransaction object representing the new transaction.
28
+ */
29
+ transaction(): Promise<PostgresTransaction>;
30
+ }
@@ -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"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Description placeholder
3
+ *
4
+ * @export
5
+ * @class Globals
6
+ * @typedef {Globals}
7
+ */
8
+ export default class Globals {
9
+ /**
10
+ * Description placeholder
11
+ *
12
+ * @public
13
+ * @static
14
+ * @type {string}
15
+ */
16
+ static ErrorResponseValidationFail: string;
17
+ /**
18
+ * Description placeholder
19
+ *
20
+ * @public
21
+ * @static
22
+ * @type {string}
23
+ */
24
+ static ErrorResponseInvalidServerResponse: string;
25
+ /**
26
+ * Description placeholder
27
+ *
28
+ * @public
29
+ * @static
30
+ * @type {string}
31
+ */
32
+ static ErrorResponseUnhandledError: string;
33
+ /**
34
+ * Description placeholder
35
+ *
36
+ * @public
37
+ * @static
38
+ * @type {string}
39
+ */
40
+ static ErrorResponseNoRecords: string;
41
+ /**
42
+ * Description placeholder
43
+ *
44
+ * @public
45
+ * @static
46
+ * @type {string}
47
+ */
48
+ static ErrorCode_MissingParam: string;
49
+ /**
50
+ * Description placeholder
51
+ *
52
+ * @public
53
+ * @static
54
+ * @type {string}
55
+ */
56
+ static ErrorCode_InvalidInput: string;
57
+ /**
58
+ * Description placeholder
59
+ *
60
+ * @public
61
+ * @static
62
+ * @type {string}
63
+ */
64
+ static ErrorCode_APIError: string;
65
+ /**
66
+ * Description placeholder
67
+ *
68
+ * @public
69
+ * @static
70
+ * @type {string}
71
+ */
72
+ static ErrorCode_NoRecords: string;
73
+ /**
74
+ * Description placeholder
75
+ *
76
+ * @public
77
+ * @static
78
+ * @type {*}
79
+ */
80
+ static Listener_HTTP_DefaultPort: number;
81
+ /**
82
+ * Description placeholder
83
+ *
84
+ * @public
85
+ * @static
86
+ * @type {string}
87
+ */
88
+ static Listener_HTTP_DefaultHost: string;
89
+ /**
90
+ * Description placeholder
91
+ *
92
+ * @public
93
+ * @static
94
+ * @type {string}
95
+ */
96
+ static Listener_HTTP_ProxyRoute: string;
97
+ /**
98
+ * Description placeholder
99
+ *
100
+ * @public
101
+ * @static
102
+ * @type {*}
103
+ */
104
+ static Listener_HTTP_DefaultTimeout: number;
105
+ /**
106
+ * Description placeholder
107
+ *
108
+ * @public
109
+ * @static
110
+ * @type {*}
111
+ */
112
+ static Listener_HTTP_DefaultHealthCheckRoute: string;
113
+ /**
114
+ * Description placeholder
115
+ *
116
+ * @public
117
+ * @static
118
+ * @type {string}
119
+ */
120
+ static Resp_MSG_EXCEPTION: string;
121
+ /**
122
+ * Description placeholder
123
+ *
124
+ * @public
125
+ * @static
126
+ * @type {string}
127
+ */
128
+ static Resp_CODE_EXCEPTION: string;
129
+ /**
130
+ * Description placeholder
131
+ *
132
+ * @public
133
+ * @static
134
+ * @type {number}
135
+ */
136
+ static Resp_STATUSCODE_EXCEPTION: number;
137
+ /**
138
+ * Description placeholder
139
+ *
140
+ * @public
141
+ * @static
142
+ * @type {string}
143
+ */
144
+ static Resp_MSG_INVALIDRESP: string;
145
+ /**
146
+ * Description placeholder
147
+ *
148
+ * @public
149
+ * @static
150
+ * @type {string}
151
+ */
152
+ static Resp_CODE_INVALIDRESP: string;
153
+ /**
154
+ * Description placeholder
155
+ *
156
+ * @public
157
+ * @static
158
+ * @type {number}
159
+ */
160
+ static Resp_STATUSCODE_INVALIDRESP: number;
161
+ }
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var dotenv = require("dotenv");
4
+ var Utils_1 = require("./API/Utils");
5
+ // important for dev env to load .env file
6
+ dotenv.config();
7
+ /**
8
+ * Description placeholder
9
+ *
10
+ * @export
11
+ * @class Globals
12
+ * @typedef {Globals}
13
+ */
14
+ var Globals = /** @class */ (function () {
15
+ function Globals() {
16
+ }
17
+ /**
18
+ * Description placeholder
19
+ *
20
+ * @public
21
+ * @static
22
+ * @type {string}
23
+ */
24
+ Globals.ErrorResponseValidationFail = 'Input validation failed: '; //400
25
+ /**
26
+ * Description placeholder
27
+ *
28
+ * @public
29
+ * @static
30
+ * @type {string}
31
+ */
32
+ Globals.ErrorResponseInvalidServerResponse = 'No valid response, this is a system error.'; //400
33
+ /**
34
+ * Description placeholder
35
+ *
36
+ * @public
37
+ * @static
38
+ * @type {string}
39
+ */
40
+ Globals.ErrorResponseUnhandledError = 'Unhandled error when processing request.'; //400
41
+ /**
42
+ * Description placeholder
43
+ *
44
+ * @public
45
+ * @static
46
+ * @type {string}
47
+ */
48
+ Globals.ErrorResponseNoRecords = 'No events to be processed.'; //400
49
+ /**
50
+ * Description placeholder
51
+ *
52
+ * @public
53
+ * @static
54
+ * @type {string}
55
+ */
56
+ Globals.ErrorCode_MissingParam = 'MISSING_PARAM';
57
+ /**
58
+ * Description placeholder
59
+ *
60
+ * @public
61
+ * @static
62
+ * @type {string}
63
+ */
64
+ Globals.ErrorCode_InvalidInput = 'INVALID_INPUT';
65
+ /**
66
+ * Description placeholder
67
+ *
68
+ * @public
69
+ * @static
70
+ * @type {string}
71
+ */
72
+ Globals.ErrorCode_APIError = 'API_ERROR';
73
+ /**
74
+ * Description placeholder
75
+ *
76
+ * @public
77
+ * @static
78
+ * @type {string}
79
+ */
80
+ Globals.ErrorCode_NoRecords = 'EMPTY_EVENT';
81
+ /**
82
+ * Description placeholder
83
+ *
84
+ * @public
85
+ * @static
86
+ * @type {*}
87
+ */
88
+ Globals.Listener_HTTP_DefaultPort = Utils_1.default.parseIntNullIfNaN(process.env.PORT) || 9000;
89
+ /**
90
+ * Description placeholder
91
+ *
92
+ * @public
93
+ * @static
94
+ * @type {string}
95
+ */
96
+ Globals.Listener_HTTP_DefaultHost = 'localhost';
97
+ /**
98
+ * Description placeholder
99
+ *
100
+ * @public
101
+ * @static
102
+ * @type {string}
103
+ */
104
+ Globals.Listener_HTTP_ProxyRoute = '*';
105
+ /**
106
+ * Description placeholder
107
+ *
108
+ * @public
109
+ * @static
110
+ * @type {*}
111
+ */
112
+ Globals.Listener_HTTP_DefaultTimeout = Utils_1.default.parseIntNullIfNaN(process.env.TIMEOUT) || 30000;
113
+ /**
114
+ * Description placeholder
115
+ *
116
+ * @public
117
+ * @static
118
+ * @type {*}
119
+ */
120
+ Globals.Listener_HTTP_DefaultHealthCheckRoute = process.env.HEALTH_ROUTE || '/health';
121
+ //Resps
122
+ /**
123
+ * Description placeholder
124
+ *
125
+ * @public
126
+ * @static
127
+ * @type {string}
128
+ */
129
+ Globals.Resp_MSG_EXCEPTION = '[Proxy]: Exception during request execution!';
130
+ /**
131
+ * Description placeholder
132
+ *
133
+ * @public
134
+ * @static
135
+ * @type {string}
136
+ */
137
+ Globals.Resp_CODE_EXCEPTION = 'EXEC_EXCEPTION';
138
+ /**
139
+ * Description placeholder
140
+ *
141
+ * @public
142
+ * @static
143
+ * @type {number}
144
+ */
145
+ Globals.Resp_STATUSCODE_EXCEPTION = 502;
146
+ /**
147
+ * Description placeholder
148
+ *
149
+ * @public
150
+ * @static
151
+ * @type {string}
152
+ */
153
+ Globals.Resp_MSG_INVALIDRESP = '[Proxy]: Invalid response from server!';
154
+ /**
155
+ * Description placeholder
156
+ *
157
+ * @public
158
+ * @static
159
+ * @type {string}
160
+ */
161
+ Globals.Resp_CODE_INVALIDRESP = 'EMPTY_RESPONSE';
162
+ /**
163
+ * Description placeholder
164
+ *
165
+ * @public
166
+ * @static
167
+ * @type {number}
168
+ */
169
+ Globals.Resp_STATUSCODE_INVALIDRESP = 400;
170
+ return Globals;
171
+ }());
172
+ exports.default = Globals;
173
+ //# sourceMappingURL=Globals.js.map
@@ -0,0 +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;AACf;;;;;;GAMG;AACH;IAAA;IA6JA,CAAC;IA5JC;;;;;;OAMG;IACW,mCAA2B,GAAG,2BAA2B,CAAA,CAAC,KAAK;IAC7E;;;;;;OAMG;IACW,0CAAkC,GAAG,4CAA4C,CAAA,CAAC,KAAK;IACrG;;;;;;OAMG;IACW,mCAA2B,GAAG,0CAA0C,CAAA,CAAC,KAAK;IAC5F;;;;;;OAMG;IACW,8BAAsB,GAAG,4BAA4B,CAAA,CAAC,KAAK;IACzE;;;;;;OAMG;IACW,8BAAsB,GAAG,eAAe,CAAA;IACtD;;;;;;OAMG;IACW,8BAAsB,GAAG,eAAe,CAAA;IACtD;;;;;;OAMG;IACW,0BAAkB,GAAG,WAAW,CAAA;IAC9C;;;;;;OAMG;IACW,2BAAmB,GAAG,aAAa,CAAA;IAEjD;;;;;;OAMG;IACW,iCAAyB,GAAG,eAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA;IAE3F;;;;;;OAMG;IACW,iCAAyB,GAAG,WAAW,CAAA;IACrD;;;;;;OAMG;IACW,gCAAwB,GAAG,GAAG,CAAA;IAC5C;;;;;;OAMG;IACW,oCAA4B,GAAG,eAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAA;IAClG;;;;;;OAMG;IACW,6CAAqC,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,SAAS,CAAA;IAC3F,OAAO;IACP;;;;;;OAMG;IACW,0BAAkB,GAAG,8CAA8C,CAAA;IACjF;;;;;;OAMG;IACW,2BAAmB,GAAG,gBAAgB,CAAA;IACpD;;;;;;OAMG;IACW,iCAAyB,GAAG,GAAG,CAAA;IAE7C;;;;;;OAMG;IACW,4BAAoB,GAAG,wCAAwC,CAAA;IAC7E;;;;;;OAMG;IACW,6BAAqB,GAAG,gBAAgB,CAAA;IACtD;;;;;;OAMG;IACW,mCAA2B,GAAG,GAAG,CAAA;IACjD,cAAC;CAAA,AA7JD,IA6JC;kBA7JoB,OAAO"}