@fuzionx/core 0.1.43 → 0.1.45

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/types/index.d.ts CHANGED
@@ -1,164 +1,164 @@
1
- // TypeScript 타입 정의 — fuzionx framework
2
-
3
- export interface FuzionXOptions {
4
- config: string;
5
- port?: number;
6
- }
7
-
8
- export interface UploadedFile {
9
- fieldName: string;
10
- originalName: string;
11
- mimeType: string;
12
- size: number;
13
- tempPath: string;
14
- }
15
-
16
- export interface FuzionXRequest {
17
- method: string;
18
- url: string;
19
- path: string;
20
- query: Record<string, string>;
21
- params: Record<string, string>;
22
- headers: Record<string, string>;
23
- ip: string;
24
- body: string;
25
- json: any;
26
- handlerId: number;
27
- requestId: number;
28
- sessionId: string | null;
29
- files: UploadedFile[] | null;
30
- session: SessionHelper;
31
- t: (key: string, defaultValue?: string) => string;
32
- }
33
-
34
- export interface FuzionXResponse {
35
- status(code: number): FuzionXResponse;
36
- json(data: any): FuzionXResponse;
37
- send(text: string): FuzionXResponse;
38
- html(content: string): FuzionXResponse;
39
- redirect(url: string, code?: number): FuzionXResponse;
40
- header(key: string, value: string): FuzionXResponse;
41
- }
42
-
43
- export type NextFunction = (err?: Error) => void;
44
- export type RequestHandler = (req: FuzionXRequest, res: FuzionXResponse, next: NextFunction) => void;
45
- export type ErrorHandler = (err: Error, req: FuzionXRequest, res: FuzionXResponse, next: NextFunction) => void;
46
-
47
- export interface SessionHelper {
48
- get(key?: string): any;
49
- set(key: string, value: string): void;
50
- destroy(): void;
51
- renew(): string | null;
52
- }
53
-
54
- export interface I18nHelper {
55
- translate(locale: string, key: string): string | null;
56
- readonly locales: string[];
57
- setLocale(locale: string): void;
58
- updateMissing(key: string, value: string): void;
59
- readonly autoComplete: boolean;
60
- render(template: string, context?: Record<string, any>, locale?: string): string;
61
- }
62
-
63
- export interface WsHelper {
64
- broadcast(data: any): void;
65
- sendTo(sessionId: string, data: any): void;
66
- sendToMany(sessionIds: string[], data: any): void;
67
- broadcastExcluding(excludeId: string, data: any): void;
68
- sendToMatch(key: string, value: string, data: any): void;
69
- readonly onlineCount: number;
70
- readonly sessionIds: string[];
71
- disconnect(sessionId: string): void;
72
- setMetadata(sessionId: string, key: string, value: string): void;
73
- getMetadata(sessionId: string, key: string): string | null;
74
- removeInactive(seconds: number): number;
75
- }
76
-
77
- export interface CryptoHelper {
78
- uuid(): string;
79
- md5(input: string): string;
80
- sha256(input: string): string;
81
- encrypt(key: string, plaintext: string): string;
82
- decrypt(key: string, ciphertext: string): string;
83
- encryptCustom(plaintext: string, key: string): string;
84
- decryptCustom(ciphertext: string, key: string): string;
85
- getUaSlice(userAgent: string): string;
86
- deriveTransportKey(sessionKey: string, uaSlice: string): string;
87
- }
88
-
89
- export interface FileHelper {
90
- move(src: string, dst: string): void;
91
- copy(src: string, dst: string): number;
92
- ensureDir(dirPath: string): void;
93
- size(filePath: string): number;
94
- exists(filePath: string): boolean;
95
- remove(filePath: string): boolean;
96
- tempPath(prefix?: string): string;
97
- extension(filePath: string): string | null;
98
- }
99
-
100
- export interface HashHelper {
101
- bcrypt(password: string, cost?: number): string;
102
- bcryptVerify(password: string, hash: string): boolean;
103
- argon2(password: string): string;
104
- argon2Verify(password: string, hash: string): boolean;
105
- }
106
-
107
- export interface ResizeSpec {
108
- width: number;
109
- height: number;
110
- format?: string;
111
- quality?: number;
112
- suffix: string;
113
- }
114
-
115
- export interface ImageInfo {
116
- width: number;
117
- height: number;
118
- format: string;
119
- }
120
-
121
- export interface VideoInfo {
122
- duration: number;
123
- width: number;
124
- height: number;
125
- codec: string;
126
- fps: number;
127
- }
128
-
129
- export interface MediaHelper {
130
- resize(input: string, output: string, width: number, height: number, format?: string, quality?: number): string;
131
- resizeMultiple(input: string, outputDir: string, baseName: string, specs: ResizeSpec[]): string[];
132
- imageInfo(filePath: string): ImageInfo;
133
- toWebp(input: string, output: string, quality?: number): string;
134
- videoThumbnail(input: string, output: string, atSeconds?: number, width?: number, format?: string): string;
135
- videoInfo(filePath: string): VideoInfo;
136
- }
137
-
138
- export declare class FuzionXApp {
139
- constructor(options?: FuzionXOptions);
140
-
141
- readonly config: Record<string, any>;
142
- readonly appConfig: Record<string, any>;
143
- readonly crypto: CryptoHelper;
144
- readonly file: FileHelper;
145
- readonly hash: HashHelper;
146
- readonly media: MediaHelper;
147
- readonly ws: WsHelper | null;
148
- readonly i18n: I18nHelper | null;
149
-
150
- get(path: string, ...handlers: RequestHandler[]): this;
151
- post(path: string, ...handlers: RequestHandler[]): this;
152
- put(path: string, ...handlers: RequestHandler[]): this;
153
- delete(path: string, ...handlers: RequestHandler[]): this;
154
- patch(path: string, ...handlers: RequestHandler[]): this;
155
-
156
- use(handler: RequestHandler | ErrorHandler): this;
157
- use(path: string, ...handlers: (RequestHandler | ErrorHandler)[]): this;
158
-
159
- listen(port?: number, callback?: () => void): this;
160
- listen(callback: () => void): this;
161
- }
162
-
163
- export declare function createApp(options?: FuzionXOptions): FuzionXApp;
164
-
1
+ // TypeScript 타입 정의 — fuzionx framework
2
+
3
+ export interface FuzionXOptions {
4
+ config: string;
5
+ port?: number;
6
+ }
7
+
8
+ export interface UploadedFile {
9
+ fieldName: string;
10
+ originalName: string;
11
+ mimeType: string;
12
+ size: number;
13
+ tempPath: string;
14
+ }
15
+
16
+ export interface FuzionXRequest {
17
+ method: string;
18
+ url: string;
19
+ path: string;
20
+ query: Record<string, string>;
21
+ params: Record<string, string>;
22
+ headers: Record<string, string>;
23
+ ip: string;
24
+ body: string;
25
+ json: any;
26
+ handlerId: number;
27
+ requestId: number;
28
+ sessionId: string | null;
29
+ files: UploadedFile[] | null;
30
+ session: SessionHelper;
31
+ t: (key: string, defaultValue?: string) => string;
32
+ }
33
+
34
+ export interface FuzionXResponse {
35
+ status(code: number): FuzionXResponse;
36
+ json(data: any): FuzionXResponse;
37
+ send(text: string): FuzionXResponse;
38
+ html(content: string): FuzionXResponse;
39
+ redirect(url: string, code?: number): FuzionXResponse;
40
+ header(key: string, value: string): FuzionXResponse;
41
+ }
42
+
43
+ export type NextFunction = (err?: Error) => void;
44
+ export type RequestHandler = (req: FuzionXRequest, res: FuzionXResponse, next: NextFunction) => void;
45
+ export type ErrorHandler = (err: Error, req: FuzionXRequest, res: FuzionXResponse, next: NextFunction) => void;
46
+
47
+ export interface SessionHelper {
48
+ get(key?: string): any;
49
+ set(key: string, value: string): void;
50
+ destroy(): void;
51
+ renew(): string | null;
52
+ }
53
+
54
+ export interface I18nHelper {
55
+ translate(locale: string, key: string): string | null;
56
+ readonly locales: string[];
57
+ setLocale(locale: string): void;
58
+ updateMissing(key: string, value: string): void;
59
+ readonly autoComplete: boolean;
60
+ render(template: string, context?: Record<string, any>, locale?: string): string;
61
+ }
62
+
63
+ export interface WsHelper {
64
+ broadcast(data: any): void;
65
+ sendTo(sessionId: string, data: any): void;
66
+ sendToMany(sessionIds: string[], data: any): void;
67
+ broadcastExcluding(excludeId: string, data: any): void;
68
+ sendToMatch(key: string, value: string, data: any): void;
69
+ readonly onlineCount: number;
70
+ readonly sessionIds: string[];
71
+ disconnect(sessionId: string): void;
72
+ setMetadata(sessionId: string, key: string, value: string): void;
73
+ getMetadata(sessionId: string, key: string): string | null;
74
+ removeInactive(seconds: number): number;
75
+ }
76
+
77
+ export interface CryptoHelper {
78
+ uuid(): string;
79
+ md5(input: string): string;
80
+ sha256(input: string): string;
81
+ encrypt(key: string, plaintext: string): string;
82
+ decrypt(key: string, ciphertext: string): string;
83
+ encryptCustom(plaintext: string, key: string): string;
84
+ decryptCustom(ciphertext: string, key: string): string;
85
+ getUaSlice(userAgent: string): string;
86
+ deriveTransportKey(sessionKey: string, uaSlice: string): string;
87
+ }
88
+
89
+ export interface FileHelper {
90
+ move(src: string, dst: string): void;
91
+ copy(src: string, dst: string): number;
92
+ ensureDir(dirPath: string): void;
93
+ size(filePath: string): number;
94
+ exists(filePath: string): boolean;
95
+ remove(filePath: string): boolean;
96
+ tempPath(prefix?: string): string;
97
+ extension(filePath: string): string | null;
98
+ }
99
+
100
+ export interface HashHelper {
101
+ bcrypt(password: string, cost?: number): string;
102
+ bcryptVerify(password: string, hash: string): boolean;
103
+ argon2(password: string): string;
104
+ argon2Verify(password: string, hash: string): boolean;
105
+ }
106
+
107
+ export interface ResizeSpec {
108
+ width: number;
109
+ height: number;
110
+ format?: string;
111
+ quality?: number;
112
+ suffix: string;
113
+ }
114
+
115
+ export interface ImageInfo {
116
+ width: number;
117
+ height: number;
118
+ format: string;
119
+ }
120
+
121
+ export interface VideoInfo {
122
+ duration: number;
123
+ width: number;
124
+ height: number;
125
+ codec: string;
126
+ fps: number;
127
+ }
128
+
129
+ export interface MediaHelper {
130
+ resize(input: string, output: string, width: number, height: number, format?: string, quality?: number): string;
131
+ resizeMultiple(input: string, outputDir: string, baseName: string, specs: ResizeSpec[]): string[];
132
+ imageInfo(filePath: string): ImageInfo;
133
+ toWebp(input: string, output: string, quality?: number): string;
134
+ videoThumbnail(input: string, output: string, atSeconds?: number, width?: number, format?: string): string;
135
+ videoInfo(filePath: string): VideoInfo;
136
+ }
137
+
138
+ export declare class FuzionXApp {
139
+ constructor(options?: FuzionXOptions);
140
+
141
+ readonly config: Record<string, any>;
142
+ readonly appConfig: Record<string, any>;
143
+ readonly crypto: CryptoHelper;
144
+ readonly file: FileHelper;
145
+ readonly hash: HashHelper;
146
+ readonly media: MediaHelper;
147
+ readonly ws: WsHelper | null;
148
+ readonly i18n: I18nHelper | null;
149
+
150
+ get(path: string, ...handlers: RequestHandler[]): this;
151
+ post(path: string, ...handlers: RequestHandler[]): this;
152
+ put(path: string, ...handlers: RequestHandler[]): this;
153
+ delete(path: string, ...handlers: RequestHandler[]): this;
154
+ patch(path: string, ...handlers: RequestHandler[]): this;
155
+
156
+ use(handler: RequestHandler | ErrorHandler): this;
157
+ use(path: string, ...handlers: (RequestHandler | ErrorHandler)[]): this;
158
+
159
+ listen(port?: number, callback?: () => void): this;
160
+ listen(callback: () => void): this;
161
+ }
162
+
163
+ export declare function createApp(options?: FuzionXOptions): FuzionXApp;
164
+