@kubb/plugin-oas 3.0.0-alpha.1 → 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 (72) hide show
  1. package/dist/OperationGenerator-By5WOmWB.d.ts +165 -0
  2. package/dist/OperationGenerator-Gd1X7wUz.d.cts +165 -0
  3. package/dist/{Schema-DefwBJMc.d.ts → Schema-B1vcPGiK.d.ts} +3 -5
  4. package/dist/{Schema-an5hOrjZ.d.cts → Schema-DoSFh7Qd.d.cts} +3 -5
  5. package/dist/{SchemaMapper-CsBQ6eEx.d.cts → SchemaMapper-sGcY1xL5.d.cts} +1 -2
  6. package/dist/{SchemaMapper-CsBQ6eEx.d.ts → SchemaMapper-sGcY1xL5.d.ts} +1 -2
  7. package/dist/chunk-75BIOXB7.cjs +7 -0
  8. package/dist/chunk-75BIOXB7.cjs.map +1 -0
  9. package/dist/{chunk-DRLYORTT.cjs → chunk-IAUV3UKH.cjs} +735 -35
  10. package/dist/chunk-IAUV3UKH.cjs.map +1 -0
  11. package/dist/{chunk-LEACSHKT.js → chunk-M347763D.js} +714 -14
  12. package/dist/chunk-M347763D.js.map +1 -0
  13. package/dist/{chunk-Y4V7HHX7.js → chunk-N7EEVJA6.js} +3 -3
  14. package/dist/{chunk-P42X362U.cjs → chunk-NU4F7G47.cjs} +4 -16
  15. package/dist/chunk-NU4F7G47.cjs.map +1 -0
  16. package/dist/{chunk-QLJIL3U5.cjs → chunk-O76YQFZB.cjs} +3 -3
  17. package/dist/{chunk-QLJIL3U5.cjs.map → chunk-O76YQFZB.cjs.map} +1 -1
  18. package/dist/chunk-SQ64ESS4.js +7 -0
  19. package/dist/chunk-SQ64ESS4.js.map +1 -0
  20. package/dist/{chunk-UB552H4J.js → chunk-SZDO532A.js} +3 -15
  21. package/dist/{chunk-UB552H4J.js.map → chunk-SZDO532A.js.map} +1 -1
  22. package/dist/components.cjs +4 -9
  23. package/dist/components.cjs.map +1 -1
  24. package/dist/components.d.cts +13 -7
  25. package/dist/components.d.ts +13 -7
  26. package/dist/components.js +3 -8
  27. package/dist/components.js.map +1 -1
  28. package/dist/hooks.cjs +12 -13
  29. package/dist/hooks.cjs.map +1 -1
  30. package/dist/hooks.d.cts +4 -4
  31. package/dist/hooks.d.ts +4 -4
  32. package/dist/hooks.js +2 -3
  33. package/dist/hooks.js.map +1 -1
  34. package/dist/index.cjs +282 -231
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +8 -77
  37. package/dist/index.d.ts +8 -77
  38. package/dist/index.js +274 -223
  39. package/dist/index.js.map +1 -1
  40. package/dist/{types-Dte3MA6H.d.cts → types-CZTUCaE5.d.cts} +3 -1
  41. package/dist/{types-Dte3MA6H.d.ts → types-CZTUCaE5.d.ts} +3 -1
  42. package/dist/utils.cjs +12 -54
  43. package/dist/utils.cjs.map +1 -1
  44. package/dist/utils.d.cts +7 -33
  45. package/dist/utils.d.ts +7 -33
  46. package/dist/utils.js +6 -48
  47. package/dist/utils.js.map +1 -1
  48. package/package.json +11 -10
  49. package/src/OperationGenerator.ts +68 -32
  50. package/src/SchemaGenerator.ts +32 -15
  51. package/src/SchemaMapper.ts +1 -1
  52. package/src/components/Oas.tsx +9 -3
  53. package/src/components/Operation.tsx +1 -1
  54. package/src/components/Schema.tsx +29 -31
  55. package/src/generator.tsx +125 -0
  56. package/src/hooks/useOperationManager.ts +1 -0
  57. package/src/index.ts +3 -9
  58. package/src/plugin.ts +25 -38
  59. package/src/types.ts +2 -0
  60. package/src/utils/getParams.ts +1 -1
  61. package/src/utils/index.ts +2 -1
  62. package/dist/OperationGenerator-CeM_9pxW.d.cts +0 -60
  63. package/dist/OperationGenerator-DhUhvRJE.d.ts +0 -60
  64. package/dist/chunk-CJXRFYEF.cjs +0 -698
  65. package/dist/chunk-CJXRFYEF.cjs.map +0 -1
  66. package/dist/chunk-DRLYORTT.cjs.map +0 -1
  67. package/dist/chunk-K6KUETAI.js +0 -698
  68. package/dist/chunk-K6KUETAI.js.map +0 -1
  69. package/dist/chunk-LEACSHKT.js.map +0 -1
  70. package/dist/chunk-P42X362U.cjs.map +0 -1
  71. package/src/utils/getGroupedByTagFiles.ts +0 -82
  72. /package/dist/{chunk-Y4V7HHX7.js.map → chunk-N7EEVJA6.js.map} +0 -0
