@xrystal/core 3.5.1 → 3.5.3
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/package.json +1 -1
- package/source/utils/helpers/index.d.ts +1 -1
- package/source/utils/helpers/index.js +1 -1
- package/source/utils/models/classes/class.controller.d.ts +30 -90
- package/source/utils/models/classes/class.controller.js +106 -390
- package/x/dist/utils/helpers/index.d.ts +1 -1
- package/x/dist/utils/helpers/index.js +1 -1
- package/x/dist/utils/models/classes/class.controller.d.ts +30 -90
- package/x/dist/utils/models/classes/class.controller.js +106 -390
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
import { ParsedQs } from 'qs';
|
|
2
1
|
import { ProtocolEnum, ResponseSchema } from '../../index';
|
|
3
|
-
export interface ElysiaContext {
|
|
4
|
-
request: Request;
|
|
5
|
-
body?: any;
|
|
6
|
-
params?: Record<string, string>;
|
|
7
|
-
query?: Record<string, any>;
|
|
8
|
-
headers?: Headers;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
2
|
export interface CustomRequest {
|
|
12
3
|
accounts?: any;
|
|
13
|
-
query:
|
|
14
|
-
sort?: string;
|
|
15
|
-
['start-date']?: string;
|
|
16
|
-
date?: string;
|
|
17
|
-
['end-date']?: string;
|
|
18
|
-
offset?: string;
|
|
19
|
-
limit?: string;
|
|
20
|
-
} & ParsedQs;
|
|
4
|
+
query: Record<string, any>;
|
|
21
5
|
url: string;
|
|
22
6
|
method: string;
|
|
23
7
|
headers: Record<string, string>;
|
|
@@ -27,12 +11,9 @@ export interface CustomRequest {
|
|
|
27
11
|
}
|
|
28
12
|
export interface CustomResponse {
|
|
29
13
|
status: (code: number) => CustomResponse;
|
|
30
|
-
send: (data: any) =>
|
|
31
|
-
json: (data: any) =>
|
|
32
|
-
locals:
|
|
33
|
-
ID?: any;
|
|
34
|
-
user?: any;
|
|
35
|
-
};
|
|
14
|
+
send: (data: any) => any;
|
|
15
|
+
json: (data: any) => any;
|
|
16
|
+
locals: Record<string, any>;
|
|
36
17
|
}
|
|
37
18
|
export interface ReturnChecksCallbackFuncInterface {
|
|
38
19
|
status?: boolean;
|
|
@@ -47,11 +28,11 @@ export interface ReturnLogicCallbackFuncInterface {
|
|
|
47
28
|
message?: string;
|
|
48
29
|
payload?: any;
|
|
49
30
|
code?: number;
|
|
50
|
-
response?:
|
|
31
|
+
response?: Function;
|
|
51
32
|
}
|
|
52
33
|
export interface ReturnResponseCallbackFuncInterface {
|
|
53
34
|
message: Array<string>;
|
|
54
|
-
response?:
|
|
35
|
+
response?: Function;
|
|
55
36
|
}
|
|
56
37
|
export type Sort = {
|
|
57
38
|
key: string;
|
|
@@ -60,81 +41,40 @@ export type Sort = {
|
|
|
60
41
|
declare abstract class Controller {
|
|
61
42
|
private logger;
|
|
62
43
|
protected protocol: ProtocolEnum | null;
|
|
63
|
-
protected
|
|
64
|
-
protected
|
|
65
|
-
|
|
66
|
-
protected accounts: any;
|
|
67
|
-
protected startDate: string | null;
|
|
68
|
-
protected date: string | null;
|
|
69
|
-
protected dateStart: string | null;
|
|
70
|
-
protected endDate: string | null;
|
|
71
|
-
protected sort: Sort | null;
|
|
72
|
-
protected offset: string | null;
|
|
73
|
-
protected limit: string | null;
|
|
74
|
-
defaultLimitSize: number;
|
|
75
|
-
maxLimitSize: number;
|
|
76
|
-
constructor({ protocol, socket, req, res, ctx }: {
|
|
44
|
+
protected req: CustomRequest | null;
|
|
45
|
+
protected res: CustomResponse | null;
|
|
46
|
+
constructor({ protocol, req, res, ctx }: {
|
|
77
47
|
protocol: ProtocolEnum;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
res?: CustomResponse;
|
|
48
|
+
req?: any;
|
|
49
|
+
res?: any;
|
|
81
50
|
ctx?: any;
|
|
82
51
|
});
|
|
83
|
-
protected
|
|
84
|
-
protected payloadProtocolSwitch: ({ protocol, socket, req, res }: {
|
|
85
|
-
protocol: ProtocolEnum;
|
|
86
|
-
socket?: any;
|
|
87
|
-
req?: any;
|
|
88
|
-
res?: CustomResponse;
|
|
89
|
-
}) => Promise<any>;
|
|
90
|
-
protected convertedPayloadProtocolSwitch: ({ protocol, socket, req, res, }: {
|
|
52
|
+
protected responseProtocolSwitch: ({ protocol, req, res, resStatus, context }: {
|
|
91
53
|
protocol: ProtocolEnum;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
res?: CustomResponse;
|
|
95
|
-
}) => Promise<any>;
|
|
96
|
-
protected responseProtocolSwitch: ({ protocol, socket, req, res, resStatus, context }: {
|
|
97
|
-
protocol: ProtocolEnum;
|
|
98
|
-
socket?: any;
|
|
99
|
-
req?: any;
|
|
100
|
-
res?: CustomResponse;
|
|
54
|
+
req: CustomRequest;
|
|
55
|
+
res: CustomResponse;
|
|
101
56
|
resStatus?: number;
|
|
102
|
-
context: (
|
|
57
|
+
context: (helpers: {
|
|
103
58
|
localeLanguageConverter?: Function;
|
|
104
59
|
}) => ResponseSchema;
|
|
105
|
-
}) => Promise<
|
|
106
|
-
protected parsedQuerys: (url: string) => Record<
|
|
107
|
-
protected
|
|
108
|
-
protected dateNativeUTCToUTCConverter: (date: string) => string;
|
|
109
|
-
protected sortParser: (sort: string) => Sort | null;
|
|
110
|
-
protected aprotator(value: any): boolean;
|
|
111
|
-
protected log: ({ level, message }: {
|
|
112
|
-
level: string;
|
|
113
|
-
message: string;
|
|
114
|
-
}) => Promise<void>;
|
|
115
|
-
protected getErrorMessage(error: unknown): string;
|
|
60
|
+
}) => Promise<any>;
|
|
61
|
+
protected parsedQuerys: (url: string) => Record<string, any>;
|
|
62
|
+
protected log: (level: string, message: string) => Promise<void>;
|
|
116
63
|
}
|
|
117
|
-
declare class ControllerSchema extends Controller {
|
|
118
|
-
constructor({ protocol, socket, req, res, ctx }: {
|
|
119
|
-
protocol: ProtocolEnum;
|
|
120
|
-
socket?: any;
|
|
121
|
-
req?: CustomRequest;
|
|
122
|
-
res?: CustomResponse;
|
|
123
|
-
ctx?: any;
|
|
124
|
-
});
|
|
64
|
+
export declare class ControllerSchema extends Controller {
|
|
125
65
|
schema({ checks, logic, response, }: {
|
|
126
|
-
checks?: (
|
|
127
|
-
payload
|
|
128
|
-
convertedPayload
|
|
66
|
+
checks?: (args: {
|
|
67
|
+
payload: any;
|
|
68
|
+
convertedPayload: any;
|
|
129
69
|
}) => Promise<ReturnChecksCallbackFuncInterface | Array<any>>;
|
|
130
|
-
logic: (
|
|
131
|
-
payload
|
|
132
|
-
convertedPayload
|
|
70
|
+
logic: (args: {
|
|
71
|
+
payload: any;
|
|
72
|
+
convertedPayload: any;
|
|
133
73
|
}) => Promise<ReturnLogicCallbackFuncInterface>;
|
|
134
|
-
response?: (
|
|
135
|
-
payload
|
|
136
|
-
convertedPayload
|
|
74
|
+
response?: (args: {
|
|
75
|
+
payload: any;
|
|
76
|
+
convertedPayload: any;
|
|
137
77
|
}) => Promise<ReturnResponseCallbackFuncInterface>;
|
|
138
|
-
}): Promise<
|
|
78
|
+
}): Promise<any>;
|
|
139
79
|
}
|
|
140
|
-
export { Controller
|
|
80
|
+
export { Controller };
|