@felloh-org/lambda-wrapper 1.0.9 → 1.0.13

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.
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.Dependencies = exports.DEFINITIONS = void 0;
7
7
 
8
+ var _eventBridge = _interopRequireDefault(require("../service/event-bridge"));
9
+
8
10
  var _http = _interopRequireDefault(require("../service/http"));
9
11
 
10
12
  var _logger = _interopRequireDefault(require("../service/logger"));
@@ -16,6 +18,7 @@ var _warehouse = _interopRequireDefault(require("../service/warehouse"));
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
20
  const DEFINITIONS = {
21
+ EVENT_BRIDGE: 'EVENT_BRIDGE',
19
22
  HTTP: 'HTTP',
20
23
  LOGGER: 'LOGGER',
21
24
  REQUEST: 'REQUEST',
@@ -23,6 +26,7 @@ const DEFINITIONS = {
23
26
  };
24
27
  exports.DEFINITIONS = DEFINITIONS;
25
28
  const Dependencies = {
29
+ [DEFINITIONS.EVENT_BRIDGE]: _eventBridge.default,
26
30
  [DEFINITIONS.HTTP]: _http.default,
27
31
  [DEFINITIONS.LOGGER]: _logger.default,
28
32
  [DEFINITIONS.REQUEST]: _request.default,
@@ -15,7 +15,7 @@ var _booking = _interopRequireDefault(require("../../agent-data/booking"));
15
15
 
16
16
  var _transaction = _interopRequireDefault(require("../transaction"));
17
17
 
18
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12;
18
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13;
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
@@ -43,19 +43,23 @@ let PaymentLink = (_dec = (0, _typeorm.Entity)({
43
43
  type: "int"
44
44
  }), _dec10 = (0, _typeorm.Column)({
45
45
  type: "varchar",
46
- length: "250"
46
+ length: "150",
47
+ nullable: true
47
48
  }), _dec11 = (0, _typeorm.Column)({
48
49
  type: "varchar",
49
- length: "200"
50
+ length: "250"
50
51
  }), _dec12 = (0, _typeorm.Column)({
51
52
  type: "varchar",
52
53
  length: "200"
53
54
  }), _dec13 = (0, _typeorm.Column)({
54
55
  type: "varchar",
55
56
  length: "200"
56
- }), _dec14 = (0, _typeorm.OneToMany)(() => _transaction.default, transaction => transaction.payment_link), _dec15 = (0, _typeorm.Column)({
57
+ }), _dec14 = (0, _typeorm.Column)({
58
+ type: "varchar",
59
+ length: "200"
60
+ }), _dec15 = (0, _typeorm.OneToMany)(() => _transaction.default, transaction => transaction.payment_link), _dec16 = (0, _typeorm.Column)({
57
61
  type: "timestamp with time zone"
58
- }), _dec16 = (0, _typeorm.CreateDateColumn)(), _dec(_class = (_class2 = class PaymentLink {
62
+ }), _dec17 = (0, _typeorm.CreateDateColumn)(), _dec(_class = (_class2 = class PaymentLink {
59
63
  constructor() {
60
64
  _initializerDefineProperty(this, "id", _descriptor, this);
61
65
 
@@ -67,19 +71,21 @@ let PaymentLink = (_dec = (0, _typeorm.Entity)({
67
71
 
68
72
  _initializerDefineProperty(this, "amount", _descriptor5, this);
69
73
 
70
- _initializerDefineProperty(this, "description", _descriptor6, this);
74
+ _initializerDefineProperty(this, "customer_name", _descriptor6, this);
75
+
76
+ _initializerDefineProperty(this, "description", _descriptor7, this);
71
77
 
72
- _initializerDefineProperty(this, "success_url", _descriptor7, this);
78
+ _initializerDefineProperty(this, "success_url", _descriptor8, this);
73
79
 
74
- _initializerDefineProperty(this, "failure_url", _descriptor8, this);
80
+ _initializerDefineProperty(this, "failure_url", _descriptor9, this);
75
81
 
76
- _initializerDefineProperty(this, "cancel_url", _descriptor9, this);
82
+ _initializerDefineProperty(this, "cancel_url", _descriptor10, this);
77
83
 
78
- _initializerDefineProperty(this, "transactions", _descriptor10, this);
84
+ _initializerDefineProperty(this, "transactions", _descriptor11, this);
79
85
 
80
- _initializerDefineProperty(this, "expires_at", _descriptor11, this);
86
+ _initializerDefineProperty(this, "expires_at", _descriptor12, this);
81
87
 
82
- _initializerDefineProperty(this, "created_at", _descriptor12, this);
88
+ _initializerDefineProperty(this, "created_at", _descriptor13, this);
83
89
  }
84
90
 
85
91
  generateExpiryDate() {
@@ -121,47 +127,54 @@ let PaymentLink = (_dec = (0, _typeorm.Entity)({
121
127
  enumerable: true,
122
128
  writable: true,
123
129
  initializer: null
124
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "description", [_dec10], {
130
+ }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "customer_name", [_dec10], {
131
+ configurable: true,
132
+ enumerable: true,
133
+ writable: true,
134
+ initializer: function () {
135
+ return "";
136
+ }
137
+ }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "description", [_dec11], {
125
138
  configurable: true,
126
139
  enumerable: true,
127
140
  writable: true,
128
141
  initializer: function () {
129
142
  return "";
130
143
  }
131
- }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "success_url", [_dec11], {
144
+ }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "success_url", [_dec12], {
132
145
  configurable: true,
133
146
  enumerable: true,
134
147
  writable: true,
135
148
  initializer: function () {
136
149
  return "";
137
150
  }
138
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "failure_url", [_dec12], {
151
+ }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "failure_url", [_dec13], {
139
152
  configurable: true,
140
153
  enumerable: true,
141
154
  writable: true,
142
155
  initializer: function () {
143
156
  return "";
144
157
  }
145
- }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "cancel_url", [_dec13], {
158
+ }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "cancel_url", [_dec14], {
146
159
  configurable: true,
147
160
  enumerable: true,
148
161
  writable: true,
149
162
  initializer: function () {
150
163
  return "";
151
164
  }
152
- }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "transactions", [_dec14], {
165
+ }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "transactions", [_dec15], {
153
166
  configurable: true,
154
167
  enumerable: true,
155
168
  writable: true,
156
169
  initializer: null
157
- }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "expires_at", [_dec15], {
170
+ }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "expires_at", [_dec16], {
158
171
  configurable: true,
159
172
  enumerable: true,
160
173
  writable: true,
161
174
  initializer: function () {
162
175
  return this.generateExpiryDate();
163
176
  }
164
- }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec16], {
177
+ }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec17], {
165
178
  configurable: true,
166
179
  enumerable: true,
167
180
  writable: true,
@@ -19,8 +19,10 @@ var _feature = _interopRequireDefault(require("./feature"));
19
19
 
20
20
  var _organisationFeature = _interopRequireDefault(require("./organisation-feature"));
21
21
 
22
+ var _loginLink = _interopRequireDefault(require("./login-link"));
23
+
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
25
 
24
- const ENTITIES = [_organisation.default, _role.default, _userRole.default, _user.default, _userActivity.default, _feature.default, _organisationFeature.default];
26
+ const ENTITIES = [_organisation.default, _role.default, _userRole.default, _user.default, _userActivity.default, _feature.default, _organisationFeature.default, _loginLink.default];
25
27
  var _default = ENTITIES;
26
28
  exports.default = _default;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.EXPIRATION_DAYS = void 0;
7
+
8
+ var _typeorm = require("typeorm");
9
+
10
+ var _uuid = require("uuid");
11
+
12
+ var _user = _interopRequireDefault(require("../user"));
13
+
14
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5;
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ 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 }); }
19
+
20
+ 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; }
21
+
22
+ 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.'); }
23
+
24
+ const EXPIRATION_DAYS = 3;
25
+ exports.EXPIRATION_DAYS = EXPIRATION_DAYS;
26
+ let LoginLink = (_dec = (0, _typeorm.Entity)({
27
+ name: 'login_link',
28
+ schema: 'user'
29
+ }), _dec2 = (0, _typeorm.PrimaryColumn)("varchar"), _dec3 = (0, _typeorm.ManyToOne)(() => _user.default), _dec4 = (0, _typeorm.JoinColumn)({
30
+ name: 'user_id',
31
+ referencedColumnName: 'id'
32
+ }), _dec5 = (0, _typeorm.CreateDateColumn)(), _dec6 = (0, _typeorm.Column)({
33
+ type: "timestamp with time zone"
34
+ }), _dec7 = (0, _typeorm.Column)({
35
+ type: "boolean",
36
+ default: false
37
+ }), _dec(_class = (_class2 = class LoginLink {
38
+ constructor() {
39
+ _initializerDefineProperty(this, "id", _descriptor, this);
40
+
41
+ _initializerDefineProperty(this, "user", _descriptor2, this);
42
+
43
+ _initializerDefineProperty(this, "created_at", _descriptor3, this);
44
+
45
+ _initializerDefineProperty(this, "expires_at", _descriptor4, this);
46
+
47
+ _initializerDefineProperty(this, "used", _descriptor5, this);
48
+ }
49
+
50
+ }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
51
+ configurable: true,
52
+ enumerable: true,
53
+ writable: true,
54
+ initializer: function () {
55
+ return (0, _uuid.v4)();
56
+ }
57
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "user", [_dec3, _dec4], {
58
+ configurable: true,
59
+ enumerable: true,
60
+ writable: true,
61
+ initializer: function () {
62
+ return _user.default;
63
+ }
64
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec5], {
65
+ configurable: true,
66
+ enumerable: true,
67
+ writable: true,
68
+ initializer: null
69
+ }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "expires_at", [_dec6], {
70
+ configurable: true,
71
+ enumerable: true,
72
+ writable: true,
73
+ initializer: function () {
74
+ return new Date(new Date().setDate(new Date().getDate() + EXPIRATION_DAYS));
75
+ }
76
+ }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "used", [_dec7], {
77
+ configurable: true,
78
+ enumerable: true,
79
+ writable: true,
80
+ initializer: function () {
81
+ return false;
82
+ }
83
+ })), _class2)) || _class);
84
+ exports.default = LoginLink;
@@ -9,7 +9,7 @@ var _typeorm = require("typeorm");
9
9
 
10
10
  var _organisation = _interopRequireDefault(require("../organisation"));
11
11
 
12
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10;
12
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11;
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
@@ -29,24 +29,29 @@ exports.USER_STATUS = USER_STATUS;
29
29
  let User = (_dec = (0, _typeorm.Entity)({
30
30
  name: 'user',
31
31
  schema: 'user'
32
- }), _dec2 = (0, _typeorm.PrimaryColumn)("varchar"), _dec3 = (0, _typeorm.Column)({
32
+ }), _dec2 = (0, _typeorm.PrimaryColumn)("varchar"), _dec3 = (0, _typeorm.Index)(), _dec4 = (0, _typeorm.Column)({
33
+ type: "varchar",
34
+ length: "36",
35
+ nullable: true
36
+ }), _dec5 = (0, _typeorm.Column)({
33
37
  type: "varchar",
34
38
  length: "150"
35
- }), _dec4 = (0, _typeorm.Column)({
39
+ }), _dec6 = (0, _typeorm.Column)({
36
40
  type: "varchar",
37
- length: "50"
38
- }), _dec5 = (0, _typeorm.Column)({
41
+ length: "50",
42
+ nullable: true
43
+ }), _dec7 = (0, _typeorm.Column)({
39
44
  type: "varchar",
40
45
  length: "20"
41
- }), _dec6 = (0, _typeorm.Column)({
46
+ }), _dec8 = (0, _typeorm.Column)({
42
47
  type: "varchar",
43
48
  length: "50"
44
- }), _dec7 = (0, _typeorm.Column)({
49
+ }), _dec9 = (0, _typeorm.Column)({
45
50
  type: "varchar",
46
51
  length: "50"
47
- }), _dec8 = (0, _typeorm.CreateDateColumn)(), _dec9 = (0, _typeorm.UpdateDateColumn)(), _dec10 = (0, _typeorm.DeleteDateColumn)(), _dec11 = (0, _typeorm.ManyToMany)(() => _organisation.default, organisation => organisation.users, {
52
+ }), _dec10 = (0, _typeorm.CreateDateColumn)(), _dec11 = (0, _typeorm.UpdateDateColumn)(), _dec12 = (0, _typeorm.DeleteDateColumn)(), _dec13 = (0, _typeorm.ManyToMany)(() => _organisation.default, organisation => organisation.users, {
48
53
  cascade: true
49
- }), _dec12 = (0, _typeorm.JoinTable)({
54
+ }), _dec14 = (0, _typeorm.JoinTable)({
50
55
  name: "user_organisation",
51
56
  schema: "user",
52
57
  joinColumn: {
@@ -61,23 +66,25 @@ let User = (_dec = (0, _typeorm.Entity)({
61
66
  constructor() {
62
67
  _initializerDefineProperty(this, "id", _descriptor, this);
63
68
 
64
- _initializerDefineProperty(this, "email", _descriptor2, this);
69
+ _initializerDefineProperty(this, "cognito_sub", _descriptor2, this);
70
+
71
+ _initializerDefineProperty(this, "email", _descriptor3, this);
65
72
 
66
- _initializerDefineProperty(this, "mobile", _descriptor3, this);
73
+ _initializerDefineProperty(this, "mobile", _descriptor4, this);
67
74
 
68
- _initializerDefineProperty(this, "status", _descriptor4, this);
75
+ _initializerDefineProperty(this, "status", _descriptor5, this);
69
76
 
70
- _initializerDefineProperty(this, "first_name", _descriptor5, this);
77
+ _initializerDefineProperty(this, "first_name", _descriptor6, this);
71
78
 
72
- _initializerDefineProperty(this, "last_name", _descriptor6, this);
79
+ _initializerDefineProperty(this, "last_name", _descriptor7, this);
73
80
 
74
- _initializerDefineProperty(this, "created_at", _descriptor7, this);
81
+ _initializerDefineProperty(this, "created_at", _descriptor8, this);
75
82
 
76
- _initializerDefineProperty(this, "updated_at", _descriptor8, this);
83
+ _initializerDefineProperty(this, "updated_at", _descriptor9, this);
77
84
 
78
- _initializerDefineProperty(this, "deleted_at", _descriptor9, this);
85
+ _initializerDefineProperty(this, "deleted_at", _descriptor10, this);
79
86
 
80
- _initializerDefineProperty(this, "organisations", _descriptor10, this);
87
+ _initializerDefineProperty(this, "organisations", _descriptor11, this);
81
88
  }
82
89
 
83
90
  propgate(email, mobile, status, firstName, lastName) {
@@ -95,57 +102,64 @@ let User = (_dec = (0, _typeorm.Entity)({
95
102
  initializer: function () {
96
103
  return undefined;
97
104
  }
98
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "email", [_dec3], {
105
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "cognito_sub", [_dec3, _dec4], {
106
+ configurable: true,
107
+ enumerable: true,
108
+ writable: true,
109
+ initializer: function () {
110
+ return null;
111
+ }
112
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "email", [_dec5], {
99
113
  configurable: true,
100
114
  enumerable: true,
101
115
  writable: true,
102
116
  initializer: function () {
103
117
  return "";
104
118
  }
105
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "mobile", [_dec4], {
119
+ }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "mobile", [_dec6], {
106
120
  configurable: true,
107
121
  enumerable: true,
108
122
  writable: true,
109
123
  initializer: function () {
110
124
  return "";
111
125
  }
112
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "status", [_dec5], {
126
+ }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "status", [_dec7], {
113
127
  configurable: true,
114
128
  enumerable: true,
115
129
  writable: true,
116
130
  initializer: function () {
117
131
  return "";
118
132
  }
119
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "first_name", [_dec6], {
133
+ }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "first_name", [_dec8], {
120
134
  configurable: true,
121
135
  enumerable: true,
122
136
  writable: true,
123
137
  initializer: function () {
124
138
  return "";
125
139
  }
126
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "last_name", [_dec7], {
140
+ }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "last_name", [_dec9], {
127
141
  configurable: true,
128
142
  enumerable: true,
129
143
  writable: true,
130
144
  initializer: function () {
131
145
  return "";
132
146
  }
133
- }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec8], {
147
+ }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec10], {
134
148
  configurable: true,
135
149
  enumerable: true,
136
150
  writable: true,
137
151
  initializer: null
138
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec9], {
152
+ }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec11], {
139
153
  configurable: true,
140
154
  enumerable: true,
141
155
  writable: true,
142
156
  initializer: null
143
- }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "deleted_at", [_dec10], {
157
+ }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "deleted_at", [_dec12], {
144
158
  configurable: true,
145
159
  enumerable: true,
146
160
  writable: true,
147
161
  initializer: null
148
- }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "organisations", [_dec11, _dec12], {
162
+ }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "organisations", [_dec13, _dec14], {
149
163
  configurable: true,
150
164
  enumerable: true,
151
165
  writable: true,
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ /**
9
+ * Base Event
10
+ */
11
+ class BaseEvent {
12
+ /**
13
+ * BaseEvent constructor
14
+ */
15
+ constructor() {
16
+ this.base = {
17
+ Source: process.env.SERVICE_NAME,
18
+ EventBusName: process.env.EVENT_BRIDGE_ARN,
19
+ DetailType: null,
20
+ Time: new Date(),
21
+ Detail: {}
22
+ };
23
+ }
24
+ /**
25
+ * Get the base
26
+ * @returns {*|{EventBusName: string, DetailType: null, Time: Date, Source: string, Detail: {}}}
27
+ */
28
+
29
+
30
+ getBase() {
31
+ return { ...this.base,
32
+ Detail: JSON.stringify(this.base.Detail)
33
+ };
34
+ }
35
+ /**
36
+ * Set the user that initiated the action
37
+ * @param user
38
+ */
39
+
40
+
41
+ setUserBy(user) {
42
+ this.base.Detail.userBy = user;
43
+ }
44
+ /**
45
+ * Set the event type
46
+ * @param type
47
+ */
48
+
49
+
50
+ setDetailType(type) {
51
+ this.base.DetailType = type;
52
+ }
53
+ /**
54
+ * Set a parameter in the event detail
55
+ * @param key
56
+ * @param value
57
+ */
58
+
59
+
60
+ setDetailParam(key, value) {
61
+ this.base.Detail[key] = value;
62
+ }
63
+
64
+ }
65
+
66
+ var _default = BaseEvent;
67
+ exports.default = _default;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "UserRegistration", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _registration.default;
10
+ }
11
+ });
12
+
13
+ var _registration = _interopRequireDefault(require("./user/registration"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _baseEvent = _interopRequireDefault(require("../../base-event"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const EVENT_TYPE = 'user:registration';
13
+
14
+ class UserRegistrationEvent extends _baseEvent.default {
15
+ constructor() {
16
+ super();
17
+ this.setDetailType(EVENT_TYPE);
18
+ this.setDetailParam('user', {});
19
+ this.setDetailParam('organisation', {});
20
+ }
21
+
22
+ }
23
+
24
+ var _default = UserRegistrationEvent;
25
+ exports.default = _default;
package/dist/index.js CHANGED
@@ -99,6 +99,12 @@ Object.defineProperty(exports, "LoggerService", {
99
99
  return _logger.default;
100
100
  }
101
101
  });
102
+ Object.defineProperty(exports, "LoginLinkEntity", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _loginLink.default;
106
+ }
107
+ });
102
108
  Object.defineProperty(exports, "Model", {
103
109
  enumerable: true,
104
110
  get: function () {
@@ -255,6 +261,12 @@ Object.defineProperty(exports, "UserEntity", {
255
261
  return _user.default;
256
262
  }
257
263
  });
264
+ Object.defineProperty(exports, "UserRegistrationEvent", {
265
+ enumerable: true,
266
+ get: function () {
267
+ return _registration.default;
268
+ }
269
+ });
258
270
  Object.defineProperty(exports, "UserRoleEntity", {
259
271
  enumerable: true,
260
272
  get: function () {
@@ -290,6 +302,8 @@ var _feature = _interopRequireDefault(require("./entity/user/feature"));
290
302
 
291
303
  var _organisationFeature = _interopRequireDefault(require("./entity/user/organisation-feature"));
292
304
 
305
+ var _loginLink = _interopRequireDefault(require("./entity/user/login-link"));
306
+
293
307
  var _account = _interopRequireDefault(require("./entity/bank/account"));
294
308
 
295
309
  var _beneficiaryProvider = _interopRequireDefault(require("./entity/bank/beneficiary-provider"));
@@ -332,6 +346,8 @@ var _beneficiary = _interopRequireDefault(require("./entity/nuapay/beneficiary")
332
346
 
333
347
  var _transaction2 = _interopRequireDefault(require("./entity/nuapay/transaction"));
334
348
 
349
+ var _registration = _interopRequireDefault(require("./event/user/registration"));
350
+
335
351
  var _model = _interopRequireDefault(require("./model"));
336
352
 
337
353
  var _response = _interopRequireDefault(require("./model/response"));
@@ -0,0 +1,13 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class paymentLinkCustomer1642805897210 {
4
+ name = 'paymentLinkCustomer1642805897210'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "payment"."payment_Link" ADD "customer_name" character varying(150)`);
8
+ }
9
+
10
+ async down(queryRunner) {
11
+ await queryRunner.query(`ALTER TABLE "payment"."payment_Link" DROP COLUMN "customer_name"`);
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class userCognitoSub1643154226214 {
4
+ name = 'userCognitoSub1643154226214'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "user"."user" ADD "cognito_sub" character varying(36)`);
8
+ await queryRunner.query(`CREATE INDEX "IDX_1e75d2289be8e3905810ff9b10" ON "user"."user" ("cognito_sub") `);
9
+ }
10
+
11
+ async down(queryRunner) {
12
+ await queryRunner.query(`DROP INDEX "user"."IDX_1e75d2289be8e3905810ff9b10"`);
13
+ await queryRunner.query(`ALTER TABLE "user"."user_role" ALTER COLUMN "user_id" SET NOT NULL`);
14
+ }
15
+ }
@@ -0,0 +1,13 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class userNullableMobile1643195417761 {
4
+ name = 'userNullableMobile1643195417761'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "user"."user" ALTER COLUMN "mobile" DROP NOT NULL`);
8
+ }
9
+
10
+ async down(queryRunner) {
11
+ await queryRunner.query(`ALTER TABLE "user"."user" ALTER COLUMN "mobile" SET NOT NULL`);
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class userLoginLink1643296114720 {
4
+ name = 'userLoginLink1643296114720'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`CREATE TABLE "user"."login_link" ("id" character varying NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "expires_at" TIMESTAMP WITH TIME ZONE NOT NULL, "user_id" character varying, CONSTRAINT "PK_649f9177c9ef00bea8ef0b04a20" PRIMARY KEY ("id"))`);
8
+ await queryRunner.query(`ALTER TABLE "user"."login_link" ADD CONSTRAINT "FK_d49fc28faf37216c75b09d2f67e" FOREIGN KEY ("user_id") REFERENCES "user"."user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
9
+ }
10
+
11
+ async down(queryRunner) {
12
+ await queryRunner.query(`ALTER TABLE "user"."login_link" DROP CONSTRAINT "FK_d49fc28faf37216c75b09d2f67e"`);
13
+ await queryRunner.query(`DROP TABLE "user"."login_link"`);
14
+ }
15
+ }
@@ -0,0 +1,13 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class loginLinkUsed1643323827662 {
4
+ name = 'loginLinkUsed1643323827662'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "user"."login_link" ADD "used" boolean NOT NULL DEFAULT false`);
8
+ }
9
+
10
+ async down(queryRunner) {
11
+ await queryRunner.query(`ALTER TABLE "user"."login_link" DROP COLUMN "used"`);
12
+ }
13
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _awsSdk = _interopRequireDefault(require("aws-sdk"));
9
+
10
+ var _dependencyAware = _interopRequireDefault(require("../dependency-injection/dependency-aware"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const Eventbridge = new _awsSdk.default.EventBridge({
15
+ region: process.env.REGION
16
+ });
17
+ /**
18
+ * Event Bridge Service
19
+ */
20
+
21
+ class EventBridge extends _dependencyAware.default {
22
+ async put(eventModel) {
23
+ const currentUser = JSON.parse(this.getContainer().getEvent().requestContext.authorizer.userEntity);
24
+ eventModel.setUserBy(currentUser);
25
+ await Eventbridge.putEvents({
26
+ Entries: [eventModel.getBase()]
27
+ }).promise();
28
+ }
29
+
30
+ }
31
+
32
+ exports.default = EventBridge;
@@ -47,7 +47,7 @@ class Warehouse extends _dependencyAware.default {
47
47
  resourceArn: process.env.WAREHOUSE_ARN,
48
48
  region: process.env.REGION,
49
49
  entities: _entity.default,
50
- logging: true
50
+ logging: process.env.DB_LOGGING !== 'undefined' && process.env.DB_LOGGING === 'true'
51
51
  });
52
52
  }
53
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felloh-org/lambda-wrapper",
3
- "version": "1.0.9",
3
+ "version": "1.0.13",
4
4
  "description": "Lambda wrapper for all Felloh Serverless Projects",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {