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

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 (61) hide show
  1. package/dist/{SchemaMapper-SneuY1wg.d.ts → SchemaMapper-CLIXrzqv.d.ts} +3 -3
  2. package/dist/SchemaMapper-CeavHZlp.cjs.map +1 -1
  3. package/dist/SchemaMapper-CqMkO2T1.js.map +1 -1
  4. package/dist/{createGenerator-jtR_okrd.d.ts → createGenerator-DL3CAvaU.d.ts} +121 -70
  5. package/dist/{generators-vAAte6w6.cjs → generators-85sP4GIS.cjs} +7 -7
  6. package/dist/generators-85sP4GIS.cjs.map +1 -0
  7. package/dist/{generators-B8HiBWvT.js → generators-hPE06pZB.js} +7 -7
  8. package/dist/generators-hPE06pZB.js.map +1 -0
  9. package/dist/generators.cjs +1 -1
  10. package/dist/generators.d.ts +4 -3
  11. package/dist/generators.js +1 -1
  12. package/dist/{getFooter-Pw3tLCiV.js → getFooter-Dz4u5Mg4.js} +5 -2
  13. package/dist/getFooter-Dz4u5Mg4.js.map +1 -0
  14. package/dist/{getFooter-BBzsC616.cjs → getFooter-gshcRE1-.cjs} +5 -2
  15. package/dist/getFooter-gshcRE1-.cjs.map +1 -0
  16. package/dist/hooks.cjs +25 -21
  17. package/dist/hooks.cjs.map +1 -1
  18. package/dist/hooks.d.ts +10 -7
  19. package/dist/hooks.js +27 -23
  20. package/dist/hooks.js.map +1 -1
  21. package/dist/index.cjs +50 -45
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.ts +26 -52
  24. package/dist/index.js +49 -44
  25. package/dist/index.js.map +1 -1
  26. package/dist/mocks.d.ts +1 -1
  27. package/dist/{requestBody-BJJL0mpy.cjs → requestBody-94hwM4b-.cjs} +115 -304
  28. package/dist/requestBody-94hwM4b-.cjs.map +1 -0
  29. package/dist/{requestBody-CSL-jLGQ.js → requestBody-BO3N7fWH.js} +107 -290
  30. package/dist/requestBody-BO3N7fWH.js.map +1 -0
  31. package/dist/utils.cjs +61 -11
  32. package/dist/utils.cjs.map +1 -1
  33. package/dist/utils.d.ts +4 -4
  34. package/dist/utils.js +61 -11
  35. package/dist/utils.js.map +1 -1
  36. package/package.json +8 -12
  37. package/src/OperationGenerator.ts +72 -86
  38. package/src/SchemaGenerator.ts +61 -82
  39. package/src/SchemaMapper.ts +2 -2
  40. package/src/generators/createGenerator.ts +13 -16
  41. package/src/generators/createReactGenerator.ts +12 -15
  42. package/src/generators/index.ts +2 -2
  43. package/src/generators/jsonGenerator.ts +3 -3
  44. package/src/generators/types.ts +5 -43
  45. package/src/hooks/useOas.ts +5 -2
  46. package/src/hooks/useOperationManager.ts +22 -21
  47. package/src/hooks/useSchemaManager.ts +8 -8
  48. package/src/index.ts +2 -2
  49. package/src/plugin.ts +13 -9
  50. package/src/types.ts +15 -8
  51. package/src/utils/getBanner.ts +1 -1
  52. package/src/utils/getFooter.ts +1 -1
  53. package/src/utils/getImports.ts +3 -3
  54. package/src/utils/getParams.ts +2 -2
  55. package/src/utils.tsx +51 -151
  56. package/dist/generators-B8HiBWvT.js.map +0 -1
  57. package/dist/generators-vAAte6w6.cjs.map +0 -1
  58. package/dist/getFooter-BBzsC616.cjs.map +0 -1
  59. package/dist/getFooter-Pw3tLCiV.js.map +0 -1
  60. package/dist/requestBody-BJJL0mpy.cjs.map +0 -1
  61. package/dist/requestBody-CSL-jLGQ.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
2
  import { SchemaObject } from "@kubb/oas";
3
- import { KubbFile } from "@kubb/fabric-core/types";
3
+ import { FabricFile } from "@kubb/fabric-core/types";
4
4
 
5
5
  //#region src/SchemaMapper.d.ts
