@meistrari/vault-http-client 2.3.9 → 2.3.10

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.mjs CHANGED
@@ -1,40 +1,32 @@
1
1
  import { makeApi, Zodios } from '@zodios/core';
2
2
  import { z } from 'zod';
3
3
 
4
- const put_WorkspacesByWorkspaceIdSettings_Body = z.object({
5
- bucketName: z.string().min(1),
6
- keyArns: z.array(z.string()).min(1),
7
- defaultS3LinkTtl: z.number().gte(1)
8
- });
9
- const post_Files_Body = z.object({
10
- fileName: z.string(),
11
- sha256sum: z.string().optional(),
12
- size: z.number().optional(),
13
- mimeType: z.string().optional(),
14
- createdBy: z.string().optional(),
15
- path: z.string().optional()
16
- });
17
4
  const postFilesBulk_Body = z.union([
18
5
  z.array(
19
6
  z.object({
20
7
  fileName: z.string(),
21
- sha256sum: z.string().optional(),
22
- size: z.number().optional(),
23
- mimeType: z.string().optional(),
24
- createdBy: z.string().optional(),
25
- path: z.string().optional()
26
- })
8
+ sha256sum: z.string(),
9
+ size: z.number(),
10
+ mimeType: z.string(),
11
+ createdBy: z.string(),
12
+ path: z.string()
13
+ }).partial()
27
14
  ),
28
15
  z.object({ files: z.array(z.string()) })
29
16
  ]);
30
17
  const postFiles_Body = z.object({
31
- fileName: z.string().default("unknown"),
18
+ fileName: z.string(),
32
19
  sha256sum: z.string(),
33
20
  size: z.number(),
34
21
  mimeType: z.string(),
35
22
  createdBy: z.string(),
36
23
  path: z.string()
37
24
  }).partial();
25
+ const put_WorkspacesByWorkspaceIdSettings_Body = z.object({
26
+ bucketName: z.string().min(1),
27
+ keyArns: z.array(z.string()).min(1),
28
+ defaultS3LinkTtl: z.number().gte(1)
29
+ });
38
30
  const endpoints = makeApi([
39
31
  {
40
32
  method: "get",
@@ -109,7 +101,7 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
109
101
  {
110
102
  name: "body",
111
103
  type: "Body",
112
- schema: post_Files_Body
104
+ schema: postFiles_Body
113
105
  },
114
106
  {
115
107
  name: "expiresIn",
@@ -122,31 +114,26 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
122
114
  schema: z.string()
123
115
  }
124
116
  ],
125
- response: z.union([
126
- z.object({
117
+ response: z.object({
118
+ id: z.string(),
119
+ uploadUrl: z.string().url(),
120
+ expiresAt: z.string().datetime({ offset: true }),
121
+ metadata: z.object({
127
122
  id: z.string(),
128
- uploadUrl: z.string(),
129
- expiresAt: z.string().datetime({ offset: true }),
130
- metadata: z.object({
131
- id: z.string(),
132
- path: z.string(),
133
- workspaceId: z.string(),
134
- originalFileName: z.union([z.string(), z.null()]).optional(),
135
- mimeType: z.union([z.string(), z.null()]).optional(),
136
- size: z.union([z.number(), z.null()]).optional(),
137
- legacyKey: z.union([z.string(), z.null()]).optional(),
138
- bucketName: z.union([z.string(), z.null()]).optional(),
139
- encryptionKey: z.union([z.string(), z.null()]).optional(),
140
- createdBy: z.union([z.string(), z.null()]).optional(),
141
- createdAt: z.string(),
142
- deletedAt: z.union([z.string(), z.null()]).optional()
143
- })
144
- }),
145
- z.object({
146
- url: z.string(),
147
- expiresAt: z.string().datetime({ offset: true })
123
+ path: z.string(),
124
+ workspaceId: z.string(),
125
+ originalFileName: z.union([z.string(), z.null()]).optional(),
126
+ mimeType: z.union([z.string(), z.null()]).optional(),
127
+ size: z.union([z.number(), z.null()]).optional(),
128
+ legacyKey: z.union([z.string(), z.null()]).optional(),
129
+ bucketName: z.union([z.string(), z.null()]).optional(),
130
+ encryptionKey: z.union([z.string(), z.null()]).optional(),
131
+ createdBy: z.union([z.string(), z.null()]).optional(),
132
+ createdAt: z.string(),
133
+ deletedAt: z.union([z.string(), z.null()]).optional(),
134
+ uploadedAt: z.union([z.string(), z.null()]).optional()
148
135
  })
149
- ])
136
+ })
150
137
  },
151
138
  {
152
139
  method: "get",
@@ -186,7 +173,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
186
173
  encryptionKey: z.union([z.string(), z.null()]).optional(),
187
174
  createdBy: z.union([z.string(), z.null()]).optional(),
188
175
  createdAt: z.string(),
189
- deletedAt: z.union([z.string(), z.null()]).optional()
176
+ deletedAt: z.union([z.string(), z.null()]).optional(),
177
+ uploadedAt: z.union([z.string(), z.null()]).optional()
190
178
  }),
191
179
  z.null()
192
180
  ])
