@fractary/core 0.3.2 → 0.4.0
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/__tests__/factories.test.d.ts +5 -0
- package/dist/__tests__/factories.test.d.ts.map +1 -0
- package/dist/__tests__/factories.test.js +66 -0
- package/dist/__tests__/factories.test.js.map +1 -0
- package/dist/auth/__tests__/create-token-provider.test.d.ts +5 -0
- package/dist/auth/__tests__/create-token-provider.test.d.ts.map +1 -0
- package/dist/auth/__tests__/create-token-provider.test.js +104 -0
- package/dist/auth/__tests__/create-token-provider.test.js.map +1 -0
- package/dist/auth/__tests__/github-app-auth.test.d.ts +5 -0
- package/dist/auth/__tests__/github-app-auth.test.d.ts.map +1 -0
- package/dist/auth/__tests__/github-app-auth.test.js +293 -0
- package/dist/auth/__tests__/github-app-auth.test.js.map +1 -0
- package/dist/auth/__tests__/static-token-provider.test.d.ts +5 -0
- package/dist/auth/__tests__/static-token-provider.test.d.ts.map +1 -0
- package/dist/auth/__tests__/static-token-provider.test.js +54 -0
- package/dist/auth/__tests__/static-token-provider.test.js.map +1 -0
- package/dist/auth/github-app-auth.d.ts +109 -0
- package/dist/auth/github-app-auth.d.ts.map +1 -0
- package/dist/auth/github-app-auth.js +262 -0
- package/dist/auth/github-app-auth.js.map +1 -0
- package/dist/auth/github-app-token-provider.d.ts +59 -0
- package/dist/auth/github-app-token-provider.d.ts.map +1 -0
- package/dist/auth/github-app-token-provider.js +68 -0
- package/dist/auth/github-app-token-provider.js.map +1 -0
- package/dist/auth/index.d.ts +45 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +74 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/static-token-provider.d.ts +35 -0
- package/dist/auth/static-token-provider.d.ts.map +1 -0
- package/dist/auth/static-token-provider.js +45 -0
- package/dist/auth/static-token-provider.js.map +1 -0
- package/dist/auth/types.d.ts +49 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +8 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/common/yaml-config.d.ts +10 -0
- package/dist/common/yaml-config.d.ts.map +1 -1
- package/dist/common/yaml-config.js.map +1 -1
- package/dist/config/__tests__/loader.test.d.ts +5 -0
- package/dist/config/__tests__/loader.test.d.ts.map +1 -0
- package/dist/config/__tests__/loader.test.js +129 -0
- package/dist/config/__tests__/loader.test.js.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +27 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +126 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +277 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/docs/index.d.ts +5 -0
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +6 -1
- package/dist/docs/index.js.map +1 -1
- package/dist/docs/manager.d.ts +27 -0
- package/dist/docs/manager.d.ts.map +1 -1
- package/dist/docs/manager.js +168 -15
- package/dist/docs/manager.js.map +1 -1
- package/dist/docs/type-registry.d.ts +123 -0
- package/dist/docs/type-registry.d.ts.map +1 -0
- package/dist/docs/type-registry.js +393 -0
- package/dist/docs/type-registry.js.map +1 -0
- package/dist/docs/types.d.ts +93 -0
- package/dist/docs/types.d.ts.map +1 -1
- package/dist/factories.d.ts +89 -0
- package/dist/factories.d.ts.map +1 -0
- package/dist/factories.js +228 -0
- package/dist/factories.js.map +1 -0
- package/dist/file/factory.d.ts +41 -0
- package/dist/file/factory.d.ts.map +1 -0
- package/dist/file/factory.js +237 -0
- package/dist/file/factory.js.map +1 -0
- package/dist/file/gcs.d.ts +66 -0
- package/dist/file/gcs.d.ts.map +1 -0
- package/dist/file/gcs.js +226 -0
- package/dist/file/gcs.js.map +1 -0
- package/dist/file/gdrive.d.ts +78 -0
- package/dist/file/gdrive.d.ts.map +1 -0
- package/dist/file/gdrive.js +302 -0
- package/dist/file/gdrive.js.map +1 -0
- package/dist/file/index.d.ts +13 -1
- package/dist/file/index.d.ts.map +1 -1
- package/dist/file/index.js +25 -1
- package/dist/file/index.js.map +1 -1
- package/dist/file/manager.d.ts +83 -2
- package/dist/file/manager.d.ts.map +1 -1
- package/dist/file/manager.js +125 -4
- package/dist/file/manager.js.map +1 -1
- package/dist/file/r2.d.ts +56 -0
- package/dist/file/r2.d.ts.map +1 -0
- package/dist/file/r2.js +96 -0
- package/dist/file/r2.js.map +1 -0
- package/dist/file/s3.d.ts +61 -0
- package/dist/file/s3.d.ts.map +1 -0
- package/dist/file/s3.js +258 -0
- package/dist/file/s3.js.map +1 -0
- package/dist/file/types.d.ts +145 -2
- package/dist/file/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/logs/index.d.ts +1 -0
- package/dist/logs/index.d.ts.map +1 -1
- package/dist/logs/index.js +3 -1
- package/dist/logs/index.js.map +1 -1
- package/dist/logs/manager.d.ts +29 -2
- package/dist/logs/manager.d.ts.map +1 -1
- package/dist/logs/manager.js +48 -7
- package/dist/logs/manager.js.map +1 -1
- package/dist/logs/type-registry.d.ts +180 -0
- package/dist/logs/type-registry.d.ts.map +1 -0
- package/dist/logs/type-registry.js +421 -0
- package/dist/logs/type-registry.js.map +1 -0
- package/dist/logs/type-registry.test.d.ts +5 -0
- package/dist/logs/type-registry.test.d.ts.map +1 -0
- package/dist/logs/type-registry.test.js +671 -0
- package/dist/logs/type-registry.test.js.map +1 -0
- package/dist/logs/types.d.ts +2 -0
- package/dist/logs/types.d.ts.map +1 -1
- package/package.json +62 -8
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fractary/core - Google Drive Storage Implementation
|
|
4
|
+
*
|
|
5
|
+
* Google Drive storage backend for file operations.
|
|
6
|
+
* Uses googleapis with lazy loading.
|
|
7
|
+
*
|
|
8
|
+
* Note: Google Drive doesn't use traditional file paths. This implementation
|
|
9
|
+
* maps path-like identifiers to Google Drive files by name within a folder.
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.GDriveStorage = void 0;
|
|
46
|
+
/**
|
|
47
|
+
* Google Drive storage implementation
|
|
48
|
+
*/
|
|
49
|
+
class GDriveStorage {
|
|
50
|
+
config;
|
|
51
|
+
driveClient = null;
|
|
52
|
+
constructor(config) {
|
|
53
|
+
this.config = config;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get or create the Google Drive client (lazy loaded)
|
|
57
|
+
*/
|
|
58
|
+
async getClient() {
|
|
59
|
+
if (this.driveClient) {
|
|
60
|
+
return this.driveClient;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
// Dynamic import to avoid hard dependency
|
|
64
|
+
const { google } = await Promise.resolve().then(() => __importStar(require('googleapis')));
|
|
65
|
+
// Check if we have OAuth credentials
|
|
66
|
+
if (this.config.clientId && this.config.clientSecret && this.config.refreshToken) {
|
|
67
|
+
const oauth2Client = new google.auth.OAuth2(this.config.clientId, this.config.clientSecret);
|
|
68
|
+
oauth2Client.setCredentials({
|
|
69
|
+
refresh_token: this.config.refreshToken,
|
|
70
|
+
});
|
|
71
|
+
this.driveClient = google.drive({ version: 'v3', auth: oauth2Client });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// Use Application Default Credentials
|
|
75
|
+
const googleAuth = new google.auth.GoogleAuth({
|
|
76
|
+
scopes: ['https://www.googleapis.com/auth/drive'],
|
|
77
|
+
});
|
|
78
|
+
const authClient = await googleAuth.getClient();
|
|
79
|
+
this.driveClient = google.drive({
|
|
80
|
+
version: 'v3',
|
|
81
|
+
auth: authClient,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return this.driveClient;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
throw new Error('Google APIs SDK not available. Install with: npm install googleapis');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get the parent folder ID (internal helper)
|
|
92
|
+
*/
|
|
93
|
+
getParentFolderId() {
|
|
94
|
+
return this.config.folderId || 'root';
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Extract file name from path-like ID
|
|
98
|
+
*/
|
|
99
|
+
getFileName(id) {
|
|
100
|
+
// Take the last part of the path as the file name
|
|
101
|
+
const parts = id.split('/');
|
|
102
|
+
return parts[parts.length - 1];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Escape a string for use in Google Drive query syntax
|
|
106
|
+
* Single quotes must be escaped with backslash
|
|
107
|
+
*/
|
|
108
|
+
escapeQueryString(str) {
|
|
109
|
+
return str.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Check if a string looks like a Google Drive file ID
|
|
113
|
+
* Drive file IDs are typically 28-44 characters, alphanumeric with - and _
|
|
114
|
+
*/
|
|
115
|
+
isFileId(id) {
|
|
116
|
+
// More permissive regex to handle various Google Drive ID formats
|
|
117
|
+
return /^[a-zA-Z0-9_-]{20,50}$/.test(id) && !id.includes('/');
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Check if an error is a "not found" error
|
|
121
|
+
* Google APIs uses error.code (number) or error.errors[].reason
|
|
122
|
+
*/
|
|
123
|
+
isNotFoundError(error) {
|
|
124
|
+
return (error.code === 404 ||
|
|
125
|
+
error.status === 404 ||
|
|
126
|
+
error.errors?.some((e) => e.reason === 'notFound'));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Find a file by name in the configured folder
|
|
130
|
+
*/
|
|
131
|
+
async findFile(id) {
|
|
132
|
+
const drive = await this.getClient();
|
|
133
|
+
const fileName = this.getFileName(id);
|
|
134
|
+
const escapedFileName = this.escapeQueryString(fileName);
|
|
135
|
+
const folderId = this.getParentFolderId();
|
|
136
|
+
const response = await drive.files.list({
|
|
137
|
+
q: `name = '${escapedFileName}' and '${folderId}' in parents and trashed = false`,
|
|
138
|
+
fields: 'files(id, name)',
|
|
139
|
+
spaces: 'drive',
|
|
140
|
+
});
|
|
141
|
+
if (response.data.files && response.data.files.length > 0) {
|
|
142
|
+
return response.data.files[0].id ?? null;
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Write content to Google Drive
|
|
148
|
+
*/
|
|
149
|
+
async write(id, content) {
|
|
150
|
+
const drive = await this.getClient();
|
|
151
|
+
const fileName = this.getFileName(id);
|
|
152
|
+
const folderId = this.getParentFolderId();
|
|
153
|
+
// Check if file already exists
|
|
154
|
+
const existingFileId = await this.findFile(id);
|
|
155
|
+
const media = {
|
|
156
|
+
mimeType: 'text/plain',
|
|
157
|
+
body: content,
|
|
158
|
+
};
|
|
159
|
+
let fileId;
|
|
160
|
+
if (existingFileId) {
|
|
161
|
+
// Update existing file
|
|
162
|
+
const response = await drive.files.update({
|
|
163
|
+
fileId: existingFileId,
|
|
164
|
+
media,
|
|
165
|
+
fields: 'id',
|
|
166
|
+
});
|
|
167
|
+
if (!response.data.id) {
|
|
168
|
+
throw new Error('Failed to update file: no file ID returned');
|
|
169
|
+
}
|
|
170
|
+
fileId = response.data.id;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
// Create new file
|
|
174
|
+
const fileMetadata = {
|
|
175
|
+
name: fileName,
|
|
176
|
+
parents: [folderId],
|
|
177
|
+
};
|
|
178
|
+
const response = await drive.files.create({
|
|
179
|
+
requestBody: fileMetadata,
|
|
180
|
+
media,
|
|
181
|
+
fields: 'id',
|
|
182
|
+
});
|
|
183
|
+
if (!response.data.id) {
|
|
184
|
+
throw new Error('Failed to create file: no file ID returned');
|
|
185
|
+
}
|
|
186
|
+
fileId = response.data.id;
|
|
187
|
+
}
|
|
188
|
+
return `gdrive://${fileId}`;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Read content from Google Drive
|
|
192
|
+
*/
|
|
193
|
+
async read(id) {
|
|
194
|
+
const drive = await this.getClient();
|
|
195
|
+
// Check if id is a direct file ID or a path-like name
|
|
196
|
+
let fileId = id;
|
|
197
|
+
if (!this.isFileId(id)) {
|
|
198
|
+
// Looks like a path, search for the file
|
|
199
|
+
fileId = (await this.findFile(id)) || id;
|
|
200
|
+
}
|
|
201
|
+
try {
|
|
202
|
+
const response = await drive.files.get({
|
|
203
|
+
fileId,
|
|
204
|
+
alt: 'media',
|
|
205
|
+
});
|
|
206
|
+
return response.data;
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
if (this.isNotFoundError(error)) {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Check if file exists in Google Drive
|
|
217
|
+
*/
|
|
218
|
+
async exists(id) {
|
|
219
|
+
try {
|
|
220
|
+
const fileId = await this.findFile(id);
|
|
221
|
+
return fileId !== null;
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
// Only treat "not found" as false, rethrow other errors
|
|
225
|
+
if (this.isNotFoundError(error)) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* List files in the configured Google Drive folder
|
|
233
|
+
*/
|
|
234
|
+
async list(prefix) {
|
|
235
|
+
const drive = await this.getClient();
|
|
236
|
+
const folderId = this.getParentFolderId();
|
|
237
|
+
const results = [];
|
|
238
|
+
let pageToken;
|
|
239
|
+
do {
|
|
240
|
+
let query = `'${folderId}' in parents and trashed = false`;
|
|
241
|
+
if (prefix) {
|
|
242
|
+
const escapedPrefix = this.escapeQueryString(prefix);
|
|
243
|
+
query += ` and name contains '${escapedPrefix}'`;
|
|
244
|
+
}
|
|
245
|
+
const response = await drive.files.list({
|
|
246
|
+
q: query,
|
|
247
|
+
fields: 'nextPageToken, files(id, name)',
|
|
248
|
+
spaces: 'drive',
|
|
249
|
+
pageToken,
|
|
250
|
+
});
|
|
251
|
+
if (response.data.files) {
|
|
252
|
+
for (const file of response.data.files) {
|
|
253
|
+
if (file.name) {
|
|
254
|
+
results.push(file.name);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
pageToken = response.data.nextPageToken ?? undefined;
|
|
259
|
+
} while (pageToken);
|
|
260
|
+
return results;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Delete file from Google Drive
|
|
264
|
+
*/
|
|
265
|
+
async delete(id) {
|
|
266
|
+
const drive = await this.getClient();
|
|
267
|
+
// Check if id is a direct file ID or a path-like name
|
|
268
|
+
let fileId = id;
|
|
269
|
+
if (!this.isFileId(id)) {
|
|
270
|
+
fileId = (await this.findFile(id)) || id;
|
|
271
|
+
}
|
|
272
|
+
try {
|
|
273
|
+
await drive.files.delete({ fileId });
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
// Ignore if file doesn't exist
|
|
277
|
+
if (!this.isNotFoundError(error)) {
|
|
278
|
+
throw error;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Get a shareable URL for the file
|
|
284
|
+
*/
|
|
285
|
+
async getUrl(id, _expiresIn) {
|
|
286
|
+
// Check if id is a direct file ID or a path-like name
|
|
287
|
+
let fileId = id;
|
|
288
|
+
if (!this.isFileId(id)) {
|
|
289
|
+
fileId = (await this.findFile(id)) || id;
|
|
290
|
+
}
|
|
291
|
+
// Return the standard Google Drive view URL
|
|
292
|
+
return `https://drive.google.com/file/d/${fileId}/view`;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Get the configured folder ID
|
|
296
|
+
*/
|
|
297
|
+
getFolderId() {
|
|
298
|
+
return this.config.folderId || 'root';
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
exports.GDriveStorage = GDriveStorage;
|
|
302
|
+
//# sourceMappingURL=gdrive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gdrive.js","sourceRoot":"","sources":["../../src/file/gdrive.ts"],"names":[],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,CAAC,IAAI,EAAE,CAAC;QAC3C,CAAC;QAED,4CAA4C;QAC5C,OAAO,mCAAmC,MAAM,OAAO,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC;IACxC,CAAC;CACF;AArSD,sCAqSC"}
|
package/dist/file/index.d.ts
CHANGED
|
@@ -2,8 +2,20 @@
|
|
|
2
2
|
* @fractary/core - File Module
|
|
3
3
|
*
|
|
4
4
|
* File storage operations across local and cloud storage backends.
|
|
5
|
+
*
|
|
6
|
+
* Supported backends:
|
|
7
|
+
* - LocalStorage: Local filesystem
|
|
8
|
+
* - S3Storage: AWS S3 (requires @aws-sdk/client-s3)
|
|
9
|
+
* - R2Storage: Cloudflare R2 (requires @aws-sdk/client-s3)
|
|
10
|
+
* - GCSStorage: Google Cloud Storage (requires @google-cloud/storage)
|
|
11
|
+
* - GDriveStorage: Google Drive (requires googleapis)
|
|
5
12
|
*/
|
|
6
|
-
export { FileManager } from './manager';
|
|
13
|
+
export { FileManager, FileManagerOptions } from './manager';
|
|
7
14
|
export { LocalStorage } from './local';
|
|
15
|
+
export { S3Storage } from './s3';
|
|
16
|
+
export { R2Storage } from './r2';
|
|
17
|
+
export { GCSStorage } from './gcs';
|
|
18
|
+
export { GDriveStorage } from './gdrive';
|
|
19
|
+
export { createStorage, createStorageFromSource, sourceConfigToStorageConfig, getDefaultStorageType, } from './factory';
|
|
8
20
|
export * from './types';
|
|
9
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/file/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAGnB,cAAc,SAAS,CAAC"}
|
package/dist/file/index.js
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* @fractary/core - File Module
|
|
4
4
|
*
|
|
5
5
|
* File storage operations across local and cloud storage backends.
|
|
6
|
+
*
|
|
7
|
+
* Supported backends:
|
|
8
|
+
* - LocalStorage: Local filesystem
|
|
9
|
+
* - S3Storage: AWS S3 (requires @aws-sdk/client-s3)
|
|
10
|
+
* - R2Storage: Cloudflare R2 (requires @aws-sdk/client-s3)
|
|
11
|
+
* - GCSStorage: Google Cloud Storage (requires @google-cloud/storage)
|
|
12
|
+
* - GDriveStorage: Google Drive (requires googleapis)
|
|
6
13
|
*/
|
|
7
14
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
15
|
if (k2 === undefined) k2 = k;
|
|
@@ -19,10 +26,27 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
19
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
27
|
};
|
|
21
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.LocalStorage = exports.FileManager = void 0;
|
|
29
|
+
exports.getDefaultStorageType = exports.sourceConfigToStorageConfig = exports.createStorageFromSource = exports.createStorage = exports.GDriveStorage = exports.GCSStorage = exports.R2Storage = exports.S3Storage = exports.LocalStorage = exports.FileManager = void 0;
|
|
30
|
+
// Core exports
|
|
23
31
|
var manager_1 = require("./manager");
|
|
24
32
|
Object.defineProperty(exports, "FileManager", { enumerable: true, get: function () { return manager_1.FileManager; } });
|
|
25
33
|
var local_1 = require("./local");
|
|
26
34
|
Object.defineProperty(exports, "LocalStorage", { enumerable: true, get: function () { return local_1.LocalStorage; } });
|
|
35
|
+
// Cloud storage implementations (lazy loaded)
|
|
36
|
+
var s3_1 = require("./s3");
|
|
37
|
+
Object.defineProperty(exports, "S3Storage", { enumerable: true, get: function () { return s3_1.S3Storage; } });
|
|
38
|
+
var r2_1 = require("./r2");
|
|
39
|
+
Object.defineProperty(exports, "R2Storage", { enumerable: true, get: function () { return r2_1.R2Storage; } });
|
|
40
|
+
var gcs_1 = require("./gcs");
|
|
41
|
+
Object.defineProperty(exports, "GCSStorage", { enumerable: true, get: function () { return gcs_1.GCSStorage; } });
|
|
42
|
+
var gdrive_1 = require("./gdrive");
|
|
43
|
+
Object.defineProperty(exports, "GDriveStorage", { enumerable: true, get: function () { return gdrive_1.GDriveStorage; } });
|
|
44
|
+
// Factory functions
|
|
45
|
+
var factory_1 = require("./factory");
|
|
46
|
+
Object.defineProperty(exports, "createStorage", { enumerable: true, get: function () { return factory_1.createStorage; } });
|
|
47
|
+
Object.defineProperty(exports, "createStorageFromSource", { enumerable: true, get: function () { return factory_1.createStorageFromSource; } });
|
|
48
|
+
Object.defineProperty(exports, "sourceConfigToStorageConfig", { enumerable: true, get: function () { return factory_1.sourceConfigToStorageConfig; } });
|
|
49
|
+
Object.defineProperty(exports, "getDefaultStorageType", { enumerable: true, get: function () { return factory_1.getDefaultStorageType; } });
|
|
50
|
+
// Type exports
|
|
27
51
|
__exportStar(require("./types"), exports);
|
|
28
52
|
//# sourceMappingURL=index.js.map
|
package/dist/file/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/file/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/file/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;AAEH,eAAe;AACf,qCAA4D;AAAnD,sGAAA,WAAW,OAAA;AACpB,iCAAuC;AAA9B,qGAAA,YAAY,OAAA;AAErB,8CAA8C;AAC9C,2BAAiC;AAAxB,+FAAA,SAAS,OAAA;AAClB,2BAAiC;AAAxB,+FAAA,SAAS,OAAA;AAClB,6BAAmC;AAA1B,iGAAA,UAAU,OAAA;AACnB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAEtB,oBAAoB;AACpB,qCAKmB;AAJjB,wGAAA,aAAa,OAAA;AACb,kHAAA,uBAAuB,OAAA;AACvB,sHAAA,2BAA2B,OAAA;AAC3B,gHAAA,qBAAqB,OAAA;AAGvB,eAAe;AACf,0CAAwB"}
|
package/dist/file/manager.d.ts
CHANGED
|
@@ -2,41 +2,122 @@
|
|
|
2
2
|
* @fractary/core - File Manager
|
|
3
3
|
*
|
|
4
4
|
* Unified interface for file storage operations.
|
|
5
|
+
* Supports multiple storage backends: local, S3, R2, GCS, Google Drive.
|
|
5
6
|
*/
|
|
6
|
-
import { FileManagerConfig } from './types';
|
|
7
|
+
import { Storage, FileManagerConfig, StorageConfig } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Extended configuration options for FileManager
|
|
10
|
+
*/
|
|
11
|
+
export interface FileManagerOptions extends FileManagerConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Storage configuration for automatic backend selection
|
|
14
|
+
* If provided, this takes precedence over storage and basePath
|
|
15
|
+
*/
|
|
16
|
+
storageConfig?: StorageConfig;
|
|
17
|
+
}
|
|
7
18
|
/**
|
|
8
19
|
* File Manager - Unified interface for file operations
|
|
20
|
+
*
|
|
21
|
+
* Provides a consistent API for file operations across different storage backends.
|
|
22
|
+
* Supports local filesystem, AWS S3, Cloudflare R2, Google Cloud Storage,
|
|
23
|
+
* and Google Drive.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Local storage (default)
|
|
27
|
+
* const localManager = new FileManager({ basePath: '.fractary/files' });
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // S3 storage with configuration
|
|
31
|
+
* const s3Manager = new FileManager({
|
|
32
|
+
* storageConfig: {
|
|
33
|
+
* type: 's3',
|
|
34
|
+
* bucket: 'my-bucket',
|
|
35
|
+
* region: 'us-east-1',
|
|
36
|
+
* prefix: 'files/',
|
|
37
|
+
* auth: { profile: 'default' }
|
|
38
|
+
* }
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Custom storage backend
|
|
43
|
+
* const customManager = new FileManager({
|
|
44
|
+
* storage: myCustomStorage
|
|
45
|
+
* });
|
|
9
46
|
*/
|
|
10
47
|
export declare class FileManager {
|
|
11
48
|
private storage;
|
|
12
|
-
constructor(config
|
|
49
|
+
constructor(config?: FileManagerOptions);
|
|
50
|
+
/**
|
|
51
|
+
* Validate a file path for security issues
|
|
52
|
+
*
|
|
53
|
+
* @param path - Path to validate
|
|
54
|
+
* @throws Error if path is invalid or contains security issues
|
|
55
|
+
*/
|
|
56
|
+
private validatePath;
|
|
13
57
|
/**
|
|
14
58
|
* Write file content
|
|
59
|
+
*
|
|
60
|
+
* @param path - Path/identifier for the file
|
|
61
|
+
* @param content - Content to write
|
|
62
|
+
* @returns URI or path where the content was written
|
|
15
63
|
*/
|
|
16
64
|
write(path: string, content: string): Promise<string>;
|
|
17
65
|
/**
|
|
18
66
|
* Read file content
|
|
67
|
+
*
|
|
68
|
+
* @param path - Path/identifier for the file
|
|
69
|
+
* @returns File content or null if not found
|
|
19
70
|
*/
|
|
20
71
|
read(path: string): Promise<string | null>;
|
|
21
72
|
/**
|
|
22
73
|
* Check if file exists
|
|
74
|
+
*
|
|
75
|
+
* @param path - Path/identifier for the file
|
|
76
|
+
* @returns True if the file exists
|
|
23
77
|
*/
|
|
24
78
|
exists(path: string): Promise<boolean>;
|
|
25
79
|
/**
|
|
26
80
|
* List files (optionally with prefix)
|
|
81
|
+
*
|
|
82
|
+
* @param prefix - Optional prefix to filter results
|
|
83
|
+
* @returns List of file paths/identifiers
|
|
27
84
|
*/
|
|
28
85
|
list(prefix?: string): Promise<string[]>;
|
|
29
86
|
/**
|
|
30
87
|
* Delete file
|
|
88
|
+
*
|
|
89
|
+
* @param path - Path/identifier for the file
|
|
31
90
|
*/
|
|
32
91
|
delete(path: string): Promise<void>;
|
|
33
92
|
/**
|
|
34
93
|
* Copy file from one location to another
|
|
94
|
+
*
|
|
95
|
+
* @param sourcePath - Source path/identifier
|
|
96
|
+
* @param destPath - Destination path/identifier
|
|
97
|
+
* @returns URI or path where the content was copied
|
|
35
98
|
*/
|
|
36
99
|
copy(sourcePath: string, destPath: string): Promise<string>;
|
|
37
100
|
/**
|
|
38
101
|
* Move file from one location to another
|
|
102
|
+
*
|
|
103
|
+
* @param sourcePath - Source path/identifier
|
|
104
|
+
* @param destPath - Destination path/identifier
|
|
105
|
+
* @returns URI or path where the content was moved
|
|
39
106
|
*/
|
|
40
107
|
move(sourcePath: string, destPath: string): Promise<string>;
|
|
108
|
+
/**
|
|
109
|
+
* Get a URL for the file (if supported by the storage backend)
|
|
110
|
+
*
|
|
111
|
+
* @param path - Path/identifier for the file
|
|
112
|
+
* @param expiresIn - Expiration time in seconds (for presigned URLs)
|
|
113
|
+
* @returns URL or null if not supported
|
|
114
|
+
*/
|
|
115
|
+
getUrl(path: string, expiresIn?: number): Promise<string | null>;
|
|
116
|
+
/**
|
|
117
|
+
* Get the underlying storage backend
|
|
118
|
+
*
|
|
119
|
+
* @returns The storage instance
|
|
120
|
+
*/
|
|
121
|
+
getStorage(): Storage;
|
|
41
122
|
}
|
|
42
123
|
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/file/manager.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