@eggjs/ajv-decorator 4.0.0-beta.35 → 4.0.0-beta.36

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,46 +1,49 @@
1
+ //#region src/enum/TransformEnum.d.ts
1
2
  /**
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 declare const TransformEnum: {
7
- /** remove whitespace from start and end */
8
- trim: string;
9
- /** remove whitespace from start */
10
- trimStart: string;
11
- /**
12
- * @alias trimStart
13
- */
14
- trimLeft: string;
15
- /** remove whitespace from end */
16
- trimEnd: string;
17
- /**
18
- * @alias trimEnd
19
- */
20
- trimRight: string;
21
- /** convert to lower case */
22
- toLowerCase: string;
23
- /** convert to upper case */
24
- toUpperCase: string;
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: string;
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
+ declare const TransformEnum: {
8
+ /** remove whitespace from start and end */
9
+ trim: string;
10
+ /** remove whitespace from start */
11
+ trimStart: string;
12
+ /**
13
+ * @alias trimStart
14
+ */
15
+ trimLeft: string;
16
+ /** remove whitespace from end */
17
+ trimEnd: string;
18
+ /**
19
+ * @alias trimEnd
20
+ */
21
+ trimRight: string;
22
+ /** convert to lower case */
23
+ toLowerCase: string;
24
+ /** convert to upper case */
25
+ toUpperCase: string;
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: string;
45
46
  };
