@kubb/plugin-faker 3.0.0-alpha.14 → 3.0.0-alpha.16
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.
- package/dist/chunk-7JKM5LCT.cjs +310 -0
- package/dist/chunk-7JKM5LCT.cjs.map +1 -0
- package/dist/chunk-CJMJFFHG.cjs +110 -0
- package/dist/chunk-CJMJFFHG.cjs.map +1 -0
- package/dist/chunk-JE7K2NAC.js +108 -0
- package/dist/chunk-JE7K2NAC.js.map +1 -0
- package/dist/chunk-Q5K4KJXX.js +304 -0
- package/dist/chunk-Q5K4KJXX.js.map +1 -0
- package/dist/components.cjs +4 -530
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +16 -18
- package/dist/components.d.ts +16 -18
- package/dist/components.js +1 -528
- package/dist/components.js.map +1 -1
- package/dist/generators.cjs +13 -0
- package/dist/generators.cjs.map +1 -0
- package/dist/generators.d.cts +9 -0
- package/dist/generators.d.ts +9 -0
- package/dist/generators.js +4 -0
- package/dist/generators.js.map +1 -0
- package/dist/index.cjs +12 -430
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -125
- package/dist/index.d.ts +5 -125
- package/dist/index.js +13 -430
- package/dist/index.js.map +1 -1
- package/dist/types-DrJPCRvZ.d.cts +125 -0
- package/dist/types-DrJPCRvZ.d.ts +125 -0
- package/package.json +21 -13
- package/src/components/Faker.tsx +80 -0
- package/src/components/index.ts +1 -2
- package/src/generators/__snapshots__/createPet.ts +26 -0
- package/src/generators/__snapshots__/createPetSeed.ts +30 -0
- package/src/generators/__snapshots__/createPetUnknownTypeAny.ts +26 -0
- package/src/generators/__snapshots__/deletePet.ts +3 -0
- package/src/generators/__snapshots__/enumNames.ts +5 -0
- package/src/generators/__snapshots__/enumVarNames.ts +5 -0
- package/src/generators/__snapshots__/getPets.ts +29 -0
- package/src/generators/__snapshots__/pet.ts +15 -0
- package/src/generators/__snapshots__/petWithDateString.ts +15 -0
- package/src/generators/__snapshots__/petWithDayjs.ts +16 -0
- package/src/generators/__snapshots__/petWithMapper.ts +15 -0
- package/src/generators/__snapshots__/petWithRandExp.ts +16 -0
- package/src/generators/__snapshots__/pets.ts +5 -0
- package/src/generators/__snapshots__/showPetById.ts +29 -0
- package/src/generators/fakerGenerator.tsx +135 -0
- package/src/generators/index.ts +1 -0
- package/src/parser/index.ts +22 -12
- package/src/plugin.ts +7 -10
- package/src/types.ts +17 -17
- package/src/OperationGenerator.tsx +0 -31
- package/src/SchemaGenerator.tsx +0 -31
- package/src/components/OperationSchema.tsx +0 -81
- package/src/components/Schema.tsx +0 -148
package/dist/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/parser/index.ts","../src/OperationGenerator.tsx","../src/plugin.ts","../src/components/Schema.tsx","../src/SchemaGenerator.tsx","../src/components/OperationSchema.tsx"],"names":["value","options","Generator","transformers","SchemaGenerator","pluginTsName","jsx","schema","schemaKeywords","Oas","createRoot","App","useApp","jsxs","File"],"mappings":";;;;;;;;;;;;AAMO,IAAM,kBAAqB,GAAA;AAAA,EAChC,KAAK,MAAM,WAAA;AAAA,EACX,SAAS,MAAM,SAAA;AAAA,EACf,MAAA,EAAQ,CAAC,GAAA,EAAc,GAAiB,KAAA;AACtC,IAAI,IAAA,GAAA,KAAQ,KAAa,CAAA,IAAA,GAAA,KAAQ,KAAW,CAAA,EAAA;AAC1C,MAAO,OAAA,CAAA,0BAAA,EAA6B,GAAG,CAAA,OAAA,EAAU,GAAG,CAAA,GAAA,CAAA,CAAA;AAAA,KACtD;AAEA,IAAA,IAAI,QAAQ,KAAW,CAAA,EAAA;AACrB,MAAA,OAAO,6BAA6B,GAAG,CAAA,GAAA,CAAA,CAAA;AAAA,KACzC;AAEA,IAAA,IAAI,QAAQ,KAAW,CAAA,EAAA;AACrB,MAAA,OAAO,6BAA6B,GAAG,CAAA,GAAA,CAAA,CAAA;AAAA,KACzC;AAEA,IAAO,OAAA,sBAAA,C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Y,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,SAAW,EAAA,CAAA;AAAA,IAC9F,KAAA,CAAM,IAAI,OAAO,CAAA;AAAA,GACpB,EAAA,CAAA,CAAA;AAEJ,CAAA","file":"components.js","sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { SchemaGenerator, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\n\nimport type { Schema, SchemaKeywordBase, SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport type { Options } from '../types.ts'\n\nexport const fakerKeywordMapper = {\n any: () => 'undefined',\n unknown: () => 'unknown',\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 (min !== undefined) {\n return `faker.number.float({ min: ${min} })`\n }\n\n if (max !== undefined) {\n return `faker.number.float({ max: ${max} })`\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 (min !== undefined) {\n return `faker.number.int({ min: ${min} })`\n }\n\n if (max !== undefined) {\n return `faker.number.int({ max: ${max} })`\n }\n\n return 'faker.number.int()'\n },\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 (min !== undefined) {\n return `faker.string.alpha({ length: { min: ${min} } })`\n }\n\n if (max !== undefined) {\n return `faker.string.alpha({ length: { max: ${max} } })`\n }\n\n return 'faker.string.alpha()'\n },\n boolean: () => 'faker.datatype.boolean()',\n undefined: () => 'undefined',\n null: () => 'null',\n array: (items: string[] = []) => `faker.helpers.arrayElements([${items.join(', ')}]) as any`,\n tuple: (items: string[] = []) => `faker.helpers.arrayElements([${items.join(', ')}]) as any`,\n enum: (items: Array<string | number> = []) => `faker.helpers.arrayElement<any>([${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?: string) => {\n if (type === 'string') {\n if (parser) {\n return `${parser}(faker.date.anytime()).format(\"YYYY-MM-DD\")`\n }\n return 'faker.date.anytime().toString()'\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?: string) => {\n if (type === 'string') {\n if (parser) {\n return `${parser}(faker.date.anytime()).format(\"HH:mm:ss\")`\n }\n return 'faker.date.anytime().toString()'\n }\n return 'faker.date.anytime()'\n },\n uuid: () => 'faker.string.uuid()',\n url: () => 'faker.internet.url()',\n and: (items: string[] = []) => `Object.assign({}, ${items.join(', ')})`,\n object: () => 'object',\n ref: () => 'ref',\n matches: (value = '', regexGenerator: 'faker' | 'randexp' = 'faker') => {\n if (regexGenerator === 'randexp') {\n return `${transformers.toRegExpString(value, 'RandExp')}.gen()`\n }\n return `faker.helpers.fromRegExp(${transformers.toRegExpString(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.imageUrl() 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 strict: undefined,\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: 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 name: string\n typeName?: string\n description?: string\n\n seed?: number | number[]\n regexGenerator?: 'faker' | 'randexp'\n withData?: boolean\n dateParser?: Options['dateParser']\n mapper?: Record<string, string>\n}\n\nexport function parse(parent: Schema | undefined, current: Schema, options: ParserOptions): string | null | undefined {\n const value = fakerKeywordMapper[current.keyword as keyof typeof fakerKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n return fakerKeywordMapper.union(current.args.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean))\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\n return fakerKeywordMapper.and(current.args.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean))\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return fakerKeywordMapper.array(current.args.items.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean))\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\n return fakerKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'number') {\n return schema.name\n }\n return transformers.stringify(schema.name)\n }),\n )\n }\n\n if (isKeyword(current, schemaKeywords.ref)) {\n if (!current.args?.name) {\n throw new Error(`Name not defined for keyword ${current.keyword}`)\n }\n\n if (options.withData) {\n return `${current.args.name}(data)`\n }\n\n return `${current.args.name}()`\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\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 if (options.mapper?.[mappedName]) {\n return `\"${name}\": ${options.mapper?.[mappedName]}`\n }\n\n return `\"${name}\": ${joinItems(\n schemas\n .sort(schemaKeywordsorter)\n .map((schema) => parse(current, schema, { ...options, withData: false }))\n .filter(Boolean),\n )}`\n })\n .join(',')\n\n return `{${argsObject}}`\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n if (Array.isArray(current.args.items)) {\n return fakerKeywordMapper.tuple(current.args.items.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean))\n }\n\n return parse(current, current.args.items, { ...options, withData: false })\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n if (current.args.format === 'number' && current.args.name !== undefined) {\n return fakerKeywordMapper.const(current.args.name?.toString())\n }\n return fakerKeywordMapper.const(transformers.stringify(current.args.value))\n }\n\n if (isKeyword(current, schemaKeywords.matches) && current.args) {\n return fakerKeywordMapper.matches(current.args, options.regexGenerator)\n }\n\n if (isKeyword(current, schemaKeywords.null) || isKeyword(current, schemaKeywords.undefined) || isKeyword(current, schemaKeywords.any)) {\n return value() || ''\n }\n\n if (isKeyword(current, schemaKeywords.string)) {\n if (parent) {\n const minSchema = SchemaGenerator.find([parent], schemaKeywords.min)\n const maxSchema = SchemaGenerator.find([parent], schemaKeywords.max)\n\n return fakerKeywordMapper.string(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.string()\n }\n\n if (isKeyword(current, schemaKeywords.number)) {\n if (parent) {\n const minSchema = SchemaGenerator.find([parent], schemaKeywords.min)\n const maxSchema = SchemaGenerator.find([parent], schemaKeywords.max)\n\n return fakerKeywordMapper.number(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.number()\n }\n\n if (isKeyword(current, schemaKeywords.integer)) {\n if (parent) {\n const minSchema = SchemaGenerator.find([parent], schemaKeywords.min)\n const maxSchema = SchemaGenerator.find([parent], schemaKeywords.max)\n\n return fakerKeywordMapper.integer(minSchema?.args, maxSchema?.args)\n }\n\n return fakerKeywordMapper.integer()\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return fakerKeywordMapper.datetime()\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return fakerKeywordMapper.date(current.args.type, options.dateParser)\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return fakerKeywordMapper.time(current.args.type, options.dateParser)\n }\n\n if (current.keyword in fakerKeywordMapper && 'args' in current) {\n const value = fakerKeywordMapper[current.keyword as keyof typeof fakerKeywordMapper] as (typeof fakerKeywordMapper)['const']\n\n const options = JSON.stringify((current as SchemaKeywordBase<unknown>).args)\n\n return value(options)\n }\n\n if (current.keyword in fakerKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n","import { OperationGenerator as Generator } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\n\nimport { OperationSchema } from './components/OperationSchema.tsx'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationMethodResult } from '@kubb/plugin-oas'\nimport type { FileMeta, PluginFaker } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginFaker['resolvedOptions'], PluginFaker> {\n async operation(operation: Operation, options: PluginFaker['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={this}>\n <Oas.Operation operation={operation}>\n <OperationSchema.File />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n","import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { SchemaGenerator } from './SchemaGenerator.tsx'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\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' },\n seed,\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n mapper = {},\n dateType = 'string',\n unknownType = 'any',\n dateParser,\n regexGenerator = 'faker',\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginFakerName,\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n options: {\n extName: output.extName,\n transformers,\n dateType,\n seed,\n unknownType,\n dateParser,\n mapper,\n override,\n regexGenerator,\n },\n pre: [pluginOasName, pluginTsName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\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 (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\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 [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build()\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build()\n await this.addFile(...operationFiles)\n\n if (this.config.output.exportType) {\n const barrelFiles = await this.fileManager.getBarrelFiles({\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n }\n },\n }\n})\n","import { Oas } from '@kubb/plugin-oas/components'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, Function, useApp, useFile } from '@kubb/react'\n\nimport transformers from '@kubb/core/transformers'\nimport { schemaKeywords } from '@kubb/plugin-oas'\nimport { useSchema } from '@kubb/plugin-oas/hooks'\nimport type { ReactNode } from 'react'\nimport * as parserFaker from '../parser/index.ts'\nimport { pluginFakerName } from '../plugin.ts'\nimport type { PluginFaker } from '../types.ts'\n\ntype Props = {\n description?: string\n withData?: boolean\n}\n\nexport function Schema(props: Props): ReactNode {\n const { withData, description } = props\n const { tree, name } = useSchema()\n const {\n pluginManager,\n plugin: {\n options: { dateParser, regexGenerator, mapper, seed },\n },\n } = useApp<PluginFaker>()\n\n // all checks are also inside this.schema(React)\n const resolvedName = pluginManager.resolveName({\n name,\n pluginKey: [pluginFakerName],\n type: 'function',\n })\n\n const typeName = pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n const fakerText = parserFaker.joinItems(\n tree\n .map((schema) => parserFaker.parse(undefined, schema, { name: resolvedName, typeName, seed, regexGenerator, mapper, withData, dateParser }))\n .filter(Boolean),\n )\n\n let fakerDefaultOverride: '' | '[]' | '{}' | undefined = undefined\n let fakerTextWithOverride = fakerText\n\n if (withData && fakerText.startsWith('{')) {\n fakerDefaultOverride = '{}'\n fakerTextWithOverride = `{\n ...${fakerText},\n ...data\n}`\n }\n\n if (withData && fakerText.startsWith('faker.helpers.arrayElements')) {\n fakerDefaultOverride = '[]'\n fakerTextWithOverride = `[\n ...${fakerText},\n ...data\n ]`\n }\n\n const params = fakerDefaultOverride ? `data: NonNullable<Partial<${typeName}>> = ${fakerDefaultOverride}` : `data?: NonNullable<Partial<${typeName}>>`\n\n const containsFaker = !!fakerTextWithOverride.match(/faker/) || !!seed\n\n return (\n <>\n {containsFaker && <File.Import name={['faker']} path=\"@faker-js/faker\" />}\n <File.Source name={resolvedName} isExportable isIndexable>\n <Function\n export\n name={resolvedName}\n JSDoc={{ comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean) }}\n params={withData ? params : ''}\n returnType={typeName ? `NonNullable<${typeName}>` : ''}\n >\n {seed ? `faker.seed(${JSON.stringify(seed)})` : ''}\n <br />\n <Function.Return>{fakerTextWithOverride}</Function.Return>\n </Function>\n <br />\n </File.Source>\n </>\n )\n}\n\ntype FileProps = {}\n\nSchema.File = function ({}: FileProps): ReactNode {\n const { pluginManager } = useApp<PluginFaker>()\n const { tree, schema } = useSchema()\n\n const withData = tree.some(\n (schema) =>\n schema.keyword === schemaKeywords.array ||\n schema.keyword === schemaKeywords.and ||\n schema.keyword === schemaKeywords.object ||\n schema.keyword === schemaKeywords.union ||\n schema.keyword === schemaKeywords.tuple,\n )\n\n return (\n <Oas.Schema.File output={pluginManager.config.output.path}>\n <Schema.Imports />\n <Schema description={schema?.description} withData={withData} />\n </Oas.Schema.File>\n )\n}\nSchema.Imports = (): ReactNode => {\n const {\n pluginManager,\n plugin: {\n options: { extName, dateParser, regexGenerator },\n },\n } = useApp<PluginFaker>()\n const { path: root } = useFile()\n const { name, tree, schema } = useSchema()\n\n // used for this.options.typed\n const typeName = pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n\n const typeFileName = pluginManager.resolveName({\n name: name,\n pluginKey: [pluginTsName],\n type: 'file',\n })\n\n const typePath = pluginManager.resolvePath({\n baseName: typeFileName,\n pluginKey: [pluginTsName],\n })\n\n return (\n <>\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser && <File.Import path={dateParser} name={dateParser} />}\n {typeName && typePath && <File.Import isTypeOnly root={root} path={typePath} name={[typeName]} />}\n </>\n )\n}\n","import type { SchemaObject } from '@kubb/oas'\nimport { SchemaGenerator as Generator } from '@kubb/plugin-oas'\nimport type { SchemaMethodResult } from '@kubb/plugin-oas'\nimport { Oas } from '@kubb/plugin-oas/components'\nimport { App, createRoot } from '@kubb/react'\nimport { Schema } from './components/Schema.tsx'\nimport type { FileMeta, PluginFaker } from './types.ts'\n\nexport class SchemaGenerator extends Generator<PluginFaker['resolvedOptions'], PluginFaker> {\n async schema(name: string, schema: SchemaObject, options: PluginFaker['resolvedOptions']): SchemaMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode, output } = this.context\n\n const root = createRoot({\n logger: pluginManager.logger,\n })\n\n const tree = this.parse({ schema, name })\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={name} value={schema} tree={tree}>\n <Schema.File />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n\n return root.files\n }\n}\n","import { Oas } from '@kubb/plugin-oas/components'\nimport { useOas, useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, useApp } from '@kubb/react'\n\nimport { SchemaGenerator } from '../SchemaGenerator.tsx'\n\nimport type { OperationSchema as OperationSchemaType } from '@kubb/plugin-oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginFaker } from '../types.ts'\nimport { Schema } from './Schema.tsx'\n\ntype Props = {\n description?: string\n}\n\nexport function OperationSchema({ description }: Props): ReactNode {\n return <Schema withData={false} description={description} />\n}\n\ntype FileProps = {}\n\nOperationSchema.File = function ({}: FileProps): ReactNode {\n const { plugin, pluginManager, mode } = useApp<PluginFaker>()\n\n const oas = useOas()\n const { getSchemas, getFile } = useOperationManager()\n const operation = useOperation()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const generator = new SchemaGenerator(plugin.options, {\n oas,\n plugin,\n pluginManager,\n mode,\n override: plugin.options.override,\n })\n\n const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean)\n\n const mapItem = ({ name, schema, description, ...options }: OperationSchemaType, i: number) => {\n // used for this.options.typed\n const typeName = pluginManager.resolveName({\n name,\n pluginKey: [pluginTsName],\n type: 'type',\n })\n const typeFileName = pluginManager.resolveName({\n name: options.operationName || name,\n pluginKey: [pluginTsName],\n type: 'file',\n })\n\n // todo replace by getFile\n const typePath = pluginManager.resolvePath({\n baseName: typeFileName,\n pluginKey: [pluginTsName],\n options: { tag: options.operation?.getTags()[0]?.name },\n })\n\n const tree = generator.parse({ schema, name })\n\n return (\n <Oas.Schema key={i} name={name} value={schema} tree={tree}>\n {typeName && typePath && <File.Import isTypeOnly root={file.path} path={typePath} name={[typeName]} />}\n {plugin.options.dateParser && <File.Import path={plugin.options.dateParser} name={plugin.options.dateParser} />}\n\n {mode === 'split' && <Oas.Schema.Imports />}\n <OperationSchema description={description} />\n </Oas.Schema>\n )\n }\n\n return (\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n {plugin.options.regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {items.map(mapItem)}\n </File>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"components.js"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCJMJFFHG_cjs = require('./chunk-CJMJFFHG.cjs');
|
|
4
|
+
require('./chunk-7JKM5LCT.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "fakerGenerator", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkCJMJFFHG_cjs.fakerGenerator; }
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=generators.cjs.map
|
|
13
|
+
//# sourceMappingURL=generators.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"generators.cjs"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _kubb_plugin_oas from '@kubb/plugin-oas';
|
|
2
|
+
import { P as PluginFaker } from './types-DrJPCRvZ.cjs';
|
|
3
|
+
import '@kubb/core';
|
|
4
|
+
import '@kubb/fs/types';
|
|
5
|
+
import '@kubb/oas';
|
|
6
|
+
|
|
7
|
+
declare const fakerGenerator: _kubb_plugin_oas.Generator<PluginFaker>;
|
|
8
|
+
|
|
9
|
+
export { fakerGenerator };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _kubb_plugin_oas from '@kubb/plugin-oas';
|
|
2
|
+
import { P as PluginFaker } from './types-DrJPCRvZ.js';
|
|
3
|
+
import '@kubb/core';
|
|
4
|
+
import '@kubb/fs/types';
|
|
5
|
+
import '@kubb/oas';
|
|
6
|
+
|
|
7
|
+
declare const fakerGenerator: _kubb_plugin_oas.Generator<PluginFaker>;
|
|
8
|
+
|
|
9
|
+
export { fakerGenerator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"generators.js"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,435 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkCJMJFFHG_cjs = require('./chunk-CJMJFFHG.cjs');
|
|
4
|
+
require('./chunk-7JKM5LCT.cjs');
|
|
3
5
|
var path = require('path');
|
|
4
6
|
var core = require('@kubb/core');
|
|
5
7
|
var transformers = require('@kubb/core/transformers');
|
|
6
8
|
var utils = require('@kubb/core/utils');
|
|
7
9
|
var pluginOas = require('@kubb/plugin-oas');
|
|
8
10
|
var pluginTs = require('@kubb/plugin-ts');
|
|
9
|
-
var components = require('@kubb/plugin-oas/components');
|
|
10
|
-
var react = require('@kubb/react');
|
|
11
|
-
var hooks = require('@kubb/plugin-oas/hooks');
|
|
12
|
-
var jsxRuntime = require('@kubb/react/jsx-runtime');
|
|
13
11
|
|
|
14
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
13
|
|
|
16
14
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
17
|
-
var transformers__default = /*#__PURE__*/_interopDefault(transformers);
|
|
18
15
|
|
|
19
|
-
// src/plugin.ts
|
|
20
|
-
var fakerKeywordMapper = {
|
|
21
|
-
any: () => "undefined",
|
|
22
|
-
unknown: () => "unknown",
|
|
23
|
-
number: (min, max) => {
|
|
24
|
-
if (max !== void 0 && min !== void 0) {
|
|
25
|
-
return `faker.number.float({ min: ${min}, max: ${max} })`;
|
|
26
|
-
}
|
|
27
|
-
if (min !== void 0) {
|
|
28
|
-
return `faker.number.float({ min: ${min} })`;
|
|
29
|
-
}
|
|
30
|
-
if (max !== void 0) {
|
|
31
|
-
return `faker.number.float({ max: ${max} })`;
|
|
32
|
-
}
|
|
33
|
-
return "faker.number.float()";
|
|
34
|
-
},
|
|
35
|
-
integer: (min, max) => {
|
|
36
|
-
if (max !== void 0 && min !== void 0) {
|
|
37
|
-
return `faker.number.int({ min: ${min}, max: ${max} })`;
|
|
38
|
-
}
|
|
39
|
-
if (min !== void 0) {
|
|
40
|
-
return `faker.number.int({ min: ${min} })`;
|
|
41
|
-
}
|
|
42
|
-
if (max !== void 0) {
|
|
43
|
-
return `faker.number.int({ max: ${max} })`;
|
|
44
|
-
}
|
|
45
|
-
return "faker.number.int()";
|
|
46
|
-
},
|
|
47
|
-
string: (min, max) => {
|
|
48
|
-
if (max !== void 0 && min !== void 0) {
|
|
49
|
-
return `faker.string.alpha({ length: { min: ${min}, max: ${max} } })`;
|
|
50
|
-
}
|
|
51
|
-
if (min !== void 0) {
|
|
52
|
-
return `faker.string.alpha({ length: { min: ${min} } })`;
|
|
53
|
-
}
|
|
54
|
-
if (max !== void 0) {
|
|
55
|
-
return `faker.string.alpha({ length: { max: ${max} } })`;
|
|
56
|
-
}
|
|
57
|
-
return "faker.string.alpha()";
|
|
58
|
-
},
|
|
59
|
-
boolean: () => "faker.datatype.boolean()",
|
|
60
|
-
undefined: () => "undefined",
|
|
61
|
-
null: () => "null",
|
|
62
|
-
array: (items = []) => `faker.helpers.arrayElements([${items.join(", ")}]) as any`,
|
|
63
|
-
tuple: (items = []) => `faker.helpers.arrayElements([${items.join(", ")}]) as any`,
|
|
64
|
-
enum: (items = []) => `faker.helpers.arrayElement<any>([${items.join(", ")}])`,
|
|
65
|
-
union: (items = []) => `faker.helpers.arrayElement<any>([${items.join(", ")}])`,
|
|
66
|
-
/**
|
|
67
|
-
* ISO 8601
|
|
68
|
-
*/
|
|
69
|
-
datetime: () => "faker.date.anytime().toISOString()",
|
|
70
|
-
/**
|
|
71
|
-
* Type `'date'` Date
|
|
72
|
-
* Type `'string'` ISO date format (YYYY-MM-DD)
|
|
73
|
-
* @default ISO date format (YYYY-MM-DD)
|
|
74
|
-
*/
|
|
75
|
-
date: (type = "string", parser) => {
|
|
76
|
-
if (type === "string") {
|
|
77
|
-
if (parser) {
|
|
78
|
-
return `${parser}(faker.date.anytime()).format("YYYY-MM-DD")`;
|
|
79
|
-
}
|
|
80
|
-
return "faker.date.anytime().toString()";
|
|
81
|
-
}
|
|
82
|
-
return "faker.date.anytime()";
|
|
83
|
-
},
|
|
84
|
-
/**
|
|
85
|
-
* Type `'date'` Date
|
|
86
|
-
* Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])
|
|
87
|
-
* @default ISO time format (HH:mm:ss[.SSSSSS])
|
|
88
|
-
*/
|
|
89
|
-
time: (type = "string", parser) => {
|
|
90
|
-
if (type === "string") {
|
|
91
|
-
if (parser) {
|
|
92
|
-
return `${parser}(faker.date.anytime()).format("HH:mm:ss")`;
|
|
93
|
-
}
|
|
94
|
-
return "faker.date.anytime().toString()";
|
|
95
|
-
}
|
|
96
|
-
return "faker.date.anytime()";
|
|
97
|
-
},
|
|
98
|
-
uuid: () => "faker.string.uuid()",
|
|
99
|
-
url: () => "faker.internet.url()",
|
|
100
|
-
and: (items = []) => `Object.assign({}, ${items.join(", ")})`,
|
|
101
|
-
object: () => "object",
|
|
102
|
-
ref: () => "ref",
|
|
103
|
-
matches: (value = "", regexGenerator = "faker") => {
|
|
104
|
-
if (regexGenerator === "randexp") {
|
|
105
|
-
return `${transformers__default.default.toRegExpString(value, "RandExp")}.gen()`;
|
|
106
|
-
}
|
|
107
|
-
return `faker.helpers.fromRegExp(${transformers__default.default.toRegExpString(value)})`;
|
|
108
|
-
},
|
|
109
|
-
email: () => "faker.internet.email()",
|
|
110
|
-
firstName: () => "faker.person.firstName()",
|
|
111
|
-
lastName: () => "faker.person.lastName()",
|
|
112
|
-
password: () => "faker.internet.password()",
|
|
113
|
-
phone: () => "faker.phone.number()",
|
|
114
|
-
blob: () => "faker.image.imageUrl() as unknown as Blob",
|
|
115
|
-
default: void 0,
|
|
116
|
-
describe: void 0,
|
|
117
|
-
const: (value) => value ?? "",
|
|
118
|
-
max: void 0,
|
|
119
|
-
min: void 0,
|
|
120
|
-
nullable: void 0,
|
|
121
|
-
nullish: void 0,
|
|
122
|
-
optional: void 0,
|
|
123
|
-
readOnly: void 0,
|
|
124
|
-
strict: void 0,
|
|
125
|
-
deprecated: void 0,
|
|
126
|
-
example: void 0,
|
|
127
|
-
schema: void 0,
|
|
128
|
-
catchall: void 0,
|
|
129
|
-
name: void 0
|
|
130
|
-
};
|
|
131
|
-
function schemaKeywordsorter(a, b) {
|
|
132
|
-
if (b.keyword === "null") {
|
|
133
|
-
return -1;
|
|
134
|
-
}
|
|
135
|
-
return 0;
|
|
136
|
-
}
|
|
137
|
-
function joinItems(items) {
|
|
138
|
-
switch (items.length) {
|
|
139
|
-
case 0:
|
|
140
|
-
return "undefined";
|
|
141
|
-
case 1:
|
|
142
|
-
return items[0];
|
|
143
|
-
default:
|
|
144
|
-
return fakerKeywordMapper.union(items);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function parse(parent, current, options) {
|
|
148
|
-
const value = fakerKeywordMapper[current.keyword];
|
|
149
|
-
if (!value) {
|
|
150
|
-
return void 0;
|
|
151
|
-
}
|
|
152
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.union)) {
|
|
153
|
-
return fakerKeywordMapper.union(current.args.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean));
|
|
154
|
-
}
|
|
155
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.and)) {
|
|
156
|
-
return fakerKeywordMapper.and(current.args.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean));
|
|
157
|
-
}
|
|
158
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.array)) {
|
|
159
|
-
return fakerKeywordMapper.array(current.args.items.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean));
|
|
160
|
-
}
|
|
161
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.enum)) {
|
|
162
|
-
return fakerKeywordMapper.enum(
|
|
163
|
-
current.args.items.map((schema) => {
|
|
164
|
-
if (schema.format === "number") {
|
|
165
|
-
return schema.name;
|
|
166
|
-
}
|
|
167
|
-
return transformers__default.default.stringify(schema.name);
|
|
168
|
-
})
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.ref)) {
|
|
172
|
-
if (!current.args?.name) {
|
|
173
|
-
throw new Error(`Name not defined for keyword ${current.keyword}`);
|
|
174
|
-
}
|
|
175
|
-
if (options.withData) {
|
|
176
|
-
return `${current.args.name}(data)`;
|
|
177
|
-
}
|
|
178
|
-
return `${current.args.name}()`;
|
|
179
|
-
}
|
|
180
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.object)) {
|
|
181
|
-
const argsObject = Object.entries(current.args?.properties || {}).filter((item) => {
|
|
182
|
-
const schema = item[1];
|
|
183
|
-
return schema && typeof schema.map === "function";
|
|
184
|
-
}).map(([name, schemas]) => {
|
|
185
|
-
const nameSchema = schemas.find((schema) => schema.keyword === pluginOas.schemaKeywords.name);
|
|
186
|
-
const mappedName = nameSchema?.args || name;
|
|
187
|
-
if (options.mapper?.[mappedName]) {
|
|
188
|
-
return `"${name}": ${options.mapper?.[mappedName]}`;
|
|
189
|
-
}
|
|
190
|
-
return `"${name}": ${joinItems(
|
|
191
|
-
schemas.sort(schemaKeywordsorter).map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean)
|
|
192
|
-
)}`;
|
|
193
|
-
}).join(",");
|
|
194
|
-
return `{${argsObject}}`;
|
|
195
|
-
}
|
|
196
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.tuple)) {
|
|
197
|
-
if (Array.isArray(current.args.items)) {
|
|
198
|
-
return fakerKeywordMapper.tuple(current.args.items.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean));
|
|
199
|
-
}
|
|
200
|
-
return parse(current, current.args.items, { ...options, withData: false });
|
|
201
|
-
}
|
|
202
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.const)) {
|
|
203
|
-
if (current.args.format === "number" && current.args.name !== void 0) {
|
|
204
|
-
return fakerKeywordMapper.const(current.args.name?.toString());
|
|
205
|
-
}
|
|
206
|
-
return fakerKeywordMapper.const(transformers__default.default.stringify(current.args.value));
|
|
207
|
-
}
|
|
208
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.matches) && current.args) {
|
|
209
|
-
return fakerKeywordMapper.matches(current.args, options.regexGenerator);
|
|
210
|
-
}
|
|
211
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.null) || pluginOas.isKeyword(current, pluginOas.schemaKeywords.undefined) || pluginOas.isKeyword(current, pluginOas.schemaKeywords.any)) {
|
|
212
|
-
return value() || "";
|
|
213
|
-
}
|
|
214
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.string)) {
|
|
215
|
-
if (parent) {
|
|
216
|
-
const minSchema = pluginOas.SchemaGenerator.find([parent], pluginOas.schemaKeywords.min);
|
|
217
|
-
const maxSchema = pluginOas.SchemaGenerator.find([parent], pluginOas.schemaKeywords.max);
|
|
218
|
-
return fakerKeywordMapper.string(minSchema?.args, maxSchema?.args);
|
|
219
|
-
}
|
|
220
|
-
return fakerKeywordMapper.string();
|
|
221
|
-
}
|
|
222
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.number)) {
|
|
223
|
-
if (parent) {
|
|
224
|
-
const minSchema = pluginOas.SchemaGenerator.find([parent], pluginOas.schemaKeywords.min);
|
|
225
|
-
const maxSchema = pluginOas.SchemaGenerator.find([parent], pluginOas.schemaKeywords.max);
|
|
226
|
-
return fakerKeywordMapper.number(minSchema?.args, maxSchema?.args);
|
|
227
|
-
}
|
|
228
|
-
return fakerKeywordMapper.number();
|
|
229
|
-
}
|
|
230
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.integer)) {
|
|
231
|
-
if (parent) {
|
|
232
|
-
const minSchema = pluginOas.SchemaGenerator.find([parent], pluginOas.schemaKeywords.min);
|
|
233
|
-
const maxSchema = pluginOas.SchemaGenerator.find([parent], pluginOas.schemaKeywords.max);
|
|
234
|
-
return fakerKeywordMapper.integer(minSchema?.args, maxSchema?.args);
|
|
235
|
-
}
|
|
236
|
-
return fakerKeywordMapper.integer();
|
|
237
|
-
}
|
|
238
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.datetime)) {
|
|
239
|
-
return fakerKeywordMapper.datetime();
|
|
240
|
-
}
|
|
241
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.date)) {
|
|
242
|
-
return fakerKeywordMapper.date(current.args.type, options.dateParser);
|
|
243
|
-
}
|
|
244
|
-
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.time)) {
|
|
245
|
-
return fakerKeywordMapper.time(current.args.type, options.dateParser);
|
|
246
|
-
}
|
|
247
|
-
if (current.keyword in fakerKeywordMapper && "args" in current) {
|
|
248
|
-
const value2 = fakerKeywordMapper[current.keyword];
|
|
249
|
-
const options2 = JSON.stringify(current.args);
|
|
250
|
-
return value2(options2);
|
|
251
|
-
}
|
|
252
|
-
if (current.keyword in fakerKeywordMapper) {
|
|
253
|
-
return value();
|
|
254
|
-
}
|
|
255
|
-
return void 0;
|
|
256
|
-
}
|
|
257
|
-
function Schema(props) {
|
|
258
|
-
const { withData, description } = props;
|
|
259
|
-
const { tree, name } = hooks.useSchema();
|
|
260
|
-
const {
|
|
261
|
-
pluginManager,
|
|
262
|
-
plugin: {
|
|
263
|
-
options: { dateParser, regexGenerator, mapper, seed }
|
|
264
|
-
}
|
|
265
|
-
} = react.useApp();
|
|
266
|
-
const resolvedName = pluginManager.resolveName({
|
|
267
|
-
name,
|
|
268
|
-
pluginKey: [pluginFakerName],
|
|
269
|
-
type: "function"
|
|
270
|
-
});
|
|
271
|
-
const typeName = pluginManager.resolveName({
|
|
272
|
-
name,
|
|
273
|
-
pluginKey: [pluginTs.pluginTsName],
|
|
274
|
-
type: "type"
|
|
275
|
-
});
|
|
276
|
-
const fakerText = joinItems(
|
|
277
|
-
tree.map((schema) => parse(void 0, schema, { name: resolvedName, typeName, seed, regexGenerator, mapper, withData, dateParser })).filter(Boolean)
|
|
278
|
-
);
|
|
279
|
-
let fakerDefaultOverride = void 0;
|
|
280
|
-
let fakerTextWithOverride = fakerText;
|
|
281
|
-
if (withData && fakerText.startsWith("{")) {
|
|
282
|
-
fakerDefaultOverride = "{}";
|
|
283
|
-
fakerTextWithOverride = `{
|
|
284
|
-
...${fakerText},
|
|
285
|
-
...data
|
|
286
|
-
}`;
|
|
287
|
-
}
|
|
288
|
-
if (withData && fakerText.startsWith("faker.helpers.arrayElements")) {
|
|
289
|
-
fakerDefaultOverride = "[]";
|
|
290
|
-
fakerTextWithOverride = `[
|
|
291
|
-
...${fakerText},
|
|
292
|
-
...data
|
|
293
|
-
]`;
|
|
294
|
-
}
|
|
295
|
-
const params = fakerDefaultOverride ? `data: NonNullable<Partial<${typeName}>> = ${fakerDefaultOverride}` : `data?: NonNullable<Partial<${typeName}>>`;
|
|
296
|
-
const containsFaker = !!fakerTextWithOverride.match(/faker/) || !!seed;
|
|
297
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
298
|
-
containsFaker && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["faker"], path: "@faker-js/faker" }),
|
|
299
|
-
/* @__PURE__ */ jsxRuntime.jsxs(react.File.Source, { name: resolvedName, isExportable: true, isIndexable: true, children: [
|
|
300
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
301
|
-
react.Function,
|
|
302
|
-
{
|
|
303
|
-
export: true,
|
|
304
|
-
name: resolvedName,
|
|
305
|
-
JSDoc: { comments: [description ? `@description ${transformers__default.default.jsStringEscape(description)}` : void 0].filter(Boolean) },
|
|
306
|
-
params: withData ? params : "",
|
|
307
|
-
returnType: typeName ? `NonNullable<${typeName}>` : "",
|
|
308
|
-
children: [
|
|
309
|
-
seed ? `faker.seed(${JSON.stringify(seed)})` : "",
|
|
310
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
311
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Function.Return, { children: fakerTextWithOverride })
|
|
312
|
-
]
|
|
313
|
-
}
|
|
314
|
-
),
|
|
315
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {})
|
|
316
|
-
] })
|
|
317
|
-
] });
|
|
318
|
-
}
|
|
319
|
-
Schema.File = function({}) {
|
|
320
|
-
const { pluginManager } = react.useApp();
|
|
321
|
-
const { tree, schema } = hooks.useSchema();
|
|
322
|
-
const withData = tree.some(
|
|
323
|
-
(schema2) => schema2.keyword === pluginOas.schemaKeywords.array || schema2.keyword === pluginOas.schemaKeywords.and || schema2.keyword === pluginOas.schemaKeywords.object || schema2.keyword === pluginOas.schemaKeywords.union || schema2.keyword === pluginOas.schemaKeywords.tuple
|
|
324
|
-
);
|
|
325
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(components.Oas.Schema.File, { output: pluginManager.config.output.path, children: [
|
|
326
|
-
/* @__PURE__ */ jsxRuntime.jsx(Schema.Imports, {}),
|
|
327
|
-
/* @__PURE__ */ jsxRuntime.jsx(Schema, { description: schema?.description, withData })
|
|
328
|
-
] });
|
|
329
|
-
};
|
|
330
|
-
Schema.Imports = () => {
|
|
331
|
-
const {
|
|
332
|
-
pluginManager,
|
|
333
|
-
plugin: {
|
|
334
|
-
options: { extName, dateParser, regexGenerator }
|
|
335
|
-
}
|
|
336
|
-
} = react.useApp();
|
|
337
|
-
const { path: root } = react.useFile();
|
|
338
|
-
const { name, tree, schema } = hooks.useSchema();
|
|
339
|
-
const typeName = pluginManager.resolveName({
|
|
340
|
-
name,
|
|
341
|
-
pluginKey: [pluginTs.pluginTsName],
|
|
342
|
-
type: "type"
|
|
343
|
-
});
|
|
344
|
-
const typeFileName = pluginManager.resolveName({
|
|
345
|
-
name,
|
|
346
|
-
pluginKey: [pluginTs.pluginTsName],
|
|
347
|
-
type: "file"
|
|
348
|
-
});
|
|
349
|
-
const typePath = pluginManager.resolvePath({
|
|
350
|
-
baseName: typeFileName,
|
|
351
|
-
pluginKey: [pluginTs.pluginTsName]
|
|
352
|
-
});
|
|
353
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
354
|
-
regexGenerator === "randexp" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "RandExp", path: "randexp" }),
|
|
355
|
-
dateParser && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { path: dateParser, name: dateParser }),
|
|
356
|
-
typeName && typePath && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { isTypeOnly: true, root, path: typePath, name: [typeName] })
|
|
357
|
-
] });
|
|
358
|
-
};
|
|
359
|
-
var SchemaGenerator2 = class extends pluginOas.SchemaGenerator {
|
|
360
|
-
async schema(name, schema, options) {
|
|
361
|
-
const { oas, pluginManager, plugin, mode, output } = this.context;
|
|
362
|
-
const root = react.createRoot({
|
|
363
|
-
logger: pluginManager.logger
|
|
364
|
-
});
|
|
365
|
-
const tree = this.parse({ schema, name });
|
|
366
|
-
root.render(
|
|
367
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsxRuntime.jsx(components.Oas, { oas, children: /* @__PURE__ */ jsxRuntime.jsx(components.Oas.Schema, { name, value: schema, tree, children: /* @__PURE__ */ jsxRuntime.jsx(Schema.File, {}) }) }) })
|
|
368
|
-
);
|
|
369
|
-
return root.files;
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
function OperationSchema({ description }) {
|
|
373
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Schema, { withData: false, description });
|
|
374
|
-
}
|
|
375
|
-
OperationSchema.File = function({}) {
|
|
376
|
-
const { plugin, pluginManager, mode } = react.useApp();
|
|
377
|
-
const oas = hooks.useOas();
|
|
378
|
-
const { getSchemas, getFile } = hooks.useOperationManager();
|
|
379
|
-
const operation = hooks.useOperation();
|
|
380
|
-
const file = getFile(operation);
|
|
381
|
-
const schemas = getSchemas(operation);
|
|
382
|
-
const generator = new SchemaGenerator2(plugin.options, {
|
|
383
|
-
oas,
|
|
384
|
-
plugin,
|
|
385
|
-
pluginManager,
|
|
386
|
-
mode,
|
|
387
|
-
override: plugin.options.override
|
|
388
|
-
});
|
|
389
|
-
const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean);
|
|
390
|
-
const mapItem = ({ name, schema, description, ...options }, i) => {
|
|
391
|
-
const typeName = pluginManager.resolveName({
|
|
392
|
-
name,
|
|
393
|
-
pluginKey: [pluginTs.pluginTsName],
|
|
394
|
-
type: "type"
|
|
395
|
-
});
|
|
396
|
-
const typeFileName = pluginManager.resolveName({
|
|
397
|
-
name: options.operationName || name,
|
|
398
|
-
pluginKey: [pluginTs.pluginTsName],
|
|
399
|
-
type: "file"
|
|
400
|
-
});
|
|
401
|
-
const typePath = pluginManager.resolvePath({
|
|
402
|
-
baseName: typeFileName,
|
|
403
|
-
pluginKey: [pluginTs.pluginTsName],
|
|
404
|
-
options: { tag: options.operation?.getTags()[0]?.name }
|
|
405
|
-
});
|
|
406
|
-
const tree = generator.parse({ schema, name });
|
|
407
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(components.Oas.Schema, { name, value: schema, tree, children: [
|
|
408
|
-
typeName && typePath && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { isTypeOnly: true, root: file.path, path: typePath, name: [typeName] }),
|
|
409
|
-
plugin.options.dateParser && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { path: plugin.options.dateParser, name: plugin.options.dateParser }),
|
|
410
|
-
mode === "split" && /* @__PURE__ */ jsxRuntime.jsx(components.Oas.Schema.Imports, {}),
|
|
411
|
-
/* @__PURE__ */ jsxRuntime.jsx(OperationSchema, { description })
|
|
412
|
-
] }, i);
|
|
413
|
-
};
|
|
414
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
|
|
415
|
-
plugin.options.regexGenerator === "randexp" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "RandExp", path: "randexp" }),
|
|
416
|
-
items.map(mapItem)
|
|
417
|
-
] });
|
|
418
|
-
};
|
|
419
|
-
var OperationGenerator = class extends pluginOas.OperationGenerator {
|
|
420
|
-
async operation(operation, options) {
|
|
421
|
-
const { oas, pluginManager, plugin, mode } = this.context;
|
|
422
|
-
const root = react.createRoot({
|
|
423
|
-
logger: pluginManager.logger
|
|
424
|
-
});
|
|
425
|
-
root.render(
|
|
426
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsxRuntime.jsx(components.Oas, { oas, operations: [operation], generator: this, children: /* @__PURE__ */ jsxRuntime.jsx(components.Oas.Operation, { operation, children: /* @__PURE__ */ jsxRuntime.jsx(OperationSchema.File, {}) }) }) })
|
|
427
|
-
);
|
|
428
|
-
return root.files;
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
// src/plugin.ts
|
|
433
16
|
var pluginFakerName = "plugin-faker";
|
|
434
17
|
var pluginFaker = core.createPlugin((options) => {
|
|
435
18
|
const {
|
|
@@ -439,11 +22,11 @@ var pluginFaker = core.createPlugin((options) => {
|
|
|
439
22
|
exclude = [],
|
|
440
23
|
include,
|
|
441
24
|
override = [],
|
|
442
|
-
transformers:
|
|
25
|
+
transformers: transformers$1 = {},
|
|
443
26
|
mapper = {},
|
|
444
|
-
dateType = "string",
|
|
445
27
|
unknownType = "any",
|
|
446
|
-
|
|
28
|
+
dateType = "string",
|
|
29
|
+
dateParser = "faker",
|
|
447
30
|
regexGenerator = "faker"
|
|
448
31
|
} = options;
|
|
449
32
|
const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`;
|
|
@@ -454,10 +37,9 @@ var pluginFaker = core.createPlugin((options) => {
|
|
|
454
37
|
...output
|
|
455
38
|
},
|
|
456
39
|
options: {
|
|
457
|
-
|
|
458
|
-
transformers: transformers3,
|
|
459
|
-
dateType,
|
|
40
|
+
transformers: transformers$1,
|
|
460
41
|
seed,
|
|
42
|
+
dateType,
|
|
461
43
|
unknownType,
|
|
462
44
|
dateParser,
|
|
463
45
|
mapper,
|
|
@@ -483,7 +65,7 @@ var pluginFaker = core.createPlugin((options) => {
|
|
|
483
65
|
isFile: type === "file"
|
|
484
66
|
});
|
|
485
67
|
if (type) {
|
|
486
|
-
return
|
|
68
|
+
return transformers$1?.name?.(resolvedName, type) || resolvedName;
|
|
487
69
|
}
|
|
488
70
|
return resolvedName;
|
|
489
71
|
},
|
|
@@ -492,7 +74,7 @@ var pluginFaker = core.createPlugin((options) => {
|
|
|
492
74
|
const oas = await swaggerPlugin.context.getOas();
|
|
493
75
|
const root = path__default.default.resolve(this.config.root, this.config.output.path);
|
|
494
76
|
const mode = core.FileManager.getMode(path__default.default.resolve(root, output.path));
|
|
495
|
-
const schemaGenerator = new
|
|
77
|
+
const schemaGenerator = new pluginOas.SchemaGenerator(this.plugin.options, {
|
|
496
78
|
oas,
|
|
497
79
|
pluginManager: this.pluginManager,
|
|
498
80
|
plugin: this.plugin,
|
|
@@ -502,9 +84,9 @@ var pluginFaker = core.createPlugin((options) => {
|
|
|
502
84
|
mode,
|
|
503
85
|
output: output.path
|
|
504
86
|
});
|
|
505
|
-
const schemaFiles = await schemaGenerator.build();
|
|
87
|
+
const schemaFiles = await schemaGenerator.build(chunkCJMJFFHG_cjs.fakerGenerator);
|
|
506
88
|
await this.addFile(...schemaFiles);
|
|
507
|
-
const operationGenerator = new OperationGenerator(this.plugin.options, {
|
|
89
|
+
const operationGenerator = new pluginOas.OperationGenerator(this.plugin.options, {
|
|
508
90
|
oas,
|
|
509
91
|
pluginManager: this.pluginManager,
|
|
510
92
|
plugin: this.plugin,
|
|
@@ -514,7 +96,7 @@ var pluginFaker = core.createPlugin((options) => {
|
|
|
514
96
|
override,
|
|
515
97
|
mode
|
|
516
98
|
});
|
|
517
|
-
const operationFiles = await operationGenerator.build();
|
|
99
|
+
const operationFiles = await operationGenerator.build(chunkCJMJFFHG_cjs.fakerGenerator);
|
|
518
100
|
await this.addFile(...operationFiles);
|
|
519
101
|
if (this.config.output.exportType) {
|
|
520
102
|
const barrelFiles = await this.fileManager.getBarrelFiles({
|