@kubb/plugin-oas 3.18.3 → 4.0.0

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 (45) hide show
  1. package/dist/{Oas-Cv_pyXRM.cjs → Oas--cvTRMTA.cjs} +5 -3
  2. package/dist/{Oas-Cv_pyXRM.cjs.map → Oas--cvTRMTA.cjs.map} +1 -1
  3. package/dist/Oas-CuqAnIw-.js.map +1 -1
  4. package/dist/{SchemaGenerator-lmKFLG0M.cjs → SchemaGenerator-B1V8RwS0.cjs} +36 -46
  5. package/dist/SchemaGenerator-B1V8RwS0.cjs.map +1 -0
  6. package/dist/{SchemaGenerator-WslcpOxc.js → SchemaGenerator-C_u_E-pk.js} +25 -40
  7. package/dist/SchemaGenerator-C_u_E-pk.js.map +1 -0
  8. package/dist/SchemaMapper-BaZQKrQB.js.map +1 -1
  9. package/dist/SchemaMapper-D8J0V9Pj.cjs.map +1 -1
  10. package/dist/components.cjs +1 -1
  11. package/dist/components.d.ts +3 -3
  12. package/dist/{generators-BhLMlRNk.js → generators-CW7v1RgJ.js} +8 -9
  13. package/dist/{generators-BhLMlRNk.js.map → generators-CW7v1RgJ.js.map} +1 -1
  14. package/dist/{generators-DLH2kvlh.cjs → generators-L3av7_7B.cjs} +15 -13
  15. package/dist/{generators-DLH2kvlh.cjs.map → generators-L3av7_7B.cjs.map} +1 -1
  16. package/dist/generators.cjs +3 -3
  17. package/dist/generators.js +2 -2
  18. package/dist/{getFooter-BChY2kC1.cjs → getFooter-B_nmsoeK.cjs} +6 -4
  19. package/dist/{getFooter-BChY2kC1.cjs.map → getFooter-B_nmsoeK.cjs.map} +1 -1
  20. package/dist/{getFooter-T7_pZ6f8.js → getFooter-DM8B8cnC.js} +2 -2
  21. package/dist/{getFooter-T7_pZ6f8.js.map → getFooter-DM8B8cnC.js.map} +1 -1
  22. package/dist/{getSchemas-D8mP129c.cjs → getSchemas-08CU8KWq.cjs} +3 -2
  23. package/dist/{getSchemas-D8mP129c.cjs.map → getSchemas-08CU8KWq.cjs.map} +1 -1
  24. package/dist/getSchemas-WoSBIxG8.js.map +1 -1
  25. package/dist/hooks.cjs +8 -9
  26. package/dist/hooks.cjs.map +1 -1
  27. package/dist/hooks.js +4 -6
  28. package/dist/hooks.js.map +1 -1
  29. package/dist/index.cjs +21 -25
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.js +12 -19
  32. package/dist/index.js.map +1 -1
  33. package/dist/mocks.cjs.map +1 -1
  34. package/dist/mocks.js.map +1 -1
  35. package/dist/{parseFromConfig-CMNGsef2.cjs → parseFromConfig-CFzprC8B.cjs} +9 -5
  36. package/dist/{parseFromConfig-CMNGsef2.cjs.map → parseFromConfig-CFzprC8B.cjs.map} +1 -1
  37. package/dist/parseFromConfig-yAiFK03V.js.map +1 -1
  38. package/dist/utils.cjs +9 -6
  39. package/dist/utils.cjs.map +1 -1
  40. package/dist/utils.js +1 -1
  41. package/dist/utils.js.map +1 -1
  42. package/package.json +7 -7
  43. package/src/SchemaGenerator.ts +1 -7
  44. package/dist/SchemaGenerator-WslcpOxc.js.map +0 -1
  45. package/dist/SchemaGenerator-lmKFLG0M.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaMapper-BaZQKrQB.js","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/core/fs'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: 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.OptionalPath\n /**\n * When true `File.Import` will be used.\n * When false a reference will be 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 number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; 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 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 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 parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this will be 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":";AA6FA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,QAAQ;CACR,SAAS;CACT,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,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;;AA4Bb,SAAgB,UAAiE,MAAS,SAAwD;AAChJ,QAAO,KAAK,YAAY"}
1
+ {"version":3,"file":"SchemaMapper-BaZQKrQB.js","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/core/fs'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: 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.OptionalPath\n /**\n * When true `File.Import` will be used.\n * When false a reference will be 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 number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; 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 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 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 parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this will be 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":";AA6FA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,QAAQ;CACR,SAAS;CACT,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,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;AA2BD,SAAgB,UAAiE,MAAS,SAAwD;AAChJ,QAAO,KAAK,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaMapper-D8J0V9Pj.cjs","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/core/fs'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: 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.OptionalPath\n /**\n * When true `File.Import` will be used.\n * When false a reference will be 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 number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; 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 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 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 parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this will be 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":";;AA6FA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,QAAQ;CACR,SAAS;CACT,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,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;;AA4Bb,SAAgB,UAAiE,MAAS,SAAwD;AAChJ,QAAO,KAAK,YAAY"}
1
+ {"version":3,"file":"SchemaMapper-D8J0V9Pj.cjs","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/core/fs'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: 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.OptionalPath\n /**\n * When true `File.Import` will be used.\n * When false a reference will be 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 number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; 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 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 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 parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this will be 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":";;AA6FA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,QAAQ;CACR,SAAS;CACT,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,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;AA2BD,SAAgB,UAAiE,MAAS,SAAwD;AAChJ,QAAO,KAAK,YAAY"}
@@ -1,4 +1,4 @@
1
- const require_Oas = require('./Oas-Cv_pyXRM.cjs');
1
+ const require_Oas = require('./Oas--cvTRMTA.cjs');
2
2
 
3
3
  exports.Oas = require_Oas.Oas;
4
4
  exports.Operation = require_Oas.Operation;
@@ -1,7 +1,7 @@
1
1
  import { KubbNode, Oas as Oas$1, Operation as Operation$1, OperationGenerator } from "./OperationGenerator-B3oFps4I.js";
