@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.5.1",
4
+ "version": "3.5.3",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -1,4 +1,4 @@
1
- export { default as icons } from "picocolors";
1
+ export { default as pic } from "picocolors";
2
2
  export * from './tmp/index';
3
3
  export * from './path/index';
4
4
  export * from './is/index';
@@ -1,4 +1,4 @@
1
- export { default as icons } from "picocolors";
1
+ export { default as pic } from "picocolors";
2
2
  export * from './tmp/index';
3
3
  export * from './path/index';
4
4
  export * from './is/index';
@@ -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) => Response;
31
- json: (data: any) => Response;
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?: CustomResponse | Function;
31
+ response?: Function;
51
32
  }
52
33
  export interface ReturnResponseCallbackFuncInterface {
53
34
  message: Array<string>;
54
- response?: CustomResponse | Function;
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 socket: any | null;
64
- protected req: CustomRequest | null | undefined;
65
- protected res: CustomResponse | null | undefined;
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
- socket?: any;
79
- req?: CustomRequest;
80
- res?: CustomResponse;
48
+ req?: any;
49
+ res?: any;
81
50
  ctx?: any;
82
51
  });
83
- protected createResponse(data: any, statusCode?: number): Response;
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
- socket?: any;
93
- req?: any;
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: ({ localeLanguageConverter }: {
57
+ context: (helpers: {
103
58
  localeLanguageConverter?: Function;
104
59
  }) => ResponseSchema;
105
- }) => Promise<Response | ResponseSchema>;
106
- protected parsedQuerys: (url: string) => Record<any, any>;
107
- protected parsedQuerysWithTrueType: (url: string) => Record<string, any>;
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?: ({ payload, convertedPayload }: {
127
- payload?: any;
128
- convertedPayload?: any;
66
+ checks?: (args: {
67
+ payload: any;
68
+ convertedPayload: any;
129
69
  }) => Promise<ReturnChecksCallbackFuncInterface | Array<any>>;
130
- logic: ({ payload, convertedPayload }: {
131
- payload?: any;
132
- convertedPayload?: any;
70
+ logic: (args: {
71
+ payload: any;
72
+ convertedPayload: any;
133
73
  }) => Promise<ReturnLogicCallbackFuncInterface>;
134
- response?: ({ payload, convertedPayload }: {
135
- payload?: any;
136
- convertedPayload?: any;
74
+ response?: (args: {
75
+ payload: any;
76
+ convertedPayload: any;
137
77
  }) => Promise<ReturnResponseCallbackFuncInterface>;
138
- }): Promise<Response | ResponseSchema>;
78
+ }): Promise<any>;
139
79
  }
140
- export { Controller, ControllerSchema };
80
+ export { Controller };