systemview 1.6.3 → 1.7.4

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ```javascript
6
6
  const SystemView = require("systemView")({
7
- SystemViewConnection: "http://localhost:3300", //default
7
+ SystemViewConnection: "http://localhost:3000", //default
8
8
  SystemViewDocumentation: "./SystemView", //default
9
9
  projectCode: "ProjectName", //optional. Used to conveniently load multiple services as one project
10
10
  serviceId: "ServiceName", //required. If not included
@@ -1,7 +1,9 @@
1
1
  const fs = require("fs");
2
+ const LOCAL_STORAGE = "./api/connections.txt";
2
3
 
3
4
  module.exports = function ConnectedServices() {
4
- const LOCAL_STORAGE = "./api/connections.txt";
5
+ this.clearStorage = () => fs.writeFileSync(LOCAL_STORAGE, "[]", "utf8");
6
+
5
7
  this.save = (serviceData, index) => {
6
8
  const connections = JSON.parse(fs.readFileSync(LOCAL_STORAGE, "utf8"));
7
9
  if (typeof index === "number") connections[index] = serviceData;
@@ -29,8 +31,5 @@ module.exports = function ConnectedServices() {
29
31
  []
30
32
  );
31
33
  };
32
- // clear & ensure file existence
33
- fs.writeFileSync(LOCAL_STORAGE, "[]", "utf8");
34
-
35
34
  return this;
36
35
  };
package/api/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  const { HttpClient: http, App } = require("systemlynx");
2
2
  const LocalStorage = require("./Connections")();
3
3
  const route = "systemview/api";
4
- const port = 3300;
5
4
  const host = "localhost";
5
+ const express = require("express");
6
+ const path = require("path");
6
7
  const isUrl = (str) =>
7
8
  /^(http:\/\/|https:\/\/)?((localhost|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}))(:[0-9]{1,5})?(\/.*)?$/.test(
8
9
  str
@@ -38,6 +39,7 @@ function updateSpecList(specList, projectCode, serviceId) {
38
39
  function getServices(searchText) {
39
40
  if (isUrl(searchText)) {
40
41
  const { service } = LocalStorage.findService(searchText);
42
+
41
43
  if (service) {
42
44
  const project = { ...service, projectCode: "SystemLynx", serviceId: "Service" };
43
45
  connect(project);
@@ -67,12 +69,32 @@ async function getConnectionData(url) {
67
69
  }
68
70
  }
69
71
 
70
- App.startService({
71
- route,
72
- port,
73
- host,
74
- }).module("SystemView", {
75
- connect,
76
- getServices,
77
- updateSpecList,
78
- });
72
+ const shutdown = () => process.exit(0);
73
+
74
+ module.exports = function launchSystemView(port = 3000) {
75
+ const { server } = App;
76
+ const buildPath = path.resolve(__dirname, "../build");
77
+ const indexPath = path.join(buildPath, "index.html");
78
+
79
+ server.use(express.static(buildPath));
80
+
81
+ App.startService({
82
+ route,
83
+ port,
84
+ host,
85
+ staticRouting: true,
86
+ })
87
+ .module("SystemView", {
88
+ connect,
89
+ getServices,
90
+ updateSpecList,
91
+ shutdown,
92
+ })
93
+ .on("ready", () => {
94
+ server.get("*", (req, res) => {
95
+ res.sendFile(indexPath);
96
+ });
97
+ LocalStorage.clearStorage();
98
+ });
99
+ return new Promise((resolve) => App.on("ready", resolve));
100
+ };
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "/static/css/main.fb15c45d.chunk.css",
4
- "main.js": "/static/js/main.a47760bc.chunk.js",
5
- "main.js.map": "/static/js/main.a47760bc.chunk.js.map",
4
+ "main.js": "/static/js/main.6f3c8138.chunk.js",
5
+ "main.js.map": "/static/js/main.6f3c8138.chunk.js.map",
6
6
  "runtime-main.js": "/static/js/runtime-main.17d324d3.js",
7
7
  "runtime-main.js.map": "/static/js/runtime-main.17d324d3.js.map",
8
8
  "static/js/2.b89d4ccd.chunk.js": "/static/js/2.b89d4ccd.chunk.js",
@@ -24,6 +24,6 @@
24
24
  "static/js/runtime-main.17d324d3.js",
25
25
  "static/js/2.b89d4ccd.chunk.js",
26
26
  "static/css/main.fb15c45d.chunk.css",
27
- "static/js/main.a47760bc.chunk.js"
27
+ "static/js/main.6f3c8138.chunk.js"
28
28
  ]
29
29
  }
package/build/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>SystemView</title><link href="/static/css/main.fb15c45d.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,i,a=t[0],c=t[1],l=t[2],f=0,p=[];f<a.length;f++)i=a[f],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(s&&s(t);p.length;)p.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,a=1;a<r.length;a++){var c=r[a];0!==o[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"0571e5a9"}[e]+".chunk.js"}(e);var c=new Error;u=function(t){a.onerror=a.onload=null,clearTimeout(l);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),u=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,r[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this.webpackJsonpsystemview=this.webpackJsonpsystemview||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var s=c;r()}([])</script><script src="/static/js/2.b89d4ccd.chunk.js"></script><script src="/static/js/main.a47760bc.chunk.js"></script></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>SystemView</title><link href="/static/css/main.fb15c45d.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,i,a=t[0],c=t[1],l=t[2],f=0,p=[];f<a.length;f++)i=a[f],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(s&&s(t);p.length;)p.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,a=1;a<r.length;a++){var c=r[a];0!==o[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"0571e5a9"}[e]+".chunk.js"}(e);var c=new Error;u=function(t){a.onerror=a.onload=null,clearTimeout(l);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),u=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,r[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this.webpackJsonpsystemview=this.webpackJsonpsystemview||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var s=c;r()}([])</script><script src="/static/js/2.b89d4ccd.chunk.js"></script><script src="/static/js/main.6f3c8138.chunk.js"></script></body></html>