@@ -233,7 +221,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
233
221
  encryptionKey: z.union([z.string(), z.null()]).optional(),
234
222
  createdBy: z.union([z.string(), z.null()]).optional(),
235
223
  createdAt: z.string(),
236
- deletedAt: z.union([z.string(), z.null()]).optional()
224
+ deletedAt: z.union([z.string(), z.null()]).optional(),
225
+ uploadedAt: z.union([z.string(), z.null()]).optional()
237
226
  }),
238
227
  errors: [
239
228
  {
@@ -270,31 +259,26 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
270
259
  schema: z.string()
271
260
  }
272
261
  ],
273
- response: z.union([
274
- z.object({
262
+ response: z.object({
263
+ id: z.string(),
264
+ uploadUrl: z.string().url(),
265
+ expiresAt: z.string().datetime({ offset: true }),
266
+ metadata: z.object({
275
267
  id: z.string(),
276
- uploadUrl: z.string().url(),
277
- expiresAt: z.string().datetime({ offset: true }),
278
- metadata: z.object({
279
- id: z.string(),
280
- path: z.string(),
281
- workspaceId: z.string(),
282
- originalFileName: z.union([z.string(), z.null()]).optional(),
283
- mimeType: z.union([z.string(), z.null()]).optional(),
284
- size: z.union([z.number(), z.null()]).optional(),
285
- legacyKey: z.union([z.string(), z.null()]).optional(),
286
- bucketName: z.union([z.string(), z.null()]).optional(),
287
- encryptionKey: z.union([z.string(), z.null()]).optional(),
288
- createdBy: z.union([z.string(), z.null()]).optional(),
289
- createdAt: z.string(),
290
- deletedAt: z.union([z.string(), z.null()]).optional()
291
- })
292
- }),
293
- z.object({
294
- url: z.string().url(),
295
- expiresAt: z.string().datetime({ offset: true })
268
+ path: z.string(),
269
+ workspaceId: z.string(),
270
+ originalFileName: z.union([z.string(), z.null()]).optional(),
271
+ mimeType: z.union([z.string(), z.null()]).optional(),
272
+ size: z.union([z.number(), z.null()]).optional(),
273
+ legacyKey: z.union([z.string(), z.null()]).optional(),
274
+ bucketName: z.union([z.string(), z.null()]).optional(),
275
+ encryptionKey: z.union([z.string(), z.null()]).optional(),
276
+ createdBy: z.union([z.string(), z.null()]).optional(),
277
+ createdAt: z.string(),
278
+ deletedAt: z.union([z.string(), z.null()]).optional(),
279
+ uploadedAt: z.union([z.string(), z.null()]).optional()
296
280
  })
297
- ])
281
+ })
298
282
  },
299
283
  {
300
284
  method: "delete",
@@ -344,7 +328,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
344
328
  encryptionKey: z.union([z.string(), z.null()]).optional(),
345
329
  createdBy: z.union([z.string(), z.null()]).optional(),
346
330
  createdAt: z.string(),
347
- deletedAt: z.union([z.string(), z.null()]).optional()
331
+ deletedAt: z.union([z.string(), z.null()]).optional(),
332
+ uploadedAt: z.union([z.string(), z.null()]).optional()
348
333
  }),
