@kubb/plugin-react-query 3.0.0-alpha.0 → 3.0.0-alpha.10

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.
Files changed (41) hide show
  1. package/dist/{chunk-JFX7DCS7.cjs → chunk-7ZODZVKP.cjs} +116 -150
  2. package/dist/chunk-7ZODZVKP.cjs.map +1 -0
  3. package/dist/{chunk-5IL6M74X.js → chunk-ZYTZV43V.js} +168 -202
  4. package/dist/chunk-ZYTZV43V.js.map +1 -0
  5. package/dist/components.cjs +2 -4
  6. package/dist/components.cjs.map +1 -1
  7. package/dist/components.d.cts +1 -2
  8. package/dist/components.d.ts +1 -2
  9. package/dist/components.js +1 -3
  10. package/dist/{index-yXskx3Td.d.cts → index-5kpkk-7M.d.cts} +7 -46
  11. package/dist/{index-yXskx3Td.d.ts → index-5kpkk-7M.d.ts} +7 -46
  12. package/dist/index.cjs +28 -64
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +1 -2
  15. package/dist/index.d.ts +1 -2
  16. package/dist/index.js +17 -53
  17. package/dist/index.js.map +1 -1
  18. package/package.json +15 -15
  19. package/src/OperationGenerator.tsx +0 -29
  20. package/src/__snapshots__/mutateAsQuery/updatePetWithForm.ts +14 -9
  21. package/src/__snapshots__/pathParamsTypeInline/getPetById.ts +14 -9
  22. package/src/__snapshots__/pathParamsTypeObject/getPetById.ts +14 -9
  23. package/src/__snapshots__/queryOptions/getPetById.ts +9 -5
  24. package/src/__snapshots__/queryWithoutQueryOptions/getPetById.ts +11 -7
  25. package/src/__snapshots__/variablesTypeMutate/deletePet.ts +6 -3
  26. package/src/components/Mutation.tsx +30 -30
  27. package/src/components/Query.tsx +74 -78
  28. package/src/components/QueryKey.tsx +13 -9
  29. package/src/components/QueryOptions.tsx +21 -13
  30. package/src/components/SchemaType.tsx +9 -5
  31. package/src/components/__snapshots__/gen/showPetById.ts +58 -48
  32. package/src/components/__snapshots__/gen/useCreatePets.ts +36 -36
  33. package/src/components/__snapshots__/gen/useCreatePetsMutate.ts +36 -37
  34. package/src/components/index.ts +0 -1
  35. package/src/plugin.ts +16 -34
  36. package/src/types.ts +0 -9
  37. package/dist/chunk-5IL6M74X.js.map +0 -1
  38. package/dist/chunk-JFX7DCS7.cjs.map +0 -1
  39. package/src/__snapshots__/upload/UploadFile.ts +0 -67
  40. package/src/__snapshots__/uploadMutation/UploadFile.ts +0 -44
  41. package/src/components/Operations.tsx +0 -74
@@ -1,74 +0,0 @@
1
- import { Parser, File, useApp } from '@kubb/react'
2
-
3
- import type { KubbNode } from '@kubb/react'
4
- import type { ComponentProps, ComponentType } from 'react'
5
- import type { FileMeta, PluginReactQuery } from '../types.ts'
6
-
7
- type TemplateProps = {}
8
-
9
- function Template({}: TemplateProps): KubbNode {
10
- return null
11
- }
12
-
13
- type RootTemplateProps = {
14
- children?: React.ReactNode
15
- }
16
-
17
- function RootTemplate({ children }: RootTemplateProps) {
18
- const {
19
- pluginManager,
20
- plugin: { key: pluginKey },
21
- } = useApp<PluginReactQuery>()
22
-
23
- const file = pluginManager.getFile({
24
- name: 'operations',
25
- mode: 'split',
26
- extName: '.ts',
27
- pluginKey,
28
- })
29
-
30
- return (
31
- <Parser language="typescript">
32
- <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>
33
- <File.Source>{children}</File.Source>
34
- </File>
35
- </Parser>
36
- )
37
- }
38
-
39
- const defaultTemplates = { default: Template, root: RootTemplate } as const
40
-
41
- type Templates = Partial<typeof defaultTemplates>
42
-
43
- type Props = {
44
- /**
45
- * This will make it possible to override the default behaviour.
46
- */
47
- Template?: ComponentType<ComponentProps<typeof Template>>
48
- }
49
-
50
- export function Operations({ Template = defaultTemplates.default }: Props): KubbNode {
51
- return <Template />
52
- }
53
-
54
- type FileProps = {
55
- /**
56
- * This will make it possible to override the default behaviour.
57
- */
58
- templates?: Templates
59
- }
60
-
61
- Operations.File = function (props: FileProps): KubbNode {
62
- const templates = { ...defaultTemplates, ...props.templates }
63
-
64
- const Template = templates.default
65
- const RootTemplate = templates.root
66
-
67
- return (
68
- <RootTemplate>
69
- <Operations Template={Template} />
70
- </RootTemplate>
71
- )
72
- }
73
-
74
- Operations.templates = defaultTemplates