@e-mc/cloud 0.9.1 → 0.9.3
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 +7 -7
- package/index.js +33 -43
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.3/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { IHost, IScopeOrigin } from "./index";
|
|
@@ -174,12 +174,12 @@ const rows = await instance.getDatabaseRows({ service: "aws-v3", credential: "ma
|
|
|
174
174
|
|
|
175
175
|
## References
|
|
176
176
|
|
|
177
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
178
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
179
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
180
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
181
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
182
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
177
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/asset.d.ts
|
|
178
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/cloud.d.ts
|
|
179
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/core.d.ts
|
|
180
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/db.d.ts
|
|
181
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/logger.d.ts
|
|
182
|
+
- https://www.unpkg.com/@e-mc/types@0.9.3/lib/settings.d.ts
|
|
183
183
|
|
|
184
184
|
## LICENSE
|
|
185
185
|
|
package/index.js
CHANGED
|
@@ -622,27 +622,22 @@ class Cloud extends core_1.ClientDb {
|
|
|
622
622
|
return Promise.reject(err);
|
|
623
623
|
}
|
|
624
624
|
return new Promise((resolve, reject) => {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
await beforeResolve(value);
|
|
634
|
-
}
|
|
635
|
-
this.addLog(types_1.STATUS_TYPE.INFO, service + ' -> uploadObject', bucket, value);
|
|
636
|
-
resolve(value);
|
|
637
|
-
}
|
|
638
|
-
else {
|
|
639
|
-
reject((0, types_1.errorMessage)(service, "Upload failed"));
|
|
625
|
+
const flags = upload.flags || 0;
|
|
626
|
+
handler({ bucket, upload, buffer: upload.buffer || ((flags & 1) === 0 && (flags & 2) === 0 && (flags & 4) === 0 ? fs.readFileSync(localUri) : Buffer.alloc(0)), localUri }, async (err, value) => {
|
|
627
|
+
if (err) {
|
|
628
|
+
reject(errorObject(err, service, "Upload failed"));
|
|
629
|
+
}
|
|
630
|
+
else if (value) {
|
|
631
|
+
if (beforeResolve) {
|
|
632
|
+
await beforeResolve(value);
|
|
640
633
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
634
|
+
this.addLog(types_1.STATUS_TYPE.INFO, service + ' -> uploadObject', bucket, value);
|
|
635
|
+
resolve(value);
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
reject((0, types_1.errorMessage)(service, "Upload failed"));
|
|
639
|
+
}
|
|
640
|
+
});
|
|
646
641
|
});
|
|
647
642
|
}
|
|
648
643
|
async downloadObject(service, credential, bucket, download, beforeResolve) {
|
|
@@ -661,32 +656,27 @@ class Cloud extends core_1.ClientDb {
|
|
|
661
656
|
return Promise.reject(err);
|
|
662
657
|
}
|
|
663
658
|
return new Promise((resolve, reject) => {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
value = output;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
if (typeof value === 'string' && path.isAbsolute(value)) {
|
|
677
|
-
this.addLog(types_1.STATUS_TYPE.INFO, service + ' -> downloadObject', bucket, value);
|
|
678
|
-
this.downloaded.push(value);
|
|
659
|
+
handler({ bucket, download }, async (err, value) => {
|
|
660
|
+
if (err) {
|
|
661
|
+
reject(errorObject(err, service, "Download failed"));
|
|
662
|
+
}
|
|
663
|
+
else if (value) {
|
|
664
|
+
if (beforeResolve) {
|
|
665
|
+
const output = await beforeResolve(value);
|
|
666
|
+
if ((0, types_1.isString)(output)) {
|
|
667
|
+
value = output;
|
|
679
668
|
}
|
|
680
|
-
resolve(value);
|
|
681
669
|
}
|
|
682
|
-
|
|
683
|
-
|
|
670
|
+
if (typeof value === 'string' && path.isAbsolute(value)) {
|
|
671
|
+
this.addLog(types_1.STATUS_TYPE.INFO, service + ' -> downloadObject', bucket, value);
|
|
672
|
+
this.downloaded.push(value);
|
|
684
673
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
674
|
+
resolve(value);
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
reject((0, types_1.errorMessage)(service, "Download failed"));
|
|
678
|
+
}
|
|
679
|
+
});
|
|
690
680
|
});
|
|
691
681
|
}
|
|
692
682
|
async getDatabaseRows(item, ignoreErrors, sessionKey) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/cloud",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "Cloud constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"license": "BSD 3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/core": "0.9.
|
|
24
|
-
"@e-mc/db": "0.9.
|
|
25
|
-
"@e-mc/types": "0.9.
|
|
23
|
+
"@e-mc/core": "0.9.3",
|
|
24
|
+
"@e-mc/db": "0.9.3",
|
|
25
|
+
"@e-mc/types": "0.9.3",
|
|
26
26
|
"mime-types": "^2.1.35"
|
|
27
27
|
}
|
|
28
28
|
}
|