@kubb/plugin-faker 5.0.0-alpha.31 → 5.0.0-alpha.32

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.
@@ -1 +1 @@
1
- {"version":3,"file":"components-CRVgxJhG.js","names":["parserFaker.joinItems","parserFaker.parse"],"sources":["../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../../../internals/utils/src/regexp.ts","../src/parser.ts","../src/components/Faker.tsx"],"sourcesContent":["/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Returns a masked version of a string, showing only the first and last few characters.\n * Useful for logging sensitive values (tokens, keys) without exposing the full value.\n *\n * @example\n * maskString('KUBB_STUDIO-abc123-xyz789') // 'KUBB_STUDIO-…789'\n */\nexport function maskString(value: string, start = 8, end = 4): string {\n if (value.length <= start + end) return value\n return `${value.slice(0, start)}…${value.slice(-end)}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Strips functions, symbols, and `undefined` values from plugin options for safe JSON transport.\n *\n * @example\n * ```ts\n * serializePluginOptions({ output: './src', onWrite: () => {} })\n * // { output: './src' } (function stripped)\n * ```\n */\nexport function serializePluginOptions<TOptions extends object>(options: TOptions): TOptions {\n if (options === null || options === undefined) return {} as TOptions\n if (typeof options !== 'object') return options\n if (Array.isArray(options)) return options.map(serializePluginOptions) as unknown as TOptions\n\n const serialized: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(options)) {\n if (typeof value === 'function' || typeof value === 'symbol' || value === undefined) continue\n serialized[key] = value !== null && typeof value === 'object' ? serializePluginOptions(value as object) : value\n }\n return serialized as TOptions\n}\n\n/**\n * Strips all `undefined` values from an object recursively by round-tripping through JSON.\n * Useful for clean inline snapshot assertions that only show fields with actual values.\n *\n * @example\n * toSnapshot({ kind: 'Schema', name: undefined, type: 'string' })\n * // { kind: 'Schema', type: 'string' }\n */\nexport function toSnapshot<T>(value: T): T {\n return JSON.parse(JSON.stringify(value))\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as `^(?im)` prefixes are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * toRegExpString('^(?im)foo') // → 'new RegExp(\"foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // → '/foo/im'\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = new RegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","import { stringify, toRegExpString } from '@internals/utils'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, findSchemaKeyword, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type { Options } from './types.ts'\n\nconst fakerKeywordMapper = {\n any: () => 'undefined',\n unknown: () => 'undefined',\n void: () => 'undefined',\n number: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.number.float({ min: ${min}, max: ${max} })`\n }\n\n if (max !== undefined) {\n return `faker.number.float({ max: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.number.float({ min: ${min} })`\n }\n\n return 'faker.number.float()'\n },\n integer: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.number.int({ min: ${min}, max: ${max} })`\n }\n\n if (max !== undefined) {\n return `faker.number.int({ max: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.number.int({ min: ${min} })`\n }\n\n return 'faker.number.int()'\n },\n bigint: () => 'faker.number.bigInt()',\n string: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.string.alpha({ length: { min: ${min}, max: ${max} } })`\n }\n\n if (max !== undefined) {\n return `faker.string.alpha({ length: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.string.alpha({ length: ${min} })`\n }\n\n return 'faker.string.alpha()'\n },\n boolean: () => 'faker.datatype.boolean()',\n undefined: () => 'undefined',\n null: () => 'null',\n array: (items: string[] = [], min?: number, max?: number) => {\n if (items.length > 1) {\n return `faker.helpers.arrayElements([${items.join(', ')}])`\n }\n const item = items.at(0)\n\n if (min !== undefined && max !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: { min: ${min}, max: ${max} }})`\n }\n if (min !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: ${min} })`\n }\n if (max !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: { min: 0, max: ${max} }})`\n }\n\n return `faker.helpers.multiple(() => (${item}))`\n },\n tuple: (items: string[] = []) => `[${items.join(', ')}]`,\n enum: (items: Array<string | number | boolean | undefined> = [], type = 'any') => `faker.helpers.arrayElement<${type}>([${items.join(', ')}])`,\n union: (items: string[] = []) => `faker.helpers.arrayElement<any>([${items.join(', ')}])`,\n /**\n * ISO 8601\n */\n datetime: () => 'faker.date.anytime().toISOString()',\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', parser: Options['dateParser'] = 'faker') => {\n if (type === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"YYYY-MM-DD\")`\n }\n return 'faker.date.anytime().toISOString().substring(0, 10)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${type}' and parser '${parser}' can not work together`)\n }\n\n return 'faker.date.anytime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', parser: Options['dateParser'] = 'faker') => {\n if (type === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"HH:mm:ss\")`\n }\n return 'faker.date.anytime().toISOString().substring(11, 19)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${type}' and parser '${parser}' can not work together`)\n }\n\n return 'faker.date.anytime()'\n },\n uuid: () => 'faker.string.uuid()',\n url: () => 'faker.internet.url()',\n and: (items: string[] = []) => {\n // Handle empty array case\n if (items.length === 0) {\n return '{}'\n }\n\n // If only one item, return it as-is (no need to spread)\n // This fixes the issue with single refs to primitives like enums\n if (items.length === 1) {\n return items[0] ?? '{}'\n }\n\n // If multiple items, spread them together\n // This handles both object literals and multiple refs to objects\n return `{...${items.join(', ...')}}`\n },\n object: () => 'object',\n ref: () => 'ref',\n matches: (value = '', regexGenerator: 'faker' | 'randexp' = 'faker') => {\n if (regexGenerator === 'randexp') {\n return `${toRegExpString(value, 'RandExp')}.gen()`\n }\n return `faker.helpers.fromRegExp(\"${value}\")`\n },\n email: () => 'faker.internet.email()',\n firstName: () => 'faker.person.firstName()',\n lastName: () => 'faker.person.lastName()',\n password: () => 'faker.internet.password()',\n phone: () => 'faker.phone.number()',\n blob: () => 'faker.image.url() as unknown as Blob',\n default: undefined,\n describe: undefined,\n const: (value?: string | number) => (value as string) ?? '',\n max: undefined,\n min: undefined,\n nullable: undefined,\n nullish: undefined,\n optional: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nfunction schemaKeywordSorter(_a: Schema, b: Schema) {\n if (b.keyword === 'null') {\n return -1\n }\n\n return 0\n}\n\nexport function joinItems(items: string[]): string {\n switch (items.length) {\n case 0:\n return 'undefined'\n case 1:\n return items[0]!\n default:\n return fakerKeywordMapper.union(items)\n }\n}\n\ntype ParserOptions = {\n typeName?: string\n rootTypeName?: string\n regexGenerator?: 'faker' | 'randexp'\n canOverride?: boolean\n dateParser?: Options['dateParser']\n mapper?: Record<string, string>\n}\n\nexport const parse = createParser<string, ParserOptions>({\n mapper: fakerKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name, siblings } = tree\n\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return fakerKeywordMapper.union(\n current.args\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n },\n and(tree, options) {\n const { current, schema, siblings } = tree\n\n return fakerKeywordMapper.and(\n current.args\n .map((it) => this.parse({ schema, parent: current, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n },\n array(tree, options) {\n const { current, schema } = tree\n\n return fakerKeywordMapper.array(\n current.args.items\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n current: it,\n siblings: current.args.items,\n },\n {\n ...options,\n typeName: `NonNullable<${options.typeName}>[number]`,\n canOverride: false,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n current.args.min,\n current.args.max,\n )\n },\n enum(tree, options) {\n const { current, parent, name } = tree\n\n const isParentTuple = parent ? isKeyword(parent, schemaKeywords.tuple) : false\n\n if (isParentTuple) {\n return fakerKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'number') {\n return schema.value\n }\n\n if (schema.format === 'boolean') {\n return schema.value\n }\n return stringify(schema.value)\n }),\n )\n }\n\n return fakerKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'number') {\n return schema.value\n }\n if (schema.format === 'boolean') {\n return schema.value\n }\n return stringify(schema.value)\n }),\n // TODO replace this with getEnumNameFromSchema\n name ? options.typeName : undefined,\n )\n },\n ref(tree, options) {\n const { current, parent } = tree\n\n if (!current.args?.name) {\n throw new Error(`Name not defined for keyword ${current.keyword}`)\n }\n\n // Check if this is a self-referencing type (prevents infinite recursion)\n // The rootTypeName is the function name being generated (e.g., \"createNode\")\n // The current.args.name is the ref function name (e.g., \"createNode\")\n const isSelfReferencing = options.rootTypeName && current.args.name === options.rootTypeName\n\n if (isSelfReferencing) {\n // For self-referencing types, return undefined to prevent infinite recursion\n // This will result in empty arrays/objects by default\n return 'undefined as any'\n }\n\n // Check if the parent is an object or and keyword - in these cases, we don't want to pass data\n // because it would incorrectly forward the parent's data to a nested ref\n const isNestedInObjectOrAnd = parent && (isKeyword(parent, schemaKeywords.object) || isKeyword(parent, schemaKeywords.and))\n\n if (options.canOverride && !isNestedInObjectOrAnd) {\n return `${current.args.name}(data)`\n }\n\n return `${current.args.name}()`\n },\n object(tree, options) {\n const { current, schema } = tree\n\n const argsObject = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schema = item[1]\n return schema && typeof schema.map === 'function'\n })\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return `\"${name}\": ${options.mapper?.[mappedName]}`\n }\n\n return `\"${name}\": ${joinItems(\n schemas\n .sort(schemaKeywordSorter)\n .map((it) =>\n this.parse(\n {\n schema,\n name,\n parent: current,\n current: it,\n siblings: schemas,\n },\n {\n ...options,\n typeName: `NonNullable<${options.typeName}>[${JSON.stringify(name)}]`,\n canOverride: false,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n )}`\n })\n .join(',')\n\n return `{${argsObject}}`\n },\n tuple(tree, options) {\n const { current, schema, siblings } = tree\n\n if (Array.isArray(current.args.items)) {\n return fakerKeywordMapper.tuple(\n current.args.items\n .map((it) => this.parse({ schema, parent: current, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n }\n\n return this.parse({ schema, parent: current, current: current.args.items, siblings }, { ...options, canOverride: false })\n },\n const(tree, _options) {\n const { current } = tree\n\n if (current.args.format === 'number' && current.args.name !== undefined) {\n return fakerKeywordMapper.const(current.args.name?.toString())\n }\n return fakerKeywordMapper.const(stringify(current.args.value))\n },\n matches(tree, options) {\n const { current } = tree\n\n if (current.args) {\n return fakerKeywordMapper.matches(current.args, options.regexGenerator)\n }\n return undefined\n },\n null() {\n return fakerKeywordMapper.null()\n },\n undefined() {\n return fakerKeywordMapper.undefined()\n },\n any() {\n return fakerKeywordMapper.any()\n },\n string(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.string(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.string()\n },\n number(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.number(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.number()\n },\n integer(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.integer(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.integer()\n },\n bigint(_tree, _options) {\n return fakerKeywordMapper.bigint()\n },\n datetime() {\n return fakerKeywordMapper.datetime()\n },\n date(tree, options) {\n const { current } = tree\n\n return fakerKeywordMapper.date(current.args.type, options.dateParser)\n },\n time(tree, options) {\n const { current } = tree\n\n return fakerKeywordMapper.time(current.args.type, options.dateParser)\n },\n },\n})\n","import { jsStringEscape } from '@internals/utils'\nimport type { Schema } from '@kubb/plugin-oas'\nimport { isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport * as parserFaker from '../parser.ts'\nimport type { PluginFaker } from '../types.ts'\n\ntype Props = {\n name: string\n typeName: string\n tree: Array<Schema>\n seed?: PluginFaker['options']['seed']\n description?: string\n regexGenerator?: PluginFaker['options']['regexGenerator']\n mapper?: PluginFaker['options']['mapper']\n dateParser?: PluginFaker['options']['dateParser']\n canOverride: boolean\n}\n\nexport function Faker({ tree, description, name, typeName, seed, regexGenerator, canOverride, mapper, dateParser }: Props): FabricReactNode {\n const fakerText = parserFaker.joinItems(\n tree\n .map((schema, _index, siblings) =>\n parserFaker.parse(\n { name, schema, parent: undefined, current: schema, siblings },\n {\n typeName,\n rootTypeName: name,\n regexGenerator,\n mapper,\n canOverride,\n dateParser,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n )\n\n const isArray = fakerText.startsWith('faker.helpers.arrayElements') || fakerText.startsWith('faker.helpers.multiple')\n const isRefToArray = tree.some((s) => isKeyword(s, schemaKeywords.schema) && s.args.type === 'array')\n const isObject = fakerText.startsWith('{')\n const isTuple = fakerText.startsWith('faker.helpers.arrayElement')\n\n const isSimpleString = name === 'string'\n const isSimpleInt = name === 'integer'\n const isSimpleFloat = name === 'float'\n\n let fakerTextWithOverride = fakerText\n\n if (canOverride && isObject) {\n fakerTextWithOverride = `{\n ...${fakerText},\n ...data || {}\n}`\n }\n\n if (canOverride && isTuple) fakerTextWithOverride = `data || ${fakerText}`\n\n if (canOverride && isArray) {\n fakerTextWithOverride = `[\n ...${fakerText},\n ...data || []\n ]`\n }\n\n if (canOverride && isSimpleString) fakerTextWithOverride = 'data ?? faker.string.alpha()'\n\n if (canOverride && isSimpleInt) fakerTextWithOverride = 'data ?? faker.number.int()'\n\n if (canOverride && isSimpleFloat) fakerTextWithOverride = 'data ?? faker.number.float()'\n\n let type = `Partial<${typeName}>`\n\n if (isArray) type = typeName\n if (isRefToArray) type = typeName\n if (isSimpleString) type = name\n if (isSimpleInt || isSimpleFloat) type = 'number'\n\n const params = FunctionParams.factory({\n data: {\n // making a partial out of an array does not make sense\n type,\n optional: true,\n },\n })\n\n let returnType = canOverride ? typeName : undefined\n\n if (isSimpleString || isSimpleInt || isSimpleFloat) returnType = type\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: [description ? `@description ${jsStringEscape(description)}` : undefined].filter(Boolean) }}\n params={canOverride ? params.toConstructor() : undefined}\n returnType={returnType}\n >\n {seed ? `faker.seed(${JSON.stringify(seed)})` : undefined}\n <br />\n {`return ${fakerTextWithOverride}`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,SAAgB,WAAW,MAAsB;AAC/C,KAAI,KAAK,UAAU,GAAG;EACpB,MAAM,QAAQ,KAAK;EACnB,MAAM,OAAO,KAAK,KAAK,SAAS;AAChC,MAAK,UAAU,QAAO,SAAS,QAAS,UAAU,OAAO,SAAS,OAAS,UAAU,OAAO,SAAS,IACnG,QAAO,KAAK,MAAM,GAAG,GAAG;;AAG5B,QAAO;;;;;;;;;;;;;AAcT,SAAgB,eAAe,OAAwB;AACrD,QAAO,GAAG,QAAQ,QAAQ,4BAA4B,cAAc;AAClE,UAAQ,WAAR;GACE,KAAK;GACL,KAAK;GACL,KAAK,KACH,QAAO,KAAK;GACd,KA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AW,IAAI;CAC1C,MAAM,UAAU,UAAU,WAAW,6BAA6B;CAElE,MAAM,iBAAiB,SAAS;CAChC,MAAM,cAAc,SAAS;CAC7B,MAAM,gBAAgB,SAAS;CAE/B,IAAI,wBAAwB;AAE5B,KAAI,eAAe,SACjB,yBAAwB;OACrB,UAAU;;;AAKf,KAAI,eAAe,QAAS,yBAAwB,WAAW;AAE/D,KAAI,eAAe,QACjB,yBAAwB;WACjB,UAAU;;;AAKnB,KAAI,eAAe,eAAgB,yBAAwB;AAE3D,KAAI,eAAe,YAAa,yBAAwB;AAExD,KAAI,eAAe,cAAe,yBAAwB;CAE1D,IAAI,OAAO,WAAW,SAAS;AAE/B,KAAI,QAAS,QAAO;AACpB,KAAI,aAAc,QAAO;AACzB,KAAI,eAAgB,QAAO;AAC3B,KAAI,eAAe,cAAe,QAAO;CAEzC,MAAM,SAAS,eAAe,QAAQ,EACpC,MAAM;EAEJ;EACA,UAAU;EACX,EACF,CAAC;CAEF,IAAI,aAAa,cAAc,WAAW,KAAA;AAE1C,KAAI,kBAAkB,eAAe,cAAe,cAAa;AAEjE,QACE,oBAAC,KAAK,QAAN;EAAmB;EAAM,cAAA;EAAa,aAAA;YACpC,qBAAC,UAAD;GACE,QAAA;GACM;GACN,OAAO,EAAE,UAAU,CAAC,cAAc,gBAAgB,eAAe,YAAY,KAAK,KAAA,EAAU,CAAC,OAAO,QAAQ,EAAE;GAC9G,QAAQ,cAAc,OAAO,eAAe,GAAG,KAAA;GACnC;aALd;IAOG,OAAO,cAAc,KAAK,UAAU,KAAK,CAAC,KAAK,KAAA;IAChD,oBAAC,MAAD,EAAM,CAAA;IACL,UAAU;IACF;;EACC,CAAA"}
1
+ {"version":3,"file":"components-CRVgxJhG.js","names":["parserFaker.joinItems","parserFaker.parse"],"sources":["../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../../../internals/utils/src/regexp.ts","../src/parser.ts","../src/components/Faker.tsx"],"sourcesContent":["/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Returns a masked version of a string, showing only the first and last few characters.\n * Useful for logging sensitive values (tokens, keys) without exposing the full value.\n *\n * @example\n * maskString('KUBB_STUDIO-abc123-xyz789') // 'KUBB_STUDIO-…789'\n */\nexport function maskString(value: string, start = 8, end = 4): string {\n if (value.length <= start + end) return value\n return `${value.slice(0, start)}…${value.slice(-end)}`\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Strips functions, symbols, and `undefined` values from plugin options for safe JSON transport.\n *\n * @example\n * ```ts\n * serializePluginOptions({ output: './src', onWrite: () => {} })\n * // { output: './src' } (function stripped)\n * ```\n */\nexport function serializePluginOptions<TOptions extends object>(options: TOptions): TOptions {\n if (options === null || options === undefined) return {} as TOptions\n if (typeof options !== 'object') return options\n if (Array.isArray(options)) return options.map(serializePluginOptions) as unknown as TOptions\n\n const serialized: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(options)) {\n if (typeof value === 'function' || typeof value === 'symbol' || value === undefined) continue\n serialized[key] = value !== null && typeof value === 'object' ? serializePluginOptions(value as object) : value\n }\n return serialized as TOptions\n}\n\n/**\n * Strips all `undefined` values from an object recursively by round-tripping through JSON.\n * Useful for clean inline snapshot assertions that only show fields with actual values.\n *\n * @example\n * toSnapshot({ kind: 'Schema', name: undefined, type: 'string' })\n * // { kind: 'Schema', type: 'string' }\n */\nexport function toSnapshot<T>(value: T): T {\n return JSON.parse(JSON.stringify(value))\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as `^(?im)` prefixes are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * toRegExpString('^(?im)foo') // → 'new RegExp(\"foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // → '/foo/im'\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = new RegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","import { stringify, toRegExpString } from '@internals/utils'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, findSchemaKeyword, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type { Options } from './types.ts'\n\nconst fakerKeywordMapper = {\n any: () => 'undefined',\n unknown: () => 'undefined',\n void: () => 'undefined',\n number: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.number.float({ min: ${min}, max: ${max} })`\n }\n\n if (max !== undefined) {\n return `faker.number.float({ max: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.number.float({ min: ${min} })`\n }\n\n return 'faker.number.float()'\n },\n integer: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.number.int({ min: ${min}, max: ${max} })`\n }\n\n if (max !== undefined) {\n return `faker.number.int({ max: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.number.int({ min: ${min} })`\n }\n\n return 'faker.number.int()'\n },\n bigint: () => 'faker.number.bigInt()',\n string: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.string.alpha({ length: { min: ${min}, max: ${max} } })`\n }\n\n if (max !== undefined) {\n return `faker.string.alpha({ length: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.string.alpha({ length: ${min} })`\n }\n\n return 'faker.string.alpha()'\n },\n boolean: () => 'faker.datatype.boolean()',\n undefined: () => 'undefined',\n null: () => 'null',\n array: (items: string[] = [], min?: number, max?: number) => {\n if (items.length > 1) {\n return `faker.helpers.arrayElements([${items.join(', ')}])`\n }\n const item = items.at(0)\n\n if (min !== undefined && max !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: { min: ${min}, max: ${max} }})`\n }\n if (min !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: ${min} })`\n }\n if (max !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: { min: 0, max: ${max} }})`\n }\n\n return `faker.helpers.multiple(() => (${item}))`\n },\n tuple: (items: string[] = []) => `[${items.join(', ')}]`,\n enum: (items: Array<string | number | boolean | undefined> = [], type = 'any') => `faker.helpers.arrayElement<${type}>([${items.join(', ')}])`,\n union: (items: string[] = []) => `faker.helpers.arrayElement<any>([${items.join(', ')}])`,\n /**\n * ISO 8601\n */\n datetime: () => 'faker.date.anytime().toISOString()',\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', parser: Options['dateParser'] = 'faker') => {\n if (type === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"YYYY-MM-DD\")`\n }\n return 'faker.date.anytime().toISOString().substring(0, 10)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${type}' and parser '${parser}' can not work together`)\n }\n\n return 'faker.date.anytime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', parser: Options['dateParser'] = 'faker') => {\n if (type === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"HH:mm:ss\")`\n }\n return 'faker.date.anytime().toISOString().substring(11, 19)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${type}' and parser '${parser}' can not work together`)\n }\n\n return 'faker.date.anytime()'\n },\n uuid: () => 'faker.string.uuid()',\n url: () => 'faker.internet.url()',\n and: (items: string[] = []) => {\n // Handle empty array case\n if (items.length === 0) {\n return '{}'\n }\n\n // If only one item, return it as-is (no need to spread)\n // This fixes the issue with single refs to primitives like enums\n if (items.length === 1) {\n return items[0] ?? '{}'\n }\n\n // If multiple items, spread them together\n // This handles both object literals and multiple refs to objects\n return `{...${items.join(', ...')}}`\n },\n object: () => 'object',\n ref: () => 'ref',\n matches: (value = '', regexGenerator: 'faker' | 'randexp' = 'faker') => {\n if (regexGenerator === 'randexp') {\n return `${toRegExpString(value, 'RandExp')}.gen()`\n }\n return `faker.helpers.fromRegExp(\"${value}\")`\n },\n email: () => 'faker.internet.email()',\n firstName: () => 'faker.person.firstName()',\n lastName: () => 'faker.person.lastName()',\n password: () => 'faker.internet.password()',\n phone: () => 'faker.phone.number()',\n blob: () => 'faker.image.url() as unknown as Blob',\n default: undefined,\n describe: undefined,\n const: (value?: string | number) => (value as string) ?? '',\n max: undefined,\n min: undefined,\n nullable: undefined,\n nullish: undefined,\n optional: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nfunction schemaKeywordSorter(_a: Schema, b: Schema) {\n if (b.keyword === 'null') {\n return -1\n }\n\n return 0\n}\n\nexport function joinItems(items: string[]): string {\n switch (items.length) {\n case 0:\n return 'undefined'\n case 1:\n return items[0]!\n default:\n return fakerKeywordMapper.union(items)\n }\n}\n\ntype ParserOptions = {\n typeName?: string\n rootTypeName?: string\n regexGenerator?: 'faker' | 'randexp'\n canOverride?: boolean\n dateParser?: Options['dateParser']\n mapper?: Record<string, string>\n}\n\nexport const parse = createParser<string, ParserOptions>({\n mapper: fakerKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name, siblings } = tree\n\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return fakerKeywordMapper.union(\n current.args\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n },\n and(tree, options) {\n const { current, schema, siblings } = tree\n\n return fakerKeywordMapper.and(\n current.args\n .map((it) => this.parse({ schema, parent: current, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n },\n array(tree, options) {\n const { current, schema } = tree\n\n return fakerKeywordMapper.array(\n current.args.items\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n current: it,\n siblings: current.args.items,\n },\n {\n ...options,\n typeName: `NonNullable<${options.typeName}>[number]`,\n canOverride: false,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n current.args.min,\n current.args.max,\n )\n },\n enum(tree, options) {\n const { current, parent, name } = tree\n\n const isParentTuple = parent ? isKeyword(parent, schemaKeywords.tuple) : false\n\n if (isParentTuple) {\n return fakerKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'number') {\n return schema.value\n }\n\n if (schema.format === 'boolean') {\n return schema.value\n }\n return stringify(schema.value)\n }),\n )\n }\n\n return fakerKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'number') {\n return schema.value\n }\n if (schema.format === 'boolean') {\n return schema.value\n }\n return stringify(schema.value)\n }),\n // TODO replace this with getEnumNameFromSchema\n name ? options.typeName : undefined,\n )\n },\n ref(tree, options) {\n const { current, parent } = tree\n\n if (!current.args?.name) {\n throw new Error(`Name not defined for keyword ${current.keyword}`)\n }\n\n // Check if this is a self-referencing type (prevents infinite recursion)\n // The rootTypeName is the function name being generated (e.g., \"createNode\")\n // The current.args.name is the ref function name (e.g., \"createNode\")\n const isSelfReferencing = options.rootTypeName && current.args.name === options.rootTypeName\n\n if (isSelfReferencing) {\n // For self-referencing types, return undefined to prevent infinite recursion\n // This will result in empty arrays/objects by default\n return 'undefined as any'\n }\n\n // Check if the parent is an object or and keyword - in these cases, we don't want to pass data\n // because it would incorrectly forward the parent's data to a nested ref\n const isNestedInObjectOrAnd = parent && (isKeyword(parent, schemaKeywords.object) || isKeyword(parent, schemaKeywords.and))\n\n if (options.canOverride && !isNestedInObjectOrAnd) {\n return `${current.args.name}(data)`\n }\n\n return `${current.args.name}()`\n },\n object(tree, options) {\n const { current, schema } = tree\n\n const argsObject = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schema = item[1]\n return schema && typeof schema.map === 'function'\n })\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return `\"${name}\": ${options.mapper?.[mappedName]}`\n }\n\n return `\"${name}\": ${joinItems(\n schemas\n .sort(schemaKeywordSorter)\n .map((it) =>\n this.parse(\n {\n schema,\n name,\n parent: current,\n current: it,\n siblings: schemas,\n },\n {\n ...options,\n typeName: `NonNullable<${options.typeName}>[${JSON.stringify(name)}]`,\n canOverride: false,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n )}`\n })\n .join(',')\n\n return `{${argsObject}}`\n },\n tuple(tree, options) {\n const { current, schema, siblings } = tree\n\n if (Array.isArray(current.args.items)) {\n return fakerKeywordMapper.tuple(\n current.args.items\n .map((it) => this.parse({ schema, parent: current, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n }\n\n return this.parse({ schema, parent: current, current: current.args.items, siblings }, { ...options, canOverride: false })\n },\n const(tree, _options) {\n const { current } = tree\n\n if (current.args.format === 'number' && current.args.name !== undefined) {\n return fakerKeywordMapper.const(current.args.name?.toString())\n }\n return fakerKeywordMapper.const(stringify(current.args.value))\n },\n matches(tree, options) {\n const { current } = tree\n\n if (current.args) {\n return fakerKeywordMapper.matches(current.args, options.regexGenerator)\n }\n return undefined\n },\n null() {\n return fakerKeywordMapper.null()\n },\n undefined() {\n return fakerKeywordMapper.undefined()\n },\n any() {\n return fakerKeywordMapper.any()\n },\n string(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.string(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.string()\n },\n number(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.number(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.number()\n },\n integer(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.integer(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.integer()\n },\n bigint(_tree, _options) {\n return fakerKeywordMapper.bigint()\n },\n datetime() {\n return fakerKeywordMapper.datetime()\n },\n date(tree, options) {\n const { current } = tree\n\n return fakerKeywordMapper.date(current.args.type, options.dateParser)\n },\n time(tree, options) {\n const { current } = tree\n\n return fakerKeywordMapper.time(current.args.type, options.dateParser)\n },\n },\n})\n","import { jsStringEscape } from '@internals/utils'\nimport type { Schema } from '@kubb/plugin-oas'\nimport { isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport * as parserFaker from '../parser.ts'\nimport type { PluginFaker } from '../types.ts'\n\ntype Props = {\n name: string\n typeName: string\n tree: Array<Schema>\n seed?: PluginFaker['options']['seed']\n description?: string\n regexGenerator?: PluginFaker['options']['regexGenerator']\n mapper?: PluginFaker['options']['mapper']\n dateParser?: PluginFaker['options']['dateParser']\n canOverride: boolean\n}\n\nexport function Faker({ tree, description, name, typeName, seed, regexGenerator, canOverride, mapper, dateParser }: Props): FabricReactNode {\n const fakerText = parserFaker.joinItems(\n tree\n .map((schema, _index, siblings) =>\n parserFaker.parse(\n { name, schema, parent: undefined, current: schema, siblings },\n {\n typeName,\n rootTypeName: name,\n regexGenerator,\n mapper,\n canOverride,\n dateParser,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n )\n\n const isArray = fakerText.startsWith('faker.helpers.arrayElements') || fakerText.startsWith('faker.helpers.multiple')\n const isRefToArray = tree.some((s) => isKeyword(s, schemaKeywords.schema) && s.args.type === 'array')\n const isObject = fakerText.startsWith('{')\n const isTuple = fakerText.startsWith('faker.helpers.arrayElement')\n\n const isSimpleString = name === 'string'\n const isSimpleInt = name === 'integer'\n const isSimpleFloat = name === 'float'\n\n let fakerTextWithOverride = fakerText\n\n if (canOverride && isObject) {\n fakerTextWithOverride = `{\n ...${fakerText},\n ...data || {}\n}`\n }\n\n if (canOverride && isTuple) fakerTextWithOverride = `data || ${fakerText}`\n\n if (canOverride && isArray) {\n fakerTextWithOverride = `[\n ...${fakerText},\n ...data || []\n ]`\n }\n\n if (canOverride && isSimpleString) fakerTextWithOverride = 'data ?? faker.string.alpha()'\n\n if (canOverride && isSimpleInt) fakerTextWithOverride = 'data ?? faker.number.int()'\n\n if (canOverride && isSimpleFloat) fakerTextWithOverride = 'data ?? faker.number.float()'\n\n let type = `Partial<${typeName}>`\n\n if (isArray) type = typeName\n if (isRefToArray) type = typeName\n if (isSimpleString) type = name\n if (isSimpleInt || isSimpleFloat) type = 'number'\n\n const params = FunctionParams.factory({\n data: {\n // making a partial out of an array does not make sense\n type,\n optional: true,\n },\n })\n\n let returnType = canOverride ? typeName : undefined\n\n if (isSimpleString || isSimpleInt || isSimpleFloat) returnType = type\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: [description ? `@description ${jsStringEscape(description)}` : undefined].filter(Boolean) }}\n params={canOverride ? params.toConstructor() : undefined}\n returnType={returnType}\n >\n {seed ? `faker.seed(${JSON.stringify(seed)})` : undefined}\n <br />\n {`return ${fakerTextWithOverride}`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,SAAgB,WAAW,MAAsB;AAC/C,KAAI,KAAK,UAAU,GAAG;EACpB,MAAM,QAAQ,KAAK;EACnB,MAAM,OAAO,KAAK,KAAK,SAAS;AAChC,MAAK,UAAU,QAAO,SAAS,QAAS,UAAU,OAAO,SAAS,OAAS,UAAU,OAAO,SAAS,IACnG,QAAO,KAAK,MAAM,GAAG,GAAG;;AAG5B,QAAO;;;;;;;;;;;;;AAcT,SAAgB,eAAe,OAAwB;AACrD,QAAO,GAAG,QAAQ,QAAQ,4BAA4B,cAAc;AAClE,UAAQ,WAAR;GACE,KAAK;GACL,KAAK;GACL,KAAK,KACH,QAAO,KAAK;GACd,KAAK,KAC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AI;CAC1C,MAAM,UAAU,UAAU,WAAW,6BAA6B;CAElE,MAAM,iBAAiB,SAAS;CAChC,MAAM,cAAc,SAAS;CAC7B,MAAM,gBAAgB,SAAS;CAE/B,IAAI,wBAAwB;AAE5B,KAAI,eAAe,SACjB,yBAAwB;OACrB,UAAU;;;AAKf,KAAI,eAAe,QAAS,yBAAwB,WAAW;AAE/D,KAAI,eAAe,QACjB,yBAAwB;WACjB,UAAU;;;AAKnB,KAAI,eAAe,eAAgB,yBAAwB;AAE3D,KAAI,eAAe,YAAa,yBAAwB;AAExD,KAAI,eAAe,cAAe,yBAAwB;CAE1D,IAAI,OAAO,WAAW,SAAS;AAE/B,KAAI,QAAS,QAAO;AACpB,KAAI,aAAc,QAAO;AACzB,KAAI,eAAgB,QAAO;AAC3B,KAAI,eAAe,cAAe,QAAO;CAEzC,MAAM,SAAS,eAAe,QAAQ,EACpC,MAAM;EAEJ;EACA,UAAU;EACX,EACF,CAAC;CAEF,IAAI,aAAa,cAAc,WAAW,KAAA;AAE1C,KAAI,kBAAkB,eAAe,cAAe,cAAa;AAEjE,QACE,oBAAC,KAAK,QAAN;EAAmB;EAAM,cAAA;EAAa,aAAA;YACpC,qBAAC,UAAD;GACE,QAAA;GACM;GACN,OAAO,EAAE,UAAU,CAAC,cAAc,gBAAgB,eAAe,YAAY,KAAK,KAAA,EAAU,CAAC,OAAO,QAAQ,EAAE;GAC9G,QAAQ,cAAc,OAAO,eAAe,GAAG,KAAA;GACnC;aALd;IAOG,OAAO,cAAc,KAAK,UAAU,KAAK,CAAC,KAAK,KAAA;IAChD,oBAAC,MAAD,EAAM,CAAA;IACL,UAAU;IACF;;EACC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"components-Cmw1Lygb.cjs","names":["schemaKeywords","parserFaker.joinItems","parserFaker.parse","schemaKeywords","FunctionParams","File","Function"],"sources":["../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../../../internals/utils/src/regexp.ts","../src/parser.ts","../src/components/Faker.tsx"],"sourcesContent":["/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Returns a masked version of a string, showing only the first and last few characters.\n * Useful for logging sensitive values (tokens, keys) without exposing the full value.\n *\n * @example\n * maskString('KUBB_STUDIO-abc123-xyz789') // 'KUBB_STUDIO-…789'\n */\nexport function maskString(value: string, start = 8, end = 4): string {\n if (value.length <= start + end) return value\n return `${value.slice(0, start)}…${value.slice(-end)}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Strips functions, symbols, and `undefined` values from plugin options for safe JSON transport.\n *\n * @example\n * ```ts\n * serializePluginOptions({ output: './src', onWrite: () => {} })\n * // { output: './src' } (function stripped)\n * ```\n */\nexport function serializePluginOptions<TOptions extends object>(options: TOptions): TOptions {\n if (options === null || options === undefined) return {} as TOptions\n if (typeof options !== 'object') return options\n if (Array.isArray(options)) return options.map(serializePluginOptions) as unknown as TOptions\n\n const serialized: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(options)) {\n if (typeof value === 'function' || typeof value === 'symbol' || value === undefined) continue\n serialized[key] = value !== null && typeof value === 'object' ? serializePluginOptions(value as object) : value\n }\n return serialized as TOptions\n}\n\n/**\n * Strips all `undefined` values from an object recursively by round-tripping through JSON.\n * Useful for clean inline snapshot assertions that only show fields with actual values.\n *\n * @example\n * toSnapshot({ kind: 'Schema', name: undefined, type: 'string' })\n * // { kind: 'Schema', type: 'string' }\n */\nexport function toSnapshot<T>(value: T): T {\n return JSON.parse(JSON.stringify(value))\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as `^(?im)` prefixes are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * toRegExpString('^(?im)foo') // → 'new RegExp(\"foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // → '/foo/im'\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = new RegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","import { stringify, toRegExpString } from '@internals/utils'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, findSchemaKeyword, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type { Options } from './types.ts'\n\nconst fakerKeywordMapper = {\n any: () => 'undefined',\n unknown: () => 'undefined',\n void: () => 'undefined',\n number: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.number.float({ min: ${min}, max: ${max} })`\n }\n\n if (max !== undefined) {\n return `faker.number.float({ max: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.number.float({ min: ${min} })`\n }\n\n return 'faker.number.float()'\n },\n integer: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.number.int({ min: ${min}, max: ${max} })`\n }\n\n if (max !== undefined) {\n return `faker.number.int({ max: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.number.int({ min: ${min} })`\n }\n\n return 'faker.number.int()'\n },\n bigint: () => 'faker.number.bigInt()',\n string: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.string.alpha({ length: { min: ${min}, max: ${max} } })`\n }\n\n if (max !== undefined) {\n return `faker.string.alpha({ length: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.string.alpha({ length: ${min} })`\n }\n\n return 'faker.string.alpha()'\n },\n boolean: () => 'faker.datatype.boolean()',\n undefined: () => 'undefined',\n null: () => 'null',\n array: (items: string[] = [], min?: number, max?: number) => {\n if (items.length > 1) {\n return `faker.helpers.arrayElements([${items.join(', ')}])`\n }\n const item = items.at(0)\n\n if (min !== undefined && max !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: { min: ${min}, max: ${max} }})`\n }\n if (min !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: ${min} })`\n }\n if (max !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: { min: 0, max: ${max} }})`\n }\n\n return `faker.helpers.multiple(() => (${item}))`\n },\n tuple: (items: string[] = []) => `[${items.join(', ')}]`,\n enum: (items: Array<string | number | boolean | undefined> = [], type = 'any') => `faker.helpers.arrayElement<${type}>([${items.join(', ')}])`,\n union: (items: string[] = []) => `faker.helpers.arrayElement<any>([${items.join(', ')}])`,\n /**\n * ISO 8601\n */\n datetime: () => 'faker.date.anytime().toISOString()',\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', parser: Options['dateParser'] = 'faker') => {\n if (type === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"YYYY-MM-DD\")`\n }\n return 'faker.date.anytime().toISOString().substring(0, 10)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${type}' and parser '${parser}' can not work together`)\n }\n\n return 'faker.date.anytime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', parser: Options['dateParser'] = 'faker') => {\n if (type === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"HH:mm:ss\")`\n }\n return 'faker.date.anytime().toISOString().substring(11, 19)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${type}' and parser '${parser}' can not work together`)\n }\n\n return 'faker.date.anytime()'\n },\n uuid: () => 'faker.string.uuid()',\n url: () => 'faker.internet.url()',\n and: (items: string[] = []) => {\n // Handle empty array case\n if (items.length === 0) {\n return '{}'\n }\n\n // If only one item, return it as-is (no need to spread)\n // This fixes the issue with single refs to primitives like enums\n if (items.length === 1) {\n return items[0] ?? '{}'\n }\n\n // If multiple items, spread them together\n // This handles both object literals and multiple refs to objects\n return `{...${items.join(', ...')}}`\n },\n object: () => 'object',\n ref: () => 'ref',\n matches: (value = '', regexGenerator: 'faker' | 'randexp' = 'faker') => {\n if (regexGenerator === 'randexp') {\n return `${toRegExpString(value, 'RandExp')}.gen()`\n }\n return `faker.helpers.fromRegExp(\"${value}\")`\n },\n email: () => 'faker.internet.email()',\n firstName: () => 'faker.person.firstName()',\n lastName: () => 'faker.person.lastName()',\n password: () => 'faker.internet.password()',\n phone: () => 'faker.phone.number()',\n blob: () => 'faker.image.url() as unknown as Blob',\n default: undefined,\n describe: undefined,\n const: (value?: string | number) => (value as string) ?? '',\n max: undefined,\n min: undefined,\n nullable: undefined,\n nullish: undefined,\n optional: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nfunction schemaKeywordSorter(_a: Schema, b: Schema) {\n if (b.keyword === 'null') {\n return -1\n }\n\n return 0\n}\n\nexport function joinItems(items: string[]): string {\n switch (items.length) {\n case 0:\n return 'undefined'\n case 1:\n return items[0]!\n default:\n return fakerKeywordMapper.union(items)\n }\n}\n\ntype ParserOptions = {\n typeName?: string\n rootTypeName?: string\n regexGenerator?: 'faker' | 'randexp'\n canOverride?: boolean\n dateParser?: Options['dateParser']\n mapper?: Record<string, string>\n}\n\nexport const parse = createParser<string, ParserOptions>({\n mapper: fakerKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name, siblings } = tree\n\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return fakerKeywordMapper.union(\n current.args\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n },\n and(tree, options) {\n const { current, schema, siblings } = tree\n\n return fakerKeywordMapper.and(\n current.args\n .map((it) => this.parse({ schema, parent: current, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n },\n array(tree, options) {\n const { current, schema } = tree\n\n return fakerKeywordMapper.array(\n current.args.items\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n current: it,\n siblings: current.args.items,\n },\n {\n ...options,\n typeName: `NonNullable<${options.typeName}>[number]`,\n canOverride: false,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n current.args.min,\n current.args.max,\n )\n },\n enum(tree, options) {\n const { current, parent, name } = tree\n\n const isParentTuple = parent ? isKeyword(parent, schemaKeywords.tuple) : false\n\n if (isParentTuple) {\n return fakerKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'number') {\n return schema.value\n }\n\n if (schema.format === 'boolean') {\n return schema.value\n }\n return stringify(schema.value)\n }),\n )\n }\n\n return fakerKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'number') {\n return schema.value\n }\n if (schema.format === 'boolean') {\n return schema.value\n }\n return stringify(schema.value)\n }),\n // TODO replace this with getEnumNameFromSchema\n name ? options.typeName : undefined,\n )\n },\n ref(tree, options) {\n const { current, parent } = tree\n\n if (!current.args?.name) {\n throw new Error(`Name not defined for keyword ${current.keyword}`)\n }\n\n // Check if this is a self-referencing type (prevents infinite recursion)\n // The rootTypeName is the function name being generated (e.g., \"createNode\")\n // The current.args.name is the ref function name (e.g., \"createNode\")\n const isSelfReferencing = options.rootTypeName && current.args.name === options.rootTypeName\n\n if (isSelfReferencing) {\n // For self-referencing types, return undefined to prevent infinite recursion\n // This will result in empty arrays/objects by default\n return 'undefined as any'\n }\n\n // Check if the parent is an object or and keyword - in these cases, we don't want to pass data\n // because it would incorrectly forward the parent's data to a nested ref\n const isNestedInObjectOrAnd = parent && (isKeyword(parent, schemaKeywords.object) || isKeyword(parent, schemaKeywords.and))\n\n if (options.canOverride && !isNestedInObjectOrAnd) {\n return `${current.args.name}(data)`\n }\n\n return `${current.args.name}()`\n },\n object(tree, options) {\n const { current, schema } = tree\n\n const argsObject = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schema = item[1]\n return schema && typeof schema.map === 'function'\n })\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return `\"${name}\": ${options.mapper?.[mappedName]}`\n }\n\n return `\"${name}\": ${joinItems(\n schemas\n .sort(schemaKeywordSorter)\n .map((it) =>\n this.parse(\n {\n schema,\n name,\n parent: current,\n current: it,\n siblings: schemas,\n },\n {\n ...options,\n typeName: `NonNullable<${options.typeName}>[${JSON.stringify(name)}]`,\n canOverride: false,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n )}`\n })\n .join(',')\n\n return `{${argsObject}}`\n },\n tuple(tree, options) {\n const { current, schema, siblings } = tree\n\n if (Array.isArray(current.args.items)) {\n return fakerKeywordMapper.tuple(\n current.args.items\n .map((it) => this.parse({ schema, parent: current, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n }\n\n return this.parse({ schema, parent: current, current: current.args.items, siblings }, { ...options, canOverride: false })\n },\n const(tree, _options) {\n const { current } = tree\n\n if (current.args.format === 'number' && current.args.name !== undefined) {\n return fakerKeywordMapper.const(current.args.name?.toString())\n }\n return fakerKeywordMapper.const(stringify(current.args.value))\n },\n matches(tree, options) {\n const { current } = tree\n\n if (current.args) {\n return fakerKeywordMapper.matches(current.args, options.regexGenerator)\n }\n return undefined\n },\n null() {\n return fakerKeywordMapper.null()\n },\n undefined() {\n return fakerKeywordMapper.undefined()\n },\n any() {\n return fakerKeywordMapper.any()\n },\n string(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.string(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.string()\n },\n number(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.number(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.number()\n },\n integer(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.integer(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.integer()\n },\n bigint(_tree, _options) {\n return fakerKeywordMapper.bigint()\n },\n datetime() {\n return fakerKeywordMapper.datetime()\n },\n date(tree, options) {\n const { current } = tree\n\n return fakerKeywordMapper.date(current.args.type, options.dateParser)\n },\n time(tree, options) {\n const { current } = tree\n\n return fakerKeywordMapper.time(current.args.type, options.dateParser)\n },\n },\n})\n","import { jsStringEscape } from '@internals/utils'\nimport type { Schema } from '@kubb/plugin-oas'\nimport { isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport * as parserFaker from '../parser.ts'\nimport type { PluginFaker } from '../types.ts'\n\ntype Props = {\n name: string\n typeName: string\n tree: Array<Schema>\n seed?: PluginFaker['options']['seed']\n description?: string\n regexGenerator?: PluginFaker['options']['regexGenerator']\n mapper?: PluginFaker['options']['mapper']\n dateParser?: PluginFaker['options']['dateParser']\n canOverride: boolean\n}\n\nexport function Faker({ tree, description, name, typeName, seed, regexGenerator, canOverride, mapper, dateParser }: Props): FabricReactNode {\n const fakerText = parserFaker.joinItems(\n tree\n .map((schema, _index, siblings) =>\n parserFaker.parse(\n { name, schema, parent: undefined, current: schema, siblings },\n {\n typeName,\n rootTypeName: name,\n regexGenerator,\n mapper,\n canOverride,\n dateParser,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n )\n\n const isArray = fakerText.startsWith('faker.helpers.arrayElements') || fakerText.startsWith('faker.helpers.multiple')\n const isRefToArray = tree.some((s) => isKeyword(s, schemaKeywords.schema) && s.args.type === 'array')\n const isObject = fakerText.startsWith('{')\n const isTuple = fakerText.startsWith('faker.helpers.arrayElement')\n\n const isSimpleString = name === 'string'\n const isSimpleInt = name === 'integer'\n const isSimpleFloat = name === 'float'\n\n let fakerTextWithOverride = fakerText\n\n if (canOverride && isObject) {\n fakerTextWithOverride = `{\n ...${fakerText},\n ...data || {}\n}`\n }\n\n if (canOverride && isTuple) fakerTextWithOverride = `data || ${fakerText}`\n\n if (canOverride && isArray) {\n fakerTextWithOverride = `[\n ...${fakerText},\n ...data || []\n ]`\n }\n\n if (canOverride && isSimpleString) fakerTextWithOverride = 'data ?? faker.string.alpha()'\n\n if (canOverride && isSimpleInt) fakerTextWithOverride = 'data ?? faker.number.int()'\n\n if (canOverride && isSimpleFloat) fakerTextWithOverride = 'data ?? faker.number.float()'\n\n let type = `Partial<${typeName}>`\n\n if (isArray) type = typeName\n if (isRefToArray) type = typeName\n if (isSimpleString) type = name\n if (isSimpleInt || isSimpleFloat) type = 'number'\n\n const params = FunctionParams.factory({\n data: {\n // making a partial out of an array does not make sense\n type,\n optional: true,\n },\n })\n\n let returnType = canOverride ? typeName : undefined\n\n if (isSimpleString || isSimpleInt || isSimpleFloat) returnType = type\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: [description ? `@description ${jsStringEscape(description)}` : undefined].filter(Boolean) }}\n params={canOverride ? params.toConstructor() : undefined}\n returnType={returnType}\n >\n {seed ? `faker.seed(${JSON.stringify(seed)})` : undefined}\n <br />\n {`return ${fakerTextWithOverride}`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAgB,WAAW,MAAsB;AAC/C,KAAI,KAAK,UAAU,GAAG;EACpB,MAAM,QAAQ,KAAK;EACnB,MAAM,OAAO,KAAK,KAAK,SAAS;AAChC,MAAK,UAAU,QAAO,SAAS,QAAS,UAAU,OAAO,SAAS,OAAS,UAAU,OAAO,SAAS,IACnG,QAAO,KAAK,MAAM,GAAG,GAAG;;AAG5B,QAAO;;;;;;;;;;;;;AAcT,SAAgB,eAAe,OAAwB;AACrD,QAAO,GAAG,QAAQ,QAAQ,4BAA4B,cAAc;AAClE,UAAQ,WAAR;GACE,KAAK;GACL,KAAK;GACL,KAAK,KACH,QAAO,KAAK;GACd,KAAK,KACH,QAAO;GACT,KAAK,KACH,QAAO;GACT,KAAK,SACH,QAAO;GACT,KAAK,SACH,QAAO;GACT,QACE,QAAO;;GAEX;;;;;;;;;;;ACvCJ,SAAgB,UAAU,OAAsD;AAC9E,KAAI,UAAU,KAAA,KAAa,UAAU,KAAM,QAAO;AAClD,QAAO,KAAK,UAAU,WAAW,MAAM,UAAU,CAAC,CAAC;;;;;;;;;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AAiB,SAAS;CAChC,MAAM,cAAc,SAAS;CAC7B,MAAM,gBAAgB,SAAS;CAE/B,IAAI,wBAAwB;AAE5B,KAAI,eAAe,SACjB,yBAAwB;OACrB,UAAU;;;AAKf,KAAI,eAAe,QAAS,yBAAwB,WAAW;AAE/D,KAAI,eAAe,QACjB,yBAAwB;WACjB,UAAU;;;AAKnB,KAAI,eAAe,eAAgB,yBAAwB;AAE3D,KAAI,eAAe,YAAa,yBAAwB;AAExD,KAAI,eAAe,cAAe,yBAAwB;CAE1D,IAAI,OAAO,WAAW,SAAS;AAE/B,KAAI,QAAS,QAAO;AACpB,KAAI,aAAc,QAAO;AACzB,KAAI,eAAgB,QAAO;AAC3B,KAAI,eAAe,cAAe,QAAO;CAEzC,MAAM,SAASC,mBAAAA,eAAe,QAAQ,EACpC,MAAM;EAEJ;EACA,UAAU;EACX,EACF,CAAC;CAEF,IAAI,aAAa,cAAc,WAAW,KAAA;AAE1C,KAAI,kBAAkB,eAAe,cAAe,cAAa;AAEjE,QACE,iBAAA,GAAA,+BAAA,KAACC,mBAAAA,KAAK,QAAN;EAAmB;EAAM,cAAA;EAAa,aAAA;YACpC,iBAAA,GAAA,+BAAA,MAACC,mBAAAA,UAAD;GACE,QAAA;GACM;GACN,OAAO,EAAE,UAAU,CAAC,cAAc,gBAAgB,eAAe,YAAY,KAAK,KAAA,EAAU,CAAC,OAAO,QAAQ,EAAE;GAC9G,QAAQ,cAAc,OAAO,eAAe,GAAG,KAAA;GACnC;aALd;IAOG,OAAO,cAAc,KAAK,UAAU,KAAK,CAAC,KAAK,KAAA;IAChD,iBAAA,GAAA,+BAAA,KAAC,MAAD,EAAM,CAAA;IACL,UAAU;IACF;;EACC,CAAA"}
1
+ {"version":3,"file":"components-Cmw1Lygb.cjs","names":["schemaKeywords","parserFaker.joinItems","parserFaker.parse","schemaKeywords","FunctionParams","File","Function"],"sources":["../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../../../internals/utils/src/regexp.ts","../src/parser.ts","../src/components/Faker.tsx"],"sourcesContent":["/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Returns a masked version of a string, showing only the first and last few characters.\n * Useful for logging sensitive values (tokens, keys) without exposing the full value.\n *\n * @example\n * maskString('KUBB_STUDIO-abc123-xyz789') // 'KUBB_STUDIO-…789'\n */\nexport function maskString(value: string, start = 8, end = 4): string {\n if (value.length <= start + end) return value\n return `${value.slice(0, start)}…${value.slice(-end)}`\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Strips functions, symbols, and `undefined` values from plugin options for safe JSON transport.\n *\n * @example\n * ```ts\n * serializePluginOptions({ output: './src', onWrite: () => {} })\n * // { output: './src' } (function stripped)\n * ```\n */\nexport function serializePluginOptions<TOptions extends object>(options: TOptions): TOptions {\n if (options === null || options === undefined) return {} as TOptions\n if (typeof options !== 'object') return options\n if (Array.isArray(options)) return options.map(serializePluginOptions) as unknown as TOptions\n\n const serialized: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(options)) {\n if (typeof value === 'function' || typeof value === 'symbol' || value === undefined) continue\n serialized[key] = value !== null && typeof value === 'object' ? serializePluginOptions(value as object) : value\n }\n return serialized as TOptions\n}\n\n/**\n * Strips all `undefined` values from an object recursively by round-tripping through JSON.\n * Useful for clean inline snapshot assertions that only show fields with actual values.\n *\n * @example\n * toSnapshot({ kind: 'Schema', name: undefined, type: 'string' })\n * // { kind: 'Schema', type: 'string' }\n */\nexport function toSnapshot<T>(value: T): T {\n return JSON.parse(JSON.stringify(value))\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as `^(?im)` prefixes are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * toRegExpString('^(?im)foo') // → 'new RegExp(\"foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // → '/foo/im'\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = new RegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n","import { stringify, toRegExpString } from '@internals/utils'\nimport type { Schema, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, findSchemaKeyword, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type { Options } from './types.ts'\n\nconst fakerKeywordMapper = {\n any: () => 'undefined',\n unknown: () => 'undefined',\n void: () => 'undefined',\n number: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.number.float({ min: ${min}, max: ${max} })`\n }\n\n if (max !== undefined) {\n return `faker.number.float({ max: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.number.float({ min: ${min} })`\n }\n\n return 'faker.number.float()'\n },\n integer: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.number.int({ min: ${min}, max: ${max} })`\n }\n\n if (max !== undefined) {\n return `faker.number.int({ max: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.number.int({ min: ${min} })`\n }\n\n return 'faker.number.int()'\n },\n bigint: () => 'faker.number.bigInt()',\n string: (min?: number, max?: number) => {\n if (max !== undefined && min !== undefined) {\n return `faker.string.alpha({ length: { min: ${min}, max: ${max} } })`\n }\n\n if (max !== undefined) {\n return `faker.string.alpha({ length: ${max} })`\n }\n\n if (min !== undefined) {\n return `faker.string.alpha({ length: ${min} })`\n }\n\n return 'faker.string.alpha()'\n },\n boolean: () => 'faker.datatype.boolean()',\n undefined: () => 'undefined',\n null: () => 'null',\n array: (items: string[] = [], min?: number, max?: number) => {\n if (items.length > 1) {\n return `faker.helpers.arrayElements([${items.join(', ')}])`\n }\n const item = items.at(0)\n\n if (min !== undefined && max !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: { min: ${min}, max: ${max} }})`\n }\n if (min !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: ${min} })`\n }\n if (max !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: { min: 0, max: ${max} }})`\n }\n\n return `faker.helpers.multiple(() => (${item}))`\n },\n tuple: (items: string[] = []) => `[${items.join(', ')}]`,\n enum: (items: Array<string | number | boolean | undefined> = [], type = 'any') => `faker.helpers.arrayElement<${type}>([${items.join(', ')}])`,\n union: (items: string[] = []) => `faker.helpers.arrayElement<any>([${items.join(', ')}])`,\n /**\n * ISO 8601\n */\n datetime: () => 'faker.date.anytime().toISOString()',\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', parser: Options['dateParser'] = 'faker') => {\n if (type === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"YYYY-MM-DD\")`\n }\n return 'faker.date.anytime().toISOString().substring(0, 10)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${type}' and parser '${parser}' can not work together`)\n }\n\n return 'faker.date.anytime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', parser: Options['dateParser'] = 'faker') => {\n if (type === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"HH:mm:ss\")`\n }\n return 'faker.date.anytime().toISOString().substring(11, 19)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${type}' and parser '${parser}' can not work together`)\n }\n\n return 'faker.date.anytime()'\n },\n uuid: () => 'faker.string.uuid()',\n url: () => 'faker.internet.url()',\n and: (items: string[] = []) => {\n // Handle empty array case\n if (items.length === 0) {\n return '{}'\n }\n\n // If only one item, return it as-is (no need to spread)\n // This fixes the issue with single refs to primitives like enums\n if (items.length === 1) {\n return items[0] ?? '{}'\n }\n\n // If multiple items, spread them together\n // This handles both object literals and multiple refs to objects\n return `{...${items.join(', ...')}}`\n },\n object: () => 'object',\n ref: () => 'ref',\n matches: (value = '', regexGenerator: 'faker' | 'randexp' = 'faker') => {\n if (regexGenerator === 'randexp') {\n return `${toRegExpString(value, 'RandExp')}.gen()`\n }\n return `faker.helpers.fromRegExp(\"${value}\")`\n },\n email: () => 'faker.internet.email()',\n firstName: () => 'faker.person.firstName()',\n lastName: () => 'faker.person.lastName()',\n password: () => 'faker.internet.password()',\n phone: () => 'faker.phone.number()',\n blob: () => 'faker.image.url() as unknown as Blob',\n default: undefined,\n describe: undefined,\n const: (value?: string | number) => (value as string) ?? '',\n max: undefined,\n min: undefined,\n nullable: undefined,\n nullish: undefined,\n optional: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nfunction schemaKeywordSorter(_a: Schema, b: Schema) {\n if (b.keyword === 'null') {\n return -1\n }\n\n return 0\n}\n\nexport function joinItems(items: string[]): string {\n switch (items.length) {\n case 0:\n return 'undefined'\n case 1:\n return items[0]!\n default:\n return fakerKeywordMapper.union(items)\n }\n}\n\ntype ParserOptions = {\n typeName?: string\n rootTypeName?: string\n regexGenerator?: 'faker' | 'randexp'\n canOverride?: boolean\n dateParser?: Options['dateParser']\n mapper?: Record<string, string>\n}\n\nexport const parse = createParser<string, ParserOptions>({\n mapper: fakerKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name, siblings } = tree\n\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return fakerKeywordMapper.union(\n current.args\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n },\n and(tree, options) {\n const { current, schema, siblings } = tree\n\n return fakerKeywordMapper.and(\n current.args\n .map((it) => this.parse({ schema, parent: current, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n },\n array(tree, options) {\n const { current, schema } = tree\n\n return fakerKeywordMapper.array(\n current.args.items\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n current: it,\n siblings: current.args.items,\n },\n {\n ...options,\n typeName: `NonNullable<${options.typeName}>[number]`,\n canOverride: false,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n current.args.min,\n current.args.max,\n )\n },\n enum(tree, options) {\n const { current, parent, name } = tree\n\n const isParentTuple = parent ? isKeyword(parent, schemaKeywords.tuple) : false\n\n if (isParentTuple) {\n return fakerKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'number') {\n return schema.value\n }\n\n if (schema.format === 'boolean') {\n return schema.value\n }\n return stringify(schema.value)\n }),\n )\n }\n\n return fakerKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'number') {\n return schema.value\n }\n if (schema.format === 'boolean') {\n return schema.value\n }\n return stringify(schema.value)\n }),\n // TODO replace this with getEnumNameFromSchema\n name ? options.typeName : undefined,\n )\n },\n ref(tree, options) {\n const { current, parent } = tree\n\n if (!current.args?.name) {\n throw new Error(`Name not defined for keyword ${current.keyword}`)\n }\n\n // Check if this is a self-referencing type (prevents infinite recursion)\n // The rootTypeName is the function name being generated (e.g., \"createNode\")\n // The current.args.name is the ref function name (e.g., \"createNode\")\n const isSelfReferencing = options.rootTypeName && current.args.name === options.rootTypeName\n\n if (isSelfReferencing) {\n // For self-referencing types, return undefined to prevent infinite recursion\n // This will result in empty arrays/objects by default\n return 'undefined as any'\n }\n\n // Check if the parent is an object or and keyword - in these cases, we don't want to pass data\n // because it would incorrectly forward the parent's data to a nested ref\n const isNestedInObjectOrAnd = parent && (isKeyword(parent, schemaKeywords.object) || isKeyword(parent, schemaKeywords.and))\n\n if (options.canOverride && !isNestedInObjectOrAnd) {\n return `${current.args.name}(data)`\n }\n\n return `${current.args.name}()`\n },\n object(tree, options) {\n const { current, schema } = tree\n\n const argsObject = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schema = item[1]\n return schema && typeof schema.map === 'function'\n })\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n // Use Object.hasOwn to avoid matching inherited properties like 'toString', 'valueOf', etc.\n if (options.mapper && Object.hasOwn(options.mapper, mappedName)) {\n return `\"${name}\": ${options.mapper?.[mappedName]}`\n }\n\n return `\"${name}\": ${joinItems(\n schemas\n .sort(schemaKeywordSorter)\n .map((it) =>\n this.parse(\n {\n schema,\n name,\n parent: current,\n current: it,\n siblings: schemas,\n },\n {\n ...options,\n typeName: `NonNullable<${options.typeName}>[${JSON.stringify(name)}]`,\n canOverride: false,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n )}`\n })\n .join(',')\n\n return `{${argsObject}}`\n },\n tuple(tree, options) {\n const { current, schema, siblings } = tree\n\n if (Array.isArray(current.args.items)) {\n return fakerKeywordMapper.tuple(\n current.args.items\n .map((it) => this.parse({ schema, parent: current, current: it, siblings }, { ...options, canOverride: false }))\n .filter((x): x is string => Boolean(x)),\n )\n }\n\n return this.parse({ schema, parent: current, current: current.args.items, siblings }, { ...options, canOverride: false })\n },\n const(tree, _options) {\n const { current } = tree\n\n if (current.args.format === 'number' && current.args.name !== undefined) {\n return fakerKeywordMapper.const(current.args.name?.toString())\n }\n return fakerKeywordMapper.const(stringify(current.args.value))\n },\n matches(tree, options) {\n const { current } = tree\n\n if (current.args) {\n return fakerKeywordMapper.matches(current.args, options.regexGenerator)\n }\n return undefined\n },\n null() {\n return fakerKeywordMapper.null()\n },\n undefined() {\n return fakerKeywordMapper.undefined()\n },\n any() {\n return fakerKeywordMapper.any()\n },\n string(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.string(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.string()\n },\n number(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.number(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.number()\n },\n integer(tree, _options) {\n const { siblings } = tree\n\n if (siblings) {\n const minSchema = findSchemaKeyword(siblings, 'min')\n const maxSchema = findSchemaKeyword(siblings, 'max')\n\n return fakerKeywordMapper.integer(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.integer()\n },\n bigint(_tree, _options) {\n return fakerKeywordMapper.bigint()\n },\n datetime() {\n return fakerKeywordMapper.datetime()\n },\n date(tree, options) {\n const { current } = tree\n\n return fakerKeywordMapper.date(current.args.type, options.dateParser)\n },\n time(tree, options) {\n const { current } = tree\n\n return fakerKeywordMapper.time(current.args.type, options.dateParser)\n },\n },\n})\n","import { jsStringEscape } from '@internals/utils'\nimport type { Schema } from '@kubb/plugin-oas'\nimport { isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport * as parserFaker from '../parser.ts'\nimport type { PluginFaker } from '../types.ts'\n\ntype Props = {\n name: string\n typeName: string\n tree: Array<Schema>\n seed?: PluginFaker['options']['seed']\n description?: string\n regexGenerator?: PluginFaker['options']['regexGenerator']\n mapper?: PluginFaker['options']['mapper']\n dateParser?: PluginFaker['options']['dateParser']\n canOverride: boolean\n}\n\nexport function Faker({ tree, description, name, typeName, seed, regexGenerator, canOverride, mapper, dateParser }: Props): FabricReactNode {\n const fakerText = parserFaker.joinItems(\n tree\n .map((schema, _index, siblings) =>\n parserFaker.parse(\n { name, schema, parent: undefined, current: schema, siblings },\n {\n typeName,\n rootTypeName: name,\n regexGenerator,\n mapper,\n canOverride,\n dateParser,\n },\n ),\n )\n .filter((x): x is string => Boolean(x)),\n )\n\n const isArray = fakerText.startsWith('faker.helpers.arrayElements') || fakerText.startsWith('faker.helpers.multiple')\n const isRefToArray = tree.some((s) => isKeyword(s, schemaKeywords.schema) && s.args.type === 'array')\n const isObject = fakerText.startsWith('{')\n const isTuple = fakerText.startsWith('faker.helpers.arrayElement')\n\n const isSimpleString = name === 'string'\n const isSimpleInt = name === 'integer'\n const isSimpleFloat = name === 'float'\n\n let fakerTextWithOverride = fakerText\n\n if (canOverride && isObject) {\n fakerTextWithOverride = `{\n ...${fakerText},\n ...data || {}\n}`\n }\n\n if (canOverride && isTuple) fakerTextWithOverride = `data || ${fakerText}`\n\n if (canOverride && isArray) {\n fakerTextWithOverride = `[\n ...${fakerText},\n ...data || []\n ]`\n }\n\n if (canOverride && isSimpleString) fakerTextWithOverride = 'data ?? faker.string.alpha()'\n\n if (canOverride && isSimpleInt) fakerTextWithOverride = 'data ?? faker.number.int()'\n\n if (canOverride && isSimpleFloat) fakerTextWithOverride = 'data ?? faker.number.float()'\n\n let type = `Partial<${typeName}>`\n\n if (isArray) type = typeName\n if (isRefToArray) type = typeName\n if (isSimpleString) type = name\n if (isSimpleInt || isSimpleFloat) type = 'number'\n\n const params = FunctionParams.factory({\n data: {\n // making a partial out of an array does not make sense\n type,\n optional: true,\n },\n })\n\n let returnType = canOverride ? typeName : undefined\n\n if (isSimpleString || isSimpleInt || isSimpleFloat) returnType = type\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n export\n name={name}\n JSDoc={{ comments: [description ? `@description ${jsStringEscape(description)}` : undefined].filter(Boolean) }}\n params={canOverride ? params.toConstructor() : undefined}\n returnType={returnType}\n >\n {seed ? `faker.seed(${JSON.stringify(seed)})` : undefined}\n <br />\n {`return ${fakerTextWithOverride}`}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAgB,WAAW,MAAsB;AAC/C,KAAI,KAAK,UAAU,GAAG;EACpB,MAAM,QAAQ,KAAK;EACnB,MAAM,OAAO,KAAK,KAAK,SAAS;AAChC,MAAK,UAAU,QAAO,SAAS,QAAS,UAAU,OAAO,SAAS,OAAS,UAAU,OAAO,SAAS,IACnG,QAAO,KAAK,MAAM,GAAG,GAAG;;AAG5B,QAAO;;;;;;;;;;;;;AAcT,SAAgB,eAAe,OAAwB;AACrD,QAAO,GAAG,QAAQ,QAAQ,4BAA4B,c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AO,eAAe,GAAG,KAAA;GACnC;aALd;IAOG,OAAO,cAAc,KAAK,UAAU,KAAK,CAAC,KAAK,KAAA;IAChD,iBAAA,GAAA,+BAAA,KAAC,MAAD,EAAM,CAAA;IACL,UAAU;IACF;;EACC,CAAA"}
@@ -21,7 +21,6 @@ const fakerGenerator = createReactGenerator({
21
21
  const file = getFile(operation);
22
22
  const schemas = getSchemas(operation);
23
23
  const schemaGenerator = new SchemaGenerator(options, {
24
- fabric: generator.context.fabric,
25
24
  oas,
26
25
  plugin,
27
26
  events: generator.context.events,
@@ -197,4 +196,4 @@ const fakerGenerator = createReactGenerator({
197
196
  //#endregion
198
197
  export { fakerGenerator as t };
199
198
 
200
- //# sourceMappingURL=fakerGenerator-BviedIXa.js.map
199
+ //# sourceMappingURL=fakerGenerator-GfeyVgyv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fakerGenerator-GfeyVgyv.js","names":[],"sources":["../src/generators/fakerGenerator.tsx"],"sourcesContent":["import { useDriver, useMode } from '@kubb/core/hooks'\nimport { type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { applyParamsCasing, getBanner, getFooter, getImports, isParameterSchema } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Faker } from '../components'\nimport type { PluginFaker } from '../types'\n\nexport const fakerGenerator = createReactGenerator<PluginFaker>({\n name: 'faker',\n Operation({ operation, generator, plugin }) {\n const {\n options,\n options: { dateParser, regexGenerator, seed, mapper },\n } = plugin\n const mode = useMode()\n const driver = useDriver()\n\n const oas = useOas()\n const { getSchemas, getFile, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n oas,\n plugin,\n events: generator.context.events,\n driver,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter((x): x is OperationSchemaType => Boolean(x))\n\n const mapOperationSchema = ({ name, schema, description, ...options }: OperationSchemaType) => {\n // Apply paramsCasing transformation if enabled and this is a parameter schema\n const shouldTransform = isParameterSchema(name) && plugin.options.paramsCasing\n const transformedSchema = shouldTransform ? applyParamsCasing(schema, plugin.options.paramsCasing) : schema\n\n const tree = schemaGenerator.parse({ schema: transformedSchema, name, parentName: null })\n const imports = getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const faker = {\n name: schemaManager.getName(name, { type: 'function' }),\n file: schemaManager.getFile(name),\n }\n\n const type = {\n name: schemaManager.getName(name, { type: 'type', pluginName: pluginTsName }),\n file: schemaManager.getFile(options.operationName || name, { pluginName: pluginTsName, group }),\n }\n\n const canOverride = tree.some(\n ({ keyword }) =>\n keyword === schemaKeywords.array ||\n keyword === schemaKeywords.and ||\n keyword === schemaKeywords.object ||\n keyword === schemaKeywords.union ||\n keyword === schemaKeywords.tuple ||\n keyword === schemaKeywords.enum ||\n keyword === schemaKeywords.ref,\n )\n\n return (\n <>\n {canOverride && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} />\n ))}\n <Faker\n name={faker.name}\n typeName={type.name}\n description={description}\n tree={tree}\n regexGenerator={regexGenerator}\n dateParser={dateParser}\n mapper={mapper}\n seed={seed}\n canOverride={canOverride}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: driver.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ schema, plugin }) {\n const { getName, getFile } = useSchemaManager()\n const {\n options: { output, dateParser, regexGenerator, seed, mapper },\n } = plugin\n const driver = useDriver()\n const oas = useOas()\n const imports = getImports(schema.tree)\n\n const faker = {\n name: getName(schema.name, { type: 'function' }),\n file: getFile(schema.name),\n }\n\n const type = {\n name: getName(schema.name, { type: 'type', pluginName: pluginTsName }),\n file: getFile(schema.name, { pluginName: pluginTsName }),\n }\n\n const canOverride = schema.tree.some(\n ({ keyword }) =>\n keyword === schemaKeywords.array ||\n keyword === schemaKeywords.and ||\n keyword === schemaKeywords.object ||\n keyword === schemaKeywords.union ||\n keyword === schemaKeywords.tuple ||\n keyword === schemaKeywords.ref ||\n keyword === schemaKeywords.enum ||\n keyword === schemaKeywords.string ||\n keyword === schemaKeywords.integer ||\n keyword === schemaKeywords.number,\n )\n\n return (\n <File\n baseName={faker.file.baseName}\n path={faker.file.path}\n meta={faker.file.meta}\n banner={getBanner({ oas, output, config: driver.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n <File.Import isTypeOnly root={faker.file.path} path={type.file.path} name={[type.name]} />\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={faker.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Faker\n name={faker.name}\n typeName={type.name}\n description={schema.value.description}\n tree={schema.tree}\n regexGenerator={regexGenerator}\n dateParser={dateParser}\n mapper={mapper}\n seed={seed}\n canOverride={canOverride}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,iBAAiB,qBAAkC;CAC9D,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AAK;KAAM,MAAM,IAAI;KAAM,MAAM,IAAI;KAAQ,EAAzG;KAAC,IAAI;KAAM,IAAI;KAAM,IAAI;KAAW,CAAC,KAAK,IAAI,CAA2D,CAC3H;IAEF,oBAAC,OAAD;KACE,MAAM,MAAM;KACZ,UAAU,KAAK;KACf,aAAa,OAAO,MAAM;KAC1B,MAAM,OAAO;KACG;KACJ;KACJ;KACF;KACO;KACb,CAAA;IACG;;;CAGZ,CAAC"}
@@ -20,7 +20,6 @@ const fakerGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
20
20
  const file = getFile(operation);
21
21
  const schemas = getSchemas(operation);
22
22
  const schemaGenerator = new _kubb_plugin_oas.SchemaGenerator(options, {
23
- fabric: generator.context.fabric,
24
23
  oas,
25
24
  plugin,
26
25
  events: generator.context.events,
@@ -201,4 +200,4 @@ Object.defineProperty(exports, "fakerGenerator", {
201
200
  }
202
201
  });
203
202
 
204
- //# sourceMappingURL=fakerGenerator-Cqs2pBO4.cjs.map
203
+ //# sourceMappingURL=fakerGenerator-XdArcWbg.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fakerGenerator-XdArcWbg.cjs","names":["SchemaGenerator","pluginTsName","schemaKeywords","File","Faker"],"sources":["../src/generators/fakerGenerator.tsx"],"sourcesContent":["import { useDriver, useMode } from '@kubb/core/hooks'\nimport { type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { applyParamsCasing, getBanner, getFooter, getImports, isParameterSchema } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Faker } from '../components'\nimport type { PluginFaker } from '../types'\n\nexport const fakerGenerator = createReactGenerator<PluginFaker>({\n name: 'faker',\n Operation({ operation, generator, plugin }) {\n const {\n options,\n options: { dateParser, regexGenerator, seed, mapper },\n } = plugin\n const mode = useMode()\n const driver = useDriver()\n\n const oas = useOas()\n const { getSchemas, getFile, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n oas,\n plugin,\n events: generator.context.events,\n driver,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter((x): x is OperationSchemaType => Boolean(x))\n\n const mapOperationSchema = ({ name, schema, description, ...options }: OperationSchemaType) => {\n // Apply paramsCasing transformation if enabled and this is a parameter schema\n const shouldTransform = isParameterSchema(name) && plugin.options.paramsCasing\n const transformedSchema = shouldTransform ? applyParamsCasing(schema, plugin.options.paramsCasing) : schema\n\n const tree = schemaGenerator.parse({ schema: transformedSchema, name, parentName: null })\n const imports = getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const faker = {\n name: schemaManager.getName(name, { type: 'function' }),\n file: schemaManager.getFile(name),\n }\n\n const type = {\n name: schemaManager.getName(name, { type: 'type', pluginName: pluginTsName }),\n file: schemaManager.getFile(options.operationName || name, { pluginName: pluginTsName, group }),\n }\n\n const canOverride = tree.some(\n ({ keyword }) =>\n keyword === schemaKeywords.array ||\n keyword === schemaKeywords.and ||\n keyword === schemaKeywords.object ||\n keyword === schemaKeywords.union ||\n keyword === schemaKeywords.tuple ||\n keyword === schemaKeywords.enum ||\n keyword === schemaKeywords.ref,\n )\n\n return (\n <>\n {canOverride && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} />\n ))}\n <Faker\n name={faker.name}\n typeName={type.name}\n description={description}\n tree={tree}\n regexGenerator={regexGenerator}\n dateParser={dateParser}\n mapper={mapper}\n seed={seed}\n canOverride={canOverride}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: driver.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ schema, plugin }) {\n const { getName, getFile } = useSchemaManager()\n const {\n options: { output, dateParser, regexGenerator, seed, mapper },\n } = plugin\n const driver = useDriver()\n const oas = useOas()\n const imports = getImports(schema.tree)\n\n const faker = {\n name: getName(schema.name, { type: 'function' }),\n file: getFile(schema.name),\n }\n\n const type = {\n name: getName(schema.name, { type: 'type', pluginName: pluginTsName }),\n file: getFile(schema.name, { pluginName: pluginTsName }),\n }\n\n const canOverride = schema.tree.some(\n ({ keyword }) =>\n keyword === schemaKeywords.array ||\n keyword === schemaKeywords.and ||\n keyword === schemaKeywords.object ||\n keyword === schemaKeywords.union ||\n keyword === schemaKeywords.tuple ||\n keyword === schemaKeywords.ref ||\n keyword === schemaKeywords.enum ||\n keyword === schemaKeywords.string ||\n keyword === schemaKeywords.integer ||\n keyword === schemaKeywords.number,\n )\n\n return (\n <File\n baseName={faker.file.baseName}\n path={faker.file.path}\n meta={faker.file.meta}\n banner={getBanner({ oas, output, config: driver.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n <File.Import isTypeOnly root={faker.file.path} path={type.file.path} name={[type.name]} />\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={faker.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Faker\n name={faker.name}\n typeName={type.name}\n description={schema.value.description}\n tree={schema.tree}\n regexGenerator={regexGenerator}\n dateParser={dateParser}\n mapper={mapper}\n seed={seed}\n canOverride={canOverride}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;AAUA,MAAa,kBAAA,GAAA,4BAAA,sBAAmD;CAC9D,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SACA,SAAS,EAAE,YAAY,gBAAgB,MAAM,aAC3C;EACJ,MAAM,QAAA,GAAA,iBAAA,UAAgB;EACtB,MAAM,UAAA,GAAA,iBAAA,YAAoB;EAE1B,MAAM,OAAA,GAAA,uBAAA,SAAc;EACpB,MAAM,EAAE,YAAY,SAAS,cAAA,GAAA,uBAAA,qBAAiC,UAAU;EACxE,MAAM,iBAAA,GAAA,uBAAA,mBAAkC;EAExC,MAAM,OAAO,QAAQ,UAAU;EAC/B,MAAM,UAAU,WAAW,UAAU;EACrC,MAAM,kBAAkB,IAAIA,iBAAAA,gBAAgB,SAAS;GACnD;GACA;GACA,QAAQ,UAAU,QAAQ;GAC1B;GACA;GACA,UAAU,QAAQ;GACnB,CAAC;EAEF,MAAM,mBAAmB;GAAC,QAAQ;GAAY,QAAQ;GAAa,QAAQ;GAAc,QAAQ;GAAa,QAAQ;GAAS,QAAQ;GAAS,CAC7I,MAAM,CACN,QAAQ,MAAgC,QAAQ,EAAE,CAAC;EAEtD,MAAM,sBAAsB,EAAE,MAAM,QAAQ,aAAa,GAAG,cAAmC;GAG7F,MAAM,qBAAA,GAAA,uBAAA,mBADoC,KAAK,IAAI,OAAO,QAAQ,gBAAA,GAAA,uBAAA,mBACJ,QAAQ,OAAO,QAAQ,aAAa,GAAG;GAErG,MAAM,OAAO,gBAAgB,MAAM;IAAE,QAAQ;IAAmB;IAAM,YAAY;IAAM,CAAC;GACzF,MAAM,WAAA,GAAA,uBAAA,YAAqB,KAAK;GAChC,MAAM,QAAQ,QAAQ,YAAY,SAAS,QAAQ,UAAU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,OAAO,MAAM;KAC1B,MAAM,OAAO;KACG;KACJ;KACJ;KACF;KACO;KACb,CAAA;IACG;;;CAGZ,CAAC"}
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_fakerGenerator = require("./fakerGenerator-Cqs2pBO4.cjs");
2
+ const require_fakerGenerator = require("./fakerGenerator-XdArcWbg.cjs");
3
3
  exports.fakerGenerator = require_fakerGenerator.fakerGenerator;
@@ -1,2 +1,2 @@
1
- import { t as fakerGenerator } from "./fakerGenerator-BviedIXa.js";
1
+ import { t as fakerGenerator } from "./fakerGenerator-GfeyVgyv.js";
2
2
  export { fakerGenerator };
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_components = require("./components-Cmw1Lygb.cjs");
3
- const require_fakerGenerator = require("./fakerGenerator-Cqs2pBO4.cjs");
3
+ const require_fakerGenerator = require("./fakerGenerator-XdArcWbg.cjs");
4
4
  let node_path = require("node:path");
5
5
  node_path = require_components.__toESM(node_path);
6
6
  let _kubb_core = require("@kubb/core");
@@ -50,7 +50,7 @@ function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
50
50
  }
51
51
  //#endregion
52
52
  //#region package.json
53
- var version = "5.0.0-alpha.31";
53
+ var version = "5.0.0-alpha.32";
54
54
  //#endregion
55
55
  //#region src/plugin.ts
56
56
  const pluginFakerName = "plugin-faker";
@@ -111,7 +111,6 @@ const pluginFaker = (0, _kubb_core.createPlugin)((options) => {
111
111
  const mode = this.getMode(output);
112
112
  const oas = await this.getOas();
113
113
  const schemaFiles = await new _kubb_plugin_oas.SchemaGenerator(this.plugin.options, {
114
- fabric: this.fabric,
115
114
  oas,
116
115
  driver: this.driver,
117
116
  events: this.events,
@@ -124,7 +123,6 @@ const pluginFaker = (0, _kubb_core.createPlugin)((options) => {
124
123
  }).build(...generators);
125
124
  await this.upsertFile(...schemaFiles);
126
125
  const operationFiles = await new _kubb_plugin_oas.OperationGenerator(this.plugin.options, {
127
- fabric: this.fabric,
128
126
  oas,
129
127
  driver: this.driver,
130
128
  events: this.events,
@@ -136,7 +134,7 @@ const pluginFaker = (0, _kubb_core.createPlugin)((options) => {
136
134
  mode
137
135
  }).build(...generators);
138
136
  await this.upsertFile(...operationFiles);
139
- const barrelFiles = await (0, _kubb_core.getBarrelFiles)(this.fabric.files, {
137
+ const barrelFiles = await (0, _kubb_core.getBarrelFiles)(this.driver.fileManager.files, {
140
138
  type: output.barrelType ?? "named",
141
139
  root,
142
140
  output,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["fakerGenerator","pluginOasName","pluginTsName","path","SchemaGenerator","OperationGenerator"],"sources":["../../../internals/utils/src/casing.ts","../package.json","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'\nimport { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { version } from '../package.json'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport type { PluginFaker } from './types.ts'\n\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\nexport const pluginFaker = createPlugin<PluginFaker>((options) => {\n const {\n output = { path: 'mocks', barrelType: 'named' },\n seed,\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n mapper = {},\n unknownType = 'any',\n emptySchemaType = unknownType,\n dateType = 'string',\n integerType = 'number',\n dateParser = 'faker',\n generators = [fakerGenerator].filter(Boolean),\n regexGenerator = 'faker',\n paramsCasing,\n contentType,\n } = options\n\n // @deprecated Will be removed in v5 when collisionDetection defaults to true\n const usedEnumNames = {}\n\n return {\n name: pluginFakerName,\n version,\n options: {\n output,\n transformers,\n seed,\n dateType,\n integerType,\n unknownType,\n emptySchemaType,\n dateParser,\n mapper,\n override,\n exclude,\n include,\n regexGenerator,\n paramsCasing,\n group,\n usedEnumNames,\n },\n pre: [pluginOasName, pluginTsName],\n resolvePath(baseName, pathMode, options) {\n const root = this.root\n const mode = pathMode ?? this.getMode(output)\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: UserGroup['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n prefix: type ? 'create' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const root = this.root\n const mode = this.getMode(output)\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;AAS9D,QARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAAQ,CAEV,MAAM,gBAAgB,CAAC,OAAO,QAAQ,CAG5D,KAAK,MAAM,MAAM;AAEhB,MADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,CACjD,QAAO;AACrB,MAAI,MAAM,KAA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AAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAE8C,MAAM,GAAG,WAAW;AACpE,SAAM,KAAK,WAAW,GAAG,eAAe;GAExC,MAAM,cAAc,OAAA,GAAA,WAAA,gBAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["fakerGenerator","pluginOasName","pluginTsName","path","SchemaGenerator","OperationGenerator"],"sources":["../../../internals/utils/src/casing.ts","../package.json","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport type { FileNode } from '@kubb/ast/types'\nimport { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'\nimport { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { version } from '../package.json'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport type { PluginFaker } from './types.ts'\n\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\nexport const pluginFaker = createPlugin<PluginFaker>((options) => {\n const {\n output = { path: 'mocks', barrelType: 'named' },\n seed,\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n mapper = {},\n unknownType = 'any',\n emptySchemaType = unknownType,\n dateType = 'string',\n integerType = 'number',\n dateParser = 'faker',\n generators = [fakerGenerator].filter(Boolean),\n regexGenerator = 'faker',\n paramsCasing,\n contentType,\n } = options\n\n // @deprecated Will be removed in v5 when collisionDetection defaults to true\n const usedEnumNames = {}\n\n return {\n name: pluginFakerName,\n version,\n options: {\n output,\n transformers,\n seed,\n dateType,\n integerType,\n unknownType,\n emptySchemaType,\n dateParser,\n mapper,\n override,\n exclude,\n include,\n regexGenerator,\n paramsCasing,\n group,\n usedEnumNames,\n },\n pre: [pluginOasName, pluginTsName],\n resolvePath(baseName, pathMode, options) {\n const root = this.root\n const mode = pathMode ?? this.getMode(output)\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: UserGroup['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n prefix: type ? 'create' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const root = this.root\n const mode = this.getMode(output)\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.driver.fileManager.files as unknown as FileNode[], {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;AAS9D,QARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAAQ,CAEV,MAAM,gBAAgB,CAAC,OAAO,QAAQ,CAG5D,KAAK,MAAM,MAAM;AAEhB,MADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,CACjD,QAAO;AACrB,MAAI,MAAM,KAAK,CAAC,OAAQ,QAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GA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,WAAW,GAAG,eAAe;GAExC,MAAM,cAAc,OAAA,GAAA,WAAA,gBAAqB,KAAK,OAAO,YAAY,OAAgC;IAC/F,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { t as fakerGenerator } from "./fakerGenerator-BviedIXa.js";
2
+ import { t as fakerGenerator } from "./fakerGenerator-GfeyVgyv.js";
3
3
  import path from "node:path";
4
4
  import { createPlugin, getBarrelFiles } from "@kubb/core";
5
5
  import { OperationGenerator, SchemaGenerator, pluginOasName } from "@kubb/plugin-oas";
@@ -48,7 +48,7 @@ function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
48
48
  }
49
49
  //#endregion
50
50
  //#region package.json
51
- var version = "5.0.0-alpha.31";
51
+ var version = "5.0.0-alpha.32";
52
52
  //#endregion
53
53
  //#region src/plugin.ts
54
54
  const pluginFakerName = "plugin-faker";
@@ -109,7 +109,6 @@ const pluginFaker = createPlugin((options) => {
109
109
  const mode = this.getMode(output);
110
110
  const oas = await this.getOas();
111
111
  const schemaFiles = await new SchemaGenerator(this.plugin.options, {
112
- fabric: this.fabric,
113
112
  oas,
114
113
  driver: this.driver,
115
114
  events: this.events,
@@ -122,7 +121,6 @@ const pluginFaker = createPlugin((options) => {
122
121
  }).build(...generators);
123
122
  await this.upsertFile(...schemaFiles);
124
123
  const operationFiles = await new OperationGenerator(this.plugin.options, {
125
- fabric: this.fabric,
126
124
  oas,
127
125
  driver: this.driver,
128
126
  events: this.events,
@@ -134,7 +132,7 @@ const pluginFaker = createPlugin((options) => {
134
132
  mode
135
133
  }).build(...generators);
136
134
  await this.upsertFile(...operationFiles);
137
- const barrelFiles = await getBarrelFiles(this.fabric.files, {
135
+ const barrelFiles = await getBarrelFiles(this.driver.fileManager.files, {
138
136
  type: output.barrelType ?? "named",
139
137
  root,
140
138
  output,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/casing.ts","../package.json","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'\nimport { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { version } from '../package.json'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport type { PluginFaker } from './types.ts'\n\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\nexport const pluginFaker = createPlugin<PluginFaker>((options) => {\n const {\n output = { path: 'mocks', barrelType: 'named' },\n seed,\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n mapper = {},\n unknownType = 'any',\n emptySchemaType = unknownType,\n dateType = 'string',\n integerType = 'number',\n dateParser = 'faker',\n generators = [fakerGenerator].filter(Boolean),\n regexGenerator = 'faker',\n paramsCasing,\n contentType,\n } = options\n\n // @deprecated Will be removed in v5 when collisionDetection defaults to true\n const usedEnumNames = {}\n\n return {\n name: pluginFakerName,\n version,\n options: {\n output,\n transformers,\n seed,\n dateType,\n integerType,\n unknownType,\n emptySchemaType,\n dateParser,\n mapper,\n override,\n exclude,\n include,\n regexGenerator,\n paramsCasing,\n group,\n usedEnumNames,\n },\n pre: [pluginOasName, pluginTsName],\n resolvePath(baseName, pathMode, options) {\n const root = this.root\n const mode = pathMode ?? this.getMode(output)\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: UserGroup['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n prefix: type ? 'create' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const root = this.root\n const mode = this.getMode(output)\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;AAS9D,QARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAAQ,CAEV,MAAM,gBAAgB,CAAC,OAAO,QAAQ,CAG5D,KAAK,MAAM,MAAM;AAEhB,MADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,CACjD,QAAO;AACrB,MAAI,MAAM,KAAK,CAAC,OAAQ,QAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;AAC3E,SAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;GACnD,CACD,KAAK,GAAG,CACR,QAAQ,iBAAiB,GAAG;;;;;;;;;;AAWjC,SAAS,iBAAiB,MAAc,eAAkE;CACxG,MAAM,QAAQ,KAAK,MAAM,iBAAiB;AAC1C,QAAO,MAAM,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,SAAS,EAA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SAAS,QAAQ,MAAM,OAAQ,QAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM;IACnC,QAAQ,OAAO,WAAW,KAAA;IAC1B,QAAQ,SAAS;IAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,aAAa;GACjB,MAAM,OAAO,KAAK;GAClB,MAAM,OAAO,KAAK,QAAQ,OAAO;GACjC,MAAM,MAAM,MAAM,KAAK,QAAQ;GAe/B,MAAM,cAAc,MAbI,IAAI,gBAAgB,KAAK,OAAO,SAAS;IAC/D,QAAQ,KAAK;IACb;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA,SAAS,KAAA;IACT;IACA;IACA,QAAQ,OAAO;IAChB,CAAC,CAEwC,MAAM,GAAG,WAAW;AAC9D,SAAM,KAAK,WAAW,GAAG,YAAY;GAerC,MAAM,iBAAiB,MAbI,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAE8C,MAAM,GAAG,WAAW;AACpE,SAAM,KAAK,WAAW,GAAG,eAAe;GAExC,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/casing.ts","../package.json","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport type { FileNode } from '@kubb/ast/types'\nimport { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'\nimport { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { version } from '../package.json'\nimport { fakerGenerator } from './generators/fakerGenerator.tsx'\nimport type { PluginFaker } from './types.ts'\n\nexport const pluginFakerName = 'plugin-faker' satisfies PluginFaker['name']\n\nexport const pluginFaker = createPlugin<PluginFaker>((options) => {\n const {\n output = { path: 'mocks', barrelType: 'named' },\n seed,\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n mapper = {},\n unknownType = 'any',\n emptySchemaType = unknownType,\n dateType = 'string',\n integerType = 'number',\n dateParser = 'faker',\n generators = [fakerGenerator].filter(Boolean),\n regexGenerator = 'faker',\n paramsCasing,\n contentType,\n } = options\n\n // @deprecated Will be removed in v5 when collisionDetection defaults to true\n const usedEnumNames = {}\n\n return {\n name: pluginFakerName,\n version,\n options: {\n output,\n transformers,\n seed,\n dateType,\n integerType,\n unknownType,\n emptySchemaType,\n dateParser,\n mapper,\n override,\n exclude,\n include,\n regexGenerator,\n paramsCasing,\n group,\n usedEnumNames,\n },\n pre: [pluginOasName, pluginTsName],\n resolvePath(baseName, pathMode, options) {\n const root = this.root\n const mode = pathMode ?? this.getMode(output)\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: UserGroup['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n prefix: type ? 'create' : undefined,\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const root = this.root\n const mode = this.getMode(output)\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.driver.fileManager.files as unknown as FileNode[], {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;AAS9D,QARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAAQ,CAEV,MAAM,gBAAgB,CAAC,OAAO,QAAQ,CAG5D,KAAK,MAAM,MAAM;AAEhB,MADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,CACjD,QAAO;AACrB,MAAI,MAAM,KAAK,CAAC,OAAQ,QAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;AAC3E,SAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;GACnD,CACD,KAAK,GAAG,CACR,QAAQ,iBAAiB,GAAG;;;;;;;;;;AAWjC,SAAS,iBAAiB,MAAc,eAAkE;CACxG,MAAM,QAAQ,KAAK,MAAM,iBAAiB;AAC1C,QAAO,MAAM,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI;;;;;;;;;;AAWtF,SAAgB,UAAU,MAAc,EAAE,QAAQ,SAAS,IAAI,SAAS,OAAgB,EAAE,EAAU;AAClG,KAAI,OACF,QAAO,iBAAiB,OAAO,MAAM,WAAW,UAAU,MAAM,SAAS;EAAE;EAAQ;EAAQ,GAA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QAAQ,SAAS;IAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,aAAa;GACjB,MAAM,OAAO,KAAK;GAClB,MAAM,OAAO,KAAK,QAAQ,OAAO;GACjC,MAAM,MAAM,MAAM,KAAK,QAAQ;GAc/B,MAAM,cAAc,MAZI,IAAI,gBAAgB,KAAK,OAAO,SAAS;IAC/D;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA,SAAS,KAAA;IACT;IACA;IACA,QAAQ,OAAO;IAChB,CAAC,CAEwC,MAAM,GAAG,WAAW;AAC9D,SAAM,KAAK,WAAW,GAAG,YAAY;GAcrC,MAAM,iBAAiB,MAZI,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAE8C,MAAM,GAAG,WAAW;AACpE,SAAM,KAAK,WAAW,GAAG,eAAe;GAExC,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,YAAY,OAAgC;IAC/F,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-faker",
3
- "version": "5.0.0-alpha.31",
3
+ "version": "5.0.0-alpha.32",
4
4
  "description": "Faker.js data generator plugin for Kubb, creating realistic mock data from OpenAPI specifications for development and testing.",
5
5
  "keywords": [
6
6
  "faker",
@@ -72,10 +72,10 @@
72
72
  ],
73
73
  "dependencies": {
74
74
  "@kubb/react-fabric": "0.15.1",
75
- "@kubb/core": "5.0.0-alpha.31",
76
- "@kubb/plugin-oas": "5.0.0-alpha.31",
77
- "@kubb/oas": "5.0.0-alpha.31",
78
- "@kubb/plugin-ts": "5.0.0-alpha.31"
75
+ "@kubb/core": "5.0.0-alpha.32",
76
+ "@kubb/oas": "5.0.0-alpha.32",
77
+ "@kubb/plugin-oas": "5.0.0-alpha.32",
78
+ "@kubb/plugin-ts": "5.0.0-alpha.32"
79
79
  },
80
80
  "engines": {
81
81
  "node": ">=22"
@@ -25,7 +25,6 @@ export const fakerGenerator = createReactGenerator<PluginFaker>({
25
25
  const file = getFile(operation)
26
26
  const schemas = getSchemas(operation)
27
27
  const schemaGenerator = new SchemaGenerator(options, {
28
- fabric: generator.context.fabric,
29
28
  oas,
30
29
  plugin,
31
30
  events: generator.context.events,
package/src/plugin.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path'
2
2
  import { camelCase } from '@internals/utils'
3
+ import type { FileNode } from '@kubb/ast/types'
3
4
  import { createPlugin, getBarrelFiles, type UserGroup } from '@kubb/core'
4
5
  import { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'
5
6
  import { pluginTsName } from '@kubb/plugin-ts'
@@ -107,7 +108,6 @@ export const pluginFaker = createPlugin<PluginFaker>((options) => {
107
108
  const oas = await this.getOas()
108
109
 
109
110
  const schemaGenerator = new SchemaGenerator(this.plugin.options, {
110
- fabric: this.fabric,
111
111
  oas,
112
112
  driver: this.driver,
113
113
  events: this.events,
@@ -123,7 +123,6 @@ export const pluginFaker = createPlugin<PluginFaker>((options) => {
123
123
  await this.upsertFile(...schemaFiles)
124
124
 
125
125
  const operationGenerator = new OperationGenerator(this.plugin.options, {
126
- fabric: this.fabric,
127
126
  oas,
128
127
  driver: this.driver,
129
128
  events: this.events,
@@ -138,7 +137,7 @@ export const pluginFaker = createPlugin<PluginFaker>((options) => {
138
137
  const operationFiles = await operationGenerator.build(...generators)
139
138
  await this.upsertFile(...operationFiles)
140
139
 
141
- const barrelFiles = await getBarrelFiles(this.fabric.files, {
140
+ const barrelFiles = await getBarrelFiles(this.driver.fileManager.files as unknown as FileNode[], {
142
141
  type: output.barrelType ?? 'named',
143
142
  root,
144
143
  output,
@@ -1 +0,0 @@
1
- {"version":3,"file":"fakerGenerator-BviedIXa.js","names":[],"sources":["../src/generators/fakerGenerator.tsx"],"sourcesContent":["import { useDriver, useMode } from '@kubb/core/hooks'\nimport { type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { applyParamsCasing, getBanner, getFooter, getImports, isParameterSchema } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Faker } from '../components'\nimport type { PluginFaker } from '../types'\n\nexport const fakerGenerator = createReactGenerator<PluginFaker>({\n name: 'faker',\n Operation({ operation, generator, plugin }) {\n const {\n options,\n options: { dateParser, regexGenerator, seed, mapper },\n } = plugin\n const mode = useMode()\n const driver = useDriver()\n\n const oas = useOas()\n const { getSchemas, getFile, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n plugin,\n events: generator.context.events,\n driver,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter((x): x is OperationSchemaType => Boolean(x))\n\n const mapOperationSchema = ({ name, schema, description, ...options }: OperationSchemaType) => {\n // Apply paramsCasing transformation if enabled and this is a parameter schema\n const shouldTransform = isParameterSchema(name) && plugin.options.paramsCasing\n const transformedSchema = shouldTransform ? applyParamsCasing(schema, plugin.options.paramsCasing) : schema\n\n const tree = schemaGenerator.parse({ schema: transformedSchema, name, parentName: null })\n const imports = getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const faker = {\n name: schemaManager.getName(name, { type: 'function' }),\n file: schemaManager.getFile(name),\n }\n\n const type = {\n name: schemaManager.getName(name, { type: 'type', pluginName: pluginTsName }),\n file: schemaManager.getFile(options.operationName || name, { pluginName: pluginTsName, group }),\n }\n\n const canOverride = tree.some(\n ({ keyword }) =>\n keyword === schemaKeywords.array ||\n keyword === schemaKeywords.and ||\n keyword === schemaKeywords.object ||\n keyword === schemaKeywords.union ||\n keyword === schemaKeywords.tuple ||\n keyword === schemaKeywords.enum ||\n keyword === schemaKeywords.ref,\n )\n\n return (\n <>\n {canOverride && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} />\n ))}\n <Faker\n name={faker.name}\n typeName={type.name}\n description={description}\n tree={tree}\n regexGenerator={regexGenerator}\n dateParser={dateParser}\n mapper={mapper}\n seed={seed}\n canOverride={canOverride}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: driver.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ schema, plugin }) {\n const { getName, getFile } = useSchemaManager()\n const {\n options: { output, dateParser, regexGenerator, seed, mapper },\n } = plugin\n const driver = useDriver()\n const oas = useOas()\n const imports = getImports(schema.tree)\n\n const faker = {\n name: getName(schema.name, { type: 'function' }),\n file: getFile(schema.name),\n }\n\n const type = {\n name: getName(schema.name, { type: 'type', pluginName: pluginTsName }),\n file: getFile(schema.name, { pluginName: pluginTsName }),\n }\n\n const canOverride = schema.tree.some(\n ({ keyword }) =>\n keyword === schemaKeywords.array ||\n keyword === schemaKeywords.and ||\n keyword === schemaKeywords.object ||\n keyword === schemaKeywords.union ||\n keyword === schemaKeywords.tuple ||\n keyword === schemaKeywords.ref ||\n keyword === schemaKeywords.enum ||\n keyword === schemaKeywords.string ||\n keyword === schemaKeywords.integer ||\n keyword === schemaKeywords.number,\n )\n\n return (\n <File\n baseName={faker.file.baseName}\n path={faker.file.path}\n meta={faker.file.meta}\n banner={getBanner({ oas, output, config: driver.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n <File.Import isTypeOnly root={faker.file.path} path={type.file.path} name={[type.name]} />\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={faker.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Faker\n name={faker.name}\n typeName={type.name}\n description={schema.value.description}\n tree={schema.tree}\n regexGenerator={regexGenerator}\n dateParser={dateParser}\n mapper={mapper}\n seed={seed}\n canOverride={canOverride}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,iBAAiB,qBAAkC;CAC9D,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SACA,SAAS,EAAE,YAAY,gBAAgB,MAAM,aAC3C;EACJ,MAAM,OAAO,SAAS;EACtB,MAAM,SAAS,WAAW;EAE1B,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,aAAa,oBAAoB,UAAU;EACxE,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,OAAO,QAAQ,UAAU;EAC/B,MAAM,UAAU,WAAW,UAAU;EACrC,MAAM,kBAAkB,IAAI,gBAAgB,SAAS;GACnD,QAAQ,UAAU,QAAQ;GAC1B;GACA;GACA,QAAQ,UAAU,QAAQ;GAC1B;GACA;GACA,UAA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cesContent":["import { useDriver, useMode } from '@kubb/core/hooks'\nimport { type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { applyParamsCasing, getBanner, getFooter, getImports, isParameterSchema } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport { Faker } from '../components'\nimport type { PluginFaker } from '../types'\n\nexport const fakerGenerator = createReactGenerator<PluginFaker>({\n name: 'faker',\n Operation({ operation, generator, plugin }) {\n const {\n options,\n options: { dateParser, regexGenerator, seed, mapper },\n } = plugin\n const mode = useMode()\n const driver = useDriver()\n\n const oas = useOas()\n const { getSchemas, getFile, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n plugin,\n events: generator.context.events,\n driver,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter((x): x is OperationSchemaType => Boolean(x))\n\n const mapOperationSchema = ({ name, schema, description, ...options }: OperationSchemaType) => {\n // Apply paramsCasing transformation if enabled and this is a parameter schema\n const shouldTransform = isParameterSchema(name) && plugin.options.paramsCasing\n const transformedSchema = shouldTransform ? applyParamsCasing(schema, plugin.options.paramsCasing) : schema\n\n const tree = schemaGenerator.parse({ schema: transformedSchema, name, parentName: null })\n const imports = getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const faker = {\n name: schemaManager.getName(name, { type: 'function' }),\n file: schemaManager.getFile(name),\n }\n\n const type = {\n name: schemaManager.getName(name, { type: 'type', pluginName: pluginTsName }),\n file: schemaManager.getFile(options.operationName || name, { pluginName: pluginTsName, group }),\n }\n\n const canOverride = tree.some(\n ({ keyword }) =>\n keyword === schemaKeywords.array ||\n keyword === schemaKeywords.and ||\n keyword === schemaKeywords.object ||\n keyword === schemaKeywords.union ||\n keyword === schemaKeywords.tuple ||\n keyword === schemaKeywords.enum ||\n keyword === schemaKeywords.ref,\n )\n\n return (\n <>\n {canOverride && <File.Import isTypeOnly root={file.path} path={type.file.path} name={[type.name]} />}\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} />\n ))}\n <Faker\n name={faker.name}\n typeName={type.name}\n description={description}\n tree={tree}\n regexGenerator={regexGenerator}\n dateParser={dateParser}\n mapper={mapper}\n seed={seed}\n canOverride={canOverride}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: driver.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n {operationSchemas.map(mapOperationSchema)}\n </File>\n )\n },\n Schema({ schema, plugin }) {\n const { getName, getFile } = useSchemaManager()\n const {\n options: { output, dateParser, regexGenerator, seed, mapper },\n } = plugin\n const driver = useDriver()\n const oas = useOas()\n const imports = getImports(schema.tree)\n\n const faker = {\n name: getName(schema.name, { type: 'function' }),\n file: getFile(schema.name),\n }\n\n const type = {\n name: getName(schema.name, { type: 'type', pluginName: pluginTsName }),\n file: getFile(schema.name, { pluginName: pluginTsName }),\n }\n\n const canOverride = schema.tree.some(\n ({ keyword }) =>\n keyword === schemaKeywords.array ||\n keyword === schemaKeywords.and ||\n keyword === schemaKeywords.object ||\n keyword === schemaKeywords.union ||\n keyword === schemaKeywords.tuple ||\n keyword === schemaKeywords.ref ||\n keyword === schemaKeywords.enum ||\n keyword === schemaKeywords.string ||\n keyword === schemaKeywords.integer ||\n keyword === schemaKeywords.number,\n )\n\n return (\n <File\n baseName={faker.file.baseName}\n path={faker.file.path}\n meta={faker.file.meta}\n banner={getBanner({ oas, output, config: driver.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n <File.Import isTypeOnly root={faker.file.path} path={type.file.path} name={[type.name]} />\n {imports.map((imp) => (\n <File.Import key={[imp.path, imp.name, imp.isTypeOnly].join('-')} root={faker.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Faker\n name={faker.name}\n typeName={type.name}\n description={schema.value.description}\n tree={schema.tree}\n regexGenerator={regexGenerator}\n dateParser={dateParser}\n mapper={mapper}\n seed={seed}\n canOverride={canOverride}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;AAUA,MAAa,kBAAA,GAAA,4BAAA,sBAAmD;CAC9D,MAAM;CACN,UAAU,EAAE,WAAW,WAAW,UAAU;EAC1C,MAAM,EACJ,SACA,SAAS,EAAE,YAAY,gBAAgB,MAAM,aAC3C;EACJ,MAAM,QAAA,GAAA,iBAAA,UAAgB;EACtB,MAAM,UAAA,GAAA,iBAAA,YAAoB;EAE1B,MAAM,OAAA,GAAA,uBAAA,SAAc;EACpB,MAAM,EAAE,YAAY,SAAS,cAAA,GAAA,uBAAA,qBAAiC,UAAU;EACxE,MAAM,iBAAA,GAAA,uBAAA,mBAAkC;EAExC,MAAM,OAAO,QAAQ,UAAU;EAC/B,MAAM,UAAU,WAAW,UAAU;EACrC,MAAM,kBAAkB,IAAIA,iBAAAA,gBAAgB,SAAS;GACnD,QAAQ,UAAU,QAAQ;GAC1B;GACA;GACA,QAAQ,UAAU,QAAQ;GAC1B;GACA;GACA,UAAU,QAAQ;GACnB,CAAC;EAEF,MAAM,mBAAmB;GAAC,QAAQ;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