@kubb/plugin-msw 4.29.0 → 4.31.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.
@@ -1,4 +1,4 @@
1
- import { t as __name } from "./chunk-DKWOrOAv.js";
1
+ import { t as __name } from "./chunk-cy2TeOE5.cjs";
2
2
  import { FabricReactNode } from "@kubb/react-fabric/types";
3
3
  import { Operation } from "@kubb/oas";
4
4
 
@@ -1,11 +1,11 @@
1
- import { t as __name } from "./chunk-DKWOrOAv.js";
2
- import { n as PluginMsw } from "./types-DUwv-QOP.js";
3
- import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
4
- import { Fabric } from "@kubb/react-fabric";
5
- import { AsyncEventEmitter } from "@kubb/core/utils";
1
+ import { t as __name } from "./chunk-cy2TeOE5.cjs";
2
+ import { n as PluginMsw } from "./types-BvqplGx0.js";
6
3
  import { FabricReactNode } from "@kubb/react-fabric/types";
7
4
  import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
5
+ import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
6
+ import { AsyncEventEmitter } from "@kubb/core/utils";
8
7
  import { KubbFile } from "@kubb/fabric-core/types";
8
+ import { Fabric } from "@kubb/react-fabric";
9
9
 
10
10
  //#region ../plugin-oas/src/types.d.ts
11
11
  type GetOasOptions = {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as __name } from "./chunk-DKWOrOAv.js";
2
- import { n as PluginMsw, t as Options } from "./types-DUwv-QOP.js";
1
+ import { t as __name } from "./chunk-cy2TeOE5.cjs";
2
+ import { n as PluginMsw, t as Options } from "./types-BvqplGx0.js";
3
3
  import * as _kubb_core0 from "@kubb/core";
4
4
 
5
5
  //#region src/plugin.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-msw",
3
- "version": "4.29.0",
3
+ "version": "4.31.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",
@@ -65,7 +65,8 @@
65
65
  "src",
66
66
  "dist",
67
67
  "!/**/**.test.**",
68
- "!/**/__tests__/**"
68
+ "!/**/__tests__/**",
69
+ "!/**/__snapshots__/**"
69
70
  ],
70
71
  "size-limit": [
71
72
  {
@@ -75,12 +76,12 @@
75
76
  }
76
77
  ],
77
78
  "dependencies": {
78
- "@kubb/react-fabric": "0.13.1",
79
- "@kubb/core": "4.29.0",
80
- "@kubb/oas": "4.29.0",
81
- "@kubb/plugin-faker": "4.29.0",
82
- "@kubb/plugin-oas": "4.29.0",
83
- "@kubb/plugin-ts": "4.29.0"
79
+ "@kubb/react-fabric": "0.13.2",
80
+ "@kubb/core": "4.31.0",
81
+ "@kubb/oas": "4.31.0",
82
+ "@kubb/plugin-faker": "4.31.0",
83
+ "@kubb/plugin-oas": "4.31.0",
84
+ "@kubb/plugin-ts": "4.31.0"
84
85
  },
85
86
  "devDependencies": {},
