@creator.co/wapi 1.2.0-alpha8 → 1.2.0-beta1
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/.eslintrc.cjs +1 -1
- package/dist/package.json +1 -1
- package/dist/src/API/Response.d.ts +2 -2
- package/dist/src/API/Response.js.map +1 -1
- package/dist/src/BaseEvent/Transaction.d.ts +10 -10
- package/dist/src/BaseEvent/Transaction.js +28 -28
- package/dist/src/BaseEvent/Transaction.js.map +1 -1
- package/package.json +1 -1
- package/src/API/Response.ts +4 -4
- package/src/BaseEvent/Transaction.ts +35 -35
package/.eslintrc.cjs
CHANGED
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
|
18
18
|
},
|
|
19
19
|
],
|
|
20
20
|
"@typescript-eslint/ban-ts-comment": 0,
|
|
21
|
-
"@typescript-eslint/no-explicit-any":
|
|
21
|
+
"@typescript-eslint/no-explicit-any": 0,
|
|
22
22
|
// turn on errors for missing imports
|
|
23
23
|
"import/no-unresolved": "error",
|
|
24
24
|
// 'import/no-named-as-default-member': 'off',
|
package/dist/package.json
CHANGED
|
@@ -23,12 +23,12 @@ export default class Response<B = any | ResponseErrorType> {
|
|
|
23
23
|
getBody(): B;
|
|
24
24
|
appendIntoBody(key: string, value: any): void;
|
|
25
25
|
appendHeader(key: string, value: any): void;
|
|
26
|
-
build(context: Context, transaction: Transaction<any>, _optDoNotCallContext: boolean): Promise<void>;
|
|
26
|
+
build(context: Context, transaction: Transaction<any, any>, _optDoNotCallContext: boolean): Promise<void>;
|
|
27
27
|
private _pipe;
|
|
28
28
|
private _rawContext;
|
|
29
29
|
static MissingParamResponse(paramName: string): Response<ResponseErrorType>;
|
|
30
30
|
static MissingQueryResponse(paramName: string): Response<ResponseErrorType>;
|
|
31
|
-
static BadRequestResponse
|
|
31
|
+
static BadRequestResponse(msg?: string, errCode?: string, optBody?: any): Response<ResponseErrorType>;
|
|
32
32
|
static BadRequestResponseWithRollback(msg: string, errCode: string, optBody?: any): Response<ResponseErrorType>;
|
|
33
33
|
static UnauthorizedResponse(msg: string, errCode: string): Response<ResponseErrorType>;
|
|
34
34
|
static SuccessResponse<T>(body: T): Response<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../src/API/Response.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sCAAgC;AAChC,EAAE;AACF;IAA0B,+BAAK;IAC7B,qBAAY,IAAS;QAArB,iBAIC;QAHC,IAAM,GAAG,GAAG,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAA;gBAClE,kBAAM,GAAG,CAAC;QACV,KAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAA;;IAC9D,CAAC;IACH,kBAAC;AAAD,CAAC,AAND,CAA0B,KAAK,GAM9B;AAMD,EAAE;AACF;IASE,EAAE;IACF,kBACE,UAAkB,EAClB,IAAO,EACP,YAOa;QAEb,WAAW;QACX,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,QAAQ,GAAG;YACd,6BAA6B,EAAE,GAAG;YAClC,kCAAkC,EAAE,IAAI;YACxC,cAAc,EAAE,kBAAkB;SACnC,CAAA;QACD,YAAY;QACZ,IAAI,CAAC,YAAY,GAAG,KAAK,CAAA,CAAC,qFAAqF;QAC/G,UAAU;QACV,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,YAAY,CAAA,CAAA,CAAC,EAAE;QACnD,IAAI,CAAC,OAAO,GAAG,CAA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,yBAAgB,GAA9B,UAA+B,GAAW;QACxC,IAAM,IAAI,GAAG,IAAI,QAAQ,CAAO,GAAG,EAAE,IAAI,CAAC,CAAA;QAC1C,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;QAClC,OAAO,IAAI,CAAA;IACb,CAAC;IACa,iCAAwB,GAAtC;QACE,OAAO,IAAI,QAAQ,CAAO,GAAG,EAAE,IAAI,CAAC,CAAA;IACtC,CAAC;IACa,8BAAqB,GAAnC,UACE,MAAW,EACX,WAAmB;QAEnB,IAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;YACnD,YAAY,EAAE,IAAI;SACnB,CAAC,CAAA;QACF,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;QAC7C,IAAI,WAAW;YAAE,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;QAC/D,OAAO,IAAI,CAAA;IACb,CAAC;IACa,uBAAc,GAA5B,UAAgC,IAAO,EAAE,YAAqB;QAC5D,IAAM,IAAI,GAAG,IAAI,QAAQ,CAAI,YAAY,IAAI,GAAG,EAAE,IAAI,CAAC,CAAA;QACvD,OAAO,IAAI,CAAA;IACb,CAAC;IACH,eAAC;AAAD,CAAC,AA1LD,IA0LC"}
|
|
@@ -11,19 +11,19 @@ export type TransactionConfig = {
|
|
|
11
11
|
publisher?: PublisherConfig;
|
|
12
12
|
};
|
|
13
13
|
export default class Transaction<T = object, B = null> {
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
14
|
+
private event;
|
|
15
|
+
private context;
|
|
16
|
+
private response;
|
|
17
|
+
private syncReturn;
|
|
18
|
+
private retrowErrors;
|
|
19
19
|
readonly logger: Logger;
|
|
20
20
|
readonly request: Request<T>;
|
|
21
21
|
readonly publisher: Publisher;
|
|
22
22
|
responseProxy: (response: Response) => Promise<void>;
|
|
23
23
|
constructor(event: APIGatewayEvent | SQSEvent, context: Context, config?: TransactionConfig);
|
|
24
|
-
execute(executionFunc: TransactionExecution<Transaction<T, B>>): Promise<Response | null | SQSBatchResponse>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
execute(executionFunc: TransactionExecution<Transaction<T, B>>): Promise<Response<B> | null | SQSBatchResponse>;
|
|
25
|
+
private iexecute;
|
|
26
|
+
private executeDBTransactions;
|
|
27
|
+
private executeLoggerFlush;
|
|
28
|
+
private getErrorResponse;
|
|
29
29
|
}
|
|
@@ -50,17 +50,17 @@ var Transaction = /** @class */ (function () {
|
|
|
50
50
|
? event.requestContext.requestId
|
|
51
51
|
: "unknown";
|
|
52
52
|
// transaction ctx
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
53
|
+
this.event = event;
|
|
54
|
+
this.context = context;
|
|
55
|
+
this.response = null;
|
|
56
56
|
// when set, this will be called with the response context right before calling the context suceed/fail - useful for writing the resp for example.
|
|
57
57
|
this.responseProxy = null;
|
|
58
58
|
// transaction flags
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
59
|
+
this.syncReturn = !!(config === null || config === void 0 ? void 0 : config.syncReturn);
|
|
60
|
+
this.retrowErrors = !!(config === null || config === void 0 ? void 0 : config.throwOnErrors); /* retrow internal errors */
|
|
61
61
|
// components
|
|
62
62
|
this.logger = new Logger_1.default(config === null || config === void 0 ? void 0 : config.logger, transactionId);
|
|
63
|
-
this.request = new Request_1.default(this.
|
|
63
|
+
this.request = new Request_1.default(this.event, this.context, this.logger);
|
|
64
64
|
this.publisher = new Publisher_1.default(config === null || config === void 0 ? void 0 : config.publisher);
|
|
65
65
|
}
|
|
66
66
|
//Main interface
|
|
@@ -69,14 +69,14 @@ var Transaction = /** @class */ (function () {
|
|
|
69
69
|
var _this = this;
|
|
70
70
|
return __generator(this, function (_a) {
|
|
71
71
|
switch (_a.label) {
|
|
72
|
-
case 0: return [4 /*yield*/, this.
|
|
72
|
+
case 0: return [4 /*yield*/, this.executeLoggerFlush(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
73
73
|
var _this = this;
|
|
74
74
|
return __generator(this, function (_a) {
|
|
75
75
|
switch (_a.label) {
|
|
76
|
-
case 0: return [4 /*yield*/, this.
|
|
76
|
+
case 0: return [4 /*yield*/, this.executeDBTransactions(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
77
77
|
return __generator(this, function (_a) {
|
|
78
78
|
switch (_a.label) {
|
|
79
|
-
case 0: return [4 /*yield*/, this.
|
|
79
|
+
case 0: return [4 /*yield*/, this.iexecute(executionFunc)];
|
|
80
80
|
case 1: return [2 /*return*/, _a.sent()];
|
|
81
81
|
}
|
|
82
82
|
});
|
|
@@ -92,8 +92,8 @@ var Transaction = /** @class */ (function () {
|
|
|
92
92
|
case 1:
|
|
93
93
|
_a.sent();
|
|
94
94
|
// return raw response if sync return is requested
|
|
95
|
-
if (this.
|
|
96
|
-
return [2 /*return*/, this.
|
|
95
|
+
if (this.syncReturn)
|
|
96
|
+
return [2 /*return*/, this.response
|
|
97
97
|
// allow request to async succeed through lambda context
|
|
98
98
|
];
|
|
99
99
|
// allow request to async succeed through lambda context
|
|
@@ -103,7 +103,7 @@ var Transaction = /** @class */ (function () {
|
|
|
103
103
|
});
|
|
104
104
|
};
|
|
105
105
|
//Executions
|
|
106
|
-
Transaction.prototype.
|
|
106
|
+
Transaction.prototype.iexecute = function (executionFunc) {
|
|
107
107
|
return __awaiter(this, void 0, void 0, function () {
|
|
108
108
|
var executionFailed, _a, e_1;
|
|
109
109
|
return __generator(this, function (_b) {
|
|
@@ -121,22 +121,22 @@ var Transaction = /** @class */ (function () {
|
|
|
121
121
|
//Answer client
|
|
122
122
|
];
|
|
123
123
|
case 2:
|
|
124
|
-
_a.
|
|
125
|
-
if (!(this.
|
|
126
|
-
return [4 /*yield*/, this.
|
|
124
|
+
_a.response = _b.sent();
|
|
125
|
+
if (!(this.response && this.response instanceof Response_1.default)) return [3 /*break*/, 4];
|
|
126
|
+
return [4 /*yield*/, this.response.build(this.context, this, this.syncReturn)];
|
|
127
127
|
case 3:
|
|
128
128
|
_b.sent();
|
|
129
|
-
executionFailed = !!(this.
|
|
129
|
+
executionFailed = !!(this.response.getBody() && this.response.getBody().rollback);
|
|
130
130
|
return [3 /*break*/, 7];
|
|
131
131
|
case 4:
|
|
132
|
-
if (!(this.
|
|
132
|
+
if (!(this.syncReturn && this.response)) return [3 /*break*/, 5];
|
|
133
133
|
this.logger.log("Sync return with different response object");
|
|
134
|
-
this.logger.debug(this.
|
|
134
|
+
this.logger.debug(this.response);
|
|
135
135
|
executionFailed = false;
|
|
136
136
|
return [3 /*break*/, 7];
|
|
137
137
|
case 5:
|
|
138
|
-
this.
|
|
139
|
-
return [4 /*yield*/, this.
|
|
138
|
+
this.response = this.getErrorResponse(Globals_1.default.ErrorResponseInvalidServerResponse, Globals_1.default.ErrorCode_APIError);
|
|
139
|
+
return [4 /*yield*/, this.response.build(this.context, this, this.syncReturn)];
|
|
140
140
|
case 6:
|
|
141
141
|
_b.sent();
|
|
142
142
|
this.logger.error("Invalid response object from main request code.");
|
|
@@ -148,11 +148,11 @@ var Transaction = /** @class */ (function () {
|
|
|
148
148
|
this.logger.error("Exception when executing main request code.");
|
|
149
149
|
this.logger.exception(e_1);
|
|
150
150
|
//retrow?
|
|
151
|
-
if (this.
|
|
151
|
+
if (this.retrowErrors)
|
|
152
152
|
throw e_1;
|
|
153
153
|
if (!executionFailed) return [3 /*break*/, 10];
|
|
154
|
-
this.
|
|
155
|
-
return [4 /*yield*/, this.
|
|
154
|
+
this.response = this.getErrorResponse(Globals_1.default.ErrorResponseUnhandledError, Globals_1.default.ErrorCode_APIError);
|
|
155
|
+
return [4 /*yield*/, this.response.build(this.context, this, this.syncReturn)];
|
|
156
156
|
case 9:
|
|
157
157
|
_b.sent();
|
|
158
158
|
_b.label = 10;
|
|
@@ -162,7 +162,7 @@ var Transaction = /** @class */ (function () {
|
|
|
162
162
|
});
|
|
163
163
|
});
|
|
164
164
|
};
|
|
165
|
-
Transaction.prototype.
|
|
165
|
+
Transaction.prototype.executeDBTransactions = function (safeExecution) {
|
|
166
166
|
return __awaiter(this, void 0, void 0, function () {
|
|
167
167
|
var e_2;
|
|
168
168
|
return __generator(this, function (_a) {
|
|
@@ -200,7 +200,7 @@ var Transaction = /** @class */ (function () {
|
|
|
200
200
|
this.logger.error("Exception when executing DB transactions.");
|
|
201
201
|
this.logger.log(e_2.stack);
|
|
202
202
|
//retrow?
|
|
203
|
-
if (this.
|
|
203
|
+
if (this.retrowErrors)
|
|
204
204
|
throw e_2;
|
|
205
205
|
return [3 /*break*/, 3];
|
|
206
206
|
case 3: return [2 /*return*/];
|
|
@@ -208,7 +208,7 @@ var Transaction = /** @class */ (function () {
|
|
|
208
208
|
});
|
|
209
209
|
});
|
|
210
210
|
};
|
|
211
|
-
Transaction.prototype.
|
|
211
|
+
Transaction.prototype.executeLoggerFlush = function (safeExecution) {
|
|
212
212
|
return __awaiter(this, void 0, void 0, function () {
|
|
213
213
|
var e_3;
|
|
214
214
|
return __generator(this, function (_a) {
|
|
@@ -227,7 +227,7 @@ var Transaction = /** @class */ (function () {
|
|
|
227
227
|
this.logger.error("Exception when flushing logs.");
|
|
228
228
|
this.logger.exception(e_3);
|
|
229
229
|
//retrow?
|
|
230
|
-
if (this.
|
|
230
|
+
if (this.retrowErrors)
|
|
231
231
|
throw e_3;
|
|
232
232
|
return [3 /*break*/, 5];
|
|
233
233
|
case 4:
|
|
@@ -239,7 +239,7 @@ var Transaction = /** @class */ (function () {
|
|
|
239
239
|
});
|
|
240
240
|
};
|
|
241
241
|
/* Response support */
|
|
242
|
-
Transaction.prototype.
|
|
242
|
+
Transaction.prototype.getErrorResponse = function (error, code) {
|
|
243
243
|
return Response_1.default.BadRequestResponseWithRollback(error, code);
|
|
244
244
|
};
|
|
245
245
|
return Transaction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../src/BaseEvent/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,0CAAoC;AACpC,4CAAsC;AACtC,sCAAgC;AAChC,2CAAuD;AACvD,oDAAmE;AAenE;IAWE,EAAE;IACF,qBACE,KAAiC,EACjC,OAAgB,EAChB,MAA0B;QAE1B,IAAM,aAAa,GAAG,OAAO,CAAC,YAAY;YACxC,CAAC,CAAC,OAAO,CAAC,YAAY;YACtB,CAAC,CAAmB,KAAM,CAAC,cAAc;gBACzC,CAAC,CAAmB,KAAM,CAAC,cAAc,CAAC,SAAS;gBACnD,CAAC,CAAC,SAAS,CAAA;QACb,kBAAkB;QAClB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../src/BaseEvent/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,0CAAoC;AACpC,4CAAsC;AACtC,sCAAgC;AAChC,2CAAuD;AACvD,oDAAmE;AAenE;IAWE,EAAE;IACF,qBACE,KAAiC,EACjC,OAAgB,EAChB,MAA0B;QAE1B,IAAM,aAAa,GAAG,OAAO,CAAC,YAAY;YACxC,CAAC,CAAC,OAAO,CAAC,YAAY;YACtB,CAAC,CAAmB,KAAM,CAAC,cAAc;gBACzC,CAAC,CAAmB,KAAM,CAAC,cAAc,CAAC,SAAS;gBACnD,CAAC,CAAC,SAAS,CAAA;QACb,kBAAkB;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACpB,kJAAkJ;QAClJ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA;QACzB,oBAAoB;QACpB,IAAI,CAAC,UAAU,G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AAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAA;wBAClD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAC,CAAC,CAAA;wBACxB,SAAS;wBACT,IAAI,IAAI,CAAC,YAAY;4BAAE,MAAM,GAAC,CAAA;;;wBAE9B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;;;;;;KAEzC;IACD,sBAAsB;IACd,sCAAgB,GAAxB,UAAyB,KAAa,EAAE,IAAY;QAClD,OAAO,kBAAQ,CAAC,8BAA8B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC7D,CAAC;IACH,kBAAC;AAAD,CAAC,AA1ID,IA0IC"}
|
package/package.json
CHANGED
package/src/API/Response.ts
CHANGED
|
@@ -68,7 +68,7 @@ export default class Response<B = any | ResponseErrorType> {
|
|
|
68
68
|
}
|
|
69
69
|
public async build(
|
|
70
70
|
context: Context,
|
|
71
|
-
transaction: Transaction<any>,
|
|
71
|
+
transaction: Transaction<any, any>,
|
|
72
72
|
_optDoNotCallContext: boolean,
|
|
73
73
|
): Promise<void> {
|
|
74
74
|
//Stream support
|
|
@@ -141,13 +141,13 @@ export default class Response<B = any | ResponseErrorType> {
|
|
|
141
141
|
errCode: Globals.ErrorCode_MissingParam,
|
|
142
142
|
})
|
|
143
143
|
}
|
|
144
|
-
public static BadRequestResponse
|
|
144
|
+
public static BadRequestResponse(
|
|
145
145
|
msg?: string,
|
|
146
146
|
errCode?: string,
|
|
147
147
|
optBody?: any,
|
|
148
|
-
): Response<
|
|
148
|
+
): Response<ResponseErrorType> {
|
|
149
149
|
console.warn(`Bad request - ${msg}`)
|
|
150
|
-
return new Response(400, {
|
|
150
|
+
return new Response<ResponseErrorType>(400, {
|
|
151
151
|
err: msg,
|
|
152
152
|
...(errCode ? { errCode: errCode } : {}),
|
|
153
153
|
...(optBody || {}),
|
|
@@ -25,11 +25,11 @@ export type TransactionConfig = {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export default class Transaction<T = object, B = null> {
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private
|
|
32
|
-
private
|
|
28
|
+
private event: any
|
|
29
|
+
private context: Context
|
|
30
|
+
private response: Response | null | SQSBatchResponse
|
|
31
|
+
private syncReturn: boolean
|
|
32
|
+
private retrowErrors: boolean
|
|
33
33
|
//
|
|
34
34
|
public readonly logger: Logger
|
|
35
35
|
public readonly request: Request<T>
|
|
@@ -47,60 +47,60 @@ export default class Transaction<T = object, B = null> {
|
|
|
47
47
|
? (<APIGatewayEvent>event).requestContext.requestId
|
|
48
48
|
: "unknown"
|
|
49
49
|
// transaction ctx
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
50
|
+
this.event = event
|
|
51
|
+
this.context = context
|
|
52
|
+
this.response = null
|
|
53
53
|
// when set, this will be called with the response context right before calling the context suceed/fail - useful for writing the resp for example.
|
|
54
54
|
this.responseProxy = null
|
|
55
55
|
// transaction flags
|
|
56
|
-
this.
|
|
57
|
-
this.
|
|
56
|
+
this.syncReturn = !!config?.syncReturn
|
|
57
|
+
this.retrowErrors = !!config?.throwOnErrors /* retrow internal errors */
|
|
58
58
|
// components
|
|
59
59
|
this.logger = new Logger(config?.logger, transactionId)
|
|
60
|
-
this.request = new Request<T>(this.
|
|
60
|
+
this.request = new Request<T>(this.event, this.context, this.logger)
|
|
61
61
|
this.publisher = new Publisher(config?.publisher)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
//Main interface
|
|
65
|
-
async execute(
|
|
65
|
+
public async execute(
|
|
66
66
|
executionFunc: TransactionExecution<Transaction<T, B>>,
|
|
67
|
-
): Promise<Response | null | SQSBatchResponse> {
|
|
68
|
-
await this.
|
|
69
|
-
await this.
|
|
70
|
-
return await this.
|
|
67
|
+
): Promise<Response<B> | null | SQSBatchResponse> {
|
|
68
|
+
await this.executeLoggerFlush(async () => {
|
|
69
|
+
await this.executeDBTransactions(async () => {
|
|
70
|
+
return await this.iexecute(executionFunc)
|
|
71
71
|
})
|
|
72
72
|
})
|
|
73
73
|
// return raw response if sync return is requested
|
|
74
|
-
if (this.
|
|
74
|
+
if (this.syncReturn) return this.response
|
|
75
75
|
// allow request to async succeed through lambda context
|
|
76
76
|
return null
|
|
77
77
|
}
|
|
78
78
|
//Executions
|
|
79
|
-
async
|
|
80
|
-
executionFunc: TransactionExecution<Transaction<T>>,
|
|
79
|
+
private async iexecute(
|
|
80
|
+
executionFunc: TransactionExecution<Transaction<T, B>>,
|
|
81
81
|
): Promise<boolean> {
|
|
82
82
|
let executionFailed = true //failed til we say no!
|
|
83
83
|
//safe execution handler
|
|
84
84
|
try {
|
|
85
85
|
//Execute
|
|
86
86
|
this.logger.debug("Starting main request code")
|
|
87
|
-
this.
|
|
87
|
+
this.response = await executionFunc(this)
|
|
88
88
|
//Answer client
|
|
89
|
-
if (this.
|
|
90
|
-
await this.
|
|
89
|
+
if (this.response && this.response instanceof Response) {
|
|
90
|
+
await this.response.build(this.context, this, this.syncReturn)
|
|
91
91
|
executionFailed = !!(
|
|
92
|
-
this.
|
|
92
|
+
this.response.getBody() && this.response.getBody().rollback
|
|
93
93
|
)
|
|
94
|
-
} else if (this.
|
|
94
|
+
} else if (this.syncReturn && this.response) {
|
|
95
95
|
this.logger.log("Sync return with different response object")
|
|
96
|
-
this.logger.debug(this.
|
|
96
|
+
this.logger.debug(this.response)
|
|
97
97
|
executionFailed = false
|
|
98
98
|
} else {
|
|
99
|
-
this.
|
|
99
|
+
this.response = this.getErrorResponse(
|
|
100
100
|
Globals.ErrorResponseInvalidServerResponse,
|
|
101
101
|
Globals.ErrorCode_APIError,
|
|
102
102
|
)
|
|
103
|
-
await this.
|
|
103
|
+
await this.response.build(this.context, this, this.syncReturn)
|
|
104
104
|
this.logger.error("Invalid response object from main request code.")
|
|
105
105
|
}
|
|
106
106
|
} catch (e) {
|
|
@@ -108,19 +108,19 @@ export default class Transaction<T = object, B = null> {
|
|
|
108
108
|
this.logger.error("Exception when executing main request code.")
|
|
109
109
|
this.logger.exception(e)
|
|
110
110
|
//retrow?
|
|
111
|
-
if (this.
|
|
111
|
+
if (this.retrowErrors) throw e
|
|
112
112
|
//envelope exception?
|
|
113
113
|
if (executionFailed) {
|
|
114
|
-
this.
|
|
114
|
+
this.response = this.getErrorResponse(
|
|
115
115
|
Globals.ErrorResponseUnhandledError,
|
|
116
116
|
Globals.ErrorCode_APIError,
|
|
117
117
|
)
|
|
118
|
-
await this.
|
|
118
|
+
await this.response.build(this.context, this, this.syncReturn)
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
return executionFailed
|
|
122
122
|
}
|
|
123
|
-
async
|
|
123
|
+
private async executeDBTransactions(safeExecution) {
|
|
124
124
|
try {
|
|
125
125
|
// //start DB
|
|
126
126
|
// if (this.db) await this.db.connect();
|
|
@@ -142,10 +142,10 @@ export default class Transaction<T = object, B = null> {
|
|
|
142
142
|
this.logger.error("Exception when executing DB transactions.")
|
|
143
143
|
this.logger.log(e.stack)
|
|
144
144
|
//retrow?
|
|
145
|
-
if (this.
|
|
145
|
+
if (this.retrowErrors) throw e
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
async
|
|
148
|
+
private async executeLoggerFlush(safeExecution) {
|
|
149
149
|
try {
|
|
150
150
|
await safeExecution()
|
|
151
151
|
await this.logger.flushLogs()
|
|
@@ -153,13 +153,13 @@ export default class Transaction<T = object, B = null> {
|
|
|
153
153
|
this.logger.error("Exception when flushing logs.")
|
|
154
154
|
this.logger.exception(e)
|
|
155
155
|
//retrow?
|
|
156
|
-
if (this.
|
|
156
|
+
if (this.retrowErrors) throw e
|
|
157
157
|
} finally {
|
|
158
158
|
this.logger.debug("Transaction ended")
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
/* Response support */
|
|
162
|
-
|
|
162
|
+
private getErrorResponse(error: string, code: string): Response {
|
|
163
163
|
return Response.BadRequestResponseWithRollback(error, code)
|
|
164
164
|
}
|
|
165
165
|
}
|