@kumologica/sdk 3.2.0-beta8 → 3.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.
@@ -1742,9 +1742,9 @@ RED.editor = (function () {
1742
1742
  resize: function (dimensions) {
1743
1743
  editTrayWidthCache[type] = dimensions.width;
1744
1744
  $('.editor-tray-content').height(dimensions.height - 50);
1745
- var form = $('.editor-tray-content form').height(
1746
- dimensions.height - 50 - 40
1747
- );
1745
+ // var form = $('.editor-tray-content form').height(
1746
+ // dimensions.height - 50 - 40
1747
+ // );
1748
1748
  if (editing_node && editing_node._def.oneditresize) {
1749
1749
  try {
1750
1750
  editing_node._def.oneditresize.call(editing_node, {
@@ -118,6 +118,7 @@ RED.sidebar.awsDeploy = (function () {
118
118
  <span class="option-disabled">Generate script...</span>
119
119
  <span id="exportCloudFormationBtn" class="option">AWS CloudFormation</span>
120
120
  <span id="exportServerlessBtn" class="option">Serverless</span>
121
+ <span id="exportGithubActionBtn" class="option">Github Action Workflow</span>
121
122
  </div>
122
123
  </div>
123
124
  </div>
@@ -181,6 +182,12 @@ RED.sidebar.awsDeploy = (function () {
181
182
  });
182
183
  //tagsSection.expand();
183
184
 
185
+ // vpc section
186
+ vpcSection = sections.add({
187
+ title: 'vpc',
188
+ collapsible: true,
189
+ });
190
+
184
191
  // event section
185
192
  eventSection = sections.add({
186
193
  title: 'Triggers',
@@ -203,7 +210,7 @@ RED.sidebar.awsDeploy = (function () {
203
210
 
204
211
  // Function content init
205
212
  let functionSectionHtml = `
206
- <table class="node-info">
213
+ <table class="node-info">
207
214
  <tr class="node-info-node-row">
208
215
  <td>Name</td>
209
216
  <td colspan="2" style="background: white"><input style="width:100%" id="cloud-fn-name" class="palette-textinput" pattern="[a-zA-Z0-9-_]{1,64}" type="text"></td>
@@ -238,7 +245,10 @@ RED.sidebar.awsDeploy = (function () {
238
245
  </tr>
239
246
  <tr class="node-info-node-row">
240
247
  <td>Custom Role</td>
241
- <td colspan="2" style="background: white; overflow-x:hidden"><input id="cloud-fn-role" list="iamroles-cloud-fn-role-dataList" style="width:100%" class="palette-textinput" placeHolder="optional" type="string"><datalist id="iamroles-cloud-fn-role-dataList"></datalist></td>
248
+ <td colspan="2" style="background: white; overflow-x:hidden">
249
+ <input id="cloud-fn-role" list="iamroles-cloud-fn-role-dataList" style="width:100%" class="palette-textinput" placeHolder="optional" type="string">
250
+ <datalist id="iamroles-cloud-fn-role-dataList"></datalist>
251
+ </td>
242
252
  </tr>
243
253
  </table>
244
254
  `;
@@ -283,6 +293,28 @@ RED.sidebar.awsDeploy = (function () {
283
293
  $(tagsSectionHtml).appendTo(tagsSection.content);
284
294
  tagsSection.container.show();
285
295
 
296
+ // VPC section init
297
+ let vpcSectionHtml = `
298
+ <table class="node-info">
299
+ <tbody>
300
+ <tr class="node-info-node-row">
301
+ <td>Security Group Ids</td>
302
+ <td colspan="2" style="background: white; overflow-x:hidden">
303
+ <input id="cloud-fn-vpc-security-group" style="width:100%" class="palette-textinput" placeHolder="sg-11111, sg-22222" type="string">
304
+ </td>
305
+ </tr>
306
+ <tr class="node-info-node-row">
307
+ <td>Subnet Ids</td>
308
+ <td colspan="2" style="background: white; overflow-x:hidden">
309
+ <input id="cloud-fn-vpc-subnet" style="width:100%" class="palette-textinput" placeHolder="subnet-111, subnet-222" type="string">
310
+ </td>
311
+ </tr>
312
+ </tbody>
313
+ </table>
314
+ `;
315
+ $(vpcSectionHtml).appendTo(vpcSection.content);
316
+ vpcSection.container.show();
317
+
286
318
  // Event section init
287
319
  $(`
288
320
  <div style="display:flex; flex-direction: column; justify-content: flex-start;">
@@ -292,11 +324,12 @@ RED.sidebar.awsDeploy = (function () {
292
324
  <option value="kinesis">Amazon Kinesis</option>
293
325
  <option value="sqs">Amazon SQS</option>
294
326
  <option disabled>────────────────────</option>
295
- <option value="alb">Application Load Balancer</option>
327
+ <!--option value="alb">Application Load Balancer</option-->
296
328
  <!--option value="cognito">Amazon Cognito Sync Trigger</option-->
297
329
  <!--option value="lex">Amazon Lex</option-->
298
- <option value="alexa">Amazon Alexa</option>
330
+ <!--option value="alexa">Amazon Alexa</option-->
299
331
  <option selected value="api">Amazon API Gateway</option>
332
+ <option selected value="websocket">Amazon WebSocket API</option>
300
333
  <!--option value="cf">Amazon CloudFront (Lambda@Edge)</option-->
301
334
  <!--option value="firehose">Amazon Kinesis Data Firehose</option-->
302
335
  <option disabled>────────────────────</option>
@@ -308,7 +341,7 @@ RED.sidebar.awsDeploy = (function () {
308
341
  <option value="cwevents">Amazon CloudWatch Events</option>
309
342
  <!--option value="codecommit">Amazon CodeCommit</option-->
310
343
  <!--option value="config">Amazon Config</option-->
311
- <option value="iot">Amazon IoT Events</option>
344
+ <!--option value="iot">Amazon IoT Events</option-->
312
345
  </select>
313
346
 
314
347
  <a id="add-event" href="#" style="float: right; margin: 0px 0px 0px 5px !important; height: 21px !important;" class="editor-button editor-button-small">
@@ -397,6 +430,12 @@ RED.sidebar.awsDeploy = (function () {
397
430
  if (params.timeout) {
398
431
  $('#cloud-fn-timeout').val(params.timeout);
399
432
  }
433
+ if (params.vpcConfig && params.vpcConfig.sg) {
434
+ $('#cloud-fn-vpc-security-group').val(params.vpcConfig.sg);
435
+ }
436
+ if (params.vpcConfig && params.vpcConfig.sn) {
437
+ $('#cloud-fn-vpc-subnet').val(params.vpcConfig.sn);
438
+ }
400
439
  if (params.reservedConcurrency) {
401
440
  $('#cloud-fn-reservedConcurrency').val(params.reservedConcurrency);
402
441
  }
@@ -454,7 +493,11 @@ RED.sidebar.awsDeploy = (function () {
454
493
  let fnXray = $('#cloud-fn-x-ray').prop('checked');
455
494
  let fnProfile = getProfile();
456
495
  let fnRole = $('#cloud-fn-role').val();
457
-
496
+ let fnVpcConfig = {
497
+ sg: $('#cloud-fn-vpc-security-group').val(),
498
+ sn: $('#cloud-fn-vpc-subnet').val()
499
+ };
500
+
458
501
  // Environment variables
459
502
  let environment = [];
460
503
  let envvarRows = $('#cloud-fn-env-table tr');
@@ -506,7 +549,7 @@ RED.sidebar.awsDeploy = (function () {
506
549
  events.push(event);
507
550
  });
508
551
 
509
- return {
552
+ const res = {
510
553
  functionName: fnName,
511
554
  description: fnDescription,
512
555
  memory: fnMemory,
@@ -518,7 +561,10 @@ RED.sidebar.awsDeploy = (function () {
518
561
  environment: environment,
519
562
  tags: tags,
520
563
  events: events,
564
+ vpcConfig: fnVpcConfig
521
565
  };
566
+
567
+ return res;
522
568
  }
523
569
 
524
570
  async function attachDataList(serviceType, itemId, dataListId) {
@@ -534,7 +580,7 @@ RED.sidebar.awsDeploy = (function () {
534
580
 
535
581
  if (serviceType == 'api') {
536
582
  $(`#${dataListId}`).append(
537
- $('<option>').attr('value', 'Create new API').text('Create new API')
583
+ $('<option>').attr('value', 'create new').text('create new')
538
584
  );
539
585
  }
540
586
 
@@ -565,7 +611,7 @@ RED.sidebar.awsDeploy = (function () {
565
611
 
566
612
  if (serviceType == 'api') {
567
613
  $(`#${dataListId}`).append(
568
- $('<option>').attr('value', 'Create new API').text('Create new API')
614
+ $('<option>').attr('value', 'create new').text('create new')
569
615
  );
570
616
  }
571
617
 
@@ -790,8 +836,7 @@ RED.sidebar.awsDeploy = (function () {
790
836
  $('#cloud-fn-memory').val('512');
791
837
  $('#cloud-fn-timeout').val('20');
792
838
 
793
- $('#cloud-fn-timeout, #cloud-fn-memory, #cloud-fn-description, #cloud-fn-name, #cloud-fn-reservedConcurrency, #cloud-fn-x-ray, #cloud-fn-role'
794
- ).change(function () {
839
+ $('#cloud-fn-timeout, #cloud-fn-memory, #cloud-fn-description, #cloud-fn-name, #cloud-fn-reservedConcurrency, #cloud-fn-x-ray, #cloud-fn-role, #cloud-fn-vpc-subnet, #cloud-fn-security-group').change(function () {
795
840
  saveSettings();
796
841
  });
797
842
 
@@ -960,6 +1005,14 @@ RED.sidebar.awsDeploy = (function () {
960
1005
  exportScript(window.__kumologica.cloud.provider.serverless);
961
1006
  });
962
1007
 
1008
+ // Export serverless script
1009
+ $('#exportGithubActionBtn').click((e) => {
1010
+ e.preventDefault();
1011
+ hideMenu();
1012
+ exportScript(window.__kumologica.cloud.provider.github);
1013
+ });
1014
+
1015
+
963
1016
  $('#cloud-options-dropdown').click((e) => {
964
1017
  e.stopPropagation();
965
1018
 
@@ -1021,7 +1074,6 @@ RED.sidebar.awsDeploy = (function () {
1021
1074
  RED.notify(`<strong>Error</strong>: ${err.stderr? err.stderr: err}`, 'error');
1022
1075
  return;
1023
1076
  }
1024
-
1025
1077
 
1026
1078
  refreshDataLists();
1027
1079
  connectedState = CONNECTED;
@@ -1173,7 +1225,7 @@ RED.sidebar.awsDeploy = (function () {
1173
1225
  deployState = DEPLOYING;
1174
1226
 
1175
1227
  let item = $('#cloud-fn-event-table :input').filter(function () {
1176
- return this.value == 'Create new API';
1228
+ return this.value == 'create new';
1177
1229
  });
1178
1230
 
1179
1231
  $('#workspace-terminal').show();
@@ -1307,23 +1359,36 @@ RED.sidebar.awsDeploy = (function () {
1307
1359
  function: 'attachDataList',
1308
1360
  },
1309
1361
  ];
1310
- parameterSets['cognito'] = [
1311
- { label: 'Identity Pool ARN', key: 'identityPool', value: '' },
1312
- ];
1313
- parameterSets['iot'] = [
1362
+ //parameterSets['cognito'] = [
1363
+ // { label: 'Identity Pool ARN', key: 'identityPool', value: '' },
1364
+ //];
1365
+ //parameterSets['iot'] = [
1366
+ // {
1367
+ // label: 'Rule Name',
1368
+ // key: 'rule',
1369
+ // value: '',
1370
+ // required: true,
1371
+ // function: 'attachDataList',
1372
+ // },
1373
+ // { label: 'Query', key: 'query', value: '', required: true },
1374
+ //];
1375
+ parameterSets['api'] = [
1314
1376
  {
1315
- label: 'Rule Name',
1316
- key: 'rule',
1377
+ label: 'API',
1378
+ key: 'api',
1317
1379
  value: '',
1318
1380
  required: true,
1319
1381
  function: 'attachDataList',
1320
1382
  },
1321
- { label: 'Query', key: 'query', value: '', required: true },
1383
+ { label: 'Deployment Stage', key: 'stage', value: '', required: true },
1384
+ { label: 'Parent Id', key: 'parentId', value: '', required: false },
1385
+ { label: 'Resource', key: 'resource', value: '', required: false },
1386
+ { label: 'Authorizer Id', key: 'authorizerId', value: '', required: false }
1322
1387
  ];
1323
- parameterSets['api'] = [
1388
+ parameterSets['websocket'] = [
1324
1389
  {
1325
- label: 'API',
1326
- key: 'api',
1390
+ label: 'ApiId',
1391
+ key: 'apiId',
1327
1392
  value: '',
1328
1393
  required: true,
1329
1394
  function: 'attachDataList',
@@ -1344,23 +1409,23 @@ RED.sidebar.awsDeploy = (function () {
1344
1409
  ];
1345
1410
  parameterSets['sqs'] = [
1346
1411
  {
1347
- label: 'Queue URL',
1348
- key: 'stream',
1412
+ label: 'Queue Arn',
1413
+ key: 'queueArn',
1349
1414
  value: '',
1350
1415
  required: true,
1351
1416
  function: 'attachDataList',
1352
1417
  },
1353
1418
  { label: 'Batch Size', key: 'batchSize', value: '', min: 1, max: 10 },
1354
1419
  ];
1355
- parameterSets['alexa'] = [
1356
- {
1357
- label: 'Skill ID',
1358
- key: 'skillID',
1359
- value: '',
1360
- required: true,
1361
- function: 'attachDataList',
1362
- },
1363
- ];
1420
+ //parameterSets['alexa'] = [
1421
+ // {
1422
+ // label: 'Skill ID',
1423
+ // key: 'skillID',
1424
+ // value: '',
1425
+ // required: true,
1426
+ // function: 'attachDataList',
1427
+ // },
1428
+ //];
1364
1429
  parameterSets['kinesis'] = [
1365
1430
  { label: 'Stream ARN', key: 'stream', value: '', required: true },
1366
1431
  { label: 'Batch Size', key: 'batchSize', value: '', min: 1, max: 10000 },
@@ -1377,48 +1442,52 @@ RED.sidebar.awsDeploy = (function () {
1377
1442
  },
1378
1443
  ];
1379
1444
  parameterSets['cwevents'] = [
1380
- {
1381
- label: 'Rule ARN',
1382
- key: 'rule',
1383
- value: '',
1384
- required: true,
1385
- function: 'attachDataList',
1386
- },
1387
- ];
1388
- parameterSets['cwlogs'] = [
1389
- {
1390
- label: 'Log Group',
1391
- key: 'logGroup',
1392
- value: '',
1393
- required: true,
1394
- function: 'attachDataList',
1395
- },
1396
- { label: 'Filter Name', key: 'filterName', value: '' },
1397
- { label: 'Filter Pattern', key: 'filterPattern', value: '' },
1398
- ];
1399
- parameterSets['codecommit'] = [
1400
- {
1401
- label: 'Repository Name',
1402
- key: 'repository',
1403
- value: '',
1404
- required: true,
1405
- function: 'attachDataList',
1406
- },
1407
- { label: 'Trigger Name', key: 'trigger', value: '', required: true },
1408
- {
1409
- label: 'Events',
1410
- key: 'events',
1445
+ { label: 'Expression', key: 'expression', value: 'cron()', required: true },
1446
+ { label: 'Reference', key: 'reference', value: '' },
1447
+ { label: 'Name', key: 'name', value: ''},
1448
+ { label: 'State',
1449
+ key: 'state',
1411
1450
  value: '',
1412
1451
  list: [
1413
- { k: 'all', v: 'all' },
1414
- { k: 'updateReference', v: 'updateReference' },
1415
- { k: 'createReference', v: 'createReference' },
1416
- { k: 'deleteReference', v: 'deleteReference' },
1452
+ { k: 'ENABLED', v: 'ENABLED' },
1453
+ { k: 'DISABLED', v: 'DISABLED' }
1417
1454
  ],
1418
1455
  },
1419
- { label: 'Branch Names', key: 'branchNames', value: '' },
1420
- { label: 'Custom Data', key: 'customData', value: '' },
1421
1456
  ];
1457
+ //parameterSets['cwlogs'] = [
1458
+ // {
1459
+ // label: 'Log Group',
1460
+ // key: 'logGroup',
1461
+ // value: '',
1462
+ // required: true,
1463
+ // function: 'attachDataList',
1464
+ // },
1465
+ // { label: 'Filter Name', key: 'filterName', value: '' },
1466
+ // { label: 'Filter Pattern', key: 'filterPattern', value: '' },
1467
+ //];
1468
+ //parameterSets['codecommit'] = [
1469
+ // {
1470
+ // label: 'Repository Name',
1471
+ // key: 'repository',
1472
+ // value: '',
1473
+ // required: true,
1474
+ // function: 'attachDataList',
1475
+ // },
1476
+ // { label: 'Trigger Name', key: 'trigger', value: '', required: true },
1477
+ // {
1478
+ // label: 'Events',
1479
+ // key: 'events',
1480
+ // value: '',
1481
+ // list: [
1482
+ // { k: 'all', v: 'all' },
1483
+ // { k: 'updateReference', v: 'updateReference' },
1484
+ // { k: 'createReference', v: 'createReference' },
1485
+ // { k: 'deleteReference', v: 'deleteReference' },
1486
+ // ],
1487
+ // },
1488
+ // { label: 'Branch Names', key: 'branchNames', value: '' },
1489
+ // { label: 'Custom Data', key: 'customData', value: '' },
1490
+ //];
1422
1491
 
1423
1492
  return {
1424
1493
  init: init,
@@ -1,29 +0,0 @@
1
- const AWS = require('aws-sdk');
2
-
3
- /*
4
- * AWS JS API:
5
- * https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html
6
- */
7
- class CAAlexa {
8
-
9
- constructor(log) {
10
- this.log = log;
11
- this.alexa = new AWS.AlexaForBusiness({region: 'us-east-1'});
12
- }
13
-
14
- /**
15
- * https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/AlexaForBusiness.html#listSkills-property
16
- */
17
- async listSkills() {
18
-
19
- const response = await this.alexa.listSkills({}).promise();
20
-
21
- // {"SkillSummaries":[{"SkillId":"amzn1.ask.skill.8ac93c7f-22ec-48c7-a19d-de22baffc503","SkillName":"Writing Tips","SupportsLinking":false,"EnablementType":"ENABLED","SkillType":"PUBLIC"}]}
22
-
23
- return response.SkillSummaries.map(function(v) {
24
- return {id: v.SkillId, name: v.SkillName, arn: v.SkillName};
25
- });
26
- }
27
- }
28
-
29
- module.exports = CAAlexa;