@darco2903/cdn-api 1.0.7-beta.0 → 1.1.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.
Files changed (71) hide show
  1. package/README.md +49 -9
  2. package/dist/client.d.ts +1039 -0
  3. package/{src/client.ts → dist/client.js} +15 -18
  4. package/{src/common.ts → dist/common.d.ts} +4 -4
  5. package/dist/common.js +4 -0
  6. package/dist/consts.d.ts +5 -0
  7. package/{src/consts.ts → dist/consts.js} +4 -8
  8. package/dist/contract/auth.d.ts +35 -0
  9. package/{src/contract/auth.ts → dist/contract/auth.js} +18 -22
  10. package/dist/contract/endpoint.d.ts +396 -0
  11. package/{src/contract/endpoint.ts → dist/contract/endpoint.js} +42 -53
  12. package/dist/contract/index.d.ts +2039 -0
  13. package/{src/contract/index.ts → dist/contract/index.js} +22 -27
  14. package/dist/contract/key.d.ts +15 -0
  15. package/{src/contract/key.ts → dist/contract/key.js} +15 -19
  16. package/dist/contract/list.d.ts +134 -0
  17. package/{src/contract/list.ts → dist/contract/list.js} +28 -30
  18. package/dist/contract/record.d.ts +412 -0
  19. package/{src/contract/record.ts → dist/contract/record.js} +71 -82
  20. package/dist/contract/service.d.ts +240 -0
  21. package/{src/contract/service.ts → dist/contract/service.js} +33 -44
  22. package/dist/contract/stats.d.ts +32 -0
  23. package/{src/contract/stats.ts → dist/contract/stats.js} +34 -36
  24. package/dist/contract/upload.d.ts +790 -0
  25. package/{src/contract/upload.ts → dist/contract/upload.js} +78 -82
  26. package/{src/index.ts → dist/index.d.ts} +2 -2
  27. package/dist/index.js +2 -0
  28. package/dist/server.d.ts +10 -0
  29. package/dist/server.js +58 -0
  30. package/{src/socket/index.ts → dist/socket/index.d.ts} +2 -2
  31. package/dist/socket/index.js +2 -0
  32. package/dist/socket/interface/index.d.ts +5 -0
  33. package/dist/socket/interface/index.js +1 -0
  34. package/{src/socket/interface/template.ts → dist/socket/interface/template.d.ts} +6 -7
  35. package/dist/socket/interface/template.js +1 -0
  36. package/dist/socket/types.d.ts +3 -0
  37. package/dist/socket/types.js +1 -0
  38. package/dist/types/creds.d.ts +8 -0
  39. package/{src/types/creds.ts → dist/types/creds.js} +5 -7
  40. package/dist/types/endpoint.d.ts +25 -0
  41. package/{src/types/endpoint.ts → dist/types/endpoint.js} +12 -19
  42. package/{src/types/index.ts → dist/types/index.d.ts} +6 -6
  43. package/dist/types/index.js +6 -0
  44. package/dist/types/jwt.d.ts +128 -0
  45. package/dist/types/jwt.js +33 -0
  46. package/dist/types/record.d.ts +97 -0
  47. package/{src/types/record.ts → dist/types/record.js} +25 -35
  48. package/dist/types/stats.d.ts +15 -0
  49. package/{src/types/stats.ts → dist/types/stats.js} +6 -9
  50. package/dist/types/upload.d.ts +45 -0
  51. package/{src/types/upload.ts → dist/types/upload.js} +12 -18
  52. package/dist/types.d.ts +32 -0
  53. package/dist/types.js +27 -0
  54. package/dist/uploader.d.ts +1044 -0
  55. package/{src/uploader.ts → dist/uploader.js} +72 -99
  56. package/package.json +2 -2
  57. package/.gitattributes +0 -2
  58. package/.github/workflows/release.yml +0 -116
  59. package/TODO.md +0 -0
  60. package/prettier.config.js +0 -24
  61. package/src/server.ts +0 -89
  62. package/src/socket/interface/index.ts +0 -12
  63. package/src/socket/types.ts +0 -7
  64. package/src/types/jwt.ts +0 -78
  65. package/src/types.ts +0 -38
  66. package/tests/keys/private.pem +0 -5
  67. package/tests/keys/public.pem +0 -4
  68. package/tests/keys.ts +0 -11
  69. package/tests/tsconfig.json +0 -12
  70. package/tests/vitest/jwt.test.ts +0 -38
  71. package/tsconfig.json +0 -14
