@kubb/core 3.0.0-alpha.30 → 3.0.0-alpha.31

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.
@@ -321,7 +321,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
321
321
  * @type hookFirst
322
322
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
323
323
  */
324
- resolvePath?: (this: PluginContext<TOptions>, baseName: string, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
324
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
325
325
  /**
326
326
  * Resolve to a name based on a string.
327
327
  * Useful when converting to PascalCase or camelCase.
@@ -339,7 +339,7 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
339
339
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
340
340
  type ResolvePathParams<TOptions = object> = {
341
341
  pluginKey?: Plugin['key'];
342
- baseName: string;
342
+ baseName: KubbFile.BaseName;
343
343
  mode?: KubbFile.Mode;
344
344
  /**
345
345
  * Options to be passed to 'resolvePath' 3th parameter
@@ -392,6 +392,22 @@ type Output = {
392
392
  */
393
393
  footer?: string;
394
394
  };
395
+ type GroupContext = {
396
+ group: string;
397
+ };
398
+ type Group = {
399
+ /**
400
+ * Tag will group based on the operation tag inside the Swagger file
401
+ */
402
+ type: 'tag';
403
+ /**
404
+ * Relative path to save the grouped clients.
405
+ *
406
+ * @example `${output}/{{tag}}Controller` => `clients/PetController`
407
+ * @default `({ group }) => `${group}Controller``
408
+ */
409
+ name?: (context: GroupContext) => string;
410
+ };
395
411
 
