tuturuuu 0.0.1 → 0.0.2
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 +21 -0
- package/README.md +87 -0
- package/dist/errors.d.ts +75 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +155 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/storage.d.ts +280 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +612 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +251 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +70 -0
- package/dist/types.js.map +1 -0
- package/package.json +40 -12
- package/src/documents.test.ts +0 -523
- package/src/errors.test.ts +0 -278
- package/src/errors.ts +0 -161
- package/src/index.ts +0 -60
- package/src/storage.test.ts +0 -604
- package/src/storage.ts +0 -702
- package/src/types.test.ts +0 -562
- package/src/types.ts +0 -291
package/dist/storage.js
ADDED
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tuturuuu Storage SDK
|
|
4
|
+
*
|
|
5
|
+
* Official SDK for interacting with Tuturuuu workspace resources
|
|
6
|
+
* including storage (files/folders) and documents.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { TuturuuuClient } from 'tuturuuu';
|
|
11
|
+
*
|
|
12
|
+
* const client = new TuturuuuClient('ttr_your_api_key');
|
|
13
|
+
*
|
|
14
|
+
* // List files
|
|
15
|
+
* const files = await client.storage.list({ path: 'documents' });
|
|
16
|
+
*
|
|
17
|
+
* // Upload a file
|
|
18
|
+
* const file = new File(['content'], 'example.txt');
|
|
19
|
+
* await client.storage.upload(file, { path: 'documents' });
|
|
20
|
+
*
|
|
21
|
+
* // Create a document
|
|
22
|
+
* const doc = await client.documents.create({
|
|
23
|
+
* name: 'My Document',
|
|
24
|
+
* content: 'Hello World'
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.TuturuuuClient = exports.DocumentsClient = exports.StorageClient = void 0;
|
|
33
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
34
|
+
const errors_1 = require("./errors");
|
|
35
|
+
const types_1 = require("./types");
|
|
36
|
+
/**
|
|
37
|
+
* Transform snake_case API response to camelCase SDK format
|
|
38
|
+
*/
|
|
39
|
+
function transformStorageObject(apiObject) {
|
|
40
|
+
return {
|
|
41
|
+
id: apiObject.id,
|
|
42
|
+
name: apiObject.name,
|
|
43
|
+
createdAt: apiObject.created_at,
|
|
44
|
+
updatedAt: apiObject.updated_at,
|
|
45
|
+
lastAccessedAt: apiObject.last_accessed_at,
|
|
46
|
+
metadata: apiObject.metadata,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Helper function to validate data with Zod schema and convert errors to ValidationError
|
|
51
|
+
*/
|
|
52
|
+
function validateWithSchema(schema, data) {
|
|
53
|
+
try {
|
|
54
|
+
return schema.parse(data);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
// Check if it's a Zod error by presence of errors array
|
|
58
|
+
if (error &&
|
|
59
|
+
typeof error === 'object' &&
|
|
60
|
+
'issues' in error &&
|
|
61
|
+
Array.isArray(error.issues)) {
|
|
62
|
+
const zodError = error;
|
|
63
|
+
const message = zodError.issues
|
|
64
|
+
.map((e) => {
|
|
65
|
+
const path = e.path && e.path.length > 0 ? `${e.path.join('.')}: ` : '';
|
|
66
|
+
return `${path}${e.message}`;
|
|
67
|
+
})
|
|
68
|
+
.join(', ');
|
|
69
|
+
throw new errors_1.ValidationError(message);
|
|
70
|
+
}
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Storage operations client
|
|
76
|
+
*/
|
|
77
|
+
class StorageClient {
|
|
78
|
+
client;
|
|
79
|
+
constructor(client) {
|
|
80
|
+
this.client = client;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Lists files and folders in the workspace drive
|
|
84
|
+
*
|
|
85
|
+
* @param options - Options for listing files
|
|
86
|
+
* @returns List of storage objects with pagination
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const files = await client.storage.list({
|
|
91
|
+
* path: 'documents',
|
|
92
|
+
* search: 'report',
|
|
93
|
+
* limit: 50,
|
|
94
|
+
* sortBy: 'created_at',
|
|
95
|
+
* sortOrder: 'desc'
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
async list(options = {}) {
|
|
100
|
+
// Validate options
|
|
101
|
+
const validatedOptions = validateWithSchema(types_1.listStorageOptionsSchema, options);
|
|
102
|
+
const params = new URLSearchParams();
|
|
103
|
+
if (validatedOptions.path)
|
|
104
|
+
params.set('path', validatedOptions.path);
|
|
105
|
+
if (validatedOptions.search)
|
|
106
|
+
params.set('search', validatedOptions.search);
|
|
107
|
+
if (validatedOptions.limit !== undefined)
|
|
108
|
+
params.set('limit', validatedOptions.limit.toString());
|
|
109
|
+
if (validatedOptions.offset !== undefined)
|
|
110
|
+
params.set('offset', validatedOptions.offset.toString());
|
|
111
|
+
if (validatedOptions.sortBy)
|
|
112
|
+
params.set('sortBy', validatedOptions.sortBy);
|
|
113
|
+
if (validatedOptions.sortOrder)
|
|
114
|
+
params.set('sortOrder', validatedOptions.sortOrder);
|
|
115
|
+
const response = await this.client.request(`/storage/list?${params.toString()}`);
|
|
116
|
+
// Transform snake_case API response to camelCase SDK format
|
|
117
|
+
return {
|
|
118
|
+
data: response.data.map(transformStorageObject),
|
|
119
|
+
pagination: response.pagination,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Uploads a file to the workspace drive using signed upload URLs
|
|
124
|
+
*
|
|
125
|
+
* This method first requests a signed upload URL from the platform,
|
|
126
|
+
* then uploads the file directly to Supabase Storage. This approach
|
|
127
|
+
* is more efficient and secure than proxying files through the API.
|
|
128
|
+
*
|
|
129
|
+
* @param file - File to upload (File or Blob)
|
|
130
|
+
* @param options - Upload options
|
|
131
|
+
* @returns Upload result with path information
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const file = new File(['content'], 'document.pdf');
|
|
136
|
+
* const result = await client.storage.upload(file, {
|
|
137
|
+
* path: 'documents',
|
|
138
|
+
* upsert: true
|
|
139
|
+
* });
|
|
140
|
+
*
|
|
141
|
+
* // For Buffer in Node.js, convert to Blob first:
|
|
142
|
+
* const buffer = Buffer.from('content');
|
|
143
|
+
* const blob = new Blob([buffer]);
|
|
144
|
+
* await client.storage.upload(blob, { path: 'documents' });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
async upload(file, options = {}) {
|
|
148
|
+
// Validate options
|
|
149
|
+
const validatedOptions = validateWithSchema(types_1.uploadOptionsSchema, options);
|
|
150
|
+
// Extract filename from File or use default for Blob
|
|
151
|
+
const filename = file instanceof File ? file.name : `file-${Date.now()}.bin`;
|
|
152
|
+
// Step 1: Request a signed upload URL from the platform
|
|
153
|
+
const signedUrlResponse = await this.client.request('/storage/upload-url', {
|
|
154
|
+
method: 'POST',
|
|
155
|
+
body: JSON.stringify({
|
|
156
|
+
filename,
|
|
157
|
+
path: validatedOptions.path || '',
|
|
158
|
+
upsert: validatedOptions.upsert ?? false,
|
|
159
|
+
}),
|
|
160
|
+
});
|
|
161
|
+
const { signedUrl, path } = signedUrlResponse.data;
|
|
162
|
+
// Step 2: Upload the file directly to Supabase using the signed URL
|
|
163
|
+
try {
|
|
164
|
+
const uploadResponse = await this.client.fetch(signedUrl, {
|
|
165
|
+
method: 'PUT',
|
|
166
|
+
body: file,
|
|
167
|
+
headers: {
|
|
168
|
+
'Content-Type': file instanceof File ? file.type : 'application/octet-stream',
|
|
169
|
+
'x-upsert': validatedOptions.upsert ? 'true' : 'false',
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
if (!uploadResponse.ok) {
|
|
173
|
+
const errorText = await uploadResponse.text();
|
|
174
|
+
throw new errors_1.NetworkError(`Upload failed: ${uploadResponse.status} ${uploadResponse.statusText} - ${errorText}`);
|
|
175
|
+
}
|
|
176
|
+
// Return success response in the expected format
|
|
177
|
+
// Remove "[wsId]/" prefix to get relative path
|
|
178
|
+
// Path format from API: [wsId]/[relativePath]
|
|
179
|
+
const relativePath = path.replace(/^[^/]+\//, '');
|
|
180
|
+
return {
|
|
181
|
+
message: 'File uploaded successfully',
|
|
182
|
+
data: {
|
|
183
|
+
path: relativePath,
|
|
184
|
+
fullPath: path,
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
if (error instanceof errors_1.NetworkError) {
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
throw new errors_1.NetworkError(`Failed to upload file: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Downloads a file from the workspace drive
|
|
197
|
+
*
|
|
198
|
+
* @param path - Path to the file
|
|
199
|
+
* @returns File blob
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const blob = await client.storage.download('documents/report.pdf');
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
async download(path) {
|
|
207
|
+
if (!path) {
|
|
208
|
+
throw new errors_1.ValidationError('Path is required');
|
|
209
|
+
}
|
|
210
|
+
// Properly encode path to handle spaces and special characters
|
|
211
|
+
// Normalize backslashes to forward slashes
|
|
212
|
+
const normalizedPath = path.replace(/\\/g, '/');
|
|
213
|
+
// Split path into segments, encode each segment, and rejoin
|
|
214
|
+
const segments = normalizedPath.split('/').filter((s) => s.length > 0);
|
|
215
|
+
const encodedPath = segments.map((s) => encodeURIComponent(s)).join('/');
|
|
216
|
+
// Ensure baseUrl doesn't end with slash to avoid double slashes
|
|
217
|
+
const baseUrl = this.client.baseUrl.replace(/\/$/, '');
|
|
218
|
+
const response = await this.client.fetch(`${baseUrl}/storage/download/${encodedPath}`, {
|
|
219
|
+
method: 'GET',
|
|
220
|
+
headers: {
|
|
221
|
+
Authorization: `Bearer ${this.client.apiKey}`,
|
|
222
|
+
'X-SDK-Client': `tuturuuu/${package_json_1.default.version || '0.0.1'}`,
|
|
223
|
+
Accept: 'application/octet-stream, */*',
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
if (!response.ok) {
|
|
227
|
+
// Check if response is JSON before attempting to parse
|
|
228
|
+
const contentType = response.headers.get('content-type');
|
|
229
|
+
const isJson = contentType?.toLowerCase().includes('application/json');
|
|
230
|
+
if (isJson) {
|
|
231
|
+
try {
|
|
232
|
+
const errorData = await response.json();
|
|
233
|
+
if ((0, errors_1.isApiErrorResponse)(errorData)) {
|
|
234
|
+
throw (0, errors_1.createErrorFromResponse)(errorData, response.status);
|
|
235
|
+
}
|
|
236
|
+
throw new errors_1.NetworkError(`HTTP ${response.status}: ${response.statusText}`);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
// If JSON parsing fails, fall back to text
|
|
240
|
+
if (error instanceof SyntaxError) {
|
|
241
|
+
const text = await response.text();
|
|
242
|
+
throw new errors_1.NetworkError(`HTTP ${response.status}: ${response.statusText} - ${text.substring(0, 200)}`);
|
|
243
|
+
}
|
|
244
|
+
throw error;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
// Non-JSON response
|
|
249
|
+
const text = await response.text();
|
|
250
|
+
throw new errors_1.NetworkError(`HTTP ${response.status}: ${response.statusText} - ${text.substring(0, 200)}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return response.blob();
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Deletes files or folders from the workspace drive
|
|
257
|
+
*
|
|
258
|
+
* @param paths - Array of paths to delete
|
|
259
|
+
* @returns Delete result
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* const result = await client.storage.delete([
|
|
264
|
+
* 'documents/old-report.pdf',
|
|
265
|
+
* 'images/screenshot.png'
|
|
266
|
+
* ]);
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
async delete(paths) {
|
|
270
|
+
if (!Array.isArray(paths) || paths.length === 0) {
|
|
271
|
+
throw new errors_1.ValidationError('At least one path is required');
|
|
272
|
+
}
|
|
273
|
+
if (paths.length > 100) {
|
|
274
|
+
throw new errors_1.ValidationError('Maximum 100 paths can be deleted at once');
|
|
275
|
+
}
|
|
276
|
+
return this.client.request('/storage/delete', {
|
|
277
|
+
method: 'DELETE',
|
|
278
|
+
body: JSON.stringify({ paths }),
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Creates a new folder in the workspace drive
|
|
283
|
+
*
|
|
284
|
+
* @param path - Parent path
|
|
285
|
+
* @param name - Folder name
|
|
286
|
+
* @returns Create folder result
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```typescript
|
|
290
|
+
* const result = await client.storage.createFolder('documents', 'reports');
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
async createFolder(path, name) {
|
|
294
|
+
if (!name) {
|
|
295
|
+
throw new errors_1.ValidationError('Folder name is required');
|
|
296
|
+
}
|
|
297
|
+
return this.client.request('/storage/folders', {
|
|
298
|
+
method: 'POST',
|
|
299
|
+
body: JSON.stringify({ path, name }),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Generates a signed URL for sharing a file
|
|
304
|
+
*
|
|
305
|
+
* @param path - Path to the file
|
|
306
|
+
* @param options - Share options
|
|
307
|
+
* @returns Signed URL with expiration
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* const result = await client.storage.share('documents/report.pdf', {
|
|
312
|
+
* expiresIn: 3600 // 1 hour
|
|
313
|
+
* });
|
|
314
|
+
* console.log(result.data.signedUrl);
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
async share(path, options = {}) {
|
|
318
|
+
if (!path) {
|
|
319
|
+
throw new errors_1.ValidationError('Path is required');
|
|
320
|
+
}
|
|
321
|
+
// Validate options
|
|
322
|
+
const validatedOptions = validateWithSchema(types_1.shareOptionsSchema, options);
|
|
323
|
+
return this.client.request('/storage/share', {
|
|
324
|
+
method: 'POST',
|
|
325
|
+
body: JSON.stringify({
|
|
326
|
+
path,
|
|
327
|
+
expiresIn: validatedOptions.expiresIn,
|
|
328
|
+
}),
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Retrieves storage analytics for the workspace
|
|
333
|
+
*
|
|
334
|
+
* @returns Storage usage statistics
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* const analytics = await client.storage.getAnalytics();
|
|
339
|
+
* console.log(`Used: ${analytics.data.totalSize} bytes`);
|
|
340
|
+
* console.log(`Files: ${analytics.data.fileCount}`);
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
async getAnalytics() {
|
|
344
|
+
return this.client.request('/storage/analytics');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
exports.StorageClient = StorageClient;
|
|
348
|
+
/**
|
|
349
|
+
* Documents operations client
|
|
350
|
+
*/
|
|
351
|
+
class DocumentsClient {
|
|
352
|
+
client;
|
|
353
|
+
constructor(client) {
|
|
354
|
+
this.client = client;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Lists documents in the workspace
|
|
358
|
+
*
|
|
359
|
+
* @param options - Options for listing documents
|
|
360
|
+
* @returns List of documents with pagination
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* const docs = await client.documents.list({
|
|
365
|
+
* search: 'meeting',
|
|
366
|
+
* limit: 20,
|
|
367
|
+
* isPublic: false
|
|
368
|
+
* });
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
async list(options = {}) {
|
|
372
|
+
// Validate options
|
|
373
|
+
const validatedOptions = validateWithSchema(types_1.listDocumentsOptionsSchema, options);
|
|
374
|
+
const params = new URLSearchParams();
|
|
375
|
+
if (validatedOptions.search)
|
|
376
|
+
params.set('search', validatedOptions.search);
|
|
377
|
+
if (validatedOptions.limit !== undefined)
|
|
378
|
+
params.set('limit', validatedOptions.limit.toString());
|
|
379
|
+
if (validatedOptions.offset !== undefined)
|
|
380
|
+
params.set('offset', validatedOptions.offset.toString());
|
|
381
|
+
if (validatedOptions.isPublic !== undefined)
|
|
382
|
+
params.set('isPublic', validatedOptions.isPublic.toString());
|
|
383
|
+
return this.client.request(`/documents?${params.toString()}`);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Creates a new document
|
|
387
|
+
*
|
|
388
|
+
* @param data - Document data
|
|
389
|
+
* @returns Created document
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```typescript
|
|
393
|
+
* const doc = await client.documents.create({
|
|
394
|
+
* name: 'Meeting Notes',
|
|
395
|
+
* content: 'Discussion points...',
|
|
396
|
+
* isPublic: false
|
|
397
|
+
* });
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
async create(data) {
|
|
401
|
+
// Validate data
|
|
402
|
+
const validatedData = validateWithSchema(types_1.createDocumentDataSchema, data);
|
|
403
|
+
return this.client.request('/documents', {
|
|
404
|
+
method: 'POST',
|
|
405
|
+
body: JSON.stringify(validatedData),
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Gets a document by ID
|
|
410
|
+
*
|
|
411
|
+
* @param id - Document ID
|
|
412
|
+
* @returns Document data
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```typescript
|
|
416
|
+
* const doc = await client.documents.get('doc-id-123');
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
async get(id) {
|
|
420
|
+
if (!id) {
|
|
421
|
+
throw new errors_1.ValidationError('Document ID is required');
|
|
422
|
+
}
|
|
423
|
+
return this.client.request(`/documents/${id}`);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Updates a document
|
|
427
|
+
*
|
|
428
|
+
* @param id - Document ID
|
|
429
|
+
* @param data - Update data
|
|
430
|
+
* @returns Updated document
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* const doc = await client.documents.update('doc-id-123', {
|
|
435
|
+
* name: 'Updated Meeting Notes',
|
|
436
|
+
* content: 'New content...'
|
|
437
|
+
* });
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
async update(id, data) {
|
|
441
|
+
if (!id) {
|
|
442
|
+
throw new errors_1.ValidationError('Document ID is required');
|
|
443
|
+
}
|
|
444
|
+
// Validate data
|
|
445
|
+
const validatedData = validateWithSchema(types_1.updateDocumentDataSchema, data);
|
|
446
|
+
return this.client.request(`/documents/${id}`, {
|
|
447
|
+
method: 'PATCH',
|
|
448
|
+
body: JSON.stringify(validatedData),
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Deletes a document
|
|
453
|
+
*
|
|
454
|
+
* @param id - Document ID
|
|
455
|
+
* @returns Delete confirmation
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* ```typescript
|
|
459
|
+
* await client.documents.delete('doc-id-123');
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
async delete(id) {
|
|
463
|
+
if (!id) {
|
|
464
|
+
throw new errors_1.ValidationError('Document ID is required');
|
|
465
|
+
}
|
|
466
|
+
return this.client.request(`/documents/${id}`, {
|
|
467
|
+
method: 'DELETE',
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Searches documents by name
|
|
472
|
+
* Alias for list() with search parameter
|
|
473
|
+
*
|
|
474
|
+
* @param query - Search query
|
|
475
|
+
* @param options - Additional list options
|
|
476
|
+
* @returns List of matching documents
|
|
477
|
+
*/
|
|
478
|
+
async search(query, options = {}) {
|
|
479
|
+
return this.list({ ...options, search: query });
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
exports.DocumentsClient = DocumentsClient;
|
|
483
|
+
/**
|
|
484
|
+
* Main Tuturuuu SDK client
|
|
485
|
+
*/
|
|
486
|
+
class TuturuuuClient {
|
|
487
|
+
apiKey;
|
|
488
|
+
baseUrl;
|
|
489
|
+
timeout;
|
|
490
|
+
fetch;
|
|
491
|
+
storage;
|
|
492
|
+
documents;
|
|
493
|
+
/**
|
|
494
|
+
* Creates a new Tuturuuu client instance
|
|
495
|
+
*
|
|
496
|
+
* @param config - Client configuration
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```typescript
|
|
500
|
+
* const client = new TuturuuuClient({
|
|
501
|
+
* apiKey: 'ttr_your_api_key',
|
|
502
|
+
* baseUrl: 'https://tuturuuu.com/api/v1', // optional, this is the default
|
|
503
|
+
* timeout: 30000 // optional, default 30s
|
|
504
|
+
* });
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
constructor(config) {
|
|
508
|
+
// Support both string API key and config object
|
|
509
|
+
if (typeof config === 'string') {
|
|
510
|
+
this.apiKey = config;
|
|
511
|
+
this.baseUrl = 'https://tuturuuu.com/api/v1';
|
|
512
|
+
this.timeout = 30000;
|
|
513
|
+
this.fetch = globalThis.fetch;
|
|
514
|
+
}
|
|
515
|
+
else {
|
|
516
|
+
this.apiKey = config.apiKey;
|
|
517
|
+
this.baseUrl = config.baseUrl || 'https://tuturuuu.com/api/v1';
|
|
518
|
+
this.timeout = config.timeout || 30000;
|
|
519
|
+
this.fetch = config.fetch || globalThis.fetch;
|
|
520
|
+
}
|
|
521
|
+
// Validate API key
|
|
522
|
+
if (!this.apiKey || !this.apiKey.startsWith('ttr_')) {
|
|
523
|
+
throw new errors_1.ValidationError('Invalid API key format. Expected key to start with "ttr_"');
|
|
524
|
+
}
|
|
525
|
+
// Initialize sub-clients
|
|
526
|
+
this.storage = new StorageClient(this);
|
|
527
|
+
this.documents = new DocumentsClient(this);
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Internal method to make HTTP requests
|
|
531
|
+
* @internal
|
|
532
|
+
*/
|
|
533
|
+
async request(endpoint, options = {}) {
|
|
534
|
+
const { method = 'GET', body, skipJsonContentType = false } = options;
|
|
535
|
+
const headers = {
|
|
536
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
537
|
+
'X-SDK-Client': `tuturuuu/${package_json_1.default.version || '0.0.1'}`,
|
|
538
|
+
Accept: 'application/json',
|
|
539
|
+
};
|
|
540
|
+
// Only set Content-Type for JSON bodies
|
|
541
|
+
// For FormData, we must NOT set Content-Type - let fetch set it automatically with the boundary
|
|
542
|
+
if (!skipJsonContentType && typeof body === 'string') {
|
|
543
|
+
headers['Content-Type'] = 'application/json';
|
|
544
|
+
}
|
|
545
|
+
// IMPORTANT: When using FormData, we must not pass Content-Type header at all
|
|
546
|
+
// The fetch implementation will automatically set it with the correct multipart boundary
|
|
547
|
+
// If we pass any Content-Type (even undefined), it can interfere with boundary generation
|
|
548
|
+
const isFormData = body instanceof FormData;
|
|
549
|
+
try {
|
|
550
|
+
const controller = new AbortController();
|
|
551
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
552
|
+
const response = await this.fetch(`${this.baseUrl}${endpoint}`, {
|
|
553
|
+
method,
|
|
554
|
+
// For FormData, omit headers that might interfere with automatic Content-Type setting
|
|
555
|
+
headers: isFormData
|
|
556
|
+
? {
|
|
557
|
+
Authorization: headers.Authorization,
|
|
558
|
+
'X-SDK-Client': headers['X-SDK-Client'],
|
|
559
|
+
Accept: headers.Accept,
|
|
560
|
+
// Do NOT include Content-Type - let fetch set it automatically
|
|
561
|
+
}
|
|
562
|
+
: headers,
|
|
563
|
+
body,
|
|
564
|
+
signal: controller.signal,
|
|
565
|
+
});
|
|
566
|
+
clearTimeout(timeoutId);
|
|
567
|
+
if (!response.ok) {
|
|
568
|
+
// Check if response is JSON before attempting to parse
|
|
569
|
+
const contentType = response.headers.get('content-type');
|
|
570
|
+
const isJson = contentType?.toLowerCase().includes('application/json');
|
|
571
|
+
if (isJson) {
|
|
572
|
+
try {
|
|
573
|
+
const errorData = await response.json();
|
|
574
|
+
if ((0, errors_1.isApiErrorResponse)(errorData)) {
|
|
575
|
+
throw (0, errors_1.createErrorFromResponse)(errorData, response.status);
|
|
576
|
+
}
|
|
577
|
+
throw new errors_1.NetworkError(`HTTP ${response.status}: ${response.statusText}`);
|
|
578
|
+
}
|
|
579
|
+
catch (error) {
|
|
580
|
+
// If JSON parsing fails, fall back to text
|
|
581
|
+
if (error instanceof SyntaxError) {
|
|
582
|
+
const text = await response.text();
|
|
583
|
+
throw new errors_1.NetworkError(`HTTP ${response.status}: ${response.statusText} - ${text.substring(0, 200)}`);
|
|
584
|
+
}
|
|
585
|
+
throw error;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
// Non-JSON response
|
|
590
|
+
const text = await response.text();
|
|
591
|
+
throw new errors_1.NetworkError(`HTTP ${response.status}: ${response.statusText} - ${text.substring(0, 200)}`);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
// Check if success response is JSON before parsing
|
|
595
|
+
const contentType = response.headers.get('content-type');
|
|
596
|
+
const isJson = contentType?.toLowerCase().includes('application/json');
|
|
597
|
+
if (!isJson) {
|
|
598
|
+
const text = await response.text();
|
|
599
|
+
throw new errors_1.NetworkError(`Expected JSON response but received ${contentType || 'unknown content type'} - ${text.substring(0, 200)}`);
|
|
600
|
+
}
|
|
601
|
+
return response.json();
|
|
602
|
+
}
|
|
603
|
+
catch (error) {
|
|
604
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
605
|
+
throw new errors_1.NetworkError(`Request timeout after ${this.timeout}ms`);
|
|
606
|
+
}
|
|
607
|
+
throw error;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
exports.TuturuuuClient = TuturuuuClient;
|
|
612
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;;AAGH,mEAA0C;AAC1C,qCAKkB;AAoBlB,mCAOiB;AAEjB;;GAEG;AACH,SAAS,sBAAsB,CAAC,SAAc;IAC5C,OAAO;QACL,EAAE,EAAE,SAAS,CAAC,EAAE;QAChB,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,SAAS,EAAE,SAAS,CAAC,UAAU;QAC/B,SAAS,EAAE,SAAS,CAAC,UAAU;QAC/B,cAAc,EAAE,SAAS,CAAC,gBAAgB;QAC1C,QAAQ,EAAE,SAAS,CAAC,QAAQ;KAC7B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAI,MAAoB,EAAE,IAAa;IAChE,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,wDAAwD;QACxD,IACE,KAAK;YACL,OAAO,KAAK,KAAK,QAAQ;YACzB,QAAQ,IAAI,KAAK;YACjB,KAAK,CAAC,OAAO,CAAE,KAAa,CAAC,MAAM,CAAC,EACpC,CAAC;YACD,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