polgo-upload-kit 1.0.13 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polgo-upload-kit",
3
- "version": "1.0.13",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "main": "src/polgoUploadClient.js",
6
6
  "scripts": {
@@ -2,17 +2,16 @@
2
2
  import axios from "axios";
3
3
 
4
4
  class PolgoUploadClient {
5
- constructor(isProd, token, stack, tipo) {
5
+ constructor(isProd, token, stack) {
6
6
  this.ambiente = isProd ? "producao" : "dev";
7
7
  this.url =
8
8
  "https://mkgplyz3tc.execute-api.us-east-1.amazonaws.com/lambdaUploadProducao/arquivo/upload";
9
9
  this.stack = stack;
10
10
  this.token = token;
11
- this.tipo = tipo;
12
11
  }
13
12
 
14
- async uploadFile(bufferArquivo, options = {}) {
15
- const mimeType = this.tipo;
13
+ async uploadFile(bufferArquivo, bucket, options = {}) {
14
+ const mimeType = bufferArquivo.type;
16
15
 
17
16
  const fileBlob = new Blob([bufferArquivo], { type: mimeType });
18
17
 
@@ -28,6 +27,7 @@ class PolgoUploadClient {
28
27
  const finalUrl = `${this.url}?${queryParams.toString()}`;
29
28
  const form = new FormData();
30
29
  form.append("file", fileBlob, options.nomeArquivo || "uploaded_file");
30
+ form.append("bucket", bucket);
31
31
 
32
32
  try {
33
33
  const response = await axios.post(finalUrl, form, {