349
334
  errors: [
350
335
  {
@@ -416,7 +401,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
416
401
  encryptionKey: z.union([z.string(), z.null()]).optional(),
417
402
  createdBy: z.union([z.string(), z.null()]).optional(),
418
403
  createdAt: z.string(),
419
- deletedAt: z.union([z.string(), z.null()]).optional()
404
+ deletedAt: z.union([z.string(), z.null()]).optional(),
405
+ uploadedAt: z.union([z.string(), z.null()]).optional()
420
406
  })
421
407
  ),
422
408
  count: z.number(),
@@ -467,6 +453,20 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
467
453
  defaultS3LinkTtl: z.number().gte(1)
468
454
  })
469
455
  },
456
+ {
457
+ method: "patch",
458
+ path: "/:id/uploaded-at",
459
+ description: `Set the uploaded at timestamp for a file.`,
460
+ requestFormat: "json",
461
+ parameters: [
462
+ {
463
+ name: "id",
464
+ type: "Path",
465
+ schema: z.string()
466
+ }
467
+ ],
468
+ response: z.void()
469
+ },
470
470
  {
471
471
  method: "post",
472
472
  path: "/files",
@@ -474,8 +474,6 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
474
474
 
475
475
  The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
476
476
 
477
- 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.
478
-
479
477
  The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
480
478
  `,
481
479
  requestFormat: "json",
@@ -507,8 +505,10 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
507
505
  encryptionKey: z.union([z.string(), z.null()]).optional(),
508
506
  createdBy: z.union([z.string(), z.null()]).optional(),
509
507
  createdAt: z.string(),
510
- deletedAt: z.union([z.string(), z.null()]).optional()
511
- })
508
+ deletedAt: z.union([z.string(), z.null()]).optional(),
509
+ uploadedAt: z.union([z.string(), z.null()]).optional()
510
+ }),
511
+ path: z.string()
512
512
  })
513
513
  },
514
514
  {
@@ -539,7 +539,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
539
539
  encryptionKey: z.union([z.string(), z.null()]).optional(),
540
540
  createdBy: z.union([z.string(), z.null()]).optional(),
541
541
  createdAt: z.string(),
542
- deletedAt: z.union([z.string(), z.null()]).optional()
542
+ deletedAt: z.union([z.string(), z.null()]).optional(),
543
+ uploadedAt: z.union([z.string(), z.null()]).optional()
543
544
  }),
544
545
  z.null()
545
546
  ])
@@ -604,6 +605,40 @@ The returned permalink ID should be used with the `/permalinks/:permalinkId
604
605
  })
605
606
  )
606
607
  },
608
+ {
609
+ method: "post",
610
+ path: "/files/:filename",
611
+ description: `Create a file and get a pre-signed upload URL (legacy endpoint).
612
+
613
+ This endpoint is deprecated. Use POST /files instead with `originalFileName` in the request body.
614
+
615
+ The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
616
+
617
+ The returned `url` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
618
+ `,
619
+ requestFormat: "json",
620
+ parameters: [
621
+ {
622
+ name: "body",
623
+ type: "Body",
624
+ schema: postFiles_Body
625
+ },
626
+ {
627
+ name: "expiresIn",
628
+ type: "Query",
629
+ schema: z.number().optional().default(3600)
630
+ },
631
+ {
632
+ name: "filename",
633
+ type: "Path",
634
+ schema: z.string()
635
+ }
636
+ ],
637
+ response: z.object({
638
+ url: z.string(),
639
+ expiresAt: z.string().datetime({ offset: true })
640
+ })
641
+ },
607
642
  {
608
643
  method: "put",
609
644
  path: "/files/:id",
@@ -638,7 +673,8 @@ The returned permalink ID should be used with the `/permalinks/:permalinkId
638
673
  encryptionKey: z.union([z.string(), z.null()]).optional(),
639
674
  createdBy: z.union([z.string(), z.null()]).optional(),
640
675
  createdAt: z.string(),
641
- deletedAt: z.union([z.string(), z.null()]).optional()
676
+ deletedAt: z.union([z.string(), z.null()]).optional(),
677
+ uploadedAt: z.union([z.string(), z.null()]).optional()
642
678
  })
643
679
  }),
644
680
  z.object({
@@ -685,7 +721,8 @@ The returned permalink ID should be used with the `/permalinks/:permalinkId
685
721
  encryptionKey: z.union([z.string(), z.null()]).optional(),
686
722
  createdBy: z.union([z.string(), z.null()]).optional(),
687
723
  createdAt: z.string(),
688
- deletedAt: z.union([z.string(), z.null()]).optional()
724
+ deletedAt: z.union([z.string(), z.null()]).optional(),
725
+ uploadedAt: z.union([z.string(), z.null()]).optional()
689
726
  }),
