@aigne/afs 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 +4 -13
- package/dist/_virtual/rolldown_runtime.mjs +7 -0
- package/dist/afs.cjs +1330 -0
- package/dist/afs.d.cts +275 -0
- package/dist/afs.d.cts.map +1 -0
- package/dist/afs.d.mts +275 -0
- package/dist/afs.d.mts.map +1 -0
- package/dist/afs.mjs +1331 -0
- package/dist/afs.mjs.map +1 -0
- package/dist/capabilities/index.d.mts +2 -0
- package/dist/capabilities/types.d.cts +100 -0
- package/dist/capabilities/types.d.cts.map +1 -0
- package/dist/capabilities/types.d.mts +100 -0
- package/dist/capabilities/types.d.mts.map +1 -0
- package/dist/capabilities/world-mapping.cjs +20 -0
- package/dist/capabilities/world-mapping.d.cts +139 -0
- package/dist/capabilities/world-mapping.d.cts.map +1 -0
- package/dist/capabilities/world-mapping.d.mts +139 -0
- package/dist/capabilities/world-mapping.d.mts.map +1 -0
- package/dist/capabilities/world-mapping.mjs +20 -0
- package/dist/capabilities/world-mapping.mjs.map +1 -0
- package/dist/error.cjs +63 -0
- package/dist/error.d.cts +39 -0
- package/dist/error.d.cts.map +1 -0
- package/dist/error.d.mts +39 -0
- package/dist/error.d.mts.map +1 -0
- package/dist/error.mjs +59 -0
- package/dist/error.mjs.map +1 -0
- package/dist/index.cjs +72 -345
- package/dist/index.d.cts +18 -300
- package/dist/index.d.mts +20 -300
- package/dist/index.mjs +16 -342
- package/dist/loader/index.cjs +110 -0
- package/dist/loader/index.d.cts +48 -0
- package/dist/loader/index.d.cts.map +1 -0
- package/dist/loader/index.d.mts +48 -0
- package/dist/loader/index.d.mts.map +1 -0
- package/dist/loader/index.mjs +110 -0
- package/dist/loader/index.mjs.map +1 -0
- package/dist/meta/index.cjs +4 -0
- package/dist/meta/index.mjs +6 -0
- package/dist/meta/kind.cjs +161 -0
- package/dist/meta/kind.d.cts +134 -0
- package/dist/meta/kind.d.cts.map +1 -0
- package/dist/meta/kind.d.mts +134 -0
- package/dist/meta/kind.d.mts.map +1 -0
- package/dist/meta/kind.mjs +157 -0
- package/dist/meta/kind.mjs.map +1 -0
- package/dist/meta/path.cjs +116 -0
- package/dist/meta/path.d.cts +43 -0
- package/dist/meta/path.d.cts.map +1 -0
- package/dist/meta/path.d.mts +43 -0
- package/dist/meta/path.d.mts.map +1 -0
- package/dist/meta/path.mjs +112 -0
- package/dist/meta/path.mjs.map +1 -0
- package/dist/meta/type.d.cts +96 -0
- package/dist/meta/type.d.cts.map +1 -0
- package/dist/meta/type.d.mts +96 -0
- package/dist/meta/type.d.mts.map +1 -0
- package/dist/meta/validation.cjs +77 -0
- package/dist/meta/validation.d.cts +19 -0
- package/dist/meta/validation.d.cts.map +1 -0
- package/dist/meta/validation.d.mts +19 -0
- package/dist/meta/validation.d.mts.map +1 -0
- package/dist/meta/validation.mjs +77 -0
- package/dist/meta/validation.mjs.map +1 -0
- package/dist/meta/well-known-kinds.cjs +228 -0
- package/dist/meta/well-known-kinds.d.cts +52 -0
- package/dist/meta/well-known-kinds.d.cts.map +1 -0
- package/dist/meta/well-known-kinds.d.mts +52 -0
- package/dist/meta/well-known-kinds.d.mts.map +1 -0
- package/dist/meta/well-known-kinds.mjs +219 -0
- package/dist/meta/well-known-kinds.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.cts +141 -0
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.mts +141 -0
- package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.mts.map +1 -0
- package/dist/path.cjs +255 -0
- package/dist/path.d.cts +93 -0
- package/dist/path.d.cts.map +1 -0
- package/dist/path.d.mts +93 -0
- package/dist/path.d.mts.map +1 -0
- package/dist/path.mjs +249 -0
- package/dist/path.mjs.map +1 -0
- package/dist/provider/base.cjs +425 -0
- package/dist/provider/base.d.cts +175 -0
- package/dist/provider/base.d.cts.map +1 -0
- package/dist/provider/base.d.mts +175 -0
- package/dist/provider/base.d.mts.map +1 -0
- package/dist/provider/base.mjs +426 -0
- package/dist/provider/base.mjs.map +1 -0
- package/dist/provider/decorators.cjs +268 -0
- package/dist/provider/decorators.d.cts +244 -0
- package/dist/provider/decorators.d.cts.map +1 -0
- package/dist/provider/decorators.d.mts +244 -0
- package/dist/provider/decorators.d.mts.map +1 -0
- package/dist/provider/decorators.mjs +256 -0
- package/dist/provider/decorators.mjs.map +1 -0
- package/dist/provider/index.cjs +19 -0
- package/dist/provider/index.d.cts +5 -0
- package/dist/provider/index.d.mts +5 -0
- package/dist/provider/index.mjs +5 -0
- package/dist/provider/router.cjs +185 -0
- package/dist/provider/router.d.cts +50 -0
- package/dist/provider/router.d.cts.map +1 -0
- package/dist/provider/router.d.mts +50 -0
- package/dist/provider/router.d.mts.map +1 -0
- package/dist/provider/router.mjs +185 -0
- package/dist/provider/router.mjs.map +1 -0
- package/dist/provider/types.d.cts +113 -0
- package/dist/provider/types.d.cts.map +1 -0
- package/dist/provider/types.d.mts +113 -0
- package/dist/provider/types.d.mts.map +1 -0
- package/dist/registry.cjs +358 -0
- package/dist/registry.d.cts +96 -0
- package/dist/registry.d.cts.map +1 -0
- package/dist/registry.d.mts +96 -0
- package/dist/registry.d.mts.map +1 -0
- package/dist/registry.mjs +360 -0
- package/dist/registry.mjs.map +1 -0
- package/dist/type.cjs +34 -0
- package/dist/type.d.cts +420 -0
- package/dist/type.d.cts.map +1 -0
- package/dist/type.d.mts +420 -0
- package/dist/type.d.mts.map +1 -0
- package/dist/type.mjs +33 -0
- package/dist/type.mjs.map +1 -0
- package/dist/utils/camelize.d.cts.map +1 -1
- package/dist/utils/camelize.d.mts.map +1 -1
- package/dist/utils/schema.cjs +129 -0
- package/dist/utils/schema.d.cts +65 -0
- package/dist/utils/schema.d.cts.map +1 -0
- package/dist/utils/schema.d.mts +65 -0
- package/dist/utils/schema.d.mts.map +1 -0
- package/dist/utils/schema.mjs +124 -0
- package/dist/utils/schema.mjs.map +1 -0
- package/dist/utils/type-utils.d.cts.map +1 -1
- package/dist/utils/type-utils.d.mts.map +1 -1
- package/dist/utils/uri-template.cjs +123 -0
- package/dist/utils/uri-template.d.cts +48 -0
- package/dist/utils/uri-template.d.cts.map +1 -0
- package/dist/utils/uri-template.d.mts +48 -0
- package/dist/utils/uri-template.d.mts.map +1 -0
- package/dist/utils/uri-template.mjs +120 -0
- package/dist/utils/uri-template.mjs.map +1 -0
- package/dist/utils/uri.cjs +49 -0
- package/dist/utils/uri.d.cts +34 -0
- package/dist/utils/uri.d.cts.map +1 -0
- package/dist/utils/uri.d.mts +34 -0
- package/dist/utils/uri.d.mts.map +1 -0
- package/dist/utils/uri.mjs +49 -0
- package/dist/utils/uri.mjs.map +1 -0
- package/dist/utils/zod.cjs +6 -8
- package/dist/utils/zod.d.cts +2 -2
- package/dist/utils/zod.d.cts.map +1 -1
- package/dist/utils/zod.d.mts +2 -2
- package/dist/utils/zod.d.mts.map +1 -1
- package/dist/utils/zod.mjs +6 -8
- package/dist/utils/zod.mjs.map +1 -1
- package/package.json +27 -4
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { ListDecoratorOptions, RouteMetadata } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/provider/decorators.d.ts
|
|
4
|
+
type Constructor = Function;
|
|
5
|
+
/**
|
|
6
|
+
* Get all registered routes for a class (including inherited routes)
|
|
7
|
+
*/
|
|
8
|
+
declare function getRoutes(ctor: Constructor): RouteMetadata[];
|
|
9
|
+
/**
|
|
10
|
+
* Clear routes for a class (mainly for testing)
|
|
11
|
+
*/
|
|
12
|
+
declare function clearRoutes(ctor: Constructor): void;
|
|
13
|
+
/**
|
|
14
|
+
* @List decorator - handles list operations
|
|
15
|
+
* Handler should return: { data: AFSEntry[], total?: number }
|
|
16
|
+
*
|
|
17
|
+
* @param pattern - Route pattern to match
|
|
18
|
+
* @param optionsOrDescription - Either a description string or ListDecoratorOptions
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Simple usage
|
|
23
|
+
* @List("/:table")
|
|
24
|
+
* async listRows(ctx: RouteContext<{ table: string }>) {
|
|
25
|
+
* return { data: rows, total: 100 };
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* // Default behavior - base provider handles depth via BFS
|
|
29
|
+
* @List("/**")
|
|
30
|
+
* async listDir(ctx: RouteContext) {
|
|
31
|
+
* // Only need to return single-level results
|
|
32
|
+
* return { data: entries };
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // Handler manages depth itself (opt-in for special cases like S3)
|
|
36
|
+
* @List("/**", { handleDepth: true })
|
|
37
|
+
* async listDirWithDepth(ctx: RouteContext) {
|
|
38
|
+
* // Handler implements maxDepth logic
|
|
39
|
+
* return { data: entries };
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare function List(pattern: string, optionsOrDescription?: string | ListDecoratorOptions): MethodDecorator;
|
|
44
|
+
/**
|
|
45
|
+
* @Read decorator - handles read operations
|
|
46
|
+
* Handler should return: AFSEntry
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* @Read("/:table/:pk")
|
|
51
|
+
* async getRow(ctx: RouteContext<{ table: string; pk: string }>) {
|
|
52
|
+
* return { id: pk, path: ctx.path, content: row };
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare const Read: (pattern: string, description?: string) => MethodDecorator;
|
|
57
|
+
/**
|
|
58
|
+
* @Write decorator - handles write operations
|
|
59
|
+
* Handler should return: AFSWriteResult
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* @Write("/:table/:pk")
|
|
64
|
+
* async updateRow(ctx: RouteContext, content: AFSWriteEntryPayload) {
|
|
65
|
+
* return { data: updatedEntry };
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare const Write: (pattern: string, description?: string) => MethodDecorator;
|
|
70
|
+
/**
|
|
71
|
+
* @Delete decorator - handles delete operations
|
|
72
|
+
* Handler should return: AFSDeleteResult
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* @Delete("/:table/:pk")
|
|
77
|
+
* async deleteRow(ctx: RouteContext<{ table: string; pk: string }>) {
|
|
78
|
+
* return { message: "Deleted" };
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare const Delete: (pattern: string, description?: string) => MethodDecorator;
|
|
83
|
+
/**
|
|
84
|
+
* @Exec decorator - handles exec operations
|
|
85
|
+
* Handler should return: AFSExecResult
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* @Exec("/:table/:pk/.actions/:action")
|
|
90
|
+
* async executeAction(ctx: RouteContext, args: Record<string, unknown>) {
|
|
91
|
+
* return { data: { success: true } };
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
declare const Exec: (pattern: string, description?: string) => MethodDecorator;
|
|
96
|
+
/**
|
|
97
|
+
* @Search decorator - handles search operations
|
|
98
|
+
* Handler should return: AFSSearchResult
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* @Search("/:table")
|
|
103
|
+
* async searchTable(ctx: RouteContext, query: string, options?: AFSSearchOptions) {
|
|
104
|
+
* return { data: matchingEntries };
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
declare const Search: (pattern: string, description?: string) => MethodDecorator;
|
|
109
|
+
/**
|
|
110
|
+
* @Meta decorator - handles .meta path reads (introspection only, read-only)
|
|
111
|
+
* Automatically appends /.meta to the pattern
|
|
112
|
+
* Handler should return: AFSEntry
|
|
113
|
+
*
|
|
114
|
+
* Note: Meta is read-only. To write metadata, use @Write handler with payload.meta.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* @Meta("/:table/:pk") // Registers as /:table/:pk/.meta
|
|
119
|
+
* async getRowMeta(ctx: RouteContext<{ table: string; pk: string }>) {
|
|
120
|
+
* return { id: "meta", path: `${ctx.path}/.meta`, content: schema };
|
|
121
|
+
* }
|
|
122
|
+
*
|
|
123
|
+
* @Meta("/") // Registers as /.meta (root metadata)
|
|
124
|
+
* async getRootMeta(ctx: RouteContext) {
|
|
125
|
+
* return { id: "meta", path: "/.meta", content: rootSchema };
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare function Meta(pattern: string, description?: string): MethodDecorator;
|
|
130
|
+
/**
|
|
131
|
+
* Actions decorator interface - callable function with Execute method
|
|
132
|
+
*/
|
|
133
|
+
interface ActionsDecorator {
|
|
134
|
+
/**
|
|
135
|
+
* @Actions decorator - handles .actions path listing
|
|
136
|
+
* Automatically appends /.actions to the pattern
|
|
137
|
+
* Handler should return: { data: AFSEntry[] }
|
|
138
|
+
*
|
|
139
|
+
* @param pattern - Base path pattern for the node
|
|
140
|
+
* @param description - Optional description for the route
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* @Actions("/:table/:pk") // Registers as /:table/:pk/.actions
|
|
145
|
+
* async listRowActions(ctx: RouteContext<{ table: string; pk: string }>) {
|
|
146
|
+
* return { data: availableActions };
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
(pattern: string, description?: string): MethodDecorator;
|
|
151
|
+
/**
|
|
152
|
+
* @Actions.Exec decorator - handles action execution on nodes
|
|
153
|
+
* Automatically constructs the full .actions path for action execution.
|
|
154
|
+
* Handler should return: AFSExecResult
|
|
155
|
+
*
|
|
156
|
+
* @param pattern - Base path pattern for the node (e.g., "/issues/:number")
|
|
157
|
+
* @param actionName - Optional specific action name. If omitted, registers catch-all pattern.
|
|
158
|
+
* @param description - Optional description for the route
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* // Specific action - registers as /issues/:number/.actions/close
|
|
163
|
+
* @Actions.Exec("/issues/:number", "close")
|
|
164
|
+
* async closeIssue(ctx: RouteContext<{ number: string }>, args: Record<string, unknown>) {
|
|
165
|
+
* return { data: { success: true } };
|
|
166
|
+
* }
|
|
167
|
+
*
|
|
168
|
+
* // Catch-all action - registers as /issues/:number/.actions/:action
|
|
169
|
+
* @Actions.Exec("/issues/:number")
|
|
170
|
+
* async handleIssueAction(ctx: RouteContext<{ number: string; action: string }>, args: Record<string, unknown>) {
|
|
171
|
+
* return { data: { action: ctx.params.action } };
|
|
172
|
+
* }
|
|
173
|
+
*
|
|
174
|
+
* // Root-level action - registers as /.actions/refresh
|
|
175
|
+
* @Actions.Exec("/", "refresh")
|
|
176
|
+
* async refreshAll(ctx: RouteContext, args: Record<string, unknown>) {
|
|
177
|
+
* return { data: { refreshed: true } };
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
Exec: (pattern: string, actionName?: string, description?: string) => MethodDecorator;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* @Actions decorator - handles action-related routes
|
|
185
|
+
*
|
|
186
|
+
* Use directly for listing actions:
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* @Actions("/:table/:pk") // Registers as /:table/:pk/.actions
|
|
190
|
+
* async listRowActions(ctx: RouteContext<{ table: string; pk: string }>) {
|
|
191
|
+
* return { data: availableActions };
|
|
192
|
+
* }
|
|
193
|
+
* ```
|
|
194
|
+
*
|
|
195
|
+
* Use Actions.Exec for action execution:
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* @Actions.Exec("/:table/:pk", "close")
|
|
199
|
+
* async closeAction(ctx: RouteContext, args: Record<string, unknown>) { ... }
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
declare const Actions: ActionsDecorator;
|
|
203
|
+
/**
|
|
204
|
+
* @Stat decorator - handles stat operations
|
|
205
|
+
* Handler should return: AFSStatResult
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* @Stat("/:path*")
|
|
210
|
+
* async statPath(ctx: RouteContext<{ path?: string }>) {
|
|
211
|
+
* return { data: { path: ctx.path, size: 100, modified: new Date() } };
|
|
212
|
+
* }
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
declare const Stat: (pattern: string, description?: string) => MethodDecorator;
|
|
216
|
+
/**
|
|
217
|
+
* @Explain decorator - handles explain operations
|
|
218
|
+
* Handler should return: AFSExplainResult
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* @Explain("/:path*")
|
|
223
|
+
* async explainPath(ctx: RouteContext<{ path?: string }>) {
|
|
224
|
+
* return { data: { content: "...", format: "markdown" } };
|
|
225
|
+
* }
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
declare const Explain: (pattern: string, description?: string) => MethodDecorator;
|
|
229
|
+
/**
|
|
230
|
+
* @Rename decorator - handles rename operations
|
|
231
|
+
* Handler should return: AFSRenameResult
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* @Rename("/:path*")
|
|
236
|
+
* async renamePath(ctx: RouteContext<{ path?: string }>, newPath: string) {
|
|
237
|
+
* return { message: "Renamed successfully" };
|
|
238
|
+
* }
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
declare const Rename: (pattern: string, description?: string) => MethodDecorator;
|
|
242
|
+
//#endregion
|
|
243
|
+
export { Actions, Delete, Exec, Explain, List, Meta, Read, Rename, Search, Stat, Write, clearRoutes, getRoutes };
|
|
244
|
+
//# sourceMappingURL=decorators.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.mts","names":[],"sources":["../../src/provider/decorators.ts"],"mappings":";;;KAGK,WAAA,GAAc,QAAA;;AAHmE;;iBAetE,SAAA,CAAU,IAAA,EAAM,WAAA,GAAc,aAAA;;;AAA9C;iBAoBgB,WAAA,CAAY,IAAA,EAAM,WAAA;;;;;;;;AAAlC;;;;;AA6DA;;;;;;;;;;AAwBA;;;;;;;;iBAxBgB,IAAA,CACd,OAAA,UACA,oBAAA,YAAgC,oBAAA,GAC/B,eAAA;AAmCH;;;;;;;;;AAcA;;;AAdA,cAda,IAAA,GAAI,OAAA,UA7DQ,WAAA,cAAyB,eAAA;;;;;;AAuGlD;;;;;;;cA5Ba,KAAA,GAAK,OAAA,UA3EO,WAAA,cAAyB,eAAA;;AAqHlD;;;;;;;;;AAsBA;;cAlDa,MAAA,GAAM,OAAA,UAzFM,WAAA,cAAyB,eAAA;;;;;;;AA+IjD;;;;;;cAxCY,IAAA,GAAI,OAAA,UAvGQ,WAAA,cAAyB,eAAA;;;;;;;;AAkPlD;;;;;cA7Ha,MAAA,GAAM,OAAA,UArHM,WAAA,cAAyB,eAAA;;;;;;;;;AAuRlD;;;;;;;;;AAcA;;;iBA1JgB,IAAA,CAAK,OAAA,UAAiB,WAAA,YAAuB,eAAA;;;;UAgCnD,gBAAA;EA0H0C;;;;;;;;;;;;;;;;EAAA,CAzGjD,OAAA,UAAiB,WAAA,YAAuB,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCzC,IAAA,GAAO,OAAA,UAAiB,UAAA,WAAqB,WAAA,cAAyB,eAAA;AAAA;;;;;;;;;;;;;;;;;;;;cAsB3D,OAAA,EAAS,gBAAA;;;;;;;;;;;;;cAuBT,IAAA,GAAI,OAAA,UAzQQ,WAAA,cAAyB,eAAA;;;;;;;;;;;;;cAuRrC,OAAA,GAAO,OAAA,UAvRK,WAAA,cAAyB,eAAA;;;;;;;;;;;;;cAqSrC,MAAA,GAAM,OAAA,UArSM,WAAA,cAAyB,eAAA"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
//#region src/provider/decorators.ts
|
|
2
|
+
/**
|
|
3
|
+
* WeakMap-based route registry
|
|
4
|
+
* Using WeakMap to avoid memory leaks - when class is garbage collected,
|
|
5
|
+
* its routes are automatically cleaned up
|
|
6
|
+
*/
|
|
7
|
+
const routeRegistry = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
/**
|
|
9
|
+
* Get all registered routes for a class (including inherited routes)
|
|
10
|
+
*/
|
|
11
|
+
function getRoutes(ctor) {
|
|
12
|
+
const routes = [];
|
|
13
|
+
let current = ctor;
|
|
14
|
+
while (current && current !== Function.prototype && current !== Object) {
|
|
15
|
+
const classRoutes = routeRegistry.get(current);
|
|
16
|
+
if (classRoutes) routes.unshift(...classRoutes);
|
|
17
|
+
current = Object.getPrototypeOf(current);
|
|
18
|
+
}
|
|
19
|
+
return routes;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Clear routes for a class (mainly for testing)
|
|
23
|
+
*/
|
|
24
|
+
function clearRoutes(ctor) {
|
|
25
|
+
routeRegistry.delete(ctor);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Register a route on a class
|
|
29
|
+
*/
|
|
30
|
+
function registerRoute(ctor, pattern, operation, methodName, description, listOptions) {
|
|
31
|
+
const routes = routeRegistry.get(ctor) || [];
|
|
32
|
+
routes.push({
|
|
33
|
+
pattern,
|
|
34
|
+
operation,
|
|
35
|
+
methodName,
|
|
36
|
+
description,
|
|
37
|
+
listOptions
|
|
38
|
+
});
|
|
39
|
+
routeRegistry.set(ctor, routes);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create a route decorator for a specific operation
|
|
43
|
+
*/
|
|
44
|
+
function createRouteDecorator(operation) {
|
|
45
|
+
return (pattern, description) => (target, propertyKey) => {
|
|
46
|
+
const ctor = target.constructor;
|
|
47
|
+
registerRoute(ctor, pattern, operation, String(propertyKey), description);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @List decorator - handles list operations
|
|
52
|
+
* Handler should return: { data: AFSEntry[], total?: number }
|
|
53
|
+
*
|
|
54
|
+
* @param pattern - Route pattern to match
|
|
55
|
+
* @param optionsOrDescription - Either a description string or ListDecoratorOptions
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // Simple usage
|
|
60
|
+
* @List("/:table")
|
|
61
|
+
* async listRows(ctx: RouteContext<{ table: string }>) {
|
|
62
|
+
* return { data: rows, total: 100 };
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* // Default behavior - base provider handles depth via BFS
|
|
66
|
+
* @List("/**")
|
|
67
|
+
* async listDir(ctx: RouteContext) {
|
|
68
|
+
* // Only need to return single-level results
|
|
69
|
+
* return { data: entries };
|
|
70
|
+
* }
|
|
71
|
+
*
|
|
72
|
+
* // Handler manages depth itself (opt-in for special cases like S3)
|
|
73
|
+
* @List("/**", { handleDepth: true })
|
|
74
|
+
* async listDirWithDepth(ctx: RouteContext) {
|
|
75
|
+
* // Handler implements maxDepth logic
|
|
76
|
+
* return { data: entries };
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
function List(pattern, optionsOrDescription) {
|
|
81
|
+
return (target, propertyKey) => {
|
|
82
|
+
const ctor = target.constructor;
|
|
83
|
+
const description = typeof optionsOrDescription === "string" ? optionsOrDescription : void 0;
|
|
84
|
+
const listOptions = typeof optionsOrDescription === "object" ? optionsOrDescription : void 0;
|
|
85
|
+
registerRoute(ctor, pattern, "list", String(propertyKey), description, listOptions);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @Read decorator - handles read operations
|
|
90
|
+
* Handler should return: AFSEntry
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* @Read("/:table/:pk")
|
|
95
|
+
* async getRow(ctx: RouteContext<{ table: string; pk: string }>) {
|
|
96
|
+
* return { id: pk, path: ctx.path, content: row };
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
const Read = createRouteDecorator("read");
|
|
101
|
+
/**
|
|
102
|
+
* @Write decorator - handles write operations
|
|
103
|
+
* Handler should return: AFSWriteResult
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* @Write("/:table/:pk")
|
|
108
|
+
* async updateRow(ctx: RouteContext, content: AFSWriteEntryPayload) {
|
|
109
|
+
* return { data: updatedEntry };
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
const Write = createRouteDecorator("write");
|
|
114
|
+
/**
|
|
115
|
+
* @Delete decorator - handles delete operations
|
|
116
|
+
* Handler should return: AFSDeleteResult
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* @Delete("/:table/:pk")
|
|
121
|
+
* async deleteRow(ctx: RouteContext<{ table: string; pk: string }>) {
|
|
122
|
+
* return { message: "Deleted" };
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
const Delete = createRouteDecorator("delete");
|
|
127
|
+
/**
|
|
128
|
+
* @Exec decorator - handles exec operations
|
|
129
|
+
* Handler should return: AFSExecResult
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* @Exec("/:table/:pk/.actions/:action")
|
|
134
|
+
* async executeAction(ctx: RouteContext, args: Record<string, unknown>) {
|
|
135
|
+
* return { data: { success: true } };
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
const Exec = createRouteDecorator("exec");
|
|
140
|
+
/**
|
|
141
|
+
* @Search decorator - handles search operations
|
|
142
|
+
* Handler should return: AFSSearchResult
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* @Search("/:table")
|
|
147
|
+
* async searchTable(ctx: RouteContext, query: string, options?: AFSSearchOptions) {
|
|
148
|
+
* return { data: matchingEntries };
|
|
149
|
+
* }
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
const Search = createRouteDecorator("search");
|
|
153
|
+
/**
|
|
154
|
+
* @Meta decorator - handles .meta path reads (introspection only, read-only)
|
|
155
|
+
* Automatically appends /.meta to the pattern
|
|
156
|
+
* Handler should return: AFSEntry
|
|
157
|
+
*
|
|
158
|
+
* Note: Meta is read-only. To write metadata, use @Write handler with payload.meta.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* @Meta("/:table/:pk") // Registers as /:table/:pk/.meta
|
|
163
|
+
* async getRowMeta(ctx: RouteContext<{ table: string; pk: string }>) {
|
|
164
|
+
* return { id: "meta", path: `${ctx.path}/.meta`, content: schema };
|
|
165
|
+
* }
|
|
166
|
+
*
|
|
167
|
+
* @Meta("/") // Registers as /.meta (root metadata)
|
|
168
|
+
* async getRootMeta(ctx: RouteContext) {
|
|
169
|
+
* return { id: "meta", path: "/.meta", content: rootSchema };
|
|
170
|
+
* }
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
function Meta(pattern, description) {
|
|
174
|
+
const metaPattern = pattern === "/" ? "/.meta" : `${pattern}/.meta`;
|
|
175
|
+
return createRouteDecorator("read")(metaPattern, description);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Creates a list decorator for .actions path
|
|
179
|
+
*/
|
|
180
|
+
function createActionsListDecorator(pattern, description) {
|
|
181
|
+
const actionsPattern = pattern === "/" ? "/.actions" : `${pattern}/.actions`;
|
|
182
|
+
return createRouteDecorator("list")(actionsPattern, description);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Creates an exec decorator for action execution
|
|
186
|
+
*/
|
|
187
|
+
function createActionsExecuteDecorator(pattern, actionName, description) {
|
|
188
|
+
const basePath = pattern === "/" ? "" : pattern;
|
|
189
|
+
const fullPattern = actionName ? `${basePath}/.actions/${actionName}` : `${basePath}/.actions/:action`;
|
|
190
|
+
return createRouteDecorator("exec")(fullPattern, description);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @Actions decorator - handles action-related routes
|
|
194
|
+
*
|
|
195
|
+
* Use directly for listing actions:
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* @Actions("/:table/:pk") // Registers as /:table/:pk/.actions
|
|
199
|
+
* async listRowActions(ctx: RouteContext<{ table: string; pk: string }>) {
|
|
200
|
+
* return { data: availableActions };
|
|
201
|
+
* }
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* Use Actions.Exec for action execution:
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* @Actions.Exec("/:table/:pk", "close")
|
|
208
|
+
* async closeAction(ctx: RouteContext, args: Record<string, unknown>) { ... }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
const Actions = Object.assign((pattern, description) => {
|
|
212
|
+
return createActionsListDecorator(pattern, description);
|
|
213
|
+
}, { Exec: createActionsExecuteDecorator });
|
|
214
|
+
/**
|
|
215
|
+
* @Stat decorator - handles stat operations
|
|
216
|
+
* Handler should return: AFSStatResult
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* @Stat("/:path*")
|
|
221
|
+
* async statPath(ctx: RouteContext<{ path?: string }>) {
|
|
222
|
+
* return { data: { path: ctx.path, size: 100, modified: new Date() } };
|
|
223
|
+
* }
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
const Stat = createRouteDecorator("stat");
|
|
227
|
+
/**
|
|
228
|
+
* @Explain decorator - handles explain operations
|
|
229
|
+
* Handler should return: AFSExplainResult
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* @Explain("/:path*")
|
|
234
|
+
* async explainPath(ctx: RouteContext<{ path?: string }>) {
|
|
235
|
+
* return { data: { content: "...", format: "markdown" } };
|
|
236
|
+
* }
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
const Explain = createRouteDecorator("explain");
|
|
240
|
+
/**
|
|
241
|
+
* @Rename decorator - handles rename operations
|
|
242
|
+
* Handler should return: AFSRenameResult
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* @Rename("/:path*")
|
|
247
|
+
* async renamePath(ctx: RouteContext<{ path?: string }>, newPath: string) {
|
|
248
|
+
* return { message: "Renamed successfully" };
|
|
249
|
+
* }
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
const Rename = createRouteDecorator("rename");
|
|
253
|
+
|
|
254
|
+
//#endregion
|
|
255
|
+
export { Actions, Delete, Exec, Explain, List, Meta, Read, Rename, Search, Stat, Write, clearRoutes, getRoutes };
|
|
256
|
+
//# sourceMappingURL=decorators.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.mjs","names":[],"sources":["../../src/provider/decorators.ts"],"sourcesContent":["import type { ListDecoratorOptions, RouteMetadata, RouteOperation } from \"./types.js\";\n\n// biome-ignore lint/complexity/noBannedTypes: WeakMap requires object key type, Function is appropriate for class constructors\ntype Constructor = Function;\n\n/**\n * WeakMap-based route registry\n * Using WeakMap to avoid memory leaks - when class is garbage collected,\n * its routes are automatically cleaned up\n */\nconst routeRegistry = new WeakMap<Constructor, RouteMetadata[]>();\n\n/**\n * Get all registered routes for a class (including inherited routes)\n */\nexport function getRoutes(ctor: Constructor): RouteMetadata[] {\n const routes: RouteMetadata[] = [];\n\n // Walk up the prototype chain to collect routes from parent classes\n let current: Constructor | null = ctor;\n while (current && current !== Function.prototype && current !== Object) {\n const classRoutes = routeRegistry.get(current);\n if (classRoutes) {\n // Prepend parent routes so child routes can override\n routes.unshift(...classRoutes);\n }\n current = Object.getPrototypeOf(current);\n }\n\n return routes;\n}\n\n/**\n * Clear routes for a class (mainly for testing)\n */\nexport function clearRoutes(ctor: Constructor): void {\n routeRegistry.delete(ctor);\n}\n\n/**\n * Register a route on a class\n */\nfunction registerRoute(\n ctor: Constructor,\n pattern: string,\n operation: RouteOperation,\n methodName: string,\n description?: string,\n listOptions?: ListDecoratorOptions,\n): void {\n const routes = routeRegistry.get(ctor) || [];\n routes.push({ pattern, operation, methodName, description, listOptions });\n routeRegistry.set(ctor, routes);\n}\n\n/**\n * Create a route decorator for a specific operation\n */\nfunction createRouteDecorator(operation: RouteOperation) {\n return (pattern: string, description?: string): MethodDecorator =>\n (target: object, propertyKey: string | symbol): void => {\n const ctor = target.constructor;\n registerRoute(ctor, pattern, operation, String(propertyKey), description);\n };\n}\n\n/**\n * @List decorator - handles list operations\n * Handler should return: { data: AFSEntry[], total?: number }\n *\n * @param pattern - Route pattern to match\n * @param optionsOrDescription - Either a description string or ListDecoratorOptions\n *\n * @example\n * ```typescript\n * // Simple usage\n * @List(\"/:table\")\n * async listRows(ctx: RouteContext<{ table: string }>) {\n * return { data: rows, total: 100 };\n * }\n *\n * // Default behavior - base provider handles depth via BFS\n * @List(\"/**\")\n * async listDir(ctx: RouteContext) {\n * // Only need to return single-level results\n * return { data: entries };\n * }\n *\n * // Handler manages depth itself (opt-in for special cases like S3)\n * @List(\"/**\", { handleDepth: true })\n * async listDirWithDepth(ctx: RouteContext) {\n * // Handler implements maxDepth logic\n * return { data: entries };\n * }\n * ```\n */\nexport function List(\n pattern: string,\n optionsOrDescription?: string | ListDecoratorOptions,\n): MethodDecorator {\n return (target: object, propertyKey: string | symbol): void => {\n const ctor = target.constructor;\n const description = typeof optionsOrDescription === \"string\" ? optionsOrDescription : undefined;\n const listOptions = typeof optionsOrDescription === \"object\" ? optionsOrDescription : undefined;\n registerRoute(ctor, pattern, \"list\", String(propertyKey), description, listOptions);\n };\n}\n\n/**\n * @Read decorator - handles read operations\n * Handler should return: AFSEntry\n *\n * @example\n * ```typescript\n * @Read(\"/:table/:pk\")\n * async getRow(ctx: RouteContext<{ table: string; pk: string }>) {\n * return { id: pk, path: ctx.path, content: row };\n * }\n * ```\n */\nexport const Read = createRouteDecorator(\"read\");\n\n/**\n * @Write decorator - handles write operations\n * Handler should return: AFSWriteResult\n *\n * @example\n * ```typescript\n * @Write(\"/:table/:pk\")\n * async updateRow(ctx: RouteContext, content: AFSWriteEntryPayload) {\n * return { data: updatedEntry };\n * }\n * ```\n */\nexport const Write = createRouteDecorator(\"write\");\n\n/**\n * @Delete decorator - handles delete operations\n * Handler should return: AFSDeleteResult\n *\n * @example\n * ```typescript\n * @Delete(\"/:table/:pk\")\n * async deleteRow(ctx: RouteContext<{ table: string; pk: string }>) {\n * return { message: \"Deleted\" };\n * }\n * ```\n */\nexport const Delete = createRouteDecorator(\"delete\");\n\n/**\n * @Exec decorator - handles exec operations\n * Handler should return: AFSExecResult\n *\n * @example\n * ```typescript\n * @Exec(\"/:table/:pk/.actions/:action\")\n * async executeAction(ctx: RouteContext, args: Record<string, unknown>) {\n * return { data: { success: true } };\n * }\n * ```\n */\nexport const Exec = createRouteDecorator(\"exec\");\n\n/**\n * @Search decorator - handles search operations\n * Handler should return: AFSSearchResult\n *\n * @example\n * ```typescript\n * @Search(\"/:table\")\n * async searchTable(ctx: RouteContext, query: string, options?: AFSSearchOptions) {\n * return { data: matchingEntries };\n * }\n * ```\n */\nexport const Search = createRouteDecorator(\"search\");\n\n/**\n * @Meta decorator - handles .meta path reads (introspection only, read-only)\n * Automatically appends /.meta to the pattern\n * Handler should return: AFSEntry\n *\n * Note: Meta is read-only. To write metadata, use @Write handler with payload.meta.\n *\n * @example\n * ```typescript\n * @Meta(\"/:table/:pk\") // Registers as /:table/:pk/.meta\n * async getRowMeta(ctx: RouteContext<{ table: string; pk: string }>) {\n * return { id: \"meta\", path: `${ctx.path}/.meta`, content: schema };\n * }\n *\n * @Meta(\"/\") // Registers as /.meta (root metadata)\n * async getRootMeta(ctx: RouteContext) {\n * return { id: \"meta\", path: \"/.meta\", content: rootSchema };\n * }\n * ```\n */\nexport function Meta(pattern: string, description?: string): MethodDecorator {\n // Handle root pattern specially to avoid double slash\n const metaPattern = pattern === \"/\" ? \"/.meta\" : `${pattern}/.meta`;\n return createRouteDecorator(\"read\")(metaPattern, description);\n}\n\n/**\n * Creates a list decorator for .actions path\n */\nfunction createActionsListDecorator(pattern: string, description?: string): MethodDecorator {\n const actionsPattern = pattern === \"/\" ? \"/.actions\" : `${pattern}/.actions`;\n return createRouteDecorator(\"list\")(actionsPattern, description);\n}\n\n/**\n * Creates an exec decorator for action execution\n */\nfunction createActionsExecuteDecorator(\n pattern: string,\n actionName?: string,\n description?: string,\n): MethodDecorator {\n const basePath = pattern === \"/\" ? \"\" : pattern;\n const fullPattern = actionName\n ? `${basePath}/.actions/${actionName}`\n : `${basePath}/.actions/:action`;\n return createRouteDecorator(\"exec\")(fullPattern, description);\n}\n\n/**\n * Actions decorator interface - callable function with Execute method\n */\ninterface ActionsDecorator {\n /**\n * @Actions decorator - handles .actions path listing\n * Automatically appends /.actions to the pattern\n * Handler should return: { data: AFSEntry[] }\n *\n * @param pattern - Base path pattern for the node\n * @param description - Optional description for the route\n *\n * @example\n * ```typescript\n * @Actions(\"/:table/:pk\") // Registers as /:table/:pk/.actions\n * async listRowActions(ctx: RouteContext<{ table: string; pk: string }>) {\n * return { data: availableActions };\n * }\n * ```\n */\n (pattern: string, description?: string): MethodDecorator;\n\n /**\n * @Actions.Exec decorator - handles action execution on nodes\n * Automatically constructs the full .actions path for action execution.\n * Handler should return: AFSExecResult\n *\n * @param pattern - Base path pattern for the node (e.g., \"/issues/:number\")\n * @param actionName - Optional specific action name. If omitted, registers catch-all pattern.\n * @param description - Optional description for the route\n *\n * @example\n * ```typescript\n * // Specific action - registers as /issues/:number/.actions/close\n * @Actions.Exec(\"/issues/:number\", \"close\")\n * async closeIssue(ctx: RouteContext<{ number: string }>, args: Record<string, unknown>) {\n * return { data: { success: true } };\n * }\n *\n * // Catch-all action - registers as /issues/:number/.actions/:action\n * @Actions.Exec(\"/issues/:number\")\n * async handleIssueAction(ctx: RouteContext<{ number: string; action: string }>, args: Record<string, unknown>) {\n * return { data: { action: ctx.params.action } };\n * }\n *\n * // Root-level action - registers as /.actions/refresh\n * @Actions.Exec(\"/\", \"refresh\")\n * async refreshAll(ctx: RouteContext, args: Record<string, unknown>) {\n * return { data: { refreshed: true } };\n * }\n * ```\n */\n Exec: (pattern: string, actionName?: string, description?: string) => MethodDecorator;\n}\n\n/**\n * @Actions decorator - handles action-related routes\n *\n * Use directly for listing actions:\n * @example\n * ```typescript\n * @Actions(\"/:table/:pk\") // Registers as /:table/:pk/.actions\n * async listRowActions(ctx: RouteContext<{ table: string; pk: string }>) {\n * return { data: availableActions };\n * }\n * ```\n *\n * Use Actions.Exec for action execution:\n * @example\n * ```typescript\n * @Actions.Exec(\"/:table/:pk\", \"close\")\n * async closeAction(ctx: RouteContext, args: Record<string, unknown>) { ... }\n * ```\n */\nexport const Actions: ActionsDecorator = Object.assign(\n // Main function - for listing actions\n (pattern: string, description?: string): MethodDecorator => {\n return createActionsListDecorator(pattern, description);\n },\n // Additional methods\n {\n Exec: createActionsExecuteDecorator,\n },\n);\n\n/**\n * @Stat decorator - handles stat operations\n * Handler should return: AFSStatResult\n *\n * @example\n * ```typescript\n * @Stat(\"/:path*\")\n * async statPath(ctx: RouteContext<{ path?: string }>) {\n * return { data: { path: ctx.path, size: 100, modified: new Date() } };\n * }\n * ```\n */\nexport const Stat = createRouteDecorator(\"stat\");\n\n/**\n * @Explain decorator - handles explain operations\n * Handler should return: AFSExplainResult\n *\n * @example\n * ```typescript\n * @Explain(\"/:path*\")\n * async explainPath(ctx: RouteContext<{ path?: string }>) {\n * return { data: { content: \"...\", format: \"markdown\" } };\n * }\n * ```\n */\nexport const Explain = createRouteDecorator(\"explain\");\n\n/**\n * @Rename decorator - handles rename operations\n * Handler should return: AFSRenameResult\n *\n * @example\n * ```typescript\n * @Rename(\"/:path*\")\n * async renamePath(ctx: RouteContext<{ path?: string }>, newPath: string) {\n * return { message: \"Renamed successfully\" };\n * }\n * ```\n */\nexport const Rename = createRouteDecorator(\"rename\");\n"],"mappings":";;;;;;AAUA,MAAM,gCAAgB,IAAI,SAAuC;;;;AAKjE,SAAgB,UAAU,MAAoC;CAC5D,MAAM,SAA0B,EAAE;CAGlC,IAAI,UAA8B;AAClC,QAAO,WAAW,YAAY,SAAS,aAAa,YAAY,QAAQ;EACtE,MAAM,cAAc,cAAc,IAAI,QAAQ;AAC9C,MAAI,YAEF,QAAO,QAAQ,GAAG,YAAY;AAEhC,YAAU,OAAO,eAAe,QAAQ;;AAG1C,QAAO;;;;;AAMT,SAAgB,YAAY,MAAyB;AACnD,eAAc,OAAO,KAAK;;;;;AAM5B,SAAS,cACP,MACA,SACA,WACA,YACA,aACA,aACM;CACN,MAAM,SAAS,cAAc,IAAI,KAAK,IAAI,EAAE;AAC5C,QAAO,KAAK;EAAE;EAAS;EAAW;EAAY;EAAa;EAAa,CAAC;AACzE,eAAc,IAAI,MAAM,OAAO;;;;;AAMjC,SAAS,qBAAqB,WAA2B;AACvD,SAAQ,SAAiB,iBACtB,QAAgB,gBAAuC;EACtD,MAAM,OAAO,OAAO;AACpB,gBAAc,MAAM,SAAS,WAAW,OAAO,YAAY,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkC/E,SAAgB,KACd,SACA,sBACiB;AACjB,SAAQ,QAAgB,gBAAuC;EAC7D,MAAM,OAAO,OAAO;EACpB,MAAM,cAAc,OAAO,yBAAyB,WAAW,uBAAuB;EACtF,MAAM,cAAc,OAAO,yBAAyB,WAAW,uBAAuB;AACtF,gBAAc,MAAM,SAAS,QAAQ,OAAO,YAAY,EAAE,aAAa,YAAY;;;;;;;;;;;;;;;AAgBvF,MAAa,OAAO,qBAAqB,OAAO;;;;;;;;;;;;;AAchD,MAAa,QAAQ,qBAAqB,QAAQ;;;;;;;;;;;;;AAclD,MAAa,SAAS,qBAAqB,SAAS;;;;;;;;;;;;;AAcpD,MAAa,OAAO,qBAAqB,OAAO;;;;;;;;;;;;;AAchD,MAAa,SAAS,qBAAqB,SAAS;;;;;;;;;;;;;;;;;;;;;AAsBpD,SAAgB,KAAK,SAAiB,aAAuC;CAE3E,MAAM,cAAc,YAAY,MAAM,WAAW,GAAG,QAAQ;AAC5D,QAAO,qBAAqB,OAAO,CAAC,aAAa,YAAY;;;;;AAM/D,SAAS,2BAA2B,SAAiB,aAAuC;CAC1F,MAAM,iBAAiB,YAAY,MAAM,cAAc,GAAG,QAAQ;AAClE,QAAO,qBAAqB,OAAO,CAAC,gBAAgB,YAAY;;;;;AAMlE,SAAS,8BACP,SACA,YACA,aACiB;CACjB,MAAM,WAAW,YAAY,MAAM,KAAK;CACxC,MAAM,cAAc,aAChB,GAAG,SAAS,YAAY,eACxB,GAAG,SAAS;AAChB,QAAO,qBAAqB,OAAO,CAAC,aAAa,YAAY;;;;;;;;;;;;;;;;;;;;;AA6E/D,MAAa,UAA4B,OAAO,QAE7C,SAAiB,gBAA0C;AAC1D,QAAO,2BAA2B,SAAS,YAAY;GAGzD,EACE,MAAM,+BACP,CACF;;;;;;;;;;;;;AAcD,MAAa,OAAO,qBAAqB,OAAO;;;;;;;;;;;;;AAchD,MAAa,UAAU,qBAAqB,UAAU;;;;;;;;;;;;;AActD,MAAa,SAAS,qBAAqB,SAAS"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_decorators = require('./decorators.cjs');
|
|
2
|
+
const require_router = require('./router.cjs');
|
|
3
|
+
const require_base = require('./base.cjs');
|
|
4
|
+
|
|
5
|
+
exports.AFSBaseProvider = require_base.AFSBaseProvider;
|
|
6
|
+
exports.Actions = require_decorators.Actions;
|
|
7
|
+
exports.Delete = require_decorators.Delete;
|
|
8
|
+
exports.Exec = require_decorators.Exec;
|
|
9
|
+
exports.Explain = require_decorators.Explain;
|
|
10
|
+
exports.List = require_decorators.List;
|
|
11
|
+
exports.Meta = require_decorators.Meta;
|
|
12
|
+
exports.ProviderRouter = require_router.ProviderRouter;
|
|
13
|
+
exports.Read = require_decorators.Read;
|
|
14
|
+
exports.Rename = require_decorators.Rename;
|
|
15
|
+
exports.Search = require_decorators.Search;
|
|
16
|
+
exports.Stat = require_decorators.Stat;
|
|
17
|
+
exports.Write = require_decorators.Write;
|
|
18
|
+
exports.clearRoutes = require_decorators.clearRoutes;
|
|
19
|
+
exports.getRoutes = require_decorators.getRoutes;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DeleteRouteHandler, ExecRouteHandler, ExplainRouteHandler, ListDecoratorOptions, ListHandlerResult, ListRouteHandler, ReadRouteHandler, RenameRouteHandler, RouteContext, RouteDefinition, RouteHandler, RouteMatch, RouteMetadata, RouteOperation, SearchRouteHandler, StatRouteHandler, WriteRouteHandler } from "./types.cjs";
|
|
2
|
+
import { ProviderRouter } from "./router.cjs";
|
|
3
|
+
import { AFSBaseProvider } from "./base.cjs";
|
|
4
|
+
import { Actions, Delete, Exec, Explain, List, Meta, Read, Rename, Search, Stat, Write, clearRoutes, getRoutes } from "./decorators.cjs";
|
|
5
|
+
export { AFSBaseProvider, Actions, Delete, type DeleteRouteHandler, Exec, type ExecRouteHandler, Explain, type ExplainRouteHandler, List, type ListDecoratorOptions, type ListHandlerResult, type ListRouteHandler, Meta, ProviderRouter, Read, type ReadRouteHandler, Rename, type RenameRouteHandler, type RouteContext, type RouteDefinition, type RouteHandler, type RouteMatch, type RouteMetadata, type RouteOperation, Search, type SearchRouteHandler, Stat, type StatRouteHandler, Write, type WriteRouteHandler, clearRoutes, getRoutes };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DeleteRouteHandler, ExecRouteHandler, ExplainRouteHandler, ListDecoratorOptions, ListHandlerResult, ListRouteHandler, ReadRouteHandler, RenameRouteHandler, RouteContext, RouteDefinition, RouteHandler, RouteMatch, RouteMetadata, RouteOperation, SearchRouteHandler, StatRouteHandler, WriteRouteHandler } from "./types.mjs";
|
|
2
|
+
import { ProviderRouter } from "./router.mjs";
|
|
3
|
+
import { AFSBaseProvider } from "./base.mjs";
|
|
4
|
+
import { Actions, Delete, Exec, Explain, List, Meta, Read, Rename, Search, Stat, Write, clearRoutes, getRoutes } from "./decorators.mjs";
|
|
5
|
+
export { AFSBaseProvider, Actions, Delete, type DeleteRouteHandler, Exec, type ExecRouteHandler, Explain, type ExplainRouteHandler, List, type ListDecoratorOptions, type ListHandlerResult, type ListRouteHandler, Meta, ProviderRouter, Read, type ReadRouteHandler, Rename, type RenameRouteHandler, type RouteContext, type RouteDefinition, type RouteHandler, type RouteMatch, type RouteMetadata, type RouteOperation, Search, type SearchRouteHandler, Stat, type StatRouteHandler, Write, type WriteRouteHandler, clearRoutes, getRoutes };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Actions, Delete, Exec, Explain, List, Meta, Read, Rename, Search, Stat, Write, clearRoutes, getRoutes } from "./decorators.mjs";
|
|
2
|
+
import { ProviderRouter } from "./router.mjs";
|
|
3
|
+
import { AFSBaseProvider } from "./base.mjs";
|
|
4
|
+
|
|
5
|
+
export { AFSBaseProvider, Actions, Delete, Exec, Explain, List, Meta, ProviderRouter, Read, Rename, Search, Stat, Write, clearRoutes, getRoutes };
|