@kubb/plugin-cypress 4.11.1 → 4.11.3
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/dist/{components-DpCpyvbD.js → components-B-dUAGQo.js} +18 -6
- package/dist/components-B-dUAGQo.js.map +1 -0
- package/dist/{components-Be12iXXU.cjs → components-DYt2ZP4C.cjs} +18 -6
- package/dist/components-DYt2ZP4C.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-DI24flbw.js → generators-BQycxSP1.js} +2 -2
- package/dist/{generators-DI24flbw.js.map → generators-BQycxSP1.js.map} +1 -1
- package/dist/{generators-DkgSCwAo.cjs → generators-DHCx8qS9.cjs} +2 -2
- package/dist/{generators-DkgSCwAo.cjs.map → generators-DHCx8qS9.cjs.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/{types-BivqzA93.d.ts → types-Cu2aEsbs.d.ts} +61 -28
- package/dist/{types-DHW5okz7.d.cts → types-DosRH6oz.d.cts} +61 -28
- package/package.json +5 -5
- package/src/components/Request.tsx +12 -1
- package/src/generators/__snapshots__/createPet.ts +9 -2
- package/src/generators/__snapshots__/deletePet.ts +9 -2
- package/src/generators/__snapshots__/getPets.ts +9 -2
- package/src/generators/__snapshots__/showPetById.ts +9 -2
- package/src/plugin.ts +1 -0
- package/dist/components-Be12iXXU.cjs.map +0 -1
- package/dist/components-DpCpyvbD.js.map +0 -1
|
@@ -5,10 +5,17 @@ import { jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/Request.tsx
|
|
7
7
|
function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method }) {
|
|
8
|
-
const params = FunctionParams.factory({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const params = FunctionParams.factory({
|
|
9
|
+
data: typeSchemas.request?.name ? {
|
|
10
|
+
type: typeSchemas.request?.name,
|
|
11
|
+
optional: isOptional(typeSchemas.request?.schema)
|
|
12
|
+
} : void 0,
|
|
13
|
+
options: {
|
|
14
|
+
type: "Partial<Cypress.RequestOptions>",
|
|
15
|
+
optional: true,
|
|
16
|
+
default: "{}"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
12
19
|
const returnType = dataReturnType === "data" ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`;
|
|
13
20
|
const body = typeSchemas.request?.name ? "data" : void 0;
|
|
14
21
|
return /* @__PURE__ */ jsx(File.Source, {
|
|
@@ -20,11 +27,16 @@ function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method
|
|
|
20
27
|
export: true,
|
|
21
28
|
params: params.toConstructor(),
|
|
22
29
|
returnType,
|
|
23
|
-
children: [dataReturnType === "data" && `return cy.request(
|
|
30
|
+
children: [dataReturnType === "data" && `return cy.request({
|
|
31
|
+
method: '${method}',
|
|
32
|
+
url: '${baseURL ?? ""}${new URLPath(url).toURLPath().replace(/([^/]):/g, "$1\\\\:")}',
|
|
33
|
+
body: ${body},
|
|
34
|
+
...options,
|
|
35
|
+
}).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`, dataReturnType === "full" && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ""}${url}`).toURLPath()}', ${body})`]
|
|
24
36
|
})
|
|
25
37
|
});
|
|
26
38
|
}
|
|
27
39
|
|
|
28
40
|
//#endregion
|
|
29
41
|
export { Request as t };
|
|
30
|
-
//# sourceMappingURL=components-
|
|
42
|
+
//# sourceMappingURL=components-B-dUAGQo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-B-dUAGQo.js","names":[],"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 { 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 method: HttpMethod\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props): KubbNode {\n const params = FunctionParams.factory({\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n const body = typeSchemas.request?.name ? 'data' : undefined\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({\n method: '${method}', \n url: '${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')}', \n body: ${body},\n ...options,\n }).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}\n {dataReturnType === 'full' && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ''}${url}`).toURLPath()}', ${body})`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,UAA2B;CACzG,MAAM,SAAS,eAAe,QAAQ;EACpC,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,UAAU,WAAW,YAAY,SAAS,OAAO;GAClD,GACD;EAEJ,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;CAEF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAElJ,MAAM,OAAO,YAAY,SAAS,OAAO,SAAS;AAElD,QACE,oBAAC,KAAK;EAAa;EAAM;EAAY;YACnC,qBAAC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;cACtE,mBAAmB,UAClB;uBACa,OAAO;oBACV,WAAW,KAAK,IAAI,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU,CAAC;oBAC5E,KAAK;;2CAEkB,YAAY,SAAS,KAAK,kBAC5D,mBAAmB,UAAU,sBAAsB,OAAO,MAAM,IAAI,QAAQ,GAAG,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK;IACpH;GACC"}
|
|
@@ -6,10 +6,17 @@ let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/Request.tsx
|
|
8
8
|
function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method }) {
|
|
9
|
-
const params = __kubb_react_fabric.FunctionParams.factory({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const params = __kubb_react_fabric.FunctionParams.factory({
|
|
10
|
+
data: typeSchemas.request?.name ? {
|
|
11
|
+
type: typeSchemas.request?.name,
|
|
12
|
+
optional: (0, __kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
13
|
+
} : void 0,
|
|
14
|
+
options: {
|
|
15
|
+
type: "Partial<Cypress.RequestOptions>",
|
|
16
|
+
optional: true,
|
|
17
|
+
default: "{}"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
13
20
|
const returnType = dataReturnType === "data" ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`;
|
|
14
21
|
const body = typeSchemas.request?.name ? "data" : void 0;
|
|
15
22
|
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
|
|
@@ -21,7 +28,12 @@ function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method
|
|
|
21
28
|
export: true,
|
|
22
29
|
params: params.toConstructor(),
|
|
23
30
|
returnType,
|
|
24
|
-
children: [dataReturnType === "data" && `return cy.request(
|
|
31
|
+
children: [dataReturnType === "data" && `return cy.request({
|
|
32
|
+
method: '${method}',
|
|
33
|
+
url: '${baseURL ?? ""}${new __kubb_core_utils.URLPath(url).toURLPath().replace(/([^/]):/g, "$1\\\\:")}',
|
|
34
|
+
body: ${body},
|
|
35
|
+
...options,
|
|
36
|
+
}).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`, dataReturnType === "full" && `return cy.request('${method}', '${new __kubb_core_utils.URLPath(`${baseURL ?? ""}${url}`).toURLPath()}', ${body})`]
|
|
25
37
|
})
|
|
26
38
|
});
|
|
27
39
|
}
|
|
@@ -33,4 +45,4 @@ Object.defineProperty(exports, 'Request', {
|
|
|
33
45
|
return Request;
|
|
34
46
|
}
|
|
35
47
|
});
|
|
36
|
-
//# sourceMappingURL=components-
|
|
48
|
+
//# sourceMappingURL=components-DYt2ZP4C.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-DYt2ZP4C.cjs","names":["FunctionParams","File","Function","URLPath"],"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 { 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 method: HttpMethod\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props): KubbNode {\n const params = FunctionParams.factory({\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n\n options: {\n type: 'Partial<Cypress.RequestOptions>',\n optional: true,\n default: '{}',\n },\n })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n const body = typeSchemas.request?.name ? 'data' : undefined\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({\n method: '${method}', \n url: '${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')}', \n body: ${body},\n ...options,\n }).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}\n {dataReturnType === 'full' && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ''}${url}`).toURLPath()}', ${body})`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;AAmBA,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,UAA2B;CACzG,MAAM,SAASA,mCAAe,QAAQ;EACpC,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,qCAAqB,YAAY,SAAS,OAAO;GAClD,GACD;EAEJ,SAAS;GACP,MAAM;GACN,UAAU;GACV,SAAS;GACV;EACF,CAAC;CAEF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAElJ,MAAM,OAAO,YAAY,SAAS,OAAO,SAAS;AAElD,QACE,yDAACC,yBAAK;EAAa;EAAM;EAAY;YACnC,0DAACC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;cACtE,mBAAmB,UAClB;uBACa,OAAO;oBACV,WAAW,KAAK,IAAIC,0BAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU,CAAC;oBAC5E,KAAK;;2CAEkB,YAAY,SAAS,KAAK,kBAC5D,mBAAmB,UAAU,sBAAsB,OAAO,MAAM,IAAIA,0BAAQ,GAAG,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK;IACpH;GACC"}
|
package/dist/components.cjs
CHANGED
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-
|
|
1
|
+
import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-DosRH6oz.cjs";
|
|
2
2
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Request.d.ts
|
package/dist/components.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-
|
|
1
|
+
import { i as OperationSchemas, n as PluginCypress, o as HttpMethod } from "./types-Cu2aEsbs.js";
|
|
2
2
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Request.d.ts
|
package/dist/components.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Request } from "./components-
|
|
1
|
+
import { t as Request } from "./components-B-dUAGQo.js";
|
|
2
2
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
3
3
|
import { usePluginManager } from "@kubb/core/hooks";
|
|
4
4
|
import { URLPath } from "@kubb/core/utils";
|
|
@@ -66,4 +66,4 @@ const cypressGenerator = createReactGenerator({
|
|
|
66
66
|
|
|
67
67
|
//#endregion
|
|
68
68
|
export { cypressGenerator as t };
|
|
69
|
-
//# sourceMappingURL=generators-
|
|
69
|
+
//# sourceMappingURL=generators-BQycxSP1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generators-
|
|
1
|
+
{"version":3,"file":"generators-BQycxSP1.js","names":[],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\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 },\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 typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,mBAAmB,qBAAoC;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B;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;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAI,QAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_components = require('./components-
|
|
1
|
+
const require_components = require('./components-DYt2ZP4C.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");
|
|
@@ -72,4 +72,4 @@ Object.defineProperty(exports, 'cypressGenerator', {
|
|
|
72
72
|
return cypressGenerator;
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
-
//# sourceMappingURL=generators-
|
|
75
|
+
//# sourceMappingURL=generators-DHCx8qS9.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generators-
|
|
1
|
+
{"version":3,"file":"generators-DHCx8qS9.cjs","names":["pluginTsName","File","Request","URLPath"],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\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 },\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 typeSchemas={type.schemas}\n method={operation.method}\n baseURL={baseURL}\n url={new URLPath(operation.path).toURLPath()}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,0EAAuD;CAClE,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B;EACJ,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,6DAAgC,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,8BAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,8BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,0DAACC;GACC,UAAU,QAAQ,KAAK;GACvB,MAAM,QAAQ,KAAK;GACnB,MAAM,QAAQ,KAAK;GACnB,+CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,+CAAkB;IAAE;IAAK;IAAQ,CAAC;cAElC,yDAACA,yBAAK;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,yDAACC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAIC,0BAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
package/dist/generators.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginCypress, r as ReactGenerator } from "./types-
|
|
1
|
+
import { n as PluginCypress, r as ReactGenerator } from "./types-DosRH6oz.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/cypressGenerator.d.ts
|
|
4
4
|
declare const cypressGenerator: ReactGenerator<PluginCypress>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginCypress, r as ReactGenerator } from "./types-
|
|
1
|
+
import { n as PluginCypress, r as ReactGenerator } from "./types-Cu2aEsbs.js";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/cypressGenerator.d.ts
|
|
4
4
|
declare const cypressGenerator: ReactGenerator<PluginCypress>;
|
package/dist/generators.js
CHANGED
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-
|
|
28
|
+
const require_generators = require('./generators-DHCx8qS9.cjs');
|
|
29
29
|
let node_path = require("node:path");
|
|
30
30
|
node_path = __toESM(node_path);
|
|
31
31
|
let __kubb_core = require("@kubb/core");
|
|
@@ -79,6 +79,7 @@ const pluginCypress = (0, __kubb_core.definePlugin)((options) => {
|
|
|
79
79
|
fabric: this.fabric,
|
|
80
80
|
oas,
|
|
81
81
|
pluginManager: this.pluginManager,
|
|
82
|
+
logger: this.logger,
|
|
82
83
|
plugin: this.plugin,
|
|
83
84
|
contentType,
|
|
84
85
|
exclude,
|
package/dist/index.cjs.map
CHANGED
|
@@ -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 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 logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAa,oBAAoB;AAEjC,MAAa,+CAA6C,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,iCAAeC,8BAAa,CAAC,OAAO,QAAQ;EAClD,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,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,2CAAa,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,uDAAyB,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,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;
|
|
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 logger: this.logger,\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 logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAa,oBAAoB;AAEjC,MAAa,+CAA6C,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,iCAAeC,8BAAa,CAAC,OAAO,QAAQ;EAClD,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,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,2CAAa,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,uDAAyB,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,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,QAAQ,MAba,IAAIG,qCAAmB,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,sCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,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-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-DosRH6oz.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-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginCypress, t as Options } from "./types-Cu2aEsbs.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-
|
|
1
|
+
import { t as cypressGenerator } from "./generators-BQycxSP1.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";
|
|
@@ -51,6 +51,7 @@ const pluginCypress = definePlugin((options) => {
|
|
|
51
51
|
fabric: this.fabric,
|
|
52
52
|
oas,
|
|
53
53
|
pluginManager: this.pluginManager,
|
|
54
|
+
logger: this.logger,
|
|
54
55
|
plugin: this.plugin,
|
|
55
56
|
contentType,
|
|
56
57
|
exclude,
|
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 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 logger: this.logger,\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;
|
|
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 logger: this.logger,\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 logger: this.logger,\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;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
|
@@ -73,13 +73,35 @@ type DebugEvent = {
|
|
|
73
73
|
date: Date;
|
|
74
74
|
logs: string[];
|
|
75
75
|
fileName?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Category of the debug log, used for GitHub Actions grouping
|
|
78
|
+
* - 'setup': Initial configuration and environment setup
|
|
79
|
+
* - 'plugin': Plugin installation and execution
|
|
80
|
+
* - 'hook': Plugin hook execution details
|
|
81
|
+
* - 'schema': Schema parsing and generation
|
|
82
|
+
* - 'file': File operations (read/write/generate)
|
|
83
|
+
* - 'error': Error details and stack traces
|
|
84
|
+
* - undefined: Generic logs (always inline)
|
|
85
|
+
*/
|
|
86
|
+
category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
|
|
87
|
+
/**
|
|
88
|
+
* Plugin name for grouping plugin-specific logs together
|
|
89
|
+
*/
|
|
90
|
+
pluginName?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Indicates if this is the start or end of a plugin's execution
|
|
93
|
+
* - 'start': Start of plugin execution group
|
|
94
|
+
* - 'end': End of plugin execution group
|
|
95
|
+
*/
|
|
96
|
+
pluginGroupMarker?: 'start' | 'end';
|
|
76
97
|
};
|
|
77
98
|
type Events$1 = {
|
|
78
99
|
start: [message: string];
|
|
79
100
|
success: [message: string];
|
|
80
|
-
error: [message: string,
|
|
101
|
+
error: [message: string, error: Error];
|
|
81
102
|
warning: [message: string];
|
|
82
103
|
debug: [DebugEvent];
|
|
104
|
+
verbose: [DebugEvent];
|
|
83
105
|
info: [message: string];
|
|
84
106
|
progress_start: [{
|
|
85
107
|
id: string;
|
|
@@ -103,7 +125,7 @@ type Logger = {
|
|
|
103
125
|
consola?: ConsolaInstance;
|
|
104
126
|
on: EventEmitter<Events$1>['on'];
|
|
105
127
|
emit: EventEmitter<Events$1>['emit'];
|
|
106
|
-
writeLogs: () => Promise<
|
|
128
|
+
writeLogs: () => Promise<void>;
|
|
107
129
|
};
|
|
108
130
|
//#endregion
|
|
109
131
|
//#region ../core/src/utils/types.d.ts
|
|
@@ -414,14 +436,35 @@ type Group = {
|
|
|
414
436
|
//#region ../core/src/PluginManager.d.ts
|
|
415
437
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
416
438
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
417
|
-
type
|
|
418
|
-
message: string;
|
|
439
|
+
type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
419
440
|
strategy: Strategy;
|
|
420
441
|
hookName: H;
|
|
421
442
|
plugin: Plugin;
|
|
422
443
|
parameters?: unknown[] | undefined;
|
|
423
444
|
output?: unknown;
|
|
424
445
|
};
|
|
446
|
+
type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
447
|
+
duration: number;
|
|
448
|
+
strategy: Strategy;
|
|
449
|
+
hookName: H;
|
|
450
|
+
plugin: Plugin;
|
|
451
|
+
parameters?: unknown[] | undefined;
|
|
452
|
+
output?: unknown;
|
|
453
|
+
};
|
|
454
|
+
type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
455
|
+
hookName: H;
|
|
456
|
+
duration: number;
|
|
457
|
+
strategy: Strategy;
|
|
458
|
+
parameters?: unknown[] | undefined;
|
|
459
|
+
plugin: Plugin;
|
|
460
|
+
};
|
|
461
|
+
type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
462
|
+
hookName: H;
|
|
463
|
+
plugins: Array<Plugin>;
|
|
464
|
+
};
|
|
465
|
+
type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
466
|
+
hookName: H;
|
|
467
|
+
};
|
|
425
468
|
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
426
469
|
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
427
470
|
result: Result;
|
|
@@ -436,9 +479,11 @@ type Options$1 = {
|
|
|
436
479
|
concurrency?: number;
|
|
437
480
|
};
|
|
438
481
|
type Events = {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
482
|
+
progress_start: [meta: ProgressStartMeta];
|
|
483
|
+
progress_stop: [meta: ProgressStopMeta];
|
|
484
|
+
executing: [meta: ExecutingMeta];
|
|
485
|
+
executed: [meta: ExecutedMeta];
|
|
486
|
+
error: [error: Error, meta: ErrorMeta];
|
|
442
487
|
};
|
|
443
488
|
type GetFileProps<TOptions = object> = {
|
|
444
489
|
name: string;
|
|
@@ -451,8 +496,6 @@ declare class PluginManager {
|
|
|
451
496
|
#private;
|
|
452
497
|
readonly events: EventEmitter<Events>;
|
|
453
498
|
readonly config: Config;
|
|
454
|
-
readonly executed: Array<Executer>;
|
|
455
|
-
readonly logger: Logger;
|
|
456
499
|
readonly options: Options$1;
|
|
457
500
|
constructor(config: Config, options: Options$1);
|
|
458
501
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
@@ -478,13 +521,11 @@ declare class PluginManager {
|
|
|
478
521
|
hookForPlugin<H extends PluginLifecycleHooks>({
|
|
479
522
|
pluginKey,
|
|
480
523
|
hookName,
|
|
481
|
-
parameters
|
|
482
|
-
message
|
|
524
|
+
parameters
|
|
483
525
|
}: {
|
|
484
526
|
pluginKey: Plugin['key'];
|
|
485
527
|
hookName: H;
|
|
486
528
|
parameters: PluginParameter<H>;
|
|
487
|
-
message: string;
|
|
488
529
|
}): Promise<Array<ReturnType<ParseResult<H>> | null>>;
|
|
489
530
|
/**
|
|
490
531
|
* Run a specific hookName for plugin x.
|
|
@@ -492,13 +533,11 @@ declare class PluginManager {
|
|
|
492
533
|
hookForPluginSync<H extends PluginLifecycleHooks>({
|
|
493
534
|
pluginKey,
|
|
494
535
|
hookName,
|
|
495
|
-
parameters
|
|
496
|
-
message
|
|
536
|
+
parameters
|
|
497
537
|
}: {
|
|
498
538
|
pluginKey: Plugin['key'];
|
|
499
539
|
hookName: H;
|
|
500
540
|
parameters: PluginParameter<H>;
|
|
501
|
-
message: string;
|
|
502
541
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
503
542
|
/**
|
|
504
543
|
* First non-null result stops and will return it's value.
|
|
@@ -506,13 +545,11 @@ declare class PluginManager {
|
|
|
506
545
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
507
546
|
hookName,
|
|
508
547
|
parameters,
|
|
509
|
-
skipped
|
|
510
|
-
message
|
|
548
|
+
skipped
|
|
511
549
|
}: {
|
|
512
550
|
hookName: H;
|
|
513
551
|
parameters: PluginParameter<H>;
|
|
514
552
|
skipped?: ReadonlySet<Plugin> | null;
|
|
515
|
-
message: string;
|
|
516
553
|
}): Promise<SafeParseResult<H>>;
|
|
517
554
|
/**
|
|
518
555
|
* First non-null result stops and will return it's value.
|
|
@@ -520,37 +557,31 @@ declare class PluginManager {
|
|
|
520
557
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
521
558
|
hookName,
|
|
522
559
|
parameters,
|
|
523
|
-
skipped
|
|
524
|
-
message
|
|
560
|
+
skipped
|
|
525
561
|
}: {
|
|
526
562
|
hookName: H;
|
|
527
563
|
parameters: PluginParameter<H>;
|
|
528
564
|
skipped?: ReadonlySet<Plugin> | null;
|
|
529
|
-
message: string;
|
|
530
565
|
}): SafeParseResult<H>;
|
|
531
566
|
/**
|
|
532
567
|
* Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
|
|
533
568
|
*/
|
|
534
569
|
hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
|
|
535
570
|
hookName,
|
|
536
|
-
parameters
|
|
537
|
-
message
|
|
571
|
+
parameters
|
|
538
572
|
}: {
|
|
539
573
|
hookName: H;
|
|
540
574
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
541
|
-
message: string;
|
|
542
575
|
}): Promise<Awaited<TOuput>[]>;
|
|
543
576
|
/**
|
|
544
577
|
* Chains plugins
|
|
545
578
|
*/
|
|
546
579
|
hookSeq<H extends PluginLifecycleHooks>({
|
|
547
580
|
hookName,
|
|
548
|
-
parameters
|
|
549
|
-
message
|
|
581
|
+
parameters
|
|
550
582
|
}: {
|
|
551
583
|
hookName: H;
|
|
552
584
|
parameters?: PluginParameter<H>;
|
|
553
|
-
message: string;
|
|
554
585
|
}): Promise<void>;
|
|
555
586
|
getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
|
|
556
587
|
getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
|
|
@@ -667,6 +698,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
667
698
|
override: Array<Override<TOptions>> | undefined;
|
|
668
699
|
contentType: contentType | undefined;
|
|
669
700
|
pluginManager: PluginManager;
|
|
701
|
+
logger?: Logger;
|
|
670
702
|
/**
|
|
671
703
|
* Current plugin
|
|
672
704
|
*/
|
|
@@ -910,6 +942,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
910
942
|
fabric: Fabric;
|
|
911
943
|
oas: Oas;
|
|
912
944
|
pluginManager: PluginManager;
|
|
945
|
+
logger?: Logger;
|
|
913
946
|
/**
|
|
914
947
|
* Current plugin
|
|
915
948
|
*/
|
|
@@ -1061,4 +1094,4 @@ type ResolvedOptions = {
|
|
|
1061
1094
|
type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1062
1095
|
//#endregion
|
|
1063
1096
|
export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginCypress as n, HttpMethod as o, ReactGenerator as r, Options as t };
|
|
1064
|
-
//# sourceMappingURL=types-
|
|
1097
|
+
//# sourceMappingURL=types-Cu2aEsbs.d.ts.map
|
|
@@ -73,13 +73,35 @@ type DebugEvent = {
|
|
|
73
73
|
date: Date;
|
|
74
74
|
logs: string[];
|
|
75
75
|
fileName?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Category of the debug log, used for GitHub Actions grouping
|
|
78
|
+
* - 'setup': Initial configuration and environment setup
|
|
79
|
+
* - 'plugin': Plugin installation and execution
|
|
80
|
+
* - 'hook': Plugin hook execution details
|
|
81
|
+
* - 'schema': Schema parsing and generation
|
|
82
|
+
* - 'file': File operations (read/write/generate)
|
|
83
|
+
* - 'error': Error details and stack traces
|
|
84
|
+
* - undefined: Generic logs (always inline)
|
|
85
|
+
*/
|
|
86
|
+
category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
|
|
87
|
+
/**
|
|
88
|
+
* Plugin name for grouping plugin-specific logs together
|
|
89
|
+
*/
|
|
90
|
+
pluginName?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Indicates if this is the start or end of a plugin's execution
|
|
93
|
+
* - 'start': Start of plugin execution group
|
|
94
|
+
* - 'end': End of plugin execution group
|
|
95
|
+
*/
|
|
96
|
+
pluginGroupMarker?: 'start' | 'end';
|
|
76
97
|
};
|
|
77
98
|
type Events$1 = {
|
|
78
99
|
start: [message: string];
|
|
79
100
|
success: [message: string];
|
|
80
|
-
error: [message: string,
|
|
101
|
+
error: [message: string, error: Error];
|
|
81
102
|
warning: [message: string];
|
|
82
103
|
debug: [DebugEvent];
|
|
104
|
+
verbose: [DebugEvent];
|
|
83
105
|
info: [message: string];
|
|
84
106
|
progress_start: [{
|
|
85
107
|
id: string;
|
|
@@ -103,7 +125,7 @@ type Logger = {
|
|
|
103
125
|
consola?: ConsolaInstance;
|
|
104
126
|
on: EventEmitter<Events$1>['on'];
|
|
105
127
|
emit: EventEmitter<Events$1>['emit'];
|
|
106
|
-
writeLogs: () => Promise<
|
|
128
|
+
writeLogs: () => Promise<void>;
|
|
107
129
|
};
|
|
108
130
|
//#endregion
|
|
109
131
|
//#region ../core/src/utils/types.d.ts
|
|
@@ -414,14 +436,35 @@ type Group = {
|
|
|
414
436
|
//#region ../core/src/PluginManager.d.ts
|
|
415
437
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
416
438
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
417
|
-
type
|
|
418
|
-
message: string;
|
|
439
|
+
type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
419
440
|
strategy: Strategy;
|
|
420
441
|
hookName: H;
|
|
421
442
|
plugin: Plugin;
|
|
422
443
|
parameters?: unknown[] | undefined;
|
|
423
444
|
output?: unknown;
|
|
424
445
|
};
|
|
446
|
+
type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
447
|
+
duration: number;
|
|
448
|
+
strategy: Strategy;
|
|
449
|
+
hookName: H;
|
|
450
|
+
plugin: Plugin;
|
|
451
|
+
parameters?: unknown[] | undefined;
|
|
452
|
+
output?: unknown;
|
|
453
|
+
};
|
|
454
|
+
type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
455
|
+
hookName: H;
|
|
456
|
+
duration: number;
|
|
457
|
+
strategy: Strategy;
|
|
458
|
+
parameters?: unknown[] | undefined;
|
|
459
|
+
plugin: Plugin;
|
|
460
|
+
};
|
|
461
|
+
type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
462
|
+
hookName: H;
|
|
463
|
+
plugins: Array<Plugin>;
|
|
464
|
+
};
|
|
465
|
+
type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
466
|
+
hookName: H;
|
|
467
|
+
};
|
|
425
468
|
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
426
469
|
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
427
470
|
result: Result;
|
|
@@ -436,9 +479,11 @@ type Options$1 = {
|
|
|
436
479
|
concurrency?: number;
|
|
437
480
|
};
|
|
438
481
|
type Events = {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
482
|
+
progress_start: [meta: ProgressStartMeta];
|
|
483
|
+
progress_stop: [meta: ProgressStopMeta];
|
|
484
|
+
executing: [meta: ExecutingMeta];
|
|
485
|
+
executed: [meta: ExecutedMeta];
|
|
486
|
+
error: [error: Error, meta: ErrorMeta];
|
|
442
487
|
};
|
|
443
488
|
type GetFileProps<TOptions = object> = {
|
|
444
489
|
name: string;
|
|
@@ -451,8 +496,6 @@ declare class PluginManager {
|
|
|
451
496
|
#private;
|
|
452
497
|
readonly events: EventEmitter<Events>;
|
|
453
498
|
readonly config: Config;
|
|
454
|
-
readonly executed: Array<Executer>;
|
|
455
|
-
readonly logger: Logger;
|
|
456
499
|
readonly options: Options$1;
|
|
457
500
|
constructor(config: Config, options: Options$1);
|
|
458
501
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
@@ -478,13 +521,11 @@ declare class PluginManager {
|
|
|
478
521
|
hookForPlugin<H extends PluginLifecycleHooks>({
|
|
479
522
|
pluginKey,
|
|
480
523
|
hookName,
|
|
481
|
-
parameters
|
|
482
|
-
message
|
|
524
|
+
parameters
|
|
483
525
|
}: {
|
|
484
526
|
pluginKey: Plugin['key'];
|
|
485
527
|
hookName: H;
|
|
486
528
|
parameters: PluginParameter<H>;
|
|
487
|
-
message: string;
|
|
488
529
|
}): Promise<Array<ReturnType<ParseResult<H>> | null>>;
|
|
489
530
|
/**
|
|
490
531
|
* Run a specific hookName for plugin x.
|
|
@@ -492,13 +533,11 @@ declare class PluginManager {
|
|
|
492
533
|
hookForPluginSync<H extends PluginLifecycleHooks>({
|
|
493
534
|
pluginKey,
|
|
494
535
|
hookName,
|
|
495
|
-
parameters
|
|
496
|
-
message
|
|
536
|
+
parameters
|
|
497
537
|
}: {
|
|
498
538
|
pluginKey: Plugin['key'];
|
|
499
539
|
hookName: H;
|
|
500
540
|
parameters: PluginParameter<H>;
|
|
501
|
-
message: string;
|
|
502
541
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
503
542
|
/**
|
|
504
543
|
* First non-null result stops and will return it's value.
|
|
@@ -506,13 +545,11 @@ declare class PluginManager {
|
|
|
506
545
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
507
546
|
hookName,
|
|
508
547
|
parameters,
|
|
509
|
-
skipped
|
|
510
|
-
message
|
|
548
|
+
skipped
|
|
511
549
|
}: {
|
|
512
550
|
hookName: H;
|
|
513
551
|
parameters: PluginParameter<H>;
|
|
514
552
|
skipped?: ReadonlySet<Plugin> | null;
|
|
515
|
-
message: string;
|
|
516
553
|
}): Promise<SafeParseResult<H>>;
|
|
517
554
|
/**
|
|
518
555
|
* First non-null result stops and will return it's value.
|
|
@@ -520,37 +557,31 @@ declare class PluginManager {
|
|
|
520
557
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
521
558
|
hookName,
|
|
522
559
|
parameters,
|
|
523
|
-
skipped
|
|
524
|
-
message
|
|
560
|
+
skipped
|
|
525
561
|
}: {
|
|
526
562
|
hookName: H;
|
|
527
563
|
parameters: PluginParameter<H>;
|
|
528
564
|
skipped?: ReadonlySet<Plugin> | null;
|
|
529
|
-
message: string;
|
|
530
565
|
}): SafeParseResult<H>;
|
|
531
566
|
/**
|
|
532
567
|
* Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
|
|
533
568
|
*/
|
|
534
569
|
hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
|
|
535
570
|
hookName,
|
|
536
|
-
parameters
|
|
537
|
-
message
|
|
571
|
+
parameters
|
|
538
572
|
}: {
|
|
539
573
|
hookName: H;
|
|
540
574
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
541
|
-
message: string;
|
|
542
575
|
}): Promise<Awaited<TOuput>[]>;
|
|
543
576
|
/**
|
|
544
577
|
* Chains plugins
|
|
545
578
|
*/
|
|
546
579
|
hookSeq<H extends PluginLifecycleHooks>({
|
|
547
580
|
hookName,
|
|
548
|
-
parameters
|
|
549
|
-
message
|
|
581
|
+
parameters
|
|
550
582
|
}: {
|
|
551
583
|
hookName: H;
|
|
552
584
|
parameters?: PluginParameter<H>;
|
|
553
|
-
message: string;
|
|
554
585
|
}): Promise<void>;
|
|
555
586
|
getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
|
|
556
587
|
getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
|
|
@@ -667,6 +698,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
667
698
|
override: Array<Override<TOptions>> | undefined;
|
|
668
699
|
contentType: contentType | undefined;
|
|
669
700
|
pluginManager: PluginManager;
|
|
701
|
+
logger?: Logger;
|
|
670
702
|
/**
|
|
671
703
|
* Current plugin
|
|
672
704
|
*/
|
|
@@ -910,6 +942,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
910
942
|
fabric: Fabric;
|
|
911
943
|
oas: Oas;
|
|
912
944
|
pluginManager: PluginManager;
|
|
945
|
+
logger?: Logger;
|
|
913
946
|
/**
|
|
914
947
|
* Current plugin
|
|
915
948
|
*/
|
|
@@ -1061,4 +1094,4 @@ type ResolvedOptions = {
|
|
|
1061
1094
|
type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1062
1095
|
//#endregion
|
|
1063
1096
|
export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginCypress as n, HttpMethod as o, ReactGenerator as r, Options as t };
|
|
1064
|
-
//# sourceMappingURL=types-
|
|
1097
|
+
//# sourceMappingURL=types-DosRH6oz.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-cypress",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.3",
|
|
4
4
|
"description": "Cypress test generator plugin for Kubb, creating end-to-end tests from OpenAPI specifications for automated API testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cypress",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
],
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@kubb/react-fabric": "0.5.4",
|
|
78
|
-
"@kubb/core": "4.11.
|
|
79
|
-
"@kubb/oas": "4.11.
|
|
80
|
-
"@kubb/plugin-oas": "4.11.
|
|
81
|
-
"@kubb/plugin-ts": "4.11.
|
|
78
|
+
"@kubb/core": "4.11.3",
|
|
79
|
+
"@kubb/oas": "4.11.3",
|
|
80
|
+
"@kubb/plugin-oas": "4.11.3",
|
|
81
|
+
"@kubb/plugin-ts": "4.11.3"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|
|
84
84
|
"node": ">=20"
|
|
@@ -25,6 +25,12 @@ export function Request({ baseURL = '', name, dataReturnType, typeSchemas, url,
|
|
|
25
25
|
optional: isOptional(typeSchemas.request?.schema),
|
|
26
26
|
}
|
|
27
27
|
: undefined,
|
|
28
|
+
|
|
29
|
+
options: {
|
|
30
|
+
type: 'Partial<Cypress.RequestOptions>',
|
|
31
|
+
optional: true,
|
|
32
|
+
default: '{}',
|
|
33
|
+
},
|
|
28
34
|
})
|
|
29
35
|
|
|
30
36
|
const returnType =
|
|
@@ -36,7 +42,12 @@ export function Request({ baseURL = '', name, dataReturnType, typeSchemas, url,
|
|
|
36
42
|
<File.Source name={name} isIndexable isExportable>
|
|
37
43
|
<Function name={name} export params={params.toConstructor()} returnType={returnType}>
|
|
38
44
|
{dataReturnType === 'data' &&
|
|
39
|
-
`return cy.request(
|
|
45
|
+
`return cy.request({
|
|
46
|
+
method: '${method}',
|
|
47
|
+
url: '${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\:')}',
|
|
48
|
+
body: ${body},
|
|
49
|
+
...options,
|
|
50
|
+
}).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}
|
|
40
51
|
{dataReturnType === 'full' && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ''}${url}`).toURLPath()}', ${body})`}
|
|
41
52
|
</Function>
|
|
42
53
|
</File.Source>
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export function createPets(data: CreatePetsMutationRequest): Cypress.Chainable<CreatePetsMutationResponse> {
|
|
7
|
-
return cy
|
|
6
|
+
export function createPets(data: CreatePetsMutationRequest, options?: Partial<Cypress.RequestOptions>): Cypress.Chainable<CreatePetsMutationResponse> {
|
|
7
|
+
return cy
|
|
8
|
+
.request({
|
|
9
|
+
method: 'post',
|
|
10
|
+
url: '/pets',
|
|
11
|
+
body: data,
|
|
12
|
+
...options,
|
|
13
|
+
})
|
|
14
|
+
.then((res: Cypress.Response<CreatePetsMutationResponse>) => res.body)
|
|
8
15
|
}
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export function deletePetsPetid(): Cypress.Chainable<DeletePetsPetidMutationResponse> {
|
|
7
|
-
return cy
|
|
6
|
+
export function deletePetsPetid(options?: Partial<Cypress.RequestOptions>): Cypress.Chainable<DeletePetsPetidMutationResponse> {
|
|
7
|
+
return cy
|
|
8
|
+
.request({
|
|
9
|
+
method: 'delete',
|
|
10
|
+
url: '/pets/:petId',
|
|
11
|
+
body: undefined,
|
|
12
|
+
...options,
|
|
13
|
+
})
|
|
14
|
+
.then((res: Cypress.Response<DeletePetsPetidMutationResponse>) => res.body)
|
|
8
15
|
}
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export function listPets(): Cypress.Chainable<ListPetsQueryResponse> {
|
|
7
|
-
return cy
|
|
6
|
+
export function listPets(options?: Partial<Cypress.RequestOptions>): Cypress.Chainable<ListPetsQueryResponse> {
|
|
7
|
+
return cy
|
|
8
|
+
.request({
|
|
9
|
+
method: 'get',
|
|
10
|
+
url: '/pets',
|
|
11
|
+
body: undefined,
|
|
12
|
+
...options,
|
|
13
|
+
})
|
|
14
|
+
.then((res: Cypress.Response<ListPetsQueryResponse>) => res.body)
|
|
8
15
|
}
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export function showPetById(): Cypress.Chainable<ShowPetByIdQueryResponse> {
|
|
7
|
-
return cy
|
|
6
|
+
export function showPetById(options?: Partial<Cypress.RequestOptions>): Cypress.Chainable<ShowPetByIdQueryResponse> {
|
|
7
|
+
return cy
|
|
8
|
+
.request({
|
|
9
|
+
method: 'get',
|
|
10
|
+
url: '/pets/:petId',
|
|
11
|
+
body: undefined,
|
|
12
|
+
...options,
|
|
13
|
+
})
|
|
14
|
+
.then((res: Cypress.Response<ShowPetByIdQueryResponse>) => res.body)
|
|
8
15
|
}
|
package/src/plugin.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components-Be12iXXU.cjs","names":["FunctionParams","File","Function","URLPath"],"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 { 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 method: HttpMethod\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props): KubbNode {\n const params = FunctionParams.factory({\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n const body = typeSchemas.request?.name ? 'data' : undefined\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('${method}', '${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')}', ${body}).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}\n {dataReturnType === 'full' && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ''}${url}`).toURLPath()}', ${body})`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;AAmBA,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,UAA2B;CACzG,MAAM,SAASA,mCAAe,QAAQ,EACpC,MAAM,YAAY,SAAS,OACvB;EACE,MAAM,YAAY,SAAS;EAC3B,qCAAqB,YAAY,SAAS,OAAO;EAClD,GACD,QACL,CAAC;CAEF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAElJ,MAAM,OAAO,YAAY,SAAS,OAAO,SAAS;AAElD,QACE,yDAACC,yBAAK;EAAa;EAAM;EAAY;YACnC,0DAACC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;cACtE,mBAAmB,UAClB,sBAAsB,OAAO,MAAM,WAAW,KAAK,IAAIC,0BAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU,CAAC,KAAK,KAAK,gCAAgC,YAAY,SAAS,KAAK,kBACpL,mBAAmB,UAAU,sBAAsB,OAAO,MAAM,IAAIA,0BAAQ,GAAG,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK;IACpH;GACC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components-DpCpyvbD.js","names":[],"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 { 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 method: HttpMethod\n}\n\nexport function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props): KubbNode {\n const params = FunctionParams.factory({\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n })\n\n const returnType =\n dataReturnType === 'data' ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`\n\n const body = typeSchemas.request?.name ? 'data' : undefined\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('${method}', '${baseURL ?? ''}${new URLPath(url).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')}', ${body}).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`}\n {dataReturnType === 'full' && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ''}${url}`).toURLPath()}', ${body})`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,QAAQ,EAAE,UAAU,IAAI,MAAM,gBAAgB,aAAa,KAAK,UAA2B;CACzG,MAAM,SAAS,eAAe,QAAQ,EACpC,MAAM,YAAY,SAAS,OACvB;EACE,MAAM,YAAY,SAAS;EAC3B,UAAU,WAAW,YAAY,SAAS,OAAO;EAClD,GACD,QACL,CAAC;CAEF,MAAM,aACJ,mBAAmB,SAAS,qBAAqB,YAAY,SAAS,KAAK,KAAK,sCAAsC,YAAY,SAAS,KAAK;CAElJ,MAAM,OAAO,YAAY,SAAS,OAAO,SAAS;AAElD,QACE,oBAAC,KAAK;EAAa;EAAM;EAAY;YACnC,qBAAC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;GAAc;cACtE,mBAAmB,UAClB,sBAAsB,OAAO,MAAM,WAAW,KAAK,IAAI,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU,CAAC,KAAK,KAAK,gCAAgC,YAAY,SAAS,KAAK,kBACpL,mBAAmB,UAAU,sBAAsB,OAAO,MAAM,IAAI,QAAQ,GAAG,WAAW,KAAK,MAAM,CAAC,WAAW,CAAC,KAAK,KAAK;IACpH;GACC"}
|