6
6
  type SchemaKeywordMapper = {
@@ -116,7 +116,7 @@ type SchemaKeywordMapper = {
116
116
  /**
117
117
  * Full qualified path.
118
118
  */
119
- path: KubbFile.Path;
119
+ path: FabricFile.Path;
120
120
  /**
121
121
  * When true `File.Import` is used.
122
122
  * When false a reference is used inside the current file.
@@ -290,4 +290,4 @@ type SchemaTree = {
290
290
  declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
291
291
  //#endregion
292
292
  export { SchemaMapper as a, schemaKeywords as c, SchemaKeywordMapper as i, SchemaKeyword as n, SchemaTree as o, SchemaKeywordBase as r, isKeyword as s, Schema as t };
293
- //# sourceMappingURL=SchemaMapper-SneuY1wg.d.ts.map
293
+ //# sourceMappingURL=SchemaMapper-CLIXrzqv.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaMapper-CeavHZlp.cjs","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport type { SchemaObject } from '@kubb/oas'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n patternProperties?: Record<string, Schema[]>\n strict?: boolean\n }\n }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n writeOnly: { keyword: 'writeOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number; rest?: Schema } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number; unique?: boolean }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: {\n name: string\n $ref: string\n /**\n * Full qualified path.\n */\n path: KubbFile.Path\n /**\n * When true `File.Import` is used.\n * When false a reference is used inside the current file.\n */\n isImportable: boolean\n }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n bigint: { keyword: 'bigint' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n exclusiveMaximum: { keyword: 'exclusiveMaximum'; args: number }\n exclusiveMinimum: { keyword: 'exclusiveMinimum'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n void: { keyword: 'void' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n interface: { keyword: 'interface' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n bigint: 'bigint',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n void: 'void',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n exclusiveMinimum: 'exclusiveMinimum',\n exclusiveMaximum: 'exclusiveMaximum',\n optional: 'optional',\n readOnly: 'readOnly',\n writeOnly: 'writeOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n interface: 'interface',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport type SchemaTree = {\n schema: SchemaObject\n parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this is equal to the key of a property(object)\n */\n name?: string\n}\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n"],"mappings":";;AAkGA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,WAAW;CACX,UAAU;CACV,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;CACN,OAAO;CACP,MAAM;CACN,KAAK;CACL,MAAM;CAEN,SAAS;CACT,OAAO;CACP,KAAK;CACL,UAAU;CACV,KAAK;CACL,KAAK;CACL,kBAAkB;CAClB,kBAAkB;CAClB,UAAU;CACV,UAAU;CACV,WAAW;CAGX,QAAQ;CACR,KAAK;CACL,SAAS;CACT,WAAW;CACX,UAAU;CACV,UAAU;CACV,OAAO;CACP,MAAM;CACN,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACN,MAAM;CACN,WAAW;CACZ;AA4BD,SAAgB,UAAiE,MAAS,SAAwD;AAChJ,QAAO,KAAK,YAAY"}
1
+ {"version":3,"file":"SchemaMapper-CeavHZlp.cjs","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { FabricFile } from '@kubb/fabric-core/types'\nimport type { SchemaObject } from '@kubb/oas'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n patternProperties?: Record<string, Schema[]>\n strict?: boolean\n }\n }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n writeOnly: { keyword: 'writeOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number; rest?: Schema } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number; unique?: boolean }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: {\n name: string\n $ref: string\n /**\n * Full qualified path.\n */\n path: FabricFile.Path\n /**\n * When true `File.Import` is used.\n * When false a reference is used inside the current file.\n */\n isImportable: boolean\n }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n bigint: { keyword: 'bigint' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n exclusiveMaximum: { keyword: 'exclusiveMaximum'; args: number }\n exclusiveMinimum: { keyword: 'exclusiveMinimum'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n void: { keyword: 'void' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n interface: { keyword: 'interface' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n bigint: 'bigint',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n void: 'void',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n exclusiveMinimum: 'exclusiveMinimum',\n exclusiveMaximum: 'exclusiveMaximum',\n optional: 'optional',\n readOnly: 'readOnly',\n writeOnly: 'writeOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n interface: 'interface',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport type SchemaTree = {\n schema: SchemaObject\n parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this is equal to the key of a property(object)\n */\n name?: string\n}\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n"],"mappings":";;AAkGA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,WAAW;CACX,UAAU;CACV,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;CACN,OAAO;CACP,MAAM;CACN,KAAK;CACL,MAAM;CAEN,SAAS;CACT,OAAO;CACP,KAAK;CACL,UAAU;CACV,KAAK;CACL,KAAK;CACL,kBAAkB;CAClB,kBAAkB;CAClB,UAAU;CACV,UAAU;CACV,WAAW;CAGX,QAAQ;CACR,KAAK;CACL,SAAS;CACT,WAAW;CACX,UAAU;CACV,UAAU;CACV,OAAO;CACP,MAAM;CACN,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACN,MAAM;CACN,WAAW;CACZ;AA4BD,SAAgB,UAAiE,MAAS,SAAwD;AAChJ,QAAO,KAAK,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaMapper-CqMkO2T1.js","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport type { SchemaObject } from '@kubb/oas'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n patternProperties?: Record<string, Schema[]>\n strict?: boolean\n }\n }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n writeOnly: { keyword: 'writeOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number; rest?: Schema } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number; unique?: boolean }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: {\n name: string\n $ref: string\n /**\n * Full qualified path.\n */\n path: KubbFile.Path\n /**\n * When true `File.Import` is used.\n * When false a reference is used inside the current file.\n */\n isImportable: boolean\n }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n bigint: { keyword: 'bigint' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n exclusiveMaximum: { keyword: 'exclusiveMaximum'; args: number }\n exclusiveMinimum: { keyword: 'exclusiveMinimum'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n void: { keyword: 'void' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n interface: { keyword: 'interface' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n bigint: 'bigint',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n void: 'void',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n exclusiveMinimum: 'exclusiveMinimum',\n exclusiveMaximum: 'exclusiveMaximum',\n optional: 'optional',\n readOnly: 'readOnly',\n writeOnly: 'writeOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n interface: 'interface',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport type SchemaTree = {\n schema: SchemaObject\n parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this is equal to the key of a property(object)\n */\n name?: string\n}\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n"],"mappings":";;AAkGA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,WAAW;CACX,UAAU;CACV,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;CACN,OAAO;CACP,MAAM;CACN,KAAK;CACL,MAAM;CAEN,SAAS;CACT,OAAO;CACP,KAAK;CACL,UAAU;CACV,KAAK;CACL,KAAK;CACL,kBAAkB;CAClB,kBAAkB;CAClB,UAAU;CACV,UAAU;CACV,WAAW;CAGX,QAAQ;CACR,KAAK;CACL,SAAS;CACT,WAAW;CACX,UAAU;CACV,UAAU;CACV,OAAO;CACP,MAAM;CACN,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACN,MAAM;CACN,WAAW;CACZ;AA4BD,SAAgB,UAAiE,MAAS,SAAwD;AAChJ,QAAO,KAAK,YAAY"}
1
+ {"version":3,"file":"SchemaMapper-CqMkO2T1.js","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { FabricFile } from '@kubb/fabric-core/types'\nimport type { SchemaObject } from '@kubb/oas'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n patternProperties?: Record<string, Schema[]>\n strict?: boolean\n }\n }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n writeOnly: { keyword: 'writeOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number; rest?: Schema } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number; unique?: boolean }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: {\n name: string\n $ref: string\n /**\n * Full qualified path.\n */\n path: FabricFile.Path\n /**\n * When true `File.Import` is used.\n * When false a reference is used inside the current file.\n */\n isImportable: boolean\n }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n bigint: { keyword: 'bigint' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n exclusiveMaximum: { keyword: 'exclusiveMaximum'; args: number }\n exclusiveMinimum: { keyword: 'exclusiveMinimum'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n void: { keyword: 'void' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n interface: { keyword: 'interface' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n bigint: 'bigint',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n void: 'void',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n exclusiveMinimum: 'exclusiveMinimum',\n exclusiveMaximum: 'exclusiveMaximum',\n optional: 'optional',\n readOnly: 'readOnly',\n writeOnly: 'writeOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n interface: 'interface',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport type SchemaTree = {\n schema: SchemaObject\n parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this is equal to the key of a property(object)\n */\n name?: string\n}\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n"],"mappings":";;AAkGA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,WAAW;CACX,UAAU;CACV,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;CACN,OAAO;CACP,MAAM;CACN,KAAK;CACL,MAAM;CAEN,SAAS;CACT,OAAO;CACP,KAAK;CACL,UAAU;CACV,KAAK;CACL,KAAK;CACL,kBAAkB;CAClB,kBAAkB;CAClB,UAAU;CACV,UAAU;CACV,WAAW;CAGX,QAAQ;CACR,KAAK;CACL,SAAS;CACT,WAAW;CACX,UAAU;CACV,UAAU;CACV,OAAO;CACP,MAAM;CACN,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACN,MAAM;CACN,WAAW;CACZ;AA4BD,SAAgB,UAAiE,MAAS,SAAwD;AAChJ,QAAO,KAAK,YAAY"}
@@ -1,12 +1,81 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { i as SchemaKeywordMapper, t as Schema } from "./SchemaMapper-SneuY1wg.js";
2
+ import { i as SchemaKeywordMapper, t as Schema } from "./SchemaMapper-CLIXrzqv.js";
3
3
  import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
4
- import { Fabric } from "@kubb/react-fabric";
5
- import { Adapter, AsyncEventEmitter, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
6
- import { KubbFile } from "@kubb/fabric-core/types";
7
- import { OperationNode, SchemaNode } from "@kubb/ast/types";
4
+ import { Config, FileMetaBase, Generator, KubbEvents, Output, Plugin, PluginDriver, PluginFactoryOptions, ResolveNameParams, UserGroup } from "@kubb/core";
5
+ import { Fabric, FabricFile } from "@kubb/fabric-core/types";
8
6
  import { FabricReactNode } from "@kubb/react-fabric/types";
9
7
 
8
+ //#region ../../internals/utils/src/asyncEventEmitter.d.ts
9
+ /**
10
+ * A function that can be registered as an event listener, synchronous or async.
11
+ */
12
+ type AsyncListener<TArgs extends unknown[]> = (...args: TArgs) => void | Promise<void>;
13
+ /**
14
+ * Typed `EventEmitter` that awaits all async listeners before resolving.
15
+ * Wraps Node's `EventEmitter` with full TypeScript event-map inference.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const emitter = new AsyncEventEmitter<{ build: [name: string] }>()
20
+ * emitter.on('build', async (name) => { console.log(name) })
21
+ * await emitter.emit('build', 'petstore') // all listeners awaited
22
+ * ```
23
+ */
24
+ declare class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: unknown[] }> {
25
+ #private;
26
+ /**
27
+ * Maximum number of listeners per event before Node emits a memory-leak warning.
28
+ * @default 10
29
+ */
30
+ constructor(maxListener?: number);
31
+ /**
32
+ * Emits `eventName` and awaits all registered listeners sequentially.
33
+ * Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * await emitter.emit('build', 'petstore')
38
+ * ```
39
+ */
40
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
41
+ /**
42
+ * Registers a persistent listener for `eventName`.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * emitter.on('build', async (name) => { console.log(name) })
47
+ * ```
48
+ */
49
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
50
+ /**
51
+ * Registers a one-shot listener that removes itself after the first invocation.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * emitter.onOnce('build', async (name) => { console.log(name) })
56
+ * ```
57
+ */
58
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
59
+ /**
60
+ * Removes a previously registered listener.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * emitter.off('build', handler)
65
+ * ```
66
+ */
67
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
68
+ /**
69
+ * Removes all listeners from every event channel.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * emitter.removeAll()
74
+ * ```
75
+ */
76
+ removeAll(): void;
77
+ }
78
+ //#endregion
10
79
  //#region src/types.d.ts
11
80
  type GetOasOptions = {
12
81
  validate?: boolean;
@@ -18,6 +87,9 @@ type Context$2 = {
18
87
  declare global {
19
88
  namespace Kubb {
20
89
  interface PluginContext extends Context$2 {}
90
+ interface PluginRegistry {
91
+ 'plugin-oas': PluginOas;
92
+ }
21
93
  }
22
94
  }
23
95
  type ResolvePathOptions = {
@@ -42,7 +114,7 @@ type Options = {
42
114
  /**
43
115
  * Group the JSON files based on the provided name.
44
116
  */
45
- group?: Group;
117
+ group?: UserGroup;
46
118
  /**
47
119
  * Which server to use from the array of `servers.url[serverIndex]`
48
120
  * @example
@@ -97,7 +169,7 @@ type Options = {
97
169
  /**
98
170
  * Define some generators next to the JSON generation
99
171
  */
100
- generators?: Array<Generator<PluginOas>>;
172
+ generators?: Array<Generator$1<PluginOas>>;
101
173
  /**
102
174
  * Resolve name collisions when schemas from different components share the same name (case-insensitive).
103
175
  *
@@ -141,7 +213,7 @@ type Options = {
141
213
  type Ref = {
142
214
  propertyName: string;
143
215
  originalName: string;
144
- path: KubbFile.Path;
216
+ path: FabricFile.Path;
145
217
  pluginName?: string;
146
218
  };
147
219
  type Refs = Record<string, Ref>;
@@ -150,8 +222,8 @@ type Resolver = {
150
222
  * Original name or name resolved by `resolveName({ name: operation?.getOperationId() as string, pluginName })`
151
223
  */
152
224
  name: string;
153
- baseName: KubbFile.BaseName;
154
- path: KubbFile.Path;
225
+ baseName: FabricFile.BaseName;
226
+ path: FabricFile.Path;
155
227
  };
156
228
  type OperationSchema = {
157
229
  /**
@@ -210,18 +282,21 @@ type ByContentType = {
210
282
  type: 'contentType';
211
283
  pattern: string | RegExp;
212
284
  };
213
- type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
214
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
285
+ type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType | BySchemaName;
286
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType | BySchemaName;
215
287
  type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
216
288
  options: Partial<TOptions>;
217
289
  };
218
290
  type ResolvedOptions = Options & {
219
291
  output: Output<Oas>;
292
+ exclude: Array<Exclude>;
293
+ include?: Array<Include>;
294
+ override: Array<Override<ResolvedOptions>>;
220
295
  };
221
296
  type PluginOas = PluginFactoryOptions<'plugin-oas', Options, ResolvedOptions, Context$2, ResolvePathOptions>;
222
297
  //#endregion
223
298
  //#region src/OperationGenerator.d.ts
224
- type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
299
+ type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<FabricFile.File<TFileMeta> | Array<FabricFile.File<TFileMeta>> | null>;
225
300
  type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
226
301
  fabric: Fabric;
227
302
  oas: Oas;
@@ -229,13 +304,13 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
229
304
  include: Array<Include> | undefined;
230
305
  override: Array<Override<TOptions>> | undefined;
231
306
  contentType: contentType | undefined;
232
- pluginManager: PluginManager;
307
+ driver: PluginDriver;
233
308
  events?: AsyncEventEmitter<KubbEvents>;
234
309
  /**
235
310
  * Current plugin
236
311
  */
237
312
  plugin: Plugin<TPluginOptions>;
238
- mode: KubbFile.Mode;
313
+ mode: FabricFile.Mode;
239
314
  UNSTABLE_NAMING?: true;
240
315
  };
241
316
  declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> {
@@ -255,22 +330,22 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
255
330
  method: HttpMethod;
256
331
  operation: Operation;
257
332
  }>>;
258
- build(...generators: Array<Generator<TPluginOptions, Version>>): Promise<Array<KubbFile.File<TFileMeta>>>;
333
+ build(...generators: Array<Generator$1<TPluginOptions>>): Promise<Array<FabricFile.File<TFileMeta>>>;
259
334
  }
260
335
  //#endregion
261
336
  //#region src/SchemaGenerator.d.ts
262
337
  type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
263
- type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
338
+ type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<FabricFile.File<TFileMeta> | Array<FabricFile.File<TFileMeta>> | null>;
264
339
  type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
265
340
  fabric: Fabric;
266
341
  oas: Oas;
267
- pluginManager: PluginManager;
342
+ driver: PluginDriver;
268
343
  events?: AsyncEventEmitter<KubbEvents>;
269
344
  /**
270
345
  * Current plugin
271
346
  */
272
347
  plugin: Plugin<TPluginOptions>;
273
- mode: KubbFile.Mode;
348
+ mode: FabricFile.Mode;
274
349
  include?: Array<'schemas' | 'responses' | 'requestBodies'>;
275
350
  override: Array<Override<TOptions>> | undefined;
276
351
  contentType?: contentType;
@@ -327,24 +402,23 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
327
402
  static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
328
403
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
329
404
  static combineObjects(tree: Schema[] | undefined): Schema[];
330
- build(...generators: Array<Generator<TPluginOptions, Version>>): Promise<Array<KubbFile.File<TFileMeta>>>;
405
+ build(...generators: Array<Generator$1<TPluginOptions>>): Promise<Array<FabricFile.File<TFileMeta>>>;
331
406
  }
332
407
  //#endregion
333
408
  //#region src/generators/createReactGenerator.d.ts
334
- type UserGenerator$1<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
409
+ type UserGenerator$1<TOptions extends PluginFactoryOptions> = {
335
410
  name: string;
336
- version?: TVersion;
337
- Operations?: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode;
338
- Operation?: (props: OperationProps<TOptions, TVersion>) => FabricReactNode;
339
- Schema?: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode;
411
+ Operations?: (props: OperationsProps<TOptions>) => FabricReactNode;
412
+ Operation?: (props: OperationProps<TOptions>) => FabricReactNode;
413
+ Schema?: (props: SchemaProps<TOptions>) => FabricReactNode;
340
414
  };
341
- type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
415
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
342
416
  name: string;
343
417
  type: 'react';
344
- version: TVersion;
345
- Operations: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode;
346
- Operation: (props: OperationProps<TOptions, TVersion>) => FabricReactNode;
347
- Schema: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode;
418
+ version: '1';
419
+ Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
420
+ Operation: (props: OperationProps<TOptions>) => FabricReactNode;
421
+ Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
348
422
  };
349
423
  /****
350
424
  * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
@@ -353,37 +427,22 @@ type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Vers
353
427
  *
354
428
  * @returns A generator object with async methods for operations, operation, and schema file generation.
355
429
  */
356
- declare function createReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(generator: UserGenerator$1<TOptions, TVersion>): ReactGenerator<TOptions, TVersion>;
430
+ declare function createReactGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator$1<TOptions>): ReactGenerator<TOptions>;
357
431
  //#endregion
358
432
  //#region src/generators/types.d.ts
359
- type Version = '1' | '2';
360
- type OperationsV1Props<TOptions extends PluginFactoryOptions> = {
433
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
361
434
  config: Config;
362
435
  generator: Omit<OperationGenerator<TOptions>, 'build'>;
363
436
  plugin: Plugin<TOptions>;
364
437
  operations: Array<Operation>;
365
438
  };
366
- type OperationsV2Props<TOptions extends PluginFactoryOptions> = {
367
- config: Config;
368
- adapter: Adapter;
369
- options: Plugin<TOptions>['options'];
370
- nodes: Array<OperationNode>;
371
- };
372
- type OperationV1Props<TOptions extends PluginFactoryOptions> = {
439
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
373
440
  config: Config;
374
441
  generator: Omit<OperationGenerator<TOptions>, 'build'>;
375
442
  plugin: Plugin<TOptions>;
376
443
  operation: Operation;
377
444
  };
378
- type OperationV2Props<TOptions extends PluginFactoryOptions> = {
379
- config: Config;
380
- adapter: Adapter;
381
- options: Plugin<TOptions>['options'];
382
- node: OperationNode;
383
- };
384
- type OperationsProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? OperationsV2Props<TOptions> : OperationsV1Props<TOptions>;
385
- type OperationProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? OperationV2Props<TOptions> : OperationV1Props<TOptions>;
386
- type SchemaV1Props<TOptions extends PluginFactoryOptions> = {
445
+ type SchemaProps<TOptions extends PluginFactoryOptions> = {
387
446
  config: Config;
388
447
  generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
389
448
  plugin: Plugin<TOptions>;
@@ -393,32 +452,24 @@ type SchemaV1Props<TOptions extends PluginFactoryOptions> = {
393
452
  value: SchemaObject;
394
453
  };
395
454
  };
396
- type SchemaV2Props<TOptions extends PluginFactoryOptions> = {
397
- config: Config;
398
- options: Plugin<TOptions>['options'];
399
- node: SchemaNode;
400
- adapter: Adapter;
401
- };
402
- type SchemaProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? SchemaV2Props<TOptions> : SchemaV1Props<TOptions>;
403
- type Generator<TOptions extends PluginFactoryOptions, TVersion extends Version = Version> = CoreGenerator<TOptions, TVersion> | ReactGenerator<TOptions, TVersion>;
455
+ type Generator$1<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions> | Generator<TOptions>;
404
456
  //#endregion
405
457
  //#region src/generators/createGenerator.d.ts
406
- type UserGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
458
+ type UserGenerator<TOptions extends PluginFactoryOptions> = {
407
459
  name: string;
408
- version?: TVersion;
409
- operations?: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
410
- operation?: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
411
- schema?: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
460
+ operations?: (props: OperationsProps<TOptions>) => Promise<FabricFile.File[]>;
461
+ operation?: (props: OperationProps<TOptions>) => Promise<FabricFile.File[]>;
462
+ schema?: (props: SchemaProps<TOptions>) => Promise<FabricFile.File[]>;
412
463
  };
413
- type CoreGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
464
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
414
465
  name: string;
415
466
  type: 'core';
416
- version: TVersion;
417
- operations: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
418
- operation: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
419
- schema: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
467
+ version: '1';
468
+ operations: (props: OperationsProps<TOptions>) => Promise<FabricFile.File[]>;
469
+ operation: (props: OperationProps<TOptions>) => Promise<FabricFile.File[]>;
470
+ schema: (props: SchemaProps<TOptions>) => Promise<FabricFile.File[]>;
420
471
  };
421
- declare function createGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'>(generator: UserGenerator<TOptions, TVersion>): CoreGenerator<TOptions, TVersion>;
472
+ declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions>;
422
473
  //#endregion
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 };
424
- //# sourceMappingURL=createGenerator-jtR_okrd.d.ts.map
474
+ export { Resolver as C, ResolvePathOptions as S, Options as _, createReactGenerator as a, Ref as b, SchemaGeneratorBuildOptions as c, OperationGenerator as d, OperationMethodResult as f, OperationSchemas as g, OperationSchema as h, ReactGenerator as i, SchemaGeneratorOptions as l, Include as m, createGenerator as n, GetSchemaGeneratorOptions as o, Exclude as p, Generator$1 as r, SchemaGenerator as s, CoreGenerator as t, SchemaMethodResult as u, Override as v, Refs as x, PluginOas as y };
475
+ //# sourceMappingURL=createGenerator-DL3CAvaU.d.ts.map
@@ -1,10 +1,10 @@
1
1
  require("./chunk-ByKO4r7w.cjs");
