@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.
- package/package.json +1 -1
- package/src/BaseEvent/Launchable/ContainerExec.ts +6 -2
- package/src/Mailer/Mailer.ts +42 -52
- package/dist/index.d.ts +0 -17
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/package-lock.json +0 -11901
- package/dist/package.json +0 -82
- package/dist/src/API/Request.d.ts +0 -125
- package/dist/src/API/Request.js +0 -185
- package/dist/src/API/Request.js.map +0 -1
- package/dist/src/API/Response.d.ts +0 -188
- package/dist/src/API/Response.js +0 -270
- package/dist/src/API/Response.js.map +0 -1
- package/dist/src/BaseEvent/DynamoTransaction.d.ts +0 -70
- package/dist/src/BaseEvent/DynamoTransaction.js +0 -104
- package/dist/src/BaseEvent/DynamoTransaction.js.map +0 -1
- package/dist/src/BaseEvent/EventProcessor.d.ts +0 -58
- package/dist/src/BaseEvent/EventProcessor.js +0 -101
- package/dist/src/BaseEvent/EventProcessor.js.map +0 -1
- package/dist/src/BaseEvent/Launchable/ContainerExec.d.ts +0 -42
- package/dist/src/BaseEvent/Launchable/ContainerExec.js +0 -102
- package/dist/src/BaseEvent/Launchable/ContainerExec.js.map +0 -1
- package/dist/src/BaseEvent/Launchable/index.d.ts +0 -34
- package/dist/src/BaseEvent/Launchable/index.js +0 -43
- package/dist/src/BaseEvent/Launchable/index.js.map +0 -1
- package/dist/src/BaseEvent/Launchable/types.d.ts +0 -10
- package/dist/src/BaseEvent/Launchable/types.js +0 -2
- package/dist/src/BaseEvent/Launchable/types.js.map +0 -1
- package/dist/src/BaseEvent/Process.d.ts +0 -50
- package/dist/src/BaseEvent/Process.js +0 -64
- package/dist/src/BaseEvent/Process.js.map +0 -1
- package/dist/src/BaseEvent/StepTransaction.d.ts +0 -23
- package/dist/src/BaseEvent/StepTransaction.js +0 -27
- package/dist/src/BaseEvent/StepTransaction.js.map +0 -1
- package/dist/src/BaseEvent/Transaction.d.ts +0 -149
- package/dist/src/BaseEvent/Transaction.js +0 -224
- package/dist/src/BaseEvent/Transaction.js.map +0 -1
- package/dist/src/Cache/Redis.d.ts +0 -29
- package/dist/src/Cache/Redis.js +0 -80
- package/dist/src/Cache/Redis.js.map +0 -1
- package/dist/src/Cache/types.d.ts +0 -31
- package/dist/src/Cache/types.js +0 -2
- package/dist/src/Cache/types.js.map +0 -1
- package/dist/src/Config/Configuration.d.ts +0 -123
- package/dist/src/Config/Configuration.js +0 -109
- package/dist/src/Config/Configuration.js.map +0 -1
- package/dist/src/Config/EnvironmentVar.d.ts +0 -74
- package/dist/src/Config/EnvironmentVar.js +0 -138
- package/dist/src/Config/EnvironmentVar.js.map +0 -1
- package/dist/src/Crypto/Crypto.d.ts +0 -45
- package/dist/src/Crypto/Crypto.js +0 -72
- package/dist/src/Crypto/Crypto.js.map +0 -1
- package/dist/src/Database/Database.d.ts +0 -21
- package/dist/src/Database/Database.js +0 -15
- package/dist/src/Database/Database.js.map +0 -1
- package/dist/src/Database/DatabaseManager.d.ts +0 -47
- package/dist/src/Database/DatabaseManager.js +0 -60
- package/dist/src/Database/DatabaseManager.js.map +0 -1
- package/dist/src/Database/DatabaseTransaction.d.ts +0 -101
- package/dist/src/Database/DatabaseTransaction.js +0 -126
- package/dist/src/Database/DatabaseTransaction.js.map +0 -1
- package/dist/src/Database/index.d.ts +0 -10
- package/dist/src/Database/index.js +0 -15
- package/dist/src/Database/index.js.map +0 -1
- package/dist/src/Database/integrations/dynamo/DynamoDatabase.d.ts +0 -35
- package/dist/src/Database/integrations/dynamo/DynamoDatabase.js +0 -59
- package/dist/src/Database/integrations/dynamo/DynamoDatabase.js.map +0 -1
- package/dist/src/Database/integrations/kysely/KyselyDatabase.d.ts +0 -66
- package/dist/src/Database/integrations/kysely/KyselyDatabase.js +0 -86
- package/dist/src/Database/integrations/kysely/KyselyDatabase.js.map +0 -1
- package/dist/src/Database/integrations/kysely/KyselyTransaction.d.ts +0 -70
- package/dist/src/Database/integrations/kysely/KyselyTransaction.js +0 -118
- package/dist/src/Database/integrations/kysely/KyselyTransaction.js.map +0 -1
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.d.ts +0 -36
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.js +0 -54
- package/dist/src/Database/integrations/pgsql/PostgresDatabase.js.map +0 -1
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.d.ts +0 -63
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.js +0 -61
- package/dist/src/Database/integrations/pgsql/PostgresTransaction.js.map +0 -1
- package/dist/src/Database/types.d.ts +0 -76
- package/dist/src/Database/types.js +0 -2
- package/dist/src/Database/types.js.map +0 -1
- package/dist/src/Globals.d.ts +0 -93
- package/dist/src/Globals.js +0 -99
- package/dist/src/Globals.js.map +0 -1
- package/dist/src/Logger/Logger.d.ts +0 -161
- package/dist/src/Logger/Logger.js +0 -299
- package/dist/src/Logger/Logger.js.map +0 -1
- package/dist/src/Mailer/Mailer.d.ts +0 -78
- package/dist/src/Mailer/Mailer.js +0 -182
- package/dist/src/Mailer/Mailer.js.map +0 -1
- package/dist/src/Publisher/Publisher.d.ts +0 -39
- package/dist/src/Publisher/Publisher.js +0 -77
- package/dist/src/Publisher/Publisher.js.map +0 -1
- package/dist/src/Server/RouteResolver.d.ts +0 -33
- package/dist/src/Server/RouteResolver.js +0 -100
- package/dist/src/Server/RouteResolver.js.map +0 -1
- package/dist/src/Server/Router.d.ts +0 -157
- package/dist/src/Server/Router.js +0 -32
- package/dist/src/Server/Router.js.map +0 -1
- package/dist/src/Server/lib/ContainerServer.d.ts +0 -42
- package/dist/src/Server/lib/ContainerServer.js +0 -66
- package/dist/src/Server/lib/ContainerServer.js.map +0 -1
- package/dist/src/Server/lib/Server.d.ts +0 -45
- package/dist/src/Server/lib/Server.js +0 -93
- package/dist/src/Server/lib/Server.js.map +0 -1
- package/dist/src/Server/lib/container/GenericHandler.d.ts +0 -9
- package/dist/src/Server/lib/container/GenericHandler.js +0 -82
- package/dist/src/Server/lib/container/GenericHandler.js.map +0 -1
- package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +0 -52
- package/dist/src/Server/lib/container/GenericHandlerEvent.js +0 -132
- package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +0 -1
- package/dist/src/Server/lib/container/HealthHandler.d.ts +0 -9
- package/dist/src/Server/lib/container/HealthHandler.js +0 -19
- package/dist/src/Server/lib/container/HealthHandler.js.map +0 -1
- package/dist/src/Server/lib/container/Proxy.d.ts +0 -67
- package/dist/src/Server/lib/container/Proxy.js +0 -143
- package/dist/src/Server/lib/container/Proxy.js.map +0 -1
- package/dist/src/Server/lib/container/Utils.d.ts +0 -14
- package/dist/src/Server/lib/container/Utils.js +0 -37
- package/dist/src/Server/lib/container/Utils.js.map +0 -1
- package/dist/src/Util/AsyncSingleton.d.ts +0 -31
- package/dist/src/Util/AsyncSingleton.js +0 -83
- package/dist/src/Util/AsyncSingleton.js.map +0 -1
- package/dist/src/Util/Utils.d.ts +0 -61
- package/dist/src/Util/Utils.js +0 -147
- package/dist/src/Util/Utils.js.map +0 -1
- package/dist/src/Validation/Validator.d.ts +0 -17
- package/dist/src/Validation/Validator.js +0 -39
- package/dist/src/Validation/Validator.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { LaunchableHandlerType } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a ContainerExecution class that handles the execution of a launchable handler.
|
|
4
|
-
* @template Input - The type of input expected by the launchable handler.
|
|
5
|
-
*/
|
|
6
|
-
export default class ContainerExecution<Input> {
|
|
7
|
-
/**
|
|
8
|
-
* A private readonly property that holds a handler of LaunchableHandlerType with a given Input type.
|
|
9
|
-
*/
|
|
10
|
-
private readonly handler;
|
|
11
|
-
/**
|
|
12
|
-
* Constructor for creating an instance of a class with a LaunchableHandlerType input.
|
|
13
|
-
* @param {LaunchableHandlerType<Input>} handler - The handler for the launchable type.
|
|
14
|
-
* @returns None
|
|
15
|
-
*/
|
|
16
|
-
constructor(handler: LaunchableHandlerType<Input>);
|
|
17
|
-
/**
|
|
18
|
-
* Executes the function asynchronously, invoking the specified inputs and handling the response accordingly.
|
|
19
|
-
* If the response code is 200, the process exits with code 0; otherwise, it exits with code 1.
|
|
20
|
-
* @returns None
|
|
21
|
-
*/
|
|
22
|
-
execute(): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Retrieves inputs from the process arguments and parses them as JSON.
|
|
25
|
-
* @returns {any} The parsed input object from process arguments.
|
|
26
|
-
*/
|
|
27
|
-
private getInputs;
|
|
28
|
-
/**
|
|
29
|
-
* Builds a context object for AWS Lambda function.
|
|
30
|
-
* @param {CallableFunction} callback - The callback function to be executed.
|
|
31
|
-
* @returns {Context} A context object with AWS Lambda properties.
|
|
32
|
-
*/
|
|
33
|
-
private buildContext;
|
|
34
|
-
/**
|
|
35
|
-
* Asynchronously invokes a function with the given input and returns a promise that resolves
|
|
36
|
-
* with an object containing an error message or data response.
|
|
37
|
-
* @param {any} input - The input to be passed to the function.
|
|
38
|
-
* @returns {Promise<{ err?: string; data?: any }>} A promise that resolves with an object
|
|
39
|
-
* containing an error message or data response (serialized).
|
|
40
|
-
*/
|
|
41
|
-
private invoke;
|
|
42
|
-
}
|
|
@@ -1,102 +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
|
-
/**
|
|
11
|
-
* Represents a ContainerExecution class that handles the execution of a launchable handler.
|
|
12
|
-
* @template Input - The type of input expected by the launchable handler.
|
|
13
|
-
*/
|
|
14
|
-
export default class ContainerExecution {
|
|
15
|
-
/**
|
|
16
|
-
* Constructor for creating an instance of a class with a LaunchableHandlerType input.
|
|
17
|
-
* @param {LaunchableHandlerType<Input>} handler - The handler for the launchable type.
|
|
18
|
-
* @returns None
|
|
19
|
-
*/
|
|
20
|
-
constructor(handler) {
|
|
21
|
-
this.handler = handler;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Executes the function asynchronously, invoking the specified inputs and handling the response accordingly.
|
|
25
|
-
* If the response code is 200, the process exits with code 0; otherwise, it exits with code 1.
|
|
26
|
-
* @returns None
|
|
27
|
-
*/
|
|
28
|
-
execute() {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
try {
|
|
31
|
-
// Invoke
|
|
32
|
-
const resp = yield this.invoke(this.getInputs());
|
|
33
|
-
// Return
|
|
34
|
-
console.debug(resp);
|
|
35
|
-
if (!resp.err && resp.data && resp.data.statusCode == 200)
|
|
36
|
-
process.exit(0);
|
|
37
|
-
else
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
console.error(e);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Retrieves inputs from the process arguments and parses them as JSON.
|
|
48
|
-
* @returns {any} The parsed input object from process arguments.
|
|
49
|
-
*/
|
|
50
|
-
getInputs() {
|
|
51
|
-
let input = {};
|
|
52
|
-
console.debug(process.argv);
|
|
53
|
-
try {
|
|
54
|
-
input = JSON.parse(process.argv[2]);
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
console.log('[IKApi Launchable Runtime] - Error while decoding process arguments! (can be desconsider if no inputs were provided)', e.message);
|
|
58
|
-
}
|
|
59
|
-
return input;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Builds a context object for AWS Lambda function.
|
|
63
|
-
* @param {CallableFunction} callback - The callback function to be executed.
|
|
64
|
-
* @returns {Context} A context object with AWS Lambda properties.
|
|
65
|
-
*/
|
|
66
|
-
buildContext(callback) {
|
|
67
|
-
return {
|
|
68
|
-
awsRequestId: `${Date.now()}-${Date.now()}`,
|
|
69
|
-
callbackWaitsForEmptyEventLoop: true,
|
|
70
|
-
getRemainingTimeInMillis: () => 0,
|
|
71
|
-
done: (err, data) => callback(err, data),
|
|
72
|
-
fail: err => callback(err),
|
|
73
|
-
succeed: res => callback(null, res),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Asynchronously invokes a function with the given input and returns a promise that resolves
|
|
78
|
-
* with an object containing an error message or data response.
|
|
79
|
-
* @param {any} input - The input to be passed to the function.
|
|
80
|
-
* @returns {Promise<{ err?: string; data?: any }>} A promise that resolves with an object
|
|
81
|
-
* containing an error message or data response (serialized).
|
|
82
|
-
*/
|
|
83
|
-
invoke(input) {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
// eslint-disable-next-line no-async-promise-executor
|
|
86
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
try {
|
|
88
|
-
const context = this.buildContext((err, data) => {
|
|
89
|
-
resolve({ err, data });
|
|
90
|
-
});
|
|
91
|
-
const resp = yield this.handler(input, context);
|
|
92
|
-
if (resp)
|
|
93
|
-
resolve({ data: resp });
|
|
94
|
-
}
|
|
95
|
-
catch (e) {
|
|
96
|
-
reject(e);
|
|
97
|
-
}
|
|
98
|
-
}));
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=ContainerExec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContainerExec.js","sourceRoot":"","sources":["../../../../src/BaseEvent/Launchable/ContainerExec.ts"],"names":[],"mappings":";;;;;;;;;AAKA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAMrC;;;;OAIG;IACH,YAAY,OAAqC;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED;;;;OAIG;IACU,OAAO;;YAClB,IAAI,CAAC;gBACH,SAAS;gBACT,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;gBAChD,SAAS;gBACT,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBACnB,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,GAAG;oBAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;;oBACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACtB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC;QACH,CAAC;KAAA;IAED;;;OAGG;IACK,SAAS;QACf,IAAI,KAAK,GAAQ,EAAE,CAAA;QACnB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC3B,IAAI,CAAC;YACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QACrC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CACT,sHAAsH,EACtH,CAAC,CAAC,OAAO,CACV,CAAA;QACH,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;OAIG;IACK,YAAY,CAAC,QAA0B;QAC7C,OAAO;YACL,YAAY,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE;YAC3C,8BAA8B,EAAE,IAAI;YACpC,wBAAwB,EAAE,GAAG,EAAE,CAAC,CAAC;YACjC,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;YACxC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC1B,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,CAAA;IACrB,CAAC;IAED;;;;;;OAMG;IACW,MAAM,CAAC,KAAU;;YAC7B,qDAAqD;YACrD,OAAO,IAAI,OAAO,CAA+B,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;gBACzE,IAAI,CAAC;oBACH,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;wBAC9C,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAA;oBACxB,CAAC,CAAC,CAAA;oBACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;oBAC/C,IAAI,IAAI;wBAAE,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;gBACnC,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,MAAM,CAAC,CAAC,CAAC,CAAA;gBACX,CAAC;YACH,CAAC,CAAA,CAAC,CAAA;QACJ,CAAC;KAAA;CACF"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { LaunchableHandlerType } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a Launchable class that can be used to handle launchable items.
|
|
4
|
-
* @template Input - The type of input expected by the LaunchableHandlerType.
|
|
5
|
-
*/
|
|
6
|
-
export default class Launchable<Input = any> {
|
|
7
|
-
/**
|
|
8
|
-
* A private readonly property that holds a handler for launching with a specific input type.
|
|
9
|
-
* @type {LaunchableHandlerType<Input>}
|
|
10
|
-
*/
|
|
11
|
-
private readonly handler;
|
|
12
|
-
/**
|
|
13
|
-
* Constructor for creating an instance of a class with a LaunchableHandlerType input.
|
|
14
|
-
* @param {LaunchableHandlerType<Input>} handler - The handler for the launchable type.
|
|
15
|
-
* @returns None
|
|
16
|
-
*/
|
|
17
|
-
constructor(handler: LaunchableHandlerType<Input>);
|
|
18
|
-
/**
|
|
19
|
-
* Returns the export function based on whether the object is a container or not.
|
|
20
|
-
* If it is a container, it returns the container export function, otherwise it returns the handler function.
|
|
21
|
-
* @returns {CallableFunction} The export function to be used.
|
|
22
|
-
*/
|
|
23
|
-
getExport(): CallableFunction;
|
|
24
|
-
/**
|
|
25
|
-
* Checks if the current element is a container by calling the isHybridlessContainer method from the Utils class.
|
|
26
|
-
* @returns {boolean} - true if the element is a container, false otherwise.
|
|
27
|
-
*/
|
|
28
|
-
private isContainer;
|
|
29
|
-
/**
|
|
30
|
-
* Returns a callable function that executes a ContainerExecution instance and returns a promise.
|
|
31
|
-
* @returns {CallableFunction} A function that when called, executes a ContainerExecution instance.
|
|
32
|
-
*/
|
|
33
|
-
private getContainerExport;
|
|
34
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import ContainerExecution from './ContainerExec.js';
|
|
2
|
-
import Utils from '../../Util/Utils.js';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a Launchable class that can be used to handle launchable items.
|
|
5
|
-
* @template Input - The type of input expected by the LaunchableHandlerType.
|
|
6
|
-
*/
|
|
7
|
-
export default class Launchable {
|
|
8
|
-
/**
|
|
9
|
-
* Constructor for creating an instance of a class with a LaunchableHandlerType input.
|
|
10
|
-
* @param {LaunchableHandlerType<Input>} handler - The handler for the launchable type.
|
|
11
|
-
* @returns None
|
|
12
|
-
*/
|
|
13
|
-
constructor(handler) {
|
|
14
|
-
this.handler = handler;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns the export function based on whether the object is a container or not.
|
|
18
|
-
* If it is a container, it returns the container export function, otherwise it returns the handler function.
|
|
19
|
-
* @returns {CallableFunction} The export function to be used.
|
|
20
|
-
*/
|
|
21
|
-
getExport() {
|
|
22
|
-
return this.isContainer() ? this.getContainerExport() : this.handler;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Checks if the current element is a container by calling the isHybridlessContainer method from the Utils class.
|
|
26
|
-
* @returns {boolean} - true if the element is a container, false otherwise.
|
|
27
|
-
*/
|
|
28
|
-
isContainer() {
|
|
29
|
-
return Utils.isHybridlessContainer();
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Returns a callable function that executes a ContainerExecution instance and returns a promise.
|
|
33
|
-
* @returns {CallableFunction} A function that when called, executes a ContainerExecution instance.
|
|
34
|
-
*/
|
|
35
|
-
getContainerExport() {
|
|
36
|
-
// emulate lambda invocation
|
|
37
|
-
const ce = new ContainerExecution(this.handler);
|
|
38
|
-
ce.execute().then(() => { });
|
|
39
|
-
// return empty function, we are all done
|
|
40
|
-
return () => { };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BaseEvent/Launchable/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,oBAAoB,CAAA;AAEnD,OAAO,KAAK,MAAM,qBAAqB,CAAA;AAEvC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAO7B;;;;OAIG;IACH,YAAY,OAAqC;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED;;;;OAIG;IACI,SAAS;QACd,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAA;IACtE,CAAC;IAED;;;OAGG;IACK,WAAW;QACjB,OAAO,KAAK,CAAC,qBAAqB,EAAE,CAAA;IACtC,CAAC;IAED;;;OAGG;IACK,kBAAkB;QACxB,4BAA4B;QAC5B,MAAM,EAAE,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/C,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAC3B,yCAAyC;QACzC,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;IACjB,CAAC;CACF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Context } from 'aws-lambda';
|
|
2
|
-
import Response from '../../API/Response.js';
|
|
3
|
-
/**
|
|
4
|
-
* Defines a type for a launchable handler that takes an input event and context,
|
|
5
|
-
* and returns a promise of a response.
|
|
6
|
-
* @param {Input} event - The input event for the handler.
|
|
7
|
-
* @param {Context} context - The context for the handler.
|
|
8
|
-
* @returns {Promise<Response<any>>} A promise that resolves to a response.
|
|
9
|
-
*/
|
|
10
|
-
export type LaunchableHandlerType<Input> = (event: Input, context: Context) => Promise<Response<any> | null>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/BaseEvent/Launchable/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { TransactionConfig } from './Transaction.js';
|
|
2
|
-
import Logger from '../Logger/Logger.js';
|
|
3
|
-
import Publisher from '../Publisher/Publisher.js';
|
|
4
|
-
/**
|
|
5
|
-
* A type that represents a modified version of the TransactionConfig type, excluding the 'throwOnErrors' and 'syncReturn' properties.
|
|
6
|
-
*/
|
|
7
|
-
export type ProcessConfig = Omit<TransactionConfig, 'throwOnErrors' | 'syncReturn'>;
|
|
8
|
-
/**
|
|
9
|
-
* Represents a long-running process that executes a given function at a specified interval.
|
|
10
|
-
*/
|
|
11
|
-
export default class Process {
|
|
12
|
-
/**
|
|
13
|
-
* Private member variable representing the interval value.
|
|
14
|
-
* @type {number}
|
|
15
|
-
* @private
|
|
16
|
-
*/
|
|
17
|
-
private interval;
|
|
18
|
-
/**
|
|
19
|
-
* A logger object used for logging messages, errors, and other information.
|
|
20
|
-
* @readonly
|
|
21
|
-
*/
|
|
22
|
-
readonly logger: Logger;
|
|
23
|
-
/**
|
|
24
|
-
* The publisher of the content.
|
|
25
|
-
*/
|
|
26
|
-
readonly publisher: Publisher;
|
|
27
|
-
/**
|
|
28
|
-
* A reference to the NodeJS.Timeout object representing the interval timer.
|
|
29
|
-
*/
|
|
30
|
-
timeout: NodeJS.Timeout;
|
|
31
|
-
/**
|
|
32
|
-
* Constructs a new instance of the LongRunningProcess class.
|
|
33
|
-
* @param {ProcessConfig} config - The configuration object for the process.
|
|
34
|
-
* @param {number} interval - The interval at which the process should run.
|
|
35
|
-
* @returns None
|
|
36
|
-
*/
|
|
37
|
-
constructor(config: ProcessConfig, interval: number);
|
|
38
|
-
/**
|
|
39
|
-
* Executes the provided execution function at a specified interval.
|
|
40
|
-
* @param {Function} executionFunc - The function to execute.
|
|
41
|
-
* @returns None
|
|
42
|
-
*/
|
|
43
|
-
execute(executionFunc: any): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Executes the given execution function asynchronously and handles any exceptions that occur.
|
|
46
|
-
* @param {Function} executionFunc - The function to execute.
|
|
47
|
-
* @returns {boolean} - Returns true if the execution failed, false otherwise.
|
|
48
|
-
*/
|
|
49
|
-
private iexecute;
|
|
50
|
-
}
|
|
@@ -1,64 +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 Logger from '../Logger/Logger.js';
|
|
11
|
-
import Publisher from '../Publisher/Publisher.js';
|
|
12
|
-
/**
|
|
13
|
-
* Represents a long-running process that executes a given function at a specified interval.
|
|
14
|
-
*/
|
|
15
|
-
export default class Process {
|
|
16
|
-
/**
|
|
17
|
-
* Constructs a new instance of the LongRunningProcess class.
|
|
18
|
-
* @param {ProcessConfig} config - The configuration object for the process.
|
|
19
|
-
* @param {number} interval - The interval at which the process should run.
|
|
20
|
-
* @returns None
|
|
21
|
-
*/
|
|
22
|
-
constructor(config, interval) {
|
|
23
|
-
this.interval = interval;
|
|
24
|
-
this.logger = new Logger(config.logger, 'long-running-process');
|
|
25
|
-
this.publisher = new Publisher(config.publisher);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Executes the provided execution function at a specified interval.
|
|
29
|
-
* @param {Function} executionFunc - The function to execute.
|
|
30
|
-
* @returns None
|
|
31
|
-
*/
|
|
32
|
-
execute(executionFunc) {
|
|
33
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
this.logger.debug('Starting main process code');
|
|
35
|
-
//Program loop
|
|
36
|
-
this.timeout = setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
yield this.iexecute(executionFunc);
|
|
38
|
-
}), this.interval);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Executes the given execution function asynchronously and handles any exceptions that occur.
|
|
43
|
-
* @param {Function} executionFunc - The function to execute.
|
|
44
|
-
* @returns {boolean} - Returns true if the execution failed, false otherwise.
|
|
45
|
-
*/
|
|
46
|
-
iexecute(executionFunc) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
let executionFailed = true; //failed til we say no!
|
|
49
|
-
// safe execution handler
|
|
50
|
-
try {
|
|
51
|
-
// Execute
|
|
52
|
-
yield executionFunc(this);
|
|
53
|
-
executionFailed = false;
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
/* EXECUTION FAIL */
|
|
57
|
-
this.logger.error('Exception when executing main process code. Rolling back DB!');
|
|
58
|
-
this.logger.exception(e);
|
|
59
|
-
}
|
|
60
|
-
return executionFailed;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=Process.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Process.js","sourceRoot":"","sources":["../../../src/BaseEvent/Process.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,MAAM,MAAM,qBAAqB,CAAA;AACxC,OAAO,SAAS,MAAM,2BAA2B,CAAA;AAOjD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;IAqB1B;;;;;OAKG;IACH,YAAY,MAAqB,EAAE,QAAgB;QACjD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAA;QAC/D,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAClD,CAAC;IAED;;;;OAIG;IACU,OAAO,CAAC,aAAa;;YAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAA;YAC/C,cAAc;YACd,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,GAAS,EAAE;gBACpC,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;YACpC,CAAC,CAAA,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnB,CAAC;KAAA;IAED;;;;OAIG;IACW,QAAQ,CAAC,aAAa;;YAClC,IAAI,eAAe,GAAG,IAAI,CAAA,CAAC,uBAAuB;YAClD,yBAAyB;YACzB,IAAI,CAAC;gBACH,UAAU;gBACV,MAAM,aAAa,CAAC,IAAI,CAAC,CAAA;gBACzB,eAAe,GAAG,KAAK,CAAA;YACzB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,oBAAoB;gBACpB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAA;gBACjF,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;YAC1B,CAAC;YACD,OAAO,eAAe,CAAA;QACxB,CAAC;KAAA;CACF"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'aws-lambda';
|
|
2
|
-
import Transaction, { TransactionConfig } from './Transaction.js';
|
|
3
|
-
import Response, { ResponseErrorType } from '../API/Response.js';
|
|
4
|
-
/**
|
|
5
|
-
* Represents a step transaction that extends the Transaction class.
|
|
6
|
-
*/
|
|
7
|
-
export default class StepTransaction extends Transaction {
|
|
8
|
-
/**
|
|
9
|
-
* Constructor for creating a new Transaction object.
|
|
10
|
-
* @param {any} event - The event object.
|
|
11
|
-
* @param {Context} context - The context object.
|
|
12
|
-
* @param {TransactionConfig} [config] - Optional configuration for the transaction.
|
|
13
|
-
* @returns None
|
|
14
|
-
*/
|
|
15
|
-
constructor(event: any, context: Context, config?: TransactionConfig);
|
|
16
|
-
/**
|
|
17
|
-
* Generates an error response with the provided error message and error code.
|
|
18
|
-
* @param {string} error - The error message to include in the response.
|
|
19
|
-
* @param {string} code - The error code associated with the error.
|
|
20
|
-
* @returns {Response<ResponseErrorType>} - The error response object.
|
|
21
|
-
*/
|
|
22
|
-
protected getErrorResponse(error: string, code: string): Response<ResponseErrorType>;
|
|
23
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import Transaction from './Transaction.js';
|
|
2
|
-
import Response from '../API/Response.js';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a step transaction that extends the Transaction class.
|
|
5
|
-
*/
|
|
6
|
-
export default class StepTransaction extends Transaction {
|
|
7
|
-
/**
|
|
8
|
-
* Constructor for creating a new Transaction object.
|
|
9
|
-
* @param {any} event - The event object.
|
|
10
|
-
* @param {Context} context - The context object.
|
|
11
|
-
* @param {TransactionConfig} [config] - Optional configuration for the transaction.
|
|
12
|
-
* @returns None
|
|
13
|
-
*/
|
|
14
|
-
constructor(event, context, config) {
|
|
15
|
-
super(event, context, Object.assign({ syncReturn: true, throwOnErrors: true }, (config || {})));
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Generates an error response with the provided error message and error code.
|
|
19
|
-
* @param {string} error - The error message to include in the response.
|
|
20
|
-
* @param {string} code - The error code associated with the error.
|
|
21
|
-
* @returns {Response<ResponseErrorType>} - The error response object.
|
|
22
|
-
*/
|
|
23
|
-
getErrorResponse(error, code) {
|
|
24
|
-
return Response.StepFunctionResponse({ err: error, errCode: code }, 400);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=StepTransaction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StepTransaction.js","sourceRoot":"","sources":["../../../src/BaseEvent/StepTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,WAAkC,MAAM,kBAAkB,CAAA;AACjE,OAAO,QAA+B,MAAM,oBAAoB,CAAA;AAEhE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,WAAW;IACtD;;;;;;OAMG;IACH,YAAY,KAAU,EAAE,OAAgB,EAAE,MAA0B;QAClE,KAAK,CAAC,KAAK,EAAE,OAAO,kBAClB,UAAU,EAAE,IAAI,EAChB,aAAa,EAAE,IAAI,IAEhB,CAAC,MAAM,IAAI,EAAE,CAAC,EACjB,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACO,gBAAgB,CAAC,KAAa,EAAE,IAAY;QACpD,OAAO,QAAQ,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,CAAA;IAC1E,CAAC;CACF"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import type { APIGatewayEvent, Context, DynamoDBStreamEvent, SQSEvent } from 'aws-lambda';
|
|
2
|
-
import Request from '../API/Request.js';
|
|
3
|
-
import Response, { ResponseErrorType } from '../API/Response.js';
|
|
4
|
-
import type { DatabaseImplType, DatabaseTransactionType, DatabaseType, DbConfig } from '../Database/types.js';
|
|
5
|
-
import Logger, { LoggerConfig } from '../Logger/Logger.js';
|
|
6
|
-
import Publisher, { PublisherConfig } from '../Publisher/Publisher.js';
|
|
7
|
-
/**
|
|
8
|
-
* Defines a type for executing a transaction and returning a promise with the response.
|
|
9
|
-
* @param {TransactionType} transaction - The transaction to execute.
|
|
10
|
-
* @returns A promise that resolves to the response of the transaction.
|
|
11
|
-
*/
|
|
12
|
-
export type TransactionExecution<TransactionType, ResponseInnerType, MiscRespType = never> = (transaction: TransactionType) => Promise<Response<ResponseInnerType> | Response<ResponseErrorType> | MiscRespType>;
|
|
13
|
-
/**
|
|
14
|
-
* Represents the configuration options for a transaction.
|
|
15
|
-
* @typedef {Object} TransactionConfig
|
|
16
|
-
* @property {boolean} [throwOnErrors] - Whether to throw an error if there are any errors during the transaction.
|
|
17
|
-
* @property {boolean} [syncReturn] - Whether to return the result of the transaction synchronously.
|
|
18
|
-
* @property {boolean} [skipCleanTmp] - Whether to skip cleaning the temporary folder, in EventProcessor.
|
|
19
|
-
* @property {LoggerConfig} [logger] - The configuration options for the logger.
|
|
20
|
-
* @property {PublisherConfig} [publisher] - The configuration options for the publisher.
|
|
21
|
-
*/
|
|
22
|
-
export type TransactionConfig = {
|
|
23
|
-
throwOnErrors?: boolean;
|
|
24
|
-
syncReturn?: boolean;
|
|
25
|
-
skipCleanTmp?: boolean;
|
|
26
|
-
logger?: LoggerConfig;
|
|
27
|
-
publisher?: PublisherConfig;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Represents a simple string dictionary with string values
|
|
31
|
-
*/
|
|
32
|
-
export type StringMap = {
|
|
33
|
-
[key: string]: string | null;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Represents a transaction object that handles the execution of a request and manages the response.
|
|
37
|
-
* @template InputType - The type of the input data for the transaction.
|
|
38
|
-
* @template ResponseInnerType - The type of the inner response data for the transaction.
|
|
39
|
-
* @template MiscRespType - The type of miscellaneous response data for the transaction.
|
|
40
|
-
*/
|
|
41
|
-
export default class Transaction<InputType = never, ResponseInnerType = null, MiscRespType = never, PathParamsType = StringMap, QueryParamsType = StringMap> {
|
|
42
|
-
/**
|
|
43
|
-
* The instance of the DatabaseManager class used for managing the database.
|
|
44
|
-
*/
|
|
45
|
-
private databaseManager;
|
|
46
|
-
/**
|
|
47
|
-
* An array of database transactions.
|
|
48
|
-
* @type {DatabaseTransaction[]}
|
|
49
|
-
*/
|
|
50
|
-
private transactions;
|
|
51
|
-
/**
|
|
52
|
-
* Represents an event object.
|
|
53
|
-
* @private
|
|
54
|
-
* @type {any}
|
|
55
|
-
*/
|
|
56
|
-
private event;
|
|
57
|
-
/**
|
|
58
|
-
* The context object for the current instance.
|
|
59
|
-
*/
|
|
60
|
-
private context;
|
|
61
|
-
/**
|
|
62
|
-
* The response object that can hold different types of responses.
|
|
63
|
-
* @type {Response<ResponseInnerType | ResponseErrorType> | MiscRespType | null}
|
|
64
|
-
*/
|
|
65
|
-
private response;
|
|
66
|
-
/**
|
|
67
|
-
* A private boolean variable indicating whether the return value of a synchronous operation
|
|
68
|
-
* should be synchronized with the calling thread.
|
|
69
|
-
*/
|
|
70
|
-
private syncReturn;
|
|
71
|
-
/**
|
|
72
|
-
* A boolean flag indicating whether retroactive errors are enabled or not.
|
|
73
|
-
* @private
|
|
74
|
-
*/
|
|
75
|
-
private retrowErrors;
|
|
76
|
-
/**
|
|
77
|
-
* A logger object used for logging messages, errors, and other information.
|
|
78
|
-
* @readonly
|
|
79
|
-
*/
|
|
80
|
-
readonly logger: Logger;
|
|
81
|
-
/**
|
|
82
|
-
* The request object for making a request of type InputType.
|
|
83
|
-
* @readonly
|
|
84
|
-
*/
|
|
85
|
-
readonly request: Request<InputType, PathParamsType, QueryParamsType>;
|
|
86
|
-
/**
|
|
87
|
-
* The publisher of the content.
|
|
88
|
-
*/
|
|
89
|
-
readonly publisher: Publisher;
|
|
90
|
-
/**
|
|
91
|
-
* A function that acts as a response proxy for a given response object.
|
|
92
|
-
* @param {Response<ResponseInnerType>} response - The response object to proxy.
|
|
93
|
-
* @returns A promise that resolves to void.
|
|
94
|
-
*/
|
|
95
|
-
responseProxy: ((response: Response<ResponseInnerType>) => Promise<void>) | null;
|
|
96
|
-
/**
|
|
97
|
-
* Constructs a new instance of the Transaction class.
|
|
98
|
-
* @param {APIGatewayEvent | SQSEvent | DynamoDBStreamEvent} event - The event object passed to the Lambda function.
|
|
99
|
-
* @param {Context} context - The context object passed to the Lambda function.
|
|
100
|
-
* @param {TransactionConfig} [config] - Optional configuration object for the transaction.
|
|
101
|
-
* @returns None
|
|
102
|
-
*/
|
|
103
|
-
constructor(event: APIGatewayEvent | SQSEvent | DynamoDBStreamEvent, context: Context, config?: TransactionConfig);
|
|
104
|
-
/**
|
|
105
|
-
* Executes a transaction using the provided execution function and returns a promise
|
|
106
|
-
* that resolves to the response or miscellaneous response.
|
|
107
|
-
* @param {TransactionExecution<Transaction<InputType, ResponseInnerType, MiscRespType>, ResponseInnerType, MiscRespType>} executionFunc - The execution function to be executed.
|
|
108
|
-
* @returns {Promise<Response<ResponseInnerType | ResponseErrorType> | MiscRespType>} - A promise that resolves to the response or miscellaneous response.
|
|
109
|
-
*/
|
|
110
|
-
execute(executionFunc: TransactionExecution<Transaction<InputType, ResponseInnerType, MiscRespType, PathParamsType, QueryParamsType>, ResponseInnerType, MiscRespType>): Promise<Response<ResponseInnerType | ResponseErrorType> | MiscRespType | null>;
|
|
111
|
-
/**
|
|
112
|
-
* Executes a transaction using the provided execution function and handles the response.
|
|
113
|
-
* @param {TransactionExecution<Transaction<InputType, ResponseInnerType, MiscRespType>, ResponseInnerType, MiscRespType>} executionFunc - The function to execute the transaction.
|
|
114
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the execution failed or not.
|
|
115
|
-
*/
|
|
116
|
-
private iexecute;
|
|
117
|
-
/**
|
|
118
|
-
* Retrieves a database transaction based on the provided database configuration.
|
|
119
|
-
* @param {DbConfig<S>} config - The configuration object for the database.
|
|
120
|
-
* @returns {Promise<DatabaseTransactionType<S, DBSchema>>} A promise that resolves to the database transaction.
|
|
121
|
-
*/
|
|
122
|
-
getDbTransaction<S extends DatabaseType, DBSchema>(config: DbConfig<S>): Promise<DatabaseTransactionType<S, DBSchema>>;
|
|
123
|
-
/**
|
|
124
|
-
* Retrieves a database instance based on the provided configuration.
|
|
125
|
-
* @param {DbConfig<S>} config - The configuration object specifying the type of database.
|
|
126
|
-
* @returns {DatabaseImplType<S, DBSchema>} A database instance based on the provided configuration.
|
|
127
|
-
*/
|
|
128
|
-
getDatabase<S extends DatabaseType, DBSchema>(config: DbConfig<S>): DatabaseImplType<S, DBSchema>;
|
|
129
|
-
/**
|
|
130
|
-
* Get the remaining time in milliseconds for the current execution context.
|
|
131
|
-
* @returns {number} The remaining time in milliseconds, or -1 if the time is not available.
|
|
132
|
-
*/
|
|
133
|
-
getRemainingTimeInMillis(): number;
|
|
134
|
-
private executeDBTransactions;
|
|
135
|
-
/**
|
|
136
|
-
* Executes a logger flush operation with error handling and logging.
|
|
137
|
-
* @param {Function} safeExecution - The function to execute safely.
|
|
138
|
-
* @returns None
|
|
139
|
-
* @throws {Error} - If `retrowErrors` is true and an error occurs during execution.
|
|
140
|
-
*/
|
|
141
|
-
private executeLoggerFlush;
|
|
142
|
-
/**
|
|
143
|
-
* Generates an error response with the provided error message and code.
|
|
144
|
-
* @param {string} error - The error message to include in the response.
|
|
145
|
-
* @param {string} code - The error code associated with the response.
|
|
146
|
-
* @returns {Response<ResponseErrorType>} - The error response object.
|
|
147
|
-
*/
|
|
148
|
-
protected getErrorResponse(error: string, code: string): Response<ResponseErrorType>;
|
|
149
|
-
}
|