@kubb/plugin-msw 4.20.3 → 4.20.5

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 { h as Operation, v as __name } from "./index-B4gKt7dm.cjs";
1
+ import { o as __name, r as Operation } from "./index-CXn68Ihb.cjs";
2
2
  import { FabricReactNode } from "@kubb/react-fabric/types";
3
3
 
4
4
  //#region src/components/Handlers.d.ts
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { h as Operation } from "./index-Cdqo2P0B.js";
2
+ import { r as Operation } from "./index-DquTBoXO.js";
3
3
  import { FabricReactNode } from "@kubb/react-fabric/types";
4
4
 
5
5
  //#region src/components/Handlers.d.ts
@@ -1,5 +1,5 @@
1
- import { v as __name } from "./index-B4gKt7dm.cjs";
2
- import { n as PluginMsw, r as ReactGenerator } from "./types-PRh0FjWU.cjs";
1
+ import { o as __name } from "./index-CXn68Ihb.cjs";
2
+ import { n as PluginMsw, r as ReactGenerator } from "./types-BgtusP5O.cjs";
3
3
 
4
4
  //#region src/generators/handlersGenerator.d.ts
5
5
  declare const handlersGenerator: ReactGenerator<PluginMsw>;
@@ -1,6 +1,6 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import "./index-Cdqo2P0B.js";
3
- import { n as PluginMsw, r as ReactGenerator } from "./types-DmVjB65n.js";
2
+ import "./index-DquTBoXO.js";
3
+ import { n as PluginMsw, r as ReactGenerator } from "./types-CkkTxIj4.js";
4
4
 
5
5
  //#region src/generators/handlersGenerator.d.ts
6
6
  declare const handlersGenerator: ReactGenerator<PluginMsw>;
@@ -0,0 +1,61 @@
1
+ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
2
+ import BaseOas from "oas";
3
+ import { Operation } from "oas/operation";
4
+ import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
5
+ import { Config } from "@kubb/core";
6
+
7
+ //#region rolldown:runtime
8
+ //#endregion
9
+ //#region ../oas/src/types.d.ts
10
+ type contentType = 'application/json' | (string & {});
11
+ type SchemaObject$1 = SchemaObject & {
12
+ 'x-nullable'?: boolean;
13
+ $ref?: string;
14
+ };
15
+ type HttpMethod = HttpMethods;
16
+ type Document = OASDocument;
17
+ type Operation$1 = Operation;
18
+ type DiscriminatorObject$1 = DiscriminatorObject;
19
+ //#endregion
20
+ //#region ../oas/src/Oas.d.ts
21
+ type OasOptions = {
22
+ contentType?: contentType;
23
+ discriminator?: 'strict' | 'inherit';
24
+ /**
25
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
26
+ * @default false
27
+ */
28
+ collisionDetection?: boolean;
29
+ };
30
+ declare class Oas extends BaseOas {
31
+ #private;
32
+ document: Document;
33
+ constructor(document: Document);
34
+ setOptions(options: OasOptions): void;
35
+ get options(): OasOptions;
36
+ get<T = unknown>($ref: string): T | null;
37
+ getKey($ref: string): string | undefined;
38
+ set($ref: string, value: unknown): false | undefined;
39
+ getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
40
+ dereferenceWithRef<T = unknown>(schema?: T): T;
41
+ getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
42
+ getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
43
+ getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
44
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
45
+ flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
46
+ /**
47
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
48
+ * Returns schemas in dependency order along with name mapping for collision resolution.
49
+ */
50
+ getSchemas(options?: {
51
+ contentType?: contentType;
52
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
53
+ collisionDetection?: boolean;
54
+ }): {
55
+ schemas: Record<string, SchemaObject$1>;
56
+ nameMapping: Map<string, string>;
57
+ };
58
+ }
59
+ //#endregion
60
+ export { contentType as a, SchemaObject$1 as i, HttpMethod as n, __name as o, Operation$1 as r, Oas as t };
61
+ //# sourceMappingURL=index-CXn68Ihb.d.cts.map
@@ -0,0 +1,60 @@
1
+ import { t as __name } from "./chunk-eQyhnF5A.js";
2
+ import { Config } from "@kubb/core";
3
+ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
4
+ import BaseOas from "oas";
5
+ import { Operation } from "oas/operation";
6
+ import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
7
+
8
+ //#region ../oas/src/types.d.ts
9
+ type contentType = 'application/json' | (string & {});
10
+ type SchemaObject$1 = SchemaObject & {
11
+ 'x-nullable'?: boolean;
12
+ $ref?: string;
13
+ };
14
+ type HttpMethod = HttpMethods;
15
+ type Document = OASDocument;
16
+ type Operation$1 = Operation;
17
+ type DiscriminatorObject$1 = DiscriminatorObject;
18
+ //#endregion
19
+ //#region ../oas/src/Oas.d.ts
20
+ type OasOptions = {
21
+ contentType?: contentType;
22
+ discriminator?: 'strict' | 'inherit';
23
+ /**
24
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
25
+ * @default false
26
+ */
27
+ collisionDetection?: boolean;
28
+ };
29
+ declare class Oas extends BaseOas {
30
+ #private;
31
+ document: Document;
32
+ constructor(document: Document);
33
+ setOptions(options: OasOptions): void;
34
+ get options(): OasOptions;
35
+ get<T = unknown>($ref: string): T | null;
36
+ getKey($ref: string): string | undefined;
37
+ set($ref: string, value: unknown): false | undefined;
38
+ getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
39
+ dereferenceWithRef<T = unknown>(schema?: T): T;
40
+ getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
41
+ getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
42
+ getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
43
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
44
+ flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
45
+ /**
46
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
47
+ * Returns schemas in dependency order along with name mapping for collision resolution.
48
+ */
49
+ getSchemas(options?: {
50
+ contentType?: contentType;
51
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
52
+ collisionDetection?: boolean;
53
+ }): {
54
+ schemas: Record<string, SchemaObject$1>;
55
+ nameMapping: Map<string, string>;
56
+ };
57
+ }
58
+ //#endregion
59
+ export { contentType as a, SchemaObject$1 as i, HttpMethod as n, Operation$1 as r, Oas as t };
60
+ //# sourceMappingURL=index-DquTBoXO.d.ts.map
package/dist/index.d.cts CHANGED
@@ -1,9 +1,10 @@
1
- import { l as UserPluginWithLifeCycle, v as __name } from "./index-B4gKt7dm.cjs";
2
- import { n as PluginMsw, t as Options } from "./types-PRh0FjWU.cjs";
1
+ import { o as __name } from "./index-CXn68Ihb.cjs";
2
+ import { n as PluginMsw, t as Options } from "./types-BgtusP5O.cjs";
3
+ import * as _kubb_core0 from "@kubb/core";
3
4
 
