@swan-admin/swan-ai-measurements 1.0.97 → 1.0.99

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/Readme.md ADDED
@@ -0,0 +1,37 @@
1
+ SWAN Node.js Library
2
+ -------------------
3
+ Swan is an AI Fitting Room that lets shoppers size & try on clothes virtually. For clothing brands and online retailers, Swan powers completely personalised sales – increasing conversion & reducing expensive returns.
4
+
5
+ Documentation
6
+ ------------
7
+
8
+ See the<a href="https://www.swanvision.ai/docs">SWAN API docs</a> for Node.js.
9
+
10
+
11
+ Requirements
12
+ -------------------
13
+ Node 20 or higher.
14
+
15
+ Usage
16
+ -------------------
17
+
18
+ ##### Installation
19
+
20
+ npm i @swan-admin/swan-ai-measurements
21
+
22
+ ##### Create Customer
23
+
24
+ swan.custom.createCustomer({name, store_url, location, email, emailsTier_1, emailsTier_2})
25
+
26
+ ##### Upload file
27
+
28
+ swan.fileUpload.uploadFile({ file, objMetaData, scanId })
29
+
30
+ ##### Get measurements
31
+
32
+ swan.measurement.getMeasurementResult(scanId)
33
+
34
+
35
+ Support
36
+ ------------------
37
+ New features and bug fixes are released on the latest major version of the SWAN package. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
package/dist/constants.js CHANGED
@@ -26,6 +26,7 @@ exports.API_ENDPOINTS = {
26
26
  VERIFY_USER: "/auth/verify",
27
27
  ADD_USER: "/user",
28
28
  CUSTOM_CUSTOMER: "/customers/custom",
29
+ CREATE_CUSTOMER: "/customers",
29
30
  MODEL: "/model",
30
31
  TRY_ON_SCAN: "/tryon/scan",
31
32
  TRY_ON_IMAGE_UPLOAD: "/tryon/user-image-urls/upload",
package/dist/custom.d.ts CHANGED
@@ -2,6 +2,14 @@ import { AxiosResponse } from "axios";
2
2
  declare class Custom {
3
3
  #private;
4
4
  constructor(accessKey: string, stagingUrl?: boolean);
5
+ createCustomer(payload: {
6
+ name: string;
7
+ store_url: string;
8
+ location: string;
9
+ email: string;
10
+ emailsTier_1: string;
11
+ emailsTier_2: string;
12
+ }): Promise<AxiosResponse<any>>;
5
13
  getCustomCustomerConfig: (store_url: string) => Promise<AxiosResponse<any>>;
6
14
  getModelUrl: (id: string) => Promise<AxiosResponse<any>>;
7
15
  }
package/dist/custom.js CHANGED
@@ -13,6 +13,13 @@ class Custom {
13
13
  this.#accessKey = accessKey;
14
14
  this.#stagingUrl = stagingUrl;
15
15
  }
16
+ createCustomer(payload) {
17
+ return axios_1.default.post(`${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_AUTH_BASE_URL, stagingUrl: this.#stagingUrl })}${constants_js_1.API_ENDPOINTS.CREATE_CUSTOMER}`, {
18
+ payload,
19
+ headers: { "X-Api-Key": this.#accessKey },
20
+ });
21
+ }
22
+ ;
16
23
  getCustomCustomerConfig = (store_url) => {
17
24
  if ((0, utils_js_1.checkParameters)(store_url) === false) {
18
25
  throw new Error(constants_js_1.REQUIRED_MESSAGE);
@@ -23,6 +23,7 @@ export const API_ENDPOINTS = {
23
23
  VERIFY_USER: "/auth/verify",
24
24
  ADD_USER: "/user",
25
25
  CUSTOM_CUSTOMER: "/customers/custom",
26
+ CREATE_CUSTOMER: "/customers",
26
27
  MODEL: "/model",
27
28
  TRY_ON_SCAN: "/tryon/scan",
28
29
  TRY_ON_IMAGE_UPLOAD: "/tryon/user-image-urls/upload",
@@ -2,6 +2,14 @@ import { AxiosResponse } from "axios";
2
2
  declare class Custom {
3
3
  #private;
4
4
  constructor(accessKey: string, stagingUrl?: boolean);
5
+ createCustomer(payload: {
6
+ name: string;
7
+ store_url: string;
8
+ location: string;
9
+ email: string;
10
+ emailsTier_1: string;
11
+ emailsTier_2: string;
12
+ }): Promise<AxiosResponse<any>>;
5
13
  getCustomCustomerConfig: (store_url: string) => Promise<AxiosResponse<any>>;
6
14
  getModelUrl: (id: string) => Promise<AxiosResponse<any>>;
7
15
  }
@@ -37,6 +37,13 @@ class Custom {
37
37
  __classPrivateFieldSet(this, _Custom_accessKey, accessKey, "f");
38
38
  __classPrivateFieldSet(this, _Custom_stagingUrl, stagingUrl, "f");
39
39
  }
40
+ createCustomer(payload) {
41
+ return axios.post(`${getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _Custom_stagingUrl, "f") })}${API_ENDPOINTS.CREATE_CUSTOMER}`, {
42
+ payload,
43
+ headers: { "X-Api-Key": __classPrivateFieldGet(this, _Custom_accessKey, "f") },
44
+ });
45
+ }
46
+ ;
40
47
  }
41
48
  _Custom_accessKey = new WeakMap(), _Custom_stagingUrl = new WeakMap();
42
49
  export default Custom;
@@ -18,6 +18,6 @@ export default class FileUpload {
18
18
  #private;
19
19
  constructor(accessKey: string, stagingUrl?: boolean);
20
20
  uploadFileFrontend({ file, arrayMetaData, scanId }: UploadOptions): Promise<unknown>;
21
- uploadFileBackend({ file, arrayMetaData, scanId }: UploadOptions): Promise<unknown>;
21
+ uploadFile({ file, arrayMetaData, scanId }: UploadOptions): Promise<unknown>;
22
22
  }
23
23
  export {};
@@ -1,205 +1,169 @@
1
- var __awaiter =
2
- (this && this.__awaiter) ||
3
- function (thisArg, _arguments, P, generator) {
4
- function adopt(value) {
5
- return value instanceof P
6
- ? value
7
- : new P(function (resolve) {
8
- resolve(value);
9
- });
10
- }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11
3
  return new (P || (P = Promise))(function (resolve, reject) {
12
- function fulfilled(value) {
13
- try {
14
- step(generator.next(value));
15
- } catch (e) {
16
- reject(e);
17
- }
18
- }
19
- function rejected(value) {
20
- try {
21
- step(generator["throw"](value));
22
- } catch (e) {
23
- reject(e);
24
- }
25
- }
26
- function step(result) {
27
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
28
- }
29
- step((generator = generator.apply(thisArg, _arguments || [])).next());
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
8
  });
31
- };
32
- var __classPrivateFieldSet =
33
- (this && this.__classPrivateFieldSet) ||
34
- function (receiver, state, value, kind, f) {
9
+ };
10
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
35
11
  if (kind === "m") throw new TypeError("Private method is not writable");
36
12
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
37
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
38
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
39
- return kind === "a" ? f.call(receiver, value) : f ? (f.value = value) : state.set(receiver, value), value;
40
- };
41
- var __classPrivateFieldGet =
42
- (this && this.__classPrivateFieldGet) ||
43
- function (receiver, state, kind, f) {
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
14
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15
+ };
16
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
44
17
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
45
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
46
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
18
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
47
19
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
48
- };
20
+ };
49
21
  var _FileUpload_uppyIns, _FileUpload_accessKey, _FileUpload_stagingUrl;
50
22
  import axios from "axios";
51
23
  import { REQUIRED_MESSAGE, REQUIRED_MESSAGE_FOR_META_DATA, FILE_UPLOAD_ENDPOINT, APP_AUTH_BASE_URL } from "./constants.js";
52
24
  import { checkMetaDataValue, checkParameters, fetchData, getFileChunks, getUrl } from "./utils.js";
53
- import Uppy from "@uppy/core";
54
- import AwsS3Multipart from "@uppy/aws-s3-multipart";
25
+ const Uppy = require("fix-esm").require("@uppy/core");
26
+ const AwsS3Multipart = require("fix-esm").require("@uppy/aws-s3-multipart");
55
27
  class FileUpload {
56
- constructor(accessKey, stagingUrl = false) {
57
- _FileUpload_uppyIns.set(this, void 0);
58
- _FileUpload_accessKey.set(this, void 0);
59
- _FileUpload_stagingUrl.set(this, void 0);
60
- __classPrivateFieldSet(this, _FileUpload_accessKey, accessKey, "f");
61
- __classPrivateFieldSet(this, _FileUpload_stagingUrl, stagingUrl, "f");
62
- }
63
- uploadFileFrontend(_a) {
64
- return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
65
- if (!checkParameters(file, arrayMetaData, scanId)) {
66
- throw new Error(REQUIRED_MESSAGE);
67
- }
68
- if (!checkMetaDataValue(arrayMetaData)) {
69
- throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
70
- }
71
- return new Promise((resolve, reject) => {
72
- if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
73
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
74
- }
75
- __classPrivateFieldSet(this, _FileUpload_uppyIns, new Uppy({ autoProceed: true }), "f");
76
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").use(AwsS3Multipart, {
77
- limit: 10,
78
- retryDelays: [0, 1000, 3000, 5000],
79
- companionUrl: getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f") }),
80
- getChunkSize: () => 5 * 1024 * 1024,
81
- createMultipartUpload: (file) => {
82
- const objectKey = `${scanId}.${file.extension}`;
83
- return fetchData({
84
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
85
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
86
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
87
- body: {
88
- objectKey,
89
- contentType: file.type,
90
- objectMetadata: arrayMetaData,
91
- },
28
+ constructor(accessKey, stagingUrl = false) {
29
+ _FileUpload_uppyIns.set(this, void 0);
30
+ _FileUpload_accessKey.set(this, void 0);
31
+ _FileUpload_stagingUrl.set(this, void 0);
32
+ __classPrivateFieldSet(this, _FileUpload_accessKey, accessKey, "f");
33
+ __classPrivateFieldSet(this, _FileUpload_stagingUrl, stagingUrl, "f");
34
+ }
35
+ uploadFileFrontend(_a) {
36
+ return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
37
+ if (!checkParameters(file, arrayMetaData, scanId)) {
38
+ throw new Error(REQUIRED_MESSAGE);
39
+ }
40
+ if (!checkMetaDataValue(arrayMetaData)) {
41
+ throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
42
+ }
43
+ return new Promise((resolve, reject) => {
44
+ if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
45
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
46
+ }
47
+ __classPrivateFieldSet(this, _FileUpload_uppyIns, new Uppy.default({ autoProceed: true }), "f");
48
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").use(AwsS3Multipart.default, {
49
+ limit: 10,
50
+ retryDelays: [0, 1000, 3000, 5000],
51
+ companionUrl: getUrl({ urlName: APP_AUTH_BASE_URL, stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f") }),
52
+ getChunkSize: () => 5 * 1024 * 1024,
53
+ createMultipartUpload: (file) => {
54
+ const objectKey = `${scanId}.${file.extension}`;
55
+ return fetchData({
56
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
57
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
58
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
59
+ body: {
60
+ objectKey,
61
+ contentType: file.type,
62
+ objectMetadata: arrayMetaData,
63
+ },
64
+ });
65
+ },
66
+ completeMultipartUpload: (file, { uploadId, key, parts }) => fetchData({
67
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
68
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
69
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
70
+ body: {
71
+ uploadId,
72
+ objectKey: key,
73
+ parts,
74
+ originalFileName: file.name,
75
+ },
76
+ }),
77
+ signPart: (file, partData) => fetchData({
78
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
79
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
80
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
81
+ body: {
82
+ objectKey: partData.key,
83
+ uploadId: partData.uploadId,
84
+ partNumber: partData.partNumber,
85
+ },
86
+ }),
87
+ });
88
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").addFile({
89
+ source: "manual",
90
+ name: file.name,
91
+ type: file.type,
92
+ data: file,
93
+ });
94
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("upload-error", (file, error, response) => {
95
+ reject(error);
96
+ });
97
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("upload-success", () => {
98
+ resolve({ message: "file uploaded successfully" });
99
+ });
100
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("complete", (result) => {
101
+ if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
102
+ __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
103
+ }
104
+ });
92
105
  });
93
- },
94
- completeMultipartUpload: (file, { uploadId, key, parts }) =>
95
- fetchData({
96
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
97
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
98
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
99
- body: {
100
- uploadId,
101
- objectKey: key,
102
- parts,
103
- originalFileName: file.name,
104
- },
105
- }),
106
- signPart: (file, partData) =>
107
- fetchData({
108
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
109
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
110
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
111
- body: {
112
- objectKey: partData.key,
113
- uploadId: partData.uploadId,
114
- partNumber: partData.partNumber,
115
- },
116
- }),
117
- });
118
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").addFile({
119
- source: "manual",
120
- name: file.name,
121
- type: file.type,
122
- data: file,
123
- });
124
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("upload-error", (file, error, response) => {
125
- reject(error);
126
- });
127
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("upload-success", () => {
128
- resolve({ message: "file uploaded successfully" });
129
- });
130
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").on("complete", (result) => {
131
- if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
132
- __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
133
- }
134
106
  });