@@ -1,82 +0,0 @@
1
- import { resolve } from 'node:path'
2
-
3
- import { FileManager } from '@kubb/core'
4
- import transformers from '@kubb/core/transformers'
5
- import { renderTemplate } from '@kubb/core/utils'
6
- import { getRelativePath } from '@kubb/fs'
7
-
8
- import type { Plugin } from '@kubb/core'
9
- import type { Logger } from '@kubb/core/logger'
10
- import type * as KubbFile from '@kubb/fs/types'
11
-
12
- type Options = {
13
- logger: Logger
14
- files: Array<KubbFile.File<FileMeta>>
15
- plugin: Plugin
16
- template: string
17
- exportAs: string
18
- /**
19
- * Root based on root and output.path specified in the config
20
- */
21
- root: string
22
- /**
23
- * Output for plugin
24
- */
25
- output: {
26
- path: string
27
- exportAs?: string
28
- extName?: KubbFile.Extname
29
- exportType?: 'barrel' | 'barrelNamed' | false
30
- }
31
- }
32
-
33
- type FileMeta = {
34
- pluginKey?: Plugin['key']
35
- tag?: string
36
- }
37
-
38
- export async function getGroupedByTagFiles({ logger, files, plugin, template, exportAs, root, output }: Options): Promise<KubbFile.File<FileMeta>[]> {
39
- const { path, exportType = 'barrel' } = output
40
- const mode = FileManager.getMode(resolve(root, path))
41
-
42
- if (mode === 'single' || exportType === false) {
43
- return []
44
- }
45
-
46
- return files
47
- .filter((file) => {
48
- const name = file.meta?.pluginKey?.[0]
49
- return name === plugin.name
50
- })
51
- .map((file: KubbFile.File<FileMeta>) => {
52
- if (!file.meta?.tag) {
53
- logger?.emit('debug', [`Could not find a tagName for ${JSON.stringify(file, undefined, 2)}`])
54
-
55
- return
56
- }
57
-
58
- const tag = file.meta?.tag && transformers.camelCase(file.meta.tag)
59
- const tagPath = getRelativePath(resolve(root, output.path), resolve(root, renderTemplate(template, { tag })))
60
- const tagName = renderTemplate(exportAs, { tag })
61
-
62
- if (tagName) {
63
- return {
64
- baseName: 'index.ts' as const,
65
- path: resolve(root, output.path, 'index.ts'),
66
- source: '',
67
- exports: [
68
- {
69
- path: output.extName ? `${tagPath}/index${output.extName}` : `${tagPath}/index`,
70
- asAlias: true,
71
- name: tagName,
72
- },
73
- ],
74
- meta: {
75
- pluginKey: plugin.key,
76
- },
77
- exportable: true,
78
- }
79
- }
80
- })
81
- .filter(Boolean)
82
- }