@kubb/plugin-cypress 4.12.5 → 4.12.7

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.
Files changed (41) hide show
  1. package/dist/components-CKNcdnr_.js +101 -0
  2. package/dist/components-CKNcdnr_.js.map +1 -0
  3. package/dist/components-UBGR5HIj.cjs +107 -0
  4. package/dist/components-UBGR5HIj.cjs.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.cts +23 -2
  7. package/dist/components.d.ts +23 -2
  8. package/dist/components.js +1 -1
  9. package/dist/{generators-Nkjg7hcp.cjs → generators-Ct9I-qNg.cjs} +7 -5
  10. package/dist/generators-Ct9I-qNg.cjs.map +1 -0
  11. package/dist/{generators-CnEpcL-m.js → generators-D_AameR6.js} +7 -5
  12. package/dist/generators-D_AameR6.js.map +1 -0
  13. package/dist/generators.cjs +1 -1
  14. package/dist/generators.d.cts +1 -1
  15. package/dist/generators.d.ts +1 -1
  16. package/dist/generators.js +1 -1
  17. package/dist/index.cjs +6 -3
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +6 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-DjLyok_a.d.cts → types-Bi9SkBrH.d.cts} +34 -4
  24. package/dist/{types-BVMff21d.d.ts → types-Bs7HVpiD.d.ts} +34 -4
  25. package/package.json +6 -6
  26. package/src/components/Request.tsx +104 -12
  27. package/src/generators/__snapshots__/createPet.ts +2 -2
  28. package/src/generators/__snapshots__/deletePet.ts +9 -5
  29. package/src/generators/__snapshots__/getPets.ts +4 -4
  30. package/src/generators/__snapshots__/getPetsWithTemplateString.ts +4 -4
  31. package/src/generators/__snapshots__/showPetById.ts +4 -5
  32. package/src/generators/__snapshots__/updatePet.ts +19 -0
  33. package/src/generators/cypressGenerator.tsx +5 -3
  34. package/src/plugin.ts +7 -0
  35. package/src/types.ts +22 -0
  36. package/dist/components-CNBoaPo0.cjs +0 -48
  37. package/dist/components-CNBoaPo0.cjs.map +0 -1
  38. package/dist/components-GZOhGVCA.js +0 -42
  39. package/dist/components-GZOhGVCA.js.map +0 -1
  40. package/dist/generators-CnEpcL-m.js.map +0 -1
  41. package/dist/generators-Nkjg7hcp.cjs.map +0 -1
