@e-mc/types 0.11.8 → 0.12.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.
package/lib/request.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import type { EncodingAction } from './squared';
2
+
1
3
  import type { IRequest } from './index';
2
4
  import type { BinaryAction } from './asset';
3
- import type { HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
5
+ import type { HeadersAction, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
4
6
  import type { IncludeAction } from './module';
5
7
  import type { HttpHostSettings, RequestModule } from './settings';
6
8
 
@@ -16,6 +18,11 @@ interface SilentAction {
16
18
  silent?: boolean;
17
19
  }
18
20
 
21
+ interface CopyAction extends HeadersAction {
22
+ pathname?: string;
23
+ signal?: AbortSignal;
24
+ }
25
+
19
26
  interface ProtocolAction {
20
27
  httpVersion?: HttpProtocolVersion;
21
28
  ipVersion?: InternetProtocolVersion;
@@ -117,7 +124,7 @@ export interface HttpAdapterConstructor<T extends OpenOptions = OpenOptions> {
117
124
  new(instance: IRequest, state: ControllerState, uri: string | URL, options: T): IHttpAdapter<T>;
118
125
  }
119
126
 
120
- export interface OpenOptions extends KeepAliveAction, SilentAction {
127
+ export interface OpenOptions extends KeepAliveAction, SilentAction, EncodingAction {
121
128
  host?: IHttpHost;
122
129
  url?: URL;
123
130
  base?: boolean;
@@ -128,7 +135,6 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
128
135
  followRedirect?: boolean;
129
136
  expectContinue?: boolean;
130
137
  expectTimeout?: number;
131
- encoding?: BufferEncoding;
132
138
  maxBufferSize?: number | string;
133
139
  format?: BufferFormat | { out?: BufferFormat; parser?: PlainObject };
134
140
  headers?: OutgoingHttpHeaders | Headers;
@@ -163,10 +169,11 @@ export interface FormDataPart {
163
169
  filename?: string;
164
170
  }
165
171
 
166
- export interface Aria2Options extends BinaryAction, SilentAction {
167
- pathname?: string;
168
- headers?: OutgoingHttpHeaders | Headers;
169
- signal?: AbortSignal;
172
+ export interface Aria2Options extends BinaryAction, SilentAction, CopyAction {}
173
+
174
+ export interface RcloneOptions extends Aria2Options {
175
+ command?: "copy" | "copyto" | "copyurl";
176
+ update?: boolean;
170
177
  }
171
178
 
172
179
  export interface HostConfig extends OpenOptions {
package/lib/settings.d.ts CHANGED
@@ -12,6 +12,7 @@ import type { SpawnOptions } from 'node:child_process';
12
12
  import type { BinaryLike, CipherGCMTypes } from 'node:crypto';
13
13
  import type { LookupAddress } from 'node:dns';
14
14
  import type { BrotliOptions, ZlibOptions } from 'node:zlib';
15
+ // @ts-ignore
15
16
  import type { BackgroundColor as IBackgroundColor } from 'chalk';
16
17
  // @ts-ignore
17
18
  import type { Unit } from 'bytes';
@@ -22,13 +23,13 @@ import type { Options as ZopfliOptions } from 'node-zopfli';
22
23
  // @ts-ignore
23
24
  import type { PicomatchOptions } from 'picomatch';
24
25
 
25
- interface MinMax<T = number> {
26
- min?: T;
27
- max?: T;
26
+ export interface DownloadAction {
27
+ bin?: string | false;
28
+ exec?: ExecAction;
28
29
  }
29
30
 
30
- export interface HandlerModule<T = PlainObject> extends HandlerSettings<T> {
31
- handler?: string;
31
+ export interface HandlerModule<T = PlainObject, U = string> extends HandlerSettings<T> {
32
+ handler?: U;
32
33
  extensions?: string[];
33
34
  }
34
35
 
@@ -75,6 +76,13 @@ export interface ProcessModule<T = PlainObject> extends HandlerSettings<T> {
75
76
  expires?: number | string;
76
77
  priority: { bypass?: number | string } & MinMax<number | string>;
77
78
  };
79
+ worker?: {
80
+ users?: boolean | string[];
81
+ max?: number | string;
82
+ max_expires?: number | string;
83
+ locked?: boolean;
84
+ channel?: MinMax<number | string> & { expires?: number | string; verbose?: boolean };
85
+ };
78
86
  limit?: number | string;
79
87
  sub_limit?: number | string;
80
88
  expires?: number | string;
@@ -107,9 +115,7 @@ export interface PermissionSettings extends PlainObject {
107
115
 
108
116
  export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
109
117
  expires?: number | string;
110
- aria2?: {
111
- bin?: string | false;
112
- exec?: ExecAction;
118
+ aria2?: DownloadAction & {
113
119
  check_integrity?: boolean;
114
120
  update_status?: number | string | { interval?: number | string; broadcast_only?: boolean };
115
121
  max_concurrent_downloads?: number | string;
@@ -122,8 +128,52 @@ export interface DownloadModule<T = PlainObject> extends HandlerSettings<T> {
122
128
  lowest_speed_limit?: number | string;
123
129
  always_resume?: boolean;
124
130
  file_allocation?: "none" | "prealloc" | "trunc" | "falloc";
131
+ proxy?: {
132
+ http: string;
133
+ https: string;
134
+ ftp: string;
135
+ all: string;
136
+ } | false;
137
+ no_proxy?: string;
125
138
  conf_path?: string;
126
139
  };
140
+ rclone?: DownloadAction & {
141
+ /* Copy */
142
+ check_first?: boolean;
143
+ checksum?: boolean;
144
+ cutoff_mode?: "HARD" | "SOFT" | "CAUTIOUS";
145
+ ignore_case_sync?: boolean;
146
+ ignore_checksum?: boolean;
147
+ ignore_existing?: boolean;
148
+ ignore_size?: boolean;
149
+ ignore_times?: boolean;
150
+ immutable?: boolean;
151
+ inplace?: boolean;
152
+ max_backlog?: number;
153
+ max_duration?: string;
154
+ max_transfer?: string;
155
+ metadata?: boolean;
156
+ modify_window?: string;
157
+ multi_thread_chunk_size?: string;
158
+ multi_thread_cutoff?: string;
159
+ multi_thread_streams?: number;
160
+ multi_thread_write_buffer_size?: string;
161
+ no_check_dest?: boolean;
162
+ no_traverse?: boolean;
163
+ no_update_dir_modtime?: boolean;
164
+ refresh_times?: boolean;
165
+ size_only?: boolean;
166
+ update?: boolean;
167
+ /* Listing */
168
+ fast_list?: boolean;
169
+ /* Networking */
170
+ bind?: string;
171
+ contimeout?: string;
172
+ disable_http2?: boolean;
173
+ timeout?: string;
174
+ /* Config */
175
+ config?: string;
176
+ };
127
177
  }
128
178
 
129
179
  export interface DocumentModule<T = DocumentSettings, U = DbSettings> extends ClientModule<T> {
@@ -333,11 +383,13 @@ export interface CloudAuthSettings {
333
383
  database?: boolean;
334
384
  }
335
385
 
336
- export interface ErrorModule<T = ErrorSettings> extends HandlerModule<T> {
386
+ export interface ErrorModule<T = ErrorSettings> extends HandlerModule<T, ErrorOutMethod> {
337
387
  out?: string | ErrorOutMethod;
338
388
  abort?: string[];
339
389
  fatal?: boolean;
390
+ /** @deprecated retry_limit */
340
391
  recursion_limit?: number | string;
392
+ retry_limit?: number | string;
341
393
  }
342
394
 
343
395
  export interface ErrorSettings extends PlainObject {
@@ -353,7 +405,7 @@ export interface LoggerProgress extends LoggerFormatColor {
353
405
  raw_mode?: boolean;
354
406
  }
355
407
 
356
- export interface LoggerModule<T = number | string, U = boolean | T, V = LoggerFormat<T>> {
408
+ export interface LoggerModule<T = number | string, U = boolean | T, V = LoggerFormat<T>, W = boolean | LoggerProcessSettings> {
357
409
  enabled?: boolean;
358
410
  level?: number | string;
359
411
  production?: string[];
@@ -371,7 +423,7 @@ export interface LoggerModule<T = number | string, U = boolean | T, V = LoggerFo
371
423
  unknown?: boolean | LoggerColor;
372
424
  system?: boolean | LoggerColor;
373
425
  node?: boolean | LoggerColor;
374
- process?: boolean | LoggerProcessSettings;
426
+ process?: W;
375
427
  image?: boolean | LoggerColor;
376
428
  compress?: boolean | LoggerColor;
377
429
  watch?: boolean | LoggerColor;
@@ -402,6 +454,7 @@ export interface LoggerMeterSettings<T = number | string> {
402
454
  }
403
455
 
404
456
  export interface LoggerProcessSettings extends LoggerColor {
457
+ enabled?: boolean;
405
458
  cpu?: boolean;
406
459
  cpu_bar?: boolean | number | number[];
407
460
  cpu_bar_color?: [typeof IBackgroundColor, typeof IBackgroundColor, typeof IBackgroundColor];
@@ -487,6 +540,7 @@ export interface PoolConfig<T = number> extends MinMax {
487
540
  queue_idle?: T;
488
541
  purge?: T;
489
542
  timeout?: number;
543
+ server_timeout?: number;
490
544
  socket_timeout?: number;
491
545
  }
492
546
 
@@ -501,6 +555,11 @@ export interface ServerInfo<T = number | string> extends ServerPort<T> {
501
555
  secure?: SecureConfig & ServerPort<T>;
502
556
  }
503
557
 
558
+ export interface MinMax<T = number> {
559
+ min?: T;
560
+ max?: T;
561
+ }
562
+
504
563
  export type WatchUserSettings = ObjectMap<WatchInterval>;
505
564
  export type DocumentTransform = boolean | "etag" | HashAlgorithm | HashConfig | null;
506
565
 
package/lib/squared.d.ts CHANGED
@@ -83,6 +83,10 @@ export interface WatchAction {
83
83
  watch?: WatchValue;
84
84
  }
85
85
 
86
+ export interface WorkerAction {
87
+ worker?: boolean | number;
88
+ }
89
+
86
90
  export interface BundleAction<T = unknown> {
87
91
  bundleId?: number | string;
88
92
  bundleIndex?: number;
@@ -97,9 +101,12 @@ export interface ChecksumAction {
97
101
  checksumOutput?: ChecksumValue;
98
102
  }
99
103
 
100
- export interface DocumentAction {
104
+ export interface EncodingAction<T = BufferEncoding> {
105
+ encoding?: T;
106
+ }
107
+
108
+ export interface DocumentAction<T = BufferEncoding> extends EncodingAction<T> {
101
109
  document?: string | string[];
102
- encoding?: BufferEncoding;
103
110
  }
104
111
 
105
112
  export interface AttributeAction<T = AttributeMap> {
@@ -197,29 +204,30 @@ export interface LocationUri {
197
204
  filename: string;
198
205
  }
199
206
 
200
- export interface ViewEngine {
207
+ export interface ViewEngine<T = unknown, U = PlainObject> {
201
208
  name?: string;
202
209
  singleRow?: boolean;
203
210
  outputEmpty?: boolean;
204
211
  expires?: number | string;
205
212
  options?: {
206
- compile?: PlainObject;
207
- output?: PlainObject;
213
+ compile?: T;
214
+ output?: U;
208
215
  };
209
216
  }
210
217
 
211
- export interface CompressLevel extends MimeTypeAction {
218
+ export interface CompressLevel {
212
219
  algorithm?: string;
213
220
  level?: number;
214
221
  chunkSize?: number;
215
222
  }
216
223
 
217
- export interface CompressFormat extends CompressLevel {
224
+ export interface CompressFormat extends CompressLevel, MimeTypeAction, WorkerAction {
218
225
  format?: string;
219
226
  condition?: string;
220
227
  plugin?: string;
221
228
  timeout?: number;
222
229
  options?: PlainObject;
230
+ metadata?: PlainObject & MimeTypeAction;
223
231
  }
224
232
 
225
233
  export interface WatchInterval<T = FileAsset> extends TaskBase {
@@ -227,6 +235,7 @@ export interface WatchInterval<T = FileAsset> extends TaskBase {
227
235
  main?: boolean;
228
236
  reload?: WatchReload;
229
237
  assets?: T[];
238
+ recursive?: boolean | string | string[];
230
239
  }
231
240
 
232
241
  export interface WatchReload extends WebSocketClient {
@@ -321,7 +330,9 @@ export interface RequestObserve extends WebSocketClient {
321
330
 
322
331
  export interface ChecksumBase<T = BinaryToTextEncoding> {
323
332
  algorithm?: string;
333
+ /** @deprecated digestEncoding */
324
334
  digest?: T;
335
+ digestEncoding?: T;
325
336
  }
326
337
 
327
338
  export interface ChecksumOutput<T = BinaryToTextEncoding> extends ChecksumBase<T> {
package/lib/type.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- /** @deprecated */
2
- type Undef<T> = T | undefined;
3
- /** @deprecated */
4
- type Null<T> = T | null;
5
1
  type Void<T> = T | void;
6
2
  type Optional<T> = T | null | undefined;
7
3
  type Nullable<T> = { [P in keyof T]: T[P] | null; };
@@ -15,12 +11,8 @@ type ConstructorDerived<T> = Pick<T, { [K in keyof T]: T[K] extends new() => any
15
11
  type FunctionType<T = unknown, U = unknown> = (...args: U[]) => T;
16
12
  type FunctionArgs<T extends unknown[], U = unknown> = (...args: T) => U;
17
13
 
18
- /** @deprecated */
19
- type NumString = number | string;
20
14
  type IntBool = boolean | 0 | 1;
21
15
  type ArrayOf<T> = T | T[];
22
- /** @deprecated */
23
- type TupleOf<T> = [T, T];
24
16
  type FirstOf<T, U = boolean> = T extends U ? [T, ...T[]] : T[] | [U, T, ...T[]];
25
17
  type Bufferable = string | Buffer;
26
18
 
package/lib/watch.d.ts CHANGED
@@ -41,6 +41,7 @@ export interface IFileGroup<T extends ExternalAsset = ExternalAsset> extends IAb
41
41
  find(socketId: string): ISocketRequest | undefined;
42
42
  pause(): void;
43
43
  resume(): void;
44
+ matchRecursive(value: string): boolean;
44
45
  get server(): ws.Server | null;
45
46
  set related(value);
46
47
  get related(): T[];
@@ -54,6 +55,7 @@ export interface IFileGroup<T extends ExternalAsset = ExternalAsset> extends IAb
54
55
  get expired(): boolean;
55
56
  get paused(): boolean;
56
57
  get abortable(): boolean;
58
+ get recursive(): boolean | undefined;
57
59
  }
58
60
 
59
61
  export interface FileGroupConstructor<T extends ExternalAsset = ExternalAsset> {
@@ -62,8 +64,8 @@ export interface FileGroupConstructor<T extends ExternalAsset = ExternalAsset> {
62
64
  checkTimeout(client: ws.WebSocket): boolean;
63
65
  cloneAsset(asset: T): T;
64
66
  readonly prototype: IFileGroup<T>;
65
- new(uri: string, assets: T[], abortable: boolean): IFileGroup<T>;
66
- new(uri: string, assets: T[], startTime?: number, abortable?: boolean): IFileGroup<T>;
67
+ new(uri: string, assets: T[], abortable: boolean, recursive?: boolean | string | string[]): IFileGroup<T>;
68
+ new(uri: string, assets: T[], startTime?: number, abortable?: boolean, recursive?: boolean | string | string[]): IFileGroup<T>;
67
69
  }
68
70
 
69
71
  export interface WatchInitResult<T = ExternalAsset> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.11.8",
3
+ "version": "0.12.1",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -24,6 +24,6 @@
24
24
  "chalk": "4.1.2"
25
25
  },
26
26
  "devDependencies": {
27
- "typescript": "5.7.3"
27
+ "typescript": "5.8.3"
28
28
  }
29
29
  }