@e-mc/types 0.10.6 → 0.11.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/lib/settings.d.ts CHANGED
@@ -4,15 +4,15 @@ import type { HashAlgorithm } from './asset';
4
4
  import type { CloudSource } from './cloud';
5
5
  import type { PermissionAction, PermissionReadWrite, PermittedDirectories } from './core';
6
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 } from './logger';
7
+ import type { AuthValue, HttpOutgoingHeaders, SecureConfig, ServerPort } from './http';
8
+ import type { BackgroundColor, BroadcastOutMethod, ErrorOutMethod, ForegroundColor, LoggerColor, LoggerStatus, TextAlign, TextWrapStyle } from './logger';
9
9
  import type { ExecAction, IncludeAction } from './module';
10
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
-
11
+ import type { SpawnOptions } from 'node:child_process';
12
+ import type { BinaryLike, CipherGCMTypes } from 'node:crypto';
13
+ import type { LookupAddress } from 'node:dns';
14
+ import type { BrotliOptions, ZlibOptions } from 'node:zlib';
15
+ import type { BackgroundColor as IBackgroundColor } from 'chalk';
16
16
  // @ts-ignore
17
17
  import type { Unit } from 'bytes';
18
18
  // @ts-ignore
@@ -22,13 +22,18 @@ import type { Options as ZopfliOptions } from 'node-zopfli';
22
22
  // @ts-ignore
23
23
  import type { PicomatchOptions } from 'picomatch';
24
24
 
25
+ interface MinMax<T = number> {
26
+ min?: T;
27
+ max?: T;
28
+ }
29
+
25
30
  export interface HandlerModule<T = PlainObject> extends HandlerSettings<T> {
26
31
  handler?: string;
27
32
  extensions?: string[];
28
33
  }
29
34
 
30
35
  export interface HandlerSettings<T = PlainObject> {
31
- settings?: T & { broadcast_id?: ArrayOf<string> };
36
+ settings?: T & { broadcast_id?: string | string[] };
32
37
  }
33
38
 
34
39
  export interface ClientModule<T = ClientSettings> extends HandlerModule<T>, PermissionAction {}
@@ -38,19 +43,23 @@ export interface ClientSettings<T = PlainObject> extends PlainObject {
38
43
  cache_dir?: string;
39
44
  }
40
45
 
