@kubb/plugin-cypress 5.0.0-alpha.9 → 5.0.0-beta.100
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/LICENSE +17 -10
- package/README.md +38 -23
- package/dist/index.cjs +401 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +130 -6
- package/dist/index.js +394 -63
- package/dist/index.js.map +1 -1
- package/package.json +38 -77
- package/dist/components-BK_6GU4v.js +0 -257
- package/dist/components-BK_6GU4v.js.map +0 -1
- package/dist/components-Drg_gLu2.cjs +0 -305
- package/dist/components-Drg_gLu2.cjs.map +0 -1
- package/dist/components.cjs +0 -3
- package/dist/components.d.ts +0 -50
- package/dist/components.js +0 -2
- package/dist/generators-B3FWG2Ck.js +0 -71
- package/dist/generators-B3FWG2Ck.js.map +0 -1
- package/dist/generators-C73nd-xB.cjs +0 -75
- package/dist/generators-C73nd-xB.cjs.map +0 -1
- package/dist/generators.cjs +0 -3
- package/dist/generators.d.ts +0 -505
- package/dist/generators.js +0 -2
- package/dist/types-DGvL0jsn.d.ts +0 -85
- package/src/components/Request.tsx +0 -147
- package/src/components/index.ts +0 -1
- package/src/generators/cypressGenerator.tsx +0 -66
- package/src/generators/index.ts +0 -1
- package/src/index.ts +0 -2
- package/src/plugin.ts +0 -119
- package/src/types.ts +0 -83
- /package/dist/{chunk--u3MIqq1.js → rolldown-runtime-C0LytTxp.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,79 +1,410 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { createPlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
6
|
-
import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
|
|
1
|
+
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
+
import { Resolver, Url, ast, createResolver, defineGenerator, definePlugin } from "kubb/kit";
|
|
3
|
+
import { File, Function, jsxRenderer } from "kubb/jsx";
|
|
4
|
+
import { jsx, jsxs } from "kubb/jsx/jsx-runtime";
|
|
7
5
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
6
|
+
//#region ../../internals/shared/src/params.ts
|
|
7
|
+
/**
|
|
8
|
+
* Drops parameters that share the same name, keeping the first.
|
|
9
|
+
*
|
|
10
|
+
* A malformed spec can declare the same parameter name twice within one `in` location. Both would
|
|
11
|
+
* resolve to the same output property, so emitting both would yield an object type with a duplicate
|
|
12
|
+
* member, which TypeScript rejects. This is a defensive guard against that case, not a casing guard:
|
|
13
|
+
* parameter names flow through unchanged, so no two distinct names ever collide here anymore.
|
|
14
|
+
*/
|
|
15
|
+
function dedupeParams(params) {
|
|
16
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17
|
+
return params.filter((param) => {
|
|
18
|
+
if (seen.has(param.name)) return false;
|
|
19
|
+
seen.add(param.name);
|
|
20
|
+
return true;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region ../../internals/shared/src/operation.ts
|
|
25
|
+
/**
|
|
26
|
+
* Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several
|
|
27
|
+
* are present and the union, default, and form-data flags the client uses to pick one.
|
|
28
|
+
*/
|
|
29
|
+
function buildContentTypeInfo(contentTypes) {
|
|
30
|
+
const isMultipleContentTypes = contentTypes.length > 1;
|
|
31
|
+
return {
|
|
32
|
+
contentTypes,
|
|
33
|
+
isMultipleContentTypes,
|
|
34
|
+
contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(" | ") : "",
|
|
35
|
+
defaultContentType: contentTypes[0] ?? "application/json",
|
|
36
|
+
hasFormData: contentTypes.some((ct) => ct === "multipart/form-data")
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function getContentTypeInfo(node) {
|
|
40
|
+
return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? []);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The request-body counterpart for the primary success response: the content types it documents and
|
|
44
|
+
* whether several are present, so the client can let a caller pick which one to accept.
|
|
45
|
+
*/
|
|
46
|
+
function getResponseContentTypeInfo(node) {
|
|
47
|
+
return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? []);
|
|
48
|
+
}
|
|
49
|
+
function buildRequestConfigType(node) {
|
|
50
|
+
const request = getContentTypeInfo(node);
|
|
51
|
+
const response = getResponseContentTypeInfo(node);
|
|
52
|
+
const configType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`;
|
|
53
|
+
const members = [request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null, response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null].filter(Boolean);
|
|
54
|
+
return members.length ? `${configType} & { contentType?: { ${members.join("; ")} } }` : configType;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Which of the grouped request options an operation carries.
|
|
58
|
+
*/
|
|
59
|
+
function getRequestGroups(node) {
|
|
60
|
+
const { path, query, header } = getOperationParameters(node);
|
|
61
|
+
return {
|
|
62
|
+
path: path.length > 0,
|
|
63
|
+
query: query.length > 0,
|
|
64
|
+
body: Boolean(node.requestBody?.content?.[0]?.schema),
|
|
65
|
+
headers: header.length > 0
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Resolves which grouped request options an operation carries together with whether each group
|
|
70
|
+
* holds a required member. The grouped parameter stays optional only when nothing inside it is
|
|
71
|
+
* required, matching the generated `RequestConfig` type.
|
|
72
|
+
*/
|
|
73
|
+
function getRequestGroupOptionality(node) {
|
|
74
|
+
const groups = getRequestGroups(node);
|
|
75
|
+
const { path, query, header } = getOperationParameters(node);
|
|
76
|
+
const hasRequiredPath = path.some((param) => param.required);
|
|
77
|
+
const hasRequiredQuery = query.some((param) => param.required);
|
|
78
|
+
const hasRequiredHeader = header.some((param) => param.required);
|
|
79
|
+
return {
|
|
80
|
+
groups,
|
|
81
|
+
hasRequiredPath,
|
|
82
|
+
hasRequiredQuery,
|
|
83
|
+
hasRequiredHeader,
|
|
84
|
+
isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !groups.body
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Builds the grouped `{ path, query, body, headers }` parameter for a generated client
|
|
89
|
+
* function, typed from the operation's `Options` (minus `url`). Only the groups the
|
|
90
|
+
* operation actually has are destructured. The trailing `config` parameter carries the
|
|
91
|
+
* runtime `RequestConfig` overrides plus `client`.
|
|
92
|
+
*/
|
|
93
|
+
function buildRequestParamsSignature(node, resolver, options = {}) {
|
|
94
|
+
const { isConfigurable = true } = options;
|
|
95
|
+
const { groups, isOptional } = getRequestGroupOptionality(node);
|
|
96
|
+
const names = [
|
|
97
|
+
"path",
|
|
98
|
+
"query",
|
|
99
|
+
"body",
|
|
100
|
+
"headers"
|
|
101
|
+
].filter((key) => groups[key]);
|
|
102
|
+
return {
|
|
103
|
+
signature: [names.length > 0 ? `{ ${names.join(", ")} }: ${resolver.response.options(node)}${isOptional ? " = {}" : ""}` : null, isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null].filter(Boolean).join(", "),
|
|
104
|
+
groups
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function getOperationParameters(node) {
|
|
108
|
+
return {
|
|
109
|
+
path: dedupeParams(node.parameters.filter((param) => param.in === "path")),
|
|
110
|
+
query: dedupeParams(node.parameters.filter((param) => param.in === "query")),
|
|
111
|
+
header: dedupeParams(node.parameters.filter((param) => param.in === "header")),
|
|
112
|
+
cookie: dedupeParams(node.parameters.filter((param) => param.in === "cookie"))
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function getStatusCodeNumber(statusCode) {
|
|
116
|
+
const code = Number(statusCode);
|
|
117
|
+
return Number.isNaN(code) ? null : code;
|
|
118
|
+
}
|
|
119
|
+
function isSuccessStatusCode(statusCode) {
|
|
120
|
+
const code = getStatusCodeNumber(statusCode);
|
|
121
|
+
return code !== null && code >= 200 && code < 300;
|
|
122
|
+
}
|
|
123
|
+
function isErrorStatusCode(statusCode) {
|
|
124
|
+
const code = getStatusCodeNumber(statusCode);
|
|
125
|
+
return code !== null && code >= 400;
|
|
126
|
+
}
|
|
127
|
+
function getSuccessResponses(responses) {
|
|
128
|
+
return responses.filter((response) => isSuccessStatusCode(response.statusCode));
|
|
129
|
+
}
|
|
130
|
+
function getOperationSuccessResponses(node) {
|
|
131
|
+
return getSuccessResponses(node.responses);
|
|
132
|
+
}
|
|
133
|
+
function getPrimarySuccessResponse(node) {
|
|
134
|
+
return getOperationSuccessResponses(node)[0] ?? null;
|
|
135
|
+
}
|
|
136
|
+
function resolveErrorNames(node, resolver) {
|
|
137
|
+
return node.responses.filter((response) => isErrorStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode));
|
|
138
|
+
}
|
|
139
|
+
function resolveStatusCodeNames(node, resolver) {
|
|
140
|
+
return node.responses.map((response) => resolver.response.status(node, response.statusCode));
|
|
141
|
+
}
|
|
142
|
+
const typeNamesByResolver = /* @__PURE__ */ new WeakMap();
|
|
143
|
+
function resolveOperationTypeNames(node, resolver, options = {}) {
|
|
144
|
+
const cacheKey = `${node.operationId}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${options.includeParams === false ? "noparams" : ""}\0${(options.exclude ?? []).join(",")}`;
|
|
145
|
+
let byResolver = typeNamesByResolver.get(resolver);
|
|
146
|
+
if (byResolver) {
|
|
147
|
+
const cached = byResolver.get(cacheKey);
|
|
148
|
+
if (cached) return cached;
|
|
149
|
+
} else {
|
|
150
|
+
byResolver = /* @__PURE__ */ new Map();
|
|
151
|
+
typeNamesByResolver.set(resolver, byResolver);
|
|
152
|
+
}
|
|
153
|
+
const { path, query, header } = getOperationParameters(node);
|
|
154
|
+
const responseStatusNames = options.responseStatusNames === "error" ? resolveErrorNames(node, resolver) : options.responseStatusNames === false ? [] : resolveStatusCodeNames(node, resolver);
|
|
155
|
+
const exclude = new Set(options.exclude ?? []);
|
|
156
|
+
const paramNames = options.includeParams === false ? [] : [
|
|
157
|
+
...path.map((param) => resolver.param.path(node, param)),
|
|
158
|
+
...query.map((param) => resolver.param.query(node, param)),
|
|
159
|
+
...header.map((param) => resolver.param.headers(node, param))
|
|
160
|
+
];
|
|
161
|
+
const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)];
|
|
162
|
+
const result = (options.order === "body-response-first" ? [
|
|
163
|
+
...bodyAndResponseNames,
|
|
164
|
+
...paramNames,
|
|
165
|
+
...responseStatusNames
|
|
166
|
+
] : [
|
|
167
|
+
...paramNames,
|
|
168
|
+
...bodyAndResponseNames,
|
|
169
|
+
...responseStatusNames
|
|
170
|
+
]).filter((name) => Boolean(name) && !exclude.has(name));
|
|
171
|
+
byResolver.set(cacheKey, result);
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region ../../internals/utils/src/casing.ts
|
|
176
|
+
/**
|
|
177
|
+
* Shared implementation for camelCase and PascalCase conversion.
|
|
178
|
+
* Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
|
|
179
|
+
* and capitalizes each word according to `pascal`.
|
|
180
|
+
*
|
|
181
|
+
* When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
|
|
182
|
+
*/
|
|
183
|
+
function toCamelOrPascal(text, pascal) {
|
|
184
|
+
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
185
|
+
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
186
|
+
return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
|
|
187
|
+
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Converts `text` to camelCase.
|
|
191
|
+
*
|
|
192
|
+
* @example Word boundaries
|
|
193
|
+
* `camelCase('hello-world') // 'helloWorld'`
|
|
194
|
+
*
|
|
195
|
+
* @example With a prefix
|
|
196
|
+
* `camelCase('tag', { prefix: 'create' }) // 'createTag'`
|
|
197
|
+
*/
|
|
198
|
+
function camelCase(text, { prefix = "", suffix = "" } = {}) {
|
|
199
|
+
return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region ../../internals/shared/src/group.ts
|
|
203
|
+
/**
|
|
204
|
+
* Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
|
|
205
|
+
* shared default naming so every plugin groups output consistently:
|
|
206
|
+
*
|
|
207
|
+
* - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).
|
|
208
|
+
* - other groups use the camelCased group (`pet store` → `petStore`).
|
|
209
|
+
*
|
|
210
|
+
* A user-provided `group.name` always wins over the default namer, so callers stay in
|
|
211
|
+
* control of their output folders. Returns `null` when grouping is disabled, matching the
|
|
212
|
+
* per-plugin convention.
|
|
213
|
+
*
|
|
214
|
+
* @param group - The user-supplied group option, or `undefined` to disable grouping.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* createGroupConfig(group) // shared across every plugin
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
function createGroupConfig(group) {
|
|
222
|
+
if (!group) return null;
|
|
223
|
+
const defaultName = (ctx) => {
|
|
224
|
+
if (group.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
225
|
+
return camelCase(ctx.group);
|
|
226
|
+
};
|
|
227
|
+
return {
|
|
228
|
+
...group,
|
|
229
|
+
name: group.name ? group.name : defaultName
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/components/Request.tsx
|
|
234
|
+
function Request({ baseURL = "", name, resolver, node }) {
|
|
235
|
+
if (!ast.isHttpOperationNode(node)) return null;
|
|
236
|
+
const { signature, groups } = buildRequestParamsSignature(node, resolver, { isConfigurable: false });
|
|
237
|
+
const paramsSignature = [signature, "options: Partial<Cypress.RequestOptions> = {}"].filter(Boolean).join(", ");
|
|
238
|
+
const responseType = resolver.response.response(node);
|
|
239
|
+
const returnType = `Cypress.Chainable<${responseType}>`;
|
|
240
|
+
const urlTemplate = Url.toGroupedTemplateString(node.path, { prefix: baseURL });
|
|
241
|
+
const requestOptions = [`method: '${node.method}'`, `url: ${urlTemplate}`];
|
|
242
|
+
if (groups.query) requestOptions.push("qs: query");
|
|
243
|
+
if (groups.headers) requestOptions.push("headers");
|
|
244
|
+
if (groups.body) requestOptions.push("body");
|
|
245
|
+
requestOptions.push("...options");
|
|
246
|
+
const requestCall = `return cy.request<${responseType}>({
|
|
247
|
+
${requestOptions.join(",\n ")}
|
|
248
|
+
}).then((res) => res.body)`;
|
|
249
|
+
return /* @__PURE__ */ jsx(File.Source, {
|
|
250
|
+
name,
|
|
251
|
+
isIndexable: true,
|
|
252
|
+
isExportable: true,
|
|
253
|
+
children: /* @__PURE__ */ jsx(Function, {
|
|
254
|
+
name,
|
|
255
|
+
export: true,
|
|
256
|
+
params: paramsSignature,
|
|
257
|
+
returnType,
|
|
258
|
+
children: requestCall
|
|
259
|
+
})
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/generators/cypressGenerator.tsx
|
|
264
|
+
/**
|
|
265
|
+
* Built-in generator for `@kubb/plugin-cypress`. Emits one typed
|
|
266
|
+
* `cy.request()` wrapper per OpenAPI operation, ready to call inside Cypress
|
|
267
|
+
* test specs and custom commands.
|
|
268
|
+
*/
|
|
269
|
+
const cypressGenerator = defineGenerator({
|
|
270
|
+
name: "cypress",
|
|
271
|
+
renderer: jsxRenderer,
|
|
272
|
+
operation(node, ctx) {
|
|
273
|
+
if (!ast.isHttpOperationNode(node)) return null;
|
|
274
|
+
const { config, resolver, driver, root } = ctx;
|
|
275
|
+
const { output, baseURL, group } = ctx.options;
|
|
276
|
+
const pluginTs = driver.getPlugin(pluginTsName);
|
|
277
|
+
if (!pluginTs) return null;
|
|
278
|
+
const tsResolver = driver.getResolver(pluginTsName);
|
|
279
|
+
const importedTypeNames = [tsResolver.response.options(node), ...resolveOperationTypeNames(node, tsResolver, { includeParams: false })];
|
|
280
|
+
const meta = {
|
|
281
|
+
name: resolver.name(node.operationId),
|
|
282
|
+
file: resolver.file({
|
|
283
|
+
name: node.operationId,
|
|
284
|
+
extname: ".ts",
|
|
285
|
+
tag: node.tags[0] ?? "default",
|
|
286
|
+
path: node.path,
|
|
287
|
+
root,
|
|
288
|
+
output,
|
|
289
|
+
group: group ?? void 0
|
|
290
|
+
}),
|
|
291
|
+
fileTs: tsResolver.file({
|
|
292
|
+
name: node.operationId,
|
|
293
|
+
extname: ".ts",
|
|
294
|
+
tag: node.tags[0] ?? "default",
|
|
295
|
+
path: node.path,
|
|
296
|
+
root,
|
|
297
|
+
output: pluginTs.options?.output ?? output,
|
|
298
|
+
group: pluginTs.options?.group ?? void 0
|
|
299
|
+
})
|
|
300
|
+
};
|
|
301
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
302
|
+
baseName: meta.file.baseName,
|
|
303
|
+
path: meta.file.path,
|
|
304
|
+
meta: meta.file.meta,
|
|
305
|
+
banner: resolver.default.banner(ctx.meta, {
|
|
306
|
+
output,
|
|
307
|
+
config,
|
|
308
|
+
file: {
|
|
309
|
+
path: meta.file.path,
|
|
310
|
+
baseName: meta.file.baseName
|
|
311
|
+
}
|
|
312
|
+
}),
|
|
313
|
+
footer: resolver.default.footer(ctx.meta, {
|
|
314
|
+
output,
|
|
315
|
+
config,
|
|
316
|
+
file: {
|
|
317
|
+
path: meta.file.path,
|
|
318
|
+
baseName: meta.file.baseName
|
|
319
|
+
}
|
|
320
|
+
}),
|
|
321
|
+
children: [importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
|
|
322
|
+
name: importedTypeNames,
|
|
323
|
+
root: meta.file.path,
|
|
324
|
+
path: meta.fileTs.path,
|
|
325
|
+
isTypeOnly: true
|
|
326
|
+
}), /* @__PURE__ */ jsx(Request, {
|
|
327
|
+
name: meta.name,
|
|
328
|
+
node,
|
|
329
|
+
resolver: tsResolver,
|
|
330
|
+
baseURL
|
|
331
|
+
})]
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/resolvers/resolverCypress.ts
|
|
337
|
+
/**
|
|
338
|
+
* Default resolver used by `@kubb/plugin-cypress`. Decides the names and file
|
|
339
|
+
* paths for every generated `cy.request()` wrapper. Functions and files use
|
|
340
|
+
* camelCase, matching the convention from `@kubb/plugin-axios` and `@kubb/plugin-fetch`.
|
|
341
|
+
*
|
|
342
|
+
* @example Resolve a helper name
|
|
343
|
+
* ```ts
|
|
344
|
+
* import { resolverCypress } from '@kubb/plugin-cypress'
|
|
345
|
+
*
|
|
346
|
+
* resolverCypress.name('list pets') // 'listPets'
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
const resolverCypress = createResolver({ pluginName: "plugin-cypress" });
|
|
350
|
+
//#endregion
|
|
8
351
|
//#region src/plugin.ts
|
|
352
|
+
/**
|
|
353
|
+
* Canonical plugin name for `@kubb/plugin-cypress`. Used for driver lookups and
|
|
354
|
+
* cross-plugin dependency references.
|
|
355
|
+
*/
|
|
9
356
|
const pluginCypressName = "plugin-cypress";
|
|
10
|
-
|
|
357
|
+
/**
|
|
358
|
+
* Generates one typed `cy.request()` wrapper per OpenAPI operation. Each helper
|
|
359
|
+
* has typed path params, body, query, and a typed response, so failing API
|
|
360
|
+
* calls in Cypress show up at compile time instead of inside the test runner.
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* import { defineConfig } from 'kubb/config'
|
|
365
|
+
* import { pluginTs } from '@kubb/plugin-ts'
|
|
366
|
+
* import { pluginCypress } from '@kubb/plugin-cypress'
|
|
367
|
+
*
|
|
368
|
+
* export default defineConfig({
|
|
369
|
+
* input: './petStore.yaml',
|
|
370
|
+
* output: { path: './src/gen' },
|
|
371
|
+
* plugins: [
|
|
372
|
+
* pluginTs(),
|
|
373
|
+
* pluginCypress({
|
|
374
|
+
* output: { path: './cypress' },
|
|
375
|
+
* }),
|
|
376
|
+
* ],
|
|
377
|
+
* })
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
const pluginCypress = definePlugin((options) => {
|
|
11
381
|
const { output = {
|
|
12
382
|
path: "cypress",
|
|
13
|
-
|
|
14
|
-
}, group,
|
|
383
|
+
barrel: { type: "named" }
|
|
384
|
+
}, group, exclude = [], include, override = [], baseURL, resolver: userResolver, macros: userMacros } = options;
|
|
385
|
+
const groupConfig = createGroupConfig(group);
|
|
15
386
|
return {
|
|
16
387
|
name: pluginCypressName,
|
|
17
|
-
options
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
paramsType,
|
|
24
|
-
pathParamsType
|
|
25
|
-
},
|
|
26
|
-
pre: [pluginOasName, pluginTsName].filter(Boolean),
|
|
27
|
-
resolvePath(baseName, pathMode, options) {
|
|
28
|
-
const root = path.resolve(this.config.root, this.config.output.path);
|
|
29
|
-
if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
|
|
30
|
-
/**
|
|
31
|
-
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
32
|
-
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
33
|
-
*/
|
|
34
|
-
return path.resolve(root, output.path);
|
|
35
|
-
if (group && (options?.group?.path || options?.group?.tag)) {
|
|
36
|
-
const groupName = group?.name ? group.name : (ctx) => {
|
|
37
|
-
if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
38
|
-
return `${camelCase(ctx.group)}Requests`;
|
|
39
|
-
};
|
|
40
|
-
return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
|
|
41
|
-
}
|
|
42
|
-
return path.resolve(root, output.path, baseName);
|
|
43
|
-
},
|
|
44
|
-
resolveName(name, type) {
|
|
45
|
-
const resolvedName = camelCase(name, { isFile: type === "file" });
|
|
46
|
-
if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
|
|
47
|
-
return resolvedName;
|
|
48
|
-
},
|
|
49
|
-
async install() {
|
|
50
|
-
const root = path.resolve(this.config.root, this.config.output.path);
|
|
51
|
-
const mode = getMode(path.resolve(root, output.path));
|
|
52
|
-
const oas = await this.getOas();
|
|
53
|
-
const files = await new OperationGenerator(this.plugin.options, {
|
|
54
|
-
fabric: this.fabric,
|
|
55
|
-
oas,
|
|
56
|
-
driver: this.driver,
|
|
57
|
-
events: this.events,
|
|
58
|
-
plugin: this.plugin,
|
|
59
|
-
contentType,
|
|
388
|
+
options,
|
|
389
|
+
dependencies: [pluginTsName],
|
|
390
|
+
hooks: { "kubb:plugin:setup"(ctx) {
|
|
391
|
+
const resolver = userResolver ? Resolver.merge(resolverCypress, userResolver) : resolverCypress;
|
|
392
|
+
ctx.setOptions({
|
|
393
|
+
output,
|
|
60
394
|
exclude,
|
|
61
395
|
include,
|
|
62
396
|
override,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const barrelFiles = await getBarrelFiles(this.fabric.files, {
|
|
67
|
-
type: output.barrelType ?? "named",
|
|
68
|
-
root,
|
|
69
|
-
output,
|
|
70
|
-
meta: { pluginName: this.plugin.name }
|
|
397
|
+
group: groupConfig,
|
|
398
|
+
baseURL,
|
|
399
|
+
resolver
|
|
71
400
|
});
|
|
72
|
-
|
|
73
|
-
|
|
401
|
+
ctx.setResolver(resolver);
|
|
402
|
+
if (userMacros?.length) ctx.setMacros(userMacros);
|
|
403
|
+
ctx.addGenerator(cypressGenerator);
|
|
404
|
+
} }
|
|
74
405
|
};
|
|
75
406
|
});
|
|
76
407
|
//#endregion
|
|
77
|
-
export { pluginCypress, pluginCypressName };
|
|
408
|
+
export { Request, cypressGenerator, pluginCypress as default, pluginCypress, pluginCypressName, resolverCypress };
|
|
78
409
|
|
|
79
410
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { createPlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { cypressGenerator } from './generators'\nimport type { PluginCypress } from './types.ts'\n\nexport const pluginCypressName = 'plugin-cypress' satisfies PluginCypress['name']\n\nexport const pluginCypress = createPlugin<PluginCypress>((options) => {\n const {\n output = { path: 'cypress', barrelType: 'named' },\n group,\n dataReturnType = 'data',\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [cypressGenerator].filter(Boolean),\n contentType,\n baseURL,\n paramsCasing,\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n } = options\n\n return {\n name: pluginCypressName,\n options: {\n output,\n dataReturnType,\n group,\n baseURL,\n\n paramsCasing,\n paramsType,\n pathParamsType,\n },\n pre: [pluginOasName, pluginTsName].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;AAQA,MAAa,oBAAoB;AAEjC,MAAa,gBAAgB,cAA6B,YAAY;CACpE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,iBAAiB,QACjB,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAAC,iBAAiB,CAAC,OAAO,QAAQ,EAC/C,aACA,SACA,cACA,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,aAC9E;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GAEA;GACA;GACA;GACD;EACD,KAAK,CAAC,eAAe,aAAa,CAAC,OAAO,QAAQ;EAClD,YAAY,UAAU,UAAU,SAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,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YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../internals/shared/src/params.ts","../../../internals/shared/src/operation.ts","../../../internals/utils/src/casing.ts","../../../internals/shared/src/group.ts","../src/components/Request.tsx","../src/generators/cypressGenerator.tsx","../src/resolvers/resolverCypress.ts","../src/plugin.ts"],"sourcesContent":["import type { ast } from 'kubb/kit'\n\n/**\n * Drops parameters that share the same name, keeping the first.\n *\n * A malformed spec can declare the same parameter name twice within one `in` location. Both would\n * resolve to the same output property, so emitting both would yield an object type with a duplicate\n * member, which TypeScript rejects. This is a defensive guard against that case, not a casing guard:\n * parameter names flow through unchanged, so no two distinct names ever collide here anymore.\n */\nexport function dedupeParams(params: Array<ast.ParameterNode>): Array<ast.ParameterNode> {\n const seen = new Set<string>()\n\n return params.filter((param) => {\n if (seen.has(param.name)) return false\n seen.add(param.name)\n return true\n })\n}\n","import { type ast, type ResolverFileParams, Url } from 'kubb/kit'\nimport { dedupeParams } from './params.ts'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\n/**\n * Resolver interface for building operation parameters.\n *\n * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.\n */\nexport type OperationParamsResolver = {\n /**\n * Naming for an operation's parameters, grouped by location.\n */\n param: {\n /**\n * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.param.name(node, param) // → 'DeletePetPathPetId'`\n */\n name(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolver.param.name`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.param.path(node, param) // → 'DeletePetPath'`\n */\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.param.query(node, param) // → 'FindPetsByStatusQuery'`\n */\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.param.headers(node, param) // → 'DeletePetHeaders'`\n */\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n /**\n * Naming for an operation's request and response types.\n */\n response: {\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.response.body(node) // → 'CreatePetBody'`\n */\n body(node: ast.OperationNode): string\n }\n}\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Reads the single base content type of an operation's primary success response, lowercased and\n * stripped of any `; charset=...` suffix. Returns `undefined` when the response declares zero or\n * more than one content type, since neither case has a single type to act on.\n */\nfunction getPrimarySuccessContentType(node: ast.OperationNode): string | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n return contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n}\n\n/**\n * Whether an operation streams its primary success response as Server-Sent Events\n * (`text/event-stream`). The client generator uses this to return a typed event stream instead of a\n * one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getPrimarySuccessContentType(node) === 'text/event-stream'\n}\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type. `text/event-stream`\n * and other binary types (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`,\n * `video/*`) map to a stream or `'blob'`, and other `text/*` maps to `'text'`. Otherwise `undefined`,\n * leaving the runtime client's `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const baseType = getPrimarySuccessContentType(node)\n if (!baseType) return undefined\n\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType === 'text/event-stream') return 'stream'\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n // The request groups come from the grouped params, so `config` drops the data-shape keys to stay\n // assignable to `Options`, which omits them from `RequestConfig`.\n const configType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n\n // Only the ambiguous side is offered: a single-type side has nothing to pick, so it stays baked in\n // the generated call.\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n return members.length ? `${configType} & { contentType?: { ${members.join('; ')} } }` : configType\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...). Unlike {@link buildRequestConfigType}, it never adds a\n * `contentType?:` member: query hooks wrap GET operations, which carry no request body to select a\n * content type for.\n */\nexport function buildClientOptionType(): string {\n return `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n}\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header } = getOperationParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(node.requestBody?.content?.[0]?.schema),\n headers: header.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = getOperationParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !groups.body,\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = (['path', 'query', 'body', 'headers'] as const).filter((key) => groups[key])\n\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${resolver.response.options(node)}${isOptional ? ' = {}' : ''}` : null\n const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n return {\n signature: [firstParam, configParam].filter(Boolean).join(', '),\n groups,\n }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode): OperationParameterGroups {\n return {\n path: dedupeParams(node.parameters.filter((param) => param.in === 'path')),\n query: dedupeParams(node.parameters.filter((param) => param.in === 'query')),\n header: dedupeParams(node.parameters.filter((param) => param.in === 'header')),\n cookie: dedupeParams(node.parameters.filter((param) => param.in === 'cookie')),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isErrorStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isSuccessStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\n const { path, query, header } = getOperationParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n byResolver.set(cacheKey, result)\n return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return null\n}\n","type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Uppercases only the first character of `text`, leaving the rest untouched.\n * Unlike {@link pascalCase} it never re-splits word boundaries or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from 'kubb/kit'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import { buildRequestParamsSignature } from '@internals/shared'\nimport { ast, Url } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { File, Function } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n /**\n * AST operation node\n */\n node: ast.OperationNode\n /**\n * TypeScript resolver for resolving param/data/response type names\n */\n resolver: ResolverTs\n baseURL: string | null | undefined\n}\n\nexport function Request({ baseURL = '', name, resolver, node }: Props): KubbReactNode {\n if (!ast.isHttpOperationNode(node)) return null\n\n const { signature, groups } = buildRequestParamsSignature(node, resolver, { isConfigurable: false })\n const paramsSignature = [signature, 'options: Partial<Cypress.RequestOptions> = {}'].filter(Boolean).join(', ')\n\n const responseType = resolver.response.response(node)\n const returnType = `Cypress.Chainable<${responseType}>`\n\n // Bracket-access the path object with the raw OpenAPI param names, matching the generated `path` type's keys.\n const urlTemplate = Url.toGroupedTemplateString(node.path, { prefix: baseURL })\n\n const requestOptions: Array<string> = [`method: '${node.method}'`, `url: ${urlTemplate}`]\n\n if (groups.query) {\n requestOptions.push('qs: query')\n }\n\n if (groups.headers) {\n requestOptions.push('headers')\n }\n\n if (groups.body) {\n requestOptions.push('body')\n }\n\n requestOptions.push('...options')\n\n const requestCall = `return cy.request<${responseType}>({\n ${requestOptions.join(',\\n ')}\n}).then((res) => res.body)`\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={paramsSignature} returnType={returnType}>\n {requestCall}\n </Function>\n </File.Source>\n )\n}\n","import { resolveOperationTypeNames } from '@internals/shared'\nimport { ast, defineGenerator } from 'kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, jsxRenderer } from 'kubb/jsx'\nimport { Request } from '../components/Request.tsx'\nimport type { PluginCypress } from '../types.ts'\n\n/**\n * Built-in generator for `@kubb/plugin-cypress`. Emits one typed\n * `cy.request()` wrapper per OpenAPI operation, ready to call inside Cypress\n * test specs and custom commands.\n */\nexport const cypressGenerator = defineGenerator<PluginCypress>({\n name: 'cypress',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, resolver, driver, root } = ctx\n const { output, baseURL, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n\n if (!pluginTs) {\n return null\n }\n\n const tsResolver = driver.getResolver(pluginTsName)\n\n const importedTypeNames = [tsResolver.response.options(node), ...resolveOperationTypeNames(node, tsResolver, { includeParams: false })]\n\n const meta = {\n name: resolver.name(node.operationId),\n file: resolver.file({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path, root, output, group: group ?? undefined }),\n fileTs: tsResolver.file({\n name: node.operationId,\n extname: '.ts',\n tag: node.tags[0] ?? 'default',\n path: node.path,\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group ?? undefined,\n }),\n } as const\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n {importedTypeNames.length > 0 && <File.Import name={importedTypeNames} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />}\n <Request name={meta.name} node={node} resolver={tsResolver} baseURL={baseURL} />\n </File>\n )\n },\n})\n","import { createResolver } from 'kubb/kit'\nimport type { PluginCypress } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-cypress`. Decides the names and file\n * paths for every generated `cy.request()` wrapper. Functions and files use\n * camelCase, matching the convention from `@kubb/plugin-axios` and `@kubb/plugin-fetch`.\n *\n * @example Resolve a helper name\n * ```ts\n * import { resolverCypress } from '@kubb/plugin-cypress'\n *\n * resolverCypress.name('list pets') // 'listPets'\n * ```\n */\nexport const resolverCypress = createResolver<PluginCypress>({\n pluginName: 'plugin-cypress',\n})\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin, Resolver } from 'kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { cypressGenerator } from './generators/cypressGenerator.tsx'\nimport { resolverCypress } from './resolvers/resolverCypress.ts'\nimport type { PluginCypress, ResolverCypress } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-cypress`. Used for driver lookups and\n * cross-plugin dependency references.\n */\nexport const pluginCypressName = 'plugin-cypress' satisfies PluginCypress['name']\n\n/**\n * Generates one typed `cy.request()` wrapper per OpenAPI operation. Each helper\n * has typed path params, body, query, and a typed response, so failing API\n * calls in Cypress show up at compile time instead of inside the test runner.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginCypress } from '@kubb/plugin-cypress'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginCypress({\n * output: { path: './cypress' },\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginCypress = definePlugin<PluginCypress>((options) => {\n const {\n output = { path: 'cypress', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n baseURL,\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const groupConfig = createGroupConfig(group)\n\n return {\n name: pluginCypressName,\n options,\n dependencies: [pluginTsName],\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? Resolver.merge<ResolverCypress>(resolverCypress, userResolver) : resolverCypress\n\n ctx.setOptions({\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n baseURL,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userMacros?.length) {\n ctx.setMacros(userMacros)\n }\n ctx.addGenerator(cypressGenerator)\n },\n },\n }\n})\n\nexport default pluginCypress\n"],"mappings":";;;;;;;;;;;;;;AAUA,SAAgB,aAAa,QAA4D;CACvF,MAAM,uBAAO,IAAI,IAAY;CAE7B,OAAO,OAAO,QAAQ,UAAU;EAC9B,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG,OAAO;EACjC,KAAK,IAAI,MAAM,IAAI;EACnB,OAAO;CACT,CAAC;AACH;;;;;;;ACyIA,SAAS,qBAAqB,cAAyC;CACrE,MAAM,yBAAyB,aAAa,SAAS;CAErD,OAAO;EACL;EACA;EACA,kBAAkB,yBAAyB,aAAa,KAAK,OAAO,KAAK,UAAU,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI;EACtG,oBAAoB,aAAa,MAAM;EACvC,aAAa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