@temps-sdk/blob 0.0.1
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/client.d.ts +68 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +420 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +69 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +91 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +151 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +44 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { BlobClientConfig, BlobInfo, PutOptions, ListOptions, ListResult, BlobBody } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Blob client for interacting with the Temps Blob store
|
|
4
|
+
*/
|
|
5
|
+
export declare class BlobClient {
|
|
6
|
+
private readonly apiUrl;
|
|
7
|
+
private readonly token;
|
|
8
|
+
private readonly projectId?;
|
|
9
|
+
constructor(config?: BlobClientConfig);
|
|
10
|
+
/**
|
|
11
|
+
* Make an authenticated JSON request to the Blob API
|
|
12
|
+
*/
|
|
13
|
+
private jsonRequest;
|
|
14
|
+
/**
|
|
15
|
+
* Upload a blob
|
|
16
|
+
* @param pathname - The path/name for the blob (e.g., 'images/avatar.png')
|
|
17
|
+
* @param body - The content to upload
|
|
18
|
+
* @param options - Upload options
|
|
19
|
+
* @returns Information about the uploaded blob
|
|
20
|
+
*/
|
|
21
|
+
put(pathname: string, body: BlobBody, options?: PutOptions): Promise<BlobInfo>;
|
|
22
|
+
/**
|
|
23
|
+
* Delete one or more blobs
|
|
24
|
+
* @param urls - URL or array of URLs/pathnames to delete
|
|
25
|
+
*/
|
|
26
|
+
del(urls: string | string[]): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Get metadata for a blob
|
|
29
|
+
* @param url - URL of the blob
|
|
30
|
+
* @returns Blob metadata
|
|
31
|
+
*/
|
|
32
|
+
head(url: string): Promise<BlobInfo>;
|
|
33
|
+
/**
|
|
34
|
+
* List blobs with pagination
|
|
35
|
+
* @param options - List options (limit, prefix, cursor)
|
|
36
|
+
* @returns List of blobs with pagination info
|
|
37
|
+
*/
|
|
38
|
+
list(options?: ListOptions): Promise<ListResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Download a blob
|
|
41
|
+
* @param url - URL of the blob to download
|
|
42
|
+
* @returns Response object with blob content
|
|
43
|
+
*/
|
|
44
|
+
download(url: string): Promise<Response>;
|
|
45
|
+
/**
|
|
46
|
+
* Copy a blob to a new location
|
|
47
|
+
* @param fromUrl - Source blob URL
|
|
48
|
+
* @param toPathname - Destination path
|
|
49
|
+
* @returns Information about the copied blob
|
|
50
|
+
*/
|
|
51
|
+
copy(fromUrl: string, toPathname: string): Promise<BlobInfo>;
|
|
52
|
+
/**
|
|
53
|
+
* Guess content type from pathname extension
|
|
54
|
+
*/
|
|
55
|
+
private guessContentType;
|
|
56
|
+
/**
|
|
57
|
+
* Extract pathname from a full blob URL
|
|
58
|
+
* Returns the path WITHOUT project_id prefix (e.g., "example/file.txt")
|
|
59
|
+
*/
|
|
60
|
+
private extractPathname;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a new Blob client instance
|
|
64
|
+
* @param config - Client configuration
|
|
65
|
+
* @returns A new BlobClient instance
|
|
66
|
+
*/
|
|
67
|
+
export declare function createClient(config?: BlobClientConfig): BlobClient;
|
|
68
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,WAAW,EACX,UAAU,EAIV,QAAQ,EACT,MAAM,YAAY,CAAC;AAGpB;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;gBAExB,MAAM,GAAE,gBAAqB;IAkBzC;;OAEG;YACW,WAAW;IAgEzB;;;;;;OAMG;IACG,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IA+FpF;;;OAGG;IACG,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAajD;;;;OAIG;IACG,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IA+C1C;;;;OAIG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAqCtD;;;;OAIG;IACG,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAoC9C;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAsBlE;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAwCxB;;;OAGG;IACH,OAAO,CAAC,eAAe;CAuCxB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,UAAU,CAElE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { BlobError } from './errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Blob client for interacting with the Temps Blob store
|
|
4
|
+
*/
|
|
5
|
+
export class BlobClient {
|
|
6
|
+
apiUrl;
|
|
7
|
+
token;
|
|
8
|
+
projectId;
|
|
9
|
+
constructor(config = {}) {
|
|
10
|
+
const apiUrl = config.apiUrl || process.env.TEMPS_API_URL;
|
|
11
|
+
const token = config.token || process.env.TEMPS_TOKEN;
|
|
12
|
+
const projectId = config.projectId ?? (process.env.TEMPS_PROJECT_ID ? parseInt(process.env.TEMPS_PROJECT_ID, 10) : undefined);
|
|
13
|
+
if (!apiUrl) {
|
|
14
|
+
throw BlobError.missingConfig('apiUrl');
|
|
15
|
+
}
|
|
16
|
+
if (!token) {
|
|
17
|
+
throw BlobError.missingConfig('token');
|
|
18
|
+
}
|
|
19
|
+
// Remove trailing slash from API URL
|
|
20
|
+
this.apiUrl = apiUrl.replace(/\/$/, '');
|
|
21
|
+
this.token = token;
|
|
22
|
+
this.projectId = projectId;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Make an authenticated JSON request to the Blob API
|
|
26
|
+
*/
|
|
27
|
+
async jsonRequest(method, endpoint, body) {
|
|
28
|
+
const url = `${this.apiUrl}/api/blob${endpoint}`;
|
|
29
|
+
// For GET/HEAD requests, don't include a body (use query params instead)
|
|
30
|
+
const isBodyAllowed = !['GET', 'HEAD', 'OPTIONS'].includes(method.toUpperCase());
|
|
31
|
+
// Include projectId in body when set (only for non-GET methods)
|
|
32
|
+
const requestBody = isBodyAllowed
|
|
33
|
+
? (body
|
|
34
|
+
? (this.projectId !== undefined
|
|
35
|
+
? { ...body, projectId: this.projectId }
|
|
36
|
+
: body)
|
|
37
|
+
: (this.projectId !== undefined
|
|
38
|
+
? { projectId: this.projectId }
|
|
39
|
+
: undefined))
|
|
40
|
+
: undefined;
|
|
41
|
+
try {
|
|
42
|
+
const response = await fetch(url, {
|
|
43
|
+
method,
|
|
44
|
+
headers: {
|
|
45
|
+
'Content-Type': 'application/json',
|
|
46
|
+
'Authorization': `Bearer ${this.token}`,
|
|
47
|
+
},
|
|
48
|
+
body: requestBody ? JSON.stringify(requestBody) : undefined,
|
|
49
|
+
});
|
|
50
|
+
// Try to parse response as JSON, but handle non-JSON responses gracefully
|
|
51
|
+
let data;
|
|
52
|
+
const responseText = await response.text();
|
|
53
|
+
try {
|
|
54
|
+
data = JSON.parse(responseText);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// If JSON parsing fails, create an error with the raw response
|
|
58
|
+
if (!response.ok) {
|
|
59
|
+
throw new BlobError(`Request failed with status ${response.status}: ${responseText || response.statusText}`, { status: response.status });
|
|
60
|
+
}
|
|
61
|
+
throw new BlobError(`Failed to parse response as JSON: ${responseText.substring(0, 200)}`, { code: 'PARSE_ERROR' });
|
|
62
|
+
}
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
throw BlobError.fromResponse(response, data);
|
|
65
|
+
}
|
|
66
|
+
return data;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (error instanceof BlobError) {
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
throw BlobError.networkError(error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Upload a blob
|
|
77
|
+
* @param pathname - The path/name for the blob (e.g., 'images/avatar.png')
|
|
78
|
+
* @param body - The content to upload
|
|
79
|
+
* @param options - Upload options
|
|
80
|
+
* @returns Information about the uploaded blob
|
|
81
|
+
*/
|
|
82
|
+
async put(pathname, body, options) {
|
|
83
|
+
if (!pathname) {
|
|
84
|
+
throw BlobError.invalidInput('pathname is required');
|
|
85
|
+
}
|
|
86
|
+
// Build query params including project_id if set
|
|
87
|
+
const queryParams = new URLSearchParams();
|
|
88
|
+
queryParams.set('pathname', pathname);
|
|
89
|
+
if (options?.contentType) {
|
|
90
|
+
queryParams.set('content_type', options.contentType);
|
|
91
|
+
}
|
|
92
|
+
if (options?.addRandomSuffix !== undefined) {
|
|
93
|
+
queryParams.set('add_random_suffix', String(options.addRandomSuffix));
|
|
94
|
+
}
|
|
95
|
+
if (this.projectId !== undefined) {
|
|
96
|
+
queryParams.set('project_id', String(this.projectId));
|
|
97
|
+
}
|
|
98
|
+
const url = `${this.apiUrl}/api/blob?${queryParams.toString()}`;
|
|
99
|
+
try {
|
|
100
|
+
// Determine content type
|
|
101
|
+
const contentType = options?.contentType || this.guessContentType(pathname);
|
|
102
|
+
// Convert body to raw bytes for upload (server expects raw bytes, not FormData)
|
|
103
|
+
let blobContent;
|
|
104
|
+
if (typeof body === 'string') {
|
|
105
|
+
blobContent = body;
|
|
106
|
+
}
|
|
107
|
+
else if (body instanceof ArrayBuffer) {
|
|
108
|
+
blobContent = body;
|
|
109
|
+
}
|
|
110
|
+
else if (body instanceof Uint8Array) {
|
|
111
|
+
// Copy to new ArrayBuffer to avoid SharedArrayBuffer and offset issues
|
|
112
|
+
const arrayBuffer = new ArrayBuffer(body.byteLength);
|
|
113
|
+
new Uint8Array(arrayBuffer).set(body);
|
|
114
|
+
blobContent = arrayBuffer;
|
|
115
|
+
}
|
|
116
|
+
else if (body instanceof Blob) {
|
|
117
|
+
blobContent = body;
|
|
118
|
+
}
|
|
119
|
+
else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(body)) {
|
|
120
|
+
// Buffer extends Uint8Array, copy to new ArrayBuffer
|
|
121
|
+
const arrayBuffer = new ArrayBuffer(body.byteLength);
|
|
122
|
+
new Uint8Array(arrayBuffer).set(body);
|
|
123
|
+
blobContent = arrayBuffer;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// ReadableStream - collect into Uint8Array
|
|
127
|
+
const reader = body.getReader();
|
|
128
|
+
const chunks = [];
|
|
129
|
+
let done = false;
|
|
130
|
+
while (!done) {
|
|
131
|
+
const result = await reader.read();
|
|
132
|
+
done = result.done;
|
|
133
|
+
if (result.value) {
|
|
134
|
+
chunks.push(result.value);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
138
|
+
const combined = new Uint8Array(totalLength);
|
|
139
|
+
let offset = 0;
|
|
140
|
+
for (const chunk of chunks) {
|
|
141
|
+
combined.set(chunk, offset);
|
|
142
|
+
offset += chunk.length;
|
|
143
|
+
}
|
|
144
|
+
blobContent = combined.buffer;
|
|
145
|
+
}
|
|
146
|
+
// Send raw binary body with Content-Type header
|
|
147
|
+
const response = await fetch(url, {
|
|
148
|
+
method: 'POST',
|
|
149
|
+
headers: {
|
|
150
|
+
'Authorization': `Bearer ${this.token}`,
|
|
151
|
+
'Content-Type': contentType,
|
|
152
|
+
},
|
|
153
|
+
body: blobContent,
|
|
154
|
+
});
|
|
155
|
+
const data = await response.json();
|
|
156
|
+
if (!response.ok) {
|
|
157
|
+
throw BlobError.fromResponse(response, data);
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
url: data.url,
|
|
161
|
+
pathname: data.pathname,
|
|
162
|
+
contentType: data.contentType,
|
|
163
|
+
size: data.size,
|
|
164
|
+
uploadedAt: data.uploadedAt,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
if (error instanceof BlobError) {
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
throw BlobError.networkError(error);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Delete one or more blobs
|
|
176
|
+
* @param urls - URL or array of URLs/pathnames to delete
|
|
177
|
+
*/
|
|
178
|
+
async del(urls) {
|
|
179
|
+
const urlArray = Array.isArray(urls) ? urls : [urls];
|
|
180
|
+
if (urlArray.length === 0) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
// Extract pathnames from URLs
|
|
184
|
+
const pathnames = urlArray.map((url) => this.extractPathname(url));
|
|
185
|
+
await this.jsonRequest('DELETE', '', { pathnames });
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get metadata for a blob
|
|
189
|
+
* @param url - URL of the blob
|
|
190
|
+
* @returns Blob metadata
|
|
191
|
+
*/
|
|
192
|
+
async head(url) {
|
|
193
|
+
if (!url) {
|
|
194
|
+
throw BlobError.invalidInput('url is required');
|
|
195
|
+
}
|
|
196
|
+
// Extract pathname from URL
|
|
197
|
+
const pathname = this.extractPathname(url);
|
|
198
|
+
// Include project_id in path when set: /api/blob/{project_id}/{pathname}
|
|
199
|
+
const requestUrl = this.projectId !== undefined
|
|
200
|
+
? `${this.apiUrl}/api/blob/${this.projectId}/${pathname}`
|
|
201
|
+
: `${this.apiUrl}/api/blob/${pathname}`;
|
|
202
|
+
try {
|
|
203
|
+
const response = await fetch(requestUrl, {
|
|
204
|
+
method: 'HEAD',
|
|
205
|
+
headers: {
|
|
206
|
+
'Authorization': `Bearer ${this.token}`,
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
if (!response.ok) {
|
|
210
|
+
if (response.status === 404) {
|
|
211
|
+
throw BlobError.notFound(url);
|
|
212
|
+
}
|
|
213
|
+
throw BlobError.fromResponse(response);
|
|
214
|
+
}
|
|
215
|
+
// Parse headers to extract metadata
|
|
216
|
+
const contentType = response.headers.get('content-type') || 'application/octet-stream';
|
|
217
|
+
const contentLength = response.headers.get('content-length');
|
|
218
|
+
const lastModified = response.headers.get('last-modified');
|
|
219
|
+
return {
|
|
220
|
+
url,
|
|
221
|
+
pathname,
|
|
222
|
+
contentType,
|
|
223
|
+
size: contentLength ? parseInt(contentLength, 10) : 0,
|
|
224
|
+
uploadedAt: lastModified || new Date().toISOString(),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
if (error instanceof BlobError) {
|
|
229
|
+
throw error;
|
|
230
|
+
}
|
|
231
|
+
throw BlobError.networkError(error);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* List blobs with pagination
|
|
236
|
+
* @param options - List options (limit, prefix, cursor)
|
|
237
|
+
* @returns List of blobs with pagination info
|
|
238
|
+
*/
|
|
239
|
+
async list(options) {
|
|
240
|
+
const params = {};
|
|
241
|
+
if (options?.limit !== undefined) {
|
|
242
|
+
params.limit = options.limit;
|
|
243
|
+
}
|
|
244
|
+
if (options?.prefix) {
|
|
245
|
+
params.prefix = options.prefix;
|
|
246
|
+
}
|
|
247
|
+
if (options?.cursor) {
|
|
248
|
+
params.cursor = options.cursor;
|
|
249
|
+
}
|
|
250
|
+
// Include project_id when set
|
|
251
|
+
if (this.projectId !== undefined) {
|
|
252
|
+
params.project_id = this.projectId;
|
|
253
|
+
}
|
|
254
|
+
const queryString = new URLSearchParams(Object.entries(params).map(([k, v]) => [k, String(v)])).toString();
|
|
255
|
+
const endpoint = queryString ? `?${queryString}` : '';
|
|
256
|
+
const data = await this.jsonRequest('GET', endpoint);
|
|
257
|
+
return {
|
|
258
|
+
blobs: data.blobs.map((b) => ({
|
|
259
|
+
url: b.url,
|
|
260
|
+
pathname: b.pathname,
|
|
261
|
+
contentType: b.contentType,
|
|
262
|
+
size: b.size,
|
|
263
|
+
uploadedAt: b.uploadedAt,
|
|
264
|
+
})),
|
|
265
|
+
cursor: data.cursor,
|
|
266
|
+
hasMore: data.hasMore,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Download a blob
|
|
271
|
+
* @param url - URL of the blob to download
|
|
272
|
+
* @returns Response object with blob content
|
|
273
|
+
*/
|
|
274
|
+
async download(url) {
|
|
275
|
+
if (!url) {
|
|
276
|
+
throw BlobError.invalidInput('url is required');
|
|
277
|
+
}
|
|
278
|
+
const pathname = this.extractPathname(url);
|
|
279
|
+
// Include project_id in path when set: /api/blob/{project_id}/{pathname}
|
|
280
|
+
const requestUrl = this.projectId !== undefined
|
|
281
|
+
? `${this.apiUrl}/api/blob/${this.projectId}/${pathname}`
|
|
282
|
+
: `${this.apiUrl}/api/blob/${pathname}`;
|
|
283
|
+
try {
|
|
284
|
+
const response = await fetch(requestUrl, {
|
|
285
|
+
method: 'GET',
|
|
286
|
+
headers: {
|
|
287
|
+
'Authorization': `Bearer ${this.token}`,
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
if (!response.ok) {
|
|
291
|
+
if (response.status === 404) {
|
|
292
|
+
throw BlobError.notFound(url);
|
|
293
|
+
}
|
|
294
|
+
const data = await response.json().catch(() => ({}));
|
|
295
|
+
throw BlobError.fromResponse(response, data);
|
|
296
|
+
}
|
|
297
|
+
return response;
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
if (error instanceof BlobError) {
|
|
301
|
+
throw error;
|
|
302
|
+
}
|
|
303
|
+
throw BlobError.networkError(error);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Copy a blob to a new location
|
|
308
|
+
* @param fromUrl - Source blob URL
|
|
309
|
+
* @param toPathname - Destination path
|
|
310
|
+
* @returns Information about the copied blob
|
|
311
|
+
*/
|
|
312
|
+
async copy(fromUrl, toPathname) {
|
|
313
|
+
if (!fromUrl) {
|
|
314
|
+
throw BlobError.invalidInput('fromUrl is required');
|
|
315
|
+
}
|
|
316
|
+
if (!toPathname) {
|
|
317
|
+
throw BlobError.invalidInput('toPathname is required');
|
|
318
|
+
}
|
|
319
|
+
const data = await this.jsonRequest('POST', '/copy', {
|
|
320
|
+
fromUrl,
|
|
321
|
+
toPathname,
|
|
322
|
+
});
|
|
323
|
+
return {
|
|
324
|
+
url: data.url,
|
|
325
|
+
pathname: data.pathname,
|
|
326
|
+
contentType: data.contentType,
|
|
327
|
+
size: data.size,
|
|
328
|
+
uploadedAt: data.uploadedAt,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Guess content type from pathname extension
|
|
333
|
+
*/
|
|
334
|
+
guessContentType(pathname) {
|
|
335
|
+
const extension = pathname.split('.').pop()?.toLowerCase() || '';
|
|
336
|
+
const mimeTypes = {
|
|
337
|
+
// Images
|
|
338
|
+
jpg: 'image/jpeg',
|
|
339
|
+
jpeg: 'image/jpeg',
|
|
340
|
+
png: 'image/png',
|
|
341
|
+
gif: 'image/gif',
|
|
342
|
+
webp: 'image/webp',
|
|
343
|
+
svg: 'image/svg+xml',
|
|
344
|
+
ico: 'image/x-icon',
|
|
345
|
+
// Documents
|
|
346
|
+
pdf: 'application/pdf',
|
|
347
|
+
doc: 'application/msword',
|
|
348
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
349
|
+
xls: 'application/vnd.ms-excel',
|
|
350
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
351
|
+
// Text
|
|
352
|
+
txt: 'text/plain',
|
|
353
|
+
html: 'text/html',
|
|
354
|
+
htm: 'text/html',
|
|
355
|
+
css: 'text/css',
|
|
356
|
+
js: 'application/javascript',
|
|
357
|
+
json: 'application/json',
|
|
358
|
+
xml: 'application/xml',
|
|
359
|
+
// Archives
|
|
360
|
+
zip: 'application/zip',
|
|
361
|
+
tar: 'application/x-tar',
|
|
362
|
+
gz: 'application/gzip',
|
|
363
|
+
gzip: 'application/gzip',
|
|
364
|
+
// Media
|
|
365
|
+
mp3: 'audio/mpeg',
|
|
366
|
+
mp4: 'video/mp4',
|
|
367
|
+
webm: 'video/webm',
|
|
368
|
+
};
|
|
369
|
+
return mimeTypes[extension] || 'application/octet-stream';
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Extract pathname from a full blob URL
|
|
373
|
+
* Returns the path WITHOUT project_id prefix (e.g., "example/file.txt")
|
|
374
|
+
*/
|
|
375
|
+
extractPathname(url) {
|
|
376
|
+
let path;
|
|
377
|
+
// Handle both full URLs and relative paths
|
|
378
|
+
if (url.startsWith('http://') || url.startsWith('https://')) {
|
|
379
|
+
try {
|
|
380
|
+
const parsedUrl = new URL(url);
|
|
381
|
+
path = parsedUrl.pathname;
|
|
382
|
+
}
|
|
383
|
+
catch {
|
|
384
|
+
// If URL parsing fails, treat as pathname
|
|
385
|
+
path = url;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
path = url;
|
|
390
|
+
}
|
|
391
|
+
// Remove /api/blob/ prefix if present
|
|
392
|
+
if (path.startsWith('/api/blob/')) {
|
|
393
|
+
path = path.substring('/api/blob/'.length);
|
|
394
|
+
}
|
|
395
|
+
// Remove leading slash if present
|
|
396
|
+
if (path.startsWith('/')) {
|
|
397
|
+
path = path.substring(1);
|
|
398
|
+
}
|
|
399
|
+
// Remove project_id prefix if present (e.g., "10/example/file.txt" -> "example/file.txt")
|
|
400
|
+
// The URL format from server is /api/blob/{project_id}/{pathname}
|
|
401
|
+
const slashIndex = path.indexOf('/');
|
|
402
|
+
if (slashIndex > 0) {
|
|
403
|
+
const potentialProjectId = path.substring(0, slashIndex);
|
|
404
|
+
// Check if it's a numeric project ID
|
|
405
|
+
if (/^\d+$/.test(potentialProjectId)) {
|
|
406
|
+
path = path.substring(slashIndex + 1);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return path;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Create a new Blob client instance
|
|
414
|
+
* @param config - Client configuration
|
|
415
|
+
* @returns A new BlobClient instance
|
|
416
|
+
*/
|
|
417
|
+
export function createClient(config) {
|
|
418
|
+
return new BlobClient(config);
|
|
419
|
+
}
|
|
420
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,UAAU;IACJ,MAAM,CAAS;IACf,KAAK,CAAS;IACd,SAAS,CAAU;IAEpC,YAAY,SAA2B,EAAE;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QAC1D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;QACtD,MAAM,SAAS,GAAG,MA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CAAC;YACxC,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAyB;IACpD,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC 7807 Problem Details format
|
|
3
|
+
*/
|
|
4
|
+
interface ProblemDetails {
|
|
5
|
+
type?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
detail?: string;
|
|
8
|
+
instance?: string;
|
|
9
|
+
status?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Legacy error format
|
|
13
|
+
*/
|
|
14
|
+
interface LegacyError {
|
|
15
|
+
error?: {
|
|
16
|
+
message: string;
|
|
17
|
+
code?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Error thrown by Blob operations
|
|
22
|
+
*/
|
|
23
|
+
export declare class BlobError extends Error {
|
|
24
|
+
/**
|
|
25
|
+
* Error code from the API
|
|
26
|
+
*/
|
|
27
|
+
readonly code?: string;
|
|
28
|
+
/**
|
|
29
|
+
* HTTP status code if available
|
|
30
|
+
*/
|
|
31
|
+
readonly status?: number;
|
|
32
|
+
/**
|
|
33
|
+
* RFC 7807 Problem Details title
|
|
34
|
+
*/
|
|
35
|
+
readonly title?: string;
|
|
36
|
+
/**
|
|
37
|
+
* RFC 7807 Problem Details detail
|
|
38
|
+
*/
|
|
39
|
+
readonly detail?: string;
|
|
40
|
+
constructor(message: string, options?: {
|
|
41
|
+
code?: string;
|
|
42
|
+
status?: number;
|
|
43
|
+
title?: string;
|
|
44
|
+
detail?: string;
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Create a BlobError from an API response
|
|
48
|
+
* Supports both RFC 7807 Problem Details and legacy error formats
|
|
49
|
+
*/
|
|
50
|
+
static fromResponse(response: Response, body?: ProblemDetails | LegacyError): BlobError;
|
|
51
|
+
/**
|
|
52
|
+
* Create a BlobError for missing configuration
|
|
53
|
+
*/
|
|
54
|
+
static missingConfig(field: string): BlobError;
|
|
55
|
+
/**
|
|
56
|
+
* Create a BlobError for network errors
|
|
57
|
+
*/
|
|
58
|
+
static networkError(originalError: Error): BlobError;
|
|
59
|
+
/**
|
|
60
|
+
* Create a BlobError for blob not found
|
|
61
|
+
*/
|
|
62
|
+
static notFound(url: string): BlobError;
|
|
63
|
+
/**
|
|
64
|
+
* Create a BlobError for invalid input
|
|
65
|
+
*/
|
|
66
|
+
static invalidInput(message: string): BlobError;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC;;OAEG;IACH,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;gBAG9B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;IAeH;;;OAGG;IACH,MAAM,CAAC,YAAY,CACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,CAAC,EAAE,cAAc,GAAG,WAAW,GAClC,SAAS;IAyBZ;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAO9C;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,GAAG,SAAS;IAMpD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IAOvC;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS;CAMhD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown by Blob operations
|
|
3
|
+
*/
|
|
4
|
+
export class BlobError extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Error code from the API
|
|
7
|
+
*/
|
|
8
|
+
code;
|
|
9
|
+
/**
|
|
10
|
+
* HTTP status code if available
|
|
11
|
+
*/
|
|
12
|
+
status;
|
|
13
|
+
/**
|
|
14
|
+
* RFC 7807 Problem Details title
|
|
15
|
+
*/
|
|
16
|
+
title;
|
|
17
|
+
/**
|
|
18
|
+
* RFC 7807 Problem Details detail
|
|
19
|
+
*/
|
|
20
|
+
detail;
|
|
21
|
+
constructor(message, options) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'BlobError';
|
|
24
|
+
this.code = options?.code;
|
|
25
|
+
this.status = options?.status;
|
|
26
|
+
this.title = options?.title;
|
|
27
|
+
this.detail = options?.detail;
|
|
28
|
+
// Maintains proper stack trace for where error was thrown
|
|
29
|
+
if (Error.captureStackTrace) {
|
|
30
|
+
Error.captureStackTrace(this, BlobError);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a BlobError from an API response
|
|
35
|
+
* Supports both RFC 7807 Problem Details and legacy error formats
|
|
36
|
+
*/
|
|
37
|
+
static fromResponse(response, body) {
|
|
38
|
+
// Handle RFC 7807 Problem Details format (title, detail)
|
|
39
|
+
if (body && ('title' in body || 'detail' in body)) {
|
|
40
|
+
const problemBody = body;
|
|
41
|
+
const message = problemBody.detail ||
|
|
42
|
+
problemBody.title ||
|
|
43
|
+
`Blob operation failed with status ${response.status}`;
|
|
44
|
+
return new BlobError(message, {
|
|
45
|
+
code: problemBody.type,
|
|
46
|
+
status: response.status,
|
|
47
|
+
title: problemBody.title,
|
|
48
|
+
detail: problemBody.detail,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Handle legacy error format (error.message, error.code)
|
|
52
|
+
const legacyBody = body;
|
|
53
|
+
const message = legacyBody?.error?.message ||
|
|
54
|
+
`Blob operation failed with status ${response.status}`;
|
|
55
|
+
const code = legacyBody?.error?.code;
|
|
56
|
+
return new BlobError(message, { code, status: response.status });
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create a BlobError for missing configuration
|
|
60
|
+
*/
|
|
61
|
+
static missingConfig(field) {
|
|
62
|
+
return new BlobError(`Missing required configuration: ${field}. Set ${field === 'apiUrl' ? 'TEMPS_API_URL' : 'TEMPS_TOKEN'} environment variable or pass it in config.`, { code: 'MISSING_CONFIG' });
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a BlobError for network errors
|
|
66
|
+
*/
|
|
67
|
+
static networkError(originalError) {
|
|
68
|
+
return new BlobError(`Network error: ${originalError.message}`, {
|
|
69
|
+
code: 'NETWORK_ERROR',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create a BlobError for blob not found
|
|
74
|
+
*/
|
|
75
|
+
static notFound(url) {
|
|
76
|
+
return new BlobError(`Blob not found: ${url}`, {
|
|
77
|
+
code: 'NOT_FOUND',
|
|
78
|
+
status: 404,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Create a BlobError for invalid input
|
|
83
|
+
*/
|
|
84
|
+
static invalidInput(message) {
|
|
85
|
+
return new BlobError(message, {
|
|
86
|
+
code: 'INVALID_INPUT',
|
|
87
|
+
status: 400,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC;;OAEG;IACa,IAAI,CAAU;IAE9B;;OAEG;IACa,MAAM,CAAU;IAEhC;;OAEG;IACa,KAAK,CAAU;IAE/B;;OAEG;IACa,MAAM,CAAU;IAEhC,YACE,OAAe,EACf,OAKC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;QAE9B,0DAA0D;QAC1D,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,YAAY,CACjB,QAAkB,EAClB,IAAmC;QAEnC,yDAAyD;QACzD,IAAI,IAAI,IAAI,CAAC,OAAO,IAAI,I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AAS,CAAC,mBAAmB,GAAG,EAAE,EAAE;YAC7C,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,GAAG;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,OAAe;QACjC,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE;YAC5B,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE,GAAG;SACZ,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { PutOptions, ListOptions, BlobBody } from './types.js';
|
|
2
|
+
export { BlobClient, createClient } from './client.js';
|
|
3
|
+
export { BlobError } from './errors.js';
|
|
4
|
+
export type { BlobClientConfig, BlobInfo, PutOptions, ListOptions, ListResult, PutResponse, HeadResponse, ListResponse, BlobBody, } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Default Blob instance using environment variables
|
|
7
|
+
* Use this for quick access: `import { blob } from '@temps-sdk/blob'`
|
|
8
|
+
*/
|
|
9
|
+
export declare const blob: {
|
|
10
|
+
put: (pathname: string, body: BlobBody, options?: PutOptions) => Promise<import("./types.js").BlobInfo>;
|
|
11
|
+
del: (urls: string | string[]) => Promise<void>;
|
|
12
|
+
head: (url: string) => Promise<import("./types.js").BlobInfo>;
|
|
13
|
+
list: (options?: ListOptions) => Promise<import("./types.js").ListResult>;
|
|
14
|
+
download: (url: string) => Promise<Response>;
|
|
15
|
+
copy: (fromUrl: string, toPathname: string) => Promise<import("./types.js").BlobInfo>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Upload a blob
|
|
19
|
+
* @param pathname - The path/name for the blob
|
|
20
|
+
* @param body - The content to upload
|
|
21
|
+
* @param options - Upload options
|
|
22
|
+
*/
|
|
23
|
+
export declare function put(pathname: string, body: BlobBody, options?: PutOptions): Promise<import("./types.js").BlobInfo>;
|
|
24
|
+
/**
|
|
25
|
+
* Delete one or more blobs
|
|
26
|
+
* @param urls - URL or array of URLs to delete
|
|
27
|
+
*/
|
|
28
|
+
export declare function del(urls: string | string[]): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Get metadata for a blob
|
|
31
|
+
* @param url - URL of the blob
|
|
32
|
+
*/
|
|
33
|
+
export declare function head(url: string): Promise<import("./types.js").BlobInfo>;
|
|
34
|
+
/**
|
|
35
|
+
* List blobs with pagination
|
|
36
|
+
* @param options - List options
|
|
37
|
+
*/
|
|
38
|
+
export declare function list(options?: ListOptions): Promise<import("./types.js").ListResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Download a blob
|
|
41
|
+
* @param url - URL of the blob
|
|
42
|
+
*/
|
|
43
|
+
export declare function download(url: string): Promise<Response>;
|
|
44
|
+
/**
|
|
45
|
+
* Copy a blob to a new location
|
|
46
|
+
* @param fromUrl - Source blob URL
|
|
47
|
+
* @param toPathname - Destination path
|
|
48
|
+
*/
|
|
49
|
+
export declare function copy(fromUrl: string, toPathname: string): Promise<import("./types.js").BlobInfo>;
|
|
50
|
+
/**
|
|
51
|
+
* Reset the default client (useful for testing)
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export declare function _resetDefaultClient(): void;
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoB,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,QAAQ,GACT,MAAM,YAAY,CAAC;AAYpB;;;GAGG;AACH,eAAO,MAAM,IAAI;oBACC,MAAM,QAAQ,QAAQ,YAAY,UAAU;gBAEhD,MAAM,GAAG,MAAM,EAAE;gBACjB,MAAM;qBACD,WAAW;oBACZ,MAAM;oBACN,MAAM,cAAc,MAAM;CAC3C,CAAC;AAIF;;;;;GAKG;AACH,wBAAsB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,UAAU,0CAE/E;AAED;;;GAGG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,iBAEhD;AAED;;;GAGG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,0CAErC;AAED;;;GAGG;AACH,wBAAsB,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,4CAE/C;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,qBAEzC;AAED;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,0CAE7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { BlobClient, createClient } from './client.js';
|
|
2
|
+
// Re-export everything
|
|
3
|
+
export { BlobClient, createClient } from './client.js';
|
|
4
|
+
export { BlobError } from './errors.js';
|
|
5
|
+
// Singleton instance for convenience functions
|
|
6
|
+
let defaultClient = null;
|
|
7
|
+
function getDefaultClient() {
|
|
8
|
+
if (!defaultClient) {
|
|
9
|
+
defaultClient = createClient();
|
|
10
|
+
}
|
|
11
|
+
return defaultClient;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Default Blob instance using environment variables
|
|
15
|
+
* Use this for quick access: `import { blob } from '@temps-sdk/blob'`
|
|
16
|
+
*/
|
|
17
|
+
export const blob = {
|
|
18
|
+
put: (pathname, body, options) => getDefaultClient().put(pathname, body, options),
|
|
19
|
+
del: (urls) => getDefaultClient().del(urls),
|
|
20
|
+
head: (url) => getDefaultClient().head(url),
|
|
21
|
+
list: (options) => getDefaultClient().list(options),
|
|
22
|
+
download: (url) => getDefaultClient().download(url),
|
|
23
|
+
copy: (fromUrl, toPathname) => getDefaultClient().copy(fromUrl, toPathname),
|
|
24
|
+
};
|
|
25
|
+
// Convenience functions that use the default client
|
|
26
|
+
/**
|
|
27
|
+
* Upload a blob
|
|
28
|
+
* @param pathname - The path/name for the blob
|
|
29
|
+
* @param body - The content to upload
|
|
30
|
+
* @param options - Upload options
|
|
31
|
+
*/
|
|
32
|
+
export async function put(pathname, body, options) {
|
|
33
|
+
return getDefaultClient().put(pathname, body, options);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Delete one or more blobs
|
|
37
|
+
* @param urls - URL or array of URLs to delete
|
|
38
|
+
*/
|
|
39
|
+
export async function del(urls) {
|
|
40
|
+
return getDefaultClient().del(urls);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get metadata for a blob
|
|
44
|
+
* @param url - URL of the blob
|
|
45
|
+
*/
|
|
46
|
+
export async function head(url) {
|
|
47
|
+
return getDefaultClient().head(url);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* List blobs with pagination
|
|
51
|
+
* @param options - List options
|
|
52
|
+
*/
|
|
53
|
+
export async function list(options) {
|
|
54
|
+
return getDefaultClient().list(options);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Download a blob
|
|
58
|
+
* @param url - URL of the blob
|
|
59
|
+
*/
|
|
60
|
+
export async function download(url) {
|
|
61
|
+
return getDefaultClient().download(url);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Copy a blob to a new location
|
|
65
|
+
* @param fromUrl - Source blob URL
|
|
66
|
+
* @param toPathname - Destination path
|
|
67
|
+
*/
|
|
68
|
+
export async function copy(fromUrl, toPathname) {
|
|
69
|
+
return getDefaultClient().copy(fromUrl, toPathname);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Reset the default client (useful for testing)
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export function _resetDefaultClient() {
|
|
76
|
+
defaultClient = null;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGvD,uBAAuB;AACvB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAaxC,+CAA+C;AAC/C,IAAI,aAAa,GAAsB,IAAI,CAAC;AAE5C,SAAS,gBAAgB;IACvB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,aAAa,GAAG,YAAY,EAAE,CAAC;IACjC,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,GAAG,EAAE,CAAC,QAAgB,EAAE,IAAc,EAAE,OAAoB,EAAE,EAAE,CAC9D,gBAAgB,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC;IACjD,GAAG,EAAE,CAAC,IAAuB,EAAE,EAAE,CAAC,gBAAgB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC;IAC9D,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,gBAAgB,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;IACnD,IAAI,EAAE,CAAC,OAAqB,EAAE,EAAE,CAAC,gBAAgB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;IACjE,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,gBAAgB,EAAE,CAAC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+
* Configuration options for the Blob client
|
|
3
|
+
*/
|
|
4
|
+
export interface BlobClientConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Base URL for the Temps API
|
|
7
|
+
* @default process.env.TEMPS_API_URL
|
|
8
|
+
*/
|
|
9
|
+
apiUrl?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Authentication token (API key or deployment token)
|
|
12
|
+
* @default process.env.TEMPS_TOKEN
|
|
13
|
+
*/
|
|
14
|
+
token?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Project ID for Blob operations.
|
|
17
|
+
* Required when using API keys or session authentication.
|
|
18
|
+
* Optional when using deployment tokens (project is inferred from token).
|
|
19
|
+
* @default process.env.TEMPS_PROJECT_ID
|
|
20
|
+
*/
|
|
21
|
+
projectId?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Options for the PUT (upload) operation
|
|
25
|
+
*/
|
|
26
|
+
export interface PutOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Content type of the file
|
|
29
|
+
* Will be auto-detected if not provided
|
|
30
|
+
*/
|
|
31
|
+
contentType?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Add a random suffix to the filename to prevent collisions
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
addRandomSuffix?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Custom cache control header
|
|
39
|
+
*/
|
|
40
|
+
cacheControl?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Content encoding (e.g., 'gzip')
|
|
43
|
+
*/
|
|
44
|
+
contentEncoding?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Content disposition (e.g., 'attachment; filename="file.txt"')
|
|
47
|
+
*/
|
|
48
|
+
contentDisposition?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Information about an uploaded blob
|
|
52
|
+
*/
|
|
53
|
+
export interface BlobInfo {
|
|
54
|
+
/**
|
|
55
|
+
* Full URL to access the blob
|
|
56
|
+
*/
|
|
57
|
+
url: string;
|
|
58
|
+
/**
|
|
59
|
+
* Path/name of the blob
|
|
60
|
+
*/
|
|
61
|
+
pathname: string;
|
|
62
|
+
/**
|
|
63
|
+
* MIME type of the blob
|
|
64
|
+
*/
|
|
65
|
+
contentType: string;
|
|
66
|
+
/**
|
|
67
|
+
* Size of the blob in bytes
|
|
68
|
+
*/
|
|
69
|
+
size: number;
|
|
70
|
+
/**
|
|
71
|
+
* ISO 8601 timestamp when the blob was uploaded
|
|
72
|
+
*/
|
|
73
|
+
uploadedAt: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Options for listing blobs
|
|
77
|
+
*/
|
|
78
|
+
export interface ListOptions {
|
|
79
|
+
/**
|
|
80
|
+
* Maximum number of blobs to return
|
|
81
|
+
* @default 1000
|
|
82
|
+
*/
|
|
83
|
+
limit?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Filter blobs by prefix (folder path)
|
|
86
|
+
*/
|
|
87
|
+
prefix?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Cursor for pagination (from previous response)
|
|
90
|
+
*/
|
|
91
|
+
cursor?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Result of listing blobs
|
|
95
|
+
*/
|
|
96
|
+
export interface ListResult {
|
|
97
|
+
/**
|
|
98
|
+
* Array of blob information
|
|
99
|
+
*/
|
|
100
|
+
blobs: BlobInfo[];
|
|
101
|
+
/**
|
|
102
|
+
* Cursor for next page (if hasMore is true)
|
|
103
|
+
*/
|
|
104
|
+
cursor?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Whether there are more blobs to fetch
|
|
107
|
+
*/
|
|
108
|
+
hasMore: boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Response from PUT operation
|
|
112
|
+
*/
|
|
113
|
+
export interface PutResponse {
|
|
114
|
+
url: string;
|
|
115
|
+
pathname: string;
|
|
116
|
+
contentType: string;
|
|
117
|
+
size: number;
|
|
118
|
+
uploadedAt: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Response from HEAD operation
|
|
122
|
+
*/
|
|
123
|
+
export interface HeadResponse {
|
|
124
|
+
url: string;
|
|
125
|
+
pathname: string;
|
|
126
|
+
contentType: string;
|
|
127
|
+
size: number;
|
|
128
|
+
uploadedAt: string;
|
|
129
|
+
cacheControl?: string;
|
|
130
|
+
contentEncoding?: string;
|
|
131
|
+
contentDisposition?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Response from LIST operation
|
|
135
|
+
*/
|
|
136
|
+
export interface ListResponse {
|
|
137
|
+
blobs: Array<{
|
|
138
|
+
url: string;
|
|
139
|
+
pathname: string;
|
|
140
|
+
contentType: string;
|
|
141
|
+
size: number;
|
|
142
|
+
uploadedAt: string;
|
|
143
|
+
}>;
|
|
144
|
+
cursor?: string;
|
|
145
|
+
hasMore: boolean;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Body types that can be uploaded
|
|
149
|
+
*/
|
|
150
|
+
export type BlobBody = string | ArrayBuffer | Uint8Array | Blob | ReadableStream<Uint8Array> | Buffer;
|
|
151
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,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AAM,WAAW,YAAY;IAC3B,KAAK,EAAE,KAAK,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,WAAW,GACX,UAAU,GACV,IAAI,GACJ,cAAc,CAAC,UAAU,CAAC,GAC1B,MAAM,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@temps-sdk/blob",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Blob storage SDK for the Temps platform",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.build.json",
|
|
16
|
+
"test": "vitest",
|
|
17
|
+
"test:run": "vitest run",
|
|
18
|
+
"test:coverage": "vitest run --coverage",
|
|
19
|
+
"clean": "rm -rf dist"
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"keywords": [
|
|
30
|
+
"temps",
|
|
31
|
+
"blob",
|
|
32
|
+
"storage",
|
|
33
|
+
"s3",
|
|
34
|
+
"minio"
|
|
35
|
+
],
|
|
36
|
+
"author": "",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^20.0.0",
|
|
40
|
+
"@vitest/coverage-v8": "^2.0.0",
|
|
41
|
+
"typescript": "^5.5.4",
|
|
42
|
+
"vitest": "^2.0.0"
|
|
43
|
+
}
|
|
44
|
+
}
|