@meistrari/vault-http-client 2.10.0 → 2.17.6
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 +371 -116
- package/dist/index.d.cts +600 -218
- package/dist/index.d.mts +600 -218
- package/dist/index.d.ts +600 -218
- package/dist/index.mjs +371 -116
- package/package.json +8 -1
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { makeApi, Zodios } from '@zodios/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
z.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}).partial()
|
|
17
|
-
),
|
|
18
|
-
z.object({ files: z.array(z.string()) })
|
|
19
|
-
]);
|
|
4
|
+
const postAssets_Body = z.object({
|
|
5
|
+
assetClass: z.string().min(1).max(128).regex(/^[a-z0-9][a-z0-9._:-]*$/),
|
|
6
|
+
subject: z.string().min(1).max(255),
|
|
7
|
+
mimeType: z.enum([
|
|
8
|
+
"image/png",
|
|
9
|
+
"image/jpeg",
|
|
10
|
+
"image/gif",
|
|
11
|
+
"image/webp",
|
|
12
|
+
"image/avif"
|
|
13
|
+
]),
|
|
14
|
+
size: z.number().int().gte(0).lte(9007199254740991).optional()
|
|
15
|
+
});
|
|
20
16
|
const postFiles_Body = z.object({
|
|
21
17
|
fileName: z.string(),
|
|
22
18
|
parentId: z.string(),
|
|
@@ -25,10 +21,34 @@ const postFiles_Body = z.object({
|
|
|
25
21
|
sha256sum: z.string(),
|
|
26
22
|
size: z.number(),
|
|
27
23
|
mimeType: z.string(),
|
|
28
|
-
createdBy: z.string()
|
|
29
|
-
path: z.string()
|
|
24
|
+
createdBy: z.string()
|
|
30
25
|
}).partial();
|
|
31
|
-
const
|
|
26
|
+
const postFilesBulk_Body = z.array(
|
|
27
|
+
z.object({
|
|
28
|
+
fileName: z.string(),
|
|
29
|
+
parentId: z.string(),
|
|
30
|
+
onMissingParent: z.enum(["error", "create-as-root"]).default("error"),
|
|
31
|
+
onParentConflict: z.enum(["error", "update-parent-id", "ignore"]).default("error"),
|
|
32
|
+
sha256sum: z.string(),
|
|
33
|
+
size: z.number(),
|
|
34
|
+
mimeType: z.string(),
|
|
35
|
+
createdBy: z.string()
|
|
36
|
+
}).partial()
|
|
37
|
+
);
|
|
38
|
+
const postFilesByFileIdMultipartPart_Body = z.object({
|
|
39
|
+
uploadId: z.string().min(1).max(4096),
|
|
40
|
+
partNumber: z.number().int().gte(1).lte(1e4)
|
|
41
|
+
});
|
|
42
|
+
const postFilesByFileIdMultipartComplete_Body = z.object({
|
|
43
|
+
uploadId: z.string().min(1).max(4096),
|
|
44
|
+
parts: z.array(
|
|
45
|
+
z.object({
|
|
46
|
+
partNumber: z.number().int().gte(1).lte(1e4),
|
|
47
|
+
etag: z.string().min(1).max(256)
|
|
48
|
+
})
|
|
49
|
+
).min(1).max(1e4)
|
|
50
|
+
});
|
|
51
|
+
const putWorkspacesByWorkspaceIdSettings_Body = z.object({
|
|
32
52
|
bucketName: z.string().min(1),
|
|
33
53
|
keyArns: z.array(z.string()).min(1),
|
|
34
54
|
defaultS3LinkTtl: z.number().gte(1)
|
|
@@ -129,7 +149,9 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
129
149
|
response: z.object({
|
|
130
150
|
id: z.string(),
|
|
131
151
|
uploadUrl: z.string().url(),
|
|
132
|
-
expiresAt: z.string().
|
|
152
|
+
expiresAt: z.string().regex(
|
|
153
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
154
|
+
).datetime({ offset: true }),
|
|
133
155
|
metadata: z.object({
|
|
134
156
|
id: z.string(),
|
|
135
157
|
path: z.string(),
|
|
@@ -169,6 +191,16 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
169
191
|
type: "Query",
|
|
170
192
|
schema: z.enum(["true", "false"]).optional().default("false")
|
|
171
193
|
},
|
|
194
|
+
{
|
|
195
|
+
name: "includeChildren",
|
|
196
|
+
type: "Query",
|
|
197
|
+
schema: z.enum(["true", "false"]).optional().default("false")
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "includeParent",
|
|
201
|
+
type: "Query",
|
|
202
|
+
schema: z.enum(["true", "false"]).optional().default("false")
|
|
203
|
+
},
|
|
172
204
|
{
|
|
173
205
|
name: "fileId",
|
|
174
206
|
type: "Path",
|
|
@@ -177,7 +209,9 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
177
209
|
],
|
|
178
210
|
response: z.object({
|
|
179
211
|
url: z.string(),
|
|
180
|
-
expiresAt: z.string().
|
|
212
|
+
expiresAt: z.string().regex(
|
|
213
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
214
|
+
).datetime({ offset: true }),
|
|
181
215
|
metadata: z.union([
|
|
182
216
|
z.object({
|
|
183
217
|
id: z.string(),
|
|
@@ -211,7 +245,7 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
211
245
|
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
212
246
|
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
213
247
|
})
|
|
214
|
-
),
|
|
248
|
+
).optional(),
|
|
215
249
|
parent: z.union([
|
|
216
250
|
z.object({
|
|
217
251
|
id: z.string(),
|
|
@@ -230,7 +264,7 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
230
264
|
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
231
265
|
}),
|
|
232
266
|
z.null()
|
|
233
|
-
])
|
|
267
|
+
]).optional()
|
|
234
268
|
}),
|
|
235
269
|
z.null()
|
|
236
270
|
])
|
|
@@ -319,7 +353,9 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
319
353
|
response: z.object({
|
|
320
354
|
id: z.string(),
|
|
321
355
|
uploadUrl: z.string().url(),
|
|
322
|
-
expiresAt: z.string().
|
|
356
|
+
expiresAt: z.string().regex(
|
|
357
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
358
|
+
).datetime({ offset: true }),
|
|
323
359
|
metadata: z.object({
|
|
324
360
|
id: z.string(),
|
|
325
361
|
path: z.string(),
|
|
@@ -406,7 +442,6 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
406
442
|
response: z.array(
|
|
407
443
|
z.object({
|
|
408
444
|
workspaceId: z.string(),
|
|
409
|
-
files: z.number(),
|
|
410
445
|
permalinks: z.number(),
|
|
411
446
|
hasCustomSettings: z.boolean()
|
|
412
447
|
})
|
|
@@ -478,7 +513,7 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
478
513
|
{
|
|
479
514
|
name: "body",
|
|
480
515
|
type: "Body",
|
|
481
|
-
schema:
|
|
516
|
+
schema: putWorkspacesByWorkspaceIdSettings_Body
|
|
482
517
|
},
|
|
483
518
|
{
|
|
484
519
|
name: "workspaceId",
|
|
@@ -527,6 +562,86 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
527
562
|
],
|
|
528
563
|
response: z.void()
|
|
529
564
|
},
|
|
565
|
+
{
|
|
566
|
+
method: "post",
|
|
567
|
+
path: "/assets",
|
|
568
|
+
description: `Create an asset and get a pre-signed upload URL for the dedicated assets bucket.`,
|
|
569
|
+
requestFormat: "json",
|
|
570
|
+
parameters: [
|
|
571
|
+
{
|
|
572
|
+
name: "body",
|
|
573
|
+
type: "Body",
|
|
574
|
+
schema: postAssets_Body
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: "expiresIn",
|
|
578
|
+
type: "Query",
|
|
579
|
+
schema: z.number().optional().default(3600)
|
|
580
|
+
}
|
|
581
|
+
],
|
|
582
|
+
response: z.object({
|
|
583
|
+
assetId: z.string(),
|
|
584
|
+
assetUrl: z.string().url(),
|
|
585
|
+
uploadUrl: z.string().url(),
|
|
586
|
+
expiresAt: z.string().regex(
|
|
587
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
588
|
+
).datetime({ offset: true }),
|
|
589
|
+
uploadHeaders: z.object({
|
|
590
|
+
"cache-control": z.string(),
|
|
591
|
+
"content-disposition": z.string(),
|
|
592
|
+
"content-type": z.string(),
|
|
593
|
+
"if-none-match": z.string()
|
|
594
|
+
}),
|
|
595
|
+
asset: z.object({
|
|
596
|
+
id: z.string(),
|
|
597
|
+
path: z.string(),
|
|
598
|
+
assetUrl: z.string().url(),
|
|
599
|
+
assetClass: z.string(),
|
|
600
|
+
subject: z.string(),
|
|
601
|
+
mimeType: z.string(),
|
|
602
|
+
size: z.union([z.number(), z.null()]).optional(),
|
|
603
|
+
bucketName: z.union([z.string(), z.null()]).optional(),
|
|
604
|
+
createdBy: z.union([z.string(), z.null()]).optional(),
|
|
605
|
+
createdAt: z.string(),
|
|
606
|
+
uploadedAt: z.union([z.string(), z.null()]).optional(),
|
|
607
|
+
deletedAt: z.union([z.string(), z.null()]).optional()
|
|
608
|
+
})
|
|
609
|
+
})
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
method: "get",
|
|
613
|
+
path: "/assets/:assetId",
|
|
614
|
+
description: `Get a stored asset by ID, including its stable CloudFront URL.`,
|
|
615
|
+
requestFormat: "json",
|
|
616
|
+
parameters: [
|
|
617
|
+
{
|
|
618
|
+
name: "assetId",
|
|
619
|
+
type: "Path",
|
|
620
|
+
schema: z.string()
|
|
621
|
+
}
|
|
622
|
+
],
|
|
623
|
+
response: z.object({
|
|
624
|
+
id: z.string(),
|
|
625
|
+
path: z.string(),
|
|
626
|
+
assetUrl: z.string().url(),
|
|
627
|
+
assetClass: z.string(),
|
|
628
|
+
subject: z.string(),
|
|
629
|
+
mimeType: z.string(),
|
|
630
|
+
size: z.union([z.number(), z.null()]).optional(),
|
|
631
|
+
bucketName: z.union([z.string(), z.null()]).optional(),
|
|
632
|
+
createdBy: z.union([z.string(), z.null()]).optional(),
|
|
633
|
+
createdAt: z.string(),
|
|
634
|
+
uploadedAt: z.union([z.string(), z.null()]).optional(),
|
|
635
|
+
deletedAt: z.union([z.string(), z.null()]).optional()
|
|
636
|
+
}),
|
|
637
|
+
errors: [
|
|
638
|
+
{
|
|
639
|
+
status: 404,
|
|
640
|
+
description: `Asset not found`,
|
|
641
|
+
schema: z.void()
|
|
642
|
+
}
|
|
643
|
+
]
|
|
644
|
+
},
|
|
530
645
|
{
|
|
531
646
|
method: "post",
|
|
532
647
|
path: "/files",
|
|
@@ -552,7 +667,9 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
552
667
|
response: z.object({
|
|
553
668
|
id: z.string(),
|
|
554
669
|
uploadUrl: z.string(),
|
|
555
|
-
expiresAt: z.string().
|
|
670
|
+
expiresAt: z.string().regex(
|
|
671
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
672
|
+
).datetime({ offset: true }),
|
|
556
673
|
metadata: z.object({
|
|
557
674
|
id: z.string(),
|
|
558
675
|
path: z.string(),
|
|
@@ -572,6 +689,71 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
572
689
|
path: z.string()
|
|
573
690
|
})
|
|
574
691
|
},
|
|
692
|
+
{
|
|
693
|
+
method: "get",
|
|
694
|
+
path: "/files",
|
|
695
|
+
description: `Get a list of files.`,
|
|
696
|
+
requestFormat: "json",
|
|
697
|
+
parameters: [
|
|
698
|
+
{
|
|
699
|
+
name: "limit",
|
|
700
|
+
type: "Query",
|
|
701
|
+
schema: z.number().gte(1).lte(500).optional().default(10)
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: "offset",
|
|
705
|
+
type: "Query",
|
|
706
|
+
schema: z.number().gte(0).optional().default(0)
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
name: "orderByField",
|
|
710
|
+
type: "Query",
|
|
711
|
+
schema: z.enum(["id", "createdAt", "deletedAt"]).optional()
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
name: "orderByDirection",
|
|
715
|
+
type: "Query",
|
|
716
|
+
schema: z.enum(["asc", "desc"]).optional().default("asc")
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
name: "search",
|
|
720
|
+
type: "Query",
|
|
721
|
+
schema: z.string().optional()
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
name: "includeDeleted",
|
|
725
|
+
type: "Query",
|
|
726
|
+
schema: z.enum(["true", "false"]).optional().default("false")
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
name: "includeChildren",
|
|
730
|
+
type: "Query",
|
|
731
|
+
schema: z.enum(["true", "false"]).optional().default("false")
|
|
732
|
+
}
|
|
733
|
+
],
|
|
734
|
+
response: z.object({
|
|
735
|
+
files: z.array(
|
|
736
|
+
z.object({
|
|
737
|
+
id: z.string(),
|
|
738
|
+
path: z.string(),
|
|
739
|
+
workspaceId: z.string(),
|
|
740
|
+
parentId: z.union([z.string(), z.null()]).optional(),
|
|
741
|
+
originalFileName: z.union([z.string(), z.null()]).optional(),
|
|
742
|
+
mimeType: z.union([z.string(), z.null()]).optional(),
|
|
743
|
+
size: z.union([z.number(), z.null()]).optional(),
|
|
744
|
+
legacyKey: z.union([z.string(), z.null()]).optional(),
|
|
745
|
+
bucketName: z.union([z.string(), z.null()]).optional(),
|
|
746
|
+
encryptionKey: z.union([z.string(), z.null()]).optional(),
|
|
747
|
+
createdBy: z.union([z.string(), z.null()]).optional(),
|
|
748
|
+
createdAt: z.string(),
|
|
749
|
+
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
750
|
+
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
751
|
+
})
|
|
752
|
+
),
|
|
753
|
+
count: z.number(),
|
|
754
|
+
pages: z.number()
|
|
755
|
+
})
|
|
756
|
+
},
|
|
575
757
|
{
|
|
576
758
|
method: "get",
|
|
577
759
|
path: "/files/:fileId",
|
|
@@ -591,7 +773,9 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
591
773
|
],
|
|
592
774
|
response: z.object({
|
|
593
775
|
url: z.string(),
|
|
594
|
-
expiresAt: z.string().
|
|
776
|
+
expiresAt: z.string().regex(
|
|
777
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
778
|
+
).datetime({ offset: true }),
|
|
595
779
|
metadata: z.union([
|
|
596
780
|
z.object({
|
|
597
781
|
id: z.string(),
|
|
@@ -621,18 +805,15 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
621
805
|
]
|
|
622
806
|
},
|
|
623
807
|
{
|
|
624
|
-
method: "
|
|
625
|
-
path: "/files/:fileId
|
|
626
|
-
description: `
|
|
627
|
-
|
|
628
|
-
The returned permalink ID should be used with the `/permalinks/:permalinkId` endpoint to download the file via a 302 redirect.
|
|
629
|
-
`,
|
|
808
|
+
method: "patch",
|
|
809
|
+
path: "/files/:fileId",
|
|
810
|
+
description: `Update file metadata. This only affects file metadata and has no effect on file conflicts or storage location.`,
|
|
630
811
|
requestFormat: "json",
|
|
631
812
|
parameters: [
|
|
632
813
|
{
|
|
633
814
|
name: "body",
|
|
634
815
|
type: "Body",
|
|
635
|
-
schema: z.object({
|
|
816
|
+
schema: z.object({ name: z.string().min(1) })
|
|
636
817
|
},
|
|
637
818
|
{
|
|
638
819
|
name: "fileId",
|
|
@@ -642,17 +823,25 @@ The returned permalink ID should be used with the `/permalinks/:permalinkId
|
|
|
642
823
|
],
|
|
643
824
|
response: z.object({
|
|
644
825
|
id: z.string(),
|
|
645
|
-
|
|
826
|
+
path: z.string(),
|
|
646
827
|
workspaceId: z.string(),
|
|
828
|
+
parentId: z.union([z.string(), z.null()]).optional(),
|
|
829
|
+
originalFileName: z.union([z.string(), z.null()]).optional(),
|
|
830
|
+
mimeType: z.union([z.string(), z.null()]).optional(),
|
|
831
|
+
size: z.union([z.number(), z.null()]).optional(),
|
|
832
|
+
legacyKey: z.union([z.string(), z.null()]).optional(),
|
|
833
|
+
bucketName: z.union([z.string(), z.null()]).optional(),
|
|
834
|
+
encryptionKey: z.union([z.string(), z.null()]).optional(),
|
|
835
|
+
createdBy: z.union([z.string(), z.null()]).optional(),
|
|
647
836
|
createdAt: z.string(),
|
|
648
|
-
|
|
649
|
-
|
|
837
|
+
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
838
|
+
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
650
839
|
})
|
|
651
840
|
},
|
|
652
841
|
{
|
|
653
|
-
method: "
|
|
654
|
-
path: "/files/:fileId/
|
|
655
|
-
description: `
|
|
842
|
+
method: "post",
|
|
843
|
+
path: "/files/:fileId/multipart",
|
|
844
|
+
description: `Initiate a multipart upload for a file.`,
|
|
656
845
|
requestFormat: "json",
|
|
657
846
|
parameters: [
|
|
658
847
|
{
|
|
@@ -661,34 +850,56 @@ The returned permalink ID should be used with the `/permalinks/:permalinkId
|
|
|
661
850
|
schema: z.string()
|
|
662
851
|
}
|
|
663
852
|
],
|
|
664
|
-
response: z.
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
853
|
+
response: z.object({ uploadId: z.string().min(1) })
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
method: "delete",
|
|
857
|
+
path: "/files/:fileId/multipart",
|
|
858
|
+
description: `Abort a multipart upload and discard its uploaded parts.`,
|
|
859
|
+
requestFormat: "json",
|
|
860
|
+
parameters: [
|
|
861
|
+
{
|
|
862
|
+
name: "uploadId",
|
|
863
|
+
type: "Query",
|
|
864
|
+
schema: z.string().min(1).max(4096)
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
name: "fileId",
|
|
868
|
+
type: "Path",
|
|
869
|
+
schema: z.string()
|
|
870
|
+
}
|
|
871
|
+
],
|
|
872
|
+
response: z.void()
|
|
674
873
|
},
|
|
675
874
|
{
|
|
676
875
|
method: "post",
|
|
677
|
-
path: "/files/:
|
|
678
|
-
description: `
|
|
679
|
-
|
|
680
|
-
This endpoint is deprecated. Use POST /files instead with `originalFileName` in the request body.
|
|
681
|
-
|
|
682
|
-
The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
|
|
683
|
-
|
|
684
|
-
The returned `url` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
|
|
685
|
-
`,
|
|
876
|
+
path: "/files/:fileId/multipart/complete",
|
|
877
|
+
description: `Complete a multipart upload and assemble the file in S3.`,
|
|
686
878
|
requestFormat: "json",
|
|
687
879
|
parameters: [
|
|
688
880
|
{
|
|
689
881
|
name: "body",
|
|
690
882
|
type: "Body",
|
|
691
|
-
schema:
|
|
883
|
+
schema: postFilesByFileIdMultipartComplete_Body
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
name: "fileId",
|
|
887
|
+
type: "Path",
|
|
888
|
+
schema: z.string()
|
|
889
|
+
}
|
|
890
|
+
],
|
|
891
|
+
response: z.void()
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
method: "post",
|
|
895
|
+
path: "/files/:fileId/multipart/part",
|
|
896
|
+
description: `Get a pre-signed URL for one multipart upload part.`,
|
|
897
|
+
requestFormat: "json",
|
|
898
|
+
parameters: [
|
|
899
|
+
{
|
|
900
|
+
name: "body",
|
|
901
|
+
type: "Body",
|
|
902
|
+
schema: postFilesByFileIdMultipartPart_Body
|
|
692
903
|
},
|
|
693
904
|
{
|
|
694
905
|
name: "expiresIn",
|
|
@@ -696,16 +907,74 @@ The returned `url` is valid for 1 hour by default. You can change the
|
|
|
696
907
|
schema: z.number().optional().default(3600)
|
|
697
908
|
},
|
|
698
909
|
{
|
|
699
|
-
name: "
|
|
910
|
+
name: "fileId",
|
|
700
911
|
type: "Path",
|
|
701
912
|
schema: z.string()
|
|
702
913
|
}
|
|
703
914
|
],
|
|
704
915
|
response: z.object({
|
|
705
|
-
|
|
706
|
-
expiresAt: z.string().
|
|
916
|
+
uploadUrl: z.string().url(),
|
|
917
|
+
expiresAt: z.string().regex(
|
|
918
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
919
|
+
).datetime({ offset: true })
|
|
920
|
+
})
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
method: "post",
|
|
924
|
+
path: "/files/:fileId/permalinks",
|
|
925
|
+
description: `Create a public, direct, and optionally expiring download link for a file.
|
|
926
|
+
|
|
927
|
+
The returned permalink ID should be used with the `/permalinks/:permalinkId` endpoint to download the file via a 302 redirect.
|
|
928
|
+
`,
|
|
929
|
+
requestFormat: "json",
|
|
930
|
+
parameters: [
|
|
931
|
+
{
|
|
932
|
+
name: "body",
|
|
933
|
+
type: "Body",
|
|
934
|
+
schema: z.object({
|
|
935
|
+
expiresAt: z.string().regex(
|
|
936
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
937
|
+
).datetime({ offset: true })
|
|
938
|
+
}).partial()
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
name: "fileId",
|
|
942
|
+
type: "Path",
|
|
943
|
+
schema: z.string()
|
|
944
|
+
}
|
|
945
|
+
],
|
|
946
|
+
response: z.object({
|
|
947
|
+
id: z.string(),
|
|
948
|
+
fileId: z.string(),
|
|
949
|
+
workspaceId: z.string(),
|
|
950
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
951
|
+
expiresAt: z.union([z.string(), z.null()]),
|
|
952
|
+
createdBy: z.union([z.string(), z.null()])
|
|
707
953
|
})
|
|
708
954
|
},
|
|
955
|
+
{
|
|
956
|
+
method: "get",
|
|
957
|
+
path: "/files/:fileId/permalinks",
|
|
958
|
+
description: `Get all permalinks for a file.`,
|
|
959
|
+
requestFormat: "json",
|
|
960
|
+
parameters: [
|
|
961
|
+
{
|
|
962
|
+
name: "fileId",
|
|
963
|
+
type: "Path",
|
|
964
|
+
schema: z.string()
|
|
965
|
+
}
|
|
966
|
+
],
|
|
967
|
+
response: z.array(
|
|
968
|
+
z.object({
|
|
969
|
+
id: z.string(),
|
|
970
|
+
fileId: z.string(),
|
|
971
|
+
workspaceId: z.string(),
|
|
972
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
973
|
+
expiresAt: z.union([z.string(), z.null()]),
|
|
974
|
+
createdBy: z.union([z.string(), z.null()])
|
|
975
|
+
})
|
|
976
|
+
)
|
|
977
|
+
},
|
|
709
978
|
{
|
|
710
979
|
method: "put",
|
|
711
980
|
path: "/files/:id",
|
|
@@ -723,33 +992,29 @@ The returned `url` is valid for 1 hour by default. You can change the
|
|
|
723
992
|
schema: z.string()
|
|
724
993
|
}
|
|
725
994
|
],
|
|
726
|
-
response: z.
|
|
727
|
-
z.
|
|
995
|
+
response: z.object({
|
|
996
|
+
id: z.string(),
|
|
997
|
+
uploadUrl: z.string().url(),
|
|
998
|
+
expiresAt: z.string().regex(
|
|
999
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
1000
|
+
).datetime({ offset: true }),
|
|
1001
|
+
metadata: z.object({
|
|
728
1002
|
id: z.string(),
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
createdBy: z.union([z.string(), z.null()]).optional(),
|
|
743
|
-
createdAt: z.string(),
|
|
744
|
-
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
745
|
-
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
746
|
-
})
|
|
747
|
-
}),
|
|
748
|
-
z.object({
|
|
749
|
-
url: z.string().url(),
|
|
750
|
-
expiresAt: z.string().datetime({ offset: true })
|
|
1003
|
+
path: z.string(),
|
|
1004
|
+
workspaceId: z.string(),
|
|
1005
|
+
parentId: z.union([z.string(), z.null()]).optional(),
|
|
1006
|
+
originalFileName: z.union([z.string(), z.null()]).optional(),
|
|
1007
|
+
mimeType: z.union([z.string(), z.null()]).optional(),
|
|
1008
|
+
size: z.union([z.number(), z.null()]).optional(),
|
|
1009
|
+
legacyKey: z.union([z.string(), z.null()]).optional(),
|
|
1010
|
+
bucketName: z.union([z.string(), z.null()]).optional(),
|
|
1011
|
+
encryptionKey: z.union([z.string(), z.null()]).optional(),
|
|
1012
|
+
createdBy: z.union([z.string(), z.null()]).optional(),
|
|
1013
|
+
createdAt: z.string(),
|
|
1014
|
+
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
1015
|
+
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
751
1016
|
})
|
|
752
|
-
|
|
1017
|
+
})
|
|
753
1018
|
},
|
|
754
1019
|
{
|
|
755
1020
|
method: "delete",
|
|
@@ -867,9 +1132,14 @@ The returned `url` is valid for 1 hour by default. You can change the
|
|
|
867
1132
|
schema: postFilesBulk_Body
|
|
868
1133
|
}
|
|
869
1134
|
],
|
|
870
|
-
response: z.
|
|
871
|
-
z.
|
|
872
|
-
z.
|
|
1135
|
+
response: z.array(
|
|
1136
|
+
z.object({
|
|
1137
|
+
id: z.string(),
|
|
1138
|
+
uploadUrl: z.string(),
|
|
1139
|
+
expiresAt: z.string().regex(
|
|
1140
|
+
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
|
|
1141
|
+
).datetime({ offset: true }),
|
|
1142
|
+
metadata: z.object({
|
|
873
1143
|
id: z.string(),
|
|
874
1144
|
path: z.string(),
|
|
875
1145
|
workspaceId: z.string(),
|
|
@@ -884,29 +1154,10 @@ The returned `url` is valid for 1 hour by default. You can change the
|
|
|
884
1154
|
createdAt: z.string(),
|
|
885
1155
|
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
886
1156
|
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
887
|
-
})
|
|
888
|
-
|
|
889
|
-
z.object({
|
|
890
|
-
files: z.array(
|
|
891
|
-
z.object({
|
|
892
|
-
id: z.string(),
|
|
893
|
-
path: z.string(),
|
|
894
|
-
workspaceId: z.string(),
|
|
895
|
-
parentId: z.union([z.string(), z.null()]).optional(),
|
|
896
|
-
originalFileName: z.union([z.string(), z.null()]).optional(),
|
|
897
|
-
mimeType: z.union([z.string(), z.null()]).optional(),
|
|
898
|
-
size: z.union([z.number(), z.null()]).optional(),
|
|
899
|
-
legacyKey: z.union([z.string(), z.null()]).optional(),
|
|
900
|
-
bucketName: z.union([z.string(), z.null()]).optional(),
|
|
901
|
-
encryptionKey: z.union([z.string(), z.null()]).optional(),
|
|
902
|
-
createdBy: z.union([z.string(), z.null()]).optional(),
|
|
903
|
-
createdAt: z.string(),
|
|
904
|
-
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
905
|
-
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
906
|
-
})
|
|
907
|
-
)
|
|
1157
|
+
}),
|
|
1158
|
+
path: z.string()
|
|
908
1159
|
})
|
|
909
|
-
|
|
1160
|
+
)
|
|
910
1161
|
},
|
|
911
1162
|
{
|
|
912
1163
|
method: "get",
|
|
@@ -967,7 +1218,7 @@ Make sure to follow redirects to the actual file download URL.
|
|
|
967
1218
|
id: z.string(),
|
|
968
1219
|
fileId: z.string(),
|
|
969
1220
|
workspaceId: z.string(),
|
|
970
|
-
createdAt: z.string(),
|
|
1221
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
971
1222
|
expiresAt: z.union([z.string(), z.null()]),
|
|
972
1223
|
createdBy: z.union([z.string(), z.null()])
|
|
973
1224
|
}),
|
|
@@ -985,8 +1236,12 @@ function createApiClient(baseUrl, options) {
|
|
|
985
1236
|
return new Zodios(baseUrl, endpoints, options);
|
|
986
1237
|
}
|
|
987
1238
|
|
|
1239
|
+
const version = "2.17.6";
|
|
1240
|
+
const packageInfo = {
|
|
1241
|
+
version: version};
|
|
1242
|
+
|
|
988
1243
|
const serviceName = process.env.SERVICE_NAME;
|
|
989
|
-
const userAgent = `vault-http-client
|
|
1244
|
+
const userAgent = `vault-http-client:${packageInfo.version}${serviceName ? `@${serviceName}` : ""}`.trim();
|
|
990
1245
|
function useVaultClient(vaultUrl, token) {
|
|
991
1246
|
const api = createApiClient(vaultUrl, {
|
|
992
1247
|
axiosConfig: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/vault-http-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.6",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/meistrari/vault.git"
|
|
7
|
+
},
|
|
4
8
|
"types": "dist/index.d.ts",
|
|
5
9
|
"exports": {
|
|
6
10
|
".": {
|
|
@@ -16,5 +20,8 @@
|
|
|
16
20
|
"dependencies": {
|
|
17
21
|
"@zodios/core": "10.9.6",
|
|
18
22
|
"zod": "3.25.76"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"unbuild": "3.6.1"
|
|
19
26
|
}
|
|
20
27
|
}
|