@kubb/plugin-msw 4.4.0 → 4.5.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/{components-DhZ1MTrg.cjs → components-DsnoNtPq.cjs} +14 -14
- package/dist/components-DsnoNtPq.cjs.map +1 -0
- package/dist/{components-C1RVylIl.js → components-IvRPRy3j.js} +14 -14
- package/dist/components-IvRPRy3j.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +13 -13
- package/dist/components.d.ts +13 -13
- package/dist/components.js +1 -1
- package/dist/{generators-CNRKORe8.cjs → generators-BMD5TEc2.cjs} +58 -59
- package/dist/generators-BMD5TEc2.cjs.map +1 -0
- package/dist/{generators-BvLpjRZi.js → generators-ubi6QbfX.js} +58 -59
- package/dist/generators-ubi6QbfX.js.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +4 -4
- package/dist/generators.d.ts +4 -4
- package/dist/generators.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{types-BXU1IBpt.d.cts → types-C9Jm40mM.d.cts} +37 -157
- package/dist/{types-Bd9L1DM6.d.ts → types-DSnvepCr.d.ts} +37 -157
- package/package.json +17 -13
- package/src/components/index.ts +1 -1
- package/src/generators/handlersGenerator.tsx +4 -5
- package/src/generators/index.ts +1 -1
- package/src/generators/mswGenerator.tsx +5 -5
- package/src/types.ts +2 -1
- package/dist/components-C1RVylIl.js.map +0 -1
- package/dist/components-DhZ1MTrg.cjs.map +0 -1
- package/dist/generators-BvLpjRZi.js.map +0 -1
- package/dist/generators-CNRKORe8.cjs.map +0 -1
|
@@ -23,11 +23,22 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
//#endregion
|
|
24
24
|
let __kubb_react_fabric = require("@kubb/react-fabric");
|
|
25
25
|
__kubb_react_fabric = __toESM(__kubb_react_fabric);
|
|
26
|
-
let __kubb_core_utils = require("@kubb/core/utils");
|
|
27
|
-
__kubb_core_utils = __toESM(__kubb_core_utils);
|
|
28
26
|
let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
29
27
|
__kubb_react_fabric_jsx_runtime = __toESM(__kubb_react_fabric_jsx_runtime);
|
|
28
|
+
let __kubb_core_utils = require("@kubb/core/utils");
|
|
29
|
+
__kubb_core_utils = __toESM(__kubb_core_utils);
|
|
30
|
+
|
|
31
|
+
//#region src/components/Handlers.tsx
|
|
32
|
+
function Handlers({ name, handlers }) {
|
|
33
|
+
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
|
|
34
|
+
name,
|
|
35
|
+
isIndexable: true,
|
|
36
|
+
isExportable: true,
|
|
37
|
+
children: `export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, "")} as const`
|
|
38
|
+
});
|
|
39
|
+
}
|
|
30
40
|
|
|
41
|
+
//#endregion
|
|
31
42
|
//#region src/components/Mock.tsx
|
|
32
43
|
function Mock({ baseURL = "", name, typeName, operation }) {
|
|
33
44
|
const method = operation.method;
|
|
@@ -66,17 +77,6 @@ function Mock({ baseURL = "", name, typeName, operation }) {
|
|
|
66
77
|
});
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/components/Handlers.tsx
|
|
71
|
-
function Handlers({ name, handlers }) {
|
|
72
|
-
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
|
|
73
|
-
name,
|
|
74
|
-
isIndexable: true,
|
|
75
|
-
isExportable: true,
|
|
76
|
-
children: `export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, "")} as const`
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/components/MockWithFaker.tsx
|
|
82
82
|
function MockWithFaker({ baseURL = "", name, fakerName, typeName, operation }) {
|
|
@@ -177,4 +177,4 @@ Object.defineProperty(exports, '__toESM', {
|
|
|
177
177
|
return __toESM;
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
-
//# sourceMappingURL=components-
|
|
180
|
+
//# sourceMappingURL=components-DsnoNtPq.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-DsnoNtPq.cjs","names":["File","URLPath","FunctionParams","File","Function","URLPath","FunctionParams","File","Function","FunctionParams","File","Function"],"sources":["../src/components/Handlers.tsx","../src/components/Mock.tsx","../src/components/MockWithFaker.tsx","../src/components/Response.tsx"],"sourcesContent":["import { File } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype HandlersProps = {\n /**\n * Name of the function\n */\n name: string\n // custom\n handlers: string[]\n}\n\nexport function Handlers({ name, handlers }: HandlersProps): KubbNode {\n return (\n <File.Source name={name} isIndexable isExportable>\n {`export const ${name} = ${JSON.stringify(handlers).replaceAll(`\"`, '')} as const`}\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n fakerName: string\n baseURL: string | undefined\n operation: Operation\n}\n\nexport function Mock({ baseURL = '', name, typeName, operation }: Props): KubbNode {\n const method = operation.method\n const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))\n const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200\n\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n const url = new URLPath(operation.path).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const hasResponseSchema = contentType && responseObject?.content?.[contentType]?.schema !== undefined\n\n // If no response schema, uses any type but function to avoid overriding callback\n const dataType = hasResponseSchema ? typeName : 'string | number | boolean | null | object'\n\n const params = FunctionParams.factory({\n data: {\n type: `${dataType} | ((\n info: Parameters<Parameters<typeof http.${method}>[1]>[0],\n ) => Response | Promise<Response>)`,\n optional: true,\n },\n })\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()}>\n {`return http.${method}('${baseURL}${url.replace(/([^/]):/g, '$1\\\\\\\\:')}', function handler(info) {\n if(typeof data === 'function') return data(info)\n\n return new Response(JSON.stringify(data), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })\n })`}\n </Function>\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\n\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n fakerName: string\n baseURL: string | undefined\n operation: Operation\n}\n\nexport function MockWithFaker({ baseURL = '', name, fakerName, typeName, operation }: Props): KubbNode {\n const method = operation.method\n const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))\n const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200\n\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n const url = new URLPath(operation.path).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const params = FunctionParams.factory({\n data: {\n type: `${typeName} | ((\n info: Parameters<Parameters<typeof http.${method}>[1]>[0],\n ) => Response | Promise<Response>)`,\n optional: true,\n },\n })\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()}>\n {`return http.${method}('${baseURL}${url.replace(/([^/]):/g, '$1\\\\\\\\:')}', function handler(info) {\n if(typeof data === 'function') return data(info)\n\n return new Response(JSON.stringify(data || ${fakerName}(data)), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })\n })`}\n </Function>\n </File.Source>\n )\n}\n","import type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n typeName: string\n operation: Operation\n name: string\n statusCode: number\n}\n\nexport function Response({ name, typeName, operation, statusCode }: Props): KubbNode {\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const hasResponseSchema = contentType && responseObject?.content?.[contentType]?.schema !== undefined\n\n const params = FunctionParams.factory({\n data: {\n type: `${typeName}`,\n optional: !hasResponseSchema,\n },\n })\n\n const responseName = `${name}Response${statusCode}`\n\n return (\n <File.Source name={responseName} isIndexable isExportable>\n <Function name={responseName} export params={params.toConstructor()}>\n {`\n return new Response(JSON.stringify(data), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAgB,SAAS,EAAE,MAAM,YAAqC;AACpE,QACE,yDAACA,yBAAK;EAAa;EAAM;EAAY;YAClC,gBAAgB,KAAK,KAAK,KAAK,UAAU,SAAS,CAAC,WAAW,KAAK,GAAG,CAAC;GAC5D;;;;;ACAlB,SAAgB,KAAK,EAAE,UAAU,IAAI,MAAM,UAAU,aAA8B;CACjF,MAAM,SAAS,UAAU;CACzB,MAAM,qBAAqB,UAAU,w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F,MAAM,UAAU,CAAC,cAAc,oBAAoB,YAAY,KAAK,OAAU,CAAC,OAAO,QAAQ;CAE9F,MAAM,SAASC,mCAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG,SAAS;kDAC0B,OAAO;;EAEnD,UAAU;EACX,EACF,CAAC;AAEF,QACE,yDAACC,yBAAK;EAAa;EAAM;EAAY;YACnC,yDAACC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;aACxD,eAAe,OAAO,IAAI,UAAU,IAAI,QAAQ,YAAY,UAAU,CAAC;;;iDAG/B,UAAU;gBAC3C,WAAW;QAEnB,QAAQ,SACJ;UACF,QAAQ,KAAK,OAAO,CAAC;YAEnB,GACL;;;IAGU;GACC;;;;;AC5ClB,SAAgB,SAAS,EAAE,MAAM,UAAU,WAAW,cAA+B;CACnF,MAAM,iBAAiB,UAAU,wBAAwB,WAAW;CACpE,MAAM,cAAc,OAAO,KAAK,eAAe,WAAW,EAAE,CAAC,GAAG;CAEhE,MAAM,UAAU,CAAC,cAAc,oBAAoB,YAAY,KAAK,OAAU,CAAC,OAAO,QAAQ;CAE9F,MAAM,oBAAoB,eAAe,gBAAgB,UAAU,cAAc,WAAW;CAE5F,MAAM,SAASC,mCAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG;EACT,UAAU,CAAC;EACZ,EACF,CAAC;CAEF,MAAM,eAAe,GAAG,KAAK,UAAU;AAEvC,QACE,yDAACC,yBAAK;EAAO,MAAM;EAAc;EAAY;YAC3C,yDAACC;GAAS,MAAM;GAAc;GAAO,QAAQ,OAAO,eAAe;aAChE;;gBAEO,WAAW;QAEnB,QAAQ,SACJ;UACF,QAAQ,KAAK,OAAO,CAAC;YAEnB,GACL;;IAEU;GACC"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { File, Function, FunctionParams } from "@kubb/react-fabric";
|
|
2
|
-
import { URLPath } from "@kubb/core/utils";
|
|
3
2
|
import { jsx } from "@kubb/react-fabric/jsx-runtime";
|
|
3
|
+
import { URLPath } from "@kubb/core/utils";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Handlers.tsx
|
|
6
|
+
function Handlers({ name, handlers }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(File.Source, {
|
|
8
|
+
name,
|
|
9
|
+
isIndexable: true,
|
|
10
|
+
isExportable: true,
|
|
11
|
+
children: `export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, "")} as const`
|
|
12
|
+
});
|
|
13
|
+
}
|
|
4
14
|
|
|
15
|
+
//#endregion
|
|
5
16
|
//#region src/components/Mock.tsx
|
|
6
17
|
function Mock({ baseURL = "", name, typeName, operation }) {
|
|
7
18
|
const method = operation.method;
|
|
@@ -40,17 +51,6 @@ function Mock({ baseURL = "", name, typeName, operation }) {
|
|
|
40
51
|
});
|
|
41
52
|
}
|
|
42
53
|
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/components/Handlers.tsx
|
|
45
|
-
function Handlers({ name, handlers }) {
|
|
46
|
-
return /* @__PURE__ */ jsx(File.Source, {
|
|
47
|
-
name,
|
|
48
|
-
isIndexable: true,
|
|
49
|
-
isExportable: true,
|
|
50
|
-
children: `export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, "")} as const`
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/components/MockWithFaker.tsx
|
|
56
56
|
function MockWithFaker({ baseURL = "", name, fakerName, typeName, operation }) {
|
|
@@ -121,5 +121,5 @@ function Response({ name, typeName, operation, statusCode }) {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
//#endregion
|
|
124
|
-
export {
|
|
125
|
-
//# sourceMappingURL=components-
|
|
124
|
+
export { Handlers as i, MockWithFaker as n, Mock as r, Response as t };
|
|
125
|
+
//# sourceMappingURL=components-IvRPRy3j.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-IvRPRy3j.js","names":[],"sources":["../src/components/Handlers.tsx","../src/components/Mock.tsx","../src/components/MockWithFaker.tsx","../src/components/Response.tsx"],"sourcesContent":["import { File } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype HandlersProps = {\n /**\n * Name of the function\n */\n name: string\n // custom\n handlers: string[]\n}\n\nexport function Handlers({ name, handlers }: HandlersProps): KubbNode {\n return (\n <File.Source name={name} isIndexable isExportable>\n {`export const ${name} = ${JSON.stringify(handlers).replaceAll(`\"`, '')} as const`}\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n fakerName: string\n baseURL: string | undefined\n operation: Operation\n}\n\nexport function Mock({ baseURL = '', name, typeName, operation }: Props): KubbNode {\n const method = operation.method\n const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))\n const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200\n\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n const url = new URLPath(operation.path).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const hasResponseSchema = contentType && responseObject?.content?.[contentType]?.schema !== undefined\n\n // If no response schema, uses any type but function to avoid overriding callback\n const dataType = hasResponseSchema ? typeName : 'string | number | boolean | null | object'\n\n const params = FunctionParams.factory({\n data: {\n type: `${dataType} | ((\n info: Parameters<Parameters<typeof http.${method}>[1]>[0],\n ) => Response | Promise<Response>)`,\n optional: true,\n },\n })\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()}>\n {`return http.${method}('${baseURL}${url.replace(/([^/]):/g, '$1\\\\\\\\:')}', function handler(info) {\n if(typeof data === 'function') return data(info)\n\n return new Response(JSON.stringify(data), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })\n })`}\n </Function>\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\n\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n fakerName: string\n baseURL: string | undefined\n operation: Operation\n}\n\nexport function MockWithFaker({ baseURL = '', name, fakerName, typeName, operation }: Props): KubbNode {\n const method = operation.method\n const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))\n const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200\n\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n const url = new URLPath(operation.path).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const params = FunctionParams.factory({\n data: {\n type: `${typeName} | ((\n info: Parameters<Parameters<typeof http.${method}>[1]>[0],\n ) => Response | Promise<Response>)`,\n optional: true,\n },\n })\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()}>\n {`return http.${method}('${baseURL}${url.replace(/([^/]):/g, '$1\\\\\\\\:')}', function handler(info) {\n if(typeof data === 'function') return data(info)\n\n return new Response(JSON.stringify(data || ${fakerName}(data)), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })\n })`}\n </Function>\n </File.Source>\n )\n}\n","import type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n typeName: string\n operation: Operation\n name: string\n statusCode: number\n}\n\nexport function Response({ name, typeName, operation, statusCode }: Props): KubbNode {\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const hasResponseSchema = contentType && responseObject?.content?.[contentType]?.schema !== undefined\n\n const params = FunctionParams.factory({\n data: {\n type: `${typeName}`,\n optional: !hasResponseSchema,\n },\n })\n\n const responseName = `${name}Response${statusCode}`\n\n return (\n <File.Source name={responseName} isIndexable isExportable>\n <Function name={responseName} export params={params.toConstructor()}>\n {`\n return new Response(JSON.stringify(data), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;AAYA,SAAgB,SAAS,EAAE,MAAM,YAAqC;AACpE,QACE,oBAAC,KAAK;EAAa;EAAM;EAAY;YAClC,gBAAgB,KAAK,KAAK,KAAK,UAAU,SAAS,CAAC,WAAW,KAAK,GAAG,CAAC;GAC5D;;;;;ACAlB,SAAgB,KAAK,EAAE,UAAU,IAAI,MAAM,UAAU,aAA8B;CACjF,MAAM,SAAS,UAAU;CACzB,MAAM,qBAAqB,UAAU,wBAAwB,CAAC,QAAQ,SAAS,KAAK,WAAW,IAAI,CAAC;CACpG,MAAM,aAAa,mBAAmB,SAAS,IAAI,OAAO,mBAAmB,GAAG,GAAG;CAEnF,MAAM,iBAAiB,UAAU,wBAAwB,WAAW;CACpE,MAAM,cAAc,OAAO,KAAK,eAAe,WAAW,EAAE,CAAC,GAAG;CAChE,MAAM,MAAM,IAAI,QAAQ,UAAU,KAAK,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU;CAElF,MAAM,UAAU,CAAC,cAAc,oBAAoB,YAAY,KAAK,OAAU,CAAC,OAAO,QAAQ;CAK9F,MAAM,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,QAAQ,KAAK,OAAO,CAAC;YAEnB,GACL;;;IAGU;GACC;;;;;AC5ClB,SAAgB,SAAS,EAAE,MAAM,UAAU,WAAW,cAA+B;CACnF,MAAM,iBAAiB,UAAU,wBAAwB,WAAW;CACpE,MAAM,cAAc,OAAO,KAAK,eAAe,WAAW,EAAE,CAAC,GAAG;CAEhE,MAAM,UAAU,CAAC,cAAc,oBAAoB,YAAY,KAAK,OAAU,CAAC,OAAO,QAAQ;CAE9F,MAAM,oBAAoB,eAAe,gBAAgB,UAAU,cAAc,WAAW;CAE5F,MAAM,SAAS,eAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG;EACT,UAAU,CAAC;EACZ,EACF,CAAC;CAEF,MAAM,eAAe,GAAG,KAAK,UAAU;AAEvC,QACE,oBAAC,KAAK;EAAO,MAAM;EAAc;EAAY;YAC3C,oBAAC;GAAS,MAAM;GAAc;GAAO,QAAQ,OAAO,eAAe;aAChE;;gBAEO,WAAW;QAEnB,QAAQ,SACJ;UACF,QAAQ,KAAK,OAAO,CAAC;YAEnB,GACL;;IAEU;GACC"}
|
package/dist/components.cjs
CHANGED
package/dist/components.d.cts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { r as Operation } from "./types-8ZXwr93_.cjs";
|
|
2
2
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
3
3
|
|
|
4
|
+
//#region src/components/Handlers.d.ts
|
|
5
|
+
type HandlersProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Name of the function
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
handlers: string[];
|
|
11
|
+
};
|
|
12
|
+
declare function Handlers({
|
|
13
|
+
name,
|
|
14
|
+
handlers
|
|
15
|
+
}: HandlersProps): KubbNode;
|
|
16
|
+
//#endregion
|
|
4
17
|
//#region src/components/Mock.d.ts
|
|
5
18
|
type Props$2 = {
|
|
6
19
|
/**
|
|
@@ -19,19 +32,6 @@ declare function Mock({
|
|
|
19
32
|
operation
|
|
20
33
|
}: Props$2): KubbNode;
|
|
21
34
|
//#endregion
|
|
22
|
-
//#region src/components/Handlers.d.ts
|
|
23
|
-
type HandlersProps = {
|
|
24
|
-
/**
|
|
25
|
-
* Name of the function
|
|
26
|
-
*/
|
|
27
|
-
name: string;
|
|
28
|
-
handlers: string[];
|
|
29
|
-
};
|
|
30
|
-
declare function Handlers({
|
|
31
|
-
name,
|
|
32
|
-
handlers
|
|
33
|
-
}: HandlersProps): KubbNode;
|
|
34
|
-
//#endregion
|
|
35
35
|
//#region src/components/MockWithFaker.d.ts
|
|
36
36
|
type Props$1 = {
|
|
37
37
|
/**
|
package/dist/components.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { r as Operation } from "./types-D0JuaurR.js";
|
|
2
2
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
3
3
|
|
|
4
|
+
//#region src/components/Handlers.d.ts
|
|
5
|
+
type HandlersProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Name of the function
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
handlers: string[];
|
|
11
|
+
};
|
|
12
|
+
declare function Handlers({
|
|
13
|
+
name,
|
|
14
|
+
handlers
|
|
15
|
+
}: HandlersProps): KubbNode;
|
|
16
|
+
//#endregion
|
|
4
17
|
//#region src/components/Mock.d.ts
|
|
5
18
|
type Props$2 = {
|
|
6
19
|
/**
|
|
@@ -19,19 +32,6 @@ declare function Mock({
|
|
|
19
32
|
operation
|
|
20
33
|
}: Props$2): KubbNode;
|
|
21
34
|
//#endregion
|
|
22
|
-
//#region src/components/Handlers.d.ts
|
|
23
|
-
type HandlersProps = {
|
|
24
|
-
/**
|
|
25
|
-
* Name of the function
|
|
26
|
-
*/
|
|
27
|
-
name: string;
|
|
28
|
-
handlers: string[];
|
|
29
|
-
};
|
|
30
|
-
declare function Handlers({
|
|
31
|
-
name,
|
|
32
|
-
handlers
|
|
33
|
-
}: HandlersProps): KubbNode;
|
|
34
|
-
//#endregion
|
|
35
35
|
//#region src/components/MockWithFaker.d.ts
|
|
36
36
|
type Props$1 = {
|
|
37
37
|
/**
|
package/dist/components.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_components = require('./components-
|
|
1
|
+
const require_components = require('./components-DsnoNtPq.cjs');
|
|
2
2
|
let __kubb_plugin_faker = require("@kubb/plugin-faker");
|
|
3
3
|
__kubb_plugin_faker = require_components.__toESM(__kubb_plugin_faker);
|
|
4
|
-
let __kubb_plugin_oas = require("@kubb/plugin-oas");
|
|
5
|
-
__kubb_plugin_oas = require_components.__toESM(__kubb_plugin_oas);
|
|
6
4
|
let __kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
7
5
|
__kubb_plugin_ts = require_components.__toESM(__kubb_plugin_ts);
|
|
8
6
|
let __kubb_core_hooks = require("@kubb/core/hooks");
|
|
9
7
|
__kubb_core_hooks = require_components.__toESM(__kubb_core_hooks);
|
|
8
|
+
let __kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
|
|
9
|
+
__kubb_plugin_oas_generators = require_components.__toESM(__kubb_plugin_oas_generators);
|
|
10
10
|
let __kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
|
|
11
11
|
__kubb_plugin_oas_hooks = require_components.__toESM(__kubb_plugin_oas_hooks);
|
|
12
12
|
let __kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
@@ -16,14 +16,64 @@ __kubb_react_fabric = require_components.__toESM(__kubb_react_fabric);
|
|
|
16
16
|
let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
17
17
|
__kubb_react_fabric_jsx_runtime = require_components.__toESM(__kubb_react_fabric_jsx_runtime);
|
|
18
18
|
|
|
19
|
+
//#region src/generators/handlersGenerator.tsx
|
|
20
|
+
const handlersGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
21
|
+
name: "plugin-msw",
|
|
22
|
+
Operations({ operations, generator, plugin }) {
|
|
23
|
+
const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
|
|
24
|
+
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
25
|
+
const { getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
26
|
+
const file = pluginManager.getFile({
|
|
27
|
+
name: "handlers",
|
|
28
|
+
extname: ".ts",
|
|
29
|
+
pluginKey: plugin.key
|
|
30
|
+
});
|
|
31
|
+
const imports = operations.map((operation) => {
|
|
32
|
+
const operationFile = getFile(operation, { pluginKey: plugin.key });
|
|
33
|
+
const operationName = getName(operation, {
|
|
34
|
+
pluginKey: plugin.key,
|
|
35
|
+
type: "function"
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
38
|
+
name: [operationName],
|
|
39
|
+
root: file.path,
|
|
40
|
+
path: operationFile.path
|
|
41
|
+
}, operationFile.path);
|
|
42
|
+
});
|
|
43
|
+
const handlers = operations.map((operation) => `${getName(operation, {
|
|
44
|
+
type: "function",
|
|
45
|
+
pluginKey: plugin.key
|
|
46
|
+
})}()`);
|
|
47
|
+
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
|
|
48
|
+
baseName: file.baseName,
|
|
49
|
+
path: file.path,
|
|
50
|
+
meta: file.meta,
|
|
51
|
+
banner: (0, __kubb_plugin_oas_utils.getBanner)({
|
|
52
|
+
oas,
|
|
53
|
+
output: plugin.options.output,
|
|
54
|
+
config: pluginManager.config
|
|
55
|
+
}),
|
|
56
|
+
footer: (0, __kubb_plugin_oas_utils.getFooter)({
|
|
57
|
+
oas,
|
|
58
|
+
output: plugin.options.output
|
|
59
|
+
}),
|
|
60
|
+
children: [imports, /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.Handlers, {
|
|
61
|
+
name: "handlers",
|
|
62
|
+
handlers
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
19
69
|
//#region src/generators/mswGenerator.tsx
|
|
20
|
-
const mswGenerator = (0,
|
|
70
|
+
const mswGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
21
71
|
name: "msw",
|
|
22
|
-
Operation({ operation }) {
|
|
23
|
-
const { options: { output, parser, baseURL } } =
|
|
72
|
+
Operation({ operation, generator, plugin }) {
|
|
73
|
+
const { options: { output, parser, baseURL } } = plugin;
|
|
24
74
|
const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
|
|
25
75
|
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
26
|
-
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
|
|
76
|
+
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
27
77
|
const mock = {
|
|
28
78
|
name: getName(operation, { type: "function" }),
|
|
29
79
|
file: getFile(operation)
|
|
@@ -115,57 +165,6 @@ const mswGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
115
165
|
}
|
|
116
166
|
});
|
|
117
167
|
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/generators/handlersGenerator.tsx
|
|
120
|
-
const handlersGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
121
|
-
name: "plugin-msw",
|
|
122
|
-
Operations({ operations }) {
|
|
123
|
-
const plugin = (0, __kubb_core_hooks.usePlugin)();
|
|
124
|
-
const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
|
|
125
|
-
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
126
|
-
const { getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
|
|
127
|
-
const file = pluginManager.getFile({
|
|
128
|
-
name: "handlers",
|
|
129
|
-
extname: ".ts",
|
|
130
|
-
pluginKey: plugin.key
|
|
131
|
-
});
|
|
132
|
-
const imports = operations.map((operation) => {
|
|
133
|
-
const operationFile = getFile(operation, { pluginKey: plugin.key });
|
|
134
|
-
const operationName = getName(operation, {
|
|
135
|
-
pluginKey: plugin.key,
|
|
136
|
-
type: "function"
|
|
137
|
-
});
|
|
138
|
-
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
139
|
-
name: [operationName],
|
|
140
|
-
root: file.path,
|
|
141
|
-
path: operationFile.path
|
|
142
|
-
}, operationFile.path);
|
|
143
|
-
});
|
|
144
|
-
const handlers = operations.map((operation) => `${getName(operation, {
|
|
145
|
-
type: "function",
|
|
146
|
-
pluginKey: plugin.key
|
|
147
|
-
})}()`);
|
|
148
|
-
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
|
|
149
|
-
baseName: file.baseName,
|
|
150
|
-
path: file.path,
|
|
151
|
-
meta: file.meta,
|
|
152
|
-
banner: (0, __kubb_plugin_oas_utils.getBanner)({
|
|
153
|
-
oas,
|
|
154
|
-
output: plugin.options.output,
|
|
155
|
-
config: pluginManager.config
|
|
156
|
-
}),
|
|
157
|
-
footer: (0, __kubb_plugin_oas_utils.getFooter)({
|
|
158
|
-
oas,
|
|
159
|
-
output: plugin.options.output
|
|
160
|
-
}),
|
|
161
|
-
children: [imports, /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.Handlers, {
|
|
162
|
-
name: "handlers",
|
|
163
|
-
handlers
|
|
164
|
-
})]
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
168
|
//#endregion
|
|
170
169
|
Object.defineProperty(exports, 'handlersGenerator', {
|
|
171
170
|
enumerable: true,
|
|
@@ -179,4 +178,4 @@ Object.defineProperty(exports, 'mswGenerator', {
|
|
|
179
178
|
return mswGenerator;
|
|
180
179
|
}
|
|
181
180
|
});
|
|
182
|
-
//# sourceMappingURL=generators-
|
|
181
|
+
//# sourceMappingURL=generators-BMD5TEc2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-BMD5TEc2.cjs","names":["File","Handlers","pluginFakerName","pluginTsName","types: [statusCode: number | 'default', typeName: string][]","File","Response","MockWithFaker","Mock"],"sources":["../src/generators/handlersGenerator.tsx","../src/generators/mswGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Handlers } from '../components/Handlers.tsx'\nimport type { PluginMsw } from '../types'\n\nexport const handlersGenerator = createReactGenerator<PluginMsw>({\n name: 'plugin-msw',\n Operations({ operations, generator, plugin }) {\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile } = useOperationManager(generator)\n\n const file = pluginManager.getFile({ name: 'handlers', extname: '.ts', pluginKey: plugin.key })\n\n const imports = operations.map((operation) => {\n const operationFile = getFile(operation, { pluginKey: plugin.key })\n const operationName = getName(operation, { pluginKey: plugin.key, type: 'function' })\n\n return <File.Import key={operationFile.path} name={[operationName]} root={file.path} path={operationFile.path} />\n })\n\n const handlers = operations.map((operation) => `${getName(operation, { type: 'function', pluginKey: plugin.key })}()`)\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n {imports}\n <Handlers name={'handlers'} handlers={handlers} />\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { pluginFakerName } from '@kubb/plugin-faker'\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 { Mock, MockWithFaker, Response } from '../components'\nimport type { PluginMsw } from '../types'\n\nexport const mswGenerator = createReactGenerator<PluginMsw>({\n name: 'msw',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, parser, baseURL },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const mock = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const faker = {\n file: getFile(operation, { pluginKey: [pluginFakerName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginFakerName], type: 'function' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const responseStatusCodes = operation.getResponseStatusCodes()\n\n const types: [statusCode: number | 'default', typeName: string][] = []\n\n for (const code of responseStatusCodes) {\n if (code === 'default') {\n types.push(['default', type.schemas.response.name])\n continue\n }\n\n if (code.startsWith('2')) {\n types.push([Number(code), type.schemas.response.name])\n continue\n }\n\n const codeType = type.schemas.errors?.find((err) => err.statusCode === Number(code))\n if (codeType) types.push([Number(code), codeType.name])\n }\n\n return (\n <File\n baseName={mock.file.baseName}\n path={mock.file.path}\n meta={mock.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['http']} path=\"msw\" />\n <File.Import name={['ResponseResolver']} isTypeOnly path=\"msw\" />\n <File.Import\n name={Array.from(new Set([type.schemas.response.name, ...types.map((t) => t[1])]))}\n path={type.file.path}\n root={mock.file.path}\n isTypeOnly\n />\n {parser === 'faker' && faker.file && faker.schemas.response && (\n <File.Import name={[faker.schemas.response.name]} root={mock.file.path} path={faker.file.path} />\n )}\n\n {types\n .filter(([code]) => code !== 'default')\n .map(([code, typeName]) => (\n <Response typeName={typeName} operation={operation} name={mock.name} statusCode={code as number} />\n ))}\n {parser === 'faker' && (\n <MockWithFaker\n name={mock.name}\n typeName={type.schemas.response.name}\n fakerName={faker.schemas.response.name}\n operation={operation}\n baseURL={baseURL}\n />\n )}\n {parser === 'data' && (\n <Mock name={mock.name} typeName={type.schemas.response.name} fakerName={faker.schemas.response.name} operation={operation} baseURL={baseURL} />\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA,MAAa,2EAAoD;CAC/D,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,UAAU;EAC5C,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,SAAS,6DAAgC,UAAU;EAE3D,MAAM,OAAO,cAAc,QAAQ;GAAE,MAAM;GAAY,SAAS;GAAO,WAAW,OAAO;GAAK,CAAC;EAE/F,MAAM,UAAU,WAAW,KAAK,cAAc;GAC5C,MAAM,gBAAgB,QAAQ,WAAW,EAAE,WAAW,OAAO,KAAK,CAAC;GACnE,MAAM,gBAAgB,QAAQ,WAAW;IAAE,WAAW,OAAO;IAAK,MAAM;IAAY,CAAC;AAErF,UAAO,yDAACA,yBAAK;IAAgC,MAAM,CAAC,cAAc;IAAE,MAAM,KAAK;IAAM,MAAM,cAAc;MAAhF,cAAc,KAA0E;IACjH;EAEF,MAAM,WAAW,WAAW,KAAK,cAAc,GAAG,QAAQ,WAAW;GAAE,MAAM;GAAY,WAAW,OAAO;GAAK,CAAC,CAAC,IAAI;AAEtH,SACE,0DAACA;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,+CAAkB;IAAE;IAAK,QAAQ,OAAO,QAAQ;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GACvF,+CAAkB;IAAE;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;cAExD,SACD,yDAACC;IAAS,MAAM;IAAsB;KAAY;IAC7C;;CAGZ,CAAC;;;;AC9BF,MAAa,sEAA+C;CAC1D,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAA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K;KAAO,MAAM,CAAC,OAAO;KAAE,MAAK;MAAQ;IAC1C,yDAACA,yBAAK;KAAO,MAAM,CAAC,mBAAmB;KAAE;KAAW,MAAK;MAAQ;IACjE,yDAACA,yBAAK;KACJ,MAAM,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,QAAQ,SAAS,MAAM,GAAG,MAAM,KAAK,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;KAClF,MAAM,KAAK,KAAK;KAChB,MAAM,KAAK,KAAK;KAChB;MACA;IACD,WAAW,WAAW,MAAM,QAAQ,MAAM,QAAQ,YACjD,yDAACA,yBAAK;KAAO,MAAM,CAAC,MAAM,QAAQ,SAAS,KAAK;KAAE,MAAM,KAAK,KAAK;KAAM,MAAM,MAAM,KAAK;MAAQ;IAGlG,MACE,QAAQ,CAAC,UAAU,SAAS,UAAU,CACtC,KAAK,CAAC,MAAM,cACX,yDAACC;KAAmB;KAAqB;KAAW,MAAM,KAAK;KAAM,YAAY;MAAkB,CACnG;IACH,WAAW,WACV,yDAACC;KACC,MAAM,KAAK;KACX,UAAU,KAAK,QAAQ,SAAS;KAChC,WAAW,MAAM,QAAQ,SAAS;KACvB;KACF;MACT;IAEH,WAAW,UACV,yDAACC;KAAK,MAAM,KAAK;KAAM,UAAU,KAAK,QAAQ,SAAS;KAAM,WAAW,MAAM,QAAQ,SAAS;KAAiB;KAAoB;MAAW;;IAE5I;;CAGZ,CAAC"}
|
|
@@ -1,21 +1,71 @@
|
|
|
1
|
-
import { i as
|
|
1
|
+
import { i as Handlers, n as MockWithFaker, r as Mock, t as Response } from "./components-IvRPRy3j.js";
|
|
2
2
|
import { pluginFakerName } from "@kubb/plugin-faker";
|
|
3
|
-
import { createReactGenerator } from "@kubb/plugin-oas";
|
|
4
3
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
5
|
-
import {
|
|
4
|
+
import { usePluginManager } from "@kubb/core/hooks";
|
|
5
|
+
import { createReactGenerator } from "@kubb/plugin-oas/generators";
|
|
6
6
|
import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
|
|
7
7
|
import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
|
|
8
8
|
import { File } from "@kubb/react-fabric";
|
|
9
9
|
import { jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
10
10
|
|
|
11
|
+
//#region src/generators/handlersGenerator.tsx
|
|
12
|
+
const handlersGenerator = createReactGenerator({
|
|
13
|
+
name: "plugin-msw",
|
|
14
|
+
Operations({ operations, generator, plugin }) {
|
|
15
|
+
const pluginManager = usePluginManager();
|
|
16
|
+
const oas = useOas();
|
|
17
|
+
const { getName, getFile } = useOperationManager(generator);
|
|
18
|
+
const file = pluginManager.getFile({
|
|
19
|
+
name: "handlers",
|
|
20
|
+
extname: ".ts",
|
|
21
|
+
pluginKey: plugin.key
|
|
22
|
+
});
|
|
23
|
+
const imports = operations.map((operation) => {
|
|
24
|
+
const operationFile = getFile(operation, { pluginKey: plugin.key });
|
|
25
|
+
const operationName = getName(operation, {
|
|
26
|
+
pluginKey: plugin.key,
|
|
27
|
+
type: "function"
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ jsx(File.Import, {
|
|
30
|
+
name: [operationName],
|
|
31
|
+
root: file.path,
|
|
32
|
+
path: operationFile.path
|
|
33
|
+
}, operationFile.path);
|
|
34
|
+
});
|
|
35
|
+
const handlers = operations.map((operation) => `${getName(operation, {
|
|
36
|
+
type: "function",
|
|
37
|
+
pluginKey: plugin.key
|
|
38
|
+
})}()`);
|
|
39
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
40
|
+
baseName: file.baseName,
|
|
41
|
+
path: file.path,
|
|
42
|
+
meta: file.meta,
|
|
43
|
+
banner: getBanner({
|
|
44
|
+
oas,
|
|
45
|
+
output: plugin.options.output,
|
|
46
|
+
config: pluginManager.config
|
|
47
|
+
}),
|
|
48
|
+
footer: getFooter({
|
|
49
|
+
oas,
|
|
50
|
+
output: plugin.options.output
|
|
51
|
+
}),
|
|
52
|
+
children: [imports, /* @__PURE__ */ jsx(Handlers, {
|
|
53
|
+
name: "handlers",
|
|
54
|
+
handlers
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
11
61
|
//#region src/generators/mswGenerator.tsx
|
|
12
62
|
const mswGenerator = createReactGenerator({
|
|
13
63
|
name: "msw",
|
|
14
|
-
Operation({ operation }) {
|
|
15
|
-
const { options: { output, parser, baseURL } } =
|
|
64
|
+
Operation({ operation, generator, plugin }) {
|
|
65
|
+
const { options: { output, parser, baseURL } } = plugin;
|
|
16
66
|
const pluginManager = usePluginManager();
|
|
17
67
|
const oas = useOas();
|
|
18
|
-
const { getSchemas, getName, getFile } = useOperationManager();
|
|
68
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
19
69
|
const mock = {
|
|
20
70
|
name: getName(operation, { type: "function" }),
|
|
21
71
|
file: getFile(operation)
|
|
@@ -108,56 +158,5 @@ const mswGenerator = createReactGenerator({
|
|
|
108
158
|
});
|
|
109
159
|
|
|
110
160
|
//#endregion
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
name: "plugin-msw",
|
|
114
|
-
Operations({ operations }) {
|
|
115
|
-
const plugin = usePlugin();
|
|
116
|
-
const pluginManager = usePluginManager();
|
|
117
|
-
const oas = useOas();
|
|
118
|
-
const { getName, getFile } = useOperationManager();
|
|
119
|
-
const file = pluginManager.getFile({
|
|
120
|
-
name: "handlers",
|
|
121
|
-
extname: ".ts",
|
|
122
|
-
pluginKey: plugin.key
|
|
123
|
-
});
|
|
124
|
-
const imports = operations.map((operation) => {
|
|
125
|
-
const operationFile = getFile(operation, { pluginKey: plugin.key });
|
|
126
|
-
const operationName = getName(operation, {
|
|
127
|
-
pluginKey: plugin.key,
|
|
128
|
-
type: "function"
|
|
129
|
-
});
|
|
130
|
-
return /* @__PURE__ */ jsx(File.Import, {
|
|
131
|
-
name: [operationName],
|
|
132
|
-
root: file.path,
|
|
133
|
-
path: operationFile.path
|
|
134
|
-
}, operationFile.path);
|
|
135
|
-
});
|
|
136
|
-
const handlers = operations.map((operation) => `${getName(operation, {
|
|
137
|
-
type: "function",
|
|
138
|
-
pluginKey: plugin.key
|
|
139
|
-
})}()`);
|
|
140
|
-
return /* @__PURE__ */ jsxs(File, {
|
|
141
|
-
baseName: file.baseName,
|
|
142
|
-
path: file.path,
|
|
143
|
-
meta: file.meta,
|
|
144
|
-
banner: getBanner({
|
|
145
|
-
oas,
|
|
146
|
-
output: plugin.options.output,
|
|
147
|
-
config: pluginManager.config
|
|
148
|
-
}),
|
|
149
|
-
footer: getFooter({
|
|
150
|
-
oas,
|
|
151
|
-
output: plugin.options.output
|
|
152
|
-
}),
|
|
153
|
-
children: [imports, /* @__PURE__ */ jsx(Handlers, {
|
|
154
|
-
name: "handlers",
|
|
155
|
-
handlers
|
|
156
|
-
})]
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
//#endregion
|
|
162
|
-
export { mswGenerator as n, handlersGenerator as t };
|
|
163
|
-
//# sourceMappingURL=generators-BvLpjRZi.js.map
|
|
161
|
+
export { handlersGenerator as n, mswGenerator as t };
|
|
162
|
+
//# sourceMappingURL=generators-ubi6QbfX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-ubi6QbfX.js","names":["types: [statusCode: number | 'default', typeName: string][]"],"sources":["../src/generators/handlersGenerator.tsx","../src/generators/mswGenerator.tsx"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Handlers } from '../components/Handlers.tsx'\nimport type { PluginMsw } from '../types'\n\nexport const handlersGenerator = createReactGenerator<PluginMsw>({\n name: 'plugin-msw',\n Operations({ operations, generator, plugin }) {\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile } = useOperationManager(generator)\n\n const file = pluginManager.getFile({ name: 'handlers', extname: '.ts', pluginKey: plugin.key })\n\n const imports = operations.map((operation) => {\n const operationFile = getFile(operation, { pluginKey: plugin.key })\n const operationName = getName(operation, { pluginKey: plugin.key, type: 'function' })\n\n return <File.Import key={operationFile.path} name={[operationName]} root={file.path} path={operationFile.path} />\n })\n\n const handlers = operations.map((operation) => `${getName(operation, { type: 'function', pluginKey: plugin.key })}()`)\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n {imports}\n <Handlers name={'handlers'} handlers={handlers} />\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { pluginFakerName } from '@kubb/plugin-faker'\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 { Mock, MockWithFaker, Response } from '../components'\nimport type { PluginMsw } from '../types'\n\nexport const mswGenerator = createReactGenerator<PluginMsw>({\n name: 'msw',\n Operation({ operation, generator, plugin }) {\n const {\n options: { output, parser, baseURL },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const mock = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const faker = {\n file: getFile(operation, { pluginKey: [pluginFakerName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginFakerName], type: 'function' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const responseStatusCodes = operation.getResponseStatusCodes()\n\n const types: [statusCode: number | 'default', typeName: string][] = []\n\n for (const code of responseStatusCodes) {\n if (code === 'default') {\n types.push(['default', type.schemas.response.name])\n continue\n }\n\n if (code.startsWith('2')) {\n types.push([Number(code), type.schemas.response.name])\n continue\n }\n\n const codeType = type.schemas.errors?.find((err) => err.statusCode === Number(code))\n if (codeType) types.push([Number(code), codeType.name])\n }\n\n return (\n <File\n baseName={mock.file.baseName}\n path={mock.file.path}\n meta={mock.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['http']} path=\"msw\" />\n <File.Import name={['ResponseResolver']} isTypeOnly path=\"msw\" />\n <File.Import\n name={Array.from(new Set([type.schemas.response.name, ...types.map((t) => t[1])]))}\n path={type.file.path}\n root={mock.file.path}\n isTypeOnly\n />\n {parser === 'faker' && faker.file && faker.schemas.response && (\n <File.Import name={[faker.schemas.response.name]} root={mock.file.path} path={faker.file.path} />\n )}\n\n {types\n .filter(([code]) => code !== 'default')\n .map(([code, typeName]) => (\n <Response typeName={typeName} operation={operation} name={mock.name} statusCode={code as number} />\n ))}\n {parser === 'faker' && (\n <MockWithFaker\n name={mock.name}\n typeName={type.schemas.response.name}\n fakerName={faker.schemas.response.name}\n operation={operation}\n baseURL={baseURL}\n />\n )}\n {parser === 'data' && (\n <Mock name={mock.name} typeName={type.schemas.response.name} fakerName={faker.schemas.response.name} operation={operation} baseURL={baseURL} />\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,oBAAoB,qBAAgC;CAC/D,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,UAAU;EAC5C,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,SAAS,YAAY,oBAAoB,UAAU;EAE3D,MAAM,OAAO,cAAc,QAAQ;GAAE,MAAM;GAAY,SAAS;GAAO,WAAW,OAAO;GAAK,CAAC;EAE/F,MAAM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AM,MAAM,KAAK;MAAQ;IAGlG,MACE,QAAQ,CAAC,UAAU,SAAS,UAAU,CACtC,KAAK,CAAC,MAAM,cACX,oBAAC;KAAmB;KAAqB;KAAW,MAAM,KAAK;KAAM,YAAY;MAAkB,CACnG;IACH,WAAW,WACV,oBAAC;KACC,MAAM,KAAK;KACX,UAAU,KAAK,QAAQ,SAAS;KAChC,WAAW,MAAM,QAAQ,SAAS;KACvB;KACF;MACT;IAEH,WAAW,UACV,oBAAC;KAAK,MAAM,KAAK;KAAM,UAAU,KAAK,QAAQ,SAAS;KAAM,WAAW,MAAM,QAAQ,SAAS;KAAiB;KAAoB;MAAW;;IAE5I;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require('./components-
|
|
2
|
-
const require_generators = require('./generators-
|
|
1
|
+
require('./components-DsnoNtPq.cjs');
|
|
2
|
+
const require_generators = require('./generators-BMD5TEc2.cjs');
|
|
3
3
|
|
|
4
4
|
exports.handlersGenerator = require_generators.handlersGenerator;
|
|
5
5
|
exports.mswGenerator = require_generators.mswGenerator;
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./types-8ZXwr93_.cjs";
|
|
2
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-C9Jm40mM.cjs";
|
|
3
3
|
|
|
4
|
-
//#region src/generators/mswGenerator.d.ts
|
|
5
|
-
declare const mswGenerator: ReactGenerator<PluginMsw>;
|
|
6
|
-
//#endregion
|
|
7
4
|
//#region src/generators/handlersGenerator.d.ts
|
|
8
5
|
declare const handlersGenerator: ReactGenerator<PluginMsw>;
|
|
9
6
|
//#endregion
|
|
7
|
+
//#region src/generators/mswGenerator.d.ts
|
|
8
|
+
declare const mswGenerator: ReactGenerator<PluginMsw>;
|
|
9
|
+
//#endregion
|
|
10
10
|
export { handlersGenerator, mswGenerator };
|
|
11
11
|
//# sourceMappingURL=generators.d.cts.map
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./types-D0JuaurR.js";
|
|
2
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-DSnvepCr.js";
|
|
3
3
|
|
|
4
|
-
//#region src/generators/mswGenerator.d.ts
|
|
5
|
-
declare const mswGenerator: ReactGenerator<PluginMsw>;
|
|
6
|
-
//#endregion
|
|
7
4
|
//#region src/generators/handlersGenerator.d.ts
|
|
8
5
|
declare const handlersGenerator: ReactGenerator<PluginMsw>;
|
|
9
6
|
//#endregion
|
|
7
|
+
//#region src/generators/mswGenerator.d.ts
|
|
8
|
+
declare const mswGenerator: ReactGenerator<PluginMsw>;
|
|
9
|
+
//#endregion
|
|
10
10
|
export { handlersGenerator, mswGenerator };
|
|
11
11
|
//# sourceMappingURL=generators.d.ts.map
|
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./components-
|
|
2
|
-
import { n as
|
|
1
|
+
import "./components-IvRPRy3j.js";
|
|
2
|
+
import { n as handlersGenerator, t as mswGenerator } from "./generators-ubi6QbfX.js";
|
|
3
3
|
|
|
4
4
|
export { handlersGenerator, mswGenerator };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_components = require('./components-
|
|
2
|
-
const require_generators = require('./generators-
|
|
1
|
+
const require_components = require('./components-DsnoNtPq.cjs');
|
|
2
|
+
const require_generators = require('./generators-BMD5TEc2.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_components.__toESM(node_path);
|
|
5
5
|
let __kubb_core = require("@kubb/core");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./types-8ZXwr93_.cjs";
|
|
2
|
-
import { i as UserPluginWithLifeCycle, n as PluginMsw, t as Options } from "./types-
|
|
2
|
+
import { i as UserPluginWithLifeCycle, n as PluginMsw, t as Options } from "./types-C9Jm40mM.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMswName = "plugin-msw";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./types-D0JuaurR.js";
|
|
2
|
-
import { i as UserPluginWithLifeCycle, n as PluginMsw, t as Options } from "./types-
|
|
2
|
+
import { i as UserPluginWithLifeCycle, n as PluginMsw, t as Options } from "./types-DSnvepCr.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMswName = "plugin-msw";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./components-
|
|
2
|
-
import { n as
|
|
1
|
+
import "./components-IvRPRy3j.js";
|
|
2
|
+
import { n as handlersGenerator, t as mswGenerator } from "./generators-ubi6QbfX.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { PluginManager, createPlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
5
5
|
import { camelCase } from "@kubb/core/transformers";
|