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