@kumologica/sdk 3.5.4 → 3.6.0-alpha7

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 (36) hide show
  1. package/cli/cli.js +31 -8
  2. package/cli/commands/open.js +88 -15
  3. package/cli/commands/run.js +167 -0
  4. package/cli/commands/serve.js +139 -0
  5. package/package.json +5 -5
  6. package/src/app/main-process/main-window.js +1 -0
  7. package/src/app/main-process/modal-home.js +1 -0
  8. package/src/app/main-process/modal-newproject.js +1 -0
  9. package/src/app/main-process/modal-newtab.js +1 -0
  10. package/src/app/main-process/modal-nodelibrary.js +1 -0
  11. package/src/app/main-process/modal-renameTab.js +1 -0
  12. package/src/app/main-process/modal-welcome.js +1 -0
  13. package/src/app/main.js +179 -141
  14. package/src/app/preload.js +225 -139
  15. package/src/app/ui/editor-client/public/red/red.js +1943 -783
  16. package/src/app/ui/editor-client/public/red/red.min.js +2 -2
  17. package/src/app/ui/editor-client/public/red/style.min.css +1 -1
  18. package/src/app/ui/editor-client/public/vendor/ace-linters/javascript-service.js +10 -2
  19. package/src/app/ui/editor-client/src/js/red.js +183 -179
  20. package/src/app/ui/editor-client/src/js/ui/common/commandBox.js +107 -0
  21. package/src/app/ui/editor-client/src/js/ui/common/searchBox.js +91 -90
  22. package/src/app/ui/editor-client/src/js/ui/modules.js +164 -0
  23. package/src/app/ui/editor-client/src/js/ui/search.js +171 -123
  24. package/src/app/ui/editor-client/src/js/ui/sidebar.js +1 -1
  25. package/src/app/ui/editor-client/src/js/ui/ui-settings.js +419 -410
  26. package/src/app/ui/editor-client/src/sass/editor.scss +745 -746
  27. package/src/app/ui/editor-client/src/sass/forms.scss +1 -1
  28. package/src/app/ui/editor-client/src/sass/search.scss +16 -2
  29. package/src/app/ui/editor-client/src/sass/sidebar.scss +1 -1
  30. package/src/app/ui/editor-client/src/sass/style.scss +72 -69
  31. package/src/app/ui/editor-client/src/sass/ui/common/commandBox.scss +100 -0
  32. package/src/app/ui/editor-client/src/sass/ui/common/searchBox.scss +3 -2
  33. package/src/app/ui/editor-client/src/sass/ui-settings.scss +14 -14
  34. package/src/app/ui/editor-client/src/vendor/ace-linters/build/javascript-service.js +10 -2
  35. package/src/app/ui/editor-client/templates/index.mst +2 -2
  36. package/src/server/DesignerServer.js +152 -153
@@ -1,10 +1,11 @@
1
1
  const {
2
- AbstractServerfulServer,
3
- ConfigBuilder,
4
- PLATFORMS
5
- } = require('@kumologica/runtime');
6
- const tcpPortUsed = require('tcp-port-used');
2
+ AbstractServerfulServer,
3
+ ConfigBuilder,
4
+ PLATFORMS,
5
+ } = require("@kumologica/runtime");
6
+ const tcpPortUsed = require("tcp-port-used");
7
7
 
8
+ const os = require("os");
8
9
  /**
9
10
  * This class will encapsulate the adminApp and FlowApp into two servers.
10
11
  * It will be the one running on the development box of the user (either local or remote),
@@ -12,155 +13,153 @@ const tcpPortUsed = require('tcp-port-used');
12
13
  */
13
14
 
