@kubb/plugin-oas 5.0.0-alpha.1 → 5.0.0-alpha.3

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 (38) hide show
  1. package/dist/{createGenerator-CBXpHeVY.d.ts → createGenerator-jtR_okrd.d.ts} +11 -8
  2. package/dist/{generators-D7C3CXsN.js → generators-B8HiBWvT.js} +2 -2
  3. package/dist/{generators-D7C3CXsN.js.map → generators-B8HiBWvT.js.map} +1 -1
  4. package/dist/{generators-CyWd3UXA.cjs → generators-vAAte6w6.cjs} +2 -2
  5. package/dist/{generators-CyWd3UXA.cjs.map → generators-vAAte6w6.cjs.map} +1 -1
  6. package/dist/generators.cjs +1 -1
  7. package/dist/generators.d.ts +1 -1
  8. package/dist/generators.js +1 -1
  9. package/dist/hooks.cjs +24 -47
  10. package/dist/hooks.cjs.map +1 -1
  11. package/dist/hooks.d.ts +12 -32
  12. package/dist/hooks.js +25 -47
  13. package/dist/hooks.js.map +1 -1
  14. package/dist/index.cjs +3 -3
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +12 -2
  17. package/dist/index.js +3 -3
  18. package/dist/index.js.map +1 -1
  19. package/dist/{requestBody-DIM-iDpM.cjs → requestBody-BJJL0mpy.cjs} +24 -13
  20. package/dist/requestBody-BJJL0mpy.cjs.map +1 -0
  21. package/dist/{requestBody-mUXoBwsu.js → requestBody-CSL-jLGQ.js} +24 -13
  22. package/dist/requestBody-CSL-jLGQ.js.map +1 -0
  23. package/dist/utils.cjs +1 -1
  24. package/dist/utils.d.ts +1 -1
  25. package/dist/utils.js +1 -1
  26. package/package.json +3 -3
  27. package/src/SchemaGenerator.ts +4 -4
  28. package/src/generators/jsonGenerator.ts +1 -1
  29. package/src/generators/types.ts +7 -4
  30. package/src/hooks/index.ts +0 -1
  31. package/src/hooks/useOperationManager.ts +22 -22
  32. package/src/hooks/useSchemaManager.ts +12 -11
  33. package/src/plugin.ts +1 -1
  34. package/src/types.ts +4 -4
  35. package/src/utils.tsx +22 -9
  36. package/dist/requestBody-DIM-iDpM.cjs.map +0 -1
  37. package/dist/requestBody-mUXoBwsu.js.map +0 -1
  38. package/src/hooks/useRootNode.ts +0 -25
@@ -2,7 +2,7 @@ import { t as __name } from "./chunk--u3MIqq1.js";
2
2
  import { i as SchemaKeywordMapper, t as Schema } from "./SchemaMapper-SneuY1wg.js";
3
3
  import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
4
4
  import { Fabric } from "@kubb/react-fabric";
