@kubb/plugin-ts 4.4.1 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -557,170 +557,6 @@ type FileMetaBase = {
557
557
  pluginKey?: Plugin['key'];
558
558
  };
559
559
  //#endregion
560
- //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
561
- type ReactGenerator<TOptions extends PluginFactoryOptions> = {
562
- name: string;
563
- type: 'react';
564
- Operations: (props: OperationsProps<TOptions>) => KubbNode;
565
- Operation: (props: OperationProps<TOptions>) => KubbNode;
566
- Schema: (props: SchemaProps$1<TOptions>) => KubbNode;
567
- };
568
- //#endregion
569
- //#region ../plugin-oas/src/generators/types.d.ts
570
- type OperationsProps<TOptions extends PluginFactoryOptions> = {
571
- /**
572
- * @deprecated
573
- */
574
- instance: Omit<OperationGenerator<TOptions>, 'build'>;
575
- options: TOptions['resolvedOptions'];
576
- operations: Array<Operation$1>;
577
- };
578
- type OperationProps<TOptions extends PluginFactoryOptions> = {
579
- /**
580
- * @deprecated
581
- */
582
- instance: Omit<OperationGenerator<TOptions>, 'build'>;
583
- options: TOptions['resolvedOptions'];
584
- operation: Operation$1;
585
- };
586
- type SchemaProps$1<TOptions extends PluginFactoryOptions> = {
587
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
588
- options: TOptions['resolvedOptions'];
589
- schema: {
590
- name: string;
591
- tree: Array<Schema>;
592
- value: SchemaObject$1;
593
- };
594
- };
595
- type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
596
- //#endregion
597
- //#region ../plugin-oas/src/generators/createGenerator.d.ts
598
- type CoreGenerator<TOptions extends PluginFactoryOptions> = {
599
- name: string;
600
- type: 'core';
601
- operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
602
- operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
603
- schema: (props: SchemaProps$1<TOptions>) => Promise<KubbFile.File[]>;
604
- };
605
- //#endregion
606
- //#region ../plugin-oas/src/types.d.ts
607
- type ResolvePathOptions = {
608
- pluginKey?: Plugin['key'];
609
- group?: {
610
- tag?: string;
611
- path?: string;
612
- };
613
- type?: ResolveNameParams['type'];
614
- };
615
- /**
616
- * `propertyName` is the ref name + resolved with the nameResolver
617
- * @example import { Pet } from './Pet'
618
- *
619
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
620
- *
621
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
622
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
623
- */
624
- type Ref = {
625
- propertyName: string;
626
- originalName: string;
627
- path: KubbFile.OptionalPath;
628
- pluginKey?: Plugin['key'];
629
- };
630
- type Refs = Record<string, Ref>;
631
- type OperationSchema = {
632
- /**
633
- * Converted name, contains already `PathParams`, `QueryParams`, ...
634
- */
635
- name: string;
636
- schema: SchemaObject$1;
637
- operation?: Operation$1;
638
- /**
639
- * OperationName in PascalCase, only being used in OperationGenerator
640
- */
641
- operationName: string;
642
- description?: string;
643
- statusCode?: number;
644
- keys?: string[];
645
- keysToOmit?: string[];
646
- withData?: boolean;
647
- };
648
- type OperationSchemas = {
649
- pathParams?: OperationSchema & {
650
- keysToOmit?: never;
651
- };
652
- queryParams?: OperationSchema & {
653
- keysToOmit?: never;
654
- };
655
- headerParams?: OperationSchema & {
656
- keysToOmit?: never;
657
- };
658
- request?: OperationSchema;
659
- response: OperationSchema;
660
- responses: Array<OperationSchema>;
661
- statusCodes?: Array<OperationSchema>;
662
- errors?: Array<OperationSchema>;
663
- };
664
- type ByTag = {
665
- type: 'tag';
666
- pattern: string | RegExp;
667
- };
668
- type ByOperationId = {
669
- type: 'operationId';
670
- pattern: string | RegExp;
671
- };
672
- type ByPath = {
673
- type: 'path';
674
- pattern: string | RegExp;
675
- };
676
- type ByMethod = {
677
- type: 'method';
678
- pattern: HttpMethod | RegExp;
679
- };
680
- type BySchemaName = {
681
- type: 'schemaName';
682
- pattern: string | RegExp;
683
- };
684
- type ByContentType = {
685
- type: 'contentType';
686
- pattern: string | RegExp;
687
- };
688
- type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
689
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
690
- type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
691
- options: Partial<TOptions>;
692
- };
693
- //#endregion
694
- //#region ../plugin-oas/src/OperationGenerator.d.ts
695
- type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
696
- fabric: Fabric;
697
- oas: Oas;
698
- exclude: Array<Exclude$1> | undefined;
699
- include: Array<Include> | undefined;
700
- override: Array<Override<TOptions>> | undefined;
701
- contentType: contentType | undefined;
702
- pluginManager: PluginManager;
703
- /**
704
- * Current plugin
705
- */
706
- plugin: Plugin<TPluginOptions>;
707
- mode: KubbFile.Mode;
708
- };
709
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
710
- #private;
711
- getSchemas(operation: Operation$1, {
712
- resolveName
713
- }?: {
714
- resolveName?: (name: string) => string;
715
- }): OperationSchemas;
716
- getOperations(): Promise<Array<{
717
- path: string;
718
- method: HttpMethod;
719
- operation: Operation$1;
720
- }>>;
721
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
722
- }
723
- //#endregion
724
560
  //#region ../plugin-oas/src/SchemaMapper.d.ts