@@ -0,0 +1,101 @@
1
+ import { getPathParams } from "@kubb/plugin-oas/utils";
2
+ import { File, Function, FunctionParams } from "@kubb/react-fabric";
3
+ import { URLPath } from "@kubb/core/utils";
4
+ import { isOptional } from "@kubb/oas";
5
+ import { jsx } from "@kubb/react-fabric/jsx-runtime";
6
+
7
+ //#region src/components/Request.tsx
8
+ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
9
+ if (paramsType === "object") return FunctionParams.factory({
10
+ data: {
11
+ mode: "object",
12
+ children: {
13
+ ...getPathParams(typeSchemas.pathParams, {
14
+ typed: true,
15
+ casing: paramsCasing
16
+ }),
17
+ data: typeSchemas.request?.name ? {
18
+ type: typeSchemas.request?.name,
19
+ optional: isOptional(typeSchemas.request?.schema)
20
+ } : void 0,
21
+ params: typeSchemas.queryParams?.name ? {
22
+ type: typeSchemas.queryParams?.name,
23
+ optional: isOptional(typeSchemas.queryParams?.schema)
24
+ } : void 0,
25
+ headers: typeSchemas.headerParams?.name ? {
26
+ type: typeSchemas.headerParams?.name,
27
+ optional: isOptional(typeSchemas.headerParams?.schema)
28
+ } : void 0
29
+ }
30
+ },
31
+ options: {
32
+ type: "Partial<Cypress.RequestOptions>",
33
+ optional: true,
34
+ default: "{}"
35
+ }
36
+ });
37
+ return FunctionParams.factory({
38
+ pathParams: typeSchemas.pathParams?.name ? {
39
+ mode: pathParamsType === "object" ? "object" : "inlineSpread",
40
+ children: getPathParams(typeSchemas.pathParams, {
41
+ typed: true,
42
+ casing: paramsCasing
43
+ }),
44
+ optional: isOptional(typeSchemas.pathParams?.schema)
45
+ } : void 0,
46
+ data: typeSchemas.request?.name ? {
47
+ type: typeSchemas.request?.name,
48
+ optional: isOptional(typeSchemas.request?.schema)
49
+ } : void 0,
50
+ params: typeSchemas.queryParams?.name ? {
51
+ type: typeSchemas.queryParams?.name,
52
+ optional: isOptional(typeSchemas.queryParams?.schema)
53
+ } : void 0,
54
+ headers: typeSchemas.headerParams?.name ? {
55
+ type: typeSchemas.headerParams?.name,
56
+ optional: isOptional(typeSchemas.headerParams?.schema)
57
+ } : void 0,
58
+ options: {
59
+ type: "Partial<Cypress.RequestOptions>",
60
+ optional: true,
61
+ default: "{}"
62
+ }
63
+ });
64
+ }
65
+ function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method, paramsType, paramsCasing, pathParamsType }) {
66
+ const path = new URLPath(url, { casing: paramsCasing });
67
+ const params = getParams({
68
+ paramsType,
69
+ paramsCasing,
70
+ pathParamsType,
71
+ typeSchemas
72
+ });
73
+ const returnType = dataReturnType === "data" ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`;
74
+ const urlTemplate = path.toTemplateString({ prefix: baseURL });
75
+ const requestOptions = [`method: '${method}'`, `url: ${urlTemplate}`];
76
+ if (typeSchemas.queryParams?.name) requestOptions.push("qs: params");
77
+ if (typeSchemas.headerParams?.name) requestOptions.push("headers");
78
+ if (typeSchemas.request?.name) requestOptions.push("body: data");
79
+ requestOptions.push("...options");
80
+ return /* @__PURE__ */ jsx(File.Source, {
81
+ name,
82
+ isIndexable: true,
83
+ isExportable: true,
84
+ children: /* @__PURE__ */ jsx(Function, {
85
+ name,
86
+ export: true,
87
+ params: params.toConstructor(),
88
+ returnType,
89
+ children: dataReturnType === "data" ? `return cy.request<${typeSchemas.response.name}>({
90
+ ${requestOptions.join(",\n ")}
91
+ }).then((res) => res.body)` : `return cy.request<${typeSchemas.response.name}>({
92
+ ${requestOptions.join(",\n ")}
93
+ })`
94
+ })
95
+ });
96
+ }
97
+ Request.getParams = getParams;
98
+
99
+ //#endregion
100
+ export { Request as t };
101
+ //# sourceMappingURL=components-CKNcdnr_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-CKNcdnr_.js","names":["requestOptions: string[]"],"sources":["../src/components/Request.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginCypress } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeSchemas: OperationSchemas\n url: string\n baseURL: string | undefined\n dataReturnType: PluginCypress['resolvedOptions']['dataReturnType']\n paramsCasing: PluginCypress['resolvedOptions']['paramsCasing']\n paramsType: PluginCypress['resolvedOptions']['paramsType']\n pathParamsType: PluginCypress['resolvedOptions']['pathParamsType']\n method: HttpMethod\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginCypress['resolvedOptions']['paramsCasing']\n paramsType: PluginCypress['resolvedOptions']['paramsType']\n pathParamsType: PluginCypress['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method, paramsType, paramsCasing, pathParamsType }: Props): KubbNode {\n const path = new URLPath(url, { casing: paramsCasing })\n\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n // Build the URL template string - this will convert /pets/:petId to /pets/${petId}\n const urlTemplate = path.toTemplateString({ prefix: baseURL })\n\n // Build request options object\n const requestOptions: string[] = [`method: '${method}'`, `url: ${urlTemplate}`]\n\n // Add query params if they exist\n if (typeSchemas.queryParams?.name) {\n requestOptions.push('qs: params')\n }\n\n // Add headers if they exist\n if (typeSchemas.headerParams?.name) {\n requestOptions.push('headers')\n }\n\n // Add body if request schema exists\n if (typeSchemas.request?.name) {\n requestOptions.push('body: data')\n }\n\n // Spread additional Cypress options\n requestOptions.push('...options')\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()} returnType={returnType}>\n {dataReturnType === 'data'\n ? `return cy.request<${typeSchemas.response.name}>({\n ${requestOptions.join(',\\n ')}\n}).then((res) => res.body)`\n : `return cy.request<${typeSchemas.response.name}>({\n ${requestOptions.join(',\\n ')}\n})`}\n </Function>\n </File.Source>\n )\n}\n\nRequest.getParams = getParams\n"],"mappings":";;;;;;;AA8BA,SAAS,UAAU,EAAE,YAAY,cAAc,gBAAgB,eAA+B;AAC5F,KAAI,eAAe,SACjB,QAAO,eAAe,QAAQ;EAC5B,MAAM;GACJ,MAAM;GACN,UAAU;IACR,GAAG,cAAc,YAAY,YAAY;KAAE,OAAO;KAAM,QAAQ;KAAc,CAAC;IAC/E,MAAM,YAAY,SAAS,OACvB;KACE,MAAM,YAAY,SAAS;KAC3B,UAAU,WAAW,YAAY,SAAS,OAAO;KAClD,GACD;IACJ,QAAQ,YAAY,aAAa,OAC7B;KACE,MAAM,YAAY,aAAa;KAC/B,UAAU,WAAW,YAAY,aAAa,OAAO;KACtD,GACD;IACJ,SAAS,YAAY,cAAc,OAC/B;KACE,MAAM,YAAY,cAAc;KAChC,UAAU,WAAW,YAAY,cAAc,OAAO;KACvD,GACD;IACL;GACF;EACD,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;AAGJ,QAAO,eAAe,QAAQ;EAC5B,YAAY,YAAY,YAAY,OAChC;GACE,MAAM,mBAAmB,WAAW,WAAW;GAC/C,UAAU,cAAc,YAAY,YAAY;IAAE,OAAO;IAAM,QAAQ;IAAc,CAAC;GACtF,UAAU,WAAW,YAAY,YAAY,OAAO;GACrD,GACD;EACJ,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,UAAU,WAAW,YAAY,SAAS,OAAO;GAClD,GACD;EACJ,QAAQ,YAAY,aAAa,OAC7B;GACE,MAAM,YAAY,aAAa;GAC/B,UAAU,WAAW,YAAY,aAAa,OAAO;GACtD,GACD;EACJ,SAAS,YAAY,cAAc,OAC/B;GACE,MAAM,YAAY,cAAc;GAChC,UAAU,WAAW,YAAY,cAAc,OAAO;GACvD,GACD;EACJ,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;;AAGJ,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,QAAQ,YAAY,cAAc,kBAAmC;CACnJ,MAAM,OAAO,IAAI,QAAQ,KAAK,EAAE,QAAQ,cAAc,CAAC;CAEvD,MAAM,SAAS,UAAU;EAAE;EAAY;EAAc;EAAgB;EAAa,CAAC;CAEnF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAGlJ,MAAM,cAAc,KAAK,iBAAiB,EAAE,QAAQ,SAAS,CAAC;CAG9D,MAAMA,iBAA2B,CAAC,YAAY,OAAO,IAAI,QAAQ,cAAc;AAG/E,KAAI,YAAY,aAAa,KAC3B,gBAAe,KAAK,aAAa;AAInC,KAAI,YAAY,cAAc,KAC5B,gBAAe,KAAK,UAAU;AAIhC,KAAI,YAAY,SAAS,KACvB,gBAAe,KAAK,aAAa;AAInC,gBAAe,KAAK,aAAa;AAEjC,QACE,oBAAC,KAAK;EAAa;EAAM;EAAY;YACnC,oBAAC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;aACtE,mBAAmB,SAChB,qBAAqB,YAAY,SAAS,KAAK;IACvD,eAAe,KAAK,QAAQ,CAAC;8BAErB,qBAAqB,YAAY,SAAS,KAAK;IACvD,eAAe,KAAK,QAAQ,CAAC;;IAEhB;GACC;;AAIlB,QAAQ,YAAY"}
@@ -0,0 +1,107 @@
1
+ const require_index = require('./index.cjs');
2
+ let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
3
+ let _kubb_react_fabric = require("@kubb/react-fabric");
4
+ let _kubb_core_utils = require("@kubb/core/utils");
5
+ let _kubb_oas = require("@kubb/oas");
6
+ let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
7
+
8
+ //#region src/components/Request.tsx
9
+ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
10
+ if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
11
+ data: {
12
+ mode: "object",
13
+ children: {
14
+ ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
15
+ typed: true,
16
+ casing: paramsCasing
17
+ }),
18
+ data: typeSchemas.request?.name ? {
19
+ type: typeSchemas.request?.name,
20
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
21
+ } : void 0,
22
+ params: typeSchemas.queryParams?.name ? {
23
+ type: typeSchemas.queryParams?.name,
24
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
25
+ } : void 0,
26
+ headers: typeSchemas.headerParams?.name ? {
27
+ type: typeSchemas.headerParams?.name,
28
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
29
+ } : void 0
30
+ }
31
+ },
32
+ options: {
33
+ type: "Partial<Cypress.RequestOptions>",
34
+ optional: true,
35
+ default: "{}"
36
+ }
37
+ });
38
+ return _kubb_react_fabric.FunctionParams.factory({
39
+ pathParams: typeSchemas.pathParams?.name ? {
40
+ mode: pathParamsType === "object" ? "object" : "inlineSpread",
41
+ children: (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
42
+ typed: true,
43
+ casing: paramsCasing
44
+ }),
45
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
46
+ } : void 0,
47
+ data: typeSchemas.request?.name ? {
48
+ type: typeSchemas.request?.name,
49
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
50
+ } : void 0,
51
+ params: typeSchemas.queryParams?.name ? {
52
+ type: typeSchemas.queryParams?.name,
53
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
54
+ } : void 0,
55
+ headers: typeSchemas.headerParams?.name ? {
56
+ type: typeSchemas.headerParams?.name,
57
+ optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
58
+ } : void 0,
59
+ options: {
60
+ type: "Partial<Cypress.RequestOptions>",
61
+ optional: true,
62
+ default: "{}"
63
+ }
64
+ });
65
+ }
66
+ function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method, paramsType, paramsCasing, pathParamsType }) {
67
+ const path = new _kubb_core_utils.URLPath(url, { casing: paramsCasing });
68
+ const params = getParams({
69
+ paramsType,
70
+ paramsCasing,
71
+ pathParamsType,
72
+ typeSchemas
73
+ });
74
+ const returnType = dataReturnType === "data" ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`;
75
+ const urlTemplate = path.toTemplateString({ prefix: baseURL });
76
+ const requestOptions = [`method: '${method}'`, `url: ${urlTemplate}`];
77
+ if (typeSchemas.queryParams?.name) requestOptions.push("qs: params");
78
+ if (typeSchemas.headerParams?.name) requestOptions.push("headers");
79
+ if (typeSchemas.request?.name) requestOptions.push("body: data");
80
+ requestOptions.push("...options");
81
+ return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
82
+ name,
83
+ isIndexable: true,
84
+ isExportable: true,
85
+ children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function, {
86
+ name,
87
+ export: true,
88
+ params: params.toConstructor(),
89
+ returnType,
90
+ children: dataReturnType === "data" ? `return cy.request<${typeSchemas.response.name}>({
91
+ ${requestOptions.join(",\n ")}
92
+ }).then((res) => res.body)` : `return cy.request<${typeSchemas.response.name}>({
93
+ ${requestOptions.join(",\n ")}
94
+ })`
95
+ })
96
+ });
97
+ }
98
+ Request.getParams = getParams;
99
+
100
+ //#endregion
101
+ Object.defineProperty(exports, 'Request', {
102
+ enumerable: true,
103
+ get: function () {
104
+ return Request;
105
+ }
106
+ });
107
+ //# sourceMappingURL=components-UBGR5HIj.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-UBGR5HIj.cjs","names":["FunctionParams","URLPath","requestOptions: string[]","File","Function"],"sources":["../src/components/Request.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginCypress } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeSchemas: OperationSchemas\n url: string\n baseURL: string | undefined\n dataReturnType: PluginCypress['resolvedOptions']['dataReturnType']\n paramsCasing: PluginCypress['resolvedOptions']['paramsCasing']\n paramsType: PluginCypress['resolvedOptions']['paramsType']\n pathParamsType: PluginCypress['resolvedOptions']['pathParamsType']\n method: HttpMethod\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginCypress['resolvedOptions']['paramsCasing']\n paramsType: PluginCypress['resolvedOptions']['paramsType']\n pathParamsType: PluginCypress['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method, paramsType, paramsCasing, pathParamsType }: Props): KubbNode {\n const path = new URLPath(url, { casing: paramsCasing })\n\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n // Build the URL template string - this will convert /pets/:petId to /pets/${petId}\n const urlTemplate = path.toTemplateString({ prefix: baseURL })\n\n // Build request options object\n const requestOptions: string[] = [`method: '${method}'`, `url: ${urlTemplate}`]\n\n // Add query params if they exist\n if (typeSchemas.queryParams?.name) {\n requestOptions.push('qs: params')\n }\n\n // Add headers if they exist\n if (typeSchemas.headerParams?.name) {\n requestOptions.push('headers')\n }\n\n // Add body if request schema exists\n if (typeSchemas.request?.name) {\n requestOptions.push('body: data')\n }\n\n // Spread additional Cypress options\n requestOptions.push('...options')\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()} returnType={returnType}>\n {dataReturnType === 'data'\n ? `return cy.request<${typeSchemas.response.name}>({\n ${requestOptions.join(',\\n ')}\n}).then((res) => res.body)`\n : `return cy.request<${typeSchemas.response.name}>({\n ${requestOptions.join(',\\n ')}\n})`}\n </Function>\n </File.Source>\n )\n}\n\nRequest.getParams = getParams\n"],"mappings":";;;;;;;;AA8BA,SAAS,UAAU,EAAE,YAAY,cAAc,gBAAgB,eAA+B;AAC5F,KAAI,eAAe,SACjB,QAAOA,kCAAe,QAAQ;EAC5B,MAAM;GACJ,MAAM;GACN,UAAU;IACR,6CAAiB,YAAY,YAAY;KAAE,OAAO;KAAM,QAAQ;KAAc,CAAC;IAC/E,MAAM,YAAY,SAAS,OACvB;KACE,MAAM,YAAY,SAAS;KAC3B,oCAAqB,YAAY,SAAS,OAAO;KAClD,GACD;IACJ,QAAQ,YAAY,aAAa,OAC7B;KACE,MAAM,YAAY,aAAa;KAC/B,oCAAqB,YAAY,aAAa,OAAO;KACtD,GACD;IACJ,SAAS,YAAY,cAAc,OAC/B;KACE,MAAM,YAAY,cAAc;KAChC,oCAAqB,YAAY,cAAc,OAAO;KACvD,GACD;IACL;GACF;EACD,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;AAGJ,QAAOA,kCAAe,QAAQ;EAC5B,YAAY,YAAY,YAAY,OAChC;GACE,MAAM,mBAAmB,WAAW,WAAW;GAC/C,oDAAwB,YAAY,YAAY;IAAE,OAAO;IAAM,QAAQ;IAAc,CAAC;GACtF,oCAAqB,YAAY,YAAY,OAAO;GACrD,GACD;EACJ,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,oCAAqB,YAAY,SAAS,OAAO;GAClD,GACD;EACJ,QAAQ,YAAY,aAAa,OAC7B;GACE,MAAM,YAAY,aAAa;GAC/B,oCAAqB,YAAY,aAAa,OAAO;GACtD,GACD;EACJ,SAAS,YAAY,cAAc,OAC/B;GACE,MAAM,YAAY,cAAc;GAChC,oCAAqB,YAAY,cAAc,OAAO;GACvD,GACD;EACJ,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;;AAGJ,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,QAAQ,YAAY,cAAc,kBAAmC;CACnJ,MAAM,OAAO,IAAIC,yBAAQ,KAAK,EAAE,QAAQ,cAAc,CAAC;CAEvD,MAAM,SAAS,UAAU;EAAE;EAAY;EAAc;EAAgB;EAAa,CAAC;CAEnF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAGlJ,MAAM,cAAc,KAAK,iBAAiB,EAAE,QAAQ,SAAS,CAAC;CAG9D,MAAMC,iBAA2B,CAAC,YAAY,OAAO,IAAI,QAAQ,cAAc;AAG/E,KAAI,YAAY,aAAa,KAC3B,gBAAe,KAAK,aAAa;AAInC,KAAI,YAAY,cAAc,KAC5B,gBAAe,KAAK,UAAU;AAIhC,KAAI,YAAY,SAAS,KACvB,gBAAe,KAAK,aAAa;AAInC,gBAAe,KAAK,aAAa;AAEjC,QACE,wDAACC,wBAAK;EAAa;EAAM;EAAY;YACnC,wDAACC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;aACtE,mBAAmB,SAChB,qBAAqB,YAAY,SAAS,KAAK;IACvD,eAAe,KAAK,QAAQ,CAAC;8BAErB,qBAAqB,YAAY,SAAS,KAAK;IACvD,eAAe,KAAK,QAAQ,CAAC;;IAEhB;GACC;;AAIlB,QAAQ,YAAY"}
@@ -1,3 +1,3 @@
1
- const require_components = require('./components-CNBoaPo0.cjs');
1
+ const require_components = require('./components-UBGR5HIj.cjs');
2
2
 
