@e-mc/cloud 0.11.8 → 0.12.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # @e-mc/cloud
2
2
 
3
- * NodeJS 16 LTS
4
- * ES2021
3
+ * NodeJS 18
4
+ * ES2022
5
5
 
6
6
  ## General Usage
7
7
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.11.8/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.12.1/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { IHost, IScopeOrigin } from "./index";
@@ -175,12 +175,12 @@ const rows = await instance.getDatabaseRows({ service: "aws-v3", credential: "ma
175
175
 
176
176
  ## References
177
177
 
178
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/asset.d.ts
179
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/cloud.d.ts
180
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/core.d.ts
181
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/db.d.ts
182
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/logger.d.ts
183
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/settings.d.ts
178
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/asset.d.ts
179
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/cloud.d.ts
180
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/core.d.ts
181
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/db.d.ts
182
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/logger.d.ts
183
+ - https://www.unpkg.com/@e-mc/types@0.12.1/lib/settings.d.ts
184
184
 
185
185
  ## LICENSE
186
186
 
package/index.js CHANGED
@@ -4,6 +4,7 @@ const fs = require("node:fs");
4
4
  const crypto = require("node:crypto");
5
5
  const types_1 = require("@e-mc/types");
6
6
  const core_1 = require("@e-mc/core");
7
+ const kCloud = Symbol.for('cloud:constructor');
7
8
  const SERVICE_CLIENT = new Map();
8
9
  const SERVICE_UPLOAD = {};
9
10
  const SERVICE_DOWNLOAD = {};
@@ -61,13 +62,16 @@ function errorResponse(instance, service, bucket, err) {
61
62
  const errorObject = (err, service, value) => err instanceof Error ? err : typeof err === 'string' ? new Error(err) : (0, types_1.errorMessage)(service, value);
62
63
  const assignFilename = (value) => crypto.randomUUID() + (path.extname(value) || '');
63
64
  class Cloud extends core_1.ClientDb {
64
- constructor() {
65
- super(...arguments);
66
- this._moduleName = 'cloud';
67
- this._threadable = true;
68
- this.uploaded = [];
69
- this.downloaded = [];
70
- }
65
+ static [kCloud] = true;
66
+ static STORE_RESULT_PARTITION_SIZE = 16;
67
+ static STORE_RESULT_PARTITION_MULT = 2;
68
+ static LOG_CLOUD_FAIL = core_1.ClientDb.LOG_STYLE_FAIL;
69
+ static LOG_CLOUD_COMMAND = Object.freeze({ titleColor: 'blue' });
70
+ static LOG_CLOUD_WARN = Object.freeze({ titleColor: 'yellow' });
71
+ static LOG_CLOUD_UPLOAD = Object.freeze({ titleColor: 'green' });
72
+ static LOG_CLOUD_DOWNLOAD = Object.freeze({ titleColor: 'cyan' });
73
+ static LOG_CLOUD_DELETE = Object.freeze({ titleColor: 'grey' });
74
+ static LOG_CLOUD_DELAYED = Object.freeze({ titleColor: 'grey' });
71
75
  static async finalize(instance) {
72
76
  if (instance.aborted) {
73
77
  return (0, types_1.createAbortError)(true);
@@ -516,6 +520,10 @@ class Cloud extends core_1.ClientDb {
516
520
  }
517
521
  return assets;
518
522
  }
523
+ _moduleName = 'cloud';
524
+ _threadable = true;
525
+ uploaded = [];
526
+ downloaded = [];
519
527
  setQueryResult(service, credential, queryString, result, sessionKey) {
520
528
  if (!Array.isArray(result)) {
521
529
  result = typeof result === 'object' ? [result] : [];
@@ -870,13 +878,4 @@ class Cloud extends core_1.ClientDb {
870
878
  throw service ? (0, types_1.errorMessage)(service, "Cloud provider not found") : (0, types_1.errorValue)("Cloud provider not found");
871
879
  }
872
880
  }
873
- Cloud.STORE_RESULT_PARTITION_SIZE = 16;
874
- Cloud.STORE_RESULT_PARTITION_MULT = 2;
875
- Cloud.LOG_CLOUD_FAIL = core_1.ClientDb.LOG_STYLE_FAIL;
876
- Cloud.LOG_CLOUD_COMMAND = Object.freeze({ titleColor: 'blue' });
877
- Cloud.LOG_CLOUD_WARN = Object.freeze({ titleColor: 'yellow' });
878
- Cloud.LOG_CLOUD_UPLOAD = Object.freeze({ titleColor: 'green' });
879
- Cloud.LOG_CLOUD_DOWNLOAD = Object.freeze({ titleColor: 'cyan' });
880
- Cloud.LOG_CLOUD_DELETE = Object.freeze({ titleColor: 'grey' });
881
- Cloud.LOG_CLOUD_DELAYED = Object.freeze({ titleColor: 'grey' });
882
881
  module.exports = Cloud;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/cloud",
3
- "version": "0.11.8",
3
+ "version": "0.12.1",
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.11.8",
24
- "@e-mc/db": "0.11.8",
25
- "@e-mc/types": "0.11.8",
23
+ "@e-mc/core": "0.12.1",
24
+ "@e-mc/db": "0.12.1",
25
+ "@e-mc/types": "0.12.1",
26
26
  "mime-types": "^2.1.35"
27
27
  }
28
28
  }
package/util.d.ts CHANGED
@@ -4,8 +4,6 @@ import type { AuthValue } from '@e-mc/types/lib/http';
4
4
  import type { Readable } from 'node:stream';
5
5
 
6
6
  declare namespace util {
7
- /** @deprecated Types.IMPORT_MAP */
8
- const IMPORTS: Record<string, string | undefined>;
9
7
  function readableAsBuffer(from: Readable): Promise<Buffer | null>;
10
8
  function createKeyAndBody<T = Buffer>(filename: string, items: UploadContent[], chunkSize?: number | string | FunctionType<void>, errorCallback?: FunctionType<void> | number, flags?: number): [string[], T[], string[]];
11
9
  function generateFilename(filename: string): (i: number) => [string, boolean];
package/util.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.hasBasicAuth = exports.getBasicAuth = exports.IMPORTS = void 0;
2
+ exports.hasBasicAuth = exports.getBasicAuth = void 0;
3
3
  exports.readableAsBuffer = readableAsBuffer;
4
4
  exports.createKeyAndBody = createKeyAndBody;
5
5
  exports.generateFilename = generateFilename;
@@ -9,7 +9,6 @@ const fs = require("node:fs");
9
9
  const stream = require("node:stream");
10
10
  const mime = require("mime-types");
11
11
  const types_1 = require("@e-mc/types");
12
- Object.defineProperty(exports, "IMPORTS", { enumerable: true, get: function () { return types_1.IMPORT_MAP; } });
13
12
  const util_1 = require("@e-mc/db/util");
14
13
  Object.defineProperty(exports, "getBasicAuth", { enumerable: true, get: function () { return util_1.getBasicAuth; } });
15
14
  Object.defineProperty(exports, "hasBasicAuth", { enumerable: true, get: function () { return util_1.hasBasicAuth; } });