@kubb/plugin-faker 5.0.0-alpha.8 → 5.0.0-beta.3
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/LICENSE +17 -10
- package/README.md +1 -4
- package/dist/Faker-BgleOzVN.cjs +486 -0
- package/dist/Faker-BgleOzVN.cjs.map +1 -0
- package/dist/Faker-CdyPfOPg.d.ts +27 -0
- package/dist/Faker-fcQEB9i5.js +384 -0
- package/dist/Faker-fcQEB9i5.js.map +1 -0
- package/dist/components.cjs +2 -2
- package/dist/components.d.ts +2 -31
- package/dist/components.js +1 -1
- package/dist/fakerGenerator-C3Ho3BaI.d.ts +9 -0
- package/dist/fakerGenerator-D7daHCh6.js +516 -0
- package/dist/fakerGenerator-D7daHCh6.js.map +1 -0
- package/dist/fakerGenerator-VJEVzLjc.cjs +526 -0
- package/dist/fakerGenerator-VJEVzLjc.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +2 -476
- package/dist/generators.js +1 -1
- package/dist/index.cjs +136 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -4
- package/dist/index.js +128 -83
- package/dist/index.js.map +1 -1
- package/dist/printerFaker-CJiwzoto.d.ts +206 -0
- package/package.json +52 -50
- package/src/components/Faker.tsx +124 -78
- package/src/generators/fakerGenerator.tsx +235 -134
- package/src/index.ts +7 -2
- package/src/plugin.ts +60 -121
- package/src/printers/printerFaker.ts +341 -0
- package/src/resolvers/resolverFaker.ts +92 -0
- package/src/types.ts +127 -81
- package/src/utils.ts +356 -0
- package/dist/components-BkBIov4R.js +0 -419
- package/dist/components-BkBIov4R.js.map +0 -1
- package/dist/components-IdP8GXXX.cjs +0 -461
- package/dist/components-IdP8GXXX.cjs.map +0 -1
- package/dist/fakerGenerator-CYUCNH3Q.cjs +0 -204
- package/dist/fakerGenerator-CYUCNH3Q.cjs.map +0 -1
- package/dist/fakerGenerator-M5oCrPmy.js +0 -200
- package/dist/fakerGenerator-M5oCrPmy.js.map +0 -1
- package/dist/types-r7BubMLO.d.ts +0 -132
- package/src/parser.ts +0 -453
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
|
+
import { a as filterUsedImports, c as resolveSchemaRef, d as trimQuotes, i as canOverrideSchema, l as resolveTypeReference, n as aliasConflictingImports, o as localeToFakerImport, r as buildResponseUnionSchema, s as resolveParamNameByLocation, t as Faker, u as rewriteAliasedImports } from "./Faker-fcQEB9i5.js";
|
|
3
|
+
import { ast, defineGenerator } from "@kubb/core";
|
|
4
|
+
import { pluginTsName } from "@kubb/plugin-ts";
|
|
5
|
+
import { File, jsxRenderer } from "@kubb/renderer-jsx";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
|
|
7
|
+
//#region ../../internals/utils/src/object.ts
|
|
8
|
+
/**
|
|
9
|
+
* Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* stringify('hello') // '"hello"'
|
|
13
|
+
* stringify('"hello"') // '"hello"'
|
|
14
|
+
*/
|
|
15
|
+
function stringify(value) {
|
|
16
|
+
if (value === void 0 || value === null) return "\"\"";
|
|
17
|
+
return JSON.stringify(trimQuotes(value.toString()));
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ../../internals/utils/src/regexp.ts
|
|
21
|
+
/**
|
|
22
|
+
* Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.
|
|
23
|
+
* Inline flags expressed as `^(?im)` prefixes are extracted and applied to the resulting expression.
|
|
24
|
+
* Pass `null` as the second argument to emit a `/pattern/flags` literal instead.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* toRegExpString('^(?im)foo') // → 'new RegExp("foo", "im")'
|
|
28
|
+
* toRegExpString('^(?im)foo', null) // → '/foo/im'
|
|
29
|
+
*/
|
|
30
|
+
function toRegExpString(text, func = "RegExp") {
|
|
31
|
+
const raw = trimQuotes(text);
|
|
32
|
+
const match = raw.match(/^\^(\(\?([igmsuy]+)\))/i);
|
|
33
|
+
const replacementTarget = match?.[1] ?? "";
|
|
34
|
+
const matchedFlags = match?.[2];
|
|
35
|
+
const cleaned = raw.replace(/^\\?\//, "").replace(/\\?\/$/, "").replace(replacementTarget, "");
|
|
36
|
+
const { source, flags } = new RegExp(cleaned, matchedFlags);
|
|
37
|
+
if (func === null) return `/${source}/${flags}`;
|
|
38
|
+
return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ""})`;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/printers/printerFaker.ts
|
|
42
|
+
const fakerKeywordMapper = {
|
|
43
|
+
any: () => "undefined",
|
|
44
|
+
unknown: () => "undefined",
|
|
45
|
+
void: () => "undefined",
|
|
46
|
+
number: (min, max) => {
|
|
47
|
+
if (max !== void 0 && min !== void 0) return `faker.number.float({ min: ${min}, max: ${max} })`;
|
|
48
|
+
if (max !== void 0) return `faker.number.float({ max: ${max} })`;
|
|
49
|
+
if (min !== void 0) return `faker.number.float({ min: ${min} })`;
|
|
50
|
+
return "faker.number.float()";
|
|
51
|
+
},
|
|
52
|
+
integer: (min, max) => {
|
|
53
|
+
if (max !== void 0 && min !== void 0) return `faker.number.int({ min: ${min}, max: ${max} })`;
|
|
54
|
+
if (max !== void 0) return `faker.number.int({ max: ${max} })`;
|
|
55
|
+
if (min !== void 0) return `faker.number.int({ min: ${min} })`;
|
|
56
|
+
return "faker.number.int()";
|
|
57
|
+
},
|
|
58
|
+
bigint: () => "faker.number.bigInt()",
|
|
59
|
+
string: (min, max) => {
|
|
60
|
+
if (max !== void 0 && min !== void 0) return `faker.string.alpha({ length: { min: ${min}, max: ${max} } })`;
|
|
61
|
+
if (max !== void 0) return `faker.string.alpha({ length: ${max} })`;
|
|
62
|
+
if (min !== void 0) return `faker.string.alpha({ length: ${min} })`;
|
|
63
|
+
return "faker.string.alpha()";
|
|
64
|
+
},
|
|
65
|
+
boolean: () => "faker.datatype.boolean()",
|
|
66
|
+
null: () => "null",
|
|
67
|
+
array: (items = [], min, max) => {
|
|
68
|
+
if (items.length > 1) return `faker.helpers.arrayElements([${items.join(", ")}])`;
|
|
69
|
+
const item = items.at(0);
|
|
70
|
+
if (min !== void 0 && max !== void 0) return `faker.helpers.multiple(() => (${item}), { count: { min: ${min}, max: ${max} }})`;
|
|
71
|
+
if (min !== void 0) return `faker.helpers.multiple(() => (${item}), { count: ${min} })`;
|
|
72
|
+
if (max !== void 0) return `faker.helpers.multiple(() => (${item}), { count: { min: 0, max: ${max} }})`;
|
|
73
|
+
return `faker.helpers.multiple(() => (${item}))`;
|
|
74
|
+
},
|
|
75
|
+
tuple: (items = []) => `[${items.join(", ")}]`,
|
|
76
|
+
enum: (items = [], type = "any") => `faker.helpers.arrayElement<${type}>([${items.join(", ")}])`,
|
|
77
|
+
union: (items = []) => `faker.helpers.arrayElement<any>([${items.join(", ")}])`,
|
|
78
|
+
datetime: () => "faker.date.anytime().toISOString()",
|
|
79
|
+
date: (representation = "string", parser = "faker") => {
|
|
80
|
+
if (representation === "string") {
|
|
81
|
+
if (parser !== "faker") return `${parser}(faker.date.anytime()).format("YYYY-MM-DD")`;
|
|
82
|
+
return "faker.date.anytime().toISOString().substring(0, 10)";
|
|
83
|
+
}
|
|
84
|
+
if (parser !== "faker") throw new Error(`type '${representation}' and parser '${parser}' can not work together`);
|
|
85
|
+
return "faker.date.anytime()";
|
|
86
|
+
},
|
|
87
|
+
time: (representation = "string", parser = "faker") => {
|
|
88
|
+
if (representation === "string") {
|
|
89
|
+
if (parser !== "faker") return `${parser}(faker.date.anytime()).format("HH:mm:ss")`;
|
|
90
|
+
return "faker.date.anytime().toISOString().substring(11, 19)";
|
|
91
|
+
}
|
|
92
|
+
if (parser !== "faker") throw new Error(`type '${representation}' and parser '${parser}' can not work together`);
|
|
93
|
+
return "faker.date.anytime()";
|
|
94
|
+
},
|
|
95
|
+
uuid: () => "faker.string.uuid()",
|
|
96
|
+
url: () => "faker.internet.url()",
|
|
97
|
+
and: (items = []) => {
|
|
98
|
+
if (items.length === 0) return "{}";
|
|
99
|
+
if (items.length === 1) return items[0] ?? "{}";
|
|
100
|
+
return `{...${items.join(", ...")}}`;
|
|
101
|
+
},
|
|
102
|
+
matches: (value = "", regexGenerator = "faker") => {
|
|
103
|
+
if (regexGenerator === "randexp") return `${toRegExpString(value, "RandExp")}.gen()`;
|
|
104
|
+
return `faker.helpers.fromRegExp("${value}")`;
|
|
105
|
+
},
|
|
106
|
+
email: () => "faker.internet.email()",
|
|
107
|
+
blob: () => "faker.image.url() as unknown as Blob"
|
|
108
|
+
};
|
|
109
|
+
function getEnumValues(node) {
|
|
110
|
+
if (node.namedEnumValues?.length) return node.namedEnumValues.map((item) => item.value);
|
|
111
|
+
return node.enumValues ?? [];
|
|
112
|
+
}
|
|
113
|
+
function parseEnumValue(value) {
|
|
114
|
+
if (typeof value === "string") return stringify(value);
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Creates a Faker printer that generates mock data generation code from schema nodes.
|
|
119
|
+
* Handles circular references gracefully by emitting memoizing getters for cyclic properties.
|
|
120
|
+
*/
|
|
121
|
+
const printerFaker = ast.definePrinter((options) => {
|
|
122
|
+
const printNested = (node, overrideOptions = {}) => {
|
|
123
|
+
return printerFaker({
|
|
124
|
+
...options,
|
|
125
|
+
...overrideOptions,
|
|
126
|
+
nodes: options.nodes
|
|
127
|
+
}).print(node) ?? "undefined";
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
name: "faker",
|
|
131
|
+
options,
|
|
132
|
+
nodes: {
|
|
133
|
+
any: () => fakerKeywordMapper.any(),
|
|
134
|
+
unknown: () => fakerKeywordMapper.unknown(),
|
|
135
|
+
void: () => fakerKeywordMapper.void(),
|
|
136
|
+
boolean: () => fakerKeywordMapper.boolean(),
|
|
137
|
+
null: () => fakerKeywordMapper.null(),
|
|
138
|
+
string(node) {
|
|
139
|
+
if (node.pattern) return fakerKeywordMapper.matches(node.pattern, this.options.regexGenerator);
|
|
140
|
+
return fakerKeywordMapper.string(node.min, node.max);
|
|
141
|
+
},
|
|
142
|
+
email: () => fakerKeywordMapper.email(),
|
|
143
|
+
url: () => fakerKeywordMapper.url(),
|
|
144
|
+
uuid: () => fakerKeywordMapper.uuid(),
|
|
145
|
+
number(node) {
|
|
146
|
+
return fakerKeywordMapper.number(node.min, node.max);
|
|
147
|
+
},
|
|
148
|
+
integer(node) {
|
|
149
|
+
return fakerKeywordMapper.integer(node.min, node.max);
|
|
150
|
+
},
|
|
151
|
+
bigint: () => fakerKeywordMapper.bigint(),
|
|
152
|
+
blob: () => fakerKeywordMapper.blob(),
|
|
153
|
+
datetime: () => fakerKeywordMapper.datetime(),
|
|
154
|
+
date(node) {
|
|
155
|
+
return fakerKeywordMapper.date(node.representation ?? "string", this.options.dateParser);
|
|
156
|
+
},
|
|
157
|
+
time(node) {
|
|
158
|
+
return fakerKeywordMapper.time(node.representation ?? "string", this.options.dateParser);
|
|
159
|
+
},
|
|
160
|
+
ref(node) {
|
|
161
|
+
const refName = node.ref ? ast.extractRefName(node.ref) ?? node.name ?? node.schema?.name : node.name ?? node.schema?.name;
|
|
162
|
+
if (!refName) throw new Error("Name not defined for ref node");
|
|
163
|
+
if (this.options.schemaName && refName === this.options.schemaName) return "undefined as any";
|
|
164
|
+
const resolvedName = node.ref ? this.options.resolver.resolveName(refName) : refName;
|
|
165
|
+
if (!this.options.nestedInObject) return `${resolvedName}(data)`;
|
|
166
|
+
return `${resolvedName}()`;
|
|
167
|
+
},
|
|
168
|
+
enum(node) {
|
|
169
|
+
return fakerKeywordMapper.enum(getEnumValues(node).map(parseEnumValue), this.options.typeName);
|
|
170
|
+
},
|
|
171
|
+
union(node) {
|
|
172
|
+
const items = (node.members ?? []).map((member) => printNested(member, { nestedInObject: true })).filter((item) => Boolean(item));
|
|
173
|
+
return fakerKeywordMapper.union(items);
|
|
174
|
+
},
|
|
175
|
+
intersection(node) {
|
|
176
|
+
const items = (node.members ?? []).map((member) => printNested(member, { nestedInObject: true })).filter((item) => Boolean(item));
|
|
177
|
+
return fakerKeywordMapper.and(items);
|
|
178
|
+
},
|
|
179
|
+
array(node) {
|
|
180
|
+
const items = (node.items ?? []).map((member) => printNested(member, {
|
|
181
|
+
typeName: this.options.typeName ? `NonNullable<${this.options.typeName}>[number]` : void 0,
|
|
182
|
+
nestedInObject: true
|
|
183
|
+
})).filter((item) => Boolean(item));
|
|
184
|
+
return fakerKeywordMapper.array(items, node.min, node.max);
|
|
185
|
+
},
|
|
186
|
+
tuple(node) {
|
|
187
|
+
const items = (node.items ?? []).map((member, index) => printNested(member, {
|
|
188
|
+
typeName: this.options.typeName ? `NonNullable<${this.options.typeName}>[${index}]` : void 0,
|
|
189
|
+
nestedInObject: true
|
|
190
|
+
})).filter((item) => Boolean(item));
|
|
191
|
+
return fakerKeywordMapper.tuple(items);
|
|
192
|
+
},
|
|
193
|
+
object(node) {
|
|
194
|
+
const cyclicSchemas = this.options.cyclicSchemas;
|
|
195
|
+
return `{${(node.properties ?? []).map((property) => {
|
|
196
|
+
if (this.options.mapper && Object.hasOwn(this.options.mapper, property.name)) return `"${property.name}": ${this.options.mapper[property.name]}`;
|
|
197
|
+
const value = printNested(property.schema, {
|
|
198
|
+
typeName: this.options.typeName ? `NonNullable<${this.options.typeName}>[${JSON.stringify(property.name)}]` : void 0,
|
|
199
|
+
nestedInObject: true
|
|
200
|
+
}) ?? "undefined";
|
|
201
|
+
if (cyclicSchemas && ast.containsCircularRef(property.schema, {
|
|
202
|
+
circularSchemas: cyclicSchemas,
|
|
203
|
+
excludeName: this.options.schemaName
|
|
204
|
+
})) return `get ${property.name}() { const _value = ${value}; Object.defineProperty(this, ${JSON.stringify(property.name)}, { value: _value, configurable: true, writable: true, enumerable: true }); return _value }`;
|
|
205
|
+
return `"${property.name}": ${value}`;
|
|
206
|
+
}).join(",")}}`;
|
|
207
|
+
},
|
|
208
|
+
...options.nodes
|
|
209
|
+
},
|
|
210
|
+
print(node) {
|
|
211
|
+
return this.transform(node) ?? null;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/generators/fakerGenerator.tsx
|
|
217
|
+
const fakerGenerator = defineGenerator({
|
|
218
|
+
name: "faker",
|
|
219
|
+
renderer: jsxRenderer,
|
|
220
|
+
schema(node, ctx) {
|
|
221
|
+
const { adapter, config, resolver, root } = ctx;
|
|
222
|
+
const { output, group, dateParser, regexGenerator, mapper, seed, locale, printer } = ctx.options;
|
|
223
|
+
const pluginTs = ctx.driver.getPlugin(pluginTsName);
|
|
224
|
+
if (!node.name || !pluginTs || !adapter.inputNode) return;
|
|
225
|
+
const tsResolver = ctx.driver.getResolver(pluginTsName);
|
|
226
|
+
const schemaNode = resolveSchemaRef(node, adapter.inputNode.schemas);
|
|
227
|
+
const schemaName = schemaNode.name ?? node.name;
|
|
228
|
+
const mode = ctx.getMode(output);
|
|
229
|
+
const meta = {
|
|
230
|
+
name: resolver.resolveName(schemaName),
|
|
231
|
+
file: resolver.resolveFile({
|
|
232
|
+
name: schemaName,
|
|
233
|
+
extname: ".ts"
|
|
234
|
+
}, {
|
|
235
|
+
root,
|
|
236
|
+
output,
|
|
237
|
+
group
|
|
238
|
+
}),
|
|
239
|
+
typeName: tsResolver.resolveTypeName(schemaName),
|
|
240
|
+
typeFile: tsResolver.resolveFile({
|
|
241
|
+
name: schemaName,
|
|
242
|
+
extname: ".ts"
|
|
243
|
+
}, {
|
|
244
|
+
root,
|
|
245
|
+
output: pluginTs.options?.output ?? output,
|
|
246
|
+
group: pluginTs.options?.group
|
|
247
|
+
})
|
|
248
|
+
};
|
|
249
|
+
const canOverride = canOverrideSchema(schemaNode);
|
|
250
|
+
const cyclicSchemas = adapter.inputNode ? ast.findCircularSchemas(adapter.inputNode.schemas) : void 0;
|
|
251
|
+
const printerInstance = printerFaker({
|
|
252
|
+
resolver,
|
|
253
|
+
schemaName,
|
|
254
|
+
typeName: meta.typeName,
|
|
255
|
+
dateParser,
|
|
256
|
+
regexGenerator,
|
|
257
|
+
mapper,
|
|
258
|
+
nodes: printer?.nodes,
|
|
259
|
+
cyclicSchemas
|
|
260
|
+
});
|
|
261
|
+
const fakerText = printerInstance.print(schemaNode) ?? "undefined";
|
|
262
|
+
const typeReference = resolveTypeReference({
|
|
263
|
+
node: schemaNode,
|
|
264
|
+
canOverride,
|
|
265
|
+
name: meta.name,
|
|
266
|
+
typeName: meta.typeName,
|
|
267
|
+
filePath: meta.file.path,
|
|
268
|
+
typeFilePath: meta.typeFile.path
|
|
269
|
+
});
|
|
270
|
+
const usedImports = filterUsedImports(adapter.getImports(schemaNode, (schemaName) => ({
|
|
271
|
+
name: resolver.resolveName(schemaName),
|
|
272
|
+
path: resolver.resolveFile({
|
|
273
|
+
name: schemaName,
|
|
274
|
+
extname: ".ts"
|
|
275
|
+
}, {
|
|
276
|
+
root,
|
|
277
|
+
output,
|
|
278
|
+
group
|
|
279
|
+
}).path
|
|
280
|
+
})).filter((entry) => entry.path !== meta.file.path), fakerText);
|
|
281
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
282
|
+
baseName: meta.file.baseName,
|
|
283
|
+
path: meta.file.path,
|
|
284
|
+
meta: meta.file.meta,
|
|
285
|
+
banner: resolver.resolveBanner(adapter.inputNode, {
|
|
286
|
+
output,
|
|
287
|
+
config
|
|
288
|
+
}),
|
|
289
|
+
footer: resolver.resolveFooter(adapter.inputNode, {
|
|
290
|
+
output,
|
|
291
|
+
config
|
|
292
|
+
}),
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
295
|
+
name: locale ? [{
|
|
296
|
+
propertyName: localeToFakerImport(locale),
|
|
297
|
+
name: "faker"
|
|
298
|
+
}] : ["faker"],
|
|
299
|
+
path: "@faker-js/faker"
|
|
300
|
+
}),
|
|
301
|
+
regexGenerator === "randexp" && /* @__PURE__ */ jsx(File.Import, {
|
|
302
|
+
name: "RandExp",
|
|
303
|
+
path: "randexp"
|
|
304
|
+
}),
|
|
305
|
+
dateParser !== "faker" && /* @__PURE__ */ jsx(File.Import, {
|
|
306
|
+
path: dateParser,
|
|
307
|
+
name: dateParser
|
|
308
|
+
}),
|
|
309
|
+
typeReference.importPath && /* @__PURE__ */ jsx(File.Import, {
|
|
310
|
+
isTypeOnly: true,
|
|
311
|
+
root: meta.file.path,
|
|
312
|
+
path: typeReference.importPath,
|
|
313
|
+
name: [meta.typeName]
|
|
314
|
+
}),
|
|
315
|
+
mode === "split" && usedImports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
|
|
316
|
+
root: meta.file.path,
|
|
317
|
+
path: imp.path,
|
|
318
|
+
name: imp.name
|
|
319
|
+
}, [
|
|
320
|
+
schemaName,
|
|
321
|
+
imp.path,
|
|
322
|
+
imp.name
|
|
323
|
+
].join("-"))),
|
|
324
|
+
/* @__PURE__ */ jsx(Faker, {
|
|
325
|
+
name: meta.name,
|
|
326
|
+
typeName: typeReference.typeName,
|
|
327
|
+
description: schemaNode.description,
|
|
328
|
+
node: schemaNode,
|
|
329
|
+
printer: printerInstance,
|
|
330
|
+
seed,
|
|
331
|
+
canOverride
|
|
332
|
+
})
|
|
333
|
+
]
|
|
334
|
+
});
|
|
335
|
+
},
|
|
336
|
+
operation(node, ctx) {
|
|
337
|
+
const { adapter, config, resolver, root } = ctx;
|
|
338
|
+
const { output, group, paramsCasing, dateParser, regexGenerator, mapper, seed, locale, printer } = ctx.options;
|
|
339
|
+
const pluginTs = ctx.driver.getPlugin(pluginTsName);
|
|
340
|
+
if (!pluginTs) return;
|
|
341
|
+
const tsResolver = ctx.driver.getResolver(pluginTsName);
|
|
342
|
+
const paramEntries = ast.caseParams(node.parameters, paramsCasing).map((param) => ({
|
|
343
|
+
param,
|
|
344
|
+
name: resolveParamNameByLocation(resolver, node, param),
|
|
345
|
+
typeName: resolveParamNameByLocation(tsResolver, node, param)
|
|
346
|
+
}));
|
|
347
|
+
const responseEntries = node.responses.map((response) => ({
|
|
348
|
+
response,
|
|
349
|
+
name: resolver.resolveResponseStatusName(node, response.statusCode),
|
|
350
|
+
typeName: tsResolver.resolveResponseStatusName(node, response.statusCode)
|
|
351
|
+
}));
|
|
352
|
+
const dataEntry = node.requestBody?.content?.[0]?.schema ? {
|
|
353
|
+
schema: {
|
|
354
|
+
...node.requestBody.content[0].schema,
|
|
355
|
+
description: node.requestBody.description ?? node.requestBody.content[0].schema.description
|
|
356
|
+
},
|
|
357
|
+
name: resolver.resolveDataName(node),
|
|
358
|
+
typeName: tsResolver.resolveDataName(node),
|
|
359
|
+
description: node.requestBody.description ?? node.requestBody.content[0].schema.description
|
|
360
|
+
} : null;
|
|
361
|
+
const responseName = resolver.resolveResponseName(node);
|
|
362
|
+
const localHelperNames = new Set([
|
|
363
|
+
...paramEntries.map((entry) => entry.name),
|
|
364
|
+
...responseEntries.map((entry) => entry.name),
|
|
365
|
+
...dataEntry ? [dataEntry.name] : [],
|
|
366
|
+
responseName
|
|
367
|
+
]);
|
|
368
|
+
const meta = {
|
|
369
|
+
file: resolver.resolveFile({
|
|
370
|
+
name: node.operationId,
|
|
371
|
+
extname: ".ts",
|
|
372
|
+
tag: node.tags[0] ?? "default",
|
|
373
|
+
path: node.path
|
|
374
|
+
}, {
|
|
375
|
+
root,
|
|
376
|
+
output,
|
|
377
|
+
group
|
|
378
|
+
}),
|
|
379
|
+
typeFile: tsResolver.resolveFile({
|
|
380
|
+
name: node.operationId,
|
|
381
|
+
extname: ".ts",
|
|
382
|
+
tag: node.tags[0] ?? "default",
|
|
383
|
+
path: node.path
|
|
384
|
+
}, {
|
|
385
|
+
root,
|
|
386
|
+
output: pluginTs.options?.output ?? output,
|
|
387
|
+
group: pluginTs.options?.group
|
|
388
|
+
})
|
|
389
|
+
};
|
|
390
|
+
function resolveMockImports(schema) {
|
|
391
|
+
return adapter.getImports(schema, (schemaName) => ({
|
|
392
|
+
name: resolver.resolveName(schemaName),
|
|
393
|
+
path: resolver.resolveFile({
|
|
394
|
+
name: schemaName,
|
|
395
|
+
extname: ".ts"
|
|
396
|
+
}, {
|
|
397
|
+
root,
|
|
398
|
+
output,
|
|
399
|
+
group
|
|
400
|
+
}).path
|
|
401
|
+
})).filter((entry) => entry.path !== meta.file.path);
|
|
402
|
+
}
|
|
403
|
+
function renderEntry({ schema, name, typeName, description, skipImportNames = [] }) {
|
|
404
|
+
if (!schema) return null;
|
|
405
|
+
const canOverride = canOverrideSchema(schema);
|
|
406
|
+
const cyclicSchemas = adapter.inputNode ? ast.findCircularSchemas(adapter.inputNode.schemas) : void 0;
|
|
407
|
+
const printerInstance = printerFaker({
|
|
408
|
+
resolver,
|
|
409
|
+
schemaName: name,
|
|
410
|
+
typeName,
|
|
411
|
+
dateParser,
|
|
412
|
+
regexGenerator,
|
|
413
|
+
mapper,
|
|
414
|
+
nodes: printer?.nodes,
|
|
415
|
+
cyclicSchemas
|
|
416
|
+
});
|
|
417
|
+
const fakerText = printerInstance.print(schema) ?? "undefined";
|
|
418
|
+
const { imports, aliases } = aliasConflictingImports(filterUsedImports(resolveMockImports(schema), fakerText, skipImportNames), localHelperNames);
|
|
419
|
+
const rewrittenFakerText = rewriteAliasedImports(fakerText, aliases);
|
|
420
|
+
const typeReference = resolveTypeReference({
|
|
421
|
+
node: schema,
|
|
422
|
+
canOverride,
|
|
423
|
+
name,
|
|
424
|
+
typeName,
|
|
425
|
+
filePath: meta.file.path,
|
|
426
|
+
typeFilePath: meta.typeFile.path
|
|
427
|
+
});
|
|
428
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
429
|
+
typeReference.importPath && /* @__PURE__ */ jsx(File.Import, {
|
|
430
|
+
isTypeOnly: true,
|
|
431
|
+
root: meta.file.path,
|
|
432
|
+
path: typeReference.importPath,
|
|
433
|
+
name: [typeName]
|
|
434
|
+
}),
|
|
435
|
+
imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
|
|
436
|
+
root: meta.file.path,
|
|
437
|
+
path: imp.path,
|
|
438
|
+
name: imp.name
|
|
439
|
+
}, [
|
|
440
|
+
name,
|
|
441
|
+
imp.path,
|
|
442
|
+
imp.name
|
|
443
|
+
].join("-"))),
|
|
444
|
+
/* @__PURE__ */ jsx(Faker, {
|
|
445
|
+
name,
|
|
446
|
+
typeName: typeReference.typeName,
|
|
447
|
+
description,
|
|
448
|
+
node: schema,
|
|
449
|
+
printer: {
|
|
450
|
+
...printerInstance,
|
|
451
|
+
print: () => rewrittenFakerText
|
|
452
|
+
},
|
|
453
|
+
seed,
|
|
454
|
+
canOverride
|
|
455
|
+
})
|
|
456
|
+
] });
|
|
457
|
+
}
|
|
458
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
459
|
+
baseName: meta.file.baseName,
|
|
460
|
+
path: meta.file.path,
|
|
461
|
+
meta: meta.file.meta,
|
|
462
|
+
banner: resolver.resolveBanner(adapter.inputNode, {
|
|
463
|
+
output,
|
|
464
|
+
config
|
|
465
|
+
}),
|
|
466
|
+
footer: resolver.resolveFooter(adapter.inputNode, {
|
|
467
|
+
output,
|
|
468
|
+
config
|
|
469
|
+
}),
|
|
470
|
+
children: [
|
|
471
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
472
|
+
name: locale ? [{
|
|
473
|
+
propertyName: localeToFakerImport(locale),
|
|
474
|
+
name: "faker"
|
|
475
|
+
}] : ["faker"],
|
|
476
|
+
path: "@faker-js/faker"
|
|
477
|
+
}),
|
|
478
|
+
regexGenerator === "randexp" && /* @__PURE__ */ jsx(File.Import, {
|
|
479
|
+
name: "RandExp",
|
|
480
|
+
path: "randexp"
|
|
481
|
+
}),
|
|
482
|
+
dateParser !== "faker" && /* @__PURE__ */ jsx(File.Import, {
|
|
483
|
+
path: dateParser,
|
|
484
|
+
name: dateParser
|
|
485
|
+
}),
|
|
486
|
+
paramEntries.map(({ param, name, typeName }) => renderEntry({
|
|
487
|
+
schema: param.schema,
|
|
488
|
+
name,
|
|
489
|
+
typeName
|
|
490
|
+
})),
|
|
491
|
+
responseEntries.map(({ response, name, typeName }) => renderEntry({
|
|
492
|
+
schema: response.schema,
|
|
493
|
+
name,
|
|
494
|
+
typeName,
|
|
495
|
+
description: response.description
|
|
496
|
+
})),
|
|
497
|
+
dataEntry ? renderEntry({
|
|
498
|
+
schema: dataEntry.schema,
|
|
499
|
+
name: dataEntry.name,
|
|
500
|
+
typeName: dataEntry.typeName,
|
|
501
|
+
description: dataEntry.description
|
|
502
|
+
}) : null,
|
|
503
|
+
renderEntry({
|
|
504
|
+
schema: buildResponseUnionSchema(node, resolver),
|
|
505
|
+
name: responseName,
|
|
506
|
+
typeName: tsResolver.resolveResponseName(node),
|
|
507
|
+
skipImportNames: responseEntries.map(({ name }) => name)
|
|
508
|
+
})
|
|
509
|
+
]
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
//#endregion
|
|
514
|
+
export { printerFaker as n, fakerGenerator as t };
|
|
515
|
+
|
|
516
|
+
//# sourceMappingURL=fakerGenerator-D7daHCh6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fakerGenerator-D7daHCh6.js","names":[],"sources":["../../../internals/utils/src/object.ts","../../../internals/utils/src/regexp.ts","../src/printers/printerFaker.ts","../src/generators/fakerGenerator.tsx"],"sourcesContent":["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 * 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 { ast } from '@kubb/core'\nimport type { PluginFaker, ResolverFaker } from '../types.ts'\n\n/**\n * Partial printer nodes for Faker generation, mapping schema types to output strings.\n */\nexport type PrinterFakerNodes = ast.PrinterPartial<string, PrinterFakerOptions>\n\n/**\n * Configuration options for the Faker printer, including resolvers, mappers, and cyclic schema tracking.\n */\nexport type PrinterFakerOptions = {\n dateParser?: PluginFaker['resolvedOptions']['dateParser']\n regexGenerator?: PluginFaker['resolvedOptions']['regexGenerator']\n mapper?: PluginFaker['resolvedOptions']['mapper']\n resolver: ResolverFaker\n typeName?: string\n schemaName?: string\n nestedInObject?: boolean\n nodes?: PrinterFakerNodes\n /**\n * Names of schemas that participate in a circular dependency chain.\n * Properties whose schema transitively references one of these are emitted\n * as lazy getters so that user overrides via the `data` parameter prevent\n * the recursive faker call from ever executing (avoiding stack overflow).\n */\n cyclicSchemas?: ReadonlySet<string>\n}\n\n/**\n * Factory options for the Faker printer, defining input/output types and configuration.\n */\nexport type PrinterFakerFactory = ast.PrinterFactoryOptions<'faker', PrinterFakerOptions, string, string>\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 null: () => 'null',\n array: (items: string[] = [], min?: number, max?: number) => {\n if (items.length > 1) {\n return `faker.helpers.arrayElements([${items.join(', ')}])`\n }\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\n if (min !== undefined) {\n return `faker.helpers.multiple(() => (${item}), { count: ${min} })`\n }\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 datetime: () => 'faker.date.anytime().toISOString()',\n date: (representation: 'date' | 'string' = 'string', parser: PluginFaker['resolvedOptions']['dateParser'] = 'faker') => {\n if (representation === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"YYYY-MM-DD\")`\n }\n\n return 'faker.date.anytime().toISOString().substring(0, 10)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${representation}' and parser '${parser}' can not work together`)\n }\n\n return 'faker.date.anytime()'\n },\n time: (representation: 'date' | 'string' = 'string', parser: PluginFaker['resolvedOptions']['dateParser'] = 'faker') => {\n if (representation === 'string') {\n if (parser !== 'faker') {\n return `${parser}(faker.date.anytime()).format(\"HH:mm:ss\")`\n }\n\n return 'faker.date.anytime().toISOString().substring(11, 19)'\n }\n\n if (parser !== 'faker') {\n throw new Error(`type '${representation}' 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 if (items.length === 0) {\n return '{}'\n }\n\n if (items.length === 1) {\n return items[0] ?? '{}'\n }\n\n return `{...${items.join(', ...')}}`\n },\n matches: (value = '', regexGenerator: 'faker' | 'randexp' = 'faker') => {\n if (regexGenerator === 'randexp') {\n return `${toRegExpString(value, 'RandExp')}.gen()`\n }\n\n return `faker.helpers.fromRegExp(\"${value}\")`\n },\n email: () => 'faker.internet.email()',\n blob: () => 'faker.image.url() as unknown as Blob',\n} as const\n\nfunction getEnumValues(node: ast.EnumSchemaNode): Array<string | number | boolean | undefined> {\n if (node.namedEnumValues?.length) {\n return node.namedEnumValues.map((item) => item.value as string | number | boolean | undefined)\n }\n\n return (node.enumValues ?? []) as Array<string | number | boolean | undefined>\n}\n\nfunction parseEnumValue(value: string | number | boolean | undefined) {\n if (typeof value === 'string') {\n return stringify(value)\n }\n\n return value\n}\n\n/**\n * Creates a Faker printer that generates mock data generation code from schema nodes.\n * Handles circular references gracefully by emitting memoizing getters for cyclic properties.\n */\nexport const printerFaker: (options: PrinterFakerOptions) => ast.Printer<PrinterFakerFactory> = ast.definePrinter<PrinterFakerFactory>((options) => {\n const printNested = (node: ast.SchemaNode, overrideOptions: Partial<PrinterFakerOptions> = {}): string => {\n return (\n printerFaker({\n ...options,\n ...overrideOptions,\n nodes: options.nodes,\n }).print(node) ?? 'undefined'\n )\n }\n\n return {\n name: 'faker',\n options,\n nodes: {\n any: () => fakerKeywordMapper.any(),\n unknown: () => fakerKeywordMapper.unknown(),\n void: () => fakerKeywordMapper.void(),\n boolean: () => fakerKeywordMapper.boolean(),\n null: () => fakerKeywordMapper.null(),\n string(node) {\n if (node.pattern) {\n return fakerKeywordMapper.matches(node.pattern, this.options.regexGenerator)\n }\n\n return fakerKeywordMapper.string(node.min, node.max)\n },\n email: () => fakerKeywordMapper.email(),\n url: () => fakerKeywordMapper.url(),\n uuid: () => fakerKeywordMapper.uuid(),\n number(node) {\n return fakerKeywordMapper.number(node.min, node.max)\n },\n integer(node) {\n return fakerKeywordMapper.integer(node.min, node.max)\n },\n bigint: () => fakerKeywordMapper.bigint(),\n blob: () => fakerKeywordMapper.blob(),\n datetime: () => fakerKeywordMapper.datetime(),\n date(node) {\n return fakerKeywordMapper.date(node.representation ?? 'string', this.options.dateParser)\n },\n time(node) {\n return fakerKeywordMapper.time(node.representation ?? 'string', this.options.dateParser)\n },\n ref(node) {\n // Parser-generated refs (with $ref) carry raw schema names that need resolving.\n // Use the canonical name from the $ref path — node.name may have been overridden\n // (e.g. by single-member allOf flatten using the property-derived child name).\n // Inline refs (without $ref) from faker utils already carry resolved helper names.\n const refName = node.ref ? (ast.extractRefName(node.ref) ?? node.name ?? node.schema?.name) : (node.name ?? node.schema?.name)\n\n if (!refName) {\n throw new Error('Name not defined for ref node')\n }\n\n if (this.options.schemaName && refName === this.options.schemaName) {\n return 'undefined as any'\n }\n\n // Internal helper refs (for generated response/data helpers) are already\n // emitted with resolver output and should not be transformed twice.\n const resolvedName = node.ref ? this.options.resolver.resolveName(refName) : refName\n\n if (!this.options.nestedInObject) {\n return `${resolvedName}(data)`\n }\n\n return `${resolvedName}()`\n },\n enum(node) {\n return fakerKeywordMapper.enum(getEnumValues(node).map(parseEnumValue), this.options.typeName)\n },\n union(node): string {\n const items: string[] = (node.members ?? [])\n .map((member) =>\n printNested(member, {\n nestedInObject: true,\n }),\n )\n .filter((item): item is string => Boolean(item))\n\n return fakerKeywordMapper.union(items)\n },\n intersection(node): string {\n const items: string[] = (node.members ?? [])\n .map((member) =>\n printNested(member, {\n nestedInObject: true,\n }),\n )\n .filter((item): item is string => Boolean(item))\n\n return fakerKeywordMapper.and(items)\n },\n array(node): string {\n const items: string[] = (node.items ?? [])\n .map((member) =>\n printNested(member, {\n typeName: this.options.typeName ? `NonNullable<${this.options.typeName}>[number]` : undefined,\n nestedInObject: true,\n }),\n )\n .filter((item): item is string => Boolean(item))\n\n return fakerKeywordMapper.array(items, node.min, node.max)\n },\n tuple(node): string {\n const items: string[] = (node.items ?? [])\n .map((member, index) =>\n printNested(member, {\n typeName: this.options.typeName ? `NonNullable<${this.options.typeName}>[${index}]` : undefined,\n nestedInObject: true,\n }),\n )\n .filter((item): item is string => Boolean(item))\n\n return fakerKeywordMapper.tuple(items)\n },\n object(node): string {\n const cyclicSchemas = this.options.cyclicSchemas\n const properties = (node.properties ?? [])\n .map((property): string => {\n if (this.options.mapper && Object.hasOwn(this.options.mapper, property.name)) {\n return `\"${property.name}\": ${this.options.mapper[property.name]}`\n }\n\n const value: string =\n printNested(property.schema, {\n typeName: this.options.typeName ? `NonNullable<${this.options.typeName}>[${JSON.stringify(property.name)}]` : undefined,\n nestedInObject: true,\n }) ?? 'undefined'\n\n // When the property's schema transitively references a schema that is\n // part of a circular dependency (other than the current schema itself),\n // emit a memoizing lazy getter. On first access it computes the value,\n // replaces itself with a plain data property via Object.defineProperty,\n // and returns the cached value – so every subsequent read is stable.\n if (cyclicSchemas && ast.containsCircularRef(property.schema, { circularSchemas: cyclicSchemas, excludeName: this.options.schemaName })) {\n return `get ${property.name}() { const _value = ${value}; Object.defineProperty(this, ${JSON.stringify(property.name)}, { value: _value, configurable: true, writable: true, enumerable: true }); return _value }`\n }\n\n return `\"${property.name}\": ${value}`\n })\n .join(',')\n\n return `{${properties}}`\n },\n ...options.nodes,\n },\n print(node) {\n return this.transform(node) ?? null\n },\n }\n})\n","import { ast, defineGenerator } from '@kubb/core'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Faker } from '../components/Faker.tsx'\nimport { printerFaker } from '../printers/printerFaker.ts'\nimport type { PluginFaker } from '../types.ts'\nimport {\n aliasConflictingImports,\n buildResponseUnionSchema,\n canOverrideSchema,\n filterUsedImports,\n localeToFakerImport,\n resolveParamNameByLocation,\n resolveSchemaRef,\n resolveTypeReference,\n rewriteAliasedImports,\n} from '../utils.ts'\n\nexport const fakerGenerator = defineGenerator<PluginFaker>({\n name: 'faker',\n renderer: jsxRenderer,\n schema(node, ctx) {\n const { adapter, config, resolver, root } = ctx\n const { output, group, dateParser, regexGenerator, mapper, seed, locale, printer } = ctx.options\n const pluginTs = ctx.driver.getPlugin(pluginTsName)\n\n if (!node.name || !pluginTs || !adapter.inputNode) {\n return\n }\n\n const tsResolver = ctx.driver.getResolver(pluginTsName)\n\n const schemaNode = resolveSchemaRef(node, adapter.inputNode.schemas)\n const schemaName = schemaNode.name ?? node.name\n const mode = ctx.getMode(output)\n const meta = {\n name: resolver.resolveName(schemaName),\n file: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }),\n typeName: tsResolver.resolveTypeName(schemaName),\n typeFile: tsResolver.resolveFile(\n { name: schemaName, extname: '.ts' },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n } as const\n const canOverride = canOverrideSchema(schemaNode)\n const cyclicSchemas = adapter.inputNode ? ast.findCircularSchemas(adapter.inputNode.schemas) : undefined\n const printerInstance = printerFaker({\n resolver,\n schemaName,\n typeName: meta.typeName,\n dateParser,\n regexGenerator,\n mapper,\n nodes: printer?.nodes,\n cyclicSchemas,\n })\n const fakerText = printerInstance.print(schemaNode) ?? 'undefined'\n const typeReference = resolveTypeReference({\n node: schemaNode,\n canOverride,\n name: meta.name,\n typeName: meta.typeName,\n filePath: meta.file.path,\n typeFilePath: meta.typeFile.path,\n })\n\n const imports = adapter\n .getImports(schemaNode, (schemaName) => ({\n name: resolver.resolveName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n .filter((entry) => entry.path !== meta.file.path)\n const usedImports = filterUsedImports(imports, fakerText)\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(adapter.inputNode, { output, config })}\n footer={resolver.resolveFooter(adapter.inputNode, { output, config })}\n >\n <File.Import name={locale ? [{ propertyName: localeToFakerImport(locale), name: 'faker' }] : ['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n {typeReference.importPath && <File.Import isTypeOnly root={meta.file.path} path={typeReference.importPath} name={[meta.typeName]} />}\n {mode === 'split' &&\n usedImports.map((imp) => <File.Import key={[schemaName, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />)}\n <Faker\n name={meta.name}\n typeName={typeReference.typeName}\n description={schemaNode.description}\n node={schemaNode}\n printer={printerInstance}\n seed={seed}\n canOverride={canOverride}\n />\n </File>\n )\n },\n operation(node, ctx) {\n const { adapter, config, resolver, root } = ctx\n const { output, group, paramsCasing, dateParser, regexGenerator, mapper, seed, locale, printer } = ctx.options\n const pluginTs = ctx.driver.getPlugin(pluginTsName)\n\n if (!pluginTs) {\n return\n }\n\n const tsResolver = ctx.driver.getResolver(pluginTsName)\n\n const params = ast.caseParams(node.parameters, paramsCasing)\n const paramEntries = params.map((param) => ({\n param,\n name: resolveParamNameByLocation(resolver, node, param),\n typeName: resolveParamNameByLocation(tsResolver, node, param),\n }))\n const responseEntries = node.responses.map((response) => ({\n response,\n name: resolver.resolveResponseStatusName(node, response.statusCode),\n typeName: tsResolver.resolveResponseStatusName(node, response.statusCode),\n }))\n const dataEntry = node.requestBody?.content?.[0]?.schema\n ? {\n schema: {\n ...node.requestBody.content![0]!.schema!,\n description: node.requestBody.description ?? node.requestBody.content![0]!.schema!.description,\n },\n name: resolver.resolveDataName(node),\n typeName: tsResolver.resolveDataName(node),\n description: node.requestBody.description ?? node.requestBody.content![0]!.schema!.description,\n }\n : null\n const responseName = resolver.resolveResponseName(node)\n const localHelperNames = new Set([\n ...paramEntries.map((entry) => entry.name),\n ...responseEntries.map((entry) => entry.name),\n ...(dataEntry ? [dataEntry.name] : []),\n responseName,\n ])\n const meta = {\n file: resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n typeFile: tsResolver.resolveFile(\n {\n name: node.operationId,\n extname: '.ts',\n tag: node.tags[0] ?? 'default',\n path: node.path,\n },\n {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group,\n },\n ),\n } as const\n\n function resolveMockImports(schema: ast.SchemaNode) {\n return adapter\n .getImports(schema, (schemaName) => ({\n name: resolver.resolveName(schemaName),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n .filter((entry) => entry.path !== meta.file.path)\n }\n\n function renderEntry({\n schema,\n name,\n typeName,\n description,\n skipImportNames = [],\n }: {\n schema: ast.SchemaNode | null\n name: string\n typeName: string\n description?: string\n skipImportNames?: Array<string>\n }) {\n if (!schema) {\n return null\n }\n\n const canOverride = canOverrideSchema(schema)\n const cyclicSchemas = adapter.inputNode ? ast.findCircularSchemas(adapter.inputNode.schemas) : undefined\n const printerInstance = printerFaker({\n resolver,\n schemaName: name,\n typeName,\n dateParser,\n regexGenerator,\n mapper,\n nodes: printer?.nodes,\n cyclicSchemas,\n })\n const fakerText = printerInstance.print(schema) ?? 'undefined'\n const usedImports = filterUsedImports(resolveMockImports(schema), fakerText, skipImportNames)\n const { imports, aliases } = aliasConflictingImports(usedImports, localHelperNames)\n const rewrittenFakerText = rewriteAliasedImports(fakerText, aliases)\n const typeReference = resolveTypeReference({\n node: schema,\n canOverride,\n name,\n typeName,\n filePath: meta.file.path,\n typeFilePath: meta.typeFile.path,\n })\n\n return (\n <>\n {typeReference.importPath && <File.Import isTypeOnly root={meta.file.path} path={typeReference.importPath} name={[typeName]} />}\n {imports.map((imp) => (\n <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n <Faker\n name={name}\n typeName={typeReference.typeName}\n description={description}\n node={schema}\n printer={{ ...printerInstance, print: () => rewrittenFakerText }}\n seed={seed}\n canOverride={canOverride}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(adapter.inputNode, { output, config })}\n footer={resolver.resolveFooter(adapter.inputNode, { output, config })}\n >\n <File.Import name={locale ? [{ propertyName: localeToFakerImport(locale), name: 'faker' }] : ['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser !== 'faker' && <File.Import path={dateParser} name={dateParser} />}\n {paramEntries.map(({ param, name, typeName }) =>\n renderEntry({\n schema: param.schema,\n name,\n typeName,\n }),\n )}\n {responseEntries.map(({ response, name, typeName }) =>\n renderEntry({\n schema: response.schema,\n name,\n typeName,\n description: response.description,\n }),\n )}\n {dataEntry\n ? renderEntry({\n schema: dataEntry.schema,\n name: dataEntry.name,\n typeName: dataEntry.typeName,\n description: dataEntry.description,\n })\n : null}\n {renderEntry({\n schema: buildResponseUnionSchema(node, resolver),\n name: responseName,\n typeName: tsResolver.resolveResponseName(node),\n skipImportNames: responseEntries.map(({ name }) => name),\n })}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AASA,SAAgB,UAAU,OAAsD;AAC9E,KAAI,UAAU,KAAA,KAAa,UAAU,KAAM,QAAO;AAClD,QAAO,KAAK,UAAU,WAAW,MAAM,UAAU,CAAC,CAAC;;;;;;;;;;;;;ACArD,SAAgB,eAAe,MAAc,OAAsB,UAAkB;CACnF,MAAM,MAAM,WAAW,KAAK;CAE5B,MAAM,QAAQ,IAAI,MAAM,0BAA0B;CAClD,MAAM,oBAAoB,QAAQ,MAAM;CACxC,MAAM,eAAe,QAAQ;CAC7B,MAAM,UAAU,IACb,QAAQ,UAAU,GAAG,CACrB,QAAQ,UAAU,GAAG,CACrB,QAAQ,mBAAmB,GAAG;CAEjC,MAAM,EAAE,QAAQ,UAAU,IAAI,OAAO,SAAS,aAAa;AAE3D,KAAI,SAAS,KAAM,QAAO,IAAI,OAAO,GAAG;AAExC,QAAO,OAAO,KAAK,GAAG,KAAK,UAAU,OAAO,GAAG,QAAQ,KAAK,KAAK,UAAU,MAAM,KAAK,GAAG;;;;ACS3F,MAAM,qBAAqB;CACzB,WAAW;CACX,eAAe;CACf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