@kumologica/sdk 3.1.0-alpha2 → 3.1.0-beta2

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.
Files changed (49) hide show
  1. package/cli/.DS_Store +0 -0
  2. package/cli/KumologicaError.js +17 -0
  3. package/cli/cli.js +2 -1
  4. package/cli/commands/create-commands/create-project-iteratively.js +42 -0
  5. package/cli/commands/create-commands/index.js +5 -0
  6. package/cli/commands/create.js +55 -22
  7. package/cli/commands/list-templates.js +24 -0
  8. package/cli/commands/open.js +1 -1
  9. package/cli/commands/test-utils/TestSuiteController.js +0 -1
  10. package/cli/commands/test.js +3 -2
  11. package/cli/utils/download-template-from-repo.js +346 -0
  12. package/cli/utils/download-test.js +12 -0
  13. package/cli/utils/download.js +119 -0
  14. package/cli/utils/fs/copy-dir-contents-sync.js +15 -0
  15. package/cli/utils/fs/create-zip-file.js +39 -0
  16. package/cli/utils/fs/dir-exists-sync.js +14 -0
  17. package/cli/utils/fs/dir-exists.js +17 -0
  18. package/cli/utils/fs/file-exists-sync.js +14 -0
  19. package/cli/utils/fs/file-exists.js +12 -0
  20. package/cli/utils/fs/get-tmp-dir-path.js +22 -0
  21. package/cli/utils/fs/parse.js +40 -0
  22. package/cli/utils/fs/read-file-sync.js +11 -0
  23. package/cli/utils/fs/read-file.js +10 -0
  24. package/cli/utils/fs/safe-move-file.js +58 -0
  25. package/cli/utils/fs/walk-dir-sync.js +34 -0
  26. package/cli/utils/fs/write-file-sync.js +31 -0
  27. package/cli/utils/fs/write-file.js +32 -0
  28. package/cli/{commands/utils.js → utils/logger.js} +7 -1
  29. package/cli/utils/rename-service.js +49 -0
  30. package/package.json +18 -33
  31. package/src/app/ui/editor-api/lib/auth/index.js +75 -73
  32. package/src/app/ui/editor-api/lib/auth/strategies.js +132 -132
  33. package/src/app/ui/editor-api/lib/index.js +2 -2
  34. package/src/app/ui/editor-client/public/red/main-modals.min.js +1 -16
  35. package/src/app/ui/editor-client/public/red/main.min.js +1 -16
  36. package/src/app/ui/editor-client/public/red/red.js +64 -44
  37. package/src/app/ui/editor-client/public/red/red.min.js +19 -16
  38. package/src/app/ui/editor-client/public/red/style.min.css +1 -16
  39. package/src/app/ui/editor-client/public/vendor/ace/mode-jsonata.js +1 -1
  40. package/src/app/ui/editor-client/public/vendor/ace/snippets/jsonata.js +1 -1
  41. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.css +7 -0
  42. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.js +15 -0
  43. package/src/app/ui/editor-client/public/vendor/xterm/lib/xterm.js +2 -0
  44. package/src/app/ui/editor-client/src/js/ui/common/tabs.js +25 -17
  45. package/src/app/ui/editor-client/src/js/ui/palette-navigator.js +3 -2
  46. package/src/app/ui/editor-client/src/js/ui/search.js +21 -13
  47. package/src/app/ui/editor-client/src/js/ui/view.js +5 -3
  48. package/src/app/ui/editor-client/src/js/ui/workspaces.js +10 -9
  49. package/src/app/ui/editor-client/src/sass/palette.scss +1 -0
