@swan-admin/swan-ai-measurements 1.0.66 → 1.0.67

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.
@@ -29,6 +29,7 @@ class FileUpload {
29
29
  _FileUpload_Uppy.set(this, void 0);
30
30
  _FileUpload_AwsS3Multipart.set(this, void 0);
31
31
  __classPrivateFieldSet(this, _FileUpload_accessKey, accessKey, "f");
32
+ __classPrivateFieldGet(this, _FileUpload_instances, "m", _FileUpload_initializeModules).call(this);
32
33
  }
33
34
  uploadFile(_a) {
34
35
  return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
@@ -38,7 +39,6 @@ class FileUpload {
38
39
  if (!checkMetaDataValue(arrayMetaData)) {
39
40
  throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
40
41
  }
41
- yield __classPrivateFieldGet(this, _FileUpload_instances, "m", _FileUpload_initializeModules).call(this);
42
42
  return new Promise((resolve, reject) => {
43
43
  if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
44
44
  __classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
@@ -113,8 +113,11 @@ class FileUpload {
113
113
  _FileUpload_uppyIns = new WeakMap(), _FileUpload_accessKey = new WeakMap(), _FileUpload_Uppy = new WeakMap(), _FileUpload_AwsS3Multipart = new WeakMap(), _FileUpload_instances = new WeakSet(), _FileUpload_initializeModules = function _FileUpload_initializeModules() {
114
114
  return __awaiter(this, void 0, void 0, function* () {
115
115
  if (!__classPrivateFieldGet(this, _FileUpload_Uppy, "f") || !__classPrivateFieldGet(this, _FileUpload_AwsS3Multipart, "f")) {
116
- const { default: Uppy } = yield import("@uppy/core");
117
- const { default: AwsS3Multipart } = yield import("@uppy/aws-s3-multipart");
116
+ // const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
117
+ const Uppy = () => import("@uppy/core").then(({ default: Uppy }) => Uppy);
118
+ const AwsS3Multipart = () => import("@uppy/aws-s3-multipart").then(({ default: AwsS3Multipart }) => AwsS3Multipart);
119
+ // const { default: Uppy } = await import("@uppy/core");
120
+ // const { default: AwsS3Multipart } = await import("@uppy/aws-s3-multipart");
118
121
  __classPrivateFieldSet(this, _FileUpload_Uppy, Uppy, "f");
119
122
  __classPrivateFieldSet(this, _FileUpload_AwsS3Multipart, AwsS3Multipart, "f");
120
123
  }
@@ -32,11 +32,15 @@ class FileUpload {
32
32
  #AwsS3Multipart;
33
33
  constructor(accessKey) {
34
34
  this.#accessKey = accessKey;
35
+ this.#initializeModules();
35
36
  }
36
37
  async #initializeModules() {
37
38
  if (!this.#Uppy || !this.#AwsS3Multipart) {
38
- const { default: Uppy } = await Promise.resolve().then(() => __importStar(require("@uppy/core")));
39
- const { default: AwsS3Multipart } = await Promise.resolve().then(() => __importStar(require("@uppy/aws-s3-multipart")));
39
+ // const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
40
+ const Uppy = () => Promise.resolve().then(() => __importStar(require("@uppy/core"))).then(({ default: Uppy }) => Uppy);
41
+ const AwsS3Multipart = () => Promise.resolve().then(() => __importStar(require("@uppy/aws-s3-multipart"))).then(({ default: AwsS3Multipart }) => AwsS3Multipart);
42
+ // const { default: Uppy } = await import("@uppy/core");
43
+ // const { default: AwsS3Multipart } = await import("@uppy/aws-s3-multipart");
40
44
  this.#Uppy = Uppy;
41
45
  this.#AwsS3Multipart = AwsS3Multipart;
42
46
  }
@@ -48,7 +52,6 @@ class FileUpload {
48
52
  if (!(0, utils_1.checkMetaDataValue)(arrayMetaData)) {
49
53
  throw new Error(constants_1.REQUIRED_MESSAGE_FOR_META_DATA);
50
54
  }
51
- await this.#initializeModules();
52
55
  return new Promise((resolve, reject) => {
53
56
  if (this.#uppyIns) {
54
57
  this.#uppyIns.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.0.66",
3
+ "version": "1.0.67",
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
@@ -27,12 +27,16 @@ export default class FileUpload {
27
27
 
28
28
  constructor(accessKey: string) {
29
29
  this.#accessKey = accessKey;
30
+ this.#initializeModules();
30
31
  }
31
32
 
32
33
  async #initializeModules() {
33
34
  if (!this.#Uppy || !this.#AwsS3Multipart) {
34
- const { default: Uppy } = await import("@uppy/core");
35
- const { default: AwsS3Multipart } = await import("@uppy/aws-s3-multipart");
35
+ // const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
36
+ const Uppy = () => import("@uppy/core").then(({ default: Uppy }) => Uppy);
37
+ const AwsS3Multipart = () => import("@uppy/aws-s3-multipart").then(({ default: AwsS3Multipart }) => AwsS3Multipart);
38
+ // const { default: Uppy } = await import("@uppy/core");
39
+ // const { default: AwsS3Multipart } = await import("@uppy/aws-s3-multipart");
36
40
  this.#Uppy = Uppy;
37
41
  this.#AwsS3Multipart = AwsS3Multipart;
38
42
  }
@@ -46,8 +50,6 @@ export default class FileUpload {
46
50
  throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
47
51
  }
48
52
 
49
- await this.#initializeModules();
50
-
51
53
  return new Promise((resolve, reject) => {
52
54
  if (this.#uppyIns) {
53
55
  this.#uppyIns.close();