@rexeus/typeweaver-types 0.0.2 → 0.0.4
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 +153 -419
- package/dist/LICENSE +202 -0
- package/dist/NOTICE +4 -0
- package/dist/index.js +169 -2156
- package/dist/lib/RequestValidator.ts +13 -2
- package/dist/lib/ResponseValidator.ts +82 -1
- package/dist/lib/Validator.ts +207 -0
- package/dist/lib/assert.ts +7 -0
- package/dist/lib/index.ts +8 -1
- package/dist/templates/Request.ejs +12 -53
- package/dist/templates/RequestValidator.ejs +12 -2
- package/dist/templates/Response.ejs +8 -0
- package/dist/templates/ResponseValidator.ejs +35 -81
- package/dist/templates/SharedResponse.ejs +8 -0
- package/package.json +15 -10
- package/dist/lib/InvalidResponseStatusCodeError.ts +0 -21
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rexeus/typeweaver-types",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "TypeScript type and Zod validator generators for
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "TypeScript type and Zod validator generators for typeweaver APIs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
16
|
"package.json",
|
|
17
|
-
"README.md"
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"NOTICE"
|
|
18
20
|
],
|
|
19
21
|
"keywords": [
|
|
20
22
|
"api",
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
"typeweaver"
|
|
27
29
|
],
|
|
28
30
|
"author": "Dennis Wentzien <dw@rexeus.com>",
|
|
29
|
-
"license": "
|
|
31
|
+
"license": "Apache-2.0",
|
|
30
32
|
"repository": {
|
|
31
33
|
"type": "git",
|
|
32
34
|
"url": "git+https://github.com/rexeus/typeweaver.git",
|
|
@@ -37,20 +39,23 @@
|
|
|
37
39
|
},
|
|
38
40
|
"homepage": "https://github.com/rexeus/typeweaver#readme",
|
|
39
41
|
"peerDependencies": {
|
|
40
|
-
"@rexeus/typeweaver-core": "^0.0.
|
|
41
|
-
"@rexeus/typeweaver-gen": "^0.0.
|
|
42
|
+
"@rexeus/typeweaver-core": "^0.0.4",
|
|
43
|
+
"@rexeus/typeweaver-gen": "^0.0.4"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
|
-
"
|
|
45
|
-
"@rexeus/typeweaver-gen": "^0.0.
|
|
46
|
+
"test-utils": "file:../test-utils",
|
|
47
|
+
"@rexeus/typeweaver-gen": "^0.0.4",
|
|
48
|
+
"@rexeus/typeweaver-core": "^0.0.4"
|
|
46
49
|
},
|
|
47
50
|
"dependencies": {
|
|
48
|
-
"
|
|
51
|
+
"case": "^1.6.3",
|
|
52
|
+
"@rexeus/typeweaver-zod-to-ts": "^0.0.4"
|
|
49
53
|
},
|
|
50
54
|
"scripts": {
|
|
51
55
|
"typecheck": "tsc --noEmit",
|
|
52
56
|
"format": "prettier --write .",
|
|
53
|
-
"build": "pkgroll --clean-dist && cp -r ./src/templates ./dist/templates && cp -r ./src/lib ./dist/lib",
|
|
57
|
+
"build": "pkgroll --clean-dist && cp -r ./src/templates ./dist/templates && cp -r ./src/lib ./dist/lib && cp ../../LICENSE ../../NOTICE ./dist/",
|
|
58
|
+
"test": "vitest --run",
|
|
54
59
|
"preversion": "npm run build"
|
|
55
60
|
}
|
|
56
61
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { IHttpResponse } from "@rexeus/typeweaver-core";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Error thrown when an HTTP response has an unexpected status code.
|
|
5
|
-
*
|
|
6
|
-
* This error is typically thrown during response validation when the
|
|
7
|
-
* actual status code doesn't match any of the expected status codes
|
|
8
|
-
* defined in the operation specification.
|
|
9
|
-
*
|
|
10
|
-
* The error includes the complete response for debugging and error handling.
|
|
11
|
-
*/
|
|
12
|
-
export class InvalidResponseStatusCodeError extends Error {
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new InvalidResponseStatusCodeError.
|
|
15
|
-
*
|
|
16
|
-
* @param response - The HTTP response with unexpected status code
|
|
17
|
-
*/
|
|
18
|
-
constructor(public response: IHttpResponse) {
|
|
19
|
-
super("Invalid response status code");
|
|
20
|
-
}
|
|
21
|
-
}
|