@aigne/afs-json 1.11.0-beta → 1.11.0-beta.10
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 +17 -84
- package/README.md +0 -3
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs +10 -0
- package/dist/index.cjs +462 -170
- package/dist/index.d.cts +134 -72
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +134 -72
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +460 -170
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AFSAccessMode,
|
|
1
|
+
import { AFSAccessMode, AFSEntry, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSSearchOptions, AFSStatResult, AFSWriteEntryPayload, ProviderManifest } from "@aigne/afs";
|
|
2
|
+
import { AFSBaseProvider, RouteContext } from "@aigne/afs/provider";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
|
|
4
5
|
//#region src/index.d.ts
|
|
@@ -7,17 +8,17 @@ interface AFSJSONOptions {
|
|
|
7
8
|
jsonPath: string;
|
|
8
9
|
description?: string;
|
|
9
10
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
* Access mode for this module.
|
|
12
|
+
* - "readonly": Only read operations are allowed
|
|
13
|
+
* - "readwrite": All operations are allowed (default, unless agentSkills is enabled)
|
|
14
|
+
* @default "readwrite" (or "readonly" when agentSkills is true)
|
|
15
|
+
*/
|
|
15
16
|
accessMode?: AFSAccessMode;
|
|
16
17
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
* Enable automatic agent skill scanning for this module.
|
|
19
|
+
* When enabled, defaults accessMode to "readonly" if not explicitly set.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
21
22
|
agentSkills?: boolean;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
@@ -26,97 +27,158 @@ interface AFSJSONOptions {
|
|
|
26
27
|
* JSON/YAML objects are treated as directories, and properties/array items as files.
|
|
27
28
|
* Supports nested structures and path-based access to data values.
|
|
28
29
|
*/
|
|
29
|
-
declare class AFSJSON
|
|
30
|
+
declare class AFSJSON extends AFSBaseProvider {
|
|
30
31
|
options: AFSJSONOptions & {
|
|
31
32
|
cwd?: string;
|
|
33
|
+
localPath?: string;
|
|
34
|
+
uri?: string;
|
|
32
35
|
};
|
|
33
|
-
static schema(): z.
|
|
34
|
-
name:
|
|
35
|
-
jsonPath: z.ZodString;
|
|
36
|
-
description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
37
|
-
accessMode: z.ZodType<"readonly" | "readwrite" | undefined, z.ZodTypeDef, "readonly" | "readwrite" | undefined>;
|
|
38
|
-
agentSkills: z.ZodType<boolean | undefined, z.ZodTypeDef, boolean | undefined>;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
static schema(): z.ZodType<{
|
|
37
|
+
name: string | undefined;
|
|
40
38
|
jsonPath: string;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
description: string | undefined;
|
|
40
|
+
accessMode: "readonly" | "readwrite" | undefined;
|
|
41
|
+
agentSkills: boolean | undefined;
|
|
42
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
43
|
+
name: string | undefined;
|
|
46
44
|
jsonPath: string;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
jsonPath: string;
|
|
53
|
-
name?: string | undefined;
|
|
54
|
-
description?: string | undefined;
|
|
55
|
-
accessMode?: "readonly" | "readwrite" | undefined;
|
|
56
|
-
agentSkills?: boolean | undefined;
|
|
57
|
-
}, any>;
|
|
45
|
+
description: string | undefined;
|
|
46
|
+
accessMode: "readonly" | "readwrite" | undefined;
|
|
47
|
+
agentSkills: boolean | undefined;
|
|
48
|
+
}, unknown>>;
|
|
49
|
+
static manifest(): ProviderManifest;
|
|
58
50
|
static load({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
51
|
+
basePath,
|
|
52
|
+
config
|
|
53
|
+
}?: AFSModuleLoadParams): Promise<AFSJSON>;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly description?: string;
|
|
56
|
+
readonly accessMode: AFSAccessMode;
|
|
57
|
+
readonly agentSkills?: boolean;
|
|
62
58
|
private jsonData;
|
|
63
59
|
private fileStats;
|
|
64
60
|
private fileFormat;
|
|
61
|
+
private resolvedJsonPath;
|
|
65
62
|
constructor(options: AFSJSONOptions & {
|
|
66
63
|
cwd?: string;
|
|
64
|
+
localPath?: string;
|
|
65
|
+
uri?: string;
|
|
67
66
|
});
|
|
68
|
-
name: string;
|
|
69
|
-
description?: string;
|
|
70
|
-
accessMode: AFSAccessMode;
|
|
71
|
-
agentSkills?: boolean;
|
|
72
67
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
* Read metadata for a JSON node via /.meta or /path/.meta
|
|
69
|
+
* Returns stored metadata merged with computed type information
|
|
70
|
+
* Note: Meta is read-only. To write metadata, use write() with payload.meta.
|
|
71
|
+
*/
|
|
72
|
+
readMetaHandler(ctx: RouteContext<{
|
|
73
|
+
path?: string;
|
|
74
|
+
}>): Promise<AFSEntry | undefined>;
|
|
75
|
+
listHandler(ctx: RouteContext<{
|
|
76
|
+
path?: string;
|
|
77
|
+
}>): Promise<AFSListResult & {
|
|
78
|
+
noExpand?: string[];
|
|
79
|
+
}>;
|
|
80
|
+
readHandler(ctx: RouteContext<{
|
|
81
|
+
path?: string;
|
|
82
|
+
}>): Promise<AFSEntry | undefined>;
|
|
83
|
+
/**
|
|
84
|
+
* Write handler - supports writing content and/or metadata
|
|
85
|
+
*
|
|
86
|
+
* | payload | behavior |
|
|
87
|
+
* |---------|----------|
|
|
88
|
+
* | { content } | write content only |
|
|
89
|
+
* | { metadata } | write metadata only (to .afs storage) |
|
|
90
|
+
* | { content, metadata } | write both |
|
|
91
|
+
*/
|
|
92
|
+
writeHandler(ctx: RouteContext<{
|
|
93
|
+
path?: string;
|
|
94
|
+
}>, payload: AFSWriteEntryPayload): Promise<{
|
|
95
|
+
data: AFSEntry;
|
|
96
|
+
}>;
|
|
97
|
+
deleteHandler(ctx: RouteContext<{
|
|
98
|
+
path?: string;
|
|
99
|
+
}>): Promise<{
|
|
100
|
+
message: string;
|
|
101
|
+
}>;
|
|
102
|
+
renameHandler(ctx: RouteContext<{
|
|
103
|
+
path?: string;
|
|
104
|
+
}>, newPath: string): Promise<{
|
|
105
|
+
message: string;
|
|
106
|
+
}>;
|
|
107
|
+
searchHandler(ctx: RouteContext<{
|
|
108
|
+
path?: string;
|
|
109
|
+
}>, query: string, options?: AFSSearchOptions): Promise<{
|
|
110
|
+
data: AFSEntry[];
|
|
111
|
+
message?: string;
|
|
112
|
+
}>;
|
|
113
|
+
statHandler(ctx: RouteContext<{
|
|
114
|
+
path?: string;
|
|
115
|
+
}>): Promise<AFSStatResult>;
|
|
116
|
+
readCapabilitiesHandler(_ctx: RouteContext): Promise<AFSEntry | undefined>;
|
|
117
|
+
explainHandler(ctx: RouteContext<{
|
|
118
|
+
path?: string;
|
|
119
|
+
}>): Promise<AFSExplainResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Get a human-readable type description for a JSON value.
|
|
122
|
+
*/
|
|
123
|
+
private describeType;
|
|
124
|
+
/**
|
|
125
|
+
* Check if a key is a hidden meta key that should be filtered from listings
|
|
126
|
+
*/
|
|
127
|
+
private isMetaKey;
|
|
128
|
+
/**
|
|
129
|
+
* Load metadata for a node.
|
|
130
|
+
*
|
|
131
|
+
* Storage location depends on node type (mirrors FS provider's .afs structure):
|
|
132
|
+
* - Objects: `.afs.meta` key within the object itself
|
|
133
|
+
* - Primitives: parent's `.afs[".nodes"][key].meta`
|
|
134
|
+
*/
|
|
135
|
+
private loadMeta;
|
|
136
|
+
/**
|
|
137
|
+
* Save metadata for a node.
|
|
138
|
+
*
|
|
139
|
+
* Storage location depends on node type (mirrors FS provider's .afs structure):
|
|
140
|
+
* - Objects: `.afs.meta` key within the object itself
|
|
141
|
+
* - Primitives: parent's `.afs[".nodes"][key].meta`
|
|
142
|
+
*/
|
|
143
|
+
private saveMeta;
|
|
144
|
+
/**
|
|
145
|
+
* Load JSON/YAML data from file. Called lazily on first access.
|
|
146
|
+
* Uses YAML parser which can handle both JSON and YAML formats.
|
|
147
|
+
*/
|
|
76
148
|
private ensureLoaded;
|
|
77
149
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
150
|
+
* Save JSON/YAML data back to file. Only called in readwrite mode.
|
|
151
|
+
*/
|
|
80
152
|
private saveToFile;
|
|
81
153
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
private normalizePath;
|
|
85
|
-
/**
|
|
86
|
-
* Get path segments from normalized path
|
|
87
|
-
*/
|
|
154
|
+
* Get path segments from normalized path
|
|
155
|
+
*/
|
|
88
156
|
private getPathSegments;
|
|
89
157
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
158
|
+
* Navigate to a value in the JSON structure using path segments
|
|
159
|
+
*/
|
|
92
160
|
private getValueAtPath;
|
|
93
161
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
162
|
+
* Set a value in the JSON structure at the given path
|
|
163
|
+
*/
|
|
96
164
|
private setValueAtPath;
|
|
97
165
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
166
|
+
* Delete a value from the JSON structure at the given path
|
|
167
|
+
*/
|
|
100
168
|
private deleteValueAtPath;
|
|
101
169
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
private
|
|
170
|
+
* Check if a value is a "directory" (object or array with children)
|
|
171
|
+
*/
|
|
172
|
+
private isDirectoryValue;
|
|
105
173
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
174
|
+
* Get children of a directory value (filters out .afs meta key)
|
|
175
|
+
*/
|
|
108
176
|
private getChildren;
|
|
109
177
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
178
|
+
* Convert a JSON value to an AFSEntry
|
|
179
|
+
*/
|
|
112
180
|
private valueToAFSEntry;
|
|
113
|
-
list(path: string, options?: AFSListOptions): Promise<AFSListResult>;
|
|
114
|
-
read(path: string, _options?: AFSReadOptions): Promise<AFSReadResult>;
|
|
115
|
-
write(path: string, entry: AFSWriteEntryPayload, _options?: AFSWriteOptions): Promise<AFSWriteResult>;
|
|
116
|
-
delete(path: string, options?: AFSDeleteOptions): Promise<AFSDeleteResult>;
|
|
117
|
-
rename(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<AFSRenameResult>;
|
|
118
|
-
search(path: string, query: string, options?: AFSSearchOptions): Promise<AFSSearchResult>;
|
|
119
181
|
}
|
|
120
182
|
//#endregion
|
|
121
|
-
export { AFSJSON, AFSJSONOptions };
|
|
183
|
+
export { AFSJSON, AFSJSON as default, AFSJSONOptions };
|
|
122
184
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;UAkDiB,cAAA;EACf,IAAA;EACA,QAAA;EACA,WAAA;;;;;;;EAOA,UAAA,GAAa,aAAA;EAMb;;;AAuBF;;EAvBE,WAAA;AAAA;;;;;;;cAuBW,OAAA,SAAgB,eAAA;EAmCR,OAAA,EAAS,cAAA;IAAmB,GAAA;IAAc,SAAA;IAAoB,GAAA;EAAA;EAAA,OAlC1E,MAAA,CAAA,GAAM,CAAA,CAAA,OAAA;;;;;;;;;;;;;SAIN,QAAA,CAAA,GAAY,gBAAA;EAAA,O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IAAe,IAAA;EAAA,KAAmB,OAAA,CAAQ,gBAAA;EAvZ9C;;;EAAA,QAmgBd,YAAA;EA/bD;;;EAAA,QA8cC,SAAA;EA7cG;;;;;;;EAAA,QAwdH,QAAA;EA/WF;;;;;;;EAAA,QA+aE,QAAA;EA5aW;;;;EAAA,QAseL,YAAA;EAtb6C;;;EAAA,QAid7C,UAAA;EAtbQ;;;EAAA,QA6cd,eAAA;EA3cK;;;EAAA,QAodL,cAAA;EAlbN;;;EAAA,QA0cM,cAAA;EAvcL;;;EAAA,QAigBK,iBAAA;EA1cF;;;EAAA,QAqfE,gBAAA;EArfiD;;;EAAA,QA8fjD,WAAA;EA3dsB;;;EAAA,QA0etB,eAAA;AAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { AFSAccessMode, AFSEntry, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSSearchOptions, AFSStatResult, AFSWriteEntryPayload, ProviderManifest } from "@aigne/afs";
|
|
2
|
+
import { AFSBaseProvider, RouteContext } from "@aigne/afs/provider";
|
|
1
3
|
import { z } from "zod";
|
|
2
|
-
import { AFSAccessMode, AFSDeleteOptions, AFSDeleteResult, AFSListOptions, AFSListResult, AFSModule, AFSModuleLoadParams, AFSReadOptions, AFSReadResult, AFSRenameOptions, AFSRenameResult, AFSSearchOptions, AFSSearchResult, AFSWriteEntryPayload, AFSWriteOptions, AFSWriteResult } from "@aigne/afs";
|
|
3
4
|
|
|
4
5
|
//#region src/index.d.ts
|
|
5
6
|
interface AFSJSONOptions {
|
|
@@ -7,17 +8,17 @@ interface AFSJSONOptions {
|
|
|
7
8
|
jsonPath: string;
|
|
8
9
|
description?: string;
|
|
9
10
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
* Access mode for this module.
|
|
12
|
+
* - "readonly": Only read operations are allowed
|
|
13
|
+
* - "readwrite": All operations are allowed (default, unless agentSkills is enabled)
|
|
14
|
+
* @default "readwrite" (or "readonly" when agentSkills is true)
|
|
15
|
+
*/
|
|
15
16
|
accessMode?: AFSAccessMode;
|
|
16
17
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
* Enable automatic agent skill scanning for this module.
|
|
19
|
+
* When enabled, defaults accessMode to "readonly" if not explicitly set.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
21
22
|
agentSkills?: boolean;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
@@ -26,97 +27,158 @@ interface AFSJSONOptions {
|
|
|
26
27
|
* JSON/YAML objects are treated as directories, and properties/array items as files.
|
|
27
28
|
* Supports nested structures and path-based access to data values.
|
|
28
29
|
*/
|
|
29
|
-
declare class AFSJSON
|
|
30
|
+
declare class AFSJSON extends AFSBaseProvider {
|
|
30
31
|
options: AFSJSONOptions & {
|
|
31
32
|
cwd?: string;
|
|
33
|
+
localPath?: string;
|
|
34
|
+
uri?: string;
|
|
32
35
|
};
|
|
33
|
-
static schema(): z.
|
|
34
|
-
name:
|
|
35
|
-
jsonPath: z.ZodString;
|
|
36
|
-
description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
37
|
-
accessMode: z.ZodType<"readonly" | "readwrite" | undefined, z.ZodTypeDef, "readonly" | "readwrite" | undefined>;
|
|
38
|
-
agentSkills: z.ZodType<boolean | undefined, z.ZodTypeDef, boolean | undefined>;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
static schema(): z.ZodType<{
|
|
37
|
+
name: string | undefined;
|
|
40
38
|
jsonPath: string;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
description: string | undefined;
|
|
40
|
+
accessMode: "readonly" | "readwrite" | undefined;
|
|
41
|
+
agentSkills: boolean | undefined;
|
|
42
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
43
|
+
name: string | undefined;
|
|
46
44
|
jsonPath: string;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
jsonPath: string;
|
|
53
|
-
name?: string | undefined;
|
|
54
|
-
description?: string | undefined;
|
|
55
|
-
accessMode?: "readonly" | "readwrite" | undefined;
|
|
56
|
-
agentSkills?: boolean | undefined;
|
|
57
|
-
}, any>;
|
|
45
|
+
description: string | undefined;
|
|
46
|
+
accessMode: "readonly" | "readwrite" | undefined;
|
|
47
|
+
agentSkills: boolean | undefined;
|
|
48
|
+
}, unknown>>;
|
|
49
|
+
static manifest(): ProviderManifest;
|
|
58
50
|
static load({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
51
|
+
basePath,
|
|
52
|
+
config
|
|
53
|
+
}?: AFSModuleLoadParams): Promise<AFSJSON>;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly description?: string;
|
|
56
|
+
readonly accessMode: AFSAccessMode;
|
|
57
|
+
readonly agentSkills?: boolean;
|
|
62
58
|
private jsonData;
|
|
63
59
|
private fileStats;
|
|
64
60
|
private fileFormat;
|
|
61
|
+
private resolvedJsonPath;
|
|
65
62
|
constructor(options: AFSJSONOptions & {
|
|
66
63
|
cwd?: string;
|
|
64
|
+
localPath?: string;
|
|
65
|
+
uri?: string;
|
|
67
66
|
});
|
|
68
|
-
name: string;
|
|
69
|
-
description?: string;
|
|
70
|
-
accessMode: AFSAccessMode;
|
|
71
|
-
agentSkills?: boolean;
|
|
72
67
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
* Read metadata for a JSON node via /.meta or /path/.meta
|
|
69
|
+
* Returns stored metadata merged with computed type information
|
|
70
|
+
* Note: Meta is read-only. To write metadata, use write() with payload.meta.
|
|
71
|
+
*/
|
|
72
|
+
readMetaHandler(ctx: RouteContext<{
|
|
73
|
+
path?: string;
|
|
74
|
+
}>): Promise<AFSEntry | undefined>;
|
|
75
|
+
listHandler(ctx: RouteContext<{
|
|
76
|
+
path?: string;
|
|
77
|
+
}>): Promise<AFSListResult & {
|
|
78
|
+
noExpand?: string[];
|
|
79
|
+
}>;
|
|
80
|
+
readHandler(ctx: RouteContext<{
|
|
81
|
+
path?: string;
|
|
82
|
+
}>): Promise<AFSEntry | undefined>;
|
|
83
|
+
/**
|
|
84
|
+
* Write handler - supports writing content and/or metadata
|
|
85
|
+
*
|
|
86
|
+
* | payload | behavior |
|
|
87
|
+
* |---------|----------|
|
|
88
|
+
* | { content } | write content only |
|
|
89
|
+
* | { metadata } | write metadata only (to .afs storage) |
|
|
90
|
+
* | { content, metadata } | write both |
|
|
91
|
+
*/
|
|
92
|
+
writeHandler(ctx: RouteContext<{
|
|
93
|
+
path?: string;
|
|
94
|
+
}>, payload: AFSWriteEntryPayload): Promise<{
|
|
95
|
+
data: AFSEntry;
|
|
96
|
+
}>;
|
|
97
|
+
deleteHandler(ctx: RouteContext<{
|
|
98
|
+
path?: string;
|
|
99
|
+
}>): Promise<{
|
|
100
|
+
message: string;
|
|
101
|
+
}>;
|
|
102
|
+
renameHandler(ctx: RouteContext<{
|
|
103
|
+
path?: string;
|
|
104
|
+
}>, newPath: string): Promise<{
|
|
105
|
+
message: string;
|
|
106
|
+
}>;
|
|
107
|
+
searchHandler(ctx: RouteContext<{
|
|
108
|
+
path?: string;
|
|
109
|
+
}>, query: string, options?: AFSSearchOptions): Promise<{
|
|
110
|
+
data: AFSEntry[];
|
|
111
|
+
message?: string;
|
|
112
|
+
}>;
|
|
113
|
+
statHandler(ctx: RouteContext<{
|
|
114
|
+
path?: string;
|
|
115
|
+
}>): Promise<AFSStatResult>;
|
|
116
|
+
readCapabilitiesHandler(_ctx: RouteContext): Promise<AFSEntry | undefined>;
|
|
117
|
+
explainHandler(ctx: RouteContext<{
|
|
118
|
+
path?: string;
|
|
119
|
+
}>): Promise<AFSExplainResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Get a human-readable type description for a JSON value.
|
|
122
|
+
*/
|
|
123
|
+
private describeType;
|
|
124
|
+
/**
|
|
125
|
+
* Check if a key is a hidden meta key that should be filtered from listings
|
|
126
|
+
*/
|
|
127
|
+
private isMetaKey;
|
|
128
|
+
/**
|
|
129
|
+
* Load metadata for a node.
|
|
130
|
+
*
|
|
131
|
+
* Storage location depends on node type (mirrors FS provider's .afs structure):
|
|
132
|
+
* - Objects: `.afs.meta` key within the object itself
|
|
133
|
+
* - Primitives: parent's `.afs[".nodes"][key].meta`
|
|
134
|
+
*/
|
|
135
|
+
private loadMeta;
|
|
136
|
+
/**
|
|
137
|
+
* Save metadata for a node.
|
|
138
|
+
*
|
|
139
|
+
* Storage location depends on node type (mirrors FS provider's .afs structure):
|
|
140
|
+
* - Objects: `.afs.meta` key within the object itself
|
|
141
|
+
* - Primitives: parent's `.afs[".nodes"][key].meta`
|
|
142
|
+
*/
|
|
143
|
+
private saveMeta;
|
|
144
|
+
/**
|
|
145
|
+
* Load JSON/YAML data from file. Called lazily on first access.
|
|
146
|
+
* Uses YAML parser which can handle both JSON and YAML formats.
|
|
147
|
+
*/
|
|
76
148
|
private ensureLoaded;
|
|
77
149
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
150
|
+
* Save JSON/YAML data back to file. Only called in readwrite mode.
|
|
151
|
+
*/
|
|
80
152
|
private saveToFile;
|
|
81
153
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
private normalizePath;
|
|
85
|
-
/**
|
|
86
|
-
* Get path segments from normalized path
|
|
87
|
-
*/
|
|
154
|
+
* Get path segments from normalized path
|
|
155
|
+
*/
|
|
88
156
|
private getPathSegments;
|
|
89
157
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
158
|
+
* Navigate to a value in the JSON structure using path segments
|
|
159
|
+
*/
|
|
92
160
|
private getValueAtPath;
|
|
93
161
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
162
|
+
* Set a value in the JSON structure at the given path
|
|
163
|
+
*/
|
|
96
164
|
private setValueAtPath;
|
|
97
165
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
166
|
+
* Delete a value from the JSON structure at the given path
|
|
167
|
+
*/
|
|
100
168
|
private deleteValueAtPath;
|
|
101
169
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
private
|
|
170
|
+
* Check if a value is a "directory" (object or array with children)
|
|
171
|
+
*/
|
|
172
|
+
private isDirectoryValue;
|
|
105
173
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
174
|
+
* Get children of a directory value (filters out .afs meta key)
|
|
175
|
+
*/
|
|
108
176
|
private getChildren;
|
|
109
177
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
178
|
+
* Convert a JSON value to an AFSEntry
|
|
179
|
+
*/
|
|
112
180
|
private valueToAFSEntry;
|
|
113
|
-
list(path: string, options?: AFSListOptions): Promise<AFSListResult>;
|
|
114
|
-
read(path: string, _options?: AFSReadOptions): Promise<AFSReadResult>;
|
|
115
|
-
write(path: string, entry: AFSWriteEntryPayload, _options?: AFSWriteOptions): Promise<AFSWriteResult>;
|
|
116
|
-
delete(path: string, options?: AFSDeleteOptions): Promise<AFSDeleteResult>;
|
|
117
|
-
rename(oldPath: string, newPath: string, options?: AFSRenameOptions): Promise<AFSRenameResult>;
|
|
118
|
-
search(path: string, query: string, options?: AFSSearchOptions): Promise<AFSSearchResult>;
|
|
119
181
|
}
|
|
120
182
|
//#endregion
|
|
121
|
-
export { AFSJSON, AFSJSONOptions };
|
|
183
|
+
export { AFSJSON, AFSJSON as default, AFSJSONOptions };
|
|
122
184
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;UAkDiB,cAAA;EACf,IAAA;EACA,QAAA;EACA,WAAA;;;;;;;EAOA,UAAA,GAAa,aAAA;EAMb;;;AAuBF;;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