@meistrari/vault-http-client 2.10.0 → 2.14.1
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 +126 -43
- package/dist/index.d.cts +209 -63
- package/dist/index.d.mts +209 -63
- package/dist/index.d.ts +209 -63
- package/dist/index.mjs +126 -43
- package/package.json +23 -17
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import { makeApi, Zodios } from '@zodios/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
-
const postFilesBulk_Body = z.union([
|
|
5
|
-
z.array(
|
|
6
|
-
z.object({
|
|
7
|
-
fileName: z.string(),
|
|
8
|
-
parentId: z.string(),
|
|
9
|
-
onMissingParent: z.enum(["error", "create-as-root"]).default("error"),
|
|
10
|
-
onParentConflict: z.enum(["error", "update-parent-id", "ignore"]).default("error"),
|
|
11
|
-
sha256sum: z.string(),
|
|
12
|
-
size: z.number(),
|
|
13
|
-
mimeType: z.string(),
|
|
14
|
-
createdBy: z.string(),
|
|
15
|
-
path: z.string()
|
|
16
|
-
}).partial()
|
|
17
|
-
),
|
|
18
|
-
z.object({ files: z.array(z.string()) })
|
|
19
|
-
]);
|
|
20
4
|
const postFiles_Body = z.object({
|
|
21
5
|
fileName: z.string(),
|
|
22
6
|
parentId: z.string(),
|
|
@@ -28,6 +12,19 @@ const postFiles_Body = z.object({
|
|
|
28
12
|
createdBy: z.string(),
|
|
29
13
|
path: z.string()
|
|
30
14
|
}).partial();
|
|
15
|
+
const postFilesBulk_Body = z.array(
|
|
16
|
+
z.object({
|
|
17
|
+
fileName: z.string(),
|
|
18
|
+
parentId: z.string(),
|
|
19
|
+
onMissingParent: z.enum(["error", "create-as-root"]).default("error"),
|
|
20
|
+
onParentConflict: z.enum(["error", "update-parent-id", "ignore"]).default("error"),
|
|
21
|
+
sha256sum: z.string(),
|
|
22
|
+
size: z.number(),
|
|
23
|
+
mimeType: z.string(),
|
|
24
|
+
createdBy: z.string(),
|
|
25
|
+
path: z.string()
|
|
26
|
+
}).partial()
|
|
27
|
+
);
|
|
31
28
|
const put_WorkspacesByWorkspaceIdSettings_Body = z.object({
|
|
32
29
|
bucketName: z.string().min(1),
|
|
33
30
|
keyArns: z.array(z.string()).min(1),
|
|
@@ -406,7 +403,6 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
406
403
|
response: z.array(
|
|
407
404
|
z.object({
|
|
408
405
|
workspaceId: z.string(),
|
|
409
|
-
files: z.number(),
|
|
410
406
|
permalinks: z.number(),
|
|
411
407
|
hasCustomSettings: z.boolean()
|
|
412
408
|
})
|
|
@@ -572,6 +568,71 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
572
568
|
path: z.string()
|
|
573
569
|
})
|
|
574
570
|
},
|
|
571
|
+
{
|
|
572
|
+
method: "get",
|
|
573
|
+
path: "/files",
|
|
574
|
+
description: `Get a list of files.`,
|
|
575
|
+
requestFormat: "json",
|
|
576
|
+
parameters: [
|
|
577
|
+
{
|
|
578
|
+
name: "limit",
|
|
579
|
+
type: "Query",
|
|
580
|
+
schema: z.number().gte(1).lte(500).optional().default(10)
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
name: "offset",
|
|
584
|
+
type: "Query",
|
|
585
|
+
schema: z.number().gte(0).optional().default(0)
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
name: "orderByField",
|
|
589
|
+
type: "Query",
|
|
590
|
+
schema: z.enum(["id", "createdAt", "deletedAt"]).optional()
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
name: "orderByDirection",
|
|
594
|
+
type: "Query",
|
|
595
|
+
schema: z.enum(["asc", "desc"]).optional().default("asc")
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
name: "search",
|
|
599
|
+
type: "Query",
|
|
600
|
+
schema: z.string().optional()
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
name: "includeDeleted",
|
|
604
|
+
type: "Query",
|
|
605
|
+
schema: z.enum(["true", "false"]).optional().default("false")
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
name: "includeChildren",
|
|
609
|
+
type: "Query",
|
|
610
|
+
schema: z.enum(["true", "false"]).optional().default("false")
|
|
611
|
+
}
|
|
612
|
+
],
|
|
613
|
+
response: z.object({
|
|
614
|
+
files: z.array(
|
|
615
|
+
z.object({
|
|
616
|
+
id: z.string(),
|
|
617
|
+
path: z.string(),
|
|
618
|
+
workspaceId: z.string(),
|
|
619
|
+
parentId: z.union([z.string(), z.null()]).optional(),
|
|
620
|
+
originalFileName: z.union([z.string(), z.null()]).optional(),
|
|
621
|
+
mimeType: z.union([z.string(), z.null()]).optional(),
|
|
622
|
+
size: z.union([z.number(), z.null()]).optional(),
|
|
623
|
+
legacyKey: z.union([z.string(), z.null()]).optional(),
|
|
624
|
+
bucketName: z.union([z.string(), z.null()]).optional(),
|
|
625
|
+
encryptionKey: z.union([z.string(), z.null()]).optional(),
|
|
626
|
+
createdBy: z.union([z.string(), z.null()]).optional(),
|
|
627
|
+
createdAt: z.string(),
|
|
628
|
+
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
629
|
+
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
630
|
+
})
|
|
631
|
+
),
|
|
632
|
+
count: z.number(),
|
|
633
|
+
pages: z.number()
|
|
634
|
+
})
|
|
635
|
+
},
|
|
575
636
|
{
|
|
576
637
|
method: "get",
|
|
577
638
|
path: "/files/:fileId",
|
|
@@ -620,6 +681,40 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
|
|
|
620
681
|
}
|
|
621
682
|
]
|
|
622
683
|
},
|
|
684
|
+
{
|
|
685
|
+
method: "patch",
|
|
686
|
+
path: "/files/:fileId",
|
|
687
|
+
description: `Update file metadata. This only affects file metadata and has no effect on file conflicts or storage location.`,
|
|
688
|
+
requestFormat: "json",
|
|
689
|
+
parameters: [
|
|
690
|
+
{
|
|
691
|
+
name: "body",
|
|
692
|
+
type: "Body",
|
|
693
|
+
schema: z.object({ name: z.string().min(1) })
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
name: "fileId",
|
|
697
|
+
type: "Path",
|
|
698
|
+
schema: z.string()
|
|
699
|
+
}
|
|
700
|
+
],
|
|
701
|
+
response: z.object({
|
|
702
|
+
id: z.string(),
|
|
703
|
+
path: z.string(),
|
|
704
|
+
workspaceId: z.string(),
|
|
705
|
+
parentId: z.union([z.string(), z.null()]).optional(),
|
|
706
|
+
originalFileName: z.union([z.string(), z.null()]).optional(),
|
|
707
|
+
mimeType: z.union([z.string(), z.null()]).optional(),
|
|
708
|
+
size: z.union([z.number(), z.null()]).optional(),
|
|
709
|
+
legacyKey: z.union([z.string(), z.null()]).optional(),
|
|
710
|
+
bucketName: z.union([z.string(), z.null()]).optional(),
|
|
711
|
+
encryptionKey: z.union([z.string(), z.null()]).optional(),
|
|
712
|
+
createdBy: z.union([z.string(), z.null()]).optional(),
|
|
713
|
+
createdAt: z.string(),
|
|
714
|
+
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
715
|
+
uploadedAt: z.union([z.string(), z.null()]).optional()
|
|
716
|
+
})
|
|
717
|
+
},
|
|
623
718
|
{
|
|
624
719
|
method: "post",
|
|
625
720
|
path: "/files/:fileId/permalinks",
|
|
@@ -867,9 +962,12 @@ The returned `url` is valid for 1 hour by default. You can change the
|
|
|
867
962
|
schema: postFilesBulk_Body
|
|
868
963
|
}
|
|
869
964
|
],
|
|
870
|
-
response: z.
|
|
871
|
-
z.
|
|
872
|
-
z.
|
|
965
|
+
response: z.array(
|
|
966
|
+
z.object({
|
|
967
|
+
id: z.string(),
|
|
968
|
+
uploadUrl: z.string(),
|
|
969
|
+
expiresAt: z.string().datetime({ offset: true }),
|
|
970
|
+
metadata: z.object({
|
|
873
971
|
id: z.string(),
|
|
874
972
|
path: z.string(),
|
|
875
973
|
workspaceId: z.string(),
|
|
@@ -884,29 +982,10 @@ The returned `url` is valid for 1 hour by default. You can change the
|
|
|
884
982
|
createdAt: z.string(),
|
|
885
983
|
deletedAt: z.union([z.string(), z.null()]).optional(),
|
|
886
984
|
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
|
-
)
|
|
985
|
+
}),
|
|
986
|
+
path: z.string()
|
|
908
987
|
})
|
|
909
|
-
|
|
988
|
+
)
|
|
910
989
|
},
|
|
911
990
|
{
|
|
912
991
|
method: "get",
|
|
@@ -985,8 +1064,12 @@ function createApiClient(baseUrl, options) {
|
|
|
985
1064
|
return new Zodios(baseUrl, endpoints, options);
|
|
986
1065
|
}
|
|
987
1066
|
|
|
1067
|
+
const version = "2.14.0";
|
|
1068
|
+
const packageInfo = {
|
|
1069
|
+
version: version};
|
|
1070
|
+
|
|
988
1071
|
const serviceName = process.env.SERVICE_NAME;
|
|
989
|
-
const userAgent = `vault-http-client
|
|
1072
|
+
const userAgent = `vault-http-client:${packageInfo.version}${serviceName ? `@${serviceName}` : ""}`.trim();
|
|
990
1073
|
function useVaultClient(vaultUrl, token) {
|
|
991
1074
|
const api = createApiClient(vaultUrl, {
|
|
992
1075
|
axiosConfig: {
|
package/package.json
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"name": "@meistrari/vault-http-client",
|
|
3
|
+
"version": "2.14.1",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "unbuild"
|
|
6
|
+
},
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.mjs",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@zodios/core": "10.9.6",
|
|
21
|
+
"zod": "3.25.76"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"unbuild": "3.6.1"
|
|
11
25
|
}
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"dist"
|
|
15
|
-
],
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@zodios/core": "10.9.6",
|
|
18
|
-
"zod": "3.25.76"
|
|
19
|
-
}
|
|
20
26
|
}
|