135
- });
136
- });
137
- }
138
- uploadFileBackend(_a) {
139
- return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
140
- if (!checkParameters(file, arrayMetaData, scanId)) {
141
- throw new Error(REQUIRED_MESSAGE);
142
- }
143
- if (!checkMetaDataValue(arrayMetaData)) {
144
- throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
145
- }
146
- return new Promise((resolve, reject) =>
147
- __awaiter(this, void 0, void 0, function* () {
148
- var _b;
149
- try {
150
- const res = yield fetchData({
151
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
152
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
153
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
154
- body: {
155
- objectKey: file.name,
156
- contentType: file.type,
157
- objectMetadata: arrayMetaData,
158
- },
159
- throwError: true,
160
- });
161
- const totalChunks = getFileChunks(file);
162
- const parts = [];
163
- for (let i = 0; i < totalChunks.length; i++) {
164
- const data = yield fetchData({
165
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
166
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
167
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
168
- body: {
169
- objectKey: res === null || res === void 0 ? void 0 : res.key,
170
- uploadId: res === null || res === void 0 ? void 0 : res.uploadId,
171
- partNumber: i + 1,
172
- },
173
- throwError: true,
174
- });
175
- const val = yield axios.put(data === null || data === void 0 ? void 0 : data.url, totalChunks[i], {
176
- headers: { "Content-Type": file.type, "X-Api-Key": __classPrivateFieldGet(this, _FileUpload_accessKey, "f") },
177
- });
178
- parts.push({
179
- PartNumber: i + 1,
180
- ETag: (_b = val === null || val === void 0 ? void 0 : val.headers) === null || _b === void 0 ? void 0 : _b.etag,
181
- });
107
+ }
108
+ uploadFile(_a) {
109
+ return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
110
+ if (!checkParameters(file, arrayMetaData, scanId)) {
111
+ throw new Error(REQUIRED_MESSAGE);
182
112
  }
183
- const completeValue = yield fetchData({
184
- path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
185
- apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
186
- stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
187
- body: {
188
- uploadId: res === null || res === void 0 ? void 0 : res.uploadId,
189
- objectKey: res === null || res === void 0 ? void 0 : res.key,
190
- parts,
191
- originalFileName: file.name,
192
- },
193
- throwError: true,
194
- });
195
- resolve({ message: "successfully uploaded", data: completeValue });
196
- } catch (error) {
197
- reject(error);
198
- }
199
- })
200
- );
201
- });
202
- }
113
+ if (!checkMetaDataValue(arrayMetaData)) {
114
+ throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
115
+ }
116
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
117
+ var _b;
118
+ try {
119
+ const res = yield fetchData({
120
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_START,
121
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
122
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
123
+ body: {
124
+ objectKey: file.name,
125
+ contentType: file.type,
126
+ objectMetadata: arrayMetaData,
127
+ },
128
+ throwError: true,
129
+ });
130
+ const totalChunks = getFileChunks(file);
131
+ const parts = [];
132
+ for (let i = 0; i < totalChunks.length; i++) {
133
+ const data = yield fetchData({
134
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_SIGN_PART,
135
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
136
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
137
+ body: {
138
+ objectKey: res === null || res === void 0 ? void 0 : res.key,
139
+ uploadId: res === null || res === void 0 ? void 0 : res.uploadId,
140
+ partNumber: i + 1,
141
+ },
142
+ throwError: true,
143
+ });
144
+ const val = yield axios.put(data === null || data === void 0 ? void 0 : data.url, totalChunks[i], { headers: { "Content-Type": file.type, "X-Api-Key": __classPrivateFieldGet(this, _FileUpload_accessKey, "f") } });
145
+ parts.push({ PartNumber: i + 1, ETag: (_b = val === null || val === void 0 ? void 0 : val.headers) === null || _b === void 0 ? void 0 : _b.etag });
146
+ }
147
+ const completeValue = yield fetchData({
148
+ path: FILE_UPLOAD_ENDPOINT.UPLOAD_COMPLETE,
149
+ apiKey: __classPrivateFieldGet(this, _FileUpload_accessKey, "f"),
150
+ stagingUrl: __classPrivateFieldGet(this, _FileUpload_stagingUrl, "f"),
151
+ body: {
152
+ uploadId: res === null || res === void 0 ? void 0 : res.uploadId,
153
+ objectKey: res === null || res === void 0 ? void 0 : res.key,
154
+ parts,
155
+ originalFileName: file.name,
156
+ },
157
+ throwError: true,
158
+ });
159
+ resolve({ message: "successfully uploaded", data: completeValue });
160
+ }
161
+ catch (error) {
162
+ reject(error);
163
+ }
164
+ }));
165
+ });
166
+ }
203
167
  }
