@ikonintegration/ikapi 5.0.2 → 5.0.4

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 (132) hide show
  1. package/package.json +1 -1
  2. package/src/BaseEvent/Launchable/ContainerExec.ts +6 -2
  3. package/src/Mailer/Mailer.ts +42 -52
  4. package/dist/index.d.ts +0 -17
  5. package/dist/index.js +0 -28
  6. package/dist/index.js.map +0 -1
  7. package/dist/package-lock.json +0 -11901
  8. package/dist/package.json +0 -82
  9. package/dist/src/API/Request.d.ts +0 -125
  10. package/dist/src/API/Request.js +0 -185
  11. package/dist/src/API/Request.js.map +0 -1
  12. package/dist/src/API/Response.d.ts +0 -188
  13. package/dist/src/API/Response.js +0 -270
  14. package/dist/src/API/Response.js.map +0 -1
  15. package/dist/src/BaseEvent/DynamoTransaction.d.ts +0 -70
  16. package/dist/src/BaseEvent/DynamoTransaction.js +0 -104
  17. package/dist/src/BaseEvent/DynamoTransaction.js.map +0 -1
  18. package/dist/src/BaseEvent/EventProcessor.d.ts +0 -58
  19. package/dist/src/BaseEvent/EventProcessor.js +0 -101
  20. package/dist/src/BaseEvent/EventProcessor.js.map +0 -1
  21. package/dist/src/BaseEvent/Launchable/ContainerExec.d.ts +0 -42
  22. package/dist/src/BaseEvent/Launchable/ContainerExec.js +0 -102
  23. package/dist/src/BaseEvent/Launchable/ContainerExec.js.map +0 -1
  24. package/dist/src/BaseEvent/Launchable/index.d.ts +0 -34
  25. package/dist/src/BaseEvent/Launchable/index.js +0 -43
  26. package/dist/src/BaseEvent/Launchable/index.js.map +0 -1
  27. package/dist/src/BaseEvent/Launchable/types.d.ts +0 -10
  28. package/dist/src/BaseEvent/Launchable/types.js +0 -2
  29. package/dist/src/BaseEvent/Launchable/types.js.map +0 -1
  30. package/dist/src/BaseEvent/Process.d.ts +0 -50
  31. package/dist/src/BaseEvent/Process.js +0 -64
  32. package/dist/src/BaseEvent/Process.js.map +0 -1
  33. package/dist/src/BaseEvent/StepTransaction.d.ts +0 -23
  34. package/dist/src/BaseEvent/StepTransaction.js +0 -27
  35. package/dist/src/BaseEvent/StepTransaction.js.map +0 -1
  36. package/dist/src/BaseEvent/Transaction.d.ts +0 -149
  37. package/dist/src/BaseEvent/Transaction.js +0 -224
  38. package/dist/src/BaseEvent/Transaction.js.map +0 -1
  39. package/dist/src/Cache/Redis.d.ts +0 -29
  40. package/dist/src/Cache/Redis.js +0 -80
  41. package/dist/src/Cache/Redis.js.map +0 -1
  42. package/dist/src/Cache/types.d.ts +0 -31
  43. package/dist/src/Cache/types.js +0 -2
  44. package/dist/src/Cache/types.js.map +0 -1
  45. package/dist/src/Config/Configuration.d.ts +0 -123
  46. package/dist/src/Config/Configuration.js +0 -109
  47. package/dist/src/Config/Configuration.js.map +0 -1
  48. package/dist/src/Config/EnvironmentVar.d.ts +0 -74
  49. package/dist/src/Config/EnvironmentVar.js +0 -138
  50. package/dist/src/Config/EnvironmentVar.js.map +0 -1
  51. package/dist/src/Crypto/Crypto.d.ts +0 -45
  52. package/dist/src/Crypto/Crypto.js +0 -72
  53. package/dist/src/Crypto/Crypto.js.map +0 -1
  54. package/dist/src/Database/Database.d.ts +0 -21
  55. package/dist/src/Database/Database.js +0 -15
  56. package/dist/src/Database/Database.js.map +0 -1
  57. package/dist/src/Database/DatabaseManager.d.ts +0 -47
  58. package/dist/src/Database/DatabaseManager.js +0 -60
  59. package/dist/src/Database/DatabaseManager.js.map +0 -1
  60. package/dist/src/Database/DatabaseTransaction.d.ts +0 -101
  61. package/dist/src/Database/DatabaseTransaction.js +0 -126
  62. package/dist/src/Database/DatabaseTransaction.js.map +0 -1
  63. package/dist/src/Database/index.d.ts +0 -10
  64. package/dist/src/Database/index.js +0 -15
  65. package/dist/src/Database/index.js.map +0 -1
  66. package/dist/src/Database/integrations/dynamo/DynamoDatabase.d.ts +0 -35
  67. package/dist/src/Database/integrations/dynamo/DynamoDatabase.js +0 -59
  68. package/dist/src/Database/integrations/dynamo/DynamoDatabase.js.map +0 -1
  69. package/dist/src/Database/integrations/kysely/KyselyDatabase.d.ts +0 -66
  70. package/dist/src/Database/integrations/kysely/KyselyDatabase.js +0 -86
  71. package/dist/src/Database/integrations/kysely/KyselyDatabase.js.map +0 -1
  72. package/dist/src/Database/integrations/kysely/KyselyTransaction.d.ts +0 -70
  73. package/dist/src/Database/integrations/kysely/KyselyTransaction.js +0 -118
  74. package/dist/src/Database/integrations/kysely/KyselyTransaction.js.map +0 -1
  75. package/dist/src/Database/integrations/pgsql/PostgresDatabase.d.ts +0 -36
  76. package/dist/src/Database/integrations/pgsql/PostgresDatabase.js +0 -54
  77. package/dist/src/Database/integrations/pgsql/PostgresDatabase.js.map +0 -1
  78. package/dist/src/Database/integrations/pgsql/PostgresTransaction.d.ts +0 -63
  79. package/dist/src/Database/integrations/pgsql/PostgresTransaction.js +0 -61
  80. package/dist/src/Database/integrations/pgsql/PostgresTransaction.js.map +0 -1
  81. package/dist/src/Database/types.d.ts +0 -76
  82. package/dist/src/Database/types.js +0 -2
  83. package/dist/src/Database/types.js.map +0 -1
  84. package/dist/src/Globals.d.ts +0 -93
  85. package/dist/src/Globals.js +0 -99
  86. package/dist/src/Globals.js.map +0 -1
  87. package/dist/src/Logger/Logger.d.ts +0 -161
  88. package/dist/src/Logger/Logger.js +0 -299
  89. package/dist/src/Logger/Logger.js.map +0 -1
  90. package/dist/src/Mailer/Mailer.d.ts +0 -78
  91. package/dist/src/Mailer/Mailer.js +0 -182
  92. package/dist/src/Mailer/Mailer.js.map +0 -1
  93. package/dist/src/Publisher/Publisher.d.ts +0 -39
  94. package/dist/src/Publisher/Publisher.js +0 -77
  95. package/dist/src/Publisher/Publisher.js.map +0 -1
  96. package/dist/src/Server/RouteResolver.d.ts +0 -33
  97. package/dist/src/Server/RouteResolver.js +0 -100
  98. package/dist/src/Server/RouteResolver.js.map +0 -1
  99. package/dist/src/Server/Router.d.ts +0 -157
  100. package/dist/src/Server/Router.js +0 -32
  101. package/dist/src/Server/Router.js.map +0 -1
  102. package/dist/src/Server/lib/ContainerServer.d.ts +0 -42
  103. package/dist/src/Server/lib/ContainerServer.js +0 -66
  104. package/dist/src/Server/lib/ContainerServer.js.map +0 -1
  105. package/dist/src/Server/lib/Server.d.ts +0 -45
  106. package/dist/src/Server/lib/Server.js +0 -93
  107. package/dist/src/Server/lib/Server.js.map +0 -1
  108. package/dist/src/Server/lib/container/GenericHandler.d.ts +0 -9
  109. package/dist/src/Server/lib/container/GenericHandler.js +0 -82
  110. package/dist/src/Server/lib/container/GenericHandler.js.map +0 -1
  111. package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +0 -52
  112. package/dist/src/Server/lib/container/GenericHandlerEvent.js +0 -132
  113. package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +0 -1
  114. package/dist/src/Server/lib/container/HealthHandler.d.ts +0 -9
  115. package/dist/src/Server/lib/container/HealthHandler.js +0 -19
  116. package/dist/src/Server/lib/container/HealthHandler.js.map +0 -1
  117. package/dist/src/Server/lib/container/Proxy.d.ts +0 -67
  118. package/dist/src/Server/lib/container/Proxy.js +0 -143
  119. package/dist/src/Server/lib/container/Proxy.js.map +0 -1
  120. package/dist/src/Server/lib/container/Utils.d.ts +0 -14
  121. package/dist/src/Server/lib/container/Utils.js +0 -37
  122. package/dist/src/Server/lib/container/Utils.js.map +0 -1
  123. package/dist/src/Util/AsyncSingleton.d.ts +0 -31
  124. package/dist/src/Util/AsyncSingleton.js +0 -83
  125. package/dist/src/Util/AsyncSingleton.js.map +0 -1
  126. package/dist/src/Util/Utils.d.ts +0 -61
  127. package/dist/src/Util/Utils.js +0 -147
  128. package/dist/src/Util/Utils.js.map +0 -1
  129. package/dist/src/Validation/Validator.d.ts +0 -17
  130. package/dist/src/Validation/Validator.js +0 -39
  131. package/dist/src/Validation/Validator.js.map +0 -1
  132. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,54 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import pg from 'pg';