5
- import { AsyncEventEmitter, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
5
+ import { Adapter, AsyncEventEmitter, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
6
6
  import { KubbFile } from "@kubb/fabric-core/types";
7
7
  import { OperationNode, SchemaNode } from "@kubb/ast/types";
8
8
  import { FabricReactNode } from "@kubb/react-fabric/types";
@@ -21,7 +21,7 @@ declare global {
21
21
  }
22
22
  }
23
23
  type ResolvePathOptions = {
24
- pluginKey?: Plugin['key'];
24
+ pluginName?: string;
25
25
  group?: {
26
26
  tag?: string;
27
27
  path?: string;
@@ -135,14 +135,14 @@ type Options = {
135
135
  *
136
136
  * `originalName` is the original name used(in PascalCase), only used to remove duplicates
137
137
  *
138
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
138
+ * `pluginName` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
139
139
  * @example import a type(plugin-ts) for a mock file(swagger-faker)
140
140
  */
141
141
  type Ref = {
142
142
  propertyName: string;
143
143
  originalName: string;
144
144
  path: KubbFile.Path;
145
- pluginKey?: Plugin['key'];
145
+ pluginName?: string;
146
146
  };
147
147
  type Refs = Record<string, Ref>;
148
148
  type Resolver = {
@@ -365,7 +365,8 @@ type OperationsV1Props<TOptions extends PluginFactoryOptions> = {
365
365
  };
366
366
  type OperationsV2Props<TOptions extends PluginFactoryOptions> = {
367
367
  config: Config;
368
- plugin: Plugin<TOptions>;
368
+ adapter: Adapter;
369
+ options: Plugin<TOptions>['options'];
369
370
  nodes: Array<OperationNode>;
370
371
  };
371
372
  type OperationV1Props<TOptions extends PluginFactoryOptions> = {
@@ -376,7 +377,8 @@ type OperationV1Props<TOptions extends PluginFactoryOptions> = {
376
377
  };
377
378
  type OperationV2Props<TOptions extends PluginFactoryOptions> = {
378
379
  config: Config;
379
- plugin: Plugin<TOptions>;
380
+ adapter: Adapter;
381
+ options: Plugin<TOptions>['options'];
380
382
  node: OperationNode;
381
383
  };
382
384
  type OperationsProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? OperationsV2Props<TOptions> : OperationsV1Props<TOptions>;
@@ -393,8 +395,9 @@ type SchemaV1Props<TOptions extends PluginFactoryOptions> = {
393
395
  };
394
396
  type SchemaV2Props<TOptions extends PluginFactoryOptions> = {
395
397
  config: Config;
396
- plugin: Plugin<TOptions>;
398
+ options: Plugin<TOptions>['options'];
397
399
  node: SchemaNode;
400
+ adapter: Adapter;
398
401
  };
399
402
  type SchemaProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? SchemaV2Props<TOptions> : SchemaV1Props<TOptions>;
400
403
  type Generator<TOptions extends PluginFactoryOptions, TVersion extends Version = Version> = CoreGenerator<TOptions, TVersion> | ReactGenerator<TOptions, TVersion>;
@@ -418,4 +421,4 @@ type CoreGenerator<TOptions extends PluginFactoryOptions, TVersion extends Versi
418
421
  declare function createGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(generator: UserGenerator<TOptions, TVersion>): CoreGenerator<TOptions, TVersion>;
419
422
  //#endregion
420
423
  export { ResolvePathOptions as C, Refs as S, OperationSchemas as _, ReactGenerator as a, PluginOas as b, SchemaGenerator as c, SchemaMethodResult as d, OperationGenerator as f, OperationSchema as g, Include as h, Version as i, SchemaGeneratorBuildOptions as l, Exclude as m, createGenerator as n, createReactGenerator as o, OperationMethodResult as p, Generator as r, GetSchemaGeneratorOptions as s, CoreGenerator as t, SchemaGeneratorOptions as u, Options as v, Resolver as w, Ref as x, Override as y };
421
- //# sourceMappingURL=createGenerator-CBXpHeVY.d.ts.map
424
+ //# sourceMappingURL=createGenerator-jtR_okrd.d.ts.map
@@ -53,7 +53,7 @@ const jsonGenerator = createGenerator({
53
53
  name: camelCase(schema.name),
54
54
  extname: ".json",
55
55
  mode: "split",
56
- pluginKey: plugin.key
56
+ pluginName: plugin.name
57
57
  }),
58
58
  sources: [{
59
59
  name: camelCase(schema.name),
@@ -76,4 +76,4 @@ const jsonGenerator = createGenerator({
76
76
  //#endregion
77
77
  export { createReactGenerator as n, createGenerator as r, jsonGenerator as t };
78
78
 
79
- //# sourceMappingURL=generators-D7C3CXsN.js.map
79
+ //# sourceMappingURL=generators-B8HiBWvT.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generators-D7C3CXsN.js","names":[],"sources":["../src/generators/createGenerator.ts","../src/generators/createReactGenerator.ts","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n version?: TVersion\n operations?: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n operation?: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n schema?: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n}\n\nexport type CoreGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n type: 'core'\n version: TVersion\n operations: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n operation: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n schema: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n}\n\nexport function createGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(\n generator: UserGenerator<TOptions, TVersion>,\n): CoreGenerator<TOptions, TVersion> {\n return {\n type: 'core',\n version: (generator.version ?? '1') as TVersion,\n async operations() {\n return []\n },\n async operation() {\n return []\n },\n async schema() {\n return []\n },\n ...generator,\n }\n}\n","import type { PluginFactoryOptions } from '@kubb/core'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n version?: TVersion\n Operations?: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode\n Operation?: (props: OperationProps<TOptions, TVersion>) => FabricReactNode\n Schema?: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode\n}\n\nexport type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n type: 'react'\n version: TVersion\n Operations: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode\n Operation: (props: OperationProps<TOptions, TVersion>) => FabricReactNode\n Schema: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode\n}\n\n/****\n * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.\n *\n * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.\n *\n * @returns A generator object with async methods for operations, operation, and schema file generation.\n */\nexport function createReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(\n generator: UserGenerator<TOptions, TVersion>,\n): ReactGenerator<TOptions, TVersion> {\n return {\n type: 'react',\n version: (generator.version ?? '1') as TVersion,\n Operations() {\n return null\n },\n Operation() {\n return null\n },\n Schema() {\n return null\n },\n ...generator,\n }\n}\n","import { camelCase } from '@internals/utils'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\nimport { createGenerator } from './createGenerator.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, generator }) {\n const { pluginManager, plugin } = generator.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: generator.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;AAqBA,SAAgB,gBACd,WACmC;AACnC,QAAO;EACL,MAAM;EACN,SAAU,UAAU,WAAW;EAC/B,MAAM,aAAa;AACjB,UAAO,EAAE;;EAEX,MAAM,YAAY;AAChB,UAAO,EAAE;;EAEX,MAAM,SAAS;AACb,UAAO,EAAE;;EAEX,GAAG;EACJ;;;;;;;;;;;ACTH,SAAgB,qBACd,WACoC;AACpC,QAAO;EACL,MAAM;EACN,SAAU,UAAU,WAAW;EAC/B,aAAa;AACX,UAAO;;EAET,YAAY;AACV,UAAO;;EAET,SAAS;AACP,UAAO;;EAET,GAAG;EACJ;;;;ACtCH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,aAAa;EAClC,MAAM,EAAE,eAAe,WAAW,UAAU;AAQ5C,SAAO,CACL;GACE,GATS,cAAc,QAAQ;IACjC,MAAM,UAAU,OAAO,KAAK;IAC5B,SAAS;IACT,MAAM;IACN,WAAW,OAAO;IACnB,CAAC;GAKE,SAAS,CACP;IACE,MAAM,UAAU,OAAO,KAAK;IAC5B,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO,MAAM;IACpC,CACF;GACD,QAAQ,UAAU;IAChB,KAAK,UAAU,QAAQ;IACvB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;IACvB,CAAC;GACF,QAAQ,UAAU;IAAE,KAAK,UAAU,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GACjF,CACF;;CAEJ,CAAC"}
1
+ {"version":3,"file":"generators-B8HiBWvT.js","names":[],"sources":["../src/generators/createGenerator.ts","../src/generators/createReactGenerator.ts","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n version?: TVersion\n operations?: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n operation?: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n schema?: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n}\n\nexport type CoreGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n type: 'core'\n version: TVersion\n operations: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n operation: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n schema: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n}\n\nexport function createGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(\n generator: UserGenerator<TOptions, TVersion>,\n): CoreGenerator<TOptions, TVersion> {\n return {\n type: 'core',\n version: (generator.version ?? '1') as TVersion,\n async operations() {\n return []\n },\n async operation() {\n return []\n },\n async schema() {\n return []\n },\n ...generator,\n }\n}\n","import type { PluginFactoryOptions } from '@kubb/core'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n version?: TVersion\n Operations?: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode\n Operation?: (props: OperationProps<TOptions, TVersion>) => FabricReactNode\n Schema?: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode\n}\n\nexport type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n type: 'react'\n version: TVersion\n Operations: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode\n Operation: (props: OperationProps<TOptions, TVersion>) => FabricReactNode\n Schema: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode\n}\n\n/****\n * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.\n *\n * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.\n *\n * @returns A generator object with async methods for operations, operation, and schema file generation.\n */\nexport function createReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(\n generator: UserGenerator<TOptions, TVersion>,\n): ReactGenerator<TOptions, TVersion> {\n return {\n type: 'react',\n version: (generator.version ?? '1') as TVersion,\n Operations() {\n return null\n },\n Operation() {\n return null\n },\n Schema() {\n return null\n },\n ...generator,\n }\n}\n","import { camelCase } from '@internals/utils'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\nimport { createGenerator } from './createGenerator.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, generator }) {\n const { pluginManager, plugin } = generator.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginName: plugin.name,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: generator.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;AAqBA,SAAgB,gBACd,WACmC;AACnC,QAAO;EACL,MAAM;EACN,SAAU,UAAU,WAAW;EAC/B,MAAM,aAAa;AACjB,UAAO,EAAE;;EAEX,MAAM,YAAY;AAChB,UAAO,EAAE;;EAEX,MAAM,SAAS;AACb,UAAO,EAAE;;EAEX,GAAG;EACJ;;;;;;;;;;;ACTH,SAAgB,qBACd,WACoC;AACpC,QAAO;EACL,MAAM;EACN,SAAU,UAAU,WAAW;EAC/B,aAAa;AACX,UAAO;;EAET,YAAY;AACV,UAAO;;EAET,SAAS;AACP,UAAO;;EAET,GAAG;EACJ;;;;ACtCH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,aAAa;EAClC,MAAM,EAAE,eAAe,WAAW,UAAU;AAQ5C,SAAO,CACL;GACE,GATS,cAAc,QAAQ;IACjC,MAAM,UAAU,OAAO,KAAK;IAC5B,SAAS;IACT,MAAM;IACN,YAAY,OAAO;IACpB,CAAC;GAKE,SAAS,CACP;IACE,MAAM,UAAU,OAAO,KAAK;IAC5B,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO,MAAM;IACpC,CACF;GACD,QAAQ,UAAU;IAChB,KAAK,UAAU,QAAQ;IACvB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;IACvB,CAAC;GACF,QAAQ,UAAU;IAAE,KAAK,UAAU,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GACjF,CACF;;CAEJ,CAAC"}
@@ -53,7 +53,7 @@ const jsonGenerator = createGenerator({
53
53
  name: require_getFooter.camelCase(schema.name),
54
54
  extname: ".json",
55
55
  mode: "split",
56
- pluginKey: plugin.key
56
+ pluginName: plugin.name
57
57
  }),
58
58
  sources: [{
59
59
  name: require_getFooter.camelCase(schema.name),
@@ -93,4 +93,4 @@ Object.defineProperty(exports, "jsonGenerator", {
93
93
  }
94
94
  });
95
95
 
96
- //# sourceMappingURL=generators-CyWd3UXA.cjs.map
96
+ //# sourceMappingURL=generators-vAAte6w6.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generators-CyWd3UXA.cjs","names":["camelCase","getBanner","getFooter"],"sources":["../src/generators/createGenerator.ts","../src/generators/createReactGenerator.ts","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n version?: TVersion\n operations?: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n operation?: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n schema?: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n}\n\nexport type CoreGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n type: 'core'\n version: TVersion\n operations: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n operation: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n schema: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n}\n\nexport function createGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(\n generator: UserGenerator<TOptions, TVersion>,\n): CoreGenerator<TOptions, TVersion> {\n return {\n type: 'core',\n version: (generator.version ?? '1') as TVersion,\n async operations() {\n return []\n },\n async operation() {\n return []\n },\n async schema() {\n return []\n },\n ...generator,\n }\n}\n","import type { PluginFactoryOptions } from '@kubb/core'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n version?: TVersion\n Operations?: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode\n Operation?: (props: OperationProps<TOptions, TVersion>) => FabricReactNode\n Schema?: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode\n}\n\nexport type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n type: 'react'\n version: TVersion\n Operations: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode\n Operation: (props: OperationProps<TOptions, TVersion>) => FabricReactNode\n Schema: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode\n}\n\n/****\n * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.\n *\n * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.\n *\n * @returns A generator object with async methods for operations, operation, and schema file generation.\n */\nexport function createReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(\n generator: UserGenerator<TOptions, TVersion>,\n): ReactGenerator<TOptions, TVersion> {\n return {\n type: 'react',\n version: (generator.version ?? '1') as TVersion,\n Operations() {\n return null\n },\n Operation() {\n return null\n },\n Schema() {\n return null\n },\n ...generator,\n }\n}\n","import { camelCase } from '@internals/utils'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\nimport { createGenerator } from './createGenerator.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, generator }) {\n const { pluginManager, plugin } = generator.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: generator.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;AAqBA,SAAgB,gBACd,WACmC;AACnC,QAAO;EACL,MAAM;EACN,SAAU,UAAU,WAAW;EAC/B,MAAM,aAAa;AACjB,UAAO,EAAE;;EAEX,MAAM,YAAY;AAChB,UAAO,EAAE;;EAEX,MAAM,SAAS;AACb,UAAO,EAAE;;EAEX,GAAG;EACJ;;;;;;;;;;;ACTH,SAAgB,qBACd,WACoC;AACpC,QAAO;EACL,MAAM;EACN,SAAU,UAAU,WAAW;EAC/B,aAAa;AACX,UAAO;;EAET,YAAY;AACV,UAAO;;EAET,SAAS;AACP,UAAO;;EAET,GAAG;EACJ;;;;ACtCH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,aAAa;EAClC,MAAM,EAAE,eAAe,WAAW,UAAU;AAQ5C,SAAO,CACL;GACE,GATS,cAAc,QAAQ;IACjC,MAAMA,kBAAAA,UAAU,OAAO,KAAK;IAC5B,SAAS;IACT,MAAM;IACN,WAAW,OAAO;IACnB,CAAC;GAKE,SAAS,CACP;IACE,MAAMA,kBAAAA,UAAU,OAAO,KAAK;IAC5B,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO,MAAM;IACpC,CACF;GACD,QAAQC,kBAAAA,UAAU;IAChB,KAAK,UAAU,QAAQ;IACvB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;IACvB,CAAC;GACF,QAAQC,kBAAAA,UAAU;IAAE,KAAK,UAAU,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GACjF,CACF;;CAEJ,CAAC"}
1
+ {"version":3,"file":"generators-vAAte6w6.cjs","names":["camelCase","getBanner","getFooter"],"sources":["../src/generators/createGenerator.ts","../src/generators/createReactGenerator.ts","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n version?: TVersion\n operations?: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n operation?: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n schema?: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n}\n\nexport type CoreGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n type: 'core'\n version: TVersion\n operations: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n operation: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n schema: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>\n}\n\nexport function createGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(\n generator: UserGenerator<TOptions, TVersion>,\n): CoreGenerator<TOptions, TVersion> {\n return {\n type: 'core',\n version: (generator.version ?? '1') as TVersion,\n async operations() {\n return []\n },\n async operation() {\n return []\n },\n async schema() {\n return []\n },\n ...generator,\n }\n}\n","import type { PluginFactoryOptions } from '@kubb/core'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport type { OperationProps, OperationsProps, SchemaProps, Version } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n version?: TVersion\n Operations?: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode\n Operation?: (props: OperationProps<TOptions, TVersion>) => FabricReactNode\n Schema?: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode\n}\n\nexport type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {\n name: string\n type: 'react'\n version: TVersion\n Operations: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode\n Operation: (props: OperationProps<TOptions, TVersion>) => FabricReactNode\n Schema: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode\n}\n\n/****\n * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.\n *\n * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.\n *\n * @returns A generator object with async methods for operations, operation, and schema file generation.\n */\nexport function createReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(\n generator: UserGenerator<TOptions, TVersion>,\n): ReactGenerator<TOptions, TVersion> {\n return {\n type: 'react',\n version: (generator.version ?? '1') as TVersion,\n Operations() {\n return null\n },\n Operation() {\n return null\n },\n Schema() {\n return null\n },\n ...generator,\n }\n}\n","import { camelCase } from '@internals/utils'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\nimport { createGenerator } from './createGenerator.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, generator }) {\n const { pluginManager, plugin } = generator.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginName: plugin.name,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: generator.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;AAqBA,SAAgB,gBACd,WACmC;AACnC,QAAO;EACL,MAAM;EACN,SAAU,UAAU,WAAW;EAC/B,MAAM,aAAa;AACjB,UAAO,EAAE;;EAEX,MAAM,YAAY;AAChB,UAAO,EAAE;;EAEX,MAAM,SAAS;AACb,UAAO,EAAE;;EAEX,GAAG;EACJ;;;;;;;;;;;ACTH,SAAgB,qBACd,WACoC;AACpC,QAAO;EACL,MAAM;EACN,SAAU,UAAU,WAAW;EAC/B,aAAa;AACX,UAAO;;EAET,YAAY;AACV,UAAO;;EAET,SAAS;AACP,UAAO;;EAET,GAAG;EACJ;;;;ACtCH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,aAAa;EAClC,MAAM,EAAE,eAAe,WAAW,UAAU;AAQ5C,SAAO,CACL;GACE,GATS,cAAc,QAAQ;IACjC,MAAMA,kBAAAA,UAAU,OAAO,KAAK;IAC5B,SAAS;IACT,MAAM;IACN,YAAY,OAAO;IACpB,CAAC;GAKE,SAAS,CACP;IACE,MAAMA,kBAAAA,UAAU,OAAO,KAAK;IAC5B,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO,MAAM;IACpC,CACF;GACD,QAAQC,kBAAAA,UAAU;IAChB,KAAK,UAAU,QAAQ;IACvB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;IACvB,CAAC;GACF,QAAQC,kBAAAA,UAAU;IAAE,KAAK,UAAU,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GACjF,CACF;;CAEJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_generators = require("./generators-CyWd3UXA.cjs");
2
+ const require_generators = require("./generators-vAAte6w6.cjs");
3
3
  exports.createGenerator = require_generators.createGenerator;
4
4
  exports.createReactGenerator = require_generators.createReactGenerator;
5
5
  exports.jsonGenerator = require_generators.jsonGenerator;
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { b as PluginOas, n as createGenerator, o as createReactGenerator, r as Generator, t as CoreGenerator } from "./createGenerator-CBXpHeVY.js";
2
+ import { b as PluginOas, n as createGenerator, o as createReactGenerator, r as Generator, t as CoreGenerator } from "./createGenerator-jtR_okrd.js";
3
3
  //#region src/generators/jsonGenerator.d.ts
4
4
  declare const jsonGenerator: CoreGenerator<PluginOas, "1">;
5
5
  //#endregion
@@ -1,2 +1,2 @@
1
- import { n as createReactGenerator, r as createGenerator, t as jsonGenerator } from "./generators-D7C3CXsN.js";
1
+ import { n as createReactGenerator, r as createGenerator, t as jsonGenerator } from "./generators-B8HiBWvT.js";
2
2
  export { createGenerator, createReactGenerator, jsonGenerator };
package/dist/hooks.cjs CHANGED
@@ -15,10 +15,10 @@ function useOas() {
15
15
  function useOperationManager(generator) {
16
16
  const plugin = (0, _kubb_core_hooks.usePlugin)();
17
17
  const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
18
- const getName = (operation, { prefix = "", suffix = "", pluginKey = plugin.key, type }) => {
18
+ const getName = (operation, { prefix = "", suffix = "", pluginName = plugin.name, type }) => {
19
19
  return pluginManager.resolveName({
20
20
  name: `${prefix} ${operation.getOperationId()} ${suffix}`,
21
- pluginKey,
21
+ pluginName,
22
22
  type
23
23
  });
24
24
  };
@@ -32,14 +32,14 @@ function useOperationManager(generator) {
32
32
  if (!generator) throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`);
33
33
  return generator.getSchemas(operation, { resolveName: (name) => pluginManager.resolveName({
34
34
  name,
35
- pluginKey: params?.pluginKey,
35
+ pluginName: params?.pluginName,
36
36
  type: params?.type
37
37
  }) });
38
38
  };
39
- const getFile = (operation, { prefix, suffix, pluginKey = plugin.key, extname = ".ts" } = {}) => {
39
+ const getFile = (operation, { prefix, suffix, pluginName = plugin.name, extname = ".ts" } = {}) => {
40
40
  const name = getName(operation, {
41
41
  type: "file",
42
- pluginKey,
42
+ pluginName,
43
43
  prefix,
44
44
  suffix
45
45
  });
@@ -47,10 +47,10 @@ function useOperationManager(generator) {
47
47
  const file = pluginManager.getFile({
48
48
  name,
49
49
  extname,
50
- pluginKey,
50
+ pluginName,
51
51
  options: {
52
52
  type: "file",
53
- pluginKey,
53
+ pluginName,
54
54
  group
55
55
  }
56
56
  });
@@ -59,19 +59,19 @@ function useOperationManager(generator) {
59
59
  meta: {
60
60
  ...file.meta,
61
61
  name,
62
- pluginKey,
62
+ pluginName,
63
63
  group
64
64
  }
65
65
  };
66
66
  };
67
- const groupSchemasByName = (operation, { pluginKey = plugin.key, type }) => {
67
+ const groupSchemasByName = (operation, { pluginName = plugin.name, type }) => {
68
68
  if (!generator) throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`);
69
69
  const schemas = generator.getSchemas(operation);
70
70
  const errors = (schemas.errors || []).reduce((prev, acc) => {
71
71
  if (!acc.statusCode) return prev;
72
72
  prev[acc.statusCode] = pluginManager.resolveName({
73
73
  name: acc.name,
74
- pluginKey,
74
+ pluginName,
75
75
  type
76
76
  });
77
77
  return prev;
@@ -80,7 +80,7 @@ function useOperationManager(generator) {
80
80
  if (!acc.statusCode) return prev;
81
81
  prev[acc.statusCode] = pluginManager.resolveName({
82
82
  name: acc.name,
83
- pluginKey,
83
+ pluginName,
84
84
  type
85
85
  });
86
86
  return prev;
@@ -88,23 +88,23 @@ function useOperationManager(generator) {
88
88
  return {
89
89
  request: schemas.request?.name ? pluginManager.resolveName({
90
90
  name: schemas.request.name,
91
- pluginKey,
91
+ pluginName,
92
92
  type
93
93
  }) : void 0,
94
94
  parameters: {
95
95
  path: schemas.pathParams?.name ? pluginManager.resolveName({
96
96
  name: schemas.pathParams.name,
97
- pluginKey,
97
+ pluginName,
98
98
  type
99
99
  }) : void 0,
100
100
  query: schemas.queryParams?.name ? pluginManager.resolveName({
101
101
  name: schemas.queryParams.name,
102
- pluginKey,
102
+ pluginName,
103
103
  type
104
104
  }) : void 0,
105
105
  header: schemas.headerParams?.name ? pluginManager.resolveName({
106
106
  name: schemas.headerParams.name,
107
- pluginKey,
107
+ pluginName,
108
108
  type
109
109
  }) : void 0
110
110
  },
@@ -112,7 +112,7 @@ function useOperationManager(generator) {
112
112
  ...responses,
113
113
  ["default"]: pluginManager.resolveName({
114
114
  name: schemas.response.name,
115
- pluginKey,
115
+ pluginName,
116
116
  type
117
117
  }),
118
118
  ...errors
@@ -129,55 +129,33 @@ function useOperationManager(generator) {
129
129
  };
130
130
  }
131
131
  //#endregion
132
- //#region src/hooks/useRootNode.ts
133
- /**
134
- * Returns the universal `@kubb/ast` `RootNode` produced by the configured adapter.
135
- *
136
- * Use this hook inside generator components when you want to consume the
137
- * format-agnostic AST directly instead of going through `useOas()`.
138
- *
139
- * Returns `undefined` when no adapter was configured (legacy OAS-only mode).
140
- *
141
- * @example
142
- * ```tsx
143
- * function MyComponent() {
144
- * const rootNode = useRootNode()
145
- * if (!rootNode) return null
146
- * return <>{rootNode.schemas.map(s => <Schema key={s.name} node={s} />)}</>
147
- * }
148
- * ```
149
- */
150
- function useRootNode() {
151
- const { meta } = (0, _kubb_react_fabric.useApp)();
152
- return meta.pluginManager?.rootNode;
153
- }
154
- //#endregion
155
132
  //#region src/hooks/useSchemaManager.ts
156
133
  /**
157
134
  * `useSchemaManager` returns helper functions to get the schema file and schema name.
135
+ * @deprecated
158
136
  */
159
137
  function useSchemaManager() {
160
138
  const plugin = (0, _kubb_core_hooks.usePlugin)();
161
139
  const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
162
- const getName = (name, { pluginKey = plugin.key, type }) => {
140
+ const getName = (name, { pluginName = plugin.name, type }) => {
163
141
  return pluginManager.resolveName({
164
142
  name,
165
- pluginKey,
143
+ pluginName,
166
144
  type
167
145
  });
168
146
  };
169
- const getFile = (name, { mode = "split", pluginKey = plugin.key, extname = ".ts", group } = {}) => {
147
+ const getFile = (name, { mode = "split", pluginName = plugin.name, extname = ".ts", group } = {}) => {
170
148
  const resolvedName = mode === "single" ? "" : getName(name, {
171
149
  type: "file",
172
- pluginKey
150
+ pluginName
173
151
  });
174
152
  const file = pluginManager.getFile({
175
153
  name: resolvedName,
176
154
  extname,
177
- pluginKey,
155
+ pluginName,
178
156
  options: {
179
157
  type: "file",
180
- pluginKey,
158
+ pluginName,
181
159
  group
182
160
  }
183
161
  });
@@ -186,7 +164,7 @@ function useSchemaManager() {
186
164
  meta: {
187
165
  ...file.meta,
188
166
  name: resolvedName,
189
- pluginKey
167
+ pluginName
190
168
  }
191
169
  };
192
170
  };
@@ -198,7 +176,6 @@ function useSchemaManager() {
198
176
  //#endregion
199
177
  exports.useOas = useOas;
200
178
  exports.useOperationManager = useOperationManager;
201
- exports.useRootNode = useRootNode;
202
179
  exports.useSchemaManager = useSchemaManager;
203
180
 
204
181
  //# sourceMappingURL=hooks.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.cjs","names":[],"sources":["../src/hooks/useOas.ts","../src/hooks/useOperationManager.ts","../src/hooks/useRootNode.ts","../src/hooks/useSchemaManager.ts"],"sourcesContent":["import type { Oas } from '@kubb/oas'\n\nimport { useApp } from '@kubb/react-fabric'\n\nexport function useOas(): Oas {\n const { meta } = useApp<{ oas: Oas }>()\n\n return meta.oas\n}\n","import type { FileMetaBase, Plugin, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'\nimport { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\nimport type { OperationGenerator } from '../OperationGenerator.ts'\nimport type { OperationSchemas } from '../types.ts'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\nexport type SchemaNames = {\n request: string | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype UseOperationManagerResult = {\n getName: (\n operation: OperationType,\n params: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => string\n getFile: (\n operation: OperationType,\n params?: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n groupSchemasByName: (\n operation: OperationType,\n params: {\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => SchemaNames\n getSchemas: (operation: Operation, params?: { pluginKey?: Plugin['key']; type?: ResolveNameParams['type'] }) => OperationSchemas\n getGroup: (operation: Operation) => FileMeta['group'] | undefined\n}\n\n/**\n * `useOperationManager` returns helper functions to get the operation file and operation name.\n */\nexport function useOperationManager<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions>(\n generator: Omit<OperationGenerator<TPluginOptions>, 'build'>,\n): UseOperationManagerResult {\n const plugin = usePlugin()\n const pluginManager = usePluginManager()\n\n const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name: `${prefix} ${operation.getOperationId()} ${suffix}`,\n pluginKey,\n type,\n })\n }\n\n const getGroup: UseOperationManagerResult['getGroup'] = (operation) => {\n return {\n tag: operation.getTags().at(0)?.name,\n path: operation.path,\n }\n }\n\n const getSchemas: UseOperationManagerResult['getSchemas'] = (operation, params) => {\n if (!generator) {\n throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`)\n }\n\n return generator.getSchemas(operation, {\n resolveName: (name) =>\n pluginManager.resolveName({\n name,\n pluginKey: params?.pluginKey,\n type: params?.type,\n }),\n })\n }\n\n const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix, pluginKey = plugin.key, extname = '.ts' } = {}) => {\n const name = getName(operation, { type: 'file', pluginKey, prefix, suffix })\n const group = getGroup(operation)\n\n const file = pluginManager.getFile({\n name,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name,\n pluginKey,\n group,\n },\n }\n }\n\n const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginKey = plugin.key, type }) => {\n if (!generator) {\n throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`)\n }\n\n const schemas = generator.getSchemas(operation)\n\n const errors = (schemas.errors || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n const responses = (schemas.responses || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n return {\n request: schemas.request?.name\n ? pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey,\n type,\n })\n : undefined,\n parameters: {\n path: schemas.pathParams?.name\n ? pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey,\n type,\n })\n : undefined,\n query: schemas.queryParams?.name\n ? pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey,\n type,\n })\n : undefined,\n header: schemas.headerParams?.name\n ? pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey,\n type,\n })\n : undefined,\n },\n responses: {\n ...responses,\n ['default']: pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey,\n type,\n }),\n ...errors,\n },\n errors,\n }\n }\n\n return {\n getName,\n getFile,\n getSchemas,\n groupSchemasByName,\n getGroup,\n }\n}\n","import type { RootNode } from '@kubb/ast/types'\nimport { useApp } from '@kubb/react-fabric'\n\n/**\n * Returns the universal `@kubb/ast` `RootNode` produced by the configured adapter.\n *\n * Use this hook inside generator components when you want to consume the\n * format-agnostic AST directly instead of going through `useOas()`.\n *\n * Returns `undefined` when no adapter was configured (legacy OAS-only mode).\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const rootNode = useRootNode()\n * if (!rootNode) return null\n * return <>{rootNode.schemas.map(s => <Schema key={s.name} node={s} />)}</>\n * }\n * ```\n */\nexport function useRootNode(): RootNode | undefined {\n const { meta } = useApp<{ pluginManager?: { rootNode?: RootNode } }>()\n\n return meta.pluginManager?.rootNode\n}\n","import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\ntype UseSchemaManagerResult = {\n getName: (name: string, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => string\n getFile: (\n name: string,\n params?: {\n pluginKey?: Plugin['key']\n mode?: KubbFile.Mode\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n}\n\n/**\n * `useSchemaManager` returns helper functions to get the schema file and schema name.\n */\nexport function useSchemaManager(): UseSchemaManagerResult {\n const plugin = usePlugin()\n const pluginManager = usePluginManager()\n\n const getName: UseSchemaManagerResult['getName'] = (name, { pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name,\n pluginKey,\n type,\n })\n }\n\n const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginKey = plugin.key, extname = '.ts', group } = {}) => {\n const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginKey })\n\n const file = pluginManager.getFile({\n name: resolvedName,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name: resolvedName,\n pluginKey,\n },\n }\n }\n\n return {\n getName,\n getFile,\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"hooks.cjs","names":[],"sources":["../src/hooks/useOas.ts","../src/hooks/useOperationManager.ts","../src/hooks/useSchemaManager.ts"],"sourcesContent":["import type { Oas } from '@kubb/oas'\n\nimport { useApp } from '@kubb/react-fabric'\n\nexport function useOas(): Oas {\n const { meta } = useApp<{ oas: Oas }>()\n\n return meta.oas\n}\n","import type { FileMetaBase, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'\nimport { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\nimport type { OperationGenerator } from '../OperationGenerator.ts'\nimport type { OperationSchemas } from '../types.ts'\n\ntype FileMeta = FileMetaBase & {\n pluginName: string\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\nexport type SchemaNames = {\n request: string | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype UseOperationManagerResult = {\n getName: (\n operation: OperationType,\n params: {\n prefix?: string\n suffix?: string\n pluginName?: string\n type: ResolveNameParams['type']\n },\n ) => string\n getFile: (\n operation: OperationType,\n params?: {\n prefix?: string\n suffix?: string\n pluginName?: string\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n groupSchemasByName: (\n operation: OperationType,\n params: {\n pluginName?: string\n type: ResolveNameParams['type']\n },\n ) => SchemaNames\n getSchemas: (operation: Operation, params?: { pluginName?: string; type?: ResolveNameParams['type'] }) => OperationSchemas\n getGroup: (operation: Operation) => FileMeta['group'] | undefined\n}\n\n/**\n * `useOperationManager` returns helper functions to get the operation file and operation name.\n */\nexport function useOperationManager<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions>(\n generator: Omit<OperationGenerator<TPluginOptions>, 'build'>,\n): UseOperationManagerResult {\n const plugin = usePlugin()\n const pluginManager = usePluginManager()\n\n const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginName = plugin.name, type }) => {\n return pluginManager.resolveName({\n name: `${prefix} ${operation.getOperationId()} ${suffix}`,\n pluginName,\n type,\n })\n }\n\n const getGroup: UseOperationManagerResult['getGroup'] = (operation) => {\n return {\n tag: operation.getTags().at(0)?.name,\n path: operation.path,\n }\n }\n\n const getSchemas: UseOperationManagerResult['getSchemas'] = (operation, params) => {\n if (!generator) {\n throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`)\n }\n\n return generator.getSchemas(operation, {\n resolveName: (name) =>\n pluginManager.resolveName({\n name,\n pluginName: params?.pluginName,\n type: params?.type,\n }),\n })\n }\n\n const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix, pluginName = plugin.name, extname = '.ts' } = {}) => {\n const name = getName(operation, { type: 'file', pluginName, prefix, suffix })\n const group = getGroup(operation)\n\n const file = pluginManager.getFile({\n name,\n extname,\n pluginName,\n options: { type: 'file', pluginName, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name,\n pluginName,\n group,\n },\n }\n }\n\n const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginName = plugin.name, type }) => {\n if (!generator) {\n throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`)\n }\n\n const schemas = generator.getSchemas(operation)\n\n const errors = (schemas.errors || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginName,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n const responses = (schemas.responses || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginName,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n return {\n request: schemas.request?.name\n ? pluginManager.resolveName({\n name: schemas.request.name,\n pluginName,\n type,\n })\n : undefined,\n parameters: {\n path: schemas.pathParams?.name\n ? pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginName,\n type,\n })\n : undefined,\n query: schemas.queryParams?.name\n ? pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginName,\n type,\n })\n : undefined,\n header: schemas.headerParams?.name\n ? pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginName,\n type,\n })\n : undefined,\n },\n responses: {\n ...responses,\n ['default']: pluginManager.resolveName({\n name: schemas.response.name,\n pluginName,\n type,\n }),\n ...errors,\n },\n errors,\n }\n }\n\n return {\n getName,\n getFile,\n getSchemas,\n groupSchemasByName,\n getGroup,\n }\n}\n","import type { FileMetaBase, ResolveNameParams } from '@kubb/core'\nimport { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\n\ntype FileMeta = FileMetaBase & {\n pluginName: string\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\ntype UseSchemaManagerResult = {\n getName: (name: string, params: { pluginName?: string; type: ResolveNameParams['type'] }) => string\n getFile: (\n name: string,\n params?: {\n pluginName?: string\n mode?: KubbFile.Mode\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n}\n\n/**\n * `useSchemaManager` returns helper functions to get the schema file and schema name.\n * @deprecated\n */\nexport function useSchemaManager(): UseSchemaManagerResult {\n const plugin = usePlugin()\n const pluginManager = usePluginManager()\n\n const getName: UseSchemaManagerResult['getName'] = (name, { pluginName = plugin.name, type }) => {\n return pluginManager.resolveName({\n name,\n pluginName,\n type,\n })\n }\n\n const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginName = plugin.name, extname = '.ts', group } = {}) => {\n const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginName })\n\n const file = pluginManager.getFile({\n name: resolvedName,\n extname,\n pluginName,\n options: { type: 'file', pluginName, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name: resolvedName,\n pluginName,\n },\n }\n }\n\n return {\n getName,\n getFile,\n }\n}\n"],"mappings":";;;;;AAIA,SAAgB,SAAc;CAC5B,MAAM,EAAE,UAAA,GAAA,mBAAA,SAA+B;AAEvC,QAAO,KAAK;;;;;;;ACyDd,SAAgB,oBACd,WAC2B;CAC3B,MAAM,UAAA,GAAA,iBAAA,YAAoB;CAC1B,MAAM,iBAAA,GAAA,iBAAA,mBAAkC;CAExC,MAAM,WAAiD,WAAW,EAAE,SAAS,IAAI,SAAS,IAAI,aAAa,OAAO,MAAM,WAAW;AACjI,SAAO,cAAc,YAAY;GAC/B,MAAM,GAAG,OAAO,GAAG,UAAU,gBAAgB,CAAC,GAAG;GACjD;GACA;GACD,CAAC;;CAGJ,MAAM,YAAmD,cAAc;AACrE,SAAO;GACL,KAAK,UAAU,SAAS,CAAC,GAAG,EAAE,EAAE;GAChC,MAAM,UAAU;GACjB;;CAGH,MAAM,cAAuD,WAAW,WAAW;AACjF,MAAI,CAAC,UACH,OAAM,IAAI,MAAM,8EAA8E;AAGhG,SAAO,UAAU,WAAW,WAAW,EACrC,cAAc,SACZ,cAAc,YAAY;GACxB;GACA,YAAY,QAAQ;GACpB,MAAM,QAAQ;GACf,CAAC,EACL,CAAC;;CAGJ,MAAM,WAAiD,WAAW,EAAE,QAAQ,QAAQ,aAAa,OAAO,MAAM,UAAU,UAAU,EAAE,KAAK;EACvI,MAAM,OAAO,QAAQ,WAAW;GAAE,MAAM;GAAQ;GAAY;GAAQ;GAAQ,CAAC;EAC7E,MAAM,QAAQ,SAAS,UAAU;EAEjC,MAAM,OAAO,cAAc,QAAQ;GACjC;GACA;GACA;GACA,SAAS;IAAE,MAAM;IAAQ;IAAY;IAAO;GAC7C,CAAC;AAEF,SAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG,KAAK;IACR;IACA;IACA;IACD;GACF;;CAGH,MAAM,sBAAuE,WAAW,EAAE,aAAa,OAAO,MAAM,WAAW;AAC7H,MAAI,CAAC,UACH,OAAM,IAAI,MAAM,8EAA8E;EAGhG,MAAM,UAAU,UAAU,WAAW,UAAU;EAE/C,MAAM,UAAU,QAAQ,UAAU,EAAE,EAAE,QACnC,MAAM,QAAQ;AACb,OAAI,CAAC,IAAI,WACP,QAAO;AAGT,QAAK,IAAI,cAAc,cAAc,YAAY;IAC/C,MAAM,IAAI;IACV;IACA;IACD,CAAC;AAEF,UAAO;KAET,EAAE,CACH;EAED,MAAM,aAAa,QAAQ,aAAa,EAAE,EAAE,QACzC,MAAM,QAAQ;AACb,OAAI,CAAC,IAAI,WACP,QAAO;AAGT,QAAK,IAAI,cAAc,cAAc,YAAY;IAC/C,MAAM,IAAI;IACV;IACA;IACD,CAAC;AAEF,UAAO;KAET,EAAE,CACH;AAED,SAAO;GACL,SAAS,QAAQ,SAAS,OACtB,cAAc,YAAY;IACxB,MAAM,QAAQ,QAAQ;IACtB;IACA;IACD,CAAC,GACF,KAAA;GACJ,YAAY;IACV,MAAM,QAAQ,YAAY,OACtB,cAAc,YAAY;KACxB,MAAM,QAAQ,WAAW;KACzB;KACA;KACD,CAAC,GACF,KAAA;IACJ,OAAO,QAAQ,aAAa,OACxB,cAAc,YAAY;KACxB,MAAM,QAAQ,YAAY;KAC1B;KACA;KACD,CAAC,GACF,KAAA;IACJ,QAAQ,QAAQ,cAAc,OAC1B,cAAc,YAAY;KACxB,MAAM,QAAQ,aAAa;KAC3B;KACA;KACD,CAAC,GACF,KAAA;IACL;GACD,WAAW;IACT,GAAG;KACF,YAAY,cAAc,YAAY;KACrC,MAAM,QAAQ,SAAS;KACvB;KACA;KACD,CAAC;IACF,GAAG;IACJ;GACD;GACD;;AAGH,QAAO;EACL;EACA;EACA;EACA;EACA;EACD;;;;;;;;ACpLH,SAAgB,mBAA2C;CACzD,MAAM,UAAA,GAAA,iBAAA,YAAoB;CAC1B,MAAM,iBAAA,GAAA,iBAAA,mBAAkC;CAExC,MAAM,WAA8C,MAAM,EAAE,aAAa,OAAO,MAAM,WAAW;AAC/F,SAAO,cAAc,YAAY;GAC/B;GACA;GACA;GACD,CAAC;;CAGJ,MAAM,WAA8C,MAAM,EAAE,OAAO,SAAS,aAAa,OAAO,MAAM,UAAU,OAAO,UAAU,EAAE,KAAK;EACtI,MAAM,eAAe,SAAS,WAAW,KAAK,QAAQ,MAAM;GAAE,MAAM;GAAQ;GAAY,CAAC;EAEzF,MAAM,OAAO,cAAc,QAAQ;GACjC,MAAM;GACN;GACA;GACA,SAAS;IAAE,MAAM;IAAQ;IAAY;IAAO;GAC7C,CAAC;AAEF,SAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG,KAAK;IACR,MAAM;IACN;IACD;GACF;;AAGH,QAAO;EACL;EACA;EACD"}
package/dist/hooks.d.ts CHANGED
@@ -1,16 +1,15 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { _ as OperationSchemas, f as OperationGenerator } from "./createGenerator-CBXpHeVY.js";
2
+ import { _ as OperationSchemas, f as OperationGenerator } from "./createGenerator-jtR_okrd.js";
3
3
  import { Oas, Operation } from "@kubb/oas";
4
- import { FileMetaBase, Plugin, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
4
+ import { FileMetaBase, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
5
5
  import { KubbFile } from "@kubb/fabric-core/types";
6
- import { RootNode } from "@kubb/ast/types";
7
6
 
8
7
  //#region src/hooks/useOas.d.ts
9
8
  declare function useOas(): Oas;
10
9
  //#endregion
11
10
  //#region src/hooks/useOperationManager.d.ts
12
11
  type FileMeta$1 = FileMetaBase & {
13
- pluginKey: Plugin['key'];
12
+ pluginName: string;
14
13
  name: string;
15
14
  group?: {
16
15
  tag?: string;
@@ -33,13 +32,13 @@ type UseOperationManagerResult = {
33
32
  getName: (operation: Operation, params: {
34
33
  prefix?: string;
35
34
  suffix?: string;
36
- pluginKey?: Plugin['key'];
35
+ pluginName?: string;
37
36
  type: ResolveNameParams['type'];
38
37
  }) => string;
39
38
  getFile: (operation: Operation, params?: {
40
39
  prefix?: string;
41
40
  suffix?: string;
42
- pluginKey?: Plugin['key'];
41
+ pluginName?: string;
43
42
  extname?: KubbFile.Extname;
44
43
  group?: {
45
44
  tag?: string;
@@ -47,11 +46,11 @@ type UseOperationManagerResult = {
47
46
  };
48
47
  }) => KubbFile.File<FileMeta$1>;
49
48
  groupSchemasByName: (operation: Operation, params: {
50
- pluginKey?: Plugin['key'];
49
+ pluginName?: string;
51
50
  type: ResolveNameParams['type'];
52
51
  }) => SchemaNames;
53
52
  getSchemas: (operation: Operation, params?: {
54
- pluginKey?: Plugin['key'];
53
+ pluginName?: string;
55
54
  type?: ResolveNameParams['type'];
56
55
  }) => OperationSchemas;
57
56
  getGroup: (operation: Operation) => FileMeta$1['group'] | undefined;
@@ -61,29 +60,9 @@ type UseOperationManagerResult = {
61
60
  */
62
61
  declare function useOperationManager<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions>(generator: Omit<OperationGenerator<TPluginOptions>, 'build'>): UseOperationManagerResult;
63
62
  //#endregion
64
- //#region src/hooks/useRootNode.d.ts
65
- /**
66
- * Returns the universal `@kubb/ast` `RootNode` produced by the configured adapter.
67
- *
68
- * Use this hook inside generator components when you want to consume the
69
- * format-agnostic AST directly instead of going through `useOas()`.
70
- *
71
- * Returns `undefined` when no adapter was configured (legacy OAS-only mode).
72
- *
73
- * @example
74
- * ```tsx
75
- * function MyComponent() {
76
- * const rootNode = useRootNode()
77
- * if (!rootNode) return null
78
- * return <>{rootNode.schemas.map(s => <Schema key={s.name} node={s} />)}</>
79
- * }
80
- * ```
81
- */
82
- declare function useRootNode(): RootNode | undefined;
83
- //#endregion
84
63
  //#region src/hooks/useSchemaManager.d.ts
85
64
  type FileMeta = FileMetaBase & {
86
- pluginKey: Plugin['key'];
65
+ pluginName: string;
87
66
  name: string;
88
67
  group?: {
89
68
  tag?: string;
@@ -92,11 +71,11 @@ type FileMeta = FileMetaBase & {
92
71
  };
93
72
  type UseSchemaManagerResult = {
94
73
  getName: (name: string, params: {
95
- pluginKey?: Plugin['key'];
74
+ pluginName?: string;
96
75
  type: ResolveNameParams['type'];
97
76
  }) => string;
98
77
  getFile: (name: string, params?: {
99
- pluginKey?: Plugin['key'];
78
+ pluginName?: string;
100
79
  mode?: KubbFile.Mode;
101
80
  extname?: KubbFile.Extname;
102
81
  group?: {
@@ -107,8 +86,9 @@ type UseSchemaManagerResult = {
107
86
  };
108
87
  /**
109
88
  * `useSchemaManager` returns helper functions to get the schema file and schema name.
89
+ * @deprecated
110
90
  */
111
91
  declare function useSchemaManager(): UseSchemaManagerResult;
112
92
  //#endregion
113
- export { type SchemaNames, useOas, useOperationManager, useRootNode, useSchemaManager };
93
+ export { type SchemaNames, useOas, useOperationManager, useSchemaManager };
114
94
  //# sourceMappingURL=hooks.d.ts.map