@kubb/plugin-cypress 3.16.2 → 3.16.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-C8-e6KqF.cjs +64 -0
- package/dist/components-C8-e6KqF.cjs.map +1 -0
- package/dist/components-jRFHC_sv.js +30 -0
- package/dist/components-jRFHC_sv.js.map +1 -0
- package/dist/components.cjs +2 -11
- package/dist/components.d.cts +22 -16
- package/dist/components.d.ts +22 -16
- package/dist/components.js +3 -3
- package/dist/generators-Ct16r8RK.cjs +72 -0
- package/dist/{chunk-PIJKOKJD.js.map → generators-Ct16r8RK.cjs.map} +1 -1
- package/dist/generators-aYB5ZkVA.js +67 -0
- package/dist/generators-aYB5ZkVA.js.map +1 -0
- package/dist/generators.cjs +3 -12
- package/dist/generators.d.cts +5 -6
- package/dist/generators.d.ts +5 -6
- package/dist/generators.js +4 -4
- package/dist/index.cjs +74 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +74 -93
- package/dist/index.js.map +1 -1
- package/dist/types-BNTHk264.d.ts +1166 -0
- package/dist/types-Rl0-mzsN.d.cts +1166 -0
- package/package.json +18 -33
- package/dist/chunk-AQ3NKEYB.cjs +0 -75
- package/dist/chunk-AQ3NKEYB.cjs.map +0 -1
- package/dist/chunk-LJ3OQYCX.cjs +0 -26
- package/dist/chunk-LJ3OQYCX.cjs.map +0 -1
- package/dist/chunk-NEMUYKDD.js +0 -24
- package/dist/chunk-NEMUYKDD.js.map +0 -1
- package/dist/chunk-PIJKOKJD.js +0 -73
- package/dist/components.cjs.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/generators.cjs.map +0 -1
- package/dist/generators.js.map +0 -1
- package/dist/types-C2ke2hnU.d.cts +0 -59
- package/dist/types-C2ke2hnU.d.ts +0 -59
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-cypress",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.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",
|
|
@@ -29,35 +29,21 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
31
|
"import": "./dist/index.js",
|
|
32
|
-
"require": "./dist/index.cjs"
|
|
33
|
-
"default": "./dist/index.cjs"
|
|
34
|
-
},
|
|
35
|
-
"./utils": {
|
|
36
|
-
"import": "./dist/utils.js",
|
|
37
|
-
"require": "./dist/utils.cjs",
|
|
38
|
-
"default": "./dist/utils.cjs"
|
|
39
|
-
},
|
|
40
|
-
"./hooks": {
|
|
41
|
-
"import": "./dist/hooks.js",
|
|
42
|
-
"require": "./dist/hooks.cjs",
|
|
43
|
-
"default": "./dist/hooks.cjs"
|
|
32
|
+
"require": "./dist/index.cjs"
|
|
44
33
|
},
|
|
45
34
|
"./components": {
|
|
46
35
|
"import": "./dist/components.js",
|
|
47
|
-
"require": "./dist/components.cjs"
|
|
48
|
-
"default": "./dist/components.cjs"
|
|
36
|
+
"require": "./dist/components.cjs"
|
|
49
37
|
},
|
|
50
38
|
"./generators": {
|
|
51
39
|
"import": "./dist/generators.js",
|
|
52
|
-
"require": "./dist/generators.cjs"
|
|
53
|
-
"default": "./dist/generators.cjs"
|
|
40
|
+
"require": "./dist/generators.cjs"
|
|
54
41
|
},
|
|
55
|
-
"./package.json": "./package.json"
|
|
56
|
-
"./*": "./*"
|
|
42
|
+
"./package.json": "./package.json"
|
|
57
43
|
},
|
|
58
|
-
"main": "dist/index.cjs",
|
|
59
|
-
"module": "dist/index.js",
|
|
60
|
-
"types": "./dist/index.d.
|
|
44
|
+
"main": "./dist/index.cjs",
|
|
45
|
+
"module": "./dist/index.js",
|
|
46
|
+
"types": "./dist/index.d.cts",
|
|
61
47
|
"typesVersions": {
|
|
62
48
|
"*": {
|
|
63
49
|
"utils": [
|
|
@@ -81,19 +67,18 @@
|
|
|
81
67
|
"!/**/__tests__/**"
|
|
82
68
|
],
|
|
83
69
|
"dependencies": {
|
|
84
|
-
"@kubb/core": "3.16.
|
|
85
|
-
"@kubb/oas": "3.16.
|
|
86
|
-
"@kubb/plugin-oas": "3.16.
|
|
87
|
-
"@kubb/plugin-ts": "3.16.
|
|
88
|
-
"@kubb/react": "3.16.
|
|
70
|
+
"@kubb/core": "3.16.3",
|
|
71
|
+
"@kubb/oas": "3.16.3",
|
|
72
|
+
"@kubb/plugin-oas": "3.16.3",
|
|
73
|
+
"@kubb/plugin-ts": "3.16.3",
|
|
74
|
+
"@kubb/react": "3.16.3"
|
|
89
75
|
},
|
|
90
76
|
"devDependencies": {
|
|
91
77
|
"@types/react": "^18.3.23",
|
|
92
78
|
"react": "^18.3.1",
|
|
93
|
-
"
|
|
79
|
+
"tsdown": "^0.14.1",
|
|
94
80
|
"typescript": "^5.9.2",
|
|
95
|
-
"@kubb/config-ts": "3.16.
|
|
96
|
-
"@kubb/config-tsup": "3.16.2"
|
|
81
|
+
"@kubb/config-ts": "3.16.3"
|
|
97
82
|
},
|
|
98
83
|
"peerDependencies": {
|
|
99
84
|
"@kubb/react": "^3.0.0"
|
|
@@ -106,13 +91,13 @@
|
|
|
106
91
|
"registry": "https://registry.npmjs.org/"
|
|
107
92
|
},
|
|
108
93
|
"scripts": {
|
|
109
|
-
"build": "
|
|
94
|
+
"build": "tsdown",
|
|
110
95
|
"clean": "npx rimraf ./dist",
|
|
111
96
|
"lint": "bun biome lint .",
|
|
112
|
-
"lint:fix": "bun biome lint--fix --unsafe .",
|
|
97
|
+
"lint:fix": "bun biome lint --fix --unsafe .",
|
|
113
98
|
"release": "pnpm publish --no-git-check",
|
|
114
99
|
"release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
|
|
115
|
-
"start": "
|
|
100
|
+
"start": "tsdown --watch",
|
|
116
101
|
"test": "vitest --passWithNoTests",
|
|
117
102
|
"typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
|
|
118
103
|
}
|
package/dist/chunk-AQ3NKEYB.cjs
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkLJ3OQYCX_cjs = require('./chunk-LJ3OQYCX.cjs');
|
|
4
|
-
var utils$1 = require('@kubb/core/utils');
|
|
5
|
-
var pluginOas = require('@kubb/plugin-oas');
|
|
6
|
-
var hooks = require('@kubb/plugin-oas/hooks');
|
|
7
|
-
var utils = require('@kubb/plugin-oas/utils');
|
|
8
|
-
var pluginTs = require('@kubb/plugin-ts');
|
|
9
|
-
var react = require('@kubb/react');
|
|
10
|
-
var jsxRuntime = require('@kubb/react/jsx-runtime');
|
|
11
|
-
|
|
12
|
-
var cypressGenerator = pluginOas.createReactGenerator({
|
|
13
|
-
name: "cypress",
|
|
14
|
-
Operation({ operation }) {
|
|
15
|
-
const {
|
|
16
|
-
pluginManager,
|
|
17
|
-
plugin: {
|
|
18
|
-
options: { output, baseURL, dataReturnType }
|
|
19
|
-
}
|
|
20
|
-
} = react.useApp();
|
|
21
|
-
const oas = hooks.useOas();
|
|
22
|
-
const { getSchemas, getName, getFile } = hooks.useOperationManager();
|
|
23
|
-
const request = {
|
|
24
|
-
name: getName(operation, { type: "function" }),
|
|
25
|
-
file: getFile(operation)
|
|
26
|
-
};
|
|
27
|
-
const type = {
|
|
28
|
-
file: getFile(operation, { pluginKey: [pluginTs.pluginTsName] }),
|
|
29
|
-
schemas: getSchemas(operation, { pluginKey: [pluginTs.pluginTsName], type: "type" })
|
|
30
|
-
};
|
|
31
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
32
|
-
react.File,
|
|
33
|
-
{
|
|
34
|
-
baseName: request.file.baseName,
|
|
35
|
-
path: request.file.path,
|
|
36
|
-
meta: request.file.meta,
|
|
37
|
-
banner: utils.getBanner({ oas, output, config: pluginManager.config }),
|
|
38
|
-
footer: utils.getFooter({ oas, output }),
|
|
39
|
-
children: [
|
|
40
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
-
react.File.Import,
|
|
42
|
-
{
|
|
43
|
-
name: [
|
|
44
|
-
type.schemas.request?.name,
|
|
45
|
-
type.schemas.response.name,
|
|
46
|
-
type.schemas.pathParams?.name,
|
|
47
|
-
type.schemas.queryParams?.name,
|
|
48
|
-
type.schemas.headerParams?.name,
|
|
49
|
-
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
50
|
-
].filter(Boolean),
|
|
51
|
-
root: request.file.path,
|
|
52
|
-
path: type.file.path,
|
|
53
|
-
isTypeOnly: true
|
|
54
|
-
}
|
|
55
|
-
),
|
|
56
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
-
chunkLJ3OQYCX_cjs.Request,
|
|
58
|
-
{
|
|
59
|
-
name: request.name,
|
|
60
|
-
dataReturnType,
|
|
61
|
-
typeSchemas: type.schemas,
|
|
62
|
-
method: operation.method,
|
|
63
|
-
baseURL,
|
|
64
|
-
url: new utils$1.URLPath(operation.path).toURLPath()
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
exports.cypressGenerator = cypressGenerator;
|
|
74
|
-
//# sourceMappingURL=chunk-AQ3NKEYB.cjs.map
|
|
75
|
-
//# sourceMappingURL=chunk-AQ3NKEYB.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generators/cypressGenerator.tsx"],"names":["createReactGenerator","useApp","useOas","useOperationManager","pluginTsName","jsxs","File","getBanner","getFooter","jsx","Request","URLPath"],"mappings":";;;;;;;;;;;AASO,IAAM,mBAAmBA,8BAAoC,CAAA;AAAA,EAClE,IAAM,EAAA,SAAA;AAAA,EACN,SAAA,CAAU,EAAE,SAAA,EAAa,EAAA;AACvB,IAAM,MAAA;AAAA,MACJ,aAAA;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,OAAS,EAAA,EAAE,MAAQ,EAAA,OAAA,EAAS,cAAe;AAAA;AAC7C,QACEC,YAAsB,EAAA;AAC1B,IAAA,MAAM,MAAMC,YAAO,EAAA;AACnB,IAAA,MAAM,EAAE,UAAA,EAAY,OAAS,EAAA,OAAA,KAAYC,yBAAoB,EAAA;AAE7D,IAAA,MAAM,OAAU,GAAA;AAAA,MACd,MAAM,OAAQ,CAAA,SAAA,EAAW,EAAE,IAAA,EAAM,YAAY,CAAA;AAAA,MAC7C,IAAA,EAAM,QAAQ,SAAS;AAAA,KACzB;AAEA,IAAA,MAAM,IAAO,GAAA;AAAA,MACX,IAAA,EAAM,QAAQ,SAAW,EAAA,EAAE,WAAW,CAACC,qBAAY,GAAG,CAAA;AAAA,MACtD,OAAA,EAAS,UAAW,CAAA,SAAA,EAAW,EAAE,SAAA,EAAW,CAACA,qBAAY,CAAA,EAAG,IAAM,EAAA,MAAA,EAAQ;AAAA,KAC5E;AAEA,IACE,uBAAAC,eAAA;AAAA,MAACC,UAAA;AAAA,MAAA;AAAA,QACC,QAAA,EAAU,QAAQ,IAAK,CAAA,QAAA;AAAA,QACvB,IAAA,EAAM,QAAQ,IAAK,CAAA,IAAA;AAAA,QACnB,IAAA,EAAM,QAAQ,IAAK,CAAA,IAAA;AAAA,QACnB,MAAA,EAAQC,gBAAU,EAAE,GAAA,EAAK,QAAQ,MAAQ,EAAA,aAAA,CAAc,QAAQ,CAAA;AAAA,QAC/D,MAAQ,EAAAC,eAAA,CAAU,EAAE,GAAA,EAAK,QAAQ,CAAA;AAAA,QAEjC,QAAA,EAAA;AAAA,0BAAAC,cAAA;AAAA,YAACH,UAAK,CAAA,MAAA;AAAA,YAAL;AAAA,cACC,IAAM,EAAA;AAAA,gBACJ,IAAA,CAAK,QAAQ,OAAS,EAAA,IAAA;AAAA,gBACtB,IAAA,CAAK,QAAQ,QAAS,CAAA,IAAA;AAAA,gBACtB,IAAA,CAAK,QAAQ,UAAY,EAAA,IAAA;AAAA,gBACzB,IAAA,CAAK,QAAQ,WAAa,EAAA,IAAA;AAAA,gBAC1B,IAAA,CAAK,QAAQ,YAAc,EAAA,IAAA;AAAA,gBAC3B,GAAI,IAAK,CAAA,OAAA,CAAQ,WAAa,EAAA,GAAA,CAAI,CAAC,IAAS,KAAA,IAAA,CAAK,IAAI,CAAA,IAAK;AAAC,eAC7D,CAAE,OAAO,OAAO,CAAA;AAAA,cAChB,IAAA,EAAM,QAAQ,IAAK,CAAA,IAAA;AAAA,cACnB,IAAA,EAAM,KAAK,IAAK,CAAA,IAAA;AAAA,cAChB,UAAU,EAAA;AAAA;AAAA,WACZ;AAAA,0BACAG,cAAA;AAAA,YAACC,yBAAA;AAAA,YAAA;AAAA,cACC,MAAM,OAAQ,CAAA,IAAA;AAAA,cACd,cAAA;AAAA,cACA,aAAa,IAAK,CAAA,OAAA;AAAA,cAClB,QAAQ,SAAU,CAAA,MAAA;AAAA,cAClB,OAAA;AAAA,cACA,KAAK,IAAIC,eAAA,CAAQ,SAAU,CAAA,IAAI,EAAE,SAAU;AAAA;AAAA;AAC7C;AAAA;AAAA,KACF;AAAA;AAGN,CAAC","file":"chunk-AQ3NKEYB.cjs","sourcesContent":["import { 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, useApp } 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 pluginManager,\n plugin: {\n options: { output, baseURL, dataReturnType },\n },\n } = useApp<PluginCypress>()\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"]}
|
package/dist/chunk-LJ3OQYCX.cjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var react = require('@kubb/react');
|
|
4
|
-
var oas = require('@kubb/oas');
|
|
5
|
-
var utils = require('@kubb/core/utils');
|
|
6
|
-
var jsxRuntime = require('@kubb/react/jsx-runtime');
|
|
7
|
-
|
|
8
|
-
// src/components/Request.tsx
|
|
9
|
-
function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method }) {
|
|
10
|
-
const params = react.FunctionParams.factory({
|
|
11
|
-
data: typeSchemas.request?.name ? {
|
|
12
|
-
type: typeSchemas.request?.name,
|
|
13
|
-
optional: oas.isOptional(typeSchemas.request?.schema)
|
|
14
|
-
} : void 0
|
|
15
|
-
});
|
|
16
|
-
const returnType = dataReturnType === "data" ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`;
|
|
17
|
-
const body = typeSchemas.request?.name ? "data" : void 0;
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isIndexable: true, isExportable: true, children: /* @__PURE__ */ jsxRuntime.jsxs(react.Function, { name, export: true, params: params.toConstructor(), returnType, children: [
|
|
19
|
-
dataReturnType === "data" && `return cy.request('${method}', '${baseURL ?? ""}${new utils.URLPath(url).toURLPath().replace(/([^/]):/g, "$1\\\\:")}', ${body}).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`,
|
|
20
|
-
dataReturnType === "full" && `return cy.request('${method}', '${new utils.URLPath(`${baseURL ?? ""}${url}`).toURLPath()}', ${body})`
|
|
21
|
-
] }) });
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
exports.Request = Request;
|
|
25
|
-
//# sourceMappingURL=chunk-LJ3OQYCX.cjs.map
|
|
26
|
-
//# sourceMappingURL=chunk-LJ3OQYCX.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Request.tsx"],"names":["FunctionParams","isOptional","File","jsxs","Function","URLPath"],"mappings":";;;;;;;;AAoBO,SAAS,OAAA,CAAQ,EAAE,OAAU,GAAA,EAAA,EAAI,MAAM,cAAgB,EAAA,WAAA,EAAa,GAAK,EAAA,MAAA,EAA4B,EAAA;AAC1G,EAAM,MAAA,MAAA,GAASA,qBAAe,OAAQ,CAAA;AAAA,IACpC,IAAA,EAAM,WAAY,CAAA,OAAA,EAAS,IACvB,GAAA;AAAA,MACE,IAAA,EAAM,YAAY,OAAS,EAAA,IAAA;AAAA,MAC3B,QAAU,EAAAC,cAAA,CAAW,WAAY,CAAA,OAAA,EAAS,MAAM;AAAA,KAElD,GAAA;AAAA,GACL,CAAA;AAED,EAAM,MAAA,UAAA,GACJ,cAAmB,KAAA,MAAA,GAAS,CAAqB,kBAAA,EAAA,WAAA,CAAY,QAAS,CAAA,IAAI,CAAM,CAAA,CAAA,GAAA,CAAA,mCAAA,EAAsC,WAAY,CAAA,QAAA,CAAS,IAAI,CAAA,EAAA,CAAA;AAEjJ,EAAA,MAAM,IAAO,GAAA,WAAA,CAAY,OAAS,EAAA,IAAA,GAAO,MAAS,GAAA,MAAA;AAElD,EAAA,sCACGC,UAAK,CAAA,MAAA,EAAL,EAAY,IAAY,EAAA,WAAA,EAAW,MAAC,YAAY,EAAA,IAAA,EAC/C,QAAC,kBAAAC,eAAA,CAAAC,cAAA,EAAA,EAAS,MAAY,MAAM,EAAA,IAAA,EAAC,QAAQ,MAAO,CAAA,aAAA,IAAiB,UAC1D,EAAA,QAAA,EAAA;AAAA,IAAmB,cAAA,KAAA,MAAA,IAClB,sBAAsB,MAAM,CAAA,IAAA,EAAO,WAAW,EAAE,CAAA,EAAG,IAAIC,aAAA,CAAQ,GAAG,CAAA,CAAE,WAAY,CAAA,OAAA,CAAQ,YAAY,SAAS,CAAC,MAAM,IAAI,CAAA,8BAAA,EAAiC,WAAY,CAAA,QAAA,CAAS,IAAI,CAAA,eAAA,CAAA;AAAA,IACnL,mBAAmB,MAAU,IAAA,CAAA,mBAAA,EAAsB,MAAM,CAAA,IAAA,EAAO,IAAIA,aAAQ,CAAA,CAAA,EAAG,OAAW,IAAA,EAAE,GAAG,GAAG,CAAA,CAAE,EAAE,SAAU,EAAC,MAAM,IAAI,CAAA,CAAA;AAAA,GAAA,EAC9H,CACF,EAAA,CAAA;AAEJ","file":"chunk-LJ3OQYCX.cjs","sourcesContent":["import { File, Function, FunctionParams } from '@kubb/react'\n\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport { URLPath } from '@kubb/core/utils'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\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): ReactNode {\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"]}
|
package/dist/chunk-NEMUYKDD.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { FunctionParams, File, Function } from '@kubb/react';
|
|
2
|
-
import { isOptional } from '@kubb/oas';
|
|
3
|
-
import { URLPath } from '@kubb/core/utils';
|
|
4
|
-
import { jsx, jsxs } from '@kubb/react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
// src/components/Request.tsx
|
|
7
|
-
function Request({ baseURL = "", name, dataReturnType, typeSchemas, url, method }) {
|
|
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
|
-
});
|
|
14
|
-
const returnType = dataReturnType === "data" ? `Cypress.Chainable<${typeSchemas.response.name}>` : `Cypress.Chainable<Cypress.Response<${typeSchemas.response.name}>>`;
|
|
15
|
-
const body = typeSchemas.request?.name ? "data" : void 0;
|
|
16
|
-
return /* @__PURE__ */ jsx(File.Source, { name, isIndexable: true, isExportable: true, children: /* @__PURE__ */ jsxs(Function, { name, export: true, params: params.toConstructor(), returnType, children: [
|
|
17
|
-
dataReturnType === "data" && `return cy.request('${method}', '${baseURL ?? ""}${new URLPath(url).toURLPath().replace(/([^/]):/g, "$1\\\\:")}', ${body}).then((res: Cypress.Response<${typeSchemas.response.name}>) => res.body)`,
|
|
18
|
-
dataReturnType === "full" && `return cy.request('${method}', '${new URLPath(`${baseURL ?? ""}${url}`).toURLPath()}', ${body})`
|
|
19
|
-
] }) });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { Request };
|
|
23
|
-
//# sourceMappingURL=chunk-NEMUYKDD.js.map
|
|
24
|
-
//# sourceMappingURL=chunk-NEMUYKDD.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Request.tsx"],"names":[],"mappings":";;;;;;AAoBO,SAAS,OAAA,CAAQ,EAAE,OAAU,GAAA,EAAA,EAAI,MAAM,cAAgB,EAAA,WAAA,EAAa,GAAK,EAAA,MAAA,EAA4B,EAAA;AAC1G,EAAM,MAAA,MAAA,GAAS,eAAe,OAAQ,CAAA;AAAA,IACpC,IAAA,EAAM,WAAY,CAAA,OAAA,EAAS,IACvB,GAAA;AAAA,MACE,IAAA,EAAM,YAAY,OAAS,EAAA,IAAA;AAAA,MAC3B,QAAU,EAAA,UAAA,CAAW,WAAY,CAAA,OAAA,EAAS,MAAM;AAAA,KAElD,GAAA;AAAA,GACL,CAAA;AAED,EAAM,MAAA,UAAA,GACJ,cAAmB,KAAA,MAAA,GAAS,CAAqB,kBAAA,EAAA,WAAA,CAAY,QAAS,CAAA,IAAI,CAAM,CAAA,CAAA,GAAA,CAAA,mCAAA,EAAsC,WAAY,CAAA,QAAA,CAAS,IAAI,CAAA,EAAA,CAAA;AAEjJ,EAAA,MAAM,IAAO,GAAA,WAAA,CAAY,OAAS,EAAA,IAAA,GAAO,MAAS,GAAA,MAAA;AAElD,EAAA,2BACG,IAAK,CAAA,MAAA,EAAL,EAAY,IAAY,EAAA,WAAA,EAAW,MAAC,YAAY,EAAA,IAAA,EAC/C,QAAC,kBAAA,IAAA,CAAA,QAAA,EAAA,EAAS,MAAY,MAAM,EAAA,IAAA,EAAC,QAAQ,MAAO,CAAA,aAAA,IAAiB,UAC1D,EAAA,QAAA,EAAA;AAAA,IAAmB,cAAA,KAAA,MAAA,IAClB,sBAAsB,MAAM,CAAA,IAAA,EAAO,WAAW,EAAE,CAAA,EAAG,IAAI,OAAA,CAAQ,GAAG,CAAA,CAAE,WAAY,CAAA,OAAA,CAAQ,YAAY,SAAS,CAAC,MAAM,IAAI,CAAA,8BAAA,EAAiC,WAAY,CAAA,QAAA,CAAS,IAAI,CAAA,eAAA,CAAA;AAAA,IACnL,mBAAmB,MAAU,IAAA,CAAA,mBAAA,EAAsB,MAAM,CAAA,IAAA,EAAO,IAAI,OAAQ,CAAA,CAAA,EAAG,OAAW,IAAA,EAAE,GAAG,GAAG,CAAA,CAAE,EAAE,SAAU,EAAC,MAAM,IAAI,CAAA,CAAA;AAAA,GAAA,EAC9H,CACF,EAAA,CAAA;AAEJ","file":"chunk-NEMUYKDD.js","sourcesContent":["import { File, Function, FunctionParams } from '@kubb/react'\n\nimport { type HttpMethod, isOptional } from '@kubb/oas'\nimport type { ReactNode } from 'react'\nimport { URLPath } from '@kubb/core/utils'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\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): ReactNode {\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"]}
|
package/dist/chunk-PIJKOKJD.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Request } from './chunk-NEMUYKDD.js';
|
|
2
|
-
import { URLPath } from '@kubb/core/utils';
|
|
3
|
-
import { createReactGenerator } from '@kubb/plugin-oas';
|
|
4
|
-
import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks';
|
|
5
|
-
import { getFooter, getBanner } from '@kubb/plugin-oas/utils';
|
|
6
|
-
import { pluginTsName } from '@kubb/plugin-ts';
|
|
7
|
-
import { useApp, File } from '@kubb/react';
|
|
8
|
-
import { jsxs, jsx } from '@kubb/react/jsx-runtime';
|
|
9
|
-
|
|
10
|
-
var cypressGenerator = createReactGenerator({
|
|
11
|
-
name: "cypress",
|
|
12
|
-
Operation({ operation }) {
|
|
13
|
-
const {
|
|
14
|
-
pluginManager,
|
|
15
|
-
plugin: {
|
|
16
|
-
options: { output, baseURL, dataReturnType }
|
|
17
|
-
}
|
|
18
|
-
} = useApp();
|
|
19
|
-
const oas = useOas();
|
|
20
|
-
const { getSchemas, getName, getFile } = useOperationManager();
|
|
21
|
-
const request = {
|
|
22
|
-
name: getName(operation, { type: "function" }),
|
|
23
|
-
file: getFile(operation)
|
|
24
|
-
};
|
|
25
|
-
const type = {
|
|
26
|
-
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
27
|
-
schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
|
|
28
|
-
};
|
|
29
|
-
return /* @__PURE__ */ jsxs(
|
|
30
|
-
File,
|
|
31
|
-
{
|
|
32
|
-
baseName: request.file.baseName,
|
|
33
|
-
path: request.file.path,
|
|
34
|
-
meta: request.file.meta,
|
|
35
|
-
banner: getBanner({ oas, output, config: pluginManager.config }),
|
|
36
|
-
footer: getFooter({ oas, output }),
|
|
37
|
-
children: [
|
|
38
|
-
/* @__PURE__ */ jsx(
|
|
39
|
-
File.Import,
|
|
40
|
-
{
|
|
41
|
-
name: [
|
|
42
|
-
type.schemas.request?.name,
|
|
43
|
-
type.schemas.response.name,
|
|
44
|
-
type.schemas.pathParams?.name,
|
|
45
|
-
type.schemas.queryParams?.name,
|
|
46
|
-
type.schemas.headerParams?.name,
|
|
47
|
-
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
48
|
-
].filter(Boolean),
|
|
49
|
-
root: request.file.path,
|
|
50
|
-
path: type.file.path,
|
|
51
|
-
isTypeOnly: true
|
|
52
|
-
}
|
|
53
|
-
),
|
|
54
|
-
/* @__PURE__ */ jsx(
|
|
55
|
-
Request,
|
|
56
|
-
{
|
|
57
|
-
name: request.name,
|
|
58
|
-
dataReturnType,
|
|
59
|
-
typeSchemas: type.schemas,
|
|
60
|
-
method: operation.method,
|
|
61
|
-
baseURL,
|
|
62
|
-
url: new URLPath(operation.path).toURLPath()
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export { cypressGenerator };
|
|
72
|
-
//# sourceMappingURL=chunk-PIJKOKJD.js.map
|
|
73
|
-
//# sourceMappingURL=chunk-PIJKOKJD.js.map
|
package/dist/components.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"components.cjs"}
|
package/dist/components.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"components.js"}
|
package/dist/generators.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"generators.cjs"}
|
package/dist/generators.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"generators.js"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Output, Group, ResolveNameParams, PluginFactoryOptions } from '@kubb/core';
|
|
2
|
-
import { Oas, contentType } from '@kubb/oas';
|
|
3
|
-
import { Exclude, Include, Override, Generator, ResolvePathOptions } from '@kubb/plugin-oas';
|
|
4
|
-
|
|
5
|
-
type Options = {
|
|
6
|
-
/**
|
|
7
|
-
* Specify the export location for the files and define the behavior of the output
|
|
8
|
-
* @default { path: 'cypress', barrelType: 'named' }
|
|
9
|
-
*/
|
|
10
|
-
output?: Output<Oas>;
|
|
11
|
-
/**
|
|
12
|
-
* Define which contentType should be used.
|
|
13
|
-
* By default, the first JSON valid mediaType will be used
|
|
14
|
-
*/
|
|
15
|
-
contentType?: contentType;
|
|
16
|
-
/**
|
|
17
|
-
* ReturnType that will be used when calling cy.request.
|
|
18
|
-
* - 'data' will return ResponseConfig[data].
|
|
19
|
-
* - 'full' will return ResponseConfig.
|
|
20
|
-
* @default 'data'
|
|
21
|
-
*/
|
|
22
|
-
dataReturnType?: 'data' | 'full';
|
|
23
|
-
baseURL?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Group the Cypress requests based on the provided name.
|
|
26
|
-
*/
|
|
27
|
-
group?: Group;
|
|
28
|
-
/**
|
|
29
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
30
|
-
*/
|
|
31
|
-
exclude?: Array<Exclude>;
|
|
32
|
-
/**
|
|
33
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
34
|
-
*/
|
|
35
|
-
include?: Array<Include>;
|
|
36
|
-
/**
|
|
37
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
38
|
-
*/
|
|
39
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
40
|
-
transformers?: {
|
|
41
|
-
/**
|
|
42
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
43
|
-
*/
|
|
44
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Define some generators next to the Cypress generators.
|
|
48
|
-
*/
|
|
49
|
-
generators?: Array<Generator<PluginCypress>>;
|
|
50
|
-
};
|
|
51
|
-
type ResolvedOptions = {
|
|
52
|
-
output: Output<Oas>;
|
|
53
|
-
group: Options['group'];
|
|
54
|
-
baseURL: Options['baseURL'] | undefined;
|
|
55
|
-
dataReturnType: NonNullable<Options['dataReturnType']>;
|
|
56
|
-
};
|
|
57
|
-
type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
58
|
-
|
|
59
|
-
export type { Options as O, PluginCypress as P };
|
package/dist/types-C2ke2hnU.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Output, Group, ResolveNameParams, PluginFactoryOptions } from '@kubb/core';
|
|
2
|
-
import { Oas, contentType } from '@kubb/oas';
|
|
3
|
-
import { Exclude, Include, Override, Generator, ResolvePathOptions } from '@kubb/plugin-oas';
|
|
4
|
-
|
|
5
|
-
type Options = {
|
|
6
|
-
/**
|
|
7
|
-
* Specify the export location for the files and define the behavior of the output
|
|
8
|
-
* @default { path: 'cypress', barrelType: 'named' }
|
|
9
|
-
*/
|
|
10
|
-
output?: Output<Oas>;
|
|
11
|
-
/**
|
|
12
|
-
* Define which contentType should be used.
|
|
13
|
-
* By default, the first JSON valid mediaType will be used
|
|
14
|
-
*/
|
|
15
|
-
contentType?: contentType;
|
|
16
|
-
/**
|
|
17
|
-
* ReturnType that will be used when calling cy.request.
|
|
18
|
-
* - 'data' will return ResponseConfig[data].
|
|
19
|
-
* - 'full' will return ResponseConfig.
|
|
20
|
-
* @default 'data'
|
|
21
|
-
*/
|
|
22
|
-
dataReturnType?: 'data' | 'full';
|
|
23
|
-
baseURL?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Group the Cypress requests based on the provided name.
|
|
26
|
-
*/
|
|
27
|
-
group?: Group;
|
|
28
|
-
/**
|
|
29
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
30
|
-
*/
|
|
31
|
-
exclude?: Array<Exclude>;
|
|
32
|
-
/**
|
|
33
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
34
|
-
*/
|
|
35
|
-
include?: Array<Include>;
|
|
36
|
-
/**
|
|
37
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
38
|
-
*/
|
|
39
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
40
|
-
transformers?: {
|
|
41
|
-
/**
|
|
42
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
43
|
-
*/
|
|
44
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Define some generators next to the Cypress generators.
|
|
48
|
-
*/
|
|
49
|
-
generators?: Array<Generator<PluginCypress>>;
|
|
50
|
-
};
|
|
51
|
-
type ResolvedOptions = {
|
|
52
|
-
output: Output<Oas>;
|
|
53
|
-
group: Options['group'];
|
|
54
|
-
baseURL: Options['baseURL'] | undefined;
|
|
55
|
-
dataReturnType: NonNullable<Options['dataReturnType']>;
|
|
56
|
-
};
|
|
57
|
-
type PluginCypress = PluginFactoryOptions<'plugin-cypress', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
58
|
-
|
|
59
|
-
export type { Options as O, PluginCypress as P };
|