@swan-admin/swan-ai-measurements 1.0.81 → 1.0.83

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.
@@ -10,7 +10,7 @@ interface ObjMetaData {
10
10
  callback_url: string;
11
11
  }
12
12
  interface UploadOptions {
13
- file: any;
13
+ file: File;
14
14
  arrayMetaData: ObjMetaData[];
15
15
  scanId: string;
16
16
  }
@@ -86,17 +86,17 @@ class FileUpload {
86
86
  },
87
87
  });
88
88
  },
89
- completeMultipartUpload: (file, { uploadId, key, parts }) =>
90
- fetchData({
91
- path: UPPY_FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
92
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
93
- body: {
94
- uploadId,
95
- objectKey: key,
96
- parts,
97
- originalFileName: file.name,
98
- },
99
- }),
89
+ // completeMultipartUpload: (file: any, { uploadId, key, parts }: { uploadId: string | number; key: string | number; parts: any }) =>
90
+ // fetchData({
91
+ // path: UPPY_FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
92
+ // apiKey: this.#accessKey,
93
+ // body: {
94
+ // uploadId,
95
+ // objectKey: key,
96
+ // parts,
97
+ // originalFileName: file.name,
98
+ // },
99
+ // }),
100
100
  signPart: (file, partData) =>
101
101
  fetchData({
102
102
  path: UPPY_FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
@@ -10,7 +10,7 @@ interface ObjMetaData {
10
10
  callback_url: string;
11
11
  }
12
12
  interface UploadOptions {
13
- file: any;
13
+ file: File;
14
14
  arrayMetaData: ObjMetaData[];
15
15
  scanId: string;
16
16
  }
@@ -38,16 +38,17 @@ class FileUpload {
38
38
  },
39
39
  });
40
40
  },
41
- completeMultipartUpload: (file, { uploadId, key, parts }) => (0, utils_js_1.fetchData)({
42
- path: constants_js_1.UPPY_FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
43
- apiKey: this.#accessKey,
44
- body: {
45
- uploadId,
46
- objectKey: key,
47
- parts,
48
- originalFileName: file.name,
49
- },
50
- }),
41
+ // completeMultipartUpload: (file: any, { uploadId, key, parts }: { uploadId: string | number; key: string | number; parts: any }) =>
42
+ // fetchData({
43
+ // path: UPPY_FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
44
+ // apiKey: this.#accessKey,
45
+ // body: {
46
+ // uploadId,
47
+ // objectKey: key,
48
+ // parts,
49
+ // originalFileName: file.name,
50
+ // },
51
+ // }),
51
52
  signPart: (file, partData) => (0, utils_js_1.fetchData)({
52
53
  path: constants_js_1.UPPY_FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
53
54
  apiKey: this.#accessKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.0.81",
3
+ "version": "1.0.83",
4
4
  "description": "provides ai measurement suggestion",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/fileUpload.ts CHANGED
@@ -15,7 +15,7 @@ interface ObjMetaData {
15
15
  }
16
16
 
17
17
  interface UploadOptions {
18
- file: any;
18
+ file: File;
19
19
  arrayMetaData: ObjMetaData[];
20
20
  scanId: string;
21
21
  }
@@ -57,17 +57,17 @@ export default class FileUpload {
57
57
  },
58
58
  });
59
59
  },
60
- completeMultipartUpload: (file: any, { uploadId, key, parts }: { uploadId: string | number; key: string | number; parts: any }) =>
61
- fetchData({
62
- path: UPPY_FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
63
- apiKey: this.#accessKey,
64
- body: {
65
- uploadId,
66
- objectKey: key,
67
- parts,
68
- originalFileName: file.name,
69
- },
70
- }),
60
+ // completeMultipartUpload: (file: any, { uploadId, key, parts }: { uploadId: string | number; key: string | number; parts: any }) =>
61
+ // fetchData({
62
+ // path: UPPY_FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
63
+ // apiKey: this.#accessKey,
64
+ // body: {
65
+ // uploadId,
66
+ // objectKey: key,
67
+ // parts,
68
+ // originalFileName: file.name,
69
+ // },
70
+ // }),
71
71
 
72
72
  signPart: (file: any, partData: any) =>
73
73
  fetchData({
package/src/utils.ts CHANGED
@@ -24,18 +24,12 @@ export async function fetchData(options: FetchDataOptions): Promise<any> {
24
24
 
25
25
  const apiUrl = `${baseUrl}${path}${queryParams ? `?${new URLSearchParams(queryParams)}` : ""}`;
26
26
  try {
27
- const response = await fetch(apiUrl, {
28
- method: "POST",
29
- headers,
30
- body: JSON.stringify(body),
31
- });
32
-
33
- if (!response.ok) {
34
- throw new Error(`Error: Unexpected response status ${response.status}`);
27
+ const res: AxiosResponse<any> = await axios.post(apiUrl, body, { headers });
28
+ if (res.status >= 200 && res.status < 300) {
29
+ return res.data;
35
30
  }
36
-
37
- const data = await response.json();
38
- return data;
31
+ console.error(`Error: Unexpected response status ${res.status}`);
32
+ return {};
39
33
  } catch (error) {
40
34
  console.error(error, "while uploading");
41
35
  return {};