@meistrari/vault-http-client 2.3.6 → 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 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 postFilesByFilename_Body = zod.z.object({
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
  {
@@ -466,6 +469,50 @@ The returned `uploadUrl` is valid for 1 hour by default. You can chang
466
469
  defaultS3LinkTtl: zod.z.number().gte(1)
467
470
  })
468
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
+ },
469
516
  {
470
517
  method: "get",
471
518
  path: "/files/:fileId",
@@ -559,61 +606,6 @@ The returned permalink ID should be used with the `/permalinks/:permalinkId
559
606
  })
560
607
  )
561
608
  },
562
- {
563
- method: "post",
564
- path: "/files/:filename",
565
- description: `Create a file and get a pre-signed upload URL.
566
-
567
- The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
568
-
569
- 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.
570
-
571
- The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
572
- `,
573
- requestFormat: "json",
574
- parameters: [
575
- {
576
- name: "body",
577
- type: "Body",
578
- schema: postFilesByFilename_Body
579
- },
580
- {
581
- name: "expiresIn",
582
- type: "Query",
583
- schema: zod.z.number().optional().default(3600)
584
- },
585
- {
586
- name: "filename",
587
- type: "Path",
588
- schema: zod.z.string()
589
- }
590
- ],
591
- response: zod.z.union([
592
- zod.z.object({
593
- id: zod.z.string(),
594
- uploadUrl: zod.z.string(),
595
- expiresAt: zod.z.string().datetime({ offset: true }),
596
- metadata: zod.z.object({
597
- id: zod.z.string(),
598
- path: zod.z.string(),
599
- workspaceId: zod.z.string(),
600
- originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
601
- mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
602
- size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
603
- legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
604
- bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
605
- encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
606
- createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
607
- createdAt: zod.z.string(),
608
- deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
609
- })
610
- }),
611
- zod.z.object({
612
- url: zod.z.string(),
613
- expiresAt: zod.z.string().datetime({ offset: true })
614
- })
615
- ])
616
- },
617
609
  {
618
610
  method: "put",
619
611
  path: "/files/:id",
@@ -825,6 +817,50 @@ Make sure to follow redirects to the actual file download URL.
825
817
  }
826
818
  ]
827
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
+ },
828
864
  {
829
865
  method: "get",
830
866
  path: "/v2/files/:fileId",
@@ -866,61 +902,6 @@ Make sure to follow redirects to the actual file download URL.
866
902
  }
867
903
  ]
868
904
  },
869
- {
870
- method: "post",
871
- path: "/v2/files/:filename",
872
- description: `Create a file and get a pre-signed upload URL.
873
-
874
- The `sha256` body param is used as the file's primary key. If not provided, a random UUID will be generated.
875
-
876
- 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.
877
-
878
- The returned `uploadUrl` is valid for 1 hour by default. You can change the expiration time by passing the `expiresIn` query parameter.
879
- `,
880
- requestFormat: "json",
881
- parameters: [
882
- {
883
- name: "body",
884
- type: "Body",
885
- schema: postFilesByFilename_Body
886
- },
887
- {
888
- name: "expiresIn",
889
- type: "Query",
890
- schema: zod.z.number().optional().default(3600)
891
- },
892
- {
893
- name: "filename",
894
- type: "Path",
895
- schema: zod.z.string()
896
- }
897
- ],
898
- response: zod.z.union([
899
- zod.z.object({
900
- id: zod.z.string(),
901
- uploadUrl: zod.z.string(),
902
- expiresAt: zod.z.string().datetime({ offset: true }),
903
- metadata: zod.z.object({
904
- id: zod.z.string(),
905
- path: zod.z.string(),
906
- workspaceId: zod.z.string(),
907
- originalFileName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
908
- mimeType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
909
- size: zod.z.union([zod.z.number(), zod.z.null()]).optional(),
910
- legacyKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
911
- bucketName: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
912
- encryptionKey: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
913
- createdBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
914
- createdAt: zod.z.string(),
915
- deletedAt: zod.z.union([zod.z.string(), zod.z.null()]).optional()
916
- })
917
- }),
918
- zod.z.object({
919
- url: zod.z.string(),
920
- expiresAt: zod.z.string().datetime({ offset: true })
921
- })
922
- ])
923
- },
924
905
  {
925
906
  method: "put",
926
907
  path: "/v2/files/:id",
@@ -1067,12 +1048,14 @@ function createApiClient(baseUrl, options) {
1067
1048
  return new core.Zodios(baseUrl, endpoints, options);
1068
1049
  }
1069
1050
 
1070
- function useVaultClient(vaultUrl, token) {
1051
+ function useVaultClient(vaultUrl, token, headerOverrides = {}) {
1071
1052
  const api = createApiClient(vaultUrl, {
1072
1053
  axiosConfig: {
1073
1054
  headers: {
1074
1055
  Authorization: token,
1075
- "User-Agent": "vault-http-client:2.3.6"
1056
+ "User-Agent": "vault-http-client:2.3.9",
1057
+ "X-Compatibility-Date": "2025-09-17T10:33:21.181Z",
1058
+ ...headerOverrides
1076
1059
  }
1077
1060
  }
1078
1061
  });