palbase 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +27 -0
- package/README.md +2 -2
- package/dist/ai/index.js +17 -0
- package/dist/backend/engine.js +2 -0
- package/dist/backend/env.js +1 -0
- package/dist/backend/index.js +12 -0
- package/dist/backend/stack.js +1 -0
- package/dist/backend/test.js +2 -0
- package/dist/chunks/5W6XJM46.js +13 -0
- package/dist/chunks/6OPBXB7Z.js +2 -0
- package/dist/chunks/7LOMYBLN.js +20 -0
- package/dist/chunks/AN5LCF5K.js +55 -0
- package/dist/chunks/ECUYQ73P.js +2 -0
- package/dist/chunks/HDX6YUAB.js +2 -0
- package/dist/chunks/HVC2C35F.js +2 -0
- package/dist/chunks/I3JNX6MZ.js +4 -0
- package/dist/chunks/JEJ5CFTK.js +2 -0
- package/dist/chunks/K3C2IEDS.js +2 -0
- package/dist/chunks/KRBVYYME.js +2 -0
- package/dist/chunks/NIJHTHNF.js +2 -0
- package/dist/chunks/TL4H6V3P.js +2 -0
- package/dist/chunks/UTRQWCMD.js +6 -0
- package/dist/chunks/ZFPDYRRY.js +2 -0
- package/dist/cli.js +815 -0
- package/dist/refuse/ai.js +2 -0
- package/dist/refuse/backend.js +2 -0
- package/dist/refuse/server.js +2 -0
- package/dist/server/index.js +2 -0
- package/dist/server/testing.js +2 -0
- package/dist/web/index.js +2 -0
- package/dist/web/palbe.js +2 -0
- package/dist/web/paywall.js +2 -0
- package/dist/web/vite.js +3 -0
- package/package.json +111 -4
- package/types/ai/src/ai.d.ts +178 -0
- package/types/ai/src/index.d.ts +5 -0
- package/types/ai/src/partial.d.ts +1 -0
- package/types/ai/src/schema.d.ts +47 -0
- package/types/backend/src/bootstrap.d.ts +72 -0
- package/types/backend/src/cache.d.ts +32 -0
- package/types/backend/src/container.d.ts +49 -0
- package/types/backend/src/database.d.ts +148 -0
- package/types/backend/src/db-env.d.ts +4 -0
- package/types/backend/src/decorators.d.ts +293 -0
- package/types/backend/src/engine-db.d.ts +24 -0
- package/types/backend/src/engine-exports.d.ts +3 -0
- package/types/backend/src/engine.d.ts +124 -0
- package/types/backend/src/env.d.ts +27 -0
- package/types/backend/src/errors.d.ts +70 -0
- package/types/backend/src/i18n.d.ts +21 -0
- package/types/backend/src/index.d.ts +23 -0
- package/types/backend/src/openapi.d.ts +73 -0
- package/types/backend/src/platform-calls.d.ts +41 -0
- package/types/backend/src/requests.d.ts +81 -0
- package/types/backend/src/rooms.d.ts +168 -0
- package/types/backend/src/router.d.ts +22 -0
- package/types/backend/src/runtime.d.ts +56 -0
- package/types/backend/src/services.d.ts +262 -0
- package/types/backend/src/stack.d.ts +20 -0
- package/types/backend/src/strings-files.d.ts +3 -0
- package/types/backend/src/testing/index.d.ts +3 -0
- package/types/backend/src/testing/unit.d.ts +66 -0
- package/types/backend/src/upload.d.ts +125 -0
- package/types/backend/src/webhooks.d.ts +113 -0
- package/types/internal/src/event.d.ts +9 -0
- package/types/internal/src/modules/ai.d.ts +678 -0
- package/types/internal/src/modules/analytics.d.ts +1414 -0
- package/types/internal/src/modules/auth.d.ts +5660 -0
- package/types/internal/src/modules/cache.d.ts +158 -0
- package/types/internal/src/modules/events.d.ts +19 -0
- package/types/internal/src/modules/flags.d.ts +957 -0
- package/types/internal/src/modules/index.d.ts +13 -0
- package/types/internal/src/modules/machines.d.ts +1584 -0
- package/types/internal/src/modules/notify.d.ts +1450 -0
- package/types/internal/src/modules/purchases.d.ts +4113 -0
- package/types/internal/src/modules/realtime.d.ts +326 -0
- package/types/internal/src/modules/secrets.d.ts +275 -0
- package/types/internal/src/modules/storage.d.ts +691 -0
- package/types/internal/src/modules/stores.d.ts +1516 -0
- package/types/internal/src/retry.d.ts +14 -0
- package/types/internal/src/transport.d.ts +106 -0
- package/types/server/src/auth/dpop.d.ts +47 -0
- package/types/server/src/auth/jwt.d.ts +115 -0
- package/types/server/src/index.d.ts +9 -0
- package/types/server/src/pages.d.ts +4 -0
- package/types/server/src/purchases.d.ts +51 -0
- package/types/server/src/secrets-env.d.ts +22 -0
- package/types/server/src/server.d.ts +40 -0
- package/types/server/src/testing.d.ts +91 -0
- package/types/server/src/webhooks.d.ts +72 -0
- package/types/web/src/analytics.d.ts +87 -0
- package/types/web/src/auth.d.ts +155 -0
- package/types/web/src/backend-error.d.ts +38 -0
- package/types/web/src/backend-names.d.ts +25 -0
- package/types/web/src/backends.d.ts +84 -0
- package/types/web/src/client.d.ts +51 -0
- package/types/web/src/index.d.ts +13 -0
- package/types/web/src/palbe.d.ts +2 -0
- package/types/web/src/paywall/icons.d.ts +5 -0
- package/types/web/src/paywall/index.d.ts +5 -0
- package/types/web/src/paywall/placement.d.ts +85 -0
- package/types/web/src/paywall/prices.d.ts +40 -0
- package/types/web/src/paywall/render.d.ts +54 -0
- package/types/web/src/paywall/resolve.d.ts +149 -0
- package/types/web/src/purchases.d.ts +86 -0
- package/types/web/src/rooms.d.ts +61 -0
- package/types/web/src/session.d.ts +91 -0
- package/types/web/src/socket.d.ts +87 -0
- package/types/web/src/vite.d.ts +49 -0
|
@@ -0,0 +1,691 @@
|
|
|
1
|
+
import { type Reply, type Transport } from '../transport.js';
|
|
2
|
+
export type Bucket = {
|
|
3
|
+
/**
|
|
4
|
+
* The content types it takes; empty: any. image/* names a family.
|
|
5
|
+
*/
|
|
6
|
+
allowed_mime_types: string[];
|
|
7
|
+
/**
|
|
8
|
+
* When it was created.
|
|
9
|
+
*/
|
|
10
|
+
created_at: string;
|
|
11
|
+
/**
|
|
12
|
+
* The largest object it takes, in bytes; absent: the platform's (5 GiB).
|
|
13
|
+
*/
|
|
14
|
+
file_size_limit?: number;
|
|
15
|
+
/**
|
|
16
|
+
* The bucket's name.
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether anyone may read its objects at /storage/public/.
|
|
21
|
+
*/
|
|
22
|
+
public: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* When its declaration last changed.
|
|
25
|
+
*/
|
|
26
|
+
updated_at: string;
|
|
27
|
+
/**
|
|
28
|
+
* The renditions made of every picture put in it.
|
|
29
|
+
*/
|
|
30
|
+
variants: BucketVariant[];
|
|
31
|
+
};
|
|
32
|
+
export type BucketList = {
|
|
33
|
+
/**
|
|
34
|
+
* The project's buckets, by name.
|
|
35
|
+
*/
|
|
36
|
+
buckets: Bucket[];
|
|
37
|
+
};
|
|
38
|
+
export type BucketVariant = {
|
|
39
|
+
/**
|
|
40
|
+
* cover fills the box and crops; contain and inside keep the whole picture inside it (inside never enlarges). Absent: contain.
|
|
41
|
+
*/
|
|
42
|
+
fit: "cover" | "contain" | "inside";
|
|
43
|
+
/**
|
|
44
|
+
* The rendition's format. Absent: jpeg.
|
|
45
|
+
*/
|
|
46
|
+
format: "jpeg" | "png" | "webp";
|
|
47
|
+
/**
|
|
48
|
+
* Pixels; 0 derives it from the width and the picture's aspect.
|
|
49
|
+
*/
|
|
50
|
+
height: number;
|
|
51
|
+
/**
|
|
52
|
+
* The rendition's name: a lowercase letter, then lowercase letters, digits and _ (32 at most).
|
|
53
|
+
*/
|
|
54
|
+
name: string;
|
|
55
|
+
/**
|
|
56
|
+
* 1 to 100 for jpeg and webp; 0: the format's default.
|
|
57
|
+
*/
|
|
58
|
+
quality: number;
|
|
59
|
+
/**
|
|
60
|
+
* Pixels; 0 derives it from the height and the picture's aspect.
|
|
61
|
+
*/
|
|
62
|
+
width: number;
|
|
63
|
+
};
|
|
64
|
+
export type BucketWrite = {
|
|
65
|
+
/**
|
|
66
|
+
* The content types it takes; empty or absent: any. image/* names a family. 64 at most.
|
|
67
|
+
*/
|
|
68
|
+
allowed_mime_types?: string[];
|
|
69
|
+
/**
|
|
70
|
+
* The largest object it takes, in bytes (1 to 5 GiB); null or absent: the platform's.
|
|
71
|
+
*/
|
|
72
|
+
file_size_limit?: number | null;
|
|
73
|
+
/**
|
|
74
|
+
* Whether anyone may read its objects at /storage/public/. Absent: false.
|
|
75
|
+
*/
|
|
76
|
+
public?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* The renditions made of every picture put in it; 16 at most.
|
|
79
|
+
*/
|
|
80
|
+
variants?: BucketVariant[];
|
|
81
|
+
};
|
|
82
|
+
export type ErrorResponse = {
|
|
83
|
+
/**
|
|
84
|
+
* Machine-readable error code (snake_case)
|
|
85
|
+
*/
|
|
86
|
+
error: string;
|
|
87
|
+
/**
|
|
88
|
+
* Human-readable explanation
|
|
89
|
+
*/
|
|
90
|
+
error_description: string;
|
|
91
|
+
/**
|
|
92
|
+
* Correlation ID for log/audit lookup
|
|
93
|
+
*/
|
|
94
|
+
request_id: string;
|
|
95
|
+
/**
|
|
96
|
+
* Seconds to wait before retrying; present on a refusal that ends with time.
|
|
97
|
+
*/
|
|
98
|
+
retry_after?: number;
|
|
99
|
+
/**
|
|
100
|
+
* HTTP status code (mirrors the response status)
|
|
101
|
+
*/
|
|
102
|
+
status: number;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* file.uploaded and file.deleted: an object written (or replaced) in a bucket, or removed from it — by an app, a signed URL, the project's server, or an upload route.
|
|
106
|
+
*/
|
|
107
|
+
export type FileEvent = {
|
|
108
|
+
/**
|
|
109
|
+
* The bucket.
|
|
110
|
+
*/
|
|
111
|
+
bucket: string;
|
|
112
|
+
/**
|
|
113
|
+
* Its content type.
|
|
114
|
+
*/
|
|
115
|
+
content_type: string;
|
|
116
|
+
/**
|
|
117
|
+
* The user it belongs to; null: the project's.
|
|
118
|
+
*/
|
|
119
|
+
owner_id: string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Its path in the bucket.
|
|
122
|
+
*/
|
|
123
|
+
path: string;
|
|
124
|
+
/**
|
|
125
|
+
* Its size in bytes.
|
|
126
|
+
*/
|
|
127
|
+
size: number;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* file.moved: an object moved to another path in its bucket.
|
|
131
|
+
*/
|
|
132
|
+
export type FileMovedEvent = {
|
|
133
|
+
/**
|
|
134
|
+
* The bucket.
|
|
135
|
+
*/
|
|
136
|
+
bucket: string;
|
|
137
|
+
/**
|
|
138
|
+
* The path it was at.
|
|
139
|
+
*/
|
|
140
|
+
from: string;
|
|
141
|
+
/**
|
|
142
|
+
* The user it belongs to; null: the project's.
|
|
143
|
+
*/
|
|
144
|
+
owner_id: string | null;
|
|
145
|
+
/**
|
|
146
|
+
* The path it is at now.
|
|
147
|
+
*/
|
|
148
|
+
to: string;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* An object's bytes.
|
|
152
|
+
*/
|
|
153
|
+
export type ObjectBytes = Blob;
|
|
154
|
+
export type ObjectPage = {
|
|
155
|
+
/**
|
|
156
|
+
* The next page's cursor; absent on the last page.
|
|
157
|
+
*/
|
|
158
|
+
next_cursor?: string;
|
|
159
|
+
/**
|
|
160
|
+
* A page of objects, newest first.
|
|
161
|
+
*/
|
|
162
|
+
objects: StorageObject[];
|
|
163
|
+
};
|
|
164
|
+
export type ObjectRelocate = {
|
|
165
|
+
/**
|
|
166
|
+
* The object's path.
|
|
167
|
+
*/
|
|
168
|
+
from: string;
|
|
169
|
+
/**
|
|
170
|
+
* Replace an object already at to. Absent: false.
|
|
171
|
+
*/
|
|
172
|
+
overwrite?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Where it goes.
|
|
175
|
+
*/
|
|
176
|
+
to: string;
|
|
177
|
+
};
|
|
178
|
+
export type RenderedVariant = {
|
|
179
|
+
/**
|
|
180
|
+
* The rendition's content type, as it was made.
|
|
181
|
+
*/
|
|
182
|
+
content_type: string;
|
|
183
|
+
/**
|
|
184
|
+
* Its size in bytes.
|
|
185
|
+
*/
|
|
186
|
+
size: number;
|
|
187
|
+
};
|
|
188
|
+
export type SignedUrl = {
|
|
189
|
+
/**
|
|
190
|
+
* When it stops working.
|
|
191
|
+
*/
|
|
192
|
+
expires_at: string;
|
|
193
|
+
/**
|
|
194
|
+
* The URL, at the project's own address.
|
|
195
|
+
*/
|
|
196
|
+
url: string;
|
|
197
|
+
};
|
|
198
|
+
export type SignedUrlRequest = {
|
|
199
|
+
/**
|
|
200
|
+
* Seconds the URL works, 1 to 604800.
|
|
201
|
+
*/
|
|
202
|
+
expires_in: number;
|
|
203
|
+
/**
|
|
204
|
+
* The object's path.
|
|
205
|
+
*/
|
|
206
|
+
path: string;
|
|
207
|
+
};
|
|
208
|
+
export type StorageObject = {
|
|
209
|
+
/**
|
|
210
|
+
* Its bucket.
|
|
211
|
+
*/
|
|
212
|
+
bucket: string;
|
|
213
|
+
/**
|
|
214
|
+
* The bytes' sha256, hex.
|
|
215
|
+
*/
|
|
216
|
+
checksum_sha256: string;
|
|
217
|
+
/**
|
|
218
|
+
* Its content type, sniffed from its bytes.
|
|
219
|
+
*/
|
|
220
|
+
content_type: string;
|
|
221
|
+
/**
|
|
222
|
+
* When an object was first stored at its path.
|
|
223
|
+
*/
|
|
224
|
+
created_at: string;
|
|
225
|
+
/**
|
|
226
|
+
* A picture's height in pixels.
|
|
227
|
+
*/
|
|
228
|
+
height?: number;
|
|
229
|
+
/**
|
|
230
|
+
* The user it belongs to; it is deleted with them. Absent: the project's.
|
|
231
|
+
*/
|
|
232
|
+
owner_id?: string;
|
|
233
|
+
/**
|
|
234
|
+
* Its path.
|
|
235
|
+
*/
|
|
236
|
+
path: string;
|
|
237
|
+
/**
|
|
238
|
+
* Its size in bytes.
|
|
239
|
+
*/
|
|
240
|
+
size: number;
|
|
241
|
+
/**
|
|
242
|
+
* A picture's placeholder (ThumbHash, base64).
|
|
243
|
+
*/
|
|
244
|
+
thumbhash?: string;
|
|
245
|
+
/**
|
|
246
|
+
* When its bytes or path last changed.
|
|
247
|
+
*/
|
|
248
|
+
updated_at: string;
|
|
249
|
+
/**
|
|
250
|
+
* Its renditions, by name.
|
|
251
|
+
*/
|
|
252
|
+
variants: {
|
|
253
|
+
[key: string]: RenderedVariant;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* A picture's width in pixels.
|
|
257
|
+
*/
|
|
258
|
+
width?: number;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* What the project keeps, counted.
|
|
262
|
+
*/
|
|
263
|
+
export type StorageStats = {
|
|
264
|
+
/**
|
|
265
|
+
* Every bucket of the project, by name; an empty one with zeros.
|
|
266
|
+
*/
|
|
267
|
+
buckets: StorageStatsBucket[];
|
|
268
|
+
/**
|
|
269
|
+
* One entry per UTC day of the window, oldest first; a day nothing was added on has zeros.
|
|
270
|
+
*/
|
|
271
|
+
days: StorageStatsDay[];
|
|
272
|
+
totals: StorageStatsTotals;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* One bucket's objects.
|
|
276
|
+
*/
|
|
277
|
+
export type StorageStatsBucket = {
|
|
278
|
+
/**
|
|
279
|
+
* Their bytes, renditions included.
|
|
280
|
+
*/
|
|
281
|
+
bytes: number;
|
|
282
|
+
/**
|
|
283
|
+
* The bucket's name.
|
|
284
|
+
*/
|
|
285
|
+
name: string;
|
|
286
|
+
/**
|
|
287
|
+
* The objects in it.
|
|
288
|
+
*/
|
|
289
|
+
objects: number;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* The objects first written on one UTC day that the project still keeps.
|
|
293
|
+
*/
|
|
294
|
+
export type StorageStatsDay = {
|
|
295
|
+
/**
|
|
296
|
+
* Their bytes now, renditions included.
|
|
297
|
+
*/
|
|
298
|
+
bytes_added: number;
|
|
299
|
+
/**
|
|
300
|
+
* The UTC day, YYYY-MM-DD.
|
|
301
|
+
*/
|
|
302
|
+
day: string;
|
|
303
|
+
/**
|
|
304
|
+
* How many.
|
|
305
|
+
*/
|
|
306
|
+
objects_added: number;
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Every object of the project.
|
|
310
|
+
*/
|
|
311
|
+
export type StorageStatsTotals = {
|
|
312
|
+
/**
|
|
313
|
+
* Their bytes, renditions included: what storage.bytes meters.
|
|
314
|
+
*/
|
|
315
|
+
bytes: number;
|
|
316
|
+
/**
|
|
317
|
+
* How many.
|
|
318
|
+
*/
|
|
319
|
+
objects: number;
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* What the app's completion handler (or its authorize's refusal) answered, as it answered it.
|
|
323
|
+
*/
|
|
324
|
+
export type UploadAnswer = unknown;
|
|
325
|
+
export type UploadForm = {
|
|
326
|
+
/**
|
|
327
|
+
* The route's JSON body, at most 1 MiB; sent before the file.
|
|
328
|
+
*/
|
|
329
|
+
body?: string;
|
|
330
|
+
/**
|
|
331
|
+
* The file; its part's filename and Content-Type are the app's to read (the type is detected from the bytes).
|
|
332
|
+
*/
|
|
333
|
+
file: Blob;
|
|
334
|
+
};
|
|
335
|
+
export type UploadUrlRequest = {
|
|
336
|
+
/**
|
|
337
|
+
* Seconds the URL works, 1 to 604800.
|
|
338
|
+
*/
|
|
339
|
+
expires_in: number;
|
|
340
|
+
/**
|
|
341
|
+
* A ceiling below the bucket's own, in bytes.
|
|
342
|
+
*/
|
|
343
|
+
max_bytes?: number;
|
|
344
|
+
/**
|
|
345
|
+
* The user the object will belong to; it is deleted with them.
|
|
346
|
+
*/
|
|
347
|
+
owner_id?: string;
|
|
348
|
+
/**
|
|
349
|
+
* The object's path.
|
|
350
|
+
*/
|
|
351
|
+
path: string;
|
|
352
|
+
};
|
|
353
|
+
/** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
|
|
354
|
+
export interface Events {
|
|
355
|
+
/**
|
|
356
|
+
* file.deleted: an object was removed from a bucket. An endpoint that names buckets hears only theirs.
|
|
357
|
+
*/
|
|
358
|
+
"file.deleted": FileEvent;
|
|
359
|
+
/**
|
|
360
|
+
* file.moved: an object moved to another path in its bucket. An endpoint that names buckets hears only theirs.
|
|
361
|
+
*/
|
|
362
|
+
"file.moved": FileMovedEvent;
|
|
363
|
+
/**
|
|
364
|
+
* file.uploaded: an object was written (or replaced) in a bucket. An endpoint that names buckets hears only theirs.
|
|
365
|
+
*/
|
|
366
|
+
"file.uploaded": FileEvent;
|
|
367
|
+
}
|
|
368
|
+
/** Palbase Storage */
|
|
369
|
+
export declare function client(t: Transport): {
|
|
370
|
+
/**
|
|
371
|
+
* List buckets
|
|
372
|
+
*
|
|
373
|
+
* Every bucket of the project, by name.
|
|
374
|
+
*/
|
|
375
|
+
listBuckets(input?: {
|
|
376
|
+
signal?: AbortSignal;
|
|
377
|
+
}): Promise<Reply<200, BucketList>>;
|
|
378
|
+
/**
|
|
379
|
+
* Read a bucket
|
|
380
|
+
*
|
|
381
|
+
* A bucket and its declaration.
|
|
382
|
+
*/
|
|
383
|
+
getBucket(input: {
|
|
384
|
+
path: {
|
|
385
|
+
bucket: string;
|
|
386
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
387
|
+
signal?: AbortSignal;
|
|
388
|
+
}): Promise<Reply<200, Bucket>>;
|
|
389
|
+
/**
|
|
390
|
+
* Declare a bucket
|
|
391
|
+
*
|
|
392
|
+
* Creates the bucket as declared, or makes it so: whether anyone may read it (public), the largest object it takes, the content types it takes (empty: any; image/* a family), and the renditions made of every picture put in it. A declaration a renderer cannot honour is refused here, not at the first upload.
|
|
393
|
+
*/
|
|
394
|
+
putBucket(input: {
|
|
395
|
+
path: {
|
|
396
|
+
bucket: string;
|
|
397
|
+
};
|
|
398
|
+
headers?: {
|
|
399
|
+
"Idempotency-Key"?: string;
|
|
400
|
+
};
|
|
401
|
+
body: BucketWrite; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
402
|
+
signal?: AbortSignal;
|
|
403
|
+
}): Promise<Reply<200, Bucket> | Reply<201, Bucket>>;
|
|
404
|
+
/**
|
|
405
|
+
* Delete a bucket
|
|
406
|
+
*
|
|
407
|
+
* Deletes an empty bucket; one that still holds objects is refused (409 bucket_not_empty), so no file goes by surprise.
|
|
408
|
+
*/
|
|
409
|
+
deleteBucket(input: {
|
|
410
|
+
path: {
|
|
411
|
+
bucket: string;
|
|
412
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
413
|
+
signal?: AbortSignal;
|
|
414
|
+
}): Promise<Reply<204, undefined>>;
|
|
415
|
+
/**
|
|
416
|
+
* Copy an object
|
|
417
|
+
*
|
|
418
|
+
* Writes a new object at to with from's bytes and renditions. An object already at to is refused (409 object_exists) unless overwrite. Emits file.uploaded.
|
|
419
|
+
*/
|
|
420
|
+
copyObject(input: {
|
|
421
|
+
path: {
|
|
422
|
+
bucket: string;
|
|
423
|
+
};
|
|
424
|
+
headers?: {
|
|
425
|
+
"Idempotency-Key"?: string;
|
|
426
|
+
};
|
|
427
|
+
body: ObjectRelocate; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
428
|
+
signal?: AbortSignal;
|
|
429
|
+
}): Promise<Reply<201, StorageObject>>;
|
|
430
|
+
/**
|
|
431
|
+
* Move an object
|
|
432
|
+
*
|
|
433
|
+
* Gives the object at from the path to: no byte is copied. An object already at to is refused (409 object_exists) unless overwrite. Emits file.moved.
|
|
434
|
+
*/
|
|
435
|
+
moveObject(input: {
|
|
436
|
+
path: {
|
|
437
|
+
bucket: string;
|
|
438
|
+
};
|
|
439
|
+
headers?: {
|
|
440
|
+
"Idempotency-Key"?: string;
|
|
441
|
+
};
|
|
442
|
+
body: ObjectRelocate; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
443
|
+
signal?: AbortSignal;
|
|
444
|
+
}): Promise<Reply<200, StorageObject>>;
|
|
445
|
+
/**
|
|
446
|
+
* List objects
|
|
447
|
+
*
|
|
448
|
+
* A bucket's objects, newest first, a page at a time; prefix narrows them to the paths that start with it.
|
|
449
|
+
*/
|
|
450
|
+
listObjects(input: {
|
|
451
|
+
path: {
|
|
452
|
+
bucket: string;
|
|
453
|
+
};
|
|
454
|
+
query?: {
|
|
455
|
+
prefix?: string; /** Objects per page, 1 to 1000 (100 when absent). */
|
|
456
|
+
limit?: number; /** The next_cursor of the page before. */
|
|
457
|
+
cursor?: string;
|
|
458
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
459
|
+
signal?: AbortSignal;
|
|
460
|
+
}): Promise<Reply<200, ObjectPage>>;
|
|
461
|
+
/**
|
|
462
|
+
* Read an object
|
|
463
|
+
*
|
|
464
|
+
* The object's bytes, or a rendition's (variant). Entity tags and one byte range are honoured; what is served is made inert (nosniff, a sandboxing CSP, and a download for any type a browser does not render safely). Counts toward the project's egress.
|
|
465
|
+
*/
|
|
466
|
+
getObject(input: {
|
|
467
|
+
path: {
|
|
468
|
+
bucket: string; /** The object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8. */
|
|
469
|
+
path: string;
|
|
470
|
+
};
|
|
471
|
+
query?: {
|
|
472
|
+
variant?: string;
|
|
473
|
+
};
|
|
474
|
+
headers?: {
|
|
475
|
+
Range?: string; /** The entity tag the caller holds; a match is answered 304 with no body. */
|
|
476
|
+
"If-None-Match"?: string;
|
|
477
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
478
|
+
signal?: AbortSignal;
|
|
479
|
+
}): Promise<Reply<200, Response> | Reply<206, Response> | Reply<304, undefined>>;
|
|
480
|
+
/**
|
|
481
|
+
* Write an object
|
|
482
|
+
*
|
|
483
|
+
* Stores the body at the path, replacing what is there (If-None-Match: * only creates). The type is sniffed from the bytes, not taken from Content-Type (which is used when the bytes cannot tell, as for HEIC); the bucket's ceiling and types are enforced while the bytes stream. A picture gets its dimensions, a placeholder (thumbhash) and the bucket's renditions, made inside the upload. owner_id makes the object a user's: it goes when they are deleted. Emits file.uploaded.
|
|
484
|
+
*/
|
|
485
|
+
putObject(input: {
|
|
486
|
+
path: {
|
|
487
|
+
bucket: string; /** The object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8. */
|
|
488
|
+
path: string;
|
|
489
|
+
};
|
|
490
|
+
query?: {
|
|
491
|
+
owner_id?: string;
|
|
492
|
+
};
|
|
493
|
+
headers?: {
|
|
494
|
+
"If-None-Match"?: "*"; /** The bytes' sha256, hex: bytes that do not match are refused and nothing is kept. */
|
|
495
|
+
"X-Checksum-Sha256"?: string;
|
|
496
|
+
};
|
|
497
|
+
body: BodyInit;
|
|
498
|
+
contentType?: string; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
499
|
+
signal?: AbortSignal;
|
|
500
|
+
}): Promise<Reply<200, StorageObject> | Reply<201, StorageObject>>;
|
|
501
|
+
/**
|
|
502
|
+
* Delete an object
|
|
503
|
+
*
|
|
504
|
+
* Deletes the object and its renditions; the bytes are swept from the blob store after. Emits file.deleted.
|
|
505
|
+
*/
|
|
506
|
+
deleteObject(input: {
|
|
507
|
+
path: {
|
|
508
|
+
bucket: string; /** The object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8. */
|
|
509
|
+
path: string;
|
|
510
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
511
|
+
signal?: AbortSignal;
|
|
512
|
+
}): Promise<Reply<204, undefined>>;
|
|
513
|
+
/**
|
|
514
|
+
* Read an object's headers
|
|
515
|
+
*
|
|
516
|
+
* GetObject without the body: size, type, entity tag.
|
|
517
|
+
*/
|
|
518
|
+
headObject(input: {
|
|
519
|
+
path: {
|
|
520
|
+
bucket: string; /** The object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8. */
|
|
521
|
+
path: string;
|
|
522
|
+
};
|
|
523
|
+
query?: {
|
|
524
|
+
variant?: string;
|
|
525
|
+
};
|
|
526
|
+
headers?: {
|
|
527
|
+
"If-None-Match"?: string;
|
|
528
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
529
|
+
signal?: AbortSignal;
|
|
530
|
+
}): Promise<Reply<200, undefined> | Reply<304, undefined>>;
|
|
531
|
+
/**
|
|
532
|
+
* Sign a download URL
|
|
533
|
+
*
|
|
534
|
+
* A URL that reads one object, by anyone holding it, until it expires (at most 7 days). The object must exist. The URL is the project's own address; it opens nothing at another project's.
|
|
535
|
+
*/
|
|
536
|
+
createSignedUrl(input: {
|
|
537
|
+
path: {
|
|
538
|
+
bucket: string;
|
|
539
|
+
};
|
|
540
|
+
body: SignedUrlRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
541
|
+
signal?: AbortSignal;
|
|
542
|
+
}): Promise<Reply<200, SignedUrl>>;
|
|
543
|
+
/**
|
|
544
|
+
* Sign an upload URL
|
|
545
|
+
*
|
|
546
|
+
* A URL a client PUTs one object to, until it expires (at most 7 days): the bytes go from the client to storage, never through the project's server. It pins the path, a ceiling (max_bytes, never above the bucket's), the bucket's content types and the user the object will belong to (owner_id).
|
|
547
|
+
*/
|
|
548
|
+
createUploadUrl(input: {
|
|
549
|
+
path: {
|
|
550
|
+
bucket: string;
|
|
551
|
+
};
|
|
552
|
+
body: UploadUrlRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
553
|
+
signal?: AbortSignal;
|
|
554
|
+
}): Promise<Reply<200, SignedUrl>>;
|
|
555
|
+
/**
|
|
556
|
+
* Read a public object
|
|
557
|
+
*
|
|
558
|
+
* An object of a public bucket, with no credential — what an <img src> or a CDN fetches. A private bucket's object is refused (403, the same answer a forged link gets).
|
|
559
|
+
*/
|
|
560
|
+
getPublicObject(input: {
|
|
561
|
+
path: {
|
|
562
|
+
bucket: string; /** The object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8. */
|
|
563
|
+
path: string;
|
|
564
|
+
};
|
|
565
|
+
query?: {
|
|
566
|
+
variant?: string;
|
|
567
|
+
};
|
|
568
|
+
headers?: {
|
|
569
|
+
Range?: string; /** The entity tag the caller holds; a match is answered 304 with no body. */
|
|
570
|
+
"If-None-Match"?: string;
|
|
571
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
572
|
+
signal?: AbortSignal;
|
|
573
|
+
}): Promise<Reply<200, Response> | Reply<206, Response> | Reply<304, undefined>>;
|
|
574
|
+
/**
|
|
575
|
+
* Read a public object's headers
|
|
576
|
+
*
|
|
577
|
+
* GetPublicObject without the body.
|
|
578
|
+
*/
|
|
579
|
+
headPublicObject(input: {
|
|
580
|
+
path: {
|
|
581
|
+
bucket: string; /** The object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8. */
|
|
582
|
+
path: string;
|
|
583
|
+
};
|
|
584
|
+
query?: {
|
|
585
|
+
variant?: string;
|
|
586
|
+
};
|
|
587
|
+
headers?: {
|
|
588
|
+
"If-None-Match"?: string;
|
|
589
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
590
|
+
signal?: AbortSignal;
|
|
591
|
+
}): Promise<Reply<200, undefined> | Reply<304, undefined>>;
|
|
592
|
+
/**
|
|
593
|
+
* Read through a signed URL
|
|
594
|
+
*
|
|
595
|
+
* What a download signature grants: the one object it names, until it expires. Any other object, an upload signature, an edited, expired or another project's signature: 403.
|
|
596
|
+
*/
|
|
597
|
+
getSignedObject(input: {
|
|
598
|
+
path: {
|
|
599
|
+
bucket: string; /** The object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8. */
|
|
600
|
+
path: string;
|
|
601
|
+
};
|
|
602
|
+
query: {
|
|
603
|
+
variant?: string; /** The bucket the signature grants (from the signed URL). */
|
|
604
|
+
b: string; /** The object path the signature grants (from the signed URL). */
|
|
605
|
+
p: string; /** When the signature expires, Unix seconds (from the signed URL). */
|
|
606
|
+
e: string; /** The signature (from the signed URL). Every parameter of the URL is covered by it. */
|
|
607
|
+
sig: string;
|
|
608
|
+
};
|
|
609
|
+
headers?: {
|
|
610
|
+
Range?: string; /** The entity tag the caller holds; a match is answered 304 with no body. */
|
|
611
|
+
"If-None-Match"?: string;
|
|
612
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
613
|
+
signal?: AbortSignal;
|
|
614
|
+
}): Promise<Reply<200, Response> | Reply<206, Response> | Reply<304, undefined>>;
|
|
615
|
+
/**
|
|
616
|
+
* Write through a signed URL
|
|
617
|
+
*
|
|
618
|
+
* What an upload signature grants: the one object it names, no larger than its ceiling, of its content types, belonging to its owner. If-None-Match: * only creates. Emits file.uploaded.
|
|
619
|
+
*/
|
|
620
|
+
putSignedObject(input: {
|
|
621
|
+
path: {
|
|
622
|
+
bucket: string; /** The object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8. */
|
|
623
|
+
path: string;
|
|
624
|
+
};
|
|
625
|
+
query: {
|
|
626
|
+
b: string; /** The object path the signature grants (from the signed URL). */
|
|
627
|
+
p: string; /** When the signature expires, Unix seconds (from the signed URL). */
|
|
628
|
+
e: string; /** The signature (from the signed URL). Every parameter of the URL is covered by it. */
|
|
629
|
+
sig: string; /** Marks an upload grant (from the signed URL). */
|
|
630
|
+
u: string; /** The largest object the upload may be, in bytes (from the signed URL). */
|
|
631
|
+
max: string; /** The content types the upload may be (from the signed URL). */
|
|
632
|
+
mime?: string; /** The user the uploaded object will belong to (from the signed URL). */
|
|
633
|
+
o?: string;
|
|
634
|
+
};
|
|
635
|
+
headers?: {
|
|
636
|
+
"If-None-Match"?: "*"; /** The bytes' sha256, hex: bytes that do not match are refused and nothing is kept. */
|
|
637
|
+
"X-Checksum-Sha256"?: string;
|
|
638
|
+
};
|
|
639
|
+
body: BodyInit;
|
|
640
|
+
contentType?: string; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
641
|
+
signal?: AbortSignal;
|
|
642
|
+
}): Promise<Reply<200, StorageObject> | Reply<201, StorageObject>>;
|
|
643
|
+
/**
|
|
644
|
+
* Read headers through a signed URL
|
|
645
|
+
*
|
|
646
|
+
* GetSignedObject without the body.
|
|
647
|
+
*/
|
|
648
|
+
headSignedObject(input: {
|
|
649
|
+
path: {
|
|
650
|
+
bucket: string; /** The object's path as ONE percent-encoded segment: a/b.jpg is a%2Fb.jpg. Segments are separated by /, none empty, . or ..; 1 to 1024 bytes of UTF-8. */
|
|
651
|
+
path: string;
|
|
652
|
+
};
|
|
653
|
+
query: {
|
|
654
|
+
variant?: string; /** The bucket the signature grants (from the signed URL). */
|
|
655
|
+
b: string; /** The object path the signature grants (from the signed URL). */
|
|
656
|
+
p: string; /** When the signature expires, Unix seconds (from the signed URL). */
|
|
657
|
+
e: string; /** The signature (from the signed URL). Every parameter of the URL is covered by it. */
|
|
658
|
+
sig: string;
|
|
659
|
+
};
|
|
660
|
+
headers?: {
|
|
661
|
+
"If-None-Match"?: string;
|
|
662
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
663
|
+
signal?: AbortSignal;
|
|
664
|
+
}): Promise<Reply<200, undefined> | Reply<304, undefined>>;
|
|
665
|
+
/**
|
|
666
|
+
* Read the storage stats
|
|
667
|
+
*
|
|
668
|
+
* What the project keeps, counted: its objects and their bytes — an object's own and its renditions', as storage.bytes meters them — in all and per bucket (every bucket; an empty one with zeros), and, for each of the last `days` UTC days (today included; a day nothing was added on is listed with zeros), the objects first written that day and their bytes. Counted from the objects the project keeps now: a deleted object is in no count, and a replaced one counts on the day it was first written, with the bytes it holds now.
|
|
669
|
+
*/
|
|
670
|
+
getStorageStats(input?: {
|
|
671
|
+
query?: {
|
|
672
|
+
days?: number;
|
|
673
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
674
|
+
signal?: AbortSignal;
|
|
675
|
+
}): Promise<Reply<200, StorageStats>>;
|
|
676
|
+
/**
|
|
677
|
+
* Upload a file to an app's upload route
|
|
678
|
+
*
|
|
679
|
+
* An app's upload route (@Upload): one call carrying a file and a JSON body, answered with what the app's completion handler returned. The app's machine authorizes it (the route's own auth, and the object's bucket and path), storage writes the bytes under the bucket's rules and measures them, then gives the app the object and the body; its answer is this call's, as the app gave it. A completion that refuses, or does not answer, deletes the object. The caller is named to the app (id, session, role); its token is never forwarded.
|
|
680
|
+
*/
|
|
681
|
+
upload(input: {
|
|
682
|
+
path: {
|
|
683
|
+
machine: string; /** The app's upload route as ONE percent-encoded segment: posts/photo is posts%2Fphoto. Segments separated by /, none empty, . or .. (after Unicode compatibility folding), no control character or backslash; 1 to 1024 bytes of UTF-8. Its query is the request's own. */
|
|
684
|
+
route: string;
|
|
685
|
+
};
|
|
686
|
+
body: BodyInit;
|
|
687
|
+
contentType?: string; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
688
|
+
signal?: AbortSignal;
|
|
689
|
+
}): Promise<never>;
|
|
690
|
+
};
|
|
691
|
+
export type Client = ReturnType<typeof client>;
|