@felloh-org/lambda-wrapper 1.0.26 → 1.0.27
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/.concourse/pipeline.yml +129 -0
- package/.concourse/private.yml +0 -0
- package/.gitattributes +1 -0
- package/dist/entity/trust-payments/chargeback/index.js +2 -1
- package/dist/migration/1648137333608-trust_chargeback_due.js +13 -0
- package/dist/service/warehouse.js +7 -5
- package/package.json +5 -2
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# --------------------------------------------------------------------------------------------------
|
|
2
|
+
# Resource Types
|
|
3
|
+
# --------------------------------------------------------------------------------------------------
|
|
4
|
+
resource_types:
|
|
5
|
+
|
|
6
|
+
- name: pull-request
|
|
7
|
+
type: docker-image
|
|
8
|
+
source:
|
|
9
|
+
repository: teliaoss/github-pr-resource
|
|
10
|
+
|
|
11
|
+
- name: slack-notification
|
|
12
|
+
type: docker-image
|
|
13
|
+
source:
|
|
14
|
+
repository: mockersf/concourse-slack-notifier
|
|
15
|
+
tag: latest
|
|
16
|
+
|
|
17
|
+
# --------------------------------------------------------------------------------------------------
|
|
18
|
+
# Resources
|
|
19
|
+
# --------------------------------------------------------------------------------------------------
|
|
20
|
+
resources:
|
|
21
|
+
|
|
22
|
+
- name: concourse-scripts
|
|
23
|
+
type: git
|
|
24
|
+
source:
|
|
25
|
+
uri: git@github.com:felloh-org/concourse-scripts.git
|
|
26
|
+
branch: main
|
|
27
|
+
depth: 0
|
|
28
|
+
private_key: ((git.private_key))
|
|
29
|
+
|
|
30
|
+
- name: lambda-wrapper
|
|
31
|
+
type: git
|
|
32
|
+
source:
|
|
33
|
+
uri: git@github.com:felloh-org/lambda-wrapper.git
|
|
34
|
+
branch: main
|
|
35
|
+
depth: 0
|
|
36
|
+
private_key: ((git.private_key))
|
|
37
|
+
|
|
38
|
+
- name: slack-alert-deploy
|
|
39
|
+
type: slack-notification
|
|
40
|
+
source:
|
|
41
|
+
url: ((slack.channels.engineering-deployments))
|
|
42
|
+
|
|
43
|
+
# --------------------------------------------------------------------------------------------------
|
|
44
|
+
# Jobs
|
|
45
|
+
# --------------------------------------------------------------------------------------------------
|
|
46
|
+
jobs:
|
|
47
|
+
- name: 'migrations.staging'
|
|
48
|
+
serial: true
|
|
49
|
+
plan:
|
|
50
|
+
- in_parallel:
|
|
51
|
+
- get: lambda-wrapper
|
|
52
|
+
trigger: true
|
|
53
|
+
- get: concourse-scripts
|
|
54
|
+
- task: 'schema.create'
|
|
55
|
+
file: concourse-scripts/scripts/pulumi_npm_run/npm_run.yml
|
|
56
|
+
input_mapping:
|
|
57
|
+
repository: lambda-wrapper
|
|
58
|
+
params:
|
|
59
|
+
NPM_COMMAND: 'orm:schema:create'
|
|
60
|
+
AWS_ACCESS_KEY_ID: ((aws.keys.access))
|
|
61
|
+
AWS_SECRET_ACCESS_KEY: ((aws.keys.secret))
|
|
62
|
+
AWS_REGION: ((aws.region.primary))
|
|
63
|
+
WAREHOUSE_ARN: ((aws.rds.warehouse_arn.staging))
|
|
64
|
+
WAREHOUSE_SECRET_ARN: ((aws.secret_manager.warehouse_secret_arn.staging))
|
|
65
|
+
WAREHOUSE_DATABASE: 'felloh'
|
|
66
|
+
WAREHOUSE_SCHEMA: 'user'
|
|
67
|
+
- task: 'migrations.run'
|
|
68
|
+
file: concourse-scripts/scripts/pulumi_npm_run/npm_run.yml
|
|
69
|
+
input_mapping:
|
|
70
|
+
repository: lambda-wrapper
|
|
71
|
+
params:
|
|
72
|
+
NPM_COMMAND: 'orm:migration:run'
|
|
73
|
+
AWS_ACCESS_KEY_ID: ((aws.keys.access))
|
|
74
|
+
AWS_SECRET_ACCESS_KEY: ((aws.keys.secret))
|
|
75
|
+
AWS_REGION: ((aws.region.primary))
|
|
76
|
+
WAREHOUSE_ARN: ((aws.rds.warehouse_arn.staging))
|
|
77
|
+
WAREHOUSE_SECRET_ARN: ((aws.secret_manager.warehouse_secret_arn.staging))
|
|
78
|
+
WAREHOUSE_DATABASE: 'felloh'
|
|
79
|
+
WAREHOUSE_SCHEMA: 'user'
|
|
80
|
+
on_failure:
|
|
81
|
+
put: slack-alert-deploy
|
|
82
|
+
params:
|
|
83
|
+
alert_type: 'failed'
|
|
84
|
+
message: Staging deployment failed
|
|
85
|
+
|
|
86
|
+
- name: 'migrations.production'
|
|
87
|
+
serial: true
|
|
88
|
+
plan:
|
|
89
|
+
- in_parallel:
|
|
90
|
+
- get: lambda-wrapper
|
|
91
|
+
passed: ['migrations.staging']
|
|
92
|
+
trigger: true
|
|
93
|
+
- get: concourse-scripts
|
|
94
|
+
- task: 'schema.create'
|
|
95
|
+
file: concourse-scripts/scripts/pulumi_npm_run/npm_run.yml
|
|
96
|
+
input_mapping:
|
|
97
|
+
repository: lambda-wrapper
|
|
98
|
+
params:
|
|
99
|
+
NPM_COMMAND: 'orm:schema:create'
|
|
100
|
+
AWS_ACCESS_KEY_ID: ((aws.keys.access))
|
|
101
|
+
AWS_SECRET_ACCESS_KEY: ((aws.keys.secret))
|
|
102
|
+
AWS_REGION: ((aws.region.primary))
|
|
103
|
+
WAREHOUSE_ARN: ((aws.rds.warehouse_arn.production))
|
|
104
|
+
WAREHOUSE_SECRET_ARN: ((aws.secret_manager.warehouse_secret_arn.production))
|
|
105
|
+
WAREHOUSE_DATABASE: 'felloh'
|
|
106
|
+
WAREHOUSE_SCHEMA: 'user'
|
|
107
|
+
- task: 'migrations.run'
|
|
108
|
+
file: concourse-scripts/scripts/pulumi_npm_run/npm_run.yml
|
|
109
|
+
input_mapping:
|
|
110
|
+
repository: lambda-wrapper
|
|
111
|
+
params:
|
|
112
|
+
NPM_COMMAND: 'orm:migration:run'
|
|
113
|
+
AWS_ACCESS_KEY_ID: ((aws.keys.access))
|
|
114
|
+
AWS_SECRET_ACCESS_KEY: ((aws.keys.secret))
|
|
115
|
+
AWS_REGION: ((aws.region.primary))
|
|
116
|
+
WAREHOUSE_ARN: ((aws.rds.warehouse_arn.production))
|
|
117
|
+
WAREHOUSE_SECRET_ARN: ((aws.secret_manager.warehouse_secret_arn.production))
|
|
118
|
+
WAREHOUSE_DATABASE: 'felloh'
|
|
119
|
+
WAREHOUSE_SCHEMA: 'user'
|
|
120
|
+
on_success:
|
|
121
|
+
put: slack-alert-deploy
|
|
122
|
+
params:
|
|
123
|
+
alert_type: 'success'
|
|
124
|
+
message: Migrations deployment succeeded
|
|
125
|
+
on_failure:
|
|
126
|
+
put: slack-alert-deploy
|
|
127
|
+
params:
|
|
128
|
+
alert_type: 'failed'
|
|
129
|
+
message: Migrations deployment failed
|
|
Binary file
|
package/.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.concourse/private.yml filter=git-crypt diff=git-crypt
|
|
@@ -39,7 +39,8 @@ let Chargeback = (_dec = (0, _typeorm.Entity)({
|
|
|
39
39
|
}), _dec8 = (0, _typeorm.Column)({
|
|
40
40
|
type: "int"
|
|
41
41
|
}), _dec9 = (0, _typeorm.Column)({
|
|
42
|
-
type: "date"
|
|
42
|
+
type: "date",
|
|
43
|
+
nullable: true
|
|
43
44
|
}), _dec10 = (0, _typeorm.Column)({
|
|
44
45
|
type: "date"
|
|
45
46
|
}), _dec11 = (0, _typeorm.Column)({
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class trustChargebackDue1648137333608 {
|
|
4
|
+
name = 'trustChargebackDue1648137333608'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."chargeback" ALTER COLUMN "due_date" DROP NOT NULL`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async down(queryRunner) {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "trust_payments"."chargeback" ALTER COLUMN "due_date" SET NOT NULL`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -26,13 +26,15 @@ class Warehouse extends _dependencyAware.default {
|
|
|
26
26
|
this.connection = null;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
29
|
+
* Connect to the warehouse
|
|
30
|
+
* @param database
|
|
31
|
+
* @param cache
|
|
32
|
+
* @returns {Promise<null>}
|
|
31
33
|
*/
|
|
32
34
|
|
|
33
35
|
|
|
34
|
-
async connect() {
|
|
35
|
-
if (this.connection) {
|
|
36
|
+
async connect(database = null, cache = true) {
|
|
37
|
+
if (this.connection && cache === true) {
|
|
36
38
|
return this.connection;
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -41,7 +43,7 @@ class Warehouse extends _dependencyAware.default {
|
|
|
41
43
|
} catch (error) {
|
|
42
44
|
this.connection = await (0, _typeorm.createConnection)({
|
|
43
45
|
type: 'aurora-data-api-pg',
|
|
44
|
-
database: process.env.WAREHOUSE_DATABASE,
|
|
46
|
+
database: database !== null ? database : process.env.WAREHOUSE_DATABASE,
|
|
45
47
|
schema: process.env.WAREHOUSE_SCHEMA,
|
|
46
48
|
secretArn: process.env.WAREHOUSE_SECRET_ARN,
|
|
47
49
|
resourceArn: process.env.WAREHOUSE_ARN,
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@felloh-org/lambda-wrapper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "Lambda wrapper for all Felloh Serverless Projects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "./node_modules/.bin/babel src --out-dir dist --copy-files --ignore src/migration",
|
|
8
8
|
"build:orm": "./node_modules/.bin/babel src --out-dir dist --copy-files --ignore src/migration",
|
|
9
|
+
"concourse:deploy": "fly -t felloh-cicd set-pipeline -p lambda-wrapper -c .concourse/pipeline.yml -l .concourse/private.yml",
|
|
10
|
+
"concourse:login": "fly --target felloh-cicd login --insecure --concourse-url https://ci.services.felloh.org --team-name libraries",
|
|
11
|
+
"concourse:sync": "sudo fly -t ci sync",
|
|
9
12
|
"lint": "./node_modules/.bin/eslint ./src",
|
|
10
13
|
"orm:migration:generate": "rm -rf dist && yarn build:orm && ./node_modules/.bin/typeorm migration:generate -o -n",
|
|
11
14
|
"orm:migration:run": "rm -rf dist && yarn build:orm && ./node_modules/.bin/typeorm migration:run",
|
|
@@ -34,7 +37,6 @@
|
|
|
34
37
|
"babel-jest": "^26.3.3",
|
|
35
38
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
36
39
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
37
|
-
"dotenv": "^11.0.0",
|
|
38
40
|
"eslint": "^8.6.0",
|
|
39
41
|
"eslint-plugin-flowtype": "^8.0.3",
|
|
40
42
|
"eslint-plugin-import": "^2.25.3",
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
"alai": "1.0.3",
|
|
53
55
|
"async": "^3.2.0",
|
|
54
56
|
"axios": "^0.21.1",
|
|
57
|
+
"dotenv": "^11.0.0",
|
|
55
58
|
"epsagon": "^1.104.2",
|
|
56
59
|
"typeorm": "^0.2.41",
|
|
57
60
|
"typeorm-aurora-data-api-driver": "^2.3.5",
|