@aigne/afs-gce 1.11.0-beta.6 → 1.11.0-beta.7

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/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
+ import { AFSAccessMode, AFSBaseProvider, AFSDeleteResult, AFSEntry, AFSExecResult, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSStatResult, AFSWriteEntryPayload, AFSWriteResult, RouteContext } from "@aigne/afs";
2
+ import * as zod0 from "zod";
1
3
  import { z } from "zod";
2
- import { AFSListOptions, AFSListResult, AFSModule, AFSReadOptions, AFSReadResult, AFSStatResult, AFSWriteEntryPayload, AFSWriteOptions, AFSWriteResult } from "@aigne/afs";
3
4
 
4
5
  //#region src/types.d.ts
5
6
  /**
@@ -84,53 +85,164 @@ declare const afsgceOptionsSchema: z.ZodEffects<z.ZodObject<{
84
85
  //#endregion
85
86
  //#region src/index.d.ts
86
87
  /**
87
- * AFS GCE Provider
88
+ * AFSGCE Provider using AFSBaseProvider pattern
88
89
  *
89
- * Provides a file-system-like interface to GCE instances.
90
+ * Provides file-system-like access to GCE instances.
91
+ * Uses decorator routing (@List, @Read, @Write, @Delete, @Meta, @Actions, @Explain).
90
92
  *
91
93
  * @example
92
94
  * ```typescript
93
- * const provider = new AFSGCE({
94
- * projectId: 'my-project',
95
- * zone: 'us-central1-a',
95
+ * const gce = new AFSGCE({
96
+ * projectId: "my-project",
97
+ * zone: "us-central1-a",
96
98
  * });
97
99
  *
98
- * // List instances
99
- * const instances = await provider.list('/instances');
100
+ * // Mount to AFS
101
+ * afs.mount(gce);
100
102
  *
101
- * // Get instance metadata
102
- * const metadata = await provider.read('/instances/my-vm/metadata.json');
103
+ * // List instances
104
+ * const result = await afs.list("/modules/gce/instances");
103
105
  *
104
- * // Start an instance (requires readwrite mode)
105
- * await provider.write('/instances/my-vm/actions/start', {});
106
+ * // Read instance metadata
107
+ * const meta = await afs.read("/modules/gce/instances/my-vm/metadata.json");
106
108
  * ```
107
109
  */
