@kubb/swagger-ts 2.0.0-beta.1 → 2.0.0-beta.11

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 (44) hide show
  1. package/dist/components.cjs +3993 -0
  2. package/dist/components.cjs.map +1 -0
  3. package/dist/components.d.cts +68 -0
  4. package/dist/components.d.ts +68 -0
  5. package/dist/components.js +3969 -0
  6. package/dist/components.js.map +1 -0
  7. package/dist/index-PYW2PpJw.d.cts +392 -0
  8. package/dist/index-PYW2PpJw.d.ts +392 -0
  9. package/dist/index.cjs +3553 -289
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +9 -80
  12. package/dist/index.d.ts +9 -80
  13. package/dist/index.js +3555 -291
  14. package/dist/index.js.map +1 -1
  15. package/dist/oas.cjs +4 -0
  16. package/dist/oas.cjs.map +1 -0
  17. package/dist/oas.d.cts +6 -0
  18. package/dist/oas.d.ts +6 -0
  19. package/dist/oas.js +5 -0
  20. package/dist/oas.js.map +1 -0
  21. package/dist/types-IAThMYCO.d.cts +105 -0
  22. package/dist/types-IAThMYCO.d.ts +105 -0
  23. package/package.json +22 -8
  24. package/src/OperationGenerator.tsx +62 -0
  25. package/src/TypeBuilder.ts +58 -0
  26. package/src/{generators/TypeGenerator.ts → TypeGenerator.ts} +78 -68
  27. package/src/components/Mutation.tsx +137 -0
  28. package/src/components/Oas.tsx +84 -0
  29. package/src/components/Query.tsx +136 -0
  30. package/src/components/index.ts +3 -0
  31. package/src/index.ts +1 -1
  32. package/src/oas/index.ts +7 -0
  33. package/src/oas/infer.ts +58 -0
  34. package/src/oas/mappers.ts +93 -0
  35. package/src/oas/model.ts +38 -0
  36. package/src/oas/requestParams.ts +170 -0
  37. package/src/oas/response.ts +39 -0
  38. package/src/oas/security.ts +158 -0
  39. package/src/plugin.ts +52 -107
  40. package/src/types.ts +41 -13
  41. package/src/builders/TypeBuilder.ts +0 -94
  42. package/src/builders/index.ts +0 -1
  43. package/src/generators/OperationGenerator.ts +0 -213
  44. package/src/generators/index.ts +0 -2
package/dist/index.d.cts CHANGED
@@ -1,86 +1,15 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { ResolveNameParams, KubbPlugin, PluginFactoryOptions } from '@kubb/core';
3
- import { Exclude, Include, Override, ResolvePathOptions } from '@kubb/swagger';
4
-
5
- type Options = {
6
- /**
7
- * Relative path to save the TypeScript types.
8
- * When output is a file it will save all models inside that file else it will create a file per schema item.
9
- * @default 'types'
10
- */
11
- output?: string;
12
- /**
13
- * Group the TypeScript types based on the provided name.
14
- */
15
- group?: {
16
- /**
17
- * Tag will group based on the operation tag inside the Swagger file.
18
- */
19
- type: 'tag';
20
- /**
21
- * Relative path to save the grouped TypeScript Types.
22
- *
23
- * `{{tag}}` will be replaced by the current tagName.
24
- * @example `${output}/{{tag}}Controller` => `models/PetController`
25
- * @default `${output}/{{tag}}Controller`
26
- */
27
- output?: string;
28
- };
29
- /**
30
- * Name to be used for the `export * as {{exportAs}} from './`
31
- */
32
- exportAs?: string;
33
- /**
34
- * Array containing exclude paramaters to exclude/skip tags/operations/methods/paths.
35
- */
36
- exclude?: Array<Exclude>;
37
- /**
38
- * Array containing include paramaters to include tags/operations/methods/paths.
39
- */
40
- include?: Array<Include>;
41
- /**
42
- * Array containing override paramaters to override `options` based on tags/operations/methods/paths.
43
- */
44
- override?: Array<Override<Options>>;
45
- /**
46
- * Choose to use `enum` or `as const` for enums
47
- * @default 'asConst'
48
- */
49
- enumType?: 'enum' | 'asConst' | 'asPascalConst';
50
- /**
51
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
52
- * @default 'string'
53
- */
54
- dateType?: 'string' | 'date';
55
- /**
56
- * Choose what to use as mode for an optional value.
57
- * @examples 'questionToken': type?: string
58
- * @examples 'undefined': type: string | undefined
59
- * @examples 'questionTokenAndUndefined': type?: string | undefined
60
- * @default 'questionToken'
61
- */
62
- optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
63
- transformers?: {
64
- /**
65
- * Customize the names based on the type that is provided by the plugin.
66
- */
67
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
68
- };
69
- };
70
- type FileMeta = {
71
- pluginKey?: KubbPlugin['key'];
72
- name?: string;
73
- tag?: string;
74
- };
75
- type PluginOptions = PluginFactoryOptions<'swagger-ts', 'schema', Options, Options, never, ResolvePathOptions>;
76
- declare module '@kubb/core' {
77
- interface _Register {
78
- ['@kubb/swagger-ts']: PluginOptions;
79
- }
80
- }
2
+ import { P as PluginOptions, O as Options } from './types-IAThMYCO.cjs';
3
+ export { F as FileMeta } from './types-IAThMYCO.cjs';
4
+ export { i as Oas } from './index-PYW2PpJw.cjs';
5
+ import '@kubb/swagger';
6
+ import 'hotscript';
7
+ import 'ts-toolbelt';
8
+ import 'json-schema-to-ts';
9
+ import '@kubb/types';
81
10
 
