@kubb/agent 5.0.0-alpha.34 → 5.0.0-alpha.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.
- package/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +1790 -20812
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +16 -14
- package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
- package/.output/server/index.mjs +16 -14
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/constants.js +18 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/permessage-deflate.js +514 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/sender.js +602 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/stream.js +159 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket-server.js +540 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket.js +1388 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/package.json +69 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/wrapper.mjs +8 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/buffer-util.js +131 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/event-target.js +292 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/extension.js +203 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/limiter.js +55 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/receiver.js +706 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/subprotocol.js +62 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/validation.js +152 -0
- package/.output/server/node_modules/@clack/core/dist/index.mjs +11 -0
- package/.output/server/node_modules/@clack/core/package.json +60 -0
- package/.output/server/node_modules/@clack/prompts/dist/index.mjs +137 -0
- package/.output/server/node_modules/@clack/prompts/package.json +65 -0
- package/.output/server/node_modules/@kubb/ast/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/ast/dist/index.js +423 -0
- package/.output/server/node_modules/@kubb/ast/package.json +70 -0
- package/.output/server/node_modules/@kubb/core/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/core/dist/hooks.js +23 -0
- package/.output/server/node_modules/@kubb/core/dist/index.js +2311 -0
- package/.output/server/node_modules/@kubb/core/package.json +109 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/chunk-O_arW02_.js +17 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/defaultParser-iCpMSYCp.js +15 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/getRelativePath-NAm_Y-vp.js +55 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/index.js +653 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/onProcessExit-Cput7j2c.js +742 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers/typescript.js +101 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers.js +17 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/plugins.js +375 -0
- package/.output/server/node_modules/@kubb/fabric-core/package.json +111 -0
- package/.output/server/node_modules/@kubb/oas/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/oas/dist/index.js +918 -0
- package/.output/server/node_modules/@kubb/oas/package.json +94 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/StaticClassClient-bCe7RG_w.js +636 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/components.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/generators-BffddRNu.js +723 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/index.js +124 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/axios.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/fetch.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/config.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/package.json +153 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/components-BK_6GU4v.js +257 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/generators-D5YFtyyC.js +71 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/index.js +79 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/package.json +108 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/components-BkBIov4R.js +419 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/fakerGenerator-BztogaeO.js +200 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/index.js +141 -0
- package/.output/server/node_modules/@kubb/plugin-faker/package.json +103 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/Server-H3SwqhwF.js +178 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/generators-BqkMrcs9.js +274 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/index.js +122 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/package.json +107 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/components-DgtTZkWX.js +277 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/generators-C34kqa1L.js +161 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/index.js +84 -0
- package/.output/server/node_modules/@kubb/plugin-msw/package.json +109 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/SchemaMapper-CqMkO2T1.js +58 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/generators-D7C3CXsN.js +79 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/generators.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/getFooter-Pw3tLCiV.js +112 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/hooks.js +200 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/index.js +408 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/requestBody-pRavthCw.js +1336 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/utils.js +268 -0
- package/.output/server/node_modules/@kubb/plugin-oas/package.json +122 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/components-CpyHYGOw.js +1520 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/generators-CpiBv5eE.js +1427 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/index.js +166 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/package.json +112 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/dist/index.js +65 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/package.json +85 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/static/redoc.hbs +22 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/components-BhStIi1M.js +665 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/generators-CQClzsST.js +415 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/index.js +145 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/package.json +113 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/components-DntKBsnB.js +666 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/generators-BtTsGGrM.js +414 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/index.js +145 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/package.json +113 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/components-DRDGvgXG.js +702 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/generators-ClWZJ-YG.js +399 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/index.js +144 -0
- package/.output/server/node_modules/@kubb/plugin-swr/package.json +115 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/components-C7fu-sK1.js +723 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/index.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/plugin-CYC-FGXe.js +479 -0
- package/.output/server/node_modules/@kubb/plugin-ts/package.json +105 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/components-_AMBl0g-.js +1029 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/generators-Zb1s5Wmb.js +661 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/index.js +157 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/package.json +114 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/components-eECfXVou.js +842 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/generators-D1R6NNf2.js +290 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/index.js +175 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/templates/ToZod.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-zod/package.json +112 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/chunk-BGCRLu6H.js +38 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/index.js +525 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime-Bl0DfUmV.js +1448 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime.js +12 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/parsers.js +2 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/plugins.js +4 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/reactPlugin-QQPrjNuQ.js +17813 -0
- package/.output/server/node_modules/@kubb/react-fabric/package.json +143 -0
- package/.output/server/node_modules/@redocly/config/lib/root-config-schema.js +11 -1
- package/.output/server/node_modules/@redocly/config/package.json +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-document.js +25 -10
- package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-visitor.js +32 -29
- package/.output/server/node_modules/@redocly/openapi-core/lib/config/config.js +5 -0
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/index.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/remove-unused-components.js +47 -38
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/index.js +1 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/remove-unused-components.js +45 -41
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-http-verbs-in-paths.js +3 -1
- package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-required-schema-properties-undefined.js +41 -55
- package/.output/server/node_modules/@redocly/openapi-core/lib/walk.js +28 -16
- package/.output/server/node_modules/@redocly/openapi-core/package.json +2 -2
- package/.output/server/node_modules/buffer-from/index.js +72 -0
- package/.output/server/node_modules/buffer-from/package.json +19 -0
- package/.output/server/node_modules/fast-string-truncated-width/dist/index.js +171 -0
- package/.output/server/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
- package/.output/server/node_modules/fast-string-truncated-width/package.json +35 -0
- package/.output/server/node_modules/fast-string-width/dist/index.js +14 -0
- package/.output/server/node_modules/fast-string-width/package.json +34 -0
- package/.output/server/node_modules/fast-wrap-ansi/lib/main.js +216 -0
- package/.output/server/node_modules/fast-wrap-ansi/package.json +51 -0
- package/.output/server/node_modules/p-limit/index.js +127 -0
- package/.output/server/node_modules/p-limit/package.json +58 -0
- package/.output/server/node_modules/react-devtools-core/dist/backend.js +18302 -0
- package/.output/server/node_modules/react-devtools-core/package.json +38 -0
- package/.output/server/node_modules/sisteransi/package.json +34 -0
- package/.output/server/node_modules/sisteransi/src/index.js +58 -0
- package/.output/server/node_modules/source-map-support/package.json +31 -0
- package/.output/server/node_modules/source-map-support/source-map-support.js +625 -0
- package/.output/server/node_modules/typescript/lib/typescript.js +200276 -0
- package/.output/server/node_modules/typescript/package.json +120 -0
- package/.output/server/node_modules/yocto-queue/index.js +90 -0
- package/.output/server/node_modules/yocto-queue/package.json +48 -0
- package/.output/server/package.json +35 -4
- package/package.json +20 -20
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/buffer-util.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/event-target.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/extension.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/limiter.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/receiver.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/subprotocol.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/validation.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/constants.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/permessage-deflate.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/sender.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/stream.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket-server.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/package.json +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/wrapper.mjs +0 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
|
+
//#region src/constants.ts
|
|
3
|
+
const visitorDepths = {
|
|
4
|
+
shallow: "shallow",
|
|
5
|
+
deep: "deep"
|
|
6
|
+
};
|
|
7
|
+
const nodeKinds = {
|
|
8
|
+
root: "Root",
|
|
9
|
+
operation: "Operation",
|
|
10
|
+
schema: "Schema",
|
|
11
|
+
property: "Property",
|
|
12
|
+
parameter: "Parameter",
|
|
13
|
+
response: "Response"
|
|
14
|
+
};
|
|
15
|
+
const schemaTypes = {
|
|
16
|
+
string: "string",
|
|
17
|
+
number: "number",
|
|
18
|
+
integer: "integer",
|
|
19
|
+
bigint: "bigint",
|
|
20
|
+
boolean: "boolean",
|
|
21
|
+
null: "null",
|
|
22
|
+
any: "any",
|
|
23
|
+
unknown: "unknown",
|
|
24
|
+
void: "void",
|
|
25
|
+
object: "object",
|
|
26
|
+
array: "array",
|
|
27
|
+
tuple: "tuple",
|
|
28
|
+
union: "union",
|
|
29
|
+
intersection: "intersection",
|
|
30
|
+
enum: "enum",
|
|
31
|
+
ref: "ref",
|
|
32
|
+
date: "date",
|
|
33
|
+
datetime: "datetime",
|
|
34
|
+
time: "time",
|
|
35
|
+
uuid: "uuid",
|
|
36
|
+
email: "email",
|
|
37
|
+
url: "url",
|
|
38
|
+
blob: "blob"
|
|
39
|
+
};
|
|
40
|
+
const httpMethods = {
|
|
41
|
+
get: "GET",
|
|
42
|
+
post: "POST",
|
|
43
|
+
put: "PUT",
|
|
44
|
+
patch: "PATCH",
|
|
45
|
+
delete: "DELETE",
|
|
46
|
+
head: "HEAD",
|
|
47
|
+
options: "OPTIONS",
|
|
48
|
+
trace: "TRACE"
|
|
49
|
+
};
|
|
50
|
+
const mediaTypes = {
|
|
51
|
+
applicationJson: "application/json",
|
|
52
|
+
applicationXml: "application/xml",
|
|
53
|
+
applicationFormUrlEncoded: "application/x-www-form-urlencoded",
|
|
54
|
+
applicationOctetStream: "application/octet-stream",
|
|
55
|
+
applicationPdf: "application/pdf",
|
|
56
|
+
applicationZip: "application/zip",
|
|
57
|
+
applicationGraphql: "application/graphql",
|
|
58
|
+
multipartFormData: "multipart/form-data",
|
|
59
|
+
textPlain: "text/plain",
|
|
60
|
+
textHtml: "text/html",
|
|
61
|
+
textCsv: "text/csv",
|
|
62
|
+
textXml: "text/xml",
|
|
63
|
+
imagePng: "image/png",
|
|
64
|
+
imageJpeg: "image/jpeg",
|
|
65
|
+
imageGif: "image/gif",
|
|
66
|
+
imageWebp: "image/webp",
|
|
67
|
+
imageSvgXml: "image/svg+xml",
|
|
68
|
+
audioMpeg: "audio/mpeg",
|
|
69
|
+
videoMp4: "video/mp4"
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/factory.ts
|
|
73
|
+
/**
|
|
74
|
+
* Creates a `RootNode`.
|
|
75
|
+
*/
|
|
76
|
+
function createRoot(overrides = {}) {
|
|
77
|
+
return {
|
|
78
|
+
schemas: [],
|
|
79
|
+
operations: [],
|
|
80
|
+
...overrides,
|
|
81
|
+
kind: "Root"
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Creates an `OperationNode`.
|
|
86
|
+
*/
|
|
87
|
+
function createOperation(props) {
|
|
88
|
+
return {
|
|
89
|
+
tags: [],
|
|
90
|
+
parameters: [],
|
|
91
|
+
responses: [],
|
|
92
|
+
...props,
|
|
93
|
+
kind: "Operation"
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function createSchema(props) {
|
|
97
|
+
if (props["type"] === "object") return {
|
|
98
|
+
properties: [],
|
|
99
|
+
...props,
|
|
100
|
+
kind: "Schema"
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
...props,
|
|
104
|
+
kind: "Schema"
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Creates a `PropertyNode`. `required` defaults to `false`.
|
|
109
|
+
*/
|
|
110
|
+
function createProperty(props) {
|
|
111
|
+
return {
|
|
112
|
+
required: false,
|
|
113
|
+
...props,
|
|
114
|
+
kind: "Property"
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Creates a `ParameterNode`. `required` defaults to `false`.
|
|
119
|
+
*/
|
|
120
|
+
function createParameter(props) {
|
|
121
|
+
return {
|
|
122
|
+
required: false,
|
|
123
|
+
...props,
|
|
124
|
+
kind: "Parameter"
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Creates a `ResponseNode`.
|
|
129
|
+
*/
|
|
130
|
+
function createResponse(props) {
|
|
131
|
+
return {
|
|
132
|
+
...props,
|
|
133
|
+
kind: "Response"
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/guards.ts
|
|
138
|
+
/**
|
|
139
|
+
* Narrows a `SchemaNode` to the specific variant matching `type`.
|
|
140
|
+
*/
|
|
141
|
+
function narrowSchema(node, type) {
|
|
142
|
+
return node?.type === type ? node : void 0;
|
|
143
|
+
}
|
|
144
|
+
function isKind(kind) {
|
|
145
|
+
return (node) => node.kind === kind;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Type guard for `RootNode`.
|
|
149
|
+
*/
|
|
150
|
+
const isRootNode = isKind("Root");
|
|
151
|
+
/**
|
|
152
|
+
* Type guard for `OperationNode`.
|
|
153
|
+
*/
|
|
154
|
+
const isOperationNode = isKind("Operation");
|
|
155
|
+
/**
|
|
156
|
+
* Type guard for `SchemaNode`.
|
|
157
|
+
*/
|
|
158
|
+
const isSchemaNode = isKind("Schema");
|
|
159
|
+
/**
|
|
160
|
+
* Type guard for `PropertyNode`.
|
|
161
|
+
*/
|
|
162
|
+
const isPropertyNode = isKind("Property");
|
|
163
|
+
/**
|
|
164
|
+
* Type guard for `ParameterNode`.
|
|
165
|
+
*/
|
|
166
|
+
const isParameterNode = isKind("Parameter");
|
|
167
|
+
/**
|
|
168
|
+
* Type guard for `ResponseNode`.
|
|
169
|
+
*/
|
|
170
|
+
const isResponseNode = isKind("Response");
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/printer.ts
|
|
173
|
+
/**
|
|
174
|
+
* Creates a named printer factory. Mirrors the `definePlugin` / `defineAdapter` pattern
|
|
175
|
+
* from `@kubb/core` — wraps a builder to make options optional and separates raw options
|
|
176
|
+
* from resolved options.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* type ZodPrinter = PrinterFactoryOptions<'zod', { strict?: boolean }, { strict: boolean }, string>
|
|
181
|
+
*
|
|
182
|
+
* export const zodPrinter = definePrinter<ZodPrinter>((options) => {
|
|
183
|
+
* const { strict = true } = options
|
|
184
|
+
* return {
|
|
185
|
+
* name: 'zod',
|
|
186
|
+
* options: { strict },
|
|
187
|
+
* nodes: {
|
|
188
|
+
* string(node) {
|
|
189
|
+
* return `z.string()`
|
|
190
|
+
* },
|
|
191
|
+
* object(node) {
|
|
192
|
+
* const props = node.properties
|
|
193
|
+
* ?.map(p => `${p.name}: ${this.print(p)}`)
|
|
194
|
+
* .join(', ') ?? ''
|
|
195
|
+
* return `z.object({ ${props} })`
|
|
196
|
+
* },
|
|
197
|
+
* },
|
|
198
|
+
* }
|
|
199
|
+
* })
|
|
200
|
+
*
|
|
201
|
+
* const printer = zodPrinter({ strict: false })
|
|
202
|
+
* printer.name // 'zod'
|
|
203
|
+
* printer.options // { strict: false }
|
|
204
|
+
* printer.print(node) // 'z.string()'
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
function definePrinter(build) {
|
|
208
|
+
return (options) => {
|
|
209
|
+
const { name, options: resolvedOptions, nodes } = build(options ?? {});
|
|
210
|
+
const context = {
|
|
211
|
+
options: resolvedOptions,
|
|
212
|
+
print: (node) => {
|
|
213
|
+
const handler = nodes[node.type];
|
|
214
|
+
return handler ? handler.call(context, node) : void 0;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
return {
|
|
218
|
+
name,
|
|
219
|
+
options: resolvedOptions,
|
|
220
|
+
print: context.print,
|
|
221
|
+
for: (nodes) => nodes.map(context.print)
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/refs.ts
|
|
227
|
+
/**
|
|
228
|
+
* Indexes named schemas from `root.schemas` by name. Unnamed schemas are skipped.
|
|
229
|
+
*/
|
|
230
|
+
function buildRefMap(root) {
|
|
231
|
+
const map = /* @__PURE__ */ new Map();
|
|
232
|
+
for (const schema of root.schemas) if (schema.name) map.set(schema.name, schema);
|
|
233
|
+
return map;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Looks up a schema by name. Prefer over `RefMap.get()` to keep the resolution strategy swappable.
|
|
237
|
+
*/
|
|
238
|
+
function resolveRef(refMap, ref) {
|
|
239
|
+
return refMap.get(ref);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Converts a `RefMap` to a plain object.
|
|
243
|
+
*/
|
|
244
|
+
function refMapToObject(refMap) {
|
|
245
|
+
return Object.fromEntries(refMap);
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/visitor.ts
|
|
249
|
+
function createLimit(concurrency) {
|
|
250
|
+
let active = 0;
|
|
251
|
+
const queue = [];
|
|
252
|
+
function next() {
|
|
253
|
+
if (active < concurrency && queue.length > 0) {
|
|
254
|
+
active++;
|
|
255
|
+
queue.shift()();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return function limit(fn) {
|
|
259
|
+
return new Promise((resolve, reject) => {
|
|
260
|
+
queue.push(() => {
|
|
261
|
+
Promise.resolve(fn()).then(resolve, reject).finally(() => {
|
|
262
|
+
active--;
|
|
263
|
+
next();
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
next();
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Traversable children of `node`, respecting `recurse` for schema nodes.
|
|
272
|
+
*/
|
|
273
|
+
function getChildren(node, recurse) {
|
|
274
|
+
switch (node.kind) {
|
|
275
|
+
case "Root": return [...node.schemas, ...node.operations];
|
|
276
|
+
case "Operation": return [
|
|
277
|
+
...node.parameters,
|
|
278
|
+
...node.requestBody ? [node.requestBody] : [],
|
|
279
|
+
...node.responses
|
|
280
|
+
];
|
|
281
|
+
case "Schema": {
|
|
282
|
+
const children = [];
|
|
283
|
+
if (!recurse) return [];
|
|
284
|
+
if ("properties" in node && node.properties.length > 0) children.push(...node.properties);
|
|
285
|
+
if ("items" in node && node.items) children.push(...node.items);
|
|
286
|
+
if ("members" in node && node.members) children.push(...node.members);
|
|
287
|
+
return children;
|
|
288
|
+
}
|
|
289
|
+
case "Property": return [node.schema];
|
|
290
|
+
case "Parameter": return [node.schema];
|
|
291
|
+
case "Response": return node.schema ? [node.schema] : [];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Depth-first traversal for side effects. Visitor return values are ignored.
|
|
296
|
+
* Sibling nodes at each level are visited concurrently up to `options.concurrency` (default: 30).
|
|
297
|
+
*/
|
|
298
|
+
async function walk(node, visitor, options = {}) {
|
|
299
|
+
return _walk(node, visitor, (options.depth ?? visitorDepths.deep) === visitorDepths.deep, createLimit(options.concurrency ?? 30));
|
|
300
|
+
}
|
|
301
|
+
async function _walk(node, visitor, recurse, limit) {
|
|
302
|
+
switch (node.kind) {
|
|
303
|
+
case "Root":
|
|
304
|
+
await limit(() => visitor.root?.(node));
|
|
305
|
+
break;
|
|
306
|
+
case "Operation":
|
|
307
|
+
await limit(() => visitor.operation?.(node));
|
|
308
|
+
break;
|
|
309
|
+
case "Schema":
|
|
310
|
+
await limit(() => visitor.schema?.(node));
|
|
311
|
+
break;
|
|
312
|
+
case "Property":
|
|
313
|
+
await limit(() => visitor.property?.(node));
|
|
314
|
+
break;
|
|
315
|
+
case "Parameter":
|
|
316
|
+
await limit(() => visitor.parameter?.(node));
|
|
317
|
+
break;
|
|
318
|
+
case "Response":
|
|
319
|
+
await limit(() => visitor.response?.(node));
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
const children = getChildren(node, recurse);
|
|
323
|
+
await Promise.all(children.map((child) => _walk(child, visitor, recurse, limit)));
|
|
324
|
+
}
|
|
325
|
+
function transform(node, visitor, options = {}) {
|
|
326
|
+
const recurse = (options.depth ?? visitorDepths.deep) === visitorDepths.deep;
|
|
327
|
+
switch (node.kind) {
|
|
328
|
+
case "Root": {
|
|
329
|
+
let root = node;
|
|
330
|
+
const replaced = visitor.root?.(root);
|
|
331
|
+
if (replaced) root = replaced;
|
|
332
|
+
return {
|
|
333
|
+
...root,
|
|
334
|
+
schemas: root.schemas.map((s) => transform(s, visitor, options)),
|
|
335
|
+
operations: root.operations.map((op) => transform(op, visitor, options))
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
case "Operation": {
|
|
339
|
+
let op = node;
|
|
340
|
+
const replaced = visitor.operation?.(op);
|
|
341
|
+
if (replaced) op = replaced;
|
|
342
|
+
return {
|
|
343
|
+
...op,
|
|
344
|
+
parameters: op.parameters.map((p) => transform(p, visitor, options)),
|
|
345
|
+
requestBody: op.requestBody ? transform(op.requestBody, visitor, options) : void 0,
|
|
346
|
+
responses: op.responses.map((r) => transform(r, visitor, options))
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
case "Schema": {
|
|
350
|
+
let schema = node;
|
|
351
|
+
const replaced = visitor.schema?.(schema);
|
|
352
|
+
if (replaced) schema = replaced;
|
|
353
|
+
return {
|
|
354
|
+
...schema,
|
|
355
|
+
..."properties" in schema && recurse ? { properties: schema.properties.map((p) => transform(p, visitor, options)) } : {},
|
|
356
|
+
..."items" in schema && recurse ? { items: schema.items?.map((i) => transform(i, visitor, options)) } : {},
|
|
357
|
+
..."members" in schema && recurse ? { members: schema.members?.map((m) => transform(m, visitor, options)) } : {}
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
case "Property": {
|
|
361
|
+
let prop = node;
|
|
362
|
+
const replaced = visitor.property?.(prop);
|
|
363
|
+
if (replaced) prop = replaced;
|
|
364
|
+
return {
|
|
365
|
+
...prop,
|
|
366
|
+
schema: transform(prop.schema, visitor, options)
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
case "Parameter": {
|
|
370
|
+
let param = node;
|
|
371
|
+
const replaced = visitor.parameter?.(param);
|
|
372
|
+
if (replaced) param = replaced;
|
|
373
|
+
return {
|
|
374
|
+
...param,
|
|
375
|
+
schema: transform(param.schema, visitor, options)
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
case "Response": {
|
|
379
|
+
let response = node;
|
|
380
|
+
const replaced = visitor.response?.(response);
|
|
381
|
+
if (replaced) response = replaced;
|
|
382
|
+
return {
|
|
383
|
+
...response,
|
|
384
|
+
schema: response.schema ? transform(response.schema, visitor, options) : void 0
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Depth-first synchronous reduction. Collects non-`undefined` visitor return values into an array.
|
|
391
|
+
*/
|
|
392
|
+
function collect(node, visitor, options = {}) {
|
|
393
|
+
const recurse = (options.depth ?? visitorDepths.deep) === visitorDepths.deep;
|
|
394
|
+
const results = [];
|
|
395
|
+
let v;
|
|
396
|
+
switch (node.kind) {
|
|
397
|
+
case "Root":
|
|
398
|
+
v = visitor.root?.(node);
|
|
399
|
+
break;
|
|
400
|
+
case "Operation":
|
|
401
|
+
v = visitor.operation?.(node);
|
|
402
|
+
break;
|
|
403
|
+
case "Schema":
|
|
404
|
+
v = visitor.schema?.(node);
|
|
405
|
+
break;
|
|
406
|
+
case "Property":
|
|
407
|
+
v = visitor.property?.(node);
|
|
408
|
+
break;
|
|
409
|
+
case "Parameter":
|
|
410
|
+
v = visitor.parameter?.(node);
|
|
411
|
+
break;
|
|
412
|
+
case "Response":
|
|
413
|
+
v = visitor.response?.(node);
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
if (v !== void 0) results.push(v);
|
|
417
|
+
for (const child of getChildren(node, recurse)) for (const item of collect(child, visitor, options)) results.push(item);
|
|
418
|
+
return results;
|
|
419
|
+
}
|
|
420
|
+
//#endregion
|
|
421
|
+
export { buildRefMap, collect, createOperation, createParameter, createProperty, createResponse, createRoot, createSchema, definePrinter, httpMethods, isOperationNode, isParameterNode, isPropertyNode, isResponseNode, isRootNode, isSchemaNode, mediaTypes, narrowSchema, nodeKinds, refMapToObject, resolveRef, schemaTypes, transform, walk };
|
|
422
|
+
|
|
423
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kubb/ast",
|
|
3
|
+
"version": "4.37.2",
|
|
4
|
+
"description": "Spec-agnostic AST layer for Kubb. Defines nodes, visitor pattern, and factory functions used across codegen plugins.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"kubb",
|
|
7
|
+
"ast",
|
|
8
|
+
"typescript",
|
|
9
|
+
"codegen",
|
|
10
|
+
"openapi"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/kubb-labs/kubb.git",
|
|
15
|
+
"directory": "packages/ast"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "stijnvanhulle",
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
|
+
},
|
|
26
|
+
"./types": {
|
|
27
|
+
"import": "./dist/types.js",
|
|
28
|
+
"require": "./dist/types.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"typesVersions": {
|
|
34
|
+
"*": {
|
|
35
|
+
"types": [
|
|
36
|
+
"./dist/types.d.ts"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"src",
|
|
42
|
+
"dist",
|
|
43
|
+
"!/**/**.test.**",
|
|
44
|
+
"!/**/__tests__/**",
|
|
45
|
+
"!/**/__snapshots__/**"
|
|
46
|
+
],
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^20.19.37"
|
|
49
|
+
},
|
|
50
|
+
"main": "./dist/index.cjs",
|
|
51
|
+
"module": "./dist/index.js",
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public",
|
|
57
|
+
"registry": "https://registry.npmjs.org/"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsdown",
|
|
61
|
+
"clean": "npx rimraf ./dist",
|
|
62
|
+
"lint": "bun biome lint .",
|
|
63
|
+
"lint:fix": "bun biome lint --fix --unsafe .",
|
|
64
|
+
"release": "pnpm publish --no-git-check",
|
|
65
|
+
"release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
|
|
66
|
+
"start": "tsdown --watch",
|
|
67
|
+
"test": "vitest --passWithNoTests",
|
|
68
|
+
"typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
|
+
import { useFabric } from "@kubb/react-fabric";
|
|
3
|
+
//#region src/hooks/useMode.ts
|
|
4
|
+
function useMode() {
|
|
5
|
+
const { meta } = useFabric();
|
|
6
|
+
return meta.mode;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/hooks/usePlugin.ts
|
|
10
|
+
function usePlugin() {
|
|
11
|
+
const { meta } = useFabric();
|
|
12
|
+
return meta.plugin;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/hooks/usePluginManager.ts
|
|
16
|
+
function usePluginManager() {
|
|
17
|
+
const { meta } = useFabric();
|
|
18
|
+
return meta.pluginManager;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { useMode, usePlugin, usePluginManager };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=hooks.js.map
|