@e-mc/core 0.8.3 → 0.8.4
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 +174 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,178 @@
|
|
|
1
|
-
|
|
1
|
+
# @e-mc/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
* NodeJS 14
|
|
4
|
+
* ES2020
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## General Usage
|
|
7
|
+
|
|
8
|
+
* [Read the Docs](https://e-mc.readthedocs.io)
|
|
9
|
+
|
|
10
|
+
## Interface
|
|
11
|
+
|
|
12
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/index.d.ts
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { DataSource, LogStatus } from "./squared";
|
|
16
|
+
|
|
17
|
+
import type { IHost, IModule, ModuleConstructor } from "./index";
|
|
18
|
+
import type { CacheOptions, HostInitConfig, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, StoreResultOptions, ThreadCountStat } from "./core";
|
|
19
|
+
import type { QueryResult, TimeoutAction } from "./db";
|
|
20
|
+
import type { AddEventListenerOptions } from "./dom";
|
|
21
|
+
import type { StatusType } from "./logger";
|
|
22
|
+
import type { Settings } from "./node";
|
|
23
|
+
import type { ClientDbSettings, ClientModule, ClientSettings, DbCacheValue, DbCoerceSettings, DbCoerceValue, DbSourceOptions } from "./settings";
|
|
24
|
+
|
|
25
|
+
interface IHost extends IModule {
|
|
26
|
+
restartable: boolean;
|
|
27
|
+
readonly modules: Set<IModule>;
|
|
28
|
+
readonly subProcesses: Set<IModule>;
|
|
29
|
+
readonly startTime: number;
|
|
30
|
+
using(...items: unknown[] | [boolean, ...unknown[]]): this;
|
|
31
|
+
contains(item: unknown, condition?: (...args: any[]) => boolean): boolean;
|
|
32
|
+
find(name: string): IModule | undefined;
|
|
33
|
+
findAll(name: string): IModule[];
|
|
34
|
+
willLog(name: string): boolean;
|
|
35
|
+
ignoreLog(values: boolean | string | string[]): void;
|
|
36
|
+
collectLog(level?: boolean): LogStatus<StatusType>[];
|
|
37
|
+
willAbort(value: string | IModule): boolean;
|
|
38
|
+
loadModule(name: string, ...args: any[]): IModule | null;
|
|
39
|
+
retain(process: IModule): void;
|
|
40
|
+
release(process: IModule, log?: boolean): boolean;
|
|
41
|
+
restart(...args: unknown[]): void;
|
|
42
|
+
joinQueue(options?: JoinQueueOptions): boolean;
|
|
43
|
+
resumeThread?(options: ResumeThreadOptions): void;
|
|
44
|
+
set host(value);
|
|
45
|
+
get host(): null;
|
|
46
|
+
get config(): Readonly<HostInitConfig>;
|
|
47
|
+
get errorCount(): number;
|
|
48
|
+
get username(): string;
|
|
49
|
+
set done(value);
|
|
50
|
+
get done(): boolean;
|
|
51
|
+
get queued(): boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface HostConstructor extends ModuleConstructor {
|
|
55
|
+
loadSettings(settings: Settings, password?: string): boolean;
|
|
56
|
+
loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
|
|
57
|
+
isPermission(value: unknown): value is IPermission;
|
|
58
|
+
createPermission(all?: boolean, freeze?: boolean): IPermission;
|
|
59
|
+
kill(username: string, iv: BinaryLike, all: true): number;
|
|
60
|
+
kill(username: string, iv: BinaryLike, pid: number | number[] | boolean): number;
|
|
61
|
+
getThreadCount(full: true): ThreadCountStat;
|
|
62
|
+
getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
|
|
63
|
+
getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
|
|
64
|
+
getPermissionFromSettings(): IPermission;
|
|
65
|
+
readonly prototype: IHost;
|
|
66
|
+
new(config?: HostInitConfig): IHost;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface IClient extends IModule<IHost> {
|
|
70
|
+
module: ClientModule;
|
|
71
|
+
init(...args: unknown[]): this;
|
|
72
|
+
getUserSettings(): unknown;
|
|
73
|
+
get settings(): ClientSettings;
|
|
74
|
+
set cacheDir(value: string);
|
|
75
|
+
get cacheDir(): string;
|
|
76
|
+
set extensions(values: unknown[]);
|
|
77
|
+
get extensions(): ((...args: unknown[]) => unknown)[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface ClientConstructor extends ModuleConstructor {
|
|
81
|
+
readonly prototype: IClient;
|
|
82
|
+
new(module?: ClientModule): IClient;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface IClientDb extends IClient<IHost, ClientModule<ClientDbSettings>> {
|
|
86
|
+
database: DataSource[];
|
|
87
|
+
cacheExpires: number;
|
|
88
|
+
add(item: DataSource, state?: number): void;
|
|
89
|
+
hasCache(source: string, sessionKey?: string, override?: DbCacheValue): boolean;
|
|
90
|
+
hasCoerce(source: string, component: keyof DbCoerceSettings, uuidKey: string | undefined): boolean;
|
|
91
|
+
hasCoerce(source: string, component: keyof DbCoerceSettings, override: DbCoerceValue | null | undefined, credential?: unknown): boolean;
|
|
92
|
+
hasCoerce(source: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
|
|
93
|
+
getQueryResult(source: string, credential: unknown, queryString: string, renewCache: boolean): QueryResult | undefined;
|
|
94
|
+
getQueryResult(source: string, credential: unknown, queryString: string, sessionKey: string, renewCache?: boolean): QueryResult | undefined;
|
|
95
|
+
getQueryResult(source: string, credential: unknown, queryString: string, options?: CacheOptions | string, renewCache?: boolean): QueryResult | undefined;
|
|
96
|
+
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey: string | undefined): QueryResult;
|
|
97
|
+
setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
|
|
98
|
+
applyState(items: DataSource | DataSource[], value: number, as?: boolean): void;
|
|
99
|
+
commit(items?: DataSource[]): Promise<boolean>;
|
|
100
|
+
valueOfKey(credential: unknown, name: keyof DbSourceOptions, component?: keyof DbCoerceSettings): unknown;
|
|
101
|
+
settingsOf(source: string, name: keyof DbSourceOptions, component?: keyof DbCoerceSettings): unknown;
|
|
102
|
+
settingsKey(uuidKey: string, name: keyof DbSourceOptions, component?: keyof DbCoerceSettings): unknown;
|
|
103
|
+
get pending(): DataSource[];
|
|
104
|
+
get committed(): DataSource[];
|
|
105
|
+
get failed(): DataSource[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface ClientDbConstructor extends ClientConstructor<IHost, ClientModule> {
|
|
109
|
+
STORE_RESULT_PARTITION_SIZE: number;
|
|
110
|
+
STORE_RESULT_PARTITION_MULT: number;
|
|
111
|
+
readonly TRANSACTION_ACTIVE: number;
|
|
112
|
+
readonly TRANSACTION_PARTIAL: number;
|
|
113
|
+
readonly TRANSACTION_COMMIT: number;
|
|
114
|
+
readonly TRANSACTION_TERMINATE: number;
|
|
115
|
+
readonly TRANSACTION_ABORT: number;
|
|
116
|
+
readonly TRANSACTION_FAIL: number;
|
|
117
|
+
loadSettings(settings: Pick<Settings, "process" | "memory">, password?: string) : boolean;
|
|
118
|
+
getTimeout(value: number | string | TimeoutAction | undefined): number;
|
|
119
|
+
convertTime(value: number | string): number;
|
|
120
|
+
findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean): QueryResult | undefined;
|
|
121
|
+
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, options: StoreResultOptions): QueryResult;
|
|
122
|
+
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, sessionKey: string, sessionExpires: number): QueryResult;
|
|
123
|
+
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue): QueryResult;
|
|
124
|
+
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue | undefined, options: StoreResultOptions): QueryResult;
|
|
125
|
+
purgeResult(prefix?: string): Promise<number>;
|
|
126
|
+
extractUUID(credential: unknown): string;
|
|
127
|
+
setPoolConfig(value: unknown): void;
|
|
128
|
+
getPoolConfig(source: string): unknown;
|
|
129
|
+
keyOfResult(source: string, credential: unknown, uuidOnly?: boolean): string;
|
|
130
|
+
readonly prototype: IClientDb;
|
|
131
|
+
new(module?: ClientModule, database?: DataSource[]): IClientDb;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface IAbortComponent extends AbortController {
|
|
135
|
+
reset(): void;
|
|
136
|
+
get aborted(): boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface AbortComponentConstructor {
|
|
140
|
+
attach(instance: IAbortComponent, signal: AbortSignal, options?: AddEventListenerOptions): void;
|
|
141
|
+
detach(instance: IAbortComponent, signal: AbortSignal): void;
|
|
142
|
+
readonly prototype: IAbortComponent;
|
|
143
|
+
new(): IAbortComponent;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface IPermission {
|
|
147
|
+
setDiskRead(pathname?: string | string[], enabled?: boolean): void;
|
|
148
|
+
setDiskWrite(pathname?: string | string[], enabled?: boolean): void;
|
|
149
|
+
setUNCRead(pathname?: string | string[], enabled?: boolean): void;
|
|
150
|
+
setUNCWrite(pathname?: string | string[], enabled?: boolean): void;
|
|
151
|
+
getDiskRead(): string | string[];
|
|
152
|
+
getDiskWrite(): string | string[];
|
|
153
|
+
getUNCRead(): string | string[];
|
|
154
|
+
getUNCWrite(): string | string[];
|
|
155
|
+
hasDiskRead(pathname: string): boolean;
|
|
156
|
+
hasDiskWrite(pathname: string): boolean;
|
|
157
|
+
hasUNCRead(pathname: string): boolean;
|
|
158
|
+
hasUNCWrite(pathname: string): boolean;
|
|
159
|
+
get diskRead(): boolean;
|
|
160
|
+
get diskWrite(): boolean;
|
|
161
|
+
get uncRead(): boolean;
|
|
162
|
+
get uncWrite(): boolean;
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## References
|
|
167
|
+
|
|
168
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/squared.d.ts
|
|
169
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/core.d.ts
|
|
170
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/db.d.ts
|
|
171
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/dom.d.ts
|
|
172
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/logger.d.ts
|
|
173
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/node.d.ts
|
|
174
|
+
- https://www.unpkg.com/@e-mc/types@0.8.4/lib/settings.d.ts
|
|
175
|
+
|
|
176
|
+
## LICENSE
|
|
6
177
|
|
|
7
178
|
BSD 3-Clause
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "Core modules for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"license": "BSD 3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/module": "0.8.
|
|
24
|
-
"@e-mc/types": "0.8.
|
|
23
|
+
"@e-mc/module": "0.8.4",
|
|
24
|
+
"@e-mc/types": "0.8.4",
|
|
25
25
|
"picomatch": "^3.0.1"
|
|
26
26
|
}
|
|
27
27
|
}
|