@e-mc/types 0.0.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.
@@ -0,0 +1,53 @@
1
+ import type { FinalizedElement, ControllerSettingsDirectoryUI as IControllerSettingsDirectoryUI } from './squared';
2
+
3
+ import type { ExternalAsset } from './asset';
4
+ import type { RequestData as IRequestData } from './node';
5
+
6
+ export interface DocumentOutput {
7
+ targetAPI?: NumString;
8
+ manifest?: ManifestData;
9
+ namespace?: string;
10
+ profileable?: boolean | StringOfArray;
11
+ dependencies?: string[];
12
+ directories?: ControllerSettingsDirectoryUI;
13
+ elements?: FinalizedElement[];
14
+ projectName?: string;
15
+ mainParentDir?: string;
16
+ mainSrcDir?: string;
17
+ mainActivityFile?: string;
18
+ javaVersion?: NumString;
19
+ versionName?: string;
20
+ versionCode?: number;
21
+ dataBinding?: boolean;
22
+ commands?: ArrayOf<StringOfArray>;
23
+ extensionData?: PlainObject;
24
+ }
25
+
26
+ export interface RequestData extends IRequestData<ExternalAsset>, DocumentOutput {}
27
+
28
+ export interface ManifestData {
29
+ package?: string;
30
+ application?: {
31
+ supportsRtl?: boolean;
32
+ label?: string;
33
+ theme?: string;
34
+ metaData?: { name?: string; resource?: string; value?: string }[];
35
+ activity?: ObjectMap<{
36
+ layout?: {
37
+ defaultWidth?: string;
38
+ defaultHeight?: string;
39
+ minWidth?: string;
40
+ minHeight?: string;
41
+ gravity?: string;
42
+ };
43
+ }>;
44
+ activityName?: string;
45
+ fontProvider?: string;
46
+ };
47
+ }
48
+
49
+ export interface ControllerSettingsDirectoryUI extends IControllerSettingsDirectoryUI {
50
+ main: string;
51
+ animation: string;
52
+ theme: string;
53
+ }
package/lib/asset.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ import type { BundleAction, FileAsset, LocationUri, MimeTypeAction } from './squared';
2
+
3
+ import type { IFileManager, IModule } from './index';
4
+ import type { IAbortComponent } from './core';
5
+ import type { FetchType } from './filemanager';
6
+
7
+ interface ProcessInit {
8
+ threadCount: number;
9
+ startTime: number;
10
+ timeout: number;
11
+ }
12
+
13
+ export interface BinaryAction {
14
+ binOpts?: string[];
15
+ }
16
+
17
+ export interface FileData<T extends ExternalAsset> extends MimeTypeAction {
18
+ file: T;
19
+ }
20
+
21
+ export interface FileCommand<T extends ExternalAsset> extends FileData<T> {
22
+ command?: string;
23
+ outputType?: string;
24
+ }
25
+
26
+ export interface IFileThread<T extends ExternalAsset = ExternalAsset> extends IAbortComponent, Required<FileData<T>> {
27
+ threadCount: number;
28
+ readonly startTime: number;
29
+ openThread(instance: IModule, timeout?: number): boolean;
30
+ closeThread(instance: IModule, callback?: FunctionType<void>): boolean;
31
+ getObject<U extends FileCommand<T>>(data?: PlainObject): U;
32
+ get host(): IFileManager<T>;
33
+ get queuedTasks(): FunctionType<void>[];
34
+ }
35
+
36
+ export interface FileThreadConstructor<T extends ExternalAsset = ExternalAsset> {
37
+ readonly prototype: IFileThread<T>;
38
+ new(host: IFileManager<T>, file: ExternalAsset, threadCount: number): IFileThread<T>;
39
+ }
40
+
41
+ export interface OutputFinalize<T extends ExternalAsset> extends FileCommand<T> {
42
+ output: string;
43
+ baseDirectory?: string;
44
+ }
45
+
46
+ export interface InitialValue extends Partial<LocationUri>, MimeTypeAction {
47
+ localUri?: string;
48
+ buffer?: Buffer;
49
+ etag?: string;
50
+ cacheable?: boolean;
51
+ }
52
+
53
+ export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction {
54
+ id?: number;
55
+ url?: URL;
56
+ socketPath?: string;
57
+ buffer?: Buffer;
58
+ localUri?: string;
59
+ fetchType?: FetchType;
60
+ sourceUTF8?: string;
61
+ transforms?: string[];
62
+ descendants?: string[];
63
+ torrentFiles?: string[];
64
+ sourceFiles?: string[];
65
+ initialValue?: InitialValue;
66
+ processModule?: ObjectMap<ProcessInit>;
67
+ etag?: string;
68
+ lastModified?: string;
69
+ contentLength?: number;
70
+ invalid?: boolean;
71
+ }
@@ -0,0 +1,106 @@
1
+ import type { AttributeAction, ConditionProperty, CssConditionData, ElementAction, ExcludeAction, FileAsset, FromAction, HashAction, DataSource as IDataSource, ImportAction, MetadataAction, ViewEngine, XmlTagNode } from './squared';
2
+
3
+ import type { UploadAction } from './cloud';
4
+ import type { CascadeAction, DbSource } from './db';
5
+ import type { RequestData as IRequestData } from './node';
6
+
7
+ interface ImportFrom {
8
+ placeholder: string;
9
+ original: string;
10
+ uri: string;
11
+ type?: string;
12
+ dynamic?: boolean;
13
+ }
14
+
15
+ interface DataObject extends CascadeAction {
16
+ format?: string;
17
+ options?: PlainObject;
18
+ }
19
+
20
+ export interface DocumentOutput {
21
+ productionRelease?: boolean | string;
22
+ productionIncremental?: boolean;
23
+ useOriginalHtmlPage?: boolean | string;
24
+ useUnsafeReplace?: ArrayOf<"html" | "css"> | boolean;
25
+ stripCommentsAndCDATA?: boolean | string;
26
+ normalizeHtmlOutput?: boolean | string;
27
+ escapeReservedCharacters?: boolean;
28
+ ignoreServerCodeBlocks?: string[];
29
+ webBundle?: {
30
+ rootDirAlias?: string;
31
+ baseUrl?: string;
32
+ primaryUrl?: string;
33
+ copyTo?: string;
34
+ rewriteHtmlPage?: boolean | string;
35
+ excludeHtmlPage?: boolean;
36
+ excludeTransforms?: boolean;
37
+ includeScopes?: string[];
38
+ excludeScopes?: string[];
39
+ };
40
+ templateMap?: TemplateMap;
41
+ }
42
+
43
+ export interface RequestData extends IRequestData<ChromeAsset>, Readonly<DocumentOutput>, Readonly<CssRuleData> {}
44
+
45
+ export interface ChromeAsset extends FileAsset, AttributeAction, ElementAction, MetadataAction<PlainObject>, UploadAction, HashAction, ExcludeAction, ImportAction<ImportFrom[] | boolean>, FromAction {
46
+ preserve?: boolean;
47
+ static?: boolean;
48
+ editing?: boolean;
49
+ inlineContent?: string;
50
+ originAddress?: boolean;
51
+ }
52
+
53
+ export interface TemplateMap extends PlainObject {
54
+ html?: ObjectMap<StringMap>;
55
+ js?: ObjectMap<StringMap>;
56
+ css?: ObjectMap<StringMap>;
57
+ data?: StringMap;
58
+ }
59
+
60
+ export interface CssRuleData {
61
+ usedVariables?: string[];
62
+ usedFontFace?: string[];
63
+ usedKeyframes?: string[];
64
+ unusedStyles?: string[];
65
+ unusedMedia?: string[];
66
+ unusedContainer?: string[];
67
+ unusedSupports?: string[];
68
+ unusedAtRules?: UnusedAtRule[];
69
+ }
70
+
71
+ export interface UnusedAtRule {
72
+ selector?: string;
73
+ media?: ConditionProperty;
74
+ supports?: ConditionProperty;
75
+ container?: CssConditionData & Partial<ConditionProperty>;
76
+ layer?: string[];
77
+ }
78
+
79
+ export interface DataSource<T = string> extends IDataSource<T>, ElementAction {
80
+ source: "cloud" | "uri" | "local" | "export" | DbSource;
81
+ element?: XmlTagNode;
82
+ type?: "text" | "attribute" | "display";
83
+ dynamic?: boolean;
84
+ value?: StringOfArray | ObjectMap<unknown>;
85
+ template?: string;
86
+ viewEngine?: ViewEngine | string;
87
+ ignoreEmpty?: boolean;
88
+ }
89
+
90
+ export interface UriDataSource extends DataSource, DataObject {
91
+ source: "uri";
92
+ }
93
+
94
+ export interface LocalDataSource extends DataSource, DataObject {
95
+ source: "local";
96
+ pathname?: string;
97
+ }
98
+
99
+ export interface ExportDataSource extends DataSource, CascadeAction {
100
+ source: "export";
101
+ execute?: FunctionType;
102
+ pathname?: string;
103
+ settings?: string;
104
+ params?: unknown;
105
+ persist?: boolean;
106
+ }
package/lib/cloud.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ import type { DbDataSource, LocationUri, StorageAction } from './squared';
2
+
3
+ import type { ExternalAsset } from './asset';
4
+
5
+ export interface UploadAction {
6
+ cloudUrl?: string;
7
+ }
8
+
9
+ export interface CloudAsset<T = CloudStorage> extends ExternalAsset, UploadAction, StorageAction<T> {}
10
+
11
+ export interface CloudService {
12
+ service: string;
13
+ credential?: unknown;
14
+ }
15
+
16
+ export interface CloudDatabase<T = unknown, U = PlainObject, V = unknown, W = unknown> extends CloudService, DbDataSource<T, U, V> {
17
+ id?: string;
18
+ params?: W;
19
+ }
20
+
21
+ export interface CloudStorage extends CloudService {
22
+ bucket?: string;
23
+ admin?: CloudStorageAdmin;
24
+ upload?: CloudStorageUpload;
25
+ download?: CloudStorageDownload;
26
+ }
27
+
28
+ export interface CloudStorageAdmin<T = unknown, U = string, V = unknown> extends CloudStorageACL<U> {
29
+ emptyBucket?: boolean;
30
+ configBucket?: {
31
+ create?: T;
32
+ policy?: V;
33
+ website?: BucketWebsiteOptions;
34
+ };
35
+ recursive?: boolean;
36
+ preservePath?: boolean;
37
+ }
38
+
39
+ export interface CloudStorageAction<T = unknown, U = string, V = unknown> extends Partial<LocationUri> {
40
+ active?: boolean;
41
+ overwrite?: boolean;
42
+ admin?: CloudStorageAdmin<T, U, V>;
43
+ }
44
+
45
+ export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = string> extends CloudStorageACL<U>, CloudStorageAction<V, W> {
46
+ buffer?: Null<Buffer>;
47
+ contentType?: string;
48
+ metadata?: Record<string, string>;
49
+ options?: T;
50
+ fileGroup?: [BufferContent, string, string?][];
51
+ localStorage?: boolean;
52
+ endpoint?: string;
53
+ all?: boolean;
54
+ }
55
+
56
+ export interface CloudStorageACL<T = string> {
57
+ publicRead?: boolean | 0;
58
+ acl?: T;
59
+ }
60
+
61
+ export interface CloudStorageDownload<T = unknown> extends CloudStorageAction {
62
+ versionId?: string;
63
+ deleteObject?: T;
64
+ waitStatus?: boolean;
65
+ }
66
+
67
+ export interface BucketWebsiteOptions {
68
+ indexPage?: string;
69
+ errorPage?: string;
70
+ indexPath?: string;
71
+ errorPath?: string;
72
+ }
73
+
74
+ export interface FunctionData {
75
+ bucket: string;
76
+ }
77
+
78
+ export interface UploadData<T = unknown, U = string, V = unknown, W = string> extends FunctionData {
79
+ upload: CloudStorageUpload<T, U, V, W>;
80
+ localUri: string;
81
+ buffer: Buffer;
82
+ }
83
+
84
+ export interface DownloadData<T = unknown> extends FunctionData {
85
+ download: CloudStorageDownload<T>;
86
+ }
87
+
88
+ export type CloudFeatures = "storage" | "database";
89
+ export type CloudFunctions = "upload" | "download";
@@ -0,0 +1,125 @@
1
+ import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost, IImage, IModule, ImageConstructor, ModuleConstructor, WatchConstructor } from './index';
2
+
3
+ import type { ExternalAsset, IFileThread } from './asset';
4
+ import type { CacheOptions } from './core';
5
+ import type { QueryResult } from './db';
6
+ import type { ITransformSeries, OutV3, TransformSeriesConstructor } from './document';
7
+ import type { IHttpMemoryCache } from './filemanager';
8
+ import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
9
+ import type { CloneObjectOptions, GetFunctionsOptions } from './module';
10
+ import type { LogFailOptions, LogType, LogValue } from './logger';
11
+ import type { HostConfig, OpenOptions, ProxySettings } from './request';
12
+ import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings } from './settings';
13
+
14
+ import type { Readable, Writable } from 'stream';
15
+ import type { OutgoingHttpHeaders } from 'http';
16
+ import type { LookupFunction } from 'net';
17
+
18
+ // @ts-ignore
19
+ import type { BytesOptions } from 'bytes';
20
+
21
+ type CpuUsage = NodeJS.CpuUsage;
22
+
23
+ export interface IModuleLibV4 {
24
+ isString(value: unknown): value is string;
25
+ isObject<T = object>(value: unknown): value is T;
26
+ isPlainObject<T = PlainObject>(value: unknown): value is T;
27
+ escapePattern(value: unknown, lookBehind?: boolean): string;
28
+ generateUUID(format?: string, dictionary?: string): string;
29
+ validateUUID(value: unknown): value is string;
30
+ cloneObject<T, U = unknown>(data: T, options?: boolean | WeakSet<object> | CloneObjectOptions<U>): T;
31
+ coerceObject<T = unknown>(data: T, parseString?: FunctionType<unknown, string> | boolean, cache?: boolean): T;
32
+ asFunction<T = unknown, U = FunctionType<Promise<T> | T>>(value: unknown, sync?: boolean): Null<U>;
33
+ isFileHTTP(value: string | URL): boolean;
34
+ isFileUNC(value: string | URL): boolean;
35
+ isPathUNC(value: string | URL): boolean;
36
+ toTimeMs(hrtime: HighResolutionTime, format?: boolean): NumString;
37
+ renameExt(value: string, ext: string, when?: string): string;
38
+ existsSafe(value: string, isFile?: boolean): boolean;
39
+ readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null<BufferContent>;
40
+ getFunctions<T extends FunctionType>(values: unknown[], absolute?: boolean | GetFunctionsOptions, sync?: boolean, outFailed?: string[]): T[];
41
+ formatSize(value: NumString, options?: BytesOptions): NumString;
42
+ hasSameStat(src: string, dest: string, keepEmpty?: boolean): boolean;
43
+ hasSize(value: string, keepEmpty?: boolean): boolean;
44
+ getSize(value: string, diskUsed?: boolean): number;
45
+ byteLength(value: BufferContent, encoding?: BufferEncoding): number;
46
+ cleanupStream(target: Readable | Writable, pathname?: string): void;
47
+ allSettled: AllSettledMethod;
48
+ }
49
+
50
+ export interface IModuleCompatV4<T extends IHost = IHost> extends IModule<T> {
51
+ set startCPU(value);
52
+ get startCPU(): Null<CpuUsage>;
53
+ }
54
+
55
+ export interface ModuleCompatV4Constructor extends ModuleConstructor, IModuleLibV4 {
56
+ readonly prototype: IModuleCompatV4;
57
+ new(...args: unknown[]): IModuleCompatV4;
58
+ }
59
+
60
+ export interface IFileManagerCompatV4<T extends ExternalAsset = ExternalAsset> extends IFileManager<T> {
61
+ cacheHttpRequest: boolean | FirstOf<string>;
62
+ cacheHttpRequestBuffer: IHttpMemoryCache<T>;
63
+ fetchTimeout: number;
64
+ httpProxy: Null<ProxySettings>;
65
+ acceptEncoding: boolean;
66
+ keepAliveTimeout: number;
67
+ addDns(hostname: string, address: string, family?: NumString): void;
68
+ lookupDns(hostname: string): LookupFunction;
69
+ getHttpProxy(uri: string, localhost?: boolean): Null<ProxySettings>;
70
+ getHttpHeaders(uri: string): Undef<OutgoingHttpHeaders>;
71
+ createHttpRequest(uri: string | URL, options?: OpenOptions): HostConfig;
72
+ getHttpClient(uri: string | URL, options: OpenOptions): HttpRequestClient;
73
+ set httpVersion(value);
74
+ get httpVersion(): Null<HttpProtocolVersion>;
75
+ set ipVersion(value);
76
+ get ipVersion(): InternetProtocolVersion;
77
+ }
78
+
79
+ export interface FileManagerCompatV4Constructor<T extends ExternalAsset = ExternalAsset> extends FileManagerConstructor<T> {
80
+ fromHttpStatusCode(value: NumString): string;
81
+ resetHttpHost(version?: HttpProtocolVersion): void;
82
+ defineHttpBuffer(options: HttpMemorySettings): void;
83
+ defineHttpSettings(options: HttpSettings): void;
84
+ defineHttpAgent(options: HttpAgentSettings): void;
85
+ defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void;
86
+ clearDnsLookup(): void;
87
+ getAria2Path(): string;
88
+ clearHttpBuffer(percent?: number, limit?: number): void;
89
+ readonly prototype: IFileManagerCompatV4<T>;
90
+ new(...args: unknown[]): IFileManagerCompatV4<T>;
91
+ }
92
+
93
+ export interface ImageCompatV4Constructor<T extends IHost = IHost, U extends IImage<T> = IImage<T>> extends ImageConstructor<T, U> {
94
+ using<V extends ExternalAsset>(this: T, instance: U, data: IFileThread<V>, command: string): Promise<unknown>;
95
+ }
96
+
97
+ export interface ICloudCompatV4<T extends IHost = IHost> extends ICloud<T> {
98
+ getDatabaseResult(service: string, credential: unknown, queryString: string, options?: CacheOptions | boolean | string): Undef<QueryResult>;
99
+ setDatabaseResult(service: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
100
+ hasDatabaseCache(service: string, sessionKey?: string): boolean;
101
+ hasDatabaseCoerce(service: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
102
+ }
103
+
104
+ export interface CloudCompatV4Constructor extends CloudConstructor {
105
+ readonly prototype: ICloudCompatV4;
106
+ new(...args: unknown[]): ICloudCompatV4;
107
+ }
108
+
109
+ export interface WatchCompatV4Constructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> extends WatchConstructor<T, U> {
110
+ readCACert(value: string, cache?: boolean): string;
111
+ readTLSKey(value: string, cache?: boolean): string;
112
+ readTLSCert(value: string, cache?: boolean): string;
113
+ isCert(value: string): boolean;
114
+ parseExpires(value: NumString, start?: number): number;
115
+ }
116
+
117
+ export interface ITransformSeriesCompatV4<T = AnyObject, U = T> extends ITransformSeries<T, U>, PropertyAction<OutV3, "out"> {}
118
+
119
+ export interface TransformSeriesCompatV4Constructor extends TransformSeriesConstructor {
120
+ readonly prototype: ITransformSeriesCompatV4;
121
+ new(...args: unknown[]): ITransformSeriesCompatV4;
122
+ }
123
+
124
+ export type SupportedMethod = (major: number, minor?: number, patch?: number, lts?: boolean) => boolean;
125
+ export type AllSettledMethod<T extends boolean = false> = <U>(values: readonly (U | PromiseLike<U>)[], rejected?: LogValue, options?: LogFailOptions | LogType) => Promise<T extends true ? PromiseFulfilledResult<U>[] : PromiseSettledResult<U>[]>;
@@ -0,0 +1,25 @@
1
+ import type { CompressFormat as ICompressFormat } from './squared';
2
+
3
+ import type { LogBaseOptions, LogTime } from './logger';
4
+
5
+ interface CompressFormat extends ICompressFormat, LogBaseOptions {
6
+ filename?: string;
7
+ startTime?: LogTime;
8
+ etag?: string;
9
+ proxyUrl?: string | ((uri: string) => Undef<string>);
10
+ }
11
+
12
+ interface Woff {
13
+ toWoff(this: void, data: BufferLike): Buffer;
14
+ toSfnt(this: void, data: BufferLike): Buffer;
15
+ }
16
+
17
+ type ResultCallback<T = Null<Buffer | Uint8Array>> = (err: unknown, data?: T, ext?: string) => void;
18
+ type ResultData = Null<Buffer | Uint8Array> | string;
19
+
20
+ export type BufferLike = Buffer | Uint8Array | ArrayBuffer | SharedArrayBuffer | ReadonlyArray<number>;
21
+ export type TryFileCompressor = (data: string | Buffer, output: string, config: CompressFormat, callback?: TryFileResult) => Void<Promise<ResultData>>;
22
+ export type TryFileCompressorAsync = (data: string | Buffer, output: string, config: CompressFormat) => Promise<ResultData>;
23
+ export type TryFileResult = ResultCallback<ResultData>;
24
+ export type TryImageResult = ResultCallback;
25
+ export type BufferResult = Null<Buffer | Uint8Array>;
package/lib/core.d.ts ADDED
@@ -0,0 +1,187 @@
1
+ /* eslint @typescript-eslint/no-explicit-any: "off" */
2
+
3
+ import type { DataSource, RequestBase } from './squared';
4
+
5
+ import type { IExternalConfig, IExternalFunction, IHost, IModule, ModuleConstructor } from './index';
6
+ import type { QueryResult, TimeoutAction } from './db';
7
+ import type { AddEventListenerOptions } from './dom';
8
+ import type { Settings } from './node';
9
+ import type { ClientDBSettings, ClientModule, DbCacheValue, DbCoerceSettings, DbCoerceValue, DbSourceOptions } from './settings';
10
+
11
+ export interface IdentifierAction {
12
+ uuidKey?: string;
13
+ }
14
+
15
+ export interface IClient<T extends IHost, U extends ClientModule, V extends FunctionType = FunctionType> extends IModule<T>, IExternalConfig<U, U extends ClientModule<infer W> ? W : unknown>, IExternalFunction<V> {
16
+ init(...args: unknown[]): this;
17
+ set cacheDir(value: string);
18
+ get cacheDir(): string;
19
+ }
20
+
21
+ export interface ClientConstructor<T extends IHost = IHost, U extends ClientModule = ClientModule> extends ModuleConstructor {
22
+ readonly prototype: IClient<T, U>;
23
+ new(module?: U): IClient<T, U>;
24
+ }
25
+
26
+ export interface IClientDb<T extends IHost, U extends ClientModule<ClientDBSettings>, V extends DataSource = DataSource, W extends DbSourceOptions = DbSourceOptions, X extends DbCoerceSettings = DbCoerceSettings> extends IClient<T, U> {
27
+ database: V[];
28
+ cacheExpires: number;
29
+ add(item: V, state?: number): void;
30
+ hasCache(source: string, sessionKey?: string, override?: DbCacheValue): boolean;
31
+ hasCoerce(source: string, component: keyof DbCoerceSettings, uuidKey: Undef<string>): boolean;
32
+ hasCoerce(source: string, component: keyof DbCoerceSettings, override: Optional<DbCoerceValue>, credential?: unknown): boolean;
33
+ hasCoerce(source: string, component: keyof DbCoerceSettings, credential?: unknown): boolean;
34
+ getQueryResult(source: string, credential: unknown, queryString: string, renewCache: boolean): Undef<QueryResult>;
35
+ getQueryResult(source: string, credential: unknown, queryString: string, sessionKey: string, renewCache?: boolean): Undef<QueryResult>;
36
+ getQueryResult(source: string, credential: unknown, queryString: string, options?: CacheOptions | string, renewCache?: boolean): Undef<QueryResult>;
37
+ setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, sessionKey: Undef<string>): QueryResult;
38
+ setQueryResult(source: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult;
39
+ applyState(items: ArrayOf<V>, value: number, as?: boolean): void;
40
+ commit(items?: V[]): Promise<boolean>;
41
+ valueOfKey(credential: unknown, name: keyof W, component?: keyof X): unknown;
42
+ settingsOf(source: string, name: keyof W, component?: keyof X): unknown;
43
+ settingsKey(uuidKey: string, name: keyof W, component?: keyof X): unknown;
44
+ get pending(): V[];
45
+ get committed(): V[];
46
+ get failed(): V[];
47
+ }
48
+
49
+ export interface ClientDbConstructor<T extends IHost = IHost, U extends ClientModule = ClientModule, V extends DataSource = DataSource> extends ClientConstructor<T, U> {
50
+ STORE_RESULT_PARTITION_SIZE: number;
51
+ STORE_RESULT_PARTITION_MULT: number;
52
+ readonly TRANSACTION_ACTIVE: number;
53
+ readonly TRANSACTION_PARTIAL: number;
54
+ readonly TRANSACTION_COMMIT: number;
55
+ readonly TRANSACTION_TERMINATE: number;
56
+ readonly TRANSACTION_ABORT: number;
57
+ readonly TRANSACTION_FAIL: number;
58
+ loadSettings(settings: Pick<Settings, "process" | "memory">, password?: string) : boolean;
59
+ getTimeout(value: Undef<NumString | TimeoutAction>): number;
60
+ convertTime(value: NumString): number;
61
+ findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean): Undef<QueryResult>;
62
+ storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, options: StoreResultOptions): QueryResult;
63
+ storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, sessionKey: string, sessionExpires: number): QueryResult;
64
+ storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue): QueryResult;
65
+ storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: Undef<DbCacheValue>, options: StoreResultOptions): QueryResult;
66
+ purgeResult(prefix?: string): Promise<number>;
67
+ extractUUID(credential: unknown): string;
68
+ setPoolConfig(value: unknown): void;
69
+ getPoolConfig(source: string): unknown;
70
+ keyOfResult(source: string, credential: unknown, uuidOnly?: boolean): string;
71
+ readonly prototype: IClientDb<T, U, V>;
72
+ new(module?: U, database?: V[]): IClientDb<T, U, V>;
73
+ }
74
+
75
+ export interface IAbortComponent extends AbortController {
76
+ reset(): void;
77
+ get aborted(): boolean;
78
+ }
79
+
80
+ export interface AbortComponentConstructor {
81
+ attach(instance: IAbortComponent, signal: AbortSignal, options?: AddEventListenerOptions): void;
82
+ detach(instance: IAbortComponent, signal: AbortSignal): void;
83
+ readonly prototype: IAbortComponent;
84
+ new(): IAbortComponent;
85
+ }
86
+
87
+ export interface IPermission {
88
+ setDiskRead(pathname?: StringOfArray, enabled?: boolean): void;
89
+ setDiskWrite(pathname?: StringOfArray, enabled?: boolean): void;
90
+ setUNCRead(pathname?: StringOfArray, enabled?: boolean): void;
91
+ setUNCWrite(pathname?: StringOfArray, enabled?: boolean): void;
92
+ getDiskRead(): StringOfArray;
93
+ getDiskWrite(): StringOfArray;
94
+ getUNCRead(): StringOfArray;
95
+ getUNCWrite(): StringOfArray;
96
+ hasDiskRead(pathname: string): boolean;
97
+ hasDiskWrite(pathname: string): boolean;
98
+ hasUNCRead(pathname: string): boolean;
99
+ hasUNCWrite(pathname: string): boolean;
100
+ get diskRead(): boolean;
101
+ get diskWrite(): boolean;
102
+ get uncRead(): boolean;
103
+ get uncWrite(): boolean;
104
+ }
105
+
106
+ export interface PermissionConstructor {
107
+ create(settings: PermittedDirectories, freeze?: boolean): Null<IPermission>;
108
+ create(settings: PermittedDirectories, parent: Null<IPermission>, freeze?: boolean): Null<IPermission>;
109
+ validate(settings: unknown): settings is PermittedDirectories;
110
+ clone(permission: IPermission, freeze?: boolean): IPermission;
111
+ match(pathname: string, pattern: StringOfArray): boolean;
112
+ readonly prototype: IPermission;
113
+ new(freeze?: boolean): IPermission;
114
+ }
115
+
116
+ export interface PermissionReadWrite<T = boolean> {
117
+ disk_read?: T;
118
+ disk_write?: T;
119
+ unc_read?: T;
120
+ unc_write?: T;
121
+ }
122
+
123
+ export interface PermissionAction {
124
+ permission?: PermittedDirectories;
125
+ }
126
+
127
+ export interface HostInitConfig extends PlainObject, RequestBase<HostInitLog> {
128
+ username?: string;
129
+ ignoreModules?: string[];
130
+ }
131
+
132
+ export interface HostInitLog {
133
+ enabled?: boolean;
134
+ level?: NumString;
135
+ exclude?: StringOfArray;
136
+ useColor?: boolean;
137
+ }
138
+
139
+ export interface PermittedDirectories extends PermissionReadWrite<StringOfArray> {
140
+ inherit?: boolean;
141
+ }
142
+
143
+ export interface StoreResultOptions {
144
+ cache?: DbCacheValue;
145
+ cacheDir?: string;
146
+ sessionKey?: string;
147
+ sessionExpires?: number;
148
+ }
149
+
150
+ export interface CacheOptions {
151
+ value?: DbCacheValue;
152
+ renewCache?: boolean;
153
+ sessionKey?: string;
154
+ }
155
+
156
+ export interface ThreadInfo {
157
+ pid: number;
158
+ startTime: number;
159
+ username?: string;
160
+ sessionId?: string;
161
+ broadcastId?: StringOfArray;
162
+ }
163
+
164
+ export interface ThreadCountStat {
165
+ count: number;
166
+ pending: number;
167
+ opened?: number;
168
+ closed?: number;
169
+ queued?: number;
170
+ rejected?: number;
171
+ killed?: number;
172
+ startTime?: number;
173
+ previousTime?: number;
174
+ max?: number;
175
+ admin?: ThreadInfo[];
176
+ }
177
+
178
+ export interface JoinQueueOptions {
179
+ args?: unknown[];
180
+ reject?: boolean;
181
+ }
182
+
183
+ export interface ResumeThreadOptions {
184
+ args: unknown[];
185
+ startTime: number;
186
+ aborted?: boolean;
187
+ }