@kubb/plugin-vue-query 0.0.0-canary-20251028170426 → 0.0.0-canary-20251103132818
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/{components-DoPUxAFs.cjs → components-CvorLYVT.cjs} +214 -214
- package/dist/components-CvorLYVT.cjs.map +1 -0
- package/dist/{components-B8p5782n.js → components-kADKAHgd.js} +213 -213
- package/dist/components-kADKAHgd.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +114 -114
- package/dist/components.d.ts +114 -114
- package/dist/components.js +1 -1
- package/dist/{generators-a7s1tUe0.cjs → generators-B7BEw8ZB.cjs} +206 -143
- package/dist/generators-B7BEw8ZB.cjs.map +1 -0
- package/dist/{generators-CxbnV3X_.js → generators-DHkXUh19.js} +203 -141
- package/dist/generators-DHkXUh19.js.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +5 -5
- package/dist/generators.d.ts +5 -5
- package/dist/generators.js +2 -2
- package/dist/index.cjs +18 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-CGRXTDFW.d.ts → types-DU_h6t_f.d.ts} +174 -179
- package/dist/{types-PVIn4n6Z.d.cts → types-Qs1U5SfA.d.cts} +174 -179
- package/package.json +9 -9
- package/src/components/QueryOptions.tsx +1 -1
- package/src/components/index.ts +3 -3
- package/src/generators/index.ts +2 -2
- package/src/generators/infiniteQueryGenerator.tsx +35 -11
- package/src/generators/mutationGenerator.tsx +34 -9
- package/src/generators/queryGenerator.tsx +35 -11
- package/src/plugin.ts +24 -1
- package/src/types.ts +4 -3
- package/dist/components-B8p5782n.js.map +0 -1
- package/dist/components-DoPUxAFs.cjs.map +0 -1
- package/dist/generators-CxbnV3X_.js.map +0 -1
- package/dist/generators-a7s1tUe0.cjs.map +0 -1
|
@@ -556,170 +556,6 @@ type FileMetaBase = {
|
|
|
556
556
|
pluginKey?: Plugin['key'];
|
|
557
557
|
};
|
|
558
558
|
//#endregion
|
|
559
|
-
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
560
|
-
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
561
|
-
name: string;
|
|
562
|
-
type: 'react';
|
|
563
|
-
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
564
|
-
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
565
|
-
Schema: (props: SchemaProps$1<TOptions>) => KubbNode;
|
|
566
|
-
};
|
|
567
|
-
//#endregion
|
|
568
|
-
//#region ../plugin-oas/src/generators/types.d.ts
|
|
569
|
-
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
570
|
-
/**
|
|
571
|
-
* @deprecated
|
|
572
|
-
*/
|
|
573
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
574
|
-
options: TOptions['resolvedOptions'];
|
|
575
|
-
operations: Array<Operation$1>;
|
|
576
|
-
};
|
|
577
|
-
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
578
|
-
/**
|
|
579
|
-
* @deprecated
|
|
580
|
-
*/
|
|
581
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
582
|
-
options: TOptions['resolvedOptions'];
|
|
583
|
-
operation: Operation$1;
|
|
584
|
-
};
|
|
585
|
-
type SchemaProps$1<TOptions extends PluginFactoryOptions> = {
|
|
586
|
-
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
587
|
-
options: TOptions['resolvedOptions'];
|
|
588
|
-
schema: {
|
|
589
|
-
name: string;
|
|
590
|
-
tree: Array<Schema>;
|
|
591
|
-
value: SchemaObject$1;
|
|
592
|
-
};
|
|
593
|
-
};
|
|
594
|
-
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
595
|
-
//#endregion
|
|
596
|
-
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
597
|
-
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
598
|
-
name: string;
|
|
599
|
-
type: 'core';
|
|
600
|
-
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
601
|
-
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
602
|
-
schema: (props: SchemaProps$1<TOptions>) => Promise<KubbFile.File[]>;
|
|
603
|
-
};
|
|
604
|
-
//#endregion
|
|
605
|
-
//#region ../plugin-oas/src/types.d.ts
|
|
606
|
-
type ResolvePathOptions = {
|
|
607
|
-
pluginKey?: Plugin['key'];
|
|
608
|
-
group?: {
|
|
609
|
-
tag?: string;
|
|
610
|
-
path?: string;
|
|
611
|
-
};
|
|
612
|
-
type?: ResolveNameParams['type'];
|
|
613
|
-
};
|
|
614
|
-
/**
|
|
615
|
-
* `propertyName` is the ref name + resolved with the nameResolver
|
|
616
|
-
* @example import { Pet } from './Pet'
|
|
617
|
-
*
|
|
618
|
-
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
619
|
-
*
|
|
620
|
-
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
621
|
-
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
622
|
-
*/
|
|
623
|
-
type Ref = {
|
|
624
|
-
propertyName: string;
|
|
625
|
-
originalName: string;
|
|
626
|
-
path: KubbFile.OptionalPath;
|
|
627
|
-
pluginKey?: Plugin['key'];
|
|
628
|
-
};
|
|
629
|
-
type Refs = Record<string, Ref>;
|
|
630
|
-
type OperationSchema = {
|
|
631
|
-
/**
|
|
632
|
-
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
633
|
-
*/
|
|
634
|
-
name: string;
|
|
635
|
-
schema: SchemaObject$1;
|
|
636
|
-
operation?: Operation$1;
|
|
637
|
-
/**
|
|
638
|
-
* OperationName in PascalCase, only being used in OperationGenerator
|
|
639
|
-
*/
|
|
640
|
-
operationName: string;
|
|
641
|
-
description?: string;
|
|
642
|
-
statusCode?: number;
|
|
643
|
-
keys?: string[];
|
|
644
|
-
keysToOmit?: string[];
|
|
645
|
-
withData?: boolean;
|
|
646
|
-
};
|
|
647
|
-
type OperationSchemas = {
|
|
648
|
-
pathParams?: OperationSchema & {
|
|
649
|
-
keysToOmit?: never;
|
|
650
|
-
};
|
|
651
|
-
queryParams?: OperationSchema & {
|
|
652
|
-
keysToOmit?: never;
|
|
653
|
-
};
|
|
654
|
-
headerParams?: OperationSchema & {
|
|
655
|
-
keysToOmit?: never;
|
|
656
|
-
};
|
|
657
|
-
request?: OperationSchema;
|
|
658
|
-
response: OperationSchema;
|
|
659
|
-
responses: Array<OperationSchema>;
|
|
660
|
-
statusCodes?: Array<OperationSchema>;
|
|
661
|
-
errors?: Array<OperationSchema>;
|
|
662
|
-
};
|
|
663
|
-
type ByTag = {
|
|
664
|
-
type: 'tag';
|
|
665
|
-
pattern: string | RegExp;
|
|
666
|
-
};
|
|
667
|
-
type ByOperationId = {
|
|
668
|
-
type: 'operationId';
|
|
669
|
-
pattern: string | RegExp;
|
|
670
|
-
};
|
|
671
|
-
type ByPath = {
|
|
672
|
-
type: 'path';
|
|
673
|
-
pattern: string | RegExp;
|
|
674
|
-
};
|
|
675
|
-
type ByMethod = {
|
|
676
|
-
type: 'method';
|
|
677
|
-
pattern: HttpMethod | RegExp;
|
|
678
|
-
};
|
|
679
|
-
type BySchemaName = {
|
|
680
|
-
type: 'schemaName';
|
|
681
|
-
pattern: string | RegExp;
|
|
682
|
-
};
|
|
683
|
-
type ByContentType = {
|
|
684
|
-
type: 'contentType';
|
|
685
|
-
pattern: string | RegExp;
|
|
686
|
-
};
|
|
687
|
-
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
688
|
-
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
689
|
-
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
690
|
-
options: Partial<TOptions>;
|
|
691
|
-
};
|
|
692
|
-
//#endregion
|
|
693
|
-
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
694
|
-
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
695
|
-
fabric: Fabric;
|
|
696
|
-
oas: Oas;
|
|
697
|
-
exclude: Array<Exclude$1> | undefined;
|
|
698
|
-
include: Array<Include> | undefined;
|
|
699
|
-
override: Array<Override<TOptions>> | undefined;
|
|
700
|
-
contentType: contentType | undefined;
|
|
701
|
-
pluginManager: PluginManager;
|
|
702
|
-
/**
|
|
703
|
-
* Current plugin
|
|
704
|
-
*/
|
|
705
|
-
plugin: Plugin<TPluginOptions>;
|
|
706
|
-
mode: KubbFile.Mode;
|
|
707
|
-
};
|
|
708
|
-
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
709
|
-
#private;
|
|
710
|
-
getSchemas(operation: Operation$1, {
|
|
711
|
-
resolveName
|
|
712
|
-
}?: {
|
|
713
|
-
resolveName?: (name: string) => string;
|
|
714
|
-
}): OperationSchemas;
|
|
715
|
-
getOperations(): Promise<Array<{
|
|
716
|
-
path: string;
|
|
717
|
-
method: HttpMethod;
|
|
718
|
-
operation: Operation$1;
|
|
719
|
-
}>>;
|
|
720
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
721
|
-
}
|
|
722
|
-
//#endregion
|
|
723
559
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
724
560
|
type SchemaKeywordMapper = {
|
|
725
561
|
object: {
|
|
@@ -937,8 +773,96 @@ type Schema = {
|
|
|
937
773
|
keyword: string;
|
|
938
774
|
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
939
775
|
//#endregion
|
|
776
|
+
//#region ../plugin-oas/src/types.d.ts
|
|
777
|
+
type ResolvePathOptions = {
|
|
778
|
+
pluginKey?: Plugin['key'];
|
|
779
|
+
group?: {
|
|
780
|
+
tag?: string;
|
|
781
|
+
path?: string;
|
|
782
|
+
};
|
|
783
|
+
type?: ResolveNameParams['type'];
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* `propertyName` is the ref name + resolved with the nameResolver
|
|
787
|
+
* @example import { Pet } from './Pet'
|
|
788
|
+
*
|
|
789
|
+
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
790
|
+
*
|
|
791
|
+
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
792
|
+
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
793
|
+
*/
|
|
794
|
+
type Ref = {
|
|
795
|
+
propertyName: string;
|
|
796
|
+
originalName: string;
|
|
797
|
+
path: KubbFile.OptionalPath;
|
|
798
|
+
pluginKey?: Plugin['key'];
|
|
799
|
+
};
|
|
800
|
+
type Refs = Record<string, Ref>;
|
|
801
|
+
type OperationSchema = {
|
|
802
|
+
/**
|
|
803
|
+
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
804
|
+
*/
|
|
805
|
+
name: string;
|
|
806
|
+
schema: SchemaObject$1;
|
|
807
|
+
operation?: Operation$1;
|
|
808
|
+
/**
|
|
809
|
+
* OperationName in PascalCase, only being used in OperationGenerator
|
|
810
|
+
*/
|
|
811
|
+
operationName: string;
|
|
812
|
+
description?: string;
|
|
813
|
+
statusCode?: number;
|
|
814
|
+
keys?: string[];
|
|
815
|
+
keysToOmit?: string[];
|
|
816
|
+
withData?: boolean;
|
|
817
|
+
};
|
|
818
|
+
type OperationSchemas = {
|
|
819
|
+
pathParams?: OperationSchema & {
|
|
820
|
+
keysToOmit?: never;
|
|
821
|
+
};
|
|
822
|
+
queryParams?: OperationSchema & {
|
|
823
|
+
keysToOmit?: never;
|
|
824
|
+
};
|
|
825
|
+
headerParams?: OperationSchema & {
|
|
826
|
+
keysToOmit?: never;
|
|
827
|
+
};
|
|
828
|
+
request?: OperationSchema;
|
|
829
|
+
response: OperationSchema;
|
|
830
|
+
responses: Array<OperationSchema>;
|
|
831
|
+
statusCodes?: Array<OperationSchema>;
|
|
832
|
+
errors?: Array<OperationSchema>;
|
|
833
|
+
};
|
|
834
|
+
type ByTag = {
|
|
835
|
+
type: 'tag';
|
|
836
|
+
pattern: string | RegExp;
|
|
837
|
+
};
|
|
838
|
+
type ByOperationId = {
|
|
839
|
+
type: 'operationId';
|
|
840
|
+
pattern: string | RegExp;
|
|
841
|
+
};
|
|
842
|
+
type ByPath = {
|
|
843
|
+
type: 'path';
|
|
844
|
+
pattern: string | RegExp;
|
|
845
|
+
};
|
|
846
|
+
type ByMethod = {
|
|
847
|
+
type: 'method';
|
|
848
|
+
pattern: HttpMethod | RegExp;
|
|
849
|
+
};
|
|
850
|
+
type BySchemaName = {
|
|
851
|
+
type: 'schemaName';
|
|
852
|
+
pattern: string | RegExp;
|
|
853
|
+
};
|
|
854
|
+
type ByContentType = {
|
|
855
|
+
type: 'contentType';
|
|
856
|
+
pattern: string | RegExp;
|
|
857
|
+
};
|
|
858
|
+
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
859
|
+
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
860
|
+
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
861
|
+
options: Partial<TOptions>;
|
|
862
|
+
};
|
|
863
|
+
//#endregion
|
|
940
864
|
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
941
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
865
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
942
866
|
fabric: Fabric;
|
|
943
867
|
oas: Oas;
|
|
944
868
|
pluginManager: PluginManager;
|
|
@@ -971,15 +895,15 @@ type SchemaGeneratorOptions = {
|
|
|
971
895
|
* TODO TODO add docs
|
|
972
896
|
* @beta
|
|
973
897
|
*/
|
|
974
|
-
schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
898
|
+
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
975
899
|
};
|
|
976
900
|
};
|
|
977
|
-
type SchemaProps = {
|
|
901
|
+
type SchemaProps$1 = {
|
|
978
902
|
schemaObject?: SchemaObject$1;
|
|
979
903
|
name?: string;
|
|
980
904
|
parentName?: string;
|
|
981
905
|
};
|
|
982
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
906
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
|
|
983
907
|
#private;
|
|
984
908
|
refs: Refs;
|
|
985
909
|
/**
|
|
@@ -987,7 +911,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
987
911
|
* Delegates to getBaseTypeFromSchema internally and
|
|
988
912
|
* optionally adds a union with null.
|
|
989
913
|
*/
|
|
990
|
-
parse(props: SchemaProps): Schema[];
|
|
914
|
+
parse(props: SchemaProps$1): Schema[];
|
|
991
915
|
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
992
916
|
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
993
917
|
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
@@ -997,6 +921,79 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
997
921
|
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
998
922
|
}
|
|
999
923
|
//#endregion
|
|
924
|
+
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
925
|
+
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
926
|
+
name: string;
|
|
927
|
+
type: 'core';
|
|
928
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
929
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
930
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
931
|
+
};
|
|
932
|
+
//#endregion
|
|
933
|
+
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
934
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
935
|
+
name: string;
|
|
936
|
+
type: 'react';
|
|
937
|
+
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
938
|
+
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
939
|
+
Schema: (props: SchemaProps<TOptions>) => KubbNode;
|
|
940
|
+
};
|
|
941
|
+
//#endregion
|
|
942
|
+
//#region ../plugin-oas/src/generators/types.d.ts
|
|
943
|
+
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
944
|
+
config: Config;
|
|
945
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
946
|
+
plugin: Plugin<TOptions>;
|
|
947
|
+
operations: Array<Operation$1>;
|
|
948
|
+
};
|
|
949
|
+
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
950
|
+
config: Config;
|
|
951
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
952
|
+
plugin: Plugin<TOptions>;
|
|
953
|
+
operation: Operation$1;
|
|
954
|
+
};
|
|
955
|
+
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
956
|
+
config: Config;
|
|
957
|
+
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
958
|
+
plugin: Plugin<TOptions>;
|
|
959
|
+
schema: {
|
|
960
|
+
name: string;
|
|
961
|
+
tree: Array<Schema>;
|
|
962
|
+
value: SchemaObject$1;
|
|
963
|
+
};
|
|
964
|
+
};
|
|
965
|
+
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
966
|
+
//#endregion
|
|
967
|
+
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
968
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
969
|
+
fabric: Fabric;
|
|
970
|
+
oas: Oas;
|
|
971
|
+
exclude: Array<Exclude$1> | undefined;
|
|
972
|
+
include: Array<Include> | undefined;
|
|
973
|
+
override: Array<Override<TOptions>> | undefined;
|
|
974
|
+
contentType: contentType | undefined;
|
|
975
|
+
pluginManager: PluginManager;
|
|
976
|
+
/**
|
|
977
|
+
* Current plugin
|
|
978
|
+
*/
|
|
979
|
+
plugin: Plugin<TPluginOptions>;
|
|
980
|
+
mode: KubbFile.Mode;
|
|
981
|
+
};
|
|
982
|
+
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
983
|
+
#private;
|
|
984
|
+
getSchemas(operation: Operation$1, {
|
|
985
|
+
resolveName
|
|
986
|
+
}?: {
|
|
987
|
+
resolveName?: (name: string) => string;
|
|
988
|
+
}): OperationSchemas;
|
|
989
|
+
getOperations(): Promise<Array<{
|
|
990
|
+
path: string;
|
|
991
|
+
method: HttpMethod;
|
|
992
|
+
operation: Operation$1;
|
|
993
|
+
}>>;
|
|
994
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
995
|
+
}
|
|
996
|
+
//#endregion
|
|
1000
997
|
//#region ../plugin-client/src/types.d.ts
|
|
1001
998
|
type Options$2 = {
|
|
1002
999
|
/**
|
|
@@ -1041,7 +1038,6 @@ type Options$2 = {
|
|
|
1041
1038
|
* Path to the client import path that will be used to do the API calls.
|
|
1042
1039
|
* It will be used as `import client from '${client.importPath}'`.
|
|
1043
1040
|
* It allows both relative and absolute path but be aware that we will not change the path.
|
|
1044
|
-
* @default '@kubb/plugin-client/clients/axios'
|
|
1045
1041
|
*/
|
|
1046
1042
|
importPath?: string;
|
|
1047
1043
|
/**
|
|
@@ -1082,8 +1078,8 @@ type Options$2 = {
|
|
|
1082
1078
|
parser?: 'client' | 'zod';
|
|
1083
1079
|
/**
|
|
1084
1080
|
* Which client should be used to do the HTTP calls
|
|
1085
|
-
* - 'axios' will use `@kubb/plugin-client/
|
|
1086
|
-
* - 'fetch' will use `@kubb/plugin-client/
|
|
1081
|
+
* - 'axios' will use `@kubb/plugin-client/templates/axios` to fetch data.
|
|
1082
|
+
* - 'fetch' will use `@kubb/plugin-client/templates/fetch` to fetch data.
|
|
1087
1083
|
* @default 'axios'
|
|
1088
1084
|
*/
|
|
1089
1085
|
client?: 'axios' | 'fetch';
|
|
@@ -1102,9 +1098,10 @@ type ResolvedOptions$1 = {
|
|
|
1102
1098
|
output: Output<Oas>;
|
|
1103
1099
|
group?: Options$2['group'];
|
|
1104
1100
|
baseURL: string | undefined;
|
|
1101
|
+
client: Options$2['client'];
|
|
1105
1102
|
parser: NonNullable<Options$2['parser']>;
|
|
1106
1103
|
urlType: NonNullable<Options$2['urlType']>;
|
|
1107
|
-
importPath:
|
|
1104
|
+
importPath: Options$2['importPath'];
|
|
1108
1105
|
dataReturnType: NonNullable<Options$2['dataReturnType']>;
|
|
1109
1106
|
pathParamsType: NonNullable<Options$2['pathParamsType']>;
|
|
1110
1107
|
paramsType: NonNullable<Options$2['paramsType']>;
|
|
@@ -1188,7 +1185,7 @@ type Options$1 = {
|
|
|
1188
1185
|
* Group the @tanstack/query hooks based on the provided name.
|
|
1189
1186
|
*/
|
|
1190
1187
|
group?: Group;
|
|
1191
|
-
client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
1188
|
+
client?: Pick<PluginClient['options'], 'client' | 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
1192
1189
|
/**
|
|
1193
1190
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
1194
1191
|
*/
|
|
@@ -1253,9 +1250,7 @@ type Options$1 = {
|
|
|
1253
1250
|
type ResolvedOptions = {
|
|
1254
1251
|
output: Output<Oas>;
|
|
1255
1252
|
group: Options$1['group'];
|
|
1256
|
-
client:
|
|
1257
|
-
baseURL?: string;
|
|
1258
|
-
};
|
|
1253
|
+
client: NonNullable<PluginVueQuery['options']['client']>;
|
|
1259
1254
|
parser: Required<NonNullable<Options$1['parser']>>;
|
|
1260
1255
|
paramsCasing: Options$1['paramsCasing'];
|
|
1261
1256
|
paramsType: NonNullable<Options$1['paramsType']>;
|
|
@@ -1271,5 +1266,5 @@ type ResolvedOptions = {
|
|
|
1271
1266
|
};
|
|
1272
1267
|
type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1273
1268
|
//#endregion
|
|
1274
|
-
export {
|
|
1275
|
-
//# sourceMappingURL=types-
|
|
1269
|
+
export { ReactGenerator as a, Operation$1 as c, Transformer as i, Options$1 as n, OperationSchemas as o, PluginVueQuery as r, UserPluginWithLifeCycle as s, Infinite as t };
|
|
1270
|
+
//# sourceMappingURL=types-Qs1U5SfA.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-vue-query",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251103132818",
|
|
4
4
|
"description": "Vue Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Vue.js applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue-query",
|
|
@@ -68,18 +68,18 @@
|
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@kubb/react-fabric": "0.2.
|
|
71
|
+
"@kubb/react-fabric": "0.2.14",
|
|
72
72
|
"remeda": "^2.32.0",
|
|
73
|
-
"@kubb/core": "0.0.0-canary-
|
|
74
|
-
"@kubb/oas": "0.0.0-canary-
|
|
75
|
-
"@kubb/plugin-
|
|
76
|
-
"@kubb/plugin-
|
|
77
|
-
"@kubb/plugin-
|
|
78
|
-
"@kubb/plugin-
|
|
73
|
+
"@kubb/core": "0.0.0-canary-20251103132818",
|
|
74
|
+
"@kubb/oas": "0.0.0-canary-20251103132818",
|
|
75
|
+
"@kubb/plugin-client": "0.0.0-canary-20251103132818",
|
|
76
|
+
"@kubb/plugin-oas": "0.0.0-canary-20251103132818",
|
|
77
|
+
"@kubb/plugin-ts": "0.0.0-canary-20251103132818",
|
|
78
|
+
"@kubb/plugin-zod": "0.0.0-canary-20251103132818"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"@kubb/react-fabric": "0.2.
|
|
82
|
+
"@kubb/react-fabric": "0.2.14"
|
|
83
83
|
},
|
|
84
84
|
"engines": {
|
|
85
85
|
"node": ">=20"
|
|
@@ -3,9 +3,9 @@ import { Client } from '@kubb/plugin-client/components'
|
|
|
3
3
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
4
4
|
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
5
5
|
import { File, Function, FunctionParams } from '@kubb/react-fabric'
|
|
6
|
+
import type { KubbNode } from '@kubb/react-fabric/types'
|
|
6
7
|
import type { PluginVueQuery } from '../types.ts'
|
|
7
8
|
import { QueryKey } from './QueryKey.tsx'
|
|
8
|
-
import type { KubbNode } from '@kubb/react-fabric/types'
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
11
11
|
name: string
|
package/src/components/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export { InfiniteQuery } from './InfiniteQuery.tsx'
|
|
2
|
+
export { InfiniteQueryOptions } from './InfiniteQueryOptions.tsx'
|
|
1
3
|
export { Mutation } from './Mutation.tsx'
|
|
4
|
+
export { MutationKey } from './MutationKey.tsx'
|
|
2
5
|
export { Query } from './Query.tsx'
|
|
3
6
|
export { QueryKey } from './QueryKey.tsx'
|
|
4
7
|
export { QueryOptions } from './QueryOptions.tsx'
|
|
5
|
-
export { InfiniteQueryOptions } from './InfiniteQueryOptions.tsx'
|
|
6
|
-
export { InfiniteQuery } from './InfiniteQuery.tsx'
|
|
7
|
-
export { MutationKey } from './MutationKey.tsx'
|
package/src/generators/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { queryGenerator } from './queryGenerator.tsx'
|
|
2
|
-
export { mutationGenerator } from './mutationGenerator.tsx'
|
|
3
1
|
export { infiniteQueryGenerator } from './infiniteQueryGenerator.tsx'
|
|
2
|
+
export { mutationGenerator } from './mutationGenerator.tsx'
|
|
3
|
+
export { queryGenerator } from './queryGenerator.tsx'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { usePluginManager } from '@kubb/core/hooks'
|
|
2
3
|
import { pluginClientName } from '@kubb/plugin-client'
|
|
3
4
|
import { Client } from '@kubb/plugin-client/components'
|
|
4
|
-
import { createReactGenerator } from '@kubb/plugin-oas'
|
|
5
|
+
import { createReactGenerator } from '@kubb/plugin-oas/generators'
|
|
5
6
|
import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
6
7
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
7
8
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
@@ -13,14 +14,15 @@ import type { PluginVueQuery } from '../types'
|
|
|
13
14
|
|
|
14
15
|
export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
15
16
|
name: 'vue-infinite-query',
|
|
16
|
-
Operation({
|
|
17
|
+
Operation({ config, operation, generator, plugin }) {
|
|
17
18
|
const {
|
|
19
|
+
options,
|
|
18
20
|
options: { output },
|
|
19
|
-
} =
|
|
21
|
+
} = plugin
|
|
20
22
|
const pluginManager = usePluginManager()
|
|
21
23
|
|
|
22
24
|
const oas = useOas()
|
|
23
|
-
const { getSchemas, getName, getFile } = useOperationManager()
|
|
25
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator)
|
|
24
26
|
|
|
25
27
|
const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)
|
|
26
28
|
const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
|
|
@@ -84,12 +86,34 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
84
86
|
{options.parser === 'zod' && (
|
|
85
87
|
<File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />
|
|
86
88
|
)}
|
|
89
|
+
{options.client.importPath ? (
|
|
90
|
+
<>
|
|
91
|
+
<File.Import name={'fetch'} path={options.client.importPath} />
|
|
92
|
+
<File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
93
|
+
{options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
|
|
94
|
+
</>
|
|
95
|
+
) : (
|
|
96
|
+
<>
|
|
97
|
+
<File.Import name={'fetch'} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')} />
|
|
98
|
+
<File.Import
|
|
99
|
+
name={['RequestConfig', 'ResponseErrorConfig']}
|
|
100
|
+
root={query.file.path}
|
|
101
|
+
path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}
|
|
102
|
+
isTypeOnly
|
|
103
|
+
/>
|
|
104
|
+
{options.client.dataReturnType === 'full' && (
|
|
105
|
+
<File.Import
|
|
106
|
+
name={['ResponseConfig']}
|
|
107
|
+
root={query.file.path}
|
|
108
|
+
path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}
|
|
109
|
+
isTypeOnly
|
|
110
|
+
/>
|
|
111
|
+
)}
|
|
112
|
+
</>
|
|
113
|
+
)}
|
|
87
114
|
<File.Import name={['toValue']} path="vue" />
|
|
88
115
|
<File.Import name={['MaybeRefOrGetter']} path="vue" isTypeOnly />
|
|
89
|
-
<File.Import name={'fetch'} path={options.client.importPath} />
|
|
90
116
|
{hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}
|
|
91
|
-
<File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
92
|
-
{options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
|
|
93
117
|
<File.Import
|
|
94
118
|
name={[
|
|
95
119
|
type.schemas.request?.name,
|
|
@@ -119,7 +143,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
119
143
|
operation={operation}
|
|
120
144
|
typeSchemas={type.schemas}
|
|
121
145
|
zodSchemas={zod.schemas}
|
|
122
|
-
dataReturnType={options.client.dataReturnType}
|
|
146
|
+
dataReturnType={options.client.dataReturnType || 'data'}
|
|
123
147
|
paramsCasing={options.paramsCasing}
|
|
124
148
|
paramsType={options.paramsType}
|
|
125
149
|
pathParamsType={options.pathParamsType}
|
|
@@ -138,7 +162,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
138
162
|
paramsType={options.paramsType}
|
|
139
163
|
paramsCasing={options.paramsCasing}
|
|
140
164
|
pathParamsType={options.pathParamsType}
|
|
141
|
-
dataReturnType={options.client.dataReturnType}
|
|
165
|
+
dataReturnType={options.client.dataReturnType || 'data'}
|
|
142
166
|
cursorParam={options.infinite.cursorParam}
|
|
143
167
|
initialPageParam={options.infinite.initialPageParam}
|
|
144
168
|
queryParam={options.infinite.queryParam}
|
|
@@ -157,7 +181,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
157
181
|
paramsType={options.paramsType}
|
|
158
182
|
pathParamsType={options.pathParamsType}
|
|
159
183
|
operation={operation}
|
|
160
|
-
dataReturnType={options.client.dataReturnType}
|
|
184
|
+
dataReturnType={options.client.dataReturnType || 'data'}
|
|
161
185
|
queryKeyName={queryKey.name}
|
|
162
186
|
queryKeyTypeName={queryKey.typeName}
|
|
163
187
|
/>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { usePluginManager } from '@kubb/core/hooks'
|
|
2
3
|
import { pluginClientName } from '@kubb/plugin-client'
|
|
3
4
|
import { Client } from '@kubb/plugin-client/components'
|
|
4
|
-
import { createReactGenerator } from '@kubb/plugin-oas'
|
|
5
|
+
import { createReactGenerator } from '@kubb/plugin-oas/generators'
|
|
5
6
|
import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
6
7
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
7
8
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
@@ -13,14 +14,15 @@ import type { PluginVueQuery } from '../types'
|
|
|
13
14
|
|
|
14
15
|
export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
15
16
|
name: 'vue-query',
|
|
16
|
-
Operation({
|
|
17
|
+
Operation({ config, operation, generator, plugin }) {
|
|
17
18
|
const {
|
|
19
|
+
options,
|
|
18
20
|
options: { output },
|
|
19
|
-
} =
|
|
21
|
+
} = plugin
|
|
20
22
|
const pluginManager = usePluginManager()
|
|
21
23
|
|
|
22
24
|
const oas = useOas()
|
|
23
|
-
const { getSchemas, getName, getFile } = useOperationManager()
|
|
25
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator)
|
|
24
26
|
|
|
25
27
|
const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)
|
|
26
28
|
const isMutation =
|
|
@@ -79,10 +81,33 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
79
81
|
{options.parser === 'zod' && (
|
|
80
82
|
<File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={mutation.file.path} path={zod.file.path} />
|
|
81
83
|
)}
|
|
84
|
+
{options.client.importPath ? (
|
|
85
|
+
<>
|
|
86
|
+
<File.Import name={'fetch'} path={options.client.importPath} />
|
|
87
|
+
<File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
88
|
+
{options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
|
|
89
|
+
</>
|
|
90
|
+
) : (
|
|
91
|
+
<>
|
|
92
|
+
<File.Import name={'fetch'} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')} />
|
|
93
|
+
<File.Import
|
|
94
|
+
name={['RequestConfig', 'ResponseErrorConfig']}
|
|
95
|
+
root={mutation.file.path}
|
|
96
|
+
path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}
|
|
97
|
+
isTypeOnly
|
|
98
|
+
/>
|
|
99
|
+
{options.client.dataReturnType === 'full' && (
|
|
100
|
+
<File.Import
|
|
101
|
+
name={['ResponseConfig']}
|
|
102
|
+
root={mutation.file.path}
|
|
103
|
+
path={path.resolve(config.root, config.output.path, '.kubb/fetcher.ts')}
|
|
104
|
+
isTypeOnly
|
|
105
|
+
/>
|
|
106
|
+
)}
|
|
107
|
+
</>
|
|
108
|
+
)}
|
|
82
109
|
<File.Import name={['MaybeRefOrGetter']} path="vue" isTypeOnly />
|
|
83
|
-
<File.Import name={'fetch'} path={options.client.importPath} />
|
|
84
110
|
{!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}
|
|
85
|
-
<File.Import name={['RequestConfig', 'ResponseConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
86
111
|
<File.Import
|
|
87
112
|
name={[
|
|
88
113
|
type.schemas.request?.name,
|
|
@@ -112,7 +137,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
112
137
|
operation={operation}
|
|
113
138
|
typeSchemas={type.schemas}
|
|
114
139
|
zodSchemas={zod.schemas}
|
|
115
|
-
dataReturnType={options.client.dataReturnType}
|
|
140
|
+
dataReturnType={options.client.dataReturnType || 'data'}
|
|
116
141
|
paramsCasing={options.paramsCasing}
|
|
117
142
|
paramsType={options.paramsType}
|
|
118
143
|
pathParamsType={options.pathParamsType}
|
|
@@ -130,7 +155,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
130
155
|
typeSchemas={type.schemas}
|
|
131
156
|
operation={operation}
|
|
132
157
|
paramsCasing={options.paramsCasing}
|
|
133
|
-
dataReturnType={options.client.dataReturnType}
|
|
158
|
+
dataReturnType={options.client.dataReturnType || 'data'}
|
|
134
159
|
paramsType={options.paramsType}
|
|
135
160
|
pathParamsType={options.pathParamsType}
|
|
136
161
|
mutationKeyName={mutationKey.name}
|