@kubb/plugin-oas 4.1.4 → 4.2.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/{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-BeVo1_b1.d.cts} +87 -157
- package/dist/{OperationGenerator-aKcfGbOt.d.cts → OperationGenerator-CUE372Ht.d.ts} +87 -157
- package/dist/{Schema-DxWT5L8_.d.ts → Schema-BPvUCUWJ.d.ts} +7 -8
- package/dist/{Schema-CEmdFRTN.d.cts → Schema-D-wz873C.d.cts} +7 -8
- package/dist/{SchemaGenerator-Dnllsi8M.cjs → SchemaGenerator-BQUPa5AD.cjs} +2 -3
- package/dist/{SchemaGenerator-Dnllsi8M.cjs.map → SchemaGenerator-BQUPa5AD.cjs.map} +1 -1
- package/dist/{SchemaGenerator-TL2a9FN6.js → SchemaGenerator-DYOXlswO.js} +5 -6
- package/dist/{SchemaGenerator-TL2a9FN6.js.map → SchemaGenerator-DYOXlswO.js.map} +1 -1
- 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-L3av7_7B.cjs → generators-BIyNritE.cjs} +76 -61
- package/dist/generators-BIyNritE.cjs.map +1 -0
- package/dist/{generators-CW7v1RgJ.js → generators-CJBwMPUb.js} +79 -64
- package/dist/generators-CJBwMPUb.js.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/generators.js +3 -3
- package/dist/getFooter-CvTKkK7-.js +58 -0
- package/dist/getFooter-CvTKkK7-.js.map +1 -0
- package/dist/getFooter-pQXwqM81.cjs +72 -0
- package/dist/getFooter-pQXwqM81.cjs.map +1 -0
- 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 +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/dist/{parseFromConfig-yAiFK03V.js → parseFromConfig-DSI6Meg0.js} +5 -10
- package/dist/parseFromConfig-DSI6Meg0.js.map +1 -0
- package/dist/{parseFromConfig-CFzprC8B.cjs → parseFromConfig-o3tU1XJt.cjs} +4 -9
- package/dist/parseFromConfig-o3tU1XJt.cjs.map +1 -0
- package/dist/utils.cjs +2 -2
- package/dist/utils.d.cts +6 -9
- package/dist/utils.d.ts +6 -9
- package/dist/utils.js +3 -3
- package/package.json +5 -7
- package/src/generator.tsx +50 -43
- package/src/hooks/useOperationManager.ts +5 -6
- package/src/hooks/useSchemaManager.ts +3 -3
- package/src/plugin.ts +2 -3
- package/src/utils/getBanner.ts +47 -1
- package/dist/generators-CW7v1RgJ.js.map +0 -1
- package/dist/generators-L3av7_7B.cjs.map +0 -1
- package/dist/getFooter-B_nmsoeK.cjs +0 -45
- package/dist/getFooter-B_nmsoeK.cjs.map +0 -1
- package/dist/getFooter-DM8B8cnC.js +0 -31
- package/dist/getFooter-DM8B8cnC.js.map +0 -1
- package/dist/parseFromConfig-CFzprC8B.cjs.map +0 -1
- package/dist/parseFromConfig-yAiFK03V.js.map +0 -1
|
@@ -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-BvE5JflR.cjs";
|
|
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";
|
|
@@ -7,7 +6,10 @@ import { OpenAPIV3, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1 } from "openapi-types"
|
|
|
7
6
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
8
7
|
import BaseOas from "oas";
|
|
9
8
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
9
|
+
import { FileManager } from "@kubb/fabric-core";
|
|
10
10
|
|
|
11
|
+
//#region rolldown:runtime
|
|
12
|
+
//#endregion
|
|
11
13
|
//#region ../oas/src/types.d.ts
|
|
12
14
|
type contentType = 'application/json' | (string & {});
|
|
13
15
|
type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
@@ -42,46 +44,19 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
42
44
|
getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
|
|
43
45
|
valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
44
46
|
}
|
|
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;
|
|
47
|
+
import * as import___kubb_react_fabric_types from "@kubb/react-fabric/types";
|
|
73
48
|
//#endregion
|
|
74
49
|
//#region ../core/src/BaseGenerator.d.ts
|
|
75
50
|
/**
|
|
76
51
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
77
52
|
* @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
|
|
78
53
|
*/
|
|
79
|
-
declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
54
|
+
declare abstract class BaseGenerator<TOptions$1 = unknown, TContext = unknown> {
|
|
80
55
|
#private;
|
|
81
|
-
constructor(options?: TOptions, context?: TContext);
|
|
82
|
-
get options(): TOptions;
|
|
56
|
+
constructor(options?: TOptions$1, context?: TContext);
|
|
57
|
+
get options(): TOptions$1;
|
|
83
58
|
get context(): TContext;
|
|
84
|
-
set options(options: TOptions);
|
|
59
|
+
set options(options: TOptions$1);
|
|
85
60
|
abstract build(...params: unknown[]): unknown;
|
|
86
61
|
}
|
|
87
62
|
//#endregion
|
|
@@ -134,9 +109,7 @@ type Logger = {
|
|
|
134
109
|
};
|
|
135
110
|
//#endregion
|
|
136
111
|
//#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;
|
|
112
|
+
type PossiblePromise<T$1> = Promise<T$1> | T$1;
|
|
140
113
|
//#endregion
|
|
141
114
|
//#region ../core/src/types.d.ts
|
|
142
115
|
type InputPath = {
|
|
@@ -249,11 +222,11 @@ TName extends string = string,
|
|
|
249
222
|
/**
|
|
250
223
|
* Options of the plugin.
|
|
251
224
|
*/
|
|
252
|
-
TOptions extends object = object,
|
|
225
|
+
TOptions$1 extends object = object,
|
|
253
226
|
/**
|
|
254
227
|
* Options of the plugin that can be used later on, see `options` inside your plugin config.
|
|
255
228
|
*/
|
|
256
|
-
TResolvedOptions extends object = TOptions,
|
|
229
|
+
TResolvedOptions extends object = TOptions$1,
|
|
257
230
|
/**
|
|
258
231
|
* Context that you want to expose to other plugins.
|
|
259
232
|
*/
|
|
@@ -267,23 +240,23 @@ TResolvePathOptions extends object = object> = {
|
|
|
267
240
|
* Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
268
241
|
*/
|
|
269
242
|
key: PluginKey<TName | string>;
|
|
270
|
-
options: TOptions;
|
|
243
|
+
options: TOptions$1;
|
|
271
244
|
resolvedOptions: TResolvedOptions;
|
|
272
245
|
context: TContext;
|
|
273
246
|
resolvePathOptions: TResolvePathOptions;
|
|
274
247
|
};
|
|
275
248
|
type PluginKey<TName> = [name: TName, identifier?: string | number];
|
|
276
|
-
type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
249
|
+
type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
277
250
|
/**
|
|
278
251
|
* Unique name used for the plugin
|
|
279
252
|
* The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
|
|
280
253
|
* @example @kubb/typescript
|
|
281
254
|
*/
|
|
282
|
-
name: TOptions['name'];
|
|
255
|
+
name: TOptions$1['name'];
|
|
283
256
|
/**
|
|
284
257
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
285
258
|
*/
|
|
286
|
-
options: TOptions['resolvedOptions'];
|
|
259
|
+
options: TOptions$1['resolvedOptions'];
|
|
287
260
|
/**
|
|
288
261
|
* 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
262
|
* Can be used to validate dependent plugins.
|
|
@@ -293,23 +266,23 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
293
266
|
* 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
267
|
*/
|
|
295
268
|
post?: Array<string>;
|
|
296
|
-
} & (TOptions['context'] extends never ? {
|
|
269
|
+
} & (TOptions$1['context'] extends never ? {
|
|
297
270
|
context?: never;
|
|
298
271
|
} : {
|
|
299
|
-
context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
|
|
272
|
+
context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
|
|
300
273
|
});
|
|
301
|
-
type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
|
|
302
|
-
type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
274
|
+
type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
|
|
275
|
+
type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
303
276
|
/**
|
|
304
277
|
* Unique name used for the plugin
|
|
305
278
|
* @example @kubb/typescript
|
|
306
279
|
*/
|
|
307
|
-
name: TOptions['name'];
|
|
280
|
+
name: TOptions$1['name'];
|
|
308
281
|
/**
|
|
309
282
|
* Internal key used when a developer uses more than one of the same plugin
|
|
310
283
|
* @private
|
|
311
284
|
*/
|
|
312
|
-
key: TOptions['key'];
|
|
285
|
+
key: TOptions$1['key'];
|
|
313
286
|
/**
|
|
314
287
|
* 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
288
|
* Can be used to validate dependent plugins.
|
|
@@ -322,49 +295,49 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
322
295
|
/**
|
|
323
296
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
324
297
|
*/
|
|
325
|
-
options: TOptions['resolvedOptions'];
|
|
326
|
-
} & (TOptions['context'] extends never ? {
|
|
298
|
+
options: TOptions$1['resolvedOptions'];
|
|
299
|
+
} & (TOptions$1['context'] extends never ? {
|
|
327
300
|
context?: never;
|
|
328
301
|
} : {
|
|
329
|
-
context: TOptions['context'];
|
|
302
|
+
context: TOptions$1['context'];
|
|
330
303
|
});
|
|
331
|
-
type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
|
|
332
|
-
type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
304
|
+
type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
|
|
305
|
+
type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
333
306
|
/**
|
|
334
307
|
* Start of the lifecycle of a plugin.
|
|
335
308
|
* @type hookParallel
|
|
336
309
|
*/
|
|
337
|
-
buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
|
|
310
|
+
buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
|
|
338
311
|
/**
|
|
339
312
|
* Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
|
|
340
313
|
* Options can als be included.
|
|
341
314
|
* @type hookFirst
|
|
342
315
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
343
316
|
*/
|
|
344
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
317
|
+
resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
|
|
345
318
|
/**
|
|
346
319
|
* Resolve to a name based on a string.
|
|
347
320
|
* Useful when converting to PascalCase or camelCase.
|
|
348
321
|
* @type hookFirst
|
|
349
322
|
* @example ('pet') => 'Pet'
|
|
350
323
|
*/
|
|
351
|
-
resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
324
|
+
resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
352
325
|
/**
|
|
353
326
|
* End of the plugin lifecycle.
|
|
354
327
|
* @type hookParallel
|
|
355
328
|
*/
|
|
356
|
-
buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
|
|
329
|
+
buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
|
|
357
330
|
};
|
|
358
331
|
type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
359
|
-
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
360
|
-
type ResolvePathParams<TOptions = object> = {
|
|
332
|
+
type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
|
|
333
|
+
type ResolvePathParams<TOptions$1 = object> = {
|
|
361
334
|
pluginKey?: Plugin['key'];
|
|
362
335
|
baseName: BaseName;
|
|
363
336
|
mode?: Mode;
|
|
364
337
|
/**
|
|
365
338
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
366
339
|
*/
|
|
367
|
-
options?: TOptions;
|
|
340
|
+
options?: TOptions$1;
|
|
368
341
|
};
|
|
369
342
|
type ResolveNameParams = {
|
|
370
343
|
name: string;
|
|
@@ -377,12 +350,15 @@ type ResolveNameParams = {
|
|
|
377
350
|
*/
|
|
378
351
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
379
352
|
};
|
|
380
|
-
type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
353
|
+
type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
381
354
|
config: Config;
|
|
355
|
+
/**
|
|
356
|
+
* @deprecated
|
|
357
|
+
*/
|
|
382
358
|
fileManager: FileManager;
|
|
383
359
|
pluginManager: PluginManager;
|
|
384
360
|
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
385
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
361
|
+
resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
|
|
386
362
|
resolveName: (params: ResolveNameParams) => string;
|
|
387
363
|
logger: Logger;
|
|
388
364
|
/**
|
|
@@ -392,12 +368,12 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
392
368
|
/**
|
|
393
369
|
* Current plugin
|
|
394
370
|
*/
|
|
395
|
-
plugin: Plugin<TOptions>;
|
|
371
|
+
plugin: Plugin<TOptions$1>;
|
|
396
372
|
};
|
|
397
373
|
/**
|
|
398
374
|
* Specify the export location for the files and define the behavior of the output
|
|
399
375
|
*/
|
|
400
|
-
type Output<TOptions> = {
|
|
376
|
+
type Output<TOptions$1> = {
|
|
401
377
|
/**
|
|
402
378
|
* Path to the output folder or file that will contain the generated code
|
|
403
379
|
*/
|
|
@@ -410,11 +386,11 @@ type Output<TOptions> = {
|
|
|
410
386
|
/**
|
|
411
387
|
* Add a banner text in the beginning of every file
|
|
412
388
|
*/
|
|
413
|
-
banner?: string | ((options: TOptions) => string);
|
|
389
|
+
banner?: string | ((options: TOptions$1) => string);
|
|
414
390
|
/**
|
|
415
391
|
* Add a footer text in the beginning of every file
|
|
416
392
|
*/
|
|
417
|
-
footer?: string | ((options: TOptions) => string);
|
|
393
|
+
footer?: string | ((options: TOptions$1) => string);
|
|
418
394
|
};
|
|
419
395
|
type GroupContext = {
|
|
420
396
|
group: string;
|
|
@@ -430,73 +406,19 @@ type Group = {
|
|
|
430
406
|
name?: (context: GroupContext) => string;
|
|
431
407
|
};
|
|
432
408
|
//#endregion
|
|
433
|
-
//#region ../core/src/FileManager.d.ts
|
|
434
|
-
type FileMetaBase = {
|
|
435
|
-
pluginKey?: Plugin['key'];
|
|
436
|
-
};
|
|
437
|
-
type AddResult<T extends Array<File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
|
|
438
|
-
type AddIndexesProps = {
|
|
439
|
-
type: BarrelType | false | undefined;
|
|
440
|
-
/**
|
|
441
|
-
* Root based on root and output.path specified in the config
|
|
442
|
-
*/
|
|
443
|
-
root: string;
|
|
444
|
-
/**
|
|
445
|
-
* Output for plugin
|
|
446
|
-
*/
|
|
447
|
-
output: {
|
|
448
|
-
path: string;
|
|
449
|
-
};
|
|
450
|
-
group?: {
|
|
451
|
-
output: string;
|
|
452
|
-
exportAs: string;
|
|
453
|
-
};
|
|
454
|
-
logger?: Logger;
|
|
455
|
-
meta?: FileMetaBase;
|
|
456
|
-
};
|
|
457
|
-
type WriteFilesProps = {
|
|
458
|
-
root: Config['root'];
|
|
459
|
-
extension?: Record<Extname, Extname | ''>;
|
|
460
|
-
logger?: Logger;
|
|
461
|
-
dryRun?: boolean;
|
|
462
|
-
};
|
|
463
|
-
declare class FileManager {
|
|
464
|
-
#private;
|
|
465
|
-
constructor();
|
|
466
|
-
add<T extends Array<File> = Array<File>>(...files: T): AddResult<T>;
|
|
467
|
-
getByPath(path: Path): Promise<ResolvedFile | null>;
|
|
468
|
-
deleteByPath(path: Path): Promise<void>;
|
|
469
|
-
clear(): Promise<void>;
|
|
470
|
-
getFiles(): Promise<Array<ResolvedFile>>;
|
|
471
|
-
processFiles({
|
|
472
|
-
dryRun,
|
|
473
|
-
root,
|
|
474
|
-
extension,
|
|
475
|
-
logger
|
|
476
|
-
}: WriteFilesProps): Promise<Array<ResolvedFile>>;
|
|
477
|
-
getBarrelFiles({
|
|
478
|
-
type,
|
|
479
|
-
meta,
|
|
480
|
-
root,
|
|
481
|
-
output,
|
|
482
|
-
logger
|
|
483
|
-
}: AddIndexesProps): Promise<File[]>;
|
|
484
|
-
static getMode(path: string | undefined | null): Mode;
|
|
485
|
-
}
|
|
486
|
-
//#endregion
|
|
487
409
|
//#region ../core/src/PluginManager.d.ts
|
|
488
410
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
489
411
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
490
|
-
type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
412
|
+
type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
491
413
|
message: string;
|
|
492
414
|
strategy: Strategy;
|
|
493
|
-
hookName: H;
|
|
415
|
+
hookName: H$1;
|
|
494
416
|
plugin: Plugin;
|
|
495
417
|
parameters?: unknown[] | undefined;
|
|
496
418
|
output?: unknown;
|
|
497
419
|
};
|
|
498
|
-
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
499
|
-
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
420
|
+
type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
|
|
421
|
+
type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
|
|
500
422
|
result: Result;
|
|
501
423
|
plugin: Plugin;
|
|
502
424
|
};
|
|
@@ -512,16 +434,19 @@ type Events = {
|
|
|
512
434
|
executed: [executer: Executer];
|
|
513
435
|
error: [error: Error];
|
|
514
436
|
};
|
|
515
|
-
type GetFileProps<TOptions = object> = {
|
|
437
|
+
type GetFileProps<TOptions$1 = object> = {
|
|
516
438
|
name: string;
|
|
517
439
|
mode?: Mode;
|
|
518
440
|
extname: Extname;
|
|
519
441
|
pluginKey: Plugin['key'];
|
|
520
|
-
options?: TOptions;
|
|
442
|
+
options?: TOptions$1;
|
|
521
443
|
};
|
|
522
444
|
declare class PluginManager {
|
|
523
445
|
#private;
|
|
524
446
|
readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
|
|
447
|
+
/**
|
|
448
|
+
* @deprecated do not use from pluginManager
|
|
449
|
+
*/
|
|
525
450
|
readonly fileManager: FileManager;
|
|
526
451
|
readonly events: EventEmitter<Events>;
|
|
527
452
|
readonly config: Config;
|
|
@@ -630,6 +555,11 @@ declare class PluginManager {
|
|
|
630
555
|
static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
|
|
631
556
|
}
|
|
632
557
|
//#endregion
|
|
558
|
+
//#region ../core/src/FileManager.d.ts
|
|
559
|
+
type FileMetaBase = {
|
|
560
|
+
pluginKey?: Plugin['key'];
|
|
561
|
+
};
|
|
562
|
+
//#endregion
|
|
633
563
|
//#region src/types.d.ts
|
|
634
564
|
type ResolvePathOptions = {
|
|
635
565
|
pluginKey?: Plugin['key'];
|
|
@@ -774,8 +704,8 @@ type ByContentType = {
|
|
|
774
704
|
};
|
|
775
705
|
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
776
706
|
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
777
|
-
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
778
|
-
options: Partial<TOptions>;
|
|
707
|
+
type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
708
|
+
options: Partial<TOptions$1>;
|
|
779
709
|
};
|
|
780
710
|
type ResolvedOptions = Options$1 & {
|
|
781
711
|
output: Output<Oas>;
|
|
@@ -783,9 +713,9 @@ type ResolvedOptions = Options$1 & {
|
|
|
783
713
|
type PluginOas = PluginFactoryOptions<'plugin-oas', Options$1, ResolvedOptions, API, ResolvePathOptions>;
|
|
784
714
|
//#endregion
|
|
785
715
|
//#region src/SchemaGenerator.d.ts
|
|
786
|
-
type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
716
|
+
type GetSchemaGeneratorOptions<T$1 extends SchemaGenerator<any, any, any>> = T$1 extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
787
717
|
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<File<TFileMeta> | Array<File<TFileMeta>> | null>;
|
|
788
|
-
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
718
|
+
type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
|
|
789
719
|
oas: Oas;
|
|
790
720
|
pluginManager: PluginManager;
|
|
791
721
|
/**
|
|
@@ -794,7 +724,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
794
724
|
plugin: Plugin<TPluginOptions>;
|
|
795
725
|
mode: Mode;
|
|
796
726
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
797
|
-
override: Array<Override<TOptions>> | undefined;
|
|
727
|
+
override: Array<Override<TOptions$1>> | undefined;
|
|
798
728
|
contentType?: contentType;
|
|
799
729
|
output?: string;
|
|
800
730
|
};
|
|
@@ -826,7 +756,7 @@ type SchemaProps$1 = {
|
|
|
826
756
|
name?: string;
|
|
827
757
|
parentName?: string;
|
|
828
758
|
};
|
|
829
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
|
|
759
|
+
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
760
|
#private;
|
|
831
761
|
refs: Refs;
|
|
832
762
|
/**
|
|
@@ -845,38 +775,38 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
845
775
|
}
|
|
846
776
|
//#endregion
|
|
847
777
|
//#region src/generator.d.ts
|
|
848
|
-
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
849
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
850
|
-
options: TOptions['resolvedOptions'];
|
|
778
|
+
type OperationsProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
779
|
+
instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
|
|
780
|
+
options: TOptions$1['resolvedOptions'];
|
|
851
781
|
operations: Array<Operation$1>;
|
|
852
782
|
};
|
|
853
|
-
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
854
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
855
|
-
options: TOptions['resolvedOptions'];
|
|
783
|
+
type OperationProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
784
|
+
instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
|
|
785
|
+
options: TOptions$1['resolvedOptions'];
|
|
856
786
|
operation: Operation$1;
|
|
857
787
|
};
|
|
858
|
-
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
859
|
-
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
860
|
-
options: TOptions['resolvedOptions'];
|
|
788
|
+
type SchemaProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
789
|
+
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions$1>, 'build'>;
|
|
790
|
+
options: TOptions$1['resolvedOptions'];
|
|
861
791
|
schema: {
|
|
862
792
|
name: string;
|
|
863
793
|
tree: Array<Schema>;
|
|
864
794
|
value: SchemaObject$1;
|
|
865
795
|
};
|
|
866
796
|
};
|
|
867
|
-
type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
797
|
+
type GeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
|
|
868
798
|
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[]>;
|
|
799
|
+
operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
|
|
800
|
+
operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
|
|
801
|
+
schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
|
|
872
802
|
};
|
|
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> = {
|
|
803
|
+
type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
|
|
804
|
+
declare function createGenerator<TOptions$1 extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions$1>): Generator<TOptions$1>;
|
|
805
|
+
type ReactGeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
|
|
876
806
|
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;
|
|
807
|
+
Operations?: (this: ReactGeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => types_d_exports$1.KubbNode;
|
|
808
|
+
Operation?: (this: ReactGeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => types_d_exports$1.KubbNode;
|
|
809
|
+
Schema?: (this: ReactGeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => types_d_exports$1.KubbNode;
|
|
880
810
|
};
|
|
881
811
|
/****
|
|
882
812
|
* Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
|
|
@@ -885,15 +815,15 @@ type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
|
885
815
|
*
|
|
886
816
|
* @returns A generator object with async methods for operations, operation, and schema file generation.
|
|
887
817
|
*/
|
|
888
|
-
declare function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions>;
|
|
818
|
+
declare function createReactGenerator<TOptions$1 extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions$1>): Generator<TOptions$1>;
|
|
889
819
|
//#endregion
|
|
890
820
|
//#region src/OperationGenerator.d.ts
|
|
891
821
|
type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<File<TFileMeta> | Array<File<TFileMeta>> | null>;
|
|
892
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
822
|
+
type Context<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
|
|
893
823
|
oas: Oas;
|
|
894
824
|
exclude: Array<Exclude$1> | undefined;
|
|
895
825
|
include: Array<Include> | undefined;
|
|
896
|
-
override: Array<Override<TOptions>> | undefined;
|
|
826
|
+
override: Array<Override<TOptions$1>> | undefined;
|
|
897
827
|
contentType: contentType | undefined;
|
|
898
828
|
pluginManager: PluginManager;
|
|
899
829
|
/**
|
|
@@ -917,5 +847,5 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
917
847
|
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
918
848
|
}
|
|
919
849
|
//#endregion
|
|
920
|
-
export {
|
|
921
|
-
//# sourceMappingURL=OperationGenerator-
|
|
850
|
+
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 };
|
|
851
|
+
//# sourceMappingURL=OperationGenerator-BeVo1_b1.d.cts.map
|