@renderinc/sdk 0.2.0 → 0.2.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/CHANGELOG.md +9 -2
- package/README.md +32 -22
- package/dist/experimental/experimental.d.ts +6 -2
- package/dist/experimental/experimental.d.ts.map +1 -1
- package/dist/experimental/experimental.js +9 -3
- package/dist/experimental/index.d.ts +2 -2
- package/dist/experimental/index.d.ts.map +1 -1
- package/dist/experimental/index.js +6 -5
- package/dist/experimental/object/api.d.ts +11 -0
- package/dist/experimental/object/api.d.ts.map +1 -0
- package/dist/experimental/object/api.js +44 -0
- package/dist/experimental/object/client.d.ts +21 -0
- package/dist/experimental/object/client.d.ts.map +1 -0
- package/dist/experimental/object/client.js +127 -0
- package/dist/experimental/object/index.d.ts +5 -0
- package/dist/experimental/object/index.d.ts.map +1 -0
- package/dist/experimental/object/index.js +8 -0
- package/dist/experimental/object/types.d.ts +49 -0
- package/dist/experimental/object/types.d.ts.map +1 -0
- package/dist/generated/schema.d.ts +131 -3
- package/dist/generated/schema.d.ts.map +1 -1
- package/dist/workflows/uds.d.ts.map +1 -1
- package/dist/workflows/uds.js +26 -51
- package/examples/client/main.ts +1 -1
- package/examples/client/package-lock.json +4 -4
- package/examples/client/package.json +1 -1
- package/examples/task/main.ts +1 -1
- package/examples/task/package-lock.json +5 -6
- package/examples/task/package.json +1 -1
- package/package.json +9 -8
- package/src/errors.test.ts +75 -0
- package/src/experimental/experimental.ts +30 -7
- package/src/experimental/index.ts +18 -18
- package/src/experimental/{blob → object}/api.ts +7 -7
- package/src/experimental/object/client.test.ts +138 -0
- package/src/experimental/{blob → object}/client.ts +57 -57
- package/src/experimental/object/index.ts +22 -0
- package/src/experimental/object/types.test.ts +87 -0
- package/src/experimental/{blob → object}/types.ts +30 -30
- package/src/generated/schema.ts +217 -9
- package/src/utils/get-base-url.test.ts +58 -0
- package/src/workflows/client/client.test.ts +68 -0
- package/src/workflows/types.test.ts +52 -0
- package/src/workflows/uds.ts +29 -69
- package/tsconfig.json +1 -1
- package/{vite.config.ts → vitest.config.ts} +1 -0
- package/dist/workflows/client/errors.d.ts +0 -25
- package/dist/workflows/client/errors.d.ts.map +0 -1
- package/dist/workflows/client/errors.js +0 -56
- package/dist/workflows/client/schema.d.ts +0 -9322
- package/dist/workflows/client/schema.d.ts.map +0 -1
- package/dist/workflows/client/workflows.d.ts +0 -15
- package/dist/workflows/client/workflows.d.ts.map +0 -1
- package/dist/workflows/client/workflows.js +0 -63
- package/src/experimental/blob/index.ts +0 -22
- /package/dist/{workflows/client/schema.js → experimental/object/types.js} +0 -0
|
@@ -2,39 +2,39 @@ import type { Client } from "openapi-fetch";
|
|
|
2
2
|
import { RenderError } from "../../errors.js";
|
|
3
3
|
import type { paths } from "../../generated/schema.js";
|
|
4
4
|
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
DeleteObjectInput,
|
|
6
|
+
GetObjectInput,
|
|
7
|
+
ObjectData,
|
|
8
|
+
ObjectScope,
|
|
9
|
+
PutObjectInput,
|
|
10
|
+
PutObjectResult,
|
|
11
11
|
Region,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
ScopedDeleteObjectInput,
|
|
13
|
+
ScopedGetObjectInput,
|
|
14
|
+
ScopedPutObjectInput,
|
|
15
15
|
} from "./types.js";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Layer 3: High-Level
|
|
18
|
+
* Layer 3: High-Level Object Client
|
|
19
19
|
*
|
|
20
20
|
* User-facing API that abstracts presigned URLs completely.
|
|
21
21
|
* Provides simple put/get/delete operations that handle the
|
|
22
22
|
* two-step presigned URL flow internally.
|
|
23
23
|
*/
|
|
24
|
-
export class
|
|
24
|
+
export class ObjectClient {
|
|
25
25
|
constructor(private readonly apiClient: Client<paths>) {}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Upload
|
|
28
|
+
* Upload an object to storage
|
|
29
29
|
*
|
|
30
|
-
* @param input - Upload parameters including
|
|
30
|
+
* @param input - Upload parameters including object identifier and data
|
|
31
31
|
* @returns Result with optional ETag
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
34
|
* ```typescript
|
|
35
35
|
* // Upload a Buffer
|
|
36
36
|
* const data = Buffer.from("binary content");
|
|
37
|
-
* await
|
|
37
|
+
* await objectClient.put({
|
|
38
38
|
* ownerId: "tea-xxxxx",
|
|
39
39
|
* region: "oregon",
|
|
40
40
|
* key: "path/to/file.png",
|
|
@@ -45,7 +45,7 @@ export class BlobClient {
|
|
|
45
45
|
* // Upload from stream
|
|
46
46
|
* const stream = createReadStream("/path/to/file.zip");
|
|
47
47
|
* const stats = statSync("/path/to/file.zip");
|
|
48
|
-
* await
|
|
48
|
+
* await objectClient.put({
|
|
49
49
|
* ownerId: "tea-xxxxx",
|
|
50
50
|
* region: "oregon",
|
|
51
51
|
* key: "file.zip",
|
|
@@ -54,7 +54,7 @@ export class BlobClient {
|
|
|
54
54
|
* });
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
|
-
async put(input:
|
|
57
|
+
async put(input: PutObjectInput): Promise<PutObjectResult> {
|
|
58
58
|
// Resolve and validate size
|
|
59
59
|
const size = this.resolveSize(input);
|
|
60
60
|
|
|
@@ -100,25 +100,25 @@ export class BlobClient {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* Download
|
|
103
|
+
* Download an object from storage
|
|
104
104
|
*
|
|
105
|
-
* @param input - Download parameters including
|
|
106
|
-
* @returns
|
|
105
|
+
* @param input - Download parameters including object identifier
|
|
106
|
+
* @returns Object data with content
|
|
107
107
|
*
|
|
108
108
|
* @example
|
|
109
109
|
* ```typescript
|
|
110
|
-
* const
|
|
110
|
+
* const obj = await objectClient.get({
|
|
111
111
|
* ownerId: "tea-xxxxx",
|
|
112
112
|
* region: "oregon",
|
|
113
113
|
* key: "path/to/file.png"
|
|
114
114
|
* });
|
|
115
115
|
*
|
|
116
|
-
* console.log(
|
|
117
|
-
* console.log(
|
|
118
|
-
* //
|
|
116
|
+
* console.log(obj.size); // Size in bytes
|
|
117
|
+
* console.log(obj.contentType); // MIME type if available
|
|
118
|
+
* // obj.data is a Buffer
|
|
119
119
|
* ```
|
|
120
120
|
*/
|
|
121
|
-
async get(input:
|
|
121
|
+
async get(input: GetObjectInput): Promise<ObjectData> {
|
|
122
122
|
// Step 1: Get presigned download URL from Render API
|
|
123
123
|
const { data, error } = await this.apiClient.GET("/blobs/{ownerId}/{region}/{key}", {
|
|
124
124
|
params: {
|
|
@@ -152,20 +152,20 @@ export class BlobClient {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
* Delete
|
|
155
|
+
* Delete an object from storage
|
|
156
156
|
*
|
|
157
|
-
* @param input - Delete parameters including
|
|
157
|
+
* @param input - Delete parameters including object identifier
|
|
158
158
|
*
|
|
159
159
|
* @example
|
|
160
160
|
* ```typescript
|
|
161
|
-
* await
|
|
161
|
+
* await objectClient.delete({
|
|
162
162
|
* ownerId: "tea-xxxxx",
|
|
163
163
|
* region: "oregon",
|
|
164
164
|
* key: "path/to/file.png"
|
|
165
165
|
* });
|
|
166
166
|
* ```
|
|
167
167
|
*/
|
|
168
|
-
async delete(input:
|
|
168
|
+
async delete(input: DeleteObjectInput): Promise<void> {
|
|
169
169
|
// DELETE goes directly to Render API (no presigned URL)
|
|
170
170
|
const { error } = await this.apiClient.DELETE("/blobs/{ownerId}/{region}/{key}", {
|
|
171
171
|
params: {
|
|
@@ -178,19 +178,19 @@ export class BlobClient {
|
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
if (error) {
|
|
181
|
-
throw new RenderError(`Failed to delete
|
|
181
|
+
throw new RenderError(`Failed to delete object: ${error.message || "Unknown error"}`);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
|
-
* Create a scoped
|
|
186
|
+
* Create a scoped object client for a specific owner and region
|
|
187
187
|
*
|
|
188
188
|
* @param scope - Owner ID and region to scope operations to
|
|
189
|
-
* @returns Scoped
|
|
189
|
+
* @returns Scoped object client that doesn't require ownerId/region on each call
|
|
190
190
|
*
|
|
191
191
|
* @example
|
|
192
192
|
* ```typescript
|
|
193
|
-
* const scoped =
|
|
193
|
+
* const scoped = objectClient.scoped({
|
|
194
194
|
* ownerId: "tea-xxxxx",
|
|
195
195
|
* region: "oregon"
|
|
196
196
|
* });
|
|
@@ -201,8 +201,8 @@ export class BlobClient {
|
|
|
201
201
|
* await scoped.delete({ key: "file.png" });
|
|
202
202
|
* ```
|
|
203
203
|
*/
|
|
204
|
-
scoped(scope:
|
|
205
|
-
return new
|
|
204
|
+
scoped(scope: ObjectScope): ScopedObjectClient {
|
|
205
|
+
return new ScopedObjectClient(this.apiClient, scope);
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
/**
|
|
@@ -211,7 +211,7 @@ export class BlobClient {
|
|
|
211
211
|
* - For Buffer/Uint8Array: auto-calculate size, validate if provided
|
|
212
212
|
* - For streams/strings: require explicit size
|
|
213
213
|
*/
|
|
214
|
-
private resolveSize(input:
|
|
214
|
+
private resolveSize(input: PutObjectInput): number {
|
|
215
215
|
if (Buffer.isBuffer(input.data) || input.data instanceof Uint8Array) {
|
|
216
216
|
const actualSize = input.data.byteLength;
|
|
217
217
|
|
|
@@ -240,30 +240,30 @@ export class BlobClient {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
|
-
* Scoped
|
|
243
|
+
* Scoped Object Client
|
|
244
244
|
*
|
|
245
245
|
* Pre-configured client for a specific owner and region.
|
|
246
246
|
* Eliminates the need to specify ownerId and region on every operation.
|
|
247
247
|
*/
|
|
248
|
-
export class
|
|
249
|
-
private readonly
|
|
248
|
+
export class ScopedObjectClient {
|
|
249
|
+
private readonly objectClient: ObjectClient;
|
|
250
250
|
|
|
251
251
|
constructor(
|
|
252
252
|
apiClient: Client<paths>,
|
|
253
|
-
private readonly scope:
|
|
253
|
+
private readonly scope: ObjectScope,
|
|
254
254
|
) {
|
|
255
|
-
this.
|
|
255
|
+
this.objectClient = new ObjectClient(apiClient);
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
|
-
* Upload
|
|
259
|
+
* Upload an object to storage using scoped owner and region
|
|
260
260
|
*
|
|
261
261
|
* @param input - Upload parameters (key and data only)
|
|
262
262
|
* @returns Result with optional ETag
|
|
263
263
|
*
|
|
264
264
|
* @example
|
|
265
265
|
* ```typescript
|
|
266
|
-
* const scoped =
|
|
266
|
+
* const scoped = objectClient.scoped({ ownerId: "tea-xxxxx", region: "oregon" });
|
|
267
267
|
* await scoped.put({
|
|
268
268
|
* key: "file.png",
|
|
269
269
|
* data: Buffer.from("content"),
|
|
@@ -271,47 +271,47 @@ export class ScopedBlobClient {
|
|
|
271
271
|
* });
|
|
272
272
|
* ```
|
|
273
273
|
*/
|
|
274
|
-
async put(input:
|
|
275
|
-
return this.
|
|
274
|
+
async put(input: ScopedPutObjectInput): Promise<PutObjectResult> {
|
|
275
|
+
return this.objectClient.put({
|
|
276
276
|
...this.scope,
|
|
277
277
|
...input,
|
|
278
|
-
} as
|
|
278
|
+
} as PutObjectInput);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
/**
|
|
282
|
-
* Download
|
|
282
|
+
* Download an object from storage using scoped owner and region
|
|
283
283
|
*
|
|
284
284
|
* @param input - Download parameters (key only)
|
|
285
|
-
* @returns
|
|
285
|
+
* @returns Object data with content
|
|
286
286
|
*
|
|
287
287
|
* @example
|
|
288
288
|
* ```typescript
|
|
289
|
-
* const scoped =
|
|
290
|
-
* const
|
|
289
|
+
* const scoped = objectClient.scoped({ ownerId: "tea-xxxxx", region: "oregon" });
|
|
290
|
+
* const obj = await scoped.get({ key: "file.png" });
|
|
291
291
|
* ```
|
|
292
292
|
*/
|
|
293
|
-
async get(input:
|
|
294
|
-
return this.
|
|
293
|
+
async get(input: ScopedGetObjectInput): Promise<ObjectData> {
|
|
294
|
+
return this.objectClient.get({
|
|
295
295
|
...this.scope,
|
|
296
296
|
...input,
|
|
297
|
-
} as
|
|
297
|
+
} as GetObjectInput);
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
/**
|
|
301
|
-
* Delete
|
|
301
|
+
* Delete an object from storage using scoped owner and region
|
|
302
302
|
*
|
|
303
303
|
* @param input - Delete parameters (key only)
|
|
304
304
|
*
|
|
305
305
|
* @example
|
|
306
306
|
* ```typescript
|
|
307
|
-
* const scoped =
|
|
307
|
+
* const scoped = objectClient.scoped({ ownerId: "tea-xxxxx", region: "oregon" });
|
|
308
308
|
* await scoped.delete({ key: "file.png" });
|
|
309
309
|
* ```
|
|
310
310
|
*/
|
|
311
|
-
async delete(input:
|
|
312
|
-
return this.
|
|
311
|
+
async delete(input: ScopedDeleteObjectInput): Promise<void> {
|
|
312
|
+
return this.objectClient.delete({
|
|
313
313
|
...this.scope,
|
|
314
314
|
...input,
|
|
315
|
-
} as
|
|
315
|
+
} as DeleteObjectInput);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Object storage client exports
|
|
2
|
+
export { ObjectApi } from "./api.js";
|
|
3
|
+
export { ObjectClient, ScopedObjectClient } from "./client.js";
|
|
4
|
+
// Type exports
|
|
5
|
+
export type {
|
|
6
|
+
DeleteObjectInput,
|
|
7
|
+
GetObjectInput,
|
|
8
|
+
ObjectData,
|
|
9
|
+
ObjectIdentifier,
|
|
10
|
+
ObjectScope,
|
|
11
|
+
PresignedDownloadUrl,
|
|
12
|
+
PresignedUploadUrl,
|
|
13
|
+
PutObjectInput,
|
|
14
|
+
PutObjectInputBuffer,
|
|
15
|
+
PutObjectInputStream,
|
|
16
|
+
PutObjectResult,
|
|
17
|
+
ScopedDeleteObjectInput,
|
|
18
|
+
ScopedGetObjectInput,
|
|
19
|
+
ScopedPutObjectInput,
|
|
20
|
+
} from "./types.js";
|
|
21
|
+
// Re-export the Region enum (both type and value)
|
|
22
|
+
export { Region } from "./types.js";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Readable } from "node:stream";
|
|
2
|
+
import type {
|
|
3
|
+
DeleteObjectInput,
|
|
4
|
+
GetObjectInput,
|
|
5
|
+
ObjectIdentifier,
|
|
6
|
+
ObjectScope,
|
|
7
|
+
PutObjectInput,
|
|
8
|
+
PutObjectInputBuffer,
|
|
9
|
+
PutObjectInputStream,
|
|
10
|
+
ScopedDeleteObjectInput,
|
|
11
|
+
ScopedGetObjectInput,
|
|
12
|
+
ScopedPutObjectInput,
|
|
13
|
+
} from "./types.js";
|
|
14
|
+
|
|
15
|
+
describe("PutObjectInput discriminated union", () => {
|
|
16
|
+
it("accepts buffer variant", () => {
|
|
17
|
+
const input: PutObjectInput = {
|
|
18
|
+
ownerId: "tea-123",
|
|
19
|
+
region: "frankfurt",
|
|
20
|
+
key: "test.txt",
|
|
21
|
+
data: Buffer.from("hello"),
|
|
22
|
+
};
|
|
23
|
+
expectTypeOf(input).toMatchTypeOf<PutObjectInput>();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("accepts stream variant with required size", () => {
|
|
27
|
+
const input: PutObjectInput = {
|
|
28
|
+
ownerId: "tea-123",
|
|
29
|
+
region: "frankfurt",
|
|
30
|
+
key: "test.txt",
|
|
31
|
+
data: {} as Readable,
|
|
32
|
+
size: 100,
|
|
33
|
+
};
|
|
34
|
+
expectTypeOf(input).toMatchTypeOf<PutObjectInput>();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("union includes both variants", () => {
|
|
38
|
+
expectTypeOf<PutObjectInput>().toMatchTypeOf<PutObjectInputBuffer | PutObjectInputStream>();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe("ObjectIdentifier type", () => {
|
|
43
|
+
it("requires tea- prefix on ownerId", () => {
|
|
44
|
+
expectTypeOf<ObjectIdentifier["ownerId"]>().toEqualTypeOf<`tea-${string}`>();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("has required key property", () => {
|
|
48
|
+
expectTypeOf<ObjectIdentifier>().toHaveProperty("key");
|
|
49
|
+
expectTypeOf<ObjectIdentifier["key"]>().toEqualTypeOf<string>();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe("Scoped types omit ObjectScope fields", () => {
|
|
54
|
+
it("ScopedPutObjectInput omits ownerId and region", () => {
|
|
55
|
+
expectTypeOf<ScopedPutObjectInput>().not.toHaveProperty("ownerId");
|
|
56
|
+
expectTypeOf<ScopedPutObjectInput>().not.toHaveProperty("region");
|
|
57
|
+
expectTypeOf<ScopedPutObjectInput>().toHaveProperty("key");
|
|
58
|
+
expectTypeOf<ScopedPutObjectInput>().toHaveProperty("data");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("ScopedGetObjectInput omits ownerId and region", () => {
|
|
62
|
+
expectTypeOf<ScopedGetObjectInput>().not.toHaveProperty("ownerId");
|
|
63
|
+
expectTypeOf<ScopedGetObjectInput>().not.toHaveProperty("region");
|
|
64
|
+
expectTypeOf<ScopedGetObjectInput>().toHaveProperty("key");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("ScopedDeleteObjectInput omits ownerId and region", () => {
|
|
68
|
+
expectTypeOf<ScopedDeleteObjectInput>().not.toHaveProperty("ownerId");
|
|
69
|
+
expectTypeOf<ScopedDeleteObjectInput>().not.toHaveProperty("region");
|
|
70
|
+
expectTypeOf<ScopedDeleteObjectInput>().toHaveProperty("key");
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("ObjectScope has ownerId and region", () => {
|
|
74
|
+
expectTypeOf<ObjectScope>().toHaveProperty("ownerId");
|
|
75
|
+
expectTypeOf<ObjectScope>().toHaveProperty("region");
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe("GetObjectInput and DeleteObjectInput extend ObjectIdentifier", () => {
|
|
80
|
+
it("GetObjectInput matches ObjectIdentifier", () => {
|
|
81
|
+
expectTypeOf<GetObjectInput>().toMatchTypeOf<ObjectIdentifier>();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("DeleteObjectInput matches ObjectIdentifier", () => {
|
|
85
|
+
expectTypeOf<DeleteObjectInput>().toMatchTypeOf<ObjectIdentifier>();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import type { Readable } from "node:stream";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Supported regions for
|
|
4
|
+
* Supported regions for object storage
|
|
5
5
|
*/
|
|
6
6
|
export type Region = "frankfurt" | "oregon" | "ohio" | "singapore" | "virginia";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Base identifier for a
|
|
9
|
+
* Base identifier for a storage object
|
|
10
10
|
*/
|
|
11
|
-
export interface
|
|
11
|
+
export interface ObjectIdentifier {
|
|
12
12
|
/** Owner ID (workspace team ID) in format tea-xxxxx */
|
|
13
13
|
ownerId: `tea-${string}`;
|
|
14
|
-
/** Region where the
|
|
14
|
+
/** Region where the object is stored */
|
|
15
15
|
region: Region | string;
|
|
16
|
-
/** Object key (path) for the
|
|
16
|
+
/** Object key (path) for the object */
|
|
17
17
|
key: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Base options for putting
|
|
21
|
+
* Base options for putting an object
|
|
22
22
|
*/
|
|
23
|
-
interface
|
|
23
|
+
interface PutObjectInputBase extends ObjectIdentifier {
|
|
24
24
|
/** MIME type of the content (optional, will be auto-detected if not provided) */
|
|
25
25
|
contentType?: string;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Put
|
|
29
|
+
* Put object input for Buffer, Uint8Array, or string data
|
|
30
30
|
* Size is optional and will be auto-calculated
|
|
31
31
|
*/
|
|
32
|
-
export interface
|
|
32
|
+
export interface PutObjectInputBuffer extends PutObjectInputBase {
|
|
33
33
|
/** Binary data as Buffer, Uint8Array, or string */
|
|
34
34
|
data: Buffer | Uint8Array | string;
|
|
35
35
|
/** Size in bytes (optional, auto-calculated for Buffer/Uint8Array) */
|
|
@@ -37,10 +37,10 @@ export interface PutBlobInputBuffer extends PutBlobInputBase {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Put
|
|
40
|
+
* Put object input for readable streams
|
|
41
41
|
* Size is required for streams
|
|
42
42
|
*/
|
|
43
|
-
export interface
|
|
43
|
+
export interface PutObjectInputStream extends PutObjectInputBase {
|
|
44
44
|
/** Readable stream */
|
|
45
45
|
data: Readable;
|
|
46
46
|
/** Size in bytes (required for streams) */
|
|
@@ -48,20 +48,20 @@ export interface PutBlobInputStream extends PutBlobInputBase {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* Input for uploading
|
|
51
|
+
* Input for uploading an object
|
|
52
52
|
* Discriminated union: size is optional for Buffer/Uint8Array, required for streams
|
|
53
53
|
*/
|
|
54
|
-
export type
|
|
54
|
+
export type PutObjectInput = PutObjectInputBuffer | PutObjectInputStream;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* Input for downloading
|
|
57
|
+
* Input for downloading an object
|
|
58
58
|
*/
|
|
59
|
-
export interface
|
|
59
|
+
export interface GetObjectInput extends ObjectIdentifier {}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* Input for deleting
|
|
62
|
+
* Input for deleting an object
|
|
63
63
|
*/
|
|
64
|
-
export interface
|
|
64
|
+
export interface DeleteObjectInput extends ObjectIdentifier {}
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Presigned URL for uploading
|
|
@@ -86,9 +86,9 @@ export interface PresignedDownloadUrl {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
* Downloaded
|
|
89
|
+
* Downloaded object data
|
|
90
90
|
*/
|
|
91
|
-
export interface
|
|
91
|
+
export interface ObjectData {
|
|
92
92
|
/** Binary content */
|
|
93
93
|
data: Buffer;
|
|
94
94
|
/** MIME type if available */
|
|
@@ -98,34 +98,34 @@ export interface BlobData {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
* Result from uploading
|
|
101
|
+
* Result from uploading an object
|
|
102
102
|
*/
|
|
103
|
-
export interface
|
|
103
|
+
export interface PutObjectResult {
|
|
104
104
|
/** ETag from storage provider */
|
|
105
105
|
etag?: string;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* Scope configuration for scoped
|
|
109
|
+
* Scope configuration for scoped object client
|
|
110
110
|
*/
|
|
111
|
-
export interface
|
|
111
|
+
export interface ObjectScope {
|
|
112
112
|
/** Owner ID (workspace team ID) in format tea-xxxxx */
|
|
113
113
|
ownerId: `tea-${string}`;
|
|
114
|
-
/** Region where the
|
|
114
|
+
/** Region where the object is stored */
|
|
115
115
|
region: Region | string;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* Scoped input for uploading
|
|
119
|
+
* Scoped input for uploading an object (without ownerId/region)
|
|
120
120
|
*/
|
|
121
|
-
export type
|
|
121
|
+
export type ScopedPutObjectInput = Omit<PutObjectInput, keyof ObjectScope>;
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
|
-
* Scoped input for downloading
|
|
124
|
+
* Scoped input for downloading an object (without ownerId/region)
|
|
125
125
|
*/
|
|
126
|
-
export type
|
|
126
|
+
export type ScopedGetObjectInput = Omit<GetObjectInput, keyof ObjectScope>;
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
* Scoped input for deleting
|
|
129
|
+
* Scoped input for deleting an object (without ownerId/region)
|
|
130
130
|
*/
|
|
131
|
-
export type
|
|
131
|
+
export type ScopedDeleteObjectInput = Omit<DeleteObjectInput, keyof ObjectScope>;
|