@kubb/plugin-cypress 4.3.0 → 4.4.0
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/chunk-DMmIE7y6.js +28 -0
- package/dist/{components-B-t6gvpJ.cjs → components-CDWcq6eX.cjs} +8 -8
- package/dist/components-CDWcq6eX.cjs.map +1 -0
- package/dist/{components-CkuOZl8o.js → components-Cs-85WSv.js} +3 -3
- package/dist/components-Cs-85WSv.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +3 -2
- package/dist/components.d.ts +3 -2
- package/dist/components.js +1 -1
- package/dist/{generators-Dcm7kTBP.cjs → generators-CKKLK5ah.cjs} +9 -9
- package/dist/generators-CKKLK5ah.cjs.map +1 -0
- package/dist/{generators-v4Wf70NJ.js → generators-CfF-r6zR.js} +4 -4
- package/dist/generators-CfF-r6zR.js.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/generators.js +2 -2
- package/dist/index.cjs +3 -2
- 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 +3 -2
- package/dist/index.js.map +1 -1
- package/dist/{types-BzpxVS9E.d.cts → types-BOoil2LF.d.cts} +220 -201
- package/dist/{types-DvtvRYFG.d.ts → types-D6SVPqai.d.ts} +225 -206
- package/package.json +8 -8
- package/src/components/Request.tsx +3 -3
- package/src/generators/cypressGenerator.tsx +1 -1
- package/src/plugin.ts +1 -0
- package/src/types.ts +2 -2
- package/dist/components-B-t6gvpJ.cjs.map +0 -1
- package/dist/components-CkuOZl8o.js.map +0 -1
- package/dist/generators-Dcm7kTBP.cjs.map +0 -1
- package/dist/generators-v4Wf70NJ.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-cypress",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
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",
|
|
@@ -67,18 +67,18 @@
|
|
|
67
67
|
"!/**/__tests__/**"
|
|
68
68
|
],
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@kubb/
|
|
71
|
-
"@kubb/
|
|
72
|
-
"@kubb/
|
|
73
|
-
"@kubb/
|
|
74
|
-
"@kubb/
|
|
70
|
+
"@kubb/react-fabric": "0.2.8",
|
|
71
|
+
"@kubb/core": "4.4.0",
|
|
72
|
+
"@kubb/oas": "4.4.0",
|
|
73
|
+
"@kubb/plugin-oas": "4.4.0",
|
|
74
|
+
"@kubb/plugin-ts": "4.4.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"tsdown": "^0.15.
|
|
77
|
+
"tsdown": "^0.15.11",
|
|
78
78
|
"typescript": "^5.9.3"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@kubb/react": "
|
|
81
|
+
"@kubb/react-fabric": "0.2.8"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|
|
84
84
|
"node": ">=20"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { URLPath } from '@kubb/core/utils'
|
|
2
|
-
|
|
3
2
|
import { type HttpMethod, isOptional } from '@kubb/oas'
|
|
4
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
5
|
-
import { File, Function, FunctionParams } from '@kubb/react'
|
|
4
|
+
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
5
|
+
import type { KubbNode } from '@kubb/react-fabric/types'
|
|
6
6
|
import type { PluginCypress } from '../types.ts'
|
|
7
7
|
|
|
8
8
|
type Props = {
|
|
@@ -17,7 +17,7 @@ type Props = {
|
|
|
17
17
|
method: HttpMethod
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props) {
|
|
20
|
+
export function Request({ baseURL = '', name, dataReturnType, typeSchemas, url, method }: Props): KubbNode {
|
|
21
21
|
const params = FunctionParams.factory({
|
|
22
22
|
data: typeSchemas.request?.name
|
|
23
23
|
? {
|
|
@@ -4,7 +4,7 @@ import { createReactGenerator } from '@kubb/plugin-oas'
|
|
|
4
4
|
import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
5
5
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
6
6
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
|
-
import { File } from '@kubb/react'
|
|
7
|
+
import { File } from '@kubb/react-fabric'
|
|
8
8
|
import { Request } from '../components'
|
|
9
9
|
import type { PluginCypress } from '../types'
|
|
10
10
|
|
package/src/plugin.ts
CHANGED
|
@@ -85,6 +85,7 @@ export const pluginCypress = createPlugin<PluginCypress>((options) => {
|
|
|
85
85
|
const mode = getMode(path.resolve(root, output.path))
|
|
86
86
|
|
|
87
87
|
const operationGenerator = new OperationGenerator(this.plugin.options, {
|
|
88
|
+
fabric: this.fabric,
|
|
88
89
|
oas,
|
|
89
90
|
pluginManager: this.pluginManager,
|
|
90
91
|
plugin: this.plugin,
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import type { Exclude, Include, Override, ResolvePathOptions
|
|
3
|
+
import type { contentType, Oas } from '@kubb/oas'
|
|
4
|
+
import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
|
|
5
5
|
|
|
6
6
|
export type Options = {
|
|
7
7
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components-B-t6gvpJ.cjs","names":["FunctionParams","File","Function","URLPath"],"sources":["../src/components/Request.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\n\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\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) {\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,UAAiB;CAC/F,MAAM,SAASA,4BAAe,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,kDAACC,kBAAK;EAAa;EAAM;EAAY;YACnC,mDAACC;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-CkuOZl8o.js","names":[],"sources":["../src/components/Request.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\n\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\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) {\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,UAAiB;CAC/F,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-Dcm7kTBP.cjs","names":["pluginTsName","File","Request","URLPath"],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas'\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'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = usePlugin<PluginCypress>()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\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,+DAAuD;CAClE,MAAM;CACN,UAAU,EAAE,aAAa;EACvB,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,uDACA;EAC9B,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,8DAAiC;EAE9D,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,mDAACC;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,kDAACA,kBAAK;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,kDAACC;IACC,MAAM,QAAQ;IACE;IAChB,aAAa,KAAK;IAClB,QAAQ,UAAU;IACT;IACT,KAAK,IAAIC,0BAAQ,UAAU,KAAK,CAAC,WAAW;KAC5C;IACG;;CAGZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-v4Wf70NJ.js","names":[],"sources":["../src/generators/cypressGenerator.tsx"],"sourcesContent":["import { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport { URLPath } from '@kubb/core/utils'\nimport { createReactGenerator } from '@kubb/plugin-oas'\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'\nimport { Request } from '../components'\nimport type { PluginCypress } from '../types'\n\nexport const cypressGenerator = createReactGenerator<PluginCypress>({\n name: 'cypress',\n Operation({ operation }) {\n const {\n options: { output, baseURL, dataReturnType },\n } = usePlugin<PluginCypress>()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\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,aAAa;EACvB,MAAM,EACJ,SAAS,EAAE,QAAQ,SAAS,qBAC1B,WAA0B;EAC9B,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,qBAAqB;EAE9D,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"}
|