690
727
  errors: [
691
728
  {
@@ -721,7 +758,8 @@ The returned permalink ID should be used with the `/permalinks/:permalinkId
721
758
  encryptionKey: z.union([z.string(), z.null()]).optional(),
722
759
  createdBy: z.union([z.string(), z.null()]).optional(),
723
760
  createdAt: z.string(),
724
- deletedAt: z.union([z.string(), z.null()]).optional()
761
+ deletedAt: z.union([z.string(), z.null()]).optional(),
762
+ uploadedAt: z.union([z.string(), z.null()]).optional()
725
763
  })
726
764
  ),
727
765
  z.object({
@@ -738,7 +776,8 @@ The returned permalink ID should be used with the `/permalinks/:permalinkId
738
776
  encryptionKey: z.union([z.string(), z.null()]).optional(),
739
777
  createdBy: z.union([z.string(), z.null()]).optional(),
740
778
  createdAt: z.string(),
741
- deletedAt: z.union([z.string(), z.null()]).optional()
779
+ deletedAt: z.union([z.string(), z.null()]).optional(),
780
+ uploadedAt: z.union([z.string(), z.null()]).optional()
742
781
  })
743
782
  )
744
783
  })
@@ -815,6 +854,20 @@ Make sure to follow redirects to the actual file download URL.
815
854
  }
816
855
  ]
817
856
  },