396
412
  type BarrelData = {
397
413
  file?: KubbFile.File;
@@ -472,4 +488,4 @@ type GetSourceOptions = {
472
488
  };
473
489
  declare function getSource<TMeta extends FileMetaBase = FileMetaBase>(file: ResolvedFile<TMeta>, { logger, extname }?: GetSourceOptions): Promise<string>;
474
490
 
475
- export { type BarrelType as B, type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type Output as O, type PluginContext as P, type ResolvePathParams as R, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, getSource as g, type UserPlugin as h, type Plugin as i, type PluginWithLifeCycle as j, type PluginLifecycle as k, type PluginLifecycleHooks as l, type PluginParameter as m, type ResolveNameParams as n };
491
+ export { type BarrelType as B, type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type Output as O, type PluginContext as P, type ResolvePathParams as R, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, getSource as g, type UserPlugin as h, type Plugin as i, type PluginWithLifeCycle as j, type PluginLifecycle as k, type PluginLifecycleHooks as l, type PluginParameter as m, type ResolveNameParams as n, type Group as o };
@@ -321,7 +321,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
321
321
  * @type hookFirst
322
322
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
323
323
  */
324
- resolvePath?: (this: PluginContext<TOptions>, baseName: string, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
324
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
325
325
  /**
326
326
  * Resolve to a name based on a string.
327
327
  * Useful when converting to PascalCase or camelCase.
@@ -339,7 +339,7 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
339
339
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
340
340
  type ResolvePathParams<TOptions = object> = {
341
341
  pluginKey?: Plugin['key'];
342
- baseName: string;
342
+ baseName: KubbFile.BaseName;
343
343
  mode?: KubbFile.Mode;
344
344
  /**
345
345
  * Options to be passed to 'resolvePath' 3th parameter
@@ -392,6 +392,22 @@ type Output = {
392
392
  */
393
393
  footer?: string;
394
394
  };
395
+ type GroupContext = {
396
+ group: string;
397
+ };
398
+ type Group = {
399
+ /**
400
+ * Tag will group based on the operation tag inside the Swagger file
401
+ */
402
+ type: 'tag';
403
+ /**
404
+ * Relative path to save the grouped clients.
405
+ *
406
+ * @example `${output}/{{tag}}Controller` => `clients/PetController`
407
+ * @default `({ group }) => `${group}Controller``
408
+ */
409
+ name?: (context: GroupContext) => string;
410
+ };
395
411
 
396
412
  type BarrelData = {
397
413
  file?: KubbFile.File;
@@ -472,4 +488,4 @@ type GetSourceOptions = {
472
488
  };
473
489
  declare function getSource<TMeta extends FileMetaBase = FileMetaBase>(file: ResolvedFile<TMeta>, { logger, extname }?: GetSourceOptions): Promise<string>;
474
490
 
475
- export { type BarrelType as B, type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type Output as O, type PluginContext as P, type ResolvePathParams as R, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, getSource as g, type UserPlugin as h, type Plugin as i, type PluginWithLifeCycle as j, type PluginLifecycle as k, type PluginLifecycleHooks as l, type PluginParameter as m, type ResolveNameParams as n };
491
+ export { type BarrelType as B, type Config as C, FileManager as F, type GetPluginFactoryOptions as G, type InputPath as I, type Output as O, type PluginContext as P, type ResolvePathParams as R, type UserConfig as U, PluginManager as a, type PluginFactoryOptions as b, type UserPluginWithLifeCycle as c, type FileMetaBase as d, type InputData as e, type PluginKey as f, getSource as g, type UserPlugin as h, type Plugin as i, type PluginWithLifeCycle as j, type PluginLifecycle as k, type PluginLifecycleHooks as l, type PluginParameter as m, type ResolveNameParams as n, type Group as o };
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PluginContext, F as FileManager, a as PluginManager, U as UserConfig, C as Config, I as InputPath, b as PluginFactoryOptions, c as UserPluginWithLifeCycle } from './FileManager-CqvmdzNO.cjs';
2
- export { B as BarrelType, d as FileMetaBase, G as GetPluginFactoryOptions, e as InputData, O as Output, i as Plugin, f as PluginKey, k as PluginLifecycle, l as PluginLifecycleHooks, m as PluginParameter, j as PluginWithLifeCycle, n as ResolveNameParams, R as ResolvePathParams, h as UserPlugin, g as getSource } from './FileManager-CqvmdzNO.cjs';
1
+ import { P as PluginContext, F as FileManager, a as PluginManager, U as UserConfig, C as Config, I as InputPath, b as PluginFactoryOptions, c as UserPluginWithLifeCycle } from './FileManager-U5yCmg00.cjs';
2
+ export { B as BarrelType, d as FileMetaBase, G as GetPluginFactoryOptions, o as Group, e as InputData, O as Output, i as Plugin, f as PluginKey, k as PluginLifecycle, l as PluginLifecycleHooks, m as PluginParameter, j as PluginWithLifeCycle, n as ResolveNameParams, R as ResolvePathParams, h as UserPlugin, g as getSource } from './FileManager-U5yCmg00.cjs';
3
3
  import { L as Logger } from './logger-DvbHXjIO.cjs';
4
4
  import { PossiblePromise } from '@kubb/types';
5
5
  import '@kubb/fs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PluginContext, F as FileManager, a as PluginManager, U as UserConfig, C as Config, I as InputPath, b as PluginFactoryOptions, c as UserPluginWithLifeCycle } from './FileManager-DIArE3b0.js';
2
- export { B as BarrelType, d as FileMetaBase, G as GetPluginFactoryOptions, e as InputData, O as Output, i as Plugin, f as PluginKey, k as PluginLifecycle, l as PluginLifecycleHooks, m as PluginParameter, j as PluginWithLifeCycle, n as ResolveNameParams, R as ResolvePathParams, h as UserPlugin, g as getSource } from './FileManager-DIArE3b0.js';
1
+ import { P as PluginContext, F as FileManager, a as PluginManager, U as UserConfig, C as Config, I as InputPath, b as PluginFactoryOptions, c as UserPluginWithLifeCycle } from './FileManager-Dnafk2I5.js';
2
+ export { B as BarrelType, d as FileMetaBase, G as GetPluginFactoryOptions, o as Group, e as InputData, O as Output, i as Plugin, f as PluginKey, k as PluginLifecycle, l as PluginLifecycleHooks, m as PluginParameter, j as PluginWithLifeCycle, n as ResolveNameParams, R as ResolvePathParams, h as UserPlugin, g as getSource } from './FileManager-Dnafk2I5.js';
3
3
  import { L as Logger } from './logger-DvbHXjIO.js';
4
4
  import { PossiblePromise } from '@kubb/types';
5
5
  import '@kubb/fs';
package/dist/mocks.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ResolvedFile, File } from '@kubb/fs/types';
2
- import { a as PluginManager } from './FileManager-CqvmdzNO.cjs';
2
+ import { a as PluginManager } from './FileManager-U5yCmg00.cjs';
3
3
  import { L as Logger } from './logger-DvbHXjIO.cjs';