725
561
  type SchemaKeywordMapper = {
726
562
  object: {
@@ -938,8 +774,96 @@ type Schema = {
938
774
  keyword: string;
939
775
  } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
940
776
  //#endregion
777
+ //#region ../plugin-oas/src/types.d.ts
778
+ type ResolvePathOptions = {
779
+ pluginKey?: Plugin['key'];
780
+ group?: {
781
+ tag?: string;
782
+ path?: string;
783
+ };
784
+ type?: ResolveNameParams['type'];
785
+ };
786
+ /**
787
+ * `propertyName` is the ref name + resolved with the nameResolver
788
+ * @example import { Pet } from './Pet'
789
+ *
790
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
791
+ *
792
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
793
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
794
+ */
795
+ type Ref = {
796
+ propertyName: string;
797
+ originalName: string;
798
+ path: KubbFile.OptionalPath;
799
+ pluginKey?: Plugin['key'];
800
+ };
801
+ type Refs = Record<string, Ref>;
802
+ type OperationSchema = {
803
+ /**
804
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
805
+ */
806
+ name: string;
807
+ schema: SchemaObject$1;
808
+ operation?: Operation$1;
809
+ /**
810
+ * OperationName in PascalCase, only being used in OperationGenerator
811
+ */
812
+ operationName: string;
813
+ description?: string;
814
+ statusCode?: number;
815
+ keys?: string[];
816
+ keysToOmit?: string[];
817
+ withData?: boolean;
818
+ };
819
+ type OperationSchemas = {
820
+ pathParams?: OperationSchema & {
821
+ keysToOmit?: never;
822
+ };
823
+ queryParams?: OperationSchema & {
824
+ keysToOmit?: never;
825
+ };
826
+ headerParams?: OperationSchema & {
827
+ keysToOmit?: never;
828
+ };
829
+ request?: OperationSchema;
830
+ response: OperationSchema;
831
+ responses: Array<OperationSchema>;
832
+ statusCodes?: Array<OperationSchema>;
833
+ errors?: Array<OperationSchema>;
834
+ };
835
+ type ByTag = {
836
+ type: 'tag';
837
+ pattern: string | RegExp;
838
+ };
839
+ type ByOperationId = {
840
+ type: 'operationId';
841
+ pattern: string | RegExp;
842
+ };
843
+ type ByPath = {
844
+ type: 'path';
845
+ pattern: string | RegExp;
846
+ };
847
+ type ByMethod = {
848
+ type: 'method';
849
+ pattern: HttpMethod | RegExp;
850
+ };
851
+ type BySchemaName = {
852
+ type: 'schemaName';
853
+ pattern: string | RegExp;
854
+ };
855
+ type ByContentType = {
856
+ type: 'contentType';
857
+ pattern: string | RegExp;
858
+ };
859
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
860
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
861
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
862
+ options: Partial<TOptions>;
863
+ };
864
+ //#endregion
941
865
  //#region ../plugin-oas/src/SchemaGenerator.d.ts
942
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
866
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
943
867
  fabric: Fabric;
944
868
  oas: Oas;
945
869
  pluginManager: PluginManager;
@@ -972,15 +896,15 @@ type SchemaGeneratorOptions = {
972
896
  * TODO TODO add docs
973
897
  * @beta
974
898
  */
975
- schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined;
899
+ schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
976
900
  };
977
901
  };
