@makano/rew 1.2.75 → 1.2.77

Sign up to get free protection for your applications and to get access to all the features.
package/runtime.d.ts CHANGED
@@ -1,957 +1,1009 @@
1
1
 
2
2
 
3
- interface ImportOptions {
4
- /**
5
- * Determines how to import the given module
6
- */
7
- type: "js" | "coffee" | "yaml" | "json" | "qrew" | "text";
8
- [key: string]: any;
9
- }
10
-
11
- interface ModuleConfOptionCenter {
12
- /**
13
- * Get a config key
14
- * @param key The key of the config to get
15
- * @param defaultValue The default value ig null
16
- * @returns The value of the key or the defaultValue if it's null.
17
- */
18
- get: <T = any>(key: string, defaultValue?: T) => T;
19
- /**
20
- * Set a config key
21
- * @param key The key of the config to set
22
- * @param value The value to set it to
23
- * @returns true if it was a success
24
- */
25
- set: <T = any>(key: string, value: T) => boolean;
26
- /**
27
- * Removes a key from the config
28
- * @param key The key of the config to remove
29
- * @returns true if it was a success
30
- */
31
- remove: (key: string) => boolean;
32
- /**
33
- * Resets the entire config option center to it's default value
34
- */
35
- reset: () => boolean;
36
- /**
37
- * Get all values in an option center
38
- * @param str
39
- * @returns
40
- */
41
- getAll: (() => string) | ((str?: false) => Record<string, any>);
42
- }
43
3
 