@@ -0,0 +1,1044 @@
1
+ import { AxiosInstance } from "axios";
2
+ export default class Uploader {
3
+ static MAX_SINGLE_UPLOAD_SIZE: number;
4
+ protected ax: AxiosInstance;
5
+ protected client: {
6
+ list: {
7
+ public: (args?: {
8
+ cache?: RequestCache | undefined;
9
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
10
+ extraHeaders?: ({
11
+ authorization?: undefined;
12
+ } & Record<string, string | undefined>) | undefined;
13
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
14
+ headers?: {
15
+ authorization?: string | undefined;
16
+ } | undefined;
17
+ } | undefined) => Promise<{
18
+ status: 200;
19
+ body: {
20
+ filename: string;
21
+ size: number;
22
+ storage_id: string;
23
+ mime_type: string;
24
+ endpoints: {
25
+ endpoint: string;
26
+ }[];
27
+ }[];
28
+ headers: Headers;
29
+ } | {
30
+ status: 500;
31
+ body: {
32
+ code: "INTERNAL_SERVER_ERROR";
33
+ name: "APIError";
34
+ error: string;
35
+ };
36
+ headers: Headers;
37
+ } | {
38
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
39
+ body: unknown;
40
+ headers: Headers;
41
+ }>;
42
+ admin: (args?: {
43
+ cache?: RequestCache | undefined;
44
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
45
+ extraHeaders?: ({
46
+ authorization?: undefined;
47
+ } & Record<string, string | undefined>) | undefined;
48
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
49
+ headers?: {
50
+ authorization?: string | undefined;
51
+ } | undefined;
52
+ } | undefined) => Promise<{
53
+ status: 200;
54
+ body: {
55
+ type: "user" | "service" | "system";
56
+ filename: string;
57
+ active: boolean;
58
+ visible: boolean;
59
+ role: number;
60
+ size: number;
61
+ created_at: Date;
62
+ updated_at: Date;
63
+ storage_id: string;
64
+ mime_type: string;
65
+ endpoints: {
66
+ created_at: Date;
67
+ updated_at: Date;
68
+ endpoint: string;
69
+ }[];
70
+ user_id: string | null;
71
+ }[];
72
+ headers: Headers;
73
+ } | {
74
+ status: 401;
75
+ body: {
76
+ code: "UNAUTHORIZED";
77
+ name: "APIError";
78
+ error: "Unauthorized";
79
+ };
80
+ headers: Headers;
81
+ } | {
82
+ status: 403;
83
+ body: {
84
+ code: "FORBIDDEN";
85
+ name: "APIError";
86
+ error: "Forbidden";
87
+ };
88
+ headers: Headers;
89
+ } | {
90
+ status: 500;
91
+ body: {
92
+ code: "INTERNAL_SERVER_ERROR";
93
+ name: "APIError";
94
+ error: string;
95
+ };
96
+ headers: Headers;
97
+ } | {
98
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 402 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
99
+ body: unknown;
100
+ headers: Headers;
101
+ }>;
102
+ };
103
+ record: {
104
+ get: (args: {
105
+ params: {
106
+ storage_id: string;
107
+ };
108
+ cache?: RequestCache | undefined;
109
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
110
+ extraHeaders?: ({
111
+ authorization?: undefined;
112
+ } & Record<string, string | undefined>) | undefined;
113
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
114
+ headers?: {
115
+ authorization?: string | undefined;
116
+ } | undefined;
117
+ }) => Promise<{
118
+ status: 200;
119
+ body: {
120
+ type: "user" | "service" | "system";
121
+ filename: string;
122
+ active: boolean;
123
+ visible: boolean;
124
+ role: number;
125
+ size: number;
126
+ created_at: Date;
127
+ updated_at: Date;
128
+ storage_id: string;
129
+ mime_type: string;
130
+ endpoints: {
131
+ created_at: Date;
132
+ updated_at: Date;
133
+ endpoint: string;
134
+ }[];
135
+ user_id: string | null;
136
+ };
137
+ headers: Headers;
138
+ } | {
139
+ status: 401;
140
+ body: {
141
+ code: "UNAUTHORIZED";
142
+ name: "APIError";
143
+ error: "Unauthorized";
144
+ };
145
+ headers: Headers;
146
+ } | {
147
+ status: 403;
148
+ body: {
149
+ code: "FORBIDDEN";
150
+ name: "APIError";
151
+ error: "Forbidden";
152
+ };
153
+ headers: Headers;
154
+ } | {
155
+ status: 404;
156
+ body: {
157
+ code: "NOT_FOUND";
158
+ name: "APIError";
159
+ error: "Record not found";
160
+ };
161
+ headers: Headers;
162
+ } | {
163
+ status: 500;
164
+ body: {
165
+ code: "INTERNAL_SERVER_ERROR";
166
+ name: "APIError";
167
+ error: string;
168
+ };
169
+ headers: Headers;
170
+ } | {
171
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 402 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
172
+ body: unknown;
173
+ headers: Headers;
174
+ }>;
175
+ update: (args: {
176
+ body: {
177
+ filename: string;
178
+ active?: boolean | undefined;
179
+ visible?: boolean | undefined;
180
+ role?: number | undefined;
181
+ } | {
182
+ role: number;
183
+ filename?: string | undefined;
184
+ active?: boolean | undefined;
185
+ visible?: boolean | undefined;
186
+ } | {
187
+ active: boolean;
188
+ filename?: string | undefined;
189
+ visible?: boolean | undefined;
190
+ role?: number | undefined;
191
+ } | {
192
+ visible: boolean;
193
+ filename?: string | undefined;
194
+ active?: boolean | undefined;
195
+ role?: number | undefined;
196
+ };
197
+ params: {
198
+ storage_id: string;
199
+ };
200
+ cache?: RequestCache | undefined;
201
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
202
+ extraHeaders?: ({
203
+ authorization?: undefined;
204
+ } & Record<string, string | undefined>) | undefined;
205
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
206
+ headers?: {
207
+ authorization?: string | undefined;
208
+ } | undefined;
209
+ }) => Promise<{
210
+ status: 200;
211
+ body: null;
212
+ headers: Headers;
213
+ } | {
214
+ status: 400;
215
+ body: {
216
+ name: "ZodError";
217
+ issues: import("zod").objectOutputType<{
218
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
219
+ message: import("zod").ZodOptional<import("zod").ZodString>;
220
+ code: import("zod").ZodNativeEnum<{
221
+ invalid_type: "invalid_type";
222
+ invalid_literal: "invalid_literal";
223
+ custom: "custom";
224
+ invalid_union: "invalid_union";
225
+ invalid_union_discriminator: "invalid_union_discriminator";
226
+ invalid_enum_value: "invalid_enum_value";
227
+ unrecognized_keys: "unrecognized_keys";
228
+ invalid_arguments: "invalid_arguments";
229
+ invalid_return_type: "invalid_return_type";
230
+ invalid_date: "invalid_date";
231
+ invalid_string: "invalid_string";
232
+ too_small: "too_small";
233
+ too_big: "too_big";
234
+ invalid_intersection_types: "invalid_intersection_types";
235
+ not_multiple_of: "not_multiple_of";
236
+ not_finite: "not_finite";
237
+ }>;
238
+ }, import("zod").ZodAny, "strip">[];
239
+ };
240
+ headers: Headers;
241
+ } | {
242
+ status: 401;
243
+ body: {
244
+ code: "UNAUTHORIZED";
245
+ name: "APIError";
246
+ error: "Unauthorized";
247
+ };
248
+ headers: Headers;
249
+ } | {
250
+ status: 403;
251
+ body: {
252
+ code: "FORBIDDEN";
253
+ name: "APIError";
254
+ error: "Forbidden";
255
+ };
256
+ headers: Headers;
257
+ } | {
258
+ status: 404;
259
+ body: {
260
+ code: "NOT_FOUND";
261
+ name: "APIError";
262
+ error: "Record not found";
263
+ };
264
+ headers: Headers;
265
+ } | {
266
+ status: 500;
267
+ body: {
268
+ code: "INTERNAL_SERVER_ERROR";
269
+ name: "APIError";
270
+ error: string;
271
+ };
272
+ headers: Headers;
273
+ } | {
274
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
275
+ body: unknown;
276
+ headers: Headers;
277
+ }>;
278
+ delete: (args: {
279
+ params: {
280
+ storage_id: string;
281
+ };
282
+ cache?: RequestCache | undefined;
283
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
284
+ extraHeaders?: ({
285
+ authorization?: undefined;
286
+ } & Record<string, string | undefined>) | undefined;
287
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
288
+ headers?: {
289
+ authorization?: string | undefined;
290
+ } | undefined;
291
+ }) => Promise<{
292
+ status: 200;
293
+ body: null;
294
+ headers: Headers;
295
+ } | {
296
+ status: 401;
297
+ body: {
298
+ code: "UNAUTHORIZED";
299
+ name: "APIError";
300
+ error: "Unauthorized";
301
+ };
302
+ headers: Headers;
303
+ } | {
304
+ status: 403;
305
+ body: {
306
+ code: "FORBIDDEN";
307
+ name: "APIError";
308
+ error: "Forbidden";
309
+ };
310
+ headers: Headers;
311
+ } | {
312
+ status: 404;
313
+ body: {
314
+ code: "NOT_FOUND";
315
+ name: "APIError";
316
+ error: "Record not found";
317
+ };
318
+ headers: Headers;
319
+ } | {
320
+ status: 500;
321
+ body: {
322
+ code: "INTERNAL_SERVER_ERROR";
323
+ name: "APIError";
324
+ error: string;
325
+ };
326
+ headers: Headers;
327
+ } | {
328
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 402 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
329
+ body: unknown;
330
+ headers: Headers;
331
+ }>;
332
+ };
333
+ service: {
334
+ update: (args: {
335
+ body: FormData | {};
336
+ headers: {
337
+ authorization: string;
338
+ };
339
+ cache?: RequestCache | undefined;
340
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
341
+ extraHeaders?: ({
342
+ authorization?: undefined;
343
+ } & Record<string, string | undefined>) | undefined;
344
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
345
+ }) => Promise<{
346
+ status: 200;
347
+ body: null;
348
+ headers: Headers;
349
+ } | {
350
+ status: 400;
351
+ body: {
352
+ code: "BAD_REQUEST";
353
+ name: "APIError";
354
+ error: string;
355
+ };
356
+ headers: Headers;
357
+ } | {
358
+ status: 401;
359
+ body: {
360
+ code: "UNAUTHORIZED";
361
+ name: "APIError";
362
+ error: "Invalid CDN token";
363
+ };
364
+ headers: Headers;
365
+ } | {
366
+ status: 429;
367
+ body: {
368
+ code: "TOO_MANY_REQUESTS";
369
+ name: "APIError";
370
+ error: string;
371
+ };
372
+ headers: Headers;
373
+ } | {
374
+ status: 500;
375
+ body: {
376
+ code: "INTERNAL_SERVER_ERROR";
377
+ name: "APIError";
378
+ error: string;
379
+ };
380
+ headers: Headers;
381
+ } | {
382
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
383
+ body: unknown;
384
+ headers: Headers;
385
+ }>;
386
+ delete: (args: {
387
+ headers: {
388
+ authorization: string;
389
+ };
390
+ cache?: RequestCache | undefined;
391
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
392
+ extraHeaders?: ({
393
+ authorization?: undefined;
394
+ } & Record<string, string | undefined>) | undefined;
395
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
396
+ }) => Promise<{
397
+ status: 200;
398
+ body: null;
399
+ headers: Headers;
400
+ } | {
401
+ status: 400;
402
+ body: {
403
+ name: "ZodError";
404
+ issues: import("zod").objectOutputType<{
405
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
406
+ message: import("zod").ZodOptional<import("zod").ZodString>;
407
+ code: import("zod").ZodNativeEnum<{
408
+ invalid_type: "invalid_type";
409
+ invalid_literal: "invalid_literal";
410
+ custom: "custom";
411
+ invalid_union: "invalid_union";
412
+ invalid_union_discriminator: "invalid_union_discriminator";
413
+ invalid_enum_value: "invalid_enum_value";
414
+ unrecognized_keys: "unrecognized_keys";
415
+ invalid_arguments: "invalid_arguments";
416
+ invalid_return_type: "invalid_return_type";
417
+ invalid_date: "invalid_date";
418
+ invalid_string: "invalid_string";
419
+ too_small: "too_small";
420
+ too_big: "too_big";
421
+ invalid_intersection_types: "invalid_intersection_types";
422
+ not_multiple_of: "not_multiple_of";
423
+ not_finite: "not_finite";
424
+ }>;
425
+ }, import("zod").ZodAny, "strip">[];
426
+ };
427
+ headers: Headers;
428
+ } | {
429
+ status: 401;
430
+ body: {
431
+ code: "UNAUTHORIZED";
432
+ name: "APIError";
433
+ error: "Invalid CDN token";
434
+ };
435
+ headers: Headers;
436
+ } | {
437
+ status: 404;
438
+ body: {
439
+ code: "NOT_FOUND";
440
+ name: "APIError";
441
+ error: "Service asset not found";
442
+ };
443
+ headers: Headers;
444
+ } | {
445
+ status: 500;
446
+ body: {
447
+ code: "INTERNAL_SERVER_ERROR";
448
+ name: "APIError";
449
+ error: string;
450
+ };
451
+ headers: Headers;
452
+ } | {
453
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 403 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
454
+ body: unknown;
455
+ headers: Headers;
456
+ }>;
457
+ };
458
+ stats: {
459
+ global: (args?: {
460
+ cache?: RequestCache | undefined;
461
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
462
+ extraHeaders?: Record<string, string | undefined> | undefined;
463
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
464
+ } | undefined) => Promise<{
465
+ status: 200;
466
+ body: {
467
+ record_count: number;
468
+ total_size: number;
469
+ max_size: number;
470
+ };
471
+ headers: Headers;
472
+ } | {
473
+ status: 500;
474
+ body: {
475
+ code: "INTERNAL_SERVER_ERROR";
476
+ name: "APIError";
477
+ error: string;
478
+ };
479
+ headers: Headers;
480
+ } | {
481
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
482
+ body: unknown;
483
+ headers: Headers;
484
+ }>;
485
+ };
486
+ upload: {
487
+ upload: (args: {
488
+ body: FormData | {
489
+ data: string;
490
+ file?: any;
491
+ };
492
+ cache?: RequestCache | undefined;
493
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
494
+ extraHeaders?: ({
495
+ authorization?: undefined;
496
+ } & Record<string, string | undefined>) | undefined;
497
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
498
+ headers?: {
499
+ authorization?: string | undefined;
500
+ } | undefined;
501
+ }) => Promise<{
502
+ status: 200;
503
+ body: null;
504
+ headers: Headers;
505
+ } | {
506
+ status: 400;
507
+ body: {
508
+ name: "ZodError";
509
+ issues: import("zod").objectOutputType<{
510
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
511
+ message: import("zod").ZodOptional<import("zod").ZodString>;
512
+ code: import("zod").ZodNativeEnum<{
513
+ invalid_type: "invalid_type";
514
+ invalid_literal: "invalid_literal";
515
+ custom: "custom";
516
+ invalid_union: "invalid_union";
517
+ invalid_union_discriminator: "invalid_union_discriminator";
518
+ invalid_enum_value: "invalid_enum_value";
519
+ unrecognized_keys: "unrecognized_keys";
520
+ invalid_arguments: "invalid_arguments";
521
+ invalid_return_type: "invalid_return_type";
522
+ invalid_date: "invalid_date";
523
+ invalid_string: "invalid_string";
524
+ too_small: "too_small";
525
+ too_big: "too_big";
526
+ invalid_intersection_types: "invalid_intersection_types";
527
+ not_multiple_of: "not_multiple_of";
528
+ not_finite: "not_finite";
529
+ }>;
530
+ }, import("zod").ZodAny, "strip">[];
531
+ } | {
532
+ code: "BAD_REQUEST";
533
+ name: "APIError";
534
+ error: string;
535
+ };
536
+ headers: Headers;
537
+ } | {
538
+ status: 401;
539
+ body: {
540
+ code: "UNAUTHORIZED";
541
+ name: "APIError";
542
+ error: "Unauthorized";
543
+ };
544
+ headers: Headers;
545
+ } | {
546
+ status: 403;
547
+ body: {
548
+ code: "FORBIDDEN";
549
+ name: "APIError";
550
+ error: "Forbidden";
551
+ };
552
+ headers: Headers;
553
+ } | {
554
+ status: 500;
555
+ body: {
556
+ code: "INTERNAL_SERVER_ERROR";
557
+ name: "APIError";
558
+ error: string;
559
+ };
560
+ headers: Headers;
561
+ } | {
562
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
563
+ body: unknown;
564
+ headers: Headers;
565
+ }>;
566
+ uploadInit: (args: {
567
+ body: {
568
+ filename: string;
569
+ active: boolean;
570
+ visible: boolean;
571
+ role: number;
572
+ size: number;
573
+ mimeType: string;
574
+ parts: number;
575
+ };
576
+ cache?: RequestCache | undefined;
577
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
578
+ extraHeaders?: Record<string, string | undefined> | undefined;
579
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
580
+ }) => Promise<{
581
+ status: 200;
582
+ body: {
583
+ uploadId: string;
584
+ };
585
+ headers: Headers;
586
+ } | {
587
+ status: 400;
588
+ body: {
589
+ name: "ZodError";
590
+ issues: import("zod").objectOutputType<{
591
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
592
+ message: import("zod").ZodOptional<import("zod").ZodString>;
593
+ code: import("zod").ZodNativeEnum<{
594
+ invalid_type: "invalid_type";
595
+ invalid_literal: "invalid_literal";
596
+ custom: "custom";
597
+ invalid_union: "invalid_union";
598
+ invalid_union_discriminator: "invalid_union_discriminator";
599
+ invalid_enum_value: "invalid_enum_value";
600
+ unrecognized_keys: "unrecognized_keys";
601
+ invalid_arguments: "invalid_arguments";
602
+ invalid_return_type: "invalid_return_type";
603
+ invalid_date: "invalid_date";
604
+ invalid_string: "invalid_string";
605
+ too_small: "too_small";
606
+ too_big: "too_big";
607
+ invalid_intersection_types: "invalid_intersection_types";
608
+ not_multiple_of: "not_multiple_of";
609
+ not_finite: "not_finite";
610
+ }>;
611
+ }, import("zod").ZodAny, "strip">[];
612
+ } | {
613
+ code: "BAD_REQUEST";
614
+ name: "APIError";
615
+ error: string;
616
+ };
617
+ headers: Headers;
618
+ } | {
619
+ status: 401;
620
+ body: {
621
+ code: "UNAUTHORIZED";
622
+ name: "APIError";
623
+ error: "Unauthorized";
624
+ };
625
+ headers: Headers;
626
+ } | {
627
+ status: 403;
628
+ body: {
629
+ code: "FORBIDDEN";
630
+ name: "APIError";
631
+ error: "Forbidden";
632
+ };
633
+ headers: Headers;
634
+ } | {
635
+ status: 500;
636
+ body: {
637
+ code: "INTERNAL_SERVER_ERROR";
638
+ name: "APIError";
639
+ error: string;
640
+ };
641
+ headers: Headers;
642
+ } | {
643
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
644
+ body: unknown;
645
+ headers: Headers;
646
+ }>;
647
+ uploadPart: (args: {
648
+ body: FormData | {
649
+ file?: any;
650
+ };
651
+ params: {
652
+ upload_id: string;
653
+ part: string;
654
+ };
655
+ cache?: RequestCache | undefined;
656
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
657
+ extraHeaders?: Record<string, string | undefined> | undefined;
658
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
659
+ }) => Promise<{
660
+ status: 200;
661
+ body: null;
662
+ headers: Headers;
663
+ } | {
664
+ status: 400;
665
+ body: {
666
+ name: "ZodError";
667
+ issues: import("zod").objectOutputType<{
668
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
669
+ message: import("zod").ZodOptional<import("zod").ZodString>;
670
+ code: import("zod").ZodNativeEnum<{
671
+ invalid_type: "invalid_type";
672
+ invalid_literal: "invalid_literal";
673
+ custom: "custom";
674
+ invalid_union: "invalid_union";
675
+ invalid_union_discriminator: "invalid_union_discriminator";
676
+ invalid_enum_value: "invalid_enum_value";
677
+ unrecognized_keys: "unrecognized_keys";
678
+ invalid_arguments: "invalid_arguments";
679
+ invalid_return_type: "invalid_return_type";
680
+ invalid_date: "invalid_date";
681
+ invalid_string: "invalid_string";
682
+ too_small: "too_small";
683
+ too_big: "too_big";
684
+ invalid_intersection_types: "invalid_intersection_types";
685
+ not_multiple_of: "not_multiple_of";
686
+ not_finite: "not_finite";
687
+ }>;
688
+ }, import("zod").ZodAny, "strip">[];
689
+ } | {
690
+ code: "BAD_REQUEST";
691
+ name: "APIError";
692
+ error: string;
693
+ };
694
+ headers: Headers;
695
+ } | {
696
+ status: 401;
697
+ body: {
698
+ code: "UNAUTHORIZED";
699
+ name: "APIError";
700
+ error: "Unauthorized";
701
+ };
702
+ headers: Headers;
703
+ } | {
704
+ status: 403;
705
+ body: {
706
+ code: "FORBIDDEN";
707
+ name: "APIError";
708
+ error: "Forbidden";
709
+ };
710
+ headers: Headers;
711
+ } | {
712
+ status: 404;
713
+ body: {
714
+ code: "NOT_FOUND";
715
+ name: "APIError";
716
+ error: string;
717
+ };
718
+ headers: Headers;
719
+ } | {
720
+ status: 409;
721
+ body: {
722
+ code: "CONFLICT";
723
+ name: "APIError";
724
+ error: string;
725
+ };
726
+ headers: Headers;
727
+ } | {
728
+ status: 500;
729
+ body: {
730
+ code: "INTERNAL_SERVER_ERROR";
731
+ name: "APIError";
732
+ error: string;
733
+ };
734
+ headers: Headers;
735
+ } | {
736
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
737
+ body: unknown;
738
+ headers: Headers;
739
+ }>;
740
+ uploadEnd: (args: {
741
+ params: {
742
+ upload_id: string;
743
+ };
744
+ cache?: RequestCache | undefined;
745
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
746
+ extraHeaders?: Record<string, string | undefined> | undefined;
747
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
748
+ }) => Promise<{
749
+ status: 200;
750
+ body: null;
751
+ headers: Headers;
752
+ } | {
753
+ status: 400;
754
+ body: {
755
+ name: "ZodError";
756
+ issues: import("zod").objectOutputType<{
757
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
758
+ message: import("zod").ZodOptional<import("zod").ZodString>;
759
+ code: import("zod").ZodNativeEnum<{
760
+ invalid_type: "invalid_type";
761
+ invalid_literal: "invalid_literal";
762
+ custom: "custom";
763
+ invalid_union: "invalid_union";
764
+ invalid_union_discriminator: "invalid_union_discriminator";
765
+ invalid_enum_value: "invalid_enum_value";
766
+ unrecognized_keys: "unrecognized_keys";
767
+ invalid_arguments: "invalid_arguments";
768
+ invalid_return_type: "invalid_return_type";
769
+ invalid_date: "invalid_date";
770
+ invalid_string: "invalid_string";
771
+ too_small: "too_small";
772
+ too_big: "too_big";
773
+ invalid_intersection_types: "invalid_intersection_types";
774
+ not_multiple_of: "not_multiple_of";
775
+ not_finite: "not_finite";
776
+ }>;
777
+ }, import("zod").ZodAny, "strip">[];
778
+ };
779
+ headers: Headers;
780
+ } | {
781
+ status: 401;
782
+ body: {
783
+ code: "UNAUTHORIZED";
784
+ name: "APIError";
785
+ error: "Unauthorized";
786
+ };
787
+ headers: Headers;
788
+ } | {
789
+ status: 403;
790
+ body: {
791
+ code: "FORBIDDEN";
792
+ name: "APIError";
793
+ error: "Forbidden";
794
+ };
795
+ headers: Headers;
796
+ } | {
797
+ status: 404;
798
+ body: {
799
+ code: "NOT_FOUND";
800
+ name: "APIError";
801
+ error: string;
802
+ };
803
+ headers: Headers;
804
+ } | {
805
+ status: 500;
806
+ body: {
807
+ code: "INTERNAL_SERVER_ERROR";
808
+ name: "APIError";
809
+ error: string;
810
+ };
811
+ headers: Headers;
812
+ } | {
813
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
814
+ body: unknown;
815
+ headers: Headers;
816
+ }>;
817
+ };
818
+ publicKey: (args?: {
819
+ cache?: RequestCache | undefined;
820
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
821
+ extraHeaders?: Record<string, string | undefined> | undefined;
822
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
823
+ } | undefined) => Promise<{
824
+ status: 200;
825
+ body: {
826
+ publicKey: string;
827
+ };
828
+ headers: Headers;
829
+ } | {
830
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
831
+ body: unknown;
832
+ headers: Headers;
833
+ }>;
834
+ auth: {
835
+ access: (args?: {
836
+ cache?: RequestCache | undefined;
837
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
838
+ extraHeaders?: ({
839
+ authorization?: undefined;
840
+ } & Record<string, string | undefined>) | undefined;
841
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
842
+ headers?: {
843
+ authorization?: string | undefined;
844
+ } | undefined;
845
+ } | undefined) => Promise<{
846
+ status: 200;
847
+ body: {
848
+ access: boolean;
849
+ };
850
+ headers: Headers;
851
+ } | {
852
+ status: 500;
853
+ body: {
854
+ code: "INTERNAL_SERVER_ERROR";
855
+ name: "APIError";
856
+ error: string;
857
+ };
858
+ headers: Headers;
859
+ } | {
860
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
861
+ body: unknown;
862
+ headers: Headers;
863
+ }>;
864
+ };
865
+ endpoint: {
866
+ create: (args: {
867
+ body: {
868
+ endpoint: string;
869
+ storage_id: string;
870
+ };
871
+ cache?: RequestCache | undefined;
872
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
873
+ extraHeaders?: ({
874
+ authorization?: undefined;
875
+ } & Record<string, string | undefined>) | undefined;
876
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
877
+ headers?: {
878
+ authorization?: string | undefined;
879
+ } | undefined;
880
+ }) => Promise<{
881
+ status: 200;
882
+ body: null;
883
+ headers: Headers;
884
+ } | {
885
+ status: 400;
886
+ body: {
887
+ name: "ZodError";
888
+ issues: import("zod").objectOutputType<{
889
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
890
+ message: import("zod").ZodOptional<import("zod").ZodString>;
891
+ code: import("zod").ZodNativeEnum<{
892
+ invalid_type: "invalid_type";
893
+ invalid_literal: "invalid_literal";
894
+ custom: "custom";
895
+ invalid_union: "invalid_union";
896
+ invalid_union_discriminator: "invalid_union_discriminator";
897
+ invalid_enum_value: "invalid_enum_value";
898
+ unrecognized_keys: "unrecognized_keys";
899
+ invalid_arguments: "invalid_arguments";
900
+ invalid_return_type: "invalid_return_type";
901
+ invalid_date: "invalid_date";
902
+ invalid_string: "invalid_string";
903
+ too_small: "too_small";
904
+ too_big: "too_big";
905
+ invalid_intersection_types: "invalid_intersection_types";
906
+ not_multiple_of: "not_multiple_of";
907
+ not_finite: "not_finite";
908
+ }>;
909
+ }, import("zod").ZodAny, "strip">[];
910
+ };
911
+ headers: Headers;
912
+ } | {
913
+ status: 401;
914
+ body: {
915
+ code: "UNAUTHORIZED";
916
+ name: "APIError";
917
+ error: "Unauthorized";
918
+ };
919
+ headers: Headers;
920
+ } | {
921
+ status: 403;
922
+ body: {
923
+ code: "FORBIDDEN";
924
+ name: "APIError";
925
+ error: "Forbidden";
926
+ };
927
+ headers: Headers;
928
+ } | {
929
+ status: 404;
930
+ body: {
931
+ code: "NOT_FOUND";
932
+ name: "APIError";
933
+ error: "Record not found";
934
+ };
935
+ headers: Headers;
936
+ } | {
937
+ status: 409;
938
+ body: {
939
+ code: "CONFLICT";
940
+ name: "APIError";
941
+ error: "Endpoint already exists";
942
+ };
943
+ headers: Headers;
944
+ } | {
945
+ status: 500;
946
+ body: {
947
+ code: "INTERNAL_SERVER_ERROR";
948
+ name: "APIError";
949
+ error: string;
950
+ };
951
+ headers: Headers;
952
+ } | {
953
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
954
+ body: unknown;
955
+ headers: Headers;
956
+ }>;
957
+ delete: (args: {
958
+ body: {
959
+ endpoint: string;
960
+ };
961
+ cache?: RequestCache | undefined;
962
+ fetchOptions?: import("@ts-rest/core").FetchOptions | undefined;
963
+ extraHeaders?: ({
964
+ authorization?: undefined;
965
+ } & Record<string, string | undefined>) | undefined;
966
+ overrideClientOptions?: Partial<import("@ts-rest/core").OverrideableClientArgs> | undefined;
967
+ headers?: {
968
+ authorization?: string | undefined;
969
+ } | undefined;
970
+ }) => Promise<{
971
+ status: 200;
972
+ body: null;
973
+ headers: Headers;
974
+ } | {
975
+ status: 400;
976
+ body: {
977
+ name: "ZodError";
978
+ issues: import("zod").objectOutputType<{
979
+ path: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, "many">;
980
+ message: import("zod").ZodOptional<import("zod").ZodString>;
981
+ code: import("zod").ZodNativeEnum<{
982
+ invalid_type: "invalid_type";
983
+ invalid_literal: "invalid_literal";
984
+ custom: "custom";
985
+ invalid_union: "invalid_union";
986
+ invalid_union_discriminator: "invalid_union_discriminator";
987
+ invalid_enum_value: "invalid_enum_value";
988
+ unrecognized_keys: "unrecognized_keys";
989
+ invalid_arguments: "invalid_arguments";
990
+ invalid_return_type: "invalid_return_type";
991
+ invalid_date: "invalid_date";
992
+ invalid_string: "invalid_string";
993
+ too_small: "too_small";
994
+ too_big: "too_big";
995
+ invalid_intersection_types: "invalid_intersection_types";
996
+ not_multiple_of: "not_multiple_of";
997
+ not_finite: "not_finite";
998
+ }>;
999
+ }, import("zod").ZodAny, "strip">[];
1000
+ };
1001
+ headers: Headers;
1002
+ } | {
1003
+ status: 401;
1004
+ body: {
1005
+ code: "UNAUTHORIZED";
1006
+ name: "APIError";
1007
+ error: "Unauthorized";
1008
+ };
1009
+ headers: Headers;
1010
+ } | {
1011
+ status: 403;
1012
+ body: {
1013
+ code: "FORBIDDEN";
1014
+ name: "APIError";
1015
+ error: "Forbidden";
1016
+ };
1017
+ headers: Headers;
1018
+ } | {
1019
+ status: 404;
1020
+ body: {
1021
+ code: "NOT_FOUND";
1022
+ name: "APIError";
1023
+ error: "Endpoint not found";
1024
+ };
1025
+ headers: Headers;
1026
+ } | {
1027
+ status: 500;
1028
+ body: {
1029
+ code: "INTERNAL_SERVER_ERROR";
1030
+ name: "APIError";
1031
+ error: string;
1032
+ };
1033
+ headers: Headers;
1034
+ } | {
1035
+ status: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 100 | 101 | 102 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 402 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
1036
+ body: unknown;
1037
+ headers: Headers;
1038
+ }>;
1039
+ };
1040
+ };
1041
+ constructor(origin: string);
1042
+ protected getPartEndpoint(uploadId: string, part: number): string;
1043
+ upload(file: File, role: number, visible: boolean, active: boolean): Promise<void>;
1044
+ }