@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.
- package/AGENT.md +33 -0
- package/LICENSE +7 -0
- package/README.md +136 -0
- package/dist/cli/claude-context.d.ts +3 -0
- package/dist/cli/claude-context.d.ts.map +1 -0
- package/dist/cli/claude-context.js +21 -0
- package/dist/cli/claude-context.js.map +1 -0
- package/dist/factory.d.ts +30 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/fetch.d.ts +142 -0
- package/dist/fetch.d.ts.map +1 -0
- package/dist/filesystem-local.d.ts +82 -0
- package/dist/filesystem-local.d.ts.map +1 -0
- package/dist/filesystem.d.ts +155 -0
- package/dist/filesystem.d.ts.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2719 -0
- package/dist/index.js.map +1 -0
- package/dist/legacy.d.ts +209 -0
- package/dist/legacy.d.ts.map +1 -0
- package/dist/node/local.d.ts +332 -0
- package/dist/node/local.d.ts.map +1 -0
- package/dist/providers/gdrive.d.ts +87 -0
- package/dist/providers/gdrive.d.ts.map +1 -0
- package/dist/providers/s3.d.ts +32 -0
- package/dist/providers/s3.d.ts.map +1 -0
- package/dist/redact.d.ts +2 -0
- package/dist/redact.d.ts.map +1 -0
- package/dist/shared/base.d.ts +106 -0
- package/dist/shared/base.d.ts.map +1 -0
- package/dist/shared/factory.d.ts +148 -0
- package/dist/shared/factory.d.ts.map +1 -0
- package/dist/shared/types.d.ts +464 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/metadata.json +35 -0
- package/package.json +65 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../src/providers/s3.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,eAAe,EACpB,KAAK,Q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AAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAyElE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAiD1C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqB1C,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,aAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC;IAKV,QAAQ,CACZ,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,GAAE,eAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC;IAQZ,eAAe,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAwBzD"}
|
package/dist/redact.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AA8BA,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,KAAK,EAAE,CAAC,GACP,CAAC,SAAS,MAAM,GAAG,OAAO,GAAG,CAAC,CAIhC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { BaseProviderOptions, CacheOptions, CreateDirOptions, DownloadOptions, FileInfo, FileStats, FilesystemCapabilities, FilesystemInterface, ListFilesOptions, ListOptions, ReadOptions, UploadOptions, WriteOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for filesystem providers.
|
|
4
|
+
*
|
|
5
|
+
* Implements {@link FilesystemInterface} with shared logic for path normalization,
|
|
6
|
+
* validation, caching, and legacy method adapters. Concrete providers (e.g.
|
|
7
|
+
* {@link LocalFilesystemProvider}, {@link GoogleDriveProvider}) extend this class
|
|
8
|
+
* and implement the abstract methods for their specific storage backend.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class BaseFilesystemProvider implements FilesystemInterface {
|
|
11
|
+
protected basePath: string;
|
|
12
|
+
protected applyBasePath: boolean;
|
|
13
|
+
protected cacheDir: string;
|
|
14
|
+
protected createMissing: boolean;
|
|
15
|
+
protected providerType: string;
|
|
16
|
+
constructor(options?: BaseProviderOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Get default cache directory for the current context
|
|
19
|
+
*/
|
|
20
|
+
private getDefaultCacheDir;
|
|
21
|
+
/**
|
|
22
|
+
* Throw error for unsupported operations
|
|
23
|
+
*/
|
|
24
|
+
protected throwUnsupported(operation: string): never;
|
|
25
|
+
/**
|
|
26
|
+
* Normalize path by removing leading/trailing slashes and resolving relative paths
|
|
27
|
+
*/
|
|
28
|
+
protected normalizePath(path: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Universal path joining function that works in both Node.js and browser
|
|
31
|
+
*/
|
|
32
|
+
private joinPaths;
|
|
33
|
+
/**
|
|
34
|
+
* Validate that a path is safe (no directory traversal)
|
|
35
|
+
*/
|
|
36
|
+
protected validatePath(path: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get cache key for a given path
|
|
39
|
+
*/
|
|
40
|
+
protected getCacheKey(path: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Abstract methods that must be implemented by providers
|
|
43
|
+
*/
|
|
44
|
+
abstract exists(path: string): Promise<boolean>;
|
|
45
|
+
abstract read(path: string, options?: ReadOptions): Promise<string | Buffer>;
|
|
46
|
+
abstract write(path: string, content: string | Buffer, options?: WriteOptions): Promise<void>;
|
|
47
|
+
abstract delete(path: string): Promise<void>;
|
|
48
|
+
abstract copy(sourcePath: string, destPath: string): Promise<void>;
|
|
49
|
+
abstract move(sourcePath: string, destPath: string): Promise<void>;
|
|
50
|
+
abstract createDirectory(path: string, options?: CreateDirOptions): Promise<void>;
|
|
51
|
+
abstract list(path: string, options?: ListOptions): Promise<FileInfo[]>;
|
|
52
|
+
abstract getStats(path: string): Promise<FileStats>;
|
|
53
|
+
abstract getMimeType(path: string): Promise<string>;
|
|
54
|
+
abstract getCapabilities(): Promise<FilesystemCapabilities>;
|
|
55
|
+
/**
|
|
56
|
+
* Provider methods with default implementations (may be overridden)
|
|
57
|
+
*/
|
|
58
|
+
upload(_localPath: string, _remotePath: string, _options?: UploadOptions): Promise<void>;
|
|
59
|
+
download(_remotePath: string, _localPath?: string, _options?: DownloadOptions): Promise<string>;
|
|
60
|
+
downloadWithCache(remotePath: string, options?: CacheOptions): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Cache implementation - providers can override for their specific storage
|
|
63
|
+
*/
|
|
64
|
+
cache: {
|
|
65
|
+
get: (_key: string, _expiry?: number) => Promise<string | undefined>;
|
|
66
|
+
set: (_key: string, _data: string) => Promise<void>;
|
|
67
|
+
clear: (_key?: string) => Promise<void>;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Check if a path is a file (legacy)
|
|
71
|
+
*/
|
|
72
|
+
isFile(file: string): Promise<false | FileStats>;
|
|
73
|
+
/**
|
|
74
|
+
* Check if a path is a directory (legacy)
|
|
75
|
+
*/
|
|
76
|
+
isDirectory(dir: string): Promise<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Create a directory if it doesn't exist (legacy)
|
|
79
|
+
*/
|
|
80
|
+
ensureDirectoryExists(dir: string): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Upload data to a URL using PUT method (legacy)
|
|
83
|
+
*/
|
|
84
|
+
uploadToUrl(_url: string, _data: string | Buffer): Promise<Response>;
|
|
85
|
+
/**
|
|
86
|
+
* Download a file from a URL and save it to a local file (legacy)
|
|
87
|
+
*/
|
|
88
|
+
downloadFromUrl(_url: string, _filepath: string): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Download a file with caching support (legacy)
|
|
91
|
+
*/
|
|
92
|
+
downloadFileWithCache(_url: string, _targetPath?: string | null): Promise<string>;
|
|
93
|
+
/**
|
|
94
|
+
* List files in a directory with optional filtering (legacy)
|
|
95
|
+
*/
|
|
96
|
+
listFiles(dirPath: string, options?: ListFilesOptions): Promise<string[]>;
|
|
97
|
+
/**
|
|
98
|
+
* Get data from cache if available and not expired (legacy)
|
|
99
|
+
*/
|
|
100
|
+
getCached(file: string, expiry?: number): Promise<string | undefined>;
|
|
101
|
+
/**
|
|
102
|
+
* Set data in cache (legacy)
|
|
103
|
+
*/
|
|
104
|
+
setCached(file: string, data: string): Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/shared/base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,sBAAsB,EAE3B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AACH,8BAAsB,sBAAuB,YAAW,mBAAmB;IACzE,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;gBAEnB,OAAO,GAAE,mBAAwB;IAW7C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;OAEG;IACH,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK;IASpD;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAc7C;;OAEG;IACH,OAAO,CAAC,SAAS;IAOjB;;OAEG;IACH,SA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M,EAAE,CAAC;IAWpB;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI3E;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FilesystemInterface, GetFilesystemOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Register a filesystem provider factory function
|
|
4
|
+
*
|
|
5
|
+
* This function allows registration of new filesystem providers at runtime.
|
|
6
|
+
* Each provider must implement the FilesystemInterface.
|
|
7
|
+
*
|
|
8
|
+
* @param type - The provider type identifier (e.g., 'local', 's3', 'webdav')
|
|
9
|
+
* @param factory - Async factory function that returns the provider class constructor
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* registerProvider('custom', async () => {
|
|
14
|
+
* const { CustomProvider } = await import('./custom-provider.js');
|
|
15
|
+
* return CustomProvider;
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function registerProvider(type: string, factory: () => Promise<any>): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get list of available provider types
|
|
22
|
+
*
|
|
23
|
+
* Returns an array of all registered filesystem provider type identifiers.
|
|
24
|
+
* This can be used to check which providers are available in the current environment.
|
|
25
|
+
*
|
|
26
|
+
* @returns Array of provider type strings (e.g., ['local', 's3', 'webdav'])
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const availableProviders = getAvailableProviders();
|
|
31
|
+
* console.log('Available providers:', availableProviders);
|
|
32
|
+
* // Output: ['local', 's3', 'webdav']
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function getAvailableProviders(): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Create a filesystem instance with the specified provider and configuration
|
|
38
|
+
*
|
|
39
|
+
* This is the main entry point for creating filesystem instances. It automatically
|
|
40
|
+
* detects the provider type from the options, validates the configuration, and
|
|
41
|
+
* returns a fully configured filesystem interface.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Provider configuration options. Defaults to local filesystem if not specified
|
|
44
|
+
* @returns Promise resolving to a configured filesystem instance
|
|
45
|
+
* @throws {FilesystemError} When provider options are invalid or provider creation fails
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // Create local filesystem provider
|
|
50
|
+
* const localFs = await getFilesystem({ type: 'local', basePath: '/app/data' });
|
|
51
|
+
*
|
|
52
|
+
* // Create S3 provider
|
|
53
|
+
* const s3Fs = await getFilesystem({
|
|
54
|
+
* type: 's3',
|
|
55
|
+
* region: 'us-east-1',
|
|
56
|
+
* bucket: 'my-bucket',
|
|
57
|
+
* accessKeyId: 'AKIA...',
|
|
58
|
+
* secretAccessKey: 'secret'
|
|
59
|
+
* });
|
|
60
|
+
*
|
|
61
|
+
* // Create WebDAV provider for Nextcloud
|
|
62
|
+
* const webdavFs = await getFilesystem({
|
|
63
|
+
* type: 'webdav',
|
|
64
|
+
* baseUrl: 'https://cloud.example.com',
|
|
65
|
+
* username: 'user',
|
|
66
|
+
* password: 'password',
|
|
67
|
+
* davPath: '/remote.php/dav/files/user/'
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* // Auto-detect provider type from options
|
|
71
|
+
* const autoFs = await getFilesystem({ region: 'us-west-2', bucket: 'data' }); // detects S3
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare function getFilesystem(options?: GetFilesystemOptions): Promise<FilesystemInterface>;
|
|
75
|
+
/**
|
|
76
|
+
* Initialize and register all available filesystem providers
|
|
77
|
+
*
|
|
78
|
+
* This function registers the built-in providers that are available in the current
|
|
79
|
+
* environment. It's called automatically when the module is imported, but can be
|
|
80
|
+
* called manually if needed.
|
|
81
|
+
*
|
|
82
|
+
* In Node.js environments, this registers the local filesystem provider.
|
|
83
|
+
* In browser environments, this would register the browser storage provider.
|
|
84
|
+
*
|
|
85
|
+
* @returns Promise that resolves when all providers are registered
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* // Manually reinitialize providers
|
|
90
|
+
* await initializeProviders();
|
|
91
|
+
* console.log('Providers:', getAvailableProviders());
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare function initializeProviders(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Check if a specific provider type is available
|
|
97
|
+
*
|
|
98
|
+
* Determines whether a provider has been registered and is available for use.
|
|
99
|
+
* This is useful for feature detection and graceful degradation.
|
|
100
|
+
*
|
|
101
|
+
* @param type - Provider type to check (e.g., 'local', 's3', 'webdav')
|
|
102
|
+
* @returns True if the provider is registered and available, false otherwise
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* if (isProviderAvailable('s3')) {
|
|
107
|
+
* // Use S3 provider
|
|
108
|
+
* const fs = await getFilesystem({ type: 's3', region: 'us-east-1', bucket: 'data' });
|
|
109
|
+
* } else {
|
|
110
|
+
* // Fallback to local provider
|
|
111
|
+
* const fs = await getFilesystem({ type: 'local' });
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare function isProviderAvailable(type: string): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Get detailed information about a specific provider
|
|
118
|
+
*
|
|
119
|
+
* Returns comprehensive information about a provider including availability,
|
|
120
|
+
* description, and required configuration options.
|
|
121
|
+
*
|
|
122
|
+
* @param type - Provider type to get information about
|
|
123
|
+
* @returns Object containing provider availability, description, and required options
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const s3Info = getProviderInfo('s3');
|
|
128
|
+
* console.log(s3Info);
|
|
129
|
+
* // {
|
|
130
|
+
* // available: true,
|
|
131
|
+
* // description: 'S3-compatible provider supporting AWS S3, MinIO, and other S3-compatible services',
|
|
132
|
+
* // requiredOptions: ['region', 'bucket']
|
|
133
|
+
* // }
|
|
134
|
+
*
|
|
135
|
+
* // Check requirements before configuration
|
|
136
|
+
* const webdavInfo = getProviderInfo('webdav');
|
|
137
|
+
* if (webdavInfo.available) {
|
|
138
|
+
* console.log('WebDAV requires:', webdavInfo.requiredOptions);
|
|
139
|
+
* // ['baseUrl', 'username', 'password']
|
|
140
|
+
* }
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export declare function getProviderInfo(type: string): {
|
|
144
|
+
available: boolean;
|
|
145
|
+
description: string;
|
|
146
|
+
requiredOptions: string[];
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/shared/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAI1B,MAAM,SAAS,CAAC;AAQjB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAC1B,IAAI,CAEN;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAoJD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,aAAa,CACjC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,mBAAmB,CAAC,CA4B9B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAoBzD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CA0BA"}
|