4
5
  //#region src/plugin.d.ts
5
6
  declare const pluginMswName = "plugin-msw";
6
- declare const pluginMsw: (options?: Options | undefined) => UserPluginWithLifeCycle<PluginMsw>;
7
+ declare const pluginMsw: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginMsw>;
7
8
  //#endregion
8
9
  export { type PluginMsw, pluginMsw, pluginMswName };
9
10
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { l as UserPluginWithLifeCycle } from "./index-Cdqo2P0B.js";
3
- import { n as PluginMsw, t as Options } from "./types-DmVjB65n.js";
2
+ import "./index-DquTBoXO.js";
3
+ import { n as PluginMsw, t as Options } from "./types-CkkTxIj4.js";
4
+ import * as _kubb_core0 from "@kubb/core";
4
5
 
5
6
  //#region src/plugin.d.ts
6
7
  declare const pluginMswName = "plugin-msw";
7
- declare const pluginMsw: (options?: Options | undefined) => UserPluginWithLifeCycle<PluginMsw>;
8
+ declare const pluginMsw: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginMsw>;
8
9
  //#endregion
9
10
  export { type PluginMsw, pluginMsw, pluginMswName };
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,36 @@
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";
1
+ import { a as contentType, i as SchemaObject, n as HttpMethod, o as __name, r as Operation, t as Oas } from "./index-CXn68Ihb.cjs";
2
2
  import { FabricReactNode } from "@kubb/react-fabric/types";
3
+ import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
3
4
  import { KubbFile } from "@kubb/fabric-core/types";
4
5
  import { Fabric } from "@kubb/react-fabric";
5
6
 
7
+ //#region ../core/src/utils/AsyncEventEmitter.d.ts
8
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
9
+ #private;
10
+ constructor(maxListener?: number);
11
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
12
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
13
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
14
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
15
+ removeAll(): void;
16
+ }
17
+ //#endregion
18
+ //#region ../core/src/types.d.ts
19
+ declare global {
20
+ namespace Kubb {
21
+ interface PluginContext {}
22
+ }
23
+ }
24
+ /**
25
+ * Config used in `kubb.config.ts`
26
+ *
27
+ * @example
28
+ * import { defineConfig } from '@kubb/core'
29
+ * export default defineConfig({
30
+ * ...
31
+ * })
32
+ */
33
+ //#endregion
6
34
  //#region ../plugin-oas/src/types.d.ts
