@aigne/afs-explorer 1.0.0 → 1.1.0-beta

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.0-beta](https://github.com/AIGNE-io/aigne-framework/compare/afs-explorer-v1.0.0...afs-explorer-v1.1.0-beta) (2026-01-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * **afs:** add explorer for AFS ([97ebe2d](https://github.com/AIGNE-io/aigne-framework/commit/97ebe2de59fb4ac4a5e5dea51b027a02ee69638d))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **afs:** improve explorer server with SPA routing and global error handler ([865c160](https://github.com/AIGNE-io/aigne-framework/commit/865c1601e2a0d9e481f260d150cb3210aef622fb))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * The following workspace dependencies were updated
19
+ * dependencies
20
+ * @aigne/afs bumped to 1.4.0-beta.11
21
+ * @aigne/core bumped to 1.72.0-beta.25
22
+ * devDependencies
23
+ * @aigne/afs-git bumped to 1.1.0-beta
24
+ * @aigne/afs-history bumped to 1.2.0-beta.12
25
+ * @aigne/afs-json bumped to 1.1.0-beta
26
+ * @aigne/afs-local-fs bumped to 1.4.0-beta.26
27
+ * @aigne/test-utils bumped to 0.5.69-beta.25
28
+
3
29
  ## 1.0.0 (2026-01-16)
4
30
 
5
31
 
package/lib/cjs/server.js CHANGED
@@ -26,54 +26,42 @@ class ExplorerServer {
26
26
  setupRoutes() {
27
27
  // API Routes
28
28
  this.app.get("/api/list", async (req, res) => {
29
- try {
30
- const path = req.query.path || "/";
31
- const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth, 10) : 1;
32
- const result = await this.afs.list(path, { maxDepth });
33
- res.json(result);
34
- }
35
- catch (error) {
36
- res.status(500).json({ error: String(error) });
37
- }
29
+ const path = req.query.path || "/";
30
+ const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth, 10) : 1;
31
+ const result = await this.afs.list(path, { maxDepth });
32
+ res.json(result);
38
33
  });
39
34
  this.app.get("/api/read", async (req, res) => {
40
- try {
41
- const path = req.query.path;
42
- if (!path) {
43
- res.status(400).json({ error: "Path is required" });
44
- return;
45
- }
46
- const result = await this.afs.read(path);
47
- res.json(result);
48
- }
49
- catch (error) {
50
- res.status(500).json({ error: String(error) });
35
+ const path = req.query.path;
36
+ if (!path) {
37
+ res.status(400).json({ error: "Path is required" });
38
+ return;
51
39
  }
40
+ const result = await this.afs.read(path);
41
+ res.json(result);
52
42
  });
53
43
  this.app.get("/api/search", async (req, res) => {
54
- try {
55
- const path = req.query.path || "/";
56
- const query = req.query.query;
57
- if (!query) {
58
- res.status(400).json({ error: "Query is required" });
59
- return;
60
- }
61
- const result = await this.afs.search(path, query);
62
- res.json(result);
63
- }
64
- catch (error) {
65
- res.status(500).json({ error: String(error) });
44
+ const path = req.query.path || "/";
45
+ const query = req.query.query;
46
+ if (!query) {
47
+ res.status(400).json({ error: "Query is required" });
48
+ return;
66
49
  }
50
+ const result = await this.afs.search(path, query);
51
+ res.json(result);
67
52
  });
68
53
  // Serve static files from the dist directory (if provided)
69
54
  if (this.options.distPath) {
70
55
  const distPath = node_path_1.default.resolve(this.options.distPath);
71
56
  this.app.use(express_1.default.static(distPath));
72
- // Serve index.html for all other routes (SPA fallback)
73
- this.app.use((_req, res) => {
74
- res.sendFile(node_path_1.default.join(distPath, "index.html"));
57
+ this.app.get("/{*splat}", (_req, res) => {
58
+ res.sendFile("index.html", { root: distPath });
75
59
  });
76
60
  }
61
+ // Global error handler
62
+ this.app.use((err, _req, res, _next) => {
63
+ res.status(500).json({ error: err.message || String(err) });
64
+ });
77
65
  }
78
66
  async start() {
79
67
  const port = this.options.port || 3000;
package/lib/esm/server.js CHANGED
@@ -20,54 +20,42 @@ export class ExplorerServer {
20
20
  setupRoutes() {
21
21
  // API Routes
22
22
  this.app.get("/api/list", async (req, res) => {
23
- try {
24
- const path = req.query.path || "/";
25
- const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth, 10) : 1;
26
- const result = await this.afs.list(path, { maxDepth });
27
- res.json(result);
28
- }
29
- catch (error) {
30
- res.status(500).json({ error: String(error) });
31
- }
23
+ const path = req.query.path || "/";
24
+ const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth, 10) : 1;
25
+ const result = await this.afs.list(path, { maxDepth });
26
+ res.json(result);
32
27
  });
33
28
  this.app.get("/api/read", async (req, res) => {
34
- try {
35
- const path = req.query.path;
36
- if (!path) {
37
- res.status(400).json({ error: "Path is required" });
38
- return;
39
- }
40
- const result = await this.afs.read(path);
41
- res.json(result);
42
- }
43
- catch (error) {
44
- res.status(500).json({ error: String(error) });
29
+ const path = req.query.path;
30
+ if (!path) {
31
+ res.status(400).json({ error: "Path is required" });
32
+ return;
45
33
  }
34
+ const result = await this.afs.read(path);
35
+ res.json(result);
46
36
  });
47
37
  this.app.get("/api/search", async (req, res) => {
48
- try {
49
- const path = req.query.path || "/";
50
- const query = req.query.query;
51
- if (!query) {
52
- res.status(400).json({ error: "Query is required" });
53
- return;
54
- }
55
- const result = await this.afs.search(path, query);
56
- res.json(result);
57
- }
58
- catch (error) {
59
- res.status(500).json({ error: String(error) });
38
+ const path = req.query.path || "/";
39
+ const query = req.query.query;
40
+ if (!query) {
41
+ res.status(400).json({ error: "Query is required" });
42
+ return;
60
43
  }
44
+ const result = await this.afs.search(path, query);
45
+ res.json(result);
61
46
  });
62
47
  // Serve static files from the dist directory (if provided)
63
48
  if (this.options.distPath) {
64
49
  const distPath = path.resolve(this.options.distPath);
65
50
  this.app.use(express.static(distPath));
66
- // Serve index.html for all other routes (SPA fallback)
67
- this.app.use((_req, res) => {
68
- res.sendFile(path.join(distPath, "index.html"));
51
+ this.app.get("/{*splat}", (_req, res) => {
52
+ res.sendFile("index.html", { root: distPath });
69
53
  });
70
54
  }
55
+ // Global error handler
56
+ this.app.use((err, _req, res, _next) => {
57
+ res.status(500).json({ error: err.message || String(err) });
58
+ });
71
59
  }
72
60
  async start() {
73
61
  const port = this.options.port || 3000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/afs-explorer",
3
- "version": "1.0.0",
3
+ "version": "1.1.0-beta",
4
4
  "description": "Explore and manage AFS file systems",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -53,8 +53,8 @@
53
53
  "express": "^5.1.0",
54
54
  "yaml": "^2.8.1",
55
55
  "zod": "^3.25.67",
56
- "@aigne/afs": "^1.4.0-beta.10",
57
- "@aigne/core": "^1.72.0-beta.24"
56
+ "@aigne/afs": "^1.4.0-beta.11",
57
+ "@aigne/core": "^1.72.0-beta.25"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@emotion/react": "^11.14.0",
@@ -82,11 +82,11 @@
82
82
  "typescript": "^5.9.2",
83
83
  "vite": "^7.1.5",
84
84
  "vite-plugin-svgr": "^4.3.0",
85
- "@aigne/afs-git": "^1.0.0",
86
- "@aigne/afs-history": "^1.2.0-beta.11",
87
- "@aigne/afs-json": "^1.0.0",
88
- "@aigne/afs-local-fs": "^1.4.0-beta.25",
89
- "@aigne/test-utils": "^0.5.69-beta.24"
85
+ "@aigne/afs-git": "^1.1.0-beta",
86
+ "@aigne/afs-history": "^1.2.0-beta.12",
87
+ "@aigne/afs-json": "^1.1.0-beta",
88
+ "@aigne/afs-local-fs": "^1.4.0-beta.26",
89
+ "@aigne/test-utils": "^0.5.69-beta.25"
90
90
  },
91
91
  "scripts": {
92
92
  "lint": "tsc --noEmit",