3
3
  exports.Request = require_components.Request;
@@ -1,4 +1,5 @@
1
- import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-DjLyok_a.cjs";
1
+ import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-Bi9SkBrH.cjs";
2
+ import { FunctionParams } from "@kubb/react-fabric";
2
3
  import { KubbNode } from "@kubb/react-fabric/types";
3
4
 
4
5
  //#region src/components/Request.d.ts
@@ -11,16 +12,36 @@ type Props = {
11
12
  url: string;
12
13
  baseURL: string | undefined;
13
14
  dataReturnType: PluginCypress['resolvedOptions']['dataReturnType'];
15
+ paramsCasing: PluginCypress['resolvedOptions']['paramsCasing'];
16
+ paramsType: PluginCypress['resolvedOptions']['paramsType'];
17
+ pathParamsType: PluginCypress['resolvedOptions']['pathParamsType'];
14
18
  method: HttpMethod;
15
19
  };
20
+ type GetParamsProps = {
21
+ paramsCasing: PluginCypress['resolvedOptions']['paramsCasing'];
22
+ paramsType: PluginCypress['resolvedOptions']['paramsType'];
23
+ pathParamsType: PluginCypress['resolvedOptions']['pathParamsType'];
24
+ typeSchemas: OperationSchemas;
25
+ };
16
26
  declare function Request({
17
27
  baseURL,
18
28
  name,
19
29
  dataReturnType,
20
30
  typeSchemas,
21
31
  url,
22
- method
32
+ method,
33
+ paramsType,
34
+ paramsCasing,
35
+ pathParamsType
23
36
  }: Props): KubbNode;
