@kubb/plugin-msw 4.19.2 → 4.20.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.
- package/dist/components-Fe6NiCbv.cjs.map +1 -1
- package/dist/components-r7XTqwE7.js.map +1 -1
- package/dist/components.d.cts +5 -5
- package/dist/components.d.ts +5 -5
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{types-CBM4UWNM.d.ts → types-DmVjB65n.d.ts} +5 -5
- package/dist/{types-BvhOEuZ8.d.cts → types-PRh0FjWU.d.cts} +5 -5
- package/package.json +7 -7
- package/src/components/Handlers.tsx +2 -2
- package/src/components/Mock.tsx +2 -2
- package/src/components/MockWithFaker.tsx +2 -2
- package/src/components/Response.tsx +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-Fe6NiCbv.cjs","names":["File","URLPath","FunctionParams","File","Function","URLPath","FunctionParams","File","Function","FunctionParams","File","Function"],"sources":["../src/components/Handlers.tsx","../src/components/Mock.tsx","../src/components/MockWithFaker.tsx","../src/components/Response.tsx"],"sourcesContent":["import { File } from '@kubb/react-fabric'\nimport type {
|
|
1
|
+
{"version":3,"file":"components-Fe6NiCbv.cjs","names":["File","URLPath","FunctionParams","File","Function","URLPath","FunctionParams","File","Function","FunctionParams","File","Function"],"sources":["../src/components/Handlers.tsx","../src/components/Mock.tsx","../src/components/MockWithFaker.tsx","../src/components/Response.tsx"],"sourcesContent":["import { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype HandlersProps = {\n /**\n * Name of the function\n */\n name: string\n // custom\n handlers: string[]\n}\n\nexport function Handlers({ name, handlers }: HandlersProps): FabricReactNode {\n return (\n <File.Source name={name} isIndexable isExportable>\n {`export const ${name} = ${JSON.stringify(handlers).replaceAll(`\"`, '')} as const`}\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n fakerName: string\n baseURL: string | undefined\n operation: Operation\n}\n\nexport function Mock({ baseURL = '', name, typeName, operation }: Props): FabricReactNode {\n const method = operation.method\n const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))\n const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200\n\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n const url = new URLPath(operation.path).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const hasResponseSchema = contentType && responseObject?.content?.[contentType]?.schema !== undefined\n\n // If no response schema, uses any type but function to avoid overriding callback\n const dataType = hasResponseSchema ? typeName : 'string | number | boolean | null | object'\n\n const params = FunctionParams.factory({\n data: {\n type: `${dataType} | ((\n info: Parameters<Parameters<typeof http.${method}>[1]>[0],\n ) => Response | Promise<Response>)`,\n optional: true,\n },\n })\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()}>\n {`return http.${method}(\\`${baseURL}${url.replace(/([^/]):/g, '$1\\\\\\\\:')}\\`, function handler(info) {\n if(typeof data === 'function') return data(info)\n\n return new Response(JSON.stringify(data), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })\n })`}\n </Function>\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\n\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n fakerName: string\n baseURL: string | undefined\n operation: Operation\n}\n\nexport function MockWithFaker({ baseURL = '', name, fakerName, typeName, operation }: Props): FabricReactNode {\n const method = operation.method\n const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))\n const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200\n\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n const url = new URLPath(operation.path).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const params = FunctionParams.factory({\n data: {\n type: `${typeName} | ((\n info: Parameters<Parameters<typeof http.${method}>[1]>[0],\n ) => Response | Promise<Response>)`,\n optional: true,\n },\n })\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()}>\n {`return http.${method}('${baseURL}${url.replace(/([^/]):/g, '$1\\\\\\\\:')}', function handler(info) {\n if(typeof data === 'function') return data(info)\n\n return new Response(JSON.stringify(data || ${fakerName}(data)), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })\n })`}\n </Function>\n </File.Source>\n )\n}\n","import type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n typeName: string\n operation: Operation\n name: string\n statusCode: number\n}\n\nexport function Response({ name, typeName, operation, statusCode }: Props): FabricReactNode {\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const hasResponseSchema = contentType && responseObject?.content?.[contentType]?.schema !== undefined\n\n const params = FunctionParams.factory({\n data: {\n type: `${typeName}`,\n optional: !hasResponseSchema,\n },\n })\n\n const responseName = `${name}Response${statusCode}`\n\n return (\n <File.Source name={responseName} isIndexable isExportable>\n <Function name={responseName} export params={params.toConstructor()}>\n {`\n return new Response(JSON.stringify(data), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAgB,SAAS,EAAE,MAAM,YAA4C;AAC3E,QACE,wDAACA,wBAAK;EAAa;EAAM;EAAY;YAClC,gBAAgB,KAAK,KAAK,KAAK,UAAU,SAAS,CAAC,WAAW,KAAK,GAAG,CAAC;GAC5D;;;;;ACAlB,SAAgB,KAAK,EAAE,UAAU,IAAI,MAAM,UAAU,aAAqC;CACxF,MAAM,SAAS,UAAU;CACzB,MAAM,qBAAqB,UAAU,wBAAwB,CAAC,QAAQ,SAAS,KAAK,WAAW,IAAI,CAAC;CACpG,MAAM,aAAa,mBAAmB,SAAS,IAAI,OAAO,mBAAmB,GAAG,GAAG;CAEnF,MAAM,iBAAiB,UAAU,wBAAwB,WAAW;CACpE,MAAM,cAAc,OAAO,KAAK,eAAe,WAAW,EAAE,CAAC,GAAG;CAChE,MAAM,MAAM,IAAIC,yBAAQ,UAAU,KAAK,CAAC,WAAW,CAAC,QAAQ,YAAY,UAAU;CAElF,MAAM,UAAU,CAAC,cAAc,oBAAoB,YAAY,KAAK,OAAU,CAAC,OAAO,QAAQ;CAK9F,MAAM,WAHoB,eAAe,gBAAgB,UAAU,cAAc,WAAW,SAGvD,WAAW;CAEhD,MAAM,SAASC,kCAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG,SAAS;kDAC0B,OAAO;;EAEnD,UAAU;EACX,EACF,CAAC;AAEF,QACE,wDAACC,wBAAK;EAAa;EAAM;EAAY;YACnC,wDAACC;GAAe;GAAM;GAAO,QAAQ,OAAO,eAAe;aACxD,eA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K,OAAU,CAAC,OAAO,QAAQ;CAE9F,MAAM,oBAAoB,eAAe,gBAAgB,UAAU,cAAc,WAAW;CAE5F,MAAM,SAASC,kCAAe,QAAQ,EACpC,MAAM;EACJ,MAAM,GAAG;EACT,UAAU,CAAC;EACZ,EACF,CAAC;CAEF,MAAM,eAAe,GAAG,KAAK,UAAU;AAEvC,QACE,wDAACC,wBAAK;EAAO,MAAM;EAAc;EAAY;YAC3C,wDAACC;GAAS,MAAM;GAAc;GAAO,QAAQ,OAAO,eAAe;aAChE;;gBAEO,WAAW;QAEnB,QAAQ,SACJ;UACF,QAAQ,KAAK,OAAO,CAAC;YAEnB,GACL;;IAEU;GACC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-r7XTqwE7.js","names":[],"sources":["../src/components/Handlers.tsx","../src/components/Mock.tsx","../src/components/MockWithFaker.tsx","../src/components/Response.tsx"],"sourcesContent":["import { File } from '@kubb/react-fabric'\nimport type {
|
|
1
|
+
{"version":3,"file":"components-r7XTqwE7.js","names":[],"sources":["../src/components/Handlers.tsx","../src/components/Mock.tsx","../src/components/MockWithFaker.tsx","../src/components/Response.tsx"],"sourcesContent":["import { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype HandlersProps = {\n /**\n * Name of the function\n */\n name: string\n // custom\n handlers: string[]\n}\n\nexport function Handlers({ name, handlers }: HandlersProps): FabricReactNode {\n return (\n <File.Source name={name} isIndexable isExportable>\n {`export const ${name} = ${JSON.stringify(handlers).replaceAll(`\"`, '')} as const`}\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n fakerName: string\n baseURL: string | undefined\n operation: Operation\n}\n\nexport function Mock({ baseURL = '', name, typeName, operation }: Props): FabricReactNode {\n const method = operation.method\n const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))\n const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200\n\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n const url = new URLPath(operation.path).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const hasResponseSchema = contentType && responseObject?.content?.[contentType]?.schema !== undefined\n\n // If no response schema, uses any type but function to avoid overriding callback\n const dataType = hasResponseSchema ? typeName : 'string | number | boolean | null | object'\n\n const params = FunctionParams.factory({\n data: {\n type: `${dataType} | ((\n info: Parameters<Parameters<typeof http.${method}>[1]>[0],\n ) => Response | Promise<Response>)`,\n optional: true,\n },\n })\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()}>\n {`return http.${method}(\\`${baseURL}${url.replace(/([^/]):/g, '$1\\\\\\\\:')}\\`, function handler(info) {\n if(typeof data === 'function') return data(info)\n\n return new Response(JSON.stringify(data), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })\n })`}\n </Function>\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\n\nimport type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n fakerName: string\n baseURL: string | undefined\n operation: Operation\n}\n\nexport function MockWithFaker({ baseURL = '', name, fakerName, typeName, operation }: Props): FabricReactNode {\n const method = operation.method\n const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))\n const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200\n\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n const url = new URLPath(operation.path).toURLPath().replace(/([^/]):/g, '$1\\\\\\\\:')\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const params = FunctionParams.factory({\n data: {\n type: `${typeName} | ((\n info: Parameters<Parameters<typeof http.${method}>[1]>[0],\n ) => Response | Promise<Response>)`,\n optional: true,\n },\n })\n\n return (\n <File.Source name={name} isIndexable isExportable>\n <Function name={name} export params={params.toConstructor()}>\n {`return http.${method}('${baseURL}${url.replace(/([^/]):/g, '$1\\\\\\\\:')}', function handler(info) {\n if(typeof data === 'function') return data(info)\n\n return new Response(JSON.stringify(data || ${fakerName}(data)), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })\n })`}\n </Function>\n </File.Source>\n )\n}\n","import type { OasTypes, Operation } from '@kubb/oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n typeName: string\n operation: Operation\n name: string\n statusCode: number\n}\n\nexport function Response({ name, typeName, operation, statusCode }: Props): FabricReactNode {\n const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject\n const contentType = Object.keys(responseObject.content || {})?.[0]\n\n const headers = [contentType ? `'Content-Type': '${contentType}'` : undefined].filter(Boolean)\n\n const hasResponseSchema = contentType && responseObject?.content?.[contentType]?.schema !== undefined\n\n const params = FunctionParams.factory({\n data: {\n type: `${typeName}`,\n optional: !hasResponseSchema,\n },\n })\n\n const responseName = `${name}Response${statusCode}`\n\n return (\n <File.Source name={responseName} isIndexable isExportable>\n <Function name={responseName} export params={params.toConstructor()}>\n {`\n return new Response(JSON.stringify(data), {\n status: ${statusCode},\n ${\n headers.length\n ? ` headers: {\n ${headers.join(', \\n')}\n },`\n : ''\n }\n })`}\n </Function>\n </File.Source>\n )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,MAAM;GAAc;GAAO,QAAQ,OAAO,eAAe;aAChE;;gBAEO,WAAW;QAEnB,QAAQ,SACJ;UACF,QAAQ,KAAK,OAAO,CAAC;YAEnB,GACL;;IAEU;GACC"}
|
package/dist/components.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as Operation, v as __name } from "./index-B4gKt7dm.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Handlers.d.ts
|
|
5
5
|
type HandlersProps = {
|
|
@@ -12,7 +12,7 @@ type HandlersProps = {
|
|
|
12
12
|
declare function Handlers({
|
|
13
13
|
name,
|
|
14
14
|
handlers
|
|
15
|
-
}: HandlersProps):
|
|
15
|
+
}: HandlersProps): FabricReactNode;
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/components/Mock.d.ts
|
|
18
18
|
type Props$2 = {
|
|
@@ -30,7 +30,7 @@ declare function Mock({
|
|
|
30
30
|
name,
|
|
31
31
|
typeName,
|
|
32
32
|
operation
|
|
33
|
-
}: Props$2):
|
|
33
|
+
}: Props$2): FabricReactNode;
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/components/MockWithFaker.d.ts
|
|
36
36
|
type Props$1 = {
|
|
@@ -49,7 +49,7 @@ declare function MockWithFaker({
|
|
|
49
49
|
fakerName,
|
|
50
50
|
typeName,
|
|
51
51
|
operation
|
|
52
|
-
}: Props$1):
|
|
52
|
+
}: Props$1): FabricReactNode;
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/components/Response.d.ts
|
|
55
55
|
type Props = {
|
|
@@ -63,7 +63,7 @@ declare function Response({
|
|
|
63
63
|
typeName,
|
|
64
64
|
operation,
|
|
65
65
|
statusCode
|
|
66
|
-
}: Props):
|
|
66
|
+
}: Props): FabricReactNode;
|
|
67
67
|
//#endregion
|
|
68
68
|
export { Handlers, Mock, MockWithFaker, Response };
|
|
69
69
|
//# sourceMappingURL=components.d.cts.map
|
package/dist/components.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
2
|
import { h as Operation } from "./index-Cdqo2P0B.js";
|
|
3
|
-
import {
|
|
3
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Handlers.d.ts
|
|
6
6
|
type HandlersProps = {
|
|
@@ -13,7 +13,7 @@ type HandlersProps = {
|
|
|
13
13
|
declare function Handlers({
|
|
14
14
|
name,
|
|
15
15
|
handlers
|
|
16
|
-
}: HandlersProps):
|
|
16
|
+
}: HandlersProps): FabricReactNode;
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/components/Mock.d.ts
|
|
19
19
|
type Props$2 = {
|
|
@@ -31,7 +31,7 @@ declare function Mock({
|
|
|
31
31
|
name,
|
|
32
32
|
typeName,
|
|
33
33
|
operation
|
|
34
|
-
}: Props$2):
|
|
34
|
+
}: Props$2): FabricReactNode;
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/components/MockWithFaker.d.ts
|
|
37
37
|
type Props$1 = {
|
|
@@ -50,7 +50,7 @@ declare function MockWithFaker({
|
|
|
50
50
|
fakerName,
|
|
51
51
|
typeName,
|
|
52
52
|
operation
|
|
53
|
-
}: Props$1):
|
|
53
|
+
}: Props$1): FabricReactNode;
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/components/Response.d.ts
|
|
56
56
|
type Props = {
|
|
@@ -64,7 +64,7 @@ declare function Response({
|
|
|
64
64
|
typeName,
|
|
65
65
|
operation,
|
|
66
66
|
statusCode
|
|
67
|
-
}: Props):
|
|
67
|
+
}: Props): FabricReactNode;
|
|
68
68
|
//#endregion
|
|
69
69
|
export { Handlers, Mock, MockWithFaker, Response };
|
|
70
70
|
//# sourceMappingURL=components.d.ts.map
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as __name } from "./index-B4gKt7dm.cjs";
|
|
2
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-PRh0FjWU.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/handlersGenerator.d.ts
|
|
5
5
|
declare const handlersGenerator: ReactGenerator<PluginMsw>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
2
|
import "./index-Cdqo2P0B.js";
|
|
3
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
3
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-DmVjB65n.js";
|
|
4
4
|
|
|
5
5
|
//#region src/generators/handlersGenerator.d.ts
|
|
6
6
|
declare const handlersGenerator: ReactGenerator<PluginMsw>;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as UserPluginWithLifeCycle, v as __name } from "./index-B4gKt7dm.cjs";
|
|
2
|
-
import { n as PluginMsw, t as Options } from "./types-
|
|
2
|
+
import { n as PluginMsw, t as Options } from "./types-PRh0FjWU.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMswName = "plugin-msw";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
2
|
import { l as UserPluginWithLifeCycle } from "./index-Cdqo2P0B.js";
|
|
3
|
-
import { n as PluginMsw, t as Options } from "./types-
|
|
3
|
+
import { n as PluginMsw, t as Options } from "./types-DmVjB65n.js";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin.d.ts
|
|
6
6
|
declare const pluginMswName = "plugin-msw";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
2
|
import { _ as contentType, a as Output, c as ResolveNameParams, d as KubbEvents, f as BaseGenerator, g as SchemaObject, h as Operation, i as Group, m as HttpMethod, n as PluginManager, o as Plugin, p as Oas, r as Config, s as PluginFactoryOptions, t as FileMetaBase, u as AsyncEventEmitter } from "./index-Cdqo2P0B.js";
|
|
3
3
|
import { Fabric } from "@kubb/react-fabric";
|
|
4
|
-
import {
|
|
4
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
5
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
6
6
|
|
|
7
7
|
//#region ../plugin-oas/src/types.d.ts
|
|
@@ -457,9 +457,9 @@ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions>
|
|
|
457
457
|
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
458
458
|
name: string;
|
|
459
459
|
type: 'react';
|
|
460
|
-
Operations: (props: OperationsProps<TOptions>) =>
|
|
461
|
-
Operation: (props: OperationProps<TOptions>) =>
|
|
462
|
-
Schema: (props: SchemaProps<TOptions>) =>
|
|
460
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
461
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
462
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
463
463
|
};
|
|
464
464
|
//#endregion
|
|
465
465
|
//#region src/types.d.ts
|
|
@@ -523,4 +523,4 @@ type ResolvedOptions = {
|
|
|
523
523
|
type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
524
524
|
//#endregion
|
|
525
525
|
export { PluginMsw as n, ReactGenerator as r, Options as t };
|
|
526
|
-
//# sourceMappingURL=types-
|
|
526
|
+
//# sourceMappingURL=types-DmVjB65n.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as contentType, a as Output, c as ResolveNameParams, d as KubbEvents, f as BaseGenerator, g as SchemaObject, h as Operation, i as Group, m as HttpMethod, n as PluginManager, o as Plugin, p as Oas, r as Config, s as PluginFactoryOptions, t as FileMetaBase, u as AsyncEventEmitter, v as __name } from "./index-B4gKt7dm.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
import { Fabric } from "@kubb/react-fabric";
|
|
5
5
|
|
|
@@ -456,9 +456,9 @@ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions>
|
|
|
456
456
|
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
457
457
|
name: string;
|
|
458
458
|
type: 'react';
|
|
459
|
-
Operations: (props: OperationsProps<TOptions>) =>
|
|
460
|
-
Operation: (props: OperationProps<TOptions>) =>
|
|
461
|
-
Schema: (props: SchemaProps<TOptions>) =>
|
|
459
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
460
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
461
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
462
462
|
};
|
|
463
463
|
//#endregion
|
|
464
464
|
//#region src/types.d.ts
|
|
@@ -522,4 +522,4 @@ type ResolvedOptions = {
|
|
|
522
522
|
type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
523
523
|
//#endregion
|
|
524
524
|
export { PluginMsw as n, ReactGenerator as r, Options as t };
|
|
525
|
-
//# sourceMappingURL=types-
|
|
525
|
+
//# sourceMappingURL=types-PRh0FjWU.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-msw",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.20.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",
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
}
|
|
74
74
|
],
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@kubb/react-fabric": "0.12.
|
|
77
|
-
"@kubb/core": "4.
|
|
78
|
-
"@kubb/oas": "4.
|
|
79
|
-
"@kubb/plugin-faker": "4.
|
|
80
|
-
"@kubb/plugin-oas": "4.
|
|
81
|
-
"@kubb/plugin-ts": "4.
|
|
76
|
+
"@kubb/react-fabric": "0.12.7",
|
|
77
|
+
"@kubb/core": "4.20.1",
|
|
78
|
+
"@kubb/oas": "4.20.1",
|
|
79
|
+
"@kubb/plugin-faker": "4.20.1",
|
|
80
|
+
"@kubb/plugin-oas": "4.20.1",
|
|
81
|
+
"@kubb/plugin-ts": "4.20.1"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {},
|
|
84
84
|
"engines": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { File } from '@kubb/react-fabric'
|
|
2
|
-
import type {
|
|
2
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
3
3
|
|
|
4
4
|
type HandlersProps = {
|
|
5
5
|
/**
|
|
@@ -10,7 +10,7 @@ type HandlersProps = {
|
|
|
10
10
|
handlers: string[]
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function Handlers({ name, handlers }: HandlersProps):
|
|
13
|
+
export function Handlers({ name, handlers }: HandlersProps): FabricReactNode {
|
|
14
14
|
return (
|
|
15
15
|
<File.Source name={name} isIndexable isExportable>
|
|
16
16
|
{`export const ${name} = ${JSON.stringify(handlers).replaceAll(`"`, '')} as const`}
|
package/src/components/Mock.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { URLPath } from '@kubb/core/utils'
|
|
2
2
|
import type { OasTypes, Operation } from '@kubb/oas'
|
|
3
3
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
4
|
-
import type {
|
|
4
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
5
5
|
|
|
6
6
|
type Props = {
|
|
7
7
|
/**
|
|
@@ -14,7 +14,7 @@ type Props = {
|
|
|
14
14
|
operation: Operation
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export function Mock({ baseURL = '', name, typeName, operation }: Props):
|
|
17
|
+
export function Mock({ baseURL = '', name, typeName, operation }: Props): FabricReactNode {
|
|
18
18
|
const method = operation.method
|
|
19
19
|
const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))
|
|
20
20
|
const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200
|
|
@@ -2,7 +2,7 @@ import { URLPath } from '@kubb/core/utils'
|
|
|
2
2
|
|
|
3
3
|
import type { OasTypes, Operation } from '@kubb/oas'
|
|
4
4
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
8
|
/**
|
|
@@ -15,7 +15,7 @@ type Props = {
|
|
|
15
15
|
operation: Operation
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export function MockWithFaker({ baseURL = '', name, fakerName, typeName, operation }: Props):
|
|
18
|
+
export function MockWithFaker({ baseURL = '', name, fakerName, typeName, operation }: Props): FabricReactNode {
|
|
19
19
|
const method = operation.method
|
|
20
20
|
const successStatusCodes = operation.getResponseStatusCodes().filter((code) => code.startsWith('2'))
|
|
21
21
|
const statusCode = successStatusCodes.length > 0 ? Number(successStatusCodes[0]) : 200
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OasTypes, Operation } from '@kubb/oas'
|
|
2
2
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
3
|
-
import type {
|
|
3
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
6
6
|
typeName: string
|
|
@@ -9,7 +9,7 @@ type Props = {
|
|
|
9
9
|
statusCode: number
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function Response({ name, typeName, operation, statusCode }: Props):
|
|
12
|
+
export function Response({ name, typeName, operation, statusCode }: Props): FabricReactNode {
|
|
13
13
|
const responseObject = operation.getResponseByStatusCode(statusCode) as OasTypes.ResponseObject
|
|
14
14
|
const contentType = Object.keys(responseObject.content || {})?.[0]
|
|
15
15
|
|