@felloh-org/lambda-wrapper 1.1.12 → 1.1.15

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.
@@ -97,10 +97,14 @@ let Booking = (_dec = (0, _typeorm.Entity)({
97
97
  response.transactions = this.transactions.map(transaction => transaction.getPublicCompactData());
98
98
  }
99
99
 
100
- if (typeof this.user.id !== 'undefined') {
100
+ if (this.user !== null && typeof this.user.id !== 'undefined') {
101
101
  response.user = this.user.getPublicCompactData();
102
102
  }
103
103
 
104
+ if (this.organisation !== null && typeof this.organisation.id !== 'undefined') {
105
+ response.organisation = this.organisation.getPublicCompactData();
106
+ }
107
+
104
108
  return response;
105
109
  }
106
110
 
@@ -172,4 +176,5 @@ let Booking = (_dec = (0, _typeorm.Entity)({
172
176
  writable: true,
173
177
  initializer: null
174
178
  })), _class2)) || _class);
175
- exports.default = Booking;
179
+ exports.default = Booking;
180
+ ``;
@@ -21,6 +21,8 @@ var _transactionStatus = _interopRequireDefault(require("./transaction-status"))
21
21
 
22
22
  var _transactionType = _interopRequireDefault(require("./transaction-type"));
23
23
 
24
+ var _transactionSource = _interopRequireDefault(require("./transaction-source"));
25
+
24
26
  var _transactionMetadata = _interopRequireDefault(require("./transaction-metadata"));
25
27
 
26
28
  var _organisationPaymentProvider = _interopRequireDefault(require("./organisation-payment-provider"));
@@ -29,6 +31,6 @@ var _paymentProvider = _interopRequireDefault(require("./payment-provider"));
29
31
 
30
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
33
 
32
- const ENTITIES = [_chargeback.default, _organisationPaymentProvider.default, _paymentLink.default, _paymentProvider.default, _transaction.default, _transactionEvent.default, _transactionEventType.default, _transactionMethod.default, _transactionStatus.default, _transactionType.default, _transactionMetadata.default];
34
+ const ENTITIES = [_chargeback.default, _organisationPaymentProvider.default, _paymentLink.default, _paymentProvider.default, _transaction.default, _transactionEvent.default, _transactionEventType.default, _transactionMethod.default, _transactionStatus.default, _transactionSource.default, _transactionType.default, _transactionMetadata.default];
33
35
  var _default = ENTITIES;
34
36
  exports.default = _default;