204
- (_FileUpload_uppyIns = new WeakMap()), (_FileUpload_accessKey = new WeakMap()), (_FileUpload_stagingUrl = new WeakMap());
168
+ _FileUpload_uppyIns = new WeakMap(), _FileUpload_accessKey = new WeakMap(), _FileUpload_stagingUrl = new WeakMap();
205
169
  export default FileUpload;
@@ -18,6 +18,6 @@ export default class FileUpload {
18
18
  #private;
19
19
  constructor(accessKey: string, stagingUrl?: boolean);
20
20
  uploadFileFrontend({ file, arrayMetaData, scanId }: UploadOptions): Promise<unknown>;
21
- uploadFileBackend({ file, arrayMetaData, scanId }: UploadOptions): Promise<unknown>;
21
+ uploadFile({ file, arrayMetaData, scanId }: UploadOptions): Promise<unknown>;
22
22
  }
23
23
  export {};
@@ -87,7 +87,7 @@ class FileUpload {
87
87
  });
88
88
  });
89
89
  }
90
- async uploadFileBackend({ file, arrayMetaData, scanId }) {
90
+ async uploadFile({ file, arrayMetaData, scanId }) {
91
91
  if (!(0, utils_js_1.checkParameters)(file, arrayMetaData, scanId)) {
92
92
  throw new Error(constants_js_1.REQUIRED_MESSAGE);
93
93
  }
package/package.json CHANGED
@@ -1,58 +1,58 @@
1
- {
2
- "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.0.97",
4
- "description": "provides ai measurement suggestion",
5
- "main": "dist/index.js",
6
- "module": "dist/esm/index.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "require": "./dist/index.js",
11
- "import": "./dist/esm/index.js"
12
- }
13
- },
14
- "dependencies": {
15
- "@types/axios": "^0.14.0",
16
- "@types/node": "^20.12.12",
17
- "@uppy/aws-s3-multipart": "^3.11.1",
18
- "@uppy/core": "^3.11.3",
19
- "axios": "^1.6.7",
20
- "socket.io": "^4.7.5",
21
- "socket.io-client": "^4.7.5",
22
- "tslib": "^2.6.2",
23
- "typescript": "^5.4.5",
24
- "fix-esm": "^1.0.1"
25
- },
26
- "scripts": {
27
- "start": "nodemon dist/index.js",
28
- "build": "tsc && tsc --project tsconfig.esm.json",
29
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
30
- "start:dev": "nodemon src/index.ts",
31
- "start:debug": "nodemon --inspect-brk src/index.ts",
32
- "start:prod": "node dist/index.js",
33
- "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
34
- "test": "jest",
35
- "test:watch": "jest --watch",
36
- "test:cov": "jest --coverage",
37
- "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
38
- "test:e2e": "jest --config ./test/jest-e2e.json"
39
- },
40
- "repository": {
41
- "type": "git",
42
- "url": "https://github.com/paras-swan/swan-ai-measurements.git"
43
- },
44
- "keywords": [
45
- "swan",
46
- "ai",
47
- "fitview"
48
- ],
49
- "author": "paras",
50
- "license": "ISC",
51
- "bugs": {
52
- "url": "https://github.com/paras-swan/swan-ai-measurements/issues"
53
- },
54
- "homepage": "https://github.com/paras-swan/swan-ai-measurements#readme",
55
- "devDependencies": {
56
- "nodemon": "^3.1.0"
57
- }
58
- }
1
+ {
2
+ "name": "@swan-admin/swan-ai-measurements",
3
+ "version": "1.0.99",
4
+ "description": "provides ai measurement suggestion",
5
+ "main": "dist/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./dist/index.js",
11
+ "import": "./dist/esm/index.js"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "@types/axios": "^0.14.0",
16
+ "@types/node": "^20.12.12",
17
+ "@uppy/aws-s3-multipart": "^3.11.1",
18
+ "@uppy/core": "^3.11.3",
19
+ "axios": "^1.6.7",
20
+ "socket.io": "^4.7.5",
21
+ "socket.io-client": "^4.7.5",
22
+ "tslib": "^2.6.2",
23
+ "typescript": "^5.4.5",
24
+ "fix-esm": "^1.0.1"
25
+ },
26
+ "scripts": {
27
+ "start": "nodemon dist/index.js",
28
+ "build": "tsc && tsc --project tsconfig.esm.json",
29
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
30
+ "start:dev": "nodemon src/index.ts",
31
+ "start:debug": "nodemon --inspect-brk src/index.ts",
32
+ "start:prod": "node dist/index.js",
33
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
34
+ "test": "jest",
35
+ "test:watch": "jest --watch",
36
+ "test:cov": "jest --coverage",
37
+ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
38
+ "test:e2e": "jest --config ./test/jest-e2e.json"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/paras-swan/swan-ai-measurements.git"
43
+ },
44
+ "keywords": [
45
+ "swan",
46
+ "ai",
47
+ "fitview"
48
+ ],
49
+ "author": "paras",
50
+ "license": "ISC",
51
+ "bugs": {
52
+ "url": "https://github.com/paras-swan/swan-ai-measurements/issues"
53
+ },
54
+ "homepage": "https://github.com/paras-swan/swan-ai-measurements#readme",
55
+ "devDependencies": {
56
+ "nodemon": "^3.1.0"
57
+ }
58
+ }