@arkyn/server 3.0.1-beta.9 → 3.0.1-beta.91
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/README.md +368 -65
- package/dist/api/arkynLogRequest.d.ts +1 -1
- package/dist/api/arkynLogRequest.d.ts.map +1 -1
- package/dist/api/arkynLogRequest.js +24 -19
- package/dist/api/makeRequest.d.ts +1 -1
- package/dist/api/makeRequest.d.ts.map +1 -1
- package/dist/api/makeRequest.js +9 -7
- package/dist/bundle.js +1507 -0
- package/dist/bundle.umd.cjs +10 -0
- package/dist/http/badResponses/_badResponse.d.ts +11 -0
- package/dist/http/badResponses/_badResponse.d.ts.map +1 -0
- package/dist/http/badResponses/_badResponse.js +20 -0
- package/dist/http/badResponses/badGateway.d.ts +2 -1
- package/dist/http/badResponses/badGateway.d.ts.map +1 -1
- package/dist/http/badResponses/badGateway.js +9 -3
- package/dist/http/badResponses/badRequest.d.ts +2 -1
- package/dist/http/badResponses/badRequest.d.ts.map +1 -1
- package/dist/http/badResponses/badRequest.js +9 -3
- package/dist/http/badResponses/conflict.d.ts +2 -1
- package/dist/http/badResponses/conflict.d.ts.map +1 -1
- package/dist/http/badResponses/conflict.js +9 -3
- package/dist/http/badResponses/forbidden.d.ts +2 -1
- package/dist/http/badResponses/forbidden.d.ts.map +1 -1
- package/dist/http/badResponses/forbidden.js +9 -3
- package/dist/http/badResponses/notFound.d.ts +2 -1
- package/dist/http/badResponses/notFound.d.ts.map +1 -1
- package/dist/http/badResponses/notFound.js +9 -3
- package/dist/http/badResponses/notImplemented.d.ts +2 -1
- package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
- package/dist/http/badResponses/notImplemented.js +9 -3
- package/dist/http/badResponses/serverError.d.ts +2 -1
- package/dist/http/badResponses/serverError.d.ts.map +1 -1
- package/dist/http/badResponses/serverError.js +9 -3
- package/dist/http/badResponses/unauthorized.d.ts +2 -1
- package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
- package/dist/http/badResponses/unauthorized.js +9 -3
- package/dist/http/badResponses/unprocessableEntity.d.ts +3 -2
- package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
- package/dist/http/badResponses/unprocessableEntity.js +9 -4
- package/dist/http/successResponses/_successResponse.d.ts +22 -0
- package/dist/http/successResponses/_successResponse.d.ts.map +1 -0
- package/dist/http/successResponses/_successResponse.js +37 -0
- package/dist/http/successResponses/created.d.ts +2 -1
- package/dist/http/successResponses/created.d.ts.map +1 -1
- package/dist/http/successResponses/created.js +4 -1
- package/dist/http/successResponses/found.d.ts +2 -1
- package/dist/http/successResponses/found.d.ts.map +1 -1
- package/dist/http/successResponses/found.js +4 -1
- package/dist/http/successResponses/noContent.d.ts +2 -1
- package/dist/http/successResponses/noContent.d.ts.map +1 -1
- package/dist/http/successResponses/noContent.js +4 -1
- package/dist/http/successResponses/success.d.ts +2 -1
- package/dist/http/successResponses/success.d.ts.map +1 -1
- package/dist/http/successResponses/success.js +4 -1
- package/dist/http/successResponses/updated.d.ts +2 -1
- package/dist/http/successResponses/updated.d.ts.map +1 -1
- package/dist/http/successResponses/updated.js +4 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/{config/apiInstance.d.ts → services/apiService.d.ts} +25 -21
- package/dist/services/apiService.d.ts.map +1 -0
- package/dist/{config/apiInstance.js → services/apiService.js} +45 -23
- package/dist/{config/arkynLogInstance.d.ts → services/arkynLogService.d.ts} +11 -11
- package/dist/services/arkynLogService.d.ts.map +1 -0
- package/dist/{config/arkynLogInstance.js → services/arkynLogService.js} +8 -11
- package/dist/services/debugService.d.ts +54 -0
- package/dist/services/debugService.d.ts.map +1 -0
- package/dist/services/debugService.js +57 -0
- package/dist/services/flushDebugLogs.d.ts +8 -0
- package/dist/services/flushDebugLogs.d.ts.map +1 -0
- package/dist/services/flushDebugLogs.js +20 -0
- package/{src/services/formParse.ts → dist/services/formAsyncParse.d.ts} +20 -44
- package/dist/services/formAsyncParse.d.ts.map +1 -0
- package/dist/services/formAsyncParse.js +58 -0
- package/dist/services/formParse.d.ts +3 -3
- package/dist/services/formParse.d.ts.map +1 -1
- package/dist/services/formParse.js +7 -5
- package/dist/services/getCaller.d.ts.map +1 -1
- package/dist/services/getCaller.js +9 -14
- package/dist/services/measureRouteExecution.d.ts +3 -0
- package/dist/services/measureRouteExecution.d.ts.map +1 -0
- package/dist/services/measureRouteExecution.js +24 -0
- package/dist/services/schemaValidator.d.ts +148 -3
- package/dist/services/schemaValidator.d.ts.map +1 -1
- package/dist/services/schemaValidator.js +160 -4
- package/dist/validations/validateCep.d.ts +24 -0
- package/dist/validations/validateCep.d.ts.map +1 -0
- package/dist/validations/validateCep.js +33 -0
- package/dist/validations/validateCnpj.d.ts +22 -0
- package/dist/validations/validateCnpj.d.ts.map +1 -0
- package/dist/validations/validateCnpj.js +52 -0
- package/dist/validations/validateCpf.d.ts +24 -0
- package/dist/validations/validateCpf.d.ts.map +1 -0
- package/dist/validations/validateCpf.js +54 -0
- package/dist/validations/validateDate.d.ts +34 -0
- package/dist/validations/validateDate.d.ts.map +1 -0
- package/dist/validations/validateDate.js +73 -0
- package/dist/validations/validateEmail.d.ts +22 -0
- package/dist/validations/validateEmail.d.ts.map +1 -0
- package/dist/validations/validateEmail.js +123 -0
- package/dist/validations/validatePassword.d.ts +21 -0
- package/dist/validations/validatePassword.d.ts.map +1 -0
- package/dist/validations/validatePassword.js +34 -0
- package/dist/validations/validatePhone.d.ts +29 -0
- package/dist/validations/validatePhone.d.ts.map +1 -0
- package/dist/validations/validatePhone.js +44 -0
- package/dist/validations/validateRg.d.ts +22 -0
- package/dist/validations/validateRg.d.ts.map +1 -0
- package/dist/validations/validateRg.js +31 -0
- package/package.json +34 -18
- package/dist/config/apiInstance.d.ts.map +0 -1
- package/dist/config/arkynLogInstance.d.ts.map +0 -1
- package/dist/services/httpDebug.d.ts +0 -35
- package/dist/services/httpDebug.d.ts.map +0 -1
- package/dist/services/httpDebug.js +0 -52
- package/src/api/arkynLogRequest.ts +0 -125
- package/src/api/deleteRequest.ts +0 -22
- package/src/api/getRequest.ts +0 -20
- package/src/api/makeRequest.ts +0 -120
- package/src/api/patchRequest.ts +0 -22
- package/src/api/postRequest.ts +0 -22
- package/src/api/putRequest.ts +0 -22
- package/src/config/apiInstance.ts +0 -148
- package/src/config/arkynLogInstance.ts +0 -70
- package/src/http/badResponses/badGateway.ts +0 -63
- package/src/http/badResponses/badRequest.ts +0 -63
- package/src/http/badResponses/conflict.ts +0 -63
- package/src/http/badResponses/forbidden.ts +0 -63
- package/src/http/badResponses/notFound.ts +0 -63
- package/src/http/badResponses/notImplemented.ts +0 -63
- package/src/http/badResponses/serverError.ts +0 -63
- package/src/http/badResponses/unauthorized.ts +0 -63
- package/src/http/badResponses/unprocessableEntity.ts +0 -79
- package/src/http/successResponses/created.ts +0 -64
- package/src/http/successResponses/found.ts +0 -67
- package/src/http/successResponses/noContent.ts +0 -42
- package/src/http/successResponses/success.ts +0 -64
- package/src/http/successResponses/updated.ts +0 -64
- package/src/index.ts +0 -31
- package/src/mapper/arkynLogRequestMapper.ts +0 -73
- package/src/services/decodeErrorMessageFromRequest.ts +0 -36
- package/src/services/decodeRequestBody.ts +0 -43
- package/src/services/errorHandler.ts +0 -99
- package/src/services/getCaller.ts +0 -82
- package/src/services/getScopedParams.ts +0 -43
- package/src/services/httpDebug.ts +0 -61
- package/src/services/schemaValidator.ts +0 -66
- package/src/types/ApiResponseDTO.ts +0 -19
- package/tsconfig.json +0 -21
- package/vitest.config.ts +0 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `
|
|
2
|
+
* The `ArkynLogService` class manages the configuration for the arkyn flow.
|
|
3
3
|
* It allows you to set and retrieve the arkyn configuration, including the traffic source ID,
|
|
4
4
|
* user token, and API URL.
|
|
5
5
|
*/
|
|
6
|
-
class
|
|
6
|
+
class ArkynLogService {
|
|
7
7
|
static arkynConfig;
|
|
8
8
|
/**
|
|
9
9
|
* Sets the configuration for the arkyn. This method initializes the arkyn configuration
|
|
@@ -19,18 +19,15 @@ class ArkynLogInstance {
|
|
|
19
19
|
static setArkynConfig(arkynConfig) {
|
|
20
20
|
if (!!this.arkynConfig)
|
|
21
21
|
return;
|
|
22
|
-
|
|
23
|
-
let arkynLogBaseApiUrl = arkynConfig.arkynLogBaseApiUrl || defaultArkynURL;
|
|
24
|
-
arkynLogBaseApiUrl =
|
|
25
|
-
arkynLogBaseApiUrl + "/http-traffic-records/:trafficSourceId";
|
|
22
|
+
const { trafficSourceId, userToken, logBaseApiUrl } = arkynConfig;
|
|
26
23
|
this.arkynConfig = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
trafficSourceId,
|
|
25
|
+
userToken,
|
|
26
|
+
apiUrl: logBaseApiUrl || `http://95.216.190.158:8081/ingest-log`,
|
|
30
27
|
};
|
|
31
28
|
}
|
|
32
29
|
/**
|
|
33
|
-
* Retrieves the current arkyn configuration for the
|
|
30
|
+
* Retrieves the current arkyn configuration for the ArkynLogService.
|
|
34
31
|
*
|
|
35
32
|
* @returns {ArkynConfigProps | undefined} The current arkyn configuration if set,
|
|
36
33
|
* or `undefined` if no configuration has been initialized.
|
|
@@ -46,4 +43,4 @@ class ArkynLogInstance {
|
|
|
46
43
|
this.arkynConfig = undefined;
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
|
-
export {
|
|
46
|
+
export { ArkynLogService };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for managing HTTP debug configuration and behavior.
|
|
3
|
+
*
|
|
4
|
+
* This service provides functionality to configure how the `getCaller` function
|
|
5
|
+
* identifies the actual caller in the stack trace by allowing specific files
|
|
6
|
+
* to be ignored during stack trace analysis.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Configure to ignore httpAdapter.ts in stack traces
|
|
11
|
+
* HttpDebugService.setIgnoreFile("httpAdapter.ts");
|
|
12
|
+
*
|
|
13
|
+
* // Now when httpDebug is called from within httpAdapter.ts,
|
|
14
|
+
* // it will show the actual caller (e.g., cart.ts) instead
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare class DebugService {
|
|
18
|
+
/**
|
|
19
|
+
* The name of the file to ignore when analyzing the stack trace.
|
|
20
|
+
* When set, the `getCaller` function will skip stack frames containing this file name.
|
|
21
|
+
*/
|
|
22
|
+
static ignoreFiles: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Sets the file name to be ignored during stack trace analysis.
|
|
25
|
+
*
|
|
26
|
+
* This method configures the debug service to skip specific files when
|
|
27
|
+
* determining the actual caller of a function. This is useful when you have
|
|
28
|
+
* adapter or wrapper functions that you want to be transparent in the debug output.
|
|
29
|
+
*
|
|
30
|
+
* @param file - The name of the file to ignore in stack traces (e.g., "httpAdapter.ts")
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Ignore the HTTP adapter file so debug shows the actual business logic caller
|
|
35
|
+
* DebugService.setIgnoreFile("httpAdapter.ts");
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
static setIgnoreFile(file: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Clears all configured ignore files.
|
|
41
|
+
*
|
|
42
|
+
* This method resets the ignore file configuration, allowing all files to be
|
|
43
|
+
* considered in stack trace analysis again.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* // Clear all ignore file configurations
|
|
48
|
+
* DebugService.clearIgnoreFiles();
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
static clearIgnoreFiles(): void;
|
|
52
|
+
}
|
|
53
|
+
export { DebugService };
|
|
54
|
+
//# sourceMappingURL=debugService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugService.d.ts","sourceRoot":"","sources":["../../src/services/debugService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAM,YAAY;IAChB;;;OAGG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,CAAM;IAElC;;;;;;;;;;;;;;OAcG;IAEH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM;IAIjC;;;;;;;;;;;OAWG;IAEH,MAAM,CAAC,gBAAgB;CAGxB;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for managing HTTP debug configuration and behavior.
|
|
3
|
+
*
|
|
4
|
+
* This service provides functionality to configure how the `getCaller` function
|
|
5
|
+
* identifies the actual caller in the stack trace by allowing specific files
|
|
6
|
+
* to be ignored during stack trace analysis.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Configure to ignore httpAdapter.ts in stack traces
|
|
11
|
+
* HttpDebugService.setIgnoreFile("httpAdapter.ts");
|
|
12
|
+
*
|
|
13
|
+
* // Now when httpDebug is called from within httpAdapter.ts,
|
|
14
|
+
* // it will show the actual caller (e.g., cart.ts) instead
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
class DebugService {
|
|
18
|
+
/**
|
|
19
|
+
* The name of the file to ignore when analyzing the stack trace.
|
|
20
|
+
* When set, the `getCaller` function will skip stack frames containing this file name.
|
|
21
|
+
*/
|
|
22
|
+
static ignoreFiles = [];
|
|
23
|
+
/**
|
|
24
|
+
* Sets the file name to be ignored during stack trace analysis.
|
|
25
|
+
*
|
|
26
|
+
* This method configures the debug service to skip specific files when
|
|
27
|
+
* determining the actual caller of a function. This is useful when you have
|
|
28
|
+
* adapter or wrapper functions that you want to be transparent in the debug output.
|
|
29
|
+
*
|
|
30
|
+
* @param file - The name of the file to ignore in stack traces (e.g., "httpAdapter.ts")
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Ignore the HTTP adapter file so debug shows the actual business logic caller
|
|
35
|
+
* DebugService.setIgnoreFile("httpAdapter.ts");
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
static setIgnoreFile(file) {
|
|
39
|
+
this.ignoreFiles.push(file);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Clears all configured ignore files.
|
|
43
|
+
*
|
|
44
|
+
* This method resets the ignore file configuration, allowing all files to be
|
|
45
|
+
* considered in stack trace analysis again.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // Clear all ignore file configurations
|
|
50
|
+
* DebugService.clearIgnoreFiles();
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
static clearIgnoreFiles() {
|
|
54
|
+
this.ignoreFiles = [];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export { DebugService };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flushDebugLogs.d.ts","sourceRoot":"","sources":["../../src/services/flushDebugLogs.ts"],"names":[],"mappings":"AAAA,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,QAwBjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function flushDebugLogs(props) {
|
|
2
|
+
const isDebugMode = process.env.NODE_ENV === "development" ||
|
|
3
|
+
process.env?.SHOW_ERRORS_IN_CONSOLE === "true";
|
|
4
|
+
if (isDebugMode) {
|
|
5
|
+
const reset = "\x1b[0m";
|
|
6
|
+
const colors = {
|
|
7
|
+
yellow: "\x1b[33m",
|
|
8
|
+
cyan: "\x1b[36m",
|
|
9
|
+
red: "\x1b[31m",
|
|
10
|
+
green: "\x1b[32m",
|
|
11
|
+
};
|
|
12
|
+
const debugName = `${colors[props.scheme]}[${props.name}]${reset}`;
|
|
13
|
+
let consoleData = `\n`;
|
|
14
|
+
props.debugs.forEach((debug) => {
|
|
15
|
+
consoleData += `${debugName} ${debug.trim()}\n`;
|
|
16
|
+
});
|
|
17
|
+
console.log(consoleData);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export { flushDebugLogs };
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ZodType } from "zod";
|
|
3
2
|
type SuccessResponse<T extends FormParseProps> = {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
success: true;
|
|
4
|
+
data: T[1] extends ZodType<infer U> ? U : never;
|
|
6
5
|
};
|
|
7
|
-
|
|
8
6
|
type ErrorResponse = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
success: false;
|
|
8
|
+
fields: {
|
|
9
|
+
[x: string]: string;
|
|
10
|
+
};
|
|
11
|
+
fieldErrors: {
|
|
12
|
+
[x: string]: string;
|
|
13
|
+
};
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
type FormParseReturnType<T extends FormParseProps> =
|
|
17
|
-
| SuccessResponse<T>
|
|
18
|
-
| ErrorResponse;
|
|
19
|
-
|
|
15
|
+
type FormParseProps = [formData: {
|
|
16
|
+
[k: string]: any;
|
|
17
|
+
}, schema: ZodType];
|
|
18
|
+
type FormParseReturnType<T extends FormParseProps> = SuccessResponse<T> | ErrorResponse;
|
|
20
19
|
/**
|
|
21
|
-
*
|
|
20
|
+
* Asynchronously parses form data using a Zod schema and returns the result.
|
|
22
21
|
*
|
|
23
22
|
* @template T - A type that extends `FormParseProps`.
|
|
24
23
|
*
|
|
@@ -26,7 +25,7 @@ type FormParseReturnType<T extends FormParseProps> =
|
|
|
26
25
|
* @param {T[0]} param0[0] - The form data to be validated.
|
|
27
26
|
* @param {T[1]} param0[1] - The Zod schema used for validation.
|
|
28
27
|
*
|
|
29
|
-
* @returns {FormParseReturnType<T
|
|
28
|
+
* @returns {Promise<FormParseReturnType<T>>} A promise that resolves to an object containing the validation result.
|
|
30
29
|
* - If validation fails, it includes:
|
|
31
30
|
* - `success`: A boolean indicating the validation status (false).
|
|
32
31
|
* - `fieldErrors`: An object mapping field names to their respective error messages.
|
|
@@ -46,7 +45,7 @@ type FormParseReturnType<T extends FormParseProps> =
|
|
|
46
45
|
*
|
|
47
46
|
* const formData = { name: "", age: 17 };
|
|
48
47
|
*
|
|
49
|
-
* const result =
|
|
48
|
+
* const result = await formAsyncParse([formData, schema]);
|
|
50
49
|
*
|
|
51
50
|
* if (!result.success) {
|
|
52
51
|
* console.log(result.fieldErrors); // { name: "Name is required", age: "Must be at least 18" }
|
|
@@ -55,29 +54,6 @@ type FormParseReturnType<T extends FormParseProps> =
|
|
|
55
54
|
* }
|
|
56
55
|
* ```
|
|
57
56
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
schema,
|
|
62
|
-
]: T): FormParseReturnType<T> {
|
|
63
|
-
const zodResponse = schema.safeParse(formData);
|
|
64
|
-
|
|
65
|
-
if (zodResponse.success === false) {
|
|
66
|
-
const errorsObject = Object.fromEntries(
|
|
67
|
-
zodResponse.error.errors.map((item) => [
|
|
68
|
-
item.path.join("."),
|
|
69
|
-
item.message,
|
|
70
|
-
])
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
success: zodResponse.success,
|
|
75
|
-
fieldErrors: errorsObject,
|
|
76
|
-
fields: formData,
|
|
77
|
-
};
|
|
78
|
-
} else {
|
|
79
|
-
return { success: zodResponse.success, data: zodResponse.data };
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export { formParse };
|
|
57
|
+
declare function formAsyncParse<T extends FormParseProps>([formData, schema,]: T): Promise<FormParseReturnType<T>>;
|
|
58
|
+
export { formAsyncParse };
|
|
59
|
+
//# sourceMappingURL=formAsyncParse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formAsyncParse.d.ts","sourceRoot":"","sources":["../../src/services/formAsyncParse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CACjD,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,WAAW,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtC,CAAC;AAEF,KAAK,cAAc,GAAG,CAAC,QAAQ,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAExE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAC7C,eAAe,CAAC,CAAC,CAAC,GAClB,aAAa,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,iBAAe,cAAc,CAAC,CAAC,SAAS,cAAc,EAAE,CACtD,QAAQ,EACR,MAAM,EACP,EAAE,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAqBrC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asynchronously parses form data using a Zod schema and returns the result.
|
|
3
|
+
*
|
|
4
|
+
* @template T - A type that extends `FormParseProps`.
|
|
5
|
+
*
|
|
6
|
+
* @param {T} param0 - An array containing the form data and the Zod schema.
|
|
7
|
+
* @param {T[0]} param0[0] - The form data to be validated.
|
|
8
|
+
* @param {T[1]} param0[1] - The Zod schema used for validation.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<FormParseReturnType<T>>} A promise that resolves to an object containing the validation result.
|
|
11
|
+
* - If validation fails, it includes:
|
|
12
|
+
* - `success`: A boolean indicating the validation status (false).
|
|
13
|
+
* - `fieldErrors`: An object mapping field names to their respective error messages.
|
|
14
|
+
* - `fields`: The original form data.
|
|
15
|
+
* - If validation succeeds, it includes:
|
|
16
|
+
* - `success`: A boolean indicating the validation status (true).
|
|
17
|
+
* - `data`: The parsed and validated data.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { z } from "zod";
|
|
22
|
+
*
|
|
23
|
+
* const schema = z.object({
|
|
24
|
+
* name: z.string().min(1, "Name is required"),
|
|
25
|
+
* age: z.number().min(18, "Must be at least 18"),
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const formData = { name: "", age: 17 };
|
|
29
|
+
*
|
|
30
|
+
* const result = await formAsyncParse([formData, schema]);
|
|
31
|
+
*
|
|
32
|
+
* if (!result.success) {
|
|
33
|
+
* console.log(result.fieldErrors); // { name: "Name is required", age: "Must be at least 18" }
|
|
34
|
+
* } else {
|
|
35
|
+
* console.log(result.data); // Parsed data
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
async function formAsyncParse([formData, schema,]) {
|
|
40
|
+
const zodResponse = await schema.safeParseAsync(formData);
|
|
41
|
+
if (zodResponse.success === false) {
|
|
42
|
+
const errorsObject = Object.fromEntries(zodResponse.error.issues.map((item) => {
|
|
43
|
+
return [item.path.join("."), item.message];
|
|
44
|
+
}));
|
|
45
|
+
return {
|
|
46
|
+
success: zodResponse.success,
|
|
47
|
+
fieldErrors: errorsObject,
|
|
48
|
+
fields: formData,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return {
|
|
53
|
+
success: zodResponse.success,
|
|
54
|
+
data: zodResponse.data,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export { formAsyncParse };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ZodType } from "zod";
|
|
2
2
|
type SuccessResponse<T extends FormParseProps> = {
|
|
3
3
|
success: true;
|
|
4
|
-
data: T[1] extends
|
|
4
|
+
data: T[1] extends ZodType<infer U> ? U : never;
|
|
5
5
|
};
|
|
6
6
|
type ErrorResponse = {
|
|
7
7
|
success: false;
|
|
@@ -14,7 +14,7 @@ type ErrorResponse = {
|
|
|
14
14
|
};
|
|
15
15
|
type FormParseProps = [formData: {
|
|
16
16
|
[k: string]: any;
|
|
17
|
-
}, schema:
|
|
17
|
+
}, schema: ZodType];
|
|
18
18
|
type FormParseReturnType<T extends FormParseProps> = SuccessResponse<T> | ErrorResponse;
|
|
19
19
|
/**
|
|
20
20
|
* Parses form data using a Zod schema and returns the result.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formParse.d.ts","sourceRoot":"","sources":["../../src/services/formParse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"formParse.d.ts","sourceRoot":"","sources":["../../src/services/formParse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CACjD,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,WAAW,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtC,CAAC;AAEF,KAAK,cAAc,GAAG,CAAC,QAAQ,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAExE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAC7C,eAAe,CAAC,CAAC,CAAC,GAClB,aAAa,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,iBAAS,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,CAC3C,QAAQ,EACR,MAAM,EACP,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAqB5B;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -39,10 +39,9 @@
|
|
|
39
39
|
function formParse([formData, schema,]) {
|
|
40
40
|
const zodResponse = schema.safeParse(formData);
|
|
41
41
|
if (zodResponse.success === false) {
|
|
42
|
-
const errorsObject = Object.fromEntries(zodResponse.error.
|
|
43
|
-
item.path.join("."),
|
|
44
|
-
|
|
45
|
-
]));
|
|
42
|
+
const errorsObject = Object.fromEntries(zodResponse.error.issues.map((item) => {
|
|
43
|
+
return [item.path.join("."), item.message];
|
|
44
|
+
}));
|
|
46
45
|
return {
|
|
47
46
|
success: zodResponse.success,
|
|
48
47
|
fieldErrors: errorsObject,
|
|
@@ -50,7 +49,10 @@ function formParse([formData, schema,]) {
|
|
|
50
49
|
};
|
|
51
50
|
}
|
|
52
51
|
else {
|
|
53
|
-
return {
|
|
52
|
+
return {
|
|
53
|
+
success: zodResponse.success,
|
|
54
|
+
data: zodResponse.data,
|
|
55
|
+
};
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
export { formParse };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCaller.d.ts","sourceRoot":"","sources":["../../src/services/getCaller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCaller.d.ts","sourceRoot":"","sources":["../../src/services/getCaller.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,iBAAS,SAAS;;;EAiEjB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import { DebugService } from "./debugService";
|
|
2
3
|
/**
|
|
3
4
|
* Retrieves information about the caller of the current function.
|
|
4
5
|
*
|
|
@@ -15,51 +16,45 @@ function getCaller() {
|
|
|
15
16
|
const err = new Error();
|
|
16
17
|
const stack = err.stack || "";
|
|
17
18
|
const stackLines = stack.split("\n").map((line) => line.trim());
|
|
18
|
-
|
|
19
|
-
// The second line is this function (getCaller)
|
|
20
|
-
// The third line should be the direct caller
|
|
21
|
-
// We start from 2 because indexes are zero-based
|
|
19
|
+
const ignoreFiles = DebugService.ignoreFiles;
|
|
22
20
|
let callerIndex = 2;
|
|
23
|
-
// Ignore internal or infrastructure lines if necessary
|
|
24
21
|
while (callerIndex < stackLines.length &&
|
|
25
22
|
(stackLines[callerIndex].includes("node:internal") ||
|
|
26
23
|
stackLines[callerIndex].includes("/node_modules/"))) {
|
|
27
24
|
callerIndex++;
|
|
28
25
|
}
|
|
26
|
+
if (ignoreFiles.length > 0) {
|
|
27
|
+
while (callerIndex < stackLines.length &&
|
|
28
|
+
ignoreFiles.some((ignoreFile) => stackLines[callerIndex].includes(ignoreFile))) {
|
|
29
|
+
callerIndex++;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
29
32
|
const callerLine = stackLines[callerIndex] || "";
|
|
30
33
|
let functionName = "Unknown function";
|
|
31
34
|
let callerInfo = "Unknown caller";
|
|
32
|
-
// Default for named functions: "at functionName (file:line:column)"
|
|
33
35
|
const namedFunctionMatch = callerLine.match(/at\s+([^(\s]+)\s+\(([^)]+)\)/);
|
|
34
36
|
if (namedFunctionMatch) {
|
|
35
37
|
functionName = namedFunctionMatch[1];
|
|
36
38
|
callerInfo = namedFunctionMatch[2];
|
|
37
39
|
}
|
|
38
|
-
// Default for anonymous functions or methods: "at file:line:column"
|
|
39
40
|
else {
|
|
40
41
|
const anonymousFunctionMatch = callerLine.match(/at\s+(.+)/);
|
|
41
42
|
if (anonymousFunctionMatch) {
|
|
42
43
|
callerInfo = anonymousFunctionMatch[1];
|
|
43
|
-
// Tenta extrair nome da função de padrões como Object.method ou Class.method
|
|
44
44
|
const objectMethodMatch = callerInfo.match(/at\s+([^(\s]+)\s+/);
|
|
45
45
|
if (objectMethodMatch && objectMethodMatch[1] !== "new") {
|
|
46
46
|
functionName = objectMethodMatch[1];
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
// Handles file paths
|
|
51
50
|
if (callerInfo.includes("(")) {
|
|
52
51
|
callerInfo = callerInfo.substring(callerInfo.indexOf("(") + 1, callerInfo.lastIndexOf(")"));
|
|
53
52
|
}
|
|
54
|
-
// Remove the line:column part of the file path
|
|
55
53
|
callerInfo = callerInfo.split(":").slice(0, -2).join(":");
|
|
56
|
-
// Make the path relative to the project
|
|
57
54
|
try {
|
|
58
55
|
callerInfo = path.relative(projectRoot, callerInfo);
|
|
59
56
|
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
// If it fails to relativize, use the original path
|
|
62
|
-
}
|
|
57
|
+
catch (e) { }
|
|
63
58
|
return { functionName, callerInfo };
|
|
64
59
|
}
|
|
65
60
|
export { getCaller };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureRouteExecution.d.ts","sourceRoot":"","sources":["../../src/services/measureRouteExecution.ts"],"names":[],"mappings":"AAAA,iBAAS,qBAAqB,CAAC,CAAC,GAAG,OAAO,EACxC,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,IAEG,OAAO,GAAG,KAAG,OAAO,CAAC,CAAC,CAAC,CAyB9D;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function measureRouteExecution(handler) {
|
|
2
|
+
return async function measuredHandler(props) {
|
|
3
|
+
const startTime = performance.now();
|
|
4
|
+
try {
|
|
5
|
+
const result = await handler(props);
|
|
6
|
+
const url = new URL(props.request.url);
|
|
7
|
+
const endTime = performance.now();
|
|
8
|
+
const duration = (endTime - startTime).toFixed(2);
|
|
9
|
+
console.log({
|
|
10
|
+
domain: url.hostname,
|
|
11
|
+
pathname: url.pathname,
|
|
12
|
+
method: props.request.method,
|
|
13
|
+
duration,
|
|
14
|
+
});
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
const endTime = performance.now();
|
|
19
|
+
console.error("");
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export { measureRouteExecution };
|
|
@@ -1,13 +1,158 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ZodType, z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* A schema validator class that provides multiple validation methods for Zod schemas.
|
|
4
|
+
*
|
|
5
|
+
* @template T - A type that extends ZodType.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { z } from "zod";
|
|
10
|
+
*
|
|
11
|
+
* const userSchema = z.object({
|
|
12
|
+
* name: z.string().min(1, "Name is required"),
|
|
13
|
+
* email: z.string().email("Invalid email"),
|
|
14
|
+
* age: z.number().min(18, "Must be at least 18")
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* const validator = new SchemaValidator(userSchema);
|
|
18
|
+
*
|
|
19
|
+
* // Check if data is valid without throwing
|
|
20
|
+
* const isValid = validator.isValid({ name: "John", email: "john@example.com", age: 25 });
|
|
21
|
+
*
|
|
22
|
+
* // Validate and throw ServerError on failure
|
|
23
|
+
* try {
|
|
24
|
+
* const validData = validator.validate({ name: "John", email: "john@example.com", age: 25 });
|
|
25
|
+
* } catch (error) {
|
|
26
|
+
* console.error(error.message);
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* // Form validation with UnprocessableEntity error
|
|
30
|
+
* try {
|
|
31
|
+
* const formData = validator.formValidate(requestBody);
|
|
32
|
+
* } catch (error) {
|
|
33
|
+
* // Returns structured error with fieldErrors for forms
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare class SchemaValidator<T extends ZodType> {
|
|
3
38
|
readonly schema: T;
|
|
4
39
|
functionName: string;
|
|
5
40
|
callerInfo: string;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a new SchemaValidator instance.
|
|
43
|
+
*
|
|
44
|
+
* @param {T} schema - The Zod schema to use for validation.
|
|
45
|
+
*/
|
|
6
46
|
constructor(schema: T);
|
|
47
|
+
/**
|
|
48
|
+
* Checks if the provided data is valid according to the schema without throwing errors.
|
|
49
|
+
*
|
|
50
|
+
* @param {any} data - The data to validate.
|
|
51
|
+
*
|
|
52
|
+
* @returns {boolean} True if the data is valid, false otherwise.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const validator = new SchemaValidator(userSchema);
|
|
57
|
+
* const isValid = validator.isValid({ name: "John", email: "invalid-email" });
|
|
58
|
+
* console.log(isValid); // false
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
7
61
|
isValid(data: any): boolean;
|
|
8
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Safely validates data and returns the complete parse result without throwing errors.
|
|
64
|
+
*
|
|
65
|
+
* @param {any} data - The data to validate.
|
|
66
|
+
*
|
|
67
|
+
* @returns {z.ZodSafeParseResult<z.infer<T>>} The Zod safe parse result containing success status and data or error.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const validator = new SchemaValidator(userSchema);
|
|
72
|
+
* const result = validator.safeValidate({ name: "", email: "john@example.com" });
|
|
73
|
+
*
|
|
74
|
+
* if (result.success) {
|
|
75
|
+
* console.log(result.data); // Validated data
|
|
76
|
+
* } else {
|
|
77
|
+
* console.log(result.error.issues); // Validation errors
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
safeValidate(data: any): z.ZodSafeParseResult<z.infer<T>>;
|
|
82
|
+
/**
|
|
83
|
+
* Validates data and returns the parsed result, throwing a ServerError on validation failure.
|
|
84
|
+
*
|
|
85
|
+
* @param {any} data - The data to validate.
|
|
86
|
+
*
|
|
87
|
+
* @returns {z.infer<T>} The validated and parsed data.
|
|
88
|
+
*
|
|
89
|
+
* @throws {ServerError} When validation fails, with a formatted error message.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const validator = new SchemaValidator(userSchema);
|
|
94
|
+
*
|
|
95
|
+
* try {
|
|
96
|
+
* const validUser = validator.validate({ name: "John", email: "john@example.com", age: 25 });
|
|
97
|
+
* console.log(validUser); // { name: "John", email: "john@example.com", age: 25 }
|
|
98
|
+
* } catch (error) {
|
|
99
|
+
* console.error(error.message); // "Error validating:\n-> name: String must contain at least 1 character(s)"
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
9
103
|
validate(data: any): z.infer<T>;
|
|
104
|
+
/**
|
|
105
|
+
* Validates form data and returns the parsed result, throwing an UnprocessableEntity error on validation failure.
|
|
106
|
+
* This method is specifically designed for form validation in web applications.
|
|
107
|
+
*
|
|
108
|
+
* @param {any} data - The form data to validate.
|
|
109
|
+
* @param {string} [message] - Optional custom error message.
|
|
110
|
+
*
|
|
111
|
+
* @returns {z.infer<T>} The validated and parsed form data.
|
|
112
|
+
*
|
|
113
|
+
* @throws {UnprocessableEntity} When validation fails, with structured field errors for form handling.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const validator = new SchemaValidator(userSchema);
|
|
118
|
+
*
|
|
119
|
+
* try {
|
|
120
|
+
* const validFormData = validator.formValidate(requestBody, "User data is invalid");
|
|
121
|
+
* console.log(validFormData);
|
|
122
|
+
* } catch (error) {
|
|
123
|
+
* // UnprocessableEntity with fieldErrors, fields, and scrollTo data
|
|
124
|
+
* console.log(error.fieldErrors); // { name: "Name is required", email: "Invalid email" }
|
|
125
|
+
* console.log(error.data.scrollTo); // "name" (first error field)
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
10
129
|
formValidate(data: any, message?: string): z.infer<T>;
|
|
130
|
+
/**
|
|
131
|
+
* Asynchronously validates form data and returns the parsed result, throwing an UnprocessableEntity error on validation failure.
|
|
132
|
+
* This method is the async version of formValidate, designed for form validation with async schemas.
|
|
133
|
+
*
|
|
134
|
+
* @param {any} data - The form data to validate.
|
|
135
|
+
* @param {string} [message] - Optional custom error message.
|
|
136
|
+
*
|
|
137
|
+
* @returns {Promise<z.infer<T>>} A promise that resolves to the validated and parsed form data.
|
|
138
|
+
*
|
|
139
|
+
* @throws {UnprocessableEntity} When validation fails, with structured field errors for form handling.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const validator = new SchemaValidator(userSchemaWithAsyncValidation);
|
|
144
|
+
*
|
|
145
|
+
* try {
|
|
146
|
+
* const validFormData = await validator.formAsyncValidate(requestBody, "User data is invalid");
|
|
147
|
+
* console.log(validFormData);
|
|
148
|
+
* } catch (error) {
|
|
149
|
+
* // UnprocessableEntity with fieldErrors, fields, and scrollTo data
|
|
150
|
+
* console.log(error.fieldErrors); // { name: "Name is required", email: "Invalid email" }
|
|
151
|
+
* console.log(error.data.scrollTo); // "name" (first error field)
|
|
152
|
+
* }
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
formAsyncValidate(data: any, message?: string): Promise<z.infer<T>>;
|
|
11
156
|
}
|
|
12
157
|
export { SchemaValidator };
|
|
13
158
|
//# sourceMappingURL=schemaValidator.d.ts.map
|