@kubb/plugin-msw 4.11.3 → 4.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/{components-CDRldAv7.cjs → components-ATPc-lQH.cjs} +2 -2
  2. package/dist/components-ATPc-lQH.cjs.map +1 -0
  3. package/dist/{components-DK6Olrp_.js → components-C5_yzPIo.js} +2 -2
  4. package/dist/components-C5_yzPIo.js.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.cts +1 -1
  7. package/dist/components.d.ts +1 -1
  8. package/dist/components.js +1 -1
  9. package/dist/{generators-BFHTvRSh.cjs → generators-Cz0z5DBg.cjs} +2 -2
  10. package/dist/{generators-BFHTvRSh.cjs.map → generators-Cz0z5DBg.cjs.map} +1 -1
  11. package/dist/{generators-DmpieAeS.js → generators-D36jd0kA.js} +2 -2
  12. package/dist/{generators-DmpieAeS.js.map → generators-D36jd0kA.js.map} +1 -1
  13. package/dist/generators.cjs +1 -1
  14. package/dist/generators.d.cts +2 -2
  15. package/dist/generators.d.ts +2 -2
  16. package/dist/generators.js +1 -1
  17. package/dist/{index-BSYdDKeZ.d.cts → index-CH9QiCej.d.cts} +214 -101
  18. package/dist/{index-B8yvSsLX.d.ts → index-pe4_JZ3K.d.ts} +214 -101
  19. package/dist/index.cjs +3 -4
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +2 -2
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.js +3 -4
  24. package/dist/index.js.map +1 -1
  25. package/dist/{types-MDRyMp8X.d.cts → types-CSdstWCA.d.ts} +5 -5
  26. package/dist/{types-BUzgaOhd.d.ts → types-CZnA5aRm.d.cts} +5 -5
  27. package/package.json +7 -7
  28. package/src/components/Mock.tsx +1 -1
  29. package/src/generators/__snapshots__/createPet.ts +1 -1
  30. package/src/generators/__snapshots__/deletePet.ts +1 -1
  31. package/src/generators/__snapshots__/getPets.ts +1 -1
  32. package/src/generators/__snapshots__/getPetsTemplateBaseUrl.ts +33 -0
  33. package/src/generators/__snapshots__/showPetById.ts +1 -1
  34. package/src/plugin.ts +1 -2
  35. package/dist/components-CDRldAv7.cjs.map +0 -1
  36. package/dist/components-DK6Olrp_.js.map +0 -1