@@ -150,6 +150,10 @@ let PaymentLink = (_dec = (0, _typeorm.Entity)({
150
150
  response.user = this.user.getPublicCompactData();
151
151
  }
152
152
 
153
+ if (this.organisation !== null && typeof this.organisation.id !== 'undefined') {
154
+ response.organisation = this.organisation.getPublicCompactData();
155
+ }
156
+
153
157
  return response;
154
158
  }
155
159
 
@@ -27,7 +27,9 @@ var _organisationPaymentProvider = _interopRequireDefault(require("../organisati
27
27
 
28
28
  var _transactionBatch = _interopRequireDefault(require("../../bank/transaction-batch"));
29
29
 
30
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17;
30
+ var _transactionSource = _interopRequireDefault(require("../transaction-source"));
31
+
32
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _dec27, _dec28, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17, _descriptor18;
31
33
 
32
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
35
 
@@ -59,34 +61,39 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
59
61
  }), _dec12 = (0, _typeorm.ManyToOne)(() => _transactionType.default), _dec13 = (0, _typeorm.JoinColumn)({
60
62
  name: 'type_id',
61
63
  referencedColumnName: 'id'
62
- }), _dec14 = (0, _typeorm.ManyToOne)(() => _paymentLink.default, {
64
+ }), _dec14 = (0, _typeorm.ManyToOne)(() => _transactionSource.default, {
63
65
  nullable: true
64
66
  }), _dec15 = (0, _typeorm.JoinColumn)({
67
+ name: 'source_id',
68
+ referencedColumnName: 'id'
69
+ }), _dec16 = (0, _typeorm.ManyToOne)(() => _paymentLink.default, {
70
+ nullable: true
71
+ }), _dec17 = (0, _typeorm.JoinColumn)({
65
72
  name: 'payment_link_id',
66
73
  referencedColumnName: 'id'
67
- }), _dec16 = (0, _typeorm.OneToOne)(() => _transactionMetadata.default, transactionMetadata => transactionMetadata.transaction), _dec17 = (0, _typeorm.ManyToOne)(() => _paymentProvider.default), _dec18 = (0, _typeorm.JoinColumn)({
74
+ }), _dec18 = (0, _typeorm.OneToOne)(() => _transactionMetadata.default, transactionMetadata => transactionMetadata.transaction), _dec19 = (0, _typeorm.ManyToOne)(() => _paymentProvider.default), _dec20 = (0, _typeorm.JoinColumn)({
68
75
  name: 'payment_provider_id',
69
76
  referencedColumnName: 'id'
70
- }), _dec19 = (0, _typeorm.ManyToOne)(() => _organisationPaymentProvider.default, {
77
+ }), _dec21 = (0, _typeorm.ManyToOne)(() => _organisationPaymentProvider.default, {
71
78
  nullable: true
72
- }), _dec20 = (0, _typeorm.JoinColumn)({
79
+ }), _dec22 = (0, _typeorm.JoinColumn)({
73
80
  name: 'organisation_payment_provider_id',
74
81
  referencedColumnName: 'id'
75
- }), _dec21 = (0, _typeorm.Column)({
82
+ }), _dec23 = (0, _typeorm.Column)({
76
83
  type: "varchar",
77
84
  length: "250",
78
85
  nullable: true
79
- }), _dec22 = (0, _typeorm.Column)({
86
+ }), _dec24 = (0, _typeorm.Column)({
80
87
  type: "timestamp with time zone",
81
88
  nullable: true
82
- }), _dec23 = (0, _typeorm.Column)({
89
+ }), _dec25 = (0, _typeorm.Column)({
83
90
  type: "text",
84
91
  nullable: true
85
- }), _dec24 = (0, _typeorm.CreateDateColumn)({
92
+ }), _dec26 = (0, _typeorm.CreateDateColumn)({
86
93
  type: 'timestamp with time zone'
87
- }), _dec25 = (0, _typeorm.UpdateDateColumn)({
94
+ }), _dec27 = (0, _typeorm.UpdateDateColumn)({
88
95
  type: 'timestamp with time zone'
89
- }), _dec26 = (0, _typeorm.OneToMany)(() => _transactionBatch.default, transactionBatch => transactionBatch.transaction), _dec(_class = (_class2 = class Transaction {
96
+ }), _dec28 = (0, _typeorm.OneToMany)(() => _transactionBatch.default, transactionBatch => transactionBatch.transaction), _dec(_class = (_class2 = class Transaction {
90
97
  constructor() {
91
98
  _initializerDefineProperty(this, "id", _descriptor, this);
92
99
 
@@ -102,25 +109,27 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
102
109
 
103
110
  _initializerDefineProperty(this, "type", _descriptor7, this);
104
111
 
105
- _initializerDefineProperty(this, "payment_link", _descriptor8, this);
112
+ _initializerDefineProperty(this, "source", _descriptor8, this);
106
113
 
107
- _initializerDefineProperty(this, "metadata", _descriptor9, this);
114
+ _initializerDefineProperty(this, "payment_link", _descriptor9, this);
108
115
 
109
- _initializerDefineProperty(this, "payment_provider", _descriptor10, this);
116
+ _initializerDefineProperty(this, "metadata", _descriptor10, this);
110
117
 
111
- _initializerDefineProperty(this, "organisation_payment_provider", _descriptor11, this);
118
+ _initializerDefineProperty(this, "payment_provider", _descriptor11, this);
112
119
 
113
- _initializerDefineProperty(this, "provider_reference", _descriptor12, this);
120
+ _initializerDefineProperty(this, "organisation_payment_provider", _descriptor12, this);
114
121
 
115
- _initializerDefineProperty(this, "completed_at", _descriptor13, this);
122
+ _initializerDefineProperty(this, "provider_reference", _descriptor13, this);
116
123
 
117
- _initializerDefineProperty(this, "message", _descriptor14, this);
124
+ _initializerDefineProperty(this, "completed_at", _descriptor14, this);
118
125
 
119
- _initializerDefineProperty(this, "created_at", _descriptor15, this);
126
+ _initializerDefineProperty(this, "message", _descriptor15, this);
120
127
 
121
- _initializerDefineProperty(this, "updated_at", _descriptor16, this);
128
+ _initializerDefineProperty(this, "created_at", _descriptor16, this);
122
129
 
123
- _initializerDefineProperty(this, "batch", _descriptor17, this);
130
+ _initializerDefineProperty(this, "updated_at", _descriptor17, this);
131
+
132
+ _initializerDefineProperty(this, "batch", _descriptor18, this);
124
133
  }
125
134
 
126
135
  getPublicData() {
@@ -138,11 +147,15 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
138
147
  response.booking = this.booking.getPublicData();
139
148
  }
140
149
 
150
+ if (this.organisation !== null && typeof this.organisation.id !== 'undefined') {
151
+ response.organisation = this.organisation.getPublicCompactData();
152
+ }
153
+
141
154
  return response;
142
155
  }
143
156
 
144
157
  getPublicCompactData() {
145
- return {
158
+ const response = {
146
159
  id: this.id,
147
160
  amount: this.amount,
148
161
  status: this.status.id,
@@ -151,6 +164,12 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
151
164
  created_at: this.created_at,
152
165
  completed_at: this.completed_at
153
166
  };
167
+
168
+ if (this.organisation !== null && typeof this.organisation.id !== 'undefined') {
169
+ response.organisation = this.organisation.getPublicCompactData();
170
+ }
171
+
172
+ return response;
154
173
  }
155
174
 
156
175
  }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
@@ -200,60 +219,67 @@ let Transaction = (_dec = (0, _typeorm.Entity)({
200
219
  initializer: function () {
201
220
  return _transactionType.default;
202
221
  }
203
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "payment_link", [_dec14, _dec15], {
222
+ }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "source", [_dec14, _dec15], {
223
+ configurable: true,
224
+ enumerable: true,
225
+ writable: true,
226
+ initializer: function () {
227
+ return _transactionSource.default;
228
+ }
229
+ }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "payment_link", [_dec16, _dec17], {
204
230
  configurable: true,
205
231
  enumerable: true,
206
232
  writable: true,
207
233
  initializer: function () {
208
234
  return _paymentLink.default;
209
235
  }
210
- }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "metadata", [_dec16], {
236
+ }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "metadata", [_dec18], {
211
237
  configurable: true,
212
238
  enumerable: true,
213
239
  writable: true,
214
240
  initializer: null
215
- }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "payment_provider", [_dec17, _dec18], {
241
+ }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "payment_provider", [_dec19, _dec20], {
216
242
  configurable: true,
217
243
  enumerable: true,
218
244
  writable: true,
219
245
  initializer: function () {
220
246
  return _paymentProvider.default;
221
247
  }
222
- }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "organisation_payment_provider", [_dec19, _dec20], {
248
+ }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "organisation_payment_provider", [_dec21, _dec22], {
223
249
  configurable: true,
224
250
  enumerable: true,
225
251
  writable: true,
226
252
  initializer: function () {
227
253
  return _organisationPaymentProvider.default;
228
254
  }
229
- }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "provider_reference", [_dec21], {
255
+ }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "provider_reference", [_dec23], {
230
256
  configurable: true,
231
257
  enumerable: true,
232
258
  writable: true,
233
259
  initializer: function () {
234
260
  return "";
235
261
  }
236
- }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "completed_at", [_dec22], {
262
+ }), _descriptor14 = _applyDecoratedDescriptor(_class2.prototype, "completed_at", [_dec24], {
237
263
  configurable: true,
238
264
  enumerable: true,
239
265
  writable: true,
240
266
  initializer: null
241
- }), _descriptor14 = _applyDecoratedDescriptor(_class2.prototype, "message", [_dec23], {
267
+ }), _descriptor15 = _applyDecoratedDescriptor(_class2.prototype, "message", [_dec25], {
242
268
  configurable: true,
243
269
  enumerable: true,
244
270
  writable: true,
245
271
  initializer: null
246
- }), _descriptor15 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec24], {
272
+ }), _descriptor16 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec26], {
247
273
  configurable: true,
248
274
  enumerable: true,
249
275
  writable: true,
250
276
  initializer: null
251
- }), _descriptor16 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec25], {
277
+ }), _descriptor17 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec27], {
252
278
  configurable: true,
253
279
  enumerable: true,
254
280
  writable: true,
255
281
  initializer: null
256
- }), _descriptor17 = _applyDecoratedDescriptor(_class2.prototype, "batch", [_dec26], {
282
+ }), _descriptor18 = _applyDecoratedDescriptor(_class2.prototype, "batch", [_dec28], {
257
283
  configurable: true,
258
284
  enumerable: true,
259
285
  writable: true,
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _typeorm = require("typeorm");
9
+
10
+ var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
11
+
12
+ function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
13
+
14
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
15
+
16
+ function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }
17
+
18
+ let TransactionSource = (_dec = (0, _typeorm.Entity)({
19
+ name: 'transaction_source',
20
+ schema: 'payment'
21
+ }), _dec2 = (0, _typeorm.PrimaryColumn)("varchar"), _dec3 = (0, _typeorm.CreateDateColumn)(), _dec(_class = (_class2 = class TransactionSource {
22
+ constructor() {
23
+ _initializerDefineProperty(this, "id", _descriptor, this);
24
+
25
+ _initializerDefineProperty(this, "created_at", _descriptor2, this);
26
+ }
27
+
28
+ }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
29
+ configurable: true,
30
+ enumerable: true,
31
+ writable: true,
32
+ initializer: null
33
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec3], {
34
+ configurable: true,
35
+ enumerable: true,
36
+ writable: true,
37
+ initializer: null
38
+ })), _class2)) || _class);
39
+ exports.default = TransactionSource;
package/dist/index.js CHANGED
@@ -327,6 +327,12 @@ Object.defineProperty(exports, "TransactionMethodEntity", {
327
327
  return _transactionMethod.default;
328
328
  }
329
329
  });
