@swan-admin/swan-ai-measurements 1.0.67 → 1.0.68
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/esm/fileUpload.d.ts +1 -0
- package/dist/esm/fileUpload.js +16 -16
- package/dist/fileUpload.d.ts +1 -0
- package/dist/fileUpload.js +2 -2
- package/package.json +1 -1
- package/src/fileUpload.ts +2 -2
package/dist/esm/fileUpload.d.ts
CHANGED
package/dist/esm/fileUpload.js
CHANGED
|
@@ -18,18 +18,29 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
18
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");
|
|
19
19
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
20
|
};
|
|
21
|
-
var
|
|
21
|
+
var _FileUpload_uppyIns, _FileUpload_accessKey, _FileUpload_Uppy, _FileUpload_AwsS3Multipart;
|
|
22
22
|
import { REQUIRED_MESSAGE, REQUIRED_MESSAGE_FOR_META_DATA, UPPY_FILE_UPLOAD_ENDPOINT } from "./constants";
|
|
23
23
|
import { checkMetaDataValue, checkParameters, fetchData } from "./utils";
|
|
24
24
|
class FileUpload {
|
|
25
25
|
constructor(accessKey) {
|
|
26
|
-
_FileUpload_instances.add(this);
|
|
27
26
|
_FileUpload_uppyIns.set(this, void 0);
|
|
28
27
|
_FileUpload_accessKey.set(this, void 0);
|
|
29
28
|
_FileUpload_Uppy.set(this, void 0);
|
|
30
29
|
_FileUpload_AwsS3Multipart.set(this, void 0);
|
|
31
30
|
__classPrivateFieldSet(this, _FileUpload_accessKey, accessKey, "f");
|
|
32
|
-
|
|
31
|
+
}
|
|
32
|
+
initializeModules() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (!__classPrivateFieldGet(this, _FileUpload_Uppy, "f") || !__classPrivateFieldGet(this, _FileUpload_AwsS3Multipart, "f")) {
|
|
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");
|
|
40
|
+
__classPrivateFieldSet(this, _FileUpload_Uppy, Uppy, "f");
|
|
41
|
+
__classPrivateFieldSet(this, _FileUpload_AwsS3Multipart, AwsS3Multipart, "f");
|
|
42
|
+
}
|
|
43
|
+
});
|
|
33
44
|
}
|
|
34
45
|
uploadFile(_a) {
|
|
35
46
|
return __awaiter(this, arguments, void 0, function* ({ file, arrayMetaData, scanId }) {
|
|
@@ -39,6 +50,7 @@ class FileUpload {
|
|
|
39
50
|
if (!checkMetaDataValue(arrayMetaData)) {
|
|
40
51
|
throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
|
|
41
52
|
}
|
|
53
|
+
yield this.initializeModules();
|
|
42
54
|
return new Promise((resolve, reject) => {
|
|
43
55
|
if (__classPrivateFieldGet(this, _FileUpload_uppyIns, "f")) {
|
|
44
56
|
__classPrivateFieldGet(this, _FileUpload_uppyIns, "f").close();
|
|
@@ -110,17 +122,5 @@ class FileUpload {
|
|
|
110
122
|
});
|
|
111
123
|
}
|
|
112
124
|
}
|
|
113
|
-
_FileUpload_uppyIns = new WeakMap(), _FileUpload_accessKey = new WeakMap(), _FileUpload_Uppy = new WeakMap(), _FileUpload_AwsS3Multipart = new WeakMap()
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
if (!__classPrivateFieldGet(this, _FileUpload_Uppy, "f") || !__classPrivateFieldGet(this, _FileUpload_AwsS3Multipart, "f")) {
|
|
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");
|
|
121
|
-
__classPrivateFieldSet(this, _FileUpload_Uppy, Uppy, "f");
|
|
122
|
-
__classPrivateFieldSet(this, _FileUpload_AwsS3Multipart, AwsS3Multipart, "f");
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
};
|
|
125
|
+
_FileUpload_uppyIns = new WeakMap(), _FileUpload_accessKey = new WeakMap(), _FileUpload_Uppy = new WeakMap(), _FileUpload_AwsS3Multipart = new WeakMap();
|
|
126
126
|
export default FileUpload;
|
package/dist/fileUpload.d.ts
CHANGED
package/dist/fileUpload.js
CHANGED
|
@@ -32,9 +32,8 @@ class FileUpload {
|
|
|
32
32
|
#AwsS3Multipart;
|
|
33
33
|
constructor(accessKey) {
|
|
34
34
|
this.#accessKey = accessKey;
|
|
35
|
-
this.#initializeModules();
|
|
36
35
|
}
|
|
37
|
-
async
|
|
36
|
+
async initializeModules() {
|
|
38
37
|
if (!this.#Uppy || !this.#AwsS3Multipart) {
|
|
39
38
|
// const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
|
|
40
39
|
const Uppy = () => Promise.resolve().then(() => __importStar(require("@uppy/core"))).then(({ default: Uppy }) => Uppy);
|
|
@@ -52,6 +51,7 @@ class FileUpload {
|
|
|
52
51
|
if (!(0, utils_1.checkMetaDataValue)(arrayMetaData)) {
|
|
53
52
|
throw new Error(constants_1.REQUIRED_MESSAGE_FOR_META_DATA);
|
|
54
53
|
}
|
|
54
|
+
await this.initializeModules();
|
|
55
55
|
return new Promise((resolve, reject) => {
|
|
56
56
|
if (this.#uppyIns) {
|
|
57
57
|
this.#uppyIns.close();
|
package/package.json
CHANGED
package/src/fileUpload.ts
CHANGED
|
@@ -27,10 +27,9 @@ export default class FileUpload {
|
|
|
27
27
|
|
|
28
28
|
constructor(accessKey: string) {
|
|
29
29
|
this.#accessKey = accessKey;
|
|
30
|
-
this.#initializeModules();
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
async
|
|
32
|
+
async initializeModules() {
|
|
34
33
|
if (!this.#Uppy || !this.#AwsS3Multipart) {
|
|
35
34
|
// const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
|
|
36
35
|
const Uppy = () => import("@uppy/core").then(({ default: Uppy }) => Uppy);
|
|
@@ -49,6 +48,7 @@ export default class FileUpload {
|
|
|
49
48
|
if (!checkMetaDataValue(arrayMetaData)) {
|
|
50
49
|
throw new Error(REQUIRED_MESSAGE_FOR_META_DATA);
|
|
51
50
|
}
|
|
51
|
+
await this.initializeModules();
|
|
52
52
|
|
|
53
53
|
return new Promise((resolve, reject) => {
|
|
54
54
|
if (this.#uppyIns) {
|