44
- interface ModuleConf extends ModuleConfOptionCenter {
45
- /**
46
- * A separate options file for a related set of options
47
- * @param name The option center full path
48
- * @param defaults The default values
49
- *
50
- * @example
51
- * conf = imp 'conf'
52
- *
53
- * animations = conf.optionCenter 'animations', enable: false, speed: '1x'
54
- *
55
- * if animations.get 'enable'
56
- * animate animations.get 'speed'
57
- */
58
- optionCenter: (name: string, defaults?: any) => ModuleConfOptionCenter;
59
- /**
60
- * Manage Static files
61
- */
62
- staticFile: (
63
- name: string,
64
- defaults?: any
65
- ) => {
66
- write: (value: any, ifExists?: boolean) => any;
67
- // @ts-ignore
68
- read: (to?: string | object) => string | object | Buffer;
69
- fileRoot: string;
70
- exists: boolean;
71
- };
72
- }
73
-
74
- interface ModuleEnv {
75
- has: (key: string) => boolean;
76
- get: (key: string) => string;
77
- set: (key: string, value: string) => boolean;
78
- rm: (key: string) => boolean;
79
- is: (key: string, value: string) => boolean;
80
- }
81
-
82
- interface ModuleRuneDBCollcetion {
83
- insert(record: object): any;
84
- read(id: string | object, evaluate?: boolean): any;
85
- update(caseRecord: string | object, newRecord: object): any;
86
- remove(id: string | object): boolean;
87
- find(criteria: string | object): any;
88
- map(cb: (data: any[]) => any[], mutate?: boolean): any[];
89
- transform(cb: (data: any[]) => any[], mutate?: boolean): any[];
90
- filter(cb: (data: any[]) => boolean, mutate?: boolean): any[];
91
- sort(cb: (a: any, b: any) => number, mutate?: boolean): any[];
92
- list(): any[];
93
- }
94
-
95
- interface ModuleRuneDBMap {
96
- set(key: string, value: any): void;
97
- get(key: string): any | null;
98
- remove(key: string): boolean;
99
- transform(cb: (data: any) => any, mutate?: boolean): any;
100
- list(): { [key: string]: any };
101
- }
102
-
103
- interface ModuleRuneDB {
104
- collection: (name: string) => ModuleRuneDBCollcetion;
105
- map: (name: string) => ModuleRuneDBMap;
106
- findRef: (ref: string) => any;
107
- setData: (data: Record<string, any>) => void;
108
- getData: () => Record<string, any>;
109
- makeRef(value: object, props?: string): string | null;
110
- }
111
-
112
- interface ModuleRune {
113
- db(dbname: string, data?: object, encryptionKey?: string): ModuleRuneDB;
114
- genKey(secret: string): string;
115
- push(...values: any[]): any;
116
- pop(...values: any[]): any;
117
- }
118
-
119
- interface ModuleThreads {
120
- thread: (cb: Function) => {
121
- stopAll: () => void;
122
- start: (context: Record<string, any>) => {
123
- on: (event: string, callback: (data) => void) => void;
124
- off: (event: string, callback: (data) => void) => void;
125
- emit: (event: string, data: any) => void;
126
- get: () => Promise<any>;
127
- stop: () => void;
128
- };
129
- };
4
+ declare module "serve" {
5
+ export default Rew.ModuleServe
130
6
  }
131
-
132
-
133
- type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request;
134
- type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
135
- type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
136
- type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
137
- type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
138
- : import("undici-types").RequestInit;
139
- type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
140
- : import("undici-types").ResponseInit;
141
- // @ts-ignore
142
- type _File = typeof globalThis extends { onmessage: any } ? {} : import("node:buffer").File;
143
-
144
- interface Request {}
145
- declare var Request: typeof globalThis extends {
146
- onmessage: any;
147
- Request: infer T;
148
- } ? T
149
- : typeof import("undici-types").Request;
150
-
151
- interface ResponseInit extends _ResponseInit {}
152
-
153
- interface Response extends _Response {}
154
- declare var Response: typeof globalThis extends {
155
- onmessage: any;
156
- Response: infer T;
157
- } ? T
158
- : typeof import("undici-types").Response;
159
-
160
- type GenericTraps = Record<string, any>;
161
-
162
- type IRequestStrict = {
163
- route: string;
164
- params: {
165
- [key: string]: string;
166
- };
167
- query: {
168
- [key: string]: string | string[] | undefined;
169
- };
170
- proxy?: any;
171
- } & Request;
172
-
173
- type IRequest = IRequestStrict & GenericTraps;
174
-
175
- type RequestHandler<RequestType = IRequest, Args extends Array<any> = any[]> = (
176
- request: RequestType,
177
- ...args: Args
178
- ) => any;
179
-
180
- type ResponseHandler<
181
- ResponseType = any,
182
- RequestType = IRequest,
183
- Args extends any[] = any[]
184
- > = (response: ResponseType, request: RequestType, ...args: Args) => any;
185
-
186
- type StatusErrorObject = {
187
- error?: string;
188
- [key: string]: any;
189
- };
190
-
191
- interface StatusError extends Error {
192
- status: number;
193
- [key: string]: any;
194
- constructor(status?: number, body?: StatusErrorObject | string);
7
+ declare module "stream" {
8
+ const module: Rew.ModuleStream
9
+ // @ts-ignore
10
+ export default module;
195
11
  }
196
-
197
- type ErrorHandler<
198
- ErrorType extends Error = StatusError,
199
- RequestType = IRequest,
200
- Args extends any[] = any[]
201
- > = (error: ErrorType, request: RequestType, ...args: Args) => any;
202
-
203
- type RouteEntry<RequestType = IRequest, Args extends any[] = any[]> = [
204
- httpMethod: string,
205
- match: RegExp,
206
- handlers: RequestHandler<RequestType, Args>[],
207
- path?: string
208
- ];
209
-
210
- type IttyRouterOptions = {
211
- base?: string;
212
- routes?: RouteEntry[];
213
- } & GenericTraps;
214
-
215
- type RouterOptions<RequestType = IRequest, Args extends any[] = []> = {
216
- before?: RequestHandler<RequestType, Args>[];
217
- catch?: ErrorHandler<StatusError, RequestType, Args>;
218
- finally?: ResponseHandler<any, RequestType, Args>[];
219
- } & IttyRouterOptions;
220
-
221
- type AutoRouterOptions<RequestType, Args extends any[]> = {
222
- missing?: RequestHandler<RequestType, Args>;
223
- format?: ResponseHandler;
224
- } & RouterOptions<RequestType, Args>;
225
-
226
- type RequestLike = {
227
- method: string;
228
- url: string;
229
- } & GenericTraps;
230
-
231
- type Route<R = IRequest, A extends Array<any> = any[]> = <
232
- RequestType = R,
233
- Args extends Array<any> = A
234
- >(
235
- path: string,
236
- ...handlers: RequestHandler<RequestType, Args>[]
237
- ) => IttyRouterType<R, A>;
238
-
239
- type CustomRoutes<R = Route> = {
240
- [key: string]: R;
241
- };
242
-
243
- type IttyRouterType<
244
- RequestType = IRequest,
245
- Args extends any[] = any[],
246
- ResponseType = any
247
- > = {
248
- __proto__: IttyRouterType<RequestType, Args, ResponseType>;
249
- routes: RouteEntry[];
250
- fetch: <A extends any[] = Args>(
251
- request: RequestLike,
252
- ...extra: A
253
- ) => Promise<ResponseType>;
254
- all: Route<RequestType, Args>;
255
- delete: Route<RequestType, Args>;
256
- get: Route<RequestType, Args>;
257
- head: Route<RequestType, Args>;
258
- options: Route<RequestType, Args>;
259
- patch: Route<RequestType, Args>;
260
- post: Route<RequestType, Args>;
261
- put: Route<RequestType, Args>;
262
- } & CustomRoutes<Route<RequestType, Args>> &
263
- GenericTraps;
264
-
265
- type RouterType<
266
- RequestType = IRequest,
267
- Args extends any[] = any[],
268
- ResponseType = any
269
- > = {
270
- before?: RequestHandler<RequestType, Args>[];
271
- catch?: ErrorHandler<StatusError, RequestType, Args>;
272
- finally?: ResponseHandler<any, RequestType, Args>[];
273
- } & IttyRouterType<RequestType, Args, ResponseType>;
274
-
275
- type AutoRouterType<
276
- RequestType = IRequest,
277
- Args extends any[] = any[],
278
- ResponseType = any
279
- > = {
280
- missing?: RequestHandler<RequestType, Args>;
281
- format?: ResponseHandler;
282
- } & RouterType<RequestType, Args, ResponseType>;
283
-
284
- type HasContent<ContentType> = {
285
- content: ContentType;
286
- } & IRequestStrict;
287
-
288
- type ResponseFormatter = (body?: any, options?: ResponseInit) => Response;
289
-
290
- interface ErrorLike extends Error {
291
- status?: number;
292
- [any: string]: any;
12
+ declare module "conf" {
13
+ const module: Rew.ModuleConf
14
+ export default module;
293
15
  }
294
- type ErrorBody = string | object;
295
- interface ErrorFormatter {
296
- (statusCode?: number, body?: ErrorBody): Response;
16
+ declare module "env" {
17
+ const module: Rew.ModuleEnv
18
+ export default module;
297
19
  }
298
-
299
- type IttyRouter = <
300
- RequestType extends IRequest = IRequest,
301
- Args extends any[] = any[],
302
- ResponseType = any
303
- >({
304
- base,
305
- routes,
306
- ...other
307
- }?: IttyRouterOptions) => IttyRouterType<RequestType, Args, ResponseType>;
308
-
309
- type Router = <
310
- RequestType = IRequest,
311
- Args extends any[] = any[],
312
- ResponseType = any
313
- >({
314
- base,
315
- routes,
316
- ...other
317
- }?: RouterOptions<RequestType, Args>) => RouterType<
318
- RequestType,
319
- Args,
320
- ResponseType
321
- >;
322
-
323
- type AutoRouter = <
324
- RequestType extends IRequest = IRequest,
325
- Args extends any[] = any[],
326
- ResponseType = any
327
- >({
328
- format,
329
- missing,
330
- finally: f,
331
- before,
332
- ...options
333
- }?: AutoRouterOptions<RequestType, Args>) => AutoRouterType<
334
- RequestType,
335
- Args,
336
- ResponseType
337
- >;
338
-
339
- type createResponse = (
340
- format?: string,
341
- transform?: ((body: any) => any) | undefined
342
- ) => ResponseFormatter;
343
-
344
- type statusR = (status: number, options?: ResponseInit) => Response;
345
-
346
- type withContent = (request: IRequest) => Promise<void>;
347
-
348
- type withCookies = (r: IRequest) => void;
349
-
350
- type withParams = (request: IRequest) => void;
351
-
352
- type CorsOptions = {
353
- credentials?: true;
354
- origin?:
355
- | boolean
356
- | string
357
- | string[]
358
- | RegExp
359
- | ((origin: string) => string | void);
360
- maxAge?: number;
361
- allowMethods?: string | string[];
362
- allowHeaders?: any;
363
- exposeHeaders?: string | string[];
364
- };
365
- type Preflight = (request: IRequest) => Response | void;
366
- type Corsify = (response: Response, request?: IRequest) => Response;
367
- type CorsPair = {
368
- preflight: Preflight;
369
- corsify: Corsify;
370
- };
371
- type cors = (options?: CorsOptions) => {
372
- corsify: (response: Response, request?: Request) => Response;
373
- preflight: (request: Request) => Response | undefined;
374
- };
375
-
376
- interface ModuleServeRouter extends RouterType {
377
- to(server: ModuleServeServer): any;
20
+ declare module "rune" {
21
+ const module: Rew.ModuleRune
22
+ export default module;
378
23
  }
379
-
380
- interface ResponseType{}
381
-
382
- declare class ModuleServeServerOptions {
383
- handler?: (req: RequestLike, res: ResponseType) => any;
384
- routers?: ModuleServeRouter[];
385
- fetch?: (req: RequestLike) => ResponseType | Promise<ResponseType>;
24
+ declare module "threads" {
25
+ const module: Rew.ModuleThreads
26
+ export default module;
386
27
  }
387
-
388
- interface ModuleServeServer {
389
- _server: any;
390
- routers: Record<string, ModuleServeRouter>;
391
-
392
- handleRequest: typeof ModuleServeServerOptions.prototype.handler;
393
- listen: this;
394
- port: (port: number) => this;
395
- log: (string: string) => this;
28
+ declare module "web" {
29
+ export default Rew.ModuleWeb
396
30
  }
397
-
398
- interface ModuleServeFileRouterOptions {
399
- root: string;
400
- basePath?: string;
401
- resolveExtensions?: string[];
402
- bundlerOptions?: Record<string, any>;
403
- bundlerEntry?: (file: string, layouts?: string[]) => string;
404
- ssrBundlerEntry?: (file: string, layouts?: string[]) => string;
405
- onError?: () => any;
31
+ declare module "data" {
32
+ const module: Rew.ModuleData;
33
+ export default module;
406
34
  }
407
35
 
408
- declare class ModuleServe {
409
- router({
410
- id,
411
- type,
412
- }: {
413
- id?: string;
414
- type?: "auto" | "normal" | "default";
36
+ declare namespace Rew {
37
+ interface ImportOptions {
38
+ /**
39
+ * Determines how to import the given module
40
+ */
41
+ type: "js" | "coffee" | "yaml" | "json" | "qrew" | "text";
415
42
  [key: string]: any;
416
- }): ModuleServeRouter;
417
- create(o: ModuleServeServerOptions): ModuleServeServer;
418
-
419
- createFileRouter(
420
- o: ModuleServeFileRouterOptions
421
- ): (req: RequestLike) => ResponseType | Promise<ResponseType>;
422
-
423
- cors: cors;
424
- json: ResponseFormatter;
425
- error: ResponseFormatter;
426
- png: ResponseFormatter;
427
- jpeg: ResponseFormatter;
428
- webp: ResponseFormatter;
429
- text: ResponseFormatter;
430
- html: ResponseFormatter;
431
- status: statusR;
432
-
433
- createResponse: createResponse;
434
-
435
- withContent: withContent;
436
- withCookies: withCookies;
437
- withParams: withParams;
438
-
439
- // @ts-ignore
440
- Request = Request;
43
+ }
44
+
45
+ interface ModuleConfOptionCenter {
46
+ /**
47
+ * Get a config key
48
+ * @param key The key of the config to get
49
+ * @param defaultValue The default value ig null
50
+ * @returns The value of the key or the defaultValue if it's null.
51
+ */
52
+ get: <T = any>(key: string, defaultValue?: T) => T;
53
+ /**
54
+ * Set a config key
55
+ * @param key The key of the config to set
56
+ * @param value The value to set it to
57
+ * @returns true if it was a success
58
+ */
59
+ set: <T = any>(key: string, value: T) => boolean;
60
+ /**
61
+ * Removes a key from the config
62
+ * @param key The key of the config to remove
63
+ * @returns true if it was a success
64
+ */
65
+ remove: (key: string) => boolean;
66
+ /**
67
+ * Resets the entire config option center to it's default value
68
+ */
69
+ reset: () => boolean;
70
+ /**
71
+ * Get all values in an option center
72
+ * @param str
73
+ * @returns
74
+ */
75
+ getAll: (() => string) | ((str?: false) => Record<string, any>);
76
+ }
77
+
78
+ interface ModuleConf extends ModuleConfOptionCenter {
79
+ /**
80
+ * A separate options file for a related set of options
81
+ * @param name The option center full path
82
+ * @param defaults The default values
83
+ *
84
+ * @example
85
+ * conf = imp 'conf'
86
+ *
87
+ * animations = conf.optionCenter 'animations', enable: false, speed: '1x'
88
+ *
89
+ * if animations.get 'enable'
90
+ * animate animations.get 'speed'
91
+ */
92
+ optionCenter: (name: string, defaults?: any) => ModuleConfOptionCenter;
93
+ /**
94
+ * Manage Static files
95
+ */
96
+ staticFile: (
97
+ name: string,
98
+ defaults?: any
99
+ ) => {
100
+ write: (value: any, ifExists?: boolean) => any;
101
+ // @ts-ignore
102
+ read: (to?: string | object) => string | object | Buffer;
103
+ fileRoot: string;
104
+ exists: boolean;
105
+ };
106
+ }
107
+
108
+ interface ModuleEnv {
109
+ has: (key: string) => boolean;
110
+ get: (key: string) => string;
111
+ set: (key: string, value: string) => boolean;
112
+ rm: (key: string) => boolean;
113
+ is: (key: string, value: string) => boolean;
114
+ }
115
+
116
+ interface ModuleRuneDBCollcetion {
117
+ insert(record: object): any;
118
+ read(id: string | object, evaluate?: boolean): any;
119
+ update(caseRecord: string | object, newRecord: object): any;
120
+ remove(id: string | object): boolean;
121
+ find(criteria: string | object): any;
122
+ map(cb: (data: any[]) => any[], mutate?: boolean): any[];
123
+ transform(cb: (data: any[]) => any[], mutate?: boolean): any[];
124
+ filter(cb: (data: any[]) => boolean, mutate?: boolean): any[];
125
+ sort(cb: (a: any, b: any) => number, mutate?: boolean): any[];
126
+ list(): any[];
127
+ }
128
+
129
+ interface ModuleRuneDBMap {
130
+ set(key: string, value: any): void;
131
+ get(key: string): any | null;
132
+ remove(key: string): boolean;
133
+ transform(cb: (data: any) => any, mutate?: boolean): any;
134
+ list(): { [key: string]: any };
135
+ }
136
+
137
+ interface ModuleRuneDB {
138
+ collection: (name: string) => ModuleRuneDBCollcetion;
139
+ map: (name: string) => ModuleRuneDBMap;
140
+ findRef: (ref: string) => any;
141
+ setData: (data: Record<string, any>) => void;
142
+ getData: () => Record<string, any>;
143
+ makeRef(value: object, props?: string): string | null;
144
+ }
145
+
146
+ interface ModuleRune {
147
+ db(dbname: string, data?: object, encryptionKey?: string): ModuleRuneDB;
148
+ genKey(secret: string): string;
149
+ push(...values: any[]): any;
150
+ pop(...values: any[]): any;
151
+ }
152
+
153
+ interface ModuleThreads {
154
+ thread: (cb: Function) => {
155
+ stopAll: () => void;
156
+ start: (context: Record<string, any>) => {
157
+ on: (event: string, callback: (data) => void) => void;
158
+ off: (event: string, callback: (data) => void) => void;
159
+ emit: (event: string, data: any) => void;
160
+ get: () => Promise<any>;
161
+ stop: () => void;
162
+ };
163
+ };
164
+ }
165
+
166
+ type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request;
167
+ type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
168
+ type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
169
+ type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
170
+ type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
171
+ : import("undici-types").RequestInit;
172
+ type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
173
+ : import("undici-types").ResponseInit;
441
174
  // @ts-ignore
442
- Response = Response;
443
- }
444
-
445
- // @ts-ignore
446
- type nodable = Element | Node | any;
447
- interface Node {
448
- type: string;
449
- props: {
450
- children: nodable[];
175
+ type _File = typeof globalThis extends { onmessage: any } ? {} : import("node:buffer").File;
176
+
177
+ interface Request {}
178
+ var Request: typeof globalThis extends {
179
+ onmessage: any;
180
+ Request: infer T;
181
+ } ? T
182
+ : typeof import("undici-types").Request;
183
+
184
+ interface ResponseInit extends _ResponseInit {}
185
+
186
+ interface Response extends _Response {}
187
+ var Response: typeof globalThis extends {
188
+ onmessage: any;
189
+ Response: infer T;
190
+ } ? T
191
+ : typeof import("undici-types").Response;
192
+
193
+ type GenericTraps = Record<string, any>;
194
+
195
+ type IRequestStrict = {
196
+ route: string;
197
+ params: {
198
+ [key: string]: string;
199
+ };
200
+ query: {
201
+ [key: string]: string | string[] | undefined;
202
+ };
203
+ proxy?: any;
204
+ } & Request;
205
+
206
+ type IRequest = IRequestStrict & GenericTraps;
207
+
208
+ type RequestHandler<RequestType = IRequest, Args extends Array<any> = any[]> = (
209
+ request: RequestType,
210
+ ...args: Args
211
+ ) => any;
212
+
213
+ type ResponseHandler<
214
+ ResponseType = any,
215
+ RequestType = IRequest,
216
+ Args extends any[] = any[]
217
+ > = (response: ResponseType, request: RequestType, ...args: Args) => any;
218
+
219
+ type StatusErrorObject = {
220
+ error?: string;
451
221
  [key: string]: any;
452
222
  };
453
- }
454
- interface ElementNode extends Node {}
455
-
456
- interface ModuleWebPageOptions {
457
- viewportMeta?: string | boolean;
458
- title?: string | boolean;
459
- }
460
-
461
- interface ModuleWebPage {
462
- root: nodable;
463
- body: nodable;
464
- head: nodable;
465
-
466
- find(key: string, value?: string): Node;
467
- add(...children: nodable[]): typeof this.body;
468
-
469
- script(script: string): ReturnType<typeof this.add>;
470
-
471
- serializeState(): string;
472
-
473
- render(static?: boolean): string;
474
-
475
- clone(): ModuleWebPage;
476
- }
477
-
478
- interface ModuleWebState {
479
- value: any;
480
- _value: any;
481
- subscribe(callback: CallableFunction): this;
482
- }
483
-
484
- declare class ModuleWeb {
485
- create(options: ModuleWebPageOptions): ModuleWebPage;
486
- isNode(node: any): boolean;
487
- isTextNode(node: any): boolean;
488
- isElementNode(node: any): boolean;
489
-
490
- createText(text: string): Node;
491
- createElement(...args: any[]): ElementNode;
492
-
493
- state(value): ModuleWebState | any;
223
+
224
+ interface StatusError extends Error {
225
+ status: number;
226
+ [key: string]: any;
227
+ constructor(status?: number, body?: StatusErrorObject | string);
228
+ }
229
+
230
+ type ErrorHandler<
231
+ ErrorType extends Error = StatusError,
232
+ RequestType = IRequest,
233
+ Args extends any[] = any[]
234
+ > = (error: ErrorType, request: RequestType, ...args: Args) => any;
235
+
236
+ type RouteEntry<RequestType = IRequest, Args extends any[] = any[]> = [
237
+ httpMethod: string,
238
+ match: RegExp,
239
+ handlers: RequestHandler<RequestType, Args>[],
240
+ path?: string
241
+ ];
242
+
243
+ type IttyRouterOptions = {
244
+ base?: string;
245
+ routes?: RouteEntry[];
246
+ } & GenericTraps;
247
+
248
+ type RouterOptions<RequestType = IRequest, Args extends any[] = []> = {
249
+ before?: RequestHandler<RequestType, Args>[];
250
+ catch?: ErrorHandler<StatusError, RequestType, Args>;
251
+ finally?: ResponseHandler<any, RequestType, Args>[];
252
+ } & IttyRouterOptions;
253
+
254
+ type AutoRouterOptions<RequestType, Args extends any[]> = {
255
+ missing?: RequestHandler<RequestType, Args>;
256
+ format?: ResponseHandler;
257
+ } & RouterOptions<RequestType, Args>;
258
+
259
+ type RequestLike = {
260
+ method: string;
261
+ url: string;
262
+ } & GenericTraps;
263
+
264
+ type Route<R = IRequest, A extends Array<any> = any[]> = <
265
+ RequestType = R,
266
+ Args extends Array<any> = A
267
+ >(
268
+ path: string,
269
+ ...handlers: RequestHandler<RequestType, Args>[]
270
+ ) => IttyRouterType<R, A>;
271
+
272
+ type CustomRoutes<R = Route> = {
273
+ [key: string]: R;
274
+ };
275
+
276
+ type IttyRouterType<
277
+ RequestType = IRequest,
278
+ Args extends any[] = any[],
279
+ ResponseType = any
280
+ > = {
281
+ __proto__: IttyRouterType<RequestType, Args, ResponseType>;
282
+ routes: RouteEntry[];
283
+ fetch: <A extends any[] = Args>(
284
+ request: RequestLike,
285
+ ...extra: A
286
+ ) => Promise<ResponseType>;
287
+ all: Route<RequestType, Args>;
288
+ delete: Route<RequestType, Args>;
289
+ get: Route<RequestType, Args>;
290
+ head: Route<RequestType, Args>;
291
+ options: Route<RequestType, Args>;
292
+ patch: Route<RequestType, Args>;
293
+ post: Route<RequestType, Args>;
294
+ put: Route<RequestType, Args>;
295
+ } & CustomRoutes<Route<RequestType, Args>> &
296
+ GenericTraps;
297
+
298
+ type RouterType<
299
+ RequestType = IRequest,
300
+ Args extends any[] = any[],
301
+ ResponseType = any
302
+ > = {
303
+ before?: RequestHandler<RequestType, Args>[];
304
+ catch?: ErrorHandler<StatusError, RequestType, Args>;
305
+ finally?: ResponseHandler<any, RequestType, Args>[];
306
+ } & IttyRouterType<RequestType, Args, ResponseType>;
307
+
308
+ type AutoRouterType<
309
+ RequestType = IRequest,
310
+ Args extends any[] = any[],
311
+ ResponseType = any
312
+ > = {
313
+ missing?: RequestHandler<RequestType, Args>;
314
+ format?: ResponseHandler;
315
+ } & RouterType<RequestType, Args, ResponseType>;
316
+
317
+ type HasContent<ContentType> = {
318
+ content: ContentType;
319
+ } & IRequestStrict;
320
+
321
+ type ResponseFormatter = (body?: any, options?: ResponseInit) => Response;
322
+
323
+ interface ErrorLike extends Error {
324
+ status?: number;
325
+ [any: string]: any;
326
+ }
327
+ type ErrorBody = string | object;
328
+ interface ErrorFormatter {
329
+ (statusCode?: number, body?: ErrorBody): Response;
330
+ }
331
+
332
+ type IttyRouter = <
333
+ RequestType extends IRequest = IRequest,
334
+ Args extends any[] = any[],
335
+ ResponseType = any
336
+ >({
337
+ base,
338
+ routes,
339
+ ...other
340
+ }?: IttyRouterOptions) => IttyRouterType<RequestType, Args, ResponseType>;
341
+
342
+ type Router = <
343
+ RequestType = IRequest,
344
+ Args extends any[] = any[],
345
+ ResponseType = any
346
+ >({
347
+ base,
348
+ routes,
349
+ ...other
350
+ }?: RouterOptions<RequestType, Args>) => RouterType<
351
+ RequestType,
352
+ Args,
353
+ ResponseType
354
+ >;
355
+
356
+ type AutoRouter = <
357
+ RequestType extends IRequest = IRequest,
358
+ Args extends any[] = any[],
359
+ ResponseType = any
360
+ >({
361
+ format,
362
+ missing,
363
+ finally: f,
364
+ before,
365
+ ...options
366
+ }?: AutoRouterOptions<RequestType, Args>) => AutoRouterType<
367
+ RequestType,
368
+ Args,
369
+ ResponseType
370
+ >;
371
+
372
+ type createResponse = (
373
+ format?: string,
374
+ transform?: ((body: any) => any) | undefined
375
+ ) => ResponseFormatter;
376
+
377
+ type statusR = (status: number, options?: ResponseInit) => Response;
378
+
379
+ type withContent = (request: IRequest) => Promise<void>;
380
+
381
+ type withCookies = (r: IRequest) => void;
382
+
383
+ type withParams = (request: IRequest) => void;
384
+
385
+ type CorsOptions = {
386
+ credentials?: true;
387
+ origin?:
388
+ | boolean
389
+ | string
390
+ | string[]
391
+ | RegExp
392
+ | ((origin: string) => string | void);
393
+ maxAge?: number;
394
+ allowMethods?: string | string[];
395
+ allowHeaders?: any;
396
+ exposeHeaders?: string | string[];
397
+ };
398
+ type Preflight = (request: IRequest) => Response | void;
399
+ type Corsify = (response: Response, request?: IRequest) => Response;
400
+ type CorsPair = {
401
+ preflight: Preflight;
402
+ corsify: Corsify;
403
+ };
404
+ type cors = (options?: CorsOptions) => {
405
+ corsify: (response: Response, request?: Request) => Response;
406
+ preflight: (request: Request) => Response | undefined;
407
+ };
408
+
409
+ interface ModuleServeRouter extends RouterType {
410
+ to(server: ModuleServeServer): any;
411
+ }
412
+
413
+ interface ResponseType{}
414
+
415
+ class ModuleServeServerOptions {
416
+ handler?: (req: RequestLike, res: ResponseType) => any;
417
+ routers?: ModuleServeRouter[];
418
+ fetch?: (req: RequestLike) => ResponseType | Promise<ResponseType>;
419
+ }
420
+
421
+ interface ModuleServeServer {
422
+ _server: any;
423
+ routers: Record<string, ModuleServeRouter>;
424
+
425
+ handleRequest: typeof ModuleServeServerOptions.prototype.handler;
426
+ listen: this;
427
+ port: (port: number) => this;
428
+ log: (string: string) => this;
429
+ }
430
+
431
+ interface ModuleServeFileRouterOptions {
432
+ root: string;
433
+ basePath?: string;
434
+ resolveExtensions?: string[];
435
+ bundlerOptions?: Record<string, any>;
436
+ bundlerEntry?: (file: string, layouts?: string[]) => string;
437
+ ssrBundlerEntry?: (file: string, layouts?: string[]) => string;
438
+ onError?: () => any;
439
+ }
440
+
441
+ class ModuleServe {
442
+ router({
443
+ id,
444
+ type,
445
+ }: {
446
+ id?: string;
447
+ type?: "auto" | "normal" | "default";
448
+ [key: string]: any;
449
+ }): ModuleServeRouter;
450
+ create(o: ModuleServeServerOptions): ModuleServeServer;
451
+
452
+ createFileRouter(
453
+ o: ModuleServeFileRouterOptions
454
+ ): (req: RequestLike) => ResponseType | Promise<ResponseType>;
455
+
456
+ cors: cors;
457
+ json: ResponseFormatter;
458
+ error: ResponseFormatter;
459
+ png: ResponseFormatter;
460
+ jpeg: ResponseFormatter;
461
+ webp: ResponseFormatter;
462
+ text: ResponseFormatter;
463
+ html: ResponseFormatter;
464
+ status: statusR;
465
+
466
+ createResponse: createResponse;
467
+
468
+ withContent: withContent;
469
+ withCookies: withCookies;
470
+ withParams: withParams;
471
+
472
+ // @ts-ignore
473
+ Request = Request;
474
+ // @ts-ignore
475
+ Response = Response;
476
+ }
477
+
494
478
  // @ts-ignore
495
- invokeState(states: State[], callback: CallableFunction): any;
496
-
497
- bundle(filePath: string, options?: Record<string, any>): string;
498
- }
479
+ type nodable = Element | Node | any;
480
+ interface Node {
481
+ type: string;
482
+ props: {
483
+ children: nodable[];
484
+ [key: string]: any;
485
+ };
486
+ }
487
+ interface ElementNode extends Node {}
488
+
489
+ interface ModuleWebPageOptions {
490
+ viewportMeta?: string | boolean;
491
+ title?: string | boolean;
492
+ }
493
+
494
+ interface ModuleWebPage {
495
+ root: nodable;
496
+ body: nodable;
497
+ head: nodable;
498
+
499
+ find(key: string, value?: string): Node;
500
+ add(...children: nodable[]): typeof this.body;
501
+
502
+ script(script: string): ReturnType<typeof this.add>;
503
+
504
+ serializeState(): string;
505
+
506
+ render(static?: boolean): string;
507
+
508
+ clone(): ModuleWebPage;
509
+ }
510
+
511
+ interface ModuleWebState {
512
+ value: any;
513
+ _value: any;
514
+ subscribe(callback: CallableFunction): this;
515
+ }
516
+
517
+ class ModuleWeb {
518
+ create(options: ModuleWebPageOptions): ModuleWebPage;
519
+ isNode(node: any): boolean;
520
+ isTextNode(node: any): boolean;
521
+ isElementNode(node: any): boolean;
522
+
523
+ createText(text: string): Node;
524
+ createElement(...args: any[]): ElementNode;
525
+
526
+ state(value): ModuleWebState | any;
527
+ // @ts-ignore
528
+ invokeState(states: State[], callback: CallableFunction): any;
529
+
530
+ bundle(filePath: string, options?: Record<string, any>): string;
531
+ }
532
+
533
+ class Stack<T = any> {
534
+ constructor();
535
+ push(item: T): void;
536
+ pop(): T | undefined;
537
+ isEmpty(): boolean;
538
+ peek(): T | undefined;
539
+ toArray(): T[];
540
+ }
541
+
542
+ class Queue<T = any> {
543
+ constructor();
544
+ enqueue(item: T): void;
545
+ dequeue(): T | undefined;
546
+ isEmpty(): boolean;
547
+ peek(): T | undefined;
548
+ toArray(): T[];
549
+ }
550
+
551
+ class LinkedList<T = any> {
552
+ constructor();
553
+ append(value: T): void;
554
+ prepend(value: T): void;
555
+ find(value: T): LinkedList.Node<T> | null;
556
+ delete(value: T): void;
557
+ toArray(): T[];
558
+ }
559
+
560
+ namespace LinkedList {
561
+ class Node<T = any> {
562
+ constructor(value: T);
563
+ value: T;
564
+ next: Node<T> | null;
565
+ }
566
+ }
567
+
568
+ class BinaryTree<T = any> {
569
+ constructor();
570
+ insert(value: T): void;
571
+ find(value: T): BinaryTree.Node<T> | null;
572
+ toArray(): T[];
573
+ }
574
+
575
+ namespace BinaryTree {
576
+ class Node<T = any> {
577
+ constructor(value: T);
578
+ value: T;
579
+ left: Node<T> | null;
580
+ right: Node<T> | null;
581
+ }
582
+ }
583
+
584
+ class DoublyLinkedList<T = any> {
585
+ constructor();
586
+ append(value: T): void;
587
+ prepend(value: T): void;
588
+ find(value: T): DoublyLinkedList.Node<T> | null;
589
+ delete(value: T): void;
590
+ toArray(): T[];
591
+ }
592
+
593
+ namespace DoublyLinkedList {
594
+ class Node<T = any> {
595
+ constructor(value: T);
596
+ value: T;
597
+ next: Node<T> | null;
598
+ prev: Node<T> | null;
599
+ }
600
+ }
601
+
602
+ interface ModuleData {
603
+ Stack: typeof Stack;
604
+ Queue: typeof Queue;
605
+ BinaryTree: typeof BinaryTree;
606
+ DoublyLinkedList: typeof DoublyLinkedList;
607
+ LinkedList: typeof LinkedList;
608
+ }
609
+
610
+ interface ModuleStream {
611
+ // @ts-ignore
612
+ Readable: Readable,
613
+ // @ts-ignore
614
+ Writable: Writable,
615
+ // @ts-ignore
616
+ Transform: Transform,
617
+ // @ts-ignore
618
+ Duplex: Duplex,
619
+ // @ts-ignore
620
+ pipeline: pipeline,
621
+ // @ts-ignore
622
+ finished: finished
623
+ }
499
624
 
500
- declare class Stack<T = any> {
501
- constructor();
502
- push(item: T): void;
503
- pop(): T | undefined;
504
- isEmpty(): boolean;
505
- peek(): T | undefined;
506
- toArray(): T[];
507
- }
508
625
 
509
- declare class Queue<T = any> {
510
- constructor();
511
- enqueue(item: T): void;
512
- dequeue(): T | undefined;
513
- isEmpty(): boolean;
514
- peek(): T | undefined;
515
- toArray(): T[];
516
- }
626
+ interface Module {
627
+ exports: any;
628
+ filepath: string;
629
+ main: boolean;
630
+ impots: string[];
631
+ compiled: string;
632
+ }
517
633
 
518
- declare class LinkedList<T = any> {
519
- constructor();
520
- append(value: T): void;
521
- prepend(value: T): void;
522
- find(value: T): LinkedList.Node<T> | null;
523
- delete(value: T): void;
524
- toArray(): T[];
525
- }
526
634
 
527
- declare namespace LinkedList {
528
- class Node<T = any> {
529
- constructor(value: T);
530
- value: T;
531
- next: Node<T> | null;
635
+ interface Imports {
636
+ meta: {
637
+ // @ts-ignore
638
+ url: URL,
639
+ main: boolean
640
+ };
641
+ assets: any;
532
642
  }
533
- }
534
643
 
535
- declare class BinaryTree<T = any> {
536
- constructor();
537
- insert(value: T): void;
538
- find(value: T): BinaryTree.Node<T> | null;
539
- toArray(): T[];
540
- }
541
644
 
542
- declare namespace BinaryTree {
543
- class Node<T = any> {
544
- constructor(value: T);
545
- value: T;
546
- left: Node<T> | null;
547
- right: Node<T> | null;
645
+ interface AppConfig {
646
+ manifest: {
647
+ package: string;
648
+ [key: string]: any;
649
+ };
548
650
  }
549
- }
550
651
 
551
- declare class DoublyLinkedList<T = any> {
552
- constructor();
553
- append(value: T): void;
554
- prepend(value: T): void;
555
- find(value: T): DoublyLinkedList.Node<T> | null;
556
- delete(value: T): void;
557
- toArray(): T[];
558
- }
559
652
 
560
- declare namespace DoublyLinkedList {
561
- class Node<T = any> {
562
- constructor(value: T);
563
- value: T;
564
- next: Node<T> | null;
565
- prev: Node<T> | null;
566
- }
567
653
  }
568
654
 
569
- declare interface ModuleData {
570
- Stack: typeof Stack;
571
- Queue: typeof Queue;
572
- BinaryTree: typeof BinaryTree;
573
- DoublyLinkedList: typeof DoublyLinkedList;
574
- LinkedList: typeof LinkedList;
575
- }
576
655
 
577
- interface ModuleStream {
656
+ // declare namespace RewContext {
578
657
  // @ts-ignore
579
- Readable: Readable,
658
+ declare const require: NodeRequire;
580
659
  // @ts-ignore
581
- Writable: Writable,
660
+ declare const module: Rew.Module;
661
+
662
+ declare function imp(path: "conf", options?: Rew.ImportOptions): Rew.ModuleConf;
663
+ declare function imp(path: "env", options?: Rew.ImportOptions): Rew.ModuleEnv;
664
+ declare function imp(path: "rune", options?: Rew.ImportOptions): Rew.ModuleRune;
665
+ declare function imp(path: "threads", options?: Rew.ImportOptions): Rew.ModuleThreads;
666
+ declare function imp(
667
+ path: "serve",
668
+ options?: Rew.ImportOptions
669
+ ): typeof Rew.ModuleServe;
670
+ declare function imp(path: "web", options?: Rew.ImportOptions): typeof Rew.ModuleWeb;
671
+ declare function imp(path: "data", options?: Rew.ImportOptions): Rew.ModuleData;
672
+ declare function imp(path: "stream", options?: Rew.ImportOptions): Rew.ModuleStream;
582
673
  // @ts-ignore
583
- Transform: Transform,
584
- // @ts-ignore
585
- Duplex: Duplex,
586
- // @ts-ignore
587
- pipeline: pipeline,
588
- // @ts-ignore
589
- finished: finished
590
- }
674
+ declare function imp(path: string, options?: Rew.ImportOptions): ReturnType<NodeRequire>
675
+
591
676
 
592
- declare function imp(path: "conf", options?: ImportOptions): ModuleConf;
593
- declare function imp(path: "env", options?: ImportOptions): ModuleEnv;
594
- declare function imp(path: "rune", options?: ImportOptions): ModuleRune;
595
- declare function imp(path: "threads", options?: ImportOptions): ModuleThreads;
596
- declare function imp(
597
- path: "serve",
598
- options?: ImportOptions
599
- ): typeof ModuleServe;
600
- declare function imp(path: "web", options?: ImportOptions): typeof ModuleWeb;
601
- declare function imp(path: "data", options?: ImportOptions): ModuleData;
602
- declare function imp(path: "stream", options?: ImportOptions): ModuleStream;
603
- declare function imp(path: string, options?: ImportOptions): any;
604
-
605
- declare const inc: typeof imp;
606
-
607
- // @ts-ignore
608
- declare function require(moduleName: string): any;
609
-
610
- interface Module {
611
- exports: any;
612
- filepath: string;
613
- main: boolean;
614
- impots: string[];
615
- compiled: string;
616
- }
677
+ declare const inc: typeof imp;
678
+ declare const imports: Rew.Imports;
617
679
 
618
- // @ts-ignore
619
- declare const module: Module;
620
680
 
621
- interface Imports {
622
- meta: {
623
- // @ts-ignore
624
- url: URL,
625
- main: boolean
681
+ // @ts-ignore
682
+ declare const process: {
683
+ argv: string[];
684
+ target: ReturnType<typeof emitter>;
685
+ __execFile: string;
686
+ env: Record<string, any>;
687
+ cwd: () => string;
688
+ arch: string;
689
+ exit: () => void;
626
690
  };
627
- assets: any;
628
- }
629
691
 
630
- declare const imports: Imports;
631
-
632
- // @ts-ignore
633
- declare const process: {
634
- argv: string[];
635
- target: ReturnType<typeof emitter>;
636
- __execFile: string;
637
- env: Record<string, any>;
638
- cwd: () => string;
639
- arch: string;
640
- exit: () => void;
641
- };
642
-
643
- interface AppConfig {
644
- manifest: {
645
- package: string;
692
+ declare const app: {
693
+ path: string;
694
+ config: Rew.AppConfig;
695
+ };
696
+
697
+ declare function read(filepath: string, options?: { encoding: string }): string;
698
+
699
+ declare function realpath(
700
+ filepath: string,
701
+ options?: { encoding: string }
702
+ ): string;
703
+
704
+ declare function write(filepath: string, content: any, options?: any): void;
705
+
706
+ declare function exists(filepath: string, options?: any): boolean;
707
+
708
+ declare function fstat(filepath: string, options?: any): any;
709
+
710
+ declare function rm(filepath: string, options?: any): void;
711
+
712
+ declare function chmod(filepath: string, mode: any, options?: any): void;
713
+
714
+ declare function mkdir(filepath: string, options?: any): void;
715
+
716
+ declare function ls(filepath: string, options?: any): string[];
717
+
718
+ declare function struct(template: {
646
719
  [key: string]: any;
647
- };
648
- }
649
-
650
- declare const app: {
651
- path: string;
652
- config: AppConfig;
653
- };
654
-
655
- declare function read(filepath: string, options?: { encoding: string }): string;
656
-
657
- declare function realpath(
658
- filepath: string,
659
- options?: { encoding: string }
660
- ): string;
720
+ }): (...args: any[]) => any;
661
721
 
662
- declare function write(filepath: string, content: any, options?: any): void;
722
+ declare function future(
723
+ callback: (resolve: (data: any) => void, reject: (data: any) => void) => void,
724
+ timeout?: number,
725
+ defData?: any
726
+ ): {
727
+ pipe(callback: (data: any) => any): Promise<any>;
728
+ last(callback: (data: any) => any): Promise<any>;
729
+ catch(callback: (data: any) => any): Promise<any>;
730
+ resolve(data: any): void;
731
+ reject(data: any): void;
732
+ wait(): Promise<any>;
733
+ };
734
+ declare namespace future {
735
+ function promise(
736
+ promse: Promise<any>,
737
+ timeout?: number,
738
+ defData?: any
739
+ ): ReturnType<typeof future>;
740
+ }
663
741
 
664
- declare function exists(filepath: string, options?: any): boolean;
742
+ declare function emitter(): {
743
+ on(
744
+ event: string | string[],
745
+ callback: (...args: any[]) => void,
746
+ props?: {}
747
+ ): ReturnType<typeof emitter>;
748
+ off(
749
+ event: string | string[],
750
+ callback: (...args: any[]) => void,
751
+ removable?: (event: any) => void
752
+ ): ReturnType<typeof emitter>;
753
+ emit(event: string | string[], ...data: any[]): ReturnType<typeof emitter>;
754
+ };
665
755
 
666
- declare function fstat(filepath: string, options?: any): any;
756
+ declare function exec(command: string, options?: { output?: boolean }): any;
757
+ declare namespace exec {
758
+ function background(
759
+ command: string,
760
+ options?: any,
761
+ callback?: (...args: any[]) => void
762
+ ): any;
763
+ }
764
+ declare function spawn(command: string, ...args: any[]): any;
667
765
 
668
- declare function rm(filepath: string, options?: any): void;
766
+ declare function typedef(
767
+ value: any,
768
+ strict?: boolean
769
+ ): {
770
+ strict: boolean;
771
+ defaultValue: any;
772
+ class: Function;
773
+ type: string;
774
+ isConstucted: boolean;
775
+ isEmpty: boolean;
776
+ };
669
777
 
670
- declare function chmod(filepath: string, mode: any, options?: any): void;
778
+ // @ts-ignore
779
+ declare const Request: Rew.Request
780
+ // @ts-ignore
781
+ declare const Response: Rew.Response
671
782
 
672
- declare function mkdir(filepath: string, options?: any): void;
783
+ declare function typeis(obj: any, typeDef: any): boolean;
673
784
 
674
- declare function ls(filepath: string, options?: any): string[];
785
+ declare function typex(child: any, parent: any): boolean;
675
786
 
676
- declare function struct(template: {
677
- [key: string]: any;
678
- }): (...args: any[]) => any;
787
+ declare function typei(child: any, parent: any): boolean;
679
788
 
680
- declare function future(
681
- callback: (resolve: (data: any) => void, reject: (data: any) => void) => void,
682
- timeout?: number,
683
- defData?: any
684
- ): {
685
- pipe(callback: (data: any) => any): Promise<any>;
686
- last(callback: (data: any) => any): Promise<any>;
687
- catch(callback: (data: any) => any): Promise<any>;
688
- resolve(data: any): void;
689
- reject(data: any): void;
690
- wait(): Promise<any>;
691
- };
692
- declare namespace future {
693
- function promise(
694
- promse: Promise<any>,
695
- timeout?: number,
696
- defData?: any
697
- ): ReturnType<typeof future>;
698
- }
789
+ declare function int(v: any): number;
699
790
 
700
- declare function emitter(): {
701
- on(
702
- event: string | string[],
703
- callback: (...args: any[]) => void,
704
- props?: {}
705
- ): ReturnType<typeof emitter>;
706
- off(
707
- event: string | string[],
708
- callback: (...args: any[]) => void,
709
- removable?: (event: any) => void
710
- ): ReturnType<typeof emitter>;
711
- emit(event: string | string[], ...data: any[]): ReturnType<typeof emitter>;
712
- };
713
- declare function exec(command: string, options?: { output?: boolean }): any;
714
- declare namespace exec {
715
- function background(
716
- command: string,
717
- options?: any,
718
- callback?: (...args: any[]) => void
791
+ declare namespace int {
792
+ const type: {
793
+ strict: boolean;
794
+ defaultValue: number;
795
+ class: Function;
796
+ type: string;
797
+ isConstucted: boolean;
798
+ isEmpty: boolean;
799
+ };
800
+ }
801
+ declare function float(v: any): number;
802
+ declare namespace float {
803
+ const type: {
804
+ strict: boolean;
805
+ defaultValue: number;
806
+ class: Function;
807
+ type: string;
808
+ isConstucted: boolean;
809
+ isEmpty: boolean;
810
+ };
811
+ }
812
+ declare function num(v: any): number;
813
+ declare namespace num {
814
+ const type: {
815
+ strict: boolean;
816
+ defaultValue: number;
817
+ class: Function;
818
+ type: string;
819
+ isConstucted: boolean;
820
+ isEmpty: boolean;
821
+ };
822
+ }
823
+ declare function str(str: any): string;
824
+ declare namespace str {
825
+ const type: {
826
+ strict: boolean;
827
+ defaultValue: string;
828
+ class: Function;
829
+ type: string;
830
+ isConstucted: boolean;
831
+ isEmpty: boolean;
832
+ };
833
+ }
834
+ declare function bool(value: any): boolean;
835
+ declare namespace bool {
836
+ const type: {
837
+ strict: boolean;
838
+ defaultValue: boolean;
839
+ class: Function;
840
+ type: string;
841
+ isConstucted: boolean;
842
+ isEmpty: boolean;
843
+ };
844
+ }
845
+ declare function isEmpty(value: any): boolean;
846
+ declare function clone(value: any): any;
847
+ declare function deepClone(value: any): any;
848
+ declare function merge(obj1: any, obj2: any): any;
849
+ declare const uniqueId: () => string;
850
+ declare function filter(arr: any[], fn: (value: any) => boolean): any[];
851
+ declare function reduce(
852
+ arr: any[],
853
+ fn: (acc: any, value: any) => any,
854
+ initial: any
719
855
  ): any;
720
- }
721
- declare function spawn(command: string, ...args: any[]): any;
722
-
723
- declare function typedef(
724
- value: any,
725
- strict?: boolean
726
- ): {
727
- strict: boolean;
728
- defaultValue: any;
729
- class: Function;
730
- type: string;
731
- isConstucted: boolean;
732
- isEmpty: boolean;
733
- };
734
-
735
- declare function typeis(obj: any, typeDef: any): boolean;
856
+ declare function compose(...fns: Function[]): (initialValue: any) => any;
857
+ declare function curry(fn: Function): (...args: any[]) => any;
858
+ // @ts-ignore
859
+ declare function json(thing: string): any;
860
+ declare function jsons(thing: any): string;
861
+ declare function yaml(thing: any): any;
862
+ declare function yamls(thing: any): string;
736
863
 
737
- declare function typex(child: any, parent: any): boolean;
738
864
 
739
- declare function typei(child: any, parent: any): boolean;
865
+ /**
866
+ * Makes a HTTP request to the specified URL.
867
+ * @param url The URL to request.
868
+ * @param options The options for the request.
869
+ * @returns A promise resolving to the response or other specified output based on the options.
870
+ */
871
+ declare function curl(
872
+ url: string,
873
+ options: {
874
+ /**
875
+ * Indicates whether to return a promise.
876
+ */
877
+ a: true;
878
+ /**
879
+ * Indicates whether to return the response as plain text.
880
+ */
881
+ text: true;
882
+ o?: string;
883
+ }
884
+ ): Promise<string>;
885
+ /**
886
+ * Makes a HTTP request to the specified URL.
887
+ * @param url The URL to request.
888
+ * @param options The options for the request.
889
+ * @returns A promise resolving to the response or other specified output based on the options.
890
+ */
891
+ declare function curl(
892
+ url: string,
893
+ options: {
894
+ /**
895
+ * Indicates whether to return a promise.
896
+ */
897
+ a: true;
898
+ /**
899
+ * Indicates whether to return the response as JSON.
900
+ */
901
+ json: true;
902
+ /**
903
+ * The file path to output the response.
904
+ */
905
+ o?: string;
906
+ }
907
+ ): Promise<object>;
908
+ /**
909
+ * Makes a HTTP request to the specified URL.
910
+ * @param url The URL to request.
911
+ * @param options The options for the request.
912
+ * @returns A promise resolving to the response or other specified output based on the options.
913
+ */
914
+ declare function curl(
915
+ url: string,
916
+ options: {
917
+ /**
918
+ * Indicates whether to return a promise.
919
+ */
920
+ a: true;
921
+ /**
922
+ * The file path to output the response.
923
+ */
924
+ o?: string;
925
+ }
926
+ // @ts-ignore
927
+ ): Promise<Response>;
740
928
 
741
- declare function int(v: any): number;
929
+ /**
930
+ * Makes a HTTP request to the specified URL.
931
+ * @param url The URL to request.
932
+ * @param options The options for the request.
933
+ * @returns A promise resolving to the response or other specified output based on the options.
934
+ */
935
+ declare function curl(
936
+ url: string,
937
+ options?: {
938
+ /**
939
+ * Indicates whether to return a promise.
940
+ */
941
+ a?: boolean;
942
+ /**
943
+ * The file path to output the response.
944
+ */
945
+ o?: string;
946
+ /**
947
+ * Indicates whether to return the response as JSON.
948
+ */
949
+ json?: boolean;
950
+ /**
951
+ * Indicates whether to return the response as plain text.
952
+ */
953
+ text?: boolean;
954
+ }
955
+ ): ReturnType<typeof future>;
742
956
 
743
- declare namespace int {
744
- const type: {
745
- strict: boolean;
746
- defaultValue: number;
747
- class: Function;
748
- type: string;
749
- isConstucted: boolean;
750
- isEmpty: boolean;
751
- };
752
- }
753
- declare function float(v: any): number;
754
- declare namespace float {
755
- const type: {
756
- strict: boolean;
757
- defaultValue: number;
758
- class: Function;
759
- type: string;
760
- isConstucted: boolean;
761
- isEmpty: boolean;
762
- };
763
- }
764
- declare function num(v: any): number;
765
- declare namespace num {
766
- const type: {
767
- strict: boolean;
768
- defaultValue: number;
769
- class: Function;
770
- type: string;
771
- isConstucted: boolean;
772
- isEmpty: boolean;
773
- };
774
- }
775
- declare function str(str: any): string;
776
- declare namespace str {
777
- const type: {
778
- strict: boolean;
779
- defaultValue: string;
780
- class: Function;
781
- type: string;
782
- isConstucted: boolean;
783
- isEmpty: boolean;
784
- };
785
- }
786
- declare function bool(value: any): boolean;
787
- declare namespace bool {
788
- const type: {
789
- strict: boolean;
790
- defaultValue: boolean;
791
- class: Function;
792
- type: string;
793
- isConstucted: boolean;
794
- isEmpty: boolean;
795
- };
796
- }
797
- declare function isEmpty(value: any): boolean;
798
- declare function clone(value: any): any;
799
- declare function deepClone(value: any): any;
800
- declare function merge(obj1: any, obj2: any): any;
801
- declare const uniqueId: () => string;
802
- declare function filter(arr: any[], fn: (value: any) => boolean): any[];
803
- declare function reduce(
804
- arr: any[],
805
- fn: (acc: any, value: any) => any,
806
- initial: any
807
- ): any;
808
- declare function compose(...fns: Function[]): (initialValue: any) => any;
809
- declare function curry(fn: Function): (...args: any[]) => any;
810
- declare function json(thing: string): any;
811
- declare function jsons(thing: any): string;
812
- declare function yaml(thing: any): any;
813
- declare function yamls(thing: any): string;
814
-
815
- /**
816
- * Makes a HTTP request to the specified URL.
817
- * @param url The URL to request.
818
- * @param options The options for the request.
819
- * @returns A promise resolving to the response or other specified output based on the options.
820
- */
821
- declare function curl(
822
- url: string,
823
- options: {
824
- /**
825
- * Indicates whether to return a promise.
826
- */
827
- a: true;
828
- /**
829
- * Indicates whether to return the response as plain text.
830
- */
831
- text: true;
832
- o?: string;
833
- }
834
- ): Promise<string>;
835
- /**
836
- * Makes a HTTP request to the specified URL.
837
- * @param url The URL to request.
838
- * @param options The options for the request.
839
- * @returns A promise resolving to the response or other specified output based on the options.
840
- */
841
- declare function curl(
842
- url: string,
843
- options: {
844
- /**
845
- * Indicates whether to return a promise.
846
- */
847
- a: true;
848
- /**
849
- * Indicates whether to return the response as JSON.
850
- */
851
- json: true;
852
- /**
853
- * The file path to output the response.
854
- */
855
- o?: string;
856
- }
857
- ): Promise<object>;
858
- /**
859
- * Makes a HTTP request to the specified URL.
860
- * @param url The URL to request.
861
- * @param options The options for the request.
862
- * @returns A promise resolving to the response or other specified output based on the options.
863
- */
864
- declare function curl(
865
- url: string,
866
- options: {
867
- /**
868
- * Indicates whether to return a promise.
869
- */
870
- a: true;
871
- /**
872
- * The file path to output the response.
873
- */
874
- o?: string;
875
- }
876
- // @ts-ignore
877
- ): Promise<Response>;
878
-
879
- /**
880
- * Makes a HTTP request to the specified URL.
881
- * @param url The URL to request.
882
- * @param options The options for the request.
883
- * @returns A promise resolving to the response or other specified output based on the options.
884
- */
885
- declare function curl(
886
- url: string,
887
- options?: {
888
- /**
889
- * Indicates whether to return a promise.
890
- */
891
- a?: boolean;
892
- /**
893
- * The file path to output the response.
894
- */
895
- o?: string;
896
- /**
897
- * Indicates whether to return the response as JSON.
898
- */
899
- json?: boolean;
900
- /**
901
- * Indicates whether to return the response as plain text.
902
- */
903
- text?: boolean;
957
+ declare function print(...args: any[]): void;
958
+ declare namespace print {
959
+ // @ts-ignore
960
+ const stdout: WriteStream;
961
+ // @ts-ignore
962
+ const stdin: ReadStream;
904
963
  }
905
- ): ReturnType<typeof future>;
906
964
 
907
- declare function print(...args: any[]): void;
908
- declare namespace print {
909
- // @ts-ignore
910
- const stdout: WriteStream;
911
- // @ts-ignore
912
- const stdin: ReadStream;
913
- }
965
+ declare function input(prompt: string): string;
914
966
 
915
- declare function input(prompt: string): string;
967
+ declare const basename: (path: string) => string;
968
+ declare const dirname: (path: string) => string;
969
+ declare const extname: (path: string) => string;
970
+ declare const pjoin: (...paths: string[]) => string;
971
+ declare const presolve: (...paths: string[]) => string;
916
972
 
917
- declare const basename: (path: string) => string;
918
- declare const dirname: (path: string) => string;
919
- declare const extname: (path: string) => string;
920
- declare const pjoin: (...paths: string[]) => string;
921
- declare const presolve: (...paths: string[]) => string;
973
+ // @ts-ignore
974
+ declare function exports(value: any): any;
922
975
 
923
- // @ts-ignore
924
- declare function exports(value: any): any;
925
976
 
977
+ declare function pub(value: any): any;
978
+ declare function pub(name: string, value: any): any;
926
979
 
927
- declare function pub(value: any): any;
928
- declare function pub(name: string, value: any): any;
980
+ declare const opt: {
981
+ set: (key: string, value: any) => void;
982
+ get: (key: string) => any;
983
+ push: (key: string, value: any) => any;
984
+ pop: (key: string) => any;
985
+ };
929
986
 
930
- declare const opt: {
931
- set: (key: string, value: any) => void;
932
- get: (key: string) => any;
933
- push: (key: string, value: any) => any;
934
- pop: (key: string) => any;
935
- };
987
+ declare const JSX: any;
988
+ declare const TYPES: any;
989
+ declare const DECORATORS: any;
990
+ declare function using(fn: any, ...args: any[]): any;
936
991
 
937
- declare const JSX: any;
938
- declare const TYPES: any;
939
- declare const DECORATORS: any;
940
- declare function using(fn: any, ...args: any[]): any;
992
+ declare function wait(fn: CallableFunction, ...args: any[]): any;
993
+ declare function clear(): void;
941
994
 
942
- declare function wait(fn: CallableFunction, ...args: any[]): any;
943
- declare function clear(): void;
995
+ declare function namespace(object: any, callback: () => any): Usage;
996
+ declare namespace namespace {
997
+ function group<T = any[], U = any>(group: T, props?: U): { g: T, [key: string]: any }
998
+ }
944
999
 
945
- declare function namespace(object: any, callback: () => any): Usage;
946
- declare namespace namespace {
947
- function group<T = any[], U = any>(group: T, props?: U): { g: T, [key: string]: any }
948
- }
1000
+ declare class Usage<T = () => void> {
1001
+ name: string;
1002
+ trigger: T;
1003
+ save: boolean;
1004
+ constructor(name: string, trigger: T, save: boolean);
1005
+ create(name: string, trigger: T, save: boolean): Usage;
1006
+ group(...group: any[]): { g: T, with: (props: any) => { g: T, [key: string]: any }, [key: string]: any }
1007
+ }
949
1008
 
950
- declare class Usage<T = () => void> {
951
- name: string;
952
- trigger: T;
953
- save: boolean;
954
- constructor(name: string, trigger: T, save: boolean);
955
- create(name: string, trigger: T, save: boolean): Usage;
956
- group(...group: any[]): { g: T, with: (props: any) => { g: T, [key: string]: any }, [key: string]: any }
957
- }
1009
+ // }