@e-mc/types 0.10.1 → 0.10.2

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/lib/settings.d.ts CHANGED
@@ -1,491 +1,491 @@
1
- import type { WatchInterval } from './squared';
2
-
3
- import type { HashAlgorithm } from './asset';
4
- import type { CloudSource } from './cloud';
5
- import type { PermissionAction, PermissionReadWrite, PermittedDirectories } from './core';
6
- import type { DbSource, TimeoutAction } from './db';
7
- import type { HttpOutgoingHeaders, SecureConfig, ServerPort } from './http';
8
- import type { BackgroundColor, BroadcastOutMethod, ErrorOutMethod, ForegroundColor, LoggerColor, LoggerStatus, TextAlign, TextWrapStyle } from './logger';
9
- import type { ExecAction, IncludeAction } from './module';
10
-
11
- import type { SpawnOptions } from 'child_process';
12
- import type { BinaryLike, CipherGCMTypes } from 'crypto';
13
- import type { LookupAddress } from 'dns';
14
- import type { BrotliOptions, ZlibOptions } from 'zlib';
15
-
16
- import type { BackgroundColor as IBackgroundColor } from 'chalk';
17
- // @ts-ignore
18
- import type { Unit } from 'bytes';
19
- // @ts-ignore
20
- import type { MinimatchOptions } from 'minimatch';
21
- // @ts-ignore
22
- import type { Options as ZopfliOptions } from 'node-zopfli';
23
- // @ts-ignore
24
- import type { PicomatchOptions } from 'picomatch';
25
-
26
- export interface HandlerModule<T = PlainObject> extends HandlerSettings<T> {
27
- handler?: string;
28
- extensions?: string[];
29
- }
30
-
31
- export interface HandlerSettings<T = PlainObject> {
32
- settings?: T & { broadcast_id?: ArrayOf<string> };
33
- }
34
-
35
- export interface ClientModule<T = ClientSettings> extends HandlerModule<T>, PermissionAction {}
36
-
37
- export interface ClientSettings<T = PlainObject> extends PlainObject {
38
- users?: ObjectMap<T>;
39
- cache_dir?: string;
40
- }
41
-
42
- export interface NodeModule<T = PlainObject> extends HandlerSettings<T> {
43
- process?: {
44
- cpu_usage?: boolean;
45
- memory_usage?: boolean;
46
- inline?: boolean;
47
- };
48
- require?: {
49
- ext?: ArrayOf<string> | boolean;
50
- npm?: boolean;
51
- inline?: boolean;
52
- };
53
- }
54
-
55
- export interface ProcessModule<T = PlainObject> extends HandlerSettings<T> {
56
- env?: ProcessEnvConfig;
57
- thread?: {
58
- admin: {
59
- users?: string[];
60
- private?: boolean;
61
- };
62
- queue?: {
63
- limit?: number | string;
64
- expires?: number | string;
65
- priority: { bypass?: number | string } & MinMax<number | string>;
66
- };
67
- limit?: number | string;
68
- sub_limit?: number | string;
69
- expires?: number | string;
70
- };
71
- cipher?: CipherConfig;
72
- password?: string;
73
- }
74
-
75
- export interface ProcessEnvConfig {
76
- apply?: boolean;
77
- }
78
-
79
- export interface TempModule<T = PlainObject> extends HandlerSettings<T> {
80
- dir?: string;
81
- env?: string;
82
- write?: boolean;
83
- }
84
-
85
- export interface PermissionModule<T = PermissionSettings> extends PermittedDirectories, HandlerSettings<T> {
86
- home_read?: boolean;
87
- home_write?: boolean;
88
- process_exec?: (string | ExecOptions)[];
89
- }
90
-
91
- export interface PermissionSettings extends PlainObject {
92
- picomatch?: Null<PicomatchOptions>;
93
- minimatch?: Null<MinimatchOptions>;
94
- }
95
-
96
- export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
97
- expires?: number | string;
98
- aria2?: {
99
- bin?: string | false;
100
- exec?: ExecAction;
101
- check_integrity?: boolean;
102
- update_status?: number | string | { interval?: number | string; broadcast_only?: boolean };
103
- max_concurrent_downloads?: number | string;
104
- max_connection_per_server?: number | string;
105
- bt_stop_timeout?: number | string;
106
- bt_tracker_connect_timeout?: number | string;
107
- bt_tracker_timeout?: number | string;
108
- min_split_size?: string;
109
- disk_cache?: number | string;
110
- lowest_speed_limit?: number | string;
111
- always_resume?: boolean;
112
- file_allocation?: "none" | "prealloc" | "trunc" | "falloc";
113
- conf_path?: string;
114
- };
115
- }
116
-
117
- export interface DocumentModule<T = DocumentSettings, U = DbSettings> extends ClientModule<T> {
118
- eval?: DocumentEval;
119
- imports?: StringMap;
120
- versions?: StringMap;
121
- format?: AnyObject;
122
- db?: DbModule<U>;
123
- }
124
-
125
- export interface DocumentEval {
126
- function?: boolean;
127
- absolute?: boolean;
128
- }
129
-
130
- export interface DocumentGroup<T = { imports?: StringMap } & AnyObject, U = AnyObject> {
131
- transform?: T;
132
- view_engine?: U;
133
- pages?: ObjectMap<AnyObject>;
134
- imports?: StringMap;
135
- }
136
-
137
- export interface DocumentUserSettings<T = AnyObject, U = T> extends DocumentGroup<T, U>, PlainObject {
138
- extensions?: Null<string[]>;
139
- imports_strict?: boolean;
140
- }
141
-
142
- export interface DocumentComponent<T = boolean, U = T, V = U> extends Omit<DocumentGroup<T, U>, "pages"> {
143
- cloud?: V;
144
- }
145
-
146
- export interface DocumentComponentOption<T = unknown> {
147
- cache?: T;
148
- coerce?: boolean;
149
- abort?: boolean;
150
- local_file?: number | string;
151
- }
152
-
153
- export interface DocumentSettings<T extends DocumentUserSettings = DocumentUserSettings> extends DocumentGroup, PurgeAction, ClientSettings<T>, PlainObject {
154
- directory?: DocumentDirectory;
155
- options?: DocumentComponentOptions;
156
- imports_strict?: boolean;
157
- }
158
-
159
- export interface DocumentDirectory extends StringMap {
160
- package?: string;
161
- }
162
-
163
- export type DocumentComponentOptions = DocumentComponent<DocumentComponentOption<DocumentTransform>, DocumentComponentOption<boolean>>;
164
-
165
- export interface ClientDbSettings<T = PlainObject> extends ClientSettings<T>, PurgeAction {
166
- session_expires?: number;
167
- user_key?: ObjectMap<DbSourceOptions>;
168
- imports?: StringMap;
169
- }
170
-
171
- export interface MemoryModule<T = MemorySettings> extends HandlerSettings<T>, Record<string, Undef<T | ObjectMap<PurgeBase>>> {}
172
-
173
- export interface MemorySettings extends PlainObject {
174
- users?: boolean | string[];
175
- cache_disk?: MemoryCacheDiskSettings;
176
- }
177
-
178
- export interface MemoryCacheDiskSettings<T = number | string> extends IncludeAction<Null<string[]>> {
179
- enabled?: boolean;
180
- min_size?: T;
181
- max_size?: T;
182
- expires?: T;
183
- }
184
-
185
- export interface DbModule<T = DbSettings> extends ClientModule<T>, DbSourceDataType<ObjectMap<AnyObject>>, PlainObject {
186
- apiVersion?: string;
187
- }
188
-
189
- export interface DbSettings<T = DbUserSettings> extends ClientDbSettings<T>, DbSourceDataType<DbSourceOptions> {}
190
-
191
- export interface DbUserSettings extends DbSourceDataType<{ commands?: ObjectMap<ObjectMap<PlainObject>> }>, PlainObject {}
192
-
193
- export interface DbCacheSettings extends TimeoutAction {
194
- dir?: string;
195
- purge?: number | string;
196
- when_empty?: boolean;
197
- }
198
-
199
- export interface DbSourceOptions {
200
- pool?: PoolConfig<number | string>;
201
- cache?: DbCacheValue;
202
- coerce?: DbCoerceValue;
203
- }
204
-
205
- export interface DbCoerceSettings<T = boolean> {
206
- credential?: T;
207
- options?: T;
208
- }
209
-
210
- export interface PurgeBase<T = number | string> extends MinMax {
211
- enabled?: boolean;
212
- percent?: T;
213
- limit?: number;
214
- }
215
-
216
- export interface PurgeComponent extends PurgeBase {
217
- interval?: number | string;
218
- all?: boolean | number;
219
- log?: boolean;
220
- prefix?: string;
221
- }
222
-
223
- export type DbCacheValue = number | string | DbCacheSettings;
224
- export type DbCoerceValue = boolean | DbCoerceSettings;
225
- export type DbSourceDataType<T = unknown> = {
226
- [K in DbSource]?: T;
227
- };
228
-
229
- export type ImageModule<T = ImageSettings> = ClientModule<T>;
230
-
231
- export interface ImageSettings extends PlainObject {
232
- cache?: boolean;
233
- webp?: {
234
- path?: string;
235
- cwebp?: string[];
236
- gif2webp?: string[];
237
- };
238
- }
239
-
240
- export interface RequestModule<T = RequestSettings> extends HandlerSettings<T>, HttpHostSettings {
241
- timeout?: number | string;
242
- read_timeout?: number | string;
243
- agent?: {
244
- keep_alive?: boolean;
245
- timeout?: number | string;
246
- };
247
- disk?: HttpDiskSettings;
248
- buffer?: HttpMemorySettings;
249
- connect?: HttpConnectSettings;
250
- dns?: DnsLookupSettings;
251
- use?: {
252
- http_version?: number | string;
253
- accept_encoding?: boolean;
254
- };
255
- proxy?: HttpProxySettings;
256
- headers?: HttpOutgoingHeaders;
257
- certs?: ObjectMap<SecureConfig<ArrayOf<string>>>;
258
- post_limit?: number | string;
259
- }
260
-
261
- export interface HttpProxySettings extends AuthValue, IncludeAction {
262
- address?: string;
263
- port?: number | string;
264
- origin?: string;
265
- keep_alive?: boolean;
266
- }
267
-
268
- export interface HttpHostSettings {
269
- localhost?: string[];
270
- protocol?: {
271
- "http/1.1"?: string[];
272
- h2c?: string[];
273
- h2?: string[];
274
- };
275
- write_stream?: ObjectMap<number | string>;
276
- }
277
-
278
- export interface RequestSettings extends PurgeAction, PlainObject {
279
- time_format?: "readable" | "relative" | "none";
280
- }
281
-
282
- export interface WatchModule<T = WatchSettings> extends HandlerModule<T>, ServerInfo {
283
- interval?: number | string;
284
- }
285
-
286
- export interface WatchSettings<T = WatchUserSettings> extends ClientSettings<ObjectMap<T>>, PlainObject {}
287
-
288
- export interface CompressModule<U = CompressSettings> extends HandlerSettings<U> {
289
- gzip?: ZlibOptions;
290
- brotli?: BrotliOptions;
291
- zopfli?: ZopfliOptions;
292
- }
293
-
294
- export interface CompressSettings extends PlainObject {
295
- cache?: boolean;
296
- cache_expires?: number | string;
297
- gzip_level?: number | string;
298
- brotli_quality?: number | string;
299
- zopfli_iterations?: number | string;
300
- chunk_size?: number | string;
301
- }
302
-
303
- export interface TaskModule<T = PlainObject> extends ClientModule<T>, PlainObject {}
304
-
305
- export interface CloudModule<T = CloudSettings> extends ClientModule<T>, CloudServiceDataType<ObjectMap<AnyObject>>, PlainObject {
306
- apiVersion?: string;
307
- }
308
-
309
- export interface CloudSettings extends ClientDbSettings, CloudServiceDataType<CloudServiceOptions> {}
310
-
311
- export type CloudServiceDataType<T = unknown> = {
312
- [K in CloudSource]?: T;
313
- };
314
-
315
- export interface CloudServiceOptions extends DbSourceOptions {
316
- auth?: CloudAuthSettings;
317
- }
318
-
319
- export interface CloudAuthSettings {
320
- storage?: boolean;
321
- database?: boolean;
322
- }
323
-
324
- export interface ErrorModule extends HandlerModule {
325
- out?: string | ErrorOutMethod;
326
- abort?: string[];
327
- fatal?: boolean;
328
- recursion_limit?: number | string;
329
- }
330
-
331
- export interface LoggerProgress extends LoggerFormatColor {
332
- scroll_buffer?: number | string;
333
- max_width?: number | string;
334
- use_color?: boolean;
335
- text_wrap?: TextWrapStyle;
336
- box_char?: string;
337
- raw_mode?: boolean;
338
- }
339
-
340
- export interface LoggerModule<T = number | string, U = boolean | T, V = LoggerFormat<T>> {
341
- enabled?: boolean;
342
- level?: number | string;
343
- production?: string[];
344
- format?: LoggerFormatSettings<V>;
345
- progress?: LoggerProgress;
346
- meter?: LoggerMeterSettings<T>;
347
- broadcast?: BroadcastServer & { color?: boolean };
348
- status?: boolean | LoggerStatus;
349
- color?: boolean;
350
- session_id?: U;
351
- message?: boolean;
352
- stack_trace?: boolean | T;
353
- abort?: boolean;
354
- stdout?: boolean;
355
- unknown?: boolean | LoggerColor;
356
- system?: boolean | LoggerColor;
357
- node?: boolean | LoggerColor;
358
- process?: boolean | LoggerProcessSettings;
359
- image?: boolean | LoggerColor;
360
- compress?: boolean | LoggerColor;
361
- watch?: boolean | LoggerColor;
362
- file?: boolean | LoggerColor;
363
- cloud?: boolean | LoggerColor;
364
- db?: boolean | LoggerColor;
365
- time_elapsed?: boolean | LoggerColor;
366
- time_process?: boolean | LoggerColor;
367
- exec?: boolean | LoggerColor;
368
- http?: boolean | LoggerColor;
369
- }
370
-
371
- export interface LoggerFormatSettings<T = PlainObject> {
372
- title?: T;
373
- value?: T;
374
- hint?: T & { unit?: "auto" | "s" | "ms" };
375
- session_id?: T;
376
- message?: T;
377
- meter?: T;
378
- error?: T;
379
- }
380
-
381
- export interface LoggerMeterSettings<T = number | string> {
382
- http?: T;
383
- image?: T;
384
- compress?: T;
385
- process?: T;
386
- }
387
-
388
- export interface LoggerProcessSettings extends LoggerColor {
389
- cpu?: boolean;
390
- cpu_bar?: boolean | ArrayOf<number>;
391
- cpu_bar_color?: [typeof IBackgroundColor, typeof IBackgroundColor, typeof IBackgroundColor];
392
- cpu_single_core?: boolean;
393
- mem?: boolean;
394
- mem_format?: "%" | Unit;
395
- }
396
-
397
- export interface LoggerFormatColor {
398
- color?: ForegroundColor;
399
- bg_color?: BackgroundColor;
400
- }
401
-
402
- export interface LoggerFormat<T = number | string> extends LoggerFormatColor {
403
- width?: T;
404
- alt_color?: ForegroundColor;
405
- bg_alt_color?: BackgroundColor;
406
- bold?: boolean;
407
- justify?: TextAlign;
408
- unit?: string;
409
- as?: StringMap;
410
- braces?: string | TupleOf<string>;
411
- }
412
-
413
- export interface HttpSettings {
414
- version?: number | string;
415
- timeout?: number | string;
416
- headers?: HttpOutgoingHeaders;
417
- certs?: ObjectMap<SecureConfig<ArrayOf<string>>>;
418
- }
419
-
420
- export interface HttpDiskSettings extends IncludeAction {
421
- enabled?: boolean;
422
- limit?: number | string;
423
- expires?: number | string;
424
- }
425
-
426
- export interface HttpMemorySettings extends HttpDiskSettings {
427
- limit_all?: number | string;
428
- to_disk?: number | string | [number | string, (number | string)?];
429
- purge_amount?: number | string;
430
- }
431
-
432
- export interface HttpConnectSettings {
433
- timeout?: number | string;
434
- retry_wait?: number | string;
435
- retry_after?: number | string;
436
- retry_limit?: number | string;
437
- redirect_limit?: number | string;
438
- }
439
-
440
- export interface DnsLookupSettings {
441
- family?: number | string;
442
- expires?: number | string;
443
- resolve?: ObjectMap<Partial<LookupAddress>>;
444
- }
445
-
446
- export interface HashConfig extends IncludeAction<ObjectMap<string[] | "*">> {
447
- enabled?: boolean;
448
- algorithm?: HashAlgorithm;
449
- etag?: boolean;
450
- expires?: number | string;
451
- renew?: boolean;
452
- limit?: number | string;
453
- }
454
-
455
- export interface BroadcastServer extends ServerInfo<ArrayOf<number | string>> {
456
- out?: string | BroadcastOutMethod;
457
- }
458
-
459
- export interface ExecOptions extends SpawnOptions {
460
- command?: string;
461
- warn?: ArrayOf<string>;
462
- }
463
-
464
- export interface PurgeAction {
465
- purge?: PurgeComponent;
466
- }
467
-
468
- export interface PoolConfig<T = number> extends MinMax {
469
- idle?: T;
470
- queue_max?: number;
471
- queue_idle?: T;
472
- purge?: T;
473
- timeout?: number;
474
- socket_timeout?: number;
475
- }
476
-
477
- export interface CipherConfig {
478
- algorithm?: CipherGCMTypes;
479
- key?: BinaryLike;
480
- iv?: BinaryLike;
481
- }
482
-
483
- export interface ServerInfo<T = number | string> extends ServerPort<T> {
484
- enabled?: boolean;
485
- secure?: SecureConfig & ServerPort<T>;
486
- }
487
-
488
- export type WatchUserSettings = ObjectMap<WatchInterval>;
489
- export type DocumentTransform = Null<boolean | "etag" | HashAlgorithm | HashConfig>;
490
-
1
+ import type { WatchInterval } from './squared';
2
+
3
+ import type { HashAlgorithm } from './asset';
4
+ import type { CloudSource } from './cloud';
5
+ import type { PermissionAction, PermissionReadWrite, PermittedDirectories } from './core';
6
+ import type { DbSource, TimeoutAction } from './db';
7
+ import type { HttpOutgoingHeaders, SecureConfig, ServerPort } from './http';
8
+ import type { BackgroundColor, BroadcastOutMethod, ErrorOutMethod, ForegroundColor, LoggerColor, LoggerStatus, TextAlign, TextWrapStyle } from './logger';
9
+ import type { ExecAction, IncludeAction } from './module';
10
+
11
+ import type { SpawnOptions } from 'child_process';
12
+ import type { BinaryLike, CipherGCMTypes } from 'crypto';
13
+ import type { LookupAddress } from 'dns';
14
+ import type { BrotliOptions, ZlibOptions } from 'zlib';
15
+
16
+ import type { BackgroundColor as IBackgroundColor } from 'chalk';
17
+ // @ts-ignore
18
+ import type { Unit } from 'bytes';
19
+ // @ts-ignore
20
+ import type { MinimatchOptions } from 'minimatch';
21
+ // @ts-ignore
22
+ import type { Options as ZopfliOptions } from 'node-zopfli';
23
+ // @ts-ignore
24
+ import type { PicomatchOptions } from 'picomatch';
25
+
26
+ export interface HandlerModule<T = PlainObject> extends HandlerSettings<T> {
27
+ handler?: string;
28
+ extensions?: string[];
29
+ }
30
+
31
+ export interface HandlerSettings<T = PlainObject> {
32
+ settings?: T & { broadcast_id?: ArrayOf<string> };
33
+ }
34
+
35
+ export interface ClientModule<T = ClientSettings> extends HandlerModule<T>, PermissionAction {}
36
+
37
+ export interface ClientSettings<T = PlainObject> extends PlainObject {
38
+ users?: ObjectMap<T>;
39
+ cache_dir?: string;
40
+ }
41
+
42
+ export interface NodeModule<T = PlainObject> extends HandlerSettings<T> {
43
+ process?: {
44
+ cpu_usage?: boolean;
45
+ memory_usage?: boolean;
46
+ inline?: boolean;
47
+ };
48
+ require?: {
49
+ ext?: ArrayOf<string> | boolean;
50
+ npm?: boolean;
51
+ inline?: boolean;
52
+ };
53
+ }
54
+
55
+ export interface ProcessModule<T = PlainObject> extends HandlerSettings<T> {
56
+ env?: ProcessEnvConfig;
57
+ thread?: {
58
+ admin: {
59
+ users?: string[];
60
+ private?: boolean;
61
+ };
62
+ queue?: {
63
+ limit?: number | string;
64
+ expires?: number | string;
65
+ priority: { bypass?: number | string } & MinMax<number | string>;
66
+ };
67
+ limit?: number | string;
68
+ sub_limit?: number | string;
69
+ expires?: number | string;
70
+ };
71
+ cipher?: CipherConfig;
72
+ password?: string;
73
+ }
74
+
75
+ export interface ProcessEnvConfig {
76
+ apply?: boolean;
77
+ }
78
+
79
+ export interface TempModule<T = PlainObject> extends HandlerSettings<T> {
80
+ dir?: string;
81
+ env?: string;
82
+ write?: boolean;
83
+ }
84
+
85
+ export interface PermissionModule<T = PermissionSettings> extends PermittedDirectories, HandlerSettings<T> {
86
+ home_read?: boolean;
87
+ home_write?: boolean;
88
+ process_exec?: (string | ExecOptions)[];
89
+ }
90
+
91
+ export interface PermissionSettings extends PlainObject {
92
+ picomatch?: Null<PicomatchOptions>;
93
+ minimatch?: Null<MinimatchOptions>;
94
+ }
95
+
96
+ export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
97
+ expires?: number | string;
98
+ aria2?: {
99
+ bin?: string | false;
100
+ exec?: ExecAction;
101
+ check_integrity?: boolean;
102
+ update_status?: number | string | { interval?: number | string; broadcast_only?: boolean };
103
+ max_concurrent_downloads?: number | string;
104
+ max_connection_per_server?: number | string;
105
+ bt_stop_timeout?: number | string;
106
+ bt_tracker_connect_timeout?: number | string;
107
+ bt_tracker_timeout?: number | string;
108
+ min_split_size?: string;
109
+ disk_cache?: number | string;
110
+ lowest_speed_limit?: number | string;
111
+ always_resume?: boolean;
112
+ file_allocation?: "none" | "prealloc" | "trunc" | "falloc";
113
+ conf_path?: string;
114
+ };
115
+ }
116
+
117
+ export interface DocumentModule<T = DocumentSettings, U = DbSettings> extends ClientModule<T> {
118
+ eval?: DocumentEval;
119
+ imports?: StringMap;
120
+ versions?: StringMap;
121
+ format?: AnyObject;
122
+ db?: DbModule<U>;
123
+ }
124
+
125
+ export interface DocumentEval {
126
+ function?: boolean;
127
+ absolute?: boolean;
128
+ }
129
+
130
+ export interface DocumentGroup<T = { imports?: StringMap } & AnyObject, U = AnyObject> {
131
+ transform?: T;
132
+ view_engine?: U;
133
+ pages?: ObjectMap<AnyObject>;
134
+ imports?: StringMap;
135
+ }
136
+
137
+ export interface DocumentUserSettings<T = AnyObject, U = T> extends DocumentGroup<T, U>, PlainObject {
138
+ extensions?: Null<string[]>;
139
+ imports_strict?: boolean;
140
+ }
141
+
142
+ export interface DocumentComponent<T = boolean, U = T, V = U> extends Omit<DocumentGroup<T, U>, "pages"> {
143
+ cloud?: V;
144
+ }
145
+
146
+ export interface DocumentComponentOption<T = unknown> {
147
+ cache?: T;
148
+ coerce?: boolean;
149
+ abort?: boolean;
150
+ local_file?: number | string;
151
+ }
152
+
153
+ export interface DocumentSettings<T extends DocumentUserSettings = DocumentUserSettings> extends DocumentGroup, PurgeAction, ClientSettings<T>, PlainObject {
154
+ directory?: DocumentDirectory;
155
+ options?: DocumentComponentOptions;
156
+ imports_strict?: boolean;
157
+ }
158
+
159
+ export interface DocumentDirectory extends StringMap {
160
+ package?: string;
161
+ }
162
+
163
+ export type DocumentComponentOptions = DocumentComponent<DocumentComponentOption<DocumentTransform>, DocumentComponentOption<boolean>>;
164
+
165
+ export interface ClientDbSettings<T = PlainObject> extends ClientSettings<T>, PurgeAction {
166
+ session_expires?: number;
167
+ user_key?: ObjectMap<DbSourceOptions>;
168
+ imports?: StringMap;
169
+ }
170
+
171
+ export interface MemoryModule<T = MemorySettings> extends HandlerSettings<T>, Record<string, Undef<T | ObjectMap<PurgeBase>>> {}
172
+
173
+ export interface MemorySettings extends PlainObject {
174
+ users?: boolean | string[];
175
+ cache_disk?: MemoryCacheDiskSettings;
176
+ }
177
+
178
+ export interface MemoryCacheDiskSettings<T = number | string> extends IncludeAction<Null<string[]>> {
179
+ enabled?: boolean;
180
+ min_size?: T;
181
+ max_size?: T;
182
+ expires?: T;
183
+ }
184
+
185
+ export interface DbModule<T = DbSettings> extends ClientModule<T>, DbSourceDataType<ObjectMap<AnyObject>>, PlainObject {
186
+ apiVersion?: string;
187
+ }
188
+
189
+ export interface DbSettings<T = DbUserSettings> extends ClientDbSettings<T>, DbSourceDataType<DbSourceOptions> {}
190
+
191
+ export interface DbUserSettings extends DbSourceDataType<{ commands?: ObjectMap<ObjectMap<PlainObject>> }>, PlainObject {}
192
+
193
+ export interface DbCacheSettings extends TimeoutAction {
194
+ dir?: string;
195
+ purge?: number | string;
196
+ when_empty?: boolean;
197
+ }
198
+
199
+ export interface DbSourceOptions {
200
+ pool?: PoolConfig<number | string>;
201
+ cache?: DbCacheValue;
202
+ coerce?: DbCoerceValue;
203
+ }
204
+
205
+ export interface DbCoerceSettings<T = boolean> {
206
+ credential?: T;
207
+ options?: T;
208
+ }
209
+
210
+ export interface PurgeBase<T = number | string> extends MinMax {
211
+ enabled?: boolean;
212
+ percent?: T;
213
+ limit?: number;
214
+ }
215
+
216
+ export interface PurgeComponent extends PurgeBase {
217
+ interval?: number | string;
218
+ all?: boolean | number;
219
+ log?: boolean;
220
+ prefix?: string;
221
+ }
222
+
223
+ export type DbCacheValue = number | string | DbCacheSettings;
224
+ export type DbCoerceValue = boolean | DbCoerceSettings;
225
+ export type DbSourceDataType<T = unknown> = {
226
+ [K in DbSource]?: T;
227
+ };
228
+
229
+ export type ImageModule<T = ImageSettings> = ClientModule<T>;
230
+
231
+ export interface ImageSettings extends PlainObject {
232
+ cache?: boolean;
233
+ webp?: {
234
+ path?: string;
235
+ cwebp?: string[];
236
+ gif2webp?: string[];
237
+ };
238
+ }
239
+
240
+ export interface RequestModule<T = RequestSettings> extends HandlerSettings<T>, HttpHostSettings {
241
+ timeout?: number | string;
242
+ read_timeout?: number | string;
243
+ agent?: {
244
+ keep_alive?: boolean;
245
+ timeout?: number | string;
246
+ };
247
+ disk?: HttpDiskSettings;
248
+ buffer?: HttpMemorySettings;
249
+ connect?: HttpConnectSettings;
250
+ dns?: DnsLookupSettings;
251
+ use?: {
252
+ http_version?: number | string;
253
+ accept_encoding?: boolean;
254
+ };
255
+ proxy?: HttpProxySettings;
256
+ headers?: HttpOutgoingHeaders;
257
+ certs?: ObjectMap<SecureConfig<ArrayOf<string>>>;
258
+ post_limit?: number | string;
259
+ }
260
+
261
+ export interface HttpProxySettings extends AuthValue, IncludeAction {
262
+ address?: string;
263
+ port?: number | string;
264
+ origin?: string;
265
+ keep_alive?: boolean;
266
+ }
267
+
268
+ export interface HttpHostSettings {
269
+ localhost?: string[];
270
+ protocol?: {
271
+ "http/1.1"?: string[];
272
+ h2c?: string[];
273
+ h2?: string[];
274
+ };
275
+ write_stream?: ObjectMap<number | string>;
276
+ }
277
+
278
+ export interface RequestSettings extends PurgeAction, PlainObject {
279
+ time_format?: "readable" | "relative" | "none";
280
+ }
281
+
282
+ export interface WatchModule<T = WatchSettings> extends HandlerModule<T>, ServerInfo {
283
+ interval?: number | string;
284
+ }
285
+
286
+ export interface WatchSettings<T = WatchUserSettings> extends ClientSettings<ObjectMap<T>>, PlainObject {}
287
+
288
+ export interface CompressModule<U = CompressSettings> extends HandlerSettings<U> {
289
+ gzip?: ZlibOptions;
290
+ brotli?: BrotliOptions;
291
+ zopfli?: ZopfliOptions;
292
+ }
293
+
294
+ export interface CompressSettings extends PlainObject {
295
+ cache?: boolean;
296
+ cache_expires?: number | string;
297
+ gzip_level?: number | string;
298
+ brotli_quality?: number | string;
299
+ zopfli_iterations?: number | string;
300
+ chunk_size?: number | string;
301
+ }
302
+
303
+ export interface TaskModule<T = PlainObject> extends ClientModule<T>, PlainObject {}
304
+
305
+ export interface CloudModule<T = CloudSettings> extends ClientModule<T>, CloudServiceDataType<ObjectMap<AnyObject>>, PlainObject {
306
+ apiVersion?: string;
307
+ }
308
+
309
+ export interface CloudSettings extends ClientDbSettings, CloudServiceDataType<CloudServiceOptions> {}
310
+
311
+ export type CloudServiceDataType<T = unknown> = {
312
+ [K in CloudSource]?: T;
313
+ };
314
+
315
+ export interface CloudServiceOptions extends DbSourceOptions {
316
+ auth?: CloudAuthSettings;
317
+ }
318
+
319
+ export interface CloudAuthSettings {
320
+ storage?: boolean;
321
+ database?: boolean;
322
+ }
323
+
324
+ export interface ErrorModule extends HandlerModule {
325
+ out?: string | ErrorOutMethod;
326
+ abort?: string[];
327
+ fatal?: boolean;
328
+ recursion_limit?: number | string;
329
+ }
330
+
331
+ export interface LoggerProgress extends LoggerFormatColor {
332
+ scroll_buffer?: number | string;
333
+ max_width?: number | string;
334
+ use_color?: boolean;
335
+ text_wrap?: TextWrapStyle;
336
+ box_char?: string;
337
+ raw_mode?: boolean;
338
+ }
339
+
340
+ export interface LoggerModule<T = number | string, U = boolean | T, V = LoggerFormat<T>> {
341
+ enabled?: boolean;
342
+ level?: number | string;
343
+ production?: string[];
344
+ format?: LoggerFormatSettings<V>;
345
+ progress?: LoggerProgress;
346
+ meter?: LoggerMeterSettings<T>;
347
+ broadcast?: BroadcastServer & { color?: boolean };
348
+ status?: boolean | LoggerStatus;
349
+ color?: boolean;
350
+ session_id?: U;
351
+ message?: boolean;
352
+ stack_trace?: boolean | T;
353
+ abort?: boolean;
354
+ stdout?: boolean;
355
+ unknown?: boolean | LoggerColor;
356
+ system?: boolean | LoggerColor;
357
+ node?: boolean | LoggerColor;
358
+ process?: boolean | LoggerProcessSettings;
359
+ image?: boolean | LoggerColor;
360
+ compress?: boolean | LoggerColor;
361
+ watch?: boolean | LoggerColor;
362
+ file?: boolean | LoggerColor;
363
+ cloud?: boolean | LoggerColor;
364
+ db?: boolean | LoggerColor;
365
+ time_elapsed?: boolean | LoggerColor;
366
+ time_process?: boolean | LoggerColor;
367
+ exec?: boolean | LoggerColor;
368
+ http?: boolean | LoggerColor;
369
+ }
370
+
371
+ export interface LoggerFormatSettings<T = PlainObject> {
372
+ title?: T;
373
+ value?: T;
374
+ hint?: T & { unit?: "auto" | "s" | "ms" };
375
+ session_id?: T;
376
+ message?: T;
377
+ meter?: T;
378
+ error?: T;
379
+ }
380
+
381
+ export interface LoggerMeterSettings<T = number | string> {
382
+ http?: T;
383
+ image?: T;
384
+ compress?: T;
385
+ process?: T;
386
+ }
387
+
388
+ export interface LoggerProcessSettings extends LoggerColor {
389
+ cpu?: boolean;
390
+ cpu_bar?: boolean | ArrayOf<number>;
391
+ cpu_bar_color?: [typeof IBackgroundColor, typeof IBackgroundColor, typeof IBackgroundColor];
392
+ cpu_single_core?: boolean;
393
+ mem?: boolean;
394
+ mem_format?: "%" | Unit;
395
+ }
396
+
397
+ export interface LoggerFormatColor {
398
+ color?: ForegroundColor;
399
+ bg_color?: BackgroundColor;
400
+ }
401
+
402
+ export interface LoggerFormat<T = number | string> extends LoggerFormatColor {
403
+ width?: T;
404
+ alt_color?: ForegroundColor;
405
+ bg_alt_color?: BackgroundColor;
406
+ bold?: boolean;
407
+ justify?: TextAlign;
408
+ unit?: string;
409
+ as?: StringMap;
410
+ braces?: string | TupleOf<string>;
411
+ }
412
+
413
+ export interface HttpSettings {
414
+ version?: number | string;
415
+ timeout?: number | string;
416
+ headers?: HttpOutgoingHeaders;
417
+ certs?: ObjectMap<SecureConfig<ArrayOf<string>>>;
418
+ }
419
+
420
+ export interface HttpDiskSettings extends IncludeAction {
421
+ enabled?: boolean;
422
+ limit?: number | string;
423
+ expires?: number | string;
424
+ }
425
+
426
+ export interface HttpMemorySettings extends HttpDiskSettings {
427
+ limit_all?: number | string;
428
+ to_disk?: number | string | [number | string, (number | string)?];
429
+ purge_amount?: number | string;
430
+ }
431
+
432
+ export interface HttpConnectSettings {
433
+ timeout?: number | string;
434
+ retry_wait?: number | string;
435
+ retry_after?: number | string;
436
+ retry_limit?: number | string;
437
+ redirect_limit?: number | string;
438
+ }
439
+
440
+ export interface DnsLookupSettings {
441
+ family?: number | string;
442
+ expires?: number | string;
443
+ resolve?: ObjectMap<Partial<LookupAddress>>;
444
+ }
445
+
446
+ export interface HashConfig extends IncludeAction<ObjectMap<string[] | "*">> {
447
+ enabled?: boolean;
448
+ algorithm?: HashAlgorithm;
449
+ etag?: boolean;
450
+ expires?: number | string;
451
+ renew?: boolean;
452
+ limit?: number | string;
453
+ }
454
+
455
+ export interface BroadcastServer extends ServerInfo<ArrayOf<number | string>> {
456
+ out?: string | BroadcastOutMethod;
457
+ }
458
+
459
+ export interface ExecOptions extends SpawnOptions {
460
+ command?: string;
461
+ warn?: ArrayOf<string>;
462
+ }
463
+
464
+ export interface PurgeAction {
465
+ purge?: PurgeComponent;
466
+ }
467
+
468
+ export interface PoolConfig<T = number> extends MinMax {
469
+ idle?: T;
470
+ queue_max?: number;
471
+ queue_idle?: T;
472
+ purge?: T;
473
+ timeout?: number;
474
+ socket_timeout?: number;
475
+ }
476
+
477
+ export interface CipherConfig {
478
+ algorithm?: CipherGCMTypes;
479
+ key?: BinaryLike;
480
+ iv?: BinaryLike;
481
+ }
482
+
483
+ export interface ServerInfo<T = number | string> extends ServerPort<T> {
484
+ enabled?: boolean;
485
+ secure?: SecureConfig & ServerPort<T>;
486
+ }
487
+
488
+ export type WatchUserSettings = ObjectMap<WatchInterval>;
489
+ export type DocumentTransform = Null<boolean | "etag" | HashAlgorithm | HashConfig>;
490
+
491
491
  export type { ExecAction, PermissionReadWrite, SecureConfig };