@aigne/afs-gcs 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 ADDED
@@ -0,0 +1,26 @@
1
+ # Proprietary License
2
+
3
+ Copyright (c) 2024-2025 ArcBlock, Inc. All Rights Reserved.
4
+
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.
8
+
9
+ The Software is provided for internal use only within ArcBlock, Inc. and its
10
+ authorized affiliates.
11
+
12
+ ## No License Granted
13
+
14
+ No license, express or implied, is granted to any party for any purpose.
15
+ All rights are reserved by ArcBlock, Inc.
16
+
17
+ ## Public Artifact Distribution
18
+
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.
23
+
24
+ ## Contact
25
+
26
+ For licensing inquiries, contact: legal@arcblock.io
@@ -0,0 +1,193 @@
1
+ import { AFSAccessMode, AFSBaseProvider, AFSDeleteResult, AFSEntry, AFSExecResult, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSSearchResult, AFSStatResult, AFSWriteEntryPayload, AFSWriteResult, ProviderManifest, RouteContext } from "@aigne/afs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/types.d.ts
5
+ /**
6
+ * Configuration options for AFSGCS
7
+ */
8
+ interface AFSGCSOptions {
9
+ /** Module name (used as mount path segment) */
10
+ name?: string;
11
+ /** Module description */
12
+ description?: string;
13
+ /** GCS bucket name */
14
+ bucket: string;
15
+ /** Key prefix (optional) */
16
+ prefix?: string;
17
+ /** GCP project ID */
18
+ projectId?: string;
19
+ /** Access mode */
20
+ accessMode?: "readonly" | "readwrite";
21
+ /** Custom endpoint for GCS-compatible services (fake-gcs-server) */
22
+ endpoint?: string;
23
+ /** Path to service account key file */
24
+ keyFilename?: string;
25
+ /** Explicit credentials (for programmatic access) */
26
+ credentials?: {
27
+ clientEmail: string;
28
+ privateKey: string;
29
+ };
30
+ /** Cache TTL in seconds (0 = no cache) */
31
+ cacheTtl?: number;
32
+ }
33
+ /**
34
+ * Parsed GCS URI
35
+ */
36
+ interface ParsedGCSUri {
37
+ bucket: string;
38
+ prefix: string;
39
+ }
40
+ //#endregion
41
+ //#region src/gcs-afs.d.ts
42
+ /**
43
+ * AFSGCS Provider using Base Provider pattern
44
+ *
45
+ * Provides access to Google Cloud Storage through AFS.
46
+ * Uses decorator routing (@List, @Read, @Write, @Delete, @Meta, @Actions).
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const gcs = new AFSGCS({
51
+ * bucket: "my-bucket",
52
+ * prefix: "data",
53
+ * projectId: "my-project",
54
+ * });
55
+ *
56
+ * // Mount to AFS
57
+ * afs.mount(gcs);
58
+ *
59
+ * // List objects
60
+ * const result = await afs.list("/modules/my-bucket/data");
61
+ *
62
+ * // Read object
63
+ * const content = await afs.read("/modules/my-bucket/data/file.json");
64
+ * ```
65
+ */
66
+ declare class AFSGCS extends AFSBaseProvider {
67
+ readonly name: string;
68
+ readonly description?: string;
69
+ readonly accessMode: AFSAccessMode;
70
+ private options;
71
+ private storage;
72
+ private bucket;
73
+ private listCache?;
74
+ private statCache?;
75
+ constructor(options: AFSGCSOptions & {
76
+ uri?: string;
77
+ token?: string;
78
+ auth?: unknown;
79
+ });
80
+ /**
81
+ * Schema for configuration validation
82
+ */
83
+ static schema(): z.ZodType<{
84
+ name: string | undefined;
85
+ description: string | undefined;
86
+ bucket: string;
87
+ prefix: string | undefined;
88
+ projectId: string | undefined;
89
+ accessMode: "readonly" | "readwrite" | undefined;
90
+ endpoint: string | undefined;
91
+ keyFilename: string | undefined;
92
+ credentials: {
93
+ clientEmail: string;
94
+ privateKey: string;
95
+ } | undefined;
96
+ cacheTtl: number | undefined;
97
+ }, unknown, z.core.$ZodTypeInternals<{
98
+ name: string | undefined;
99
+ description: string | undefined;
100
+ bucket: string;
101
+ prefix: string | undefined;
102
+ projectId: string | undefined;
103
+ accessMode: "readonly" | "readwrite" | undefined;
104
+ endpoint: string | undefined;
105
+ keyFilename: string | undefined;
106
+ credentials: {
107
+ clientEmail: string;
108
+ privateKey: string;
109
+ } | undefined;
110
+ cacheTtl: number | undefined;
111
+ }, unknown>>;
112
+ /**
113
+ * Provider manifest for URI-based discovery
114
+ */
115
+ static manifest(): ProviderManifest;
116
+ /**
117
+ * Load from configuration file
118
+ */
119
+ static load({
120
+ basePath,
121
+ config
122
+ }?: AFSModuleLoadParams): Promise<AFSGCS>;
123
+ /**
124
+ * Build the full GCS key from a path
125
+ */
126
+ private buildGCSKey;
127
+ /**
128
+ * Generate a unique ID for a GCS object
129
+ */
130
+ private generateId;
131
+ /**
132
+ * Invalidate caches for a given path
133
+ */
134
+ private invalidateCache;
135
+ /**
136
+ * Clear all caches
137
+ */
138
+ clearCache(): void;
139
+ listHandler(ctx: RouteContext<{
140
+ path?: string;
141
+ }>): Promise<AFSListResult>;
142
+ /**
143
+ * List with delimiter (single level)
144
+ */
145
+ private listWithDelimiter;
146
+ listVersionsHandler(ctx: RouteContext<{
147
+ path: string;
148
+ }>): Promise<AFSListResult>;
149
+ readHandler(ctx: RouteContext<{
150
+ path: string;
151
+ }>): Promise<AFSEntry>;
152
+ readVersionHandler(ctx: RouteContext<{
153
+ path: string;
154
+ generation: string;
155
+ }>): Promise<AFSEntry>;
156
+ metaHandler(ctx: RouteContext<{
157
+ path?: string;
158
+ }>): Promise<AFSEntry>;
159
+ statHandler(ctx: RouteContext<{
160
+ path?: string;
161
+ }>): Promise<AFSStatResult>;
162
+ writeHandler(ctx: RouteContext<{
163
+ path: string;
164
+ }>, payload: AFSWriteEntryPayload): Promise<AFSWriteResult>;
165
+ deleteHandler(ctx: RouteContext<{
166
+ path: string;
167
+ }>): Promise<AFSDeleteResult>;
168
+ listActionsHandler(ctx: RouteContext<{
169
+ path: string;
170
+ }>): Promise<AFSListResult>;
171
+ signDownloadActionHandler(ctx: RouteContext<{
172
+ path: string;
173
+ }>, args: Record<string, unknown>): Promise<AFSExecResult>;
174
+ signUploadActionHandler(ctx: RouteContext<{
175
+ path: string;
176
+ }>, args: Record<string, unknown>): Promise<AFSExecResult>;
177
+ composeActionHandler(ctx: RouteContext<{
178
+ path: string;
179
+ }>, args: Record<string, unknown>): Promise<AFSExecResult>;
180
+ rewriteActionHandler(ctx: RouteContext<{
181
+ path: string;
182
+ }>, args: Record<string, unknown>): Promise<AFSExecResult>;
183
+ explainHandler(ctx: RouteContext<{
184
+ path?: string;
185
+ }>): Promise<AFSExplainResult>;
186
+ searchHandler(ctx: RouteContext<{
187
+ path?: string;
188
+ }>, query: string): Promise<AFSSearchResult>;
189
+ readCapabilities(_ctx: RouteContext): Promise<AFSEntry>;
190
+ }
191
+ //#endregion
192
+ export { AFSGCS, AFSGCS as default, type AFSGCSOptions, type ParsedGCSUri };
193
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/gcs-afs.ts"],"mappings":";;;;AAUA;;;AAAA,UAAiB,aAAA;EAEf;EAAA,IAAA;EAMA;EAHA,WAAA;EASA;EANA,MAAA;EAYA;EATA,MAAA;EAeA;EAZA,SAAA;EAcE;EAXF,UAAA;EAeQ;EAZR,QAAA;EAmEe;EAhEf,WAAA;;EAGA,WAAA;IACE,WAAA;IACA,UAAA;EAAA;;EAIF,QAAA;AAAA;;;;UAuDe,YAAA;EACf,MAAA;EACA,MAAA;AAAA;;;;;;;;;;;;;;;;AAFF;;;;;;;;ACZA;;;cAAa,MAAA,SAAe,eAAA;EAAA,SACR,IAAA;EAAA,SACA,WAAA;EAAA,SACA,UAAA,EAAY,aAAA;EAAA,QAEtB,OAAA;EAAA,QACA,OAAA;EAAA,QACA,MAAA;EAAA,QACA,SAAA;EAAA,QACA,SAAA;cAEI,OAAA,EAAS,aAAA;IAAkB,GAAA;IAAc,KAAA;IA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