@kubb/plugin-oas 0.0.0-canary-20251028131922 → 0.0.0-canary-20251103125929

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 (107) hide show
  1. package/dist/{SchemaGenerator-DzVHk6OP.cjs → SchemaGenerator-B8Reay1m.cjs} +114 -16
  2. package/dist/SchemaGenerator-B8Reay1m.cjs.map +1 -0
  3. package/dist/{SchemaGenerator-7wBwdv8G.js → SchemaGenerator-ChoBQWm5.js} +93 -15
  4. package/dist/SchemaGenerator-ChoBQWm5.js.map +1 -0
  5. package/dist/{SchemaMapper-DoL-a6qq.cjs → SchemaMapper-BUV8vhg0.cjs} +1 -1
  6. package/dist/SchemaMapper-BUV8vhg0.cjs.map +1 -0
  7. package/dist/{SchemaMapper-CqBW0VOy.d.ts → SchemaMapper-CX7sIIuZ.d.cts} +5 -118
  8. package/dist/{SchemaMapper-Cx4X1al6.js → SchemaMapper-D30tqRoX.js} +1 -1
  9. package/dist/SchemaMapper-D30tqRoX.js.map +1 -0
  10. package/dist/{SchemaMapper-MiRB5_Zp.d.cts → SchemaMapper-m5TKynWt.d.ts} +5 -118
  11. package/dist/{OperationGenerator-BZPWkxw4.d.ts → createGenerator-DlSlv4sR.d.ts} +130 -182
  12. package/dist/{OperationGenerator-CJTAer7l.d.cts → createGenerator-PIseu7v9.d.cts} +131 -183
  13. package/dist/{generators-C61FxVIj.js → generators-CJDEf8Kn.js} +6 -6
  14. package/dist/generators-CJDEf8Kn.js.map +1 -0
  15. package/dist/{generators-B27La9Vd.cjs → generators-udGOxdUV.cjs} +6 -6
  16. package/dist/generators-udGOxdUV.cjs.map +1 -0
  17. package/dist/generators.cjs +2 -7
  18. package/dist/generators.d.cts +8 -3
  19. package/dist/generators.d.ts +8 -3
  20. package/dist/generators.js +3 -5
  21. package/dist/{getFooter-D5MdeUVv.js → getFooter-CV73pVXj.js} +2 -2
  22. package/dist/{getFooter-D5MdeUVv.js.map → getFooter-CV73pVXj.js.map} +1 -1
  23. package/dist/{getFooter-CwjCW4h5.cjs → getFooter-DPh4lxBH.cjs} +3 -3
  24. package/dist/{getFooter-CwjCW4h5.cjs.map → getFooter-DPh4lxBH.cjs.map} +1 -1
  25. package/dist/{getSchemas-DY8s2CSl.cjs → getSchemas-CP_YS4_2.cjs} +1 -1
  26. package/dist/getSchemas-CP_YS4_2.cjs.map +1 -0
  27. package/dist/{getSchemas-Bdg6n9Qk.js → getSchemas-CTi8zYew.js} +1 -1
  28. package/dist/getSchemas-CTi8zYew.js.map +1 -0
  29. package/dist/hooks.cjs +6 -47
  30. package/dist/hooks.cjs.map +1 -1
  31. package/dist/hooks.d.cts +11 -45
  32. package/dist/hooks.d.ts +11 -45
  33. package/dist/hooks.js +8 -46
  34. package/dist/hooks.js.map +1 -1
  35. package/dist/index.cjs +37 -32
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +58 -3
  38. package/dist/index.d.ts +58 -3
  39. package/dist/index.js +32 -24
  40. package/dist/index.js.map +1 -1
  41. package/dist/mocks.cjs +1 -1
  42. package/dist/mocks.d.cts +1 -1
  43. package/dist/mocks.d.ts +1 -1
  44. package/dist/mocks.js +1 -1
  45. package/dist/{parseFromConfig-CqiiLCPe.js → parseFromConfig-BkUoWC2U.js} +1 -1
  46. package/dist/parseFromConfig-BkUoWC2U.js.map +1 -0
  47. package/dist/{parseFromConfig-RR31a98-.cjs → parseFromConfig-EjsCZ0-8.cjs} +1 -1
  48. package/dist/parseFromConfig-EjsCZ0-8.cjs.map +1 -0
  49. package/dist/utils.cjs +3 -3
  50. package/dist/utils.cjs.map +1 -1
  51. package/dist/utils.d.cts +24 -24
  52. package/dist/utils.d.ts +24 -24
  53. package/dist/utils.js +3 -3
  54. package/dist/utils.js.map +1 -1
  55. package/package.json +14 -17
  56. package/src/OperationGenerator.ts +27 -14
  57. package/src/SchemaGenerator.ts +19 -11
  58. package/src/SchemaMapper.ts +1 -1
  59. package/src/generators/createGenerator.ts +1 -1
  60. package/src/generators/index.ts +0 -1
  61. package/src/generators/jsonGenerator.ts +4 -4
  62. package/src/generators/types.ts +13 -14
  63. package/src/hooks/index.ts +1 -4
  64. package/src/hooks/useOas.ts +5 -11
  65. package/src/hooks/useOperationManager.ts +3 -5
  66. package/src/hooks/useSchemaManager.ts +1 -1
  67. package/src/index.ts +1 -1
  68. package/src/types.ts +1 -1
  69. package/src/utils/getBanner.ts +1 -1
  70. package/src/utils/getParams.ts +1 -2
  71. package/src/utils/getSchemaFactory.ts +1 -2
  72. package/src/utils/getSchemas.ts +1 -1
  73. package/src/utils/index.ts +3 -4
  74. package/src/utils/parseFromConfig.ts +2 -6
  75. package/src/utils.tsx +101 -0
  76. package/dist/Oas-BzrQ6RGC.cjs +0 -80
  77. package/dist/Oas-BzrQ6RGC.cjs.map +0 -1
  78. package/dist/Oas-CIeHKOo0.js +0 -60
  79. package/dist/Oas-CIeHKOo0.js.map +0 -1
  80. package/dist/Schema-CjraJhJi.d.ts +0 -38
  81. package/dist/Schema-zcZF0UIp.d.cts +0 -38
  82. package/dist/SchemaGenerator-7wBwdv8G.js.map +0 -1
  83. package/dist/SchemaGenerator-DzVHk6OP.cjs.map +0 -1
  84. package/dist/SchemaMapper-Cx4X1al6.js.map +0 -1
  85. package/dist/SchemaMapper-DoL-a6qq.cjs.map +0 -1
  86. package/dist/components.cjs +0 -5
  87. package/dist/components.d.cts +0 -42
  88. package/dist/components.d.ts +0 -42
  89. package/dist/components.js +0 -3
  90. package/dist/generators-B27La9Vd.cjs.map +0 -1
  91. package/dist/generators-C61FxVIj.js.map +0 -1
  92. package/dist/getSchemas-Bdg6n9Qk.js.map +0 -1
  93. package/dist/getSchemas-DY8s2CSl.cjs.map +0 -1
  94. package/dist/parseFromConfig-CqiiLCPe.js.map +0 -1
  95. package/dist/parseFromConfig-RR31a98-.cjs.map +0 -1
  96. package/dist/utils-BnkB1ikY.js +0 -99
  97. package/dist/utils-BnkB1ikY.js.map +0 -1
  98. package/dist/utils-nzdccPlU.cjs +0 -119
  99. package/dist/utils-nzdccPlU.cjs.map +0 -1
  100. package/src/components/Oas.tsx +0 -35
  101. package/src/components/Operation.tsx +0 -20
  102. package/src/components/Schema.tsx +0 -38
  103. package/src/components/index.ts +0 -3
  104. package/src/generators/utils.tsx +0 -114
  105. package/src/hooks/useOperation.ts +0 -18
  106. package/src/hooks/useOperations.ts +0 -40
  107. package/src/hooks/useSchema.ts +0 -16
