@e-mc/types 0.10.6 → 0.11.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/db.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { DataSource, DbDataSource } from './squared';
2
2
 
3
3
  import type { CacheOptions, IdentifierAction } from './core';
4
+ import type { AuthValue } from './http';
4
5
 
5
6
  import type { DB_TYPE } from '../index.d';
6
7
 
@@ -32,14 +33,12 @@ export interface ProcessRowsOptions {
32
33
  parallel?: boolean;
33
34
  }
34
35
 
35
- export interface DbConnection {
36
+ export interface DbConnection extends Required<AuthValue> {
37
+ protocol: string;
36
38
  hostname: string;
37
- password: string;
38
- pathname: string;
39
39
  port: string;
40
- protocol: string;
40
+ pathname: string;
41
41
  search: string;
42
- username: string;
43
42
  database: string;
44
43
  }
45
44
 
@@ -56,16 +55,16 @@ export interface ServerAuth<T = number> extends AuthValue, IdentifierAction {
56
55
  database?: string;
57
56
  }
58
57
 
59
- export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
58
+ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
60
59
  client: U;
61
60
  lastAccessed: number;
62
61
  success: number;
63
62
  failed: number;
64
63
  poolKey: string;
65
- uuidKey: Null<AuthValue>;
64
+ uuidKey: AuthValue | null;
66
65
  add(item: T, uuidKey?: string): this;
67
66
  has(item: T): boolean;
68
- getConnection(): Promise<V>;
67
+ getConnection(credential?: W): Promise<V>;
69
68
  remove(): void;
70
69
  detach(force?: boolean): Promise<void>;
71
70
  close(): Promise<void>;
@@ -78,22 +77,26 @@ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V =
78
77
  set parent(value: ObjectMap<IDbPool<T>>);
79
78
  }
80
79
 
81
- export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
82
- findKey<W extends IDbPool, X extends DbDataSource>(pools: ObjectMap<W>, uuidKey: unknown, poolKey: Undef<string>, ...items: X[]): Null<W>;
83
- validateKey<W extends IDbPool>(pools: ObjectMap<W>, username: string, uuidKey: unknown): [string, Null<W>];
84
- checkTimeout<W extends IDbPool>(pools: ObjectMap<W>, value: number, limit?: number): Promise<number>;
85
- readonly prototype: IDbPool<T, U, V>;
86
- new(pool: U, poolKey: string, uuidKey?: Null<AuthValue>): IDbPool<T, U, V>;
80
+ export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown, V = unknown, W = unknown> {
81
+ CACHE_UNUSED: readonly string[];
82
+ asString(credential: unknown): string;
83
+ sanitize(credential: unknown): unknown;
84
+ removeUUIDKey<X>(credential: X & IdentifierAction): X;
85
+ findKey<X extends IDbPool, Y extends DbDataSource>(pools: ObjectMap<X>, uuidKey: unknown, poolKey: string | undefined, ...items: Y[]): X | null;
86
+ validateKey<X extends IDbPool>(pools: ObjectMap<X>, username: string, uuidKey: unknown): [string, X | null];
87
+ checkTimeout<X extends IDbPool>(pools: ObjectMap<X>, value: number, limit?: number): Promise<number>;
88
+ readonly prototype: IDbPool<T, U, V, W>;
89
+ new(pool: U, poolKey: string, uuidKey?: AuthValue | null): IDbPool<T, U, V, W>;
87
90
  }
88
91
 
89
92
  export interface TimeoutAction {
90
- timeout?: NumString;
93
+ timeout?: number | string;
91
94
  }
92
95
 
93
96
  export type DbSource = "mariadb" | "mongodb" | "mssql" | "mysql" | "oracle" | "postgres" | "redis";
94
97
  export type QueryResult = unknown[];
95
- export type BatchQueryResult = Null<QueryResult>[];
96
- export type CheckObjectCallback = (item: DataSource, data: unknown) => Null<QueryResult>;
98
+ export type BatchQueryResult = QueryResult | null[];
99
+ export type CheckObjectCallback = (item: DataSource, data: unknown) => QueryResult | null;
97
100
  export type ErrorQueryCallback = (err: unknown, item: DbDataSource, commandType?: number) => boolean;