978
- type SchemaProps = {
902
+ type SchemaProps$1 = {
979
903
  schemaObject?: SchemaObject$1;
980
904
  name?: string;
981
905
  parentName?: string;
982
906
  };
983
- declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
907
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
984
908
  #private;
985
909
  refs: Refs;
986
910
  /**
@@ -988,16 +912,86 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
988
912
  * Delegates to getBaseTypeFromSchema internally and
989
913
  * optionally adds a union with null.
990
914
  */
991
- parse(props: SchemaProps): Schema[];
992
- deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
993
- find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
915
+ parse(props: SchemaProps$1): Schema[];
994
916
  static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
995
- static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
996
917
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
997
918
  static combineObjects(tree: Schema[] | undefined): Schema[];
998
919
  build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
999
920
  }
1000
921
  //#endregion
922
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
923
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
924
+ name: string;
925
+ type: 'core';
926
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
927
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
928
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
929
+ };
930
+ //#endregion
931
+ //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
932
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
933
+ name: string;
934
+ type: 'react';
935
+ Operations: (props: OperationsProps<TOptions>) => KubbNode;
936
+ Operation: (props: OperationProps<TOptions>) => KubbNode;
937
+ Schema: (props: SchemaProps<TOptions>) => KubbNode;
938
+ };
939
+ //#endregion
940
+ //#region ../plugin-oas/src/generators/types.d.ts
941
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
942
+ config: Config;
943
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
944
+ plugin: Plugin<TOptions>;
945
+ operations: Array<Operation$1>;
946
+ };
947
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
948
+ config: Config;
949
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
950
+ plugin: Plugin<TOptions>;
951
+ operation: Operation$1;
952
+ };
953
+ type SchemaProps<TOptions extends PluginFactoryOptions> = {
954
+ config: Config;
955
+ generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
956
+ plugin: Plugin<TOptions>;
957
+ schema: {
958
+ name: string;
959
+ tree: Array<Schema>;
960
+ value: SchemaObject$1;
961
+ };
962
+ };
963
+ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
964
+ //#endregion
965
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
966
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
967
+ fabric: Fabric;
968
+ oas: Oas;
969
+ exclude: Array<Exclude$1> | undefined;
970
+ include: Array<Include> | undefined;
971
+ override: Array<Override<TOptions>> | undefined;
972
+ contentType: contentType | undefined;
973
+ pluginManager: PluginManager;
974
+ /**
975
+ * Current plugin
976
+ */
977
+ plugin: Plugin<TPluginOptions>;
978
+ mode: KubbFile.Mode;
979
+ };
980
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
981
+ #private;
982
+ getSchemas(operation: Operation$1, {
983
+ resolveName
984
+ }?: {
985
+ resolveName?: (name: string) => string;
986
+ }): OperationSchemas;
987
+ getOperations(): Promise<Array<{
988
+ path: string;
989
+ method: HttpMethod;
990
+ operation: Operation$1;
991
+ }>>;
992
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
993
+ }
994
+ //#endregion
1001
995
  //#region src/types.d.ts
1002
996
  type Options$1 = {
1003
997
  /**
@@ -1110,5 +1104,5 @@ type PluginTs = PluginFactoryOptions<'plugin-ts', Options$1, ResolvedOptions, {
1110
1104
  usedEnumNames: Record<string, number>;
1111
1105
  }, ResolvePathOptions>;
1112
1106
  //#endregion
1113
- export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginTs as n, OasTypes as o, Schema as r, SchemaObject$1 as s, Options$1 as t };
1114
- //# sourceMappingURL=types-D1T1t1A0.d.ts.map
1107
+ export { UserPluginWithLifeCycle as a, Schema as i, PluginTs as n, OasTypes as o, ReactGenerator as r, SchemaObject$1 as s, Options$1 as t };
1108
+ //# sourceMappingURL=types-BXlkWRNi.d.ts.map