37
+ declare namespace Request {
38
+ var getParams: ({
39
+ paramsType,
40
+ paramsCasing,
41
+ pathParamsType,
42
+ typeSchemas
43
+ }: GetParamsProps) => FunctionParams;
44
+ }
24
45
  //#endregion
25
46
  export { Request };
26
47
  //# sourceMappingURL=components.d.cts.map
@@ -1,4 +1,5 @@
1
- import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-BVMff21d.js";
1
+ import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-Bs7HVpiD.js";
2
+ import { FunctionParams } from "@kubb/react-fabric";
2
3
  import { KubbNode } from "@kubb/react-fabric/types";
3
4
 
4
5
  //#region src/components/Request.d.ts
@@ -11,16 +12,36 @@ type Props = {
11
12
  url: string;
12
13
  baseURL: string | undefined;
13
14
  dataReturnType: PluginCypress['resolvedOptions']['dataReturnType'];
15
+ paramsCasing: PluginCypress['resolvedOptions']['paramsCasing'];
16
+ paramsType: PluginCypress['resolvedOptions']['paramsType'];
17
+ pathParamsType: PluginCypress['resolvedOptions']['pathParamsType'];
14
18
  method: HttpMethod;
15
19
  };
20
+ type GetParamsProps = {
21
+ paramsCasing: PluginCypress['resolvedOptions']['paramsCasing'];
22
+ paramsType: PluginCypress['resolvedOptions']['paramsType'];
23
+ pathParamsType: PluginCypress['resolvedOptions']['pathParamsType'];
24
+ typeSchemas: OperationSchemas;
25
+ };
16
26
  declare function Request({
17
27
  baseURL,
18
28
  name,
19
29
  dataReturnType,
20
30
  typeSchemas,
21
31
  url,
22
- method
32
+ method,
33
+ paramsType,
34
+ paramsCasing,
35
+ pathParamsType
23
36
  }: Props): KubbNode;
