@e-mc/cloud 0.9.0 → 0.9.2

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/LICENSE CHANGED
@@ -1,11 +1,11 @@
1
- Copyright 2024 An Pham
2
-
3
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
-
5
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
-
7
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
-
9
- 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
-
1
+ Copyright 2024 An Pham
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
11
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @e-mc/cloud
2
2
 
3
- * NodeJS 14/16
3
+ * NodeJS 16
4
4
  * ES2020
5
5
 
6
6
  ## General Usage
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.9.0/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.9.2/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { IHost, IScopeOrigin } from "./index";
@@ -172,30 +172,14 @@ Promise.all([
172
172
  const rows = await instance.getDatabaseRows({ service: "aws-v3", credential: "main", table: "demo", key: { id: 1 } });
173
173
  ```
174
174
 
175
- ## NodeJS 14 LTS
176
-
177
- Any optional fail safe dependencies were removed as of `E-mc 0.9`. The code itself will still be *ES2020* and will continue to work equivalently when self-installing these dependencies:
178
-
179
- ### Under 15.4 + 16.0
180
-
181
- ```sh
182
- npm i abort-controller event-target-shim
183
- ```
184
-
185
- ### Under 14.17 + 15.6
186
-
187
- ```sh
188
- npm i uuid
189
- ```
190
-
191
175
  ## References
192
176
 
193
- - https://www.unpkg.com/@e-mc/types@0.9.0/lib/asset.d.ts
194
- - https://www.unpkg.com/@e-mc/types@0.9.0/lib/cloud.d.ts
195
- - https://www.unpkg.com/@e-mc/types@0.9.0/lib/core.d.ts
196
- - https://www.unpkg.com/@e-mc/types@0.9.0/lib/db.d.ts
197
- - https://www.unpkg.com/@e-mc/types@0.9.0/lib/logger.d.ts
198
- - https://www.unpkg.com/@e-mc/types@0.9.0/lib/settings.d.ts
177
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/asset.d.ts
178
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/cloud.d.ts
179
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/core.d.ts
180
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/db.d.ts
181
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/logger.d.ts
182
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/settings.d.ts
199
183
 
200
184
  ## LICENSE
201
185
 
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { CloudConstructor, IFileManager } from '../types/lib';
2
- import type { CloudAsset } from '../types/lib/cloud';
3
-
4
- declare const Cloud: CloudConstructor<IFileManager<CloudAsset>>;
5
-
1
+ import type { CloudConstructor, IFileManager } from '../types/lib';
2
+ import type { CloudAsset } from '../types/lib/cloud';
3
+
4
+ declare const Cloud: CloudConstructor<IFileManager<CloudAsset>>;
5
+
6
6
  export = Cloud;
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
- try {
626
- const flags = upload.flags || 0;
627
- 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) => {
628
- if (err) {
629
- reject(errorObject(err, service, "Upload failed"));
630
- }
631
- else if (value) {
632
- if (beforeResolve) {
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
- catch (err) {
644
- reject(err);
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
- try {
665
- handler({ bucket, download }, async (err, value) => {
666
- if (err) {
667
- reject(errorObject(err, service, "Download failed"));
668
- }
669
- else if (value) {
670
- if (beforeResolve) {
671
- const output = await beforeResolve(value);
672
- if ((0, types_1.isString)(output)) {
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
- else {
683
- reject((0, types_1.errorMessage)(service, "Download failed"));
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
- catch (err) {
688
- reject(err);
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.0",
3
+ "version": "0.9.2",
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.0",
24
- "@e-mc/db": "0.9.0",
25
- "@e-mc/types": "0.9.0",
23
+ "@e-mc/core": "0.9.2",
24
+ "@e-mc/db": "0.9.2",
25
+ "@e-mc/types": "0.9.2",
26
26
  "mime-types": "^2.1.35"
27
27
  }
28
28
  }