@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,83 +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 class that can be used to create a singleton instance of a class that is created asynchronously.
|
|
12
|
-
*/
|
|
13
|
-
export default class AsyncSingleton {
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new instance of the AsyncSingleton class.
|
|
16
|
-
* @param factory The factory function that creates the instance.
|
|
17
|
-
* @param checker The function that checks if the instance is valid.
|
|
18
|
-
*/
|
|
19
|
-
constructor(factory, checker = () => __awaiter(this, void 0, void 0, function* () { return true; })) {
|
|
20
|
-
this.queue = [];
|
|
21
|
-
this.instantiating = false;
|
|
22
|
-
this.factory = factory;
|
|
23
|
-
this.checker = checker;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Gets the instance of the class.
|
|
27
|
-
* @param r The configuration object for creating the instance.
|
|
28
|
-
*/
|
|
29
|
-
instance(r) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
if (this.value && (yield this.checker(this.value)))
|
|
32
|
-
return this.value;
|
|
33
|
-
if (this.instantiating) {
|
|
34
|
-
return yield this.awaitOtherInit();
|
|
35
|
-
}
|
|
36
|
-
return yield this.initHere(r);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Gets the current value, may be undefined or invalid.
|
|
41
|
-
*/
|
|
42
|
-
getValue() {
|
|
43
|
-
return this.value;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Clears the current value and rejects all pending promises.
|
|
47
|
-
*/
|
|
48
|
-
clear() {
|
|
49
|
-
this.value = undefined;
|
|
50
|
-
for (const [, rej] of this.queue) {
|
|
51
|
-
rej();
|
|
52
|
-
}
|
|
53
|
-
this.queue = [];
|
|
54
|
-
}
|
|
55
|
-
initHere(r) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
try {
|
|
58
|
-
this.instantiating = true;
|
|
59
|
-
this.value = yield this.factory(r);
|
|
60
|
-
for (const [res] of this.queue) {
|
|
61
|
-
res();
|
|
62
|
-
}
|
|
63
|
-
this.queue = [];
|
|
64
|
-
return this.value;
|
|
65
|
-
}
|
|
66
|
-
finally {
|
|
67
|
-
for (const [, rej] of this.queue) {
|
|
68
|
-
rej();
|
|
69
|
-
}
|
|
70
|
-
this.instantiating = false;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
awaitOtherInit() {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
yield new Promise((res, rej) => {
|
|
77
|
-
this.queue.push([res, rej]);
|
|
78
|
-
});
|
|
79
|
-
return this.value;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=AsyncSingleton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncSingleton.js","sourceRoot":"","sources":["../../../src/Util/AsyncSingleton.ts"],"names":[],"mappings":";;;;;;;;;AAEA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IASjC;;;;OAIG;IACH,YACE,OAA6B,EAC7B,UAA0C,GAAS,EAAE,gDAAC,OAAA,IAAI,CAAA,GAAA;QAZpD,UAAK,GAAoB,EAAE,CAAA;QAC3B,kBAAa,GAAY,KAAK,CAAA;QAapC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED;;;OAGG;IACU,QAAQ,CAAC,CAAI;;YACxB,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC,KAAK,CAAA;YAErE,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvB,OAAO,MAAM,IAAI,CAAC,cAAc,EAAE,CAAA;YACpC,CAAC;YAED,OAAO,MAAM,IAAI,CAAC,QA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
|
-
/**
|
|
2
|
-
* Utility class containing various static methods for common operations.
|
|
3
|
-
*/
|
|
4
|
-
export default class Utils {
|
|
5
|
-
/**
|
|
6
|
-
* Checks if the application is running in a hybridless container.
|
|
7
|
-
* @returns {boolean} - True if the application is running in a hybridless container, false otherwise.
|
|
8
|
-
*/
|
|
9
|
-
static isHybridlessContainer(): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Checks if a given string is valid.
|
|
12
|
-
* @param {string} string - The string to check.
|
|
13
|
-
* @returns {boolean} - True if the string is valid, false otherwise.
|
|
14
|
-
*/
|
|
15
|
-
static isValidString(string: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Parses a string into an integer and returns null if the string is not a valid number.
|
|
18
|
-
* @param {string} str - The string to parse into an integer.
|
|
19
|
-
* @returns {number | null} - The parsed integer or null if the string is not a valid number.
|
|
20
|
-
*/
|
|
21
|
-
static parseIntNullIfNaN(str?: string): number | null;
|
|
22
|
-
/**
|
|
23
|
-
* Parses a JSON string and returns the resulting object. If the string is empty or
|
|
24
|
-
* cannot be parsed, null is returned.
|
|
25
|
-
* @param {string} string - The JSON string to parse.
|
|
26
|
-
* @returns {any | null} - The parsed object or null if the string is empty or invalid.
|
|
27
|
-
*/
|
|
28
|
-
static parseObjectNullIfEmpty(string: string | undefined): any | null;
|
|
29
|
-
/**
|
|
30
|
-
* Checks if a given value is a valid number.
|
|
31
|
-
* @param {string} number - The value to be checked.
|
|
32
|
-
* @returns {boolean} - True if the value is a valid number, false otherwise.
|
|
33
|
-
*/
|
|
34
|
-
static isValidNumber(number: string): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieves the value from an object using a case-insensitive key lookup.
|
|
37
|
-
* @param {any} obj - The object to search for the key.
|
|
38
|
-
* @param {string} key - The key to search for in the object.
|
|
39
|
-
* @returns {any | null} The value associated with the key, or null if the key is not found.
|
|
40
|
-
*/
|
|
41
|
-
static caseInsensitiveObjectForKey(obj: any, key: string): any | null;
|
|
42
|
-
/**
|
|
43
|
-
* Cleans out the /tmp directory asynchronously.
|
|
44
|
-
*/
|
|
45
|
-
static cleanTemporaryFolder(): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Marshalls the given item into a DynamoDB format.
|
|
48
|
-
* If the item is an array, it maps over each element and marshalls it recursively.
|
|
49
|
-
* If the item is an object, it marshalls the object using the marshall function with options to remove undefined values and convert class instances to maps.
|
|
50
|
-
* If the item is neither an array nor an object, it converts the item to an attribute.
|
|
51
|
-
* @param {any} item - The item to be marshalled.
|
|
52
|
-
* @returns The marshalled item in DynamoDB format.
|
|
53
|
-
*/
|
|
54
|
-
static ddbMarshall<T>(item: T, rec?: boolean): any;
|
|
55
|
-
/**
|
|
56
|
-
* Recursively unmarshalls a DynamoDB item by converting it into a plain JavaScript object.
|
|
57
|
-
* @param {any} item - The DynamoDB item to unmarshall.
|
|
58
|
-
* @returns {any} The unmarshalled JavaScript object.
|
|
59
|
-
*/
|
|
60
|
-
static ddbUnmarshall(item: any): any;
|
|
61
|
-
}
|
package/dist/src/Util/Utils.js
DELETED
|
@@ -1,147 +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 child_process from 'child_process';
|
|
11
|
-
import { convertToAttr, marshall, unmarshall } from '@aws-sdk/util-dynamodb';
|
|
12
|
-
/**
|
|
13
|
-
* Utility class containing various static methods for common operations.
|
|
14
|
-
*/
|
|
15
|
-
export default class Utils {
|
|
16
|
-
/**
|
|
17
|
-
* Checks if the application is running in a hybridless container.
|
|
18
|
-
* @returns {boolean} - True if the application is running in a hybridless container, false otherwise.
|
|
19
|
-
*/
|
|
20
|
-
static isHybridlessContainer() {
|
|
21
|
-
return process.env.HYBRIDLESS_RUNTIME == 'true';
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Checks if a given string is valid.
|
|
25
|
-
* @param {string} string - The string to check.
|
|
26
|
-
* @returns {boolean} - True if the string is valid, false otherwise.
|
|
27
|
-
*/
|
|
28
|
-
static isValidString(string) {
|
|
29
|
-
return (string === null || string === void 0 ? void 0 : string.length) > 0 && !Array.isArray(string);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Parses a string into an integer and returns null if the string is not a valid number.
|
|
33
|
-
* @param {string} str - The string to parse into an integer.
|
|
34
|
-
* @returns {number | null} - The parsed integer or null if the string is not a valid number.
|
|
35
|
-
*/
|
|
36
|
-
static parseIntNullIfNaN(str) {
|
|
37
|
-
const n = parseInt(str || '');
|
|
38
|
-
return isNaN(n) ? null : n;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Parses a JSON string and returns the resulting object. If the string is empty or
|
|
42
|
-
* cannot be parsed, null is returned.
|
|
43
|
-
* @param {string} string - The JSON string to parse.
|
|
44
|
-
* @returns {any | null} - The parsed object or null if the string is empty or invalid.
|
|
45
|
-
*/
|
|
46
|
-
static parseObjectNullIfEmpty(string) {
|
|
47
|
-
let o = null;
|
|
48
|
-
try {
|
|
49
|
-
o = string ? JSON.parse(string) : null;
|
|
50
|
-
if (o && Object.keys(o).length <= 0)
|
|
51
|
-
o = null;
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
/* empty */
|
|
55
|
-
}
|
|
56
|
-
return o;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Checks if a given value is a valid number.
|
|
60
|
-
* @param {string} number - The value to be checked.
|
|
61
|
-
* @returns {boolean} - True if the value is a valid number, false otherwise.
|
|
62
|
-
*/
|
|
63
|
-
static isValidNumber(number) {
|
|
64
|
-
let validNumb = NaN;
|
|
65
|
-
try {
|
|
66
|
-
validNumb = parseInt(number + '');
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
console.error('Error while validating number', e);
|
|
70
|
-
}
|
|
71
|
-
return !isNaN(validNumb) && !Array.isArray(number);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Retrieves the value from an object using a case-insensitive key lookup.
|
|
75
|
-
* @param {any} obj - The object to search for the key.
|
|
76
|
-
* @param {string} key - The key to search for in the object.
|
|
77
|
-
* @returns {any | null} The value associated with the key, or null if the key is not found.
|
|
78
|
-
*/
|
|
79
|
-
static caseInsensitiveObjectForKey(obj, key) {
|
|
80
|
-
if (!obj)
|
|
81
|
-
return null;
|
|
82
|
-
const insensitiveKey = Object.keys(obj).find(k => k.toLowerCase() === key.toLowerCase());
|
|
83
|
-
if (insensitiveKey && insensitiveKey != '')
|
|
84
|
-
return obj[insensitiveKey];
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Cleans out the /tmp directory asynchronously.
|
|
89
|
-
*/
|
|
90
|
-
static cleanTemporaryFolder() {
|
|
91
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
return new Promise(resolve => {
|
|
93
|
-
try {
|
|
94
|
-
child_process.execSync('rm -rf /tmp/*');
|
|
95
|
-
console.log('Cleaned tmp folder');
|
|
96
|
-
}
|
|
97
|
-
catch (err) {
|
|
98
|
-
console.error('Error while cleaning tmp folder', err);
|
|
99
|
-
}
|
|
100
|
-
finally {
|
|
101
|
-
resolve();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Marshalls the given item into a DynamoDB format.
|
|
108
|
-
* If the item is an array, it maps over each element and marshalls it recursively.
|
|
109
|
-
* If the item is an object, it marshalls the object using the marshall function with options to remove undefined values and convert class instances to maps.
|
|
110
|
-
* If the item is neither an array nor an object, it converts the item to an attribute.
|
|
111
|
-
* @param {any} item - The item to be marshalled.
|
|
112
|
-
* @returns The marshalled item in DynamoDB format.
|
|
113
|
-
*/
|
|
114
|
-
static ddbMarshall(item, rec) {
|
|
115
|
-
if (Array.isArray(item))
|
|
116
|
-
return { L: item.map(_i => this.ddbMarshall(_i, true)) };
|
|
117
|
-
else if (typeof item === 'object' && isNaN(parseInt(item))) {
|
|
118
|
-
const marshalled = marshall(item, {
|
|
119
|
-
removeUndefinedValues: true,
|
|
120
|
-
convertClassInstanceToMap: true,
|
|
121
|
-
});
|
|
122
|
-
if (rec)
|
|
123
|
-
return { M: marshalled };
|
|
124
|
-
else
|
|
125
|
-
return marshalled;
|
|
126
|
-
}
|
|
127
|
-
else
|
|
128
|
-
return convertToAttr(item, { removeUndefinedValues: true, convertClassInstanceToMap: true });
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Recursively unmarshalls a DynamoDB item by converting it into a plain JavaScript object.
|
|
132
|
-
* @param {any} item - The DynamoDB item to unmarshall.
|
|
133
|
-
* @returns {any} The unmarshalled JavaScript object.
|
|
134
|
-
*/
|
|
135
|
-
static ddbUnmarshall(item) {
|
|
136
|
-
if (!item && item !== false)
|
|
137
|
-
return null;
|
|
138
|
-
if (Array.isArray(item)) {
|
|
139
|
-
return item.map(_item => this.ddbUnmarshall(_item));
|
|
140
|
-
}
|
|
141
|
-
else if (typeof item === 'object') {
|
|
142
|
-
return unmarshall(item);
|
|
143
|
-
}
|
|
144
|
-
return item;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
//# sourceMappingURL=Utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Util/Utils.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,aAAa,MAAM,eAAe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C,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,CAAA;aAC5E,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAW,CAAC,CAAC,EAAE,CAAC;YAClE,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,EAAE;gBAChC,qBAAqB,EAAE,IAAI;gBAC3B,yBAAyB,EAAE,IAAI;aAChC,CAAC,CAAA;YACF,IAAI,GAAG;gBAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAA;;gBAC5B,OAAO,UAAU,CAAA;QACxB,CAAC;;YACC,OAAO,aAAa,CAAC,IAAI,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAA;IAChG,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,aAAa,CAAC,IAAI;QAC9B,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,KAAK;YAAE,OAAO,IAAI,CAAA;QACxC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;QACrD,CAAC;aAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YACpC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAA;QACzB,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import Response, { ResponseErrorType } from '../API/Response.js';
|
|
3
|
-
/**
|
|
4
|
-
* Validates the given data against the provided schema.
|
|
5
|
-
* @param {any} data - The data to be validated.
|
|
6
|
-
* @param {z.ZodObject<any>} schema - The schema to validate against.
|
|
7
|
-
* @returns {boolean | Response<ResponseErrorType>} - Returns true if the data is valid, otherwise returns a response object with an error message.
|
|
8
|
-
*/
|
|
9
|
-
export default class Validator {
|
|
10
|
-
/**
|
|
11
|
-
* Validates the given data against the provided schema.
|
|
12
|
-
* @param {any} data - The data to be validated.
|
|
13
|
-
* @param {z.ZodObject<any> | z.ZodUnion<any>} schema - The schema to validate against.
|
|
14
|
-
* @returns {boolean | Response<ResponseErrorType>} - Returns either true if the data is valid or a Response object with an error message if validation fails.
|
|
15
|
-
*/
|
|
16
|
-
static validateSchema(data: any, schema: z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>): boolean | Response<ResponseErrorType>;
|
|
17
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import Response from '../API/Response.js';
|
|
3
|
-
import Globals from '../Globals.js';
|
|
4
|
-
/**
|
|
5
|
-
* Validates the given data against the provided schema.
|
|
6
|
-
* @param {any} data - The data to be validated.
|
|
7
|
-
* @param {z.ZodObject<any>} schema - The schema to validate against.
|
|
8
|
-
* @returns {boolean | Response<ResponseErrorType>} - Returns true if the data is valid, otherwise returns a response object with an error message.
|
|
9
|
-
*/
|
|
10
|
-
export default class Validator {
|
|
11
|
-
/**
|
|
12
|
-
* Validates the given data against the provided schema.
|
|
13
|
-
* @param {any} data - The data to be validated.
|
|
14
|
-
* @param {z.ZodObject<any> | z.ZodUnion<any>} schema - The schema to validate against.
|
|
15
|
-
* @returns {boolean | Response<ResponseErrorType>} - Returns either true if the data is valid or a Response object with an error message if validation fails.
|
|
16
|
-
*/
|
|
17
|
-
static validateSchema(data, schema) {
|
|
18
|
-
let error, validatedInput;
|
|
19
|
-
// Validate body against known zod schema
|
|
20
|
-
try {
|
|
21
|
-
schema.parse(data);
|
|
22
|
-
validatedInput = true;
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
if (err instanceof z.ZodError)
|
|
26
|
-
error = JSON.parse(err.message);
|
|
27
|
-
else
|
|
28
|
-
error = 'Unknown validation error!'; //unhandled case, hard to test
|
|
29
|
-
}
|
|
30
|
-
// Error validation
|
|
31
|
-
if (!validatedInput || error) {
|
|
32
|
-
return Response.BadRequestResponse(Globals.ErrorResponseValidationFail, Globals.ErrorCode_InvalidInput, { validationFailure: error });
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=Validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.js","sourceRoot":"","sources":["../../../src/Validation/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,QAA+B,MAAM,oBAAoB,CAAA;AAChE,OAAO,OAAO,MAAM,eAAe,CAAA;AAEnC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;;OAKG;IACI,MAAM,CAAC,cAAc,CAC1B,IAAS,EACT,MAAwE;QAExE,IAAI,KAAK,EAAE,cAAc,CAAA;QAEzB,yCAAyC;QACzC,IAAI,CAAC;YACH,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAClB,cAAc,GAAG,IAAI,CAAA;QACvB,CAAC;QAAC,OAAO,GAAqB,EAAE,CAAC;YAC/B,IAAI,GAAG,YAAY,CAAC,CAAC,QAAQ;gBAAE,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;;gBACzD,KAAK,GAAG,2BAA2B,CAAA,CAAC,8BAA8B;QACzE,CAAC;QAED,mBAAmB;QACnB,IAAI,CAAC,cAAc,IAAI,KAAK,EAAE,CAAC;YAC7B,OAAO,QAAQ,CAAC,kBAAkB,CAChC,OAAO,CAAC,2BAA2B,EACnC,OAAO,CAAC,sBAAsB,EAC9B,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAA;QACH,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["../index.ts","../src/globals.ts","../src/api/request.ts","../src/api/response.ts","../src/baseevent/dynamotransaction.ts","../src/baseevent/eventprocessor.ts","../src/baseevent/process.ts","../src/baseevent/steptransaction.ts","../src/baseevent/transaction.ts","../src/baseevent/launchable/containerexec.ts","../src/baseevent/launchable/index.ts","../src/baseevent/launchable/types.ts","../src/cache/redis.ts","../src/cache/types.ts","../src/config/configuration.ts","../src/config/environmentvar.ts","../src/crypto/crypto.ts","../src/database/database.ts","../src/database/databasemanager.ts","../src/database/databasetransaction.ts","../src/database/index.ts","../src/database/types.ts","../src/database/integrations/dynamo/dynamodatabase.ts","../src/database/integrations/kysely/kyselydatabase.ts","../src/database/integrations/kysely/kyselytransaction.ts","../src/database/integrations/pgsql/postgresdatabase.ts","../src/database/integrations/pgsql/postgrestransaction.ts","../src/logger/logger.ts","../src/mailer/mailer.ts","../src/publisher/publisher.ts","../src/server/routeresolver.ts","../src/server/router.ts","../src/server/lib/containerserver.ts","../src/server/lib/server.ts","../src/server/lib/container/generichandler.ts","../src/server/lib/container/generichandlerevent.ts","../src/server/lib/container/healthhandler.ts","../src/server/lib/container/proxy.ts","../src/server/lib/container/utils.ts","../src/util/asyncsingleton.ts","../src/util/utils.ts","../src/validation/validator.ts","../package-lock.json","../package.json"],"version":"5.6.2"}
|