@felloh-org/lambda-wrapper 1.1.76 → 1.2.0

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.yml CHANGED
@@ -8,6 +8,9 @@ plugins:
8
8
  extends:
9
9
  - "@felloh-org/eslint-config/mixins/base"
10
10
 
11
+ parserOptions:
12
+ ecmaVersion: 11
13
+
11
14
  ignorePatterns:
12
15
  - dist
13
16
  - tests
@@ -19,4 +22,3 @@ rules:
19
22
  camelcase: "off"
20
23
  import/no-dynamic-require: "off"
21
24
  global-require: "off"
22
-
@@ -15,7 +15,9 @@ var _paymentProvider = _interopRequireDefault(require("../payment-provider"));
15
15
 
16
16
  var _transactionMethod = _interopRequireDefault(require("../transaction-method"));
17
17
 
18
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14;
18
+ var _organisationPaymentProviderMethod = _interopRequireDefault(require("../organisation-payment-provider-method"));
19
+
20
+ 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, _descriptor14;
19
21
 
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
23
 
@@ -37,37 +39,24 @@ let OrganisationPaymentProvider = (_dec = (0, _typeorm.Entity)({
37
39
  }), _dec6 = (0, _typeorm.ManyToOne)(() => _paymentProvider.default), _dec7 = (0, _typeorm.JoinColumn)({
38
40
  name: 'payment_provider_id',
39
41
  referencedColumnName: 'id'
40
- }), _dec8 = (0, _typeorm.ManyToMany)(() => _transactionMethod.default, {
41
- cascade: true
42
- }), _dec9 = (0, _typeorm.JoinTable)({
43
- name: "organisation_payment_provider_method",
44
- schema: "payment",
45
- joinColumn: {
46
- name: "organisation_payment_provider_id",
47
- referencedColumnName: "id"
48
- },
49
- inverseJoinColumn: {
50
- name: "transaction_method_id",
51
- referencedColumnName: "id"
52
- }
53
- }), _dec10 = (0, _typeorm.Column)({
42
+ }), _dec8 = (0, _typeorm.OneToMany)(() => _organisationPaymentProviderMethod.default, transactionMethod => transactionMethod.payment_provider), _dec9 = (0, _typeorm.Column)({
54
43
  type: "varchar",
55
44
  length: "150"
56
- }), _dec11 = (0, _typeorm.Column)({
45
+ }), _dec10 = (0, _typeorm.Column)({
57
46
  type: "json",
58
47
  nullable: true
59
- }), _dec12 = (0, _typeorm.Column)({
48
+ }), _dec11 = (0, _typeorm.Column)({
60
49
  type: "varchar",
61
50
  length: "512"
62
- }), _dec13 = (0, _typeorm.Column)({
51
+ }), _dec12 = (0, _typeorm.Column)({
63
52
  type: "varchar",
64
53
  length: "4"
65
- }), _dec14 = (0, _typeorm.Column)({
54
+ }), _dec13 = (0, _typeorm.Column)({
66
55
  type: "boolean",
67
56
  default: false
68
- }), _dec15 = (0, _typeorm.Column)({
57
+ }), _dec14 = (0, _typeorm.Column)({
69
58
  type: "int"
70
- }), _dec16 = (0, _typeorm.CreateDateColumn)(), _dec17 = (0, _typeorm.UpdateDateColumn)(), _dec18 = (0, _typeorm.DeleteDateColumn)(), _dec(_class = (_class2 = class OrganisationPaymentProvider {
59
+ }), _dec15 = (0, _typeorm.CreateDateColumn)(), _dec16 = (0, _typeorm.UpdateDateColumn)(), _dec17 = (0, _typeorm.DeleteDateColumn)(), _dec(_class = (_class2 = class OrganisationPaymentProvider {
71
60
  constructor() {
72
61
  _initializerDefineProperty(this, "id", _descriptor, this);
73
62
 
@@ -126,60 +115,60 @@ let OrganisationPaymentProvider = (_dec = (0, _typeorm.Entity)({
126
115
  initializer: function () {
127
116
  return _paymentProvider.default;
128
117
  }
129
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "transaction_methods", [_dec8, _dec9], {
118
+ }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "transaction_methods", [_dec8], {
130
119
  configurable: true,
131
120
  enumerable: true,
132
121
  writable: true,
133
122
  initializer: null
134
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "public_key", [_dec10], {
123
+ }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "public_key", [_dec9], {
135
124
  configurable: true,
136
125
  enumerable: true,
137
126
  writable: true,
138
127
  initializer: function () {
139
128
  return "";
140
129
  }
141
- }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "public_creds", [_dec11], {
130
+ }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "public_creds", [_dec10], {
142
131
  configurable: true,
143
132
  enumerable: true,
144
133
  writable: true,
145
134
  initializer: null
146
- }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "secret_key", [_dec12], {
135
+ }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "secret_key", [_dec11], {
147
136
  configurable: true,
148
137
  enumerable: true,
149
138
  writable: true,
150
139
  initializer: function () {
151
140
  return "";
152
141
  }
153
- }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "secret_key_last_four", [_dec13], {
142
+ }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "secret_key_last_four", [_dec12], {
154
143
  configurable: true,
155
144
  enumerable: true,
156
145
  writable: true,
157
146
  initializer: function () {
158
147
  return "";
159
148
  }
160
- }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "is_active", [_dec14], {
149
+ }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "is_active", [_dec13], {
161
150
  configurable: true,
162
151
  enumerable: true,
163
152
  writable: true,
164
153
  initializer: function () {
165
154
  return false;
166
155
  }
167
- }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "weight", [_dec15], {
156
+ }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "weight", [_dec14], {
168
157
  configurable: true,
169
158
  enumerable: true,
170
159
  writable: true,
171
160
  initializer: null
172
- }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec16], {
161
+ }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec15], {
173
162
  configurable: true,
174
163
  enumerable: true,
175
164
  writable: true,
176
165
  initializer: null
177
- }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec17], {
166
+ }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec16], {
178
167
  configurable: true,
179
168
  enumerable: true,
180
169
  writable: true,
181
170
  initializer: null
182
- }), _descriptor14 = _applyDecoratedDescriptor(_class2.prototype, "deleted_at", [_dec18], {
171
+ }), _descriptor14 = _applyDecoratedDescriptor(_class2.prototype, "deleted_at", [_dec17], {
183
172
  configurable: true,
184
173
  enumerable: true,
185
174
  writable: true,
@@ -0,0 +1,64 @@
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 _organisationPaymentProvider = _interopRequireDefault(require("../organisation-payment-provider"));
11
+
12
+ var _transactionMethod = _interopRequireDefault(require("../transaction-method"));
13
+
14
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _class, _class2, _descriptor, _descriptor2, _descriptor3;
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
+ let OrganisationPaymentProviderMethod = (_dec = (0, _typeorm.Entity)({
25
+ name: 'organisation_payment_provider_method',
26
+ schema: 'payment'
27
+ }), _dec2 = (0, _typeorm.ManyToOne)(() => _organisationPaymentProvider.default, {
28
+ primary: true
29
+ }), _dec3 = (0, _typeorm.JoinColumn)({
30
+ name: 'organisation_payment_provider_id',
31
+ referencedColumnName: 'id'
32
+ }), _dec4 = (0, _typeorm.ManyToOne)(() => _transactionMethod.default, {
33
+ primary: true
34
+ }), _dec5 = (0, _typeorm.JoinColumn)({
35
+ name: 'transaction_method_id',
36
+ referencedColumnName: 'id'
37
+ }), _dec6 = (0, _typeorm.Column)({
38
+ type: 'int'
39
+ }), _dec(_class = (_class2 = class OrganisationPaymentProviderMethod {
40
+ constructor() {
41
+ _initializerDefineProperty(this, "payment_provider", _descriptor, this);
42
+
43
+ _initializerDefineProperty(this, "transaction_method", _descriptor2, this);
44
+
45
+ _initializerDefineProperty(this, "weight", _descriptor3, this);
46
+ }
47
+
48
+ }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "payment_provider", [_dec2, _dec3], {
49
+ configurable: true,
50
+ enumerable: true,
51
+ writable: true,
52
+ initializer: null
53
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "transaction_method", [_dec4, _dec5], {
54
+ configurable: true,
55
+ enumerable: true,
56
+ writable: true,
57
+ initializer: null
58
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "weight", [_dec6], {
59
+ configurable: true,
60
+ enumerable: true,
61
+ writable: true,
62
+ initializer: null
63
+ })), _class2)) || _class);
64
+ exports.default = OrganisationPaymentProviderMethod;
@@ -0,0 +1,25 @@
1
+ const { MigrationInterface, QueryRunner } = require("typeorm");
2
+
3
+ module.exports = class organisationPaymentProviderMethodWeight1661262743555 {
4
+ name = 'organisationPaymentProviderMethodWeight1661262743555'
5
+
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" DROP CONSTRAINT "FK_5c73d00c542e73bc44fc84f5e1e"`);
8
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" DROP CONSTRAINT "FK_1027b1f5301948b2c8dc5121017"`);
9
+ await queryRunner.query(`DROP INDEX "payment"."IDX_1027b1f5301948b2c8dc512101"`);
10
+ await queryRunner.query(`DROP INDEX "payment"."IDX_5c73d00c542e73bc44fc84f5e1"`);
11
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" ADD "weight" integer NOT NULL`);
12
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" ADD CONSTRAINT "FK_1027b1f5301948b2c8dc5121017" FOREIGN KEY ("organisation_payment_provider_id") REFERENCES "payment"."organisation_payment_provider"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
13
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" ADD CONSTRAINT "FK_5c73d00c542e73bc44fc84f5e1e" FOREIGN KEY ("transaction_method_id") REFERENCES "payment"."transaction_method"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
14
+ }
15
+
16
+ async down(queryRunner) {
17
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" DROP CONSTRAINT "FK_5c73d00c542e73bc44fc84f5e1e"`);
18
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" DROP CONSTRAINT "FK_1027b1f5301948b2c8dc5121017"`);
19
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" DROP COLUMN "weight"`);
20
+ await queryRunner.query(`CREATE INDEX "IDX_5c73d00c542e73bc44fc84f5e1" ON "payment"."organisation_payment_provider_method" ("transaction_method_id") `);
21
+ await queryRunner.query(`CREATE INDEX "IDX_1027b1f5301948b2c8dc512101" ON "payment"."organisation_payment_provider_method" ("organisation_payment_provider_id") `);
22
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" ADD CONSTRAINT "FK_1027b1f5301948b2c8dc5121017" FOREIGN KEY ("organisation_payment_provider_id") REFERENCES "payment"."organisation_payment_provider"("id") ON DELETE CASCADE ON UPDATE CASCADE`);
23
+ await queryRunner.query(`ALTER TABLE "payment"."organisation_payment_provider_method" ADD CONSTRAINT "FK_5c73d00c542e73bc44fc84f5e1e" FOREIGN KEY ("transaction_method_id") REFERENCES "payment"."transaction_method"("id") ON DELETE CASCADE ON UPDATE CASCADE`);
24
+ }
25
+ }
@@ -43,12 +43,27 @@ class User extends _dependencyAware.default {
43
43
  await this.initialise();
44
44
 
45
45
  if (typeof process.env.IS_OFFLINE !== 'undefined') {
46
- const sub = this.di.getEvent().requestContext.authorizer.claims.sub;
47
- return this.userRepository.findOne({
48
- cognito_sub: sub
49
- }, {
50
- relations: ['organisations']
51
- });
46
+ var _this$di$getEvent$req, _this$di$getEvent$req2, _this$di$getEvent$req3, _this$di$getEvent$req4, _this$di$getEvent$req5, _this$di$getEvent$req6;
47
+
48
+ const sub = (_this$di$getEvent$req = this.di.getEvent().requestContext) === null || _this$di$getEvent$req === void 0 ? void 0 : (_this$di$getEvent$req2 = _this$di$getEvent$req.authorizer) === null || _this$di$getEvent$req2 === void 0 ? void 0 : (_this$di$getEvent$req3 = _this$di$getEvent$req2.claims) === null || _this$di$getEvent$req3 === void 0 ? void 0 : _this$di$getEvent$req3.sub;
49
+
50
+ if (typeof sub !== 'undefined') {
51
+ return this.userRepository.findOne({
52
+ cognito_sub: sub
53
+ }, {
54
+ relations: ['organisations']
55
+ });
56
+ }
57
+
58
+ const userID = (_this$di$getEvent$req4 = this.di.getEvent().requestContext) === null || _this$di$getEvent$req4 === void 0 ? void 0 : (_this$di$getEvent$req5 = _this$di$getEvent$req4.authorizer) === null || _this$di$getEvent$req5 === void 0 ? void 0 : (_this$di$getEvent$req6 = _this$di$getEvent$req5.claims) === null || _this$di$getEvent$req6 === void 0 ? void 0 : _this$di$getEvent$req6.user_id;
59
+
60
+ if (typeof userID !== 'undefined') {
61
+ return this.userRepository.findOne({
62
+ id: userID
63
+ }, {
64
+ relations: ['organisations']
65
+ });
66
+ }
52
67
  }
53
68
 
54
69
  return JSON.parse(this.di.getEvent().requestContext.authorizer.user);
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@felloh-org/lambda-wrapper",
3
- "version": "1.1.76",
3
+ "version": "1.2.0",
4
4
  "description": "Lambda wrapper for all Felloh Serverless Projects",
5
5
  "main": "dist/index.js",
6
+ "engines": {
7
+ "node": ">=14"
8
+ },
6
9
  "scripts": {
7
10
  "build": "./node_modules/.bin/babel src --out-dir dist --copy-files --ignore src/migration",
8
11
  "build:orm": "./node_modules/.bin/babel src --out-dir dist --copy-files --ignore src/migration",