@aigne/afs-explorer 1.11.0-beta → 1.11.0-beta.2

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/LICENSE.md CHANGED
@@ -1,93 +1,26 @@
1
- Elastic License 2.0
1
+ # Proprietary License
2
2
 
3
- URL: https://www.elastic.co/licensing/elastic-license
3
+ Copyright (c) 2024-2025 ArcBlock, Inc. All Rights Reserved.
4
4
 
5
- ## Acceptance
5
+ This software and associated documentation files (the "Software") are proprietary
6
+ and confidential. Unauthorized copying, modification, distribution, or use of
7
+ this Software, via any medium, is strictly prohibited.
6
8
 
7
- By using the software, you agree to all of the terms and conditions below.
9
+ The Software is provided for internal use only within ArcBlock, Inc. and its
10
+ authorized affiliates.
8
11
 
9
- ## Copyright License
12
+ ## No License Granted
10
13
 
11
- The licensor grants you a non-exclusive, royalty-free, worldwide,
12
- non-sublicensable, non-transferable license to use, copy, distribute, make
13
- available, and prepare derivative works of the software, in each case subject to
14
- the limitations and conditions below.
14
+ No license, express or implied, is granted to any party for any purpose.
15
+ All rights are reserved by ArcBlock, Inc.
15
16
 
16
- ## Limitations
17
+ ## Public Artifact Distribution
17
18
 
18
- You may not provide the software to third parties as a hosted or managed
19
- service, where the service provides users with access to any substantial set of
20
- the features or functionality of the software.
19
+ Portions of this Software may be released publicly under separate open-source
20
+ licenses (such as MIT License) through designated public repositories. Such
21
+ public releases are governed by their respective licenses and do not affect
22
+ the proprietary nature of this repository.
21
23
 
22
- You may not move, change, disable, or circumvent the license key functionality
23
- in the software, and you may not remove or obscure any functionality in the
24
- software that is protected by the license key.
24
+ ## Contact
25
25
 