@@ -8949,7 +8949,8 @@ RED.panels = (function() {
8949
8949
  if (options.onclick) {
8950
8950
  options.onclick(tabs[thisTabA.attr('href').slice(1)]);
8951
8951
  }
8952
- activateTab(thisTabA);
8952
+ activateTab(thisTabA, {scroll: false}); // no-scroll
8953
+
8953
8954
  // Select the tab on the navigator
8954
8955
  // console.log('[tabs] selecting tab with id:', evt.currentTarget.id)
8955
8956
  RED.palette.navigator.selectTab(evt.currentTarget.id);
@@ -8990,13 +8991,9 @@ RED.panels = (function() {
8990
8991
  return false;
8991
8992
  }
8992
8993
 
8993
- function activateTab(link) {
8994
- // DX improvement - activate test workspace when test tab is selected
8995
- // if (link === 'test') {
8996
- // $('#view-test-flow').click();
8997
- // }
8998
-
8999
- // DX improvement - activate main workspace when trace message is being hovered
8994
+ function activateTab(link, opts) {
8995
+ const scrollAllowed = opts? opts.scroll: true;
8996
+ // console.log(`[tabs::activateTab] link: ${link}... scrollAllowed: ${scrollAllowed}`);
9000
8997
 
9001
8998
  if (typeof link === 'string') {
9002
8999
  link = ul.find("a[href='#" + link + "']");
@@ -9005,6 +9002,7 @@ RED.panels = (function() {
9005
9002
  return;
9006
9003
  }
9007
9004
  if (!link.parent().hasClass('active')) {
9005
+ // console.log(`[tabs::activateTab] link.parent is not active.`);
9008
9006
  ul.children().removeClass('active');
9009
9007
  ul.children().css({ transition: 'width 100ms' });
9010
9008
  link.parent().addClass('active');
@@ -9013,16 +9011,26 @@ RED.panels = (function() {
9013
9011
  $('#' + parentId + '-link-button').addClass('active selected');
9014
9012
  if (options.scrollable) {
9015
9013
  var pos = link.parent().position().left;
9016
- if (pos - 21 < 0) {
9017
- scrollContainer.animate({ scrollLeft: '+=' + (pos - 50) }, 300);
9018
- } else if (pos + 120 > scrollContainer.width()) {
9019
- scrollContainer.animate(
9020
- { scrollLeft: '+=' + (pos + 140 - scrollContainer.width()) },
9021
- 300
9022
- );
9014
+ // console.log(`[tabs::activateTab] pos: ${pos}`)
9015
+ // const panelNavigatorWidth = 220;
9016
+ // const tabNavigatorWidth = 21 * 2;
9017
+ // const totalLeftWidth = panelNavigatorWidth + tabNavigatorWidth;
9018
+ // console.log(`scrollContainer.width = `, scrollContainer.width());
9019
+ if (scrollAllowed) {
9020
+ // When starting the workspace, the width is 30, so we dont want to scroll. Just to make first tab fully visible and active
9021
+ if (scrollContainer.width() < 100 ){
9022
+ // console.log(`[tabs::activateTab] inital scroll`)
9023
+ scrollContainer.animate({ scrollLeft: pos }, 300);
9024
+ }
9025
+ else if (pos + 120 > scrollContainer.width()) {
9026
+ // console.log(`[tabs::activateTab] jump to right`)
9027
+ scrollContainer.animate({ scrollLeft: '+=' + (pos + 140 - scrollContainer.width()) }, 300);
9028
+ } else {
9029
+ // console.log(`[tabs::activateTab] jump to left`)
9030
+ scrollContainer.animate({ scrollLeft: pos }, 300);
9031
+ }
9023
9032
  }
9024
9033
  }
9025
- // console.log('options(onchange)=', options)
9026
9034
  if (options.onchange) {
9027
9035
  options.onchange(tabs[link.attr('href').slice(1)]);
9028
9036
  }
@@ -9032,7 +9040,7 @@ RED.panels = (function() {
9032
9040
  ul.children().css({ transition: '' });
9033
9041
  }, 100);
9034
9042
  } else {
9035
- // console.log('options(onsame)=', options)
9043
+ // console.log(`[tabs::activateTab] link.parent is active.`);
9036
9044
  if (options.onsame) {
9037
9045
  // hide the sidebar when you click on selected tab
9038
9046
  options.onsame(tabs[link.attr('href').slice(1)]); //RED.actions.invoke('core:hide-sidebar');
@@ -14942,15 +14950,16 @@ RED.h = handlers;
14942
14950
  hideWorkspace();
14943
14951
  }
14944
14952
  },
14945
- onreorder: function(oldOrder, newOrder) {
14946
- RED.history.push({
14947
- t: 'reorder',
14948
- order: oldOrder,
14949
- dirty: RED.nodes.dirty()
14950
- });
14951
- RED.nodes.dirty(true);
14952
- setWorkspaceOrder(newOrder);
14953
- },
14953
+ // onreorder: function(oldOrder, newOrder) {
14954
+ // console.log('[workspace] onreorder disabled')
14955
+ // RED.history.push({
14956
+ // t: 'reorder',
14957
+ // order: oldOrder,
14958
+ // dirty: RED.nodes.dirty()
14959
+ // });
14960
+ // RED.nodes.dirty(true);
14961
+ // setWorkspaceOrder(newOrder);
14962
+ // },
14954
14963
  onselect: function(selectedTabs) {
14955
14964
  RED.view.select(false);
14956
14965
  if (selectedTabs.length === 0) {
@@ -17029,7 +17038,7 @@ RED.h = handlers;
17029
17038
  var lastSelection = null;
17030
17039
 
17031
17040
  function updateSelection(ignoreEdit) {
17032
- // console.log(`[view] ==> updateSelection invoked! ignoreEdit=${ignoreEdit}`)
17041
+ console.log(`[view::updateSelection] invoked - ignoreEdit=${ignoreEdit}`)
17033
17042
  var selection = {};
17034
17043
 
17035
17044
  var workspaceSelection = RED.workspaces.selection();
@@ -17155,11 +17164,13 @@ RED.h = handlers;
17155
17164
  }else{
17156
17165
  if (selectionJSON !== lastSelection) {
17157
17166
  lastSelection = selectionJSON;
17158
- // console.log('[view] Selection has changed.', selection);
17167
+ console.log('[view::updateSelection] Selection has changed from lastSelection:\n', lastSelection);
17168
+ console.log('[view::updateSelection] Selection has changed to selectionJSON:\n', selectionJSON);
17169
+
17159
17170
  RED.editor.edit(selection);
17160
17171
  }else{
17161
17172
  // User has clicked on the canvas or link
17162
- console.log('[view] Selection has not changed. Ignore');
17173
+ console.log('[view::updateSelection] Selection has not changed. Ignore');
17163
17174
  // Just close the sidebar
17164
17175
  RED.editor.resetEditor();
17165
17176
  }
@@ -27338,12 +27349,14 @@ RED.sidebar.azure = (function () {
27338
27349
  $('#projectnav').on(
27339
27350
  'tree.select',
27340
27351
  function(event) {
27352
+ event.stopImmediatePropagation();
27341
27353
  if (event.node) {
27342
- console.log('[palette-navigator] on select tree. event=', event);
27354
+ // console.log(`[palette-navigator] Select Tab=(${event.node.id})`);
27343
27355
  // node was selected
27344
27356
  var node = event.node;
27345
27357
  if (node.id){
27346
27358
  RED.workspaces.showSafe(node.id);
27359
+ // selectTab(node.id);
27347
27360
  }
27348
27361
  // let ws = RED.nodes.workspace(node.id);
27349
27362
  // RED.workspaces.add(ws);
@@ -27351,7 +27364,6 @@ RED.sidebar.azure = (function () {
27351
27364
 
27352
27365
  }
27353
27366
  else {
27354
- event.stopPropagation();
27355
27367
  var prevNode = event.previous_node
27356
27368
  if (prevNode.id){
27357
27369
  RED.workspaces.showSafe(prevNode.id);
@@ -35629,7 +35641,7 @@ RED.notifications = (function() {
35629
35641
  }
35630
35642
  if (results.length > 0) {
35631
35643
  // Excluding tabs
35632
- results = results.filter((r) => r.node.type !== 'tab');
35644
+ // results = results.filter((r) => r.node.type !== 'tab');
35633
35645
  for (i = 0; i < Math.min(results.length, 25); i++) {
35634
35646
  searchResults.editableList('addItem', results[i]);
35635
35647
  }
@@ -35667,7 +35679,7 @@ RED.notifications = (function() {
35667
35679
  dialog
35668
35680
  );
35669
35681
  searchInput = $(
35670
- '<input type="text" placeholder="Search nodes">'
35682
+ '<input type="text" placeholder="Find (Nodes and Tabs)">'
35671
35683
  )
35672
35684
  .appendTo(searchDiv)
35673
35685
  .searchBox({
@@ -35717,6 +35729,7 @@ RED.notifications = (function() {
35717
35729
  var searchResultsDiv = $('<div>', {
35718
35730
  class: 'red-ui-search-results-container',
35719
35731
  }).appendTo(dialog);
35732
+
35720
35733
  searchResults = $('<ol>', {
35721
35734
  id: 'search-result-list',
35722
35735
  style: 'position: absolute;top: 5px;bottom: 5px;left: 5px;right: 5px;',
@@ -35726,14 +35739,14 @@ RED.notifications = (function() {
35726
35739
  addButton: false,
35727
35740
  addItem: function (container, i, object) {
35728
35741
  var node = object.node;
35742
+ console.log(`[search] node = `, node);
35729
35743
 
35730
35744
  if (node === undefined) {
35731
35745
  $('<div>', { class: 'red-ui-search-empty' })
35732
35746
  .text('No matches found')
35733
35747
  .appendTo(container);
35734
- } else if (node.type === 'tab') {
35735
- // exclude the tabs
35736
- return;
35748
+ // } else if (node.type === 'tab') {
35749
+ // }
35737
35750
  } else {
35738
35751
  var def = node._def;
35739
35752
  var div = $('<a>', {
@@ -35747,15 +35760,22 @@ RED.notifications = (function() {
35747
35760
  var colour = RED.utils.getNodeColor(node.type, def);
35748
35761
  var icon_url = RED.utils.getNodeIcon(def, node);
35749
35762
  if (node.type === 'tab') {
35750
- colour = '#C0DEED';
35763
+ // colour = '#C0DEED';
35764
+ var iconContainer = $('<div/>', {
35765
+ class: 'palette_icon_container',
35766
+ }).appendTo(nodeDiv);
35767
+ RED.utils.createIconElement('icons/kumologica-core/kumologica-tab.png', iconContainer, true);
35768
+ }else{
35769
+ // Disable the background color, we want it transparent now
35770
+ //nodeDiv.css('backgroundColor', colour);
35771
+ var iconContainer = $('<div/>', {
35772
+ class: 'palette_icon_container',
35773
+ }).appendTo(nodeDiv);
35774
+ RED.utils.createIconElement(icon_url, iconContainer, true);
35751
35775
  }
35752
- // Disable the background color, we want it transparent now
35753
- //nodeDiv.css('backgroundColor', colour);
35776
+
35754
35777
 
35755
- var iconContainer = $('<div/>', {
35756
- class: 'palette_icon_container',
35757
- }).appendTo(nodeDiv);
35758
- RED.utils.createIconElement(icon_url, iconContainer, true);
35778
+
35759
35779
 
35760
35780
  var contentDiv = $('<div>', {
35761
35781
  class: 'red-ui-search-result-description',
@@ -35766,7 +35786,7 @@ RED.notifications = (function() {
35766
35786
  workspace = RED.nodes.subflow(node.z);
35767
35787
  workspace = 'subflow:' + workspace.name;
35768
35788
  } else {
35769
- workspace = 'flow:' + workspace.label;
35789
+ workspace = 'tab:' + workspace.label; //'flow:' + workspace.label
35770
35790
  }
35771
35791
  $('<div>', { class: 'red-ui-search-result-node-flow' })
35772
35792
  .text(workspace)