@eggjs/tegg-ajv-plugin 4.0.0-beta.7 → 4.0.0-beta.8
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/dist/Ajv-CgZKKL0H.js +72 -0
- package/dist/Ajv-DB_-1_ty.d.ts +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/Ajv.d.ts +1 -16
- package/dist/lib/Ajv.js +1 -57
- package/package.json +5 -5
- package/dist/_virtual/_@oxc-project_runtime@0.93.0/helpers/decorate.js +0 -10
- package/dist/_virtual/_@oxc-project_runtime@0.93.0/helpers/decorateMetadata.js +0 -7
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Ajv2019 } from "ajv/dist/2019.js";
|
|
2
|
+
import addFormats from "@eggjs/ajv-formats";
|
|
3
|
+
import keyWords from "@eggjs/ajv-keywords";
|
|
4
|
+
import { AjvInvalidParamError } from "@eggjs/tegg/ajv";
|
|
5
|
+
import { AccessLevel, LifecycleInit, SingletonProto } from "@eggjs/tegg";
|
|
6
|
+
|
|
7
|
+
//#region \0@oxc-project+runtime@0.93.0/helpers/decorateMetadata.js
|
|
8
|
+
function __decorateMetadata(k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region \0@oxc-project+runtime@0.93.0/helpers/decorate.js
|
|
14
|
+
function __decorate(decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/lib/Ajv.ts
|
|
23
|
+
var _Ajv;
|
|
24
|
+
let Ajv$1 = class Ajv$2 {
|
|
25
|
+
static {
|
|
26
|
+
_Ajv = this;
|
|
27
|
+
}
|
|
28
|
+
static InvalidParamErrorClass = AjvInvalidParamError;
|
|
29
|
+
#ajvInstance;
|
|
30
|
+
_init() {
|
|
31
|
+
this.#ajvInstance = new Ajv2019();
|
|
32
|
+
keyWords(this.#ajvInstance, "transform");
|
|
33
|
+
addFormats(this.#ajvInstance, [
|
|
34
|
+
"date-time",
|
|
35
|
+
"time",
|
|
36
|
+
"date",
|
|
37
|
+
"email",
|
|
38
|
+
"hostname",
|
|
39
|
+
"ipv4",
|
|
40
|
+
"ipv6",
|
|
41
|
+
"uri",
|
|
42
|
+
"uri-reference",
|
|
43
|
+
"uuid",
|
|
44
|
+
"uri-template",
|
|
45
|
+
"json-pointer",
|
|
46
|
+
"relative-json-pointer",
|
|
47
|
+
"regex"
|
|
48
|
+
]).addKeyword("kind").addKeyword("modifier");
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Validate data with typebox Schema.
|
|
52
|
+
*
|
|
53
|
+
* If validate fail, with throw `Ajv.InvalidParamErrorClass`
|
|
54
|
+
*/
|
|
55
|
+
validate(schema, data) {
|
|
56
|
+
if (!this.#ajvInstance.validate(schema, data)) throw new _Ajv.InvalidParamErrorClass("Validation Failed", {
|
|
57
|
+
errorData: data,
|
|
58
|
+
currentSchema: JSON.stringify(schema),
|
|
59
|
+
errors: this.#ajvInstance.errors
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
__decorate([
|
|
64
|
+
LifecycleInit(),
|
|
65
|
+
__decorateMetadata("design:type", Function),
|
|
66
|
+
__decorateMetadata("design:paramtypes", []),
|
|
67
|
+
__decorateMetadata("design:returntype", void 0)
|
|
68
|
+
], Ajv$1.prototype, "_init", null);
|
|
69
|
+
Ajv$1 = _Ajv = __decorate([SingletonProto({ accessLevel: AccessLevel.PUBLIC })], Ajv$1);
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { Ajv$1 as Ajv };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Schema } from "ajv/dist/2019.js";
|
|
2
|
+
import { Ajv, AjvInvalidParamError } from "@eggjs/tegg/ajv";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/Ajv.d.ts
|
|
5
|
+
declare class Ajv$1 implements Ajv {
|
|
6
|
+
#private;
|
|
7
|
+
static InvalidParamErrorClass: typeof AjvInvalidParamError;
|
|
8
|
+
protected _init(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Validate data with typebox Schema.
|
|
11
|
+
*
|
|
12
|
+
* If validate fail, with throw `Ajv.InvalidParamErrorClass`
|
|
13
|
+
*/
|
|
14
|
+
validate(schema: Schema, data: unknown): void;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Ajv$1 as Ajv };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Ajv } from "./
|
|
1
|
+
import { Ajv } from "./Ajv-DB_-1_ty.js";
|
|
2
2
|
export { Ajv };
|
package/dist/index.js
CHANGED
package/dist/lib/Ajv.d.ts
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Ajv as Ajv$1, AjvInvalidParamError } from "@eggjs/tegg/ajv";
|
|
3
|
-
|
|
4
|
-
//#region src/lib/Ajv.d.ts
|
|
5
|
-
declare class Ajv implements Ajv$1 {
|
|
6
|
-
#private;
|
|
7
|
-
static InvalidParamErrorClass: typeof AjvInvalidParamError;
|
|
8
|
-
protected _init(): void;
|
|
9
|
-
/**
|
|
10
|
-
* Validate data with typebox Schema.
|
|
11
|
-
*
|
|
12
|
-
* If validate fail, with throw `Ajv.InvalidParamErrorClass`
|
|
13
|
-
*/
|
|
14
|
-
validate(schema: Schema, data: unknown): void;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
1
|
+
import { Ajv } from "../Ajv-DB_-1_ty.js";
|
|
17
2
|
export { Ajv };
|
package/dist/lib/Ajv.js
CHANGED
|
@@ -1,59 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.93.0/helpers/decorate.js";
|
|
3
|
-
import { Ajv2019 } from "ajv/dist/2019.js";
|
|
4
|
-
import addFormats from "@eggjs/ajv-formats";
|
|
5
|
-
import keyWords from "@eggjs/ajv-keywords";
|
|
6
|
-
import { AjvInvalidParamError } from "@eggjs/tegg/ajv";
|
|
7
|
-
import { AccessLevel, LifecycleInit, SingletonProto } from "@eggjs/tegg";
|
|
1
|
+
import { Ajv } from "../Ajv-CgZKKL0H.js";
|
|
8
2
|
|
|
9
|
-
//#region src/lib/Ajv.ts
|
|
10
|
-
var _Ajv;
|
|
11
|
-
let Ajv = class Ajv$2 {
|
|
12
|
-
static {
|
|
13
|
-
_Ajv = this;
|
|
14
|
-
}
|
|
15
|
-
static InvalidParamErrorClass = AjvInvalidParamError;
|
|
16
|
-
#ajvInstance;
|
|
17
|
-
_init() {
|
|
18
|
-
this.#ajvInstance = new Ajv2019();
|
|
19
|
-
keyWords(this.#ajvInstance, "transform");
|
|
20
|
-
addFormats(this.#ajvInstance, [
|
|
21
|
-
"date-time",
|
|
22
|
-
"time",
|
|
23
|
-
"date",
|
|
24
|
-
"email",
|
|
25
|
-
"hostname",
|
|
26
|
-
"ipv4",
|
|
27
|
-
"ipv6",
|
|
28
|
-
"uri",
|
|
29
|
-
"uri-reference",
|
|
30
|
-
"uuid",
|
|
31
|
-
"uri-template",
|
|
32
|
-
"json-pointer",
|
|
33
|
-
"relative-json-pointer",
|
|
34
|
-
"regex"
|
|
35
|
-
]).addKeyword("kind").addKeyword("modifier");
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Validate data with typebox Schema.
|
|
39
|
-
*
|
|
40
|
-
* If validate fail, with throw `Ajv.InvalidParamErrorClass`
|
|
41
|
-
*/
|
|
42
|
-
validate(schema, data) {
|
|
43
|
-
if (!this.#ajvInstance.validate(schema, data)) throw new _Ajv.InvalidParamErrorClass("Validation Failed", {
|
|
44
|
-
errorData: data,
|
|
45
|
-
currentSchema: JSON.stringify(schema),
|
|
46
|
-
errors: this.#ajvInstance.errors
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
__decorate([
|
|
51
|
-
LifecycleInit(),
|
|
52
|
-
__decorateMetadata("design:type", Function),
|
|
53
|
-
__decorateMetadata("design:paramtypes", []),
|
|
54
|
-
__decorateMetadata("design:returntype", void 0)
|
|
55
|
-
], Ajv.prototype, "_init", null);
|
|
56
|
-
Ajv = _Ajv = __decorate([SingletonProto({ accessLevel: AccessLevel.PUBLIC })], Ajv);
|
|
57
|
-
|
|
58
|
-
//#endregion
|
|
59
3
|
export { Ajv };
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"eggModule": {
|
|
11
11
|
"name": "teggAjv"
|
|
12
12
|
},
|
|
13
|
-
"version": "4.0.0-beta.
|
|
13
|
+
"version": "4.0.0-beta.8",
|
|
14
14
|
"description": "ajv plugin for egg and tegg",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"egg",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@eggjs/ajv-formats": "^3.0.1",
|
|
46
46
|
"@eggjs/ajv-keywords": "^5.1.0",
|
|
47
47
|
"ajv": "^8.17.1",
|
|
48
|
-
"@eggjs/tegg": "4.0.0-beta.
|
|
48
|
+
"@eggjs/tegg": "4.0.0-beta.8"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eggjs/mock": "beta",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"typescript": "^5.9.3",
|
|
55
55
|
"tsdown": "^0.15.6",
|
|
56
56
|
"unplugin-unused": "^0.5.3",
|
|
57
|
-
"@eggjs/tegg-
|
|
58
|
-
"@eggjs/tegg-plugin": "4.0.0-beta.
|
|
59
|
-
"@eggjs/tegg-
|
|
57
|
+
"@eggjs/tegg-config": "4.0.0-beta.8",
|
|
58
|
+
"@eggjs/tegg-controller-plugin": "4.0.0-beta.8",
|
|
59
|
+
"@eggjs/tegg-plugin": "4.0.0-beta.8"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.93.0/helpers/decorate.js
|
|
2
|
-
function __decorate(decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { __decorate };
|