package/dist/utils.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_getFooter = require('./getFooter-CwjCW4h5.cjs');
3
- const require_getSchemas = require('./getSchemas-DY8s2CSl.cjs');
4
- const require_parseFromConfig = require('./parseFromConfig-RR31a98-.cjs');
2
+ const require_getFooter = require('./getFooter-DPh4lxBH.cjs');
3
+ const require_getSchemas = require('./getSchemas-CP_YS4_2.cjs');
4
+ const require_parseFromConfig = require('./parseFromConfig-EjsCZ0-8.cjs');
5
5
  let __kubb_core_transformers = require("@kubb/core/transformers");
6
6
  __kubb_core_transformers = require_chunk.__toESM(__kubb_core_transformers);
7
7
  let __kubb_core_utils = require("@kubb/core/utils");
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","names":["URLPath","transformers","data: FunctionParamsAST"],"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `{@link ${new URLPath(operation.path).URL}}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport { camelCase, isValidVarName } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react-fabric/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n let name = isValidVarName(curr.name) ? curr.name : camelCase(curr.name)\n\n if (options.casing === 'camelcase') {\n name = camelCase(name)\n }\n\n acc[name] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n"],"mappings":";;;;;;;;;;;;AAKA,SAAgB,YAAY,WAAgC;AAC1D,QAAO;EACL,UAAU,gBAAgB,IAAI,gBAAgB,UAAU,gBAAgB;EACxE,UAAU,YAAY,IAAI,YAAY,UAAU,YAAY;EAC5D,UAAU,QAAQ,UAAU,IAAIA,0BAAQ,UAAU,KAAK,CAAC,IAAI;EAC5D,UAAU,cAAc,IAAI;EAC7B,CACE,OAAO,QAAQ,CACf,KAAK,SAASC,iCAAa,KAAK,KAAK,CAAC;;;;;;;;;;ACD3C,SAAgB,aACd,iBACA,EACE,QAAQ,OACR,aAIE,EAAE,EACe;AACrB,KAAI,CAAC,mBAAmB,CAAC,gBAAgB,OAAO,cAAc,CAAC,gBAAgB,KAC7E,QAAO,EAAE;AAGX,QAAO,OAAO,QAAQ,gBAAgB,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,YAA6C;EAChH,MAAM,4CAA4B,OAAO;EACzC,MAAMC,OAA0B;GAC9B;GACA,SAAS,CAAC,CAAC;GACX,UAAU,UAAU,OAAO,WAAW;GACtC,MAAM,QAAQ,GAAG,gBAAgB,KAAK,IAAI,KAAK,MAAM;GACtD;AAED,SAAO,WAAW,SAAS,KAAK,GAAG;GACnC;;AAGJ,SAAgB,cACd,iBACA,UAII,EAAE,EACN;AACA,QAAO,aAAa,iBAAiB,QAAQ,CAAC,QAAQ,KAAK,SAAS;AAClE,MAAI,KAAK,QAAQ,KAAK,SAAS;GAC7B,IAAI,oDAAsB,KAAK,KAAK,GAAG,KAAK,+CAAiB,KAAK,KAAK;AAEvE,OAAI,QAAQ,WAAW,YACrB,gDAAiB,KAAK;AAGxB,OAAI,QAAQ;IACV,SAAS,KAAK;IACd,MAAM,KAAK;IACX,UAAU,CAAC,KAAK;IACjB;;AAGH,SAAO;IACN,EAAE,CAAW"}
1
+ {"version":3,"file":"utils.cjs","names":["URLPath","transformers","data: FunctionParamsAST"],"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `{@link ${new URLPath(operation.path).URL}}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { camelCase, isValidVarName } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport { isParameterObject } from '@kubb/oas'\nimport type { Params } from '@kubb/react-fabric/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n let name = isValidVarName(curr.name) ? curr.name : camelCase(curr.name)\n\n if (options.casing === 'camelcase') {\n name = camelCase(name)\n }\n\n acc[name] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n"],"mappings":";;;;;;;;;;;;AAKA,SAAgB,YAAY,WAAgC;AAC1D,QAAO;EACL,UAAU,gBAAgB,IAAI,gBAAgB,UAAU,gBAAgB;EACxE,UAAU,YAAY,IAAI,YAAY,UAAU,YAAY;EAC5D,UAAU,QAAQ,UAAU,IAAIA,0BAAQ,UAAU,KAAK,CAAC,IAAI;EAC5D,UAAU,cAAc,IAAI;EAC7B,CACE,OAAO,QAAQ,CACf,KAAK,SAASC,iCAAa,KAAK,KAAK,CAAC;;;;;;;;;;ACF3C,SAAgB,aACd,iBACA,EACE,QAAQ,OACR,aAIE,EAAE,EACe;AACrB,KAAI,CAAC,mBAAmB,CAAC,gBAAgB,OAAO,cAAc,CAAC,gBAAgB,KAC7E,QAAO,EAAE;AAGX,QAAO,OAAO,QAAQ,gBAAgB,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,YAA6C;EAChH,MAAM,4CAA4B,OAAO;EACzC,MAAMC,OAA0B;GAC9B;GACA,SAAS,CAAC,CAAC;GACX,UAAU,UAAU,OAAO,WAAW;GACtC,MAAM,QAAQ,GAAG,gBAAgB,KAAK,IAAI,KAAK,MAAM;GACtD;AAED,SAAO,WAAW,SAAS,KAAK,GAAG;GACnC;;AAGJ,SAAgB,cACd,iBACA,UAII,EAAE,EACN;AACA,QAAO,aAAa,iBAAiB,QAAQ,CAAC,QAAQ,KAAK,SAAS;AAClE,MAAI,KAAK,QAAQ,KAAK,SAAS;GAC7B,IAAI,oDAAsB,KAAK,KAAK,GAAG,KAAK,+CAAiB,KAAK,KAAK;AAEvE,OAAI,QAAQ,WAAW,YACrB,gDAAiB,KAAK;AAGxB,OAAI,QAAQ;IACV,SAAS,KAAK;IACd,MAAM,KAAK;IACX,UAAU,CAAC,KAAK;IACjB;;AAGH,SAAO;IACN,EAAE,CAAW"}
package/dist/utils.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Config, B as SchemaObject$1, I as OasTypes, L as OpenAPIV3$1, P as Oas, R as OpenAPIV3_1, V as contentType, j as Output, v as OperationSchema, z as Operation } from "./OperationGenerator-CJTAer7l.cjs";
2
- import "./SchemaMapper-MiRB5_Zp.cjs";
1
+ import { A as SchemaObject$1, D as OpenAPIV3$1, E as OasTypes, N as Config, O as OpenAPIV3_1, P as Output, T as Oas, g as OperationSchema, j as contentType, k as Operation } from "./createGenerator-PIseu7v9.cjs";
2
+ import "./SchemaMapper-CX7sIIuZ.cjs";
3
3
  import { OASDocument, SchemaObject } from "oas/types";