37
+ declare namespace Request {
38
+ var getParams: ({
39
+ paramsType,
40
+ paramsCasing,
41
+ pathParamsType,
42
+ typeSchemas
43
+ }: GetParamsProps) => FunctionParams;
44
+ }
24
45
  //#endregion
25
46
  export { Request };
26
47
  //# sourceMappingURL=components.d.ts.map
@@ -1,3 +1,3 @@
1
- import { t as Request } from "./components-GZOhGVCA.js";
1
+ import { t as Request } from "./components-CKNcdnr_.js";
2
2
 
3
3
  export { Request };
@@ -1,8 +1,7 @@
1
- const require_components = require('./components-CNBoaPo0.cjs');
1
+ const require_components = require('./components-UBGR5HIj.cjs');
2
2
  const require_index = require('./index.cjs');
3
3
  let _kubb_plugin_ts = require("@kubb/plugin-ts");
4
4
  let _kubb_core_hooks = require("@kubb/core/hooks");
5
- let _kubb_core_utils = require("@kubb/core/utils");
6
5
  let _kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
7
6
  let _kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
8
7
  let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
@@ -13,7 +12,7 @@ let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
13
12
  const cypressGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
14
13
  name: "cypress",
15
14
  Operation({ operation, generator, plugin }) {
16
- const { options: { output, baseURL, dataReturnType } } = plugin;
15
+ const { options: { output, baseURL, dataReturnType, paramsCasing, paramsType, pathParamsType } } = plugin;
17
16
  const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
18
17
  const oas = (0, _kubb_plugin_oas_hooks.useOas)();
19
18
  const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
@@ -56,10 +55,13 @@ const cypressGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
56
55
  }), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Request, {
57
56
  name: request.name,
58
57
  dataReturnType,
58
+ paramsCasing,
59
+ paramsType,
60
+ pathParamsType,
59
61
  typeSchemas: type.schemas,
60
62
  method: operation.method,
61
63
  baseURL,
62
- url: new _kubb_core_utils.URLPath(operation.path).toURLPath()
64
+ url: operation.path
63
65
  })]
