@seip/bluebird-js 0.1.4 → 0.1.5

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/core/index.d.ts CHANGED
@@ -1,1278 +1,1385 @@
1
- import type { Server as HttpServer } from "node:http";
2
- import { Router as ExpressRouter, Request, Response, NextFunction, RequestHandler } from "express";
3
-
4
- export type { Request, Response, NextFunction, RequestHandler };
5
-
6
- /**
7
- * Standard pagination metadata structure.
8
- */
9
- export interface PaginationMeta {
10
- page?: number;
11
- limit?: number;
12
- total?: number;
13
- totalPages?: number;
14
- }
15
-
16
- /**
17
- * Uploaded file object populated by multer middleware.
18
- */
19
- export interface UploadedFile {
20
- fieldname: string;
21
- originalname: string;
22
- encoding: string;
23
- mimetype: string;
24
- size: number;
25
- destination: string;
26
- filename: string;
27
- path: string;
28
- buffer?: Buffer;
29
- }
30
-
31
- /**
32
- * Standard Bluebird API JSON response envelope.
33
- */
34
- export interface ApiResponse<T = any> {
35
- status: "success" | "error";
36
- message: string;
37
- data?: T;
38
- errors?: any;
39
- pagination?: PaginationMeta;
40
- }
41
-
42
- declare global {
43
- namespace Express {
44
- interface Response {
45
- /**
46
- * Sends a standardized JSON success response.
47
- * @param data Data payload to return.
48
- * @param message Success message.
49
- * @param statusCode HTTP status code (default: 200).
50
- */
51
- success<T = any>(data?: T, message?: string, statusCode?: number): Response;
52
-
53
- /**
54
- * Sends a standardized HTTP 200 OK success response.
55
- * @param data Data payload.
56
- * @param message Success message.
57
- */
58
- ok<T = any>(data?: T, message?: string): Response;
59
-
60
- /**
61
- * Sends a standardized HTTP 201 Created success response.
62
- * @param data Data payload.
63
- * @param message Success message.
64
- */
65
- created<T = any>(data?: T, message?: string): Response;
66
-
67
- /**
68
- * Sends a standardized HTTP 400 Bad Request error response.
69
- * @param message Error message.
70
- * @param errors Detailed errors array or object.
71
- */
72
- badRequest(message?: string, errors?: any): Response;
73
-
74
- /**
75
- * Sends a standardized HTTP 401 Unauthorized error response.
76
- * @param message Error message.
77
- */
78
- unauthorized(message?: string): Response;
79
-
80
- /**
81
- * Sends a standardized HTTP 403 Forbidden error response.
82
- * @param message Error message.
83
- */
84
- forbidden(message?: string): Response;
85
-
86
- /**
87
- * Sends a standardized HTTP 404 Not Found error response.
88
- * @param message Error message.
89
- */
90
- notFound(message?: string): Response;
91
-
92
- /**
93
- * Sends a standardized HTTP 500 Internal Server Error response.
94
- * @param message Error message.
95
- * @param errors Error details.
96
- */
97
- serverError(message?: string, errors?: any): Response;
98
-
99
- /**
100
- * Sends a standardized JSON error response.
101
- * @param message Error message.
102
- * @param statusCode HTTP status code (default: 400).
103
- * @param errors Array or object of detailed errors.
104
- */
105
- error(message?: string, statusCode?: number, errors?: any): Response;
106
-
107
- /**
108
- * Sends a standardized paginated JSON response.
109
- * @param data Array of records for current page.
110
- * @param pagination Object containing page, limit, and total count.
111
- * @param message Success message.
112
- */
113
- paginate<T = any>(
114
- data?: T[],
115
- pagination?: PaginationMeta,
116
- message?: string
117
- ): Response;
118
- }
119
-
120
- interface Request {
121
- lang?: string;
122
- user?: any;
123
- csrfToken?(): string;
124
- file?: UploadedFile;
125
- files?: UploadedFile[] | Record<string, UploadedFile[]>;
126
- [key: string]: any;
127
- }
128
- }
129
- }
130
-
131
- export class AppError extends Error {
132
- statusCode: number;
133
- errors: any;
134
- isOperational: boolean;
135
-
136
- constructor(message: string, statusCode?: number, errors?: any);
137
- }
138
-
139
- /**
140
- * CORS configuration options.
141
- */
142
- export interface CorsOptions {
143
- origin?:
144
- | string
145
- | boolean
146
- | string[]
147
- | ((origin: string | undefined, req: Request) => boolean);
148
- methods?: string | string[];
149
- allowedHeaders?: string | string[];
150
- exposedHeaders?: string | string[];
151
- credentials?: boolean;
152
- maxAge?: number;
153
- }
154
-
155
- /**
156
- * Security response headers options.
157
- */
158
- export interface SecurityHeadersOptions {
159
- csp?: string | false;
160
- frameOptions?: string;
161
- referrerPolicy?: string;
162
- permissionsPolicy?: string;
163
- }
164
-
165
- /**
166
- * Static asset serving options.
167
- */
168
- export interface AppStaticOptions {
169
- path: string;
170
- options?: Record<string, any>;
171
- }
172
-
173
- /**
174
- * Rate limit configuration options.
175
- */
176
- export interface RateLimitOptions {
177
- windowMs?: number;
178
- max?: number;
179
- message?: string;
180
- statusCode?: number;
181
- headers?: boolean;
182
- driver?: "memory" | "redis";
183
- keyGenerator?: (req: Request) => string;
184
- skip?: (req: Request) => boolean;
185
- }
186
-
187
- export class RateLimit {
188
- static middleware(options?: RateLimitOptions | boolean): (req: Request, res: Response, next: NextFunction) => Promise<any>;
189
- static clear(): void;
190
- }
191
-
192
- export class Seo {
193
- static registerRoute(basePath: string, routePath: string | RegExp, languages?: string[]): void;
194
- static getRoutes(): string[];
195
- static clear(): void;
196
- static generateSitemap(baseUrl?: string): string;
197
- static generateRobots(baseUrl?: string, disallow?: string[]): string;
198
- }
199
-
200
- /**
201
- * WebSocket manager configuration options.
202
- */
203
- export interface WebSocketOptions {
204
- path?: string;
205
- auth?: boolean;
206
- maxPayload?: number;
207
- }
208
-
209
- /**
210
- * Active WebSocket client connection interface.
211
- */
212
- export interface WebSocketClient {
213
- isAlive?: boolean;
214
- user?: any;
215
- rooms?: Set<string>;
216
- send(data: any): void;
217
- on(event: string, handler: (...args: any[]) => void): void;
218
- close(code?: number, reason?: string): void;
219
- [key: string]: any;
220
- }
221
-
222
- export type WebSocketConnectionHandler = (ws: WebSocketClient, req: Request) => void;
223
-
224
- export class WebSocketManager {
225
- server: HttpServer;
226
- path: string;
227
- requireAuth: boolean;
228
- maxPayload: number;
229
- rooms: Map<string, Set<WebSocketClient>>;
230
- clients: Set<WebSocketClient>;
231
-
232
- constructor(server: HttpServer | any, options?: WebSocketOptions);
233
- onConnection(handler: WebSocketConnectionHandler): void;
234
- join(room: string, ws: WebSocketClient): void;
235
- leave(room: string, ws: WebSocketClient): void;
236
- broadcast(data: any, room?: string | null): void;
237
- }
238
-
239
- /**
240
- * Application initialization options.
241
- */
242
- export interface AppOptions {
243
- routes?: Array<Router | ExpressRouter | any>;
244
- cors?: boolean | CorsOptions;
245
- middlewares?: Array<RequestHandler | any>;
246
- port?: number | string;
247
- host?: string;
248
- appUrl?: string;
249
- logger?: boolean;
250
- notFound?: boolean;
251
- json?: boolean | Record<string, any>;
252
- urlencoded?: boolean | Record<string, any>;
253
- static?: AppStaticOptions;
254
- cookieParser?: boolean;
255
- swagger?: boolean | SwaggerOptions;
256
- compression?: boolean;
257
- security?: boolean | SecurityHeadersOptions;
258
- rateLimit?: boolean | RateLimitOptions;
259
- autoRoutes?: boolean;
260
- noAutoDiscoverRoutes?: boolean;
261
- desktop?: boolean;
262
- userDataPath?: string;
263
- appPath?: string;
264
- allowLan?: boolean;
265
- trustProxy?: boolean | number | string;
266
- }
267
-
268
- export class App {
269
- app: ExpressRouter | any;
270
- server: HttpServer;
271
- wsManager: WebSocketManager | null;
272
- routes: any[];
273
- cors: boolean | CorsOptions;
274
- middlewares: any[];
275
- port: number | string;
276
- host: string;
277
- appUrl: string;
278
- logger: boolean;
279
- notFound: boolean;
280
- desktop: boolean;
281
- allowLan: boolean;
282
- trustProxy: boolean | number | string;
283
-
284
- constructor(options?: AppOptions);
285
-
286
- use(record: any): void;
287
- set(key: string, value: any): void;
288
- websocket(
289
- options?:
290
- | WebSocketConnectionHandler
291
- | WebSocketOptions
292
- ): WebSocketManager;
293
- getPort(): number;
294
- getUrl(): string;
295
- run(): Promise<any>;
296
- runDesktop(options?: {
297
- appPath?: string;
298
- userDataPath?: string;
299
- allowLan?: boolean;
300
- host?: string;
301
- port?: number;
302
- }): Promise<{ server: HttpServer; port: number; url: string; lanUrl?: string; lanIp?: string }>;
303
- close(): Promise<void>;
304
-
305
- static helmet(options?: any): (req: Request, res: Response, next: NextFunction) => void;
306
- static securityHeaders(options?: SecurityHeadersOptions): (req: Request, res: Response, next: NextFunction) => void;
307
- static rateLimit(options?: RateLimitOptions | boolean): (req: Request, res: Response, next: NextFunction) => Promise<any>;
308
- }
309
-
310
- /**
311
- * Router configuration options.
312
- */
313
- export interface RouterOptions {
314
- seo?: boolean;
315
- languages?: string[];
316
- }
317
-
318
- export class Router {
319
- router: ExpressRouter;
320
- path: string;
321
-
322
- constructor(path?: string, options?: RouterOptions);
323
-
324
- use(...middleware: Array<RequestHandler | any>): void;
325
- get(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
326
- post(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
327
- put(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
328
- delete(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
329
- patch(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
330
- options(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
331
- getRouter(): ExpressRouter;
332
- getPath(): string;
333
- }
334
-
335
- /**
336
- * Validation rule configuration for a single field.
337
- */
338
- export interface ValidationRule {
339
- required?: boolean;
340
- min?: number;
341
- max?: number;
342
- email?: boolean;
343
- number?: boolean;
344
- alpha?: boolean;
345
- alphanumeric?: boolean;
346
- boolean?: boolean;
347
- date?: boolean;
348
- url?: boolean;
349
- in?: any[];
350
- equals?: any;
351
- password?: boolean;
352
- pattern?: RegExp | string;
353
- xss?: boolean;
354
- messages?: Partial<
355
- Record<
356
- | "required"
357
- | "min"
358
- | "max"
359
- | "email"
360
- | "number"
361
- | "alpha"
362
- | "alphanumeric"
363
- | "boolean"
364
- | "date"
365
- | "url"
366
- | "in"
367
- | "equals"
368
- | "password"
369
- | "pattern",
370
- string
371
- >
372
- >;
373
- }
374
-
375
- /**
376
- * Validator schema definition.
377
- */
378
- export type ValidationSchema = Record<string, ValidationRule>;
379
-
380
- /**
381
- * Validation failure item.
382
- */
383
- export interface ValidationError {
384
- field: string;
385
- message: string;
386
- }
387
-
388
- /**
389
- * Validation output result.
390
- */
391
- export interface ValidationResult {
392
- success: boolean;
393
- error: boolean;
394
- errors: ValidationError[];
395
- message: string[];
396
- html?: string[];
397
- }
398
-
399
- export class Validator {
400
- schema: ValidationSchema;
401
- lang_default: string | null;
402
- messages: Record<string, any>;
403
-
404
- constructor(schema: ValidationSchema, lang_default?: string, messages?: Record<string, any>);
405
- middleware(): (req: Request, res: Response, next: NextFunction) => void;
406
- validate(req: Request | Record<string, any>): Promise<ValidationResult>;
407
- static xssMiddleware(): (req: Request, res: Response, next: NextFunction) => void;
408
- static sanitizeObject<T = any>(obj: T): T;
409
- static mutateSanitized(obj: any): void;
410
- }
411
-
412
- /**
413
- * Password hashing options.
414
- */
415
- export interface HashMakeOptions {
416
- driver?: "scrypt" | "bcrypt";
417
- rounds?: number;
418
- N?: number;
419
- r?: number;
420
- p?: number;
421
- }
422
-
423
- export class Hash {
424
- static make(password: string, options?: HashMakeOptions): Promise<string>;
425
- static hash(password: string, options?: HashMakeOptions): Promise<string>;
426
- static verify(password: string, hash: string): Promise<boolean>;
427
- static check(password: string, hash: string): Promise<boolean>;
428
- static needsRehash(hash: string, options?: HashMakeOptions): boolean;
429
- }
430
-
431
- /**
432
- * Auth protect middleware options.
433
- */
434
- export interface AuthProtectOptions {
435
- redirect?: string | null;
436
- key?: string;
437
- cookieKey?: string;
438
- secret?: string;
439
- }
440
-
441
- /**
442
- * Auth login options.
443
- */
444
- export interface AuthLoginOptions {
445
- expiresIn?: string | number;
446
- cookie?: Record<string, any>;
447
- secret?: string;
448
- }
449
-
450
- /**
451
- * Decoded Auth JWT token payload.
452
- */
453
- export type AuthTokenPayload = Record<string, any> & {
454
- _sessionId?: string;
455
- exp?: number;
456
- iat?: number;
457
- };
458
-
459
- export class Auth {
460
- static encrypt(payload: any, secret?: string): string;
461
- static decrypt<T = any>(data: string, secret?: string): T | null;
462
- static generateToken(payload: any, secret?: string, expiresIn?: string | number): string;
463
- static verifyToken<T = any>(token: string, secret?: string): T | null;
464
- static protect(options?: AuthProtectOptions): (req: Request, res: Response, next: NextFunction) => Promise<any>;
465
- static login(res: Response, data: any, key?: string, options?: AuthLoginOptions): Promise<string>;
466
- static logout(res: Response, key?: string, options?: Record<string, any>, req?: Request | null): Promise<boolean>;
467
- }
468
-
469
- export type CacheDriver = "memory" | "redis" | "file";
470
-
471
- /**
472
- * Cache middleware options.
473
- */
474
- export interface CacheMiddlewareOptions {
475
- driver?: "memory" | "redis";
476
- allowAuthenticated?: boolean;
477
- key?: (req: Request) => string;
478
- }
479
-
480
- /**
481
- * Cache read options.
482
- */
483
- export interface CacheGetOptions {
484
- driver?: CacheDriver;
485
- }
486
-
487
- /**
488
- * Cache write options.
489
- */
490
- export interface CacheSetOptions {
491
- driver?: CacheDriver;
492
- fallbackDriver?: CacheDriver;
493
- }
494
-
495
- export class Cache {
496
- static middleware(seconds?: number, options?: CacheMiddlewareOptions): (req: Request, res: Response, next: NextFunction) => Promise<any>;
497
- static get<T = any>(key: string, options?: CacheGetOptions): Promise<T | null>;
498
- static set(key: string, value: any, seconds?: number, options?: CacheSetOptions): Promise<boolean>;
499
- static deduplicate<T = any>(key: string, loader: () => Promise<T>): Promise<T>;
500
- static delete(keys: string | string[]): Promise<boolean>;
501
- static del(keys: string | string[]): Promise<boolean>;
502
- static deletePrefix(prefix: string): Promise<boolean>;
503
- static clear(): Promise<boolean>;
504
- static getMode(): string;
505
- static size(): number;
506
- }
507
-
508
- export function getRedisClient(): any;
509
-
510
- /**
511
- * Render island / client component options.
512
- */
513
- export interface RenderIslandOptions {
514
- persist?: boolean;
515
- persistent?: boolean;
516
- fallback?: any;
517
- skeleton?: any;
518
- minHeight?: string | number;
519
- minWidth?: string | number;
520
- className?: string;
521
- style?: Record<string, any> | string;
522
- ssr?: boolean;
523
- tag?: string;
524
- client?: Function;
525
- onMount?: Function;
526
- }
527
-
528
- /**
529
- * Server Action definition options.
530
- */
531
- export interface ActionDefinitionOptions {
532
- schema?: ValidationSchema | Validator;
533
- maxBytes?: number | string;
534
- limit?: number | string;
535
- maxDepth?: number;
536
- maxKeys?: number;
537
- csrf?: boolean;
538
- }
539
-
540
- /**
541
- * Server Action execution context.
542
- */
543
- export interface ActionContext<TBody = Record<string, any>> {
544
- req: Request;
545
- res: Response;
546
- user?: any;
547
- body: TBody;
548
- params: Record<string, string>;
549
- query: Record<string, any>;
550
- action: string;
551
- }
552
-
553
- export class Actions {
554
- static define<TBody = Record<string, any>, TResult = any>(
555
- optionsOrHandler: ActionDefinitionOptions | ((ctx: ActionContext<TBody>, body: TBody) => Promise<TResult> | TResult),
556
- handlerFn?: (ctx: ActionContext<TBody>, body: TBody) => Promise<TResult> | TResult
557
- ): any;
558
- static createDispatcher(viewName: string, actionsMap: Record<string, any>): (req: Request, res: Response) => Promise<any>;
559
- }
560
-
561
- /**
562
- * Props for `<Island>` / `<Client>` JSX components.
563
- */
564
- export interface IslandComponentProps extends RenderIslandOptions {
565
- component?: string | Function;
566
- name?: string;
567
- props?: Record<string, any>;
568
- children?: any;
569
- [key: string]: any;
570
- }
571
-
572
- export function h(type: any, props?: Record<string, any> | null, ...children: any[]): any;
573
- export function createElement(type: any, props?: Record<string, any> | null, ...children: any[]): any;
574
- export function jsx(type: any, props: Record<string, any>, key?: string | number): any;
575
- export function jsxs(type: any, props: Record<string, any>, key?: string | number): any;
576
- export const Fragment: symbol;
577
- export function Island(options?: IslandComponentProps): Promise<any>;
578
- export function Client(options?: IslandComponentProps): Promise<any>;
579
- export function isJsxElement(val: any): boolean;
580
- export function renderJsxToString(node: any, ctx?: Record<string, any>): Promise<string>;
581
- export function compileJsx(source: string): string;
1
+ import type { Server as HttpServer } from "node:http";
2
+ import { Router as ExpressRouter, Request, Response, NextFunction, RequestHandler } from "express";
3
+
4
+ export type { Request, Response, NextFunction, RequestHandler };
5
+
6
+ /**
7
+ * Standard pagination metadata structure.
8
+ */
9
+ export interface PaginationMeta {
10
+ page?: number;
11
+ limit?: number;
12
+ total?: number;
13
+ totalPages?: number;
14
+ }
15
+
16
+ /**
17
+ * Uploaded file object populated by multer middleware.
18
+ */
19
+ export interface UploadedFile {
20
+ fieldname: string;
21
+ originalname: string;
22
+ encoding: string;
23
+ mimetype: string;
24
+ size: number;
25
+ destination: string;
26
+ filename: string;
27
+ path: string;
28
+ buffer?: Buffer;
29
+ }
30
+
31
+ /**
32
+ * Standard Bluebird API JSON response envelope.
33
+ */
34
+ export interface ApiResponse<T = any> {
35
+ status: "success" | "error";
36
+ message: string;
37
+ data?: T;
38
+ errors?: any;
39
+ pagination?: PaginationMeta;
40
+ }
41
+
42
+ declare global {
43
+ namespace Express {
44
+ interface Response {
45
+ /**
46
+ * Sends a standardized JSON success response.
47
+ * @param data Data payload to return.
48
+ * @param message Success message.
49
+ * @param statusCode HTTP status code (default: 200).
50
+ */
51
+ success<T = any>(data?: T, message?: string, statusCode?: number): Response;
52
+
53
+ /**
54
+ * Sends a standardized HTTP 200 OK success response.
55
+ * @param data Data payload.
56
+ * @param message Success message.
57
+ */
58
+ ok<T = any>(data?: T, message?: string): Response;
59
+
60
+ /**
61
+ * Sends a standardized HTTP 201 Created success response.
62
+ * @param data Data payload.
63
+ * @param message Success message.
64
+ */
65
+ created<T = any>(data?: T, message?: string): Response;
66
+
67
+ /**
68
+ * Sends a standardized HTTP 400 Bad Request error response.
69
+ * @param message Error message.
70
+ * @param errors Detailed errors array or object.
71
+ */
72
+ badRequest(message?: string, errors?: any): Response;
73
+
74
+ /**
75
+ * Sends a standardized HTTP 401 Unauthorized error response.
76
+ * @param message Error message.
77
+ */
78
+ unauthorized(message?: string): Response;
79
+
80
+ /**
81
+ * Sends a standardized HTTP 403 Forbidden error response.
82
+ * @param message Error message.
83
+ */
84
+ forbidden(message?: string): Response;
85
+
86
+ /**
87
+ * Sends a standardized HTTP 404 Not Found error response.
88
+ * @param message Error message.
89
+ */
90
+ notFound(message?: string): Response;
91
+
92
+ /**
93
+ * Sends a standardized HTTP 500 Internal Server Error response.
94
+ * @param message Error message.
95
+ * @param errors Error details.
96
+ */
97
+ serverError(message?: string, errors?: any): Response;
98
+
99
+ /**
100
+ * Sends a standardized JSON error response.
101
+ * @param message Error message.
102
+ * @param statusCode HTTP status code (default: 400).
103
+ * @param errors Array or object of detailed errors.
104
+ */
105
+ error(message?: string, statusCode?: number, errors?: any): Response;
106
+
107
+ /**
108
+ * Sends a standardized paginated JSON response.
109
+ * @param data Array of records for current page.
110
+ * @param pagination Object containing page, limit, and total count.
111
+ * @param message Success message.
112
+ */
113
+ paginate<T = any>(
114
+ data?: T[],
115
+ pagination?: PaginationMeta,
116
+ message?: string
117
+ ): Response;
118
+ }
119
+
120
+ interface Request {
121
+ lang?: string;
122
+ user?: any;
123
+ csrfToken?(): string;
124
+ file?: UploadedFile;
125
+ files?: UploadedFile[] | Record<string, UploadedFile[]>;
126
+ [key: string]: any;
127
+ }
128
+ }
129
+ }
130
+
131
+ export class AppError extends Error {
132
+ statusCode: number;
133
+ errors: any;
134
+ isOperational: boolean;
135
+
136
+ constructor(message: string, statusCode?: number, errors?: any);
137
+ }
138
+
139
+ /**
140
+ * CORS configuration options.
141
+ */
142
+ export interface CorsOptions {
143
+ origin?:
144
+ | string
145
+ | boolean
146
+ | string[]
147
+ | ((origin: string | undefined, req: Request) => boolean);
148
+ methods?: string | string[];
149
+ allowedHeaders?: string | string[];
150
+ exposedHeaders?: string | string[];
151
+ credentials?: boolean;
152
+ maxAge?: number;
153
+ }
154
+
155
+ /**
156
+ * Security response headers options.
157
+ */
158
+ export interface SecurityHeadersOptions {
159
+ csp?: string | false;
160
+ frameOptions?: string;
161
+ referrerPolicy?: string;
162
+ permissionsPolicy?: string;
163
+ }
164
+
165
+ /**
166
+ * Static asset serving options.
167
+ */
168
+ export interface AppStaticOptions {
169
+ path: string;
170
+ options?: Record<string, any>;
171
+ }
172
+
173
+ /**
174
+ * Rate limit configuration options.
175
+ */
176
+ export interface RateLimitOptions {
177
+ windowMs?: number;
178
+ max?: number;
179
+ message?: string;
180
+ statusCode?: number;
181
+ headers?: boolean;
182
+ driver?: "memory" | "redis";
183
+ keyGenerator?: (req: Request) => string;
184
+ skip?: (req: Request) => boolean;
185
+ }
186
+
187
+ export class RateLimit {
188
+ static middleware(options?: RateLimitOptions | boolean): (req: Request, res: Response, next: NextFunction) => Promise<any>;
189
+ static clear(): void;
190
+ }
191
+
192
+ export class Seo {
193
+ static registerRoute(basePath: string, routePath: string | RegExp, languages?: string[]): void;
194
+ static getRoutes(): string[];
195
+ static clear(): void;
196
+ static generateSitemap(baseUrl?: string): string;
197
+ static generateRobots(baseUrl?: string, disallow?: string[]): string;
198
+ }
199
+
200
+ /**
201
+ * WebSocket manager configuration options.
202
+ */
203
+ export interface WebSocketOptions {
204
+ path?: string;
205
+ auth?: boolean;
206
+ maxPayload?: number;
207
+ }
208
+
209
+ /**
210
+ * Active WebSocket client connection interface.
211
+ */
212
+ export interface WebSocketClient {
213
+ isAlive?: boolean;
214
+ user?: any;
215
+ rooms?: Set<string>;
216
+ send(data: any): void;
217
+ on(event: string, handler: (...args: any[]) => void): void;
218
+ close(code?: number, reason?: string): void;
219
+ [key: string]: any;
220
+ }
221
+
222
+ export type WebSocketConnectionHandler = (ws: WebSocketClient, req: Request) => void;
223
+
224
+ export class WebSocketManager {
225
+ server: HttpServer;
226
+ path: string;
227
+ requireAuth: boolean;
228
+ maxPayload: number;
229
+ rooms: Map<string, Set<WebSocketClient>>;
230
+ clients: Set<WebSocketClient>;
231
+
232
+ constructor(server: HttpServer | any, options?: WebSocketOptions);
233
+ onConnection(handler: WebSocketConnectionHandler): void;
234
+ join(room: string, ws: WebSocketClient): void;
235
+ leave(room: string, ws: WebSocketClient): void;
236
+ broadcast(data: any, room?: string | null): void;
237
+ }
238
+
239
+ /**
240
+ * Application initialization options.
241
+ */
242
+ export interface AppOptions {
243
+ routes?: Array<Router | ExpressRouter | any>;
244
+ cors?: boolean | CorsOptions;
245
+ middlewares?: Array<RequestHandler | any>;
246
+ port?: number | string;
247
+ host?: string;
248
+ appUrl?: string;
249
+ logger?: boolean;
250
+ notFound?: boolean;
251
+ json?: boolean | Record<string, any>;
252
+ urlencoded?: boolean | Record<string, any>;
253
+ static?: AppStaticOptions;
254
+ cookieParser?: boolean;
255
+ swagger?: boolean | SwaggerOptions;
256
+ compression?: boolean;
257
+ security?: boolean | SecurityHeadersOptions;
258
+ rateLimit?: boolean | RateLimitOptions;
259
+ autoRoutes?: boolean;
260
+ noAutoDiscoverRoutes?: boolean;
261
+ desktop?: boolean;
262
+ userDataPath?: string;
263
+ appPath?: string;
264
+ allowLan?: boolean;
265
+ trustProxy?: boolean | number | string;
266
+ }
267
+
268
+ export class App {
269
+ app: ExpressRouter | any;
270
+ server: HttpServer;
271
+ wsManager: WebSocketManager | null;
272
+ routes: any[];
273
+ cors: boolean | CorsOptions;
274
+ middlewares: any[];
275
+ port: number | string;
276
+ host: string;
277
+ appUrl: string;
278
+ logger: boolean;
279
+ notFound: boolean;
280
+ desktop: boolean;
281
+ allowLan: boolean;
282
+ trustProxy: boolean | number | string;
283
+
284
+ constructor(options?: AppOptions);
285
+
286
+ use(record: any): void;
287
+ set(key: string, value: any): void;
288
+ websocket(
289
+ options?:
290
+ | WebSocketConnectionHandler
291
+ | WebSocketOptions
292
+ ): WebSocketManager;
293
+ getPort(): number;
294
+ getUrl(): string;
295
+ run(): Promise<any>;
296
+ runDesktop(options?: {
297
+ appPath?: string;
298
+ userDataPath?: string;
299
+ allowLan?: boolean;
300
+ host?: string;
301
+ port?: number;
302
+ }): Promise<{ server: HttpServer; port: number; url: string; lanUrl?: string; lanIp?: string }>;
303
+ close(): Promise<void>;
304
+
305
+ static helmet(options?: any): (req: Request, res: Response, next: NextFunction) => void;
306
+ static securityHeaders(options?: SecurityHeadersOptions): (req: Request, res: Response, next: NextFunction) => void;
307
+ static rateLimit(options?: RateLimitOptions | boolean): (req: Request, res: Response, next: NextFunction) => Promise<any>;
308
+ }
309
+
310
+ /**
311
+ * Router configuration options.
312
+ */
313
+ export interface RouterOptions {
314
+ seo?: boolean;
315
+ languages?: string[];
316
+ }
317
+
318
+ export class Router {
319
+ router: ExpressRouter;
320
+ path: string;
321
+
322
+ constructor(path?: string, options?: RouterOptions);
323
+
324
+ use(...middleware: Array<RequestHandler | any>): void;
325
+ get(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
326
+ post(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
327
+ put(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
328
+ delete(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
329
+ patch(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
330
+ options(path: string | RegExp, ...callback: Array<RequestHandler | any>): void;
331
+ getRouter(): ExpressRouter;
332
+ getPath(): string;
333
+ }
334
+
335
+ /**
336
+ * Validation rule configuration for a single field.
337
+ */
338
+ export interface ValidationRule {
339
+ required?: boolean;
340
+ min?: number;
341
+ max?: number;
342
+ email?: boolean;
343
+ number?: boolean;
344
+ alpha?: boolean;
345
+ alphanumeric?: boolean;
346
+ boolean?: boolean;
347
+ date?: boolean;
348
+ url?: boolean;
349
+ in?: any[];
350
+ equals?: any;
351
+ password?: boolean;
352
+ pattern?: RegExp | string;
353
+ xss?: boolean;
354
+ messages?: Partial<
355
+ Record<
356
+ | "required"
357
+ | "min"
358
+ | "max"
359
+ | "email"
360
+ | "number"
361
+ | "alpha"
362
+ | "alphanumeric"
363
+ | "boolean"
364
+ | "date"
365
+ | "url"
366
+ | "in"
367
+ | "equals"
368
+ | "password"
369
+ | "pattern",
370
+ string
371
+ >
372
+ >;
373
+ }
374
+
375
+ /**
376
+ * Validator schema definition.
377
+ */
378
+ export type ValidationSchema = Record<string, ValidationRule>;
379
+
380
+ /**
381
+ * Validation failure item.
382
+ */
383
+ export interface ValidationError {
384
+ field: string;
385
+ message: string;
386
+ }
387
+
388
+ /**
389
+ * Validation output result.
390
+ */
391
+ export interface ValidationResult {
392
+ success: boolean;
393
+ error: boolean;
394
+ errors: ValidationError[];
395
+ message: string[];
396
+ html?: string[];
397
+ }
398
+
399
+ export class Validator {
400
+ schema: ValidationSchema;
401
+ lang_default: string | null;
402
+ messages: Record<string, any>;
403
+
404
+ constructor(schema: ValidationSchema, lang_default?: string, messages?: Record<string, any>);
405
+ middleware(): (req: Request, res: Response, next: NextFunction) => void;
406
+ validate(req: Request | Record<string, any>): Promise<ValidationResult>;
407
+ static xssMiddleware(): (req: Request, res: Response, next: NextFunction) => void;
408
+ static sanitizeObject<T = any>(obj: T): T;
409
+ static mutateSanitized(obj: any): void;
410
+ }
411
+
412
+ /**
413
+ * Password hashing options.
414
+ */
415
+ export interface HashMakeOptions {
416
+ driver?: "scrypt" | "bcrypt";
417
+ rounds?: number;
418
+ N?: number;
419
+ r?: number;
420
+ p?: number;
421
+ }
422
+
423
+ export class Hash {
424
+ static make(password: string, options?: HashMakeOptions): Promise<string>;
425
+ static hash(password: string, options?: HashMakeOptions): Promise<string>;
426
+ static verify(password: string, hash: string): Promise<boolean>;
427
+ static check(password: string, hash: string): Promise<boolean>;
428
+ static needsRehash(hash: string, options?: HashMakeOptions): boolean;
429
+ }
430
+
431
+ /**
432
+ * Auth protect middleware options.
433
+ */
434
+ export interface AuthProtectOptions {
435
+ redirect?: string | null;
436
+ key?: string;
437
+ cookieKey?: string;
438
+ secret?: string;
439
+ }
440
+
441
+ /**
442
+ * Auth login options.
443
+ */
444
+ export interface AuthLoginOptions {
445
+ expiresIn?: string | number;
446
+ cookie?: Record<string, any>;
447
+ secret?: string;
448
+ }
449
+
450
+ /**
451
+ * Decoded Auth JWT token payload.
452
+ */
453
+ export type AuthTokenPayload = Record<string, any> & {
454
+ _sessionId?: string;
455
+ exp?: number;
456
+ iat?: number;
457
+ };
458
+
459
+ export class Auth {
460
+ static encrypt(payload: any, secret?: string): string;
461
+ static decrypt<T = any>(data: string, secret?: string): T | null;
462
+ static generateToken(payload: any, secret?: string, expiresIn?: string | number): string;
463
+ static verifyToken<T = any>(token: string, secret?: string): T | null;
464
+ static protect(options?: AuthProtectOptions): (req: Request, res: Response, next: NextFunction) => Promise<any>;
465
+ static login(res: Response, data: any, key?: string, options?: AuthLoginOptions): Promise<string>;
466
+ static logout(res: Response, key?: string, options?: Record<string, any>, req?: Request | null): Promise<boolean>;
467
+ }
468
+
469
+ export type CacheDriver = "memory" | "redis" | "file";
470
+
471
+ /**
472
+ * Cache middleware options.
473
+ */
474
+ export interface CacheMiddlewareOptions {
475
+ driver?: "memory" | "redis";
476
+ allowAuthenticated?: boolean;
477
+ key?: (req: Request) => string;
478
+ }
479
+
480
+ /**
481
+ * Cache read options.
482
+ */
483
+ export interface CacheGetOptions {
484
+ driver?: CacheDriver;
485
+ }
486
+
487
+ /**
488
+ * Cache write options.
489
+ */
490
+ export interface CacheSetOptions {
491
+ driver?: CacheDriver;
492
+ fallbackDriver?: CacheDriver;
493
+ }
494
+
495
+ export class Cache {
496
+ static middleware(seconds?: number, options?: CacheMiddlewareOptions): (req: Request, res: Response, next: NextFunction) => Promise<any>;
497
+ static get<T = any>(key: string, options?: CacheGetOptions): Promise<T | null>;
498
+ static set(key: string, value: any, seconds?: number, options?: CacheSetOptions): Promise<boolean>;
499
+ static deduplicate<T = any>(key: string, loader: () => Promise<T>): Promise<T>;
500
+ static delete(keys: string | string[]): Promise<boolean>;
501
+ static del(keys: string | string[]): Promise<boolean>;
502
+ static deletePrefix(prefix: string): Promise<boolean>;
503
+ static clear(): Promise<boolean>;
504
+ static getMode(): string;
505
+ static size(): number;
506
+ }
507
+
508
+ export function getRedisClient(): any;
509
+
510
+ /**
511
+ * Render island / client component options.
512
+ */
513
+ export interface RenderIslandOptions {
514
+ persist?: boolean;
515
+ persistent?: boolean;
516
+ fallback?: any;
517
+ skeleton?: any;
518
+ minHeight?: string | number;
519
+ minWidth?: string | number;
520
+ className?: string;
521
+ style?: Record<string, any> | string;
522
+ ssr?: boolean;
523
+ tag?: string;
524
+ client?: Function;
525
+ onMount?: Function;
526
+ }
527
+
528
+ /**
529
+ * Server Action definition options.
530
+ */
531
+ export interface ActionDefinitionOptions {
532
+ schema?: ValidationSchema | Validator;
533
+ maxBytes?: number | string;
534
+ limit?: number | string;
535
+ maxDepth?: number;
536
+ maxKeys?: number;
537
+ csrf?: boolean;
538
+ }
539
+
540
+ /**
541
+ * Server Action execution context.
542
+ */
543
+ export interface ActionContext<TBody = Record<string, any>> {
544
+ req: Request;
545
+ res: Response;
546
+ user?: any;
547
+ body: TBody;
548
+ params: Record<string, string>;
549
+ query: Record<string, any>;
550
+ action: string;
551
+ }
552
+
553
+ export class Actions {
554
+ static define<TBody = Record<string, any>, TResult = any>(
555
+ optionsOrHandler: ActionDefinitionOptions | ((ctx: ActionContext<TBody>, body: TBody) => Promise<TResult> | TResult),
556
+ handlerFn?: (ctx: ActionContext<TBody>, body: TBody) => Promise<TResult> | TResult
557
+ ): any;
558
+ static createDispatcher(viewName: string, actionsMap: Record<string, any>): (req: Request, res: Response) => Promise<any>;
559
+ }
560
+
561
+ /**
562
+ * Props for `<Island>` / `<Client>` JSX components.
563
+ */
564
+ export interface IslandComponentProps extends RenderIslandOptions {
565
+ component?: string | Function;
566
+ name?: string;
567
+ props?: Record<string, any>;
568
+ children?: any;
569
+ [key: string]: any;
570
+ }
571
+
572
+ export interface ErrorBoundaryProps {
573
+ fallback?: any | ((error: Error) => any);
574
+ onError?: (error: Error) => void;
575
+ children?: any;
576
+ }
577
+
578
+ export interface SuspenseProps {
579
+ fallback?: any;
580
+ children?: any;
581
+ }
582
+
583
+ export interface HeadProps {
584
+ children?: any;
585
+ }
586
+
587
+ export interface TitleProps {
588
+ children?: any;
589
+ }
590
+
591
+ export interface MetaProps {
592
+ name?: string;
593
+ property?: string;
594
+ content?: string;
595
+ charSet?: string;
596
+ httpEquiv?: string;
597
+ [key: string]: any;
598
+ }
599
+
600
+ export interface UseActionOptions {
601
+ url?: string;
602
+ partial?: boolean;
603
+ onSuccess?: (data: any) => void;
604
+ onError?: (error: any) => void;
605
+ onSettled?: () => void;
606
+ }
607
+
608
+ export const ERROR_BOUNDARY: symbol;
609
+ export const SUSPENSE_ELEMENT: symbol;
610
+ export const HEAD_ELEMENT: symbol;
611
+ export const TITLE_ELEMENT: symbol;
612
+ export const META_ELEMENT: symbol;
613
+
614
+ export function h(type: any, props?: Record<string, any> | null, ...children: any[]): any;
615
+ export function createElement(type: any, props?: Record<string, any> | null, ...children: any[]): any;
616
+ export function jsx(type: any, props: Record<string, any>, key?: string | number): any;
617
+ export function jsxs(type: any, props: Record<string, any>, key?: string | number): any;
618
+ export const Fragment: symbol;
619
+ export function Island(options?: IslandComponentProps): Promise<any>;
620
+ export function Client(options?: IslandComponentProps): Promise<any>;
621
+ export function ErrorBoundary(props?: ErrorBoundaryProps): any;
622
+ export function Suspense(props?: SuspenseProps): any;
623
+ export function Head(props?: HeadProps): any;
624
+ export function Title(props?: TitleProps): any;
625
+ export function Meta(props?: MetaProps): any;
626
+ export function isJsxElement(val: any): boolean;
627
+ export function renderJsxToString(node: any, ctx?: Record<string, any>): Promise<string>;
628
+ export function compileJsx(source: string, options?: { ts?: boolean; typescript?: boolean }): string;
629
+ export function stripTsTypes(code: string): string;
582
630
  export function registerJsxLoader(): void;
583
631
  export function useState<T>(initial?: T | (() => T)): [T, (value: T | ((prev: T) => T)) => void];
584
632
  export function useEffect(effectFn: () => void | (() => void), deps?: any[]): void;
585
633
  export function useRef<T>(initial?: T): { current: T };
586
634
  export function useMemo<T>(fn: () => T, deps?: any[]): T;
587
- export function useCallback<T extends (...args: any[]) => any>(fn: T, deps?: any[]): T;
588
-
589
- /**
590
- * Options for serving raw static HTML files.
591
- */
592
- export interface RenderHtmlOptions {
593
- ttl?: number;
594
- }
595
-
596
- export class Render {
597
- static island(
598
- name: string | Function,
599
- props?: Record<string, any>,
600
- options?: RenderIslandOptions
601
- ): string;
602
- static component(partialName: string, props?: Record<string, any>): Promise<string>;
603
- static html(res: Response, relativePath: string, options?: RenderHtmlOptions): Promise<void>;
604
- static send(res: Response, viewName: string, data?: Record<string, any>, ttl?: number): Promise<void>;
605
- static partial(res: Response, partialName: string, data?: Record<string, any>, ttl?: number): Promise<void>;
606
- static stream(res: Response, viewName: string, data?: Record<string, any>): Promise<void>;
607
- static view(
608
- viewName: string,
609
- dataOrFn?: Record<string, any> | ((req: Request, res: Response) => any),
610
- ttl?: number
611
- ): (req: Request, res: Response) => Promise<void>;
612
- static cache(
613
- seconds?: number,
614
- options?: { allowAuthenticated?: boolean }
615
- ): (req: Request, res: Response, next: NextFunction) => Promise<any>;
616
- static redirect(req: Request, res: Response, url: string, status?: number): void;
617
- static clearTemplateCache(): void;
618
- static invalidate(keys?: string | string[]): Promise<void>;
619
- static autoRoutes(targetRouter?: Router): Promise<Array<{ viewName: string; routePath: string; cache: number; seo: boolean }>>;
620
- }
621
-
622
- export * from "./html.js";
623
-
624
- /**
625
- * Vite integration options.
626
- */
627
- export interface ViteOptions {
628
- entry?: string;
629
- viteUrl?: string;
630
- debug?: boolean;
631
- }
632
-
633
- export class Vite {
634
- static tags(options?: ViteOptions): string;
635
- static clearCache(): void;
636
- }
637
-
638
- export const DB_TYPE: "sqlite" | "postgres" | "mysql" | "none" | string;
639
-
640
- /**
641
- * Database query execution options.
642
- */
643
- export interface DatabaseQueryOptions {
644
- cache?: number;
645
- cachePrefix?: string;
646
- return_row?: boolean;
647
- [key: string]: any;
648
- }
649
-
650
- /**
651
- * Standard paginated query result.
652
- */
653
- export interface PaginatedResult<T = any> {
654
- data: T[];
655
- total: number;
656
- page: number;
657
- limit: number;
658
- totalPages: number;
659
- }
660
-
661
- /**
662
- * Transaction runner client.
663
- */
664
- export interface DatabaseTransactionClient {
665
- query<T = any>(sql: string, params?: any[], options?: "return_row" | DatabaseQueryOptions | any): Promise<T>;
666
- }
667
-
668
- export class Database {
669
- type: string;
670
- constructor(connectionLimit?: number, queueLimit?: number, config?: any);
671
- init(retries?: number): Promise<boolean>;
672
- query<T = any>(sql: string, params?: any[], options?: "return_row" | DatabaseQueryOptions | any): Promise<T>;
673
- paginate<T = any>(
674
- sql: string,
675
- params?: any[],
676
- options?: { page?: number; limit?: number; cache?: number }
677
- ): Promise<PaginatedResult<T>>;
678
- transaction<T = any>(callback: (tx: DatabaseTransactionClient) => Promise<T>): Promise<T>;
679
- executeTransaction<T = any>(callback: (tx: DatabaseTransactionClient) => Promise<T>): Promise<T>;
680
- close(): Promise<void>;
681
- static closeAll(): Promise<void>;
682
- }
683
-
684
- /**
685
- * Queue dispatching options.
686
- */
687
- export interface QueueDispatchOptions {
688
- delayMs?: number;
689
- }
690
-
691
- /**
692
- * Queue job item structure.
693
- */
694
- export interface QueueJob<T = any> {
695
- id: string;
696
- name: string;
697
- payload: T;
698
- createdAt: string;
699
- }
700
-
701
- export type QueueHandler<T = any> = (payload: T) => Promise<any> | any;
702
-
703
- export class Queue {
704
- static process<T = any>(jobName: string, handler: QueueHandler<T>): void;
705
- static dispatch<T = any>(jobName: string, payload?: T, options?: QueueDispatchOptions): Promise<boolean>;
706
- static work(): Promise<void>;
707
- static stop(): void;
708
- static loadJobs(jobsDir?: string): Promise<void>;
709
- }
710
-
711
- /**
712
- * CSRF middleware options.
713
- */
714
- export interface CsrfOptions {
715
- cookieName?: string;
716
- headerName?: string;
717
- bodyKey?: string;
718
- maxAgeMs?: number;
719
- secret?: string;
720
- }
721
-
722
- export class Csrf {
723
- static generateToken(secret?: string): string;
724
- static verifyToken(token: string, secret?: string, maxAgeMs?: number): boolean;
725
- static middleware(options?: CsrfOptions): (req: Request, res: Response, next: NextFunction) => void;
726
- }
727
-
728
- export interface ModelSchemaColumn {
729
- type: "int" | "integer" | "bigint" | "string" | "text" | "boolean" | "date" | "float" | "json" | (string & {});
730
- primary?: boolean;
731
- auto?: boolean;
732
- unique?: boolean;
733
- required?: boolean;
734
- nullable?: boolean;
735
- default?: any;
736
- hidden?: boolean;
737
- length?: number;
738
- min?: number;
739
- max?: number;
740
- email?: boolean;
741
- hash?: boolean;
742
- in?: any[];
743
- references?: string;
744
- onDelete?: "cascade" | "set null" | "restrict" | "no action" | (string & {});
745
- }
746
-
747
- /**
748
- * Options for Model.find query.
749
- */
750
- export interface ModelFindOptions {
751
- withDeleted?: boolean;
752
- withHidden?: boolean;
753
- cache?: number;
754
- oneMany?: typeof Model | Array<typeof Model>;
755
- belongsTo?: typeof Model | Array<typeof Model>;
756
- }
757
-
758
- /**
759
- * Options for Model.all query.
760
- */
761
- export interface ModelAllOptions {
762
- where?: Record<string, any>;
763
- order?: string | string[];
764
- limit?: number;
765
- offset?: number;
766
- withDeleted?: boolean;
767
- withHidden?: boolean;
768
- cache?: number;
769
- oneMany?: typeof Model | Array<typeof Model>;
770
- belongsTo?: typeof Model | Array<typeof Model>;
771
- }
772
-
773
- /**
774
- * Options for Model.paginate query.
775
- */
776
- export interface ModelPaginateOptions {
777
- where?: Record<string, any>;
778
- order?: string | string[];
779
- page?: number;
780
- limit?: number;
781
- withDeleted?: boolean;
782
- withHidden?: boolean;
783
- cache?: number;
784
- }
785
-
786
- /**
787
- * Options for Model.delete operation.
788
- */
789
- export interface ModelDeleteOptions {
790
- force?: boolean;
791
- cascade?: Array<typeof Model>;
792
- }
793
-
794
- export class Model {
795
- static table: string;
796
- static primaryKey: string;
797
- static timestamps: boolean;
798
- static softDelete: boolean;
799
- static schema: Record<string, ModelSchemaColumn>;
800
- static fillable: string[];
801
- static guarded: string[];
802
-
803
- static getDatabase(): Database;
804
- static setDatabase(db: Database): void;
805
- static close(): Promise<void>;
806
- static query<T = any>(sql: string, params?: any[], options?: any): Promise<T>;
807
- static transaction<T = any>(callback: (tx: DatabaseTransactionClient | any) => Promise<T>): Promise<T>;
808
- static invalidateCache(): Promise<void>;
809
- static find<T = any>(
810
- idOrConditions: number | string | Record<string, any>,
811
- options?: ModelFindOptions
812
- ): Promise<T | null>;
813
- static first<T = any>(
814
- idOrConditions?: number | string | Record<string, any>,
815
- options?: ModelFindOptions
816
- ): Promise<T | null>;
817
- static count(where?: Record<string, any>): Promise<number>;
818
- static exists(where?: Record<string, any>): Promise<boolean>;
819
- static firstOrCreate<T = any>(where: Record<string, any>, defaults?: Record<string, any>): Promise<T>;
820
- static updateOrCreate<T = any>(where: Record<string, any>, values?: Record<string, any>): Promise<T>;
821
- static all<T = any>(options?: ModelAllOptions): Promise<T[]>;
822
- static paginate<T = any>(options?: ModelPaginateOptions): Promise<PaginatedResult<T>>;
823
- static create(data: Record<string, any>, options?: { only?: string[]; except?: string[] }): Promise<number | string>;
824
- static update(
825
- idOrConditions: number | string | Record<string, any>,
826
- data: Record<string, any>,
827
- options?: { only?: string[]; except?: string[] }
828
- ): Promise<number>;
829
- static delete(
830
- idOrConditions: number | string | Record<string, any>,
831
- options?: ModelDeleteOptions
832
- ): Promise<number>;
833
- static restore(idOrConditions: number | string | Record<string, any>): Promise<number>;
834
- static validator(mode?: "create" | "update", lang?: string): Validator;
835
- static columnToSQL(col: string, def: ModelSchemaColumn, dialect?: "sqlite" | "mysql" | "postgres"): string;
836
- static toDDL(dialect?: "sqlite" | "mysql" | "postgres"): string;
837
- }
838
-
839
- export interface UploadDiskOptions {
840
- folder?: string;
841
- fileSize?: number;
842
- allowedTypes?: string[];
843
- }
844
-
845
- export interface UploadMiddleware {
846
- single(fieldName: string): (req: Request, res: Response, next: NextFunction) => void;
847
- array(fieldName: string, maxCount?: number): (req: Request, res: Response, next: NextFunction) => void;
848
- fields(fields: Array<{ name: string; maxCount?: number }>): (req: Request, res: Response, next: NextFunction) => void;
849
- none(): (req: Request, res: Response, next: NextFunction) => void;
850
- any(): (req: Request, res: Response, next: NextFunction) => void;
851
- }
852
-
853
- export class Upload {
854
- static storage(folder?: string): any;
855
- static disk(options?: UploadDiskOptions): UploadMiddleware;
856
- static url(filename: string, folder?: string): string;
857
- }
858
-
859
- export interface SwaggerOptions {
860
- route?: string;
861
- url?: string;
862
- info?: {
863
- title?: string;
864
- version?: string;
865
- description?: string;
866
- };
867
- apis?: string[];
868
- }
869
-
870
- export class Swagger {
871
- static init(app: any, options?: SwaggerOptions): Promise<boolean>;
872
- }
873
-
874
- export interface AppProps {
875
- debug: boolean;
876
- desktop: boolean;
877
- userDataDir: string;
878
- appDir: string;
879
- title: string;
880
- description: string;
881
- version: string;
882
- host: string;
883
- appUrl: string;
884
- port: number;
885
- jwtSecret?: string;
886
- langMeta: string;
887
- static: { path: string; options: Record<string, any> };
888
- descriptionMeta?: string;
889
- keywordsMeta?: string;
890
- titleMeta?: string;
891
- authorMeta?: string;
892
- }
893
-
894
- export class Config {
895
- static dirname(): string;
896
- static appDir(): string;
897
- static setAppDir(dirPath: string): void;
898
- static isDesktop(): boolean;
899
- static setUserDataDir(customDir: string): void;
900
- static userDataDir(): string;
901
- static reload(): AppProps;
902
- static props(): AppProps;
903
- }
904
-
905
- export class Logger {
906
- folder: string;
907
- constructor();
908
- nowFolder(): string;
909
- now(): string;
910
- _log(file: string, level: string, message: string): void;
911
- log(file: string, level: string, message: string): void;
912
- info(message: string): void;
913
- error(message: string): void;
914
- warn(message: string): void;
915
- warning(message: string): void;
916
- debug(message: string): void;
917
- }
918
-
919
- export class Debug {
920
- constructor();
921
- static shouldTrack(req: Request): boolean;
922
- static middlewareMetrics(app: any): void;
923
- getRouter(): { path: string; router: ExpressRouter };
924
- }
925
-
926
- export interface CommonMiddleware {
927
- auth: (req: Request, res: Response, next: NextFunction) => Promise<any>;
928
- webAuth: (req: Request, res: Response, next: NextFunction) => Promise<any>;
929
- logger: (req: Request, res: Response, next: NextFunction) => void;
930
- }
931
-
932
- export const Middleware: CommonMiddleware;
933
-
934
- export default App;
935
-
936
- declare module "@seip/bluebird-js/core/model.js" {
937
- import {
938
- Model,
939
- ModelSchemaColumn,
940
- ModelFindOptions,
941
- ModelAllOptions,
942
- ModelPaginateOptions,
943
- ModelDeleteOptions,
944
- PaginatedResult,
945
- } from "@seip/bluebird-js";
946
- export {
947
- Model,
948
- ModelSchemaColumn,
949
- ModelFindOptions,
950
- ModelAllOptions,
951
- ModelPaginateOptions,
952
- ModelDeleteOptions,
953
- PaginatedResult,
954
- };
955
- export default Model;
956
- }
957
-
958
- declare module "@seip/bluebird-js/core/app.js" {
959
- import App, {
960
- AppError,
961
- WebSocketManager,
962
- AppOptions,
963
- CorsOptions,
964
- SecurityHeadersOptions,
965
- AppStaticOptions,
966
- } from "@seip/bluebird-js";
967
- export {
968
- App,
969
- AppError,
970
- WebSocketManager,
971
- AppOptions,
972
- CorsOptions,
973
- SecurityHeadersOptions,
974
- AppStaticOptions,
975
- };
976
- export default App;
977
- }
978
-
979
- declare module "@seip/bluebird-js/core/router.js" {
980
- import { Router, RouterOptions } from "@seip/bluebird-js";
981
- export { Router, RouterOptions };
982
- export default Router;
983
- }
984
-
985
- declare module "@seip/bluebird-js/core/render.js" {
986
- import {
987
- Render,
988
- RenderIslandOptions,
989
- RenderHtmlOptions,
990
- IslandComponentProps,
991
- h,
992
- Fragment,
993
- Island,
994
- Client,
995
- } from "@seip/bluebird-js";
996
- export {
997
- Render,
998
- RenderIslandOptions,
999
- RenderHtmlOptions,
1000
- IslandComponentProps,
1001
- h,
1002
- Fragment,
1003
- Island,
1004
- Client,
1005
- };
1006
- export default Render;
1007
- }
1008
-
1009
- declare module "@seip/bluebird-js/core/jsx.js" {
1010
- import {
1011
- h,
1012
- createElement,
1013
- jsx,
1014
- jsxs,
1015
- Fragment,
1016
- Island,
1017
- Client,
1018
- IslandComponentProps,
1019
- isJsxElement,
1020
- renderJsxToString,
1021
- compileJsx,
1022
- registerJsxLoader,
1023
- } from "@seip/bluebird-js";
1024
- export {
1025
- h,
1026
- createElement,
1027
- jsx,
1028
- jsxs,
1029
- Fragment,
1030
- Island,
1031
- Client,
1032
- IslandComponentProps,
1033
- isJsxElement,
1034
- renderJsxToString,
1035
- compileJsx,
1036
- registerJsxLoader,
1037
- };
1038
- }
1039
-
1040
- declare module "@seip/bluebird-js/core/html.js" {
1041
- import {
1042
- SafeHtml,
1043
- isSafeHtml,
1044
- escapeHtml,
1045
- safeJson,
1046
- HtmlTag,
1047
- html,
1048
- ScriptTag,
1049
- script,
1050
- each,
1051
- cached,
1052
- defer,
1053
- } from "@seip/bluebird-js";
1054
- export {
1055
- SafeHtml,
1056
- isSafeHtml,
1057
- escapeHtml,
1058
- safeJson,
1059
- HtmlTag,
1060
- html,
1061
- ScriptTag,
1062
- script,
1063
- each,
1064
- cached,
1065
- defer,
1066
- };
1067
- export default html;
1068
- }
1069
-
1070
- declare module "@seip/bluebird-js/core/validate.js" {
1071
- import {
1072
- Validator,
1073
- ValidationRule,
1074
- ValidationSchema,
1075
- ValidationError,
1076
- ValidationResult,
1077
- } from "@seip/bluebird-js";
1078
- export {
1079
- Validator,
1080
- ValidationRule,
1081
- ValidationSchema,
1082
- ValidationError,
1083
- ValidationResult,
1084
- };
1085
- export default Validator;
1086
- }
1087
-
1088
- declare module "@seip/bluebird-js/core/database.js" {
1089
- import {
1090
- Database,
1091
- DB_TYPE,
1092
- DatabaseQueryOptions,
1093
- DatabaseTransactionClient,
1094
- PaginatedResult,
1095
- } from "@seip/bluebird-js";
1096
- export {
1097
- Database,
1098
- DB_TYPE,
1099
- DatabaseQueryOptions,
1100
- DatabaseTransactionClient,
1101
- PaginatedResult,
1102
- };
1103
- export default Database;
1104
- }
1105
-
1106
- declare module "@seip/bluebird-js/core/auth.js" {
1107
- import {
1108
- Auth,
1109
- AuthProtectOptions,
1110
- AuthLoginOptions,
1111
- AuthTokenPayload,
1112
- } from "@seip/bluebird-js";
1113
- export {
1114
- Auth,
1115
- AuthProtectOptions,
1116
- AuthLoginOptions,
1117
- AuthTokenPayload,
1118
- };
1119
- export default Auth;
1120
- }
1121
-
1122
- declare module "@seip/bluebird-js/core/cache.js" {
1123
- import {
1124
- Cache,
1125
- getRedisClient,
1126
- CacheDriver,
1127
- CacheMiddlewareOptions,
1128
- CacheGetOptions,
1129
- CacheSetOptions,
1130
- } from "@seip/bluebird-js";
1131
- export {
1132
- Cache,
1133
- getRedisClient,
1134
- CacheDriver,
1135
- CacheMiddlewareOptions,
1136
- CacheGetOptions,
1137
- CacheSetOptions,
1138
- };
1139
- export default Cache;
1140
- }
1141
-
1142
- declare module "@seip/bluebird-js/core/redis.js" {
1143
- export function initRedis(): Promise<any>;
1144
- export function getRedisClient(): any;
1145
- export function isRedisConnectedStatus(): boolean;
1146
- export function redisGet(key: string): Promise<any>;
1147
- export function redisSet(key: string, value: any, seconds?: number): Promise<boolean>;
1148
- export function redisDel(keys: string | string[]): Promise<boolean>;
1149
- export function redisClearPrefix(prefix: string): Promise<boolean>;
1150
- export function disconnectRedis(): Promise<void>;
1151
-
1152
- const redisHandler: {
1153
- initRedis: typeof initRedis;
1154
- getRedisClient: typeof getRedisClient;
1155
- isRedisConnectedStatus: typeof isRedisConnectedStatus;
1156
- redisGet: typeof redisGet;
1157
- redisSet: typeof redisSet;
1158
- redisDel: typeof redisDel;
1159
- redisClearPrefix: typeof redisClearPrefix;
1160
- disconnectRedis: typeof disconnectRedis;
1161
- };
1162
- export default redisHandler;
1163
- }
1164
-
1165
- declare module "@seip/bluebird-js/core/csrf.js" {
1166
- import { Csrf, CsrfOptions } from "@seip/bluebird-js";
1167
- export { Csrf, CsrfOptions };
1168
- export default Csrf;
1169
- }
1170
-
1171
- declare module "@seip/bluebird-js/core/hash.js" {
1172
- import { Hash, HashMakeOptions } from "@seip/bluebird-js";
1173
- export { Hash, HashMakeOptions };
1174
- export default Hash;
1175
- }
1176
-
1177
- declare module "@seip/bluebird-js/core/queue.js" {
1178
- import {
1179
- Queue,
1180
- QueueDispatchOptions,
1181
- QueueJob,
1182
- QueueHandler,
1183
- } from "@seip/bluebird-js";
1184
- export {
1185
- Queue,
1186
- QueueDispatchOptions,
1187
- QueueJob,
1188
- QueueHandler,
1189
- };
1190
- export default Queue;
1191
- }
1192
-
1193
- declare module "@seip/bluebird-js/core/upload.js" {
1194
- import {
1195
- Upload,
1196
- UploadDiskOptions,
1197
- UploadMiddleware,
1198
- UploadedFile,
1199
- } from "@seip/bluebird-js";
1200
- export {
1201
- Upload,
1202
- UploadDiskOptions,
1203
- UploadMiddleware,
1204
- UploadedFile,
1205
- };
1206
- export default Upload;
1207
- }
1208
-
1209
- declare module "@seip/bluebird-js/core/ws.js" {
1210
- import {
1211
- WebSocketManager,
1212
- WebSocketOptions,
1213
- WebSocketClient,
1214
- WebSocketConnectionHandler,
1215
- } from "@seip/bluebird-js";
1216
- export {
1217
- WebSocketManager,
1218
- WebSocketOptions,
1219
- WebSocketClient,
1220
- WebSocketConnectionHandler,
1221
- };
1222
- export default WebSocketManager;
1223
- }
1224
-
1225
- declare module "@seip/bluebird-js/core/swagger.js" {
1226
- import { Swagger, SwaggerOptions } from "@seip/bluebird-js";
1227
- export { Swagger, SwaggerOptions };
1228
- export default Swagger;
1229
- }
1230
-
1231
- declare module "@seip/bluebird-js/core/logger.js" {
1232
- import { Logger } from "@seip/bluebird-js";
1233
- export { Logger };
1234
- export default Logger;
1235
- }
1236
-
1237
- declare module "@seip/bluebird-js/core/config.js" {
1238
- import { Config, AppProps } from "@seip/bluebird-js";
1239
- export { Config, AppProps };
1240
- export default Config;
1241
- }
1242
-
1243
- declare module "@seip/bluebird-js/core/debug.js" {
1244
- import { Debug } from "@seip/bluebird-js";
1245
- export { Debug };
1246
- export default Debug;
1247
- }
1248
-
1249
- declare module "@seip/bluebird-js/core/middleware.js" {
1250
- import { Middleware, CommonMiddleware } from "@seip/bluebird-js";
1251
- export { Middleware, CommonMiddleware };
1252
- export default Middleware;
1253
- }
1254
-
1255
- declare module "@seip/bluebird-js/core/vite.js" {
1256
- import { Vite, ViteOptions } from "@seip/bluebird-js";
1257
- export { Vite, ViteOptions };
1258
- export default Vite;
1259
- }
1260
-
1261
- declare module "@seip/bluebird-js/core/ratelimit.js" {
1262
- import { RateLimit, RateLimitOptions } from "@seip/bluebird-js";
1263
- export { RateLimit, RateLimitOptions };
1264
- export default RateLimit;
1265
- }
1266
-
1267
- declare module "@seip/bluebird-js/core/seo.js" {
1268
- import { Seo } from "@seip/bluebird-js";
1269
- export { Seo };
1270
- export default Seo;
1271
- }
1272
-
1273
- declare module "@seip/bluebird-js/core/actions.js" {
1274
- import { Actions, ActionDefinitionOptions, ActionContext } from "@seip/bluebird-js";
1275
- export { Actions, ActionDefinitionOptions, ActionContext };
1276
- export default Actions;
1277
- }
1278
-
635
+ export function useCallback<T extends (...args: any[]) => any>(fn: T, deps?: any[]): T;
636
+ export function useAction(
637
+ actionName: string | Function,
638
+ options?: UseActionOptions
639
+ ): [
640
+ execute: (payload?: any) => Promise<any>,
641
+ isPending: boolean,
642
+ data: any,
643
+ error: any,
644
+ reset: () => void
645
+ ];
646
+ export function useActionState<T>(
647
+ actionFn: string | ((prevState: T, payload?: any) => Promise<T> | T),
648
+ initialState: T
649
+ ): [state: T, dispatch: (payload?: any) => Promise<T>, isPending: boolean];
650
+
651
+ /**
652
+ * Options for serving raw static HTML files.
653
+ */
654
+ export interface RenderHtmlOptions {
655
+ ttl?: number;
656
+ }
657
+
658
+ export class Render {
659
+ static island(
660
+ name: string | Function,
661
+ props?: Record<string, any>,
662
+ options?: RenderIslandOptions
663
+ ): string;
664
+ static component(partialName: string, props?: Record<string, any>): Promise<string>;
665
+ static html(res: Response, relativePath: string, options?: RenderHtmlOptions): Promise<void>;
666
+ static send(res: Response, viewName: string, data?: Record<string, any>, ttl?: number): Promise<void>;
667
+ static partial(res: Response, partialName: string, data?: Record<string, any>, ttl?: number): Promise<void>;
668
+ static stream(
669
+ res: Response,
670
+ viewName: string,
671
+ data?: Record<string, any>,
672
+ options?: number | { ttl?: number }
673
+ ): Promise<void>;
674
+ static view(
675
+ viewName: string,
676
+ dataOrFn?: Record<string, any> | ((req: Request, res: Response) => any),
677
+ ttl?: number
678
+ ): (req: Request, res: Response) => Promise<void>;
679
+ static cache(
680
+ seconds?: number,
681
+ options?: { allowAuthenticated?: boolean }
682
+ ): (req: Request, res: Response, next: NextFunction) => Promise<any>;
683
+ static redirect(req: Request, res: Response, url: string, status?: number): void;
684
+ static clearTemplateCache(): void;
685
+ static invalidate(keys?: string | string[]): Promise<void>;
686
+ static autoRoutes(targetRouter?: Router): Promise<Array<{ viewName: string; routePath: string; cache: number; seo: boolean }>>;
687
+ }
688
+
689
+ export * from "./html.js";
690
+
691
+ /**
692
+ * Vite integration options.
693
+ */
694
+ export interface ViteOptions {
695
+ entry?: string;
696
+ viteUrl?: string;
697
+ debug?: boolean;
698
+ }
699
+
700
+ export class Vite {
701
+ static tags(options?: ViteOptions): string;
702
+ static clearCache(): void;
703
+ }
704
+
705
+ export const DB_TYPE: "sqlite" | "postgres" | "mysql" | "none" | string;
706
+
707
+ /**
708
+ * Database query execution options.
709
+ */
710
+ export interface DatabaseQueryOptions {
711
+ cache?: number;
712
+ cachePrefix?: string;
713
+ return_row?: boolean;
714
+ [key: string]: any;
715
+ }
716
+
717
+ /**
718
+ * Standard paginated query result.
719
+ */
720
+ export interface PaginatedResult<T = any> {
721
+ data: T[];
722
+ total: number;
723
+ page: number;
724
+ limit: number;
725
+ totalPages: number;
726
+ }
727
+
728
+ /**
729
+ * Transaction runner client.
730
+ */
731
+ export interface DatabaseTransactionClient {
732
+ query<T = any>(sql: string, params?: any[], options?: "return_row" | DatabaseQueryOptions | any): Promise<T>;
733
+ }
734
+
735
+ export class Database {
736
+ type: string;
737
+ constructor(connectionLimit?: number, queueLimit?: number, config?: any);
738
+ init(retries?: number): Promise<boolean>;
739
+ query<T = any>(sql: string, params?: any[], options?: "return_row" | DatabaseQueryOptions | any): Promise<T>;
740
+ paginate<T = any>(
741
+ sql: string,
742
+ params?: any[],
743
+ options?: { page?: number; limit?: number; cache?: number }
744
+ ): Promise<PaginatedResult<T>>;
745
+ transaction<T = any>(callback: (tx: DatabaseTransactionClient) => Promise<T>): Promise<T>;
746
+ executeTransaction<T = any>(callback: (tx: DatabaseTransactionClient) => Promise<T>): Promise<T>;
747
+ close(): Promise<void>;
748
+ static closeAll(): Promise<void>;
749
+ }
750
+
751
+ /**
752
+ * Queue dispatching options.
753
+ */
754
+ export interface QueueDispatchOptions {
755
+ delayMs?: number;
756
+ }
757
+
758
+ /**
759
+ * Queue job item structure.
760
+ */
761
+ export interface QueueJob<T = any> {
762
+ id: string;
763
+ name: string;
764
+ payload: T;
765
+ createdAt: string;
766
+ }
767
+
768
+ export type QueueHandler<T = any> = (payload: T) => Promise<any> | any;
769
+
770
+ export class Queue {
771
+ static process<T = any>(jobName: string, handler: QueueHandler<T>): void;
772
+ static dispatch<T = any>(jobName: string, payload?: T, options?: QueueDispatchOptions): Promise<boolean>;
773
+ static work(): Promise<void>;
774
+ static stop(): void;
775
+ static loadJobs(jobsDir?: string): Promise<void>;
776
+ }
777
+
778
+ /**
779
+ * CSRF middleware options.
780
+ */
781
+ export interface CsrfOptions {
782
+ cookieName?: string;
783
+ headerName?: string;
784
+ bodyKey?: string;
785
+ maxAgeMs?: number;
786
+ secret?: string;
787
+ }
788
+
789
+ export class Csrf {
790
+ static generateToken(secret?: string): string;
791
+ static verifyToken(token: string, secret?: string, maxAgeMs?: number): boolean;
792
+ static middleware(options?: CsrfOptions): (req: Request, res: Response, next: NextFunction) => void;
793
+ }
794
+
795
+ export interface ModelSchemaColumn {
796
+ type: "int" | "integer" | "bigint" | "string" | "text" | "boolean" | "date" | "float" | "json" | (string & {});
797
+ primary?: boolean;
798
+ auto?: boolean;
799
+ unique?: boolean;
800
+ required?: boolean;
801
+ nullable?: boolean;
802
+ default?: any;
803
+ hidden?: boolean;
804
+ length?: number;
805
+ min?: number;
806
+ max?: number;
807
+ email?: boolean;
808
+ hash?: boolean;
809
+ in?: any[];
810
+ references?: string;
811
+ onDelete?: "cascade" | "set null" | "restrict" | "no action" | (string & {});
812
+ }
813
+
814
+ /**
815
+ * Options for Model.find query.
816
+ */
817
+ export interface ModelFindOptions {
818
+ withDeleted?: boolean;
819
+ withHidden?: boolean;
820
+ cache?: number;
821
+ oneMany?: typeof Model | Array<typeof Model>;
822
+ belongsTo?: typeof Model | Array<typeof Model>;
823
+ }
824
+
825
+ /**
826
+ * Options for Model.all query.
827
+ */
828
+ export interface ModelAllOptions {
829
+ where?: Record<string, any>;
830
+ order?: string | string[];
831
+ limit?: number;
832
+ offset?: number;
833
+ withDeleted?: boolean;
834
+ withHidden?: boolean;
835
+ cache?: number;
836
+ oneMany?: typeof Model | Array<typeof Model>;
837
+ belongsTo?: typeof Model | Array<typeof Model>;
838
+ }
839
+
840
+ /**
841
+ * Options for Model.paginate query.
842
+ */
843
+ export interface ModelPaginateOptions {
844
+ where?: Record<string, any>;
845
+ order?: string | string[];
846
+ page?: number;
847
+ limit?: number;
848
+ withDeleted?: boolean;
849
+ withHidden?: boolean;
850
+ cache?: number;
851
+ }
852
+
853
+ /**
854
+ * Options for Model.delete operation.
855
+ */
856
+ export interface ModelDeleteOptions {
857
+ force?: boolean;
858
+ cascade?: Array<typeof Model>;
859
+ }
860
+
861
+ export class Model {
862
+ static table: string;
863
+ static primaryKey: string;
864
+ static timestamps: boolean;
865
+ static softDelete: boolean;
866
+ static schema: Record<string, ModelSchemaColumn>;
867
+ static fillable: string[];
868
+ static guarded: string[];
869
+
870
+ static getDatabase(): Database;
871
+ static setDatabase(db: Database): void;
872
+ static close(): Promise<void>;
873
+ static query<T = any>(sql: string, params?: any[], options?: any): Promise<T>;
874
+ static transaction<T = any>(callback: (tx: DatabaseTransactionClient | any) => Promise<T>): Promise<T>;
875
+ static invalidateCache(): Promise<void>;
876
+ static find<T = any>(
877
+ idOrConditions: number | string | Record<string, any>,
878
+ options?: ModelFindOptions
879
+ ): Promise<T | null>;
880
+ static first<T = any>(
881
+ idOrConditions?: number | string | Record<string, any>,
882
+ options?: ModelFindOptions
883
+ ): Promise<T | null>;
884
+ static count(where?: Record<string, any>): Promise<number>;
885
+ static exists(where?: Record<string, any>): Promise<boolean>;
886
+ static firstOrCreate<T = any>(where: Record<string, any>, defaults?: Record<string, any>): Promise<T>;
887
+ static updateOrCreate<T = any>(where: Record<string, any>, values?: Record<string, any>): Promise<T>;
888
+ static all<T = any>(options?: ModelAllOptions): Promise<T[]>;
889
+ static paginate<T = any>(options?: ModelPaginateOptions): Promise<PaginatedResult<T>>;
890
+ static create(data: Record<string, any>, options?: { only?: string[]; except?: string[] }): Promise<number | string>;
891
+ static update(
892
+ idOrConditions: number | string | Record<string, any>,
893
+ data: Record<string, any>,
894
+ options?: { only?: string[]; except?: string[] }
895
+ ): Promise<number>;
896
+ static delete(
897
+ idOrConditions: number | string | Record<string, any>,
898
+ options?: ModelDeleteOptions
899
+ ): Promise<number>;
900
+ static restore(idOrConditions: number | string | Record<string, any>): Promise<number>;
901
+ static validator(mode?: "create" | "update", lang?: string): Validator;
902
+ static columnToSQL(col: string, def: ModelSchemaColumn, dialect?: "sqlite" | "mysql" | "postgres"): string;
903
+ static toDDL(dialect?: "sqlite" | "mysql" | "postgres"): string;
904
+ }
905
+
906
+ export interface UploadDiskOptions {
907
+ folder?: string;
908
+ fileSize?: number;
909
+ allowedTypes?: string[];
910
+ }
911
+
912
+ export interface UploadMiddleware {
913
+ single(fieldName: string): (req: Request, res: Response, next: NextFunction) => void;
914
+ array(fieldName: string, maxCount?: number): (req: Request, res: Response, next: NextFunction) => void;
915
+ fields(fields: Array<{ name: string; maxCount?: number }>): (req: Request, res: Response, next: NextFunction) => void;
916
+ none(): (req: Request, res: Response, next: NextFunction) => void;
917
+ any(): (req: Request, res: Response, next: NextFunction) => void;
918
+ }
919
+
920
+ export class Upload {
921
+ static storage(folder?: string): any;
922
+ static disk(options?: UploadDiskOptions): UploadMiddleware;
923
+ static url(filename: string, folder?: string): string;
924
+ }
925
+
926
+ export interface SwaggerOptions {
927
+ route?: string;
928
+ url?: string;
929
+ info?: {
930
+ title?: string;
931
+ version?: string;
932
+ description?: string;
933
+ };
934
+ apis?: string[];
935
+ }
936
+
937
+ export class Swagger {
938
+ static init(app: any, options?: SwaggerOptions): Promise<boolean>;
939
+ }
940
+
941
+ export interface AppProps {
942
+ debug: boolean;
943
+ desktop: boolean;
944
+ userDataDir: string;
945
+ appDir: string;
946
+ title: string;
947
+ description: string;
948
+ version: string;
949
+ host: string;
950
+ appUrl: string;
951
+ port: number;
952
+ jwtSecret?: string;
953
+ langMeta: string;
954
+ static: { path: string; options: Record<string, any> };
955
+ descriptionMeta?: string;
956
+ keywordsMeta?: string;
957
+ titleMeta?: string;
958
+ authorMeta?: string;
959
+ }
960
+
961
+ export class Config {
962
+ static dirname(): string;
963
+ static appDir(): string;
964
+ static setAppDir(dirPath: string): void;
965
+ static isDesktop(): boolean;
966
+ static setUserDataDir(customDir: string): void;
967
+ static userDataDir(): string;
968
+ static reload(): AppProps;
969
+ static props(): AppProps;
970
+ }
971
+
972
+ export class Logger {
973
+ folder: string;
974
+ constructor();
975
+ nowFolder(): string;
976
+ now(): string;
977
+ _log(file: string, level: string, message: string): void;
978
+ log(file: string, level: string, message: string): void;
979
+ info(message: string): void;
980
+ error(message: string): void;
981
+ warn(message: string): void;
982
+ warning(message: string): void;
983
+ debug(message: string): void;
984
+ }
985
+
986
+ export class Debug {
987
+ constructor();
988
+ static shouldTrack(req: Request): boolean;
989
+ static middlewareMetrics(app: any): void;
990
+ getRouter(): { path: string; router: ExpressRouter };
991
+ }
992
+
993
+ export interface CommonMiddleware {
994
+ auth: (req: Request, res: Response, next: NextFunction) => Promise<any>;
995
+ webAuth: (req: Request, res: Response, next: NextFunction) => Promise<any>;
996
+ logger: (req: Request, res: Response, next: NextFunction) => void;
997
+ }
998
+
999
+ export const Middleware: CommonMiddleware;
1000
+
1001
+ export default App;
1002
+
1003
+ declare module "@seip/bluebird-js/core/model.js" {
1004
+ import {
1005
+ Model,
1006
+ ModelSchemaColumn,
1007
+ ModelFindOptions,
1008
+ ModelAllOptions,
1009
+ ModelPaginateOptions,
1010
+ ModelDeleteOptions,
1011
+ PaginatedResult,
1012
+ } from "@seip/bluebird-js";
1013
+ export {
1014
+ Model,
1015
+ ModelSchemaColumn,
1016
+ ModelFindOptions,
1017
+ ModelAllOptions,
1018
+ ModelPaginateOptions,
1019
+ ModelDeleteOptions,
1020
+ PaginatedResult,
1021
+ };
1022
+ export default Model;
1023
+ }
1024
+
1025
+ declare module "@seip/bluebird-js/core/app.js" {
1026
+ import App, {
1027
+ AppError,
1028
+ WebSocketManager,
1029
+ AppOptions,
1030
+ CorsOptions,
1031
+ SecurityHeadersOptions,
1032
+ AppStaticOptions,
1033
+ } from "@seip/bluebird-js";
1034
+ export {
1035
+ App,
1036
+ AppError,
1037
+ WebSocketManager,
1038
+ AppOptions,
1039
+ CorsOptions,
1040
+ SecurityHeadersOptions,
1041
+ AppStaticOptions,
1042
+ };
1043
+ export default App;
1044
+ }
1045
+
1046
+ declare module "@seip/bluebird-js/core/router.js" {
1047
+ import { Router, RouterOptions } from "@seip/bluebird-js";
1048
+ export { Router, RouterOptions };
1049
+ export default Router;
1050
+ }
1051
+
1052
+ declare module "@seip/bluebird-js/core/render.js" {
1053
+ import {
1054
+ Render,
1055
+ RenderIslandOptions,
1056
+ RenderHtmlOptions,
1057
+ IslandComponentProps,
1058
+ h,
1059
+ Fragment,
1060
+ Island,
1061
+ Client,
1062
+ ErrorBoundary,
1063
+ Suspense,
1064
+ Head,
1065
+ Title,
1066
+ Meta,
1067
+ useAction,
1068
+ useActionState,
1069
+ } from "@seip/bluebird-js";
1070
+ export {
1071
+ Render,
1072
+ RenderIslandOptions,
1073
+ RenderHtmlOptions,
1074
+ IslandComponentProps,
1075
+ h,
1076
+ Fragment,
1077
+ Island,
1078
+ Client,
1079
+ ErrorBoundary,
1080
+ Suspense,
1081
+ Head,
1082
+ Title,
1083
+ Meta,
1084
+ useAction,
1085
+ useActionState,
1086
+ };
1087
+ export default Render;
1088
+ }
1089
+
1090
+ declare module "@seip/bluebird-js/core/jsx.js" {
1091
+ import {
1092
+ h,
1093
+ createElement,
1094
+ jsx,
1095
+ jsxs,
1096
+ Fragment,
1097
+ Island,
1098
+ Client,
1099
+ ErrorBoundary,
1100
+ Suspense,
1101
+ Head,
1102
+ Title,
1103
+ Meta,
1104
+ useAction,
1105
+ useActionState,
1106
+ useState,
1107
+ useEffect,
1108
+ useRef,
1109
+ useMemo,
1110
+ useCallback,
1111
+ IslandComponentProps,
1112
+ isJsxElement,
1113
+ renderJsxToString,
1114
+ compileJsx,
1115
+ stripTsTypes,
1116
+ registerJsxLoader,
1117
+ } from "@seip/bluebird-js";
1118
+ export {
1119
+ h,
1120
+ createElement,
1121
+ jsx,
1122
+ jsxs,
1123
+ Fragment,
1124
+ Island,
1125
+ Client,
1126
+ ErrorBoundary,
1127
+ Suspense,
1128
+ Head,
1129
+ Title,
1130
+ Meta,
1131
+ useAction,
1132
+ useActionState,
1133
+ useState,
1134
+ useEffect,
1135
+ useRef,
1136
+ useMemo,
1137
+ useCallback,
1138
+ IslandComponentProps,
1139
+ isJsxElement,
1140
+ renderJsxToString,
1141
+ compileJsx,
1142
+ stripTsTypes,
1143
+ registerJsxLoader,
1144
+ };
1145
+ }
1146
+
1147
+ declare module "@seip/bluebird-js/core/html.js" {
1148
+ import {
1149
+ SafeHtml,
1150
+ isSafeHtml,
1151
+ escapeHtml,
1152
+ safeJson,
1153
+ HtmlTag,
1154
+ html,
1155
+ ScriptTag,
1156
+ script,
1157
+ each,
1158
+ cached,
1159
+ defer,
1160
+ } from "@seip/bluebird-js";
1161
+ export {
1162
+ SafeHtml,
1163
+ isSafeHtml,
1164
+ escapeHtml,
1165
+ safeJson,
1166
+ HtmlTag,
1167
+ html,
1168
+ ScriptTag,
1169
+ script,
1170
+ each,
1171
+ cached,
1172
+ defer,
1173
+ };
1174
+ export default html;
1175
+ }
1176
+
1177
+ declare module "@seip/bluebird-js/core/validate.js" {
1178
+ import {
1179
+ Validator,
1180
+ ValidationRule,
1181
+ ValidationSchema,
1182
+ ValidationError,
1183
+ ValidationResult,
1184
+ } from "@seip/bluebird-js";
1185
+ export {
1186
+ Validator,
1187
+ ValidationRule,
1188
+ ValidationSchema,
1189
+ ValidationError,
1190
+ ValidationResult,
1191
+ };
1192
+ export default Validator;
1193
+ }
1194
+
1195
+ declare module "@seip/bluebird-js/core/database.js" {
1196
+ import {
1197
+ Database,
1198
+ DB_TYPE,
1199
+ DatabaseQueryOptions,
1200
+ DatabaseTransactionClient,
1201
+ PaginatedResult,
1202
+ } from "@seip/bluebird-js";
1203
+ export {
1204
+ Database,
1205
+ DB_TYPE,
1206
+ DatabaseQueryOptions,
1207
+ DatabaseTransactionClient,
1208
+ PaginatedResult,
1209
+ };
1210
+ export default Database;
1211
+ }
1212
+
1213
+ declare module "@seip/bluebird-js/core/auth.js" {
1214
+ import {
1215
+ Auth,
1216
+ AuthProtectOptions,
1217
+ AuthLoginOptions,
1218
+ AuthTokenPayload,
1219
+ } from "@seip/bluebird-js";
1220
+ export {
1221
+ Auth,
1222
+ AuthProtectOptions,
1223
+ AuthLoginOptions,
1224
+ AuthTokenPayload,
1225
+ };
1226
+ export default Auth;
1227
+ }
1228
+
1229
+ declare module "@seip/bluebird-js/core/cache.js" {
1230
+ import {
1231
+ Cache,
1232
+ getRedisClient,
1233
+ CacheDriver,
1234
+ CacheMiddlewareOptions,
1235
+ CacheGetOptions,
1236
+ CacheSetOptions,
1237
+ } from "@seip/bluebird-js";
1238
+ export {
1239
+ Cache,
1240
+ getRedisClient,
1241
+ CacheDriver,
1242
+ CacheMiddlewareOptions,
1243
+ CacheGetOptions,
1244
+ CacheSetOptions,
1245
+ };
1246
+ export default Cache;
1247
+ }
1248
+
1249
+ declare module "@seip/bluebird-js/core/redis.js" {
1250
+ export function initRedis(): Promise<any>;
1251
+ export function getRedisClient(): any;
1252
+ export function isRedisConnectedStatus(): boolean;
1253
+ export function redisGet(key: string): Promise<any>;
1254
+ export function redisSet(key: string, value: any, seconds?: number): Promise<boolean>;
1255
+ export function redisDel(keys: string | string[]): Promise<boolean>;
1256
+ export function redisClearPrefix(prefix: string): Promise<boolean>;
1257
+ export function disconnectRedis(): Promise<void>;
1258
+
1259
+ const redisHandler: {
1260
+ initRedis: typeof initRedis;
1261
+ getRedisClient: typeof getRedisClient;
1262
+ isRedisConnectedStatus: typeof isRedisConnectedStatus;
1263
+ redisGet: typeof redisGet;
1264
+ redisSet: typeof redisSet;
1265
+ redisDel: typeof redisDel;
1266
+ redisClearPrefix: typeof redisClearPrefix;
1267
+ disconnectRedis: typeof disconnectRedis;
1268
+ };
1269
+ export default redisHandler;
1270
+ }
1271
+
1272
+ declare module "@seip/bluebird-js/core/csrf.js" {
1273
+ import { Csrf, CsrfOptions } from "@seip/bluebird-js";
1274
+ export { Csrf, CsrfOptions };
1275
+ export default Csrf;
1276
+ }
1277
+
1278
+ declare module "@seip/bluebird-js/core/hash.js" {
1279
+ import { Hash, HashMakeOptions } from "@seip/bluebird-js";
1280
+ export { Hash, HashMakeOptions };
1281
+ export default Hash;
1282
+ }
1283
+
1284
+ declare module "@seip/bluebird-js/core/queue.js" {
1285
+ import {
1286
+ Queue,
1287
+ QueueDispatchOptions,
1288
+ QueueJob,
1289
+ QueueHandler,
1290
+ } from "@seip/bluebird-js";
1291
+ export {
1292
+ Queue,
1293
+ QueueDispatchOptions,
1294
+ QueueJob,
1295
+ QueueHandler,
1296
+ };
1297
+ export default Queue;
1298
+ }
1299
+
1300
+ declare module "@seip/bluebird-js/core/upload.js" {
1301
+ import {
1302
+ Upload,
1303
+ UploadDiskOptions,
1304
+ UploadMiddleware,
1305
+ UploadedFile,
1306
+ } from "@seip/bluebird-js";
1307
+ export {
1308
+ Upload,
1309
+ UploadDiskOptions,
1310
+ UploadMiddleware,
1311
+ UploadedFile,
1312
+ };
1313
+ export default Upload;
1314
+ }
1315
+
1316
+ declare module "@seip/bluebird-js/core/ws.js" {
1317
+ import {
1318
+ WebSocketManager,
1319
+ WebSocketOptions,
1320
+ WebSocketClient,
1321
+ WebSocketConnectionHandler,
1322
+ } from "@seip/bluebird-js";
1323
+ export {
1324
+ WebSocketManager,
1325
+ WebSocketOptions,
1326
+ WebSocketClient,
1327
+ WebSocketConnectionHandler,
1328
+ };
1329
+ export default WebSocketManager;
1330
+ }
1331
+
1332
+ declare module "@seip/bluebird-js/core/swagger.js" {
1333
+ import { Swagger, SwaggerOptions } from "@seip/bluebird-js";
1334
+ export { Swagger, SwaggerOptions };
1335
+ export default Swagger;
1336
+ }
1337
+
1338
+ declare module "@seip/bluebird-js/core/logger.js" {
1339
+ import { Logger } from "@seip/bluebird-js";
1340
+ export { Logger };
1341
+ export default Logger;
1342
+ }
1343
+
1344
+ declare module "@seip/bluebird-js/core/config.js" {
1345
+ import { Config, AppProps } from "@seip/bluebird-js";
1346
+ export { Config, AppProps };
1347
+ export default Config;
1348
+ }
1349
+
1350
+ declare module "@seip/bluebird-js/core/debug.js" {
1351
+ import { Debug } from "@seip/bluebird-js";
1352
+ export { Debug };
1353
+ export default Debug;
1354
+ }
1355
+
1356
+ declare module "@seip/bluebird-js/core/middleware.js" {
1357
+ import { Middleware, CommonMiddleware } from "@seip/bluebird-js";
1358
+ export { Middleware, CommonMiddleware };
1359
+ export default Middleware;
1360
+ }
1361
+
1362
+ declare module "@seip/bluebird-js/core/vite.js" {
1363
+ import { Vite, ViteOptions } from "@seip/bluebird-js";
1364
+ export { Vite, ViteOptions };
1365
+ export default Vite;
1366
+ }
1367
+
1368
+ declare module "@seip/bluebird-js/core/ratelimit.js" {
1369
+ import { RateLimit, RateLimitOptions } from "@seip/bluebird-js";
1370
+ export { RateLimit, RateLimitOptions };
1371
+ export default RateLimit;
1372
+ }
1373
+
1374
+ declare module "@seip/bluebird-js/core/seo.js" {
1375
+ import { Seo } from "@seip/bluebird-js";
1376
+ export { Seo };
1377
+ export default Seo;
1378
+ }
1379
+
1380
+ declare module "@seip/bluebird-js/core/actions.js" {
1381
+ import { Actions, ActionDefinitionOptions, ActionContext } from "@seip/bluebird-js";
1382
+ export { Actions, ActionDefinitionOptions, ActionContext };
1383
+ export default Actions;
1384
+ }
1385
+