systemview 2.0.0 → 2.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.
- package/README.md +76 -40
- package/api/CLIHistory.js +29 -0
- package/api/Connections.js +14 -0
- package/api/cli-history.json +1 -0
- package/api/connections.json +1 -1
- package/api/index.js +41 -47
- package/build/asset-manifest.json +6 -6
- package/build/index.html +1 -1
- package/build/static/css/main.1916c1d1.css +15 -0
- package/build/static/css/main.1916c1d1.css.map +1 -0
- package/build/static/js/{main.72103448.js → main.c7a05ef5.js} +3 -3
- package/build/static/js/main.c7a05ef5.js.map +1 -0
- package/cli/connectService.js +143 -52
- package/cli/index.js +80 -45
- package/cli/launchApp.js +8 -5
- package/cli/listTests.js +31 -16
- package/cli/logs.js +288 -95
- package/cli/manifest.js +97 -0
- package/cli/openBrowser.js +1 -1
- package/cli/probe.js +30 -18
- package/cli/runTests.js +30 -36
- package/cli/startLineReader.js +140 -15
- package/cli/utils/cli.js +64 -17
- package/package.json +2 -2
- package/build/static/css/main.ff3d0549.css +0 -15
- package/build/static/css/main.ff3d0549.css.map +0 -1
- package/build/static/js/main.72103448.js.map +0 -1
- /package/build/static/js/{main.72103448.js.LICENSE.txt → main.c7a05ef5.js.LICENSE.txt} +0 -0
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ systemview # start on port 3000 (interactive)
|
|
|
21
21
|
systemview start 4000 # custom port
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
If SystemView is already running, `systemview start` attaches your terminal to the existing instance — no second server is started. You can run as many interactive terminals as you like against the same instance.
|
|
25
|
+
|
|
24
26
|
Once running:
|
|
25
27
|
- **UI** → `http://localhost:3000`
|
|
26
28
|
- **API** → `http://localhost:3000/systemview/api`
|
|
@@ -63,35 +65,37 @@ if (process.env.SYSTEMVIEW_HOST) {
|
|
|
63
65
|
```
|
|
64
66
|
|
|
65
67
|
On startup the plugin:
|
|
66
|
-
1.
|
|
67
|
-
2. Writes `systemview.manifest.json` to the project root —
|
|
68
|
-
|
|
69
|
-
```json
|
|
70
|
-
{
|
|
71
|
-
"projectCode": "myProject",
|
|
72
|
-
"services": [
|
|
73
|
-
{
|
|
74
|
-
"serviceId": "MyService",
|
|
75
|
-
"system": {
|
|
76
|
-
"connectionData": {
|
|
77
|
-
"serviceUrl": "http://localhost:4100/my/api",
|
|
78
|
-
"modules": { ... },
|
|
79
|
-
"routing": { ... }
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"specList": {
|
|
83
|
-
"docs": ["Users.md"],
|
|
84
|
-
"tests": ["Users.signUp.json"]
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
```
|
|
68
|
+
1. Registers the service with the SystemView UI (source of truth for all connections)
|
|
69
|
+
2. Writes `systemview.manifest.json` to the project root — used by the CLI to reconnect at startup
|
|
90
70
|
|
|
91
71
|
Add `systemview.manifest.json` to `.gitignore` — it regenerates each time the service starts.
|
|
92
72
|
|
|
93
73
|
---
|
|
94
74
|
|
|
75
|
+
## Connecting Services from the CLI
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Probe a live service and register it in the UI
|
|
79
|
+
systemview connect http://localhost:4100/my/api
|
|
80
|
+
|
|
81
|
+
# With plugin installed — registers under the real projectCode from the manifest
|
|
82
|
+
systemview connect http://localhost:4100/my/api --manifest
|
|
83
|
+
|
|
84
|
+
# Reconnect all services for a stored project
|
|
85
|
+
systemview connect myProject
|
|
86
|
+
|
|
87
|
+
# Re-probe even if already connected (picks up shape changes)
|
|
88
|
+
systemview connect http://localhost:4100/my/api --force
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Remove a project or service from the UI store
|
|
93
|
+
systemview disconnect myProject
|
|
94
|
+
systemview disconnect myProject MyService
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
95
99
|
## Using the UI
|
|
96
100
|
|
|
97
101
|
| Panel | Description |
|
|
@@ -116,25 +120,56 @@ Click **Run** to execute the sequence. Click **Save** to persist the test to the
|
|
|
116
120
|
## Running Tests from the CLI
|
|
117
121
|
|
|
118
122
|
```bash
|
|
119
|
-
systemview test myProject
|
|
120
|
-
systemview test myProject Users
|
|
121
|
-
systemview test myProject Users.signUp
|
|
122
|
-
systemview test myProject --json
|
|
123
|
-
systemview test myProject --verbose
|
|
123
|
+
systemview test myProject # run all tests for a project
|
|
124
|
+
systemview test myProject Users # filter by module
|
|
125
|
+
systemview test myProject Users.signUp # filter by method
|
|
126
|
+
systemview test myProject --json # structured JSON output for CI/agents
|
|
127
|
+
systemview test myProject --verbose # show args passed to each call
|
|
128
|
+
systemview test myProject --bail # stop after first failure
|
|
129
|
+
systemview test myProject --dry-run # print which tests would run
|
|
130
|
+
systemview test myProject --skip deleteUser # exclude matching tests (repeatable)
|
|
131
|
+
systemview test myProject --phase main # run only one phase (before/main/events/after)
|
|
132
|
+
systemview test myProject --index 0 # run only action at index n within each phase
|
|
133
|
+
systemview test myProject --header "X-Key: secret" # extra request header (repeatable)
|
|
124
134
|
```
|
|
125
135
|
|
|
126
136
|
Starts the SystemView server headlessly if needed, runs all tests, exits with `0` (all passed) or `1` (any failure).
|
|
127
137
|
|
|
128
138
|
---
|
|
129
139
|
|
|
130
|
-
##
|
|
140
|
+
## Streaming Logs
|
|
131
141
|
|
|
132
142
|
```bash
|
|
133
|
-
#
|
|
134
|
-
systemview
|
|
143
|
+
systemview logs # stream from all connected services
|
|
144
|
+
systemview logs myProject # stream from a project
|
|
145
|
+
systemview logs myProject Users # filter by module/method namespace
|
|
146
|
+
systemview logs myProject --level error # filter by level
|
|
147
|
+
systemview logs myProject --current # show existing entries before streaming
|
|
148
|
+
systemview logs myProject --current --limit 20 # limit history shown
|
|
149
|
+
systemview logs myProject --filter level=error # AND filter on any field (repeatable)
|
|
150
|
+
systemview logs myProject --or moduleMethod=signIn # OR filter (repeatable)
|
|
151
|
+
systemview logs myProject --include userId # show extra field as column (repeatable)
|
|
152
|
+
systemview logs myProject --verbose # show full entry payload
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
In interactive mode:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
logs myProject # start streaming
|
|
159
|
+
stoplogs # stop streaming (keeps log history)
|
|
160
|
+
unsubscribe # alias for stoplogs
|
|
161
|
+
clearlogs # wipe log history and stop streaming
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
135
165
|
|
|
136
|
-
|
|
137
|
-
|
|
166
|
+
## Listing Projects and Tests
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
systemview list # list all connected projects and services
|
|
170
|
+
systemview list myProject # list services and test files for a project
|
|
171
|
+
systemview list myProject Users # list tests for a module/method
|
|
172
|
+
systemview list myProject --verbose # expand full hierarchy
|
|
138
173
|
```
|
|
139
174
|
|
|
140
175
|
---
|
|
@@ -158,15 +193,16 @@ systemview probe MyService.String.repeat '["ha", 3]'
|
|
|
158
193
|
|
|
159
194
|
| Command | Description |
|
|
160
195
|
|---|---|
|
|
161
|
-
| `systemview [start] [port]` | Start SystemView UI
|
|
196
|
+
| `systemview [start] [port]` | Start SystemView UI; attach if already running |
|
|
162
197
|
| `systemview test <projectCode> [namespace]` | Run saved tests |
|
|
163
|
-
| `systemview
|
|
164
|
-
| `systemview
|
|
198
|
+
| `systemview list [projectCode] [namespace]` | List projects, services, or tests |
|
|
199
|
+
| `systemview logs [projectCode] [namespace]` | Stream log entries from connected services |
|
|
200
|
+
| `systemview connect <url\|projectCode>` | Connect a service or reconnect a project |
|
|
201
|
+
| `systemview connect <url> --manifest` | Connect via plugin manifest (real projectCode) |
|
|
202
|
+
| `systemview disconnect [projectCode] [serviceId]` | Remove from UI store |
|
|
165
203
|
| `systemview probe <Service.Module.method> [args]` | Call a method ad-hoc |
|
|
166
204
|
| `systemview open [projectCode] [namespace]` | Open the UI in a browser |
|
|
167
205
|
| `systemview shutdown [port]` | Stop a running instance |
|
|
168
206
|
| `systemview help` | Print help |
|
|
169
207
|
|
|
170
|
-
**
|
|
171
|
-
|
|
172
|
-
Full reference: [`docs/cli.md`](docs/cli.md)
|
|
208
|
+
**Common flags:** `--json` · `--verbose` · `--bail` · `--dry-run` · `--manifest` · `--force` · `--header "Name: Value"` · `--skip <pattern>` · `--phase <phase>` · `--index <n>` · `--level <level>` · `--current` · `--limit <n>` · `--filter <field=value>` · `--or <field=value>` · `--include <field>`
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
|
|
3
|
+
const HISTORY_FILE = `${__dirname}/cli-history.json`;
|
|
4
|
+
const LIMIT = 50;
|
|
5
|
+
|
|
6
|
+
function read() {
|
|
7
|
+
try { return JSON.parse(fs.readFileSync(HISTORY_FILE, "utf8")); }
|
|
8
|
+
catch { return []; }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function write(history) {
|
|
12
|
+
fs.writeFile(HISTORY_FILE, JSON.stringify(history), () => {});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = function CLIHistory() {
|
|
16
|
+
this.getHistory = () => read();
|
|
17
|
+
|
|
18
|
+
this.saveHistory = (entry) => {
|
|
19
|
+
if (!entry || !entry.trim()) return;
|
|
20
|
+
let history = read();
|
|
21
|
+
history = history.filter((h) => h !== entry);
|
|
22
|
+
history.push(entry);
|
|
23
|
+
if (history.length > LIMIT) history = history.slice(-LIMIT);
|
|
24
|
+
write(history);
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return this;
|
|
29
|
+
};
|
package/api/Connections.js
CHANGED
|
@@ -65,5 +65,19 @@ module.exports = function ConnectedServices() {
|
|
|
65
65
|
return JSON.parse(fs.readFileSync(LOCAL_STORAGE, "utf8"));
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
this.deleteService = (projectCode, serviceId) => {
|
|
69
|
+
const connections = JSON.parse(fs.readFileSync(LOCAL_STORAGE, "utf8"));
|
|
70
|
+
const filtered = connections.filter(
|
|
71
|
+
(s) => !(s.projectCode === projectCode && s.serviceId === serviceId)
|
|
72
|
+
);
|
|
73
|
+
fs.writeFileSync(LOCAL_STORAGE, JSON.stringify(filtered), "utf8");
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
this.deleteProject = (projectCode) => {
|
|
77
|
+
const connections = JSON.parse(fs.readFileSync(LOCAL_STORAGE, "utf8"));
|
|
78
|
+
const filtered = connections.filter((s) => s.projectCode !== projectCode);
|
|
79
|
+
fs.writeFileSync(LOCAL_STORAGE, JSON.stringify(filtered), "utf8");
|
|
80
|
+
};
|
|
81
|
+
|
|
68
82
|
return this;
|
|
69
83
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
["test","test systemview-test"]
|
package/api/connections.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"projectCode":"buAPI","serviceId":"Networking","system":{"connectionData":{"modules":[{"namespace":"ws://127.0.0.1:5100/bu/api/networking/Chats","route":"/bu/api/networking/Chats","name":"Chats","methods":[{"method":"post","fn":"start"},{"method":"post","fn":"send"},{"method":"post","fn":"get"},{"method":"post","fn":"getMessages"},{"method":"post","fn":"undoMessage"},{"method":"post","fn":"addMember"},{"method":"post","fn":"removeMember"},{"method":"post","fn":"addSeenBy"},{"method":"post","fn":"getAll"}]},{"namespace":"ws://127.0.0.1:5100/bu/api/networking/Notifications","route":"/bu/api/networking/Notifications","name":"Notifications","methods":[{"method":"post","fn":"add"},{"method":"post","fn":"get"},{"method":"post","fn":"updateStatus"}]},{"namespace":"ws://127.0.0.1:5100/bu/api/networking/Storage","route":"/bu/api/networking/Storage","name":"Storage","methods":[{"method":"post","fn":"save"},{"method":"post","fn":"delete"},{"method":"post","fn":"list"}]},{"namespace":"ws://127.0.0.1:5100/bu/api/networking/Plugin","route":"/bu/api/networking/Plugin","name":"Plugin","methods":[{"method":"post","fn":"clearMockChats"},{"method":"post","fn":"clearMockNotifications"},{"method":"post","fn":"clearStorage"},{"method":"post","fn":"saveDoc"},{"method":"post","fn":"getDoc"},{"method":"post","fn":"getTests"},{"method":"post","fn":"saveTest"},{"method":"post","fn":"deleteTest"},{"method":"post","fn":"getSpecList"},{"method":"post","fn":"getConnection"},{"method":"post","fn":"getLog"}]}],"host":"127.0.0.1","route":"/bu/api/networking","port":"5100","serviceUrl":"http://127.0.0.1:5100/bu/api/networking","socketPath":"/bu/api/networking/socket.io","namespace":"ws://127.0.0.1:5100/bu/api/networking","SystemLynxService":true},"modules":[{"name":"Chats","module":{"db":{"itemName":"Chat","collectionName":"Chats"}}},{"name":"Notifications","module":{"db":{"itemName":"Notification","collectionName":"Notifications"}}},{"name":"Storage","module":{"STORAGE":"/Users/odionedwards/buAPI/Networking/files","STORAGE_URL":"http://127.0.0.1:5100/storage"}},{"name":"Plugin","module":{}}],"routing":{"route":"bu/api/networking","port":"5100","host":"127.0.0.1","protocol":"http","ssl":null,"staticRouting":true},"services":[{"name":"Profiles","url":"http://127.0.0.1:4100/bu/api/profiles","onLoad":null,"client":{}},{"name":"SystemView","url":"http://localhost:3000/systemview/api","onLoad":null,"client":{}}]},"specList":{"docs":["Chats.md","Networking.md","Notifications.md","Shares.md"],"tests":["Chats.addMember.json","Chats.addSeenBy.json","Chats.get.json","Chats.getAll.json","Chats.getMessages.json","Chats.removeMember.json","Chats.send.json","Chats.start.json","Chats.undoMessage.json","Notifications.add.json","Notifications.get.json","Notifications.updateStatus.json"]}},{"projectCode":"buAPI","serviceId":"Basketball","system":{"connectionData":{"modules":[{"namespace":"ws://127.0.0.1:4900/bu/api/basketball/Games","route":"/bu/api/basketball/Games","name":"Games","methods":[{"method":"post","fn":"add"},{"method":"post","fn":"get"},{"method":"post","fn":"getPage"},{"method":"post","fn":"editGameDetails"},{"method":"post","fn":"updateTeam"},{"method":"post","fn":"addAdmin"},{"method":"post","fn":"removeAdmin"},{"method":"post","fn":"addPlay"},{"method":"post","fn":"editPlay"},{"method":"post","fn":"undoPlay"},{"method":"post","fn":"insertPlay"},{"method":"post","fn":"endReview"},{"method":"post","fn":"acceptCallout"},{"method":"post","fn":"rejectCallout"},{"method":"post","fn":"setAdmins"}]},{"namespace":"ws://127.0.0.1:4900/bu/api/basketball/Stats","route":"/bu/api/basketball/Stats","name":"Stats","methods":[{"method":"post","fn":"get"},{"method":"post","fn":"getPage"}]},{"namespace":"ws://127.0.0.1:4900/bu/api/basketball/Seasons","route":"/bu/api/basketball/Seasons","name":"Seasons","methods":[{"method":"post","fn":"add"},{"method":"post","fn":"get"},{"method":"post","fn":"getPage"},{"method":"post","fn":"edit"},{"method":"post","fn":"addAdmin"},{"method":"post","fn":"removeAdmin"},{"method":"post","fn":"addRound"},{"method":"post","fn":"editRound"},{"method":"post","fn":"removeRound"},{"method":"post","fn":"addTeam"},{"method":"post","fn":"removeTeam"},{"method":"post","fn":"editTeam"},{"method":"post","fn":"acceptCallout"},{"method":"post","fn":"rejectCallout"},{"method":"post","fn":"addMatch"},{"method":"post","fn":"editMatch"},{"method":"post","fn":"cancel"},{"method":"post","fn":"removeMatch"}]},{"namespace":"ws://127.0.0.1:4900/bu/api/basketball/Aggregator","route":"/bu/api/basketball/Aggregator","name":"Aggregator","methods":[{"method":"post","fn":"get"}]},{"namespace":"ws://127.0.0.1:4900/bu/api/basketball/Storage","route":"/bu/api/basketball/Storage","name":"Storage","methods":[{"method":"post","fn":"save"},{"method":"post","fn":"delete"},{"method":"post","fn":"list"}]},{"namespace":"ws://127.0.0.1:4900/bu/api/basketball/Plugin","route":"/bu/api/basketball/Plugin","name":"Plugin","methods":[{"method":"post","fn":"clearMockCourts"},{"method":"post","fn":"clearMockGames"},{"method":"post","fn":"clearMockSeasons"},{"method":"post","fn":"clearMockLocations"},{"method":"post","fn":"readyGame"},{"method":"post","fn":"clearStats"},{"method":"post","fn":"getMockPlays"},{"method":"post","fn":"wait"},{"method":"post","fn":"readySeason"},{"method":"post","fn":"seasonsTest1"},{"method":"post","fn":"seasonsTest2"},{"method":"post","fn":"seasonsTest3"},{"method":"post","fn":"seasonsTest4"},{"method":"post","fn":"seasonsTest5"},{"method":"post","fn":"playOutMockRound"},{"method":"post","fn":"playCasualGames"},{"method":"post","fn":"addSeasonGames"},{"method":"post","fn":"seedLocations"},{"method":"post","fn":"clearStorage"},{"method":"post","fn":"saveDoc"},{"method":"post","fn":"getDoc"},{"method":"post","fn":"getTests"},{"method":"post","fn":"saveTest"},{"method":"post","fn":"deleteTest"},{"method":"post","fn":"getSpecList"},{"method":"post","fn":"getConnection"},{"method":"post","fn":"getLog"}]}],"host":"127.0.0.1","route":"/bu/api/basketball","port":"4900","serviceUrl":"http://127.0.0.1:4900/bu/api/basketball","socketPath":"/bu/api/basketball/socket.io","namespace":"ws://127.0.0.1:4900/bu/api/basketball","SystemLynxService":true},"modules":[{"name":"Games","module":{"db":{"itemName":"Game","collectionName":"Games"}}},{"name":"Stats","module":{}},{"name":"Seasons","module":{"db":{"itemName":"Season","collectionName":"Seasons"}}},{"name":"Aggregator","module":{"db":{},"COLLECTIONS":["Events","Games","Seasons","PlayerOverallPerformance","PlayerSeasonalPerformance","PlayerPerGamePerformance","TeamOverallPerformance","TeamSeasonalPerformance","TeamPerGamePerformance","Locations"]}},{"name":"Storage","module":{"STORAGE":"/Users/odionedwards/buAPI/Basketball/files","STORAGE_URL":"http://127.0.0.1:4900/storage"}},{"name":"Plugin","module":{}}],"routing":{"route":"bu/api/basketball","port":"4900","host":"127.0.0.1","protocol":"http","ssl":null,"staticRouting":true},"services":[{"name":"Profiles","url":"http://127.0.0.1:4100/bu/api/profiles","onLoad":null,"client":{}},{"name":"SystemView","url":"http://localhost:3000/systemview/api","onLoad":null,"client":{}}]},"specList":{"docs":["Basketball.md","Games.md","Seasons.get.md","Seasons.md","Stats.md"],"tests":["Aggregator.get.json","Games.acceptCallout.json","Games.add.json","Games.addAdmin.json","Games.addPlay.json","Games.editGameDetails.json","Games.editPlay.json","Games.endReview.json","Games.get.json","Games.getPage.json","Games.insertPlay.json","Games.rejectCallout.json","Games.removeAdmin.json","Games.setAdmins.json","Games.undoPlay.json","Games.updateTeam.json","Plugin.getMockPlays.json","Plugin.seasonsTest1.json","Plugin.seasonsTest2.json","Plugin.seasonsTest3.json","Plugin.seasonsTest4.json","Plugin.seasonsTest5.json","Seasons.acceptCallout.json","Seasons.add.json","Seasons.addAdmin.json","Seasons.addMatch.json","Seasons.addRound.json","Seasons.addTeam.json","Seasons.cancel.json","Seasons.edit.json","Seasons.editMatch.json","Seasons.editRound.json","Seasons.editTeam.json","Seasons.get.json","Seasons.getPage.json","Seasons.rejectCallout.json","Seasons.removeAdmin.json","Seasons.removeMatch.json","Seasons.removeRound.json","Seasons.removeTeam.json","Stats.get.json","Stats.getPage.json"]}},{"projectCode":"buAPI","serviceId":"Media","system":{"connectionData":{"modules":[{"namespace":"ws://127.0.0.1:4000/bu/api/media/Broadcasts","route":"/bu/api/media/Broadcasts","name":"Broadcasts","methods":[{"method":"post","fn":"add"},{"method":"post","fn":"get"},{"method":"post","fn":"getPage"},{"method":"post","fn":"getRtpCapabilities"},{"method":"post","fn":"getSenderTransportData"},{"method":"post","fn":"connectTransport"},{"method":"post","fn":"createSceneProducer"},{"method":"post","fn":"getReceiverTransportData"},{"method":"post","fn":"createSceneConsumers"},{"method":"post","fn":"resumeConsumer"},{"method":"post","fn":"switchScenes"},{"method":"post","fn":"startBroadcast"},{"method":"post","fn":"endBroadcast"},{"method":"post","fn":"addAdmin"},{"method":"post","fn":"removeAdmin"},{"method":"post","fn":"setAdmins"},{"method":"post","fn":"addContributor"},{"method":"post","fn":"removeContributor"},{"method":"post","fn":"setContributors"}]},{"namespace":"ws://127.0.0.1:4000/bu/api/media/Posts","route":"/bu/api/media/Posts","name":"Posts","methods":[{"method":"post","fn":"add"},{"method":"post","fn":"get"},{"method":"post","fn":"getPage"},{"method":"post","fn":"delete"},{"method":"post","fn":"edit"}]},{"namespace":"ws://127.0.0.1:4000/bu/api/media/Reactions","route":"/bu/api/media/Reactions","name":"Reactions","methods":[{"method":"post","fn":"add"},{"method":"post","fn":"get"},{"method":"post","fn":"getPage"},{"method":"post","fn":"getCount"},{"method":"post","fn":"delete"}]},{"namespace":"ws://127.0.0.1:4000/bu/api/media/Storage","route":"/bu/api/media/Storage","name":"Storage","methods":[{"method":"post","fn":"save"},{"method":"post","fn":"delete"},{"method":"post","fn":"list"}]},{"namespace":"ws://127.0.0.1:4000/bu/api/media/Plugin","route":"/bu/api/media/Plugin","name":"Plugin","methods":[{"method":"post","fn":"clearMockBroadcasts"},{"method":"post","fn":"clearMockReactions"},{"method":"post","fn":"clearMockPost"},{"method":"post","fn":"clearStorage"},{"method":"post","fn":"saveDoc"},{"method":"post","fn":"getDoc"},{"method":"post","fn":"getTests"},{"method":"post","fn":"saveTest"},{"method":"post","fn":"deleteTest"},{"method":"post","fn":"getSpecList"},{"method":"post","fn":"getConnection"},{"method":"post","fn":"getLog"}]}],"host":"127.0.0.1","route":"/bu/api/media","port":"4000","serviceUrl":"http://127.0.0.1:4000/bu/api/media","socketPath":"/bu/api/media/socket.io","namespace":"ws://127.0.0.1:4000/bu/api/media","SystemLynxService":true},"modules":[{"name":"Broadcasts","module":{"db":{"itemName":"Broadcast","collectionName":"Broadcasts"},"router":{"_events":{},"_eventsCount":2,"_maxListeners":null}}},{"name":"Posts","module":{"db":{"itemName":"Post","collectionName":"Posts"}}},{"name":"Reactions","module":{"db":{"itemName":"Reaction","collectionName":"Reactions"}}},{"name":"Storage","module":{"STORAGE":"/Users/odionedwards/buAPI/Media/files","STORAGE_URL":"http://127.0.0.1:4000/storage"}},{"name":"Plugin","module":{}}],"routing":{"route":"bu/api/media","port":"4000","host":"127.0.0.1","protocol":"http","ssl":null,"staticRouting":true},"services":[{"name":"Profiles","url":"http://127.0.0.1:4100/bu/api/profiles","onLoad":null,"client":{"Badges":{},"Locations":{},"Users":{},"Teams":{},"Tournaments":{},"Groups":{},"Events":{},"Follows":{},"Solicitations":{},"Aggregator":{},"Storage":{},"MyMath":{},"Plugin":{}}},{"name":"Basketball","url":"http://127.0.0.1:4900/bu/api/basketball","onLoad":null,"client":{"Games":{},"Stats":{},"Seasons":{},"Aggregator":{},"Storage":{},"Plugin":{}}},{"name":"SystemView","url":"http://localhost:3000/systemview/api","onLoad":null,"client":{}}]},"specList":{"docs":["Broadcasts.md","Media.md","Posts-contract.md","Posts.md","Reactions.md","Storage.md"],"tests":["Broadcasts.add.json","Broadcasts.addAdmin.json","Broadcasts.addContributor.json","Broadcasts.get.json","Broadcasts.getPage.json","Broadcasts.removeAdmin.json","Broadcasts.removeContributor.json","Broadcasts.setAdmins.json","Broadcasts.setContributors.json","Posts.add.json","Posts.delete.json","Posts.edit.json","Posts.get.json","Posts.getPage.json","Reactions.add.json","Reactions.delete.json","Reactions.get.json","Reactions.getCount.json","Reactions.getPage.json"]}},{"projectCode":"buAPI","serviceId":"Mocks","system":{"connectionData":{"modules":[{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Badges","route":"/bu/api/mocks/Badges","name":"Badges","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Locations","route":"/bu/api/mocks/Locations","name":"Locations","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Users","route":"/bu/api/mocks/Users","name":"Users","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/UsersArchive","route":"/bu/api/mocks/UsersArchive","name":"UsersArchive","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Tournaments","route":"/bu/api/mocks/Tournaments","name":"Tournaments","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Teams","route":"/bu/api/mocks/Teams","name":"Teams","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Groups","route":"/bu/api/mocks/Groups","name":"Groups","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Events","route":"/bu/api/mocks/Events","name":"Events","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Follows","route":"/bu/api/mocks/Follows","name":"Follows","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Solicitations","route":"/bu/api/mocks/Solicitations","name":"Solicitations","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/PlayerOverallPerformance","route":"/bu/api/mocks/PlayerOverallPerformance","name":"PlayerOverallPerformance","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/PlayerSeasonalPerformance","route":"/bu/api/mocks/PlayerSeasonalPerformance","name":"PlayerSeasonalPerformance","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/PlayerPerGamePerformance","route":"/bu/api/mocks/PlayerPerGamePerformance","name":"PlayerPerGamePerformance","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/TeamOverallPerformance","route":"/bu/api/mocks/TeamOverallPerformance","name":"TeamOverallPerformance","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/TeamSeasonalPerformance","route":"/bu/api/mocks/TeamSeasonalPerformance","name":"TeamSeasonalPerformance","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/TeamPerGamePerformance","route":"/bu/api/mocks/TeamPerGamePerformance","name":"TeamPerGamePerformance","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Broadcasts","route":"/bu/api/mocks/Broadcasts","name":"Broadcasts","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Posts","route":"/bu/api/mocks/Posts","name":"Posts","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Reactions","route":"/bu/api/mocks/Reactions","name":"Reactions","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/People","route":"/bu/api/mocks/People","name":"People","methods":[{"method":"post","fn":"createUsers"},{"method":"post","fn":"createPopulatedUsers"},{"method":"post","fn":"createTeams"},{"method":"post","fn":"createPopulatedTeams"},{"method":"post","fn":"createTournaments"},{"method":"post","fn":"createPopulatedTournaments"},{"method":"post","fn":"createGroups"},{"method":"post","fn":"createPopulatedGroups"},{"method":"post","fn":"createEvents"},{"method":"post","fn":"createPopulatedEvents"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Games","route":"/bu/api/mocks/Games","name":"Games","methods":[{"method":"post","fn":"playOutGames"},{"method":"post","fn":"playOutExistingGames"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Seasons","route":"/bu/api/mocks/Seasons","name":"Seasons","methods":[{"method":"post","fn":"createPopulatedSeasons"},{"method":"post","fn":"playOutSeasons"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Media","route":"/bu/api/mocks/Media","name":"Media","methods":[{"method":"post","fn":"createPosts"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Scenarios","route":"/bu/api/mocks/Scenarios","name":"Scenarios","methods":[{"method":"post","fn":"buildArea"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/GamesDB","route":"/bu/api/mocks/GamesDB","name":"GamesDB","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/SeasonsDB","route":"/bu/api/mocks/SeasonsDB","name":"SeasonsDB","methods":[{"method":"post","fn":"find"},{"method":"post","fn":"findOne"},{"method":"post","fn":"updateOne"},{"method":"post","fn":"deleteOne"},{"method":"post","fn":"deleteMany"}]},{"namespace":"ws://127.0.0.1:4300/bu/api/mocks/Plugin","route":"/bu/api/mocks/Plugin","name":"Plugin","methods":[{"method":"post","fn":"saveDoc"},{"method":"post","fn":"getDoc"},{"method":"post","fn":"getTests"},{"method":"post","fn":"saveTest"},{"method":"post","fn":"deleteTest"},{"method":"post","fn":"getSpecList"},{"method":"post","fn":"getConnection"},{"method":"post","fn":"getLog"}]}],"host":"127.0.0.1","route":"/bu/api/mocks","port":"4300","serviceUrl":"http://127.0.0.1:4300/bu/api/mocks","socketPath":"/bu/api/mocks/socket.io","namespace":"ws://127.0.0.1:4300/bu/api/mocks","SystemLynxService":true},"modules":[{"name":"Badges","__constructor":{},"module":{}},{"name":"Locations","__constructor":{},"module":{}},{"name":"Users","__constructor":{},"module":{}},{"name":"UsersArchive","__constructor":{},"module":{}},{"name":"Tournaments","__constructor":{},"module":{}},{"name":"Teams","__constructor":{},"module":{}},{"name":"Groups","__constructor":{},"module":{}},{"name":"Events","__constructor":{},"module":{}},{"name":"Follows","__constructor":{},"module":{}},{"name":"Solicitations","__constructor":{},"module":{}},{"name":"PlayerOverallPerformance","__constructor":{},"module":{}},{"name":"PlayerSeasonalPerformance","__constructor":{},"module":{}},{"name":"PlayerPerGamePerformance","__constructor":{},"module":{}},{"name":"TeamOverallPerformance","__constructor":{},"module":{}},{"name":"TeamSeasonalPerformance","__constructor":{},"module":{}},{"name":"TeamPerGamePerformance","__constructor":{},"module":{}},{"name":"Broadcasts","__constructor":{},"module":{}},{"name":"Posts","__constructor":{},"module":{}},{"name":"Reactions","__constructor":{},"module":{}},{"name":"People","module":{}},{"name":"Games","module":{}},{"name":"Seasons","module":{}},{"name":"Media","module":{}},{"name":"Scenarios","module":{}},{"name":"GamesDB","__constructor":{},"module":{}},{"name":"SeasonsDB","__constructor":{},"module":{}},{"name":"Plugin","module":{}}],"routing":{"route":"bu/api/mocks","port":"4300","host":"127.0.0.1","protocol":"http","ssl":null,"staticRouting":true},"services":[{"name":"Basketball","url":"http://127.0.0.1:4900/bu/api/basketball","onLoad":null,"client":{"Games":{},"Stats":{},"Seasons":{},"Aggregator":{},"Storage":{},"Plugin":{}}},{"name":"SystemView","url":"http://localhost:3000/systemview/api","onLoad":null,"client":{}}]},"specList":{"docs":["Mocks.md"],"tests":["Games.playOutGames.json","Media.createPosts.json","People.createPopulatedTeams.json","People.createUsers.json","Seasons.createPopulatedSeasons.json","Seasons.playOutSeasons.json"]}},{"projectCode":"systemview-test","serviceId":"TestService","system":{"connectionData":{"modules":[{"namespace":"ws://localhost:5555/test/api/Math","route":"/test/api/Math","name":"Math","methods":[{"method":"post","fn":"add"},{"method":"post","fn":"subtract"},{"method":"post","fn":"multiply"},{"method":"post","fn":"divide"},{"method":"post","fn":"getItems"},{"method":"post","fn":"once"},{"method":"post","fn":"destroy"}]},{"namespace":"ws://localhost:5555/test/api/String","route":"/test/api/String","name":"String","methods":[{"method":"post","fn":"concat"},{"method":"post","fn":"repeat"},{"method":"post","fn":"toUpperCase"},{"method":"post","fn":"once"},{"method":"post","fn":"destroy"}]},{"namespace":"ws://localhost:5555/test/api/Auth","route":"/test/api/Auth","name":"Auth","methods":[{"method":"post","fn":"signIn"},{"method":"post","fn":"getSession"},{"method":"post","fn":"once"},{"method":"post","fn":"destroy"}]},{"namespace":"ws://localhost:5555/test/api/Headers","route":"/test/api/Headers","name":"Headers","methods":[{"method":"post","fn":"getOrigin"},{"method":"post","fn":"once"},{"method":"post","fn":"destroy"}]},{"namespace":"ws://localhost:5555/test/api/SystemViewLogs","route":"/test/api/SystemViewLogs","name":"SystemViewLogs","methods":[{"method":"post","fn":"once"},{"method":"post","fn":"destroy"}]},{"namespace":"ws://localhost:5555/test/api/Plugin","route":"/test/api/Plugin","name":"Plugin","methods":[{"method":"post","fn":"once"},{"method":"post","fn":"destroy"},{"method":"post","fn":"saveDoc"},{"method":"post","fn":"getDoc"},{"method":"post","fn":"getTests"},{"method":"post","fn":"saveTest"},{"method":"post","fn":"deleteTest"},{"method":"post","fn":"getSpecList"},{"method":"post","fn":"getConnection"},{"method":"post","fn":"getLog"}]}],"host":"localhost","route":"/test/api","port":5555,"serviceUrl":"http://localhost:5555/test/api","socketPath":"/test/api/socket.io","namespace":"ws://localhost:5555/test/api","SystemLynxService":true},"modules":[{"name":"Math","__constructor":{},"module":{}},{"name":"String","__constructor":{},"module":{}},{"name":"Auth","__constructor":{"_lastCookie":""},"module":{}},{"name":"Headers","__constructor":{"_lastOrigin":""},"module":{}},{"name":"SystemViewLogs","__constructor":{},"module":{}},{"name":"Plugin","module":{}}],"routing":{"route":"test/api","port":5555},"services":[{"name":"SystemView","url":"http://localhost:3000/systemview/api","onLoad":null,"client":{"SystemView":{}}}]},"specList":{"docs":[],"tests":["Auth.getSession.json","Auth.signIn.json","Headers.getOrigin.json","Math.add.json","Math.divide.json","Math.list.json","Math.multiply.json","Math.subtract.json","String.concat.json","String.repeat.json"]}}]
|
|
1
|
+
[{"system":{"connectionData":{"modules":[{"namespace":"ws://localhost:5555/test/api/Math","route":"/test/api/Math","name":"Math","methods":[{"method":"post","fn":"add"},{"method":"post","fn":"subtract"},{"method":"post","fn":"multiply"},{"method":"post","fn":"divide"},{"method":"post","fn":"getItems"}]},{"namespace":"ws://localhost:5555/test/api/String","route":"/test/api/String","name":"String","methods":[{"method":"post","fn":"concat"},{"method":"post","fn":"repeat"},{"method":"post","fn":"toUpperCase"}]},{"namespace":"ws://localhost:5555/test/api/Auth","route":"/test/api/Auth","name":"Auth","methods":[{"method":"post","fn":"signIn"},{"method":"post","fn":"getSession"}]},{"namespace":"ws://localhost:5555/test/api/Headers","route":"/test/api/Headers","name":"Headers","methods":[{"method":"post","fn":"getOrigin"}]},{"namespace":"ws://localhost:5555/test/api/SystemView","route":"/test/api/SystemView","name":"SystemView","methods":[{"method":"post","fn":"trace"},{"method":"post","fn":"log"},{"method":"post","fn":"warn"},{"method":"post","fn":"error"},{"method":"post","fn":"debug"},{"method":"post","fn":"getLog"},{"method":"post","fn":"clearLog"}]},{"namespace":"ws://localhost:5555/test/api/Plugin","route":"/test/api/Plugin","name":"Plugin","methods":[{"method":"post","fn":"saveDoc"},{"method":"post","fn":"getDoc"},{"method":"post","fn":"getTests"},{"method":"post","fn":"saveTest"},{"method":"post","fn":"deleteTest"},{"method":"post","fn":"getSpecList"},{"method":"post","fn":"getConnection"},{"method":"post","fn":"getLog"},{"method":"post","fn":"getManifest"}]}],"host":"localhost","route":"/test/api","port":5555,"serviceUrl":"http://localhost:5555/test/api","socketPath":"/test/api/socket.io","namespace":"ws://localhost:5555/test/api","SystemLynxService":true},"modules":[{"name":"Math","__constructor":{},"module":{}},{"name":"String","__constructor":{},"module":{}},{"name":"Auth","__constructor":{"_lastCookie":""},"module":{}},{"name":"Headers","__constructor":{"_lastOrigin":""},"module":{}},{"name":"SystemView","module":{}},{"name":"Plugin","module":{}}],"routing":{"route":"test/api","port":5555},"services":[{"name":"SystemViewUI","url":"http://localhost:3000/systemview/api","onLoad":null,"client":{"SystemView":{},"CLI":{}}}]},"projectCode":"systemview-test","serviceId":"TestService","specList":{"docs":[],"tests":["Auth.getSession.json","Auth.signIn.json","Headers.getOrigin.json","Math.add.json","Math.divide.json","Math.list.json","Math.multiply.json","Math.subtract.json","String.concat.json","String.repeat.json"]}}]
|
package/api/index.js
CHANGED
|
@@ -1,45 +1,12 @@
|
|
|
1
|
-
const { HttpClient: http, App } = require("systemlynx");
|
|
1
|
+
const { HttpClient: http, createClient, App } = require("systemlynx");
|
|
2
2
|
const ConnectedServices = require("./Connections")();
|
|
3
|
+
const CLIHistory = require("./CLIHistory")();
|
|
4
|
+
const Client = createClient();
|
|
3
5
|
const route = "systemview/api";
|
|
4
6
|
const host = "localhost";
|
|
5
7
|
const express = require("express");
|
|
6
8
|
const path = require("path");
|
|
7
|
-
const fs = require("fs");
|
|
8
9
|
|
|
9
|
-
const LOG_FILE = path.join(__dirname, "../systemview.logs");
|
|
10
|
-
|
|
11
|
-
function saveLog(entry) {
|
|
12
|
-
const record = JSON.stringify({ timestamp: new Date().toISOString(), ...entry });
|
|
13
|
-
fs.appendFileSync(LOG_FILE, record + "\n");
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function getLogs({ projectCode, serviceId, moduleMethod, level, limit = 200 } = {}) {
|
|
18
|
-
if (!fs.existsSync(LOG_FILE)) return [];
|
|
19
|
-
const lines = fs.readFileSync(LOG_FILE, "utf8").trim().split("\n").filter(Boolean);
|
|
20
|
-
let entries = lines
|
|
21
|
-
.map((l) => {
|
|
22
|
-
try {
|
|
23
|
-
return JSON.parse(l);
|
|
24
|
-
} catch {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
.filter(Boolean);
|
|
29
|
-
if (projectCode) entries = entries.filter((e) => e.projectCode === projectCode);
|
|
30
|
-
if (serviceId) entries = entries.filter((e) => e.serviceId === serviceId);
|
|
31
|
-
if (moduleMethod)
|
|
32
|
-
entries = entries.filter(
|
|
33
|
-
(e) => e.moduleMethod && e.moduleMethod.includes(moduleMethod),
|
|
34
|
-
);
|
|
35
|
-
if (level) entries = entries.filter((e) => e.level === level);
|
|
36
|
-
return entries.slice(-limit);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function clearLogs() {
|
|
40
|
-
fs.writeFileSync(LOG_FILE, "");
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
10
|
const isUrl = (str) =>
|
|
44
11
|
/^(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(
|
|
45
12
|
str,
|
|
@@ -95,13 +62,27 @@ function getServices(searchText) {
|
|
|
95
62
|
async function getConnectionData(url) {
|
|
96
63
|
try {
|
|
97
64
|
const connectionData = await http.request({ url });
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
65
|
+
if (!connectionData || !connectionData.SystemLynxService) return [];
|
|
66
|
+
const svc = Client.createService(connectionData);
|
|
67
|
+
let project;
|
|
68
|
+
try {
|
|
69
|
+
const connection = await svc.Plugin.getConnection();
|
|
70
|
+
project = {
|
|
71
|
+
system: connection.system,
|
|
72
|
+
projectCode: connection.projectCode,
|
|
73
|
+
serviceId: connection.serviceId,
|
|
74
|
+
specList: connection.specList,
|
|
75
|
+
};
|
|
76
|
+
} catch {
|
|
77
|
+
const routeSegs = (connectionData.route || "").split("/").filter(Boolean);
|
|
78
|
+
const serviceId = [...routeSegs].reverse().find((s) => s.toLowerCase() !== "api") || "Service";
|
|
79
|
+
project = {
|
|
80
|
+
system: { connectionData },
|
|
81
|
+
serviceId,
|
|
82
|
+
projectCode: "connected-services",
|
|
83
|
+
specList: { tests: [], docs: [] },
|
|
84
|
+
};
|
|
85
|
+
}
|
|
105
86
|
connect(project);
|
|
106
87
|
return [project];
|
|
107
88
|
} catch (error) {
|
|
@@ -116,17 +97,27 @@ async function refreshConnection(searchText) {
|
|
|
116
97
|
function getProjects() {
|
|
117
98
|
const connections = ConnectedServices.getAllConnections();
|
|
118
99
|
const projects = {};
|
|
119
|
-
connections.forEach(({ projectCode, serviceId, system }) => {
|
|
100
|
+
connections.forEach(({ projectCode, serviceId, system, specList }) => {
|
|
120
101
|
if (!projects[projectCode]) projects[projectCode] = [];
|
|
121
102
|
projects[projectCode].push({
|
|
122
103
|
serviceId,
|
|
123
104
|
serviceUrl: system.connectionData.serviceUrl,
|
|
124
105
|
connectionData: system.connectionData,
|
|
106
|
+
system,
|
|
107
|
+
specList: specList || { tests: [], docs: [] },
|
|
125
108
|
});
|
|
126
109
|
});
|
|
127
110
|
return projects;
|
|
128
111
|
}
|
|
129
112
|
|
|
113
|
+
function deleteService(projectCode, serviceId) {
|
|
114
|
+
ConnectedServices.deleteService(projectCode, serviceId);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function deleteProject(projectCode) {
|
|
118
|
+
ConnectedServices.deleteProject(projectCode);
|
|
119
|
+
}
|
|
120
|
+
|
|
130
121
|
const shutdown = () => process.exit(0);
|
|
131
122
|
|
|
132
123
|
module.exports = function launchSystemView(port = 3000) {
|
|
@@ -149,9 +140,12 @@ module.exports = function launchSystemView(port = 3000) {
|
|
|
149
140
|
updateSpecList,
|
|
150
141
|
shutdown,
|
|
151
142
|
refreshConnection,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
143
|
+
deleteService,
|
|
144
|
+
deleteProject,
|
|
145
|
+
})
|
|
146
|
+
.module("CLI", {
|
|
147
|
+
getHistory: CLIHistory.getHistory,
|
|
148
|
+
saveHistory: CLIHistory.saveHistory,
|
|
155
149
|
})
|
|
156
150
|
.on("ready", () => {
|
|
157
151
|
server.get("*", (req, res) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
|
-
"main.css": "/static/css/main.
|
|
4
|
-
"main.js": "/static/js/main.
|
|
3
|
+
"main.css": "/static/css/main.1916c1d1.css",
|
|
4
|
+
"main.js": "/static/js/main.c7a05ef5.js",
|
|
5
5
|
"static/js/422.05c538a9.chunk.js": "/static/js/422.05c538a9.chunk.js",
|
|
6
6
|
"static/media/FontsFree-Net-SFMono-Regular.ttf": "/static/media/FontsFree-Net-SFMono-Regular.9647425ef282c28529df.ttf",
|
|
7
7
|
"static/media/loading.gif": "/static/media/loading.10ca842f103fd1282bdb.gif",
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"static/media/check.svg": "/static/media/check.c17549c742b818356d1a95bfa3b0404a.svg",
|
|
13
13
|
"static/media/error.svg": "/static/media/error.1d9e99c1bb443d2374ef72a7205a5b71.svg",
|
|
14
14
|
"static/media/x.svg": "/static/media/x.f680188c9bc9ed62e3647ad587e1bea0.svg",
|
|
15
|
-
"main.
|
|
16
|
-
"main.
|
|
15
|
+
"main.1916c1d1.css.map": "/static/css/main.1916c1d1.css.map",
|
|
16
|
+
"main.c7a05ef5.js.map": "/static/js/main.c7a05ef5.js.map",
|
|
17
17
|
"422.05c538a9.chunk.js.map": "/static/js/422.05c538a9.chunk.js.map"
|
|
18
18
|
},
|
|
19
19
|
"entrypoints": [
|
|
20
|
-
"static/css/main.
|
|
21
|
-
"static/js/main.
|
|
20
|
+
"static/css/main.1916c1d1.css",
|
|
21
|
+
"static/js/main.c7a05ef5.js"
|
|
22
22
|
]
|
|
23
23
|
}
|
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><script defer="defer" src="/static/js/main.
|
|
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><script defer="defer" src="/static/js/main.c7a05ef5.js"></script><link href="/static/css/main.1916c1d1.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|