108
- declare class AFSGCE implements AFSModule {
110
+ declare class AFSGCE extends AFSBaseProvider {
109
111
  readonly name: string;
110
112
  readonly description?: string;
111
- readonly accessMode: "readonly" | "readwrite";
113
+ readonly accessMode: AFSAccessMode;
112
114
  private readonly client;
113
115
  private readonly projectId;
114
116
  private readonly zone;
115
117
  constructor(options: AFSGCEOptions);
116
- /**
117
- * List GCE resources
118
- */
119
- list(path: string, options?: AFSListOptions): Promise<AFSListResult>;
120
- /**
121
- * Get metadata for a GCE resource
122
- */
123
- stat(path: string): Promise<AFSStatResult>;
124
- /**
125
- * Read GCE resource data
126
- */
127
- read(path: string, options?: AFSReadOptions): Promise<AFSReadResult>;
128
- /**
129
- * Write/execute action on GCE resource
130
- *
131
- * In GCE, write is used to execute actions (start, stop, reset)
132
- */
133
- write(path: string, _content: AFSWriteEntryPayload, _options?: AFSWriteOptions): Promise<AFSWriteResult>;
118
+ static schema(): zod0.ZodEffects<zod0.ZodObject<{
119
+ name: zod0.ZodType<string | undefined, zod0.ZodTypeDef, string | undefined>;
120
+ description: zod0.ZodType<string | undefined, zod0.ZodTypeDef, string | undefined>;
121
+ projectId: zod0.ZodString;
122
+ zone: zod0.ZodString;
123
+ accessMode: zod0.ZodType<"readonly" | "readwrite" | undefined, zod0.ZodTypeDef, "readonly" | "readwrite" | undefined>;
124
+ keyFilename: zod0.ZodType<string | undefined, zod0.ZodTypeDef, string | undefined>;
125
+ credentials: zod0.ZodType<{
126
+ clientEmail: string;
127
+ privateKey: string;
128
+ } | undefined, zod0.ZodTypeDef, {
129
+ clientEmail: string;
130
+ privateKey: string;
131
+ } | undefined>;
132
+ cacheTtl: zod0.ZodType<number | undefined, zod0.ZodTypeDef, number | undefined>;
133
+ }, "strict", zod0.ZodTypeAny, {
134
+ projectId: string;
135
+ zone: string;
136
+ name?: string | undefined;
137
+ description?: string | undefined;
138
+ accessMode?: "readonly" | "readwrite" | undefined;
139
+ keyFilename?: string | undefined;
140
+ credentials?: {
141
+ clientEmail: string;
142
+ privateKey: string;
143
+ } | undefined;
144
+ cacheTtl?: number | undefined;
145
+ }, {
146
+ projectId: string;
147
+ zone: string;
148
+ name?: string | undefined;
149
+ description?: string | undefined;
150
+ accessMode?: "readonly" | "readwrite" | undefined;
151
+ keyFilename?: string | undefined;
152
+ credentials?: {
153
+ clientEmail: string;
154
+ privateKey: string;
155
+ } | undefined;
156
+ cacheTtl?: number | undefined;
157
+ }>, {
158
+ projectId: string;
159
+ zone: string;
160
+ name?: string | undefined;
161
+ description?: string | undefined;
162
+ accessMode?: "readonly" | "readwrite" | undefined;
163
+ keyFilename?: string | undefined;
164
+ credentials?: {
165
+ clientEmail: string;
166
+ privateKey: string;
167
+ } | undefined;
168
+ cacheTtl?: number | undefined;
169
+ }, any>;
170
+ static load({
171
+ basePath,
172
+ config
173
+ }?: AFSModuleLoadParams): Promise<AFSGCE>;
174
+ private getInstance;
175
+ private listAllInstances;
176
+ private buildInstanceEntry;
177
+ listRoot(_ctx: RouteContext): Promise<AFSListResult>;
178
+ listInstances(_ctx: RouteContext): Promise<AFSListResult>;
179
+ listInstanceChildren(ctx: RouteContext<{
180
+ instanceId: string;
181
+ status?: string;
182
+ }>): Promise<AFSListResult>;
183
+ listInstanceLabels(ctx: RouteContext<{
184
+ instanceId: string;
185
+ status?: string;
186
+ }>): Promise<AFSListResult>;
187
+ listByStatus(_ctx: RouteContext): Promise<AFSListResult>;
188
+ listByStatusFilter(ctx: RouteContext<{
189
+ status: string;
190
+ }>): Promise<AFSListResult>;
191
+ readCapabilities(_ctx: RouteContext): Promise<AFSEntry>;
192
+ readInstanceMetadata(ctx: RouteContext<{
193
+ instanceId: string;
194
+ status?: string;
195
+ }>): Promise<AFSEntry>;
196
+ readInstanceLabel(ctx: RouteContext<{
197
+ instanceId: string;
198
+ labelKey: string;
199
+ status?: string;
200
+ }>): Promise<AFSEntry>;
201
+ metaRoot(ctx: RouteContext): Promise<AFSEntry>;
202
+ metaInstances(ctx: RouteContext): Promise<AFSEntry>;
203
+ metaInstance(ctx: RouteContext<{
204
+ instanceId: string;
205
+ status?: string;
206
+ }>): Promise<AFSEntry>;
207
+ statRoot(ctx: RouteContext): Promise<AFSStatResult>;
208
+ statInstances(ctx: RouteContext): Promise<AFSStatResult>;
209
+ statInstance(ctx: RouteContext<{
210
+ instanceId: string;
211
+ status?: string;
212
+ }>): Promise<AFSStatResult>;
213
+ writeInstanceLabel(ctx: RouteContext<{
214
+ instanceId: string;
215
+ labelKey: string;
216
+ status?: string;
217
+ }>, payload: AFSWriteEntryPayload): Promise<AFSWriteResult>;
218
+ deleteInstanceLabel(ctx: RouteContext<{
219
+ instanceId: string;
220
+ labelKey: string;
221
+ status?: string;
222
+ }>): Promise<AFSDeleteResult>;
223
+ listGlobalActions(ctx: RouteContext): Promise<AFSListResult>;
224
+ refreshAction(_ctx: RouteContext, _args: Record<string, unknown>): Promise<AFSExecResult>;
225
+ listInstanceActions(ctx: RouteContext<{
226
+ instanceId: string;
227
+ status?: string;
228
+ }>): Promise<AFSListResult>;
229
+ startInstanceAction(ctx: RouteContext<{
230
+ instanceId: string;
231
+ status?: string;
232
+ }>, _args: Record<string, unknown>): Promise<AFSExecResult>;
233
+ stopInstanceAction(ctx: RouteContext<{
234
+ instanceId: string;
235
+ status?: string;
236
+ }>, _args: Record<string, unknown>): Promise<AFSExecResult>;
237
+ resetInstanceAction(ctx: RouteContext<{
238
+ instanceId: string;
239
+ status?: string;
240
+ }>, _args: Record<string, unknown>): Promise<AFSExecResult>;
241
+ explainRoot(_ctx: RouteContext): Promise<AFSExplainResult>;
242
+ explainInstance(ctx: RouteContext<{
243
+ instanceId: string;
244
+ status?: string;
245
+ }>): Promise<AFSExplainResult>;
134
246
  }
135
247
  //#endregion
136
248
  export { AFSGCE, type AFSGCEOptions, afsgceOptionsSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;AAUA;;;A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