@kubb/plugin-oas 0.0.0-canary-20251028131922 → 0.0.0-canary-20251103125929
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/{SchemaGenerator-DzVHk6OP.cjs → SchemaGenerator-B8Reay1m.cjs} +114 -16
- package/dist/SchemaGenerator-B8Reay1m.cjs.map +1 -0
- package/dist/{SchemaGenerator-7wBwdv8G.js → SchemaGenerator-ChoBQWm5.js} +93 -15
- package/dist/SchemaGenerator-ChoBQWm5.js.map +1 -0
- package/dist/{SchemaMapper-DoL-a6qq.cjs → SchemaMapper-BUV8vhg0.cjs} +1 -1
- package/dist/SchemaMapper-BUV8vhg0.cjs.map +1 -0
- package/dist/{SchemaMapper-CqBW0VOy.d.ts → SchemaMapper-CX7sIIuZ.d.cts} +5 -118
- package/dist/{SchemaMapper-Cx4X1al6.js → SchemaMapper-D30tqRoX.js} +1 -1
- package/dist/SchemaMapper-D30tqRoX.js.map +1 -0
- package/dist/{SchemaMapper-MiRB5_Zp.d.cts → SchemaMapper-m5TKynWt.d.ts} +5 -118
- package/dist/{OperationGenerator-BZPWkxw4.d.ts → createGenerator-DlSlv4sR.d.ts} +130 -182
- package/dist/{OperationGenerator-CJTAer7l.d.cts → createGenerator-PIseu7v9.d.cts} +131 -183
- package/dist/{generators-C61FxVIj.js → generators-CJDEf8Kn.js} +6 -6
- package/dist/generators-CJDEf8Kn.js.map +1 -0
- package/dist/{generators-B27La9Vd.cjs → generators-udGOxdUV.cjs} +6 -6
- package/dist/generators-udGOxdUV.cjs.map +1 -0
- package/dist/generators.cjs +2 -7
- package/dist/generators.d.cts +8 -3
- package/dist/generators.d.ts +8 -3
- package/dist/generators.js +3 -5
- package/dist/{getFooter-D5MdeUVv.js → getFooter-CV73pVXj.js} +2 -2
- package/dist/{getFooter-D5MdeUVv.js.map → getFooter-CV73pVXj.js.map} +1 -1
- package/dist/{getFooter-CwjCW4h5.cjs → getFooter-DPh4lxBH.cjs} +3 -3
- package/dist/{getFooter-CwjCW4h5.cjs.map → getFooter-DPh4lxBH.cjs.map} +1 -1
- package/dist/{getSchemas-DY8s2CSl.cjs → getSchemas-CP_YS4_2.cjs} +1 -1
- package/dist/getSchemas-CP_YS4_2.cjs.map +1 -0
- package/dist/{getSchemas-Bdg6n9Qk.js → getSchemas-CTi8zYew.js} +1 -1
- package/dist/getSchemas-CTi8zYew.js.map +1 -0
- package/dist/hooks.cjs +6 -47
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +11 -45
- package/dist/hooks.d.ts +11 -45
- package/dist/hooks.js +8 -46
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +37 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -3
- package/dist/index.d.ts +58 -3
- package/dist/index.js +32 -24
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +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-CqiiLCPe.js → parseFromConfig-BkUoWC2U.js} +1 -1
- package/dist/parseFromConfig-BkUoWC2U.js.map +1 -0
- package/dist/{parseFromConfig-RR31a98-.cjs → parseFromConfig-EjsCZ0-8.cjs} +1 -1
- package/dist/parseFromConfig-EjsCZ0-8.cjs.map +1 -0
- package/dist/utils.cjs +3 -3
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +24 -24
- package/dist/utils.d.ts +24 -24
- package/dist/utils.js +3 -3
- package/dist/utils.js.map +1 -1
- package/package.json +14 -17
- package/src/OperationGenerator.ts +27 -14
- package/src/SchemaGenerator.ts +19 -11
- package/src/SchemaMapper.ts +1 -1
- package/src/generators/createGenerator.ts +1 -1
- package/src/generators/index.ts +0 -1
- package/src/generators/jsonGenerator.ts +4 -4
- package/src/generators/types.ts +13 -14
- package/src/hooks/index.ts +1 -4
- package/src/hooks/useOas.ts +5 -11
- package/src/hooks/useOperationManager.ts +3 -5
- package/src/hooks/useSchemaManager.ts +1 -1
- package/src/index.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils/getBanner.ts +1 -1
- package/src/utils/getParams.ts +1 -2
- package/src/utils/getSchemaFactory.ts +1 -2
- package/src/utils/getSchemas.ts +1 -1
- package/src/utils/index.ts +3 -4
- package/src/utils/parseFromConfig.ts +2 -6
- package/src/utils.tsx +101 -0
- package/dist/Oas-BzrQ6RGC.cjs +0 -80
- package/dist/Oas-BzrQ6RGC.cjs.map +0 -1
- package/dist/Oas-CIeHKOo0.js +0 -60
- package/dist/Oas-CIeHKOo0.js.map +0 -1
- package/dist/Schema-CjraJhJi.d.ts +0 -38
- package/dist/Schema-zcZF0UIp.d.cts +0 -38
- package/dist/SchemaGenerator-7wBwdv8G.js.map +0 -1
- package/dist/SchemaGenerator-DzVHk6OP.cjs.map +0 -1
- package/dist/SchemaMapper-Cx4X1al6.js.map +0 -1
- package/dist/SchemaMapper-DoL-a6qq.cjs.map +0 -1
- package/dist/components.cjs +0 -5
- package/dist/components.d.cts +0 -42
- package/dist/components.d.ts +0 -42
- package/dist/components.js +0 -3
- package/dist/generators-B27La9Vd.cjs.map +0 -1
- package/dist/generators-C61FxVIj.js.map +0 -1
- package/dist/getSchemas-Bdg6n9Qk.js.map +0 -1
- package/dist/getSchemas-DY8s2CSl.cjs.map +0 -1
- package/dist/parseFromConfig-CqiiLCPe.js.map +0 -1
- package/dist/parseFromConfig-RR31a98-.cjs.map +0 -1
- package/dist/utils-BnkB1ikY.js +0 -99
- package/dist/utils-BnkB1ikY.js.map +0 -1
- package/dist/utils-nzdccPlU.cjs +0 -119
- package/dist/utils-nzdccPlU.cjs.map +0 -1
- package/src/components/Oas.tsx +0 -35
- package/src/components/Operation.tsx +0 -20
- package/src/components/Schema.tsx +0 -38
- package/src/components/index.ts +0 -3
- package/src/generators/utils.tsx +0 -114
- package/src/hooks/useOperation.ts +0 -18
- package/src/hooks/useOperations.ts +0 -40
- package/src/hooks/useSchema.ts +0 -16
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as SchemaKeywordMapper, t as Schema } from "./SchemaMapper-m5TKynWt.js";
|
|
2
2
|
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
3
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
|
+
import { ConsolaInstance, LogLevel } from "consola";
|
|
3
5
|
import * as OasTypes from "oas/types";
|
|
4
6
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
5
7
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -7,43 +9,7 @@ import { OpenAPIV3, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1 } from "openapi-types"
|
|
|
7
9
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
8
10
|
import BaseOas from "oas";
|
|
9
11
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
10
|
-
import { ConsolaInstance, LogLevel } from "consola";
|
|
11
12
|
|
|
12
|
-
//#region ../oas/src/types.d.ts
|
|
13
|
-
type contentType = 'application/json' | (string & {});
|
|
14
|
-
type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
15
|
-
'x-nullable'?: boolean;
|
|
16
|
-
$ref?: string;
|
|
17
|
-
};
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region ../oas/src/Oas.d.ts
|
|
20
|
-
type Options$3 = {
|
|
21
|
-
contentType?: contentType;
|
|
22
|
-
discriminator?: 'strict' | 'inherit';
|
|
23
|
-
};
|
|
24
|
-
declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
25
|
-
#private;
|
|
26
|
-
document: TOAS;
|
|
27
|
-
constructor({
|
|
28
|
-
oas,
|
|
29
|
-
user
|
|
30
|
-
}: {
|
|
31
|
-
oas: TOAS | OASDocument | string;
|
|
32
|
-
user?: User;
|
|
33
|
-
});
|
|
34
|
-
setOptions(options: Options$3): void;
|
|
35
|
-
get options(): Options$3;
|
|
36
|
-
get($ref: string): any;
|
|
37
|
-
getKey($ref: string): string | undefined;
|
|
38
|
-
set($ref: string, value: unknown): false | undefined;
|
|
39
|
-
getDiscriminator(schema: OasTypes.SchemaObject): OpenAPIV3.DiscriminatorObject | undefined;
|
|
40
|
-
dereferenceWithRef(schema?: unknown): any;
|
|
41
|
-
getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject;
|
|
42
|
-
getRequestSchema(operation: Operation): SchemaObject | undefined;
|
|
43
|
-
getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
|
|
44
|
-
valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
13
|
//#region ../core/src/BaseGenerator.d.ts
|
|
48
14
|
/**
|
|
49
15
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
@@ -181,7 +147,7 @@ type Config<TInput = Input> = {
|
|
|
181
147
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
182
148
|
* @default { '.ts': '.ts'}
|
|
183
149
|
*/
|
|
184
|
-
extension?: Record<Extname, Extname | ''>;
|
|
150
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
185
151
|
/**
|
|
186
152
|
* Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
|
|
187
153
|
* @default 'named'
|
|
@@ -312,7 +278,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
312
278
|
* @type hookFirst
|
|
313
279
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
314
280
|
*/
|
|
315
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
281
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
316
282
|
/**
|
|
317
283
|
* Resolve to a name based on a string.
|
|
318
284
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -330,8 +296,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
330
296
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
331
297
|
type ResolvePathParams<TOptions = object> = {
|
|
332
298
|
pluginKey?: Plugin['key'];
|
|
333
|
-
baseName: BaseName;
|
|
334
|
-
mode?: Mode;
|
|
299
|
+
baseName: KubbFile.BaseName;
|
|
300
|
+
mode?: KubbFile.Mode;
|
|
335
301
|
/**
|
|
336
302
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
337
303
|
*/
|
|
@@ -356,8 +322,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
356
322
|
*/
|
|
357
323
|
fileManager: FileManager;
|
|
358
324
|
pluginManager: PluginManager;
|
|
359
|
-
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
360
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
325
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
326
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
361
327
|
resolveName: (params: ResolveNameParams) => string;
|
|
362
328
|
logger: Logger;
|
|
363
329
|
/**
|
|
@@ -421,7 +387,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
421
387
|
result: Result;
|
|
422
388
|
plugin: Plugin;
|
|
423
389
|
};
|
|
424
|
-
type Options$
|
|
390
|
+
type Options$3 = {
|
|
425
391
|
fabric: Fabric;
|
|
426
392
|
logger: Logger;
|
|
427
393
|
/**
|
|
@@ -436,8 +402,8 @@ type Events = {
|
|
|
436
402
|
};
|
|
437
403
|
type GetFileProps<TOptions = object> = {
|
|
438
404
|
name: string;
|
|
439
|
-
mode?: Mode;
|
|
440
|
-
extname: Extname;
|
|
405
|
+
mode?: KubbFile.Mode;
|
|
406
|
+
extname: KubbFile.Extname;
|
|
441
407
|
pluginKey: Plugin['key'];
|
|
442
408
|
options?: TOptions;
|
|
443
409
|
};
|
|
@@ -448,18 +414,18 @@ declare class PluginManager {
|
|
|
448
414
|
readonly config: Config;
|
|
449
415
|
readonly executed: Array<Executer>;
|
|
450
416
|
readonly logger: Logger;
|
|
451
|
-
readonly options: Options$
|
|
452
|
-
constructor(config: Config, options: Options$
|
|
417
|
+
readonly options: Options$3;
|
|
418
|
+
constructor(config: Config, options: Options$3);
|
|
453
419
|
getFile<TOptions = object>({
|
|
454
420
|
name,
|
|
455
421
|
mode,
|
|
456
422
|
extname,
|
|
457
423
|
pluginKey,
|
|
458
424
|
options
|
|
459
|
-
}: GetFileProps<TOptions>): File<{
|
|
425
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
460
426
|
pluginKey: Plugin['key'];
|
|
461
427
|
}>;
|
|
462
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
428
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
463
429
|
resolveName: (params: ResolveNameParams) => string;
|
|
464
430
|
/**
|
|
465
431
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -556,44 +522,40 @@ type FileMetaBase = {
|
|
|
556
522
|
pluginKey?: Plugin['key'];
|
|
557
523
|
};
|
|
558
524
|
//#endregion
|
|
559
|
-
//#region src/
|
|
560
|
-
type
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
schema?: (props: SchemaProps<TOptions>) => Promise<File[]>;
|
|
565
|
-
};
|
|
566
|
-
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
567
|
-
name: string;
|
|
568
|
-
type: 'core';
|
|
569
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File[]>;
|
|
570
|
-
operation: (props: OperationProps<TOptions>) => Promise<File[]>;
|
|
571
|
-
schema: (props: SchemaProps<TOptions>) => Promise<File[]>;
|
|
525
|
+
//#region ../oas/src/types.d.ts
|
|
526
|
+
type contentType = 'application/json' | (string & {});
|
|
527
|
+
type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
528
|
+
'x-nullable'?: boolean;
|
|
529
|
+
$ref?: string;
|
|
572
530
|
};
|
|
573
|
-
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator$1<TOptions>): CoreGenerator<TOptions>;
|
|
574
531
|
//#endregion
|
|
575
|
-
//#region src/
|
|
576
|
-
type
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
Operation?: (props: OperationProps<TOptions>) => KubbNode;
|
|
580
|
-
Schema?: (props: SchemaProps<TOptions>) => KubbNode;
|
|
581
|
-
};
|
|
582
|
-
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
583
|
-
name: string;
|
|
584
|
-
type: 'react';
|
|
585
|
-
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
586
|
-
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
587
|
-
Schema: (props: SchemaProps<TOptions>) => KubbNode;
|
|
532
|
+
//#region ../oas/src/Oas.d.ts
|
|
533
|
+
type Options$2 = {
|
|
534
|
+
contentType?: contentType;
|
|
535
|
+
discriminator?: 'strict' | 'inherit';
|
|
588
536
|
};
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
537
|
+
declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
538
|
+
#private;
|
|
539
|
+
document: TOAS;
|
|
540
|
+
constructor({
|
|
541
|
+
oas,
|
|
542
|
+
user
|
|
543
|
+
}: {
|
|
544
|
+
oas: TOAS | OASDocument | string;
|
|
545
|
+
user?: User;
|
|
546
|
+
});
|
|
547
|
+
setOptions(options: Options$2): void;
|
|
548
|
+
get options(): Options$2;
|
|
549
|
+
get($ref: string): any;
|
|
550
|
+
getKey($ref: string): string | undefined;
|
|
551
|
+
set($ref: string, value: unknown): false | undefined;
|
|
552
|
+
getDiscriminator(schema: OasTypes.SchemaObject): OpenAPIV3.DiscriminatorObject | undefined;
|
|
553
|
+
dereferenceWithRef(schema?: unknown): any;
|
|
554
|
+
getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject;
|
|
555
|
+
getRequestSchema(operation: Operation): SchemaObject | undefined;
|
|
556
|
+
getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
|
|
557
|
+
valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
558
|
+
}
|
|
597
559
|
//#endregion
|
|
598
560
|
//#region src/types.d.ts
|
|
599
561
|
type ResolvePathOptions = {
|
|
@@ -668,7 +630,7 @@ type Options$1 = {
|
|
|
668
630
|
type Ref = {
|
|
669
631
|
propertyName: string;
|
|
670
632
|
originalName: string;
|
|
671
|
-
path: OptionalPath;
|
|
633
|
+
path: KubbFile.OptionalPath;
|
|
672
634
|
pluginKey?: Plugin['key'];
|
|
673
635
|
};
|
|
674
636
|
type Refs = Record<string, Ref>;
|
|
@@ -677,8 +639,8 @@ type Resolver = {
|
|
|
677
639
|
* Original name or name resolved by `resolveName({ name: operation?.getOperationId() as string, pluginName })`
|
|
678
640
|
*/
|
|
679
641
|
name: string;
|
|
680
|
-
baseName: BaseName;
|
|
681
|
-
path: Path;
|
|
642
|
+
baseName: KubbFile.BaseName;
|
|
643
|
+
path: KubbFile.Path;
|
|
682
644
|
};
|
|
683
645
|
type OperationSchema = {
|
|
684
646
|
/**
|
|
@@ -747,13 +709,41 @@ type ResolvedOptions = Options$1 & {
|
|
|
747
709
|
};
|
|
748
710
|
type PluginOas = PluginFactoryOptions<'plugin-oas', Options$1, ResolvedOptions, API, ResolvePathOptions>;
|
|
749
711
|
//#endregion
|
|
750
|
-
//#region src/
|
|
751
|
-
|
|
712
|
+
//#region src/OperationGenerator.d.ts
|
|
713
|
+
type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
714
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
715
|
+
fabric: Fabric;
|
|
716
|
+
oas: Oas;
|
|
717
|
+
exclude: Array<Exclude$1> | undefined;
|
|
718
|
+
include: Array<Include> | undefined;
|
|
719
|
+
override: Array<Override<TOptions>> | undefined;
|
|
720
|
+
contentType: contentType | undefined;
|
|
721
|
+
pluginManager: PluginManager;
|
|
722
|
+
/**
|
|
723
|
+
* Current plugin
|
|
724
|
+
*/
|
|
725
|
+
plugin: Plugin<TPluginOptions>;
|
|
726
|
+
mode: KubbFile.Mode;
|
|
727
|
+
};
|
|
728
|
+
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
729
|
+
#private;
|
|
730
|
+
getSchemas(operation: Operation$1, {
|
|
731
|
+
resolveName
|
|
732
|
+
}?: {
|
|
733
|
+
resolveName?: (name: string) => string;
|
|
734
|
+
}): OperationSchemas;
|
|
735
|
+
getOperations(): Promise<Array<{
|
|
736
|
+
path: string;
|
|
737
|
+
method: HttpMethod;
|
|
738
|
+
operation: Operation$1;
|
|
739
|
+
}>>;
|
|
740
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
741
|
+
}
|
|
752
742
|
//#endregion
|
|
753
743
|
//#region src/SchemaGenerator.d.ts
|
|
754
744
|
type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
755
|
-
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<File<TFileMeta> | Array<File<TFileMeta>> | null>;
|
|
756
|
-
type Context
|
|
745
|
+
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
746
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
757
747
|
fabric: Fabric;
|
|
758
748
|
oas: Oas;
|
|
759
749
|
pluginManager: PluginManager;
|
|
@@ -761,7 +751,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
761
751
|
* Current plugin
|
|
762
752
|
*/
|
|
763
753
|
plugin: Plugin<TPluginOptions>;
|
|
764
|
-
mode: Mode;
|
|
754
|
+
mode: KubbFile.Mode;
|
|
765
755
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
766
756
|
override: Array<Override<TOptions>> | undefined;
|
|
767
757
|
contentType?: contentType;
|
|
@@ -795,7 +785,7 @@ type SchemaProps$1 = {
|
|
|
795
785
|
name?: string;
|
|
796
786
|
parentName?: string;
|
|
797
787
|
};
|
|
798
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context
|
|
788
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
799
789
|
#private;
|
|
800
790
|
refs: Refs;
|
|
801
791
|
/**
|
|
@@ -810,76 +800,49 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
810
800
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
811
801
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
812
802
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
813
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
803
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
814
804
|
}
|
|
815
805
|
//#endregion
|
|
816
|
-
//#region src/generators/
|
|
817
|
-
type
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
*/
|
|
823
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
824
|
-
options: TOptions['resolvedOptions'];
|
|
825
|
-
};
|
|
826
|
-
declare function buildOperations<TOptions extends PluginFactoryOptions>(operations: Array<Operation$1>, {
|
|
827
|
-
fabric,
|
|
828
|
-
options,
|
|
829
|
-
instance,
|
|
830
|
-
generator
|
|
831
|
-
}: BuildOperationsOptions<TOptions>): Promise<void>;
|
|
832
|
-
type BuildOperationOptions<TOptions extends PluginFactoryOptions> = BuildOperationsOptions<TOptions>;
|
|
833
|
-
declare function buildOperation<TOptions extends PluginFactoryOptions>(operation: Operation$1, {
|
|
834
|
-
fabric,
|
|
835
|
-
options,
|
|
836
|
-
instance,
|
|
837
|
-
generator
|
|
838
|
-
}: BuildOperationOptions<TOptions>): Promise<void>;
|
|
839
|
-
type BuildSchemaOptions<TOptions extends PluginFactoryOptions> = {
|
|
840
|
-
fabric: Fabric;
|
|
841
|
-
generator: ReactGenerator<any>;
|
|
842
|
-
/**
|
|
843
|
-
* @deprecated
|
|
844
|
-
*/
|
|
845
|
-
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
846
|
-
options: TOptions['resolvedOptions'];
|
|
806
|
+
//#region src/generators/createReactGenerator.d.ts
|
|
807
|
+
type UserGenerator$1<TOptions extends PluginFactoryOptions> = {
|
|
808
|
+
name: string;
|
|
809
|
+
Operations?: (props: OperationsProps<TOptions>) => KubbNode;
|
|
810
|
+
Operation?: (props: OperationProps<TOptions>) => KubbNode;
|
|
811
|
+
Schema?: (props: SchemaProps<TOptions>) => KubbNode;
|
|
847
812
|
};
|
|
848
|
-
|
|
813
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
849
814
|
name: string;
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
815
|
+
type: 'react';
|
|
816
|
+
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
817
|
+
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
818
|
+
Schema: (props: SchemaProps<TOptions>) => KubbNode;
|
|
819
|
+
};
|
|
820
|
+
/****
|
|
821
|
+
* Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
|
|
822
|
+
*
|
|
823
|
+
* The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.
|
|
824
|
+
*
|
|
825
|
+
* @returns A generator object with async methods for operations, operation, and schema file generation.
|
|
826
|
+
*/
|
|
827
|
+
declare function createReactGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator$1<TOptions>): ReactGenerator<TOptions>;
|
|
862
828
|
//#endregion
|
|
863
829
|
//#region src/generators/types.d.ts
|
|
864
830
|
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
869
|
-
options: TOptions['resolvedOptions'];
|
|
831
|
+
config: Config;
|
|
832
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
833
|
+
plugin: Plugin<TOptions>;
|
|
870
834
|
operations: Array<Operation$1>;
|
|
871
835
|
};
|
|
872
836
|
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
877
|
-
options: TOptions['resolvedOptions'];
|
|
837
|
+
config: Config;
|
|
838
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
839
|
+
plugin: Plugin<TOptions>;
|
|
878
840
|
operation: Operation$1;
|
|
879
841
|
};
|
|
880
842
|
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
881
|
-
|
|
882
|
-
|
|
843
|
+
config: Config;
|
|
844
|
+
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
845
|
+
plugin: Plugin<TOptions>;
|
|
883
846
|
schema: {
|
|
884
847
|
name: string;
|
|
885
848
|
tree: Array<Schema>;
|
|
@@ -888,36 +851,21 @@ type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
|
888
851
|
};
|
|
889
852
|
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
890
853
|
//#endregion
|
|
891
|
-
//#region src/
|
|
892
|
-
type
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
include: Array<Include> | undefined;
|
|
898
|
-
override: Array<Override<TOptions>> | undefined;
|
|
899
|
-
contentType: contentType | undefined;
|
|
900
|
-
pluginManager: PluginManager;
|
|
901
|
-
/**
|
|
902
|
-
* Current plugin
|
|
903
|
-
*/
|
|
904
|
-
plugin: Plugin<TPluginOptions>;
|
|
905
|
-
mode: Mode;
|
|
854
|
+
//#region src/generators/createGenerator.d.ts
|
|
855
|
+
type UserGenerator<TOptions extends PluginFactoryOptions> = {
|
|
856
|
+
name: string;
|
|
857
|
+
operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
858
|
+
operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
859
|
+
schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
906
860
|
};
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
path: string;
|
|
916
|
-
method: HttpMethod;
|
|
917
|
-
operation: Operation$1;
|
|
918
|
-
}>>;
|
|
919
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
920
|
-
}
|
|
861
|
+
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
862
|
+
name: string;
|
|
863
|
+
type: 'core';
|
|
864
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
865
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
866
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
867
|
+
};
|
|
868
|
+
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions>;
|
|
921
869
|
//#endregion
|
|
922
|
-
export {
|
|
923
|
-
//# sourceMappingURL=
|
|
870
|
+
export { SchemaObject$1 as A, ResolvePathOptions as C, OpenAPIV3$1 as D, OasTypes as E, Plugin as F, PluginFactoryOptions as I, ResolveNameParams as L, FileMetaBase as M, Config as N, OpenAPIV3_1 as O, Output as P, UserPluginWithLifeCycle as R, Refs as S, Oas as T, OperationSchemas as _, createReactGenerator as a, PluginOas as b, SchemaGeneratorBuildOptions as c, OperationGenerator as d, OperationMethodResult as f, OperationSchema as g, Include as h, ReactGenerator as i, contentType as j, Operation$1 as k, SchemaGeneratorOptions as l, Exclude$1 as m, createGenerator as n, GetSchemaGeneratorOptions as o, API as p, Generator as r, SchemaGenerator as s, CoreGenerator as t, SchemaMethodResult as u, Options$1 as v, Resolver as w, Ref as x, Override as y };
|
|
871
|
+
//# sourceMappingURL=createGenerator-DlSlv4sR.d.ts.map
|