41
- export interface NodeModule<T = PlainObject> extends HandlerSettings<T> {
46
+ export interface NodeModule<T = NodeSettings> extends HandlerSettings<T> {
42
47
  process?: {
43
48
  cpu_usage?: boolean;
44
49
  memory_usage?: boolean;
45
50
  inline?: boolean;
46
51
  };
47
52
  require?: {
48
- ext?: ArrayOf<string> | boolean;
53
+ ext?: string | string[] | boolean;
49
54
  npm?: boolean;
50
55
  inline?: boolean;
51
56
  };
52
57
  }
53
58
 
59
+ export interface NodeSettings extends PlainObject {
60
+ package_manager?: "npm" | "yarn" | "pnpm";
61
+ }
62
+
54
63
  export interface ProcessModule<T = PlainObject> extends HandlerSettings<T> {
55
64
  env?: ProcessEnvConfig;
56
65
  thread?: {
@@ -59,13 +68,13 @@ export interface ProcessModule<T = PlainObject> extends HandlerSettings<T> {
59
68
  private?: boolean;
60
69
  };
61
70
  queue?: {
62
- limit?: NumString;
63
- expires?: NumString;
64
- priority: { bypass?: NumString } & MinMax<NumString>;
71
+ limit?: number | string;
72
+ expires?: number | string;
73
+ priority: { bypass?: number | string } & MinMax<number | string>;
65
74
  };
66
- limit?: NumString;
67
- sub_limit?: NumString;
68
- expires?: NumString;
75
+ limit?: number | string;
76
+ sub_limit?: number | string;
77
+ expires?: number | string;
69
78
  };
70
79
  cipher?: CipherConfig;
71
80
  password?: string;
@@ -77,34 +86,37 @@ export interface ProcessEnvConfig {
77
86
 
78
87
  export interface TempModule<T = PlainObject> extends HandlerSettings<T> {
79
88
  dir?: string;
89
+ env?: string;
90
+ os?: boolean;
80
91
  write?: boolean;
81
92
  }
82
93
 
83
94
  export interface PermissionModule<T = PermissionSettings> extends PermittedDirectories, HandlerSettings<T> {
84
95
  home_read?: boolean;
85
96
  home_write?: boolean;
86
- process_exec?: (string | ExecOptions)[];
97
+ process_exec?: Array<string | ExecOptions>;
87
98
  }
88
99
 
89
100
  export interface PermissionSettings extends PlainObject {
90
- picomatch?: Null<PicomatchOptions>;
91
- minimatch?: Null<MinimatchOptions>;
101
+ picomatch?: PicomatchOptions | null;
102
+ minimatch?: MinimatchOptions | null;
92
103
  }
93
104
 
94
105
  export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
95
- expires?: NumString;
106
+ expires?: number | string;
96
107
  aria2?: {
97
108
  bin?: string | false;
98
109
  exec?: ExecAction;
99
- update_status?: NumString | { interval?: NumString; broadcast_only?: boolean };
100
- max_concurrent_downloads?: NumString;
101
- max_connection_per_server?: NumString;
102
- bt_stop_timeout?: NumString;
103
- bt_tracker_connect_timeout?: NumString;
104
- bt_tracker_timeout?: NumString;
110
+ check_integrity?: boolean;
111
+ update_status?: number | string | { interval?: number | string; broadcast_only?: boolean };
112
+ max_concurrent_downloads?: number | string;
113
+ max_connection_per_server?: number | string;
114
+ bt_stop_timeout?: number | string;
115
+ bt_tracker_connect_timeout?: number | string;
116
+ bt_tracker_timeout?: number | string;
105
117
  min_split_size?: string;
106
- disk_cache?: NumString;
107
- lowest_speed_limit?: NumString;
118
+ disk_cache?: number | string;
119
+ lowest_speed_limit?: number | string;
108
120
  always_resume?: boolean;
109
121
  file_allocation?: "none" | "prealloc" | "trunc" | "falloc";
110
122
  conf_path?: string;
@@ -132,7 +144,7 @@ export interface DocumentGroup<T = { imports?: StringMap } & AnyObject, U = AnyO
132
144
  }
133
145
 
134
146
  export interface DocumentUserSettings<T = AnyObject, U = T> extends DocumentGroup<T, U>, PlainObject {
135
- extensions?: Null<string[]>;
147
+ extensions?: string[] | null;
136
148
  imports_strict?: boolean;
137
149
  }
138
150
 
@@ -144,13 +156,13 @@ export interface DocumentComponentOption<T = unknown> {
144
156
  cache?: T;
145
157
  coerce?: boolean;
146
158
  abort?: boolean;
147
- local_file?: NumString;
159
+ local_file?: number | string;
148
160
  }
149
161
 
150
- export interface DocumentSettings extends DocumentGroup, PurgeAction, ClientSettings<DocumentUserSettings>, PlainObject {
151
- imports_strict?: boolean;
162
+ export interface DocumentSettings<T extends DocumentUserSettings = DocumentUserSettings> extends DocumentGroup, PurgeAction, ClientSettings<T>, PlainObject {
152
163
  directory?: DocumentDirectory;
153
164
  options?: DocumentComponentOptions;
165
+ imports_strict?: boolean;
154
166
  }
155
167
 
156
168
  export interface DocumentDirectory extends StringMap {
@@ -165,14 +177,14 @@ export interface ClientDbSettings<T = PlainObject> extends ClientSettings<T>, Pu
165
177
  imports?: StringMap;
166
178
  }
167
179
 
168
- export interface MemoryModule<T = MemorySettings> extends HandlerSettings<T>, Record<string, Undef<T | ObjectMap<PurgeBase>>> {}
180
+ export interface MemoryModule<T = MemorySettings> extends HandlerSettings<T>, Record<string, T | ObjectMap<PurgeBase> | undefined> {}
169
181
 
170
182
  export interface MemorySettings extends PlainObject {
171
183
  users?: boolean | string[];
172
184
  cache_disk?: MemoryCacheDiskSettings;
173
185
  }
174
186
 
175
- export interface MemoryCacheDiskSettings<T = NumString> extends IncludeAction<Null<string[]>> {
187
+ export interface MemoryCacheDiskSettings<T = number | string> extends IncludeAction<string[] | null> {
176
188
  enabled?: boolean;
177
189
  min_size?: T;
178
190
  max_size?: T;
@@ -189,12 +201,12 @@ export interface DbUserSettings extends DbSourceDataType<{ commands?: ObjectMap<
189
201
 
190
202
  export interface DbCacheSettings extends TimeoutAction {
191
203
  dir?: string;
192
- purge?: NumString;
204
+ purge?: number | string;
193
205
  when_empty?: boolean;
194
206
  }
195
207
 
196
208
  export interface DbSourceOptions {
197
- pool?: PoolConfig<NumString>;
209
+ pool?: PoolConfig<number | string>;
198
210
  cache?: DbCacheValue;
199
211
  coerce?: DbCoerceValue;
200
212
  }
@@ -204,20 +216,20 @@ export interface DbCoerceSettings<T = boolean> {
204
216
  options?: T;
205
217
  }
206
218
 
207
- export interface PurgeBase<T = NumString> extends MinMax {
219
+ export interface PurgeBase<T = number | string> extends MinMax {
208
220
  enabled?: boolean;
209
221
  percent?: T;
210
222
  limit?: number;
211
223
  }
212
224
 
213
225
  export interface PurgeComponent extends PurgeBase {
214
- interval?: NumString;
226
+ interval?: number | string;
215
227
  all?: boolean | number;
216
228
  log?: boolean;
217
229
  prefix?: string;
218
230
  }
219
231
 
220
- export type DbCacheValue = NumString | DbCacheSettings;
232
+ export type DbCacheValue = number | string | DbCacheSettings;
221
233
  export type DbCoerceValue = boolean | DbCoerceSettings;
222
234
  export type DbSourceDataType<T = unknown> = {
223
235
  [K in DbSource]?: T;
@@ -234,35 +246,42 @@ export interface ImageSettings extends PlainObject {
234
246
  };
235
247
  }
236
248
 
237
- export interface RequestModule<T = RequestSettings> extends HandlerSettings<T> {
238
- timeout?: NumString;
239
- read_timeout?: NumString;
249
+ export interface RequestModule<T = RequestSettings> extends HandlerSettings<T>, HttpHostSettings {
250
+ timeout?: number | string;
251
+ read_timeout?: number | string;
240
252
  agent?: {
241
253
  keep_alive?: boolean;
242
- timeout?: NumString;
254
+ timeout?: number | string;
243
255
  };
244
256
  disk?: HttpDiskSettings;
245
257
  buffer?: HttpMemorySettings;
246
258
  connect?: HttpConnectSettings;
247
259
  dns?: DnsLookupSettings;
248
260
  use?: {
249
- http_version?: NumString;
261
+ http_version?: number | string;
250
262
  accept_encoding?: boolean;
251
263
  };
252
- proxy?: AuthValue & IncludeAction & {
253
- address?: string;
254
- port?: NumString;
255
- keep_alive?: boolean;
256
- };
264
+ proxy?: HttpProxySettings;
257
265
  headers?: HttpOutgoingHeaders;
258
- certs?: ObjectMap<SecureConfig<ArrayOf<string>>>;
266
+ certs?: ObjectMap<SecureConfig<string | string[]>>;
267
+ post_limit?: number | string;
268
+ }
269
+
270
+ export interface HttpProxySettings extends AuthValue, IncludeAction {
271
+ address?: string;
272
+ port?: number | string;
273
+ origin?: string;
274
+ keep_alive?: boolean;
275
+ }
276
+
277
+ export interface HttpHostSettings {
259
278
  localhost?: string[];
260
279
  protocol?: {
261
280
  "http/1.1"?: string[];
262
281
  h2c?: string[];
263
282
  h2?: string[];
264
283
  };
265
- post_limit?: NumString;
284
+ write_stream?: ObjectMap<number | string>;
266
285
  }
267
286
 
268
287
  export interface RequestSettings extends PurgeAction, PlainObject {
@@ -270,7 +289,7 @@ export interface RequestSettings extends PurgeAction, PlainObject {
270
289
  }
271
290
 
272
291
  export interface WatchModule<T = WatchSettings> extends HandlerModule<T>, ServerInfo {
273
- interval?: NumString;
292
+ interval?: number | string;
274
293
  }
275
294
 
276
295
  export interface WatchSettings<T = WatchUserSettings> extends ClientSettings<ObjectMap<T>>, PlainObject {}
@@ -279,19 +298,15 @@ export interface CompressModule<U = CompressSettings> extends HandlerSettings<U>
279
298
  gzip?: ZlibOptions;
280
299
  brotli?: BrotliOptions;
281
300
  zopfli?: ZopfliOptions;
282
- tinify?: {
283
- api_key?: string;
284
- proxy?: string;
285
- };
286
301
  }
287
302
 
288
303
  export interface CompressSettings extends PlainObject {
289
304
  cache?: boolean;
290
- cache_expires?: NumString;
291
- gzip_level?: NumString;
292
- brotli_quality?: NumString;
293
- zopfli_iterations?: NumString;
294
- chunk_size?: NumString;
305
+ cache_expires?: number | string;
306
+ gzip_level?: number | string;
307
+ brotli_quality?: number | string;
308
+ zopfli_iterations?: number | string;
309
+ chunk_size?: number | string;
295
310
  }
296
311
 
297
312
  export interface TaskModule<T = PlainObject> extends ClientModule<T>, PlainObject {}
@@ -315,18 +330,32 @@ export interface CloudAuthSettings {
315
330
  database?: boolean;
316
331
  }
317
332
 
318
- export interface ErrorModule extends HandlerModule {
333
+ export interface ErrorModule<T = ErrorSettings> extends HandlerModule<T> {
319
334
  out?: string | ErrorOutMethod;
320
335
  abort?: string[];
321
336
  fatal?: boolean;
322
- recursion_limit?: NumString;
337
+ recursion_limit?: number | string;
323
338
  }
324
339
 
325
- export interface LoggerModule<T = NumString, U = boolean | T, V = LoggerFormat<T>> {
340
+ export interface ErrorSettings extends PlainObject {
341
+ trap_exceptions?: boolean;
342
+ }
343
+
344
+ export interface LoggerProgress extends LoggerFormatColor {
345
+ scroll_buffer?: number | string;
346
+ max_width?: number | string;
347
+ use_color?: boolean;
348
+ text_wrap?: TextWrapStyle;
349
+ box_char?: string;
350
+ raw_mode?: boolean;
351
+ }
352
+
353
+ export interface LoggerModule<T = number | string, U = boolean | T, V = LoggerFormat<T>> {
326
354
  enabled?: boolean;
327
- level?: NumString;
355
+ level?: number | string;
328
356
  production?: string[];
329
357
  format?: LoggerFormatSettings<V>;
358
+ progress?: LoggerProgress;
330
359
  meter?: LoggerMeterSettings<T>;
331
360
  broadcast?: BroadcastServer & { color?: boolean };
332
361
  status?: boolean | LoggerStatus;
@@ -359,9 +388,10 @@ export interface LoggerFormatSettings<T = PlainObject> {
359
388
  session_id?: T;
360
389
  message?: T;
361
390
  meter?: T;
391
+ error?: T;
362
392
  }
363
393
 
364
- export interface LoggerMeterSettings<T = NumString> {
394
+ export interface LoggerMeterSettings<T = number | string> {
365
395
  http?: T;
366
396
  image?: T;
367
397
  compress?: T;
@@ -370,53 +400,59 @@ export interface LoggerMeterSettings<T = NumString> {
370
400
 
371
401
  export interface LoggerProcessSettings extends LoggerColor {
372
402
  cpu?: boolean;
373
- cpu_bar?: boolean | ArrayOf<number>;
403
+ cpu_bar?: boolean | number | number[];
404
+ cpu_bar_color?: [typeof IBackgroundColor, typeof IBackgroundColor, typeof IBackgroundColor];
374
405
  cpu_single_core?: boolean;
375
406
  mem?: boolean;
376
407
  mem_format?: "%" | Unit;
377
408
  }
378
409
 
379
- export interface LoggerFormat<T = NumString> {
380
- width?: T;
410
+ export interface LoggerFormatColor {
381
411
  color?: ForegroundColor;
382
412
  bg_color?: BackgroundColor;
413
+ }
414
+
415
+ export interface LoggerFormat<T = number | string> extends LoggerFormatColor {
416
+ width?: T;
417
+ alt_color?: ForegroundColor;
383
418
  bg_alt_color?: BackgroundColor;
384
419
  bold?: boolean;
385
420
  justify?: TextAlign;
386
421
  unit?: string;
387
422
  as?: StringMap;
423
+ braces?: string | [string, string];
388
424
  }
389
425
 
390
426
  export interface HttpSettings {
391
- version?: NumString;
392
- timeout?: NumString;
427
+ version?: number | string;
428
+ timeout?: number | string;
393
429
  headers?: HttpOutgoingHeaders;
394
- certs?: ObjectMap<SecureConfig<ArrayOf<string>>>;
430
+ certs?: ObjectMap<SecureConfig<string | string[]>>;
395
431
  }
396
432
 
397
433
  export interface HttpDiskSettings extends IncludeAction {
398
434
  enabled?: boolean;
399
- limit?: NumString;
400
- expires?: NumString;
435
+ limit?: number | string;
436
+ expires?: number | string;
401
437
  }
402
438
 
403
439
  export interface HttpMemorySettings extends HttpDiskSettings {
404
- limit_all?: NumString;
405
- to_disk?: NumString | [NumString, NumString?];
406
- purge_amount?: NumString;
440
+ limit_all?: number | string;
441
+ to_disk?: number | string | [number | string, (number | string)?];
442
+ purge_amount?: number | string;
407
443
  }
408
444
 
409
445
  export interface HttpConnectSettings {
410
- timeout?: NumString;
411
- retry_wait?: NumString;
412
- retry_after?: NumString;
413
- retry_limit?: NumString;
414
- redirect_limit?: NumString;
446
+ timeout?: number | string;
447
+ retry_wait?: number | string;
448
+ retry_after?: number | string;
449
+ retry_limit?: number | string;
450
+ redirect_limit?: number | string;
415
451
  }
416
452
 
417
453
  export interface DnsLookupSettings {
418
- family?: NumString;
419
- expires?: NumString;
454
+ family?: number | string;
455
+ expires?: number | string;
420
456
  resolve?: ObjectMap<Partial<LookupAddress>>;
421
457
  }
422
458
 
@@ -424,18 +460,18 @@ export interface HashConfig extends IncludeAction<ObjectMap<string[] | "*">> {
424
460
  enabled?: boolean;
425
461
  algorithm?: HashAlgorithm;
426
462
  etag?: boolean;
427
- expires?: NumString;
463
+ expires?: number | string;
428
464
  renew?: boolean;
429
- limit?: NumString;
465
+ limit?: number | string;
430
466
  }
431
467
 
432
- export interface BroadcastServer extends ServerInfo<ArrayOf<NumString>> {
468
+ export interface BroadcastServer extends ServerInfo<ArrayOf<number | string>> {
433
469
  out?: string | BroadcastOutMethod;
434
470
  }
435
471
 
436
472
  export interface ExecOptions extends SpawnOptions {
437
473
  command?: string;
438
- warn?: ArrayOf<string>;
474
+ warn?: string | string[];
439
475
  }
440
476
 
441
477
  export interface PurgeAction {
@@ -457,12 +493,12 @@ export interface CipherConfig {
457
493
  iv?: BinaryLike;
458
494
  }
459
495
 
460
- export interface ServerInfo<T = NumString> extends ServerPort<T> {
496
+ export interface ServerInfo<T = number | string> extends ServerPort<T> {
461
497
  enabled?: boolean;
462
498
  secure?: SecureConfig & ServerPort<T>;
463
499
  }
464
500
 
465
501
  export type WatchUserSettings = ObjectMap<WatchInterval>;
466
- export type DocumentTransform = Null<boolean | "etag" | HashAlgorithm | HashConfig>;
502
+ export type DocumentTransform = boolean | "etag" | HashAlgorithm | HashConfig | null;
467
503
 
468
504
  export type { ExecAction, PermissionReadWrite, SecureConfig };
package/lib/squared.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  /// <reference path="type.d.ts" />
2
- /// <reference path="object.d.ts" />
3
2
 
4
3
  import type { BinaryToTextEncoding } from "crypto";
5
4
 
@@ -23,20 +22,13 @@ interface BlobValue extends KeyValue<string, unknown> {
23
22
  filename?: string;
24
23
  }
25
24
 
26
- interface BoxRect<T = number> {
27
- top: T;
28
- right: T;
29
- bottom: T;
30
- left: T;
31
- }
32
-
33
- interface BoxRectDimension extends BoxRect, Dimension {
34
- numberOfLines?: number;
35
- overflow?: boolean;
25
+ export interface KeyValue<T, out U> {
26
+ key: T;
27
+ value: U;
36
28
  }
37
29
 
38
30
  export interface FileAsset extends TextAsset, OutputAction, DocumentAction, MultipartAction, ResourceAction, IncrementalAction, ChecksumAction {
39
- format?: ArrayOf<string>;
31
+ format?: string | string[];
40
32
  dataView?: NodeJS.ArrayBufferView;
41
33
  base64?: string;
42
34
  imported?: boolean | string[];
@@ -53,7 +45,7 @@ export interface DataSource<T = unknown> extends DocumentAction {
53
45
  preRender?: string | FunctionType;
54
46
  whenEmpty?: string | FunctionType;
55
47
  removeEmpty?: boolean;
56
- ignoreCache?: boolean | 0 | 1 | [number, number?, number?];
48
+ ignoreCache?: IntBool | FirstOf<number, number>;
57
49
  transactionState?: number;
58
50
  transactionFail?: boolean;
59
51
  }
@@ -64,10 +56,11 @@ export interface DbDataSource<T = unknown, U = unknown, V = unknown, W = unknown
64
56
  credential?: string | W;
65
57
  options?: U;
66
58
  update?: V;
67
- withCommand?: string | TupleOf<string>;
59
+ withCommand?: string | [string, string];
68
60
  parallel?: boolean;
61
+ flat?: number;
69
62
  willAbort?: boolean;
70
- streamRow?: Null<boolean | string | ((row: unknown) => Void<Error | false>)>;
63
+ streamRow?: boolean | string | ((row: unknown) => Error | false | void) | null;
71
64
  usePool?: boolean | X;
72
65
  }
73
66
 
@@ -91,11 +84,11 @@ export interface WatchAction {
91
84
  }
92
85
 
93
86
  export interface BundleAction<T = unknown> {
94
- bundleId?: NumString;
87
+ bundleId?: number | string;
95
88
  bundleIndex?: number;
96
89
  bundleReplace?: T;
97
90
  bundleQueue?: Promise<unknown>[];
98
- trailingContent?: ArrayOf<string>;
91
+ trailingContent?: string | string[];
99
92
  exported?: boolean;
100
93
  }
101
94
 
@@ -105,7 +98,7 @@ export interface ChecksumAction {
105
98
  }
106
99
 
107
100
  export interface DocumentAction {
108
- document?: ArrayOf<string>;
101
+ document?: string | string[];
109
102
  encoding?: BufferEncoding;
110
103
  }
111
104
 
@@ -208,6 +201,7 @@ export interface ViewEngine {
208
201
  name?: string;
209
202
  singleRow?: boolean;
210
203
  outputEmpty?: boolean;
204
+ expires?: number | string;
211
205
  options?: {
212
206
  compile?: PlainObject;
213
207
  output?: PlainObject;
@@ -225,7 +219,7 @@ export interface CompressFormat extends CompressLevel {
225
219
  condition?: string;
226
220
  plugin?: string;
227
221
  timeout?: number;
228
- options?: PlainObject & { apiKey?: string };
222
+ options?: PlainObject;
229
223
  }
230
224
 
231
225
  export interface WatchInterval<T = FileAsset> extends TaskBase {
@@ -242,7 +236,7 @@ export interface WatchReload extends WebSocketClient {
242
236
 
243
237
  export interface WebSocketResponse {
244
238
  event?: string;
245
- socketId?: ArrayOf<string>;
239
+ socketId?: string | string[];
246
240
  type?: string;
247
241
  encoding?: BufferEncoding;
248
242
  value?: unknown;
@@ -268,17 +262,17 @@ export interface BroadcastResponse extends WebSocketResponse {
268
262
 
269
263
  export interface FileInfo {
270
264
  name: string;
271
- size: NumString;
265
+ size: number | string;
272
266
  }
273
267
 
274
268
  export interface RequestBase<T = PlainObject> {
275
269
  baseUrl?: string;
276
270
  priority?: number;
277
271
  threads?: number;
278
- broadcastId?: ArrayOf<string>;
279
- log?: boolean | ArrayOf<string> | T;
280
- error?: { abort?: boolean | ArrayOf<string>; fatal?: boolean };
281
- ignoreExtensions?: boolean | ArrayOf<string>;
272
+ broadcastId?: string | string[];
273
+ log?: boolean | string | string[] | T;
274
+ error?: { abort?: boolean | string | string[]; fatal?: boolean };
275
+ ignoreExtensions?: boolean | string | string[];
282
276
  }
283
277
 
284
278
  export interface RequestData extends RequestBase, ImportAction<StringMap>, IncrementalAction {
@@ -322,32 +316,7 @@ export interface ResponseError {
322
316
 
323
317
  export interface RequestObserve extends WebSocketClient {
324
318
  action?: string;
325
- expires?: NumString;
326
- }
327
-
328
- export interface FinalizedElement {
329
- documentId: string;
330
- bounds: BoxRectDimension;
331
- css: PlainObject;
332
- outerWrapperIds?: string[];
333
- }
334
-
335
- export interface ConditionProperty {
336
- conditionText: string;
337
- }
338
-
339
- export interface CssConditionData extends ConditionProperty {
340
- name?: string;
341
- conditionText: string;
342
- }
343
-
344
- export interface ControllerSettingsDirectoryUI {
345
- layout: string;
346
- string: string;
347
- font: string;
348
- image: string;
349
- video: string;
350
- audio: string;
319
+ expires?: number | string;
351
320
  }
352
321
 
353
322
  export interface ChecksumBase<T = BinaryToTextEncoding> {
@@ -357,15 +326,15 @@ export interface ChecksumBase<T = BinaryToTextEncoding> {
357
326
 
358
327
  export interface ChecksumOutput<T = BinaryToTextEncoding> extends ChecksumBase<T> {
359
328
  filename?: string;
360
- include?: ArrayOf<string>;
361
- exclude?: ArrayOf<string>;
329
+ include?: string | string[];
330
+ exclude?: string | string[];
362
331
  recursive?: boolean | 1;
363
332
  }
364
333
 
365
334
  export interface TaskBase {
366
- interval?: NumString;
367
- start?: NumString;
368
- expires?: NumString;
335
+ interval?: number | string;
336
+ start?: number | string;
337
+ expires?: number | string;
369
338
  }
370
339
 
371
340
  export type WebSocketEvent = "close" | "error";
package/lib/type.d.ts CHANGED
@@ -1,31 +1,36 @@
1
- /* eslint @typescript-eslint/no-explicit-any: "off", @typescript-eslint/no-redeclare: "off" */
2
-
1
+ /** @deprecated */
3
2
  type Undef<T> = T | undefined;
3
+ /** @deprecated */
4
4
  type Null<T> = T | null;
5
5
  type Void<T> = T | void;
6
6
  type Optional<T> = T | null | undefined;
7
7
  type Nullable<T> = { [P in keyof T]: T[P] | null; };
8
- type Writeable<T> = { -readonly [P in keyof T]: T[P] };
8
+ type Writable<T> = { -readonly [P in keyof T]: T[P] };
9
9
  type KeyOfType<T, U = any, V = any> = { [K in keyof T]: K extends U ? T[K] extends V ? K : never : never }[keyof T];
10
10
  type MapOfType<T, U = any, V = any> = { [K in KeyOfType<T, U, V>]: K extends U ? T[K] extends V ? T[K] : never : never };
11
11
 
12
12
  type Constructor<out T> = new(...args: any[]) => T;
13
+ type ConstructorDerived<T> = Pick<T, { [K in keyof T]: T[K] extends new() => any ? never : K }[keyof T]>;
13
14
 
14
15
  type FunctionType<T = unknown, U = unknown> = (...args: U[]) => T;
15
16
  type FunctionArgs<T extends unknown[], U = unknown> = (...args: T) => U;
16
17
 
18
+ /** @deprecated */
17
19
  type NumString = number | string;
20
+ type IntBool = boolean | 0 | 1;
18
21
  type ArrayOf<T> = T | T[];
22
+ /** @deprecated */
19
23
  type TupleOf<T> = [T, T];
20
- type FirstOf<T, U = boolean> = T[] | [U, ...T[]];
24
+ type FirstOf<T, U = boolean> = T extends U ? [T, ...T[]] : T[] | [U, T, ...T[]];
21
25
  type Bufferable = string | Buffer;
22
26
 
23
27
  type AnyObject = Record<string, unknown>;
24
28
  type PlainObject = Record<string | number | symbol, unknown>;
25
29
 
26
30
  type StandardMap = Record<string, any>;
27
- type StringMap = Record<string, Undef<string>>;
28
- type ObjectMap<T> = Record<string, Undef<T>>;
31
+ type StringMap = Record<string, string | undefined>;
32
+ type ObjectMap<T> = Record<string, T | undefined>;
33
+ type IterableMap<T> = Record<string, T>;
29
34
 
30
35
  type PropertyAction<T, U extends string, V extends boolean = false> = {
31
36
  [K in keyof T as `${U}${V extends true ? string & K : Capitalize<string & K>}`]: T[K];