46
- export type TransformEnum = (typeof TransformEnum)[keyof typeof TransformEnum];
47
+ type TransformEnum = (typeof TransformEnum)[keyof typeof TransformEnum];
48
+ //#endregion
49
+ export { TransformEnum };
@@ -1,46 +1,19 @@
1
+ //#region src/enum/TransformEnum.ts
1
2
  /**
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 const 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',
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
+ const TransformEnum = {
8
+ trim: "trim",
9
+ trimStart: "trimStart",
10
+ trimLeft: "trimLeft",
11
+ trimEnd: "trimEnd",
12
+ trimRight: "trimRight",
13
+ toLowerCase: "toLowerCase",
14
+ toUpperCase: "toUpperCase",
15
+ toEnumCase: "toEnumCase"
45
16
  };
46
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVHJhbnNmb3JtRW51bS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbnVtL1RyYW5zZm9ybUVudW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7R0FJRztBQUNILE1BQU0sQ0FBQyxNQUFNLGFBQWEsR0FBRztJQUMzQiwyQ0FBMkM7SUFDM0MsSUFBSSxFQUFFLE1BQU07SUFDWixtQ0FBbUM7SUFDbkMsU0FBUyxFQUFFLFdBQVc7SUFDdEI7O09BRUc7SUFDSCxRQUFRLEVBQUUsVUFBVTtJQUNwQixpQ0FBaUM7SUFDakMsT0FBTyxFQUFFLFNBQVM7SUFDbEI7O09BRUc7SUFDSCxTQUFTLEVBQUUsV0FBVztJQUN0Qiw0QkFBNEI7SUFDNUIsV0FBVyxFQUFFLGFBQWE7SUFDMUIsNEJBQTRCO0lBQzVCLFdBQVcsRUFBRSxhQUFhO0lBQzFCOzs7Ozs7Ozs7Ozs7Ozs7Ozs7T0FrQkc7SUFDSCxVQUFVLEVBQUUsWUFBWTtDQUN6QixDQUFDIn0=
17
+
18
+ //#endregion
19
+ export { TransformEnum };
@@ -1,12 +1,16 @@
1
- import { type ErrorObject } from 'ajv/dist/2019.js';
2
- export interface AjvInvalidParamErrorOptions {
3
- errorData: unknown;
4
- currentSchema: string;
5
- errors: ErrorObject[];
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[];
6
8
  }
7
- export declare class AjvInvalidParamError extends Error {
8
- errorData: unknown;
9
- currentSchema: string;
10
- errors: ErrorObject[];
11
- constructor(message: string, options: AjvInvalidParamErrorOptions);
9
+ declare class AjvInvalidParamError extends Error {
10
+ errorData: unknown;
11
+ currentSchema: string;
12
+ errors: ErrorObject[];
13
+ constructor(message: string, options: AjvInvalidParamErrorOptions);
12
14
  }
15
+ //#endregion
16
+ export { AjvInvalidParamError, AjvInvalidParamErrorOptions };
@@ -1,15 +1,19 @@
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
- Error.captureStackTrace(this, this.constructor);
13
- }
14
- }
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWp2SW52YWxpZFBhcmFtRXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZXJyb3IvQWp2SW52YWxpZFBhcmFtRXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFvQixNQUFNLGtCQUFrQixDQUFDO0FBUXBELE1BQU0sT0FBTyxvQkFBcUIsU0FBUSxLQUFLO0lBQzdDLFNBQVMsQ0FBVTtJQUNuQixhQUFhLENBQVM7SUFDdEIsTUFBTSxDQUFnQjtJQUV0QixZQUFZLE9BQWUsRUFBRSxPQUFvQztRQUMvRCxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDZixJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDO1FBQ2xDLElBQUksQ0FBQyxTQUFTLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQztRQUNuQyxJQUFJLENBQUMsYUFBYSxHQUFHLE9BQU8sQ0FBQyxhQUFhLENBQUM7UUFDM0MsSUFBSSxDQUFDLE1BQU0sR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDO1FBQzdCLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLFdBQVcsQ0FBQyxDQUFDO0lBQ2xELENBQUM7Q0FDRiJ9
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
+ Error.captureStackTrace(this, this.constructor);
15
+ }
16
+ };
17
+
18
+ //#endregion
19
+ export { AjvInvalidParamError };
@@ -1 +1 @@
1
- export * from './AjvInvalidParamError.ts';
1
+ import { AjvInvalidParamError, AjvInvalidParamErrorOptions } from "./AjvInvalidParamError.js";
@@ -1,2 +1,3 @@
1
- export * from "./AjvInvalidParamError.js";
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZXJyb3IvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYywyQkFBMkIsQ0FBQyJ9
1
+ import { AjvInvalidParamError } from "./AjvInvalidParamError.js";
2
+
3
+ export { };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- export * from '@sinclair/typebox';
2
- export * from './enum/index.ts';
3
- export * from './error/index.ts';
4
- export * from './type/index.ts';
1
+ import { TransformEnum } from "./enum/TransformEnum.js";
2
+ import { AjvInvalidParamError, AjvInvalidParamErrorOptions } from "./error/AjvInvalidParamError.js";
3
+ import "./error/index.js";
4
+ import { Ajv } from "./type/Ajv.js";
5
+ import "./type/index.js";
6
+ export * from "typebox";
7
+ export { Ajv, AjvInvalidParamError, AjvInvalidParamErrorOptions, TransformEnum };
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
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
+ import { TransformEnum } from "./enum/TransformEnum.js";
2
+ import { AjvInvalidParamError } from "./error/AjvInvalidParamError.js";
3
+ import "./error/index.js";
4
+
5
+ export * from "typebox"
6
+
7
+ export { AjvInvalidParamError, TransformEnum };
@@ -1,4 +1,8 @@
1
- import type { Schema } from 'ajv/dist/2019.js';
2
- export interface Ajv {
3
- validate(schema: Schema, data: unknown): void;
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;
4
6
  }
7
+ //#endregion
8
+ export { Ajv };
@@ -1 +1 @@
1
- export * from './Ajv.ts';
1
+ import { Ajv } from "./Ajv.js";
package/package.json CHANGED
@@ -1,54 +1,50 @@
1
1
  {
2
2
  "name": "@eggjs/ajv-decorator",
3
- "version": "4.0.0-beta.35",
3
+ "version": "4.0.0-beta.36",
4
4
  "description": "tegg ajv decorator",
5
5
  "keywords": [
6
- "egg",
7
- "typescript",
6
+ "ajv",
8
7
  "decorator",
8
+ "egg",
9
9
  "tegg",
10
- "ajv"
10
+ "typescript"
11
11
  ],
12
- "type": "module",
13
- "exports": {
14
- ".": "./dist/index.js",
15
- "./package.json": "./package.json"
16
- },
17
- "files": [
18
- "dist"
19
- ],
20
- "license": "MIT",
21
12
  "homepage": "https://github.com/eggjs/egg/tree/next/tegg/core/ajv-decorator",
22
13
  "bugs": {
23
14
  "url": "https://github.com/eggjs/egg/issues"
24
15
  },
16
+ "license": "MIT",
25
17
  "repository": {
26
18
  "type": "git",
27
19
  "url": "git+https://github.com/eggjs/egg.git",
28
20
  "directory": "tegg/core/ajv-decorator"
29
21
  },
30
- "engines": {
31
- "node": ">=22.18.0"
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "type": "module",
26
+ "main": "./dist/index.js",
27
+ "module": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": "./dist/index.js",
31
+ "./package.json": "./package.json"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
32
35
  },
33
36
  "dependencies": {
34
- "@sinclair/typebox": "^0.34.41",
35
- "ajv": "^8.8.2"
37
+ "ajv": "^8.8.2",
38
+ "typebox": "^1.0.65"
36
39
  },
37
40
  "devDependencies": {
38
- "@types/node": "^24.10.1",
39
- "typescript": "^5.9.3",
40
- "tsdown": "^0.17.0",
41
- "unplugin-unused": "^0.5.4"
41
+ "@types/node": "^24.10.2",
42
+ "typescript": "^5.9.3"
42
43
  },
43
- "publishConfig": {
44
- "access": "public"
44
+ "engines": {
45
+ "node": ">=22.18.0"
45
46
  },
46
- "main": "./dist/index.js",
47
- "module": "./dist/index.js",
48
- "types": "./dist/index.d.ts",
49
47
  "scripts": {
50
- "clean": "rimraf dist *.tsbuildinfo",
51
- "build": "tsdown && npm run clean && tsc -p tsconfig.build.json",
52
- "typecheck": "tsc --noEmit"
48
+ "typecheck": "tsgo --noEmit"
53
49
  }
54
50
  }
@@ -1 +0,0 @@
1
- export * from './TransformEnum.ts';
@@ -1,2 +0,0 @@
1
- export * from "./TransformEnum.js";
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZW51bS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG9CQUFvQixDQUFDIn0=
package/dist/type/Ajv.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWp2LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R5cGUvQWp2LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -1,2 +0,0 @@
1
- export * from "./Ajv.js";
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFVBQVUsQ0FBQyJ9