@kubb/plugin-oas 4.1.3 → 4.2.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/README.md +16 -16
- package/dist/{Oas-CuqAnIw-.js → Oas-DoN76W2_.js} +2 -2
- package/dist/{Oas-CuqAnIw-.js.map → Oas-DoN76W2_.js.map} +1 -1
- package/dist/{OperationGenerator-B3oFps4I.d.ts → OperationGenerator-D9MJSd3H.d.ts} +78 -104
- package/dist/{OperationGenerator-aKcfGbOt.d.cts → OperationGenerator-DiPab7wp.d.cts} +78 -104
- package/dist/{Schema-DxWT5L8_.d.ts → Schema-DzjTOgNU.d.ts} +7 -8
- package/dist/{Schema-CEmdFRTN.d.cts → Schema-lFrS1u1u.d.cts} +7 -8
- package/dist/{SchemaGenerator-BQG5bN6q.cjs → SchemaGenerator-BQUPa5AD.cjs} +4 -4
- package/dist/SchemaGenerator-BQUPa5AD.cjs.map +1 -0
- package/dist/{SchemaGenerator-B0NuJl4f.js → SchemaGenerator-DYOXlswO.js} +7 -7
- package/dist/SchemaGenerator-DYOXlswO.js.map +1 -0
- package/dist/{SchemaMapper-BiagBQN4.d.cts → SchemaMapper-BWDIvdP9.d.ts} +2 -2
- package/dist/{SchemaMapper-C2J2d3o4.d.ts → SchemaMapper-BvE5JflR.d.cts} +2 -2
- package/dist/{SchemaMapper-BaZQKrQB.js → SchemaMapper-CqOUibvI.js} +2 -2
- package/dist/{SchemaMapper-BaZQKrQB.js.map → SchemaMapper-CqOUibvI.js.map} +1 -1
- package/dist/components.d.cts +7 -19
- package/dist/components.d.ts +7 -19
- package/dist/components.js +1 -1
- package/dist/{generators-CW7v1RgJ.js → generators-CC4tK-sV.js} +79 -64
- package/dist/generators-CC4tK-sV.js.map +1 -0
- package/dist/{generators-L3av7_7B.cjs → generators-DeiYqSf3.cjs} +75 -60
- package/dist/generators-DeiYqSf3.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/generators.js +3 -3
- package/dist/{getFooter-DM8B8cnC.js → getFooter-DrSj240h.js} +2 -2
- package/dist/{getFooter-DM8B8cnC.js.map → getFooter-DrSj240h.js.map} +1 -1
- package/dist/{getSchemas-WoSBIxG8.js → getSchemas-CvUX0jWa.js} +2 -2
- package/dist/{getSchemas-WoSBIxG8.js.map → getSchemas-CvUX0jWa.js.map} +1 -1
- package/dist/hooks.cjs +7 -3
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +3 -3
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +10 -7
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/dist/{parseFromConfig-DoynWlIk.js → parseFromConfig-DSI6Meg0.js} +2 -2
- package/dist/{parseFromConfig-DoynWlIk.js.map → parseFromConfig-DSI6Meg0.js.map} +1 -1
- package/dist/utils.d.cts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +3 -3
- package/package.json +6 -8
- package/src/generator.tsx +50 -43
- package/src/hooks/useOperationManager.ts +5 -6
- package/src/hooks/useSchemaManager.ts +3 -3
- package/dist/SchemaGenerator-B0NuJl4f.js.map +0 -1
- package/dist/SchemaGenerator-BQG5bN6q.cjs.map +0 -1
- package/dist/generators-CW7v1RgJ.js.map +0 -1
- package/dist/generators-L3av7_7B.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
+
<h1>Plugin Oas</h1>
|
|
3
|
+
<a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
|
|
4
|
+
<img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
|
|
5
|
+
</a>
|
|
2
6
|
|
|
3
|
-
<!-- <img src="assets/logo.png" alt="logo" width="200" height="auto" /> -->
|
|
4
|
-
<h1>@kubb/plugin-oas</h1>
|
|
5
|
-
|
|
6
|
-
<p>
|
|
7
|
-
Swagger package.
|
|
8
|
-
</p>
|
|
9
|
-
<img src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/banner.png" alt="logo" height="auto" />
|
|
10
7
|
|
|
11
8
|
[![npm version][npm-version-src]][npm-version-href]
|
|
12
9
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
13
10
|
[![Coverage][coverage-src]][coverage-href]
|
|
14
11
|
[![License][license-src]][license-href]
|
|
15
|
-
|
|
12
|
+
[![Sponsors][sponsors-src]][sponsors-href]
|
|
16
13
|
<h4>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
<a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
|
|
15
|
+
<span> · </span>
|
|
16
|
+
<a href="https://kubb.dev/" target="_blank">Documentation</a>
|
|
17
|
+
<span> · </span>
|
|
18
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
|
|
19
|
+
<span> · </span>
|
|
20
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
|
|
21
|
+
</h4>
|
|
25
22
|
</div>
|
|
26
23
|
|
|
24
|
+
|
|
27
25
|
## Supporting Kubb
|
|
28
26
|
|
|
29
27
|
Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
|
|
@@ -51,3 +49,5 @@ Kubb uses an MIT-licensed open source project with its ongoing development made
|
|
|
51
49
|
[minified-href]: https://www.npmjs.com/package/@kubb/plugin-oas
|
|
52
50
|
[coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
|
|
53
51
|
[coverage-href]: https://www.npmjs.com/package/@kubb/plugin-oas
|
|
52
|
+
[sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
|
|
53
|
+
[sponsors-href]: https://github.com/sponsors/stijnvanhulle/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Oas-
|
|
1
|
+
{"version":3,"file":"Oas-DoN76W2_.js","names":[],"sources":["../src/components/Operation.tsx","../src/components/Schema.tsx","../src/components/Oas.tsx"],"sourcesContent":["import type { Operation as OperationType } from '@kubb/oas'\nimport { createContext } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\n\ntype Props = {\n operation: OperationType\n children?: KubbNode\n}\n\ntype OperationContextProps = {\n operation?: OperationType\n}\n\nconst OperationContext = createContext<OperationContextProps>({})\n\nexport function Operation({ operation, children }: Props) {\n return <OperationContext.Provider value={{ operation }}>{children}</OperationContext.Provider>\n}\n\nOperation.Context = OperationContext\n","import { createContext } from '@kubb/react'\n\nimport type { SchemaObject } from '@kubb/oas'\nimport type { Key, KubbNode } from '@kubb/react/types'\nimport type { Schema as SchemaType } from '../SchemaMapper.ts'\n\nexport type SchemaContextProps = {\n name: string\n schemaObject?: SchemaObject\n tree: Array<SchemaType>\n}\n\ntype Props = {\n key?: Key\n name: string\n schemaObject?: SchemaObject\n tree?: Array<SchemaType>\n children?: KubbNode\n}\n\nconst SchemaContext = createContext<SchemaContextProps>({\n name: 'unknown',\n tree: [],\n})\n\n/**\n * Provides schema-related context to descendant components.\n *\n * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.\n *\n * @param name - The name of the schema.\n * @param schemaObject - The schema object to provide in context, if available.\n * @param tree - An array representing the schema type hierarchy.\n */\nexport function Schema({ name, schemaObject, tree = [], children }: Props) {\n return <SchemaContext.Provider value={{ name, schemaObject, tree }}>{children}</SchemaContext.Provider>\n}\n\nSchema.Context = SchemaContext\n","import { createContext } from '@kubb/react'\n\nimport { Operation } from './Operation.tsx'\nimport { Schema } from './Schema.tsx'\n\nimport type { Oas as OasType, Operation as OperationType } from '@kubb/oas'\nimport type { KubbNode } from '@kubb/react/types'\nimport type { OperationGenerator } from '../OperationGenerator.ts'\n\ntype Props = {\n oas: OasType\n operations?: OperationType[]\n /**\n * @deprecated\n */\n generator?: Omit<OperationGenerator, 'build'>\n children?: KubbNode\n}\n\ntype OasContextProps = {\n oas?: OasType\n operations?: OperationType[]\n /**\n * @deprecated\n */\n generator?: Omit<OperationGenerator, 'build'>\n}\n\nconst OasContext = createContext<OasContextProps>({})\n\nexport function Oas({ oas, children, operations, generator }: Props) {\n return <OasContext.Provider value={{ oas, generator, operations }}>{children}</OasContext.Provider>\n}\n\nOas.Context = OasContext\nOas.Operation = Operation\nOas.Schema = Schema\n"],"mappings":";;;;AAaA,MAAM,mBAAmB,cAAqC,EAAE,CAAC;AAEjE,SAAgB,UAAU,EAAE,WAAW,YAAmB;AACxD,QAAO,oBAAC,iBAAiB;EAAS,OAAO,EAAE,WAAW;EAAG;GAAqC;;AAGhG,UAAU,UAAU;;;;ACCpB,MAAM,gBAAgB,cAAkC;CACtD,MAAM;CACN,MAAM,EAAE;CACT,CAAC;;;;;;;;;;AAWF,SAAgB,OAAO,EAAE,MAAM,cAAc,OAAO,EAAE,EAAE,YAAmB;AACzE,QAAO,oBAAC,cAAc;EAAS,OAAO;GAAE;GAAM;GAAc;GAAM;EAAG;GAAkC;;AAGzG,OAAO,UAAU;;;;ACVjB,MAAM,aAAa,cAA+B,EAAE,CAAC;AAErD,SAAgB,IAAI,EAAE,KAAK,UAAU,YAAY,aAAoB;AACnE,QAAO,oBAAC,WAAW;EAAS,OAAO;GAAE;GAAK;GAAW;GAAY;EAAG;GAA+B;;AAGrG,IAAI,UAAU;AACd,IAAI,YAAY;AAChB,IAAI,SAAS"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Key, ReactNode } from "react";
|
|
1
|
+
import { d as File, g as ResolvedFile, h as Path, i as SchemaKeywordMapper, l as BaseName, m as OptionalPath, p as Mode, t as Schema, u as Extname } from "./SchemaMapper-BWDIvdP9.js";
|
|
3
2
|
import * as OasTypes from "oas/types";
|
|
4
3
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
5
4
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -8,6 +7,8 @@ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
|
8
7
|
import BaseOas from "oas";
|
|
9
8
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
9
|
|
|
10
|
+
//#region rolldown:runtime
|
|
11
|
+
//#endregion
|
|
11
12
|
//#region ../oas/src/types.d.ts
|
|
12
13
|
type contentType = 'application/json' | (string & {});
|
|
13
14
|
type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
@@ -42,46 +43,19 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
42
43
|
getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
|
|
43
44
|
valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
-
//#region ../react/src/utils/getFunctionParams.d.ts
|
|
47
|
-
type Param = {
|
|
48
|
-
/**
|
|
49
|
-
* `object` will return the pathParams as an object.
|
|
50
|
-
*
|
|
51
|
-
* `inline` will return the pathParams as comma separated params.
|
|
52
|
-
* @default `'inline'`
|
|
53
|
-
* @private
|
|
54
|
-
*/
|
|
55
|
-
mode?: 'object' | 'inline' | 'inlineSpread';
|
|
56
|
-
type?: 'string' | 'number' | (string & {});
|
|
57
|
-
optional?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* @example test = "default"
|
|
60
|
-
*/
|
|
61
|
-
default?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Used for no TypeScript(with mode object)
|
|
64
|
-
* @example test: "default"
|
|
65
|
-
*/
|
|
66
|
-
value?: string;
|
|
67
|
-
children?: Params;
|
|
68
|
-
};
|
|
69
|
-
type Params = Record<string, Param | undefined>;
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region ../react/src/types.d.ts
|
|
72
|
-
type KubbNode = ReactNode;
|
|
46
|
+
import * as import___kubb_react_fabric_types from "@kubb/react-fabric/types";
|
|
73
47
|
//#endregion
|
|
74
48
|
//#region ../core/src/BaseGenerator.d.ts
|
|
75
49
|
/**
|
|
76
50
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
77
51
|
* @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
|
|
78
52
|
*/
|
|
79
|
-
declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
53
|
+
declare abstract class BaseGenerator<TOptions$1 = unknown, TContext = unknown> {
|
|
80
54
|
#private;
|
|
81
|
-
constructor(options?: TOptions, context?: TContext);
|
|
82
|
-
get options(): TOptions;
|
|
55
|
+
constructor(options?: TOptions$1, context?: TContext);
|
|
56
|
+
get options(): TOptions$1;
|
|
83
57
|
get context(): TContext;
|
|
84
|
-
set options(options: TOptions);
|
|
58
|
+
set options(options: TOptions$1);
|
|
85
59
|
abstract build(...params: unknown[]): unknown;
|
|
86
60
|
}
|
|
87
61
|
//#endregion
|
|
@@ -134,9 +108,9 @@ type Logger = {
|
|
|
134
108
|
};
|
|
135
109
|
//#endregion
|
|
136
110
|
//#region ../core/src/utils/types.d.ts
|
|
137
|
-
type PossiblePromise<T> = Promise<T> | T;
|
|
138
|
-
type ArrayWithLength<T extends number, U extends any[] = []> = U['length'] extends T ? U : ArrayWithLength<T, [true, ...U]>;
|
|
139
|
-
type GreaterThan<T extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T>, ...infer _] ? false : true;
|
|
111
|
+
type PossiblePromise<T$1> = Promise<T$1> | T$1;
|
|
112
|
+
type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
|
|
113
|
+
type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
|
|
140
114
|
//#endregion
|
|
141
115
|
//#region ../core/src/types.d.ts
|
|
142
116
|
type InputPath = {
|
|
@@ -249,11 +223,11 @@ TName extends string = string,
|
|
|
249
223
|
/**
|
|
250
224
|
* Options of the plugin.
|
|
251
225
|
*/
|
|
252
|
-
TOptions extends object = object,
|
|
226
|
+
TOptions$1 extends object = object,
|
|
253
227
|
/**
|
|
254
228
|
* Options of the plugin that can be used later on, see `options` inside your plugin config.
|
|
255
229
|
*/
|
|
256
|
-
TResolvedOptions extends object = TOptions,
|
|
230
|
+
TResolvedOptions extends object = TOptions$1,
|
|
257
231
|
/**
|
|
258
232
|
* Context that you want to expose to other plugins.
|
|
259
233
|
*/
|
|
@@ -267,23 +241,23 @@ TResolvePathOptions extends object = object> = {
|
|
|
267
241
|
* Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
268
242
|
*/
|
|
269
243
|
key: PluginKey<TName | string>;
|
|
270
|
-
options: TOptions;
|
|
244
|
+
options: TOptions$1;
|
|
271
245
|
resolvedOptions: TResolvedOptions;
|
|
272
246
|
context: TContext;
|
|
273
247
|
resolvePathOptions: TResolvePathOptions;
|
|
274
248
|
};
|
|
275
249
|
type PluginKey<TName> = [name: TName, identifier?: string | number];
|
|
276
|
-
type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
250
|
+
type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
277
251
|
/**
|
|
278
252
|
* Unique name used for the plugin
|
|
279
253
|
* The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
|
|
280
254
|
* @example @kubb/typescript
|
|
281
255
|
*/
|
|
282
|
-
name: TOptions['name'];
|
|
256
|
+
name: TOptions$1['name'];
|
|
283
257
|
/**
|
|
284
258
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
285
259
|
*/
|
|
286
|
-
options: TOptions['resolvedOptions'];
|
|
260
|
+
options: TOptions$1['resolvedOptions'];
|
|
287
261
|
/**
|
|
288
262
|
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
|
|
289
263
|
* Can be used to validate dependent plugins.
|
|
@@ -293,23 +267,23 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
293
267
|
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
|
|
294
268
|
*/
|
|
295
269
|
post?: Array<string>;
|
|
296
|
-
} & (TOptions['context'] extends never ? {
|
|
270
|
+
} & (TOptions$1['context'] extends never ? {
|
|
297
271
|
context?: never;
|
|
298
272
|
} : {
|
|
299
|
-
context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
|
|
273
|
+
context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
|
|
300
274
|
});
|
|
301
|
-
type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
|
|
302
|
-
type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
275
|
+
type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
|
|
276
|
+
type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
303
277
|
/**
|
|
304
278
|
* Unique name used for the plugin
|
|
305
279
|
* @example @kubb/typescript
|
|
306
280
|
*/
|
|
307
|
-
name: TOptions['name'];
|
|
281
|
+
name: TOptions$1['name'];
|
|
308
282
|
/**
|
|
309
283
|
* Internal key used when a developer uses more than one of the same plugin
|
|
310
284
|
* @private
|
|
311
285
|
*/
|
|
312
|
-
key: TOptions['key'];
|
|
286
|
+
key: TOptions$1['key'];
|
|
313
287
|
/**
|
|
314
288
|
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
|
|
315
289
|
* Can be used to validate dependent plugins.
|
|
@@ -322,49 +296,49 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
322
296
|
/**
|
|
323
297
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
324
298
|
*/
|
|
325
|
-
options: TOptions['resolvedOptions'];
|
|
326
|
-
} & (TOptions['context'] extends never ? {
|
|
299
|
+
options: TOptions$1['resolvedOptions'];
|
|
300
|
+
} & (TOptions$1['context'] extends never ? {
|
|
327
301
|
context?: never;
|
|
328
302
|
} : {
|
|
329
|
-
context: TOptions['context'];
|
|
303
|
+
context: TOptions$1['context'];
|
|
330
304
|
});
|
|
331
|
-
type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
|
|
332
|
-
type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
305
|
+
type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
|
|
306
|
+
type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
333
307
|
/**
|
|
334
308
|
* Start of the lifecycle of a plugin.
|
|
335
309
|
* @type hookParallel
|
|
336
310
|
*/
|
|
337
|
-
buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
|
|
311
|
+
buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
|
|
338
312
|
/**
|
|
339
313
|
* Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
|
|
340
314
|
* Options can als be included.
|
|
341
315
|
* @type hookFirst
|
|
342
316
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
343
317
|
*/
|
|
344
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
318
|
+
resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
|
|
345
319
|
/**
|
|
346
320
|
* Resolve to a name based on a string.
|
|
347
321
|
* Useful when converting to PascalCase or camelCase.
|
|
348
322
|
* @type hookFirst
|
|
349
323
|
* @example ('pet') => 'Pet'
|
|
350
324
|
*/
|
|
351
|
-
resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
325
|
+
resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
352
326
|
/**
|
|
353
327
|
* End of the plugin lifecycle.
|
|
354
328
|
* @type hookParallel
|
|
355
329
|
*/
|
|
356
|
-
buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
|
|
330
|
+
buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
|
|
357
331
|
};
|
|
358
332
|
type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
359
|
-
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
360
|
-
type ResolvePathParams<TOptions = object> = {
|
|
333
|
+
type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
|
|
334
|
+
type ResolvePathParams<TOptions$1 = object> = {
|
|
361
335
|
pluginKey?: Plugin['key'];
|
|
362
336
|
baseName: BaseName;
|
|
363
337
|
mode?: Mode;
|
|
364
338
|
/**
|
|
365
339
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
366
340
|
*/
|
|
367
|
-
options?: TOptions;
|
|
341
|
+
options?: TOptions$1;
|
|
368
342
|
};
|
|
369
343
|
type ResolveNameParams = {
|
|
370
344
|
name: string;
|
|
@@ -377,12 +351,12 @@ type ResolveNameParams = {
|
|
|
377
351
|
*/
|
|
378
352
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
379
353
|
};
|
|
380
|
-
type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
354
|
+
type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
381
355
|
config: Config;
|
|
382
356
|
fileManager: FileManager;
|
|
383
357
|
pluginManager: PluginManager;
|
|
384
358
|
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
385
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
359
|
+
resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
|
|
386
360
|
resolveName: (params: ResolveNameParams) => string;
|
|
387
361
|
logger: Logger;
|
|
388
362
|
/**
|
|
@@ -392,12 +366,12 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
392
366
|
/**
|
|
393
367
|
* Current plugin
|
|
394
368
|
*/
|
|
395
|
-
plugin: Plugin<TOptions>;
|
|
369
|
+
plugin: Plugin<TOptions$1>;
|
|
396
370
|
};
|
|
397
371
|
/**
|
|
398
372
|
* Specify the export location for the files and define the behavior of the output
|
|
399
373
|
*/
|
|
400
|
-
type Output<TOptions> = {
|
|
374
|
+
type Output<TOptions$1> = {
|
|
401
375
|
/**
|
|
402
376
|
* Path to the output folder or file that will contain the generated code
|
|
403
377
|
*/
|
|
@@ -410,11 +384,11 @@ type Output<TOptions> = {
|
|
|
410
384
|
/**
|
|
411
385
|
* Add a banner text in the beginning of every file
|
|
412
386
|
*/
|
|
413
|
-
banner?: string | ((options: TOptions) => string);
|
|
387
|
+
banner?: string | ((options: TOptions$1) => string);
|
|
414
388
|
/**
|
|
415
389
|
* Add a footer text in the beginning of every file
|
|
416
390
|
*/
|
|
417
|
-
footer?: string | ((options: TOptions) => string);
|
|
391
|
+
footer?: string | ((options: TOptions$1) => string);
|
|
418
392
|
};
|
|
419
393
|
type GroupContext = {
|
|
420
394
|
group: string;
|
|
@@ -434,7 +408,7 @@ type Group = {
|
|
|
434
408
|
type FileMetaBase = {
|
|
435
409
|
pluginKey?: Plugin['key'];
|
|
436
410
|
};
|
|
437
|
-
type AddResult<T extends Array<File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
|
|
411
|
+
type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
|
|
438
412
|
type AddIndexesProps = {
|
|
439
413
|
type: BarrelType | false | undefined;
|
|
440
414
|
/**
|
|
@@ -487,16 +461,16 @@ declare class FileManager {
|
|
|
487
461
|
//#region ../core/src/PluginManager.d.ts
|
|
488
462
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
489
463
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
490
|
-
type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
464
|
+
type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
491
465
|
message: string;
|
|
492
466
|
strategy: Strategy;
|
|
493
|
-
hookName: H;
|
|
467
|
+
hookName: H$1;
|
|
494
468
|
plugin: Plugin;
|
|
495
469
|
parameters?: unknown[] | undefined;
|
|
496
470
|
output?: unknown;
|
|
497
471
|
};
|
|
498
|
-
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
499
|
-
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
472
|
+
type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
|
|
473
|
+
type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
|
|
500
474
|
result: Result;
|
|
501
475
|
plugin: Plugin;
|
|
502
476
|
};
|
|
@@ -512,12 +486,12 @@ type Events = {
|
|
|
512
486
|
executed: [executer: Executer];
|
|
513
487
|
error: [error: Error];
|
|
514
488
|
};
|
|
515
|
-
type GetFileProps<TOptions = object> = {
|
|
489
|
+
type GetFileProps<TOptions$1 = object> = {
|
|
516
490
|
name: string;
|
|
517
491
|
mode?: Mode;
|
|
518
492
|
extname: Extname;
|
|
519
493
|
pluginKey: Plugin['key'];
|
|
520
|
-
options?: TOptions;
|
|
494
|
+
options?: TOptions$1;
|
|
521
495
|
};
|
|
522
496
|
declare class PluginManager {
|
|
523
497
|
#private;
|
|
@@ -774,8 +748,8 @@ type ByContentType = {
|
|
|
774
748
|
};
|
|
775
749
|
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
776
750
|
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
777
|
-
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
778
|
-
options: Partial<TOptions>;
|
|
751
|
+
type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
752
|
+
options: Partial<TOptions$1>;
|
|
779
753
|
};
|
|
780
754
|
type ResolvedOptions = Options$1 & {
|
|
781
755
|
output: Output<Oas>;
|
|
@@ -783,9 +757,9 @@ type ResolvedOptions = Options$1 & {
|
|
|
783
757
|
type PluginOas = PluginFactoryOptions<'plugin-oas', Options$1, ResolvedOptions, API, ResolvePathOptions>;
|
|
784
758
|
//#endregion
|
|
785
759
|
//#region src/SchemaGenerator.d.ts
|
|
786
|
-
type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
760
|
+
type GetSchemaGeneratorOptions<T$1 extends SchemaGenerator<any, any, any>> = T$1 extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
787
761
|
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<File<TFileMeta> | Array<File<TFileMeta>> | null>;
|
|
788
|
-
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
762
|
+
type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
|
|
789
763
|
oas: Oas;
|
|
790
764
|
pluginManager: PluginManager;
|
|
791
765
|
/**
|
|
@@ -794,7 +768,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
794
768
|
plugin: Plugin<TPluginOptions>;
|
|
795
769
|
mode: Mode;
|
|
796
770
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
797
|
-
override: Array<Override<TOptions>> | undefined;
|
|
771
|
+
override: Array<Override<TOptions$1>> | undefined;
|
|
798
772
|
contentType?: contentType;
|
|
799
773
|
output?: string;
|
|
800
774
|
};
|
|
@@ -826,7 +800,7 @@ type SchemaProps$1 = {
|
|
|
826
800
|
name?: string;
|
|
827
801
|
parentName?: string;
|
|
828
802
|
};
|
|
829
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
|
|
803
|
+
declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions$1, Context$1<TOptions$1, TPluginOptions>> {
|
|
830
804
|
#private;
|
|
831
805
|
refs: Refs;
|
|
832
806
|
/**
|
|
@@ -845,38 +819,38 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
845
819
|
}
|
|
846
820
|
//#endregion
|
|
847
821
|
//#region src/generator.d.ts
|
|
848
|
-
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
849
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
850
|
-
options: TOptions['resolvedOptions'];
|
|
822
|
+
type OperationsProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
823
|
+
instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
|
|
824
|
+
options: TOptions$1['resolvedOptions'];
|
|
851
825
|
operations: Array<Operation$1>;
|
|
852
826
|
};
|
|
853
|
-
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
854
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
855
|
-
options: TOptions['resolvedOptions'];
|
|
827
|
+
type OperationProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
828
|
+
instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
|
|
829
|
+
options: TOptions$1['resolvedOptions'];
|
|
856
830
|
operation: Operation$1;
|
|
857
831
|
};
|
|
858
|
-
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
859
|
-
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
860
|
-
options: TOptions['resolvedOptions'];
|
|
832
|
+
type SchemaProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
833
|
+
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions$1>, 'build'>;
|
|
834
|
+
options: TOptions$1['resolvedOptions'];
|
|
861
835
|
schema: {
|
|
862
836
|
name: string;
|
|
863
837
|
tree: Array<Schema>;
|
|
864
838
|
value: SchemaObject$1;
|
|
865
839
|
};
|
|
866
840
|
};
|
|
867
|
-
type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
841
|
+
type GeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
|
|
868
842
|
name: string;
|
|
869
|
-
operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<File[]>;
|
|
870
|
-
operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<File[]>;
|
|
871
|
-
schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<File[]>;
|
|
843
|
+
operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
|
|
844
|
+
operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
|
|
845
|
+
schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
|
|
872
846
|
};
|
|
873
|
-
type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>;
|
|
874
|
-
declare function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions>;
|
|
875
|
-
type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
847
|
+
type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
|
|
848
|
+
declare function createGenerator<TOptions$1 extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions$1>): Generator<TOptions$1>;
|
|
849
|
+
type ReactGeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
|
|
876
850
|
name: string;
|
|
877
|
-
Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode;
|
|
878
|
-
Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode;
|
|
879
|
-
Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode;
|
|
851
|
+
Operations?: (this: ReactGeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => types_d_exports$1.KubbNode;
|
|
852
|
+
Operation?: (this: ReactGeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => types_d_exports$1.KubbNode;
|
|
853
|
+
Schema?: (this: ReactGeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => types_d_exports$1.KubbNode;
|
|
880
854
|
};
|
|
881
855
|
/****
|
|
882
856
|
* Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
|
|
@@ -885,15 +859,15 @@ type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
|
885
859
|
*
|
|
886
860
|
* @returns A generator object with async methods for operations, operation, and schema file generation.
|
|
887
861
|
*/
|
|
888
|
-
declare function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions>;
|
|
862
|
+
declare function createReactGenerator<TOptions$1 extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions$1>): Generator<TOptions$1>;
|
|
889
863
|
//#endregion
|
|
890
864
|
//#region src/OperationGenerator.d.ts
|
|
891
865
|
type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<File<TFileMeta> | Array<File<TFileMeta>> | null>;
|
|
892
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
866
|
+
type Context<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
|
|
893
867
|
oas: Oas;
|
|
894
868
|
exclude: Array<Exclude$1> | undefined;
|
|
895
869
|
include: Array<Include> | undefined;
|
|
896
|
-
override: Array<Override<TOptions>> | undefined;
|
|
870
|
+
override: Array<Override<TOptions$1>> | undefined;
|
|
897
871
|
contentType: contentType | undefined;
|
|
898
872
|
pluginManager: PluginManager;
|
|
899
873
|
/**
|
|
@@ -917,5 +891,5 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
917
891
|
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
918
892
|
}
|
|
919
893
|
//#endregion
|
|
920
|
-
export {
|
|
921
|
-
//# sourceMappingURL=OperationGenerator-
|
|
894
|
+
export { UserPluginWithLifeCycle as A, ResolvePathOptions as C, Output as D, Config as E, OpenAPIV3$1 as F, OpenAPIV3_1 as I, Operation$1 as L, Oas as M, HttpMethod as N, Plugin as O, OasTypes as P, SchemaObject$1 as R, Refs as S, FileMetaBase as T, OperationSchemas as _, ReactGeneratorOptions as a, PluginOas as b, GetSchemaGeneratorOptions as c, SchemaGeneratorOptions as d, SchemaMethodResult as f, OperationSchema as g, Include as h, GeneratorOptions as i, types_d_exports$1 as j, ResolveNameParams as k, SchemaGenerator as l, Exclude$1 as m, OperationMethodResult as n, createGenerator as o, API as p, Generator as r, createReactGenerator as s, OperationGenerator as t, SchemaGeneratorBuildOptions as u, Options$1 as v, Resolver as w, Ref as x, Override as y, contentType as z };
|
|
895
|
+
//# sourceMappingURL=OperationGenerator-D9MJSd3H.d.ts.map
|