2
- const require_getFooter = require("./getFooter-BBzsC616.cjs");
2
+ const require_getFooter = require("./getFooter-gshcRE1-.cjs");
3
3
  //#region src/generators/createGenerator.ts
4
4
  function createGenerator(generator) {
5
5
  return {
6
6
  type: "core",
7
- version: generator.version ?? "1",
7
+ version: "1",
8
8
  async operations() {
9
9
  return [];
10
10
  },
@@ -29,7 +29,7 @@ function createGenerator(generator) {
29
29
  function createReactGenerator(generator) {
30
30
  return {
31
31
  type: "react",
32
- version: generator.version ?? "1",
32
+ version: "1",
33
33
  Operations() {
34
34
  return null;
35
35
  },
@@ -47,9 +47,9 @@ function createReactGenerator(generator) {
47
47
  const jsonGenerator = createGenerator({
48
48
  name: "plugin-oas",
49
49
  async schema({ schema, generator }) {
50
- const { pluginManager, plugin } = generator.context;
50
+ const { driver, plugin } = generator.context;
51
51
  return [{
52
- ...pluginManager.getFile({
52
+ ...driver.getFile({
53
53
  name: require_getFooter.camelCase(schema.name),
54
54
  extname: ".json",
55
55
  mode: "split",
@@ -64,7 +64,7 @@ const jsonGenerator = createGenerator({
64
64
  banner: require_getFooter.getBanner({
65
65
  oas: generator.context.oas,
66
66
  output: plugin.options.output,
67
- config: pluginManager.config
67
+ config: driver.config
68
68
  }),
69
69
  format: require_getFooter.getFooter({
70
70
  oas: generator.context.oas,
@@ -93,4 +93,4 @@ Object.defineProperty(exports, "jsonGenerator", {
93
93
  }
94
94
  });
95
95
 
96
- //# sourceMappingURL=generators-vAAte6w6.cjs.map
96
+ //# sourceMappingURL=generators-85sP4GIS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-85sP4GIS.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 { FabricFile } from '@kubb/fabric-core/types'\nimport type { OperationProps, OperationsProps, SchemaProps } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (props: OperationsProps<TOptions>) => Promise<FabricFile.File[]>\n operation?: (props: OperationProps<TOptions>) => Promise<FabricFile.File[]>\n schema?: (props: SchemaProps<TOptions>) => Promise<FabricFile.File[]>\n}\n\nexport type CoreGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n type: 'core'\n version: '1'\n operations: (props: OperationsProps<TOptions>) => Promise<FabricFile.File[]>\n operation: (props: OperationProps<TOptions>) => Promise<FabricFile.File[]>\n schema: (props: SchemaProps<TOptions>) => Promise<FabricFile.File[]>\n}\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions> {\n return {\n type: 'core',\n version: '1',\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 } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (props: OperationsProps<TOptions>) => FabricReactNode\n Operation?: (props: OperationProps<TOptions>) => FabricReactNode\n Schema?: (props: SchemaProps<TOptions>) => FabricReactNode\n}\n\nexport type ReactGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n type: 'react'\n version: '1'\n Operations: (props: OperationsProps<TOptions>) => FabricReactNode\n Operation: (props: OperationProps<TOptions>) => FabricReactNode\n Schema: (props: SchemaProps<TOptions>) => 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>(generator: UserGenerator<TOptions>): ReactGenerator<TOptions> {\n return {\n type: 'react',\n version: '1',\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 { driver, plugin } = generator.context\n const file = driver.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: driver.config,\n }),\n format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;AAoBA,SAAgB,gBAAuD,WAA6D;AAClI,QAAO;EACL,MAAM;EACN,SAAS;EACT,MAAM,aAAa;AACjB,UAAO,EAAE;;EAEX,MAAM,YAAY;AAChB,UAAO,EAAE;;EAEX,MAAM,SAAS;AACb,UAAO,EAAE;;EAEX,GAAG;EACJ;;;;;;;;;;;ACPH,SAAgB,qBAA4D,WAA8D;AACxI,QAAO;EACL,MAAM;EACN,SAAS;EACT,aAAa;AACX,UAAO;;EAET,YAAY;AACV,UAAO;;EAET,SAAS;AACP,UAAO;;EAET,GAAG;EACJ;;;;ACnCH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,aAAa;EAClC,MAAM,EAAE,QAAQ,WAAW,UAAU;AAQrC,SAAO,CACL;GACE,GATS,OAAO,QAAQ;IAC1B,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,OAAO;IAChB,CAAC;GACF,QAAQC,kBAAAA,UAAU;IAAE,KAAK,UAAU,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GACjF,CACF;;CAEJ,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { n as getBanner, r as camelCase, t as getFooter } from "./getFooter-Pw3tLCiV.js";
2
+ import { n as getBanner, r as camelCase, t as getFooter } from "./getFooter-Dz4u5Mg4.js";
3
3
  //#region src/generators/createGenerator.ts
4
4
  function createGenerator(generator) {
5
5
  return {
6
6
  type: "core",
7
- version: generator.version ?? "1",
7
+ version: "1",
8
8
  async operations() {
9
9
  return [];
10
10
  },
@@ -29,7 +29,7 @@ function createGenerator(generator) {
29
29
  function createReactGenerator(generator) {
30
30
  return {
31
31
  type: "react",
32
- version: generator.version ?? "1",
32
+ version: "1",
33
33
  Operations() {
34
34
  return null;
35
35
  },
@@ -47,9 +47,9 @@ function createReactGenerator(generator) {
47
47
  const jsonGenerator = createGenerator({
48
48
  name: "plugin-oas",
49
49
  async schema({ schema, generator }) {
50
- const { pluginManager, plugin } = generator.context;
50
+ const { driver, plugin } = generator.context;
51
51
  return [{
52
- ...pluginManager.getFile({
52
+ ...driver.getFile({
53
53
  name: camelCase(schema.name),
54
54
  extname: ".json",
55
55
  mode: "split",
@@ -64,7 +64,7 @@ const jsonGenerator = createGenerator({
64
64
  banner: getBanner({
65
65
  oas: generator.context.oas,
66
66
  output: plugin.options.output,
67
- config: pluginManager.config
67
+ config: driver.config
68
68
  }),
69
69
  format: getFooter({
70
70
  oas: generator.context.oas,
@@ -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-B8HiBWvT.js.map
79
+ //# sourceMappingURL=generators-hPE06pZB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-hPE06pZB.js","names":[],"sources":["../src/generators/createGenerator.ts","../src/generators/createReactGenerator.ts","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { FabricFile } from '@kubb/fabric-core/types'\nimport type { OperationProps, OperationsProps, SchemaProps } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (props: OperationsProps<TOptions>) => Promise<FabricFile.File[]>\n operation?: (props: OperationProps<TOptions>) => Promise<FabricFile.File[]>\n schema?: (props: SchemaProps<TOptions>) => Promise<FabricFile.File[]>\n}\n\nexport type CoreGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n type: 'core'\n version: '1'\n operations: (props: OperationsProps<TOptions>) => Promise<FabricFile.File[]>\n operation: (props: OperationProps<TOptions>) => Promise<FabricFile.File[]>\n schema: (props: SchemaProps<TOptions>) => Promise<FabricFile.File[]>\n}\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions> {\n return {\n type: 'core',\n version: '1',\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 } from './types.ts'\n\ntype UserGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (props: OperationsProps<TOptions>) => FabricReactNode\n Operation?: (props: OperationProps<TOptions>) => FabricReactNode\n Schema?: (props: SchemaProps<TOptions>) => FabricReactNode\n}\n\nexport type ReactGenerator<TOptions extends PluginFactoryOptions> = {\n name: string\n type: 'react'\n version: '1'\n Operations: (props: OperationsProps<TOptions>) => FabricReactNode\n Operation: (props: OperationProps<TOptions>) => FabricReactNode\n Schema: (props: SchemaProps<TOptions>) => 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>(generator: UserGenerator<TOptions>): ReactGenerator<TOptions> {\n return {\n type: 'react',\n version: '1',\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 { driver, plugin } = generator.context\n const file = driver.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: driver.config,\n }),\n format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;AAoBA,SAAgB,gBAAuD,WAA6D;AAClI,QAAO;EACL,MAAM;EACN,SAAS;EACT,MAAM,aAAa;AACjB,UAAO,EAAE;;EAEX,MAAM,YAAY;AAChB,UAAO,EAAE;;EAEX,MAAM,SAAS;AACb,UAAO,EAAE;;EAEX,GAAG;EACJ;;;;;;;;;;;ACPH,SAAgB,qBAA4D,WAA8D;AACxI,QAAO;EACL,MAAM;EACN,SAAS;EACT,aAAa;AACX,UAAO;;EAET,YAAY;AACV,UAAO;;EAET,SAAS;AACP,UAAO;;EAET,GAAG;EACJ;;;;ACnCH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,aAAa;EAClC,MAAM,EAAE,QAAQ,WAAW,UAAU;AAQrC,SAAO,CACL;GACE,GATS,OAAO,QAAQ;IAC1B,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,OAAO;IAChB,CAAC;GACF,QAAQ,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-vAAte6w6.cjs");
2
+ const require_generators = require("./generators-85sP4GIS.cjs");
3
3
  exports.createGenerator = require_generators.createGenerator;
4
4
  exports.createReactGenerator = require_generators.createReactGenerator;
5
5
  exports.jsonGenerator = require_generators.jsonGenerator;
@@ -1,7 +1,8 @@
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-jtR_okrd.js";
2
+ import { a as createReactGenerator, i as ReactGenerator, n as createGenerator, r as Generator, t as CoreGenerator, y as PluginOas } from "./createGenerator-DL3CAvaU.js";
3
+
3
4
  //#region src/generators/jsonGenerator.d.ts
4
- declare const jsonGenerator: CoreGenerator<PluginOas, "1">;
5
+ declare const jsonGenerator: CoreGenerator<PluginOas>;
5
6
  //#endregion
6
- export { type Generator, createGenerator, createReactGenerator, jsonGenerator };
7
+ export { type CoreGenerator, type Generator, type ReactGenerator, createGenerator, createReactGenerator, jsonGenerator };
7
8
  //# sourceMappingURL=generators.d.ts.map
@@ -1,2 +1,2 @@
1
- import { n as createReactGenerator, r as createGenerator, t as jsonGenerator } from "./generators-B8HiBWvT.js";
1
+ import { n as createReactGenerator, r as createGenerator, t as jsonGenerator } from "./generators-hPE06pZB.js";
2
2
  export { createGenerator, createReactGenerator, jsonGenerator };
@@ -20,9 +20,12 @@ function toCamelOrPascal(text, pascal) {
20
20
  * Splits `text` on `.` and applies `transformPart` to each segment.
21
21
  * The last segment receives `isLast = true`, all earlier segments receive `false`.
22
22
  * Segments are joined with `/` to form a file path.
23
+ *
24
+ * Only splits on dots followed by a letter so that version numbers
25
+ * embedded in operationIds (e.g. `v2025.0`) are kept intact.
23
26
  */
24
27
  function applyToFileParts(text, transformPart) {
25
- const parts = text.split(".");
28
+ const parts = text.split(/\.(?=[a-zA-Z])/);
26
29
  return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
27
30
  }
28
31
  /**
@@ -109,4 +112,4 @@ function getFooter({ output, oas }) {
109
112
  //#endregion
110
113
  export { pascalCase as i, getBanner as n, camelCase as r, getFooter as t };
111
114
 
112
- //# sourceMappingURL=getFooter-Pw3tLCiV.js.map
115
+ //# sourceMappingURL=getFooter-Dz4u5Mg4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFooter-Dz4u5Mg4.js","names":[],"sources":["../../../internals/utils/src/casing.ts","../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","import path from 'node:path'\nimport type { Config, Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props<TOas extends Oas> = {\n oas: TOas\n output: Output<any>\n config?: Config\n}\n\n/**\n * Generate a default banner for files created by Kubb\n * @returns A string with the default banner\n */\nfunction getDefaultBanner({ title, description, version, config }: { title?: string; description?: string; version?: string; config: Config }): string {\n try {\n let source = ''\n if ('path' in config.input) {\n source = path.basename(config.input.path)\n } else if ('data' in config.input) {\n source = 'text content'\n }\n\n let banner = '/**\\n* Generated by Kubb (https://kubb.dev/).\\n* Do not edit manually.\\n'\n\n if (config.output.defaultBanner === 'simple') {\n banner += '*/\\n'\n return banner\n }\n\n if (source) {\n banner += `* Source: ${source}\\n`\n }\n\n if (title) {\n banner += `* Title: ${title}\\n`\n }\n\n if (description) {\n const formattedDescription = description.replace(/\\n/gm, '\\n* ')\n banner += `* Description: ${formattedDescription}\\n`\n }\n\n if (version) {\n banner += `* OpenAPI spec version: ${version}\\n`\n }\n\n banner += '*/\\n'\n return banner\n } catch (_error) {\n // If there's any error in parsing the Oas data, return a simpler banner\n return '/**\\n* Generated by Kubb (https://kubb.dev/).\\n* Do not edit manually.\\n*/'\n }\n}\n\nexport function getBanner<TOas extends Oas>({ output, oas, config }: Props<TOas>): string {\n let banner = ''\n if (config?.output?.defaultBanner !== false && config) {\n const { title, description, version } = oas.api?.info || {}\n\n banner = getDefaultBanner({ title, description, version, config })\n }\n\n if (!output.banner) {\n return banner\n }\n\n if (isFunction(output.banner)) {\n return `${output.banner(oas as any)}\\n${banner}`\n }\n\n return `${output.banner}\\n${banner}`\n}\n","import type { Output } from '@kubb/core'\nimport type { Oas } from '@kubb/oas'\nimport { isFunction } from 'remeda'\n\ntype Props<TOas extends Oas> = {\n oas: TOas\n output: Output<any>\n}\n\nexport function getFooter<TOas extends Oas>({ output, oas }: Props<TOas>) {\n if (!output.footer) {\n return undefined\n }\n\n if (isFunction(output.footer)) {\n return output.footer(oas as any)\n }\n\n return output.footer\n}\n"],"mappings":";;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;AAS9D,QARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAAQ,CAEV,MAAM,gBAAgB,CAAC,OAAO,QAAQ,CAG5D,KAAK,MAAM,MAAM;AAEhB,MADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,CACjD,QAAO;AACrB,MAAI,MAAM,KAAK,CAAC,OAAQ,QAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;AAC3E,SAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;GACnD,CACD,KAAK,GAAG,CACR,QAAQ,iBAAiB,GAAG;;;;;;;;;;AAWjC,SAAS,iBAAiB,MAAc,eAAkE;CACxG,MAAM,QAAQ,KAAK,MAAM,iBAAiB;AAC1C,QAAO,MAAM,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI;;;;;;;;;;AAWtF,SAAgB,UAAU,MAAc,EAAE,QAAQ,SAAS,IAAI,SAAS,OAAgB,EAAE,EAAU;AAClG,KAAI,OACF,QAAO,iBAAiB,OAAO,MAAM,WAAW,UAAU,MAAM,SAAS;EAAE;EAAQ;EAAQ,GAAG,EAAE,CAAC,CAAC;AAGpG,QAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,MAAM;;;;;;;;;;AAW9D,SAAgB,WAAW,MAAc,EAAE,QAAQ,SAAS,IAAI,SAAS,OAAgB,EAAE,EAAU;AACnG,KAAI,OACF,QAAO,iBAAiB,OAAO,MAAM,WAAY,SAAS,WAAW,MAAM;EAAE;EAAQ;EAAQ,CAAC,GAAG,UAAU,KAAK,CAAE;AAGpH,QAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,KAAK;;;;;;;;ACrE7D,SAAS,iBAAiB,EAAE,OAAO,aAAa,SAAS,UAA8F;AACrJ,KAAI;EACF,IAAI,SAAS;AACb,MAAI,UAAU,OAAO,MACnB,UAAS,KAAK,SAAS,OAAO,MAAM,KAAK;WAChC,UAAU,OAAO,MAC1B,UAAS;EAGX,IAAI,SAAS;AAEb,MAAI,OAAO,OAAO,kBAAkB,UAAU;AAC5C,aAAU;AACV,UAAO;;AAGT,MAAI,OACF,WAAU,aAAa,OAAO;AAGhC,MAAI,MACF,WAAU,YAAY,MAAM;AAG9B,MAAI,aAAa;GACf,MAAM,uBAAuB,YAAY,QAAQ,QAAQ,OAAO;AAChE,aAAU,kBAAkB,qBAAqB;;AAGnD,MAAI,QACF,WAAU,2BAA2B,QAAQ;AAG/C,YAAU;AACV,SAAO;UACA,QAAQ;AAEf,SAAO;;;AAIX,SAAgB,UAA4B,EAAE,QAAQ,KAAK,UAA+B;CACxF,IAAI,SAAS;AACb,KAAI,QAAQ,QAAQ,kBAAkB,SAAS,QAAQ;EACrD,MAAM,EAAE,OAAO,aAAa,YAAY,IAAI,KAAK,QAAQ,EAAE;AAE3D,WAAS,iBAAiB;GAAE;GAAO;GAAa;GAAS;GAAQ,CAAC;;AAGpE,KAAI,CAAC,OAAO,OACV,QAAO;AAGT,KAAI,WAAW,OAAO,OAAO,CAC3B,QAAO,GAAG,OAAO,OAAO,IAAW,CAAC,IAAI;AAG1C,QAAO,GAAG,OAAO,OAAO,IAAI;;;;AC/D9B,SAAgB,UAA4B,EAAE,QAAQ,OAAoB;AACxE,KAAI,CAAC,OAAO,OACV;AAGF,KAAI,WAAW,OAAO,OAAO,CAC3B,QAAO,OAAO,OAAO,IAAW;AAGlC,QAAO,OAAO"}
@@ -21,9 +21,12 @@ function toCamelOrPascal(text, pascal) {
21
21
  * Splits `text` on `.` and applies `transformPart` to each segment.
22
22
  * The last segment receives `isLast = true`, all earlier segments receive `false`.
23
23
  * Segments are joined with `/` to form a file path.
24
+ *
25
+ * Only splits on dots followed by a letter so that version numbers
26
+ * embedded in operationIds (e.g. `v2025.0`) are kept intact.
24
27
  */
25
28
  function applyToFileParts(text, transformPart) {
26
- const parts = text.split(".");
29
+ const parts = text.split(/\.(?=[a-zA-Z])/);
27
30
  return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
28
31
  }
29
32
  /**
@@ -133,4 +136,4 @@ Object.defineProperty(exports, "pascalCase", {
133
136
  }
134
137
  });
135
138
 
136
- //# sourceMappingURL=getFooter-BBzsC616.cjs.map
139
+ //# sourceMappingURL=getFooter-gshcRE1-.cjs.map