@happyvertical/files 0.74.8

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.
@@ -0,0 +1,464 @@
1
+ /**
2
+ * Core types and interfaces for the Files library
3
+ */
4
+ /**
5
+ * Options for reading files
6
+ */
7
+ export interface ReadOptions {
8
+ /**
9
+ * Text encoding for reading the file
10
+ */
11
+ encoding?: BufferEncoding;
12
+ /**
13
+ * Whether to return raw buffer data instead of string
14
+ */
15
+ raw?: boolean;
16
+ }
17
+ /**
18
+ * Options for writing files
19
+ */
20
+ export interface WriteOptions {
21
+ /**
22
+ * Text encoding for writing the file
23
+ */
24
+ encoding?: BufferEncoding;
25
+ /**
26
+ * File mode (permissions)
27
+ */
28
+ mode?: number;
29
+ /**
30
+ * Whether to create parent directories if they don't exist
31
+ */
32
+ createParents?: boolean;
33
+ }
34
+ /**
35
+ * Options for creating directories
36
+ */
37
+ export interface CreateDirOptions {
38
+ /**
39
+ * Whether to create parent directories recursively
40
+ */
41
+ recursive?: boolean;
42
+ /**
43
+ * Directory mode (permissions)
44
+ */
45
+ mode?: number;
46
+ }
47
+ /**
48
+ * Options for listing directory contents
49
+ */
50
+ export interface ListOptions {
51
+ /**
52
+ * Whether to include subdirectories
53
+ */
54
+ recursive?: boolean;
55
+ /**
56
+ * Filter pattern for file names
57
+ */
58
+ filter?: RegExp | string;
59
+ /**
60
+ * Whether to return full file information
61
+ */
62
+ detailed?: boolean;
63
+ }
64
+ /**
65
+ * Options for file upload operations
66
+ */
67
+ export interface UploadOptions {
68
+ /**
69
+ * Content type for the upload
70
+ */
71
+ contentType?: string;
72
+ /**
73
+ * Whether to overwrite existing files
74
+ */
75
+ overwrite?: boolean;
76
+ /**
77
+ * Custom metadata to attach to the file
78
+ */
79
+ metadata?: Record<string, string>;
80
+ /**
81
+ * Progress callback function
82
+ */
83
+ onProgress?: (progress: {
84
+ loaded: number;
85
+ total: number;
86
+ }) => void;
87
+ }
88
+ /**
89
+ * Options for file download operations
90
+ */
91
+ export interface DownloadOptions {
92
+ /**
93
+ * Whether to force download even if local copy exists
94
+ */
95
+ force?: boolean;
96
+ /**
97
+ * Progress callback function
98
+ */
99
+ onProgress?: (progress: {
100
+ loaded: number;
101
+ total: number;
102
+ }) => void;
103
+ }
104
+ /**
105
+ * Options for caching operations
106
+ */
107
+ export interface CacheOptions {
108
+ /**
109
+ * Cache expiry time in milliseconds
110
+ */
111
+ expiry?: number;
112
+ /**
113
+ * Whether to force download even if cached
114
+ */
115
+ force?: boolean;
116
+ }
117
+ /**
118
+ * Options for listing files (legacy compatibility)
119
+ */
120
+ export interface ListFilesOptions {
121
+ /**
122
+ * Optional regular expression to filter files by name
123
+ */
124
+ match?: RegExp;
125
+ }
126
+ /**
127
+ * File information structure
128
+ */
129
+ export interface FileInfo {
130
+ /**
131
+ * File name
132
+ */
133
+ name: string;
134
+ /**
135
+ * Full path to the file
136
+ */
137
+ path: string;
138
+ /**
139
+ * File size in bytes
140
+ */
141
+ size: number;
142
+ /**
143
+ * Whether this is a directory
144
+ */
145
+ isDirectory: boolean;
146
+ /**
147
+ * Last modified date
148
+ */
149
+ lastModified: Date;
150
+ /**
151
+ * MIME type of the file
152
+ */
153
+ mimeType?: string;
154
+ /**
155
+ * File extension
156
+ */
157
+ extension?: string;
158
+ }
159
+ /**
160
+ * File statistics structure
161
+ */
162
+ export interface FileStats {
163
+ /**
164
+ * File size in bytes
165
+ */
166
+ size: number;
167
+ /**
168
+ * Whether this is a directory
169
+ */
170
+ isDirectory: boolean;
171
+ /**
172
+ * Whether this is a regular file
173
+ */
174
+ isFile: boolean;
175
+ /**
176
+ * Creation time
177
+ */
178
+ birthtime: Date;
179
+ /**
180
+ * Last access time
181
+ */
182
+ atime: Date;
183
+ /**
184
+ * Last modification time
185
+ */
186
+ mtime: Date;
187
+ /**
188
+ * Last status change time
189
+ */
190
+ ctime: Date;
191
+ /**
192
+ * File mode (permissions)
193
+ */
194
+ mode: number;
195
+ /**
196
+ * User ID of file owner
197
+ */
198
+ uid: number;
199
+ /**
200
+ * Group ID of file owner
201
+ */
202
+ gid: number;
203
+ }
204
+ /**
205
+ * Filesystem capabilities structure
206
+ */
207
+ export interface FilesystemCapabilities {
208
+ /**
209
+ * Whether the filesystem supports streaming
210
+ */
211
+ streaming: boolean;
212
+ /**
213
+ * Whether the filesystem supports atomic operations
214
+ */
215
+ atomicOperations: boolean;
216
+ /**
217
+ * Whether the filesystem supports file versioning
218
+ */
219
+ versioning: boolean;
220
+ /**
221
+ * Whether the filesystem supports sharing/permissions
222
+ */
223
+ sharing: boolean;
224
+ /**
225
+ * Whether the filesystem supports real-time synchronization
226
+ */
227
+ realTimeSync: boolean;
228
+ /**
229
+ * Whether the filesystem can work offline
230
+ */
231
+ offlineCapable: boolean;
232
+ /**
233
+ * Maximum file size supported (in bytes)
234
+ */
235
+ maxFileSize?: number;
236
+ /**
237
+ * Supported file operations
238
+ */
239
+ supportedOperations: string[];
240
+ }
241
+ /**
242
+ * Core filesystem interface that all providers must implement
243
+ */
244
+ export interface FilesystemInterface {
245
+ /**
246
+ * Check if a file or directory exists
247
+ */
248
+ exists(path: string): Promise<boolean>;
249
+ /**
250
+ * Read file contents
251
+ */
252
+ read(path: string, options?: ReadOptions): Promise<string | Buffer>;
253
+ /**
254
+ * Write content to a file
255
+ */
256
+ write(path: string, content: string | Buffer, options?: WriteOptions): Promise<void>;
257
+ /**
258
+ * Delete a file or directory
259
+ */
260
+ delete(path: string): Promise<void>;
261
+ /**
262
+ * Copy a file from source to destination
263
+ */
264
+ copy(sourcePath: string, destPath: string): Promise<void>;
265
+ /**
266
+ * Move a file from source to destination
267
+ */
268
+ move(sourcePath: string, destPath: string): Promise<void>;
269
+ /**
270
+ * Create a directory
271
+ */
272
+ createDirectory(path: string, options?: CreateDirOptions): Promise<void>;
273
+ /**
274
+ * List directory contents
275
+ */
276
+ list(path: string, options?: ListOptions): Promise<FileInfo[]>;
277
+ /**
278
+ * Get file statistics
279
+ */
280
+ getStats(path: string): Promise<FileStats>;
281
+ /**
282
+ * Get MIME type for a file
283
+ */
284
+ getMimeType(path: string): Promise<string>;
285
+ /**
286
+ * Upload a file (for remote providers)
287
+ */
288
+ upload(localPath: string, remotePath: string, options?: UploadOptions): Promise<void>;
289
+ /**
290
+ * Download a file (for remote providers)
291
+ */
292
+ download(remotePath: string, localPath?: string, options?: DownloadOptions): Promise<string>;
293
+ /**
294
+ * Download file with caching
295
+ */
296
+ downloadWithCache(remotePath: string, options?: CacheOptions): Promise<string>;
297
+ /**
298
+ * Caching operations
299
+ */
300
+ cache: {
301
+ get(key: string, expiry?: number): Promise<string | undefined>;
302
+ set(key: string, data: string): Promise<void>;
303
+ clear(key?: string): Promise<void>;
304
+ };
305
+ /**
306
+ * Get provider capabilities
307
+ */
308
+ getCapabilities(): Promise<FilesystemCapabilities>;
309
+ /**
310
+ * Check if a path is a file (legacy)
311
+ */
312
+ isFile(file: string): Promise<false | FileStats>;
313
+ /**
314
+ * Check if a path is a directory (legacy)
315
+ */
316
+ isDirectory(dir: string): Promise<boolean>;
317
+ /**
318
+ * Create a directory if it doesn't exist (legacy)
319
+ */
320
+ ensureDirectoryExists(dir: string): Promise<void>;
321
+ /**
322
+ * Upload data to a URL using PUT method (legacy)
323
+ */
324
+ uploadToUrl(url: string, data: string | Buffer): Promise<Response>;
325
+ /**
326
+ * Download a file from a URL and save it to a local file (legacy)
327
+ */
328
+ downloadFromUrl(url: string, filepath: string): Promise<void>;
329
+ /**
330
+ * Download a file with caching support (legacy)
331
+ */
332
+ downloadFileWithCache(url: string, targetPath?: string | null): Promise<string>;
333
+ /**
334
+ * List files in a directory with optional filtering (legacy)
335
+ */
336
+ listFiles(dirPath: string, options?: ListFilesOptions): Promise<string[]>;
337
+ /**
338
+ * Get data from cache if available and not expired (legacy)
339
+ */
340
+ getCached(file: string, expiry?: number): Promise<string | undefined>;
341
+ /**
342
+ * Set data in cache (legacy)
343
+ */
344
+ setCached(file: string, data: string): Promise<void>;
345
+ }
346
+ /**
347
+ * Base configuration options for all providers
348
+ */
349
+ export interface BaseProviderOptions {
350
+ /**
351
+ * Base path for operations
352
+ */
353
+ basePath?: string;
354
+ /**
355
+ * Whether shared path normalization should prefix basePath.
356
+ * Providers that map basePath into their own storage root can disable this.
357
+ */
358
+ applyBasePath?: boolean;
359
+ /**
360
+ * Cache directory location
361
+ */
362
+ cacheDir?: string;
363
+ /**
364
+ * Whether to create missing directories
365
+ */
366
+ createMissing?: boolean;
367
+ }
368
+ /**
369
+ * Local filesystem provider options
370
+ */
371
+ export interface LocalOptions extends BaseProviderOptions {
372
+ type?: 'local';
373
+ }
374
+ /**
375
+ * S3-compatible provider options
376
+ */
377
+ export interface S3Options extends BaseProviderOptions {
378
+ type: 's3';
379
+ region: string;
380
+ bucket: string;
381
+ accessKeyId?: string;
382
+ secretAccessKey?: string;
383
+ endpoint?: string;
384
+ forcePathStyle?: boolean;
385
+ }
386
+ /**
387
+ * Google Drive provider options
388
+ *
389
+ * Supports three authentication modes:
390
+ * 1. OAuth2: clientId + clientSecret + refreshToken
391
+ * 2. Service account: serviceAccountKey (JSON string)
392
+ * 3. Access token: accessToken (short-lived, no auto-refresh)
393
+ */
394
+ export interface GoogleDriveOptions extends BaseProviderOptions {
395
+ type: 'gdrive';
396
+ /** OAuth2 client ID */
397
+ clientId?: string;
398
+ /** OAuth2 client secret */
399
+ clientSecret?: string;
400
+ /** OAuth2 refresh token */
401
+ refreshToken?: string;
402
+ /** Short-lived access token (no auto-refresh) */
403
+ accessToken?: string;
404
+ /** Service account key as JSON string */
405
+ serviceAccountKey?: string;
406
+ /** Root folder ID to scope operations (defaults to 'root') */
407
+ folderId?: string;
408
+ /** OAuth2 scopes (defaults to drive.file) */
409
+ scopes?: string[];
410
+ /** TTL for path-to-ID cache in ms (default 300000 / 5 min) */
411
+ pathCacheTTL?: number;
412
+ /** Page size for list pagination (default 100) */
413
+ pageSize?: number;
414
+ }
415
+ /**
416
+ * WebDAV provider options (supports Nextcloud, ownCloud, Apache, etc.)
417
+ */
418
+ export interface WebDAVOptions extends BaseProviderOptions {
419
+ type: 'webdav';
420
+ baseUrl: string;
421
+ username: string;
422
+ password: string;
423
+ davPath?: string;
424
+ }
425
+ /**
426
+ * Browser storage provider options (uses IndexedDB for app storage)
427
+ */
428
+ export interface BrowserStorageOptions extends BaseProviderOptions {
429
+ type: 'browser-storage';
430
+ /**
431
+ * Database name for IndexedDB
432
+ */
433
+ databaseName?: string;
434
+ /**
435
+ * Maximum storage quota to request (in bytes)
436
+ */
437
+ storageQuota?: number;
438
+ }
439
+ /**
440
+ * Union type for all provider options
441
+ */
442
+ export type GetFilesystemOptions = LocalOptions | S3Options | GoogleDriveOptions | WebDAVOptions | BrowserStorageOptions;
443
+ /**
444
+ * Error types for filesystem operations
445
+ */
446
+ export declare class FilesystemError extends Error {
447
+ code: string;
448
+ path?: string | undefined;
449
+ provider?: string | undefined;
450
+ constructor(message: string, code: string, path?: string | undefined, provider?: string | undefined);
451
+ }
452
+ export declare class FileNotFoundError extends FilesystemError {
453
+ constructor(path: string, provider?: string);
454
+ }
455
+ export declare class PermissionError extends FilesystemError {
456
+ constructor(path: string, provider?: string);
457
+ }
458
+ export declare class DirectoryNotEmptyError extends FilesystemError {
459
+ constructor(path: string, provider?: string);
460
+ }
461
+ export declare class InvalidPathError extends FilesystemError {
462
+ constructor(path: string, provider?: string);
463
+ }
464
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B;;OAEG;IACH,IAAI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EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAI5C;AAED,qBAAa,eAAgB,SAAQ,eAAe;gBACtC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAI5C;AAED,qBAAa,sBAAuB,SAAQ,eAAe;gBAC7C,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAI5C;AAED,qBAAa,gBAAiB,SAAQ,eAAe;gBACvC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAI5C"}
package/metadata.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@happyvertical/files",
3
+ "path": "packages/files",
4
+ "position": {
5
+ "index": 11,
6
+ "count": 30
7
+ },
8
+ "description": "File system utilities for local and remote file operations",
9
+ "provides": [
10
+ "File system utilities for local and remote file operations"
11
+ ],
12
+ "implements": [],
13
+ "requires": {
14
+ "workspace": [
15
+ "@happyvertical/utils"
16
+ ],
17
+ "externalHappyVertical": [],
18
+ "external": [
19
+ "@aws-sdk/client-s3",
20
+ "google-auth-library",
21
+ "googleapis"
22
+ ]
23
+ },
24
+ "dependents": [
25
+ "@happyvertical/documents",
26
+ "@happyvertical/sdk-mcp"
27
+ ],
28
+ "stability": {
29
+ "level": "stable",
30
+ "reason": "Primary package surface is described as implemented and production-oriented."
31
+ },
32
+ "keywords": [
33
+ "files"
34
+ ]
35
+ }
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@happyvertical/files",
3
+ "version": "0.74.8",
4
+ "description": "File system utilities for local and remote file operations",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "@aws-sdk/client-s3": "^3.1034.0",
16
+ "google-auth-library": "^9.15.1",
17
+ "googleapis": "^144.0.0",
18
+ "@happyvertical/utils": "0.74.8"
19
+ },
20
+ "devDependencies": {
21
+ "@testing-library/jest-dom": "6.9.1",
22
+ "@testing-library/svelte": "5.3.1",
23
+ "@types/node": "25.0.10",
24
+ "happy-dom": "20.9.0",
25
+ "jsdom": "27.4.0",
26
+ "typescript": "^5.9.3",
27
+ "vite": "7.3.2",
28
+ "vite-plugin-dts": "4.5.4",
29
+ "vitest": "^4.1.5"
30
+ },
31
+ "bin": {
32
+ "have-files-context": "./dist/cli/claude-context.js"
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "README.md",
37
+ "LICENSE",
38
+ "AGENT.md",
39
+ "metadata.json"
40
+ ],
41
+ "publishConfig": {
42
+ "registry": "https://registry.npmjs.org",
43
+ "access": "public"
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/happyvertical/sdk.git",
48
+ "directory": "packages/files"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/happyvertical/sdk/issues"
52
+ },
53
+ "homepage": "https://github.com/happyvertical/sdk/tree/main/packages/files#readme",
54
+ "license": "MIT",
55
+ "scripts": {
56
+ "test": "npx vitest run",
57
+ "test:watch": "npx vitest",
58
+ "build": "vite build",
59
+ "build:watch": "vite build --watch",
60
+ "docs": "typedoc --plugin typedoc-plugin-markdown --out docs --entryPoints ./src/index.ts --tsconfig ./tsconfig.json --excludePrivate --excludeInternal --hideGenerator --fileExtension .md --readme none --categorizeByGroup false --includeVersion false --hidePageHeader --hidePageTitle false --outputFileStrategy modules",
61
+ "docs:watch": "typedoc --plugin typedoc-plugin-markdown --out docs --entryPoints ./src/index.ts --tsconfig ./tsconfig.json --excludePrivate --excludeInternal --hideGenerator --fileExtension .md --readme none --categorizeByGroup false --includeVersion false --hidePageHeader --hidePageTitle false --outputFileStrategy modules --watch",
62
+ "clean": "rm -rf dist docs",
63
+ "dev": "npm run build:watch & npm run test:watch"
64
+ }
65
+ }