857
+ {
858
+ method: "patch",
859
+ path: "/v2/:id/uploaded-at",
860
+ description: `Set the uploaded at timestamp for a file.`,
861
+ requestFormat: "json",
862
+ parameters: [
863
+ {
864
+ name: "id",
865
+ type: "Path",
866
+ schema: z.string()
867
+ }
868
+ ],
869
+ response: z.void()
870
+ },
818
871
  {
819
872
  method: "post",
820
873
  path: "/v2/files",
@@ -822,8 +875,6 @@ Make sure to follow redirects to the actual file download URL.
822
875
 
823
876
  The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
824
877
 
825
- 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.
826
-
827
878
  The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
828
879
  `,
829
880
  requestFormat: "json",
@@ -855,8 +906,10 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
855
906
  encryptionKey: z.union([z.string(), z.null()]).optional(),
856
907
  createdBy: z.union([z.string(), z.null()]).optional(),
857
908
  createdAt: z.string(),
858
- deletedAt: z.union([z.string(), z.null()]).optional()
859
- })
909
+ deletedAt: z.union([z.string(), z.null()]).optional(),
910
+ uploadedAt: z.union([z.string(), z.null()]).optional()
911
+ }),
912
+ path: z.string()
860
913
  })
861
914
  },
862
915
  {
@@ -887,7 +940,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
887
940
  encryptionKey: z.union([z.string(), z.null()]).optional(),
888
941
  createdBy: z.union([z.string(), z.null()]).optional(),
889
942
  createdAt: z.string(),
890
- deletedAt: z.union([z.string(), z.null()]).optional()
943
+ deletedAt: z.union([z.string(), z.null()]).optional(),
944
+ uploadedAt: z.union([z.string(), z.null()]).optional()
891
945
  }),
892
946
  z.null()
893
947
  ])
@@ -900,6 +954,40 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
900
954
  }
901
955
  ]
902
956
  },
957
+ {
958
+ method: "post",
959
+ path: "/v2/files/:filename",
960
+ description: `Create a file and get a pre-signed upload URL (legacy endpoint).
961
+
962
+ This endpoint is deprecated. Use POST /files instead with `originalFileName` in the request body.
963
+
964
+ The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
965
+
966
+ The returned `url` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
967
+ `,
968
+ requestFormat: "json",
969
+ parameters: [
970
+ {
971
+ name: "body",
972
+ type: "Body",
973
+ schema: postFiles_Body
974
+ },
975
+ {
976
+ name: "expiresIn",
977
+ type: "Query",
978
+ schema: z.number().optional().default(3600)
979
+ },
980
+ {
981
+ name: "filename",
982
+ type: "Path",
983
+ schema: z.string()
984
+ }
985
+ ],
986
+ response: z.object({
987
+ url: z.string(),
988
+ expiresAt: z.string().datetime({ offset: true })
989
+ })
990
+ },
903
991
  {
904
992
  method: "put",
905
993
  path: "/v2/files/:id",
@@ -934,7 +1022,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
934
1022
  encryptionKey: z.union([z.string(), z.null()]).optional(),
935
1023
  createdBy: z.union([z.string(), z.null()]).optional(),
936
1024
  createdAt: z.string(),
937
- deletedAt: z.union([z.string(), z.null()]).optional()
1025
+ deletedAt: z.union([z.string(), z.null()]).optional(),
1026
+ uploadedAt: z.union([z.string(), z.null()]).optional()
938
1027
  })
939
1028
  }),
940
1029
  z.object({
@@ -981,7 +1070,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
981
1070
  encryptionKey: z.union([z.string(), z.null()]).optional(),
982
1071
  createdBy: z.union([z.string(), z.null()]).optional(),
983
1072
  createdAt: z.string(),
984
- deletedAt: z.union([z.string(), z.null()]).optional()
1073
+ deletedAt: z.union([z.string(), z.null()]).optional(),
1074
+ uploadedAt: z.union([z.string(), z.null()]).optional()
985
1075
  }),
986
1076
  errors: [
987
1077
  {
@@ -1017,7 +1107,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
1017
1107
  encryptionKey: z.union([z.string(), z.null()]).optional(),
1018
1108
  createdBy: z.union([z.string(), z.null()]).optional(),
1019
1109
  createdAt: z.string(),
1020
- deletedAt: z.union([z.string(), z.null()]).optional()
1110
+ deletedAt: z.union([z.string(), z.null()]).optional(),
1111
+ uploadedAt: z.union([z.string(), z.null()]).optional()
1021
1112
  })
1022
1113
  ),
1023
1114
  z.object({
@@ -1034,7 +1125,8 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
1034
1125
  encryptionKey: z.union([z.string(), z.null()]).optional(),
1035
1126
  createdBy: z.union([z.string(), z.null()]).optional(),
1036
1127
  createdAt: z.string(),
1037
- deletedAt: z.union([z.string(), z.null()]).optional()
1128
+ deletedAt: z.union([z.string(), z.null()]).optional(),
1129
+ uploadedAt: z.union([z.string(), z.null()]).optional()
1038
1130
  })
1039
1131
  )
1040
1132
  })
@@ -1046,14 +1138,12 @@ function createApiClient(baseUrl, options) {
1046
1138
  return new Zodios(baseUrl, endpoints, options);
1047
1139
  }
1048
1140
 
1049
- function useVaultClient(vaultUrl, token, headerOverrides = {}) {
1141
+ function useVaultClient(vaultUrl, token) {
1050
1142
  const api = createApiClient(vaultUrl, {
1051
1143
  axiosConfig: {
1052
1144
  headers: {
1053
1145
  Authorization: token,
1054
- "User-Agent": "vault-http-client:2.3.9",
1055
- "X-Compatibility-Date": "2025-09-17T10:33:21.181Z",
1056
- ...headerOverrides
1146
+ "User-Agent": "vault-http-client:2.3.10"
1057
1147
  }
1058
1148
  }
1059
1149
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/vault-http-client",
3
- "version": "2.3.9",
3
+ "version": "2.3.10",
4
4
  "types": "dist/index.d.ts",
5
5
  "exports": {
6
6
  ".": {