@aigne/afs 1.3.0-beta.2 → 1.3.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/CHANGELOG.md +9 -0
- package/lib/cjs/afs.d.ts +8 -2
- package/lib/cjs/afs.js +20 -2
- package/lib/cjs/type.d.ts +16 -1
- package/lib/dts/afs.d.ts +8 -2
- package/lib/dts/type.d.ts +16 -1
- package/lib/esm/afs.d.ts +8 -2
- package/lib/esm/afs.js +20 -2
- package/lib/esm/type.d.ts +16 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.3.0](https://github.com/AIGNE-io/aigne-framework/compare/afs-v1.3.0-beta.3...afs-v1.3.0) (2025-12-12)
|
|
4
|
+
|
|
5
|
+
## [1.3.0-beta.3](https://github.com/AIGNE-io/aigne-framework/compare/afs-v1.3.0-beta.2...afs-v1.3.0-beta.3) (2025-12-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **afs:** add edit/delete/rename methods for AFS ([#820](https://github.com/AIGNE-io/aigne-framework/issues/820)) ([68cb508](https://github.com/AIGNE-io/aigne-framework/commit/68cb508d1cfc9c516d56303018139f1e567f897e))
|
|
11
|
+
|
|
3
12
|
## [1.3.0-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/afs-v1.3.0-beta.1...afs-v1.3.0-beta.2) (2025-12-10)
|
|
4
13
|
|
|
5
14
|
|
package/lib/cjs/afs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Emitter } from "strict-event-emitter";
|
|
2
|
-
import type { AFSEntry, AFSListOptions, AFSModule, AFSRoot, AFSRootEvents, AFSSearchOptions, AFSWriteEntryPayload } from "./type.js";
|
|
2
|
+
import type { AFSDeleteOptions, AFSEntry, AFSListOptions, AFSModule, AFSRenameOptions, AFSRoot, AFSRootEvents, AFSSearchOptions, AFSWriteEntryPayload, AFSWriteOptions } from "./type.js";
|
|
3
3
|
export interface AFSOptions {
|
|
4
4
|
modules?: AFSModule[];
|
|
5
5
|
}
|
|
@@ -22,10 +22,16 @@ export declare class AFS extends Emitter<AFSRootEvents> implements AFSRoot {
|
|
|
22
22
|
result?: AFSEntry;
|
|
23
23
|
message?: string;
|
|
24
24
|
}>;
|
|
25
|
-
write(path: string, content: AFSWriteEntryPayload): Promise<{
|
|
25
|
+
write(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<{
|
|
26
26
|
result: AFSEntry;
|
|
27
27
|
message?: string;
|
|
28
28
|
}>;
|
|
29
|
+
delete(path: string, options?: AFSDeleteOptions): Promise<{
|
|
30
|
+
message?: string;
|
|
31
|
+
}>;
|
|
32
|
+
rename(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<{
|
|
33
|
+
message?: string;
|
|
34
|
+
}>;
|
|
29
35
|
search(path: string, query: string, options?: AFSSearchOptions): Promise<{
|
|
30
36
|
list: AFSEntry[];
|
|
31
37
|
message?: string;
|
package/lib/cjs/afs.js
CHANGED
|
@@ -93,11 +93,11 @@ class AFS extends strict_event_emitter_1.Emitter {
|
|
|
93
93
|
}
|
|
94
94
|
return { result: undefined, message: "File not found" };
|
|
95
95
|
}
|
|
96
|
-
async write(path, content) {
|
|
96
|
+
async write(path, content, options) {
|
|
97
97
|
const module = this.findModules(path, { exactMatch: true })[0];
|
|
98
98
|
if (!module?.module.write)
|
|
99
99
|
throw new Error(`No module found for path: ${path}`);
|
|
100
|
-
const res = await module.module.write(module.subpath, content);
|
|
100
|
+
const res = await module.module.write(module.subpath, content, options);
|
|
101
101
|
return {
|
|
102
102
|
...res,
|
|
103
103
|
result: {
|
|
@@ -106,6 +106,24 @@ class AFS extends strict_event_emitter_1.Emitter {
|
|
|
106
106
|
},
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
+
async delete(path, options) {
|
|
110
|
+
const module = this.findModules(path, { exactMatch: true })[0];
|
|
111
|
+
if (!module?.module.delete)
|
|
112
|
+
throw new Error(`No module found for path: ${path}`);
|
|
113
|
+
return await module.module.delete(module.subpath, options);
|
|
114
|
+
}
|
|
115
|
+
async rename(oldPath, newPath, options) {
|
|
116
|
+
const oldModule = this.findModules(oldPath, { exactMatch: true })[0];
|
|
117
|
+
const newModule = this.findModules(newPath, { exactMatch: true })[0];
|
|
118
|
+
// Both paths must be in the same module
|
|
119
|
+
if (!oldModule || !newModule || oldModule.modulePath !== newModule.modulePath) {
|
|
120
|
+
throw new Error(`Cannot rename across different modules. Both paths must be in the same module.`);
|
|
121
|
+
}
|
|
122
|
+
if (!oldModule.module.rename) {
|
|
123
|
+
throw new Error(`Module does not support rename operation: ${oldModule.modulePath}`);
|
|
124
|
+
}
|
|
125
|
+
return await oldModule.module.rename(oldModule.subpath, newModule.subpath, options);
|
|
126
|
+
}
|
|
109
127
|
async search(path, query, options) {
|
|
110
128
|
const results = [];
|
|
111
129
|
const messages = [];
|
package/lib/cjs/type.d.ts
CHANGED
|
@@ -13,6 +13,15 @@ export interface AFSSearchOptions {
|
|
|
13
13
|
limit?: number;
|
|
14
14
|
caseSensitive?: boolean;
|
|
15
15
|
}
|
|
16
|
+
export interface AFSDeleteOptions {
|
|
17
|
+
recursive?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface AFSRenameOptions {
|
|
20
|
+
overwrite?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface AFSWriteOptions {
|
|
23
|
+
append?: boolean;
|
|
24
|
+
}
|
|
16
25
|
export interface AFSWriteEntryPayload extends Omit<AFSEntry, "id" | "path"> {
|
|
17
26
|
}
|
|
18
27
|
export interface AFSModule {
|
|
@@ -27,10 +36,16 @@ export interface AFSModule {
|
|
|
27
36
|
result?: AFSEntry;
|
|
28
37
|
message?: string;
|
|
29
38
|
}>;
|
|
30
|
-
write?(path: string, content: AFSWriteEntryPayload): Promise<{
|
|
39
|
+
write?(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<{
|
|
31
40
|
result: AFSEntry;
|
|
32
41
|
message?: string;
|
|
33
42
|
}>;
|
|
43
|
+
delete?(path: string, options?: AFSDeleteOptions): Promise<{
|
|
44
|
+
message?: string;
|
|
45
|
+
}>;
|
|
46
|
+
rename?(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<{
|
|
47
|
+
message?: string;
|
|
48
|
+
}>;
|
|
34
49
|
search?(path: string, query: string, options?: AFSSearchOptions): Promise<{
|
|
35
50
|
list: AFSEntry[];
|
|
36
51
|
message?: string;
|
package/lib/dts/afs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Emitter } from "strict-event-emitter";
|
|
2
|
-
import type { AFSEntry, AFSListOptions, AFSModule, AFSRoot, AFSRootEvents, AFSSearchOptions, AFSWriteEntryPayload } from "./type.js";
|
|
2
|
+
import type { AFSDeleteOptions, AFSEntry, AFSListOptions, AFSModule, AFSRenameOptions, AFSRoot, AFSRootEvents, AFSSearchOptions, AFSWriteEntryPayload, AFSWriteOptions } from "./type.js";
|
|
3
3
|
export interface AFSOptions {
|
|
4
4
|
modules?: AFSModule[];
|
|
5
5
|
}
|
|
@@ -22,10 +22,16 @@ export declare class AFS extends Emitter<AFSRootEvents> implements AFSRoot {
|
|
|
22
22
|
result?: AFSEntry;
|
|
23
23
|
message?: string;
|
|
24
24
|
}>;
|
|
25
|
-
write(path: string, content: AFSWriteEntryPayload): Promise<{
|
|
25
|
+
write(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<{
|
|
26
26
|
result: AFSEntry;
|
|
27
27
|
message?: string;
|
|
28
28
|
}>;
|
|
29
|
+
delete(path: string, options?: AFSDeleteOptions): Promise<{
|
|
30
|
+
message?: string;
|
|
31
|
+
}>;
|
|
32
|
+
rename(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<{
|
|
33
|
+
message?: string;
|
|
34
|
+
}>;
|
|
29
35
|
search(path: string, query: string, options?: AFSSearchOptions): Promise<{
|
|
30
36
|
list: AFSEntry[];
|
|
31
37
|
message?: string;
|
package/lib/dts/type.d.ts
CHANGED
|
@@ -13,6 +13,15 @@ export interface AFSSearchOptions {
|
|
|
13
13
|
limit?: number;
|
|
14
14
|
caseSensitive?: boolean;
|
|
15
15
|
}
|
|
16
|
+
export interface AFSDeleteOptions {
|
|
17
|
+
recursive?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface AFSRenameOptions {
|
|
20
|
+
overwrite?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface AFSWriteOptions {
|
|
23
|
+
append?: boolean;
|
|
24
|
+
}
|
|
16
25
|
export interface AFSWriteEntryPayload extends Omit<AFSEntry, "id" | "path"> {
|
|
17
26
|
}
|
|
18
27
|
export interface AFSModule {
|
|
@@ -27,10 +36,16 @@ export interface AFSModule {
|
|
|
27
36
|
result?: AFSEntry;
|
|
28
37
|
message?: string;
|
|
29
38
|
}>;
|
|
30
|
-
write?(path: string, content: AFSWriteEntryPayload): Promise<{
|
|
39
|
+
write?(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<{
|
|
31
40
|
result: AFSEntry;
|
|
32
41
|
message?: string;
|
|
33
42
|
}>;
|
|
43
|
+
delete?(path: string, options?: AFSDeleteOptions): Promise<{
|
|
44
|
+
message?: string;
|
|
45
|
+
}>;
|
|
46
|
+
rename?(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<{
|
|
47
|
+
message?: string;
|
|
48
|
+
}>;
|
|
34
49
|
search?(path: string, query: string, options?: AFSSearchOptions): Promise<{
|
|
35
50
|
list: AFSEntry[];
|
|
36
51
|
message?: string;
|
package/lib/esm/afs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Emitter } from "strict-event-emitter";
|
|
2
|
-
import type { AFSEntry, AFSListOptions, AFSModule, AFSRoot, AFSRootEvents, AFSSearchOptions, AFSWriteEntryPayload } from "./type.js";
|
|
2
|
+
import type { AFSDeleteOptions, AFSEntry, AFSListOptions, AFSModule, AFSRenameOptions, AFSRoot, AFSRootEvents, AFSSearchOptions, AFSWriteEntryPayload, AFSWriteOptions } from "./type.js";
|
|
3
3
|
export interface AFSOptions {
|
|
4
4
|
modules?: AFSModule[];
|
|
5
5
|
}
|
|
@@ -22,10 +22,16 @@ export declare class AFS extends Emitter<AFSRootEvents> implements AFSRoot {
|
|
|
22
22
|
result?: AFSEntry;
|
|
23
23
|
message?: string;
|
|
24
24
|
}>;
|
|
25
|
-
write(path: string, content: AFSWriteEntryPayload): Promise<{
|
|
25
|
+
write(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<{
|
|
26
26
|
result: AFSEntry;
|
|
27
27
|
message?: string;
|
|
28
28
|
}>;
|
|
29
|
+
delete(path: string, options?: AFSDeleteOptions): Promise<{
|
|
30
|
+
message?: string;
|
|
31
|
+
}>;
|
|
32
|
+
rename(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<{
|
|
33
|
+
message?: string;
|
|
34
|
+
}>;
|
|
29
35
|
search(path: string, query: string, options?: AFSSearchOptions): Promise<{
|
|
30
36
|
list: AFSEntry[];
|
|
31
37
|
message?: string;
|
package/lib/esm/afs.js
CHANGED
|
@@ -90,11 +90,11 @@ export class AFS extends Emitter {
|
|
|
90
90
|
}
|
|
91
91
|
return { result: undefined, message: "File not found" };
|
|
92
92
|
}
|
|
93
|
-
async write(path, content) {
|
|
93
|
+
async write(path, content, options) {
|
|
94
94
|
const module = this.findModules(path, { exactMatch: true })[0];
|
|
95
95
|
if (!module?.module.write)
|
|
96
96
|
throw new Error(`No module found for path: ${path}`);
|
|
97
|
-
const res = await module.module.write(module.subpath, content);
|
|
97
|
+
const res = await module.module.write(module.subpath, content, options);
|
|
98
98
|
return {
|
|
99
99
|
...res,
|
|
100
100
|
result: {
|
|
@@ -103,6 +103,24 @@ export class AFS extends Emitter {
|
|
|
103
103
|
},
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
+
async delete(path, options) {
|
|
107
|
+
const module = this.findModules(path, { exactMatch: true })[0];
|
|
108
|
+
if (!module?.module.delete)
|
|
109
|
+
throw new Error(`No module found for path: ${path}`);
|
|
110
|
+
return await module.module.delete(module.subpath, options);
|
|
111
|
+
}
|
|
112
|
+
async rename(oldPath, newPath, options) {
|
|
113
|
+
const oldModule = this.findModules(oldPath, { exactMatch: true })[0];
|
|
114
|
+
const newModule = this.findModules(newPath, { exactMatch: true })[0];
|
|
115
|
+
// Both paths must be in the same module
|
|
116
|
+
if (!oldModule || !newModule || oldModule.modulePath !== newModule.modulePath) {
|
|
117
|
+
throw new Error(`Cannot rename across different modules. Both paths must be in the same module.`);
|
|
118
|
+
}
|
|
119
|
+
if (!oldModule.module.rename) {
|
|
120
|
+
throw new Error(`Module does not support rename operation: ${oldModule.modulePath}`);
|
|
121
|
+
}
|
|
122
|
+
return await oldModule.module.rename(oldModule.subpath, newModule.subpath, options);
|
|
123
|
+
}
|
|
106
124
|
async search(path, query, options) {
|
|
107
125
|
const results = [];
|
|
108
126
|
const messages = [];
|
package/lib/esm/type.d.ts
CHANGED
|
@@ -13,6 +13,15 @@ export interface AFSSearchOptions {
|
|
|
13
13
|
limit?: number;
|
|
14
14
|
caseSensitive?: boolean;
|
|
15
15
|
}
|
|
16
|
+
export interface AFSDeleteOptions {
|
|
17
|
+
recursive?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface AFSRenameOptions {
|
|
20
|
+
overwrite?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface AFSWriteOptions {
|
|
23
|
+
append?: boolean;
|
|
24
|
+
}
|
|
16
25
|
export interface AFSWriteEntryPayload extends Omit<AFSEntry, "id" | "path"> {
|
|
17
26
|
}
|
|
18
27
|
export interface AFSModule {
|
|
@@ -27,10 +36,16 @@ export interface AFSModule {
|
|
|
27
36
|
result?: AFSEntry;
|
|
28
37
|
message?: string;
|
|
29
38
|
}>;
|
|
30
|
-
write?(path: string, content: AFSWriteEntryPayload): Promise<{
|
|
39
|
+
write?(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions): Promise<{
|
|
31
40
|
result: AFSEntry;
|
|
32
41
|
message?: string;
|
|
33
42
|
}>;
|
|
43
|
+
delete?(path: string, options?: AFSDeleteOptions): Promise<{
|
|
44
|
+
message?: string;
|
|
45
|
+
}>;
|
|
46
|
+
rename?(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<{
|
|
47
|
+
message?: string;
|
|
48
|
+
}>;
|
|
34
49
|
search?(path: string, query: string, options?: AFSSearchOptions): Promise<{
|
|
35
50
|
list: AFSEntry[];
|
|
36
51
|
message?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/afs",
|
|
3
|
-
"version": "1.3.0
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Agentic File System (AFS) is a virtual file system that supports various storage backends and provides a unified API for file operations.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|