@naisys/supervisor 3.0.0-beta.7 → 3.0.0-beta.9
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/client-dist/assets/{index-BBrK4ItN.js → index-WzoDF0aQ.js} +5 -5
- package/client-dist/index.html +1 -1
- package/dist/api-reference.js +13 -11
- package/dist/auth-middleware.js +3 -3
- package/dist/hateoas.js +1 -1
- package/dist/routes/root.js +1 -1
- package/dist/services/browserSocketService.js +2 -2
- package/dist/services/runsService.js +5 -1
- package/dist/supervisorServer.js +4 -4
- package/package.json +8 -8
package/client-dist/index.html
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
<meta name="format-detection" content="telephone=no" />
|
|
41
41
|
|
|
42
42
|
<title>NAISYS Supervisor</title>
|
|
43
|
-
<script type="module" crossorigin src="/supervisor/assets/index-
|
|
43
|
+
<script type="module" crossorigin src="/supervisor/assets/index-WzoDF0aQ.js"></script>
|
|
44
44
|
<link rel="stylesheet" crossorigin href="/supervisor/assets/index-CKg0vgt5.css">
|
|
45
45
|
</head>
|
|
46
46
|
<body>
|
package/dist/api-reference.js
CHANGED
|
@@ -5,22 +5,24 @@ import { registerAuthMiddleware } from "./auth-middleware.js";
|
|
|
5
5
|
* for the Supervisor service.
|
|
6
6
|
*/
|
|
7
7
|
export async function registerApiReference(fastify) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
theme: "kepler",
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
// Wrap in a scoped plugin so registerAuthMiddleware gates access
|
|
16
|
-
// (respects PUBLIC_READ for GETs, requires auth otherwise)
|
|
8
|
+
// Both the reference page and spec endpoint are inside the auth scope.
|
|
9
|
+
// isPublicRoute treats /supervisor/api-reference as non-public (starts
|
|
10
|
+
// with /supervisor/api), so PUBLIC_READ=true allows GET access while
|
|
11
|
+
// PUBLIC_READ=false requires authentication.
|
|
17
12
|
await fastify.register(async (scope) => {
|
|
18
13
|
registerAuthMiddleware(scope);
|
|
19
|
-
scope.
|
|
14
|
+
await scope.register(scalarReference, {
|
|
15
|
+
routePrefix: "/supervisor/api-reference",
|
|
16
|
+
configuration: {
|
|
17
|
+
spec: { url: "/supervisor/api/openapi.json" },
|
|
18
|
+
theme: "kepler",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
scope.get("/supervisor/api/openapi.json", () => {
|
|
20
22
|
const spec = fastify.swagger();
|
|
21
23
|
const filteredPaths = {};
|
|
22
24
|
for (const [path, value] of Object.entries(spec.paths || {})) {
|
|
23
|
-
if (path.startsWith("/api/
|
|
25
|
+
if (path.startsWith("/supervisor/api/")) {
|
|
24
26
|
filteredPaths[path] = value;
|
|
25
27
|
}
|
|
26
28
|
}
|
package/dist/auth-middleware.js
CHANGED
|
@@ -3,17 +3,17 @@ import { extractBearerToken, hashToken, SESSION_COOKIE_NAME, } from "@naisys/com
|
|
|
3
3
|
import { findAgentByApiKey } from "@naisys/hub-database";
|
|
4
4
|
import { findSession, findUserByApiKey } from "@naisys/supervisor-database";
|
|
5
5
|
import { createUserForAgent, getUserByUuid, getUserPermissions, } from "./services/userService.js";
|
|
6
|
-
const PUBLIC_PREFIXES = ["/api/
|
|
6
|
+
const PUBLIC_PREFIXES = ["/supervisor/api/auth/login"];
|
|
7
7
|
export const authCache = new AuthCache();
|
|
8
8
|
function isPublicRoute(url) {
|
|
9
|
-
if (url === "/api/
|
|
9
|
+
if (url === "/supervisor/api/" || url === "/supervisor/api")
|
|
10
10
|
return true;
|
|
11
11
|
for (const prefix of PUBLIC_PREFIXES) {
|
|
12
12
|
if (url.startsWith(prefix))
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
15
|
// Non-supervisor-API paths (static files, ERP routes, etc.)
|
|
16
|
-
if (!url.startsWith("/api
|
|
16
|
+
if (!url.startsWith("/supervisor/api"))
|
|
17
17
|
return true;
|
|
18
18
|
return false;
|
|
19
19
|
}
|
package/dist/hateoas.js
CHANGED
package/dist/routes/root.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Server as SocketIOServer } from "socket.io";
|
|
2
1
|
import { extractBearerToken } from "@naisys/common-node";
|
|
2
|
+
import { Server as SocketIOServer } from "socket.io";
|
|
3
3
|
import { resolveUserFromApiKey, resolveUserFromToken, } from "../auth-middleware.js";
|
|
4
4
|
import { isHubConnected } from "./hubConnectionService.js";
|
|
5
5
|
let io = null;
|
|
6
6
|
export function initBrowserSocket(httpServer, isProd) {
|
|
7
7
|
io = new SocketIOServer(httpServer, {
|
|
8
|
-
path: "/api/
|
|
8
|
+
path: "/supervisor/api/ws",
|
|
9
9
|
cors: isProd
|
|
10
10
|
? undefined
|
|
11
11
|
: { origin: ["http://localhost:3002"], credentials: true },
|
|
@@ -41,7 +41,11 @@ export function obfuscateLogs(data) {
|
|
|
41
41
|
...log,
|
|
42
42
|
message: obfuscateText(log.message),
|
|
43
43
|
attachment: log.attachment
|
|
44
|
-
? {
|
|
44
|
+
? {
|
|
45
|
+
id: "no-access",
|
|
46
|
+
filename: obfuscateFilename(log.attachment.filename),
|
|
47
|
+
fileSize: 0,
|
|
48
|
+
}
|
|
45
49
|
: undefined,
|
|
46
50
|
})),
|
|
47
51
|
};
|
package/dist/supervisorServer.js
CHANGED
|
@@ -96,7 +96,7 @@ export const startServer = async (startupType, plugins = [], hubPort) => {
|
|
|
96
96
|
await fastify.register(rateLimit, {
|
|
97
97
|
max: 500,
|
|
98
98
|
timeWindow: "1 minute",
|
|
99
|
-
allowList: (request) => !request.url.
|
|
99
|
+
allowList: (request) => !request.url.match(/^\/(supervisor|erp)\/api\//),
|
|
100
100
|
});
|
|
101
101
|
await fastify.register(multipart, {
|
|
102
102
|
limits: { fileSize: MAX_ATTACHMENT_SIZE },
|
|
@@ -126,9 +126,9 @@ export const startServer = async (startupType, plugins = [], hubPort) => {
|
|
|
126
126
|
fastify.get("/", { schema: { hide: true } }, async (_request, reply) => {
|
|
127
127
|
return reply.redirect("/supervisor/");
|
|
128
128
|
});
|
|
129
|
-
fastify.register(apiRoutes, { prefix: "/api
|
|
129
|
+
fastify.register(apiRoutes, { prefix: "/supervisor/api" });
|
|
130
130
|
// Public endpoint to expose client configuration (plugins, publicRead, etc.)
|
|
131
|
-
fastify.get("/api/
|
|
131
|
+
fastify.get("/supervisor/api/client-config", { schema: { hide: true } }, () => ({
|
|
132
132
|
plugins,
|
|
133
133
|
publicRead: process.env.PUBLIC_READ === "true",
|
|
134
134
|
permissions: PermissionEnum.options,
|
|
@@ -148,7 +148,7 @@ export const startServer = async (startupType, plugins = [], hubPort) => {
|
|
|
148
148
|
prefix: "/supervisor/",
|
|
149
149
|
});
|
|
150
150
|
fastify.setNotFoundHandler((request, reply) => {
|
|
151
|
-
if (request.url.
|
|
151
|
+
if (request.url.match(/^\/(supervisor|erp)\/api\//)) {
|
|
152
152
|
reply.code(404).send({ error: "API endpoint not found" });
|
|
153
153
|
}
|
|
154
154
|
else if (request.url.startsWith("/supervisor")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naisys/supervisor",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.9",
|
|
4
4
|
"description": "NAISYS Supervisor - Web UI for monitoring agents, logs, and messaging",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/supervisorServer.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"!dist/**/*.test.*"
|
|
34
34
|
],
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@naisys/erp": "3.0.0-beta.
|
|
36
|
+
"@naisys/erp": "3.0.0-beta.9"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@naisys/erp": {
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@fastify/rate-limit": "^10.3.0",
|
|
48
48
|
"@fastify/static": "^9.0.0",
|
|
49
49
|
"@fastify/swagger": "^9.7.0",
|
|
50
|
-
"@naisys/supervisor-shared": "3.0.0-beta.
|
|
51
|
-
"@naisys/common": "3.0.0-beta.
|
|
52
|
-
"@naisys/common-node": "3.0.0-beta.
|
|
53
|
-
"@naisys/hub-database": "3.0.0-beta.
|
|
54
|
-
"@naisys/hub-protocol": "3.0.0-beta.
|
|
55
|
-
"@naisys/supervisor-database": "3.0.0-beta.
|
|
50
|
+
"@naisys/supervisor-shared": "3.0.0-beta.9",
|
|
51
|
+
"@naisys/common": "3.0.0-beta.9",
|
|
52
|
+
"@naisys/common-node": "3.0.0-beta.9",
|
|
53
|
+
"@naisys/hub-database": "3.0.0-beta.9",
|
|
54
|
+
"@naisys/hub-protocol": "3.0.0-beta.9",
|
|
55
|
+
"@naisys/supervisor-database": "3.0.0-beta.9",
|
|
56
56
|
"@scalar/fastify-api-reference": "^1.48.7",
|
|
57
57
|
"@types/archiver": "^7.0.0",
|
|
58
58
|
"archiver": "^7.0.1",
|