two-stroke 5.0.4 → 5.0.6
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/package.json +8 -8
- package/src/open-api.ts +57 -50
package/package.json
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@cloudflare/vitest-pool-workers": "^0.8.34",
|
|
12
|
-
"@cloudflare/workers-types": "^4.
|
|
12
|
+
"@cloudflare/workers-types": "^4.20250603.0",
|
|
13
13
|
"@sentry/cli": "^2.46.0",
|
|
14
14
|
"@types/node": "^22.15.29",
|
|
15
|
-
"@typescript-eslint/eslint-plugin": "^8.33.
|
|
16
|
-
"@typescript-eslint/parser": "^8.33.
|
|
17
|
-
"@vitest/coverage-istanbul": "^3.
|
|
15
|
+
"@typescript-eslint/eslint-plugin": "^8.33.1",
|
|
16
|
+
"@typescript-eslint/parser": "^8.33.1",
|
|
17
|
+
"@vitest/coverage-istanbul": "^3.2.0",
|
|
18
18
|
"eslint-config-prettier": "^10.1.5",
|
|
19
|
-
"eslint-config-two-stroke": "^1.1.
|
|
19
|
+
"eslint-config-two-stroke": "^1.1.21",
|
|
20
20
|
"eslint-config-typescript": "^3.0.0",
|
|
21
21
|
"jose": "^6.0.11",
|
|
22
22
|
"jwk-subtle": "^1.0.7",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"openapi-typescript": "^7.8.0",
|
|
26
26
|
"pbkdf-subtle": "^1.0.0",
|
|
27
27
|
"toucan-js": "^4.1.1",
|
|
28
|
-
"zod": "^3.25.
|
|
28
|
+
"zod": "^3.25.49"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@sentry/cli": ">=2",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"name": "two-stroke",
|
|
50
50
|
"packageManager": "yarn@4.6.0",
|
|
51
51
|
"type": "module",
|
|
52
|
-
"version": "5.0.
|
|
52
|
+
"version": "5.0.6",
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/eslint": "^9.6.1",
|
|
55
55
|
"eslint": "^9.28.0",
|
|
56
56
|
"prettier": "^3.5.3",
|
|
57
57
|
"typescript": "^5.8.3",
|
|
58
|
-
"vitest": "^3.
|
|
58
|
+
"vitest": "^3.2.0"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/src/open-api.ts
CHANGED
|
@@ -25,61 +25,68 @@ export const openAPI =
|
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
paths: Object.fromEntries(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
28
|
+
Object.entries(Object.groupBy(routes, ({ path }) => path)).map(
|
|
29
|
+
([path, rs]) => [
|
|
30
|
+
path,
|
|
31
|
+
Object.fromEntries(
|
|
32
|
+
(rs ?? []).map((r) => [
|
|
33
|
+
r.method.toLocaleLowerCase(),
|
|
34
|
+
{
|
|
35
|
+
parameters: [
|
|
36
|
+
...Object.entries(
|
|
37
|
+
(r.params?.shape ?? {}) as Record<string, ZodType>,
|
|
38
|
+
).map(([k, v]) => ({
|
|
39
|
+
name: k,
|
|
40
|
+
in: "query",
|
|
41
|
+
required: !v.safeParse(undefined).success,
|
|
42
|
+
schema: z.toJSONSchema(v, { io: "input" }),
|
|
43
|
+
})),
|
|
44
|
+
...Array.from(
|
|
45
|
+
r.path.matchAll(/\/{(?<name>[^}]*)}/g),
|
|
46
|
+
(match) => ({
|
|
47
|
+
name: match.groups!.name,
|
|
48
|
+
in: "path",
|
|
49
|
+
required: true,
|
|
50
|
+
schema: {
|
|
51
|
+
type: "string",
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
),
|
|
55
|
+
],
|
|
56
|
+
...(r.auth === noAuth ? {} : { security: [{ auth: [] }] }),
|
|
57
|
+
...(r.method === "POST" || r.method === "PUT"
|
|
58
|
+
? {
|
|
59
|
+
requestBody: {
|
|
60
|
+
required: true,
|
|
61
|
+
content: {
|
|
62
|
+
"application/json": r.input
|
|
63
|
+
? {
|
|
64
|
+
schema: z.toJSONSchema(r.input, {
|
|
65
|
+
io: "input",
|
|
66
|
+
}),
|
|
67
|
+
}
|
|
68
|
+
: undefined,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
: {}),
|
|
73
|
+
responses: {
|
|
74
|
+
"200": {
|
|
75
|
+
description: "OK",
|
|
58
76
|
content: {
|
|
59
|
-
"application/json":
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
: undefined,
|
|
77
|
+
"application/json": {
|
|
78
|
+
schema: z.toJSONSchema(r.output),
|
|
79
|
+
},
|
|
64
80
|
},
|
|
65
81
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
responses: {
|
|
69
|
-
"200": {
|
|
70
|
-
description: "OK",
|
|
71
|
-
content: {
|
|
72
|
-
"application/json": {
|
|
73
|
-
schema: z.toJSONSchema(r.output),
|
|
74
|
-
},
|
|
82
|
+
"400": status400,
|
|
83
|
+
"500": status500,
|
|
75
84
|
},
|
|
76
85
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
]),
|
|
86
|
+
]),
|
|
87
|
+
),
|
|
88
|
+
],
|
|
89
|
+
),
|
|
83
90
|
),
|
|
84
91
|
},
|
|
85
92
|
});
|