330
+ Object.defineProperty(exports, "TransactionSourceEntity", {
331
+ enumerable: true,
332
+ get: function () {
333
+ return _transactionSource.default;
334
+ }
335
+ });
330
336
  Object.defineProperty(exports, "TransactionStatusEntity", {
331
337
  enumerable: true,
332
338
  get: function () {
@@ -444,6 +450,8 @@ var _transactionType = _interopRequireDefault(require("./entity/payment/transact
444
450
 
445
451
  var _transactionMetadata = _interopRequireDefault(require("./entity/payment/transaction-metadata"));
446
452
 
453
+ var _transactionSource = _interopRequireDefault(require("./entity/payment/transaction-source"));
454
+
447
455
  var _transaction3 = _interopRequireDefault(require("./entity/total-processing/transaction"));
448
456
 
449
457
  var _transactionMetadata2 = _interopRequireDefault(require("./entity/total-processing/transaction-metadata"));
@@ -0,0 +1,17 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class transactionSource1653296149259 {
4
+ name = 'transactionSource1653296149259'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`CREATE TABLE "payment"."transaction_source" ("id" character varying NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_67d99beee5e33632f3c765e5123" PRIMARY KEY ("id"))`);
8
+ await queryRunner.query(`ALTER TABLE "payment"."transaction" ADD "source_id" character varying`);
9
+ await queryRunner.query(`ALTER TABLE "payment"."transaction" ADD CONSTRAINT "FK_67d99beee5e33632f3c765e5123" FOREIGN KEY ("source_id") REFERENCES "payment"."transaction_source"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
10
+ }
11
+
12
+ async down(queryRunner) {
13
+ await queryRunner.query(`ALTER TABLE "payment"."transaction" DROP CONSTRAINT "FK_67d99beee5e33632f3c765e5123"`);
14
+ await queryRunner.query(`ALTER TABLE "payment"."transaction" DROP COLUMN "source_id"`);
15
+ await queryRunner.query(`DROP TABLE "payment"."transaction_source"`);
16
+ }
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felloh-org/lambda-wrapper",
3
- "version": "1.1.12",
3
+ "version": "1.1.15",
4
4
  "description": "Lambda wrapper for all Felloh Serverless Projects",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -57,7 +57,7 @@
57
57
  "dotenv": "^16.0.0",
58
58
  "epsagon": "^1.121.3",
59
59
  "typeorm": "^0.2.41",
60
- "typeorm-aurora-data-api-driver": "^2.3.5",
60
+ "typeorm-aurora-data-api-driver": "^2.4.2",
61
61
  "useragent": "^2.3.0",
62
62
  "uuid": "^8.3.2",
63
63
  "validate.js": "^0.13.1",