86
87
  "engines": {
@@ -1,23 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { http } from 'msw'
6
-
7
- export function createPetsResponse201(data?: CreatePetsMutationResponse) {
8
- return new Response(JSON.stringify(data), {
9
- status: 201,
10
- })
11
- }
12
-
13
- export function createPets(
14
- data?: string | number | boolean | null | object | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Response | Promise<Response>),
15
- ) {
16
- return http.post(`/pets`, function handler(info) {
17
- if (typeof data === 'function') return data(info)
18
-
19
- return new Response(JSON.stringify(data), {
20
- status: 201,
21
- })
22
- })
23
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { http } from 'msw'
6
-
7
- export function createPetsResponse201(data?: CreatePetsMutationResponse) {
8
- return new Response(JSON.stringify(data), {
9
- status: 201,
10
- })
11
- }
12
-
13
- export function createPets(data?: CreatePetsMutationResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Response | Promise<Response>)) {
14
- return http.post('/pets', function handler(info) {
15
- if (typeof data === 'function') return data(info)
16
-
17
- return new Response(JSON.stringify(data || createPetsMutationResponse(data)), {
18
- status: 201,
19
- })
20
- })
21
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { http } from 'msw'
6
-
7
- export function deletePetsPetid(
8
- data?: string | number | boolean | null | object | ((info: Parameters<Parameters<typeof http.delete>[1]>[0]) => Response | Promise<Response>),
9
- ) {
10
- return http.delete(`/pets/:petId`, function handler(info) {
11
- if (typeof data === 'function') return data(info)
12
-
13
- return new Response(JSON.stringify(data), {
14
- status: 200,
15
- })
16
- })
17
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { http } from 'msw'
6
-
7
- export function listPetsResponse200(data: ListPetsQueryResponse) {
8
- return new Response(JSON.stringify(data), {
9
- status: 200,
10
- headers: {
11
- 'Content-Type': 'application/json',
12
- },
13
- })
14
- }
15
-
16
- export function listPetsResponse400(data?: ListPets400) {
17
- return new Response(JSON.stringify(data), {
18
- status: 400,
19
- })
20
- }
21
-
22
- export function listPets(data?: ListPetsQueryResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Response | Promise<Response>)) {
23
- return http.get(`/pets`, function handler(info) {
24
- if (typeof data === 'function') return data(info)
25
-
26
- return new Response(JSON.stringify(data), {
27
- status: 200,
28
- headers: {
29
- 'Content-Type': 'application/json',
30
- },
31
- })
32
- })
33
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { http } from 'msw'
6
-
7
- export function listPetsResponse200(data: ListPetsQueryResponse) {
8
- return new Response(JSON.stringify(data), {
9
- status: 200,
10
- headers: {
11
- 'Content-Type': 'application/json',
12
- },
13
- })
14
- }
15
-
16
- export function listPetsResponse400(data?: ListPets400) {
17
- return new Response(JSON.stringify(data), {
18
- status: 400,
19
- })
20
- }
21
-
22
- export function listPets(data?: ListPetsQueryResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Response | Promise<Response>)) {
23
- return http.get('/pets', function handler(info) {
24
- if (typeof data === 'function') return data(info)
25
-
26
- return new Response(JSON.stringify(data || listPetsQueryResponse(data)), {
27
- status: 200,
28
- headers: {
29
- 'Content-Type': 'application/json',
30
- },
31
- })
32
- })
33
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { http } from 'msw'
6
-
7
- export function listPetsResponse200(data: ListPetsQueryResponse) {
8
- return new Response(JSON.stringify(data), {
9
- status: 200,
10
- headers: {
11
- 'Content-Type': 'application/json',
12
- },
13
- })
14
- }
15
-
16
- export function listPetsResponse400(data?: ListPets400) {
17
- return new Response(JSON.stringify(data), {
18
- status: 400,
19
- })
20
- }
21
-
22
- export function listPets(data?: ListPetsQueryResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Response | Promise<Response>)) {
23
- return http.get(`${123456}/pets`, function handler(info) {
24
- if (typeof data === 'function') return data(info)
25
-
26
- return new Response(JSON.stringify(data), {
27
- status: 200,
28
- headers: {
29
- 'Content-Type': 'application/json',
30
- },
31
- })
32
- })
33
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { createPets, listPets, showPetById } from './findByTags'
6
-
7
- export const handlers = [listPets(), createPets(), showPetById()] as const
@@ -1,27 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { http } from 'msw'
6
-
7
- export function showPetByIdResponse200(data: ShowPetByIdQueryResponse) {
8
- return new Response(JSON.stringify(data), {
9
- status: 200,
10
- headers: {
11
- 'Content-Type': 'application/json',
12
- },
13
- })
14
- }
15
-
16
- export function showPetById(data?: ShowPetByIdQueryResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Response | Promise<Response>)) {
17
- return http.get(`/pets/:petId`, function handler(info) {
18
- if (typeof data === 'function') return data(info)
19
-
20
- return new Response(JSON.stringify(data), {
21
- status: 200,
22
- headers: {
23
- 'Content-Type': 'application/json',
24
- },
25
- })
26
- })
27
- }