@kumologica/sdk 3.2.0-beta2 → 3.2.0-beta20

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.
@@ -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 API')
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 API')
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
 
@@ -1307,23 +1360,36 @@ RED.sidebar.awsDeploy = (function () {
1307
1360
  function: 'attachDataList',
1308
1361
  },
1309
1362
  ];
1310
- parameterSets['cognito'] = [
1311
- { label: 'Identity Pool ARN', key: 'identityPool', value: '' },
1312
- ];
1313
- parameterSets['iot'] = [
1363
+ //parameterSets['cognito'] = [
1364
+ // { label: 'Identity Pool ARN', key: 'identityPool', value: '' },
1365
+ //];
1366
+ //parameterSets['iot'] = [
1367
+ // {
1368
+ // label: 'Rule Name',
1369
+ // key: 'rule',
1370
+ // value: '',
1371
+ // required: true,
1372
+ // function: 'attachDataList',
1373
+ // },
1374
+ // { label: 'Query', key: 'query', value: '', required: true },
1375
+ //];
1376
+ parameterSets['api'] = [
1314
1377
  {
1315
- label: 'Rule Name',
1316
- key: 'rule',
1378
+ label: 'API',
1379
+ key: 'api',
1317
1380
  value: '',
1318
1381
  required: true,
1319
1382
  function: 'attachDataList',
1320
1383
  },
1321
- { label: 'Query', key: 'query', value: '', required: true },
1384
+ { label: 'Deployment Stage', key: 'stage', value: '', required: true },
1385
+ { label: 'Parent Id', key: 'parentId', value: '', required: false },
1386
+ { label: 'Resource', key: 'resource', value: '', required: false },
1387
+ { label: 'Authorizer Id', key: 'authorizerId', value: '', required: false }
1322
1388
  ];
1323
- parameterSets['api'] = [
1389
+ parameterSets['websocket'] = [
1324
1390
  {
1325
- label: 'API',
1326
- key: 'api',
1391
+ label: 'ApiId',
1392
+ key: 'apiId',
1327
1393
  value: '',
1328
1394
  required: true,
1329
1395
  function: 'attachDataList',
@@ -1344,23 +1410,23 @@ RED.sidebar.awsDeploy = (function () {
1344
1410
  ];
1345
1411
  parameterSets['sqs'] = [
1346
1412
  {
1347
- label: 'Queue URL',
1348
- key: 'stream',
1413
+ label: 'Queue Arn',
1414
+ key: 'queueArn',
1349
1415
  value: '',
1350
1416
  required: true,
1351
1417
  function: 'attachDataList',
1352
1418
  },
1353
1419
  { label: 'Batch Size', key: 'batchSize', value: '', min: 1, max: 10 },
1354
1420
  ];
1355
- parameterSets['alexa'] = [
1356
- {
1357
- label: 'Skill ID',
1358
- key: 'skillID',
1359
- value: '',
1360
- required: true,
1361
- function: 'attachDataList',
1362
- },
1363
- ];
1421
+ //parameterSets['alexa'] = [
1422
+ // {
1423
+ // label: 'Skill ID',
1424
+ // key: 'skillID',
1425
+ // value: '',
1426
+ // required: true,
1427
+ // function: 'attachDataList',
1428
+ // },
1429
+ //];
1364
1430
  parameterSets['kinesis'] = [
1365
1431
  { label: 'Stream ARN', key: 'stream', value: '', required: true },
1366
1432
  { label: 'Batch Size', key: 'batchSize', value: '', min: 1, max: 10000 },
@@ -1377,48 +1443,52 @@ RED.sidebar.awsDeploy = (function () {
1377
1443
  },
1378
1444
  ];
1379
1445
  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',
1446
+ { label: 'Expression', key: 'expression', value: 'cron()', required: true },
1447
+ { label: 'Reference', key: 'reference', value: '' },
1448
+ { label: 'Name', key: 'name', value: ''},
1449
+ { label: 'State',
1450
+ key: 'state',
1411
1451
  value: '',
1412
1452
  list: [
1413
- { k: 'all', v: 'all' },
1414
- { k: 'updateReference', v: 'updateReference' },
1415
- { k: 'createReference', v: 'createReference' },
1416
- { k: 'deleteReference', v: 'deleteReference' },
1453
+ { k: 'ENABLED', v: 'ENABLED' },
1454
+ { k: 'DISABLED', v: 'DISABLED' }
1417
1455
  ],
1418
1456
  },
1419
- { label: 'Branch Names', key: 'branchNames', value: '' },
1420
- { label: 'Custom Data', key: 'customData', value: '' },
1421
1457
  ];
1458
+ //parameterSets['cwlogs'] = [
1459
+ // {
1460
+ // label: 'Log Group',
1461
+ // key: 'logGroup',
1462
+ // value: '',
1463
+ // required: true,
1464
+ // function: 'attachDataList',
1465
+ // },
1466
+ // { label: 'Filter Name', key: 'filterName', value: '' },
1467
+ // { label: 'Filter Pattern', key: 'filterPattern', value: '' },
1468
+ //];
1469
+ //parameterSets['codecommit'] = [
1470
+ // {
1471
+ // label: 'Repository Name',
1472
+ // key: 'repository',
1473
+ // value: '',
1474
+ // required: true,
1475
+ // function: 'attachDataList',
1476
+ // },
1477
+ // { label: 'Trigger Name', key: 'trigger', value: '', required: true },
1478
+ // {
1479
+ // label: 'Events',
1480
+ // key: 'events',
1481
+ // value: '',
1482
+ // list: [
1483
+ // { k: 'all', v: 'all' },
1484
+ // { k: 'updateReference', v: 'updateReference' },
1485
+ // { k: 'createReference', v: 'createReference' },
1486
+ // { k: 'deleteReference', v: 'deleteReference' },
1487
+ // ],
1488
+ // },
1489
+ // { label: 'Branch Names', key: 'branchNames', value: '' },
1490
+ // { label: 'Custom Data', key: 'customData', value: '' },
1491
+ //];
1422
1492
 
1423
1493
  return {
1424
1494
  init: init,
@@ -166,7 +166,14 @@
166
166
  '$uppercase':{ args:[ 'str' ]},
167
167
  '$zip':{ args:[ 'array1' ]},
168
168
  '$vars': {args:['string']},
169
- '$single': {args:['array','function']}
169
+ '$single': {args:['array','function']},
170
+ '$maskjson':{ args:[ 'object','object' ]},
171
+ '$maskemail':{ args:[ 'string','object' ]},
172
+ '$maskcard':{ args:[ 'string','object' ]},
173
+ '$maskphone':{ args:[ 'string','object' ]},
174
+ '$maskpassword':{ args:[ 'string','object' ]},
175
+ '$queryparam': { args:[ 'string']},
176
+ '$uriparam': { args:[ 'string']}
170
177
  }
171
178
  jsonata.getFunctionSnippet = function(fn) {
172
179
  var snippetText = "";
@@ -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;