2
2
  import "./SchemaMapper-C2J2d3o4.js";
3
3
  import { Schema } from "./Schema-DxWT5L8_.js";
4
- import * as react0 from "react";
4
+ import * as react1 from "react";
5
5
 
6
6
  //#region src/components/Operation.d.ts
7
7
  type Props$1 = {
@@ -16,7 +16,7 @@ declare function Operation({
16
16
  children
17
17
  }: Props$1): any;
18
18
  declare namespace Operation {
19
- var Context: react0.Context<OperationContextProps>;
19
+ var Context: react1.Context<OperationContextProps>;
20
20
  }
21
21
  //#endregion
22
22
  //#region src/components/Oas.d.ts
@@ -44,7 +44,7 @@ declare function Oas({
44
44
  generator
45
45
  }: Props): any;
46
46
  declare namespace Oas {
47
- var Context: react0.Context<OasContextProps>;
47
+ var Context: react1.Context<OasContextProps>;
48
48
  var Operation: typeof Operation;
49
49
  var Schema: typeof Schema;
50
50
  }
@@ -1,5 +1,5 @@
1
1
  import { Oas } from "./Oas-CuqAnIw-.js";
2
- import { getBanner, getFooter } from "./getFooter-T7_pZ6f8.js";
2
+ import { getBanner, getFooter } from "./getFooter-DM8B8cnC.js";
3
3
  import { camelCase } from "@kubb/core/transformers";
4
4
  import { App, createRoot } from "@kubb/react";
5
5
  import { jsx } from "@kubb/react/jsx-runtime";
@@ -105,14 +105,13 @@ const jsonGenerator = createGenerator({
105
105
  name: "plugin-oas",
106
106
  async schema({ schema, instance }) {
107
107
  const { pluginManager, plugin } = instance.context;
108
- const file = pluginManager.getFile({
109
- name: camelCase(schema.name),
110
- extname: ".json",
111
- mode: "split",
112
- pluginKey: plugin.key
113
- });
114
108
  return [{
115
- ...file,
109
+ ...pluginManager.getFile({
110
+ name: camelCase(schema.name),
111
+ extname: ".json",
112
+ mode: "split",
113
+ pluginKey: plugin.key
114
+ }),
116
115
  sources: [{
117
116
  name: camelCase(schema.name),
118
117
  isExportable: false,
@@ -134,4 +133,4 @@ const jsonGenerator = createGenerator({
134
133
 
135
134
  //#endregion
136
135
  export { createGenerator, createReactGenerator, jsonGenerator };
137
- //# sourceMappingURL=generators-BhLMlRNk.js.map
136
+ //# sourceMappingURL=generators-CW7v1RgJ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generators-BhLMlRNk.js","names":[],"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport { Oas } from './components/Oas.tsx'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\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>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} options={options} />\n </Oas>\n </App>,\n )\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n\n const Component = parseOptions.Schema.bind(this)\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.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: instance.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;;;;;AAyCA,SAAgB,gBAAuD,cAA+D;AACpI,QAAO;;;;;;;;;AAiBT,SAAgB,qBAA4D,cAAoE;AAC9I,QAAO;EACL,GAAG;EACH,MAAM,WAAW,EAAE,UAAU,SAAS,cAAc;AAClD,OAAI,CAAC,aAAa,WAChB,QAAO;GAGT,MAAM,E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;EAC3C,MAAM,OAAO,cAAc,QAAQ;GACjC,MAAM,UAAU,OAAO;GACvB,SAAS;GACT,MAAM;GACN,WAAW,OAAO;;AAGpB,SAAO,CACL;GACE,GAAG;GACH,SAAS,CACP;IACE,MAAM,UAAU,OAAO;IACvB,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO;;GAGjC,QAAQ,UAAU;IAChB,KAAK,SAAS,QAAQ;IACtB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;;GAExB,QAAQ,UAAU;IAAE,KAAK,SAAS,QAAQ;IAAK,QAAQ,OAAO,QAAQ"}
1
+ {"version":3,"file":"generators-CW7v1RgJ.js","names":[],"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport { Oas } from './components/Oas.tsx'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\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>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} options={options} />\n </Oas>\n </App>,\n )\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n\n const Component = parseOptions.Schema.bind(this)\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.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: instance.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;;;;;AAyCA,SAAgB,gBAAuD,cAA+D;AACpI,QAAO;;;;;;;;;AAiBT,SAAgB,qBAA4D,cAAoE;AAC9I,QAAO;EACL,GAAG;EACH,MAAM,WAAW,EAAE,UAAU,SAAS,cAAc;AAClD,OAAI,CAAC,aAAa,WAChB,QAAO,EAAE;GAGX,MAAM,EAAE,eAAe,KAAK,QAAQ,SAAS,SAAS;G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,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,YAAY;EACjC,MAAM,EAAE,eAAe,WAAW,SAAS;AAQ3C,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,SAAS,QAAQ;IACtB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;IACvB,CAAC;GACF,QAAQ,UAAU;IAAE,KAAK,SAAS,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GAChF,CACF;;CAEJ,CAAC"}
@@ -1,9 +1,12 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_Oas = require('./Oas-Cv_pyXRM.cjs');
3
- const require_getFooter = require('./getFooter-BChY2kC1.cjs');
4
- const __kubb_core_transformers = require_chunk.__toESM(require("@kubb/core/transformers"));
5
- const __kubb_react = require_chunk.__toESM(require("@kubb/react"));
6
- const __kubb_react_jsx_runtime = require_chunk.__toESM(require("@kubb/react/jsx-runtime"));
2
+ const require_Oas = require('./Oas--cvTRMTA.cjs');
3
+ const require_getFooter = require('./getFooter-B_nmsoeK.cjs');
4
+ let __kubb_core_transformers = require("@kubb/core/transformers");
5
+ __kubb_core_transformers = require_chunk.__toESM(__kubb_core_transformers);
6
+ let __kubb_react = require("@kubb/react");
7
+ __kubb_react = require_chunk.__toESM(__kubb_react);
8
+ let __kubb_react_jsx_runtime = require("@kubb/react/jsx-runtime");
9
+ __kubb_react_jsx_runtime = require_chunk.__toESM(__kubb_react_jsx_runtime);
7
10
 
8
11
  //#region src/generator.tsx
9
12
  function createGenerator(parseOptions) {
@@ -106,14 +109,13 @@ const jsonGenerator = createGenerator({
106
109
  name: "plugin-oas",
107
110
  async schema({ schema, instance }) {
108
111
  const { pluginManager, plugin } = instance.context;
109
- const file = pluginManager.getFile({
110
- name: (0, __kubb_core_transformers.camelCase)(schema.name),
111
- extname: ".json",
112
- mode: "split",
113
- pluginKey: plugin.key
114
- });
115
112
  return [{
116
- ...file,
113
+ ...pluginManager.getFile({
114
+ name: (0, __kubb_core_transformers.camelCase)(schema.name),
115
+ extname: ".json",
116
+ mode: "split",
117
+ pluginKey: plugin.key
118
+ }),
117
119
  sources: [{
118
120
  name: (0, __kubb_core_transformers.camelCase)(schema.name),
119
121
  isExportable: false,
@@ -152,4 +154,4 @@ Object.defineProperty(exports, 'jsonGenerator', {
152
154
  return jsonGenerator;
153
155
  }
154
156
  });
155
- //# sourceMappingURL=generators-DLH2kvlh.cjs.map
157
+ //# sourceMappingURL=generators-L3av7_7B.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generators-DLH2kvlh.cjs","names":["App","Oas","getBanner","getFooter"],"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport { Oas } from './components/Oas.tsx'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\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>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} options={options} />\n </Oas>\n </App>,\n )\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n\n const Component = parseOptions.Schema.bind(this)\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.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: instance.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;;;;;;AAyCA,SAAgB,gBAAuD,cAA+D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AAiB;OAAmB;;;;;AAK/D,UAAO,KAAK;;;;;;;ACtHlB,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,YAAY;EACjC,MAAM,EAAE,eAAe,WAAW,SAAS;EAC3C,MAAM,OAAO,cAAc,QAAQ;GACjC,8CAAgB,OAAO;GACvB,SAAS;GACT,MAAM;GACN,WAAW,OAAO;;AAGpB,SAAO,CACL;GACE,GAAG;GACH,SAAS,CACP;IACE,8CAAgB,OAAO;IACvB,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO;;GAGjC,QAAQC,4BAAU;IAChB,KAAK,SAAS,QAAQ;IACtB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;;GAExB,QAAQC,4BAAU;IAAE,KAAK,SAAS,QAAQ;IAAK,QAAQ,OAAO,QAAQ"}
1
+ {"version":3,"file":"generators-L3av7_7B.cjs","names":["App","Oas","getBanner","getFooter"],"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport { Oas } from './components/Oas.tsx'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\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>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} options={options} />\n </Oas>\n </App>,\n )\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n\n const Component = parseOptions.Schema.bind(this)\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.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: instance.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;;;;;;;;;AAyCA,SAAgB,gBAAuD,cAA+D;AACpI,QAAO;;;;;;;;;AAiBT,SA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AACA,gBAAI;MAAO,MAAM,OAAO;MAAM,cAAc,OAAO;MAAO,MAAM,OAAO;gBACtE,kDAAC;OAAkB;OAAiB;OAAmB;QAAY;OACxD;MACT;KACF,CACP;AACD,UAAO,KAAK;;EAEf;;;;;ACxHH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,YAAY;EACjC,MAAM,EAAE,eAAe,WAAW,SAAS;AAQ3C,SAAO,CACL;GACE,GATS,cAAc,QAAQ;IACjC,8CAAgB,OAAO,KAAK;IAC5B,SAAS;IACT,MAAM;IACN,WAAW,OAAO;IACnB,CAAC;GAKE,SAAS,CACP;IACE,8CAAgB,OAAO,KAAK;IAC5B,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO,MAAM;IACpC,CACF;GACD,QAAQC,4BAAU;IAChB,KAAK,SAAS,QAAQ;IACtB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;IACvB,CAAC;GACF,QAAQC,4BAAU;IAAE,KAAK,SAAS,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GAChF,CACF;;CAEJ,CAAC"}
@@ -1,5 +1,5 @@
1
- require('./Oas-Cv_pyXRM.cjs');
2
- const require_generators = require('./generators-DLH2kvlh.cjs');
3
- require('./getFooter-BChY2kC1.cjs');
1
+ require('./Oas--cvTRMTA.cjs');
2
+ const require_generators = require('./generators-L3av7_7B.cjs');
3
+ require('./getFooter-B_nmsoeK.cjs');
4
4
 
5
5
  exports.jsonGenerator = require_generators.jsonGenerator;
@@ -1,5 +1,5 @@
1
1
  import "./Oas-CuqAnIw-.js";
2
- import { jsonGenerator } from "./generators-BhLMlRNk.js";
3
- import "./getFooter-T7_pZ6f8.js";
2
+ import { jsonGenerator } from "./generators-CW7v1RgJ.js";
3
+ import "./getFooter-DM8B8cnC.js";
4
4
 
5
5
  export { jsonGenerator };
@@ -1,6 +1,8 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const __kubb_core = require_chunk.__toESM(require("@kubb/core"));
3
- const remeda = require_chunk.__toESM(require("remeda"));
2
+ let __kubb_core = require("@kubb/core");
3
+ __kubb_core = require_chunk.__toESM(__kubb_core);
4
+ let remeda = require("remeda");
5
+ remeda = require_chunk.__toESM(remeda);
4
6
 
5
7
  //#region src/utils/getBanner.ts
6
8
  function getBanner({ output, oas, config }) {
@@ -22,7 +24,7 @@ function getBanner({ output, oas, config }) {
22
24
  //#endregion
23
25
  //#region src/utils/getFooter.ts
24
26
  function getFooter({ output, oas }) {
25
- if (!output.footer) return void 0;
27
+ if (!output.footer) return;
26
28
  if ((0, remeda.isFunction)(output.footer)) return output.footer(oas);
27
29
  return output.footer;
28
30
  }
@@ -40,4 +42,4 @@ Object.defineProperty(exports, 'getFooter', {
40
42
  return getFooter;
41
43
  }
42
44
  });
43
- //# sourceMappingURL=getFooter-BChY2kC1.cjs.map
45
+ //# sourceMappingURL=getFooter-B_nmsoeK.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFooter-BChY2kC1.cjs","names":[],"sources":["../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"sourcesContent":["import { type Config, getDefaultBanner, 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 config?: Config\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)}\\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)\n }\n\n return output.footer\n}\n"],"mappings":";;;;;AAUA,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;AAEzD,6CAA0B;GAAE;GAAO;GAAa;GAAS;;;AAG3D,KAAI,CAAC,OAAO,OACV,QAAO;AAGT,4BAAe,OAAO,QACpB,QAAO,GAAG,OAAO,OAAO,KAAK,IAAI;AAGnC,QAAO,GAAG,OAAO,OAAO,IAAI;;;;;ACjB9B,SAAgB,UAA4B,EAAE,QAAQ,OAAoB;AACxE,KAAI,CAAC,OAAO,OACV,QAAO;AAGT,4BAAe,OAAO,QACpB,QAAO,OAAO,OAAO;AAGvB,QAAO,OAAO"}
1
+ {"version":3,"file":"getFooter-B_nmsoeK.cjs","names":[],"sources":["../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"sourcesContent":["import { type Config, getDefaultBanner, 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 config?: Config\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)}\\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)\n }\n\n return output.footer\n}\n"],"mappings":";;;;;;;AAUA,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,6CAA0B;GAAE;GAAO;GAAa;GAAS;GAAQ,CAAC;;AAGpE,KAAI,CAAC,OAAO,OACV,QAAO;AAGT,4BAAe,OAAO,OAAO,CAC3B,QAAO,GAAG,OAAO,OAAO,IAAI,CAAC,IAAI;AAGnC,QAAO,GAAG,OAAO,OAAO,IAAI;;;;;ACjB9B,SAAgB,UAA4B,EAAE,QAAQ,OAAoB;AACxE,KAAI,CAAC,OAAO,OACV;AAGF,4BAAe,OAAO,OAAO,CAC3B,QAAO,OAAO,OAAO,IAAI;AAG3B,QAAO,OAAO"}
@@ -21,11 +21,11 @@ function getBanner({ output, oas, config }) {
21
21
  //#endregion
22
22
  //#region src/utils/getFooter.ts
23
23
  function getFooter({ output, oas }) {
24
- if (!output.footer) return void 0;
24
+ if (!output.footer) return;
25
25
  if (isFunction(output.footer)) return output.footer(oas);
26
26
  return output.footer;
27
27
  }
28
28
 
29
29
  //#endregion
30
30
  export { getBanner, getFooter };
31
- //# sourceMappingURL=getFooter-T7_pZ6f8.js.map
31
+ //# sourceMappingURL=getFooter-DM8B8cnC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFooter-T7_pZ6f8.js","names":[],"sources":["../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"sourcesContent":["import { type Config, getDefaultBanner, 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 config?: Config\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)}\\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)\n }\n\n return output.footer\n}\n"],"mappings":";;;;AAUA,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;AAEzD,WAAS,iBAAiB;GAAE;GAAO;GAAa;GAAS;;;AAG3D,KAAI,CAAC,OAAO,OACV,QAAO;AAGT,KAAI,WAAW,OAAO,QACpB,QAAO,GAAG,OAAO,OAAO,KAAK,IAAI;AAGnC,QAAO,GAAG,OAAO,OAAO,IAAI;;;;;ACjB9B,SAAgB,UAA4B,EAAE,QAAQ,OAAoB;AACxE,KAAI,CAAC,OAAO,OACV,QAAO;AAGT,KAAI,WAAW,OAAO,QACpB,QAAO,OAAO,OAAO;AAGvB,QAAO,OAAO"}
1
+ {"version":3,"file":"getFooter-DM8B8cnC.js","names":[],"sources":["../src/utils/getBanner.ts","../src/utils/getFooter.ts"],"sourcesContent":["import { type Config, getDefaultBanner, 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 config?: Config\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)}\\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)\n }\n\n return output.footer\n}\n"],"mappings":";;;;AAUA,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,IAAI,CAAC,IAAI;AAGnC,QAAO,GAAG,OAAO,OAAO,IAAI;;;;;ACjB9B,SAAgB,UAA4B,EAAE,QAAQ,OAAoB;AACxE,KAAI,CAAC,OAAO,OACV;AAGF,KAAI,WAAW,OAAO,OAAO,CAC3B,QAAO,OAAO,OAAO,IAAI;AAG3B,QAAO,OAAO"}
@@ -1,5 +1,6 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const __kubb_oas = require_chunk.__toESM(require("@kubb/oas"));
2
+ let __kubb_oas = require("@kubb/oas");
3
+ __kubb_oas = require_chunk.__toESM(__kubb_oas);
3
4
 
4
5
  //#region src/utils/getSchemaFactory.ts
5
6
  /**
@@ -64,4 +65,4 @@ Object.defineProperty(exports, 'getSchemas', {
64
65
  return getSchemas;
65
66
  }
66
67
  });
67
- //# sourceMappingURL=getSchemas-D8mP129c.cjs.map
68
+ //# sourceMappingURL=getSchemas-08CU8KWq.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSchemas-D8mP129c.cjs","names":["schemas: Record<string, OasTypes.SchemaObject>"],"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.ts"],"sourcesContent":["import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schemaObject?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schemaObject?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\n/**\n * Creates a factory function that generates a versioned OpenAPI schema result.\n *\n * The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1').\n *\n * @returns A function that takes an optional schema and returns a versioned schema result.\n */\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schemaObject: oas.dereferenceWithRef(schema),\n version,\n } as SchemaResult<TWithRef>\n }\n}\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgB,iBAAmD,KAA6D;AAC9H,SAAQ,WAA0B;EAChC,MAAM,gDAAgC,IAAI,OAAO,QAAQ;AAEzD,SAAO;GACL,cAAc,IAAI,mBAAmB;GACrC;;;;;;;AC1BN,SAAgB,WAAW,EAAE,KAAK,aAAa,WAAW;CAAC;CAAW;CAAiB;KAAwE;CAC7J,MAAM,aAAa,IAAI,gBAAgB;CAEvC,IAAIA,UAAiD;AAErD,KAAI,SAAS,SAAS,WACpB,WAAU;EACR,GAAG;EACH,GAAK,YAAY,WAAqD;;CAI1E,MAAM,gBAAgB,YAAY,iBAAiB;AACnD,KAAI,SAAS,SAAS,cAAc;EAClC,MAAM,YAAY,YAAY,aAAa;AAE3C,SAAO,QAAQ,WAAW,SAAS,CAAC,MAAM,cAAiD;AACzF,OAAI,SAAS,WAAW,CAAC,QAAQ,OAAO;IACtC,MAAM,mBAAmB,OAAO,KAAK,SAAS,SAAS,MAAM;AAC7D,YAAQ,QAAQ,SAAS,UAAU,eAAe,mBAAmB;;;;AAK3E,KAAI,SAAS,SAAS,iBACpB,QAAO,QAAQ,eAAe,SAAS,CAAC,MAAM,aAAmD;AAC/F,MAAI,QAAQ,WAAW,CAAC,QAAQ,OAAO;GACrC,MAAM,mBAAmB,OAAO,KAAK,QAAQ,SAAS,MAAM;AAC5D,WAAQ,QAAQ,QAAQ,UAAU,eAAe,mBAAmB;;;AAK1E,QAAO"}
1
+ {"version":3,"file":"getSchemas-08CU8KWq.cjs","names":["schemas: Record<string, OasTypes.SchemaObject>"],"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.ts"],"sourcesContent":["import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schemaObject?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schemaObject?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\n/**\n * Creates a factory function that generates a versioned OpenAPI schema result.\n *\n * The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1').\n *\n * @returns A function that takes an optional schema and returns a versioned schema result.\n */\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schemaObject: oas.dereferenceWithRef(schema),\n version,\n } as SchemaResult<TWithRef>\n }\n}\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,SAAgB,iBAAmD,KAA6D;AAC9H,SAAQ,WAA0B;EAChC,MAAM,gDAAgC,IAAI,IAAI,GAAG,QAAQ;AAEzD,SAAO;GACL,cAAc,IAAI,mBAAmB,OAAO;GAC5C;GACD;;;;;;AC3BL,SAAgB,WAAW,EAAE,KAAK,aAAa,WAAW;CAAC;CAAW;CAAiB;CAAY,IAA4D;CAC7J,MAAM,aAAa,IAAI,eAAe,CAAC;CAEvC,IAAIA,UAAiD,EAAE;AAEvD,KAAI,SAAS,SAAS,UAAU,CAC9B,WAAU;EACR,GAAG;EACH,GAAK,YAAY,WAAqD,EAAE;EACzE;CAGH,MAAM,gBAAgB,YAAY,iBAAiB,EAAE;AACrD,KAAI,SAAS,SAAS,YAAY,EAAE;EAClC,MAAM,YAAY,YAAY,aAAa,EAAE;AAE7C,SAAO,QAAQ,UAAU,CAAC,SAAS,CAAC,MAAM,cAAiD;AACzF,OAAI,SAAS,WAAW,CAAC,QAAQ,OAAO;IACtC,MAAM,mBAAmB,OAAO,KAAK,SAAS,QAAQ,CAAC,MAAM;AAC7D,YAAQ,QAAQ,SAAS,UAAU,eAAe,mBAAmB;;IAEvE;;AAGJ,KAAI,SAAS,SAAS,gBAAgB,CACpC,QAAO,QAAQ,cAAc,CAAC,SAAS,CAAC,MAAM,aAAmD;AAC/F,MAAI,QAAQ,WAAW,CAAC,QAAQ,OAAO;GACrC,MAAM,mBAAmB,OAAO,KAAK,QAAQ,QAAQ,CAAC,MAAM;AAC5D,WAAQ,QAAQ,QAAQ,UAAU,eAAe,mBAAmB;;GAEtE;AAGJ,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"getSchemas-WoSBIxG8.js","names":["schemas: Record<string, OasTypes.SchemaObject>"],"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.ts"],"sourcesContent":["import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schemaObject?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schemaObject?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\n/**\n * Creates a factory function that generates a versioned OpenAPI schema result.\n *\n * The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1').\n *\n * @returns A function that takes an optional schema and returns a versioned schema result.\n */\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schemaObject: oas.dereferenceWithRef(schema),\n version,\n } as SchemaResult<TWithRef>\n }\n}\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n"],"mappings":";;;;;;;;;;AA8BA,SAAgB,iBAAmD,KAA6D;AAC9H,SAAQ,WAA0B;EAChC,MAAM,UAAU,sBAAsB,IAAI,OAAO,QAAQ;AAEzD,SAAO;GACL,cAAc,IAAI,mBAAmB;GACrC;;;;;;;AC1BN,SAAgB,WAAW,EAAE,KAAK,aAAa,WAAW;CAAC;CAAW;CAAiB;KAAwE;CAC7J,MAAM,aAAa,IAAI,gBAAgB;CAEvC,IAAIA,UAAiD;AAErD,KAAI,SAAS,SAAS,WACpB,WAAU;EACR,GAAG;EACH,GAAK,YAAY,WAAqD;;CAI1E,MAAM,gBAAgB,YAAY,iBAAiB;AACnD,KAAI,SAAS,SAAS,cAAc;EAClC,MAAM,YAAY,YAAY,aAAa;AAE3C,SAAO,QAAQ,WAAW,SAAS,CAAC,MAAM,cAAiD;AACzF,OAAI,SAAS,WAAW,CAAC,QAAQ,OAAO;IACtC,MAAM,mBAAmB,OAAO,KAAK,SAAS,SAAS,MAAM;AAC7D,YAAQ,QAAQ,SAAS,UAAU,eAAe,mBAAmB;;;;AAK3E,KAAI,SAAS,SAAS,iBACpB,QAAO,QAAQ,eAAe,SAAS,CAAC,MAAM,aAAmD;AAC/F,MAAI,QAAQ,WAAW,CAAC,QAAQ,OAAO;GACrC,MAAM,mBAAmB,OAAO,KAAK,QAAQ,SAAS,MAAM;AAC5D,WAAQ,QAAQ,QAAQ,UAAU,eAAe,mBAAmB;;;AAK1E,QAAO"}
1
+ {"version":3,"file":"getSchemas-WoSBIxG8.js","names":["schemas: Record<string, OasTypes.SchemaObject>"],"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.ts"],"sourcesContent":["import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schemaObject?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schemaObject?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\n/**\n * Creates a factory function that generates a versioned OpenAPI schema result.\n *\n * The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1').\n *\n * @returns A function that takes an optional schema and returns a versioned schema result.\n */\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schemaObject: oas.dereferenceWithRef(schema),\n version,\n } as SchemaResult<TWithRef>\n }\n}\n","import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n"],"mappings":";;;;;;;;;;AA8BA,SAAgB,iBAAmD,KAA6D;AAC9H,SAAQ,WAA0B;EAChC,MAAM,UAAU,sBAAsB,IAAI,IAAI,GAAG,QAAQ;AAEzD,SAAO;GACL,cAAc,IAAI,mBAAmB,OAAO;GAC5C;GACD;;;;;;AC3BL,SAAgB,WAAW,EAAE,KAAK,aAAa,WAAW;CAAC;CAAW;CAAiB;CAAY,IAA4D;CAC7J,MAAM,aAAa,IAAI,eAAe,CAAC;CAEvC,IAAIA,UAAiD,EAAE;AAEvD,KAAI,SAAS,SAAS,UAAU,CAC9B,WAAU;EACR,GAAG;EACH,GAAK,YAAY,WAAqD,EAAE;EACzE;CAGH,MAAM,gBAAgB,YAAY,iBAAiB,EAAE;AACrD,KAAI,SAAS,SAAS,YAAY,EAAE;EAClC,MAAM,YAAY,YAAY,aAAa,EAAE;AAE7C,SAAO,QAAQ,UAAU,CAAC,SAAS,CAAC,MAAM,cAAiD;AACzF,OAAI,SAAS,WAAW,CAAC,QAAQ,OAAO;IACtC,MAAM,mBAAmB,OAAO,KAAK,SAAS,QAAQ,CAAC,MAAM;AAC7D,YAAQ,QAAQ,SAAS,UAAU,eAAe,mBAAmB;;IAEvE;;AAGJ,KAAI,SAAS,SAAS,gBAAgB,CACpC,QAAO,QAAQ,cAAc,CAAC,SAAS,CAAC,MAAM,aAAmD;AAC/F,MAAI,QAAQ,WAAW,CAAC,QAAQ,OAAO;GACrC,MAAM,mBAAmB,OAAO,KAAK,QAAQ,QAAQ,CAAC,MAAM;AAC5D,WAAQ,QAAQ,QAAQ,UAAU,eAAe,mBAAmB;;GAEtE;AAGJ,QAAO"}
package/dist/hooks.cjs CHANGED
@@ -1,9 +1,10 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_SchemaGenerator = require('./SchemaGenerator-lmKFLG0M.cjs');
3
- const require_Oas = require('./Oas-Cv_pyXRM.cjs');
2
+ const require_SchemaGenerator = require('./SchemaGenerator-B1V8RwS0.cjs');
3
+ const require_Oas = require('./Oas--cvTRMTA.cjs');
4
4
  const require_SchemaMapper = require('./SchemaMapper-D8J0V9Pj.cjs');
5
- require('./getSchemas-D8mP129c.cjs');
6
- const __kubb_react = require_chunk.__toESM(require("@kubb/react"));
5
+ require('./getSchemas-08CU8KWq.cjs');
6
+ let __kubb_react = require("@kubb/react");
7
+ __kubb_react = require_chunk.__toESM(__kubb_react);
7
8
 
8
9
  //#region src/hooks/useOas.ts
9
10
  function useOas() {
@@ -165,8 +166,7 @@ function useOperations({ method, path } = {}) {
165
166
  * `useSchema` will return the current `schema properties`
166
167
  */
167
168
  function useSchema() {
168
- const props = (0, __kubb_react.useContext)(require_Oas.Schema.Context);
169
- return props;
169
+ return (0, __kubb_react.useContext)(require_Oas.Schema.Context);
170
170
  }
171
171
 
172
172
  //#endregion
@@ -208,9 +208,8 @@ function useSchemaManager() {
208
208
  };
209
209
  };
210
210
  const getImports = (tree) => {
211
- const refs = require_SchemaGenerator.SchemaGenerator.deepSearch(tree, require_SchemaMapper.schemaKeywords.ref);
212
- return refs?.map((item) => {
213
- if (!item.args.path || !item.args.isImportable) return void 0;
211
+ return require_SchemaGenerator.SchemaGenerator.deepSearch(tree, require_SchemaMapper.schemaKeywords.ref)?.map((item) => {
212
+ if (!item.args.path || !item.args.isImportable) return;
214
213
  return {
215
214
  name: [item.args.name],
216
215
  path: item.args.path
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.cjs","names":["Oas","Operation","Oas","getName: UseOperationManagerResult['getName']","getGroup: UseOperationManagerResult['getGroup']","getSchemas: UseOperationManagerResult['getSchemas']","getFile: UseOperationManagerResult['getFile']","groupSchemasByName: UseOperationManagerResult['groupSchemasByName']","Oas","Schema","getName: UseSchemaManagerResult['getName']","getFile: UseSchemaManagerResult['getFile']","getImports: UseSchemaManagerResult['getImports']","SchemaGenerator","schemaKeywords"],"sources":["../src/hooks/useOas.ts","../src/hooks/useOperation.ts","../src/hooks/useOperationManager.ts","../src/hooks/useOperations.ts","../src/hooks/useSchema.ts","../src/hooks/useSchemaManager.ts"],"sourcesContent":["import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { Oas as OasType } from '@kubb/oas'\n\nexport function useOas(): OasType {\n const { oas } = useContext(Oas.Context)\n\n if (!oas) {\n throw new Error('Oas is not defined')\n }\n\n return oas\n}\n","import { useContext } from '@kubb/react'\n\nimport { Operation } from '../components/Operation.tsx'\n\nimport type { Operation as OperationType } from '@kubb/oas'\n\n/**\n * `useOperation` will return the current `Operation`\n */\nexport function useOperation(): OperationType {\n const { operation } = useContext(Operation.Context)\n\n if (!operation) {\n throw new Error('Operation is not defined')\n }\n\n return operation\n}\n","import { useApp, useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\n\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\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` will return some helper functions that can be used to get the operation file, get the operation name.\n */\nexport function useOperationManager(): UseOperationManagerResult {\n const { plugin, pluginManager } = useApp()\n const { generator } = useContext(Oas.Context)\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(`'generator' is not defined`)\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(`'generator' is not defined`)\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 { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype UseOperationsProps = {\n /**\n * Filter based on path\n * Weight: 2\n */\n path?: string\n /**\n * Filter based on method\n * Weight: 1\n */\n method?: HttpMethod\n}\n\n/**\n * `useOperations` will return all the Operations\n */\nexport function useOperations({ method, path }: UseOperationsProps = {}): Operation[] {\n const { operations } = useContext(Oas.Context)\n\n if (!operations) {\n throw new Error('Operations is not defined')\n }\n let items = operations\n\n if (path) {\n items = items.filter((item) => item.path === path)\n }\n\n if (method) {\n items = items.filter((item) => item.method === method)\n }\n\n return items\n}\n","import { useContext } from '@kubb/react'\n\nimport { Schema } from '../components/Schema.tsx'\n\nimport type { SchemaContextProps } from '../components/Schema.tsx'\n\ntype UseSchemaResult = SchemaContextProps\n\n/**\n * `useSchema` will return the current `schema properties`\n */\nexport function useSchema(): UseSchemaResult {\n const props = useContext(Schema.Context)\n\n return props as UseSchemaResult\n}\n","import { useApp } from '@kubb/react'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport { SchemaGenerator } from '../SchemaGenerator.ts'\nimport { type Schema, schemaKeywords } from '../SchemaMapper'\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 getImports: (tree: Array<Schema>) => Array<KubbFile.Import>\n}\n\n/**\n * `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.\n */\nexport function useSchemaManager(): UseSchemaManagerResult {\n const { plugin, pluginManager } = useApp()\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 const getImports: UseSchemaManagerResult['getImports'] = (tree) => {\n const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref)\n\n return refs\n ?.map((item) => {\n if (!item.args.path || !item.args.isImportable) {\n return undefined\n }\n\n return {\n name: [item.args.name],\n path: item.args.path,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C3BT,SAAgB,YAA6B;CAC3C,MAAM,qCAAmBC,mBAAO;AAEhC,QAAO;;;;;;;;ACsBT,SAAgB,mBAA2C;CACzD,MAAM,EAAE,QAAQ;CAEhB,MAAMC,WAA8C,MAAM,EAAE,YAAY,OAAO,KAAK,WAAW;AAC7F,SAAO,cAAc,YAAY;GAC/B;GACA;GACA;;;CAIJ,MAAMC,WAA8C,MAAM,EAAE,OAAO,SAAS,YAAY,OAAO,KAAK,UAAU,OAAO,UAAU,OAAO;EACpI,MAAM,eAAe,SAAS,WAAW,KAAK,QAAQ,MAAM;GAAE,MAAM;GAAQ;;EAE5E,MAAM,OAAO,cAAc,QAAQ;GACjC,MAAM;GACN;GACA;GACA,SAAS;IAAE,MAAM;IAAQ;IAAW;;;AAGtC,SAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG,KAAK;IACR,MAAM;IACN;;;;CAKN,MAAMC,cAAoD,SAAS;EACjE,MAAM,OAAOC,wCAAgB,WAAW,MAAMC,oCAAe;AAE7D,SAAO,MACH,KAAK,SAAS;AACd,OAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,KAAK,aAChC,QAAO;AAGT,UAAO;IACL,MAAM,CAAC,KAAK,KAAK;IACjB,MAAM,KAAK,KAAK;;KAGnB,OAAO;;AAGZ,QAAO;EACL;EACA;EACA"}
1
+ {"version":3,"file":"hooks.cjs","names":["Oas","Operation","Oas","getName: UseOperationManagerResult['getName']","getGroup: UseOperationManagerResult['getGroup']","getSchemas: UseOperationManagerResult['getSchemas']","getFile: UseOperationManagerResult['getFile']","groupSchemasByName: UseOperationManagerResult['groupSchemasByName']","Oas","Schema","getName: UseSchemaManagerResult['getName']","getFile: UseSchemaManagerResult['getFile']","getImports: UseSchemaManagerResult['getImports']","SchemaGenerator","schemaKeywords"],"sources":["../src/hooks/useOas.ts","../src/hooks/useOperation.ts","../src/hooks/useOperationManager.ts","../src/hooks/useOperations.ts","../src/hooks/useSchema.ts","../src/hooks/useSchemaManager.ts"],"sourcesContent":["import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { Oas as OasType } from '@kubb/oas'\n\nexport function useOas(): OasType {\n const { oas } = useContext(Oas.Context)\n\n if (!oas) {\n throw new Error('Oas is not defined')\n }\n\n return oas\n}\n","import { useContext } from '@kubb/react'\n\nimport { Operation } from '../components/Operation.tsx'\n\nimport type { Operation as OperationType } from '@kubb/oas'\n\n/**\n * `useOperation` will return the current `Operation`\n */\nexport function useOperation(): OperationType {\n const { operation } = useContext(Operation.Context)\n\n if (!operation) {\n throw new Error('Operation is not defined')\n }\n\n return operation\n}\n","import { useApp, useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\n\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\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` will return some helper functions that can be used to get the operation file, get the operation name.\n */\nexport function useOperationManager(): UseOperationManagerResult {\n const { plugin, pluginManager } = useApp()\n const { generator } = useContext(Oas.Context)\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(`'generator' is not defined`)\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(`'generator' is not defined`)\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 { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype UseOperationsProps = {\n /**\n * Filter based on path\n * Weight: 2\n */\n path?: string\n /**\n * Filter based on method\n * Weight: 1\n */\n method?: HttpMethod\n}\n\n/**\n * `useOperations` will return all the Operations\n */\nexport function useOperations({ method, path }: UseOperationsProps = {}): Operation[] {\n const { operations } = useContext(Oas.Context)\n\n if (!operations) {\n throw new Error('Operations is not defined')\n }\n let items = operations\n\n if (path) {\n items = items.filter((item) => item.path === path)\n }\n\n if (method) {\n items = items.filter((item) => item.method === method)\n }\n\n return items\n}\n","import { useContext } from '@kubb/react'\n\nimport { Schema } from '../components/Schema.tsx'\n\nimport type { SchemaContextProps } from '../components/Schema.tsx'\n\ntype UseSchemaResult = SchemaContextProps\n\n/**\n * `useSchema` will return the current `schema properties`\n */\nexport function useSchema(): UseSchemaResult {\n const props = useContext(Schema.Context)\n\n return props as UseSchemaResult\n}\n","import { useApp } from '@kubb/react'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport { SchemaGenerator } from '../SchemaGenerator.ts'\nimport { type Schema, schemaKeywords } from '../SchemaMapper'\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 getImports: (tree: Array<Schema>) => Array<KubbFile.Import>\n}\n\n/**\n * `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.\n */\nexport function useSchemaManager(): UseSchemaManagerResult {\n const { plugin, pluginManager } = useApp()\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 const getImports: UseSchemaManagerResult['getImports'] = (tree) => {\n const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref)\n\n return refs\n ?.map((item) => {\n if (!item.args.path || !item.args.isImportable) {\n return undefined\n }\n\n return {\n name: [item.args.name],\n path: item.args.path,\n }\n })\n .filter(Boolean)\n }\n\n return {\n getName,\n getFile,\n getImports,\n }\n}\n"],"mappings":";;;;;;;;;AAMA,SAAgB,SAAkB;CAChC,MAAM,EAAE,qCAAmBA,gBAAI,QAAQ;AAEvC,KAAI,CAAC,IACH,OAAM,IAAI,MAAM,qB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AQ,MAAM,QAAQ,SAAS,KAAK,SAAS,KAAK;AAGpD,KAAI,OACF,SAAQ,MAAM,QAAQ,SAAS,KAAK,WAAW,OAAO;AAGxD,QAAO;;;;;;;;AC3BT,SAAgB,YAA6B;AAG3C,qCAFyBC,mBAAO,QAAQ;;;;;;;;ACwB1C,SAAgB,mBAA2C;CACzD,MAAM,EAAE,QAAQ,4CAA0B;CAE1C,MAAMC,WAA8C,MAAM,EAAE,YAAY,OAAO,KAAK,WAAW;AAC7F,SAAO,cAAc,YAAY;GAC/B;GACA;GACA;GACD,CAAC;;CAGJ,MAAMC,WAA8C,MAAM,EAAE,OAAO,SAAS,YAAY,OAAO,KAAK,UAAU,OAAO,UAAU,EAAE,KAAK;EACpI,MAAM,eAAe,SAAS,WAAW,KAAK,QAAQ,MAAM;GAAE,MAAM;GAAQ;GAAW,CAAC;EAExF,MAAM,OAAO,cAAc,QAAQ;GACjC,MAAM;GACN;GACA;GACA,SAAS;IAAE,MAAM;IAAQ;IAAW;IAAO;GAC5C,CAAC;AAEF,SAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG,KAAK;IACR,MAAM;IACN;IACD;GACF;;CAGH,MAAMC,cAAoD,SAAS;AAGjE,SAFaC,wCAAgB,WAAW,MAAMC,oCAAe,IAAI,EAG7D,KAAK,SAAS;AACd,OAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,KAAK,aAChC;AAGF,UAAO;IACL,MAAM,CAAC,KAAK,KAAK,KAAK;IACtB,MAAM,KAAK,KAAK;IACjB;IACD,CACD,OAAO,QAAQ;;AAGpB,QAAO;EACL;EACA;EACA;EACD"}
package/dist/hooks.js CHANGED
@@ -1,4 +1,4 @@
1
- import { SchemaGenerator } from "./SchemaGenerator-WslcpOxc.js";
1
+ import { SchemaGenerator } from "./SchemaGenerator-C_u_E-pk.js";
2
2
  import { Oas, Operation, Schema } from "./Oas-CuqAnIw-.js";
3
3
  import { schemaKeywords } from "./SchemaMapper-BaZQKrQB.js";
4
4
  import "./getSchemas-WoSBIxG8.js";
@@ -164,8 +164,7 @@ function useOperations({ method, path } = {}) {
164
164
  * `useSchema` will return the current `schema properties`
165
165
  */
166
166
  function useSchema() {
167
- const props = useContext(Schema.Context);
168
- return props;
167
+ return useContext(Schema.Context);
169
168
  }
170
169
 
171
170
  //#endregion
@@ -207,9 +206,8 @@ function useSchemaManager() {
207
206
  };
208
207
  };
209
208
  const getImports = (tree) => {
210
- const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref);
211
- return refs?.map((item) => {
212
- if (!item.args.path || !item.args.isImportable) return void 0;
209
+ return SchemaGenerator.deepSearch(tree, schemaKeywords.ref)?.map((item) => {
210
+ if (!item.args.path || !item.args.isImportable) return;
213
211
  return {
214
212
  name: [item.args.name],
215
213
  path: item.args.path