@eggjs/ajv-decorator 4.0.0-beta.7 → 4.0.0-beta.9

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.
@@ -1,48 +1,45 @@
1
- //#region src/enum/TransformEnum.d.ts
2
1
  /**
3
2
  * This keyword allows a string to be modified during validation.
4
3
  * This keyword applies only to strings. If the data is not a string, the transform keyword is ignored.
5
4
  * @see https://github.com/ajv-validator/ajv-keywords?tab=readme-ov-file#transform
6
5
  */
7
- declare enum TransformEnum {
8
- /** remove whitespace from start and end */
9
- trim = "trim",
10
- /** remove whitespace from start */
11
- trimStart = "trimStart",
12
- /**
13
- * @alias trimStart
14
- */
15
- trimLeft = "trimLeft",
16
- /** remove whitespace from end */
17
- trimEnd = "trimEnd",
18
- /**
19
- * @alias trimEnd
20
- */
21
- trimRight = "trimRight",
22
- /** convert to lower case */
23
- toLowerCase = "toLowerCase",
24
- /** convert to upper case */
25
- toUpperCase = "toUpperCase",
26
- /**
27
- * change string case to be equal to one of `enum` values in the schema
28
- *
29
- * **NOTE**: requires that all allowed values are unique when case insensitive
30
- * ```ts
31
- * const schema = {
32
- * type: "array",
33
- * items: {
34
- * type: "string",
35
- * transform: ["trim", Transform.toEnumCase],
36
- * enum: ["pH"],
37
- * },
38
- * };
39
- *
40
- * const data = ["ph", " Ph", "PH", "pH "];
41
- * ajv.validate(schema, data);
42
- * console.log(data) // ['pH','pH','pH','pH'];
43
- * ```
44
- */
45
- toEnumCase = "toEnumCase",
6
+ export declare enum TransformEnum {
7
+ /** remove whitespace from start and end */
8
+ trim = "trim",
9
+ /** remove whitespace from start */
10
+ trimStart = "trimStart",
11
+ /**
12
+ * @alias trimStart
13
+ */
14
+ trimLeft = "trimLeft",
15
+ /** remove whitespace from end */
16
+ trimEnd = "trimEnd",
17
+ /**
18
+ * @alias trimEnd
19
+ */
20
+ trimRight = "trimRight",
21
+ /** convert to lower case */
22
+ toLowerCase = "toLowerCase",
23
+ /** convert to upper case */
24
+ toUpperCase = "toUpperCase",
25
+ /**
26
+ * change string case to be equal to one of `enum` values in the schema
27
+ *
28
+ * **NOTE**: requires that all allowed values are unique when case insensitive
29
+ * ```ts
30
+ * const schema = {
31
+ * type: "array",
32
+ * items: {
33
+ * type: "string",
34
+ * transform: ["trim", Transform.toEnumCase],
35
+ * enum: ["pH"],
36
+ * },
37
+ * };
38
+ *
39
+ * const data = ["ph", " Ph", "PH", "pH "];
40
+ * ajv.validate(schema, data);
41
+ * console.log(data) // ['pH','pH','pH','pH'];
42
+ * ```
43
+ */
44
+ toEnumCase = "toEnumCase"
46
45
  }
47
- //#endregion
48
- export { TransformEnum };
@@ -1,50 +1,47 @@
1
- //#region src/enum/TransformEnum.ts
2
1
  /**
3
- * This keyword allows a string to be modified during validation.
4
- * This keyword applies only to strings. If the data is not a string, the transform keyword is ignored.
5
- * @see https://github.com/ajv-validator/ajv-keywords?tab=readme-ov-file#transform
6
- */
7
- let TransformEnum = /* @__PURE__ */ function(TransformEnum$1) {
8
- /** remove whitespace from start and end */
9
- TransformEnum$1["trim"] = "trim";
10
- /** remove whitespace from start */
11
- TransformEnum$1["trimStart"] = "trimStart";
12
- /**
13
- * @alias trimStart
14
- */
15
- TransformEnum$1["trimLeft"] = "trimLeft";
16
- /** remove whitespace from end */
17
- TransformEnum$1["trimEnd"] = "trimEnd";
18
- /**
19
- * @alias trimEnd
20
- */
21
- TransformEnum$1["trimRight"] = "trimRight";
22
- /** convert to lower case */
23
- TransformEnum$1["toLowerCase"] = "toLowerCase";
24
- /** convert to upper case */
25
- TransformEnum$1["toUpperCase"] = "toUpperCase";
26
- /**
27
- * change string case to be equal to one of `enum` values in the schema
28
- *
29
- * **NOTE**: requires that all allowed values are unique when case insensitive
30
- * ```ts
31
- * const schema = {
32
- * type: "array",
33
- * items: {
34
- * type: "string",
35
- * transform: ["trim", Transform.toEnumCase],
36
- * enum: ["pH"],
37
- * },
38
- * };
39
- *
40
- * const data = ["ph", " Ph", "PH", "pH "];
41
- * ajv.validate(schema, data);
42
- * console.log(data) // ['pH','pH','pH','pH'];
43
- * ```
44
- */
45
- TransformEnum$1["toEnumCase"] = "toEnumCase";
46
- return TransformEnum$1;
47
- }({});
48
-
49
- //#endregion
50
- export { TransformEnum };
2
+ * This keyword allows a string to be modified during validation.
3
+ * This keyword applies only to strings. If the data is not a string, the transform keyword is ignored.
4
+ * @see https://github.com/ajv-validator/ajv-keywords?tab=readme-ov-file#transform
5
+ */
6
+ export var TransformEnum;
7
+ (function (TransformEnum) {
8
+ /** remove whitespace from start and end */
9
+ TransformEnum["trim"] = "trim";
10
+ /** remove whitespace from start */
11
+ TransformEnum["trimStart"] = "trimStart";
12
+ /**
13
+ * @alias trimStart
14
+ */
15
+ TransformEnum["trimLeft"] = "trimLeft";
16
+ /** remove whitespace from end */
17
+ TransformEnum["trimEnd"] = "trimEnd";
18
+ /**
19
+ * @alias trimEnd
20
+ */
21
+ TransformEnum["trimRight"] = "trimRight";
22
+ /** convert to lower case */
23
+ TransformEnum["toLowerCase"] = "toLowerCase";
24
+ /** convert to upper case */
25
+ TransformEnum["toUpperCase"] = "toUpperCase";
26
+ /**
27
+ * change string case to be equal to one of `enum` values in the schema
28
+ *
29
+ * **NOTE**: requires that all allowed values are unique when case insensitive
30
+ * ```ts
31
+ * const schema = {
32
+ * type: "array",
33
+ * items: {
34
+ * type: "string",
35
+ * transform: ["trim", Transform.toEnumCase],
36
+ * enum: ["pH"],
37
+ * },
38
+ * };
39
+ *
40
+ * const data = ["ph", " Ph", "PH", "pH "];
41
+ * ajv.validate(schema, data);
42
+ * console.log(data) // ['pH','pH','pH','pH'];
43
+ * ```
44
+ */
45
+ TransformEnum["toEnumCase"] = "toEnumCase";
46
+ })(TransformEnum || (TransformEnum = {}));
47
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVHJhbnNmb3JtRW51bS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbnVtL1RyYW5zZm9ybUVudW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7R0FJRztBQUNILE1BQU0sQ0FBTixJQUFZLGFBdUNYO0FBdkNELFdBQVksYUFBYTtJQUN2QiwyQ0FBMkM7SUFDM0MsOEJBQWEsQ0FBQTtJQUNiLG1DQUFtQztJQUNuQyx3Q0FBdUIsQ0FBQTtJQUN2Qjs7T0FFRztJQUNILHNDQUFxQixDQUFBO0lBQ3JCLGlDQUFpQztJQUNqQyxvQ0FBbUIsQ0FBQTtJQUNuQjs7T0FFRztJQUNILHdDQUF1QixDQUFBO0lBQ3ZCLDRCQUE0QjtJQUM1Qiw0Q0FBMkIsQ0FBQTtJQUMzQiw0QkFBNEI7SUFDNUIsNENBQTJCLENBQUE7SUFDM0I7Ozs7Ozs7Ozs7Ozs7Ozs7OztPQWtCRztJQUNILDBDQUF5QixDQUFBO0FBQzNCLENBQUMsRUF2Q1csYUFBYSxLQUFiLGFBQWEsUUF1Q3hCIn0=
@@ -0,0 +1 @@
1
+ export * from './TransformEnum.ts';
@@ -0,0 +1,2 @@
1
+ export * from "./TransformEnum.js";
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZW51bS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG9CQUFvQixDQUFDIn0=
@@ -1,16 +1,12 @@
1
- import { ErrorObject } from "ajv/dist/2019.js";
2
-
3
- //#region src/error/AjvInvalidParamError.d.ts
4
- interface AjvInvalidParamErrorOptions {
5
- errorData: unknown;
6
- currentSchema: string;
7
- errors: ErrorObject[];
1
+ import { type ErrorObject } from 'ajv/dist/2019.js';
2
+ export interface AjvInvalidParamErrorOptions {
3
+ errorData: unknown;
4
+ currentSchema: string;
5
+ errors: ErrorObject[];
8
6
  }
9
- declare class AjvInvalidParamError extends Error {
10
- errorData: unknown;
11
- currentSchema: string;
12
- errors: ErrorObject[];
13
- constructor(message: string, options: AjvInvalidParamErrorOptions);
7
+ export declare class AjvInvalidParamError extends Error {
8
+ errorData: unknown;
9
+ currentSchema: string;
10
+ errors: ErrorObject[];
11
+ constructor(message: string, options: AjvInvalidParamErrorOptions);
14
12
  }
15
- //#endregion
16
- export { AjvInvalidParamError, AjvInvalidParamErrorOptions };
@@ -1,18 +1,14 @@
1
- import "ajv/dist/2019.js";
2
-
3
- //#region src/error/AjvInvalidParamError.ts
4
- var AjvInvalidParamError = class extends Error {
5
- errorData;
6
- currentSchema;
7
- errors;
8
- constructor(message, options) {
9
- super(message);
10
- this.name = this.constructor.name;
11
- this.errorData = options.errorData;
12
- this.currentSchema = options.currentSchema;
13
- this.errors = options.errors;
14
- }
15
- };
16
-
17
- //#endregion
18
- export { AjvInvalidParamError };
1
+ import {} from 'ajv/dist/2019.js';
2
+ export class AjvInvalidParamError extends Error {
3
+ errorData;
4
+ currentSchema;
5
+ errors;
6
+ constructor(message, options) {
7
+ super(message);
8
+ this.name = this.constructor.name;
9
+ this.errorData = options.errorData;
10
+ this.currentSchema = options.currentSchema;
11
+ this.errors = options.errors;
12
+ }
13
+ }
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWp2SW52YWxpZFBhcmFtRXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZXJyb3IvQWp2SW52YWxpZFBhcmFtRXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFvQixNQUFNLGtCQUFrQixDQUFDO0FBUXBELE1BQU0sT0FBTyxvQkFBcUIsU0FBUSxLQUFLO0lBQzdDLFNBQVMsQ0FBVTtJQUNuQixhQUFhLENBQVM7SUFDdEIsTUFBTSxDQUFnQjtJQUV0QixZQUFZLE9BQWUsRUFBRSxPQUFvQztRQUMvRCxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDZixJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDO1FBQ2xDLElBQUksQ0FBQyxTQUFTLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQztRQUNuQyxJQUFJLENBQUMsYUFBYSxHQUFHLE9BQU8sQ0FBQyxhQUFhLENBQUM7UUFDM0MsSUFBSSxDQUFDLE1BQU0sR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDO0lBQy9CLENBQUM7Q0FDRiJ9
@@ -0,0 +1 @@
1
+ export * from './AjvInvalidParamError.ts';
@@ -1,3 +1,2 @@
1
- import { AjvInvalidParamError } from "./AjvInvalidParamError.js";
2
-
3
- export { };
1
+ export * from "./AjvInvalidParamError.js";
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZXJyb3IvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYywyQkFBMkIsQ0FBQyJ9
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { TransformEnum } from "./enum/TransformEnum.js";
2
- import { AjvInvalidParamError, AjvInvalidParamErrorOptions } from "./error/AjvInvalidParamError.js";
3
- import { Ajv } from "./type/Ajv.js";
4
- export * from "@sinclair/typebox";
5
- export { Ajv, AjvInvalidParamError, AjvInvalidParamErrorOptions, TransformEnum };
1
+ export * from '@sinclair/typebox';
2
+ export * from './enum/index.ts';
3
+ export * from './error/index.ts';
4
+ export * from './type/index.ts';
package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
- import { TransformEnum } from "./enum/TransformEnum.js";
2
- import { AjvInvalidParamError } from "./error/AjvInvalidParamError.js";
3
- import "./error/index.js";
4
-
5
- export * from "@sinclair/typebox"
6
-
7
- export { AjvInvalidParamError, TransformEnum };
1
+ export * from '@sinclair/typebox';
2
+ export * from "./enum/index.js";
3
+ export * from "./error/index.js";
4
+ export * from "./type/index.js";
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxtQkFBbUIsQ0FBQztBQUNsQyxjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsa0JBQWtCLENBQUM7QUFDakMsY0FBYyxpQkFBaUIsQ0FBQyJ9
@@ -1,8 +1,4 @@
1
- import { Schema } from "ajv/dist/2019.js";
2
-
3
- //#region src/type/Ajv.d.ts
4
- interface Ajv {
5
- validate(schema: Schema, data: unknown): void;
1
+ import type { Schema } from 'ajv/dist/2019.js';
2
+ export interface Ajv {
3
+ validate(schema: Schema, data: unknown): void;
6
4
  }
7
- //#endregion
8
- export { Ajv };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWp2LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R5cGUvQWp2LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -0,0 +1 @@
1
+ export * from './Ajv.ts';
@@ -0,0 +1,2 @@
1
+ export * from "./Ajv.js";
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFVBQVUsQ0FBQyJ9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggjs/ajv-decorator",
3
- "version": "4.0.0-beta.7",
3
+ "version": "4.0.0-beta.9",
4
4
  "description": "tegg ajv decorator",
5
5
  "keywords": [
6
6
  "egg",
@@ -48,7 +48,7 @@
48
48
  "types": "./dist/index.d.ts",
49
49
  "scripts": {
50
50
  "clean": "rimraf dist",
51
- "build": "tsdown",
51
+ "build": "tsdown && rimraf dist && tsc -b --clean && tsc",
52
52
  "typecheck": "tsc --noEmit"
53
53
  }
54
54
  }