4
4
  import '@kubb/fs';
5
5
  import '@kubb/types';
package/dist/mocks.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ResolvedFile, File } from '@kubb/fs/types';
2
- import { a as PluginManager } from './FileManager-DIArE3b0.js';
2
+ import { a as PluginManager } from './FileManager-Dnafk2I5.js';
3
3
  import { L as Logger } from './logger-DvbHXjIO.js';
4
4
  import '@kubb/fs';
5
5
  import '@kubb/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/core",
3
- "version": "3.0.0-alpha.30",
3
+ "version": "3.0.0-alpha.31",
4
4
  "description": "Generator core",
5
5
  "keywords": [
6
6
  "typescript",
@@ -83,9 +83,9 @@
83
83
  "remeda": "^2.14.0",
84
84
  "seedrandom": "^3.0.5",
85
85
  "semver": "^7.6.3",
86
- "@kubb/fs": "3.0.0-alpha.30",
87
- "@kubb/parser-ts": "3.0.0-alpha.30",
88
- "@kubb/types": "3.0.0-alpha.30"
86
+ "@kubb/fs": "3.0.0-alpha.31",
87
+ "@kubb/parser-ts": "3.0.0-alpha.31",
88
+ "@kubb/types": "3.0.0-alpha.31"
89
89
  },
90
90
  "devDependencies": {
91
91
  "@types/object-hash": "^3.0.6",
@@ -96,8 +96,8 @@
96
96
  "tinyrainbow": "^1.2.0",
97
97
  "tsup": "^8.3.0",
98
98
  "typescript": "^5.6.2",
99
- "@kubb/config-ts": "3.0.0-alpha.30",
100
- "@kubb/config-tsup": "3.0.0-alpha.30"
99
+ "@kubb/config-ts": "3.0.0-alpha.31",
100
+ "@kubb/config-tsup": "3.0.0-alpha.31"
101
101
  },
102
102
  "engines": {
103
103
  "node": ">=20"
package/src/types.ts CHANGED
@@ -229,7 +229,12 @@ export type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactor
229
229
  * @type hookFirst
230
230
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
231
231
  */
232
- resolvePath?: (this: PluginContext<TOptions>, baseName: string, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath
232
+ resolvePath?: (
233
+ this: PluginContext<TOptions>,
234
+ baseName: KubbFile.BaseName,
235
+ mode?: KubbFile.Mode,
236
+ options?: TOptions['resolvePathOptions'],
237
+ ) => KubbFile.OptionalPath
233
238
  /**
234
239
  * Resolve to a name based on a string.
235
240
  * Useful when converting to PascalCase or camelCase.
@@ -250,7 +255,7 @@ export type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Require
250
255
 
251
256
  export type ResolvePathParams<TOptions = object> = {
252
257
  pluginKey?: Plugin['key']
253
- baseName: string
258
+ baseName: KubbFile.BaseName
254
259
  mode?: KubbFile.Mode
255
260
  /**
256
261
  * Options to be passed to 'resolvePath' 3th parameter
@@ -306,3 +311,21 @@ export type Output = {
306
311
  */
307
312
  footer?: string
308
313
  }
314
+
315
+ type GroupContext = {
316
+ group: string
317
+ }
318
+
319
+ export type Group = {
320
+ /**
321
+ * Tag will group based on the operation tag inside the Swagger file
322
+ */
323
+ type: 'tag'
324
+ /**
325
+ * Relative path to save the grouped clients.
326
+ *
327
+ * @example `${output}/{{tag}}Controller` => `clients/PetController`
328
+ * @default `({ group }) => `${group}Controller``
329
+ */
330
+ name?: (context: GroupContext) => string
331
+ }