4
4
  import { OpenAPIV3 } from "openapi-types";
5
5
  import { Params } from "@kubb/react-fabric/types";
@@ -8,9 +8,31 @@ import { Params } from "@kubb/react-fabric/types";
8
8
 
9
9
  declare function isOptional(schema?: SchemaObject): boolean;
10
10
  //#endregion
11
+ //#region src/utils/getBanner.d.ts
12
+ type Props$1<TOas extends Oas> = {
13
+ oas: TOas;
14
+ output: Output<any>;
15
+ config?: Config;
16
+ };
17
+ declare function getBanner<TOas extends Oas>({
18
+ output,
19
+ oas,
20
+ config
21
+ }: Props$1<TOas>): string;
22
+ //#endregion
11
23
  //#region src/utils/getComments.d.ts
12
24
  declare function getComments(operation: Operation): string[];
13
25
  //#endregion
26
+ //#region src/utils/getFooter.d.ts
27
+ type Props<TOas extends Oas> = {
28
+ oas: TOas;
29
+ output: Output<any>;
30
+ };
31
+ declare function getFooter<TOas extends Oas>({
32
+ output,
33
+ oas
34
+ }: Props<TOas>): string | undefined;
35
+ //#endregion
14
36
  //#region ../core/src/utils/FunctionParams.d.ts