64
66
  });
65
67
  }
@@ -72,4 +74,4 @@ Object.defineProperty(exports, 'cypressGenerator', {
72
74
  return cypressGenerator;
73
75
  }
74
76
  });
75
- //# sourceMappingURL=generators-Nkjg7hcp.cjs.map
77
+ //# sourceMappingURL=generators-Ct9I-qNg.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-Ct9I-qNg.cjs","names":["pluginTsName","File","Request"],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, baseURL, dataReturnType, paramsCasing, paramsType, pathParamsType },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={operation.path}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;AASA,MAAa,yEAAuD;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,gBAAgB,cAAc,YAAY,qBACpE;EACJ,MAAM,wDAAkC;EAExC,MAAM,0CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,4DAAgC,UAAU;EAEvE,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,6BAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,6BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,yDAACC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,8CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,8CAAkB;IAAE;IAAK;IAAQ,CAAC;cAElC,wDAACA,wBAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,wDAACC;IACC,MAAM,QAAQ;IACE;IACF;IACF;IACI;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,UAAU;KACf;IACG;;CAGZ,CAAC"}
@@ -1,7 +1,6 @@
1
- import { t as Request } from "./components-GZOhGVCA.js";
1
+ import { t as Request } from "./components-CKNcdnr_.js";
2
2
  import { pluginTsName } from "@kubb/plugin-ts";
3
3
  import { usePluginManager } from "@kubb/core/hooks";
