@kubb/plugin-msw 3.16.4 → 3.17.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.
@@ -1 +1 @@
1
- {"version":3,"file":"components-ByUOezvw.js","names":[],"sources":["../src/components/Mock.tsx","../src/components/Handlers.tsx","../src/components/MockWithFaker.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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)`,\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 { File } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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'\n\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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)`,\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"],"mappings":";;;;;AAgBA,SAAgB,KAAK,EAAE,UAAU,IAAI,MAAM,UAAU,WAAkB,EAAa;CAClF,MAAM,SAAS,UAAU;CACzB,MAAM,qBAAqB,UAAU,wBAA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aAAa,mBAAmB,SAAS,IAAI,OAAO,mBAAmB,GAAG,GAAG;CAEnF,MAAM,iBAAiB,UAAU,wBAAwB,WAAW;CACpE,MAAM,cAAc,OAAO,KAAK,eAAe,WAAW,CAAE,EAAC,GAAG;CAChE,MAAM,MAAM,IAAI,QAAQ,UAAU,MAAM,WAAW,CAAC,QAAQ,YAAY,UAAU;CAElF,MAAM,UAAU,CAAC,cAAc,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC,GAAG,MAAU,EAAC,OAAO,QAAQ;CAE9F,MAAM,SAAS,eAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG,SAAS;gDACwB,EAAE,OAAO;oBACrC,CAAC;EACf,UAAU;CACX,EACF,EAAC;AAEF,4BACG,KAAK;EAAa;EAAM;EAAY;gCAClC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;aACxD,CAAC,YAAY,EAAE,OAAO,EAAE,EAAE,UAAU,IAAI,QAAQ,YAAY,UAAU,CAAC;;;+CAGjC,EAAE,UAAU;cAC7C,EAAE,WAAW;MACrB,EACE,QAAQ,SACJ,CAAC;QACL,EAAE,QAAQ,KAAK,OAAO,CAAC;QACvB,CAAC,GACG,GACL;;IAEH,CAAC;IACY;GACC;AAEjB"}
1
+ {"version":3,"file":"components-ByUOezvw.js","names":[],"sources":["../src/components/Mock.tsx","../src/components/Handlers.tsx","../src/components/MockWithFaker.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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)`,\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 { File } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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'\n\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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)`,\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"],"mappings":";;;;;AAgBA,SAAgB,KAAK,EAAE,UAAU,IAAI,MAAM,UAAU,WAAkB,EAAa;CAClF,MAAM,SAAS,UAAU;CACzB,MAAM,qBAAqB,UAAU,yBAAyB,QAAQ,SAAS,KAAK,WAAW;CAC/F,MAAM,aAAa,mBAAmB,SAAS,IAAI,OAAO,mBAAmB,MAAM;CAEnF,MAAM,iBAAiB,UAAU,wBAAwB;CACzD,MAAM,cAAc,OAAO,KAAK,eAAe,WAAW,EAAE,IAAI;CAChE,MAAM,MAAM,IAAI,QAAQ,UAAU,MAAM,YAAY,QAAQ,YAAY;CAExE,MAAM,UAAU,CAAC,cAAc,oBAAoB,YAAY,KAAK,OAAU,CAAC,OAAO;CAEtF,MAAM,SAAS,eAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG,SAAS;kDAC0B,OAAO;;EAEnD,UAAU;EACX,EACF;AAED,QACE,oBAAC,KAAK;EAAa;EAAM;EAAY;YACnC,oBAAC;GAAe;GAAM;GAAO,QAAQ,OAAO;aACzC,eAAe,OAAO,IAAI,UAAU,IAAI,QAAQ,YAAY,WAAW;;;;gBAIhE,WAAW;QAEnB,QAAQ,SACJ;UACF,QAAQ,KAAK,QAAQ;YAEnB,GACL;;;;;AAMN;;;;AC5CD,SAAgB,SAAS,EAAE,MAAM,UAAyB,EAAa;AACrE,QACE,oBAAC,KAAK;EAAa;EAAM;EAAY;YAClC,gBAAgB,KAAK,KAAK,KAAK,UAAU,UAAU,WAAW,KAAK,IAAI;;AAG7E;;;;ACDD,SAAgB,cAAc,EAAE,UAAU,IAAI,MAAM,WAAW,UAAU,WAAkB,EAAa;CACtG,MAAM,SAAS,UAAU;CACzB,MAAM,qBAAqB,UAAU,yBAAyB,QAAQ,SAAS,KAAK,WAAW;CAC/F,MAAM,aAAa,mBAAmB,SAAS,IAAI,OAAO,mBAAmB,MAAM;CAEnF,MAAM,iBAAiB,UAAU,wBAAwB;CACzD,MAAM,cAAc,OAAO,KAAK,eAAe,WAAW,EAAE,IAAI;CAChE,MAAM,MAAM,IAAI,QAAQ,UAAU,MAAM,YAAY,QAAQ,YAAY;CAExE,MAAM,UAAU,CAAC,cAAc,oBAAoB,YAAY,KAAK,OAAU,CAAC,OAAO;CAEtF,MAAM,SAAS,eAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG,SAAS;kDAC0B,OAAO;;EAEnD,UAAU;EACX,EACF;AAED,QACE,oBAAC,KAAK;EAAa;EAAM;EAAY;YACnC,oBAAC;GAAe;GAAM;GAAO,QAAQ,OAAO;aACzC,eAAe,OAAO,IAAI,UAAU,IAAI,QAAQ,YAAY,WAAW;;;iDAG/B,UAAU;gBAC3C,WAAW;QAEnB,QAAQ,SACJ;UACF,QAAQ,KAAK,QAAQ;YAEnB,GACL;;;;;AAMN"}
@@ -1 +1 @@
1
- {"version":3,"file":"components-Bz0C7Qrg.cjs","names":["URLPath","FunctionParams","File","Function","File","URLPath","FunctionParams","File","Function"],"sources":["../src/components/Mock.tsx","../src/components/Handlers.tsx","../src/components/MockWithFaker.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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)`,\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 { File } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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'\n\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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)`,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAgB,KAAK,EAAE,UAAU,IAAI,MAAM,UAAU,WAAkB,EAAa;CAClF,MAAM,SAAS,UAAU;CACzB,MAAM,qBAAqB,UAAU,wBAAwB,CAAC,OAAO,CAAC,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,CAAE,EAAC,GAAG;CAChE,MAAM,MAAM,IAAIA,0BAAQ,U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UAAU,CAAC,cAAc,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC,GAAG,MAAU,EAAC,OAAO,QAAQ;CAE9F,MAAM,SAASC,4BAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG,SAAS;gDACwB,EAAE,OAAO;oBACrC,CAAC;EACf,UAAU;CACX,EACF,EAAC;AAEF,0DACGC,kBAAK;EAAa;EAAM;EAAY;8DAClCC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;aACxD,CAAC,YAAY,EAAE,OAAO,EAAE,EAAE,UAAU,IAAI,QAAQ,YAAY,UAAU,CAAC;;;+CAGjC,EAAE,UAAU;cAC7C,EAAE,WAAW;MACrB,EACE,QAAQ,SACJ,CAAC;QACL,EAAE,QAAQ,KAAK,OAAO,CAAC;QACvB,CAAC,GACG,GACL;;IAEH,CAAC;IACY;GACC;AAEjB"}
1
+ {"version":3,"file":"components-Bz0C7Qrg.cjs","names":["URLPath","FunctionParams","File","Function","File","URLPath","FunctionParams","File","Function"],"sources":["../src/components/Mock.tsx","../src/components/Handlers.tsx","../src/components/MockWithFaker.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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)`,\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 { File } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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'\n\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react'\nimport type { ReactNode } from 'react'\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): ReactNode {\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)`,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAgB,KAAK,EAAE,UAAU,IAAI,MAAM,UAAU,WAAkB,EAAa;CAClF,MAAM,SAAS,UAAU;CACzB,MAAM,qBAAqB,UAAU,yBAAyB,QAAQ,SAAS,KAAK,WAAW;CAC/F,MAAM,aAAa,mBAAmB,SAAS,IAAI,OAAO,mBAAmB,MAAM;CAEnF,MAAM,iBAAiB,UAAU,wBAAwB;CACzD,MAAM,cAAc,OAAO,KAAK,eAAe,WAAW,EAAE,IAAI;CAChE,MAAM,MAAM,IAAIA,0BAAQ,UAAU,MAAM,YAAY,QAAQ,YAAY;CAExE,MAAM,UAAU,CAAC,cAAc,oBAAoB,YAAY,KAAK,OAAU,CAAC,OAAO;CAEtF,MAAM,SAASC,4BAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG,SAAS;kDAC0B,OAAO;;EAEnD,UAAU;EACX,EACF;AAED,QACE,kDAACC,kBAAK;EAAa;EAAM;EAAY;YACnC,kDAACC;GAAe;GAAM;GAAO,QAAQ,OAAO;aACzC,eAAe,OAAO,IAAI,UAAU,IAAI,QAAQ,YAAY,WAAW;;;;gBAIhE,WAAW;QAEnB,QAAQ,SACJ;UACF,QAAQ,KAAK,QAAQ;YAEnB,GACL;;;;;AAMN;;;;AC5CD,SAAgB,SAAS,EAAE,MAAM,UAAyB,EAAa;AACrE,QACE,kDAACC,kBAAK;EAAa;EAAM;EAAY;YAClC,gBAAgB,KAAK,KAAK,KAAK,UAAU,UAAU,WAAW,KAAK,IAAI;;AAG7E;;;;ACDD,SAAgB,cAAc,EAAE,UAAU,IAAI,MAAM,WAAW,UAAU,WAAkB,EAAa;CACtG,MAAM,SAAS,UAAU;CACzB,MAAM,qBAAqB,UAAU,yBAAyB,QAAQ,SAAS,KAAK,WAAW;CAC/F,MAAM,aAAa,mBAAmB,SAAS,IAAI,OAAO,mBAAmB,MAAM;CAEnF,MAAM,iBAAiB,UAAU,wBAAwB;CACzD,MAAM,cAAc,OAAO,KAAK,eAAe,WAAW,EAAE,IAAI;CAChE,MAAM,MAAM,IAAIC,0BAAQ,UAAU,MAAM,YAAY,QAAQ,YAAY;CAExE,MAAM,UAAU,CAAC,cAAc,oBAAoB,YAAY,KAAK,OAAU,CAAC,OAAO;CAEtF,MAAM,SAASC,4BAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG,SAAS;kDAC0B,OAAO;;EAEnD,UAAU;EACX,EACF;AAED,QACE,kDAACC,kBAAK;EAAa;EAAM;EAAY;YACnC,kDAACC;GAAe;GAAM;GAAO,QAAQ,OAAO;aACzC,eAAe,OAAO,IAAI,UAAU,IAAI,QAAQ,YAAY,WAAW;;;iDAG/B,UAAU;gBAC3C,WAAW;QAEnB,QAAQ,SACJ;UACF,QAAQ,KAAK,QAAQ;YAEnB,GACL;;;;;AAMN"}
@@ -1 +1 @@
1
- {"version":3,"file":"generators-BjQcx0SS.js","names":[],"sources":["../src/generators/mswGenerator.tsx","../src/generators/handlersGenerator.tsx"],"sourcesContent":["import { pluginFakerName } from '@kubb/plugin-faker'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, useApp } from '@kubb/react'\nimport { Mock, MockWithFaker } from '../components'\nimport type { PluginMsw } from '../types'\n\nexport const mswGenerator = createReactGenerator<PluginMsw>({\n name: 'msw',\n Operation({ operation }) {\n const {\n pluginManager,\n plugin: {\n options: { output, parser, baseURL },\n },\n } = useApp<PluginMsw>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\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 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 name={[type.schemas.response.name]} path={type.file.path} root={mock.file.path} isTypeOnly />\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 {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","import { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, useApp } from '@kubb/react'\nimport { Handlers } from '../components/Handlers.tsx'\nimport type { PluginMsw } from '../types'\n\nexport const handlersGenerator = createReactGenerator<PluginMsw>({\n name: 'plugin-msw',\n Operations({ operations }) {\n const { pluginManager, plugin } = useApp<PluginMsw>()\n const oas = useOas()\n const { getName, getFile } = useOperationManager()\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"],"mappings":";;;;;;;;;;AASA,MAAa,eAAe,qBAAgC;CAC1D,MAAM;CACN,UAAU,EAAE,WAAW,EAAE;EACvB,MAAM,EACJ,eACA,QAAQ,EACN,SAAS,EAAE,QAAQ,QAAQ,SAAS,EACrC,EACF,GAAG,QAAmB;EACvB,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,SAAS,GAAG,qBAAqB;EAE9D,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,MAAM,WAAY,EAAC;GAC9C,MAAM,QAAQ,UAAU;EACzB;EAED,MAAM,QAAQ;GACZ,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,eAAgB,EAAE,EAAC;GAC1D,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,eAAgB;IAAE,MAAM;GAAY,EAAC;EACnF;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,YAAa,EAAE,EAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,YAAa;IAAE,MAAM;GAAQ,EAAC;EAC5E;AAED,8BACG;GACC,UAAU,KAAK,KAAK;GACpB,MAAM,KAAK,KAAK;GAChB,MAAM,KAAK,KAA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8BAAQ,KAAK;IAAgC,MAAM,CAAC,aAAc;IAAE,MAAM,KAAK;IAAM,MAAM,cAAc;MAAhF,cAAc,KAA0E;EAClH,EAAC;EAEF,MAAM,WAAW,WAAW,IAAI,CAAC,cAAc,GAAG,QAAQ,WAAW;GAAE,MAAM;GAAY,WAAW,OAAO;EAAK,EAAC,CAAC,EAAE,CAAC,CAAC;AAEtH,8BACG;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,QAAQ,UAAU;IAAE;IAAK,QAAQ,OAAO,QAAQ;IAAQ,QAAQ,cAAc;GAAQ,EAAC;GACvF,QAAQ,UAAU;IAAE;IAAK,QAAQ,OAAO,QAAQ;GAAQ,EAAC;cAExD,6BACA;IAAS,MAAM;IAAsB;KAAY;IAC7C;CAEV;AACF,EAAC"}
1
+ {"version":3,"file":"generators-BjQcx0SS.js","names":[],"sources":["../src/generators/mswGenerator.tsx","../src/generators/handlersGenerator.tsx"],"sourcesContent":["import { pluginFakerName } from '@kubb/plugin-faker'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, useApp } from '@kubb/react'\nimport { Mock, MockWithFaker } from '../components'\nimport type { PluginMsw } from '../types'\n\nexport const mswGenerator = createReactGenerator<PluginMsw>({\n name: 'msw',\n Operation({ operation }) {\n const {\n pluginManager,\n plugin: {\n options: { output, parser, baseURL },\n },\n } = useApp<PluginMsw>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\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 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 name={[type.schemas.response.name]} path={type.file.path} root={mock.file.path} isTypeOnly />\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 {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","import { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, useApp } from '@kubb/react'\nimport { Handlers } from '../components/Handlers.tsx'\nimport type { PluginMsw } from '../types'\n\nexport const handlersGenerator = createReactGenerator<PluginMsw>({\n name: 'plugin-msw',\n Operations({ operations }) {\n const { pluginManager, plugin } = useApp<PluginMsw>()\n const oas = useOas()\n const { getName, getFile } = useOperationManager()\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"],"mappings":";;;;;;;;;;AASA,MAAa,eAAe,qBAAgC;CAC1D,MAAM;CACN,UAAU,EAAE,WAAW,EAAE;EACvB,MAAM,EACJ,eACA,QAAQ,EACN,SAAS,EAAE,QAAQ,QAAQ,SAAS,EACrC,EACF,GAAG;EACJ,MAAM,MAAM;EACZ,MAAM,EAAE,YAAY,SAAS,SAAS,GAAG;EAEzC,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY;GAC7C,MAAM,QAAQ;GACf;EAED,MAAM,QAAQ;GACZ,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,gBAAgB,EAAE;GACzD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,gBAAgB;IAAE,MAAM;IAAY;GAClF;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE;GACtD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ;GAC3E;AAED,SACE,qBAAC;GACC,UAAU,KAAK,KAAK;GACpB,MAAM,KAAK,KAAK;GAChB,MAAM,KAAK,KAAK;GAChB,QAAQ,UAAU;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ;GAC/D,QAAQ,UAAU;IAAE;IAAK;IAAQ;;IAEjC,oBAAC,KAAK;KAAO,MAAM,CAAC,OAAO;KAAE,MAAK;;IAClC,oBAAC,KAAK;KAAO,MAAM,CAAC,mBAAmB;KAAE;KAAW,MAAK;;IACzD,oBAAC,KAAK;KAAO,MAAM,CAAC,KAAK,QAAQ,SAAS,KAAK;KAAE,MAAM,KAAK,KAAK;KAAM,MAAM,KAAK,KAAK;KAAM;;IAC5F,WAAW,WAAW,MAAM,QAAQ,MAAM,QAAQ,YACjD,oBAAC,KAAK;KAAO,MAAM,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":3,"file":"generators-DQ6KjdAH.cjs","names":["pluginFakerName","pluginTsName","File","MockWithFaker","Mock","File","Handlers"],"sources":["../src/generators/mswGenerator.tsx","../src/generators/handlersGenerator.tsx"],"sourcesContent":["import { pluginFakerName } from '@kubb/plugin-faker'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, useApp } from '@kubb/react'\nimport { Mock, MockWithFaker } from '../components'\nimport type { PluginMsw } from '../types'\n\nexport const mswGenerator = createReactGenerator<PluginMsw>({\n name: 'msw',\n Operation({ operation }) {\n const {\n pluginManager,\n plugin: {\n options: { output, parser, baseURL },\n },\n } = useApp<PluginMsw>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\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 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 name={[type.schemas.response.name]} path={type.file.path} root={mock.file.path} isTypeOnly />\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 {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","import { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, useApp } from '@kubb/react'\nimport { Handlers } from '../components/Handlers.tsx'\nimport type { PluginMsw } from '../types'\n\nexport const handlersGenerator = createReactGenerator<PluginMsw>({\n name: 'plugin-msw',\n Operations({ operations }) {\n const { pluginManager, plugin } = useApp<PluginMsw>()\n const oas = useOas()\n const { getName, getFile } = useOperationManager()\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"],"mappings":";;;;;;;;;;AASA,MAAa,2DAA+C;CAC1D,MAAM;CACN,UAAU,EAAE,WAAW,EAAE;EACvB,MAAM,EACJ,eACA,QAAQ,EACN,SAAS,EAAE,QAAQ,QAAQ,SAAS,EACrC,EACF,6BAAsB;EACvB,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,SAAS,qDAAwB;EAE9D,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,MAAM,WAAY,EAAC;GAC9C,MAAM,QAAQ,UAAU;EACzB;EAED,MAAM,QAAQ;GACZ,MAAM,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e,QAAQ,6BAAsB;EACrD,MAAM,2CAAc;EACpB,MAAM,EAAE,SAAS,SAAS,qDAAwB;EAElD,MAAM,OAAO,cAAc,QAAQ;GAAE,MAAM;GAAY,SAAS;GAAO,WAAW,OAAO;EAAK,EAAC;EAE/F,MAAM,UAAU,WAAW,IAAI,CAAC,cAAc;GAC5C,MAAM,gBAAgB,QAAQ,WAAW,EAAE,WAAW,OAAO,IAAK,EAAC;GACnE,MAAM,gBAAgB,QAAQ,WAAW;IAAE,WAAW,OAAO;IAAK,MAAM;GAAY,EAAC;AAErF,4DAAQC,kBAAK;IAAgC,MAAM,CAAC,aAAc;IAAE,MAAM,KAAK;IAAM,MAAM,cAAc;MAAhF,cAAc,KAA0E;EAClH,EAAC;EAEF,MAAM,WAAW,WAAW,IAAI,CAAC,cAAc,GAAG,QAAQ,WAAW;GAAE,MAAM;GAAY,WAAW,OAAO;EAAK,EAAC,CAAC,EAAE,CAAC,CAAC;AAEtH,4DACGA;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,+CAAkB;IAAE;IAAK,QAAQ,OAAO,QAAQ;IAAQ,QAAQ,cAAc;GAAQ,EAAC;GACvF,+CAAkB;IAAE;IAAK,QAAQ,OAAO,QAAQ;GAAQ,EAAC;cAExD,2DACAC;IAAS,MAAM;IAAsB;KAAY;IAC7C;CAEV;AACF,EAAC"}
1
+ {"version":3,"file":"generators-DQ6KjdAH.cjs","names":["pluginFakerName","pluginTsName","File","MockWithFaker","Mock","File","Handlers"],"sources":["../src/generators/mswGenerator.tsx","../src/generators/handlersGenerator.tsx"],"sourcesContent":["import { pluginFakerName } from '@kubb/plugin-faker'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, useApp } from '@kubb/react'\nimport { Mock, MockWithFaker } from '../components'\nimport type { PluginMsw } from '../types'\n\nexport const mswGenerator = createReactGenerator<PluginMsw>({\n name: 'msw',\n Operation({ operation }) {\n const {\n pluginManager,\n plugin: {\n options: { output, parser, baseURL },\n },\n } = useApp<PluginMsw>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\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 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 name={[type.schemas.response.name]} path={type.file.path} root={mock.file.path} isTypeOnly />\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 {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","import { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, useApp } from '@kubb/react'\nimport { Handlers } from '../components/Handlers.tsx'\nimport type { PluginMsw } from '../types'\n\nexport const handlersGenerator = createReactGenerator<PluginMsw>({\n name: 'plugin-msw',\n Operations({ operations }) {\n const { pluginManager, plugin } = useApp<PluginMsw>()\n const oas = useOas()\n const { getName, getFile } = useOperationManager()\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"],"mappings":";;;;;;;;;;AASA,MAAa,2DAA+C;CAC1D,MAAM;CACN,UAAU,EAAE,WAAW,EAAE;EACvB,MAAM,EACJ,eACA,QAAQ,EACN,SAAS,EAAE,QAAQ,QAAQ,SAAS,EACrC,EACF;EACD,MAAM;EACN,MAAM,EAAE,YAAY,SAAS,SAAS;EAEtC,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY;GAC7C,MAAM,QAAQ;GACf;EAED,MAAM,QAAQ;GACZ,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,oCAAgB,EAAE;GACzD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,oCAAgB;IAAE,MAAM;IAAY;GAClF;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACC,8BAAa,EAAE;GACtD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,8BAAa;IAAE,MAAM;IAAQ;GAC3E;AAED,SACE,mDAACC;GACC,UAAU,KAAK,KAAK;GACpB,MAAM,KAAK,KAAK;GAChB,MAAM,KAAK,KAAK;GAChB,+CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IA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QAAQ,WAAW;GAAE,MAAM;GAAY,WAAW,OAAO;GAAK,EAAE;AAElH,SACE,mDAACA;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,+CAAkB;IAAE;IAAK,QAAQ,OAAO,QAAQ;IAAQ,QAAQ,cAAc;IAAQ;GACtF,+CAAkB;IAAE;IAAK,QAAQ,OAAO,QAAQ;IAAQ;cAEvD,SACD,kDAACC;IAAS,MAAM;IAAsB;;;CAG3C;CACF"}
@@ -1,5 +1,5 @@
1
1
  import "./types-DYAniEBx.cjs";
2
- import { Generator, PluginMsw } from "./types-CxxnBHOU.cjs";
2
+ import { Generator, PluginMsw } from "./types-DA0gctJM.cjs";
3
3
 
4
4
  //#region src/generators/mswGenerator.d.ts
5
5
  declare const mswGenerator: Generator<PluginMsw>;
@@ -1,5 +1,5 @@
1
1
  import "./types-BOMj2hjt.js";
2
- import { Generator, PluginMsw } from "./types-Dte4R-vh.js";
2
+ import { Generator, PluginMsw } from "./types-B_ektcRL.js";
3
3
 
4
4
  //#region src/generators/mswGenerator.d.ts
5
5
  declare const mswGenerator: Generator<PluginMsw>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["mswGenerator","handlersGenerator","pluginOasName","pluginTsName","pluginFakerName","options","path","FileManager","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { pluginTsName } from '@kubb/plugin-ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { handlersGenerator, mswGenerator } from './generators'\nimport type { PluginMsw } from './types.ts'\n\nexport const pluginMswName = 'plugin-msw' satisfies PluginMsw['name']\n\nexport const pluginMsw = createPlugin<PluginMsw>((options) => {\n const {\n output = { path: 'handlers', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n handlers = false,\n parser = 'data',\n generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginMswName,\n options: {\n output,\n parser,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName, parser === 'faker' ? pluginFakerName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n suffix: type ? 'handler' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAcA,MAAa,gBAAgB;AAE7B,MAAa,0CAAoC,CAAC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAY,YAAY;CAAS,GAClD,OACA,UAAU,CAAE,GACZ,SACA,WAAW,CAAE,GACb,eAAe,CAAE,GACjB,WAAW,OACX,SAAS,QACT,aAAa,CAACA,iCAAc,WAAWC,uCAAoB,MAAU,EAAC,OAAO,QAAQ,EACrF,aACA,SACD,GAAG;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;EACD;EACD,KAAK;GAACC;GAAeC;GAAc,WAAW,UAAUC,sCAAkB;EAAU,EAAC,OAAO,QAAQ;EACpG,YAAY,UAAU,UAAUC,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,YAAYC,wBAAY,QAAQD,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;AAE7E,OAAI,SAAS;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUD,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMG,YAA2B,OAAO,OACpC,MAAM,OACN,CAAC,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC,IAAI;AAErC,YAAO,2CAAa,IAAI,MAAM,CAAC,UAAU,CAAC;IAC3C;AAEL,WAAOF,kBAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,IACpE,EAAC,EACF,SACD;GACF;AAED,UAAOC,kBAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;EACjD;EACD,YAAY,MAAM,MAAM;GACtB,MAAM,uDAAyB,MAAM;IACnC,QAAQ,OAAO,YAAY;IAC3B,QAAQ,SAAS;GAClB,EAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;EACR;EACD,MAAM,aAAa;GACjB,MAAM,CAAC,cAA8C,GAAGG,0BAAc,mBAAyC,KAAK,SAAS,CAACP,+BAAc,EAAC;GAE7I,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAOI,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAOC,wBAAY,QAAQD,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GAEjE,MAAM,qBAAqB,IAAII,qCAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;GACD;GAED,MAAM,QAAQ,MAAM,mBAAmB,MAAM,GAAG,WAAW;GAC3D,MAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,KAAK,YAAY,eAAe;IACxD,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,IACxB;IACD,QAAQ,KAAK;GACd,EAAC;GAEF,MAAM,KAAK,QAAQ,GAAG,YAAY;EACnC;CACF;AACF,EAAC"}
1
+ {"version":3,"file":"index.cjs","names":["mswGenerator","handlersGenerator","pluginOasName","pluginTsName","pluginFakerName","path","FileManager","options","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { pluginTsName } from '@kubb/plugin-ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { handlersGenerator, mswGenerator } from './generators'\nimport type { PluginMsw } from './types.ts'\n\nexport const pluginMswName = 'plugin-msw' satisfies PluginMsw['name']\n\nexport const pluginMsw = createPlugin<PluginMsw>((options) => {\n const {\n output = { path: 'handlers', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n handlers = false,\n parser = 'data',\n generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginMswName,\n options: {\n output,\n parser,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName, parser === 'faker' ? pluginFakerName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n suffix: type ? 'handler' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAcA,MAAa,gBAAgB;AAE7B,MAAa,2CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAY,YAAY;EAAS,EAClD,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,WAAW,OACX,SAAS,QACT,aAAa,CAACA,iCAAc,WAAWC,uCAAoB,OAAU,CAAC,OAAO,UAC7E,aACA,SACD,GAAG;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK;GAACC;GAAeC;GAAc,WAAW,UAAUC,sCAAkB;GAAU,CAAC,OAAO;EAC5F,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO;GAC/D,MAAM,OAAO,YAAYC,wBAAY,QAAQD,kBAAK,QAAQ,MAAM,OAAO;AAEvE,OAAI,SAAS;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO;AAGnC,OAAI,UAAUE,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,KAAK;AAEjC,YAAO,2CAAa,IAAI,OAAO;IAChC;AAEL,WAAOH,kBAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASE,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,GACD;GAEH;AAED,UAAOF,kBAAK,QAAQ,MAAM,OAAO,MAAM;EACxC;EACD,YAAY,MAAM,MAAM;GACtB,MAAM,uDAAyB,MAAM;IACnC,QAAQ,OAAO,YAAY;IAC3B,QAAQ,SAAS;IAClB;AAED,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,SAAS;AAGrD,UAAO;EACR;EACD,MAAM,aAAa;GACjB,MAAM,CAAC,cAA8C,GAAGI,0BAAc,mBAAyC,KAAK,SAAS,CAACP,gCAAc;GAE5I,MAAM,MAAM,MAAM,cAAc,QAAQ;GACxC,MAAM,OAAOG,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO;GAC/D,MAAM,OAAOC,wBAAY,QAAQD,kBAAK,QAAQ,MAAM,OAAO;GAE3D,MAAM,qBAAqB,IAAIK,qCAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD;GAED,MAAM,QAAQ,MAAM,mBAAmB,MAAM,GAAG;AAChD,SAAM,KAAK,QAAQ,GAAG;GAEtB,MAAM,cAAc,MAAM,KAAK,YAAY,eAAe;IACxD,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd;AAED,SAAM,KAAK,QAAQ,GAAG;EACvB;EACF;AACF"}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./types-DYAniEBx.cjs";
2
- import { Options, PluginMsw, UserPluginWithLifeCycle } from "./types-CxxnBHOU.cjs";
2
+ import { Options, PluginMsw, UserPluginWithLifeCycle } from "./types-DA0gctJM.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-BOMj2hjt.js";
2
- import { Options, PluginMsw, UserPluginWithLifeCycle } from "./types-Dte4R-vh.js";
2
+ import { Options, PluginMsw, UserPluginWithLifeCycle } from "./types-B_ektcRL.js";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  declare const pluginMswName = "plugin-msw";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { pluginTsName } from '@kubb/plugin-ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { handlersGenerator, mswGenerator } from './generators'\nimport type { PluginMsw } from './types.ts'\n\nexport const pluginMswName = 'plugin-msw' satisfies PluginMsw['name']\n\nexport const pluginMsw = createPlugin<PluginMsw>((options) => {\n const {\n output = { path: 'handlers', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n handlers = false,\n parser = 'data',\n generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginMswName,\n options: {\n output,\n parser,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName, parser === 'faker' ? pluginFakerName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n suffix: type ? 'handler' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAcA,MAAa,gBAAgB;AAE7B,MAAa,YAAY,aAAwB,CAAC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAY,YAAY;CAAS,GAClD,OACA,UAAU,CAAE,GACZ,SACA,WAAW,CAAE,GACb,eAAe,CAAE,GACjB,WAAW,OACX,SAAS,QACT,aAAa,CAAC,cAAc,WAAW,oBAAoB,MAAU,EAAC,OAAO,QAAQ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KAAK;GACpE,MAAM,OAAO,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GAEjE,MAAM,qBAAqB,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;GACD;GAED,MAAM,QAAQ,MAAM,mBAAmB,MAAM,GAAG,WAAW;GAC3D,MAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,KAAK,YAAY,eAAe;IACxD,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,IACxB;IACD,QAAQ,KAAK;GACd,EAAC;GAEF,MAAM,KAAK,QAAQ,GAAG,YAAY;EACnC;CACF;AACF,EAAC"}
1
+ {"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginFakerName } from '@kubb/plugin-faker'\nimport { pluginTsName } from '@kubb/plugin-ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { handlersGenerator, mswGenerator } from './generators'\nimport type { PluginMsw } from './types.ts'\n\nexport const pluginMswName = 'plugin-msw' satisfies PluginMsw['name']\n\nexport const pluginMsw = createPlugin<PluginMsw>((options) => {\n const {\n output = { path: 'handlers', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n handlers = false,\n parser = 'data',\n generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean),\n contentType,\n baseURL,\n } = options\n\n return {\n name: pluginMswName,\n options: {\n output,\n parser,\n group,\n baseURL,\n },\n pre: [pluginOasName, pluginTsName, parser === 'faker' ? pluginFakerName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n suffix: type ? 'handler' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAcA,MAAa,gBAAgB;AAE7B,MAAa,YAAY,cAAyB,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAY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K,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO;GAC/D,MAAM,OAAO,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO;GAE3D,MAAM,qBAAqB,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD;GAED,MAAM,QAAQ,MAAM,mBAAmB,MAAM,GAAG;AAChD,SAAM,KAAK,QAAQ,GAAG;GAEtB,MAAM,cAAc,MAAM,KAAK,YAAY,eAAe;IACxD,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd;AAED,SAAM,KAAK,QAAQ,GAAG;EACvB;EACF;AACF"}
@@ -1,6 +1,6 @@
1
- import { HttpMethod, OasTypes, Operation, SchemaObject, contentType } from "./types-DYAniEBx.cjs";
2
- import { OASDocument, SchemaObject as SchemaObject$1, User } from "oas/types";
3
- import { Operation as Operation$1 } from "oas/operation";
1
+ import { HttpMethod, OasTypes, Operation as Operation$1, SchemaObject as SchemaObject$1, contentType } from "./types-BOMj2hjt.js";
2
+ import { OASDocument, SchemaObject, User } from "oas/types";
3
+ import { Operation } from "oas/operation";
4
4
  import { OpenAPIV3 } from "openapi-types";
5
5
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
6
6
  import BaseOas from "oas";
@@ -28,9 +28,9 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
28
28
  set($ref: string, value: unknown): false | undefined;
29
29
  getDiscriminator(schema: OasTypes.SchemaObject): OpenAPIV3.DiscriminatorObject | undefined;
30
30
  dereferenceWithRef(schema?: unknown): any;
31
- getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
32
- getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
33
- getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
31
+ getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject;
32
+ getRequestSchema(operation: Operation): SchemaObject | undefined;
33
+ getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
34
34
  valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
35
35
  }
36
36
  //#endregion
@@ -926,8 +926,8 @@ type OperationSchema = {
926
926
  * Converted name, contains already `PathParams`, `QueryParams`, ...
927
927
  */
928
928
  name: string;
929
- schema: SchemaObject;
930
- operation?: Operation;
929
+ schema: SchemaObject$1;
930
+ operation?: Operation$1;
931
931
  /**
932
932
  * OperationName in PascalCase, only being used in OperationGenerator
933
933
  */
@@ -1021,7 +1021,7 @@ type SchemaGeneratorOptions = {
1021
1021
  };
1022
1022
  };
1023
1023
  type SchemaProps$1 = {
1024
- schemaObject?: SchemaObject;
1024
+ schemaObject?: SchemaObject$1;
1025
1025
  name?: string;
1026
1026
  parentName?: string;
1027
1027
  };
@@ -1047,12 +1047,12 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
1047
1047
  type OperationsProps<TOptions extends PluginFactoryOptions> = {
1048
1048
  instance: Omit<OperationGenerator<TOptions>, 'build'>;
1049
1049
  options: TOptions['resolvedOptions'];
1050
- operations: Array<Operation>;
1050
+ operations: Array<Operation$1>;
1051
1051
  };
1052
1052
  type OperationProps<TOptions extends PluginFactoryOptions> = {
1053
1053
  instance: Omit<OperationGenerator<TOptions>, 'build'>;
1054
1054
  options: TOptions['resolvedOptions'];
1055
- operation: Operation;
1055
+ operation: Operation$1;
1056
1056
  };
1057
1057
  type SchemaProps<TOptions extends PluginFactoryOptions> = {
1058
1058
  instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
@@ -1060,7 +1060,7 @@ type SchemaProps<TOptions extends PluginFactoryOptions> = {
1060
1060
  schema: {
1061
1061
  name: string;
1062
1062
  tree: Array<Schema>;
1063
- value: SchemaObject;
1063
+ value: SchemaObject$1;
1064
1064
  };
1065
1065
  };
1066
1066
  type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
@@ -1087,7 +1087,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
1087
1087
  };
1088
1088
  declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
1089
1089
  #private;
1090
- getSchemas(operation: Operation, {
1090
+ getSchemas(operation: Operation$1, {
1091
1091
  resolveName
1092
1092
  }?: {
1093
1093
  resolveName?: (name: string) => string;
@@ -1095,7 +1095,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
1095
1095
  getOperations(): Promise<Array<{
1096
1096
  path: string;
1097
1097
  method: HttpMethod;
1098
- operation: Operation;
1098
+ operation: Operation$1;
1099
1099
  }>>;
1100
1100
  build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
1101
1101
  }
@@ -1161,4 +1161,4 @@ type ResolvedOptions = {
1161
1161
  type PluginMsw = PluginFactoryOptions<'plugin-msw', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1162
1162
  //#endregion
1163
1163
  export { Generator, Options$1 as Options, PluginMsw, UserPluginWithLifeCycle };
1164
- //# sourceMappingURL=types-CxxnBHOU.d.cts.map
1164
+ //# sourceMappingURL=types-B_ektcRL.d.ts.map
@@ -1,6 +1,6 @@
1
- import { HttpMethod, OasTypes, Operation, SchemaObject, contentType } from "./types-BOMj2hjt.js";
2
- import { OASDocument, SchemaObject as SchemaObject$1, User } from "oas/types";
3
- import { Operation as Operation$1 } from "oas/operation";
1
+ import { HttpMethod, OasTypes, Operation as Operation$1, SchemaObject as SchemaObject$1, contentType } from "./types-DYAniEBx.cjs";
2
+ import { OASDocument, SchemaObject, User } from "oas/types";
3
+ import { Operation } from "oas/operation";
4
4
  import { OpenAPIV3 } from "openapi-types";
5
5
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
6
6
  import BaseOas from "oas";
@@ -28,9 +28,9 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
28
28
  set($ref: string, value: unknown): false | undefined;
29
29
  getDiscriminator(schema: OasTypes.SchemaObject): OpenAPIV3.DiscriminatorObject | undefined;
30
30
  dereferenceWithRef(schema?: unknown): any;
31
- getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
32
- getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
33
- getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
31
+ getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject;
32
+ getRequestSchema(operation: Operation): SchemaObject | undefined;
33
+ getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
34
34
  valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
35
35
  }
36
36
  //#endregion
@@ -926,8 +926,8 @@ type OperationSchema = {
926
926
  * Converted name, contains already `PathParams`, `QueryParams`, ...
927
927
  */
928
928
  name: string;
929
- schema: SchemaObject;
930
- operation?: Operation;
929
+ schema: SchemaObject$1;
930
+ operation?: Operation$1;
931
931
  /**
932
932
  * OperationName in PascalCase, only being used in OperationGenerator
933
933
  */
@@ -1021,7 +1021,7 @@ type SchemaGeneratorOptions = {
1021
1021
  };
1022
1022
  };
1023
1023
  type SchemaProps$1 = {
1024
- schemaObject?: SchemaObject;
1024
+ schemaObject?: SchemaObject$1;
1025
1025
  name?: string;
1026
1026
  parentName?: string;
1027
1027
  };
@@ -1047,12 +1047,12 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
1047
1047
  type OperationsProps<TOptions extends PluginFactoryOptions> = {
1048
1048
  instance: Omit<OperationGenerator<TOptions>, 'build'>;
1049
1049
  options: TOptions['resolvedOptions'];
1050
- operations: Array<Operation>;
1050
+ operations: Array<Operation$1>;
1051
1051
  };
1052
1052
  type OperationProps<TOptions extends PluginFactoryOptions> = {
1053
1053
  instance: Omit<OperationGenerator<TOptions>, 'build'>;
1054
1054
  options: TOptions['resolvedOptions'];
1055
- operation: Operation;
1055
+ operation: Operation$1;
1056
1056
  };
1057
1057
  type SchemaProps<TOptions extends PluginFactoryOptions> = {
1058
1058
  instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
@@ -1060,7 +1060,7 @@ type SchemaProps<TOptions extends PluginFactoryOptions> = {
1060
1060
  schema: {
1061
1061
  name: string;
1062
1062
  tree: Array<Schema>;
1063
- value: SchemaObject;
1063
+ value: SchemaObject$1;
1064
1064
  };
1065
1065
  };
1066
1066
  type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
@@ -1087,7 +1087,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
1087
1087
  };
1088
1088
  declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
1089
1089
  #private;
1090
- getSchemas(operation: Operation, {
1090
+ getSchemas(operation: Operation$1, {
1091
1091
  resolveName
1092
1092
  }?: {
1093
1093
  resolveName?: (name: string) => string;
@@ -1095,7 +1095,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
1095
1095
  getOperations(): Promise<Array<{
1096
1096
  path: string;
1097
1097
  method: HttpMethod;
1098
- operation: Operation;
1098
+ operation: Operation$1;
1099
1099
  }>>;
1100
1100
  build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
1101
1101
  }
@@ -1161,4 +1161,4 @@ type ResolvedOptions = {
1161
1161
  type PluginMsw = PluginFactoryOptions<'plugin-msw', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1162
1162
  //#endregion
1163
1163
  export { Generator, Options$1 as Options, PluginMsw, UserPluginWithLifeCycle };
1164
- //# sourceMappingURL=types-Dte4R-vh.d.ts.map
1164
+ //# sourceMappingURL=types-DA0gctJM.d.cts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-msw",
3
- "version": "3.16.4",
3
+ "version": "3.17.1",
4
4
  "description": "Mock Service Worker (MSW) handlers generator plugin for Kubb, creating API mocks from OpenAPI specifications for frontend development and testing.",
5
5
  "keywords": [
6
6
  "msw",
@@ -66,19 +66,19 @@
66
66
  "!/**/__tests__/**"
67
67
  ],
68
68
  "dependencies": {
69
- "@kubb/core": "3.16.4",
70
- "@kubb/oas": "3.16.4",
71
- "@kubb/plugin-faker": "3.16.4",
72
- "@kubb/plugin-oas": "3.16.4",
73
- "@kubb/plugin-ts": "3.16.4",
74
- "@kubb/react": "3.16.4"
69
+ "@kubb/core": "3.17.1",
70
+ "@kubb/oas": "3.17.1",
71
+ "@kubb/plugin-faker": "3.17.1",
72
+ "@kubb/plugin-oas": "3.17.1",
73
+ "@kubb/plugin-ts": "3.17.1",
74
+ "@kubb/react": "3.17.1"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@types/react": "^18.3.23",
78
78
  "react": "^18.3.1",
79
79
  "tsdown": "^0.14.1",
80
80
  "typescript": "^5.9.2",
81
- "@kubb/config-ts": "3.16.4"
81
+ "@kubb/config-ts": "3.17.1"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "@kubb/react": "^3.0.0"