@kumologica/sdk 3.2.1 → 3.2.2
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/cli/commands/export-commands/github-commands/aws.js +18 -4
- package/package.json +4 -4
- package/src/app/lib/aws/index.js +1 -0
- package/src/app/lib/github/index.js +7 -60
- package/src/app/lib/serverless/index.js +13 -8
- package/src/app/ui/editor-client/public/red/red.js +3 -830
- package/src/app/ui/editor-client/public/red/red.min.js +1 -1
- package/src/app/ui/editor-client/public/red/style.min.css +1 -1
- package/src/app/ui/editor-client/src/js/ui/palette-nodes.js +0 -1
- package/src/app/ui/editor-client/src/js/ui/sidebar.js +1 -1
- package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +1 -1
- package/src/app/ui/editor-client/src/sass/style.scss +0 -1
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
const { exp } = require('@kumologica/builder');
|
|
2
2
|
|
|
3
3
|
exports.command = 'aws';
|
|
4
|
-
exports.desc = `Export github workflow file to automate deployment of kumologica flow into AWS
|
|
4
|
+
exports.desc = `Export github action workflow file to automate deployment of kumologica flow into AWS.`;
|
|
5
5
|
|
|
6
6
|
exports.builder = {
|
|
7
7
|
|
|
8
|
+
"lang": {
|
|
9
|
+
describe: "\nScripting language, either cloudformation or terraform.",
|
|
10
|
+
default: 'cloudformation',
|
|
11
|
+
type: 'string',
|
|
12
|
+
nargs: 1
|
|
13
|
+
},
|
|
14
|
+
"output-file-name": {
|
|
15
|
+
describe: "\nFull path and name of the github action workflow file to create. workflow.yaml file in current working directory if not provided.",
|
|
16
|
+
type: 'string',
|
|
17
|
+
nargs: 1
|
|
18
|
+
},
|
|
8
19
|
"project-directory": {
|
|
9
20
|
describe: "\nThe location of kumologica project.\n Current working directory if not provided.",
|
|
10
21
|
type: 'string',
|
|
@@ -97,9 +108,9 @@ exports.builder = {
|
|
|
97
108
|
nargs: 1
|
|
98
109
|
},
|
|
99
110
|
runtime: {
|
|
100
|
-
describe: "\nThe runtime, only nodejs runtimes allowed:
|
|
111
|
+
describe: "\nThe runtime, only nodejs runtimes allowed: nodejs14.x | nodejs16.x | ...",
|
|
101
112
|
type: 'string',
|
|
102
|
-
default: '
|
|
113
|
+
default: 'nodejs16.x',
|
|
103
114
|
alias: 'r',
|
|
104
115
|
nargs: 1
|
|
105
116
|
},
|
|
@@ -264,6 +275,8 @@ Examples:
|
|
|
264
275
|
|
|
265
276
|
function display(argv) {
|
|
266
277
|
console.log('Parameters:');
|
|
278
|
+
console.log(' lang: %s', argv["lang"]||'');
|
|
279
|
+
console.log(' output-file-name: %s', argv["output-file-name"]||'');
|
|
267
280
|
console.log(' flow-file-name: %s', argv["flow-file-name"]||'');
|
|
268
281
|
console.log(' zip-file-name: %s', argv["zip-file-name"]||'');
|
|
269
282
|
console.log(' lambda-name: %s', argv["lambda-name"]||'');
|
|
@@ -362,8 +375,9 @@ exports.handler = function (argv) {
|
|
|
362
375
|
|
|
363
376
|
const { exp } = require('@kumologica/builder');
|
|
364
377
|
|
|
365
|
-
exp('github', 'aws', argv);
|
|
378
|
+
const workflowFile = exp('github', 'aws', argv);
|
|
366
379
|
console.log(chalk.greenBright('Github action workflow created successfully.'));
|
|
380
|
+
console.log(`File: ${workflowFile}`);
|
|
367
381
|
|
|
368
382
|
process.exit(0);
|
|
369
383
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"productName": "Kumologica Designer",
|
|
4
4
|
"copyright": "Copyright 2020 Kumologica Pty Ltd, All Rights Reserved.",
|
|
5
5
|
"author": "Kumologica Pty Ltd <contact@kumologica.com>",
|
|
6
|
-
"version": "3.2.
|
|
6
|
+
"version": "3.2.2",
|
|
7
7
|
"description": "Kumologica Designer, harnessing Serverless for your cloud integration needs",
|
|
8
8
|
"main": "src/app/main.js",
|
|
9
9
|
"files": [
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"license": "Proprietary",
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@electron/remote": "^2.0.8",
|
|
67
|
-
"@kumologica/builder": "3.2.
|
|
68
|
-
"@kumologica/devkit": "3.2.
|
|
69
|
-
"@kumologica/runtime": "3.2.
|
|
67
|
+
"@kumologica/builder": "3.2.2",
|
|
68
|
+
"@kumologica/devkit": "3.2.2",
|
|
69
|
+
"@kumologica/runtime": "3.2.2",
|
|
70
70
|
"adm-zip": "0.4.13",
|
|
71
71
|
"ajv": "8.10.0",
|
|
72
72
|
"archive-type": "^4.0.0",
|
package/src/app/lib/aws/index.js
CHANGED
|
@@ -536,6 +536,7 @@ if (s.cwevents && s.cwevents.length > 0) {
|
|
|
536
536
|
console.log(`args: ${JSON.stringify(args)}`);
|
|
537
537
|
const scriptFileName = exp("cloudformation", "aws", args);
|
|
538
538
|
this.log(`Cloudformation script has been created: ${scriptFileName}`);
|
|
539
|
+
console.log(`Cloudformation script has been created: ${scriptFileName}`);
|
|
539
540
|
|
|
540
541
|
openFileOnEditor(scriptFileName);
|
|
541
542
|
} catch (Error) {
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
const fs = require('fs-extra');
|
|
2
1
|
const path = require('path');
|
|
3
2
|
const AWS = require('aws-sdk');
|
|
4
3
|
const { exp } = require('@kumologica/builder');
|
|
5
4
|
const AWSProfile = require('../aws/aws-profile');
|
|
6
5
|
const { openFileOnEditor } = require('../utils/editor');
|
|
7
6
|
|
|
8
|
-
/**
|
|
9
|
-
* sample events:
|
|
10
|
-
* https://docs.aws.amazon.com/lambda/latest/dg/lambda-services.html
|
|
11
|
-
*/
|
|
12
7
|
class GithubDeployer {
|
|
13
8
|
constructor(terminal) {
|
|
14
9
|
this.term = terminal;
|
|
@@ -65,39 +60,8 @@ class GithubDeployer {
|
|
|
65
60
|
}
|
|
66
61
|
}
|
|
67
62
|
|
|
68
|
-
logCloud(text) {
|
|
69
|
-
if (this.term) {
|
|
70
|
-
this.term.emit('terminal-cloud', `${text}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
prepare(projectDir, flowFileName, originaLambdaName) {
|
|
75
|
-
const deployDir = projectDir + '/deploy';
|
|
76
|
-
|
|
77
|
-
const flowName = flowFileName.replace('.json', '');
|
|
78
|
-
|
|
79
|
-
// setup deployment directory
|
|
80
|
-
fs.ensureDirSync(deployDir);
|
|
81
|
-
fs.emptyDirSync(deployDir);
|
|
82
|
-
fs.ensureDirSync(deployDir + '/node_modules');
|
|
83
|
-
|
|
84
|
-
this.processPackageJson(projectDir, deployDir);
|
|
85
|
-
|
|
86
|
-
const zipFileName = `${flowName}/lambda${Date.now()}.zip`;
|
|
87
|
-
const lambdaName = this.sanitizeLambdaName(originaLambdaName);
|
|
88
|
-
|
|
89
|
-
const functionName = `kumologica-${lambdaName}-lambda`;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
63
|
async generateScript(projectInfo, params, profile) {
|
|
93
|
-
|
|
94
|
-
/*
|
|
95
|
-
|
|
96
|
-
projectInfo: {"projectName":"sockets",
|
|
97
|
-
"projectDir":"/Users/wojtek/Development/projects/sockets",
|
|
98
|
-
"projectFlowName":"sockets-flow.json"}
|
|
99
|
-
profile: kl
|
|
100
|
-
*/
|
|
64
|
+
|
|
101
65
|
try {
|
|
102
66
|
this.log('Generating github action workflow');
|
|
103
67
|
|
|
@@ -109,26 +73,15 @@ class GithubDeployer {
|
|
|
109
73
|
const args = this.mapParams(params);
|
|
110
74
|
args.region = awsSettings.region;
|
|
111
75
|
args["bucket-name"] = awsSettings.bucket;
|
|
76
|
+
args["output-file-name"] = path.join(projectInfo.projectDir, '.github', 'workflows', 'workflow.yaml');
|
|
112
77
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const wfDir = path.join(projectInfo.projectDir, '.github', 'workspaces');
|
|
116
|
-
|
|
117
|
-
this.createFile (
|
|
118
|
-
wfDir, 'workflow.yaml',
|
|
119
|
-
wf
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
this.log(`Github action workflow created: ${path.join(wfDir, 'workflow.yaml')}`);
|
|
78
|
+
const wfDir = exp("github", "aws", args, console.log);
|
|
123
79
|
|
|
124
|
-
|
|
80
|
+
this.log(`Github action workflow created: ${wfDir}`);
|
|
125
81
|
|
|
126
|
-
|
|
82
|
+
openFileOnEditor(wfDir);
|
|
127
83
|
|
|
128
84
|
|
|
129
|
-
this.log(` ${this.chalk('#F5DEB3', 'AWS region:')} ${this.chalk('whiteBright', AWS.config.region)}`, false);
|
|
130
|
-
|
|
131
|
-
|
|
132
85
|
} catch (Error) {
|
|
133
86
|
this.log(`${this.chalk('redBright', 'Github action workflow creation failed.')}`);
|
|
134
87
|
this.log(` ${this.chalk('redBright', Error)}`);
|
|
@@ -179,7 +132,6 @@ class GithubDeployer {
|
|
|
179
132
|
// {"source":"cwevents","rule":"arn:aws:events:ap-southeast-2:174842903734:rule/Test"},
|
|
180
133
|
//{"source":"sns","topic":"arn:aws:sns:ap-southeast-2:174842903734:t1"},
|
|
181
134
|
//{"source":"s3","bucket":"kumoexcelstore","eventType":"s3:ObjectCreated:*","prefix":"cc","suffix":"fd"}],"vpcConfig":{"sg":"","sn":""}}
|
|
182
|
-
///Users/wojtek/Development/kumologica/sdk/kumologica/packages/sdk/src/app/lib/github/index.js:114
|
|
183
135
|
let triggers;
|
|
184
136
|
if (params.events) {
|
|
185
137
|
triggers = [];
|
|
@@ -197,7 +149,7 @@ class GithubDeployer {
|
|
|
197
149
|
break;
|
|
198
150
|
case "s3": triggers.push({"s3": {"bucket": e.bucket, "eventType": e.eventType, "prefix": e.prefix, "suffix": e.suffix}});
|
|
199
151
|
break;
|
|
200
|
-
case "cwevents": triggers.push({"event": {"expression": e.expression, "reference": e.reference, "name": e.name}});
|
|
152
|
+
case "cwevents": triggers.push({"event": {"expression": e.expression, "reference": e.reference, "name": e.name, "state": e.state}});
|
|
201
153
|
break;
|
|
202
154
|
}
|
|
203
155
|
})
|
|
@@ -218,7 +170,7 @@ class GithubDeployer {
|
|
|
218
170
|
"role-arn": params.role,
|
|
219
171
|
"tracing-config": tracing,
|
|
220
172
|
"reserved-concurrency": params.reservedConcurrency
|
|
221
|
-
// not present
|
|
173
|
+
// not present in designer
|
|
222
174
|
// "role-name": params.roleName,
|
|
223
175
|
// "layers": params.layers,
|
|
224
176
|
// "policy": params.policy,
|
|
@@ -232,11 +184,6 @@ class GithubDeployer {
|
|
|
232
184
|
}
|
|
233
185
|
return args;
|
|
234
186
|
}
|
|
235
|
-
|
|
236
|
-
createFile(baseDir, fileName, content) {
|
|
237
|
-
fs.outputFileSync(path.join(baseDir, fileName), content, 'utf-8');
|
|
238
|
-
}
|
|
239
|
-
|
|
240
187
|
}
|
|
241
188
|
|
|
242
189
|
module.exports = GithubDeployer;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const fs = require('fs-extra');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const AWS = require('aws-sdk');
|
|
4
|
-
const chalk = require('chalk');
|
|
5
4
|
const yaml = require('js-yaml');
|
|
6
5
|
const AWSProfile = require('../aws/aws-profile');
|
|
7
6
|
const CASQS = require('../aws/ca-sqs-api');
|
|
@@ -39,7 +38,7 @@ class ServerlessDeployer {
|
|
|
39
38
|
var t = text;
|
|
40
39
|
|
|
41
40
|
if (calog) {
|
|
42
|
-
t = `Kumologica: ${
|
|
41
|
+
t = `Kumologica: ${text}`;
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
if (this.term) {
|
|
@@ -95,34 +94,35 @@ class ServerlessDeployer {
|
|
|
95
94
|
|
|
96
95
|
try {
|
|
97
96
|
this.log('Generating serverless.yml file');
|
|
98
|
-
this.log(`
|
|
99
|
-
this.log(`
|
|
97
|
+
this.log(` AWS profile: ${AWS.config.profile}`, false);
|
|
98
|
+
this.log(` AWS region: ${AWS.config.region}`, false);
|
|
100
99
|
|
|
101
100
|
const settings = this.prepare(projectInfo.projectDir, projectInfo.projectFlowName, params.functionName, params.description);
|
|
102
101
|
const nodes = this.loadFlow(path.join(projectInfo.projectDir, projectInfo.projectFlowName));
|
|
103
102
|
|
|
104
103
|
const serverlessTemplate = await this.createServerlessTemplate(params, settings, nodes, AWS.config.region);
|
|
105
104
|
this.createFile(projectInfo.projectDir, `serverless.yml`, serverlessTemplate);
|
|
106
|
-
|
|
105
|
+
|
|
107
106
|
const scriptFileName = path.join(projectInfo.projectDir, `serverless.yml`);
|
|
108
107
|
this.log(`serverless.yml has been created.`);
|
|
109
108
|
|
|
110
109
|
openFileOnEditor(scriptFileName);
|
|
111
110
|
|
|
112
111
|
} catch (Error) {
|
|
113
|
-
this.log(`${
|
|
114
|
-
this.log(` ${
|
|
112
|
+
this.log(`${'Script creation failed.'}`);
|
|
113
|
+
this.log(` ${Error}`);
|
|
115
114
|
throw Error;
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
async createServerlessTemplate(params, settings, nodes, region){
|
|
119
|
+
try {
|
|
120
120
|
let serverlessJson = {
|
|
121
121
|
service: settings.functionName,
|
|
122
122
|
|
|
123
123
|
provider: {
|
|
124
124
|
name: "aws",
|
|
125
|
-
runtime: "
|
|
125
|
+
runtime: "nodejs16.x",
|
|
126
126
|
deploymentPrefix: "kumologica-sls"
|
|
127
127
|
},
|
|
128
128
|
functions: {},
|
|
@@ -165,7 +165,9 @@ class ServerlessDeployer {
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
console.log(`tags: ${JSON.stringify(params.tags)}`);
|
|
168
169
|
if (params.tags) {
|
|
170
|
+
serverlessJson.functions[ `${settings.functionName}`].tags = {};
|
|
169
171
|
params.tags.forEach(function(tag, index) {
|
|
170
172
|
serverlessJson.functions[ `${settings.functionName}`].tags[tag.key] = tag.value;
|
|
171
173
|
});
|
|
@@ -296,6 +298,9 @@ class ServerlessDeployer {
|
|
|
296
298
|
}
|
|
297
299
|
|
|
298
300
|
return yaml.dump(serverlessJson);
|
|
301
|
+
} catch(e) {
|
|
302
|
+
console.log(e);
|
|
303
|
+
}
|
|
299
304
|
}
|
|
300
305
|
|
|
301
306
|
|