@felloh-org/lambda-wrapper 1.2.6 → 1.2.9
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/dist/entity/agent-data/booking/index.js +7 -0
- package/dist/entity/payment/payment-link/index.js +6 -0
- package/dist/entity/payment/transaction/index.js +8 -0
- package/dist/migration/payment/1661876528683-organisation-payment-provider-cleanup-weight-attr.js +13 -0
- package/dist/model/response/status-codes.js +4 -0
- package/dist/wrapper/index.js +7 -2
- package/package.json +1 -1
|
@@ -153,6 +153,13 @@ let Booking = (_dec = (0, _typeorm.Entity)({
|
|
|
153
153
|
return response;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
getPublicCompactData() {
|
|
157
|
+
return {
|
|
158
|
+
id: this.id,
|
|
159
|
+
booking_reference: this.booking_reference
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
156
163
|
}, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
|
|
157
164
|
configurable: true,
|
|
158
165
|
enumerable: true,
|
|
@@ -195,6 +195,12 @@ let PaymentLink = (_dec = (0, _typeorm.Entity)({
|
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
getPublicUltraCompactData() {
|
|
199
|
+
return {
|
|
200
|
+
id: this.id
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
198
204
|
}, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
|
|
199
205
|
configurable: true,
|
|
200
206
|
enumerable: true,
|
|
@@ -192,6 +192,14 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
|
|
|
192
192
|
provider_reference: this.provider_reference
|
|
193
193
|
};
|
|
194
194
|
|
|
195
|
+
if (this.booking !== null && typeof this.booking.id !== 'undefined') {
|
|
196
|
+
response.booking = this.booking.getPublicCompactData();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (this.payment_link !== null && typeof this.payment_link !== 'undefined') {
|
|
200
|
+
response.payment_link = this.payment_link.getPublicUltraCompactData();
|
|
201
|
+
}
|
|
202
|
+
|
|
195
203
|
if (this.organisation !== null && typeof this.organisation.id !== 'undefined') {
|
|
196
204
|
response.organisation = this.organisation.getPublicCompactData();
|
|
197
205
|
}
|
package/dist/migration/payment/1661876528683-organisation-payment-provider-cleanup-weight-attr.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class organisationPaymentProviderCleanupWeightAttr1661876528683 {
|
|
4
|
+
name = 'organisationPaymentProviderCleanupWeightAttr1661876528683'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" DROP COLUMN "weight"`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async down(queryRunner) {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider" ADD "weight" integer NOT NULL DEFAULT '1'`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -37,6 +37,10 @@ const ERRORS = {
|
|
|
37
37
|
reason: 'Not Acceptable',
|
|
38
38
|
message: 'The response type you requested with your Accept header is not supported'
|
|
39
39
|
},
|
|
40
|
+
413: {
|
|
41
|
+
reason: 'Request Entity Too Large',
|
|
42
|
+
message: 'Your request has exceeded our file size limit, please reduce your query size.'
|
|
43
|
+
},
|
|
40
44
|
422: {
|
|
41
45
|
reason: 'Unprocessable Entity',
|
|
42
46
|
message: 'A validation error occurred'
|
package/dist/wrapper/index.js
CHANGED
|
@@ -61,14 +61,19 @@ exports.handleSuccess = handleSuccess;
|
|
|
61
61
|
|
|
62
62
|
const handleError = (di, error) => {
|
|
63
63
|
const logger = di.get(_dependencies.DEFINITIONS.LOGGER);
|
|
64
|
-
|
|
64
|
+
let errorCode = error === null || error === void 0 ? void 0 : error.code;
|
|
65
|
+
logger.metric('lambda.status_code', errorCode || 500);
|
|
65
66
|
logger.error(error);
|
|
66
67
|
|
|
67
68
|
if (error instanceof _response.default) {
|
|
68
69
|
return error.generate();
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
if (error.message === 'Database returned more than the allowed response size limit') {
|
|
73
|
+
errorCode = 413;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const response = new _response.default({}, Number.isInteger(errorCode) ? errorCode : 500);
|
|
72
77
|
|
|
73
78
|
if (typeof error.body !== 'undefined') {
|
|
74
79
|
response.setErrors(error.body || {});
|