@meistrari/vault-http-client 2.3.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/dist/index.cjs ADDED
@@ -0,0 +1,984 @@
1
+ 'use strict';
2
+
3
+ const core = require('@zodios/core');
4
+ const zod = require('zod');
5
+
6
+ const put_WorkspacesByWorkspaceIdSettings_Body = zod.z.object({
7
+ bucketName: zod.z.string().min(1),
8
+ keyArns: zod.z.array(zod.z.string()).min(1),
9
+ defaultS3LinkTtl: zod.z.number().gte(1)
10
+ }).strict();
11
+ const post_Files_Body = zod.z.object({
12
+ fileName: zod.z.string(),
13
+ sha256sum: zod.z.string().optional(),
14
+ size: zod.z.number().optional(),
15
+ mimeType: zod.z.string().optional(),
16
+ createdBy: zod.z.string().optional()
17
+ }).strict();
18
+ const postFilesBulk_Body = zod.z.union([
19
+ zod.z.array(
20
+ zod.z.object({
21
+ fileName: zod.z.string(),
22
+ sha256sum: zod.z.string().optional(),
23
+ size: zod.z.number().optional(),
24
+ mimeType: zod.z.string().optional(),
25
+ createdBy: zod.z.string().optional()
26
+ }).strict()
27
+ ),
28
+ zod.z.object({ files: zod.z.array(zod.z.string()) }).strict()
29
+ ]);
30
+ const postFilesByFilename_Body = zod.z.object({
31
+ fileName: zod.z.string(),
32
+ sha256sum: zod.z.string(),
33
+ size: zod.z.number(),
34
+ mimeType: zod.z.string(),
35
+ createdBy: zod.z.string()
36
+ }).partial().strict();
37
+ const endpoints = core.makeApi([
38
+ {
39
+ method: "get",
40
+ path: "/_/files",
41
+ description: `Get a list of files.`,
42
+ requestFormat: "json",
43
+ parameters: [
44
+ {
45
+ name: "workspaceId",
46
+ type: "Query",
47
+ schema: zod.z.string()
48
+ },
49
+ {
50
+ name: "includeDeleted",
51
+ type: "Query",
52
+ schema: zod.z.boolean().optional().default(false)
53
+ },
54
+ {
55
+ name: "size",
56
+ type: "Query",
57
+ schema: zod.z.number().optional().default(100)
58
+ },
59
+ {
60
+ name: "page",
61
+ type: "Query",
62
+ schema: zod.z.number().optional().default(1)
63
+ },
64
+ {
65
+ name: "orderByField",
66
+ type: "Query",
67
+ schema: zod.z.enum(["id", "createdAt", "deletedAt"]).optional()
68
+ },
69
+ {
70
+ name: "orderByDirection",
71
+ type: "Query",
72
+ schema: zod.z.enum(["asc", "desc"]).optional()
73
+ },
74
+ {
75
+ name: "search",
76
+ type: "Query",
77
+ schema: zod.z.string().optional()
78
+ }
79
+ ],
80
+ response: zod.z.object({
81
+ files: zod.z.array(
82
+ zod.z.object({
83
+ id: zod.z.string(),
84
+ path: zod.z.string(),
85
+ workspaceId: zod.z.string(),
86
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
87
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
88
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
89
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
90
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
91
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
92
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
93
+ createdAt: zod.z.string(),
94
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
95
+ }).strict()
96
+ ),
97
+ count: zod.z.number(),
98
+ pages: zod.z.number()
99
+ }).strict()
100
+ },
101
+ {
102
+ method: "post",
103
+ path: "/_/files",
104
+ description: `Create a file and get a pre-signed upload URL.
105
+
106
+ The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
107
+
108
+ The `filename` parameter is deprecated. Use the `originalFileName` parameter in the request body instead. Either way, the information about the file name is stored in the `metadata.originalFileName` field.
109
+
110
+ The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
111
+ `,
112
+ requestFormat: "json",
113
+ parameters: [
114
+ {
115
+ name: "body",
116
+ type: "Body",
117
+ schema: post_Files_Body
118
+ },
119
+ {
120
+ name: "expiresIn",
121
+ type: "Query",
122
+ schema: zod.z.number().optional().default(3600)
123
+ },
124
+ {
125
+ name: "workspaceId",
126
+ type: "Query",
127
+ schema: zod.z.string()
128
+ }
129
+ ],
130
+ response: zod.z.union([
131
+ zod.z.object({
132
+ id: zod.z.string(),
133
+ uploadUrl: zod.z.string(),
134
+ expiresAt: zod.z.string().datetime({ offset: true }),
135
+ metadata: zod.z.object({
136
+ id: zod.z.string(),
137
+ path: zod.z.string(),
138
+ workspaceId: zod.z.string(),
139
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
140
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
141
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
142
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
143
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
144
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
145
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
146
+ createdAt: zod.z.string(),
147
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
148
+ }).strict()
149
+ }).strict(),
150
+ zod.z.object({
151
+ url: zod.z.string(),
152
+ expiresAt: zod.z.string().datetime({ offset: true })
153
+ }).strict()
154
+ ])
155
+ },
156
+ {
157
+ method: "get",
158
+ path: "/_/files/:fileId",
159
+ description: `Get a pre-signed download URL for a file.`,
160
+ requestFormat: "json",
161
+ parameters: [
162
+ {
163
+ name: "expiresIn",
164
+ type: "Query",
165
+ schema: zod.z.number().optional().default(3600)
166
+ },
167
+ {
168
+ name: "workspaceId",
169
+ type: "Query",
170
+ schema: zod.z.string()
171
+ },
172
+ {
173
+ name: "fileId",
174
+ type: "Path",
175
+ schema: zod.z.string()
176
+ }
177
+ ],
178
+ response: zod.z.object({
179
+ url: zod.z.string(),
180
+ expiresAt: zod.z.string().datetime({ offset: true }),
181
+ metadata: zod.z.union([
182
+ zod.z.object({
183
+ id: zod.z.string(),
184
+ path: zod.z.string(),
185
+ workspaceId: zod.z.string(),
186
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
187
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
188
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
189
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
190
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
191
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
192
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
193
+ createdAt: zod.z.string(),
194
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
195
+ }).strict(),
196
+ zod.z.null()
197
+ ])
198
+ }).strict(),
199
+ errors: [
200
+ {
201
+ status: 404,
202
+ description: `File not found`,
203
+ schema: zod.z.void()
204
+ }
205
+ ]
206
+ },
207
+ {
208
+ method: "put",
209
+ path: "/_/files/:id",
210
+ description: `Get a pre-signed upload URL for a file.`,
211
+ requestFormat: "json",
212
+ parameters: [
213
+ {
214
+ name: "expiresIn",
215
+ type: "Query",
216
+ schema: zod.z.number().optional().default(3600)
217
+ },
218
+ {
219
+ name: "workspaceId",
220
+ type: "Query",
221
+ schema: zod.z.string()
222
+ },
223
+ {
224
+ name: "id",
225
+ type: "Path",
226
+ schema: zod.z.string()
227
+ }
228
+ ],
229
+ response: zod.z.union([
230
+ zod.z.object({
231
+ id: zod.z.string(),
232
+ uploadUrl: zod.z.string().url(),
233
+ expiresAt: zod.z.string().datetime({ offset: true }),
234
+ metadata: zod.z.object({
235
+ id: zod.z.string(),
236
+ path: zod.z.string(),
237
+ workspaceId: zod.z.string(),
238
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
239
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
240
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
241
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
242
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
243
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
244
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
245
+ createdAt: zod.z.string(),
246
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
247
+ }).strict()
248
+ }).strict(),
249
+ zod.z.object({
250
+ url: zod.z.string().url(),
251
+ expiresAt: zod.z.string().datetime({ offset: true })
252
+ }).strict()
253
+ ])
254
+ },
255
+ {
256
+ method: "delete",
257
+ path: "/_/files/:id",
258
+ description: `Delete a file.`,
259
+ requestFormat: "json",
260
+ parameters: [
261
+ {
262
+ name: "workspaceId",
263
+ type: "Query",
264
+ schema: zod.z.string()
265
+ },
266
+ {
267
+ name: "id",
268
+ type: "Path",
269
+ schema: zod.z.string()
270
+ }
271
+ ],
272
+ response: zod.z.void()
273
+ },
274
+ {
275
+ method: "get",
276
+ path: "/_/files/:id/metadata",
277
+ description: `Get the metadata for a file.`,
278
+ requestFormat: "json",
279
+ parameters: [
280
+ {
281
+ name: "workspaceId",
282
+ type: "Query",
283
+ schema: zod.z.string()
284
+ },
285
+ {
286
+ name: "id",
287
+ type: "Path",
288
+ schema: zod.z.string()
289
+ }
290
+ ],
291
+ response: zod.z.object({
292
+ id: zod.z.string(),
293
+ path: zod.z.string(),
294
+ workspaceId: zod.z.string(),
295
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
296
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
297
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
298
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
299
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
300
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
301
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
302
+ createdAt: zod.z.string(),
303
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
304
+ }).strict(),
305
+ errors: [
306
+ {
307
+ status: 404,
308
+ description: `File not found`,
309
+ schema: zod.z.void()
310
+ }
311
+ ]
312
+ },
313
+ {
314
+ method: "get",
315
+ path: "/_/files/by-workspace",
316
+ description: `List workspaces and their file counts`,
317
+ requestFormat: "json",
318
+ response: zod.z.array(
319
+ zod.z.object({
320
+ workspaceId: zod.z.string(),
321
+ files: zod.z.number(),
322
+ permalinks: zod.z.number(),
323
+ hasCustomSettings: zod.z.boolean()
324
+ }).strict()
325
+ )
326
+ },
327
+ {
328
+ method: "put",
329
+ path: "/_/workspaces/:workspaceId/settings",
330
+ description: `Defines settings for a workspace.`,
331
+ requestFormat: "json",
332
+ parameters: [
333
+ {
334
+ name: "body",
335
+ type: "Body",
336
+ schema: put_WorkspacesByWorkspaceIdSettings_Body
337
+ },
338
+ {
339
+ name: "workspaceId",
340
+ type: "Path",
341
+ schema: zod.z.string()
342
+ }
343
+ ],
344
+ response: zod.z.void(),
345
+ errors: [
346
+ {
347
+ status: 401,
348
+ description: `Unauthorized`,
349
+ schema: zod.z.void()
350
+ }
351
+ ]
352
+ },
353
+ {
354
+ method: "get",
355
+ path: "/_/workspaces/:workspaceId/settings",
356
+ description: `Gets settings for a workspace.`,
357
+ requestFormat: "json",
358
+ parameters: [
359
+ {
360
+ name: "workspaceId",
361
+ type: "Path",
362
+ schema: zod.z.string()
363
+ }
364
+ ],
365
+ response: zod.z.object({
366
+ bucketName: zod.z.string().min(1),
367
+ keyArns: zod.z.array(zod.z.string()).min(1),
368
+ defaultS3LinkTtl: zod.z.number().gte(1)
369
+ }).strict()
370
+ },
371
+ {
372
+ method: "get",
373
+ path: "/files/:fileId",
374
+ description: `Get a pre-signed download URL for a file.`,
375
+ requestFormat: "json",
376
+ parameters: [
377
+ {
378
+ name: "fileId",
379
+ type: "Path",
380
+ schema: zod.z.string()
381
+ }
382
+ ],
383
+ response: zod.z.object({
384
+ url: zod.z.string(),
385
+ expiresAt: zod.z.string().datetime({ offset: true }),
386
+ metadata: zod.z.union([
387
+ zod.z.object({
388
+ id: zod.z.string(),
389
+ path: zod.z.string(),
390
+ workspaceId: zod.z.string(),
391
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
392
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
393
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
394
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
395
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
396
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
397
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
398
+ createdAt: zod.z.string(),
399
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
400
+ }).strict(),
401
+ zod.z.null()
402
+ ])
403
+ }).strict(),
404
+ errors: [
405
+ {
406
+ status: 404,
407
+ description: `File not found`,
408
+ schema: zod.z.void()
409
+ }
410
+ ]
411
+ },
412
+ {
413
+ method: "post",
414
+ path: "/files/:fileId/permalinks",
415
+ description: `Create a public, direct, and optionally expiring download link for a file.
416
+
417
+ The returned permalink ID should be used with the `/permalinks/:permalinkId` endpoint to download the file via a 302 redirect.
418
+ `,
419
+ requestFormat: "json",
420
+ parameters: [
421
+ {
422
+ name: "body",
423
+ type: "Body",
424
+ schema: zod.z.object({ expiresAt: zod.z.string().datetime({ offset: true }) }).partial().strict()
425
+ },
426
+ {
427
+ name: "fileId",
428
+ type: "Path",
429
+ schema: zod.z.string()
430
+ }
431
+ ],
432
+ response: zod.z.object({
433
+ id: zod.z.string(),
434
+ fileId: zod.z.string(),
435
+ workspaceId: zod.z.string(),
436
+ createdAt: zod.z.string(),
437
+ expiresAt: zod.z.union([zod.z.string(), zod.z.null()]),
438
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()])
439
+ }).strict()
440
+ },
441
+ {
442
+ method: "get",
443
+ path: "/files/:fileId/permalinks",
444
+ description: `Get all permalinks for a file.`,
445
+ requestFormat: "json",
446
+ parameters: [
447
+ {
448
+ name: "fileId",
449
+ type: "Path",
450
+ schema: zod.z.string()
451
+ }
452
+ ],
453
+ response: zod.z.array(
454
+ zod.z.object({
455
+ id: zod.z.string(),
456
+ fileId: zod.z.string(),
457
+ workspaceId: zod.z.string(),
458
+ createdAt: zod.z.string(),
459
+ expiresAt: zod.z.union([zod.z.string(), zod.z.null()]),
460
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()])
461
+ }).strict()
462
+ )
463
+ },
464
+ {
465
+ method: "post",
466
+ path: "/files/:filename",
467
+ description: `Create a file and get a pre-signed upload URL.
468
+
469
+ The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
470
+
471
+ The `filename` parameter is deprecated. Use the `originalFileName` parameter in the request body instead. Either way, the information about the file name is stored in the `metadata.originalFileName` field.
472
+
473
+ The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
474
+ `,
475
+ requestFormat: "json",
476
+ parameters: [
477
+ {
478
+ name: "body",
479
+ type: "Body",
480
+ schema: postFilesByFilename_Body
481
+ },
482
+ {
483
+ name: "expiresIn",
484
+ type: "Query",
485
+ schema: zod.z.number().optional().default(3600)
486
+ },
487
+ {
488
+ name: "filename",
489
+ type: "Path",
490
+ schema: zod.z.string()
491
+ }
492
+ ],
493
+ response: zod.z.union([
494
+ zod.z.object({
495
+ id: zod.z.string(),
496
+ uploadUrl: zod.z.string(),
497
+ expiresAt: zod.z.string().datetime({ offset: true }),
498
+ metadata: zod.z.object({
499
+ id: zod.z.string(),
500
+ path: zod.z.string(),
501
+ workspaceId: zod.z.string(),
502
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
503
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
504
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
505
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
506
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
507
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
508
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
509
+ createdAt: zod.z.string(),
510
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
511
+ }).strict()
512
+ }).strict(),
513
+ zod.z.object({
514
+ url: zod.z.string(),
515
+ expiresAt: zod.z.string().datetime({ offset: true })
516
+ }).strict()
517
+ ])
518
+ },
519
+ {
520
+ method: "put",
521
+ path: "/files/:id",
522
+ description: `Create a file and get a pre-signed upload URL.`,
523
+ requestFormat: "json",
524
+ parameters: [
525
+ {
526
+ name: "expiresIn",
527
+ type: "Query",
528
+ schema: zod.z.number().optional().default(3600)
529
+ },
530
+ {
531
+ name: "id",
532
+ type: "Path",
533
+ schema: zod.z.string()
534
+ }
535
+ ],
536
+ response: zod.z.union([
537
+ zod.z.object({
538
+ id: zod.z.string(),
539
+ uploadUrl: zod.z.string().url(),
540
+ expiresAt: zod.z.string().datetime({ offset: true }),
541
+ metadata: zod.z.object({
542
+ id: zod.z.string(),
543
+ path: zod.z.string(),
544
+ workspaceId: zod.z.string(),
545
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
546
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
547
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
548
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
549
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
550
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
551
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
552
+ createdAt: zod.z.string(),
553
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
554
+ }).strict()
555
+ }).strict(),
556
+ zod.z.object({
557
+ url: zod.z.string().url(),
558
+ expiresAt: zod.z.string().datetime({ offset: true })
559
+ }).strict()
560
+ ])
561
+ },
562
+ {
563
+ method: "delete",
564
+ path: "/files/:id",
565
+ description: `Delete a file.`,
566
+ requestFormat: "json",
567
+ parameters: [
568
+ {
569
+ name: "id",
570
+ type: "Path",
571
+ schema: zod.z.string()
572
+ }
573
+ ],
574
+ response: zod.z.void()
575
+ },
576
+ {
577
+ method: "get",
578
+ path: "/files/:id/metadata",
579
+ description: `Get the metadata for a file.`,
580
+ requestFormat: "json",
581
+ parameters: [
582
+ {
583
+ name: "id",
584
+ type: "Path",
585
+ schema: zod.z.string()
586
+ }
587
+ ],
588
+ response: zod.z.object({
589
+ id: zod.z.string(),
590
+ path: zod.z.string(),
591
+ workspaceId: zod.z.string(),
592
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
593
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
594
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
595
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
596
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
597
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
598
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
599
+ createdAt: zod.z.string(),
600
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
601
+ }).strict(),
602
+ errors: [
603
+ {
604
+ status: 404,
605
+ description: `File not found`,
606
+ schema: zod.z.void()
607
+ }
608
+ ]
609
+ },
610
+ {
611
+ method: "post",
612
+ path: "/files/bulk",
613
+ description: `Create multiple files in bulk and get pre-signed upload URLs.`,
614
+ requestFormat: "json",
615
+ parameters: [
616
+ {
617
+ name: "body",
618
+ type: "Body",
619
+ schema: postFilesBulk_Body
620
+ }
621
+ ],
622
+ response: zod.z.union([
623
+ zod.z.array(
624
+ zod.z.object({
625
+ id: zod.z.string(),
626
+ path: zod.z.string(),
627
+ workspaceId: zod.z.string(),
628
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
629
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
630
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
631
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
632
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
633
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
634
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
635
+ createdAt: zod.z.string(),
636
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
637
+ }).strict()
638
+ ),
639
+ zod.z.object({
640
+ files: zod.z.array(
641
+ zod.z.object({
642
+ id: zod.z.string(),
643
+ path: zod.z.string(),
644
+ workspaceId: zod.z.string(),
645
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
646
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
647
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
648
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
649
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
650
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
651
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
652
+ createdAt: zod.z.string(),
653
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
654
+ }).strict()
655
+ )
656
+ }).strict()
657
+ ])
658
+ },
659
+ {
660
+ method: "get",
661
+ path: "/permalinks/:permalinkId",
662
+ description: `Download a file via a permalink.
663
+
664
+ Make sure to follow redirects to the actual file download URL.
665
+ `,
666
+ requestFormat: "json",
667
+ parameters: [
668
+ {
669
+ name: "permalinkId",
670
+ type: "Path",
671
+ schema: zod.z.string()
672
+ }
673
+ ],
674
+ response: zod.z.void(),
675
+ errors: [
676
+ {
677
+ status: 302,
678
+ description: `Redirect to the file download URL`,
679
+ schema: zod.z.void()
680
+ },
681
+ {
682
+ status: 404,
683
+ description: `Permalink not found`,
684
+ schema: zod.z.void()
685
+ }
686
+ ]
687
+ },
688
+ {
689
+ method: "delete",
690
+ path: "/permalinks/:permalinkId",
691
+ description: `Delete a permalink.`,
692
+ requestFormat: "json",
693
+ parameters: [
694
+ {
695
+ name: "permalinkId",
696
+ type: "Path",
697
+ schema: zod.z.string()
698
+ }
699
+ ],
700
+ response: zod.z.void()
701
+ },
702
+ {
703
+ method: "get",
704
+ path: "/permalinks/:permalinkId/metadata",
705
+ description: `Get the metadata for a permalink.`,
706
+ requestFormat: "json",
707
+ parameters: [
708
+ {
709
+ name: "permalinkId",
710
+ type: "Path",
711
+ schema: zod.z.string()
712
+ }
713
+ ],
714
+ response: zod.z.object({
715
+ id: zod.z.string(),
716
+ fileId: zod.z.string(),
717
+ workspaceId: zod.z.string(),
718
+ createdAt: zod.z.string(),
719
+ expiresAt: zod.z.union([zod.z.string(), zod.z.null()]),
720
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()])
721
+ }).strict(),
722
+ errors: [
723
+ {
724
+ status: 404,
725
+ description: `Permalink not found`,
726
+ schema: zod.z.void()
727
+ }
728
+ ]
729
+ },
730
+ {
731
+ method: "get",
732
+ path: "/v2/files/:fileId",
733
+ description: `Get a pre-signed download URL for a file.`,
734
+ requestFormat: "json",
735
+ parameters: [
736
+ {
737
+ name: "fileId",
738
+ type: "Path",
739
+ schema: zod.z.string()
740
+ }
741
+ ],
742
+ response: zod.z.object({
743
+ url: zod.z.string(),
744
+ expiresAt: zod.z.string().datetime({ offset: true }),
745
+ metadata: zod.z.union([
746
+ zod.z.object({
747
+ id: zod.z.string(),
748
+ path: zod.z.string(),
749
+ workspaceId: zod.z.string(),
750
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
751
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
752
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
753
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
754
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
755
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
756
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
757
+ createdAt: zod.z.string(),
758
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
759
+ }).strict(),
760
+ zod.z.null()
761
+ ])
762
+ }).strict(),
763
+ errors: [
764
+ {
765
+ status: 404,
766
+ description: `File not found`,
767
+ schema: zod.z.void()
768
+ }
769
+ ]
770
+ },
771
+ {
772
+ method: "post",
773
+ path: "/v2/files/:filename",
774
+ description: `Create a file and get a pre-signed upload URL.
775
+
776
+ The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
777
+
778
+ The `filename` parameter is deprecated. Use the `originalFileName` parameter in the request body instead. Either way, the information about the file name is stored in the `metadata.originalFileName` field.
779
+
780
+ The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
781
+ `,
782
+ requestFormat: "json",
783
+ parameters: [
784
+ {
785
+ name: "body",
786
+ type: "Body",
787
+ schema: postFilesByFilename_Body
788
+ },
789
+ {
790
+ name: "expiresIn",
791
+ type: "Query",
792
+ schema: zod.z.number().optional().default(3600)
793
+ },
794
+ {
795
+ name: "filename",
796
+ type: "Path",
797
+ schema: zod.z.string()
798
+ }
799
+ ],
800
+ response: zod.z.union([
801
+ zod.z.object({
802
+ id: zod.z.string(),
803
+ uploadUrl: zod.z.string(),
804
+ expiresAt: zod.z.string().datetime({ offset: true }),
805
+ metadata: zod.z.object({
806
+ id: zod.z.string(),
807
+ path: zod.z.string(),
808
+ workspaceId: zod.z.string(),
809
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
810
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
811
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
812
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
813
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
814
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
815
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
816
+ createdAt: zod.z.string(),
817
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
818
+ }).strict()
819
+ }).strict(),
820
+ zod.z.object({
821
+ url: zod.z.string(),
822
+ expiresAt: zod.z.string().datetime({ offset: true })
823
+ }).strict()
824
+ ])
825
+ },
826
+ {
827
+ method: "put",
828
+ path: "/v2/files/:id",
829
+ description: `Create a file and get a pre-signed upload URL.`,
830
+ requestFormat: "json",
831
+ parameters: [
832
+ {
833
+ name: "expiresIn",
834
+ type: "Query",
835
+ schema: zod.z.number().optional().default(3600)
836
+ },
837
+ {
838
+ name: "id",
839
+ type: "Path",
840
+ schema: zod.z.string()
841
+ }
842
+ ],
843
+ response: zod.z.union([
844
+ zod.z.object({
845
+ id: zod.z.string(),
846
+ uploadUrl: zod.z.string().url(),
847
+ expiresAt: zod.z.string().datetime({ offset: true }),
848
+ metadata: zod.z.object({
849
+ id: zod.z.string(),
850
+ path: zod.z.string(),
851
+ workspaceId: zod.z.string(),
852
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
853
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
854
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
855
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
856
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
857
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
858
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
859
+ createdAt: zod.z.string(),
860
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
861
+ }).strict()
862
+ }).strict(),
863
+ zod.z.object({
864
+ url: zod.z.string().url(),
865
+ expiresAt: zod.z.string().datetime({ offset: true })
866
+ }).strict()
867
+ ])
868
+ },
869
+ {
870
+ method: "delete",
871
+ path: "/v2/files/:id",
872
+ description: `Delete a file.`,
873
+ requestFormat: "json",
874
+ parameters: [
875
+ {
876
+ name: "id",
877
+ type: "Path",
878
+ schema: zod.z.string()
879
+ }
880
+ ],
881
+ response: zod.z.void()
882
+ },
883
+ {
884
+ method: "get",
885
+ path: "/v2/files/:id/metadata",
886
+ description: `Get the metadata for a file.`,
887
+ requestFormat: "json",
888
+ parameters: [
889
+ {
890
+ name: "id",
891
+ type: "Path",
892
+ schema: zod.z.string()
893
+ }
894
+ ],
895
+ response: zod.z.object({
896
+ id: zod.z.string(),
897
+ path: zod.z.string(),
898
+ workspaceId: zod.z.string(),
899
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
900
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
901
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
902
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
903
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
904
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
905
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
906
+ createdAt: zod.z.string(),
907
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
908
+ }).strict(),
909
+ errors: [
910
+ {
911
+ status: 404,
912
+ description: `File not found`,
913
+ schema: zod.z.void()
914
+ }
915
+ ]
916
+ },
917
+ {
918
+ method: "post",
919
+ path: "/v2/files/bulk",
920
+ description: `Create multiple files in bulk and get pre-signed upload URLs.`,
921
+ requestFormat: "json",
922
+ parameters: [
923
+ {
924
+ name: "body",
925
+ type: "Body",
926
+ schema: postFilesBulk_Body
927
+ }
928
+ ],
929
+ response: zod.z.union([
930
+ zod.z.array(
931
+ zod.z.object({
932
+ id: zod.z.string(),
933
+ path: zod.z.string(),
934
+ workspaceId: zod.z.string(),
935
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
936
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
937
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
938
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
939
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
940
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
941
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
942
+ createdAt: zod.z.string(),
943
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
944
+ }).strict()
945
+ ),
946
+ zod.z.object({
947
+ files: zod.z.array(
948
+ zod.z.object({
949
+ id: zod.z.string(),
950
+ path: zod.z.string(),
951
+ workspaceId: zod.z.string(),
952
+ originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
953
+ mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
954
+ size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
955
+ legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
956
+ bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
957
+ encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
958
+ createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
959
+ createdAt: zod.z.string(),
960
+ deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
961
+ }).strict()
962
+ )
963
+ }).strict()
964
+ ])
965
+ }
966
+ ]);
967
+ new core.Zodios(endpoints);
968
+ function createApiClient(baseUrl, options) {
969
+ return new core.Zodios(baseUrl, endpoints, options);
970
+ }
971
+
972
+ function useVaultClient(vaultUrl, token) {
973
+ const api = createApiClient(vaultUrl, {
974
+ axiosConfig: {
975
+ headers: {
976
+ Authorization: token
977
+ }
978
+ }
979
+ });
980
+ return api;
981
+ }
982
+
983
+ exports.createApiClient = createApiClient;
984
+ exports.useVaultClient = useVaultClient;