@kubb/plugin-oas 4.4.1 → 4.5.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/{SchemaGenerator-b7XixzRv.js → SchemaGenerator-BwYbrh7a.js} +93 -36
- package/dist/SchemaGenerator-BwYbrh7a.js.map +1 -0
- package/dist/{SchemaGenerator-DWj6buY0.cjs → SchemaGenerator-C81yEgKY.cjs} +114 -37
- package/dist/SchemaGenerator-C81yEgKY.cjs.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-CtfTw3hq.d.ts → SchemaMapper-CgGWx6jF.d.cts} +14 -2
- package/dist/{SchemaMapper-CX7sIIuZ.d.cts → SchemaMapper-Cj3vjPGs.d.ts} +14 -2
- package/dist/{SchemaMapper-Cx4X1al6.js → SchemaMapper-D30tqRoX.js} +1 -1
- package/dist/SchemaMapper-D30tqRoX.js.map +1 -0
- package/dist/{OperationGenerator-CRZpkIpZ.d.ts → createGenerator-BvCDyuKS.d.ts} +112 -176
- package/dist/{OperationGenerator-S_1PevQN.d.cts → createGenerator-CPNglV1d.d.cts} +113 -177
- package/dist/{generators-C61FxVIj.js → generators-CJDEf8Kn.js} +6 -6
- package/dist/{generators-C61FxVIj.js.map → generators-CJDEf8Kn.js.map} +1 -1
- package/dist/{generators-B27La9Vd.cjs → generators-udGOxdUV.cjs} +6 -6
- package/dist/{generators-B27La9Vd.cjs.map → generators-udGOxdUV.cjs.map} +1 -1
- 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-32BHoMO-.js +100 -0
- package/dist/getSchemas-32BHoMO-.js.map +1 -0
- package/dist/getSchemas-Cl0TZ4XY.cjs +113 -0
- package/dist/getSchemas-Cl0TZ4XY.cjs.map +1 -0
- package/dist/hooks.cjs +4 -29
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +4 -18
- package/dist/hooks.d.ts +4 -18
- package/dist/hooks.js +6 -29
- 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 +28 -24
- package/dist/utils.d.ts +28 -24
- package/dist/utils.js +3 -3
- package/dist/utils.js.map +1 -1
- package/package.json +5 -12
- package/src/OperationGenerator.ts +26 -13
- package/src/SchemaGenerator.ts +24 -46
- package/src/SchemaMapper.ts +2 -0
- 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 +0 -2
- package/src/hooks/useOperationManager.ts +2 -4
- package/src/index.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 +89 -15
- package/src/utils/index.ts +3 -4
- package/src/utils/parseFromConfig.ts +2 -6
- package/src/utils.tsx +101 -0
- package/dist/Oas-CHC1IC5D.js +0 -56
- package/dist/Oas-CHC1IC5D.js.map +0 -1
- package/dist/Oas-CQrRP_NH.cjs +0 -76
- package/dist/Oas-CQrRP_NH.cjs.map +0 -1
- package/dist/Schema-CZsDEhET.d.cts +0 -38
- package/dist/Schema-DBvtiLS7.d.ts +0 -38
- package/dist/SchemaGenerator-DWj6buY0.cjs.map +0 -1
- package/dist/SchemaGenerator-b7XixzRv.js.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 -38
- package/dist/components.d.ts +0 -38
- package/dist/components.js +0 -3
- package/dist/getSchemas-Bdg6n9Qk.js +0 -55
- package/dist/getSchemas-Bdg6n9Qk.js.map +0 -1
- package/dist/getSchemas-DY8s2CSl.cjs +0 -68
- 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-DYf-j63H.cjs +0 -115
- package/dist/utils-DYf-j63H.cjs.map +0 -1
- package/dist/utils-DaV25sy8.js +0 -95
- package/dist/utils-DaV25sy8.js.map +0 -1
- package/src/components/Oas.tsx +0 -30
- 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/useSchema.ts +0 -16
|
@@ -1,50 +1,14 @@
|
|
|
1
|
-
import { i as SchemaKeywordMapper, t as Schema } from "./SchemaMapper-
|
|
2
|
-
import * as OasTypes from "oas/types";
|
|
3
|
-
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
4
|
-
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
5
|
-
import { OpenAPIV3, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1 } from "openapi-types";
|
|
6
|
-
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
7
|
-
import BaseOas from "oas";
|
|
8
|
-
import { KubbNode } from "@kubb/react-fabric/types";
|
|
1
|
+
import { h as contentType, i as SchemaKeywordMapper, l as HttpMethod, m as SchemaObject$1, p as Operation$1, t as Schema, u as OasTypes } from "./SchemaMapper-CgGWx6jF.cjs";
|
|
9
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
10
3
|
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
11
4
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
5
|
+
import { OASDocument, SchemaObject, User } from "oas/types";
|
|
6
|
+
import { Operation } from "oas/operation";
|
|
7
|
+
import { OpenAPIV3 } from "openapi-types";
|
|
8
|
+
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
9
|
+
import BaseOas from "oas";
|
|
10
|
+
import { KubbNode } from "@kubb/react-fabric/types";
|
|
12
11
|
|
|
13
|
-
//#region ../oas/src/types.d.ts
|
|
14
|
-
type contentType = 'application/json' | (string & {});
|
|
15
|
-
type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
16
|
-
'x-nullable'?: boolean;
|
|
17
|
-
$ref?: string;
|
|
18
|
-
};
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region ../oas/src/Oas.d.ts
|
|
21
|
-
type Options$3 = {
|
|
22
|
-
contentType?: contentType;
|
|
23
|
-
discriminator?: 'strict' | 'inherit';
|
|
24
|
-
};
|
|
25
|
-
declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
26
|
-
#private;
|
|
27
|
-
document: TOAS;
|
|
28
|
-
constructor({
|
|
29
|
-
oas,
|
|
30
|
-
user
|
|
31
|
-
}: {
|
|
32
|
-
oas: TOAS | OASDocument | string;
|
|
33
|
-
user?: User;
|
|
34
|
-
});
|
|
35
|
-
setOptions(options: Options$3): void;
|
|
36
|
-
get options(): Options$3;
|
|
37
|
-
get($ref: string): any;
|
|
38
|
-
getKey($ref: string): string | undefined;
|
|
39
|
-
set($ref: string, value: unknown): false | undefined;
|
|
40
|
-
getDiscriminator(schema: OasTypes.SchemaObject): OpenAPIV3.DiscriminatorObject | undefined;
|
|
41
|
-
dereferenceWithRef(schema?: unknown): any;
|
|
42
|
-
getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject;
|
|
43
|
-
getRequestSchema(operation: Operation): SchemaObject | undefined;
|
|
44
|
-
getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
|
|
45
|
-
valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
12
|
//#region ../core/src/BaseGenerator.d.ts
|
|
49
13
|
/**
|
|
50
14
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
@@ -422,7 +386,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
422
386
|
result: Result;
|
|
423
387
|
plugin: Plugin;
|
|
424
388
|
};
|
|
425
|
-
type Options$
|
|
389
|
+
type Options$3 = {
|
|
426
390
|
fabric: Fabric;
|
|
427
391
|
logger: Logger;
|
|
428
392
|
/**
|
|
@@ -449,8 +413,8 @@ declare class PluginManager {
|
|
|
449
413
|
readonly config: Config;
|
|
450
414
|
readonly executed: Array<Executer>;
|
|
451
415
|
readonly logger: Logger;
|
|
452
|
-
readonly options: Options$
|
|
453
|
-
constructor(config: Config, options: Options$
|
|
416
|
+
readonly options: Options$3;
|
|
417
|
+
constructor(config: Config, options: Options$3);
|
|
454
418
|
getFile<TOptions = object>({
|
|
455
419
|
name,
|
|
456
420
|
mode,
|
|
@@ -557,44 +521,33 @@ type FileMetaBase = {
|
|
|
557
521
|
pluginKey?: Plugin['key'];
|
|
558
522
|
};
|
|
559
523
|
//#endregion
|
|
560
|
-
//#region src/
|
|
561
|
-
type
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
565
|
-
schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
566
|
-
};
|
|
567
|
-
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
568
|
-
name: string;
|
|
569
|
-
type: 'core';
|
|
570
|
-
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
571
|
-
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
572
|
-
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
573
|
-
};
|
|
574
|
-
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator$1<TOptions>): CoreGenerator<TOptions>;
|
|
575
|
-
//#endregion
|
|
576
|
-
//#region src/generators/createReactGenerator.d.ts
|
|
577
|
-
type UserGenerator<TOptions extends PluginFactoryOptions> = {
|
|
578
|
-
name: string;
|
|
579
|
-
Operations?: (props: OperationsProps<TOptions>) => KubbNode;
|
|
580
|
-
Operation?: (props: OperationProps<TOptions>) => KubbNode;
|
|
581
|
-
Schema?: (props: SchemaProps<TOptions>) => KubbNode;
|
|
582
|
-
};
|
|
583
|
-
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
584
|
-
name: string;
|
|
585
|
-
type: 'react';
|
|
586
|
-
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
587
|
-
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
588
|
-
Schema: (props: SchemaProps<TOptions>) => KubbNode;
|
|
524
|
+
//#region ../oas/src/Oas.d.ts
|
|
525
|
+
type Options$2 = {
|
|
526
|
+
contentType?: contentType;
|
|
527
|
+
discriminator?: 'strict' | 'inherit';
|
|
589
528
|
};
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
529
|
+
declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
530
|
+
#private;
|
|
531
|
+
document: TOAS;
|
|
532
|
+
constructor({
|
|
533
|
+
oas,
|
|
534
|
+
user
|
|
535
|
+
}: {
|
|
536
|
+
oas: TOAS | OASDocument | string;
|
|
537
|
+
user?: User;
|
|
538
|
+
});
|
|
539
|
+
setOptions(options: Options$2): void;
|
|
540
|
+
get options(): Options$2;
|
|
541
|
+
get($ref: string): any;
|
|
542
|
+
getKey($ref: string): string | undefined;
|
|
543
|
+
set($ref: string, value: unknown): false | undefined;
|
|
544
|
+
getDiscriminator(schema: OasTypes.SchemaObject): OpenAPIV3.DiscriminatorObject | undefined;
|
|
545
|
+
dereferenceWithRef(schema?: unknown): any;
|
|
546
|
+
getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject;
|
|
547
|
+
getRequestSchema(operation: Operation): SchemaObject | undefined;
|
|
548
|
+
getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
|
|
549
|
+
valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
550
|
+
}
|
|
598
551
|
//#endregion
|
|
599
552
|
//#region src/types.d.ts
|
|
600
553
|
type ResolvePathOptions = {
|
|
@@ -748,13 +701,41 @@ type ResolvedOptions = Options$1 & {
|
|
|
748
701
|
};
|
|
749
702
|
type PluginOas = PluginFactoryOptions<'plugin-oas', Options$1, ResolvedOptions, API, ResolvePathOptions>;
|
|
750
703
|
//#endregion
|
|
751
|
-
//#region src/
|
|
752
|
-
|
|
704
|
+
//#region src/OperationGenerator.d.ts
|
|
705
|
+
type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
706
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
707
|
+
fabric: Fabric;
|
|
708
|
+
oas: Oas;
|
|
709
|
+
exclude: Array<Exclude$1> | undefined;
|
|
710
|
+
include: Array<Include> | undefined;
|
|
711
|
+
override: Array<Override<TOptions>> | undefined;
|
|
712
|
+
contentType: contentType | undefined;
|
|
713
|
+
pluginManager: PluginManager;
|
|
714
|
+
/**
|
|
715
|
+
* Current plugin
|
|
716
|
+
*/
|
|
717
|
+
plugin: Plugin<TPluginOptions>;
|
|
718
|
+
mode: KubbFile.Mode;
|
|
719
|
+
};
|
|
720
|
+
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
721
|
+
#private;
|
|
722
|
+
getSchemas(operation: Operation$1, {
|
|
723
|
+
resolveName
|
|
724
|
+
}?: {
|
|
725
|
+
resolveName?: (name: string) => string;
|
|
726
|
+
}): OperationSchemas;
|
|
727
|
+
getOperations(): Promise<Array<{
|
|
728
|
+
path: string;
|
|
729
|
+
method: HttpMethod;
|
|
730
|
+
operation: Operation$1;
|
|
731
|
+
}>>;
|
|
732
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
733
|
+
}
|
|
753
734
|
//#endregion
|
|
754
735
|
//#region src/SchemaGenerator.d.ts
|
|
755
736
|
type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
756
737
|
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
757
|
-
type Context
|
|
738
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
758
739
|
fabric: Fabric;
|
|
759
740
|
oas: Oas;
|
|
760
741
|
pluginManager: PluginManager;
|
|
@@ -796,7 +777,7 @@ type SchemaProps$1 = {
|
|
|
796
777
|
name?: string;
|
|
797
778
|
parentName?: string;
|
|
798
779
|
};
|
|
799
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context
|
|
780
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
800
781
|
#private;
|
|
801
782
|
refs: Refs;
|
|
802
783
|
/**
|
|
@@ -805,82 +786,52 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
805
786
|
* optionally adds a union with null.
|
|
806
787
|
*/
|
|
807
788
|
parse(props: SchemaProps$1): Schema[];
|
|
808
|
-
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
809
|
-
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
810
789
|
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
811
|
-
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
812
790
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
813
791
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
814
792
|
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
815
793
|
}
|
|
816
794
|
//#endregion
|
|
817
|
-
//#region src/generators/
|
|
818
|
-
type
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
*/
|
|
824
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
825
|
-
options: TOptions['resolvedOptions'];
|
|
826
|
-
};
|
|
827
|
-
declare function buildOperations<TOptions extends PluginFactoryOptions>(operations: Array<Operation$1>, {
|
|
828
|
-
fabric,
|
|
829
|
-
options,
|
|
830
|
-
instance,
|
|
831
|
-
generator
|
|
832
|
-
}: BuildOperationsOptions<TOptions>): Promise<void>;
|
|
833
|
-
type BuildOperationOptions<TOptions extends PluginFactoryOptions> = BuildOperationsOptions<TOptions>;
|
|
834
|
-
declare function buildOperation<TOptions extends PluginFactoryOptions>(operation: Operation$1, {
|
|
835
|
-
fabric,
|
|
836
|
-
options,
|
|
837
|
-
instance,
|
|
838
|
-
generator
|
|
839
|
-
}: BuildOperationOptions<TOptions>): Promise<void>;
|
|
840
|
-
type BuildSchemaOptions<TOptions extends PluginFactoryOptions> = {
|
|
841
|
-
fabric: Fabric;
|
|
842
|
-
generator: ReactGenerator<any>;
|
|
843
|
-
/**
|
|
844
|
-
* @deprecated
|
|
845
|
-
*/
|
|
846
|
-
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
847
|
-
options: TOptions['resolvedOptions'];
|
|
795
|
+
//#region src/generators/createReactGenerator.d.ts
|
|
796
|
+
type UserGenerator$1<TOptions extends PluginFactoryOptions> = {
|
|
797
|
+
name: string;
|
|
798
|
+
Operations?: (props: OperationsProps<TOptions>) => KubbNode;
|
|
799
|
+
Operation?: (props: OperationProps<TOptions>) => KubbNode;
|
|
800
|
+
Schema?: (props: SchemaProps<TOptions>) => KubbNode;
|
|
848
801
|
};
|
|
849
|
-
|
|
802
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
850
803
|
name: string;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
804
|
+
type: 'react';
|
|
805
|
+
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
806
|
+
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
807
|
+
Schema: (props: SchemaProps<TOptions>) => KubbNode;
|
|
808
|
+
};
|
|
809
|
+
/****
|
|
810
|
+
* Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
|
|
811
|
+
*
|
|
812
|
+
* 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.
|
|
813
|
+
*
|
|
814
|
+
* @returns A generator object with async methods for operations, operation, and schema file generation.
|
|
815
|
+
*/
|
|
816
|
+
declare function createReactGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator$1<TOptions>): ReactGenerator<TOptions>;
|
|
863
817
|
//#endregion
|
|
864
818
|
//#region src/generators/types.d.ts
|
|
865
819
|
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
870
|
-
options: TOptions['resolvedOptions'];
|
|
820
|
+
config: Config;
|
|
821
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
822
|
+
plugin: Plugin<TOptions>;
|
|
871
823
|
operations: Array<Operation$1>;
|
|
872
824
|
};
|
|
873
825
|
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
878
|
-
options: TOptions['resolvedOptions'];
|
|
826
|
+
config: Config;
|
|
827
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
828
|
+
plugin: Plugin<TOptions>;
|
|
879
829
|
operation: Operation$1;
|
|
880
830
|
};
|
|
881
831
|
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
882
|
-
|
|
883
|
-
|
|
832
|
+
config: Config;
|
|
833
|
+
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
834
|
+
plugin: Plugin<TOptions>;
|
|
884
835
|
schema: {
|
|
885
836
|
name: string;
|
|
886
837
|
tree: Array<Schema>;
|
|
@@ -889,36 +840,21 @@ type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
|
889
840
|
};
|
|
890
841
|
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
891
842
|
//#endregion
|
|
892
|
-
//#region src/
|
|
893
|
-
type
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
include: Array<Include> | undefined;
|
|
899
|
-
override: Array<Override<TOptions>> | undefined;
|
|
900
|
-
contentType: contentType | undefined;
|
|
901
|
-
pluginManager: PluginManager;
|
|
902
|
-
/**
|
|
903
|
-
* Current plugin
|
|
904
|
-
*/
|
|
905
|
-
plugin: Plugin<TPluginOptions>;
|
|
906
|
-
mode: KubbFile.Mode;
|
|
843
|
+
//#region src/generators/createGenerator.d.ts
|
|
844
|
+
type UserGenerator<TOptions extends PluginFactoryOptions> = {
|
|
845
|
+
name: string;
|
|
846
|
+
operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
847
|
+
operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
848
|
+
schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
907
849
|
};
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
path: string;
|
|
917
|
-
method: HttpMethod;
|
|
918
|
-
operation: Operation$1;
|
|
919
|
-
}>>;
|
|
920
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
921
|
-
}
|
|
850
|
+
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
851
|
+
name: string;
|
|
852
|
+
type: 'core';
|
|
853
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
854
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
855
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
856
|
+
};
|
|
857
|
+
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions>;
|
|
922
858
|
//#endregion
|
|
923
|
-
export {
|
|
924
|
-
//# sourceMappingURL=
|
|
859
|
+
export { PluginFactoryOptions as A, ResolvePathOptions as C, Config as D, FileMetaBase as E, UserPluginWithLifeCycle as M, Output as O, 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, ResolveNameParams as j, Plugin 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 };
|
|
860
|
+
//# sourceMappingURL=createGenerator-CPNglV1d.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getBanner, t as getFooter } from "./getFooter-
|
|
1
|
+
import { n as getBanner, t as getFooter } from "./getFooter-CV73pVXj.js";
|
|
2
2
|
import { camelCase } from "@kubb/core/transformers";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/createGenerator.ts
|
|
@@ -47,8 +47,8 @@ function createReactGenerator(generator) {
|
|
|
47
47
|
//#region src/generators/jsonGenerator.ts
|
|
48
48
|
const jsonGenerator = createGenerator({
|
|
49
49
|
name: "plugin-oas",
|
|
50
|
-
async schema({ schema,
|
|
51
|
-
const { pluginManager, plugin } =
|
|
50
|
+
async schema({ schema, generator }) {
|
|
51
|
+
const { pluginManager, plugin } = generator.context;
|
|
52
52
|
return [{
|
|
53
53
|
...pluginManager.getFile({
|
|
54
54
|
name: camelCase(schema.name),
|
|
@@ -63,12 +63,12 @@ const jsonGenerator = createGenerator({
|
|
|
63
63
|
value: JSON.stringify(schema.value)
|
|
64
64
|
}],
|
|
65
65
|
banner: getBanner({
|
|
66
|
-
oas:
|
|
66
|
+
oas: generator.context.oas,
|
|
67
67
|
output: plugin.options.output,
|
|
68
68
|
config: pluginManager.config
|
|
69
69
|
}),
|
|
70
70
|
format: getFooter({
|
|
71
|
-
oas:
|
|
71
|
+
oas: generator.context.oas,
|
|
72
72
|
output: plugin.options.output
|
|
73
73
|
})
|
|
74
74
|
}];
|
|
@@ -77,4 +77,4 @@ const jsonGenerator = createGenerator({
|
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
79
|
export { createReactGenerator as n, createGenerator as r, jsonGenerator as t };
|
|
80
|
-
//# sourceMappingURL=generators-
|
|
80
|
+
//# sourceMappingURL=generators-CJDEf8Kn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generators-
|
|
1
|
+
{"version":3,"file":"generators-CJDEf8Kn.js","names":[],"sources":["../src/generators/createGenerator.ts","../src/generators/createReactGenerator.ts","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { OperationProps, OperationsProps, SchemaProps } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type CoreGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n type: 'core'\n operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions> {\n return {\n type: 'core',\n async operations() {\n return []\n },\n async operation() {\n return []\n },\n async schema() {\n return []\n },\n ...generator,\n }\n}\n","import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { OperationProps, OperationsProps, SchemaProps } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (props: OperationsProps<TOptions>) => KubbNode\n Operation?: (props: OperationProps<TOptions>) => KubbNode\n Schema?: (props: SchemaProps<TOptions>) => KubbNode\n}\n\nexport type ReactGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n type: 'react'\n Operations: (props: OperationsProps<TOptions>) => KubbNode\n Operation: (props: OperationProps<TOptions>) => KubbNode\n Schema: (props: SchemaProps<TOptions>) => KubbNode\n}\n\n/****\n * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.\n *\n * 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.\n *\n * @returns A generator object with async methods for operations, operation, and schema file generation.\n */\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): ReactGenerator<TOptions> {\n return {\n type: 'react',\n Operations() {\n return null\n },\n Operation() {\n return null\n },\n Schema() {\n return null\n },\n ...generator,\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\nimport { createGenerator } from './createGenerator.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, generator }) {\n const { pluginManager, plugin } = generator.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: generator.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;;AAmBA,SAAgB,gBAAuD,WAA6D;AAClI,QAAO;EACL,MAAM;EACN,MAAM,aAAa;AACjB,UAAO,EAAE;;EAEX,MAAM,YAAY;AAChB,UAAO,EAAE;;EAEX,MAAM,SAAS;AACb,UAAO,EAAE;;EAEX,GAAG;EACJ;;;;;;;;;;;;ACNH,SAAgB,qBAA4D,WAA8D;AACxI,QAAO;EACL,MAAM;EACN,aAAa;AACX,UAAO;;EAET,YAAY;AACV,UAAO;;EAET,SAAS;AACP,UAAO;;EAET,GAAG;EACJ;;;;;ACjCH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,aAAa;EAClC,MAAM,EAAE,eAAe,WAAW,UAAU;AAQ5C,SAAO,CACL;GACE,GATS,cAAc,QAAQ;IACjC,MAAM,UAAU,OAAO,KAAK;IAC5B,SAAS;IACT,MAAM;IACN,WAAW,OAAO;IACnB,CAAC;GAKE,SAAS,CACP;IACE,MAAM,UAAU,OAAO,KAAK;IAC5B,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO,MAAM;IACpC,CACF;GACD,QAAQ,UAAU;IAChB,KAAK,UAAU,QAAQ;IACvB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;IACvB,CAAC;GACF,QAAQ,UAAU;IAAE,KAAK,UAAU,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GACjF,CACF;;CAEJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_getFooter = require('./getFooter-
|
|
2
|
+
const require_getFooter = require('./getFooter-DPh4lxBH.cjs');
|
|
3
3
|
let __kubb_core_transformers = require("@kubb/core/transformers");
|
|
4
4
|
__kubb_core_transformers = require_chunk.__toESM(__kubb_core_transformers);
|
|
5
5
|
|
|
@@ -49,8 +49,8 @@ function createReactGenerator(generator) {
|
|
|
49
49
|
//#region src/generators/jsonGenerator.ts
|
|
50
50
|
const jsonGenerator = createGenerator({
|
|
51
51
|
name: "plugin-oas",
|
|
52
|
-
async schema({ schema,
|
|
53
|
-
const { pluginManager, plugin } =
|
|
52
|
+
async schema({ schema, generator }) {
|
|
53
|
+
const { pluginManager, plugin } = generator.context;
|
|
54
54
|
return [{
|
|
55
55
|
...pluginManager.getFile({
|
|
56
56
|
name: (0, __kubb_core_transformers.camelCase)(schema.name),
|
|
@@ -65,12 +65,12 @@ const jsonGenerator = createGenerator({
|
|
|
65
65
|
value: JSON.stringify(schema.value)
|
|
66
66
|
}],
|
|
67
67
|
banner: require_getFooter.getBanner({
|
|
68
|
-
oas:
|
|
68
|
+
oas: generator.context.oas,
|
|
69
69
|
output: plugin.options.output,
|
|
70
70
|
config: pluginManager.config
|
|
71
71
|
}),
|
|
72
72
|
format: require_getFooter.getFooter({
|
|
73
|
-
oas:
|
|
73
|
+
oas: generator.context.oas,
|
|
74
74
|
output: plugin.options.output
|
|
75
75
|
})
|
|
76
76
|
}];
|
|
@@ -96,4 +96,4 @@ Object.defineProperty(exports, 'jsonGenerator', {
|
|
|
96
96
|
return jsonGenerator;
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
|
-
//# sourceMappingURL=generators-
|
|
99
|
+
//# sourceMappingURL=generators-udGOxdUV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generators-
|
|
1
|
+
{"version":3,"file":"generators-udGOxdUV.cjs","names":["getBanner","getFooter"],"sources":["../src/generators/createGenerator.ts","../src/generators/createReactGenerator.ts","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { OperationProps, OperationsProps, SchemaProps } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type CoreGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n type: 'core'\n operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions> {\n return {\n type: 'core',\n async operations() {\n return []\n },\n async operation() {\n return []\n },\n async schema() {\n return []\n },\n ...generator,\n }\n}\n","import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { OperationProps, OperationsProps, SchemaProps } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (props: OperationsProps<TOptions>) => KubbNode\n Operation?: (props: OperationProps<TOptions>) => KubbNode\n Schema?: (props: SchemaProps<TOptions>) => KubbNode\n}\n\nexport type ReactGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n type: 'react'\n Operations: (props: OperationsProps<TOptions>) => KubbNode\n Operation: (props: OperationProps<TOptions>) => KubbNode\n Schema: (props: SchemaProps<TOptions>) => KubbNode\n}\n\n/****\n * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.\n *\n * 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.\n *\n * @returns A generator object with async methods for operations, operation, and schema file generation.\n */\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): ReactGenerator<TOptions> {\n return {\n type: 'react',\n Operations() {\n return null\n },\n Operation() {\n return null\n },\n Schema() {\n return null\n },\n ...generator,\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\nimport { createGenerator } from './createGenerator.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, generator }) {\n const { pluginManager, plugin } = generator.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: generator.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;;;;AAmBA,SAAgB,gBAAuD,WAA6D;AAClI,QAAO;EACL,MAAM;EACN,MAAM,aAAa;AACjB,UAAO,EAAE;;EAEX,MAAM,YAAY;AAChB,UAAO,EAAE;;EAEX,MAAM,SAAS;AACb,UAAO,EAAE;;EAEX,GAAG;EACJ;;;;;;;;;;;;ACNH,SAAgB,qBAA4D,WAA8D;AACxI,QAAO;EACL,MAAM;EACN,aAAa;AACX,UAAO;;EAET,YAAY;AACV,UAAO;;EAET,SAAS;AACP,UAAO;;EAET,GAAG;EACJ;;;;;ACjCH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,aAAa;EAClC,MAAM,EAAE,eAAe,WAAW,UAAU;AAQ5C,SAAO,CACL;GACE,GATS,cAAc,QAAQ;IACjC,8CAAgB,OAAO,KAAK;IAC5B,SAAS;IACT,MAAM;IACN,WAAW,OAAO;IACnB,CAAC;GAKE,SAAS,CACP;IACE,8CAAgB,OAAO,KAAK;IAC5B,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO,MAAM;IACpC,CACF;GACD,QAAQA,4BAAU;IAChB,KAAK,UAAU,QAAQ;IACvB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;IACvB,CAAC;GACF,QAAQC,4BAAU;IAAE,KAAK,UAAU,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GACjF,CACF;;CAEJ,CAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
const require_generators = require('./generators-
|
|
2
|
-
require('./getFooter-
|
|
3
|
-
require('./Oas-CQrRP_NH.cjs');
|
|
4
|
-
const require_utils = require('./utils-DYf-j63H.cjs');
|
|
1
|
+
const require_generators = require('./generators-udGOxdUV.cjs');
|
|
2
|
+
require('./getFooter-DPh4lxBH.cjs');
|
|
5
3
|
|
|
6
|
-
exports.buildOperation = require_utils.buildOperation;
|
|
7
|
-
exports.buildOperations = require_utils.buildOperations;
|
|
8
|
-
exports.buildSchema = require_utils.buildSchema;
|
|
9
4
|
exports.createGenerator = require_generators.createGenerator;
|
|
10
5
|
exports.createReactGenerator = require_generators.createReactGenerator;
|
|
11
6
|
exports.jsonGenerator = require_generators.jsonGenerator;
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./SchemaMapper-
|
|
3
|
-
|
|
1
|
+
import { a as createReactGenerator, b as PluginOas, n as createGenerator, r as Generator, t as CoreGenerator } from "./createGenerator-CPNglV1d.cjs";
|
|
2
|
+
import "./SchemaMapper-CgGWx6jF.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/generators/jsonGenerator.d.ts
|
|
5
|
+
declare const jsonGenerator: CoreGenerator<PluginOas>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type Generator, createGenerator, createReactGenerator, jsonGenerator };
|
|
8
|
+
//# sourceMappingURL=generators.d.cts.map
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./SchemaMapper-
|
|
3
|
-
|
|
1
|
+
import { a as createReactGenerator, b as PluginOas, n as createGenerator, r as Generator, t as CoreGenerator } from "./createGenerator-BvCDyuKS.js";
|
|
2
|
+
import "./SchemaMapper-Cj3vjPGs.js";
|
|
3
|
+
|
|
4
|
+
//#region src/generators/jsonGenerator.d.ts
|
|
5
|
+
declare const jsonGenerator: CoreGenerator<PluginOas>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type Generator, createGenerator, createReactGenerator, jsonGenerator };
|
|
8
|
+
//# sourceMappingURL=generators.d.ts.map
|
package/dist/generators.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { n as createReactGenerator, r as createGenerator, t as jsonGenerator } from "./generators-
|
|
2
|
-
import "./getFooter-
|
|
3
|
-
import "./Oas-CHC1IC5D.js";
|
|
4
|
-
import { n as buildOperations, r as buildSchema, t as buildOperation } from "./utils-DaV25sy8.js";
|
|
1
|
+
import { n as createReactGenerator, r as createGenerator, t as jsonGenerator } from "./generators-CJDEf8Kn.js";
|
|
2
|
+
import "./getFooter-CV73pVXj.js";
|
|
5
3
|
|
|
6
|
-
export {
|
|
4
|
+
export { createGenerator, createReactGenerator, jsonGenerator };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isFunction } from "remeda";
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
import { isFunction } from "remeda";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/getBanner.ts
|
|
5
5
|
/**
|
|
@@ -55,4 +55,4 @@ function getFooter({ output, oas }) {
|
|
|
55
55
|
|
|
56
56
|
//#endregion
|
|
57
57
|
export { getBanner as n, getFooter as t };
|
|
58
|
-
//# sourceMappingURL=getFooter-
|
|
58
|
+
//# sourceMappingURL=getFooter-CV73pVXj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFooter-
|
|
1
|
+
{"version":3,"file":"getFooter-CV73pVXj.js","names":[],"sources":["../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"sourcesContent":["import path from 'node:path'\nimport type { Config, Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props<TOas extends Oas> = {\n oas: TOas\n output: Output<any>\n config?: Config\n}\n\n/**\n * Generate a default banner for files created by Kubb\n * @returns A string with the default banner\n */\nfunction getDefaultBanner({ title, description, version, config }: { title?: string; description?: string; version?: string; config: Config }): string {\n try {\n let source = ''\n if ('path' in config.input) {\n source = path.basename(config.input.path)\n } else if ('data' in config.input) {\n source = 'text content'\n }\n\n let banner = '/**\\n* Generated by Kubb (https://kubb.dev/).\\n* Do not edit manually.\\n'\n\n if (config.output.defaultBanner === 'simple') {\n banner += '*/\\n'\n return banner\n }\n\n if (source) {\n banner += `* Source: ${source}\\n`\n }\n\n if (title) {\n banner += `* Title: ${title}\\n`\n }\n\n if (description) {\n const formattedDescription = description.replace(/\\n/gm, '\\n* ')\n banner += `* Description: ${formattedDescription}\\n`\n }\n\n if (version) {\n banner += `* OpenAPI spec version: ${version}\\n`\n }\n\n banner += '*/\\n'\n return banner\n } catch (_error) {\n // If there's any error in parsing the Oas data, return a simpler banner\n return '/**\\n* Generated by Kubb (https://kubb.dev/).\\n* Do not edit manually.\\n*/'\n }\n}\n\nexport function getBanner<TOas extends Oas>({ output, oas, config }: Props<TOas>): string {\n let banner = ''\n if (config?.output?.defaultBanner !== false && config) {\n const { title, description, version } = oas.api?.info || {}\n\n banner = getDefaultBanner({ title, description, version, config })\n }\n\n if (!output.banner) {\n return banner\n }\n\n if (isFunction(output.banner)) {\n return `${output.banner(oas)}\\n${banner}`\n }\n\n return `${output.banner}\\n${banner}`\n}\n","import type { Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props<TOas extends Oas> = {\n oas: TOas\n output: Output<any>\n}\n\nexport function getFooter<TOas extends Oas>({ output, oas }: Props<TOas>) {\n if (!output.footer) {\n return undefined\n }\n\n if (isFunction(output.footer)) {\n return output.footer(oas)\n }\n\n return output.footer\n}\n"],"mappings":";;;;;;;;AAeA,SAAS,iBAAiB,EAAE,OAAO,aAAa,SAAS,UAA8F;AACrJ,KAAI;EACF,IAAI,SAAS;AACb,MAAI,UAAU,OAAO,MACnB,UAAS,KAAK,SAAS,OAAO,MAAM,KAAK;WAChC,UAAU,OAAO,MAC1B,UAAS;EAGX,IAAI,SAAS;AAEb,MAAI,OAAO,OAAO,kBAAkB,UAAU;AAC5C,aAAU;AACV,UAAO;;AAGT,MAAI,OACF,WAAU,aAAa,OAAO;AAGhC,MAAI,MACF,WAAU,YAAY,MAAM;AAG9B,MAAI,aAAa;GACf,MAAM,uBAAuB,YAAY,QAAQ,QAAQ,OAAO;AAChE,aAAU,kBAAkB,qBAAqB;;AAGnD,MAAI,QACF,WAAU,2BAA2B,QAAQ;AAG/C,YAAU;AACV,SAAO;UACA,QAAQ;AAEf,SAAO;;;AAIX,SAAgB,UAA4B,EAAE,QAAQ,KAAK,UAA+B;CACxF,IAAI,SAAS;AACb,KAAI,QAAQ,QAAQ,kBAAkB,SAAS,QAAQ;EACrD,MAAM,EAAE,OAAO,aAAa,YAAY,IAAI,KAAK,QAAQ,EAAE;AAE3D,WAAS,iBAAiB;GAAE;GAAO;GAAa;GAAS;GAAQ,CAAC;;AAGpE,KAAI,CAAC,OAAO,OACV,QAAO;AAGT,KAAI,WAAW,OAAO,OAAO,CAC3B,QAAO,GAAG,OAAO,OAAO,IAAI,CAAC,IAAI;AAGnC,QAAO,GAAG,OAAO,OAAO,IAAI;;;;;AC/D9B,SAAgB,UAA4B,EAAE,QAAQ,OAAoB;AACxE,KAAI,CAAC,OAAO,OACV;AAGF,KAAI,WAAW,OAAO,OAAO,CAC3B,QAAO,OAAO,OAAO,IAAI;AAG3B,QAAO,OAAO"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
let remeda = require("remeda");
|
|
3
|
-
remeda = require_chunk.__toESM(remeda);
|
|
4
2
|
let node_path = require("node:path");
|
|
5
3
|
node_path = require_chunk.__toESM(node_path);
|
|
4
|
+
let remeda = require("remeda");
|
|
5
|
+
remeda = require_chunk.__toESM(remeda);
|
|
6
6
|
|
|
7
7
|
//#region src/utils/getBanner.ts
|
|
8
8
|
/**
|
|
@@ -69,4 +69,4 @@ Object.defineProperty(exports, 'getFooter', {
|
|
|
69
69
|
return getFooter;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
//# sourceMappingURL=getFooter-
|
|
72
|
+
//# sourceMappingURL=getFooter-DPh4lxBH.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFooter-
|
|
1
|
+
{"version":3,"file":"getFooter-DPh4lxBH.cjs","names":["path"],"sources":["../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"sourcesContent":["import path from 'node:path'\nimport type { Config, Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props<TOas extends Oas> = {\n oas: TOas\n output: Output<any>\n config?: Config\n}\n\n/**\n * Generate a default banner for files created by Kubb\n * @returns A string with the default banner\n */\nfunction getDefaultBanner({ title, description, version, config }: { title?: string; description?: string; version?: string; config: Config }): string {\n try {\n let source = ''\n if ('path' in config.input) {\n source = path.basename(config.input.path)\n } else if ('data' in config.input) {\n source = 'text content'\n }\n\n let banner = '/**\\n* Generated by Kubb (https://kubb.dev/).\\n* Do not edit manually.\\n'\n\n if (config.output.defaultBanner === 'simple') {\n banner += '*/\\n'\n return banner\n }\n\n if (source) {\n banner += `* Source: ${source}\\n`\n }\n\n if (title) {\n banner += `* Title: ${title}\\n`\n }\n\n if (description) {\n const formattedDescription = description.replace(/\\n/gm, '\\n* ')\n banner += `* Description: ${formattedDescription}\\n`\n }\n\n if (version) {\n banner += `* OpenAPI spec version: ${version}\\n`\n }\n\n banner += '*/\\n'\n return banner\n } catch (_error) {\n // If there's any error in parsing the Oas data, return a simpler banner\n return '/**\\n* Generated by Kubb (https://kubb.dev/).\\n* Do not edit manually.\\n*/'\n }\n}\n\nexport function getBanner<TOas extends Oas>({ output, oas, config }: Props<TOas>): string {\n let banner = ''\n if (config?.output?.defaultBanner !== false && config) {\n const { title, description, version } = oas.api?.info || {}\n\n banner = getDefaultBanner({ title, description, version, config })\n }\n\n if (!output.banner) {\n return banner\n }\n\n if (isFunction(output.banner)) {\n return `${output.banner(oas)}\\n${banner}`\n }\n\n return `${output.banner}\\n${banner}`\n}\n","import type { Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props<TOas extends Oas> = {\n oas: TOas\n output: Output<any>\n}\n\nexport function getFooter<TOas extends Oas>({ output, oas }: Props<TOas>) {\n if (!output.footer) {\n return undefined\n }\n\n if (isFunction(output.footer)) {\n return output.footer(oas)\n }\n\n return output.footer\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAS,iBAAiB,EAAE,OAAO,aAAa,SAAS,UAA8F;AACrJ,KAAI;EACF,IAAI,SAAS;AACb,MAAI,UAAU,OAAO,MACnB,UAASA,kBAAK,SAAS,OAAO,MAAM,KAAK;WAChC,UAAU,OAAO,MAC1B,UAAS;EAGX,IAAI,SAAS;AAEb,MAAI,OAAO,OAAO,kBAAkB,UAAU;AAC5C,aAAU;AACV,UAAO;;AAGT,MAAI,OACF,WAAU,aAAa,OAAO;AAGhC,MAAI,MACF,WAAU,YAAY,MAAM;AAG9B,MAAI,aAAa;GACf,MAAM,uBAAuB,YAAY,QAAQ,QAAQ,OAAO;AAChE,aAAU,kBAAkB,qBAAqB;;AAGnD,MAAI,QACF,WAAU,2BAA2B,QAAQ;AAG/C,YAAU;AACV,SAAO;UACA,QAAQ;AAEf,SAAO;;;AAIX,SAAgB,UAA4B,EAAE,QAAQ,KAAK,UAA+B;CACxF,IAAI,SAAS;AACb,KAAI,QAAQ,QAAQ,kBAAkB,SAAS,QAAQ;EACrD,MAAM,EAAE,OAAO,aAAa,YAAY,IAAI,KAAK,QAAQ,EAAE;AAE3D,WAAS,iBAAiB;GAAE;GAAO;GAAa;GAAS;GAAQ,CAAC;;AAGpE,KAAI,CAAC,OAAO,OACV,QAAO;AAGT,4BAAe,OAAO,OAAO,CAC3B,QAAO,GAAG,OAAO,OAAO,IAAI,CAAC,IAAI;AAGnC,QAAO,GAAG,OAAO,OAAO,IAAI;;;;;AC/D9B,SAAgB,UAA4B,EAAE,QAAQ,OAAoB;AACxE,KAAI,CAAC,OAAO,OACV;AAGF,4BAAe,OAAO,OAAO,CAC3B,QAAO,OAAO,OAAO,IAAI;AAG3B,QAAO,OAAO"}
|