26
- You may not alter, remove, or obscure any licensing, copyright, or other notices
27
- of the licensor in the software. Any use of the licensor’s trademarks is subject
28
- to applicable law.
29
-
30
- ## Patents
31
-
32
- The licensor grants you a license, under any patent claims the licensor can
33
- license, or becomes able to license, to make, have made, use, sell, offer for
34
- sale, import and have imported the software, in each case subject to the
35
- limitations and conditions in this license. This license does not cover any
36
- patent claims that you cause to be infringed by modifications or additions to
37
- the software. If you or your company make any written claim that the software
38
- infringes or contributes to infringement of any patent, your patent license for
39
- the software granted under these terms ends immediately. If your company makes
40
- such a claim, your patent license ends immediately for work on behalf of your
41
- company.
42
-
43
- ## Notices
44
-
45
- You must ensure that anyone who gets a copy of any part of the software from you
46
- also gets a copy of these terms.
47
-
48
- If you modify the software, you must include in any modified copies of the
49
- software prominent notices stating that you have modified the software.
50
-
51
- ## No Other Rights
52
-
53
- These terms do not imply any licenses other than those expressly granted in
54
- these terms.
55
-
56
- ## Termination
57
-
58
- If you use the software in violation of these terms, such use is not licensed,
59
- and your licenses will automatically terminate. If the licensor provides you
60
- with a notice of your violation, and you cease all violation of this license no
61
- later than 30 days after you receive that notice, your licenses will be
62
- reinstated retroactively. However, if you violate these terms after such
63
- reinstatement, any additional violation of these terms will cause your licenses
64
- to terminate automatically and permanently.
65
-
66
- ## No Liability
67
-
68
- *As far as the law allows, the software comes as is, without any warranty or
69
- condition, and the licensor will not be liable to you for any damages arising
70
- out of these terms or the use or nature of the software, under any kind of
71
- legal claim.*
72
-
73
- ## Definitions
74
-
75
- The **licensor** is the entity offering these terms, and the **software** is the
76
- software the licensor makes available under these terms, including any portion
77
- of it.
78
-
79
- **you** refers to the individual or entity agreeing to these terms.
80
-
81
- **your company** is any legal entity, sole proprietorship, or other kind of
82
- organization that you work for, plus all organizations that have control over,
83
- are under the control of, or are under common control with that
84
- organization. **control** means ownership of substantially all the assets of an
85
- entity, or the power to direct its management and policies by vote, contract, or
86
- otherwise. Control can be direct or indirect.
87
-
88
- **your licenses** are all the licenses granted to you for the software under
89
- these terms.
90
-
91
- **use** means anything you do with the software requiring one of your licenses.
92
-
93
- **trademark** means trademarks, service marks, and similar rights.
26
+ For licensing inquiries, contact: legal@arcblock.io
package/README.md CHANGED
@@ -27,13 +27,13 @@ pnpm add @aigne/afs-explorer
27
27
  ```typescript
28
28
  import { AFS } from "@aigne/afs";
29
29
  import { AFSHistory } from "@aigne/afs-history";
30
- import { LocalFS } from "@aigne/afs-local-fs";
30
+ import { AFSFS } from "@aigne/afs-fs";
31
31
  import { startExplorer } from "@aigne/afs-explorer";
32
32
 
33
33
  // Create and configure your AFS instance
34
34
  const afs = new AFS();
35
35
  afs.mount(new AFSHistory({ storage: { url: "file:./memory.sqlite3" } }));
36
- afs.mount(new LocalFS({ localPath: "./docs" }));
36
+ afs.mount(new AFSFS({ localPath: "./docs" }));
37
37
 
38
38
  // Start the explorer server
39
39
  const server = await startExplorer(afs, {
@@ -133,6 +133,3 @@ The frontend is a React application built with:
133
133
  - **Material-UI (MUI)** - Professional UI components
134
134
  - **Vite** - Fast build tool and dev server
135
135
 
136
- ## License
137
-
138
- Elastic-2.0
@@ -0,0 +1,29 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
package/dist/index.cjs CHANGED
@@ -1,113 +1,5 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
1
+ const require_server = require('./server.cjs');
26
2
 
27
- //#endregion
28
- let node_path = require("node:path");
29
- node_path = __toESM(node_path);
30
- let cors = require("cors");
31
- cors = __toESM(cors);
32
- let express = require("express");
33
- express = __toESM(express);
34
-
35
- //#region src/server.ts
36
- var ExplorerServer = class {
37
- app;
38
- server;
39
- constructor(afs, options = {}) {
40
- this.afs = afs;
41
- this.options = options;
42
- this.app = (0, express.default)();
43
- this.setupMiddleware();
44
- this.setupRoutes();
45
- }
46
- setupMiddleware() {
47
- this.app.use((0, cors.default)());
48
- this.app.use(express.default.json());
49
- }
50
- setupRoutes() {
51
- this.app.get("/api/list", async (req, res) => {
52
- const path = req.query.path || "/";
53
- const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth, 10) : 1;
54
- const result = await this.afs.list(path, { maxDepth });
55
- res.json(result);
56
- });
57
- this.app.get("/api/read", async (req, res) => {
58
- const path = req.query.path;
59
- if (!path) {
60
- res.status(400).json({ error: "Path is required" });
61
- return;
62
- }
63
- const result = await this.afs.read(path);
64
- res.json(result);
65
- });
66
- this.app.get("/api/search", async (req, res) => {
67
- const path = req.query.path || "/";
68
- const query = req.query.query;
69
- if (!query) {
70
- res.status(400).json({ error: "Query is required" });
71
- return;
72
- }
73
- const result = await this.afs.search(path, query);
74
- res.json(result);
75
- });
76
- if (this.options.distPath) {
77
- const distPath = node_path.default.resolve(this.options.distPath);
78
- this.app.use(express.default.static(distPath));
79
- this.app.get("/{*splat}", (_req, res) => {
80
- res.sendFile("index.html", { root: distPath });
81
- });
82
- }
83
- this.app.use((err, _req, res, _next) => {
84
- res.status(500).json({ error: err.message || String(err) });
85
- });
86
- }
87
- async start() {
88
- const port = this.options.port || 3e3;
89
- const host = this.options.host || "localhost";
90
- return new Promise((resolve) => {
91
- this.server = this.app.listen(port, host, () => {
92
- resolve();
93
- });
94
- });
95
- }
96
- async stop() {
97
- return new Promise((resolve, reject) => {
98
- if (this.server) this.server.close((err) => {
99
- if (err && err.code !== "ERR_SERVER_NOT_RUNNING") reject(err);
100
- else {
101
- this.server = void 0;
102
- resolve();
103
- }
104
- });
105
- else resolve();
106
- });
107
- }
108
- };
109
-
110
- //#endregion
111
3
  //#region src/index.ts
112
4
  /**
113
5
  * Start the AFS Explorer web server
@@ -116,11 +8,11 @@ var ExplorerServer = class {
116
8
  * @returns The ExplorerServer instance
117
9
  */
118
10
  async function startExplorer(afs, options = {}) {
119
- const server = new ExplorerServer(afs, options);
11
+ const server = new require_server.ExplorerServer(afs, options);
120
12
  await server.start();
121
13
  return server;
122
14
  }
123
15
 
124
16
  //#endregion
125
- exports.ExplorerServer = ExplorerServer;
17
+ exports.ExplorerServer = require_server.ExplorerServer;
126
18
  exports.startExplorer = startExplorer;
package/dist/index.d.cts CHANGED
@@ -1,27 +1,6 @@
1
+ import { ExplorerServer, ExplorerServerOptions } from "./server.cjs";
1
2
  import { AFS } from "@aigne/afs";
2
3
 
3
- //#region src/server.d.ts
4
- interface ExplorerServerOptions {
5
- port?: number;
6
- host?: string;
7
- /**
8
- * Path to the dist directory containing the built frontend.
9
- * If not provided, static file serving will be disabled.
10
- */
11
- distPath?: string;
12
- }
13
- declare class ExplorerServer {
14
- private afs;
15
- private options;
16
- private app;
17
- private server?;
18
- constructor(afs: AFS, options?: ExplorerServerOptions);
19
- private setupMiddleware;
20
- private setupRoutes;
21
- start(): Promise<void>;
22
- stop(): Promise<void>;
23
- }
24
- //#endregion
25
4
  //#region src/index.d.ts
26
5
  /**
27
6
  * Start the AFS Explorer web server
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/server.ts","../src/index.ts"],"mappings":";;;UAKiB,qBAAA;EAAA,IAAA;EAAA,IAAA;EAAA;AAUjB;;;EAViB,QAAA;AAAA;AAAA,cAUJ,cAAA;EAAA,QAAA,GAAA;EAAA,QAAA,OAAA;EAAA,QAAA,GAAA;EAAA,QAAA,MAAA;EAAA,YAAA,GAAA,EAKI,GAAA,EAAA,OAAA,GACI,qBAAA;EAAA,QAAA,eAAA;EAAA,QAAA,WAAA;EAAA,MAAA,GA2DJ,OAAA;EAAA,KAAA,GAWD,OAAA;AAAA;;;;AChFhB;;;;;iBAAsB,aAAA,CAAA,GAAA,EACf,GAAA,EAAA,OAAA,GACI,qBAAA,GACR,OAAA,CAAQ,cAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;AAWA;;;;;iBAAsB,aAAA,CAAA,GAAA,EACf,GAAA,EAAA,OAAA,GACI,qBAAA,GACR,OAAA,CAAQ,cAAA"}
package/dist/index.d.mts CHANGED
@@ -1,27 +1,6 @@
1
+ import { ExplorerServer, ExplorerServerOptions } from "./server.mjs";
1
2
  import { AFS } from "@aigne/afs";
2
3
 
3
- //#region src/server.d.ts
4
- interface ExplorerServerOptions {
5
- port?: number;
6
- host?: string;
7
- /**
8
- * Path to the dist directory containing the built frontend.
9
- * If not provided, static file serving will be disabled.
10
- */
11
- distPath?: string;
12
- }
13
- declare class ExplorerServer {
14
- private afs;
15
- private options;
16
- private app;
17
- private server?;
18
- constructor(afs: AFS, options?: ExplorerServerOptions);
19
- private setupMiddleware;
20
- private setupRoutes;
21
- start(): Promise<void>;
22
- stop(): Promise<void>;
23
- }
24
- //#endregion
25
4
  //#region src/index.d.ts
26
5
  /**
27
6
  * Start the AFS Explorer web server
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/server.ts","../src/index.ts"],"mappings":";;;UAKiB,qBAAA;EAAA,IAAA;EAAA,IAAA;EAAA;AAUjB;;;EAViB,QAAA;AAAA;AAAA,cAUJ,cAAA;EAAA,QAAA,GAAA;EAAA,QAAA,OAAA;EAAA,QAAA,GAAA;EAAA,QAAA,MAAA;EAAA,YAAA,GAAA,EAKI,GAAA,EAAA,OAAA,GACI,qBAAA;EAAA,QAAA,eAAA;EAAA,QAAA,WAAA;EAAA,MAAA,GA2DJ,OAAA;EAAA,KAAA,GAWD,OAAA;AAAA;;;;AChFhB;;;;;iBAAsB,aAAA,CAAA,GAAA,EACf,GAAA,EAAA,OAAA,GACI,qBAAA,GACR,OAAA,CAAQ,cAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;AAWA;;;;;iBAAsB,aAAA,CAAA,GAAA,EACf,GAAA,EAAA,OAAA,GACI,qBAAA,GACR,OAAA,CAAQ,cAAA"}
package/dist/index.mjs CHANGED
@@ -1,83 +1,5 @@
1
- import path from "node:path";
2
- import cors from "cors";
3
- import express from "express";
1
+ import { ExplorerServer } from "./server.mjs";
4
2
 
5
- //#region src/server.ts
6
- var ExplorerServer = class {
7
- app;
8
- server;
9
- constructor(afs, options = {}) {
10
- this.afs = afs;
11
- this.options = options;
12
- this.app = express();
13
- this.setupMiddleware();
14
- this.setupRoutes();
15
- }
16
- setupMiddleware() {
17
- this.app.use(cors());
18
- this.app.use(express.json());
19
- }
20
- setupRoutes() {
21
- this.app.get("/api/list", async (req, res) => {
22
- const path$1 = req.query.path || "/";
23
- const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth, 10) : 1;
24
- const result = await this.afs.list(path$1, { maxDepth });
25
- res.json(result);
26
- });
27
- this.app.get("/api/read", async (req, res) => {
28
- const path$1 = req.query.path;
29
- if (!path$1) {
30
- res.status(400).json({ error: "Path is required" });
31
- return;
32
- }
33
- const result = await this.afs.read(path$1);
34
- res.json(result);
35
- });
36
- this.app.get("/api/search", async (req, res) => {
37
- const path$1 = req.query.path || "/";
38
- const query = req.query.query;
39
- if (!query) {
40
- res.status(400).json({ error: "Query is required" });
41
- return;
42
- }
43
- const result = await this.afs.search(path$1, query);
44
- res.json(result);
45
- });
46
- if (this.options.distPath) {
47
- const distPath = path.resolve(this.options.distPath);
48
- this.app.use(express.static(distPath));
49
- this.app.get("/{*splat}", (_req, res) => {
50
- res.sendFile("index.html", { root: distPath });
51
- });
52
- }
53
- this.app.use((err, _req, res, _next) => {
54
- res.status(500).json({ error: err.message || String(err) });
55
- });
56
- }
57
- async start() {
58
- const port = this.options.port || 3e3;
59
- const host = this.options.host || "localhost";
60
- return new Promise((resolve) => {
61
- this.server = this.app.listen(port, host, () => {
62
- resolve();
63
- });
64
- });
65
- }
66
- async stop() {
67
- return new Promise((resolve, reject) => {
68
- if (this.server) this.server.close((err) => {
69
- if (err && err.code !== "ERR_SERVER_NOT_RUNNING") reject(err);
70
- else {
71
- this.server = void 0;
72
- resolve();
73
- }
74
- });
75
- else resolve();
76
- });
77
- }
78
- };
79
-
80
- //#endregion
81
3
  //#region src/index.ts
82
4
  /**
83
5
  * Start the AFS Explorer web server
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["path"],"sources":["../src/server.ts","../src/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { AFS } from \"@aigne/afs\";\nimport cors from \"cors\";\nimport express from \"express\";\n\nexport interface ExplorerServerOptions {\n port?: number;\n host?: string;\n /**\n * Path to the dist directory containing the built frontend.\n * If not provided, static file serving will be disabled.\n */\n distPath?: string;\n}\n\nexport class ExplorerServer {\n private app: express.Application;\n private server?: ReturnType<typeof this.app.listen>;\n\n constructor(\n private afs: AFS,\n private options: ExplorerServerOptions = {},\n ) {\n this.app = express();\n this.setupMiddleware();\n this.setupRoutes();\n }\n\n private setupMiddleware() {\n this.app.use(cors());\n this.app.use(express.json());\n }\n\n private setupRoutes() {\n // API Routes\n this.app.get(\"/api/list\", async (req, res) => {\n const path = (req.query.path as string) || \"/\";\n const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth as string, 10) : 1;\n const result = await this.afs.list(path, { maxDepth });\n res.json(result);\n });\n\n this.app.get(\"/api/read\", async (req, res) => {\n const path = req.query.path as string;\n if (!path) {\n res.status(400).json({ error: \"Path is required\" });\n return;\n }\n const result = await this.afs.read(path);\n res.json(result);\n });\n\n this.app.get(\"/api/search\", async (req, res) => {\n const path = (req.query.path as string) || \"/\";\n const query = req.query.query as string;\n if (!query) {\n res.status(400).json({ error: \"Query is required\" });\n return;\n }\n const result = await this.afs.search(path, query);\n res.json(result);\n });\n\n // Serve static files from the dist directory (if provided)\n if (this.options.distPath) {\n const distPath = path.resolve(this.options.distPath);\n this.app.use(express.static(distPath));\n this.app.get(\"/{*splat}\", (_req, res) => {\n res.sendFile(\"index.html\", { root: distPath });\n });\n }\n\n // Global error handler\n this.app.use(\n (err: Error, _req: express.Request, res: express.Response, _next: express.NextFunction) => {\n res.status(500).json({ error: err.message || String(err) });\n },\n );\n }\n\n async start(): Promise<void> {\n const port = this.options.port || 3000;\n const host = this.options.host || \"localhost\";\n\n return new Promise((resolve) => {\n this.server = this.app.listen(port, host, () => {\n resolve();\n });\n });\n }\n\n async stop(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (this.server) {\n this.server.close((err) => {\n // Ignore ERR_SERVER_NOT_RUNNING error\n if (err && (err as NodeJS.ErrnoException).code !== \"ERR_SERVER_NOT_RUNNING\") {\n reject(err);\n } else {\n this.server = undefined;\n resolve();\n }\n });\n } else {\n resolve();\n }\n });\n }\n}\n","import type { AFS } from \"@aigne/afs\";\nimport { ExplorerServer, type ExplorerServerOptions } from \"./server.js\";\n\nexport { ExplorerServer, type ExplorerServerOptions };\n\n/**\n * Start the AFS Explorer web server\n * @param afs - The AFS instance to explore\n * @param options - Server options\n * @returns The ExplorerServer instance\n */\nexport async function startExplorer(\n afs: AFS,\n options: ExplorerServerOptions = {},\n): Promise<ExplorerServer> {\n const server = new ExplorerServer(afs, options);\n await server.start();\n return server;\n}\n"],"mappings":";;;;;AAeA,IAAa,iBAAb,MAA4B;CAC1B,AAAQ;CACR,AAAQ;CAER,YACE,AAAQ,KACR,AAAQ,UAAiC,EAAE,EAC3C;EAFQ;EACA;AAER,OAAK,MAAM,SAAS;AACpB,OAAK,iBAAiB;AACtB,OAAK,aAAa;;CAGpB,AAAQ,kBAAkB;AACxB,OAAK,IAAI,IAAI,MAAM,CAAC;AACpB,OAAK,IAAI,IAAI,QAAQ,MAAM,CAAC;;CAG9B,AAAQ,cAAc;AAEpB,OAAK,IAAI,IAAI,aAAa,OAAO,KAAK,QAAQ;GAC5C,MAAMA,SAAQ,IAAI,MAAM,QAAmB;GAC3C,MAAM,WAAW,IAAI,MAAM,WAAW,OAAO,SAAS,IAAI,MAAM,UAAoB,GAAG,GAAG;GAC1F,MAAM,SAAS,MAAM,KAAK,IAAI,KAAKA,QAAM,EAAE,UAAU,CAAC;AACtD,OAAI,KAAK,OAAO;IAChB;AAEF,OAAK,IAAI,IAAI,aAAa,OAAO,KAAK,QAAQ;GAC5C,MAAMA,SAAO,IAAI,MAAM;AACvB,OAAI,CAACA,QAAM;AACT,QAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,oBAAoB,CAAC;AACnD;;GAEF,MAAM,SAAS,MAAM,KAAK,IAAI,KAAKA,OAAK;AACxC,OAAI,KAAK,OAAO;IAChB;AAEF,OAAK,IAAI,IAAI,eAAe,OAAO,KAAK,QAAQ;GAC9C,MAAMA,SAAQ,IAAI,MAAM,QAAmB;GAC3C,MAAM,QAAQ,IAAI,MAAM;AACxB,OAAI,CAAC,OAAO;AACV,QAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,qBAAqB,CAAC;AACpD;;GAEF,MAAM,SAAS,MAAM,KAAK,IAAI,OAAOA,QAAM,MAAM;AACjD,OAAI,KAAK,OAAO;IAChB;AAGF,MAAI,KAAK,QAAQ,UAAU;GACzB,MAAM,WAAW,KAAK,QAAQ,KAAK,QAAQ,SAAS;AACpD,QAAK,IAAI,IAAI,QAAQ,OAAO,SAAS,CAAC;AACtC,QAAK,IAAI,IAAI,cAAc,MAAM,QAAQ;AACvC,QAAI,SAAS,cAAc,EAAE,MAAM,UAAU,CAAC;KAC9C;;AAIJ,OAAK,IAAI,KACN,KAAY,MAAuB,KAAuB,UAAgC;AACzF,OAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI,WAAW,OAAO,IAAI,EAAE,CAAC;IAE9D;;CAGH,MAAM,QAAuB;EAC3B,MAAM,OAAO,KAAK,QAAQ,QAAQ;EAClC,MAAM,OAAO,KAAK,QAAQ,QAAQ;AAElC,SAAO,IAAI,SAAS,YAAY;AAC9B,QAAK,SAAS,KAAK,IAAI,OAAO,MAAM,YAAY;AAC9C,aAAS;KACT;IACF;;CAGJ,MAAM,OAAsB;AAC1B,SAAO,IAAI,SAAS,SAAS,WAAW;AACtC,OAAI,KAAK,OACP,MAAK,OAAO,OAAO,QAAQ;AAEzB,QAAI,OAAQ,IAA8B,SAAS,yBACjD,QAAO,IAAI;SACN;AACL,UAAK,SAAS;AACd,cAAS;;KAEX;OAEF,UAAS;IAEX;;;;;;;;;;;;AC/FN,eAAsB,cACpB,KACA,UAAiC,EAAE,EACV;CACzB,MAAM,SAAS,IAAI,eAAe,KAAK,QAAQ;AAC/C,OAAM,OAAO,OAAO;AACpB,QAAO"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { AFS } from \"@aigne/afs\";\nimport { ExplorerServer, type ExplorerServerOptions } from \"./server.js\";\n\nexport { ExplorerServer, type ExplorerServerOptions };\n\n/**\n * Start the AFS Explorer web server\n * @param afs - The AFS instance to explore\n * @param options - Server options\n * @returns The ExplorerServer instance\n */\nexport async function startExplorer(\n afs: AFS,\n options: ExplorerServerOptions = {},\n): Promise<ExplorerServer> {\n const server = new ExplorerServer(afs, options);\n await server.start();\n return server;\n}\n"],"mappings":";;;;;;;;;AAWA,eAAsB,cACpB,KACA,UAAiC,EAAE,EACV;CACzB,MAAM,SAAS,IAAI,eAAe,KAAK,QAAQ;AAC/C,OAAM,OAAO,OAAO;AACpB,QAAO"}
@@ -0,0 +1,85 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ let node_path = require("node:path");
3
+ node_path = require_rolldown_runtime.__toESM(node_path);
4
+ let cors = require("cors");
5
+ cors = require_rolldown_runtime.__toESM(cors);
6
+ let express = require("express");
7
+ express = require_rolldown_runtime.__toESM(express);
8
+
9
+ //#region src/server.ts
10
+ var ExplorerServer = class {
11
+ app;
12
+ server;
13
+ constructor(afs, options = {}) {
14
+ this.afs = afs;
15
+ this.options = options;
16
+ this.app = (0, express.default)();
17
+ this.setupMiddleware();
18
+ this.setupRoutes();
19
+ }
20
+ setupMiddleware() {
21
+ this.app.use((0, cors.default)());
22
+ this.app.use(express.default.json());
23
+ }
24
+ setupRoutes() {
25
+ this.app.get("/api/list", async (req, res) => {
26
+ const path = req.query.path || "/";
27
+ const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth, 10) : 1;
28
+ const result = await this.afs.list(path, { maxDepth });
29
+ res.json(result);
30
+ });
31
+ this.app.get("/api/read", async (req, res) => {
32
+ const path = req.query.path;
33
+ if (!path) {
34
+ res.status(400).json({ error: "Path is required" });
35
+ return;
36
+ }
37
+ const result = await this.afs.read(path);
38
+ res.json(result);
39
+ });
40
+ this.app.get("/api/search", async (req, res) => {
41
+ const path = req.query.path || "/";
42
+ const query = req.query.query;
43
+ if (!query) {
44
+ res.status(400).json({ error: "Query is required" });
45
+ return;
46
+ }
47
+ const result = await this.afs.search(path, query);
48
+ res.json(result);
49
+ });
50
+ if (this.options.distPath) {
51
+ const distPath = node_path.default.resolve(this.options.distPath);
52
+ this.app.use(express.default.static(distPath));
53
+ this.app.get("/{*splat}", (_req, res) => {
54
+ res.sendFile("index.html", { root: distPath });
55
+ });
56
+ }
57
+ this.app.use((err, _req, res, _next) => {
58
+ res.status(500).json({ error: err.message || String(err) });
59
+ });
60
+ }
61
+ async start() {
62
+ const port = this.options.port || 3e3;
63
+ const host = this.options.host || "localhost";
64
+ return new Promise((resolve) => {
65
+ this.server = this.app.listen(port, host, () => {
66
+ resolve();
67
+ });
68
+ });
69
+ }
70
+ async stop() {
71
+ return new Promise((resolve, reject) => {
72
+ if (this.server) this.server.close((err) => {
73
+ if (err && err.code !== "ERR_SERVER_NOT_RUNNING") reject(err);
74
+ else {
75
+ this.server = void 0;
76
+ resolve();
77
+ }
78
+ });
79
+ else resolve();
80
+ });
81
+ }
82
+ };
83
+
84
+ //#endregion
85
+ exports.ExplorerServer = ExplorerServer;
@@ -0,0 +1,26 @@
1
+ import { AFS } from "@aigne/afs";
2
+
3
+ //#region src/server.d.ts
4
+ interface ExplorerServerOptions {
5
+ port?: number;
6
+ host?: string;
7
+ /**
8
+ * Path to the dist directory containing the built frontend.
9
+ * If not provided, static file serving will be disabled.
10
+ */
11
+ distPath?: string;
12
+ }
13
+ declare class ExplorerServer {
14
+ private afs;
15
+ private options;
16
+ private app;
17
+ private server?;
18
+ constructor(afs: AFS, options?: ExplorerServerOptions);
19
+ private setupMiddleware;
20
+ private setupRoutes;
21
+ start(): Promise<void>;
22
+ stop(): Promise<void>;
23
+ }
24
+ //#endregion
25
+ export { ExplorerServer, ExplorerServerOptions };
26
+ //# sourceMappingURL=server.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.cts","names":[],"sources":["../src/server.ts"],"mappings":";;;UAKiB,qBAAA;EAAA,IAAA;EAAA,IAAA;EAAA;AAUjB;;;EAViB,QAAA;AAAA;AAAA,cAUJ,cAAA;EAAA,QAAA,GAAA;EAAA,QAAA,OAAA;EAAA,QAAA,GAAA;EAAA,QAAA,MAAA;EAAA,YAAA,GAAA,EAKI,GAAA,EAAA,OAAA,GACI,qBAAA;EAAA,QAAA,eAAA;EAAA,QAAA,WAAA;EAAA,MAAA,GA2DJ,OAAA;EAAA,KAAA,GAWD,OAAA;AAAA"}
@@ -0,0 +1,26 @@
1
+ import { AFS } from "@aigne/afs";
2
+
3
+ //#region src/server.d.ts
4
+ interface ExplorerServerOptions {
5
+ port?: number;
6
+ host?: string;
7
+ /**
8
+ * Path to the dist directory containing the built frontend.
9
+ * If not provided, static file serving will be disabled.
10
+ */
11
+ distPath?: string;
12
+ }
13
+ declare class ExplorerServer {
14
+ private afs;
15
+ private options;
16
+ private app;
17
+ private server?;
18
+ constructor(afs: AFS, options?: ExplorerServerOptions);
19
+ private setupMiddleware;
20
+ private setupRoutes;
21
+ start(): Promise<void>;
22
+ stop(): Promise<void>;
23
+ }
24
+ //#endregion
25
+ export { ExplorerServer, ExplorerServerOptions };
26
+ //# sourceMappingURL=server.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.mts","names":[],"sources":["../src/server.ts"],"mappings":";;;UAKiB,qBAAA;EAAA,IAAA;EAAA,IAAA;EAAA;AAUjB;;;EAViB,QAAA;AAAA;AAAA,cAUJ,cAAA;EAAA,QAAA,GAAA;EAAA,QAAA,OAAA;EAAA,QAAA,GAAA;EAAA,QAAA,MAAA;EAAA,YAAA,GAAA,EAKI,GAAA,EAAA,OAAA,GACI,qBAAA;EAAA,QAAA,eAAA;EAAA,QAAA,WAAA;EAAA,MAAA,GA2DJ,OAAA;EAAA,KAAA,GAWD,OAAA;AAAA"}
@@ -0,0 +1,82 @@
1
+ import path from "node:path";
2
+ import cors from "cors";
3
+ import express from "express";
4
+
5
+ //#region src/server.ts
6
+ var ExplorerServer = class {
7
+ app;
8
+ server;
9
+ constructor(afs, options = {}) {
10
+ this.afs = afs;
11
+ this.options = options;
12
+ this.app = express();
13
+ this.setupMiddleware();
14
+ this.setupRoutes();
15
+ }
16
+ setupMiddleware() {
17
+ this.app.use(cors());
18
+ this.app.use(express.json());
19
+ }
20
+ setupRoutes() {
21
+ this.app.get("/api/list", async (req, res) => {
22
+ const path$1 = req.query.path || "/";
23
+ const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth, 10) : 1;
24
+ const result = await this.afs.list(path$1, { maxDepth });
25
+ res.json(result);
26
+ });
27
+ this.app.get("/api/read", async (req, res) => {
28
+ const path$1 = req.query.path;
29
+ if (!path$1) {
30
+ res.status(400).json({ error: "Path is required" });
31
+ return;
32
+ }
33
+ const result = await this.afs.read(path$1);
34
+ res.json(result);
35
+ });
36
+ this.app.get("/api/search", async (req, res) => {
37
+ const path$1 = req.query.path || "/";
38
+ const query = req.query.query;
39
+ if (!query) {
40
+ res.status(400).json({ error: "Query is required" });
41
+ return;
42
+ }
43
+ const result = await this.afs.search(path$1, query);
44
+ res.json(result);
45
+ });
46
+ if (this.options.distPath) {
47
+ const distPath = path.resolve(this.options.distPath);
48
+ this.app.use(express.static(distPath));
49
+ this.app.get("/{*splat}", (_req, res) => {
50
+ res.sendFile("index.html", { root: distPath });
51
+ });
52
+ }
53
+ this.app.use((err, _req, res, _next) => {
54
+ res.status(500).json({ error: err.message || String(err) });
55
+ });
56
+ }
57
+ async start() {
58
+ const port = this.options.port || 3e3;
59
+ const host = this.options.host || "localhost";
60
+ return new Promise((resolve) => {
61
+ this.server = this.app.listen(port, host, () => {
62
+ resolve();
63
+ });
64
+ });
65
+ }
66
+ async stop() {
67
+ return new Promise((resolve, reject) => {
68
+ if (this.server) this.server.close((err) => {
69
+ if (err && err.code !== "ERR_SERVER_NOT_RUNNING") reject(err);
70
+ else {
71
+ this.server = void 0;
72
+ resolve();
73
+ }
74
+ });
75
+ else resolve();
76
+ });
77
+ }
78
+ };
79
+
80
+ //#endregion
81
+ export { ExplorerServer };
82
+ //# sourceMappingURL=server.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.mjs","names":["path"],"sources":["../src/server.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { AFS } from \"@aigne/afs\";\nimport cors from \"cors\";\nimport express from \"express\";\n\nexport interface ExplorerServerOptions {\n port?: number;\n host?: string;\n /**\n * Path to the dist directory containing the built frontend.\n * If not provided, static file serving will be disabled.\n */\n distPath?: string;\n}\n\nexport class ExplorerServer {\n private app: express.Application;\n private server?: ReturnType<typeof this.app.listen>;\n\n constructor(\n private afs: AFS,\n private options: ExplorerServerOptions = {},\n ) {\n this.app = express();\n this.setupMiddleware();\n this.setupRoutes();\n }\n\n private setupMiddleware() {\n this.app.use(cors());\n this.app.use(express.json());\n }\n\n private setupRoutes() {\n // API Routes\n this.app.get(\"/api/list\", async (req, res) => {\n const path = (req.query.path as string) || \"/\";\n const maxDepth = req.query.maxDepth ? Number.parseInt(req.query.maxDepth as string, 10) : 1;\n const result = await this.afs.list(path, { maxDepth });\n res.json(result);\n });\n\n this.app.get(\"/api/read\", async (req, res) => {\n const path = req.query.path as string;\n if (!path) {\n res.status(400).json({ error: \"Path is required\" });\n return;\n }\n const result = await this.afs.read(path);\n res.json(result);\n });\n\n this.app.get(\"/api/search\", async (req, res) => {\n const path = (req.query.path as string) || \"/\";\n const query = req.query.query as string;\n if (!query) {\n res.status(400).json({ error: \"Query is required\" });\n return;\n }\n const result = await this.afs.search(path, query);\n res.json(result);\n });\n\n // Serve static files from the dist directory (if provided)\n if (this.options.distPath) {\n const distPath = path.resolve(this.options.distPath);\n this.app.use(express.static(distPath));\n this.app.get(\"/{*splat}\", (_req, res) => {\n res.sendFile(\"index.html\", { root: distPath });\n });\n }\n\n // Global error handler\n this.app.use(\n (err: Error, _req: express.Request, res: express.Response, _next: express.NextFunction) => {\n res.status(500).json({ error: err.message || String(err) });\n },\n );\n }\n\n async start(): Promise<void> {\n const port = this.options.port || 3000;\n const host = this.options.host || \"localhost\";\n\n return new Promise((resolve) => {\n this.server = this.app.listen(port, host, () => {\n resolve();\n });\n });\n }\n\n async stop(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (this.server) {\n this.server.close((err) => {\n // Ignore ERR_SERVER_NOT_RUNNING error\n if (err && (err as NodeJS.ErrnoException).code !== \"ERR_SERVER_NOT_RUNNING\") {\n reject(err);\n } else {\n this.server = undefined;\n resolve();\n }\n });\n } else {\n resolve();\n }\n });\n }\n}\n"],"mappings":";;;;;AAeA,IAAa,iBAAb,MAA4B;CAC1B,AAAQ;CACR,AAAQ;CAER,YACE,AAAQ,KACR,AAAQ,UAAiC,EAAE,EAC3C;EAFQ;EACA;AAER,OAAK,MAAM,SAAS;AACpB,OAAK,iBAAiB;AACtB,OAAK,aAAa;;CAGpB,AAAQ,kBAAkB;AACxB,OAAK,IAAI,IAAI,MAAM,CAAC;AACpB,OAAK,IAAI,IAAI,QAAQ,MAAM,CAAC;;CAG9B,AAAQ,cAAc;AAEpB,OAAK,IAAI,IAAI,aAAa,OAAO,KAAK,QAAQ;GAC5C,MAAMA,SAAQ,IAAI,MAAM,QAAmB;GAC3C,MAAM,WAAW,IAAI,MAAM,WAAW,OAAO,SAAS,IAAI,MAAM,UAAoB,GAAG,GAAG;GAC1F,MAAM,SAAS,MAAM,KAAK,IAAI,KAAKA,QAAM,EAAE,UAAU,CAAC;AACtD,OAAI,KAAK,OAAO;IAChB;AAEF,OAAK,IAAI,IAAI,aAAa,OAAO,KAAK,QAAQ;GAC5C,MAAMA,SAAO,IAAI,MAAM;AACvB,OAAI,CAACA,QAAM;AACT,QAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,oBAAoB,CAAC;AACnD;;GAEF,MAAM,SAAS,MAAM,KAAK,IAAI,KAAKA,OAAK;AACxC,OAAI,KAAK,OAAO;IAChB;AAEF,OAAK,IAAI,IAAI,eAAe,OAAO,KAAK,QAAQ;GAC9C,MAAMA,SAAQ,IAAI,MAAM,QAAmB;GAC3C,MAAM,QAAQ,IAAI,MAAM;AACxB,OAAI,CAAC,OAAO;AACV,QAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,qBAAqB,CAAC;AACpD;;GAEF,MAAM,SAAS,MAAM,KAAK,IAAI,OAAOA,QAAM,MAAM;AACjD,OAAI,KAAK,OAAO;IAChB;AAGF,MAAI,KAAK,QAAQ,UAAU;GACzB,MAAM,WAAW,KAAK,QAAQ,KAAK,QAAQ,SAAS;AACpD,QAAK,IAAI,IAAI,QAAQ,OAAO,SAAS,CAAC;AACtC,QAAK,IAAI,IAAI,cAAc,MAAM,QAAQ;AACvC,QAAI,SAAS,cAAc,EAAE,MAAM,UAAU,CAAC;KAC9C;;AAIJ,OAAK,IAAI,KACN,KAAY,MAAuB,KAAuB,UAAgC;AACzF,OAAI,OAAO,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI,WAAW,OAAO,IAAI,EAAE,CAAC;IAE9D;;CAGH,MAAM,QAAuB;EAC3B,MAAM,OAAO,KAAK,QAAQ,QAAQ;EAClC,MAAM,OAAO,KAAK,QAAQ,QAAQ;AAElC,SAAO,IAAI,SAAS,YAAY;AAC9B,QAAK,SAAS,KAAK,IAAI,OAAO,MAAM,YAAY;AAC9C,aAAS;KACT;IACF;;CAGJ,MAAM,OAAsB;AAC1B,SAAO,IAAI,SAAS,SAAS,WAAW;AACtC,OAAI,KAAK,OACP,MAAK,OAAO,OAAO,QAAQ;AAEzB,QAAI,OAAQ,IAA8B,SAAS,yBACjD,QAAO,IAAI;SACN;AACL,UAAK,SAAS;AACd,cAAS;;KAEX;OAEF,UAAS;IAEX"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@aigne/afs-explorer",
3
- "version": "1.11.0-beta",
3
+ "version": "1.11.0-beta.2",
4
4
  "description": "Explore and manage AFS file systems",
5
- "license": "Elastic-2.0",
5
+ "license": "UNLICENSED",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "cors": "^2.8.5",
39
39
  "express": "^5.1.0",
40
- "@aigne/afs": "^1.11.0-beta"
40
+ "@aigne/afs": "^1.11.0-beta.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@emotion/react": "^11.14.0",
@@ -65,10 +65,10 @@
65
65
  "tsdown": "0.20.0-beta.3",
66
66
  "typescript": "^5.9.2",
67
67
  "vite": "^7.1.5",
68
- "@aigne/afs-json": "^1.11.0-beta",
69
- "@aigne/afs-local-fs": "^1.11.0-beta",
68
+ "@aigne/afs-git": "^1.11.0-beta.2",
69
+ "@aigne/afs-json": "^1.11.0-beta.2",
70
+ "@aigne/afs-fs": "^1.11.0-beta.2",
70
71
  "@aigne/scripts": "0.0.0",
71
- "@aigne/afs-git": "^1.11.0-beta",
72
72
  "@aigne/typescript-config": "0.0.0"
73
73
  },
74
74
  "scripts": {