98
101
 
99
102
  export interface SQL_COMMAND {
package/lib/document.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { LogComponent, LogDate } from './logger';
7
7
  import type { DocumentTransform } from './settings';
8
8
 
9
9
  export interface DocumentAsset extends ExternalAsset, StorageAction<CloudStorage> {
10
+ inlineFilename?: string;
10
11
  initialValue?: InitialValue & { inlineFilename?: string };
11
12
  }
12
13
 
@@ -15,7 +16,7 @@ export interface StartOfSourceMap {
15
16
  sourceRoot?: string;
16
17
  }
17
18
 
18
- export interface RawSourceMap<T = NumString> extends StartOfSourceMap {
19
+ export interface RawSourceMap<T = number | string> extends StartOfSourceMap {
19
20
  version: T;
20
21
  sources: string[];
21
22
  names: string[];
@@ -59,7 +60,7 @@ export interface TransformAction {
59
60
 
60
61
  export interface TransformResult extends SourceCode {
61
62
  type?: string;
62
- chunks?: Null<(SourceCode & ChunkFile)[]>;
63
+ chunks?: Array<SourceCode & ChunkFile> | null;
63
64
  sourceFiles?: string[];
64
65
  }
65
66
 
@@ -69,8 +70,8 @@ export interface TransformOutput extends Partial<LocationUri>, Omit<SourceInput<
69
70
  metadata?: unknown;
70
71
  external?: PlainObject;
71
72
  productionRelease?: boolean;
72
- getMainFile?(code?: string, imports?: StringMap): Undef<SourceInput<string>>;
73
- getSourceFiles?(imports?: StringMap): Undef<SourceInput>;
73
+ getMainFile?(code?: string, imports?: StringMap): SourceInput<string> | undefined;
74
+ getSourceFiles?(imports?: StringMap): SourceInput | undefined;
74
75
  }
75
76
 
76
77
  export interface TransformOptions<T = AnyObject, U = T> extends TransformOutput {
@@ -85,10 +86,11 @@ export interface ITransformSeries<T = AnyObject, U = T> extends IModule, Transfo
85
86
  init(instance: IModule, dirname?: string): this;
86
87
  close(instance: IModule): void;
87
88
  createSourceMap(value: string): SourceMap;
88
- getMainFile(code?: string, imports?: StringMap): Undef<SourceInput<string>>;
89
- getSourceFiles(imports?: StringMap): Undef<SourceInput>;
89
+ getMainFile(code?: string, imports?: StringMap): SourceInput<string> | undefined;
90
+ getSourceFiles(imports?: StringMap): SourceInput | undefined;
90
91
  toBaseConfig(all?: boolean): T;
91
- upgrade<V = unknown>(context: V, dirname?: string, name?: string): V;
92
+ upgrade<V = unknown>(context: V, dirname?: string, pkgname?: string): V;
93
+ upgradeESM<V = unknown>(context: V, dirname?: string, pkgname?: string): Promise<V>;
92
94
  set code(value);
93
95
  get code(): string;
94
96
  get out(): IOut;
@@ -136,12 +138,12 @@ export interface SourceMap extends SourceCode {
136
138
  reset(): void;
137
139
  nextMap(name: string, code: string, map: unknown, sourceMappingURL?: string, emptySources?: boolean): boolean;
138
140
  set map(value);
139
- get map(): Undef<RawSourceMap>;
141
+ get map(): RawSourceMap | undefined;
140
142
  }
141
143
 
142
144
  export interface SourceMapConstructor {
143
- findSourceMap(code?: string, uri?: string): Undef<RawSourceMap>;
144
- removeSourceMappingURL(value: string): [string, string?, Null<RawSourceMap>?];
145
+ findSourceMap(code?: string, uri?: string): RawSourceMap | undefined;
146
+ removeSourceMappingURL(value: string): [string, string?, (RawSourceMap | null)?];
145
147
  isRaw(map: unknown): map is RawSourceMap;
146
148
  readonly prototype: SourceMap;
147
149
  new(code: string, remove: boolean): SourceMap;
@@ -174,8 +176,8 @@ export interface LintMessage {
174
176
  export interface GenerateLintTableOptions extends Partial<LocationUri> {
175
177
  leadingText?: string;
176
178
  trailingText?: string;
177
- errorCount?: number;
178
- warningCount?: number;
179
+ errorCount?: number | [number, number];
180
+ warningCount?: number | [number, number];
179
181
  fatalErrorCount?: number;
180
182
  timeStamp?: LogDate;
181
183
  ruleWidth?: number;
@@ -188,11 +190,10 @@ export interface CustomizeOptions {
188
190
 
189
191
  export interface AsSourceFileOptions {
190
192
  encoding?: BufferEncoding;
191
- persist?: boolean;
192
193
  cache?: boolean;
193
194
  }
194
195
 
195
- export type Transformer = FunctionType<Undef<Promise<string> | string>>;
196
+ export type Transformer = FunctionType<Promise<string> | string> | undefined;
196
197
  export type ConfigOrTransformer = AnyObject | Transformer;
197
- export type PluginConfig = [string, Undef<ConfigOrTransformer>, Undef<AnyObject>, boolean?] | [];
198
- export type TransformCallback<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> = (this: T, instance: IDocument<T, U>, requireOrDocumentDir?: NodeJS.Require | string) => Void<Promise<void>>;
198
+ export type PluginConfig = [string, ConfigOrTransformer | undefined, AnyObject | undefined, boolean?] | [];
199
+ export type TransformCallback<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> = (this: T, instance: IDocument<T, U>, requireOrDocumentDir?: NodeJS.Require | string) => Promise<void >;
@@ -10,13 +10,13 @@ import type { RequestInit } from './request';
10
10
  import type { FETCH_TYPE } from '../index.d';
11
11
 
12
12
  export const enum FINALIZE_STATE {
13
- READY = 0,
14
- COMMIT = 1,
15
- END = 2,
16
- RESTART = 3,
17
- QUEUED = 4,
18
- RESTARTED = 5,
19
- ABORTED = 6
13
+ READY,
14
+ COMMIT,
15
+ END,
16
+ RESTART,
17
+ QUEUED,
18
+ RESTARTED,
19
+ ABORTED
20
20
  }
21
21
 
22
22
  export const enum INCREMENTAL {
@@ -26,8 +26,8 @@ export const enum INCREMENTAL {
26
26
  EXISTS = 'exists'
27
27
  }
28
28
 
29
- export interface RequestData<T extends ExternalAsset = ExternalAsset> extends IRequestData<T>, RequestInit {
30
- timeout?: ObjectMap<NumString>;
29
+ export interface RequestData<T extends ExternalAsset = ExternalAsset, U extends HostInitLog = HostInitLog> extends IRequestData<T, U>, RequestInit {
30
+ timeout?: ObjectMap<number | string>;
31
31
  }
32
32
 
33
33
  export interface InstallData<T extends IModule = IModule, U extends ModuleConstructor = ModuleConstructor> {
@@ -53,14 +53,14 @@ export interface IHttpDiskCache<T extends ExternalAsset = ExternalAsset> {
53
53
  }
54
54
 
55
55
  export interface IHttpMemoryCache<T extends ExternalAsset = ExternalAsset> extends IHttpDiskCache<T> {
56
- toDisk: TupleOf<number>;
56
+ toDisk: [number, number];
57
57
  purge(percent?: number, limit?: number): void;
58
58
  withinDisk(value: T | number): boolean;
59
59
  clear(uri?: string | URL): void;
60
60
  }
61
61
 
62
62
  export interface HttpDiskCacheAddOptions {
63
- buffer?: Null<Bufferable>;
63
+ buffer?: Bufferable | null;
64
64
  contentLength?: number;
65
65
  }
66
66
 
@@ -99,6 +99,7 @@ export interface DeleteFileAddendum {
99
99
  export interface HostInitLog extends IHostInitLog {
100
100
  useNumeric: boolean;
101
101
  showSize?: boolean;
102
+ showDiff?: string[];
102
103
  }
103
104
 
104
105
  export interface FindAssetOptions<T extends ExternalAsset = ExternalAsset> {
package/lib/http.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { LookupAddress } from 'dns';
2
- import type { ClientRequest, Agent as HttpAgent, OutgoingHttpHeaders } from 'http';
3
- import type { Agent as HttpsAgent } from 'https';
4
- import type { ClientHttp2Stream } from 'http2';
5
- import type { SecureVersion } from 'tls';
1
+ import type { LookupAddress } from 'node:dns';
2
+ import type { ClientRequest, Agent as HttpAgent, OutgoingHttpHeaders } from 'node:http';
3
+ import type { Agent as HttpsAgent } from 'node:https';
4
+ import type { ClientHttp2Stream } from 'node:http2';
5
+ import type { SecureVersion } from 'node:tls';
6
6
 
7
7
  export const enum HTTP_STATUS {
8
8
  CONTINUE = 100,
@@ -93,10 +93,11 @@ export interface SecureConfig<T = string, U = T> {
93
93
  key?: U;
94
94
  cert?: T;
95
95
  passphrase?: U;
96
+ ciphers?: string;
96
97
  version?: SecureVersion;
97
98
  }
98
99
 
99
- export interface ServerPort<T = NumString> {
100
+ export interface ServerPort<T = number | string> {
100
101
  port?: T;
101
102
  }
102
103
 
package/lib/image.d.ts CHANGED
@@ -1,44 +1,54 @@
1
- import type { MimeTypeAction } from './squared';
2
-
3
- import type { BroadcastValue, LogTime } from './logger';
4
- import type { ImageModule } from './settings';
5
-
6
- export interface CommandData {
7
- resize?: ResizeData;
8
- crop?: CropData;
9
- rotate?: RotateData;
10
- quality?: QualityData;
11
- method?: MethodData;
12
- opacity?: number;
13
- }
14
-
15
- export interface RotateData {
16
- values: number[];
17
- color: number;
18
- }
19
-
20
- export interface ResizeData extends Dimension {
21
- mode: string;
22
- color: number;
23
- align: Undef<string>[];
24
- algorithm?: string;
25
- }
26
-
27
- export interface CropData extends Point, Dimension {}
28
-
29
- export interface QualityData {
30
- value: number;
31
- nearLossless: number;
32
- method: number;
33
- preset?: string;
34
- }
35
-
36
- export interface TransformOptions extends MimeTypeAction {
37
- tempFile?: boolean;
38
- startTime?: LogTime;
39
- module?: ImageModule;
40
- broadcastId?: BroadcastValue;
41
- cache?: boolean;
42
- }
43
-
1
+ import type { MimeTypeAction } from './squared';
2
+
3
+ import type { BroadcastValue, LogTime } from './logger';
4
+ import type { ImageModule } from './settings';
5
+
6
+ export interface CommandData {
7
+ resize?: ResizeData | null;
8
+ crop?: CropData | null;
9
+ rotate?: RotateData | null;
10
+ quality?: QualityData | null;
11
+ method?: MethodData | null;
12
+ opacity?: number;
13
+ }
14
+
15
+ export interface RotateData {
16
+ values: number[];
17
+ color: number;
18
+ }
19
+
20
+ export interface ResizeData extends Dimension {
21
+ mode: string;
22
+ color: number;
23
+ align: [string | undefined, string | undefined];
24
+ algorithm?: string;
25
+ }
26
+
27
+ export interface CropData extends Point, Dimension {}
28
+
29
+ export interface QualityData {
30
+ value: number;
31
+ nearLossless: number;
32
+ method: number;
33
+ preset?: string;
34
+ }
35
+
36
+ export interface TransformOptions extends MimeTypeAction {
37
+ tempFile?: boolean;
38
+ startTime?: LogTime;
39
+ module?: ImageModule;
40
+ broadcastId?: BroadcastValue;
41
+ cache?: boolean;
42
+ }
43
+
44
+ export interface Point {
45
+ x: number;
46
+ y: number;
47
+ }
48
+
49
+ export interface Dimension {
50
+ width: number;
51
+ height: number;
52
+ }
53
+
44
54
  export type MethodData = [string, unknown[]?][];