react-query-lightbase-codegen 0.1.1 → 0.1.2

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.
@@ -409,7 +409,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
409
409
  // QUERIES
410
410
  if (!requestBodyComponent && paramsInPath.length && !queryParam && !headerParam) {
411
411
  output += `
412
- // type1
413
412
  type ${componentName}Return = ${genericsTypes}
414
413
  type ${componentName}Variables = {
415
414
  ${paramsTypes}
@@ -453,9 +452,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
453
452
  }
454
453
  if (!requestBodyComponent && paramsInPath.length && queryParam && !headerParam) {
455
454
  output += `
456
- import queryString from 'query-string';
457
-
458
- // type2
459
455
  type ${componentName}Return = ${genericsTypes}
460
456
  type ${componentName}Variables = {
461
457
  ${paramsTypes}
@@ -503,7 +499,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
503
499
  }
504
500
  if (!requestBodyComponent && !paramsInPath.length && !queryParam && !headerParam) {
505
501
  output += `
506
- // type3
507
502
  type ${componentName}Return = ${genericsTypes}
508
503
  use${componentName}Query.fetch = async () => {
509
504
  const result = await api.${verb}<${componentName}Return>(\`${route}\`);
@@ -543,9 +538,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
543
538
  }
544
539
  if (!requestBodyComponent && !paramsInPath.length && queryParam && !headerParam) {
545
540
  output += `
546
- // type4
547
- import queryString from 'query-string';
548
-
549
541
 
550
542
  type ${componentName}Return = ${genericsTypes}
551
543
  type ${componentName}Variables = {
@@ -589,7 +581,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
589
581
  }
590
582
  if (requestBodyComponent && !paramsInPath.length && !queryParam && !headerParam) {
591
583
  output += `
592
- // type5
593
584
  type ${componentName}Return = ${genericsTypes}
594
585
  type ${componentName}Variables = ${requestBodyComponent};
595
586
 
@@ -632,9 +623,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
632
623
  }
633
624
  if (requestBodyComponent && paramsInPath.length && !queryParam && !headerParam) {
634
625
  output += `
635
- import queryString from 'query-string';
636
-
637
- // type6
638
626
  type ${componentName}Return = ${genericsTypes}
639
627
  type ${componentName}Variables = {
640
628
  body: ${requestBodyComponent}
@@ -682,9 +670,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
682
670
  }
683
671
  if (requestBodyComponent && !paramsInPath.length && queryParam && !headerParam) {
684
672
  output += `
685
- import queryString from 'query-string';
686
-
687
- // type7
688
673
  type ${componentName}Return = ${genericsTypes}
689
674
  type ${componentName}Variables = {
690
675
  body: ${requestBodyComponent}
@@ -795,8 +780,6 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
795
780
  }
796
781
  if (!requestBodyComponent && !paramsInPath.length && queryParam && headerParam) {
797
782
  output += `
798
- import queryString from 'query-string';
799
-
800
783
  type ${componentName}Return = ${genericsTypes}
801
784
 
802
785
  type ${componentName}Variables = {
@@ -942,6 +925,7 @@ const importOpenApi = async ({ data, format, apiDirectory, queryClientDir, heade
942
925
  } from 'react-query';
943
926
  import { Updater } from 'react-query/types/core/utils';
944
927
 
928
+ import queryString from 'query-string';
945
929
  import { AxiosError } from 'axios';
946
930
  import { api } from '${apiDirectory}';
947
931
  import { queryClient } from '${queryClientDir}';
@@ -389,7 +389,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
389
389
  // QUERIES
390
390
  if (!requestBodyComponent && paramsInPath.length && !queryParam && !headerParam) {
391
391
  output += `
392
- // type1
393
392
  type ${componentName}Return = ${genericsTypes}
394
393
  type ${componentName}Variables = {
395
394
  ${paramsTypes}
@@ -433,9 +432,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
433
432
  }
434
433
  if (!requestBodyComponent && paramsInPath.length && queryParam && !headerParam) {
435
434
  output += `
436
- import queryString from 'query-string';
437
-
438
- // type2
439
435
  type ${componentName}Return = ${genericsTypes}
440
436
  type ${componentName}Variables = {
441
437
  ${paramsTypes}
@@ -483,7 +479,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
483
479
  }
484
480
  if (!requestBodyComponent && !paramsInPath.length && !queryParam && !headerParam) {
485
481
  output += `
486
- // type3
487
482
  type ${componentName}Return = ${genericsTypes}
488
483
  use${componentName}Query.fetch = async () => {
489
484
  const result = await api.${verb}<${componentName}Return>(\`${route}\`);
@@ -523,9 +518,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
523
518
  }
524
519
  if (!requestBodyComponent && !paramsInPath.length && queryParam && !headerParam) {
525
520
  output += `
526
- // type4
527
- import queryString from 'query-string';
528
-
529
521
 
530
522
  type ${componentName}Return = ${genericsTypes}
531
523
  type ${componentName}Variables = {
@@ -569,7 +561,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
569
561
  }
570
562
  if (requestBodyComponent && !paramsInPath.length && !queryParam && !headerParam) {
571
563
  output += `
572
- // type5
573
564
  type ${componentName}Return = ${genericsTypes}
574
565
  type ${componentName}Variables = ${requestBodyComponent};
575
566
 
@@ -612,9 +603,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
612
603
  }
613
604
  if (requestBodyComponent && paramsInPath.length && !queryParam && !headerParam) {
614
605
  output += `
615
- import queryString from 'query-string';
616
-
617
- // type6
618
606
  type ${componentName}Return = ${genericsTypes}
619
607
  type ${componentName}Variables = {
620
608
  body: ${requestBodyComponent}
@@ -662,9 +650,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
662
650
  }
663
651
  if (requestBodyComponent && !paramsInPath.length && queryParam && !headerParam) {
664
652
  output += `
665
- import queryString from 'query-string';
666
-
667
- // type7
668
653
  type ${componentName}Return = ${genericsTypes}
669
654
  type ${componentName}Variables = {
670
655
  body: ${requestBodyComponent}
@@ -775,8 +760,6 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
775
760
  }
776
761
  if (!requestBodyComponent && !paramsInPath.length && queryParam && headerParam) {
777
762
  output += `
778
- import queryString from 'query-string';
779
-
780
763
  type ${componentName}Return = ${genericsTypes}
781
764
 
782
765
  type ${componentName}Variables = {
@@ -921,6 +904,7 @@ export const importOpenApi = async ({ data, format, apiDirectory, queryClientDir
921
904
  } from 'react-query';
922
905
  import { Updater } from 'react-query/types/core/utils';
923
906
 
907
+ import queryString from 'query-string';
924
908
  import { AxiosError } from 'axios';
925
909
  import { api } from '${apiDirectory}';
926
910
  import { queryClient } from '${queryClientDir}';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-query-lightbase-codegen",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "MIT",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",