7
35
  type GetOasOptions = {
8
36
  validate?: boolean;
@@ -97,7 +125,7 @@ type ByContentType = {
97
125
  type: 'contentType';
98
126
  pattern: string | RegExp;
99
127
  };
100
- type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
128
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
101
129
  type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
102
130
  type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
103
131
  options: Partial<TOptions>;
@@ -107,7 +135,7 @@ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaN
107
135
  type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
108
136
  fabric: Fabric;
109
137
  oas: Oas;
110
- exclude: Array<Exclude> | undefined;
138
+ exclude: Array<Exclude$1> | undefined;
111
139
  include: Array<Include> | undefined;
112
140
  override: Array<Override<TOptions>> | undefined;
113
141
  contentType: contentType | undefined;
@@ -481,7 +509,7 @@ type Options = {
481
509
  /**
482
510
  * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
483
511
  */
484
- exclude?: Array<Exclude>;
512
+ exclude?: Array<Exclude$1>;
485
513
  /**
486
514
  * Array containing include parameters to include tags/operations/methods/paths.
487
515
  */
@@ -522,4 +550,4 @@ type ResolvedOptions = {
522
550
  type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>;
523
551
  //#endregion
524
552
  export { PluginMsw as n, ReactGenerator as r, Options as t };
525
- //# sourceMappingURL=types-PRh0FjWU.d.cts.map
553
+ //# sourceMappingURL=types-BgtusP5O.d.cts.map
@@ -1,9 +1,37 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
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";
2
+ import { a as contentType, i as SchemaObject, n as HttpMethod, r as Operation, t as Oas } from "./index-DquTBoXO.js";
3
+ import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
3
4
  import { Fabric } from "@kubb/react-fabric";
4
5
  import { FabricReactNode } from "@kubb/react-fabric/types";
5
6
  import { KubbFile } from "@kubb/fabric-core/types";
6
7
 
8
+ //#region ../core/src/utils/AsyncEventEmitter.d.ts
9
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
10
+ #private;
11
+ constructor(maxListener?: number);
12
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
13
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
14
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
15
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
16
+ removeAll(): void;
17
+ }
18
+ //#endregion
19
+ //#region ../core/src/types.d.ts
20
+ declare global {
21
+ namespace Kubb {
22
+ interface PluginContext {}
23
+ }
24
+ }
25
+ /**
26
+ * Config used in `kubb.config.ts`
27
+ *
28
+ * @example
29
+ * import { defineConfig } from '@kubb/core'
30
+ * export default defineConfig({
31
+ * ...
32
+ * })
33
+ */
34
+ //#endregion
7
35
  //#region ../plugin-oas/src/types.d.ts
8
36
  type GetOasOptions = {
9
37
  validate?: boolean;
@@ -98,7 +126,7 @@ type ByContentType = {
98
126
  type: 'contentType';
99
127
  pattern: string | RegExp;
100
128
  };
101
- type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
129
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
102
130
  type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
103
131
  type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
104
132
  options: Partial<TOptions>;
@@ -108,7 +136,7 @@ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaN
108
136
  type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
109
137
  fabric: Fabric;
110
138
  oas: Oas;
111
- exclude: Array<Exclude> | undefined;
139
+ exclude: Array<Exclude$1> | undefined;
112
140
  include: Array<Include> | undefined;
113
141
  override: Array<Override<TOptions>> | undefined;
114
142
  contentType: contentType | undefined;
@@ -482,7 +510,7 @@ type Options = {
482
510
  /**
483
511
  * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
484
512
  */
485
- exclude?: Array<Exclude>;
513
+ exclude?: Array<Exclude$1>;
486
514
  /**
487
515
  * Array containing include parameters to include tags/operations/methods/paths.
488
516
  */
@@ -523,4 +551,4 @@ type ResolvedOptions = {
523
551
  type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>;
524
552
  //#endregion
525
553
  export { PluginMsw as n, ReactGenerator as r, Options as t };
526
- //# sourceMappingURL=types-DmVjB65n.d.ts.map
554
+ //# sourceMappingURL=types-CkkTxIj4.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-msw",
3
- "version": "4.20.3",
3
+ "version": "4.20.5",
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",
@@ -77,12 +77,12 @@
77
77
  }
78
78
  ],
79
79
  "dependencies": {
80
- "@kubb/react-fabric": "0.12.9",
81
- "@kubb/core": "4.20.3",
82
- "@kubb/plugin-faker": "4.20.3",
83
- "@kubb/plugin-oas": "4.20.3",
84
- "@kubb/oas": "4.20.3",
85
- "@kubb/plugin-ts": "4.20.3"
80
+ "@kubb/react-fabric": "0.12.10",
81
+ "@kubb/core": "4.20.5",
82
+ "@kubb/oas": "4.20.5",
83
+ "@kubb/plugin-faker": "4.20.5",
84
+ "@kubb/plugin-oas": "4.20.5",
85
+ "@kubb/plugin-ts": "4.20.5"
86
86
  },
87
87
  "devDependencies": {},
88
88
  "engines": {