@creator.co/wapi 1.2.3 → 1.2.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/.github/workflows/npmpublish.yml +2 -5
- package/README.md +1 -3
- package/dist/index.d.ts +11 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/jest.config.d.ts +3 -0
- package/dist/jest.config.js +34 -0
- package/dist/jest.config.js.map +1 -0
- package/dist/package.json +64 -0
- package/dist/src/API/Request.d.ts +140 -0
- package/dist/src/API/Request.js +182 -0
- package/dist/src/API/Request.js.map +1 -0
- package/dist/src/API/Response.d.ts +256 -0
- package/dist/src/API/Response.js +398 -0
- package/dist/src/API/Response.js.map +1 -0
- package/dist/src/API/Utils.d.ts +63 -0
- package/dist/src/API/Utils.js +104 -0
- package/dist/src/API/Utils.js.map +1 -0
- package/dist/src/BaseEvent/EventProcessor.d.ts +81 -0
- package/dist/src/BaseEvent/EventProcessor.js +182 -0
- package/dist/src/BaseEvent/EventProcessor.js.map +1 -0
- package/dist/src/BaseEvent/Process.d.ts +74 -0
- package/dist/src/BaseEvent/Process.js +142 -0
- package/dist/src/BaseEvent/Process.js.map +1 -0
- package/dist/src/BaseEvent/Transaction.d.ts +29 -0
- package/dist/src/BaseEvent/Transaction.js +244 -0
- package/dist/src/BaseEvent/Transaction.js.map +1 -0
- package/dist/src/Config/Configuration.d.ts +131 -0
- package/dist/src/Config/Configuration.js +153 -0
- package/dist/src/Config/Configuration.js.map +1 -0
- package/dist/src/Config/EnvironmentVar.d.ts +101 -0
- package/dist/src/Config/EnvironmentVar.js +213 -0
- package/dist/src/Config/EnvironmentVar.js.map +1 -0
- package/dist/src/Crypto/Crypto.d.ts +57 -0
- package/dist/src/Crypto/Crypto.js +126 -0
- package/dist/src/Crypto/Crypto.js.map +1 -0
- package/dist/src/Crypto/JWT.d.ts +64 -0
- package/dist/src/Crypto/JWT.js +74 -0
- package/dist/src/Crypto/JWT.js.map +1 -0
- package/dist/src/Globals.d.ts +161 -0
- package/dist/src/Globals.js +173 -0
- package/dist/src/Globals.js.map +1 -0
- package/dist/src/Logger/Logger.d.ts +180 -0
- package/dist/src/Logger/Logger.js +412 -0
- package/dist/src/Logger/Logger.js.map +1 -0
- package/dist/src/Mailer/Mailer.d.ts +107 -0
- package/dist/src/Mailer/Mailer.js +313 -0
- package/dist/src/Mailer/Mailer.js.map +1 -0
- package/dist/src/Publisher/Publisher.d.ts +47 -0
- package/dist/src/Publisher/Publisher.js +141 -0
- package/dist/src/Publisher/Publisher.js.map +1 -0
- package/dist/src/Server/RouteResolver.d.ts +41 -0
- package/dist/src/Server/RouteResolver.js +135 -0
- package/dist/src/Server/RouteResolver.js.map +1 -0
- package/dist/src/Server/Router.d.ts +104 -0
- package/dist/src/Server/Router.js +45 -0
- package/dist/src/Server/Router.js.map +1 -0
- package/dist/src/Server/lib/ContainerServer.d.ts +58 -0
- package/dist/src/Server/lib/ContainerServer.js +143 -0
- package/dist/src/Server/lib/ContainerServer.js.map +1 -0
- package/dist/src/Server/lib/Server.d.ts +60 -0
- package/dist/src/Server/lib/Server.js +137 -0
- package/dist/src/Server/lib/Server.js.map +1 -0
- package/dist/src/Server/lib/container/GenericHandler.d.ts +4 -0
- package/dist/src/Server/lib/container/GenericHandler.js +138 -0
- package/dist/src/Server/lib/container/GenericHandler.js.map +1 -0
- package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +67 -0
- package/dist/src/Server/lib/container/GenericHandlerEvent.js +189 -0
- package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +1 -0
- package/dist/src/Server/lib/container/HealthHandler.d.ts +3 -0
- package/dist/src/Server/lib/container/HealthHandler.js +45 -0
- package/dist/src/Server/lib/container/HealthHandler.js.map +1 -0
- package/dist/src/Server/lib/container/Proxy.d.ts +95 -0
- package/dist/src/Server/lib/container/Proxy.js +201 -0
- package/dist/src/Server/lib/container/Proxy.js.map +1 -0
- package/dist/src/Server/lib/container/Utils.d.ts +18 -0
- package/dist/src/Server/lib/container/Utils.js +84 -0
- package/dist/src/Server/lib/container/Utils.js.map +1 -0
- package/dist/src/Validation/Validator.d.ts +21 -0
- package/dist/src/Validation/Validator.js +48 -0
- package/dist/src/Validation/Validator.js.map +1 -0
- package/jest.config.ts +1 -8
- package/package.json +3 -3
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ${1:Description placeholder}
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @class Utils
|
|
6
|
+
* @typedef {Utils}
|
|
7
|
+
*/
|
|
8
|
+
export default class Utils {
|
|
9
|
+
/**
|
|
10
|
+
* ${1:Description placeholder}
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @static
|
|
14
|
+
* @returns {boolean}
|
|
15
|
+
*/
|
|
16
|
+
static isHybridlessContainer(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* ${1:Description placeholder}
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
* @static
|
|
22
|
+
* @param {string} string
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
static isValidString(string: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* ${1:Description placeholder}
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
* @static
|
|
31
|
+
* @param {string} string
|
|
32
|
+
* @returns {(number | null)}
|
|
33
|
+
*/
|
|
34
|
+
static parseIntNullIfNaN(string: string): number | null;
|
|
35
|
+
/**
|
|
36
|
+
* ${1:Description placeholder}
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
* @static
|
|
40
|
+
* @param {string} string
|
|
41
|
+
* @returns {(any | null)}
|
|
42
|
+
*/
|
|
43
|
+
static parseObjectNullIfEmpty(string: string): any | null;
|
|
44
|
+
/**
|
|
45
|
+
* ${1:Description placeholder}
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
* @static
|
|
49
|
+
* @param {string} number
|
|
50
|
+
* @returns {boolean}
|
|
51
|
+
*/
|
|
52
|
+
static isValidNumber(number: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* ${1:Description placeholder}
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
* @static
|
|
58
|
+
* @param {*} obj
|
|
59
|
+
* @param {string} key
|
|
60
|
+
* @returns {(any | null)}
|
|
61
|
+
*/
|
|
62
|
+
static caseInsensitiveObjectForKey(obj: any, key: string): any | null;
|
|
63
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* ${1:Description placeholder}
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class Utils
|
|
8
|
+
* @typedef {Utils}
|
|
9
|
+
*/
|
|
10
|
+
var Utils = /** @class */ (function () {
|
|
11
|
+
function Utils() {
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* ${1:Description placeholder}
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
* @static
|
|
18
|
+
* @returns {boolean}
|
|
19
|
+
*/
|
|
20
|
+
Utils.isHybridlessContainer = function () {
|
|
21
|
+
return process.env.HYBRIDLESS_RUNTIME == 'true';
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* ${1:Description placeholder}
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
* @static
|
|
28
|
+
* @param {string} string
|
|
29
|
+
* @returns {boolean}
|
|
30
|
+
*/
|
|
31
|
+
Utils.isValidString = function (string) {
|
|
32
|
+
return (string === null || string === void 0 ? void 0 : string.length) > 0 && !Array.isArray(string);
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* ${1:Description placeholder}
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
* @static
|
|
39
|
+
* @param {string} string
|
|
40
|
+
* @returns {(number | null)}
|
|
41
|
+
*/
|
|
42
|
+
Utils.parseIntNullIfNaN = function (string) {
|
|
43
|
+
var n = parseInt(string);
|
|
44
|
+
return isNaN(n) ? null : n;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* ${1:Description placeholder}
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
* @static
|
|
51
|
+
* @param {string} string
|
|
52
|
+
* @returns {(any | null)}
|
|
53
|
+
*/
|
|
54
|
+
Utils.parseObjectNullIfEmpty = function (string) {
|
|
55
|
+
var o = null;
|
|
56
|
+
try {
|
|
57
|
+
o = JSON.parse(string);
|
|
58
|
+
if (Object.keys(o).length <= 0)
|
|
59
|
+
o = null;
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
/* empty */
|
|
63
|
+
}
|
|
64
|
+
return o;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* ${1:Description placeholder}
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
* @static
|
|
71
|
+
* @param {string} number
|
|
72
|
+
* @returns {boolean}
|
|
73
|
+
*/
|
|
74
|
+
Utils.isValidNumber = function (number) {
|
|
75
|
+
var validNumb = NaN;
|
|
76
|
+
try {
|
|
77
|
+
validNumb = parseInt(number + '');
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
console.error('Error while validating number', e);
|
|
81
|
+
}
|
|
82
|
+
return !isNaN(validNumb) && !Array.isArray(number);
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* ${1:Description placeholder}
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
* @static
|
|
89
|
+
* @param {*} obj
|
|
90
|
+
* @param {string} key
|
|
91
|
+
* @returns {(any | null)}
|
|
92
|
+
*/
|
|
93
|
+
Utils.caseInsensitiveObjectForKey = function (obj, key) {
|
|
94
|
+
if (!obj)
|
|
95
|
+
return null;
|
|
96
|
+
var insensitiveKey = Object.keys(obj).find(function (k) { return k.toLowerCase() === key.toLowerCase(); });
|
|
97
|
+
if (insensitiveKey && insensitiveKey != '')
|
|
98
|
+
return obj[insensitiveKey];
|
|
99
|
+
return null;
|
|
100
|
+
};
|
|
101
|
+
return Utils;
|
|
102
|
+
}());
|
|
103
|
+
exports.default = Utils;
|
|
104
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/API/Utils.ts"],"names":[],"mappings":";;AAAA;;;;;;GAMG;AACH;IAAA;IAoFA,CAAC;IAnFC;;;;;;OAMG;IACW,2BAAqB,GAAnC;QACE,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,MAAM,CAAA;IACjD,CAAC;IACD;;;;;;;OAOG;IACW,mBAAa,GAA3B,UAA4B,MAAc;QACxC,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,IAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACrD,CAAC;IACD;;;;;;;OAOG;IACW,uBAAiB,GAA/B,UAAgC,MAAc;QAC5C,IAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;QAC1B,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5B,CAAC;IACD;;;;;;;OAOG;IACW,4BAAsB,GAApC,UAAqC,MAAc;QACjD,IAAI,CAAC,GAAG,IAAI,CAAA;QACZ,IAAI;YACF,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YACtB,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC;gBAAE,CAAC,GAAG,IAAI,CAAA;SACzC;QAAC,OAAO,CAAC,EAAE;YACV,WAAW;SACZ;QACD,OAAO,CAAC,CAAA;IACV,CAAC;IACD;;;;;;;OAOG;IACW,mBAAa,GAA3B,UAA4B,MAAc;QACxC,IAAI,SAAS,GAAG,GAAG,CAAA;QACnB,IAAI;YACF,SAAS,GAAG,QAAQ,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;SAClC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAA;SAClD;QACD,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACpD,CAAC;IACD;;;;;;;;OAQG;IACW,iCAA2B,GAAzC,UAA0C,GAAQ,EAAE,GAAW;QAC7D,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QACrB,IAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,WAAW,EAAE,EAArC,CAAqC,CAAC,CAAA;QACxF,IAAI,cAAc,IAAI,cAAc,IAAI,EAAE;YAAE,OAAO,GAAG,CAAC,cAAc,CAAC,CAAA;QACtE,OAAO,IAAI,CAAA;IACb,CAAC;IACH,YAAC;AAAD,CAAC,AApFD,IAoFC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Context, SQSBatchResponse, SQSEvent } from 'aws-lambda';
|
|
2
|
+
import Transaction, { TransactionConfig } from './Transaction';
|
|
3
|
+
import Response, { ResponseErrorType } from '../API/Response';
|
|
4
|
+
/**
|
|
5
|
+
* ${1:Description placeholder}
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @typedef {EventProcessorExecution}
|
|
9
|
+
* @template ResponseInnerType
|
|
10
|
+
*/
|
|
11
|
+
export type EventProcessorExecution<ResponseInnerType> = (transaction: Transaction<null, ResponseInnerType | ResponseErrorType, SQSBatchResponse>, recordContent: string | object) => Promise<Response<ResponseInnerType | ResponseErrorType> | SQSBatchResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* ${1:Description placeholder}
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @class EventProcessor
|
|
17
|
+
* @typedef {EventProcessor}
|
|
18
|
+
* @template ResponseInnerType
|
|
19
|
+
*/
|
|
20
|
+
export default class EventProcessor<ResponseInnerType> {
|
|
21
|
+
/**
|
|
22
|
+
* ${1:Description placeholder}
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
* @readonly
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
*/
|
|
28
|
+
private readonly _allowFailure;
|
|
29
|
+
/**
|
|
30
|
+
* ${1:Description placeholder}
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
* @readonly
|
|
34
|
+
* @type {TransactionConfig}
|
|
35
|
+
*/
|
|
36
|
+
private readonly _apiConfig;
|
|
37
|
+
/**
|
|
38
|
+
* ${1:Description placeholder}
|
|
39
|
+
*
|
|
40
|
+
* @private
|
|
41
|
+
* @readonly
|
|
42
|
+
* @type {Context}
|
|
43
|
+
*/
|
|
44
|
+
private readonly _context;
|
|
45
|
+
/**
|
|
46
|
+
* ${1:Description placeholder}
|
|
47
|
+
*
|
|
48
|
+
* @private
|
|
49
|
+
* @readonly
|
|
50
|
+
* @type {SQSEvent}
|
|
51
|
+
*/
|
|
52
|
+
private readonly _event;
|
|
53
|
+
/**
|
|
54
|
+
* Creates an instance of EventProcessor.
|
|
55
|
+
*
|
|
56
|
+
* @constructor
|
|
57
|
+
* @param {SQSEvent} event
|
|
58
|
+
* @param {Context} context
|
|
59
|
+
* @param {?TransactionConfig} [config]
|
|
60
|
+
* @param {?boolean} [allowFailure]
|
|
61
|
+
*/
|
|
62
|
+
constructor(event: SQSEvent, context: Context, config?: TransactionConfig, allowFailure?: boolean);
|
|
63
|
+
/**
|
|
64
|
+
* ${1:Description placeholder}
|
|
65
|
+
*
|
|
66
|
+
* @async
|
|
67
|
+
* @param {EventProcessorExecution<ResponseInnerType>} execution
|
|
68
|
+
* @param {?boolean} [doNotDecodeMessage]
|
|
69
|
+
* @returns {(Promise<Response<ResponseErrorType> | null | SQSBatchResponse>)}
|
|
70
|
+
*/
|
|
71
|
+
processEvent(execution: EventProcessorExecution<ResponseInnerType>, doNotDecodeMessage?: boolean): Promise<Response<ResponseErrorType> | null | SQSBatchResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* ${1:Description placeholder}
|
|
74
|
+
*
|
|
75
|
+
* @async
|
|
76
|
+
* @param {EventProcessorExecution<ResponseInnerType>} execution
|
|
77
|
+
* @param {boolean} doNotDecodeMessage
|
|
78
|
+
* @returns {(Promise<Response<ResponseErrorType> | null | SQSBatchResponse>)}
|
|
79
|
+
*/
|
|
80
|
+
_processRawEvent(execution: EventProcessorExecution<ResponseInnerType>, doNotDecodeMessage: boolean): Promise<Response<ResponseErrorType> | null | SQSBatchResponse>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
var Transaction_1 = require("./Transaction");
|
|
51
|
+
var Response_1 = require("../API/Response");
|
|
52
|
+
var Globals_1 = require("../Globals");
|
|
53
|
+
/**
|
|
54
|
+
* ${1:Description placeholder}
|
|
55
|
+
*
|
|
56
|
+
* @export
|
|
57
|
+
* @class EventProcessor
|
|
58
|
+
* @typedef {EventProcessor}
|
|
59
|
+
* @template ResponseInnerType
|
|
60
|
+
*/
|
|
61
|
+
var EventProcessor = /** @class */ (function () {
|
|
62
|
+
/**
|
|
63
|
+
* Creates an instance of EventProcessor.
|
|
64
|
+
*
|
|
65
|
+
* @constructor
|
|
66
|
+
* @param {SQSEvent} event
|
|
67
|
+
* @param {Context} context
|
|
68
|
+
* @param {?TransactionConfig} [config]
|
|
69
|
+
* @param {?boolean} [allowFailure]
|
|
70
|
+
*/
|
|
71
|
+
function EventProcessor(event, context, config, allowFailure) {
|
|
72
|
+
this._event = event;
|
|
73
|
+
this._context = context;
|
|
74
|
+
this._apiConfig = config || {};
|
|
75
|
+
this._allowFailure = allowFailure;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* ${1:Description placeholder}
|
|
79
|
+
*
|
|
80
|
+
* @async
|
|
81
|
+
* @param {EventProcessorExecution<ResponseInnerType>} execution
|
|
82
|
+
* @param {?boolean} [doNotDecodeMessage]
|
|
83
|
+
* @returns {(Promise<Response<ResponseErrorType> | null | SQSBatchResponse>)}
|
|
84
|
+
*/
|
|
85
|
+
EventProcessor.prototype.processEvent = function (execution, doNotDecodeMessage) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
var resp;
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
switch (_a.label) {
|
|
90
|
+
case 0: return [4 /*yield*/, this._processRawEvent(execution, !!doNotDecodeMessage)];
|
|
91
|
+
case 1:
|
|
92
|
+
resp = _a.sent();
|
|
93
|
+
if (!this._allowFailure &&
|
|
94
|
+
resp &&
|
|
95
|
+
resp instanceof Response_1.default &&
|
|
96
|
+
!(resp.getCode() >= 200 && resp.getCode() < 300))
|
|
97
|
+
throw new Error(JSON.stringify(resp.getBody() || {}));
|
|
98
|
+
else if (resp)
|
|
99
|
+
return [2 /*return*/, resp];
|
|
100
|
+
return [2 /*return*/, null];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* ${1:Description placeholder}
|
|
107
|
+
*
|
|
108
|
+
* @async
|
|
109
|
+
* @param {EventProcessorExecution<ResponseInnerType>} execution
|
|
110
|
+
* @param {boolean} doNotDecodeMessage
|
|
111
|
+
* @returns {(Promise<Response<ResponseErrorType> | null | SQSBatchResponse>)}
|
|
112
|
+
*/
|
|
113
|
+
EventProcessor.prototype._processRawEvent = function (execution, doNotDecodeMessage) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
+
var _this = this;
|
|
116
|
+
return __generator(this, function (_a) {
|
|
117
|
+
switch (_a.label) {
|
|
118
|
+
case 0:
|
|
119
|
+
if (!(this._event.Records && this._event.Records.length > 0)) return [3 /*break*/, 2];
|
|
120
|
+
return [4 /*yield*/, new Transaction_1.default(this._event, this._context, __assign(__assign({}, this._apiConfig), { syncReturn: true })).execute(function (transaction) { return __awaiter(_this, void 0, void 0, function () {
|
|
121
|
+
var decodedRecords, failureIDs, _a, _b, _c, _i, eventRecordIdx, eventRecord, message, resp;
|
|
122
|
+
return __generator(this, function (_d) {
|
|
123
|
+
switch (_d.label) {
|
|
124
|
+
case 0:
|
|
125
|
+
decodedRecords = this._event.Records.map(function (eventRecord) {
|
|
126
|
+
return doNotDecodeMessage ? eventRecord.body : JSON.parse(eventRecord.body);
|
|
127
|
+
});
|
|
128
|
+
failureIDs = [];
|
|
129
|
+
_a = decodedRecords;
|
|
130
|
+
_b = [];
|
|
131
|
+
for (_c in _a)
|
|
132
|
+
_b.push(_c);
|
|
133
|
+
_i = 0;
|
|
134
|
+
_d.label = 1;
|
|
135
|
+
case 1:
|
|
136
|
+
if (!(_i < _b.length)) return [3 /*break*/, 4];
|
|
137
|
+
_c = _b[_i];
|
|
138
|
+
if (!(_c in _a)) return [3 /*break*/, 3];
|
|
139
|
+
eventRecordIdx = _c;
|
|
140
|
+
eventRecord = decodedRecords[eventRecordIdx];
|
|
141
|
+
message = this._event.Records[eventRecordIdx];
|
|
142
|
+
return [4 /*yield*/, execution(transaction, eventRecord)
|
|
143
|
+
//check for failure
|
|
144
|
+
];
|
|
145
|
+
case 2:
|
|
146
|
+
resp = _d.sent();
|
|
147
|
+
//check for failure
|
|
148
|
+
if (!resp ||
|
|
149
|
+
(resp instanceof Response_1.default && !((resp === null || resp === void 0 ? void 0 : resp.getCode()) >= 200 && (resp === null || resp === void 0 ? void 0 : resp.getCode()) < 300))) {
|
|
150
|
+
//response with failures or fail hard at first
|
|
151
|
+
if (this._allowFailure)
|
|
152
|
+
failureIDs.push(message.messageId);
|
|
153
|
+
else
|
|
154
|
+
return [2 /*return*/, resp];
|
|
155
|
+
}
|
|
156
|
+
_d.label = 3;
|
|
157
|
+
case 3:
|
|
158
|
+
_i++;
|
|
159
|
+
return [3 /*break*/, 1];
|
|
160
|
+
case 4:
|
|
161
|
+
//not errored and loop ended - succeeded (might have failures)
|
|
162
|
+
if (this._allowFailure)
|
|
163
|
+
return [2 /*return*/, {
|
|
164
|
+
batchItemFailures: failureIDs.map(function (id) { return ({ itemIdentifier: id }); }),
|
|
165
|
+
}];
|
|
166
|
+
return [2 /*return*/, Response_1.default.SuccessResponse(null)];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}); })];
|
|
170
|
+
case 1:
|
|
171
|
+
//safe check for empty events?
|
|
172
|
+
//init transaction for all records
|
|
173
|
+
return [2 /*return*/, _a.sent()];
|
|
174
|
+
case 2: return [2 /*return*/, Response_1.default.BadRequestResponse(Globals_1.default.ErrorResponseNoRecords, Globals_1.default.ErrorCode_NoRecords)]; //no event to be processed?
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
return EventProcessor;
|
|
180
|
+
}());
|
|
181
|
+
exports.default = EventProcessor;
|
|
182
|
+
//# sourceMappingURL=EventProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventProcessor.js","sourceRoot":"","sources":["../../../src/BaseEvent/EventProcessor.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { TransactionConfig } from './Transaction';
|
|
3
|
+
import Logger from '../Logger/Logger';
|
|
4
|
+
import Publisher from '../Publisher/Publisher';
|
|
5
|
+
/**
|
|
6
|
+
* ${1:Description placeholder}
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @typedef {ProcessConfig}
|
|
10
|
+
*/
|
|
11
|
+
export type ProcessConfig = Omit<TransactionConfig, 'throwOnErrors' | 'syncReturn'>;
|
|
12
|
+
/**
|
|
13
|
+
* ${1:Description placeholder}
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @class Process
|
|
17
|
+
* @typedef {Process}
|
|
18
|
+
*/
|
|
19
|
+
export default class Process {
|
|
20
|
+
/**
|
|
21
|
+
* ${1:Description placeholder}
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
* @type {number}
|
|
25
|
+
*/
|
|
26
|
+
private _interval;
|
|
27
|
+
/**
|
|
28
|
+
* ${1:Description placeholder}
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
* @readonly
|
|
32
|
+
* @type {Logger}
|
|
33
|
+
*/
|
|
34
|
+
readonly logger: Logger;
|
|
35
|
+
/**
|
|
36
|
+
* ${1:Description placeholder}
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
* @readonly
|
|
40
|
+
* @type {Publisher}
|
|
41
|
+
*/
|
|
42
|
+
readonly publisher: Publisher;
|
|
43
|
+
/**
|
|
44
|
+
* ${1:Description placeholder}
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
* @type {NodeJS.Timeout}
|
|
48
|
+
*/
|
|
49
|
+
interval: NodeJS.Timeout;
|
|
50
|
+
/**
|
|
51
|
+
* Creates an instance of Process.
|
|
52
|
+
*
|
|
53
|
+
* @constructor
|
|
54
|
+
* @param {ProcessConfig} config
|
|
55
|
+
* @param {number} interval
|
|
56
|
+
*/
|
|
57
|
+
constructor(config: ProcessConfig, interval: number);
|
|
58
|
+
/**
|
|
59
|
+
* ${1:Description placeholder}
|
|
60
|
+
*
|
|
61
|
+
* @async
|
|
62
|
+
* @param {*} executionFunc
|
|
63
|
+
* @returns {*}
|
|
64
|
+
*/
|
|
65
|
+
execute(executionFunc: any): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* ${1:Description placeholder}
|
|
68
|
+
*
|
|
69
|
+
* @async
|
|
70
|
+
* @param {*} executionFunc
|
|
71
|
+
* @returns {unknown}
|
|
72
|
+
*/
|
|
73
|
+
_execute(executionFunc: any): Promise<boolean>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var Logger_1 = require("../Logger/Logger");
|
|
40
|
+
var Publisher_1 = require("../Publisher/Publisher");
|
|
41
|
+
/**
|
|
42
|
+
* ${1:Description placeholder}
|
|
43
|
+
*
|
|
44
|
+
* @export
|
|
45
|
+
* @class Process
|
|
46
|
+
* @typedef {Process}
|
|
47
|
+
*/
|
|
48
|
+
var Process = /** @class */ (function () {
|
|
49
|
+
/**
|
|
50
|
+
* Creates an instance of Process.
|
|
51
|
+
*
|
|
52
|
+
* @constructor
|
|
53
|
+
* @param {ProcessConfig} config
|
|
54
|
+
* @param {number} interval
|
|
55
|
+
*/
|
|
56
|
+
function Process(config, interval) {
|
|
57
|
+
this._interval = interval;
|
|
58
|
+
this.logger = new Logger_1.default(config.logger, 'long-running-process');
|
|
59
|
+
this.publisher = new Publisher_1.default(config.publisher);
|
|
60
|
+
}
|
|
61
|
+
//Main interface
|
|
62
|
+
/**
|
|
63
|
+
* ${1:Description placeholder}
|
|
64
|
+
*
|
|
65
|
+
* @async
|
|
66
|
+
* @param {*} executionFunc
|
|
67
|
+
* @returns {*}
|
|
68
|
+
*/
|
|
69
|
+
Process.prototype.execute = function (executionFunc) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var _this = this;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
this.logger.debug('Starting main process code');
|
|
74
|
+
//Connect DB
|
|
75
|
+
// if (this.db) await this.db.connect();
|
|
76
|
+
//Program loop
|
|
77
|
+
this.interval = setInterval(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0: return [4 /*yield*/, this._execute(executionFunc)];
|
|
81
|
+
case 1:
|
|
82
|
+
_a.sent();
|
|
83
|
+
return [2 /*return*/];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); }, this._interval);
|
|
87
|
+
return [2 /*return*/];
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
//Executions
|
|
92
|
+
/**
|
|
93
|
+
* ${1:Description placeholder}
|
|
94
|
+
*
|
|
95
|
+
* @async
|
|
96
|
+
* @param {*} executionFunc
|
|
97
|
+
* @returns {unknown}
|
|
98
|
+
*/
|
|
99
|
+
Process.prototype._execute = function (executionFunc) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var executionFailed, e_1;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
executionFailed = true //failled til we say no!
|
|
106
|
+
;
|
|
107
|
+
_a.label = 1;
|
|
108
|
+
case 1:
|
|
109
|
+
_a.trys.push([1, 3, , 4]);
|
|
110
|
+
//start DB transaction
|
|
111
|
+
// if (this.db) await this.db.beginTransaction();
|
|
112
|
+
//Execute
|
|
113
|
+
return [4 /*yield*/, executionFunc(this)
|
|
114
|
+
//Commit DB
|
|
115
|
+
// if (this.db) await this.db.commit();
|
|
116
|
+
//
|
|
117
|
+
];
|
|
118
|
+
case 2:
|
|
119
|
+
//start DB transaction
|
|
120
|
+
// if (this.db) await this.db.beginTransaction();
|
|
121
|
+
//Execute
|
|
122
|
+
_a.sent();
|
|
123
|
+
//Commit DB
|
|
124
|
+
// if (this.db) await this.db.commit();
|
|
125
|
+
//
|
|
126
|
+
executionFailed = false;
|
|
127
|
+
return [3 /*break*/, 4];
|
|
128
|
+
case 3:
|
|
129
|
+
e_1 = _a.sent();
|
|
130
|
+
/*EXECUTION FAIL*/
|
|
131
|
+
this.logger.error('Exception when executing main process code. Rolling back DB!');
|
|
132
|
+
this.logger.exception(e_1);
|
|
133
|
+
return [3 /*break*/, 4];
|
|
134
|
+
case 4: return [2 /*return*/, executionFailed];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
return Process;
|
|
140
|
+
}());
|
|
141
|
+
exports.default = Process;
|
|
142
|
+
//# sourceMappingURL=Process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Process.js","sourceRoot":"","sources":["../../../src/BaseEvent/Process.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAAqC;AACrC,oDAA8C;AAW9C;;;;;;GAMG;AACH;IAgCE;;;;;;OAMG;IACH,iBAAY,MAAqB,EAAE,QAAgB;QACjD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,gBAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAA;QAC/D,IAAI,CAAC,SAAS,GAAG,IAAI,mBAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAClD,CAAC;IAED,gBAAgB;IAChB;;;;;;OAMG;IACG,yBAAO,GAAb,UAAc,aAAa;;;;gBACzB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAA;gBAC/C,YAAY;gBACZ,wCAAwC;gBACxC,cAAc;gBACd,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC;;;oCAC1B,qBAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAA;;gCAAlC,SAAkC,CAAA;;;;qBACnC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;;;;KACnB;IACD,YAAY;IACZ;;;;;;OAMG;IACG,0BAAQ,GAAd,UAAe,aAAa;;;;;;wBACtB,eAAe,GAAG,IAAI,CAAC,wBAAwB;wBAAzB,CAAA;;;;wBAGxB,sBAAsB;wBACtB,iDAAiD;wBACjD,SAAS;wBACT,qBAAM,aAAa,CAAC,IAAI,CAAC;4BACzB,WAAW;4BACX,uCAAuC;4BACvC,EAAE;0BAHuB;;wBAHzB,sBAAsB;wBACtB,iDAAiD;wBACjD,SAAS;wBACT,SAAyB,CAAA;wBACzB,WAAW;wBACX,uCAAuC;wBACvC,EAAE;wBACF,eAAe,GAAG,KAAK,CAAA;;;;wBAEvB,kBAAkB;wBAClB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAA;wBACjF,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAC,CAAC,CAAA;;4BAI1B,sBAAO,eAAe,EAAA;;;;KACvB;IACH,cAAC;AAAD,CAAC,AA3FD,IA2FC"}
|