4
- import { URLPath } from "@kubb/core/utils";
5
4
  import { createReactGenerator } from "@kubb/plugin-oas/generators";
6
5
  import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
7
6
  import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
@@ -12,7 +11,7 @@ import { jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
12
11
  const cypressGenerator = createReactGenerator({
13
12
  name: "cypress",
14
13
  Operation({ operation, generator, plugin }) {
15
- const { options: { output, baseURL, dataReturnType } } = plugin;
14
+ const { options: { output, baseURL, dataReturnType, paramsCasing, paramsType, pathParamsType } } = plugin;
16
15
  const pluginManager = usePluginManager();
17
16
  const oas = useOas();
18
17
  const { getSchemas, getName, getFile } = useOperationManager(generator);
@@ -55,10 +54,13 @@ const cypressGenerator = createReactGenerator({
55
54
  }), /* @__PURE__ */ jsx(Request, {
56
55
  name: request.name,
57
56
  dataReturnType,
57
+ paramsCasing,
58
+ paramsType,
59
+ pathParamsType,
58
60
  typeSchemas: type.schemas,
59
61
  method: operation.method,
60
62
  baseURL,
61
- url: new URLPath(operation.path).toURLPath()
63
+ url: operation.path
62
64
  })]
63
65
  });
64
66
  }
