@meistrari/vault-http-client 2.3.5 → 2.3.9
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 +149 -117
- package/dist/index.d.cts +516 -389
- package/dist/index.d.mts +516 -389
- package/dist/index.d.ts +516 -389
- package/dist/index.mjs +149 -117
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -13,7 +13,8 @@ const post_Files_Body = zod.z.object({
|
|
|
13
13
|
sha256sum: zod.z.string().optional(),
|
|
14
14
|
size: zod.z.number().optional(),
|
|
15
15
|
mimeType: zod.z.string().optional(),
|
|
16
|
-
createdBy: zod.z.string().optional()
|
|
16
|
+
createdBy: zod.z.string().optional(),
|
|
17
|
+
path: zod.z.string().optional()
|
|
17
18
|
});
|
|
18
19
|
const postFilesBulk_Body = zod.z.union([
|
|
19
20
|
zod.z.array(
|
|
@@ -22,17 +23,19 @@ const postFilesBulk_Body = zod.z.union([
|
|
|
22
23
|
sha256sum: zod.z.string().optional(),
|
|
23
24
|
size: zod.z.number().optional(),
|
|
24
25
|
mimeType: zod.z.string().optional(),
|
|
25
|
-
createdBy: zod.z.string().optional()
|
|
26
|
+
createdBy: zod.z.string().optional(),
|
|
27
|
+
path: zod.z.string().optional()
|
|
26
28
|
})
|
|
27
29
|
),
|
|
28
30
|
zod.z.object({ files: zod.z.array(zod.z.string()) })
|
|
29
31
|
]);
|
|
30
|
-
const
|
|
31
|
-
fileName: zod.z.string(),
|
|
32
|
+
const postFiles_Body = zod.z.object({
|
|
33
|
+
fileName: zod.z.string().default("unknown"),
|
|
32
34
|
sha256sum: zod.z.string(),
|
|
33
35
|
size: zod.z.number(),
|
|
34
36
|
mimeType: zod.z.string(),
|
|
35
|
-
createdBy: zod.z.string()
|
|
37
|
+
createdBy: zod.z.string(),
|
|
38
|
+
path: zod.z.string()
|
|
36
39
|
}).partial();
|
|
37
40
|
const endpoints = core.makeApi([
|
|
38
41
|
{
|
|
@@ -198,6 +201,55 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
198
201
|
}
|
|
199
202
|
]
|
|
200
203
|
},
|
|
204
|
+
{
|
|
205
|
+
method: "post",
|
|
206
|
+
path: "/_/files/:fileId/copy",
|
|
207
|
+
description: `Copy a file from one workspace to another.`,
|
|
208
|
+
requestFormat: "json",
|
|
209
|
+
parameters: [
|
|
210
|
+
{
|
|
211
|
+
name: "sourceWorkspaceId",
|
|
212
|
+
type: "Query",
|
|
213
|
+
schema: zod.z.string()
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: "destinationWorkspaceId",
|
|
217
|
+
type: "Query",
|
|
218
|
+
schema: zod.z.string()
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "fileId",
|
|
222
|
+
type: "Path",
|
|
223
|
+
schema: zod.z.string()
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
response: zod.z.object({
|
|
227
|
+
id: zod.z.string(),
|
|
228
|
+
path: zod.z.string(),
|
|
229
|
+
workspaceId: zod.z.string(),
|
|
230
|
+
originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
231
|
+
mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
232
|
+
size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
|
|
233
|
+
legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
234
|
+
bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
235
|
+
encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
236
|
+
createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
237
|
+
createdAt: zod.z.string(),
|
|
238
|
+
deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
|
|
239
|
+
}),
|
|
240
|
+
errors: [
|
|
241
|
+
{
|
|
242
|
+
status: 404,
|
|
243
|
+
description: `Source file not found`,
|
|
244
|
+
schema: zod.z.void()
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
status: 409,
|
|
248
|
+
description: `File already exists in destination workspace`,
|
|
249
|
+
schema: zod.z.void()
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
},
|
|
201
253
|
{
|
|
202
254
|
method: "put",
|
|
203
255
|
path: "/_/files/:id",
|
|
@@ -417,6 +469,50 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
417
469
|
defaultS3LinkTtl: zod.z.number().gte(1)
|
|
418
470
|
})
|
|
419
471
|
},
|
|
472
|
+
{
|
|
473
|
+
method: "post",
|
|
474
|
+
path: "/files",
|
|
475
|
+
description: `Create a file and get a pre-signed upload URL.
|
|
476
|
+
|
|
477
|
+
The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
|
|
478
|
+
|
|
479
|
+
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.
|
|
480
|
+
|
|
481
|
+
The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
|
|
482
|
+
`,
|
|
483
|
+
requestFormat: "json",
|
|
484
|
+
parameters: [
|
|
485
|
+
{
|
|
486
|
+
name: "body",
|
|
487
|
+
type: "Body",
|
|
488
|
+
schema: postFiles_Body
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
name: "expiresIn",
|
|
492
|
+
type: "Query",
|
|
493
|
+
schema: zod.z.number().optional().default(3600)
|
|
494
|
+
}
|
|
495
|
+
],
|
|
496
|
+
response: zod.z.object({
|
|
497
|
+
id: zod.z.string(),
|
|
498
|
+
uploadUrl: zod.z.string(),
|
|
499
|
+
expiresAt: zod.z.string().datetime({ offset: true }),
|
|
500
|
+
metadata: zod.z.object({
|
|
501
|
+
id: zod.z.string(),
|
|
502
|
+
path: zod.z.string(),
|
|
503
|
+
workspaceId: zod.z.string(),
|
|
504
|
+
originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
505
|
+
mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
506
|
+
size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
|
|
507
|
+
legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
508
|
+
bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
509
|
+
encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
510
|
+
createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
511
|
+
createdAt: zod.z.string(),
|
|
512
|
+
deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
|
|
513
|
+
})
|
|
514
|
+
})
|
|
515
|
+
},
|
|
420
516
|
{
|
|
421
517
|
method: "get",
|
|
422
518
|
path: "/files/:fileId",
|
|
@@ -510,61 +606,6 @@ The returned permalink ID should be used with the `/permalinks/:permalinkId
|
|
|
510
606
|
})
|
|
511
607
|
)
|
|
512
608
|
},
|
|
513
|
-
{
|
|
514
|
-
method: "post",
|
|
515
|
-
path: "/files/:filename",
|
|
516
|
-
description: `Create a file and get a pre-signed upload URL.
|
|
517
|
-
|
|
518
|
-
The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
|
|
519
|
-
|
|
520
|
-
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.
|
|
521
|
-
|
|
522
|
-
The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
|
|
523
|
-
`,
|
|
524
|
-
requestFormat: "json",
|
|
525
|
-
parameters: [
|
|
526
|
-
{
|
|
527
|
-
name: "body",
|
|
528
|
-
type: "Body",
|
|
529
|
-
schema: postFilesByFilename_Body
|
|
530
|
-
},
|
|
531
|
-
{
|
|
532
|
-
name: "expiresIn",
|
|
533
|
-
type: "Query",
|
|
534
|
-
schema: zod.z.number().optional().default(3600)
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
name: "filename",
|
|
538
|
-
type: "Path",
|
|
539
|
-
schema: zod.z.string()
|
|
540
|
-
}
|
|
541
|
-
],
|
|
542
|
-
response: zod.z.union([
|
|
543
|
-
zod.z.object({
|
|
544
|
-
id: zod.z.string(),
|
|
545
|
-
uploadUrl: zod.z.string(),
|
|
546
|
-
expiresAt: zod.z.string().datetime({ offset: true }),
|
|
547
|
-
metadata: zod.z.object({
|
|
548
|
-
id: zod.z.string(),
|
|
549
|
-
path: zod.z.string(),
|
|
550
|
-
workspaceId: zod.z.string(),
|
|
551
|
-
originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
552
|
-
mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
553
|
-
size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
|
|
554
|
-
legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
555
|
-
bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
556
|
-
encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
557
|
-
createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
558
|
-
createdAt: zod.z.string(),
|
|
559
|
-
deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
|
|
560
|
-
})
|
|
561
|
-
}),
|
|
562
|
-
zod.z.object({
|
|
563
|
-
url: zod.z.string(),
|
|
564
|
-
expiresAt: zod.z.string().datetime({ offset: true })
|
|
565
|
-
})
|
|
566
|
-
])
|
|
567
|
-
},
|
|
568
609
|
{
|
|
569
610
|
method: "put",
|
|
570
611
|
path: "/files/:id",
|
|
@@ -776,6 +817,50 @@ Make sure to follow redirects to the actual file download URL.
|
|
|
776
817
|
}
|
|
777
818
|
]
|
|
778
819
|
},
|
|
820
|
+
{
|
|
821
|
+
method: "post",
|
|
822
|
+
path: "/v2/files",
|
|
823
|
+
description: `Create a file and get a pre-signed upload URL.
|
|
824
|
+
|
|
825
|
+
The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
|
|
826
|
+
|
|
827
|
+
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.
|
|
828
|
+
|
|
829
|
+
The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
|
|
830
|
+
`,
|
|
831
|
+
requestFormat: "json",
|
|
832
|
+
parameters: [
|
|
833
|
+
{
|
|
834
|
+
name: "body",
|
|
835
|
+
type: "Body",
|
|
836
|
+
schema: postFiles_Body
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
name: "expiresIn",
|
|
840
|
+
type: "Query",
|
|
841
|
+
schema: zod.z.number().optional().default(3600)
|
|
842
|
+
}
|
|
843
|
+
],
|
|
844
|
+
response: zod.z.object({
|
|
845
|
+
id: zod.z.string(),
|
|
846
|
+
uploadUrl: zod.z.string(),
|
|
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
|
+
})
|
|
862
|
+
})
|
|
863
|
+
},
|
|
779
864
|
{
|
|
780
865
|
method: "get",
|
|
781
866
|
path: "/v2/files/:fileId",
|
|
@@ -817,61 +902,6 @@ Make sure to follow redirects to the actual file download URL.
|
|
|
817
902
|
}
|
|
818
903
|
]
|
|
819
904
|
},
|
|
820
|
-
{
|
|
821
|
-
method: "post",
|
|
822
|
-
path: "/v2/files/:filename",
|
|
823
|
-
description: `Create a file and get a pre-signed upload URL.
|
|
824
|
-
|
|
825
|
-
The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
|
|
826
|
-
|
|
827
|
-
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.
|
|
828
|
-
|
|
829
|
-
The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
|
|
830
|
-
`,
|
|
831
|
-
requestFormat: "json",
|
|
832
|
-
parameters: [
|
|
833
|
-
{
|
|
834
|
-
name: "body",
|
|
835
|
-
type: "Body",
|
|
836
|
-
schema: postFilesByFilename_Body
|
|
837
|
-
},
|
|
838
|
-
{
|
|
839
|
-
name: "expiresIn",
|
|
840
|
-
type: "Query",
|
|
841
|
-
schema: zod.z.number().optional().default(3600)
|
|
842
|
-
},
|
|
843
|
-
{
|
|
844
|
-
name: "filename",
|
|
845
|
-
type: "Path",
|
|
846
|
-
schema: zod.z.string()
|
|
847
|
-
}
|
|
848
|
-
],
|
|
849
|
-
response: zod.z.union([
|
|
850
|
-
zod.z.object({
|
|
851
|
-
id: zod.z.string(),
|
|
852
|
-
uploadUrl: zod.z.string(),
|
|
853
|
-
expiresAt: zod.z.string().datetime({ offset: true }),
|
|
854
|
-
metadata: zod.z.object({
|
|
855
|
-
id: zod.z.string(),
|
|
856
|
-
path: zod.z.string(),
|
|
857
|
-
workspaceId: zod.z.string(),
|
|
858
|
-
originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
859
|
-
mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
860
|
-
size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
|
|
861
|
-
legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
862
|
-
bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
863
|
-
encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
864
|
-
createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
|
|
865
|
-
createdAt: zod.z.string(),
|
|
866
|
-
deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
|
|
867
|
-
})
|
|
868
|
-
}),
|
|
869
|
-
zod.z.object({
|
|
870
|
-
url: zod.z.string(),
|
|
871
|
-
expiresAt: zod.z.string().datetime({ offset: true })
|
|
872
|
-
})
|
|
873
|
-
])
|
|
874
|
-
},
|
|
875
905
|
{
|
|
876
906
|
method: "put",
|
|
877
907
|
path: "/v2/files/:id",
|
|
@@ -1018,12 +1048,14 @@ function createApiClient(baseUrl, options) {
|
|
|
1018
1048
|
return new core.Zodios(baseUrl, endpoints, options);
|
|
1019
1049
|
}
|
|
1020
1050
|
|
|
1021
|
-
function useVaultClient(vaultUrl, token) {
|
|
1051
|
+
function useVaultClient(vaultUrl, token, headerOverrides = {}) {
|
|
1022
1052
|
const api = createApiClient(vaultUrl, {
|
|
1023
1053
|
axiosConfig: {
|
|
1024
1054
|
headers: {
|
|
1025
1055
|
Authorization: token,
|
|
1026
|
-
"User-Agent": "vault-http-client:2.3.
|
|
1056
|
+
"User-Agent": "vault-http-client:2.3.9",
|
|
1057
|
+
"X-Compatibility-Date": "2025-09-17T10:33:21.181Z",
|
|
1058
|
+
...headerOverrides
|
|
1027
1059
|
}
|
|
1028
1060
|
}
|
|
1029
1061
|
});
|