@kubb/plugin-oas 0.0.0-canary-20251028170426 → 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-DWj6buY0.cjs → SchemaGenerator-B8Reay1m.cjs} +114 -16
- package/dist/SchemaGenerator-B8Reay1m.cjs.map +1 -0
- package/dist/{SchemaGenerator-b7XixzRv.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-DoL-a6qq.cjs.map → SchemaMapper-BUV8vhg0.cjs.map} +1 -1
- package/dist/{SchemaMapper-Cx4X1al6.js → SchemaMapper-D30tqRoX.js} +1 -1
- package/dist/{SchemaMapper-Cx4X1al6.js.map → SchemaMapper-D30tqRoX.js.map} +1 -1
- package/dist/{SchemaMapper-CtfTw3hq.d.ts → SchemaMapper-m5TKynWt.d.ts} +1 -1
- package/dist/{OperationGenerator-CRZpkIpZ.d.ts → createGenerator-DlSlv4sR.d.ts} +114 -167
- package/dist/{OperationGenerator-S_1PevQN.d.cts → createGenerator-PIseu7v9.d.cts} +114 -167
- 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 +7 -2
- 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 +4 -29
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +3 -17
- 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 +57 -2
- 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.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 +23 -23
- package/dist/utils.d.ts +24 -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 +18 -10
- 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 +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-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/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.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-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,4 +1,7 @@
|
|
|
1
1
|
import { i as SchemaKeywordMapper, t as Schema } from "./SchemaMapper-CX7sIIuZ.cjs";
|
|
2
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
|
+
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
4
|
+
import { ConsolaInstance, LogLevel } from "consola";
|
|
2
5
|
import * as OasTypes from "oas/types";
|
|
3
6
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
4
7
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -6,45 +9,7 @@ import { OpenAPIV3, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1 } from "openapi-types"
|
|
|
6
9
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
7
10
|
import BaseOas from "oas";
|
|
8
11
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
9
|
-
import { KubbFile } from "@kubb/fabric-core/types";
|
|
10
|
-
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
11
|
-
import { ConsolaInstance, LogLevel } from "consola";
|
|
12
12
|
|
|
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
13
|
//#region ../core/src/BaseGenerator.d.ts
|
|
49
14
|
/**
|
|
50
15
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
@@ -422,7 +387,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
422
387
|
result: Result;
|
|
423
388
|
plugin: Plugin;
|
|
424
389
|
};
|
|
425
|
-
type Options$
|
|
390
|
+
type Options$3 = {
|
|
426
391
|
fabric: Fabric;
|
|
427
392
|
logger: Logger;
|
|
428
393
|
/**
|
|
@@ -449,8 +414,8 @@ declare class PluginManager {
|
|
|
449
414
|
readonly config: Config;
|
|
450
415
|
readonly executed: Array<Executer>;
|
|
451
416
|
readonly logger: Logger;
|
|
452
|
-
readonly options: Options$
|
|
453
|
-
constructor(config: Config, options: Options$
|
|
417
|
+
readonly options: Options$3;
|
|
418
|
+
constructor(config: Config, options: Options$3);
|
|
454
419
|
getFile<TOptions = object>({
|
|
455
420
|
name,
|
|
456
421
|
mode,
|
|
@@ -557,44 +522,40 @@ type FileMetaBase = {
|
|
|
557
522
|
pluginKey?: Plugin['key'];
|
|
558
523
|
};
|
|
559
524
|
//#endregion
|
|
560
|
-
//#region src/
|
|
561
|
-
type
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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[]>;
|
|
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;
|
|
573
530
|
};
|
|
574
|
-
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator$1<TOptions>): CoreGenerator<TOptions>;
|
|
575
531
|
//#endregion
|
|
576
|
-
//#region src/
|
|
577
|
-
type
|
|
578
|
-
|
|
579
|
-
|
|
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;
|
|
532
|
+
//#region ../oas/src/Oas.d.ts
|
|
533
|
+
type Options$2 = {
|
|
534
|
+
contentType?: contentType;
|
|
535
|
+
discriminator?: 'strict' | 'inherit';
|
|
589
536
|
};
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
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
|
+
}
|
|
598
559
|
//#endregion
|
|
599
560
|
//#region src/types.d.ts
|
|
600
561
|
type ResolvePathOptions = {
|
|
@@ -748,13 +709,41 @@ type ResolvedOptions = Options$1 & {
|
|
|
748
709
|
};
|
|
749
710
|
type PluginOas = PluginFactoryOptions<'plugin-oas', Options$1, ResolvedOptions, API, ResolvePathOptions>;
|
|
750
711
|
//#endregion
|
|
751
|
-
//#region src/
|
|
752
|
-
|
|
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
|
+
}
|
|
753
742
|
//#endregion
|
|
754
743
|
//#region src/SchemaGenerator.d.ts
|
|
755
744
|
type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
|
|
756
745
|
type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
|
|
757
|
-
type Context
|
|
746
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
758
747
|
fabric: Fabric;
|
|
759
748
|
oas: Oas;
|
|
760
749
|
pluginManager: PluginManager;
|
|
@@ -796,7 +785,7 @@ type SchemaProps$1 = {
|
|
|
796
785
|
name?: string;
|
|
797
786
|
parentName?: string;
|
|
798
787
|
};
|
|
799
|
-
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>> {
|
|
800
789
|
#private;
|
|
801
790
|
refs: Refs;
|
|
802
791
|
/**
|
|
@@ -814,73 +803,46 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
814
803
|
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
815
804
|
}
|
|
816
805
|
//#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'];
|
|
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;
|
|
848
812
|
};
|
|
849
|
-
|
|
813
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
850
814
|
name: string;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
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>;
|
|
863
828
|
//#endregion
|
|
864
829
|
//#region src/generators/types.d.ts
|
|
865
830
|
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
870
|
-
options: TOptions['resolvedOptions'];
|
|
831
|
+
config: Config;
|
|
832
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
833
|
+
plugin: Plugin<TOptions>;
|
|
871
834
|
operations: Array<Operation$1>;
|
|
872
835
|
};
|
|
873
836
|
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
878
|
-
options: TOptions['resolvedOptions'];
|
|
837
|
+
config: Config;
|
|
838
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
839
|
+
plugin: Plugin<TOptions>;
|
|
879
840
|
operation: Operation$1;
|
|
880
841
|
};
|
|
881
842
|
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
882
|
-
|
|
883
|
-
|
|
843
|
+
config: Config;
|
|
844
|
+
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
845
|
+
plugin: Plugin<TOptions>;
|
|
884
846
|
schema: {
|
|
885
847
|
name: string;
|
|
886
848
|
tree: Array<Schema>;
|
|
@@ -889,36 +851,21 @@ type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
|
889
851
|
};
|
|
890
852
|
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
891
853
|
//#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;
|
|
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[]>;
|
|
907
860
|
};
|
|
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
|
-
}
|
|
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>;
|
|
922
869
|
//#endregion
|
|
923
|
-
export {
|
|
924
|
-
//# 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-PIseu7v9.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 {
|
|
1
|
+
import { a as createReactGenerator, b as PluginOas, n as createGenerator, r as Generator, t as CoreGenerator } from "./createGenerator-PIseu7v9.cjs";
|
|
2
2
|
import "./SchemaMapper-CX7sIIuZ.cjs";
|
|
3
|
-
|
|
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-DlSlv4sR.js";
|
|
2
|
+
import "./SchemaMapper-m5TKynWt.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"}
|