@kubb/plugin-msw 3.16.3 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components-ByUOezvw.js.map +1 -1
- package/dist/components-Bz0C7Qrg.cjs.map +1 -1
- package/dist/generators-BjQcx0SS.js.map +1 -1
- package/dist/generators-DQ6KjdAH.cjs.map +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{types-CxxnBHOU.d.cts → types-B_ektcRL.d.ts} +15 -15
- package/dist/{types-Dte4R-vh.d.ts → types-DA0gctJM.d.cts} +15 -15
- package/package.json +8 -8
|
@@ -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,
|
|
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,
|
|
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
|
|
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,CAAC,MAAM,QAAQ,SAAS,KAAK;KAAE,MAAM,KAAK,KAAK;KAAM,MAAM,MAAM,KAAK;;IAG1F,WAAW,WACV,oBAAC;KACC,MAAM,KAAK;KACX,UAAU,KAAK,QAAQ,SAAS;KAChC,WAAW,MAAM,QAAQ,SAAS;KACvB;KACF;;IAGZ,WAAW,UACV,oBAAC;KAAK,MAAM,KAAK;KAAM,UAAU,KAAK,QAAQ,SAAS;KAAM,WAAW,MAAM,QAAQ,SAAS;KAAiB;KAAoB;;;;CAI3I;CACF;;;;AC3DD,MAAa,oBAAoB,qBAAgC;CAC/D,MAAM;CACN,WAAW,EAAE,YAAY,EAAE;EACzB,MAAM,EAAE,eAAe,QAAQ,GAAG;EAClC,MAAM,MAAM;EACZ,MAAM,EAAE,SAAS,SAAS,GAAG;EAE7B,MAAM,OAAO,cAAc,QAAQ;GAAE,MAAM;GAAY,SAAS;GAAO,WAAW,OAAO;GAAK;EAE9F,MAAM,UAAU,WAAW,KAAK,cAAc;GAC5C,MAAM,gBAAgB,QAAQ,WAAW,EAAE,WAAW,OAAO,KAAK;GAClE,MAAM,gBAAgB,QAAQ,WAAW;IAAE,WAAW,OAAO;IAAK,MAAM;IAAY;AAEpF,UAAO,oBAAC,KAAK;IAAgC,MAAM,CAAC,cAAc;IAAE,MAAM,KAAK;IAAM,MAAM,cAAc;MAAhF,cAAc;EACxC;EAED,MAAM,WAAW,WAAW,KAAK,cAAc,GAAG,QAAQ,WAAW;GAAE,MAAM;GAAY,WAAW,OAAO;GAAK,EAAE;AAElH,SACE,qBAAC;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,QAAQ,UAAU;IAAE;IAAK,QAAQ,OAAO,QAAQ;IAAQ,QAAQ,cAAc;IAAQ;GACtF,QAAQ,UAAU;IAAE;IAAK,QAAQ,OAAO,QAAQ;IAAQ;cAEvD,SACD,oBAAC;IAAS,MAAM;IAAsB;;;CAG3C;CACF"}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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;IAAQ;GAC/D,+CAAkB;IAAE;IAAK;IAAQ;;IAEjC,kDAACA,kBAAK;KAAO,MAAM,CAAC,OAAO;KAAE,MAAK;;IAClC,kDAACA,kBAAK;KAAO,MAAM,CAAC,mBAAmB;KAAE;KAAW,MAAK;;IACzD,kDAACA,kBAAK;KAAO,MAAM,CAAC,KAAK,QAAQ,SAAS,KAAK;KAAE,MAAM,KAAK,KAAK;KAAM,MAAM,KAAK,KAAK;KAAM;;IAC5F,WAAW,WAAW,MAAM,QAAQ,MAAM,QAAQ,YACjD,kDAACA,kBAAK;KAAO,MAAM,CAAC,MAAM,QAAQ,SAAS,KAAK;KAAE,MAAM,KAAK,KAAK;KAAM,MAAM,MAAM,KAAK;;IAG1F,WAAW,WACV,kDAACC;KACC,MAAM,KAAK;KACX,UAAU,KAAK,QAAQ,SAAS;KAChC,WAAW,MAAM,QAAQ,SAAS;KACvB;KACF;;IAGZ,WAAW,UACV,kDAACC;KAAK,MAAM,KAAK;KAAM,UAAU,KAAK,QAAQ,SAAS;KAAM,WAAW,MAAM,QAAQ,SAAS;KAAiB;KAAoB;;;;CAI3I;CACF;;;;AC3DD,MAAa,gEAAoD;CAC/D,MAAM;CACN,WAAW,EAAE,YAAY,EAAE;EACzB,MAAM,EAAE,eAAe,QAAQ;EAC/B,MAAM;EACN,MAAM,EAAE,SAAS,SAAS;EAE1B,MAAM,OAAO,cAAc,QAAQ;GAAE,MAAM;GAAY,SAAS;GAAO,WAAW,OAAO;GAAK;EAE9F,MAAM,UAAU,WAAW,KAAK,cAAc;GAC5C,MAAM,gBAAgB,QAAQ,WAAW,EAAE,WAAW,OAAO,KAAK;GAClE,MAAM,gBAAgB,QAAQ,WAAW;IAAE,WAAW,OAAO;IAAK,MAAM;IAAY;AAEpF,UAAO,kDAACC,kBAAK;IAAgC,MAAM,CAAC,cAAc;IAAE,MAAM,KAAK;IAAM,MAAM,cAAc;MAAhF,cAAc;EACxC;EAED,MAAM,WAAW,WAAW,KAAK,cAAc,GAAG,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"}
|
package/dist/generators.d.cts
CHANGED
package/dist/generators.d.ts
CHANGED
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["mswGenerator","handlersGenerator","pluginOasName","pluginTsName","pluginFakerName","
|
|
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-
|
|
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-
|
|
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,
|
|
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,YAAY;EAAS,EAClD,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,WAAW,OACX,SAAS,QACT,aAAa,CAAC,cAAc,WAAW,oBAAoB,OAAU,CAAC,OAAO,UAC7E,aACA,SACD,GAAG;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACD;EACD,KAAK;GAAC;GAAe;GAAc,WAAW,UAAU,kBAAkB;GAAU,CAAC,OAAO;EAC5F,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO;GAC/D,MAAM,OAAO,YAAY,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO;AAEvE,OAAI,SAAS;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO;AAGnC,OAAI,UAAUA,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,GAAG,UAAU,IAAI,OAAO;IAChC;AAEL,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,GACD;GAEH;AAED,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM;EACxC;EACD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,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,GAAG,cAAc,mBAAyC,KAAK,SAAS,CAAC,cAAc;GAE5I,MAAM,MAAM,MAAM,cAAc,QAAQ;GACxC,MAAM,OAAO,KAAK,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-
|
|
2
|
-
import { OASDocument, SchemaObject
|
|
3
|
-
import { 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
|
|
32
|
-
getRequestSchema(operation: Operation
|
|
33
|
-
getParametersSchema(operation: Operation
|
|
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-
|
|
1164
|
+
//# sourceMappingURL=types-B_ektcRL.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HttpMethod, OasTypes, Operation, SchemaObject, contentType } from "./types-
|
|
2
|
-
import { OASDocument, SchemaObject
|
|
3
|
-
import { 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
|
|
32
|
-
getRequestSchema(operation: Operation
|
|
33
|
-
getParametersSchema(operation: Operation
|
|
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-
|
|
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.
|
|
3
|
+
"version": "3.17.0",
|
|
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.
|
|
70
|
-
"@kubb/oas": "3.
|
|
71
|
-
"@kubb/plugin-faker": "3.
|
|
72
|
-
"@kubb/plugin-oas": "3.
|
|
73
|
-
"@kubb/plugin-ts": "3.
|
|
74
|
-
"@kubb/react": "3.
|
|
69
|
+
"@kubb/core": "3.17.0",
|
|
70
|
+
"@kubb/oas": "3.17.0",
|
|
71
|
+
"@kubb/plugin-faker": "3.17.0",
|
|
72
|
+
"@kubb/plugin-oas": "3.17.0",
|
|
73
|
+
"@kubb/plugin-ts": "3.17.0",
|
|
74
|
+
"@kubb/react": "3.17.0"
|
|
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.
|
|
81
|
+
"@kubb/config-ts": "3.17.0"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"@kubb/react": "^3.0.0"
|