@@ -66,4 +68,4 @@ const cypressGenerator = createReactGenerator({
66
68
 
67
69
  //#endregion
68
70
  export { cypressGenerator as t };
69
- //# sourceMappingURL=generators-CnEpcL-m.js.map
71
+ //# sourceMappingURL=generators-D_AameR6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-D_AameR6.js","names":[],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, baseURL, dataReturnType, paramsCasing, paramsType, pathParamsType },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const request = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={request.file.baseName}\n path={request.file.path}\n meta={request.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={request.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Request\n name={request.name}\n dataReturnType={dataReturnType}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={operation.path}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;AASA,MAAa,mBAAmB,qBAAoC;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,gBAAgB,cAAc,YAAY,qBACpE;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAEvE,MAAM,UAAU;GACd,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;GAC9C,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,qBAAC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,QAAQ,UAAU;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,QAAQ,UAAU;IAAE;IAAK;IAAQ,CAAC;cAElC,oBAAC,KAAK;IACJ,MAAM;KACJ,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,SAAS;KACtB,KAAK,QAAQ,YAAY;KACzB,KAAK,QAAQ,aAAa;KAC1B,KAAK,QAAQ,cAAc;KAC3B,GAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,KAAK,KAAK,IAAI,EAAE;KAC7D,CAAC,OAAO,QAAQ;IACjB,MAAM,QAAQ,KAAK;IACnB,MAAM,KAAK,KAAK;IAChB;KACA,EACF,oBAAC;IACC,MAAM,QAAQ;IACE;IACF;IACF;IACI;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,UAAU;KACf;IACG;;CAGZ,CAAC"}
@@ -1,3 +1,3 @@
1
- const require_generators = require('./generators-Nkjg7hcp.cjs');
1
+ const require_generators = require('./generators-Ct9I-qNg.cjs');
2
2
 
3
3
  exports.cypressGenerator = require_generators.cypressGenerator;
@@ -1,4 +1,4 @@
1
- import { n as PluginCypress, r as ReactGenerator } from "./types-DjLyok_a.cjs";
1
+ import { n as PluginCypress, r as ReactGenerator } from "./types-Bi9SkBrH.cjs";
2
2
 
3
3
  //#region src/generators/cypressGenerator.d.ts
4
4
  declare const cypressGenerator: ReactGenerator<PluginCypress>;
@@ -1,4 +1,4 @@
1
- import { n as PluginCypress, r as ReactGenerator } from "./types-BVMff21d.js";
1
+ import { n as PluginCypress, r as ReactGenerator } from "./types-Bs7HVpiD.js";
2
2
 
3
3
  //#region src/generators/cypressGenerator.d.ts
4
4
  declare const cypressGenerator: ReactGenerator<PluginCypress>;
@@ -1,3 +1,3 @@
1
- import { t as cypressGenerator } from "./generators-CnEpcL-m.js";
1
+ import { t as cypressGenerator } from "./generators-D_AameR6.js";
2
2
 
3
3
  export { cypressGenerator };
package/dist/index.cjs CHANGED
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
- const require_generators = require('./generators-Nkjg7hcp.cjs');
28
+ const require_generators = require('./generators-Ct9I-qNg.cjs');
29
29
  let node_path = require("node:path");
30
30
  node_path = __toESM(node_path);
31
31
  let _kubb_core = require("@kubb/core");
@@ -39,14 +39,17 @@ const pluginCypress = (0, _kubb_core.definePlugin)((options) => {
39
39
  const { output = {
40
40
  path: "cypress",
41
41
  barrelType: "named"
42
- }, group, dataReturnType = "data", exclude = [], include, override = [], transformers = {}, generators = [require_generators.cypressGenerator].filter(Boolean), contentType, baseURL } = options;
42
+ }, group, dataReturnType = "data", exclude = [], include, override = [], transformers = {}, generators = [require_generators.cypressGenerator].filter(Boolean), contentType, baseURL, paramsCasing = "camelcase", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline" } = options;
43
43
  return {
44
44
  name: pluginCypressName,
45
45
  options: {
46
46
  output,
47
47
  dataReturnType,
48
48
  group,
49
- baseURL
49
+ baseURL,
50
+ paramsCasing,
51
+ paramsType,
52
+ pathParamsType
50
53
  },
51
54
  pre: [_kubb_plugin_oas.pluginOasName, _kubb_plugin_ts.pluginTsName].filter(Boolean),
52
55
  resolvePath(baseName, pathMode, options$1) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["cypressGenerator","pluginOasName","pluginTsName","path","options","groupName: Group['name']","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\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 = definePlugin<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 } = options\n\n return {\n name: pluginCypressName,\n options: {\n output,\n dataReturnType,\n group,\n baseURL,\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 pluginManager: this.pluginManager,\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 pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAa,oBAAoB;AAEjC,MAAa,8CAA6C,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,CAACA,oCAAiB,CAAC,OAAO,QAAQ,EAC/C,aACA,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK,CAACC,gCAAeC,6BAAa,CAAC,OAAO,QAAQ;EAClD,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,oCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUC,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,0CAAa,IAAI,MAAM,CAAC;;AAGrC,WAAOF,kBAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASC,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAOD,kBAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,sDAAyB,MAAM,EACnC,QAAQ,SAAS,QAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAOA,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,+BAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,QAAQ,MAba,IAAIG,oCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,qCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["cypressGenerator","pluginOasName","pluginTsName","path","options","groupName: Group['name']","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\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 = definePlugin<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 = 'camelcase',\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 pluginManager: this.pluginManager,\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 pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAa,oBAAoB;AAEjC,MAAa,8CAA6C,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,CAACA,oCAAiB,CAAC,OAAO,QAAQ,EAC/C,aACA,SACA,eAAe,aACf,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,CAACC,gCAAeC,6BAAa,CAAC,OAAO,QAAQ;EAClD,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,oCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUC,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,0CAAa,IAAI,MAAM,CAAC;;AAGrC,WAAOF,kBAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASC,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAOD,kBAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,sDAAyB,MAAM,EACnC,QAAQ,SAAS,QAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAOA,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,+BAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,QAAQ,MAba,IAAIG,oCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,qCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-DjLyok_a.cjs";
1
+ import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-Bi9SkBrH.cjs";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginCypressName = "plugin-cypress";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-BVMff21d.js";
1
+ import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-Bs7HVpiD.js";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginCypressName = "plugin-cypress";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as cypressGenerator } from "./generators-CnEpcL-m.js";
1
+ import { t as cypressGenerator } from "./generators-D_AameR6.js";
2
2
  import path from "node:path";
3
3
  import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
4
4
  import { camelCase } from "@kubb/core/transformers";
@@ -11,14 +11,17 @@ const pluginCypress = definePlugin((options) => {
11
11
  const { output = {
12
12
  path: "cypress",
13
13
  barrelType: "named"
14
- }, group, dataReturnType = "data", exclude = [], include, override = [], transformers = {}, generators = [cypressGenerator].filter(Boolean), contentType, baseURL } = options;
14
+ }, group, dataReturnType = "data", exclude = [], include, override = [], transformers = {}, generators = [cypressGenerator].filter(Boolean), contentType, baseURL, paramsCasing = "camelcase", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline" } = options;
15
15
  return {
16
16
  name: pluginCypressName,
17
17
  options: {
18
18
  output,
19
19
  dataReturnType,
20
20
  group,
21
- baseURL
21
+ baseURL,
22
+ paramsCasing,
23
+ paramsType,
24
+ pathParamsType
22
25
  },
23
26
  pre: [pluginOasName, pluginTsName].filter(Boolean),
24
27
  resolvePath(baseName, pathMode, options$1) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\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 = definePlugin<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 } = options\n\n return {\n name: pluginCypressName,\n options: {\n output,\n dataReturnType,\n group,\n baseURL,\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 pluginManager: this.pluginManager,\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 pluginKey: this.plugin.key,\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,YACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK,CAAC,eAAe,aAAa,CAAC,OAAO,QAAQ;EAClD,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;AAGrC,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM,EACnC,QAAQ,SAAS,QAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,QAAQ,MAba,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\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 = definePlugin<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 = 'camelcase',\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 pluginManager: this.pluginManager,\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 pluginKey: this.plugin.key,\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,eAAe,aACf,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,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;AAGrC,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM,EACnC,QAAQ,SAAS,QAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,UAAU;GACd,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,QAAQ,MAba,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}