@e-mc/core 0.12.4 → 0.12.5
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 +13 -13
- package/index.js +2 -2
- package/package.json +4 -5
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.12.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.12.5/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, LogStatus, WorkerAction } from "./squared";
|
|
@@ -21,7 +21,7 @@ import type { LogState, StatusType } from "./logger";
|
|
|
21
21
|
import type { Settings } from "./node";
|
|
22
22
|
import type { ClientDbSettings, ClientModule, ClientSettings, DbCacheValue, DbCoerceSettings, DbCoerceValue, DbSourceOptions } from "./settings";
|
|
23
23
|
|
|
24
|
-
import type {
|
|
24
|
+
import type { Transferable, Worker, WorkerOptions } from "node:worker_threads";
|
|
25
25
|
|
|
26
26
|
import type * as EventEmitter from "node:events";
|
|
27
27
|
|
|
@@ -170,9 +170,9 @@ interface WorkerGroupConstructor {
|
|
|
170
170
|
|
|
171
171
|
interface IWorkerChannel extends EventEmitter {
|
|
172
172
|
[Symbol.iterator](): IteratorObject<Worker, BuiltinIteratorReturn>;
|
|
173
|
-
sendObject(data: unknown, transferList?:
|
|
173
|
+
sendObject(data: unknown, transferList?: Transferable[], callback?: WorkerChannelResponse<unknown>, ...returnArgs: unknown[]): Worker;
|
|
174
174
|
sendBuffer(data: Buffer, shared?: boolean, callback?: WorkerChannelResponse<unknown>, ...returnArgs: unknown[]): Worker | null;
|
|
175
|
-
send(data: unknown, transferList?:
|
|
175
|
+
send(data: unknown, transferList?: Transferable[]): Promise<unknown>;
|
|
176
176
|
drop(count?: number): Promise<number>;
|
|
177
177
|
join(group: IWorkerGroup, label?: string): void;
|
|
178
178
|
quit(): void;
|
|
@@ -201,13 +201,13 @@ interface IWorkerChannel extends EventEmitter {
|
|
|
201
201
|
on(event: "online", listener: () => void): this;
|
|
202
202
|
on(event: "message", listener: (value: any) => void): this;
|
|
203
203
|
on(event: "data", listener: (data: unknown) => void): this;
|
|
204
|
-
on(event: "pass", listener: (data: unknown, transferList:
|
|
204
|
+
on(event: "pass", listener: (data: unknown, transferList: Transferable[] | undefined) => void): this;
|
|
205
205
|
once(event: "error" | "messageerror" | "abort", listener: (err: Error) => void): this;
|
|
206
206
|
once(event: "exit", listener: (exitCode: number) => void): this;
|
|
207
207
|
once(event: "online", listener: () => void): this;
|
|
208
208
|
once(event: "message", listener: (value: any) => void): this;
|
|
209
209
|
once(event: "data", listener: (data: unknown) => void): this;
|
|
210
|
-
once(event: "pass", listener: (data: unknown, transferList:
|
|
210
|
+
once(event: "pass", listener: (data: unknown, transferList: Transferable[] | undefined) => void): this;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
interface WorkerChannelConstructor {
|
|
@@ -318,13 +318,13 @@ NOTE: **@e-mc/core** is mostly a collection of abstract base classes which canno
|
|
|
318
318
|
|
|
319
319
|
## References
|
|
320
320
|
|
|
321
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
322
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
323
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
324
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
325
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
326
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
327
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
321
|
+
- https://www.unpkg.com/@e-mc/types@0.12.5/lib/squared.d.ts
|
|
322
|
+
- https://www.unpkg.com/@e-mc/types@0.12.5/lib/core.d.ts
|
|
323
|
+
- https://www.unpkg.com/@e-mc/types@0.12.5/lib/db.d.ts
|
|
324
|
+
- https://www.unpkg.com/@e-mc/types@0.12.5/lib/dom.d.ts
|
|
325
|
+
- https://www.unpkg.com/@e-mc/types@0.12.5/lib/logger.d.ts
|
|
326
|
+
- https://www.unpkg.com/@e-mc/types@0.12.5/lib/node.d.ts
|
|
327
|
+
- https://www.unpkg.com/@e-mc/types@0.12.5/lib/settings.d.ts
|
|
328
328
|
|
|
329
329
|
* https://www.npmjs.com/package/@types/node
|
|
330
330
|
|
package/index.js
CHANGED
|
@@ -898,7 +898,7 @@ class ClientDb extends Client {
|
|
|
898
898
|
const key = name + '_' + source;
|
|
899
899
|
const stored = CACHE_SOURCE[key];
|
|
900
900
|
const { enabled, limit = 0, min = 0, max = 0 } = item;
|
|
901
|
-
if (enabled && limit > 0) {
|
|
901
|
+
if (enabled && +limit > 0) {
|
|
902
902
|
let percent = item.percent || 0;
|
|
903
903
|
if ((0, types_1.isString)(percent)) {
|
|
904
904
|
percent = percent.includes('%') ? parseFloat(percent) / 100 : parseFloat(percent);
|
|
@@ -907,7 +907,7 @@ class ClientDb extends Client {
|
|
|
907
907
|
percent /= 100;
|
|
908
908
|
}
|
|
909
909
|
if (percent > 0) {
|
|
910
|
-
(stored || (CACHE_SOURCE[key] = { items: [] })).config = { limit: limit > 0 ? limit : 0, percent: Math.min(percent, 1), min: min > 0 ? min : 0, max: max > 0 ? max : Infinity };
|
|
910
|
+
(stored || (CACHE_SOURCE[key] = { items: [] })).config = { limit: +limit > 0 ? +limit : 0, percent: Math.min(percent, 1), min: min > 0 ? min : 0, max: max > 0 ? max : Infinity };
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
913
|
else if (stored) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.5",
|
|
4
4
|
"description": "Core modules for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -13,15 +13,14 @@
|
|
|
13
13
|
"directory": "src/core"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
|
-
"squared"
|
|
17
|
-
"squared-functions"
|
|
16
|
+
"squared"
|
|
18
17
|
],
|
|
19
18
|
"author": "An Pham <anpham6@gmail.com>",
|
|
20
19
|
"license": "BSD-3-Clause",
|
|
21
20
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"@e-mc/module": "0.12.
|
|
24
|
-
"@e-mc/types": "0.12.
|
|
22
|
+
"@e-mc/module": "0.12.5",
|
|
23
|
+
"@e-mc/types": "0.12.5",
|
|
25
24
|
"ipaddr.js": "^2.2.0",
|
|
26
25
|
"picomatch": "^4.0.3"
|
|
27
26
|
}
|