@e-mc/types 0.7.0 → 0.8.0
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/constant.d.ts +5 -1
- package/index.d.ts +2 -1
- package/index.js +17 -7
- package/lib/core.d.ts +4 -2
- package/lib/document.d.ts +5 -0
- package/lib/filemanager.d.ts +1 -0
- package/lib/index.d.ts +7 -3
- package/lib/request.d.ts +2 -1
- package/lib/settings.d.ts +18 -12
- package/lib/squared.d.ts +1 -0
- package/package.json +1 -1
package/constant.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export const enum INTERNAL {
|
|
2
|
-
VERSION = '0.
|
|
2
|
+
VERSION = '0.8.0',
|
|
3
3
|
TEMP_DIR = 'tmp', // eslint-disable-line @typescript-eslint/no-shadow
|
|
4
4
|
CJS = '__cjs__'
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export const enum VAL_MESSAGE {
|
|
8
8
|
SUCCESS = 'Success',
|
|
9
|
+
COMPLETED = 'Completed',
|
|
9
10
|
MODIFIED_DIRECTORY = 'Directory was modified',
|
|
10
11
|
COMMIT_TRANSACTION = 'Transactions were committed'
|
|
11
12
|
}
|
|
@@ -35,6 +36,9 @@ export const enum ERR_MESSAGE {
|
|
|
35
36
|
FAIL = 'FAIL!',
|
|
36
37
|
WARN = 'WARN!',
|
|
37
38
|
ABORTED = 'Aborted',
|
|
39
|
+
ABORTED_HOST = 'Aborted by host',
|
|
40
|
+
ABORTED_CLIENT = 'Aborted by client',
|
|
41
|
+
ABORTED_PROCESS = 'Aborted by process',
|
|
38
42
|
ABORTED_OPERATION = 'The operation was aborted',
|
|
39
43
|
FAILED = 'Failed',
|
|
40
44
|
FAILED_CHECKSUM = 'Checksum did not match',
|
package/index.d.ts
CHANGED
|
@@ -281,11 +281,12 @@ declare namespace types {
|
|
|
281
281
|
function cloneObject<T>(data: T, deepIgnore: WeakSet<object>): T;
|
|
282
282
|
function cloneObject<T, U>(data: T, options?: CloneObjectOptions<U>): T;
|
|
283
283
|
function coerceObject<T = unknown>(data: T, cache: boolean): T;
|
|
284
|
-
function coerceObject<T = unknown>(data: T, parseString?: FunctionArgs<[string]
|
|
284
|
+
function coerceObject<T = unknown>(data: T, parseString?: FunctionArgs<[string]>, cache?: boolean): T;
|
|
285
285
|
function getEncoding(value: unknown, fallback?: BufferEncoding): BufferEncoding;
|
|
286
286
|
function encryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): Undef<string>;
|
|
287
287
|
function decryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): Undef<string>;
|
|
288
288
|
function generateUUID(): string;
|
|
289
|
+
function incrementUUID(restart?: boolean): string;
|
|
289
290
|
function validateUUID(value: unknown): boolean;
|
|
290
291
|
function randomString(format: string, dictionary?: string): string;
|
|
291
292
|
function errorValue(value: string, hint?: string): Error;
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.errorValue = exports.validateUUID = exports.randomString = exports.decryptUTF8 = exports.encryptUTF8 = exports.getEncoding = exports.asFunction = exports.coerceObject = exports.cloneObject = exports.cascadeObject = exports.formatSize = exports.renameExt = exports.escapePattern = exports.hasGlob = exports.convertTime = exports.formatTime = exports.parseExpires = exports.parseTime = exports.isEmpty = exports.isString = exports.isObject = exports.isPlainObject = exports.isArray = exports.setTempDir = exports.getTempDir = exports.setLogCurrent = exports.getLogCurrent = exports.existsFlag = exports.mainFlag = exports.processFlag = exports.modifiedFlag = exports.watchFlag = exports.usingFlag = exports.cloneFlag = exports.ignoreFlag = exports.hasBit = exports.createAbortError = exports.IMPORT_MAP = exports.THRESHOLD = exports.READDIR_SORT = exports.WATCH_EVENT = exports.DB_TRANSACTION = exports.DB_TYPE = exports.FETCH_TYPE = exports.DOWNLOAD_TYPE = exports.ERR_CODE = exports.ASSET_FLAG = exports.FILE_TYPE = exports.STATUS_TYPE = exports.LOG_TYPE = void 0;
|
|
4
|
-
exports.generateUUID = exports.purgeMemory = exports.errorMessage = void 0;
|
|
4
|
+
exports.generateUUID = exports.incrementUUID = exports.purgeMemory = exports.errorMessage = void 0;
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const crypto = require("crypto");
|
|
@@ -20,6 +20,8 @@ const ASYNC_FUNCTION = Object.getPrototypeOf(async () => { }).constructor;
|
|
|
20
20
|
let CACHE_COERCED = new WeakSet();
|
|
21
21
|
let LOG_CURRENT = null;
|
|
22
22
|
let TEMP_DIR = path.join(process.cwd(), "tmp" /* INTERNAL.TEMP_DIR */);
|
|
23
|
+
let INCREMENT_COUNT = 65536;
|
|
24
|
+
let INCREMENT_PREFIX = '';
|
|
23
25
|
function fromObject(value, typedArray) {
|
|
24
26
|
if (isObject(value)) {
|
|
25
27
|
if (value instanceof Map) {
|
|
@@ -402,7 +404,7 @@ function isArray(value) {
|
|
|
402
404
|
}
|
|
403
405
|
exports.isArray = isArray;
|
|
404
406
|
function isPlainObject(value) {
|
|
405
|
-
return
|
|
407
|
+
return typeof value === 'object' && value !== null && (value.constructor === Object || Object.getPrototypeOf(value) === null);
|
|
406
408
|
}
|
|
407
409
|
exports.isPlainObject = isPlainObject;
|
|
408
410
|
function isObject(value) {
|
|
@@ -549,10 +551,10 @@ function escapePattern(value, lookBehind) {
|
|
|
549
551
|
}
|
|
550
552
|
exports.escapePattern = escapePattern;
|
|
551
553
|
function renameExt(value, ext, when) {
|
|
552
|
-
if (ext
|
|
554
|
+
if (!ext.startsWith('.')) {
|
|
553
555
|
ext = '.' + ext;
|
|
554
556
|
}
|
|
555
|
-
if (when && when
|
|
557
|
+
if (when && !when.startsWith('.')) {
|
|
556
558
|
when = '.' + when;
|
|
557
559
|
}
|
|
558
560
|
const index = value.lastIndexOf('.');
|
|
@@ -574,7 +576,7 @@ function formatSize(value, options) {
|
|
|
574
576
|
exports.formatSize = formatSize;
|
|
575
577
|
function cascadeObject(data, query, fallback) {
|
|
576
578
|
if (isObject(data) && isString(query)) {
|
|
577
|
-
const names = query.trim().split(/(?<!\\)\./).map(item => item.
|
|
579
|
+
const names = query.trim().split(/(?<!\\)\./).map(item => item.includes('.') ? item.replace(/\\(?=\.)/g, '') : item);
|
|
578
580
|
for (let i = 0, length = names.length, match, current = data; i < length; ++i) {
|
|
579
581
|
if (!(match = /^(.+?)(?:\[(.+)\])?$/.exec(names[i]))) {
|
|
580
582
|
break;
|
|
@@ -730,7 +732,7 @@ function coerceObject(data, parseString, cache) {
|
|
|
730
732
|
default: {
|
|
731
733
|
const text = match[2].trim();
|
|
732
734
|
let values = []; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
733
|
-
if (text
|
|
735
|
+
if (text.startsWith('[') && text.endsWith(']')) {
|
|
734
736
|
values = JSON.parse(text);
|
|
735
737
|
}
|
|
736
738
|
else if (text) {
|
|
@@ -855,7 +857,7 @@ function randomString(format, dictionary) {
|
|
|
855
857
|
dictionary || (dictionary = '0123456789abcdef');
|
|
856
858
|
const result = format.match(/(\d+|[^\d[]+|\[[^\]]+\]|\[)/g).reduce((a, b) => {
|
|
857
859
|
let length, available;
|
|
858
|
-
if (b
|
|
860
|
+
if (b.startsWith('[') && b.endsWith(']')) {
|
|
859
861
|
length = 1;
|
|
860
862
|
available = b.substring(1, b.length - 1);
|
|
861
863
|
}
|
|
@@ -907,4 +909,12 @@ function purgeMemory(percent) {
|
|
|
907
909
|
CACHE_COERCED = new WeakSet();
|
|
908
910
|
}
|
|
909
911
|
exports.purgeMemory = purgeMemory;
|
|
912
|
+
function incrementUUID(restart) {
|
|
913
|
+
if (restart || INCREMENT_COUNT === 65536) {
|
|
914
|
+
INCREMENT_COUNT = 0;
|
|
915
|
+
INCREMENT_PREFIX = (0, exports.generateUUID)().substring(0, 33);
|
|
916
|
+
}
|
|
917
|
+
return INCREMENT_PREFIX + (INCREMENT_COUNT++).toString(16).padStart(4, '0');
|
|
918
|
+
}
|
|
919
|
+
exports.incrementUUID = incrementUUID;
|
|
910
920
|
exports.generateUUID = typeof crypto.randomUUID === 'function' ? crypto.randomUUID.bind(crypto) : uuid.v4;
|
package/lib/core.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { IExternalConfig, IExternalFunction, IHost, IModule, ModuleConstruc
|
|
|
6
6
|
import type { QueryResult, TimeoutAction } from './db';
|
|
7
7
|
import type { AddEventListenerOptions } from './dom';
|
|
8
8
|
import type { Settings } from './node';
|
|
9
|
-
import type {
|
|
9
|
+
import type { ClientDbSettings, ClientModule, DbCacheValue, DbCoerceSettings, DbCoerceValue, DbSourceOptions } from './settings';
|
|
10
10
|
|
|
11
11
|
export interface IdentifierAction {
|
|
12
12
|
uuidKey?: string;
|
|
@@ -14,6 +14,7 @@ export interface IdentifierAction {
|
|
|
14
14
|
|
|
15
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
16
|
init(...args: unknown[]): this;
|
|
17
|
+
getUserSettings<X>(): Null<X>;
|
|
17
18
|
set cacheDir(value: string);
|
|
18
19
|
get cacheDir(): string;
|
|
19
20
|
}
|
|
@@ -23,7 +24,7 @@ export interface ClientConstructor<T extends IHost = IHost, U extends ClientModu
|
|
|
23
24
|
new(module?: U): IClient<T, U>;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
export interface IClientDb<T extends IHost, U extends ClientModule<
|
|
27
|
+
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
28
|
database: V[];
|
|
28
29
|
cacheExpires: number;
|
|
29
30
|
add(item: V, state?: number): void;
|
|
@@ -109,6 +110,7 @@ export interface PermissionConstructor {
|
|
|
109
110
|
validate(settings: unknown): settings is PermittedDirectories;
|
|
110
111
|
clone(permission: IPermission, freeze?: boolean): IPermission;
|
|
111
112
|
match(pathname: string, pattern: StringOfArray): boolean;
|
|
113
|
+
toPosix(value: unknown): StringOfArray;
|
|
112
114
|
readonly prototype: IPermission;
|
|
113
115
|
new(freeze?: boolean): IPermission;
|
|
114
116
|
}
|
package/lib/document.d.ts
CHANGED
|
@@ -148,6 +148,11 @@ export interface SourceMapConstructor {
|
|
|
148
148
|
new(code: string, uri?: string, remove?: boolean): SourceMap;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
export interface ImportMap {
|
|
152
|
+
imports?: StringMap;
|
|
153
|
+
scopes?: ObjectMap<StringMap>;
|
|
154
|
+
}
|
|
155
|
+
|
|
151
156
|
export interface UpdateGradleOptions {
|
|
152
157
|
multiple?: boolean;
|
|
153
158
|
addendum?: string;
|
package/lib/filemanager.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ export interface FindAssetOptions<T extends ExternalAsset = ExternalAsset> {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
export interface ChecksumOptions extends ReadHashOptions, Pick<ChecksumOutput, "include" | "exclude" | "recursive"> {
|
|
104
|
+
dot?: boolean;
|
|
104
105
|
sortBy?: number;
|
|
105
106
|
verbose?: boolean;
|
|
106
107
|
ignore?: string[];
|
package/lib/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type { CommandData, CropData, QualityData, ResizeData, RotateData, Transf
|
|
|
17
17
|
import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
|
|
18
18
|
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadFileCallback, ReadFileOptions, ReadHashOptions, RemoveDirOptions, WriteFileOptions } from './module';
|
|
19
19
|
import type { RequestData, Settings } from './node';
|
|
20
|
-
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit } from './request';
|
|
20
|
+
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HeadersOnCallback, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit } from './request';
|
|
21
21
|
import type { ClientModule, CloudModule, CloudServiceOptions, CompressModule, CompressSettings, DbCoerceSettings, DbModule, DbSourceOptions, DnsLookupSettings, DocumentComponent, DocumentComponentOption, DocumentModule, HttpConnectSettings, HttpMemorySettings, ImageModule, RequestModule, RequestSettings, TaskModule, WatchModule } from './settings';
|
|
22
22
|
import type { Command, SpawnResult } from './task';
|
|
23
23
|
import type { IFileGroup, ModifiedPostFinalizeListener, SecureOptions, WatchInitResult } from './watch';
|
|
@@ -83,7 +83,7 @@ declare namespace functions {
|
|
|
83
83
|
new(module?: U): ICompress<T, U>;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule> extends IClient<T, U
|
|
86
|
+
interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule> extends IClient<T, U> {
|
|
87
87
|
resizeData?: ResizeData;
|
|
88
88
|
cropData?: CropData;
|
|
89
89
|
rotateData?: RotateData;
|
|
@@ -135,6 +135,7 @@ declare namespace functions {
|
|
|
135
135
|
setCredential(item: V): Promise<void>;
|
|
136
136
|
getCredential<Y = PlainObject>(item: V): Undef<Y>;
|
|
137
137
|
hasSource(source: string, ...type: number[]): boolean;
|
|
138
|
+
applyCommand(...items: V[]): void;
|
|
138
139
|
executeQuery(item: V, sessionKey: string): Promise<QueryResult>;
|
|
139
140
|
executeQuery(item: V, options?: ExecuteQueryOptions | string): Promise<QueryResult>;
|
|
140
141
|
executeBatchQuery(batch: V[], sessionKey: string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
|
|
@@ -212,6 +213,7 @@ declare namespace functions {
|
|
|
212
213
|
loadConfig(data: object, name: string): Optional<ConfigOrTransformer>;
|
|
213
214
|
asSourceFile(value: string, options?: AsSourceFileOptions | boolean): unknown;
|
|
214
215
|
findVersion(name: StringOfArray, fallback?: string): string;
|
|
216
|
+
findSourceScope(uri: string, imports: AnyObject): StringMap[];
|
|
215
217
|
findSourceRoot(uri: string, imports?: StringMap): Undef<string>;
|
|
216
218
|
resolveDir(name: string, ...paths: string[]): Undef<string>;
|
|
217
219
|
locateSourceFiles(file: U, code?: string, bundleContent?: string[]): (imports?: StringMap) => Undef<SourceInput>;
|
|
@@ -222,7 +224,7 @@ declare namespace functions {
|
|
|
222
224
|
settingsOf(name: keyof W, option: keyof X): unknown;
|
|
223
225
|
parseTemplate(viewEngine: ViewEngine | string, template: string, data: unknown[]): Promise<Null<string>>;
|
|
224
226
|
transform(type: string, code: string, format: StringOfArray, options?: TransformOutput & TransformAction): Promise<Void<TransformResult>>;
|
|
225
|
-
abort(name?: keyof W): void;
|
|
227
|
+
abort(name?: keyof W | Error, reason?: unknown): void;
|
|
226
228
|
restart(): void;
|
|
227
229
|
using?(data: IFileThread<U>): Promise<unknown>;
|
|
228
230
|
setLocalUri?(file: U, replace?: boolean): void;
|
|
@@ -303,6 +305,8 @@ declare namespace functions {
|
|
|
303
305
|
addDns(hostname: string, address: string, family?: NumString): void;
|
|
304
306
|
lookupDns(hostname: string): LookupFunction;
|
|
305
307
|
proxyOf(uri: string, localhost?: boolean): Undef<ProxySettings>;
|
|
308
|
+
headersOn(name: ArrayOf<string>, callback: HeadersOnCallback): void;
|
|
309
|
+
headersOn(name: ArrayOf<string>, patternUrl: string, callback: HeadersOnCallback): void;
|
|
306
310
|
headersOf(uri: string): Undef<OutgoingHttpHeaders>;
|
|
307
311
|
aria2c(uri: string | URL, pathname: string): Promise<string[]>;
|
|
308
312
|
aria2c(uri: string | URL, options?: Aria2Options): Promise<string[]>;
|
package/lib/request.d.ts
CHANGED
|
@@ -127,4 +127,5 @@ export interface ApplyOptions extends ProtocolAction, PlainObject {
|
|
|
127
127
|
export type BufferFormat = "json" | "yaml" | "json5" | "xml" | "toml";
|
|
128
128
|
export type ReadExpectType = "always" | "string" | "none";
|
|
129
129
|
export type DataEncodedResult<T extends { encoding?: BufferEncoding }> = T extends { encoding: BufferEncoding } ? string : Null<BufferContent>;
|
|
130
|
-
export type DataObjectResult<T extends { format?: unknown; encoding?: BufferEncoding }> = T extends { format: string | PlainObject } ? Null<object> : DataEncodedResult<T>;
|
|
130
|
+
export type DataObjectResult<T extends { format?: unknown; encoding?: BufferEncoding }> = T extends { format: string | PlainObject } ? Null<object> : DataEncodedResult<T>;
|
|
131
|
+
export type HeadersOnCallback = (value: IncomingHttpHeaders, url?: URL) => Void<boolean>;
|
package/lib/settings.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { WatchInterval } from './squared';
|
|
2
|
+
|
|
1
3
|
import type { PermissionAction, PermissionReadWrite, PermittedDirectories } from './core';
|
|
2
4
|
import type { DbSource, PoolConfig, TimeoutAction } from './db';
|
|
3
5
|
import type { HttpOutgoingHeaders } from './http';
|
|
@@ -29,7 +31,8 @@ export interface HandlerSettings<T = PlainObject> {
|
|
|
29
31
|
|
|
30
32
|
export interface ClientModule<T = ClientSettings> extends HandlerModule<T>, PermissionAction {}
|
|
31
33
|
|
|
32
|
-
export interface ClientSettings extends PlainObject {
|
|
34
|
+
export interface ClientSettings<T = PlainObject> extends PlainObject {
|
|
35
|
+
users?: ObjectMap<T>;
|
|
33
36
|
cache_dir?: string;
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -105,12 +108,12 @@ export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
|
|
|
105
108
|
};
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
export interface DocumentModule<T = DbSettings> extends ClientModule<
|
|
111
|
+
export interface DocumentModule<T = DocumentSettings, U = DbSettings> extends ClientModule<T> {
|
|
109
112
|
eval?: DocumentEval;
|
|
110
113
|
imports?: StringMap;
|
|
111
114
|
versions?: StringMap;
|
|
112
115
|
format?: AnyObject;
|
|
113
|
-
db?: DbModule<
|
|
116
|
+
db?: DbModule<U>;
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
export interface DocumentEval {
|
|
@@ -125,8 +128,9 @@ export interface DocumentGroup<T = { imports?: StringMap } & AnyObject, U = T> {
|
|
|
125
128
|
imports?: StringMap;
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
export interface
|
|
131
|
+
export interface DocumentUserSettings<T = AnyObject, U = T> extends DocumentGroup<T, U>, PlainObject {
|
|
129
132
|
extensions?: Null<string[]>;
|
|
133
|
+
imports_strict?: boolean;
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
export interface DocumentComponent<T = boolean, U = T, V = U> extends Omit<DocumentGroup<T, U>, "pages"> {
|
|
@@ -140,8 +144,8 @@ export interface DocumentComponentOption<T = unknown> {
|
|
|
140
144
|
local_file?: NumString;
|
|
141
145
|
}
|
|
142
146
|
|
|
143
|
-
export interface DocumentSettings extends DocumentGroup, PurgeAction, PlainObject {
|
|
144
|
-
|
|
147
|
+
export interface DocumentSettings extends DocumentGroup, PurgeAction, ClientSettings<DocumentUserSettings>, PlainObject {
|
|
148
|
+
imports_strict?: boolean;
|
|
145
149
|
directory?: DocumentDirectory;
|
|
146
150
|
options?: DocumentComponentOptions;
|
|
147
151
|
}
|
|
@@ -152,7 +156,7 @@ export interface DocumentDirectory extends StringMap {
|
|
|
152
156
|
|
|
153
157
|
export type DocumentComponentOptions = DocumentComponent<DocumentComponentOption<DocumentTransform>, DocumentComponentOption<boolean>>;
|
|
154
158
|
|
|
155
|
-
export interface
|
|
159
|
+
export interface ClientDbSettings<T = PlainObject> extends ClientSettings<T>, PurgeAction {
|
|
156
160
|
session_expires?: number;
|
|
157
161
|
user_key?: ObjectMap<DbSourceOptions>;
|
|
158
162
|
imports?: StringMap;
|
|
@@ -166,7 +170,9 @@ export interface MemorySettings extends PlainObject {
|
|
|
166
170
|
|
|
167
171
|
export interface DbModule<T = DbSettings> extends ClientModule<T>, DbSourceDataType<ObjectMap<StringMap>>, PlainObject {}
|
|
168
172
|
|
|
169
|
-
export interface DbSettings extends
|
|
173
|
+
export interface DbSettings<T = DbUserSettings> extends ClientDbSettings<T>, DbSourceDataType<DbSourceOptions> {}
|
|
174
|
+
|
|
175
|
+
export interface DbUserSettings extends DbSourceDataType<{ commands?: ObjectMap<ObjectMap<PlainObject>> }>, PlainObject {}
|
|
170
176
|
|
|
171
177
|
export interface DbCacheSettings extends TimeoutAction {
|
|
172
178
|
dir?: string;
|
|
@@ -254,9 +260,7 @@ export interface WatchModule<T = WatchSettings> extends HandlerModule<T>, Server
|
|
|
254
260
|
interval?: NumString;
|
|
255
261
|
}
|
|
256
262
|
|
|
257
|
-
export interface WatchSettings<T =
|
|
258
|
-
users?: ObjectMap<ObjectMap<T>>;
|
|
259
|
-
}
|
|
263
|
+
export interface WatchSettings<T = WatchUserSettings> extends ClientSettings<ObjectMap<T>>, PlainObject {}
|
|
260
264
|
|
|
261
265
|
export interface CompressModule<U = CompressSettings> extends HandlerSettings<U> {
|
|
262
266
|
gzip?: ZlibOptions;
|
|
@@ -283,7 +287,7 @@ export interface CloudModule<T = CloudSettings> extends ClientModule<T>, CloudSe
|
|
|
283
287
|
apiVersion?: string;
|
|
284
288
|
}
|
|
285
289
|
|
|
286
|
-
export interface CloudSettings extends
|
|
290
|
+
export interface CloudSettings extends ClientDbSettings, CloudServiceDataType<CloudServiceOptions> {}
|
|
287
291
|
|
|
288
292
|
export interface CloudServiceDataType<T = unknown> {
|
|
289
293
|
atlas?: T;
|
|
@@ -319,6 +323,7 @@ export interface LoggerModule<T = NumString, U = boolean | T, V = LoggerFormat<T
|
|
|
319
323
|
session_id?: U;
|
|
320
324
|
message?: boolean;
|
|
321
325
|
stack_trace?: boolean | T;
|
|
326
|
+
abort?: boolean;
|
|
322
327
|
stdout?: boolean;
|
|
323
328
|
unknown?: boolean | LoggerColor;
|
|
324
329
|
system?: boolean | LoggerColor;
|
|
@@ -445,6 +450,7 @@ export type DbSourceDataType<T = unknown> = {
|
|
|
445
450
|
[K in DbSource]?: T;
|
|
446
451
|
};
|
|
447
452
|
|
|
453
|
+
export type WatchUserSettings = ObjectMap<WatchInterval>;
|
|
448
454
|
export type DocumentTransform = Null<boolean | "etag" | HashAlgorithm | HashConfig>;
|
|
449
455
|
export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha224" | "sha384" | "sha512";
|
|
450
456
|
|
package/lib/squared.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export interface DbDataSource<T = unknown, U = unknown, V = unknown, W = unknown
|
|
|
64
64
|
credential?: W;
|
|
65
65
|
options?: U;
|
|
66
66
|
update?: V;
|
|
67
|
+
withCommand?: string | [string, string];
|
|
67
68
|
parallel?: boolean;
|
|
68
69
|
willAbort?: boolean;
|
|
69
70
|
streamRow?: Null<boolean | string | ((row: unknown) => Undef<Error | false>)>;
|