@@ -38,7 +38,7 @@ function Mock({ baseURL = "", name, typeName, operation }) {
38
38
  name,
39
39
  export: true,
40
40
  params: params.toConstructor(),
41
- children: `return http.${method}('${baseURL}${url.replace(/([^/]):/g, "$1\\\\:")}', function handler(info) {
41
+ children: `return http.${method}(\`${baseURL}${url.replace(/([^/]):/g, "$1\\\\:")}\`, function handler(info) {
42
42
  if(typeof data === 'function') return data(info)
43
43
 
44
44
  return new Response(JSON.stringify(data), {
@@ -146,4 +146,4 @@ Object.defineProperty(exports, 'Response', {
146
146
  return Response;
147
147
  }
148
148
  });
149
- //# sourceMappingURL=components-CDRldAv7.cjs.map
149
+ //# sourceMappingURL=components-ATPc-lQH.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-ATPc-lQH.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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,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"}
@@ -37,7 +37,7 @@ function Mock({ baseURL = "", name, typeName, operation }) {
37
37
  name,
38
38
  export: true,
39
39
  params: params.toConstructor(),
40
- children: `return http.${method}('${baseURL}${url.replace(/([^/]):/g, "$1\\\\:")}', function handler(info) {
40
+ children: `return http.${method}(\`${baseURL}${url.replace(/([^/]):/g, "$1\\\\:")}\`, function handler(info) {
41
41
  if(typeof data === 'function') return data(info)
42
42
 
43
43
  return new Response(JSON.stringify(data), {
@@ -122,4 +122,4 @@ function Response({ name, typeName, operation, statusCode }) {
122
122
 
123
123
  //#endregion
124
124
  export { Handlers as i, MockWithFaker as n, Mock as r, Response as t };
125
- //# sourceMappingURL=components-DK6Olrp_.js.map
125
+ //# sourceMappingURL=components-C5_yzPIo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-C5_yzPIo.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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;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"}
@@ -1,4 +1,4 @@
1
- const require_components = require('./components-CDRldAv7.cjs');
1
+ const require_components = require('./components-ATPc-lQH.cjs');
2
2
 
3
3
  exports.Handlers = require_components.Handlers;
4
4
  exports.Mock = require_components.Mock;
@@ -1,4 +1,4 @@
1
- import { m as Operation } from "./index-BSYdDKeZ.cjs";
1
+ import { h as Operation } from "./index-CH9QiCej.cjs";
2
2
  import { KubbNode } from "@kubb/react-fabric/types";
3
3
 
4
4
  //#region src/components/Handlers.d.ts
@@ -1,4 +1,4 @@
1
- import { m as Operation } from "./index-B8yvSsLX.js";
1
+ import { h as Operation } from "./index-pe4_JZ3K.js";
2
2
  import { KubbNode } from "@kubb/react-fabric/types";
3
3
 
4
4
  //#region src/components/Handlers.d.ts
@@ -1,3 +1,3 @@
1
- import { i as Handlers, n as MockWithFaker, r as Mock, t as Response } from "./components-DK6Olrp_.js";
1
+ import { i as Handlers, n as MockWithFaker, r as Mock, t as Response } from "./components-C5_yzPIo.js";
2
2
 
3
3
  export { Handlers, Mock, MockWithFaker, Response };
@@ -1,4 +1,4 @@
1
- const require_components = require('./components-CDRldAv7.cjs');
1
+ const require_components = require('./components-ATPc-lQH.cjs');
2
2
  const require_index = require('./index.cjs');
3
3
  let __kubb_plugin_faker = require("@kubb/plugin-faker");
4
4
  let __kubb_plugin_ts = require("@kubb/plugin-ts");
@@ -171,4 +171,4 @@ Object.defineProperty(exports, 'mswGenerator', {
171
171
  return mswGenerator;
172
172
  }
173
173
  });
174
- //# sourceMappingURL=generators-BFHTvRSh.cjs.map
174
+ //# sourceMappingURL=generators-Cz0z5DBg.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generators-BFHTvRSh.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,UAAU;EAC1C,MAAM,EACJ,SAAS,EAAE,QAAQ,QAAQ,cACzB;EACJ,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,6DA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AACA,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
+ {"version":3,"file":"generators-Cz0z5DBg.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,WA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,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,4 +1,4 @@
1
- import { i as Handlers, n as MockWithFaker, r as Mock, t as Response } from "./components-DK6Olrp_.js";
1
+ import { i as Handlers, n as MockWithFaker, r as Mock, t as Response } from "./components-C5_yzPIo.js";
2
2
  import { pluginFakerName } from "@kubb/plugin-faker";
3
3
  import { pluginTsName } from "@kubb/plugin-ts";
4
4
  import { usePluginManager } from "@kubb/core/hooks";
@@ -159,4 +159,4 @@ const mswGenerator = createReactGenerator({
159
159
 
160
160
  //#endregion
161
161
  export { handlersGenerator as n, mswGenerator as t };
162
- //# sourceMappingURL=generators-DmpieAeS.js.map
162
+ //# sourceMappingURL=generators-D36jd0kA.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generators-DmpieAeS.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,UAAU,WAAW,KAAK,cAAc;GAC5C,MAAM,gBAAgB,QAAQ,WAAW,EAAE,WAAW,OAAO,KAAK,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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"}
1
+ {"version":3,"file":"generators-D36jd0kA.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,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,oBAAC,KAAK;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,qBAAC;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,QAAQ,UAAU;IAAE;IAAK,QAAQ,O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generators-Cz0z5DBg.cjs');
2
2
 
3
3
  exports.handlersGenerator = require_generators.handlersGenerator;
4
4
  exports.mswGenerator = require_generators.mswGenerator;
@@ -1,5 +1,5 @@
1
- import "./index-BSYdDKeZ.cjs";
2
- import { n as PluginMsw, r as ReactGenerator } from "./types-MDRyMp8X.cjs";
1
+ import "./index-CH9QiCej.cjs";
2
+ import { n as PluginMsw, r as ReactGenerator } from "./types-CZnA5aRm.cjs";
3
3
 
4
4
  //#region src/generators/handlersGenerator.d.ts
5
5
  declare const handlersGenerator: ReactGenerator<PluginMsw>;
@@ -1,5 +1,5 @@
1
- import "./index-B8yvSsLX.js";
2
- import { n as PluginMsw, r as ReactGenerator } from "./types-BUzgaOhd.js";
1
+ import "./index-pe4_JZ3K.js";
2
+ import { n as PluginMsw, r as ReactGenerator } from "./types-CSdstWCA.js";
3
3
 
4
4
  //#region src/generators/handlersGenerator.d.ts
5
5
  declare const handlersGenerator: ReactGenerator<PluginMsw>;
@@ -1,3 +1,3 @@
1
- import { n as handlersGenerator, t as mswGenerator } from "./generators-DmpieAeS.js";
1
+ import { n as handlersGenerator, t as mswGenerator } from "./generators-D36jd0kA.js";
2
2
 
3
3
  export { handlersGenerator, mswGenerator };
@@ -6,7 +6,6 @@ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
6
6
  import BaseOas from "oas";
7
7
  import { KubbFile } from "@kubb/fabric-core/types";
8
8
  import { Fabric } from "@kubb/react-fabric";
9
- import { ConsolaInstance, LogLevel } from "consola";
10
9
 
11
10
  //#region ../oas/src/types.d.ts
12
11
  type contentType = 'application/json' | (string & {});
@@ -57,75 +56,229 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
57
56
  abstract build(...params: unknown[]): unknown;
58
57
  }
59
58
  //#endregion
60
- //#region ../core/src/utils/EventEmitter.d.ts
61
- declare class EventEmitter<TEvents extends Record<string, any>> {
62
- #private;
63
- constructor();
64
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
65
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
66
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
67
- removeAll(): void;
68
- }
69
- //#endregion
70
- //#region ../core/src/logger.d.ts
59
+ //#region ../core/src/Kubb.d.ts
71
60
  type DebugEvent = {
72
61
  date: Date;
73
62
  logs: string[];
74
63
  fileName?: string;
64
+ };
65
+ type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
66
+ hookName: H;
67
+ plugins: Array<Plugin>;
68
+ };
69
+ type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
70
+ hookName: H;
71
+ };
72
+ type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
73
+ strategy: Strategy;
74
+ hookName: H;
75
+ plugin: Plugin;
76
+ parameters?: unknown[] | undefined;
77
+ output?: unknown;
78
+ };
79
+ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
80
+ duration: number;
81
+ strategy: Strategy;
82
+ hookName: H;
83
+ plugin: Plugin;
84
+ parameters?: unknown[] | undefined;
85
+ output?: unknown;
86
+ };
87
+ /**
88
+ * Events emitted during the Kubb code generation lifecycle.
89
+ * These events can be listened to for logging, progress tracking, and custom integrations.
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * import type { AsyncEventEmitter } from '@kubb/core'
94
+ * import type { KubbEvents } from '@kubb/core'
95
+ *
96
+ * const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
97
+ *
98
+ * events.on('lifecycle:start', () => {
99
+ * console.log('Starting Kubb generation')
100
+ * })
101
+ *
102
+ * events.on('plugin:end', (plugin, duration) => {
103
+ * console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
104
+ * })
105
+ * ```
106
+ */
107
+ interface KubbEvents {
75
108
  /**
76
- * Category of the debug log, used for GitHub Actions grouping
77
- * - 'setup': Initial configuration and environment setup
78
- * - 'plugin': Plugin installation and execution
79
- * - 'hook': Plugin hook execution details
80
- * - 'schema': Schema parsing and generation
81
- * - 'file': File operations (read/write/generate)
82
- * - 'error': Error details and stack traces
83
- * - undefined: Generic logs (always inline)
109
+ * Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
84
110
  */
85
- category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
111
+ 'lifecycle:start': [version: string];
86
112
  /**
87
- * Plugin name for grouping plugin-specific logs together
113
+ * Emitted at the end of the Kubb lifecycle, after all code generation is complete.
88
114
  */
89
- pluginName?: string;
115
+ 'lifecycle:end': [];
90
116
  /**
91
- * Indicates if this is the start or end of a plugin's execution
92
- * - 'start': Start of plugin execution group
93
- * - 'end': End of plugin execution group
117
+ * Emitted when configuration loading starts.
94
118
  */
95
- pluginGroupMarker?: 'start' | 'end';
96
- };
97
- type Events$1 = {
98
- start: [message: string];
99
- success: [message: string];
100
- error: [message: string, error: Error];
101
- warning: [message: string];
102
- debug: [DebugEvent];
103
- verbose: [DebugEvent];
104
- info: [message: string];
105
- progress_start: [{
106
- id: string;
107
- size: number;
108
- message?: string;
109
- }];
110
- progressed: [{
111
- id: string;
112
- message?: string;
119
+ 'config:start': [];
120
+ /**
121
+ * Emitted when configuration loading is complete.
122
+ */
123
+ 'config:end': [configs: Array<Config>];
124
+ /**
125
+ * Emitted when code generation phase starts.
126
+ */
127
+ 'generation:start': [config: Config];
128
+ /**
129
+ * Emitted when code generation phase completes.
130
+ */
131
+ 'generation:end': [Config: Config];
132
+ /**
133
+ * Emitted with a summary of the generation results.
134
+ * Contains summary lines, title, and success status.
135
+ */
136
+ 'generation:summary': [Config: Config, {
137
+ failedPlugins: Set<{
138
+ plugin: Plugin;
139
+ error: Error;
140
+ }>;
141
+ status: 'success' | 'failed';
142
+ hrStart: [number, number];
143
+ filesCreated: number;
144
+ pluginTimings?: Map<string, number>;
113
145
  }];
114
- progress_stop: [{
115
- id: string;
146
+ /**
147
+ * Emitted when code formatting starts (e.g., running Biome or Prettier).
148
+ */
149
+ 'format:start': [];
150
+ /**
151
+ * Emitted when code formatting completes.
152
+ */
153
+ 'format:end': [];
154
+ /**
155
+ * Emitted when linting starts.
156
+ */
157
+ 'lint:start': [];
158
+ /**
159
+ * Emitted when linting completes.
160
+ */
161
+ 'lint:end': [];
162
+ /**
163
+ * Emitted when plugin hooks execution starts.
164
+ */
165
+ 'hooks:start': [];
166
+ /**
167
+ * Emitted when plugin hooks execution completes.
168
+ */
169
+ 'hooks:end': [];
170
+ /**
171
+ * Emitted when a single hook execution starts.
172
+ */
173
+ 'hook:start': [command: string];
174
+ /**
175
+ * Emitted to execute a hook command (e.g., format or lint).
176
+ * The callback should be invoked when the command completes.
177
+ */
178
+ 'hook:execute': [{
179
+ command: string | URL;
180
+ args?: readonly string[];
181
+ }, cb: () => void];
182
+ /**
183
+ * Emitted when a single hook execution completes.
184
+ */
185
+ 'hook:end': [command: string];
186
+ /**
187
+ * Emitted when a new version of Kubb is available.
188
+ */
189
+ 'version:new': [currentVersion: string, latestVersion: string];
190
+ /**
191
+ * Informational message event.
192
+ */
193
+ info: [message: string, info?: string];
194
+ /**
195
+ * Error event. Emitted when an error occurs during code generation.
196
+ */
197
+ error: [error: Error, meta?: Record<string, unknown>];
198
+ /**
199
+ * Success message event.
200
+ */
201
+ success: [message: string, info?: string];
202
+ /**
203
+ * Warning message event.
204
+ */
205
+ warn: [message: string, info?: string];
206
+ /**
207
+ * Debug event for detailed logging.
208
+ * Contains timestamp, log messages, and optional filename.
209
+ */
210
+ debug: [meta: DebugEvent];
211
+ /**
212
+ * Emitted when file processing starts.
213
+ * Contains the list of files to be processed.
214
+ */
215
+ 'files:processing:start': [files: Array<KubbFile.ResolvedFile>];
216
+ /**
217
+ * Emitted for each file being processed, providing progress updates.
218
+ * Contains processed count, total count, percentage, and file details.
219
+ */
220
+ 'file:processing:update': [{
221
+ /** Number of files processed so far */
222
+ processed: number;
223
+ /** Total number of files to process */
224
+ total: number;
225
+ /** Processing percentage (0-100) */
226
+ percentage: number;
227
+ /** Optional source identifier */
228
+ source?: string;
229
+ /** The file being processed */
230
+ file: KubbFile.ResolvedFile;
231
+ /**
232
+ * Kubb configuration (not present in Fabric).
233
+ * Provides access to the current config during file processing.
234
+ */
235
+ config: Config;
116
236
  }];
117
- };
118
- type Logger = {
119
237
  /**
120
- * Optional config name to show in CLI output
238
+ * Emitted when file processing completes.
239
+ * Contains the list of processed files.
121
240
  */
122
- name?: string;
123
- logLevel: LogLevel;
124
- consola?: ConsolaInstance;
125
- on: EventEmitter<Events$1>['on'];
126
- emit: EventEmitter<Events$1>['emit'];
127
- writeLogs: () => Promise<void>;
128
- };
241
+ 'files:processing:end': [files: KubbFile.ResolvedFile[]];
242
+ /**
243
+ * Emitted when a plugin starts executing.
244
+ */
245
+ 'plugin:start': [plugin: Plugin];
246
+ /**
247
+ * Emitted when a plugin completes execution.
248
+ */
249
+ 'plugin:end': [plugin: Plugin, duration: number];
250
+ /**
251
+ * Emitted when plugin hook progress tracking starts.
252
+ * Contains the hook name and list of plugins to execute.
253
+ */
254
+ 'plugins:hook:progress:start': [meta: ProgressStartMeta];
255
+ /**
256
+ * Emitted when plugin hook progress tracking ends.
257
+ * Contains the hook name that completed.
258
+ */
259
+ 'plugins:hook:progress:end': [meta: ProgressStopMeta];
260
+ /**
261
+ * Emitted when a plugin hook starts processing.
262
+ * Contains strategy, hook name, plugin, parameters, and output.
263
+ */
264
+ 'plugins:hook:processing:start': [meta: ExecutingMeta];
265
+ /**
266
+ * Emitted when a plugin hook completes processing.
267
+ * Contains duration, strategy, hook name, plugin, parameters, and output.
268
+ */
269
+ 'plugins:hook:processing:end': [meta: ExecutedMeta];
270
+ }
271
+ //#endregion
272
+ //#region ../core/src/utils/AsyncEventEmitter.d.ts
273
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
274
+ #private;
275
+ constructor(maxListener?: number);
276
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
277
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
278
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
279
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
280
+ removeAll(): void;
281
+ }
129
282
  //#endregion
130
283
  //#region ../core/src/utils/types.d.ts
131
284
  type PossiblePromise<T> = Promise<T> | T;
@@ -389,7 +542,7 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
389
542
  * merging multiple sources into the same output file
390
543
  */
391
544
  upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
392
- logger: Logger;
545
+ events: AsyncEventEmitter<KubbEvents>;
393
546
  mode: KubbFile.Mode;
394
547
  /**
395
548
  * Current plugin
@@ -435,35 +588,6 @@ type Group = {
435
588
  //#region ../core/src/PluginManager.d.ts
436
589
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
437
590
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
438
- type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
439
- strategy: Strategy;
440
- hookName: H;
441
- plugin: Plugin;
442
- parameters?: unknown[] | undefined;
443
- output?: unknown;
444
- };
445
- type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
446
- duration: number;
447
- strategy: Strategy;
448
- hookName: H;
449
- plugin: Plugin;
450
- parameters?: unknown[] | undefined;
451
- output?: unknown;
452
- };
453
- type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
454
- hookName: H;
455
- duration: number;
456
- strategy: Strategy;
457
- parameters?: unknown[] | undefined;
458
- plugin: Plugin;
459
- };
460
- type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
461
- hookName: H;
462
- plugins: Array<Plugin>;
463
- };
464
- type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
465
- hookName: H;
466
- };
467
591
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
468
592
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
469
593
  result: Result;
@@ -471,19 +595,12 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
471
595
  };
472
596
  type Options = {
473
597
  fabric: Fabric;
474
- logger: Logger;
598
+ events: AsyncEventEmitter<KubbEvents>;
475
599
  /**
476
600
  * @default Number.POSITIVE_INFINITY
477
601
  */
478
602
  concurrency?: number;
479
603
  };
480
- type Events = {
481
- progress_start: [meta: ProgressStartMeta];
482
- progress_stop: [meta: ProgressStopMeta];
483
- executing: [meta: ExecutingMeta];
484
- executed: [meta: ExecutedMeta];
485
- error: [error: Error, meta: ErrorMeta];
486
- };
487
604
  type GetFileProps<TOptions = object> = {
488
605
  name: string;
489
606
  mode?: KubbFile.Mode;
@@ -493,10 +610,10 @@ type GetFileProps<TOptions = object> = {
493
610
  };
494
611
  declare class PluginManager {
495
612
  #private;
496
- readonly events: EventEmitter<Events>;
497
613
  readonly config: Config;
498
614
  readonly options: Options;
499
615
  constructor(config: Config, options: Options);
616
+ get events(): AsyncEventEmitter<KubbEvents>;
500
617
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
501
618
  get plugins(): Array<Plugin>;
502
619
  getFile<TOptions = object>({
@@ -510,10 +627,6 @@ declare class PluginManager {
510
627
  }>;
511
628
  resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
512
629
  resolveName: (params: ResolveNameParams) => string;
513
- /**
514
- * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
515
- */
516
- on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
517
630
  /**
518
631
  * Run a specific hookName for plugin x.
519
632
  */
@@ -591,5 +704,5 @@ type FileMetaBase = {
591
704
  pluginKey?: Plugin['key'];
592
705
  };
593
706
  //#endregion
594
- export { Output as a, ResolveNameParams as c, BaseGenerator as d, Oas as f, contentType as g, SchemaObject$1 as h, Group as i, UserPluginWithLifeCycle as l, Operation$1 as m, PluginManager as n, Plugin as o, HttpMethod as p, Config as r, PluginFactoryOptions as s, FileMetaBase as t, Logger as u };
595
- //# sourceMappingURL=index-BSYdDKeZ.d.cts.map
707
+ export { contentType as _, Output as a, ResolveNameParams as c, KubbEvents as d, BaseGenerator as f, SchemaObject$1 as g, Operation$1 as h, Group as i, UserPluginWithLifeCycle as l, HttpMethod as m, PluginManager as n, Plugin as o, Oas as p, Config as r, PluginFactoryOptions as s, FileMetaBase as t, AsyncEventEmitter as u };
708
+ //# sourceMappingURL=index-CH9QiCej.d.cts.map