11
- import { PostgresTransactionImpl } from './PostgresTransaction.js';
12
- import { Database } from '../../Database.js';
13
- /**
14
- * Represents a Postgres database connection that extends the Database class.
15
- * @extends Database<PostgresTransaction>
16
- */
17
- export class PostgresDatabase extends Database {
18
- /**
19
- * Constructor for creating a new instance of a database connection using Postgres.
20
- * @param {DbConfig<'pg'>} config - The configuration object for the Postgres database.
21
- * @returns None
22
- */
23
- constructor(config) {
24
- super(config);
25
- this.client = this.providerFactory(config);
26
- if (config.readReplica)
27
- this.readClient = this.providerFactory(config.readReplica);
28
- }
29
- /**
30
- * Creates a new Postgres transaction using the provided client and read client.
31
- * @returns {Promise<PostgresTransaction>} A promise that resolves to a new PostgresTransaction object.
32
- */
33
- transaction() {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- return PostgresTransactionImpl.newTransaction(this.client, this, this.readClient);
36
- });
37
- }
38
- providerFactory(config) {
39
- return new PostgresDatabase.pgProvider({
40
- host: config.host,
41
- port: config.port,
42
- user: config.username,
43
- password: config.password,
44
- database: config.database,
45
- max: config.maxConnections,
46
- });
47
- }
48
- }
49
- /**
50
- * A public static property that represents a connection pool for a PostgreSQL database.
51
- * This property is used to manage and provide connections to the PostgreSQL database.
52
- */
53
- PostgresDatabase.pgProvider = pg.Pool;
54
- //# sourceMappingURL=PostgresDatabase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PostgresDatabase.js","sourceRoot":"","sources":["../../../../../src/Database/integrations/pgsql/PostgresDatabase.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,OAAO,EAAuB,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG5C;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,QAA6B;IAgBjE;;;;OAIG;IACH,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;QAC1C,IAAI,MAAM,CAAC,WAAW;YAAE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IACpF,CAAC;IAED;;;OAGG;IACmB,WAAW;;YAC/B,OAAO,uBAAuB,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;QACnF,CAAC;KAAA;IAEO,eAAe,CAAC,MAAoB;QAC1C,OAAO,IAAI,gBAAgB,CAAC,UAAU,CAAC;YACrC,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;;AA3CD;;;GAGG;AACY,2BAAU,GAAG,EAAE,CAAC,IAAI,CAAA"}
@@ -1,63 +0,0 @@
1
- import * as pg from 'pg';
2
- import { PostgresDatabase } from './PostgresDatabase.js';
3
- import { Database } from '../../Database.js';
4
- import { DatabaseTransaction } from '../../DatabaseTransaction.js';
5
- /**
6
- * A type alias representing a Postgres transaction. It extends the `PostgresTransactionImpl`
7
- * interface and includes the `PoolClient` interface.
8
- */
9
- export type PostgresTransaction = PostgresTransactionImpl & pg.PoolClient;
10
- /**
11
- * Represents a transaction in a Postgres database.
12
- */
13
- export declare class PostgresTransactionImpl extends DatabaseTransaction {
14
- /**
15
- * A Pool object used for writing operations.
16
- * @readonly
17
- */
18
- readonly writer: pg.Pool;
19
- /**
20
- * A readonly property representing a pool reader.
21
- */
22
- readonly reader: pg.Pool;
23
- /**
24
- * Represents a database transaction using a PoolClient.
25
- * @type {PoolClient}
26
- */
27
- protected transaction: pg.PoolClient;
28
- /**
29
- * A protected property representing a database of type Database<PostgresTransaction>.
30
- * This property is used to interact with a Postgres database using transactions.
31
- */
32
- protected database: Database<PostgresTransaction>;
33
- /**
34
- * Constructs a new instance of the class with the provided writer, database, and optional reader.
35
- * @param {Pool} writer - The writer pool for database operations.
36
- * @param {PostgresDatabase} database - The Postgres database instance.
37
- * @param {Pool} [reader] - The reader pool for database operations (optional).
38
- */
39
- private constructor();
40
- /**
41
- * Creates a new database transaction using the provided writer and database instances.
42
- * @param {Pool} writer - The writer instance for the transaction.
43
- * @param {PostgresDatabase} database - The database instance for the transaction.
44
- * @param {Pool} [reader] - Optional reader instance for the transaction.
45
- * @returns {Promise<PostgresTransaction>} A promise that resolves to a new PostgresTransaction instance.
46
- */
47
- static newTransaction(writer: pg.Pool, database: PostgresDatabase, reader?: pg.Pool): Promise<PostgresTransaction>;
48
- /**
49
- * Initiates a transaction by connecting to the writer and executing a 'BEGIN' query.
50
- * @returns {Promise<void>} A promise that resolves when the transaction is successfully initiated.
51
- */
52
- protected doBegin: () => Promise<pg.QueryResult<any>>;
53
- /**
54
- * Executes a COMMIT query to commit the current transaction.
55
- * @returns A Promise that resolves when the COMMIT query is successfully executed.
56
- */
57
- protected doCommit: () => Promise<pg.QueryResult<any>>;
58
- /**
59
- * Rolls back the current transaction by executing a 'ROLLBACK' query.
60
- * @returns A Promise that resolves when the rollback is successful.
61
- */
62
- protected doRollback: () => Promise<pg.QueryResult<any>>;
63
- }
@@ -1,61 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { DatabaseTransaction } from '../../DatabaseTransaction.js';
11
- /**
12
- * Represents a transaction in a Postgres database.
13
- */
14
- export class PostgresTransactionImpl extends DatabaseTransaction {
15
- /**
16
- * Constructs a new instance of the class with the provided writer, database, and optional reader.
17
- * @param {Pool} writer - The writer pool for database operations.
18
- * @param {PostgresDatabase} database - The Postgres database instance.
19
- * @param {Pool} [reader] - The reader pool for database operations (optional).
20
- */
21
- constructor(writer, database, reader) {
22
- super(writer, database, reader);
23
- /**
24
- * Initiates a transaction by connecting to the writer and executing a 'BEGIN' query.
25
- * @returns {Promise<void>} A promise that resolves when the transaction is successfully initiated.
26
- */
27
- this.doBegin = () => __awaiter(this, void 0, void 0, function* () {
28
- this.transaction = yield this.writer.connect();
29
- return this.transaction.query('BEGIN');
30
- });
31
- /**
32
- * Executes a COMMIT query to commit the current transaction.
33
- * @returns A Promise that resolves when the COMMIT query is successfully executed.
34
- */
35
- this.doCommit = () => {
36
- return this.transaction.query('COMMIT');
37
- };
38
- /**
39
- * Rolls back the current transaction by executing a 'ROLLBACK' query.
40
- * @returns A Promise that resolves when the rollback is successful.
41
- */
42
- this.doRollback = () => {
43
- return this.transaction.query('ROLLBACK');
44
- };
45
- }
46
- /**
47
- * Creates a new database transaction using the provided writer and database instances.
48
- * @param {Pool} writer - The writer instance for the transaction.
49
- * @param {PostgresDatabase} database - The database instance for the transaction.
50
- * @param {Pool} [reader] - Optional reader instance for the transaction.
51
- * @returns {Promise<PostgresTransaction>} A promise that resolves to a new PostgresTransaction instance.
52
- */
53
- static newTransaction(writer, database, reader) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- const tx = new PostgresTransactionImpl(writer, database, reader);
56
- yield tx.begin(); // defaults to opened
57
- return DatabaseTransaction.proxyInstance(tx);
58
- });
59
- }
60
- }
61
- //# sourceMappingURL=PostgresTransaction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PostgresTransaction.js","sourceRoot":"","sources":["../../../../../src/Database/integrations/pgsql/PostgresTransaction.ts"],"names":[],"mappings":";;;;;;;;;AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAQlE;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,mBAAmB;IAoB9D;;;;;OAKG;IACH,YAAoB,MAAe,EAAE,QAA0B,EAAE,MAAgB;QAC/E,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;QAoBjC;;;WAGG;QACO,YAAO,GAAG,GAAS,EAAE;YAC7B,IAAI,CAAC,WAAW,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;YAC9C,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACxC,CAAC,CAAA,CAAA;QAED;;;WAGG;QACO,aAAQ,GAAG,GAAG,EAAE;YACxB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QACzC,CAAC,CAAA;QAED;;;WAGG;QACO,eAAU,GAAG,GAAG,EAAE;YAC1B,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QAC3C,CAAC,CAAA;IA1CD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAO,cAAc,CAChC,MAAe,EACf,QAA0B,EAC1B,MAAgB;;YAEhB,MAAM,EAAE,GAAG,IAAI,uBAAuB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;YAChE,MAAM,EAAE,CAAC,KAAK,EAAE,CAAA,CAAC,qBAAqB;YACtC,OAAO,mBAAmB,CAAC,aAAa,CAAC,EAAE,CAAQ,CAAA;QACrD,CAAC;KAAA;CA0BF"}
@@ -1,76 +0,0 @@
1
- import { Database } from './Database.js';
2
- import { DATABASES } from './DatabaseManager.js';
3
- import { DynamoDatabase } from './integrations/dynamo/DynamoDatabase.js';
4
- import { KyselyDatabase } from './integrations/kysely/KyselyDatabase.js';
5
- import { PostgresDatabase } from './integrations/pgsql/PostgresDatabase.js';
6
- /**
7
- * Represents the possible types of databases available in the system.
8
- * @typedef {keyof typeof DATABASES} DatabaseType
9
- */
10
- export type DatabaseType = keyof typeof DATABASES;
11
- /**
12
- * Defines a type for a database class that includes instances for Postgres, and Kysely databases.
13
- * @template T - The type of data the KyselyDatabase instance will handle.
14
- * @property {new (...args: any[]) => PostgresDatabase} pg - Constructor for PostgresDatabase instances.
15
- * @property {new (...args: any[]) => KyselyDatabase<T>} kysely - Constructor for KyselyDatabase instances with type T.
16
- */
17
- export type DatabaseClass<T> = {
18
- pg: new (...args: any[]) => PostgresDatabase;
19
- kysely: new (...args: any[]) => KyselyDatabase<T>;
20
- dynamo: new (...args: any[]) => DynamoDatabase;
21
- };
22
- /**
23
- * Represents a specific implementation type for a database based on the provided DatabaseType.
24
- * @param {DatabaseType} Type - The type of database to implement.
25
- * @param {T} T - The generic type for the database implementation.
26
- * @returns An instance of the specified database class for the given type.
27
- */
28
- export type DatabaseImplType<Type extends DatabaseType, T> = InstanceType<DatabaseClass<T>[Type]>;
29
- /**
30
- * Defines the type of transaction for a specific database type and schema.
31
- * @param {DatabaseType} Type - The type of the database.
32
- * @param {DBSchema} DBSchema - The schema of the database.
33
- * @returns The transaction type associated with the database type and schema.
34
- */
35
- export type DatabaseTransactionType<Type extends DatabaseType, DBSchema> = DatabaseImplType<Type, DBSchema> extends Database<infer TransactionType> ? TransactionType : never;
36
- /**
37
- * Defines the configuration options for different types of databases.
38
- * @typedef {Object} DbBaseConfig
39
- * @property {string} host - The host of the database.
40
- * @property {number} port - The port number of the database.
41
- * @property {string} username - The username for accessing the database.
42
- * @property {string} password - The password for accessing the database.
43
- * @property {string} database - The name of the database.
44
- * @property {boolean} autoCommit - Flag indicating whether auto-commit is enabled.
45
- * @property {number} maxConnections - The maximum number of connections allowed.
46
- *
47
- * @typedef {Object} DbConfig
48
- * @property {string} type - The type of
49
- */
50
- export type DbBaseConfig = {
51
- host: string;
52
- port: number;
53
- username: string;
54
- password: string;
55
- database: string;
56
- autoCommit: boolean;
57
- maxConnections: number;
58
- };
59
- /**
60
- * Defines the configuration options for different types of databases.
61
- * @template S - The type of database (e.g., 'dynamo', 'pg', 'kysely')
62
- * @typedef {Object} DbConfig
63
- * @property {DbBaseConfig} DbBaseConfig - The base configuration for the database.
64
- * @property {S} type - The type of the database.
65
- * @property {DbBaseConfig} [readReplica] - The read replica configuration for '
66
- */
67
- export type DbConfig<S extends DatabaseType> = {
68
- type: S;
69
- } & (S extends 'pg' | 'kysely' ? DbBaseConfig & {
70
- readReplica?: DbBaseConfig;
71
- } : unknown) & (S extends 'dynamo' ? {
72
- region: string;
73
- tableName: string;
74
- maxAttempts?: number;
75
- connectionTimeout?: number;
76
- } : unknown);
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/Database/types.ts"],"names":[],"mappings":""}
@@ -1,93 +0,0 @@
1
- /**
2
- * Class containing global constants and configurations for the application.
3
- */
4
- export default class Globals {
5
- /**
6
- * A constant string representing an error message for input validation failure.
7
- */
8
- static ErrorResponseValidationFail: string;
9
- /**
10
- * A constant string representing an error response for an invalid server response.
11
- */
12
- static ErrorResponseInvalidServerResponse: string;
13
- /**
14
- * The error message for an unhandled error when processing a request.
15
- */
16
- static ErrorResponseUnhandledError: string;
17
- /**
18
- * A static string representing an error response when there are no records to be processed.
19
- */
20
- static ErrorResponseNoRecords: string;
21
- /**
22
- * Represents an error code for a missing parameter.
23
- * @type {string}
24
- */
25
- static ErrorCode_MissingParam: string;
26
- /**
27
- * Represents an error code for invalid input.
28
- * @type {string}
29
- */
30
- static ErrorCode_InvalidInput: string;
31
- /**
32
- * Represents an error code for an API error.
33
- * @type {string}
34
- */
35
- static ErrorCode_APIError: string;
36
- /**
37
- * Represents the error code for when there are no records found.
38
- * @type {string}
39
- */
40
- static ErrorCode_NoRecords: string;
41
- /**
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.
46
- */
47
- static Listener_HTTP_DefaultPort: number;
48
- /**
49
- * The default host for the HTTP listener.
50
- */
51
- static Listener_HTTP_DefaultHost: string;
52
- /**
53
- * The HTTP proxy route listener for all routes.
54
- * @type {string}
55
- */
56
- static Listener_HTTP_ProxyRoute: string;
57
- /**
58
- * Retrieves the default timeout value for HTTP listeners.
59
- * @returns {number} The default timeout value in milliseconds.
60
- */
61
- static Listener_HTTP_DefaultTimeout: number;
62
- /**
63
- * The default health check route for the HTTP listener.
64
- * @type {string}
65
- */
66
- static Listener_HTTP_DefaultHealthCheckRoute: string;
67
- /**
68
- * The response message for an exception that occurred during request execution in the Proxy.
69
- */
70
- static Resp_MSG_EXCEPTION: string;
71
- /**
72
- * The response code for an exception that occurred during execution.
73
- */
74
- static Resp_CODE_EXCEPTION: string;
75
- /**
76
- * The HTTP response status code for an exception scenario.
77
- */
78
- static Resp_STATUSCODE_EXCEPTION: number;
79
- /**
80
- * The error message for an invalid response from the server.
81
- */
82
- static Resp_MSG_INVALIDRESP: string;
83
- /**
84
- * Represents the response code for an invalid response.
85
- */
86
- static Resp_CODE_INVALIDRESP: string;
87
- /**
88
- * The HTTP response status code for an invalid response.
89
- * @type {number}
90
- * @default 400
91
- */
92
- static Resp_STATUSCODE_INVALIDRESP: number;
93
- }
@@ -1,99 +0,0 @@
1
- import dotenv from 'dotenv';
2
- import Utils from './Util/Utils.js';
3
- // important for dev env to load .env file
4
- dotenv.config();
5
- /**
6
- * Class containing global constants and configurations for the application.
7
- */
8
- class Globals {
9
- }
10
- /**
11
- * A constant string representing an error message for input validation failure.
12
- */
13
- Globals.ErrorResponseValidationFail = 'Input validation failed: '; //400
14
- /**
15
- * A constant string representing an error response for an invalid server response.
16
- */
17
- Globals.ErrorResponseInvalidServerResponse = 'No valid response, this is a system error.'; //400
18
- /**
19
- * The error message for an unhandled error when processing a request.
20
- */
21
- Globals.ErrorResponseUnhandledError = 'Unhandled error when processing request.'; //400
22
- /**
23
- * A static string representing an error response when there are no records to be processed.
24
- */
25
- Globals.ErrorResponseNoRecords = 'No events to be processed.'; //400
26
- /**
27
- * Represents an error code for a missing parameter.
28
- * @type {string}
29
- */
30
- Globals.ErrorCode_MissingParam = 'MISSING_PARAM';
31
- /**
32
- * Represents an error code for invalid input.
33
- * @type {string}
34
- */
35
- Globals.ErrorCode_InvalidInput = 'INVALID_INPUT';
36
- /**
37
- * Represents an error code for an API error.
38
- * @type {string}
39
- */
40
- Globals.ErrorCode_APIError = 'API_ERROR';
41
- /**
42
- * Represents the error code for when there are no records found.
43
- * @type {string}
44
- */
45
- Globals.ErrorCode_NoRecords = 'EMPTY_EVENT';
46
- /**
47
- * Retrieves the default port number for HTTP listeners.
48
- * The port number is obtained from the environment variable "PORT" and parsed as an integer.
49
- * If the environment variable is not set or cannot be parsed as an integer, the default port number 9000 is used.
50
- * @returns {number} - The default port number for HTTP listeners.
51
- */
52
- Globals.Listener_HTTP_DefaultPort = Utils.parseIntNullIfNaN(process.env.PORT) || 9000;
53
- /**
54
- * The default host for the HTTP listener.
55
- */
56
- Globals.Listener_HTTP_DefaultHost = 'localhost';
57
- /**
58
- * The HTTP proxy route listener for all routes.
59
- * @type {string}
60
- */
61
- Globals.Listener_HTTP_ProxyRoute = '*';
62
- /**
63
- * Retrieves the default timeout value for HTTP listeners.
64
- * @returns {number} The default timeout value in milliseconds.
65
- */
66
- Globals.Listener_HTTP_DefaultTimeout = Utils.parseIntNullIfNaN(process.env.TIMEOUT) || 30000;
67
- /**
68
- * The default health check route for the HTTP listener.
69
- * @type {string}
70
- */
71
- Globals.Listener_HTTP_DefaultHealthCheckRoute = process.env.HEALTH_ROUTE || '/health';
72
- /**
73
- * The response message for an exception that occurred during request execution in the Proxy.
74
- */
75
- Globals.Resp_MSG_EXCEPTION = '[Proxy]: Exception during request execution!';
76
- /**
77
- * The response code for an exception that occurred during execution.
78
- */
79
- Globals.Resp_CODE_EXCEPTION = 'EXEC_EXCEPTION';
80
- /**
81
- * The HTTP response status code for an exception scenario.
82
- */
83
- Globals.Resp_STATUSCODE_EXCEPTION = 502;
84
- /**
85
- * The error message for an invalid response from the server.
86
- */
87
- Globals.Resp_MSG_INVALIDRESP = '[Proxy]: Invalid response from server!';
88
- /**
89
- * Represents the response code for an invalid response.
90
- */
91
- Globals.Resp_CODE_INVALIDRESP = 'EMPTY_RESPONSE';
92
- /**
93
- * The HTTP response status code for an invalid response.
94
- * @type {number}
95
- * @default 400
96
- */
97
- Globals.Resp_STATUSCODE_INVALIDRESP = 400;
98
- export default Globals;
99
- //# sourceMappingURL=Globals.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Globals.js","sourceRoot":"","sources":["../../src/Globals.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,KAAK,MAAM,iBAAiB,CAAA;AAEnC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf;;GAEG;AACH,MAAqB,OAAO;;AAC1B;;GAEG;AACW,mCAA2B,GAAG,2BAA2B,CAAA,CAAC,KAAK;AAC7E;;GAEG;AACW,0CAAkC,GAAG,4CAA4C,CAAA,CAAC,KAAK;AACrG;;GAEG;AACW,mCAA2B,GAAG,0CAA0C,CAAA,CAAC,KAAK;AAC5F;;GAEG;AACW,8BAAsB,GAAG,4BAA4B,CAAA,CAAC,KAAK;AACzE;;;GAGG;AACW,8BAAsB,GAAG,eAAe,CAAA;AACtD;;;GAGG;AACW,8BAAsB,GAAG,eAAe,CAAA;AACtD;;;GAGG;AACW,0BAAkB,GAAG,WAAW,CAAA;AAC9C;;;GAGG;AACW,2BAAmB,GAAG,aAAa,CAAA;AAEjD;;;;;GAKG;AACW,iCAAyB,GAAG,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA;AAC3F;;GAEG;AACW,iCAAyB,GAAG,WAAW,CAAA;AACrD;;;GAGG;AACW,gCAAwB,GAAG,GAAG,CAAA;AAC5C;;;GAGG;AACW,oCAA4B,GAAG,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAA;AAClG;;;GAGG;AACW,6CAAqC,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,SAAS,CAAA;AAE3F;;GAEG;AACW,0BAAkB,GAAG,8CAA8C,CAAA;AACjF;;GAEG;AACW,2BAAmB,GAAG,gBAAgB,CAAA;AACpD;;GAEG;AACW,iCAAyB,GAAG,GAAG,CAAA;AAE7C;;GAEG;AACW,4BAAoB,GAAG,wCAAwC,CAAA;AAC7E;;GAEG;AACW,6BAAqB,GAAG,gBAAgB,CAAA;AACtD;;;;GAIG;AACW,mCAA2B,GAAG,GAAG,CAAA;eA3F5B,OAAO"}
@@ -1,161 +0,0 @@
1
- /**
2
- * Enumeration of log levels.
3
- * @enum {string}
4
- * @property {string} DEBUG - Debug log level.
5
- * @property {string} INFO - Info log level.
6
- * @property {string} WARN - Warning log level.
7
- * @property {string} ERROR - Error log level.
8
- */
9
- export declare enum LOG_LEVELS {
10
- DEBUG = "DEBUG",
11
- INFO = "INFO",
12
- WARN = "WARN",
13
- ERROR = "ERROR"
14
- }
15
- /**
16
- * Configuration options for the logger.
17
- * @typedef {Object} LoggerConfig
18
- * @property {boolean | Array<string>} [sensitiveFilteringKeywords] - Specifies whether to filter sensitive keywords in log messages. Can be a boolean value or an array of strings.
19
- * @property {LOG_LEVELS | string} [logLevel] - The log level to use for logging. Can be one of the predefined log levels or a custom string value.
20
- */
21
- export type LoggerConfig = {
22
- sensitiveFilteringKeywords?: boolean | Array<string>;
23
- logLevel?: LOG_LEVELS | string;
24
- };
25
- /**
26
- * Logger class for logging messages with different log levels.
27
- */
28
- export default class Logger {
29
- /**
30
- * The optional configuration object for the logger.
31
- */
32
- private config?;
33
- /**
34
- * Private property representing the transaction ID.
35
- * @type {string}
36
- * @private
37
- */
38
- private transactionID;
39
- /**
40
- * An array of strings representing a blacklist of filters
41
- */
42
- private filterBlacklist;
43
- /**
44
- * The current log level for the application.
45
- * @private
46
- * @type {LOG_LEVELS}
47
- */
48
- private _LOG_LEVEL;
49
- /**
50
- * The origin of the object.
51
- * @private
52
- * @type {any}
53
- */
54
- private origin;
55
- /**
56
- * Constructs a Logger object with the given configuration and transaction ID.
57
- * @param {config} config - The configuration object for the logger. Can be undefined.
58
- * @param {string} transactionID - The ID of the transaction associated with the logger.
59
- * @returns None
60
- */
61
- constructor(config: LoggerConfig | undefined, transactionID: string);
62
- /**
63
- * Returns a boolean value indicating whether the notGlobalLogger function is executed successfully.
64
- * @returns {boolean} - true if the function is executed successfully, false otherwise.
65
- */
66
- notGlobalLogger(): boolean;
67
- /**
68
- * Logs the given arguments with the debug log level.
69
- * @param {...any} args - The arguments to be logged.
70
- * @returns None
71
- */
72
- debug(...args: any[]): void;
73
- /**
74
- * Logs the given arguments with the INFO log level.
75
- * @param {...any} args - The arguments to be logged.
76
- * @returns None
77
- */
78
- log(...args: any[]): void;
79
- /**
80
- * Logs an informational message.
81
- * @param {...any} args - The message(s) to log.
82
- * @returns None
83
- */
84
- info(...args: any[]): void;
85
- /**
86
- * Logs a warning message with the provided arguments.
87
- * @param {...any} args - The arguments to be logged as a warning message.
88
- * @returns None
89
- */
90
- warning(...args: any[]): void;
91
- /**
92
- * Logs a warning message to the console.
93
- * @param {...any} args - The arguments to be logged.
94
- * @returns None
95
- */
96
- warn(...args: any[]): void;
97
- /**
98
- * Logs an error message with the given arguments.
99
- * @param {...any} args - The arguments to log as an error message.
100
- * @returns None
101
- */
102
- error(...args: any[]): void;
103
- /**
104
- * Logs an exception with optional additional arguments.
105
- * @param {any} exception - The exception to log.
106
- * @param {...any} args - Additional arguments to include in the log.
107
- * @returns None
108
- */
109
- exception(exception: any, ...args: any[]): void;
110
- /**
111
- * Sets up the console bindings for logging purposes.
112
- * @private
113
- * @returns None
114
- */
115
- private setupBindings;
116
- /**
117
- * Formats a log message with the specified log level, message, and caller.
118
- * @param {LOG_LEVELS} level - The log level of the message.
119
- * @param {Array<string>} msg - An array of strings representing the message.
120
- * @param {string} caller - The name of the caller function.
121
- * @returns {string} - The formatted log message.
122
- */
123
- private formattedLog;
124
- /**
125
- * Retrieves the name of the caller function at the specified index in the stack trace.
126
- * @param {number} index - The index of the caller function in the stack trace.
127
- * @returns {string} The name of the caller function along with the file path and line number.
128
- */
129
- private callerName;
130
- /**
131
- * Processes log messages based on the specified log level.
132
- * @param {LOG_LEVELS} level - The level of the log message.
133
- * @param {any} args - The arguments to be logged.
134
- * @returns None
135
- */
136
- private processLog;
137
- private formatArgument;
138
- /**
139
- * Logs an exception along with additional arguments and the stack trace.
140
- * @param {Error} exception - The exception object to log.
141
- * @param {...any} args - Additional arguments to include in the log.
142
- * @returns None
143
- */
144
- private iexception;
145
- /**
146
- * Pushes a log message to the console with the specified log level.
147
- * @param {LOG_LEVELS} level - The log level of the message.
148
- * @param {string} fMsg - The formatted log message.
149
- * @returns None
150
- */
151
- private pushLog;
152
- /**
153
- * Suppresses sensitive information in the given value based on the filter blacklist.
154
- * @param {any} value - The value to suppress sensitive information from.
155
- * @returns {string} - The value with sensitive information suppressed.
156
- */
157
- private suppressSensitiveInfo;
158
- private suppressSensitiveInfoItem;
159
- private suppressSensitiveString;
160
- private suppressSensitiveObject;
161
- }