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