82
11
  declare const pluginName = "swagger-ts";
83
12
  declare const pluginKey: PluginOptions['key'];
84
13
  declare const definePlugin: (options: Options) => _kubb_core.KubbUserPluginWithLifeCycle<PluginOptions>;
85
14
 
86
- export { type FileMeta, type Options, type PluginOptions, definePlugin as default, definePlugin, pluginKey, pluginName };
15
+ export { Options, PluginOptions, definePlugin as default, definePlugin, pluginKey, pluginName };
package/dist/index.d.ts CHANGED
@@ -1,86 +1,15 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { ResolveNameParams, KubbPlugin, PluginFactoryOptions } from '@kubb/core';
3
- import { Exclude, Include, Override, ResolvePathOptions } from '@kubb/swagger';
4
-
5
- type Options = {
6
- /**
7
- * Relative path to save the TypeScript types.
8
- * When output is a file it will save all models inside that file else it will create a file per schema item.
9
- * @default 'types'
10
- */
11
- output?: string;
12
- /**
13
- * Group the TypeScript types based on the provided name.
14
- */
15
- group?: {
16
- /**
17
- * Tag will group based on the operation tag inside the Swagger file.
18
- */
19
- type: 'tag';
20
- /**
21
- * Relative path to save the grouped TypeScript Types.
22
- *
23
- * `{{tag}}` will be replaced by the current tagName.
24
- * @example `${output}/{{tag}}Controller` => `models/PetController`
25
- * @default `${output}/{{tag}}Controller`
26
- */
27
- output?: string;
28
- };
29
- /**
30
- * Name to be used for the `export * as {{exportAs}} from './`
31
- */
32
- exportAs?: string;
33
- /**
34
- * Array containing exclude paramaters to exclude/skip tags/operations/methods/paths.
35
- */
36
- exclude?: Array<Exclude>;
37
- /**
38
- * Array containing include paramaters to include tags/operations/methods/paths.
39
- */
40
- include?: Array<Include>;
41
- /**
42
- * Array containing override paramaters to override `options` based on tags/operations/methods/paths.
43
- */
44
- override?: Array<Override<Options>>;
45
- /**
46
- * Choose to use `enum` or `as const` for enums
47
- * @default 'asConst'
48
- */
49
- enumType?: 'enum' | 'asConst' | 'asPascalConst';
50
- /**
51
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
52
- * @default 'string'
53
- */
54
- dateType?: 'string' | 'date';
55
- /**
56
- * Choose what to use as mode for an optional value.
57
- * @examples 'questionToken': type?: string
58
- * @examples 'undefined': type: string | undefined
59
- * @examples 'questionTokenAndUndefined': type?: string | undefined
60
- * @default 'questionToken'
61
- */
62
- optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
63
- transformers?: {
64
- /**
65
- * Customize the names based on the type that is provided by the plugin.
66
- */
67
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
68
- };
69
- };
70
- type FileMeta = {
71
- pluginKey?: KubbPlugin['key'];
72
- name?: string;
73
- tag?: string;
74
- };
75
- type PluginOptions = PluginFactoryOptions<'swagger-ts', 'schema', Options, Options, never, ResolvePathOptions>;
76
- declare module '@kubb/core' {
77
- interface _Register {
78
- ['@kubb/swagger-ts']: PluginOptions;
79
- }
80
- }
2
+ import { P as PluginOptions, O as Options } from './types-IAThMYCO.js';
3
+ export { F as FileMeta } from './types-IAThMYCO.js';
4
+ export { i as Oas } from './index-PYW2PpJw.js';
5
+ import '@kubb/swagger';
6
+ import 'hotscript';
7
+ import 'ts-toolbelt';
8
+ import 'json-schema-to-ts';
9
+ import '@kubb/types';
81
10
 
82
11
  declare const pluginName = "swagger-ts";
83
12
  declare const pluginKey: PluginOptions['key'];
84
13
  declare const definePlugin: (options: Options) => _kubb_core.KubbUserPluginWithLifeCycle<PluginOptions>;
85
14
 
86
- export { type FileMeta, type Options, type PluginOptions, definePlugin as default, definePlugin, pluginKey, pluginName };
15
+ export { Options, PluginOptions, definePlugin as default, definePlugin, pluginKey, pluginName };