14
15
  class DesignerServer {
15
-
16
- /**
17
- * @param {Object} options - Configuration options.
18
- * @param {string} options.flowPath - The path of the flow.
19
- * @param {boolean} options.safe - A boolean indicating safety.
20
- * @param {Object} options.cliParams - Command line parameters as an object.
21
- * @param {Object} options.editorApi - API object for the editor.
22
- * @param {Object} options.startupEmitter - EventEmitter object for handling events.
23
- * @param {string} options.platform - The platform to run on. Default LOCAL.
24
- */
25
- constructor(options) {
26
-
27
- if (!options.flowPath) {
28
- console.log(
29
- '[ERROR] Flow is not defined. Make sure you pass the flow file to the constructor of FlowBuilder'
30
- );
31
- os.exit(1);
32
- }
33
-
34
- this.editorApi = options.editorApi;
35
- this.startupEmitter = options.startupEmitter;
36
-
37
- this.config = ConfigBuilder.getInstance().buildConfig(
38
- options.flowPath,
39
- options.platform || PLATFORMS.LOCAL,
40
- options.cliParams
41
- );
42
- }
43
-
44
- async start() {
45
- // Check if port passed by parameter is available otherwise allocate a new one
46
- this.config.port = await this.allocatePort(this.config.port);
47
- this.flowServer = new AbstractServerfulServer(this.config, this.editorApi, this.startupEmitter);
48
-
49
- await this.flowServer.start();
50
- this.flowServer.log.debug(`Runtime Configuration:${JSON.stringify(this.config, null, 2)}`);
51
- }
52
-
53
- async allocatePort(port) {
54
- let inUse = await tcpPortUsed.check(port);
55
- if (inUse){
56
- let newPort = port + 1;
57
- console.log(`> Port: ${port} in use. Trying with port: ${newPort}...`);
58
- return await this.allocatePort(newPort);
59
- } else{
60
- return port;
61
- }
62
- }
63
-
64
- getFlowServer() {
65
- return this.flowServer;
66
- }
67
-
68
- getListeningPort() {
69
- return this.flowServer.serverSettings.port;
70
- }
71
-
72
- async stop() {
73
- await this.flowServer.stop();
74
- }
75
-
76
- /**
77
- * The express application for HTTP Nodes
78
- */
79
- get httpNode() {
80
- return this.flowServer.httpNode.expressApp;
81
- }
82
-
83
-
84
-
85
- /**
86
- * Pointer to the internal HTTP Server upon which all the express applications (Nodes and Admin) are deployed upon
87
- *
88
- * @readonly
89
- */
90
- get server() {
91
- return this.flowServer.server;
92
- }
93
-
94
- /**
95
- * Access to internal runtime api
96
- */
97
- get runtime() {
98
- return this.flowServer.runtime;
99
- }
100
-
101
-
102
-
103
- /**
104
- *
105
- * Returns the version of the runtime lib used internally
106
- * @readonly
107
- * @static
108
- */
109
- static get version() {
110
- return AbstractServerfulServer.version;
111
- }
112
-
113
- /**
114
- * This provides access to the internal settings module of the
115
- * runtime.
116
- * This is the object derived from the server settings.
117
- */
118
- get settings() {
119
- return this.flowServer._.settings;
120
- }
121
-
122
- /**
123
- * EventEmitter use to publish and subscribe to internal runtime events
124
- * For example:
125
- * runtime.events.on(
126
- * 'runtime-event',
127
- * (flowStarted = async data => {
128
- * if (data.id === 'flow-started') {
129
- * runtime.events.removeListener('runtime-event', flowStarted);
130
- *
131
- * @readonly
132
- */
133
- get events() {
134
- return this.flowServer.events;
135
- }
136
-
137
- get eventTypes() {
138
- return this.flowServer.runtimeEventTypes;
139
- }
140
-
141
- /**
142
- * This provides access to the internal nodes module of the
143
- * runtime. The details of this API remain undocumented as they should not
144
- * be used directly.
145
- *
146
- * Most administrative actions should be performed use the runtime api
147
- * under [node.runtime]
148
- */
149
- get nodes() {
150
- return this.flowServer._.nodes;
151
- }
152
-
153
- get log() {
154
- return this.flowServer.log;
155
- }
156
-
157
- get util() {
158
- return this.flowServer.util;
159
- }
160
-
161
-
16
+ /**
17
+ * @param {Object} options - Configuration options.
18
+ * @param {string} options.flowPath - The path of the flow.
19
+ * @param {boolean} options.safe - A boolean indicating safety.
20
+ * @param {Object} options.cliParams - Command line parameters as an object.
21
+ * @param {Object} options.editorApi - API object for the editor.
22
+ * @param {Object} options.startupEmitter - EventEmitter object for handling events.
23
+ * @param {string} options.platform - The platform to run on. Default LOCAL.
24
+ */
25
+ constructor(options) {
26
+ if (!options.flowPath) {
27
+ console.log(
28
+ "[ERROR] Flow is not defined. Make sure you pass the flow file to the constructor of FlowBuilder"
29
+ );
30
+ os.exit(1);
31
+ }
32
+
33
+ this.editorApi = options.editorApi;
34
+ this.startupEmitter = options.startupEmitter;
35
+
36
+ this.config = ConfigBuilder.getInstance().buildConfig(
37
+ options.flowPath,
38
+ options.platform || PLATFORMS.LOCAL,
39
+ options.cliParams
40
+ );
41
+ }
42
+
43
+ async start() {
44
+ // Check if port passed by parameter is available otherwise allocate a new one
45
+ this.config.port = await this.allocatePort(this.config.port);
46
+ this.flowServer = new AbstractServerfulServer(
47
+ this.config,
48
+ this.editorApi,
49
+ this.startupEmitter
50
+ );
51
+
52
+ await this.flowServer.start();
53
+ this.flowServer.log.debug(
54
+ `Runtime Configuration:${JSON.stringify(this.config, null, 2)}`
55
+ );
56
+ }
57
+
58
+ async allocatePort(port) {
59
+ let inUse = await tcpPortUsed.check(port);
60
+ if (inUse) {
61
+ let newPort = port + 1;
62
+ console.log(`> Port: ${port} in use. Trying with port: ${newPort}...`);
63
+ return await this.allocatePort(newPort);
64
+ } else {
65
+ return port;
66
+ }
67
+ }
68
+
69
+ getFlowServer() {
70
+ return this.flowServer;
71
+ }
72
+
73
+ getListeningPort() {
74
+ return this.flowServer.serverSettings.port;
75
+ }
76
+
77
+ async stop() {
78
+ await this.flowServer.stop();
79
+ }
80
+
81
+ /**
82
+ * The express application for HTTP Nodes
83
+ */
84
+ get httpNode() {
85
+ return this.flowServer.httpNode.expressApp;
86
+ }
87
+
88
+ /**
89
+ * Pointer to the internal HTTP Server upon which all the express applications (Nodes and Admin) are deployed upon
90
+ *
91
+ * @readonly
92
+ */
93
+ get server() {
94
+ return this.flowServer.server;
95
+ }
96
+
97
+ /**
98
+ * Access to internal runtime api
99
+ */
100
+ get runtime() {
101
+ return this.flowServer.runtime;
102
+ }
103
+
104
+ /**
105
+ *
106
+ * Returns the version of the runtime lib used internally
107
+ * @readonly
108
+ * @static
109
+ */
110
+ static get version() {
111
+ return AbstractServerfulServer.version;
112
+ }
113
+
114
+ /**
115
+ * This provides access to the internal settings module of the
116
+ * runtime.
117
+ * This is the object derived from the server settings.
118
+ */
119
+ get settings() {
120
+ return this.flowServer._.settings;
121
+ }
122
+
123
+ /**
124
+ * EventEmitter use to publish and subscribe to internal runtime events
125
+ * For example:
126
+ * runtime.events.on(
127
+ * 'runtime-event',
128
+ * (flowStarted = async data => {
129
+ * if (data.id === 'flow-started') {
130
+ * runtime.events.removeListener('runtime-event', flowStarted);
131
+ *
132
+ * @readonly
133
+ */
134
+ get events() {
135
+ return this.flowServer.events;
136
+ }
137
+
138
+ get eventTypes() {
139
+ return this.flowServer.runtimeEventTypes;
140
+ }
141
+
142
+ /**
143
+ * This provides access to the internal nodes module of the
144
+ * runtime. The details of this API remain undocumented as they should not
145
+ * be used directly.
146
+ *
147
+ * Most administrative actions should be performed use the runtime api
148
+ * under [node.runtime]
149
+ */
150
+ get nodes() {
151
+ return this.flowServer._.nodes;
152
+ }
153
+
154
+ get log() {
155
+ return this.flowServer.log;
156
+ }
157
+
158
+ get util() {
159
+ return this.flowServer.util;
160
+ }
162
161
  }
163
162
 
164
163
  module.exports = {
165
- DesignerServer,
164
+ DesignerServer,
166
165
  };