@e-mc/types 0.0.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 ADDED
@@ -0,0 +1,264 @@
1
+ import type { DataSource, DbDataSource } from './squared';
2
+
3
+ import type { CacheOptions, IdentifierAction } from './core';
4
+
5
+ import type { DB_TYPE } from '../index.d';
6
+
7
+ import type { SecureContextOptions } from 'tls';
8
+
9
+ // @ts-ignore
10
+ import type { AggregateOptions, BulkWriteOptions, CollectionOptions, CommandOperationOptions, DbOptions, Document, Filter, MongoClientOptions, OptionalUnlessRequiredId, Sort, SortDirection, UpdateFilter } from 'mongodb';
11
+ // @ts-ignore
12
+ import type { CommandOptions } from '@redis/client/dist/lib/command-options';
13
+ // @ts-ignore
14
+ import type { ClientCommandOptions } from '@redis/client/dist/lib/client';
15
+ // @ts-ignore
16
+ import type { RedisClientOptions } from '@redis/client';
17
+ // @ts-ignore
18
+ import type { RedisCommandArgument } from '@redis/client/dist/lib/commands';
19
+ // @ts-ignore
20
+ import type { RedisJSON } from '@redis/json/dist/commands';
21
+ // @ts-ignore
22
+ import type { RediSearchSchema } from 'redis';
23
+ // @ts-ignore
24
+ import type { PoolOptions, QueryOptions } from 'mysql2/promise';
25
+ // @ts-ignore
26
+ import type { PoolConfig as PostgresPoolConfig, QueryArrayConfig } from 'pg';
27
+ // @ts-ignore
28
+ import type { BindParameters, ConnectionAttributes, ExecuteOptions, PoolAttributes } from 'oracledb';
29
+ // @ts-ignore
30
+ import type { ConnectionConfig as IConnectionConfig, ParameterOptions, TediousType, TediousTypes } from 'tedious';
31
+ // @ts-ignore
32
+ import type { PoolConfig as MSSQLPoolConfig } from 'tedious-connection-pool';
33
+
34
+ interface ExecuteAction<T = unknown> {
35
+ params?: T;
36
+ }
37
+
38
+ export interface CascadeAction {
39
+ cascade?: string;
40
+ cacheObjectKey?: string;
41
+ fallback?: unknown;
42
+ }
43
+
44
+ export interface MongoDBDataSource extends DbDataSource<Filter<Document> | MongoDBQueryWithOptions, MongoClientOptions, UpdateFilter<Document> | OptionalUnlessRequiredId<unknown>[], string | MongoDBCredential, string>, MongoDBClientDBOptions, CascadeAction {
45
+ source: "mongodb";
46
+ id?: string;
47
+ updateType?: 0 | 1 | 2 | 3;
48
+ }
49
+
50
+ export interface RedisDataSource extends DbDataSource<string, PlainObject, ArrayOf<RedisSetValue> | ArrayOf<RedisJSONValue>, string | RedisCredential, string>, CascadeAction, AuthValue {
51
+ source: "redis";
52
+ key?: ArrayOf<RedisCommandArgument>;
53
+ field?: RedisCommandArgument;
54
+ path?: string;
55
+ format?: RedisFormat | "HKEYS" | "HVALS";
56
+ search?: {
57
+ index?: string;
58
+ schema?: RediSearchSchema | string;
59
+ query?: string;
60
+ options?: PlainObject;
61
+ };
62
+ options?: {
63
+ client?: RedisClientOptions;
64
+ get?: PlainObject;
65
+ command?: RedisCommandOptions;
66
+ };
67
+ database?: number;
68
+ }
69
+
70
+ export interface MySQLDataSource<T = unknown> extends DbDataSource<string | QueryOptions, unknown, unknown, string | MySQLCredential, string>, ExecuteAction<T> {
71
+ source: "mysql";
72
+ }
73
+
74
+ export interface PostgresDataSource<T = unknown[]> extends DbDataSource<string | QueryArrayConfig, unknown, unknown, string | PostgresCredential, string>, ExecuteAction<T> {
75
+ source: "postgres";
76
+ }
77
+
78
+ export interface OracleDataSource extends DbDataSource<string, ExecuteOptions, unknown, string | OracleCredential, string>, ExecuteAction<BindParameters> {
79
+ source: "oracle";
80
+ }
81
+
82
+ export interface MSSQLDataSource extends DbDataSource<string, unknown, unknown, string | MSSQLCredential, string | MSSQLPoolConfig>, ExecuteAction<MSSQLRequestParameters | MSSQLRequestWithOutputParameters> {
83
+ source: "mssql";
84
+ storedProc?: boolean;
85
+ }
86
+
87
+ export interface MongoDBCredential extends ServerAuth, Pick<MongoClientOptions, "auth" | "authMechanism" | "authSource" | "tlsCAFile" | "tlsCertificateFile" | "tlsCertificateKeyFile" | "tlsCertificateKeyFilePassword" | "sslCA" | "sslKey" | "sslCert"> {}
88
+
89
+ export type RedisCredential = ServerAuth;
90
+
91
+ export interface MySQLCredential extends ServerAuth, Omit<PoolOptions, "ssl"> {
92
+ ssl?: boolean | string | SecureContextOptions & { rejectUnauthorized?: boolean };
93
+ }
94
+
95
+ export interface PostgresCredential extends Omit<ServerAuth, "password">, PostgresPoolConfig {}
96
+
97
+ export interface OracleCredential extends ServerAuth, ConnectionAttributes, PoolAttributes {}
98
+
99
+ export interface MSSQLCredential extends ServerAuth, IConnectionConfig {}
100
+
101
+ export interface MongoDBSortValue {
102
+ value?: Sort;
103
+ direction?: SortDirection;
104
+ }
105
+
106
+ export interface MongoDBAggregate {
107
+ pipeline?: Document[];
108
+ options?: AggregateOptions;
109
+ }
110
+
111
+ export interface MongoDBClientDBOptions {
112
+ client?: {
113
+ db?: DbOptions;
114
+ collection?: CollectionOptions;
115
+ };
116
+ execute?: {
117
+ insert?: BulkWriteOptions;
118
+ };
119
+ aggregate?: MongoDBAggregate;
120
+ sort?: Sort | string | MongoDBSortValue;
121
+ }
122
+
123
+ export interface MongoDBQueryWithOptions {
124
+ value: Filter<Document>;
125
+ options: CommandOperationOptions;
126
+ }
127
+
128
+ export interface RedisSetValue<T = "HASH" | undefined, U = RedisCommandArgument, V = RedisCommandValue | RedisHSETObject> {
129
+ format: T;
130
+ key?: U;
131
+ field?: V;
132
+ value?: V;
133
+ NX?: boolean;
134
+ XX?: boolean;
135
+ EX?: number;
136
+ PX?: number;
137
+ EXAT?: number;
138
+ PXAT?: number;
139
+ options?: {
140
+ set?: PlainObject;
141
+ expire?: { [K in RedisExpireCondition]?: boolean; };
142
+ command?: RedisCommandOptions;
143
+ };
144
+ }
145
+
146
+ export interface RedisJSONValue extends Omit<RedisSetValue<"JSON", string, RedisJSON>, "field" | "EX" | "PX" | "EXAT" | "PXAT"> {
147
+ path?: string;
148
+ }
149
+
150
+ export interface MSSQLRequestWithOutputParameters {
151
+ input?: MSSQLRequestParameters;
152
+ output?: MSSQLRequestParameters;
153
+ }
154
+
155
+ export interface MSSQLRequestParameterValue {
156
+ name?: string;
157
+ value?: unknown;
158
+ type?: keyof TediousTypes | TediousType;
159
+ options?: ParameterOptions;
160
+ }
161
+
162
+ export interface ExecuteQueryOptions {
163
+ checkObject?: CheckObjectCallback | string;
164
+ checkObjectKey?: string;
165
+ errorQuery?: ErrorQueryCallback;
166
+ sessionKey?: string;
167
+ outCacheMiss?: string[];
168
+ }
169
+
170
+ export interface ExecuteBatchQueryOptions extends ExecuteQueryOptions {
171
+ parallel?: boolean;
172
+ connectOnce?: boolean;
173
+ }
174
+
175
+ export interface ProcessRowsOptions {
176
+ disconnect?: () => void;
177
+ parallel?: boolean;
178
+ }
179
+
180
+ export interface DbConnection {
181
+ hostname: string;
182
+ password: string;
183
+ pathname: string;
184
+ port: string;
185
+ protocol: string;
186
+ search: string;
187
+ username: string;
188
+ database: string;
189
+ }
190
+
191
+ export interface HandleFailOptions {
192
+ commandType?: number;
193
+ errorQuery?: ErrorQueryCallback;
194
+ }
195
+
196
+ export interface ServerAuth<T = number> extends AuthValue, IdentifierAction {
197
+ protocol?: string;
198
+ server?: string;
199
+ hostname?: string;
200
+ port?: T;
201
+ database?: string;
202
+ }
203
+
204
+ export interface IDbPool<T extends DbDataSource = DbDataSource, U = unknown, V = unknown> {
205
+ client: U;
206
+ lastAccessed: number;
207
+ success: number;
208
+ failed: number;
209
+ poolKey: string;
210
+ uuidKey: Null<AuthValue>;
211
+ add(item: T, uuidKey?: string): this;
212
+ has(item: T): boolean;
213
+ getConnection(): Promise<V>;
214
+ remove(): void;
215
+ detach(force?: boolean): Promise<void>;
216
+ close(): Promise<void>;
217
+ isIdle(timeout: number): boolean;
218
+ isEmpty(): boolean;
219
+ set connected(value: boolean);
220
+ get persist(): boolean;
221
+ get closed(): boolean;
222
+ get closeable(): boolean;
223
+ set parent(value: ObjectMap<IDbPool<T>>);
224
+ }
225
+
226
+ export interface DbPoolConstructor<T extends DbDataSource = DbDataSource, U = unknown> {
227
+ findKey<V extends IDbPool, W extends DbDataSource>(pools: ObjectMap<V>, uuidKey: unknown, poolKey: Undef<string>, ...items: W[]): Null<V>;
228
+ validateKey<V extends IDbPool>(pools: ObjectMap<V>, username: string, uuidKey: unknown): [string, Null<V>];
229
+ checkTimeout<V extends IDbPool>(pools: ObjectMap<V>, value: number, limit?: number): Promise<number>;
230
+ readonly prototype: IDbPool<T, U>;
231
+ new(pool: U, poolKey: string, uuidKey?: string): IDbPool<T, U>;
232
+ }
233
+
234
+ export interface PoolConfig<T = number> extends MinMax {
235
+ idle?: T;
236
+ queue_max?: number;
237
+ queue_idle?: T;
238
+ purge?: T;
239
+ }
240
+
241
+ export interface TimeoutAction {
242
+ timeout?: NumString;
243
+ }
244
+
245
+ export type DbSource = "mongodb" | "redis" | "mysql" | "postgres" | "oracle" | "mssql";
246
+ export type QueryResult = unknown[];
247
+ export type BatchQueryResult = Null<QueryResult>[];
248
+ export type CheckObjectCallback = (item: DataSource, data: unknown) => Null<QueryResult>;
249
+ export type RedisFormat = "HASH" | "JSON";
250
+ export type RedisExpireCondition = "NX" | "XX" | "GT" | "LT";
251
+ export type RedisCommandValue = RedisCommandArgument | number;
252
+ export type RedisCommandOptions = CommandOptions<ClientCommandOptions>;
253
+ export type RedisHSETObject = Record<NumString, RedisCommandValue>;
254
+ export type MSSQLRequestParameters = Null<MSSQLRequestParameterValue[] | ObjectMap<Omit<MSSQLRequestParameterValue, "name">>>;
255
+ export type ErrorQueryCallback = (err: unknown, item: DbDataSource, commandType?: number) => boolean;
256
+
257
+ export interface SQL_COMMAND {
258
+ SELECT: 1;
259
+ INSERT: 2;
260
+ UPDATE: 3;
261
+ DELETE: 4;
262
+ }
263
+
264
+ export type { DB_TYPE, CacheOptions, IdentifierAction, RedisCommandArgument, RedisJSON };
@@ -0,0 +1,192 @@
1
+ import type { LocationUri, MimeTypeAction, StorageAction } from './squared';
2
+
3
+ import type { IDocument, IFileManager, IModule } from './index';
4
+ import type { ExternalAsset, InitialValue } from './asset';
5
+ import type { CloudStorage } from './cloud';
6
+ import type { LogComponent, LogDate } from './logger';
7
+ import type { DocumentTransform } from './settings';
8
+
9
+ export interface DocumentAsset extends ExternalAsset, StorageAction<CloudStorage> {
10
+ initialValue?: InitialValue & { inlineFilename?: string };
11
+ }
12
+
13
+ export interface StartOfSourceMap {
14
+ file?: string;
15
+ sourceRoot?: string;
16
+ }
17
+
18
+ export interface RawSourceMap<T = NumString> extends StartOfSourceMap {
19
+ version: T;
20
+ sources: string[];
21
+ names: string[];
22
+ sourcesContent?: string[];
23
+ mappings: string;
24
+ }
25
+
26
+ export interface SourceInput<T = [string, string?, string?][]> {
27
+ code?: string;
28
+ sourceFile?: T;
29
+ sourceName?: string;
30
+ sourcesRelativeTo?: string;
31
+ }
32
+
33
+ export interface SourceCode {
34
+ code: string;
35
+ map?: RawSourceMap;
36
+ sourceMappingURL?: string;
37
+ }
38
+
39
+ export interface ChunkFile {
40
+ code: string;
41
+ filename?: string;
42
+ entryPoint?: boolean;
43
+ }
44
+
45
+ export interface ChunkData extends ChunkFile {
46
+ sourceMap?: SourceMap;
47
+ }
48
+
49
+ export interface CacheData {
50
+ uri?: string;
51
+ etag?: string;
52
+ encoding?: BufferEncoding;
53
+ override?: boolean;
54
+ }
55
+
56
+ export interface TransformAction {
57
+ cacheData?: CacheData;
58
+ }
59
+
60
+ export interface TransformResult extends SourceCode {
61
+ type?: string;
62
+ chunks?: Null<(SourceCode & ChunkFile)[]>;
63
+ sourceFiles?: string[];
64
+ }
65
+
66
+ export interface TransformOutput extends Partial<LocationUri>, Omit<SourceInput<string>, "code">, MimeTypeAction {
67
+ imported?: boolean;
68
+ sourceMap?: SourceMap;
69
+ metadata?: unknown;
70
+ external?: PlainObject;
71
+ productionRelease?: boolean;
72
+ getMainFile?(code?: string, imports?: StringMap): Undef<SourceInput<string>>;
73
+ getSourceFiles?(imports?: StringMap): Undef<SourceInput>;
74
+ }
75
+
76
+ export interface TransformOptions<T = AnyObject, U = T> extends TransformOutput {
77
+ baseConfig: T;
78
+ outputConfig: U;
79
+ sourceMap: SourceMap;
80
+ supplementChunks: ChunkData[];
81
+ }
82
+
83
+ export interface ITransformSeries<T = AnyObject, U = T> extends IModule, TransformOptions<T, U> {
84
+ readonly type: string;
85
+ init(instance: IModule, dirname?: string): this;
86
+ close(instance: IModule): void;
87
+ createSourceMap(value: string): SourceMap;
88
+ getMainFile(code?: string, imports?: StringMap): Undef<SourceInput<string>>;
89
+ getSourceFiles(imports?: StringMap): Undef<SourceInput>;
90
+ toBaseConfig(all?: boolean): T;
91
+ upgrade<V = unknown>(context: V, dirname?: string, name?: string): V;
92
+ set code(value);
93
+ get code(): string;
94
+ get out(): IOut;
95
+ get metadata(): object;
96
+ get options(): TransformOutput;
97
+ get productionRelease(): boolean;
98
+ get imported(): boolean;
99
+ set version(value);
100
+ get version(): string;
101
+ set packageName(value);
102
+ get packageName(): string;
103
+ get packageVersion(): string;
104
+ get username(): string;
105
+ }
106
+
107
+ export interface TransformSeriesConstructor {
108
+ readonly prototype: ITransformSeries;
109
+ new(type: string, code: string, options: TransformOutput): ITransformSeries;
110
+ }
111
+
112
+ export interface IOut extends OutV3, OutV4 {}
113
+
114
+ export interface OutV3 {
115
+ sourceFiles?: string[];
116
+ ignoreCache?: boolean;
117
+ logAppend?: LogComponent[];
118
+ messageAppend?: string;
119
+ }
120
+
121
+ export interface OutV4 {
122
+ logQueued?: LogComponent[];
123
+ }
124
+
125
+ export interface SourceMapOptions extends MimeTypeAction {
126
+ file?: string;
127
+ hash?: string;
128
+ sourceRoot?: string;
129
+ sourceMappingURL?: string;
130
+ inlineMap?: boolean;
131
+ emptySources?: boolean;
132
+ }
133
+
134
+ export interface SourceMap extends SourceCode {
135
+ output: Map<string, SourceCode>;
136
+ reset(): void;
137
+ nextMap(name: string, code: string, map: unknown, sourceMappingURL?: string, emptySources?: boolean): boolean;
138
+ set map(value);
139
+ get map(): Undef<RawSourceMap>;
140
+ }
141
+
142
+ export interface SourceMapConstructor {
143
+ findSourceMap(code?: string, uri?: string): Undef<RawSourceMap>;
144
+ removeSourceMappingURL(value: string): [string, string?, Null<RawSourceMap>?];
145
+ isRaw(map: unknown): map is RawSourceMap;
146
+ readonly prototype: SourceMap;
147
+ new(code: string, uri?: string): SourceMap;
148
+ }
149
+
150
+ export interface UpdateGradleOptions {
151
+ multiple?: boolean;
152
+ addendum?: string;
153
+ upgrade?: boolean;
154
+ updateOnly?: boolean;
155
+ }
156
+
157
+ export interface LintMessage {
158
+ ruleId: string;
159
+ message: string;
160
+ line: number;
161
+ column: number;
162
+ endLine?: number;
163
+ endColumn?: number;
164
+ severity?: 0 | 1 | 2 | "" | "error" | "warning";
165
+ fatal?: boolean;
166
+ }
167
+
168
+ export interface GenerateLintTableOptions extends Partial<LocationUri> {
169
+ leadingText?: string;
170
+ trailingText?: string;
171
+ errorCount?: number;
172
+ warningCount?: number;
173
+ fatalErrorCount?: number;
174
+ timeStamp?: LogDate;
175
+ ruleWidth?: number;
176
+ messageWidth?: number;
177
+ }
178
+
179
+ export interface CustomizeOptions {
180
+ transform?: DocumentTransform;
181
+ }
182
+
183
+ export interface AsSourceFileOptions {
184
+ encoding?: BufferEncoding;
185
+ persist?: boolean;
186
+ cache?: boolean;
187
+ }
188
+
189
+ export type Transformer = FunctionType<Undef<Promise<string> | string>>;
190
+ export type ConfigOrTransformer = AnyObject | Transformer;
191
+ export type PluginConfig = [string, Undef<ConfigOrTransformer>, Undef<AnyObject>, boolean?] | [];
192
+ export type TransformCallback<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset> = (this: T, instance: IDocument<T, U>, requireOrDocumentDir?: NodeJS.Require | string) => Void<Promise<void>>;
package/lib/dom.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ interface EventListenerOptions {
2
+ capture?: boolean;
3
+ }
4
+
5
+ export interface AddEventListenerOptions extends EventListenerOptions {
6
+ once?: boolean;
7
+ passive?: boolean;
8
+ signal?: AbortSignal;
9
+ }
@@ -0,0 +1,103 @@
1
+ import type { BundleAction, FileInfo, LogStatus } from './squared';
2
+
3
+ import type { IFileManager, IModule, ModuleConstructor } from './index';
4
+ import type { ExternalAsset } from './asset';
5
+ import type { HostInitLog as IHostInitLog } from './core';
6
+ import type { RequestData as IRequestData } from './node';
7
+ import type { RequestInit } from './request';
8
+
9
+ import type { FETCH_TYPE } from '../index.d';
10
+
11
+ export const enum FINALIZE_STATE {
12
+ READY = 0,
13
+ COMMIT = 1,
14
+ END = 2,
15
+ RESTART = 3,
16
+ QUEUED = 4,
17
+ RESTARTED = 5,
18
+ ABORTED = 6
19
+ }
20
+
21
+ export interface RequestData<T extends ExternalAsset = ExternalAsset> extends IRequestData<T>, RequestInit {
22
+ timeout?: ObjectMap<NumString>;
23
+ }
24
+
25
+ export interface InstallData<T extends IModule = IModule, U extends ModuleConstructor = ModuleConstructor> {
26
+ instance: T;
27
+ constructor: U;
28
+ params: unknown[];
29
+ }
30
+
31
+ export interface IHttpDiskCache<T extends ExternalAsset = ExternalAsset> {
32
+ limit: number;
33
+ expires: number;
34
+ readonly host: IFileManager<T>;
35
+ has(uri: string | URL): boolean;
36
+ add<U extends HttpDiskCacheAddOptions>(uri: string | URL, etag: string, target: string | Buffer, options?: U): void;
37
+ within(value: T | number): boolean;
38
+ clear(value?: unknown): void;
39
+ set enabled(value);
40
+ get enabled(): boolean;
41
+ set exclude(value);
42
+ get exclude(): string[];
43
+ set include(value);
44
+ get include(): string[];
45
+ }
46
+
47
+ export interface IHttpMemoryCache<T extends ExternalAsset = ExternalAsset> extends IHttpDiskCache<T> {
48
+ toDisk: TupleOf<number>;
49
+ purge(percent?: number, limit?: number): void;
50
+ withinDisk(value: T | number): boolean;
51
+ clear(uri?: string | URL): void;
52
+ }
53
+
54
+ export interface HttpDiskCacheAddOptions {
55
+ buffer?: Null<BufferContent>;
56
+ contentLength?: number;
57
+ }
58
+
59
+ export interface HttpMemoryCacheAddOptions extends Omit<HttpDiskCacheAddOptions, "buffer"> {
60
+ toDisk?: string;
61
+ encoding?: BufferEncoding;
62
+ }
63
+
64
+ export interface ReplaceOptions {
65
+ mimeType?: string;
66
+ rewritePath?: boolean;
67
+ ignoreExt?: boolean;
68
+ }
69
+
70
+ export interface AssetContentOptions extends BundleAction {
71
+ localUri: string;
72
+ }
73
+
74
+ export interface FileOutput {
75
+ pathname: string;
76
+ localUri: string;
77
+ }
78
+
79
+ export interface FinalizeResult {
80
+ files: FileInfo[];
81
+ errors: string[];
82
+ status?: LogStatus[];
83
+ aborted?: boolean;
84
+ }
85
+
86
+ export interface DeleteFileAddendum {
87
+ id?: number;
88
+ all?: boolean;
89
+ }
90
+
91
+ export interface HostInitLog extends IHostInitLog {
92
+ useNumeric: boolean;
93
+ showSize?: boolean;
94
+ }
95
+
96
+ export interface FindAssetOptions<T extends ExternalAsset = ExternalAsset> {
97
+ instance?: IModule;
98
+ assets?: T[];
99
+ replaced?: boolean;
100
+ }
101
+
102
+ export type FetchType = FETCH_TYPE[keyof FETCH_TYPE];
103
+ export type PostFinalizeCallback = (files: FileInfo[] | string[], errors: string[], status?: LogStatus[]) => void;
package/lib/http.d.ts ADDED
@@ -0,0 +1,86 @@
1
+ import type { ClientRequest, Agent as HttpAgent, OutgoingHttpHeaders } from 'http';
2
+ import type { Agent as HttpsAgent } from 'https';
3
+ import type { ClientHttp2Stream } from 'http2';
4
+
5
+ export const enum HTTP_STATUS {
6
+ CONTINUE = 100,
7
+ SWITCHING_PROTOCOL = 101,
8
+ PROCESSING = 102,
9
+ EARLY_HINTS = 103,
10
+ OK = 200,
11
+ CREATED = 201,
12
+ ACCEPTED = 202,
13
+ NON_AUTHORITATIVE_INFORMATION = 203,
14
+ NO_CONTENT = 204,
15
+ RESET_CONTENT = 205,
16
+ PARTIAL_CONTENT = 206,
17
+ MULTIPLE_CHOICES = 300,
18
+ MOVED_PERMANENTLY = 301,
19
+ FOUND = 302,
20
+ SEE_OTHER = 303,
21
+ NOT_MODIFIED = 304,
22
+ USE_PROXY = 305,
23
+ TEMPORARY_REDIRECT = 307,
24
+ PERMANENT_REDIRECT = 308,
25
+ BAD_REQUEST = 400,
26
+ UNAUTHORIZED = 401,
27
+ PAYMENT_REQUIRED = 402,
28
+ FORBIDDEN = 403,
29
+ NOT_FOUND = 404,
30
+ METHOD_NOT_ALLOWED = 405,
31
+ NOT_ACCEPTABLE = 406,
32
+ PROXY_AUTHENTICATION_REQUIRED = 407,
33
+ REQUEST_TIMEOUT = 408,
34
+ CONFLICT = 409,
35
+ GONE = 410,
36
+ LENGTH_REQUIRED = 411,
37
+ PRECONDITION_FAILED = 412,
38
+ PAYLOAD_TOO_LARGE = 413,
39
+ REQUEST_URI_TOO_LONG = 414,
40
+ UNSUPPORTED_MEDIA_TYPE = 415,
41
+ RANGE_NOT_SATISFIABLE = 416,
42
+ EXPECTATION_FAILED = 417,
43
+ MISDIRECTED_REQUEST = 421,
44
+ UNPROCESSABLE_ENTITY = 422,
45
+ LOCKED = 423,
46
+ FAILED_DEPENDENCY = 424,
47
+ UPGRADE_REQUIRED = 426,
48
+ PRECONDITION_REQUIRED = 428,
49
+ TOO_MANY_REQUESTS = 429,
50
+ REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
51
+ UNAVAILABLE_FOR_LEGAL_REASONS = 451,
52
+ CLIENT_CLOSED_REQUEST = 499,
53
+ INTERNAL_SERVER_ERROR = 500,
54
+ NOT_IMPLEMENTED = 501,
55
+ BAD_GATEWAY = 502,
56
+ SERVICE_UNAVAILABLE = 503,
57
+ GATEWAY_TIMEOUT = 504,
58
+ HTTP_VERSION_NOT_SUPPORTED = 505,
59
+ VARIANT_ALSO_NEGOTIATES = 506,
60
+ INSUFFICIENT_STORAGE = 507,
61
+ LOOP_DETECTED = 508,
62
+ NOT_EXTENDED = 510,
63
+ NETWORK_AUTHENTICATION_REQUIRED = 511,
64
+ WEB_SERVER_IS_DOWN = 521,
65
+ CONNECTION_TIMED_OUT = 522,
66
+ A_TIMEOUT_OCCURRED = 524
67
+ }
68
+
69
+ export const enum QUERY_RESULT {
70
+ FAIL,
71
+ OK,
72
+ TIMEOUT
73
+ }
74
+
75
+ export interface HttpAgentSettings {
76
+ http?: HttpAgent;
77
+ https?: HttpsAgent;
78
+ keepAlive?: boolean;
79
+ timeout?: number;
80
+ }
81
+
82
+ export type HttpRequestClient = ClientRequest | ClientHttp2Stream;
83
+ export type HttpOutgoingHeaders = ObjectMap<OutgoingHttpHeaders>;
84
+ export type HttpProtocolVersion = 1 | 2 | 3;
85
+ export type InternetProtocolVersion = 0 | 4 | 6;
86
+ export type LookupCallback = (err: NodeJS.ErrnoException | null, address: string, family: number) => void;
package/lib/image.d.ts ADDED
@@ -0,0 +1,44 @@
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
+
44
+ export type MethodData = [string, unknown[]?][];