15
37
  type FunctionParamsASTWithoutType = {
16
38
  name?: string;
@@ -92,27 +114,5 @@ declare function getSchemas({
92
114
  //#region src/utils/parseFromConfig.d.ts
93
115
  declare function parseFromConfig(config: Config, oasClass?: typeof Oas): Promise<Oas>;
94
116
  //#endregion
95
- //#region src/utils/getBanner.d.ts
96
- type Props$1<TOas extends Oas> = {
97
- oas: TOas;
98
- output: Output<any>;
99
- config?: Config;
100
- };
101
- declare function getBanner<TOas extends Oas>({
102
- output,
103
- oas,
104
- config
105
- }: Props$1<TOas>): string;
106
- //#endregion
107
- //#region src/utils/getFooter.d.ts
108
- type Props<TOas extends Oas> = {
109
- oas: TOas;
110
- output: Output<any>;
111
- };
112
- declare function getFooter<TOas extends Oas>({
113
- output,
114
- oas
115
- }: Props<TOas>): string | undefined;
116
- //#endregion
117
117
  export { getBanner, getComments, getFooter, getPathParams, getSchemaFactory, getSchemas, isOptional, parseFromConfig };
118
118
  //# sourceMappingURL=utils.d.cts.map
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Config, B as SchemaObject$1, I as OasTypes, L as OpenAPIV3$1, P as Oas, R as OpenAPIV3_1, V as contentType, j as Output, v as OperationSchema, z as Operation } from "./OperationGenerator-BZPWkxw4.js";
2
- import "./SchemaMapper-CqBW0VOy.js";
1
+ import { A as SchemaObject$1, D as OpenAPIV3$1, E as OasTypes, N as Config, O as OpenAPIV3_1, P as Output, T as Oas, g as OperationSchema, j as contentType, k as Operation } from "./createGenerator-DlSlv4sR.js";
2
+ import "./SchemaMapper-m5TKynWt.js";
3
3
  import { OASDocument, SchemaObject } from "oas/types";
4
4
  import { OpenAPIV3 } from "openapi-types";
5
5
  import { Params } from "@kubb/react-fabric/types";
@@ -8,9 +8,31 @@ import { Params } from "@kubb/react-fabric/types";
8
8
 
9
9
  declare function isOptional(schema?: SchemaObject): boolean;
10
10
  //#endregion
11
+ //#region src/utils/getBanner.d.ts
12
+ type Props$1<TOas extends Oas> = {
13
+ oas: TOas;
14
+ output: Output<any>;
15
+ config?: Config;
16
+ };
17
+ declare function getBanner<TOas extends Oas>({
18
+ output,
19
+ oas,
20
+ config
21
+ }: Props$1<TOas>): string;
22
+ //#endregion
11
23
  //#region src/utils/getComments.d.ts
12
24
  declare function getComments(operation: Operation): string[];
13
25
  //#endregion
26
+ //#region src/utils/getFooter.d.ts
27
+ type Props<TOas extends Oas> = {
28
+ oas: TOas;
29
+ output: Output<any>;
30
+ };
31
+ declare function getFooter<TOas extends Oas>({
32
+ output,
33
+ oas
34
+ }: Props<TOas>): string | undefined;
35
+ //#endregion
14
36
  //#region ../core/src/utils/FunctionParams.d.ts
15
37
  type FunctionParamsASTWithoutType = {
16
38
  name?: string;
@@ -92,27 +114,5 @@ declare function getSchemas({
92
114
  //#region src/utils/parseFromConfig.d.ts
93
115
  declare function parseFromConfig(config: Config, oasClass?: typeof Oas): Promise<Oas>;
94
116
  //#endregion
95
- //#region src/utils/getBanner.d.ts
96
- type Props$1<TOas extends Oas> = {
97
- oas: TOas;
98
- output: Output<any>;
99
- config?: Config;
100
- };
101
- declare function getBanner<TOas extends Oas>({
102
- output,
103
- oas,
104
- config
105
- }: Props$1<TOas>): string;
106
- //#endregion
107
- //#region src/utils/getFooter.d.ts
108
- type Props<TOas extends Oas> = {
109
- oas: TOas;
110
- output: Output<any>;
111
- };
112
- declare function getFooter<TOas extends Oas>({
113
- output,
114
- oas
115
- }: Props<TOas>): string | undefined;
116
- //#endregion
117
117
  export { getBanner, getComments, getFooter, getPathParams, getSchemaFactory, getSchemas, isOptional, parseFromConfig };
118
118
  //# sourceMappingURL=utils.d.ts.map
package/dist/utils.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as getBanner, t as getFooter } from "./getFooter-D5MdeUVv.js";
2
- import { n as getSchemaFactory, t as getSchemas } from "./getSchemas-Bdg6n9Qk.js";
3
- import { t as parseFromConfig } from "./parseFromConfig-CqiiLCPe.js";
1
+ import { n as getBanner, t as getFooter } from "./getFooter-CV73pVXj.js";
2
+ import { n as getSchemaFactory, t as getSchemas } from "./getSchemas-CTi8zYew.js";
3
+ import { t as parseFromConfig } from "./parseFromConfig-BkUoWC2U.js";
4
4
  import transformers, { camelCase, isValidVarName } from "@kubb/core/transformers";
5
5
  import { URLPath } from "@kubb/core/utils";
6
6
  import { isOptional, isParameterObject } from "@kubb/oas";
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["data: FunctionParamsAST"],"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `{@link ${new URLPath(operation.path).URL}}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { isParameterObject } from '@kubb/oas'\n\nimport { camelCase, isValidVarName } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react-fabric/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n let name = isValidVarName(curr.name) ? curr.name : camelCase(curr.name)\n\n if (options.casing === 'camelcase') {\n name = camelCase(name)\n }\n\n acc[name] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n"],"mappings":";;;;;;;;AAKA,SAAgB,YAAY,WAAgC;AAC1D,QAAO;EACL,UAAU,gBAAgB,IAAI,gBAAgB,UAAU,gBAAgB;EACxE,UAAU,YAAY,IAAI,YAAY,UAAU,YAAY;EAC5D,UAAU,QAAQ,UAAU,IAAI,QAAQ,UAAU,KAAK,CAAC,IAAI;EAC5D,UAAU,cAAc,IAAI;EAC7B,CACE,OAAO,QAAQ,CACf,KAAK,SAAS,aAAa,KAAK,KAAK,CAAC;;;;;;;;;;ACD3C,SAAgB,aACd,iBACA,EACE,QAAQ,OACR,aAIE,EAAE,EACe;AACrB,KAAI,CAAC,mBAAmB,CAAC,gBAAgB,OAAO,cAAc,CAAC,gBAAgB,KAC7E,QAAO,EAAE;AAGX,QAAO,OAAO,QAAQ,gBAAgB,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,YAA6C;EAChH,MAAM,UAAU,kBAAkB,OAAO;EACzC,MAAMA,OAA0B;GAC9B;GACA,SAAS,CAAC,CAAC;GACX,UAAU,UAAU,OAAO,WAAW;GACtC,MAAM,QAAQ,GAAG,gBAAgB,KAAK,IAAI,KAAK,MAAM;GACtD;AAED,SAAO,WAAW,SAAS,KAAK,GAAG;GACnC;;AAGJ,SAAgB,cACd,iBACA,UAII,EAAE,EACN;AACA,QAAO,aAAa,iBAAiB,QAAQ,CAAC,QAAQ,KAAK,SAAS;AAClE,MAAI,KAAK,QAAQ,KAAK,SAAS;GAC7B,IAAI,OAAO,eAAe,KAAK,KAAK,GAAG,KAAK,OAAO,UAAU,KAAK,KAAK;AAEvE,OAAI,QAAQ,WAAW,YACrB,QAAO,UAAU,KAAK;AAGxB,OAAI,QAAQ;IACV,SAAS,KAAK;IACd,MAAM,KAAK;IACX,UAAU,CAAC,KAAK;IACjB;;AAGH,SAAO;IACN,EAAE,CAAW"}
1
+ {"version":3,"file":"utils.js","names":["data: FunctionParamsAST"],"sources":["../src/utils/getComments.ts","../src/utils/getParams.ts"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { URLPath } from '@kubb/core/utils'\n\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `{@link ${new URLPath(operation.path).URL}}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter(Boolean)\n .map((text) => transformers.trim(text))\n}\n","import { camelCase, isValidVarName } from '@kubb/core/transformers'\nimport type { FunctionParamsAST } from '@kubb/core/utils'\nimport type { OasTypes } from '@kubb/oas'\nimport { isParameterObject } from '@kubb/oas'\nimport type { Params } from '@kubb/react-fabric/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n override,\n }: {\n typed?: boolean\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema || !operationSchema.schema.properties || !operationSchema.name) {\n return []\n }\n\n return Object.entries(operationSchema.schema.properties).map(([name, schema]: [string, OasTypes.SchemaObject]) => {\n const isParam = isParameterObject(schema)\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: isParam ? schema.required : true,\n type: typed ? `${operationSchema.name}[\"${name}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n let name = isValidVarName(curr.name) ? curr.name : camelCase(curr.name)\n\n if (options.casing === 'camelcase') {\n name = camelCase(name)\n }\n\n acc[name] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n"],"mappings":";;;;;;;;AAKA,SAAgB,YAAY,WAAgC;AAC1D,QAAO;EACL,UAAU,gBAAgB,IAAI,gBAAgB,UAAU,gBAAgB;EACxE,UAAU,YAAY,IAAI,YAAY,UAAU,YAAY;EAC5D,UAAU,QAAQ,UAAU,IAAI,QAAQ,UAAU,KAAK,CAAC,IAAI;EAC5D,UAAU,cAAc,IAAI;EAC7B,CACE,OAAO,QAAQ,CACf,KAAK,SAAS,aAAa,KAAK,KAAK,CAAC;;;;;;;;;;ACF3C,SAAgB,aACd,iBACA,EACE,QAAQ,OACR,aAIE,EAAE,EACe;AACrB,KAAI,CAAC,mBAAmB,CAAC,gBAAgB,OAAO,cAAc,CAAC,gBAAgB,KAC7E,QAAO,EAAE;AAGX,QAAO,OAAO,QAAQ,gBAAgB,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,YAA6C;EAChH,MAAM,UAAU,kBAAkB,OAAO;EACzC,MAAMA,OAA0B;GAC9B;GACA,SAAS,CAAC,CAAC;GACX,UAAU,UAAU,OAAO,WAAW;GACtC,MAAM,QAAQ,GAAG,gBAAgB,KAAK,IAAI,KAAK,MAAM;GACtD;AAED,SAAO,WAAW,SAAS,KAAK,GAAG;GACnC;;AAGJ,SAAgB,cACd,iBACA,UAII,EAAE,EACN;AACA,QAAO,aAAa,iBAAiB,QAAQ,CAAC,QAAQ,KAAK,SAAS;AAClE,MAAI,KAAK,QAAQ,KAAK,SAAS;GAC7B,IAAI,OAAO,eAAe,KAAK,KAAK,GAAG,KAAK,OAAO,UAAU,KAAK,KAAK;AAEvE,OAAI,QAAQ,WAAW,YACrB,QAAO,UAAU,KAAK;AAGxB,OAAI,QAAQ;IACV,SAAS,KAAK;IACd,MAAM,KAAK;IACX,UAAU,CAAC,KAAK;IACjB;;AAGH,SAAO;IACN,EAAE,CAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-oas",
3
- "version": "0.0.0-canary-20251028131922",
3
+ "version": "0.0.0-canary-20251103125929",
4
4
  "description": "OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.",
5
5
  "keywords": [
6
6
  "openapi",
@@ -28,10 +28,6 @@
28
28
  "import": "./dist/index.js",
29
29
  "require": "./dist/index.cjs"
30
30
  },
31
- "./components": {
32
- "import": "./dist/components.js",
33
- "require": "./dist/components.cjs"
34
- },
35
31
  "./generators": {
36
32
  "import": "./dist/generators.js",
37
33
  "require": "./dist/generators.cjs"
@@ -61,9 +57,6 @@
61
57
  "hooks": [
62
58
  "./dist/hooks.d.ts"
63
59
  ],
64
- "components": [
65
- "./dist/components.d.ts"
66
- ],
67
60
  "mocks": [
68
61
  "./dist/mocks.d.ts"
69
62
  ],
@@ -78,20 +71,24 @@
78
71
  "!/**/**.test.**",
79
72
  "!/**/__tests__/**"
80
73
  ],
74
+ "size-limit": [
75
+ {
76
+ "path": "./dist/*.js",
77
+ "limit": "510 KiB",
78
+ "gzip": true
79
+ }
80
+ ],
81
81
  "dependencies": {
82
- "@kubb/react-fabric": "0.2.8",
82
+ "@kubb/react-fabric": "0.2.14",
83
83
  "@stoplight/yaml": "^4.3.0",
84
84
  "p-limit": "^7.2.0",
85
85
  "remeda": "^2.32.0",
86
- "@kubb/core": "0.0.0-canary-20251028131922",
87
- "@kubb/oas": "0.0.0-canary-20251028131922"
88
- },
89
- "devDependencies": {
90
- "tsdown": "^0.15.11",
91
- "typescript": "^5.9.3"
86
+ "@kubb/core": "0.0.0-canary-20251103125929",
87
+ "@kubb/oas": "0.0.0-canary-20251103125929"
92
88
  },
89
+ "devDependencies": {},
93
90
  "peerDependencies": {
94
- "@kubb/react-fabric": "0.2.8"
91
+ "@kubb/react-fabric": "0.2.14"
95
92
  },
96
93
  "engines": {
97
94
  "node": ">=20"
@@ -101,7 +98,7 @@
101
98
  "registry": "https://registry.npmjs.org/"
102
99
  },
103
100
  "scripts": {
104
- "build": "tsdown",
101
+ "build": "tsdown && size-limit",
105
102
  "clean": "npx rimraf ./dist",
106
103
  "lint": "bun biome lint .",
107
104
  "lint:fix": "bun biome lint --fix --unsafe .",
@@ -1,13 +1,13 @@
1
1
  import type { Plugin, PluginFactoryOptions, PluginManager } from '@kubb/core'
2
2
  import { BaseGenerator, type FileMetaBase } from '@kubb/core'
3
- import type { KubbFile } from '@kubb/core/fs'
4
3
  import transformers from '@kubb/core/transformers'
4
+ import type { KubbFile } from '@kubb/fabric-core/types'
5
5
  import type { contentType, HttpMethod, Oas, OasTypes, Operation, SchemaObject } from '@kubb/oas'
6
6
  import type { Fabric } from '@kubb/react-fabric'
7
7
  import pLimit from 'p-limit'
8
8
  import type { Generator } from './generators/types.ts'
9
- import { buildOperation, buildOperations } from './generators/utils.tsx'
10
9
  import type { Exclude, Include, OperationSchemas, Override } from './types.ts'
10
+ import { buildOperation, buildOperations } from './utils.tsx'
11
11
 
12
12
  export type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>
13
13
 
@@ -229,12 +229,16 @@ export class OperationGenerator<
229
229
 
230
230
  if (generator.type === 'react') {
231
231
  await buildOperation(operation, {
232
+ config: this.context.pluginManager.config,
232
233
  fabric: this.context.fabric,
233
- generator,
234
- instance: this,
235
- options: {
236
- ...this.options,
237
- ...options,
234
+ Component: generator.Operation,
235
+ generator: this,
236
+ plugin: {
237
+ ...this.context.plugin,
238
+ options: {
239
+ ...this.options,
240
+ ...options,
241
+ },
238
242
  },
239
243
  })
240
244
 
@@ -242,9 +246,16 @@ export class OperationGenerator<
242
246
  }
243
247
 
244
248
  const result = await generator.operation?.({
245
- instance: this,
249
+ generator: this,
250
+ config: this.context.pluginManager.config,
246
251
  operation,
247
- options: { ...this.options, ...options },
252
+ plugin: {
253
+ ...this.context.plugin,
254
+ options: {
255
+ ...this.options,
256
+ ...options,
257
+ },
258
+ },
248
259
  })
249
260
 
250
261
  return result ?? []
@@ -259,9 +270,10 @@ export class OperationGenerator<
259
270
  operations.map((op) => op.operation),
260
271
  {
261
272
  fabric: this.context.fabric,
262
- generator,
263
- instance: this,
264
- options: this.options,
273
+ config: this.context.pluginManager.config,
274
+ Component: generator.Operations,
275
+ generator: this,
276
+ plugin: this.context.plugin,
265
277
  },
266
278
  )
267
279
 
@@ -269,9 +281,10 @@ export class OperationGenerator<
269
281
  }
270
282
 
271
283
  const operationsResult = await generator.operations?.({
272
- instance: this,
284
+ generator: this,
285
+ config: this.context.pluginManager.config,
273
286
  operations: operations.map((op) => op.operation),
274
- options: this.options,
287
+ plugin: this.context.plugin,
275
288
  })
276
289
 
277
290
  return [...opResultsFlat, ...(operationsResult ?? [])] as unknown as KubbFile.File<TFileMeta>
@@ -1,20 +1,20 @@
1
1
  import type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'
2
2
  import { BaseGenerator, type FileMetaBase } from '@kubb/core'
3
- import type { KubbFile } from '@kubb/core/fs'
4
3
  import transformers, { pascalCase } from '@kubb/core/transformers'
5
4
  import { getUniqueName } from '@kubb/core/utils'
5
+ import type { KubbFile } from '@kubb/fabric-core/types'
6
6
  import type { contentType, Oas, OpenAPIV3, SchemaObject } from '@kubb/oas'
7
7
  import { isDiscriminator, isNullable, isReference } from '@kubb/oas'
8
8
  import type { Fabric } from '@kubb/react-fabric'
9
9
  import pLimit from 'p-limit'
10
10
  import { isDeepEqual, isNumber, uniqueWith } from 'remeda'
11
11
  import type { Generator } from './generators/types.ts'
12
- import { buildSchema } from './generators/utils.tsx'
13
12
  import type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'
14
13
  import { isKeyword, schemaKeywords } from './SchemaMapper.ts'
15
14
  import type { OperationSchema, Override, Refs } from './types.ts'
16
15
  import { getSchemaFactory } from './utils/getSchemaFactory.ts'
17
16
  import { getSchemas } from './utils/getSchemas.ts'
17
+ import { buildSchema } from './utils.tsx'
18
18
 
19
19
  export type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never
20
20
 
@@ -1127,12 +1127,16 @@ export class SchemaGenerator<
1127
1127
  tree,
1128
1128
  },
1129
1129
  {
1130
+ config: this.context.pluginManager.config,
1130
1131
  fabric: this.context.fabric,
1131
- generator,
1132
- instance: this,
1133
- options: {
1134
- ...this.options,
1135
- ...options,
1132
+ Component: generator.Schema,
1133
+ generator: this,
1134
+ plugin: {
1135
+ ...this.context.plugin,
1136
+ options: {
1137
+ ...this.options,
1138
+ ...options,
1139
+ },
1136
1140
  },
1137
1141
  },
1138
1142
  )
@@ -1141,15 +1145,19 @@ export class SchemaGenerator<
1141
1145
  }
1142
1146
 
1143
1147
  const result = await generator.schema?.({
1144
- instance: this,
1148
+ config: this.context.pluginManager.config,
1149
+ generator: this,
1145
1150
  schema: {
1146
1151
  name,
1147
1152
  value: schemaObject,
1148
1153
  tree,
1149
1154
  },
1150
- options: {
1151
- ...this.options,
1152
- ...options,
1155
+ plugin: {
1156
+ ...this.context.plugin,
1157
+ options: {
1158
+ ...this.options,
1159
+ ...options,
1160
+ },
1153
1161
  },
1154
1162
  })
1155
1163
 
@@ -1,4 +1,4 @@
1
- import type { KubbFile } from '@kubb/core/fs'
1
+ import type { KubbFile } from '@kubb/fabric-core/types'
2
2
 
3
3
  export type SchemaKeywordMapper = {
4
4
  object: {
@@ -1,5 +1,5 @@
1
1
  import type { PluginFactoryOptions } from '@kubb/core'
2
- import type { KubbFile } from '@kubb/core/fs'
2
+ import type { KubbFile } from '@kubb/fabric-core/types'
3
3
  import type { OperationProps, OperationsProps, SchemaProps } from './types.ts'
4
4
 
5
5
  type UserGenerator<TOptions extends PluginFactoryOptions> = {
@@ -2,4 +2,3 @@ export { createGenerator } from './createGenerator.ts'
2
2
  export { createReactGenerator } from './createReactGenerator.ts'
3
3
  export { jsonGenerator } from './jsonGenerator.ts'
4
4
  export type { Generator } from './types.ts'
5
- export { buildOperation, buildOperations, buildSchema } from './utils.tsx'
@@ -6,8 +6,8 @@ import { createGenerator } from './createGenerator.ts'
6
6
 
7
7
  export const jsonGenerator = createGenerator<PluginOas>({
8
8
  name: 'plugin-oas',
9
- async schema({ schema, instance }) {
10
- const { pluginManager, plugin } = instance.context
9
+ async schema({ schema, generator }) {
10
+ const { pluginManager, plugin } = generator.context
11
11
  const file = pluginManager.getFile({
12
12
  name: camelCase(schema.name),
13
13
  extname: '.json',
@@ -27,11 +27,11 @@ export const jsonGenerator = createGenerator<PluginOas>({
27
27
  },
28
28
  ],
29
29
  banner: getBanner({
30
- oas: instance.context.oas,
30
+ oas: generator.context.oas,
31
31
  output: plugin.options.output,
32
32
  config: pluginManager.config,
33
33
  }),
34
- format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),
34
+ format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),
35
35
  },
36
36
  ]
37
37
  },
@@ -1,30 +1,29 @@
1
- import type { PluginFactoryOptions } from '@kubb/core'
1
+ import type { Config, Plugin, PluginFactoryOptions } from '@kubb/core'
2
2
  import type { Operation, SchemaObject } from '@kubb/oas'
3
- import type { OperationGenerator, Schema, SchemaGenerator, SchemaGeneratorOptions } from '@kubb/plugin-oas'
3
+ import type { OperationGenerator } from '../OperationGenerator.ts'
4
+ import type { SchemaGenerator, SchemaGeneratorOptions } from '../SchemaGenerator.ts'
5
+ import type { Schema } from '../SchemaMapper.ts'
4
6
  import type { CoreGenerator } from './createGenerator.ts'
5
7
  import type { ReactGenerator } from './createReactGenerator.ts'
6
8
 
7
9
  export type OperationsProps<TOptions extends PluginFactoryOptions> = {
8
- /**
9
- * @deprecated
10
- */
11
- instance: Omit<OperationGenerator<TOptions>, 'build'>
12
- options: TOptions['resolvedOptions']
10
+ config: Config
11
+ generator: Omit<OperationGenerator<TOptions>, 'build'>
12
+ plugin: Plugin<TOptions>
13
13
  operations: Array<Operation>
14
14
  }
15
15
 
16
16
  export type OperationProps<TOptions extends PluginFactoryOptions> = {
17
- /**
18
- * @deprecated
19
- */
20
- instance: Omit<OperationGenerator<TOptions>, 'build'>
21
- options: TOptions['resolvedOptions']
17
+ config: Config
18
+ generator: Omit<OperationGenerator<TOptions>, 'build'>
19
+ plugin: Plugin<TOptions>
22
20
  operation: Operation
23
21
  }
24
22
 
25
23
  export type SchemaProps<TOptions extends PluginFactoryOptions> = {
26
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>
27
- options: TOptions['resolvedOptions']
24
+ config: Config
25
+ generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>
26
+ plugin: Plugin<TOptions>
28
27
  schema: {
29
28
  name: string
30
29
  tree: Array<Schema>
@@ -1,7 +1,4 @@
1
1
  export { useOas } from './useOas.ts'
2
- export { useOperation } from './useOperation.ts'
3
- export { useOperationManager } from './useOperationManager.ts'
4
2
  export type { SchemaNames } from './useOperationManager.ts'
5
- export { useOperations } from './useOperations.ts'
6
- export { useSchema } from './useSchema.ts'
3
+ export { useOperationManager } from './useOperationManager.ts'
7
4
  export { useSchemaManager } from './useSchemaManager.ts'
@@ -1,15 +1,9 @@
1
- import { useContext } from '@kubb/react-fabric'
1
+ import type { Oas } from '@kubb/oas'
2
2
 
3
- import { Oas } from '../components/Oas.tsx'
3
+ import { useApp } from '@kubb/react-fabric'
4
4
 
5
- import type { Oas as OasType } from '@kubb/oas'
5
+ export function useOas(): Oas {
6
+ const { meta } = useApp<{ oas: Oas }>()
6
7
 
7
- export function useOas(): OasType {
8
- const { oas } = useContext(Oas.Context)
9
-
10
- if (!oas) {
11
- throw new Error('Oas is not defined')
12
- }
13
-
14
- return oas
8
+ return meta.oas
15
9
  }
@@ -1,9 +1,8 @@
1
1
  import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'
2
- import type { KubbFile } from '@kubb/core/fs'
3
2
  import { usePlugin, usePluginManager } from '@kubb/core/hooks'
3
+ import type { KubbFile } from '@kubb/fabric-core/types'
4
4
  import type { Operation, Operation as OperationType } from '@kubb/oas'
5
- import { useContext } from '@kubb/react-fabric'
6
- import { Oas } from '../components/Oas.tsx'
5
+ import type { OperationGenerator } from '../OperationGenerator.ts'
7
6
  import type { OperationSchemas } from '../types.ts'
8
7
 
9
8
  type FileMeta = FileMetaBase & {
@@ -63,10 +62,9 @@ type UseOperationManagerResult = {
63
62
  /**
64
63
  * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.
65
64
  */
66
- export function useOperationManager(): UseOperationManagerResult {
65
+ export function useOperationManager(generator: Omit<OperationGenerator, 'build'>): UseOperationManagerResult {
67
66
  const plugin = usePlugin()
68
67
  const pluginManager = usePluginManager()
69
- const { generator } = useContext(Oas.Context)
70
68
 
71
69
  const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginKey = plugin.key, type }) => {
72
70
  return pluginManager.resolveName({
@@ -1,6 +1,6 @@
1
1
  import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'
2
- import type { KubbFile } from '@kubb/core/fs'
3
2
  import { usePlugin, usePluginManager } from '@kubb/core/hooks'
3
+ import type { KubbFile } from '@kubb/fabric-core/types'
4
4
  import { SchemaGenerator } from '../SchemaGenerator.ts'
5
5
  import { type Schema, schemaKeywords } from '../SchemaMapper'
6
6
 
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './generators/index.ts'
2
1
  export type { OperationMethodResult } from './OperationGenerator.ts'
3
2
  export { OperationGenerator } from './OperationGenerator.ts'
4
3
  export { pluginOas, pluginOasName } from './plugin.ts'
@@ -19,3 +18,4 @@ export type {
19
18
  } from './SchemaMapper.ts'
20
19
  export { isKeyword, schemaKeywords } from './SchemaMapper.ts'
21
20
  export type * from './types.ts'
21
+ export { buildOperation, buildOperations, buildSchema } from './utils.tsx'
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Group, Output, Plugin, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
- import type { KubbFile } from '@kubb/core/fs'
2
+ import type { KubbFile } from '@kubb/fabric-core/types'
3
3
 
4
4
  import type { contentType, HttpMethod, Oas, Operation, SchemaObject } from '@kubb/oas'
5
5
  import type { Generator } from './generators/types.ts'
@@ -1,7 +1,7 @@
1
+ import path from 'node:path'
1
2
  import type { Config, Output } from '@kubb/core'
2
3
  import type { Oas } from '@kubb/oas'
3
4
  import { isFunction } from 'remeda'
4
- import path from 'node:path'
5
5
 
6
6
  type Props<TOas extends Oas> = {
7
7
  oas: TOas
@@ -1,8 +1,7 @@
1
- import { isParameterObject } from '@kubb/oas'
2
-
3
1
  import { camelCase, isValidVarName } from '@kubb/core/transformers'
4
2
  import type { FunctionParamsAST } from '@kubb/core/utils'
5
3
  import type { OasTypes } from '@kubb/oas'
4
+ import { isParameterObject } from '@kubb/oas'
6
5
  import type { Params } from '@kubb/react-fabric/types'
7
6
  import type { OperationSchema } from '../types.ts'
8
7
  /**
@@ -1,6 +1,5 @@
1
- import { isOpenApiV3_1Document } from '@kubb/oas'
2
-
3
1
  import type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'
2
+ import { isOpenApiV3_1Document } from '@kubb/oas'
4
3
 
5
4
  /**
6
5
  * Make it possible to narrow down the schema based on a specific version(3 or 3.1)
@@ -1,4 +1,4 @@
1
- import type { Oas, OasTypes, contentType } from '@kubb/oas'
1
+ import type { contentType, Oas, OasTypes } from '@kubb/oas'
2
2
 
3
3
  type Mode = 'schemas' | 'responses' | 'requestBodies'
4
4