@kubb/plugin-faker 3.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,579 @@
1
+ // src/plugin.ts
2
+ import path from "path";
3
+ import { FileManager, PluginManager, createPlugin } from "@kubb/core";
4
+ import { camelCase } from "@kubb/core/transformers";
5
+ import { renderTemplate } from "@kubb/core/utils";
6
+ import { pluginOasName } from "@kubb/plugin-oas";
7
+ import { getGroupedByTagFiles } from "@kubb/plugin-oas/utils";
8
+ import { pluginTsName as pluginTsName3 } from "@kubb/plugin-ts";
9
+
10
+ // src/OperationGenerator.tsx
11
+ import { OperationGenerator as Generator2 } from "@kubb/plugin-oas";
12
+ import { Oas as Oas4 } from "@kubb/plugin-oas/components";
13
+ import { App as App2, createRoot as createRoot2 } from "@kubb/react";
14
+
15
+ // src/components/OperationSchema.tsx
16
+ import { Oas as Oas3 } from "@kubb/plugin-oas/components";
17
+ import { useOas, useOperation, useOperationManager } from "@kubb/plugin-oas/hooks";
18
+ import { File as File2, Parser, useApp as useApp2 } from "@kubb/react";
19
+ import { pluginTsName as pluginTsName2 } from "@kubb/plugin-ts";
20
+
21
+ // src/SchemaGenerator.tsx
22
+ import { SchemaGenerator as Generator } from "@kubb/plugin-oas";
23
+ import { Oas as Oas2 } from "@kubb/plugin-oas/components";
24
+ import { App, createRoot } from "@kubb/react";
25
+
26
+ // src/components/Schema.tsx
27
+ import { Oas } from "@kubb/plugin-oas/components";
28
+ import { File, Function, useApp, useFile } from "@kubb/react";
29
+ import { pluginTsName } from "@kubb/plugin-ts";
30
+ import transformers2 from "@kubb/core/transformers";
31
+ import { schemaKeywords as schemaKeywords2 } from "@kubb/plugin-oas";
32
+ import { useSchema } from "@kubb/plugin-oas/hooks";
33
+
34
+ // src/parser/index.ts
35
+ import transformers from "@kubb/core/transformers";
36
+ import { SchemaGenerator, isKeyword, schemaKeywords } from "@kubb/plugin-oas";
37
+ var fakerKeywordMapper = {
38
+ any: () => "undefined",
39
+ unknown: () => "unknown",
40
+ number: (min, max) => {
41
+ if (max !== void 0 && min !== void 0) {
42
+ return `faker.number.float({ min: ${min}, max: ${max} })`;
43
+ }
44
+ if (min !== void 0) {
45
+ return `faker.number.float({ min: ${min} })`;
46
+ }
47
+ if (max !== void 0) {
48
+ return `faker.number.float({ max: ${max} })`;
49
+ }
50
+ return "faker.number.float()";
51
+ },
52
+ integer: (min, max) => {
53
+ if (max !== void 0 && min !== void 0) {
54
+ return `faker.number.int({ min: ${min}, max: ${max} })`;
55
+ }
56
+ if (min !== void 0) {
57
+ return `faker.number.int({ min: ${min} })`;
58
+ }
59
+ if (max !== void 0) {
60
+ return `faker.number.int({ max: ${max} })`;
61
+ }
62
+ return "faker.number.int()";
63
+ },
64
+ string: (min, max) => {
65
+ if (max !== void 0 && min !== void 0) {
66
+ return `faker.string.alpha({ length: { min: ${min}, max: ${max} } })`;
67
+ }
68
+ if (min !== void 0) {
69
+ return `faker.string.alpha({ length: { min: ${min} } })`;
70
+ }
71
+ if (max !== void 0) {
72
+ return `faker.string.alpha({ length: { max: ${max} } })`;
73
+ }
74
+ return "faker.string.alpha()";
75
+ },
76
+ boolean: () => "faker.datatype.boolean()",
77
+ undefined: () => "undefined",
78
+ null: () => "null",
79
+ array: (items = []) => `faker.helpers.arrayElements([${items.join(", ")}]) as any`,
80
+ tuple: (items = []) => `faker.helpers.arrayElements([${items.join(", ")}]) as any`,
81
+ enum: (items = []) => `faker.helpers.arrayElement<any>([${items.join(", ")}])`,
82
+ union: (items = []) => `faker.helpers.arrayElement<any>([${items.join(", ")}])`,
83
+ /**
84
+ * ISO 8601
85
+ */
86
+ datetime: () => "faker.date.anytime().toISOString()",
87
+ /**
88
+ * Type `'date'` Date
89
+ * Type `'string'` ISO date format (YYYY-MM-DD)
90
+ * @default ISO date format (YYYY-MM-DD)
91
+ */
92
+ date: (type = "string", parser) => {
93
+ if (type === "string") {
94
+ if (parser) {
95
+ return `${parser}(faker.date.anytime()).format("YYYY-MM-DD")`;
96
+ }
97
+ return "faker.date.anytime().toString()";
98
+ }
99
+ return "faker.date.anytime()";
100
+ },
101
+ /**
102
+ * Type `'date'` Date
103
+ * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])
104
+ * @default ISO time format (HH:mm:ss[.SSSSSS])
105
+ */
106
+ time: (type = "string", parser) => {
107
+ if (type === "string") {
108
+ if (parser) {
109
+ return `${parser}(faker.date.anytime()).format("HH:mm:ss")`;
110
+ }
111
+ return "faker.date.anytime().toString()";
112
+ }
113
+ return "faker.date.anytime()";
114
+ },
115
+ uuid: () => "faker.string.uuid()",
116
+ url: () => "faker.internet.url()",
117
+ and: (items = []) => `Object.assign({}, ${items.join(", ")})`,
118
+ object: () => "object",
119
+ ref: () => "ref",
120
+ matches: (value = "", regexGenerator = "faker") => {
121
+ if (regexGenerator === "randexp") {
122
+ return `${transformers.toRegExpString(value, "RandExp")}.gen()`;
123
+ }
124
+ return `faker.helpers.fromRegExp(${transformers.toRegExpString(value)})`;
125
+ },
126
+ email: () => "faker.internet.email()",
127
+ firstName: () => "faker.person.firstName()",
128
+ lastName: () => "faker.person.lastName()",
129
+ password: () => "faker.internet.password()",
130
+ phone: () => "faker.phone.number()",
131
+ blob: () => "faker.image.imageUrl() as unknown as Blob",
132
+ default: void 0,
133
+ describe: void 0,
134
+ const: (value) => value ?? "",
135
+ max: void 0,
136
+ min: void 0,
137
+ nullable: void 0,
138
+ nullish: void 0,
139
+ optional: void 0,
140
+ readOnly: void 0,
141
+ strict: void 0,
142
+ deprecated: void 0,
143
+ example: void 0,
144
+ schema: void 0,
145
+ catchall: void 0,
146
+ name: void 0
147
+ };
148
+ function schemaKeywordsorter(a, b) {
149
+ if (b.keyword === "null") {
150
+ return -1;
151
+ }
152
+ return 0;
153
+ }
154
+ function joinItems(items) {
155
+ switch (items.length) {
156
+ case 0:
157
+ return "undefined";
158
+ case 1:
159
+ return items[0];
160
+ default:
161
+ return fakerKeywordMapper.union(items);
162
+ }
163
+ }
164
+ function parse(parent, current, options) {
165
+ const value = fakerKeywordMapper[current.keyword];
166
+ if (!value) {
167
+ return void 0;
168
+ }
169
+ if (isKeyword(current, schemaKeywords.union)) {
170
+ return fakerKeywordMapper.union(current.args.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean));
171
+ }
172
+ if (isKeyword(current, schemaKeywords.and)) {
173
+ return fakerKeywordMapper.and(current.args.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean));
174
+ }
175
+ if (isKeyword(current, schemaKeywords.array)) {
176
+ return fakerKeywordMapper.array(current.args.items.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean));
177
+ }
178
+ if (isKeyword(current, schemaKeywords.enum)) {
179
+ return fakerKeywordMapper.enum(
180
+ current.args.items.map((schema) => {
181
+ if (schema.format === "number") {
182
+ return schema.name;
183
+ }
184
+ return transformers.stringify(schema.name);
185
+ })
186
+ );
187
+ }
188
+ if (isKeyword(current, schemaKeywords.ref)) {
189
+ if (!current.args?.name) {
190
+ throw new Error(`Name not defined for keyword ${current.keyword}`);
191
+ }
192
+ if (options.withData) {
193
+ return `${current.args.name}(data)`;
194
+ }
195
+ return `${current.args.name}()`;
196
+ }
197
+ if (isKeyword(current, schemaKeywords.object)) {
198
+ const argsObject = Object.entries(current.args?.properties || {}).filter((item) => {
199
+ const schema = item[1];
200
+ return schema && typeof schema.map === "function";
201
+ }).map(([name, schemas]) => {
202
+ const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name);
203
+ const mappedName = nameSchema?.args || name;
204
+ if (options.mapper?.[mappedName]) {
205
+ return `"${name}": ${options.mapper?.[mappedName]}`;
206
+ }
207
+ return `"${name}": ${joinItems(
208
+ schemas.sort(schemaKeywordsorter).map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean)
209
+ )}`;
210
+ }).join(",");
211
+ return `{${argsObject}}`;
212
+ }
213
+ if (isKeyword(current, schemaKeywords.tuple)) {
214
+ if (Array.isArray(current.args.items)) {
215
+ return fakerKeywordMapper.tuple(current.args.items.map((schema) => parse(current, schema, { ...options, withData: false })).filter(Boolean));
216
+ }
217
+ return parse(current, current.args.items, { ...options, withData: false });
218
+ }
219
+ if (isKeyword(current, schemaKeywords.const)) {
220
+ if (current.args.format === "number" && current.args.name !== void 0) {
221
+ return fakerKeywordMapper.const(current.args.name?.toString());
222
+ }
223
+ return fakerKeywordMapper.const(transformers.stringify(current.args.value));
224
+ }
225
+ if (isKeyword(current, schemaKeywords.matches) && current.args) {
226
+ return fakerKeywordMapper.matches(current.args, options.regexGenerator);
227
+ }
228
+ if (isKeyword(current, schemaKeywords.null) || isKeyword(current, schemaKeywords.undefined) || isKeyword(current, schemaKeywords.any)) {
229
+ return value() || "";
230
+ }
231
+ if (isKeyword(current, schemaKeywords.string)) {
232
+ if (parent) {
233
+ const minSchema = SchemaGenerator.find([parent], schemaKeywords.min);
234
+ const maxSchema = SchemaGenerator.find([parent], schemaKeywords.max);
235
+ return fakerKeywordMapper.string(minSchema?.args, maxSchema?.args);
236
+ }
237
+ return fakerKeywordMapper.string();
238
+ }
239
+ if (isKeyword(current, schemaKeywords.number)) {
240
+ if (parent) {
241
+ const minSchema = SchemaGenerator.find([parent], schemaKeywords.min);
242
+ const maxSchema = SchemaGenerator.find([parent], schemaKeywords.max);
243
+ return fakerKeywordMapper.number(minSchema?.args, maxSchema?.args);
244
+ }
245
+ return fakerKeywordMapper.number();
246
+ }
247
+ if (isKeyword(current, schemaKeywords.integer)) {
248
+ if (parent) {
249
+ const minSchema = SchemaGenerator.find([parent], schemaKeywords.min);
250
+ const maxSchema = SchemaGenerator.find([parent], schemaKeywords.max);
251
+ return fakerKeywordMapper.integer(minSchema?.args, maxSchema?.args);
252
+ }
253
+ return fakerKeywordMapper.integer();
254
+ }
255
+ if (isKeyword(current, schemaKeywords.datetime)) {
256
+ return fakerKeywordMapper.datetime();
257
+ }
258
+ if (isKeyword(current, schemaKeywords.date)) {
259
+ return fakerKeywordMapper.date(current.args.type, options.dateParser);
260
+ }
261
+ if (isKeyword(current, schemaKeywords.time)) {
262
+ return fakerKeywordMapper.time(current.args.type, options.dateParser);
263
+ }
264
+ if (current.keyword in fakerKeywordMapper && "args" in current) {
265
+ const value2 = fakerKeywordMapper[current.keyword];
266
+ const options2 = JSON.stringify(current.args);
267
+ return value2(options2);
268
+ }
269
+ if (current.keyword in fakerKeywordMapper) {
270
+ return value();
271
+ }
272
+ return void 0;
273
+ }
274
+
275
+ // src/components/Schema.tsx
276
+ import { Fragment, jsx, jsxs } from "@kubb/react/jsx-runtime";
277
+ function Schema(props) {
278
+ const { withData, description } = props;
279
+ const { tree, name } = useSchema();
280
+ const {
281
+ pluginManager,
282
+ plugin: {
283
+ options: { dateParser, regexGenerator, mapper, seed }
284
+ }
285
+ } = useApp();
286
+ const resolvedName = pluginManager.resolveName({
287
+ name,
288
+ pluginKey: [pluginFakerName],
289
+ type: "function"
290
+ });
291
+ const typeName = pluginManager.resolveName({
292
+ name,
293
+ pluginKey: [pluginTsName],
294
+ type: "type"
295
+ });
296
+ const fakerText = joinItems(
297
+ tree.map((schema) => parse(void 0, schema, { name: resolvedName, typeName, seed, regexGenerator, mapper, withData, dateParser })).filter(Boolean)
298
+ );
299
+ let fakerDefaultOverride = void 0;
300
+ let fakerTextWithOverride = fakerText;
301
+ if (withData && fakerText.startsWith("{")) {
302
+ fakerDefaultOverride = "{}";
303
+ fakerTextWithOverride = `{
304
+ ...${fakerText},
305
+ ...data
306
+ }`;
307
+ }
308
+ if (withData && fakerText.startsWith("faker.helpers.arrayElements")) {
309
+ fakerDefaultOverride = "[]";
310
+ fakerTextWithOverride = `[
311
+ ...${fakerText},
312
+ ...data
313
+ ]`;
314
+ }
315
+ const params = fakerDefaultOverride ? `data: NonNullable<Partial<${typeName}>> = ${fakerDefaultOverride}` : `data?: NonNullable<Partial<${typeName}>>`;
316
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
317
+ /* @__PURE__ */ jsxs(
318
+ Function,
319
+ {
320
+ export: true,
321
+ name: resolvedName,
322
+ JSDoc: { comments: [description ? `@description ${transformers2.jsStringEscape(description)}` : void 0].filter(Boolean) },
323
+ params: withData ? params : "",
324
+ returnType: typeName ? `NonNullable<${typeName}>` : "",
325
+ children: [
326
+ seed ? `faker.seed(${JSON.stringify(seed)})` : "",
327
+ /* @__PURE__ */ jsx("br", {}),
328
+ /* @__PURE__ */ jsx(Function.Return, { children: fakerTextWithOverride })
329
+ ]
330
+ }
331
+ ),
332
+ /* @__PURE__ */ jsx("br", {})
333
+ ] });
334
+ }
335
+ Schema.File = function({}) {
336
+ const { pluginManager } = useApp();
337
+ const { tree, schema } = useSchema();
338
+ const withData = tree.some(
339
+ (schema2) => schema2.keyword === schemaKeywords2.array || schema2.keyword === schemaKeywords2.and || schema2.keyword === schemaKeywords2.object || schema2.keyword === schemaKeywords2.union || schema2.keyword === schemaKeywords2.tuple
340
+ );
341
+ return /* @__PURE__ */ jsxs(Oas.Schema.File, { output: pluginManager.config.output.path, children: [
342
+ /* @__PURE__ */ jsx(Schema.Imports, {}),
343
+ /* @__PURE__ */ jsx(File.Source, { children: /* @__PURE__ */ jsx(Schema, { description: schema?.description, withData }) })
344
+ ] });
345
+ };
346
+ Schema.Imports = () => {
347
+ const {
348
+ pluginManager,
349
+ plugin: {
350
+ options: { extName, dateParser, regexGenerator }
351
+ }
352
+ } = useApp();
353
+ const { path: root } = useFile();
354
+ const { name, tree, schema } = useSchema();
355
+ const typeName = pluginManager.resolveName({
356
+ name,
357
+ pluginKey: [pluginTsName],
358
+ type: "type"
359
+ });
360
+ const typeFileName = pluginManager.resolveName({
361
+ name,
362
+ pluginKey: [pluginTsName],
363
+ type: "file"
364
+ });
365
+ const typePath = pluginManager.resolvePath({
366
+ baseName: typeFileName,
367
+ pluginKey: [pluginTsName]
368
+ });
369
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
370
+ /* @__PURE__ */ jsx(File.Import, { name: ["faker"], path: "@faker-js/faker" }),
371
+ regexGenerator === "randexp" && /* @__PURE__ */ jsx(File.Import, { name: "RandExp", path: "randexp" }),
372
+ dateParser && /* @__PURE__ */ jsx(File.Import, { path: dateParser, name: dateParser }),
373
+ typeName && typePath && /* @__PURE__ */ jsx(File.Import, { extName, isTypeOnly: true, root, path: typePath, name: [typeName] })
374
+ ] });
375
+ };
376
+
377
+ // src/SchemaGenerator.tsx
378
+ import { jsx as jsx2 } from "@kubb/react/jsx-runtime";
379
+ var SchemaGenerator2 = class extends Generator {
380
+ async schema(name, schema, options) {
381
+ const { oas, pluginManager, plugin, mode, output } = this.context;
382
+ const root = createRoot({
383
+ logger: pluginManager.logger
384
+ });
385
+ const tree = this.parse({ schema, name });
386
+ root.render(
387
+ /* @__PURE__ */ jsx2(App, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsx2(Oas2, { oas, children: /* @__PURE__ */ jsx2(Oas2.Schema, { name, value: schema, tree, children: /* @__PURE__ */ jsx2(Schema.File, {}) }) }) })
388
+ );
389
+ return root.files;
390
+ }
391
+ };
392
+
393
+ // src/components/OperationSchema.tsx
394
+ import { jsx as jsx3, jsxs as jsxs2 } from "@kubb/react/jsx-runtime";
395
+ function OperationSchema({ description }) {
396
+ return /* @__PURE__ */ jsx3(Schema, { withData: false, description });
397
+ }
398
+ OperationSchema.File = function({}) {
399
+ const { plugin, pluginManager, mode } = useApp2();
400
+ const oas = useOas();
401
+ const { getSchemas, getFile } = useOperationManager();
402
+ const operation = useOperation();
403
+ const file = getFile(operation);
404
+ const schemas = getSchemas(operation);
405
+ const generator = new SchemaGenerator2(plugin.options, {
406
+ oas,
407
+ plugin,
408
+ pluginManager,
409
+ mode,
410
+ override: plugin.options.override
411
+ });
412
+ const items = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response].flat().filter(Boolean);
413
+ const mapItem = ({ name, schema, description, ...options }, i) => {
414
+ const typeName = pluginManager.resolveName({
415
+ name,
416
+ pluginKey: [pluginTsName2],
417
+ type: "type"
418
+ });
419
+ const typeFileName = pluginManager.resolveName({
420
+ name: options.operationName || name,
421
+ pluginKey: [pluginTsName2],
422
+ type: "file"
423
+ });
424
+ const typePath = pluginManager.resolvePath({
425
+ baseName: typeFileName,
426
+ pluginKey: [pluginTsName2],
427
+ options: { tag: options.operation?.getTags()[0]?.name }
428
+ });
429
+ const tree = generator.parse({ schema, name });
430
+ return /* @__PURE__ */ jsxs2(Oas3.Schema, { name, value: schema, tree, children: [
431
+ typeName && typePath && /* @__PURE__ */ jsx3(File2.Import, { extName: plugin.options.extName, isTypeOnly: true, root: file.path, path: typePath, name: [typeName] }),
432
+ plugin.options.dateParser && /* @__PURE__ */ jsx3(File2.Import, { path: plugin.options.dateParser, name: plugin.options.dateParser }),
433
+ mode === "split" && /* @__PURE__ */ jsx3(Oas3.Schema.Imports, { extName: plugin.options.extName }),
434
+ /* @__PURE__ */ jsx3(File2.Source, { children: /* @__PURE__ */ jsx3(OperationSchema, { description }) })
435
+ ] }, i);
436
+ };
437
+ return /* @__PURE__ */ jsx3(Parser, { language: "typescript", children: /* @__PURE__ */ jsxs2(File2, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
438
+ /* @__PURE__ */ jsx3(File2.Import, { name: ["faker"], path: "@faker-js/faker" }),
439
+ plugin.options.regexGenerator === "randexp" && /* @__PURE__ */ jsx3(File2.Import, { name: "RandExp", path: "randexp" }),
440
+ items.map(mapItem)
441
+ ] }) });
442
+ };
443
+
444
+ // src/OperationGenerator.tsx
445
+ import { jsx as jsx4 } from "@kubb/react/jsx-runtime";
446
+ var OperationGenerator = class extends Generator2 {
447
+ async operation(operation, options) {
448
+ const { oas, pluginManager, plugin, mode } = this.context;
449
+ const root = createRoot2({
450
+ logger: pluginManager.logger
451
+ });
452
+ root.render(
453
+ /* @__PURE__ */ jsx4(App2, { pluginManager, plugin: { ...plugin, options }, mode, children: /* @__PURE__ */ jsx4(Oas4, { oas, operations: [operation], generator: this, children: /* @__PURE__ */ jsx4(Oas4.Operation, { operation, children: /* @__PURE__ */ jsx4(OperationSchema.File, {}) }) }) })
454
+ );
455
+ return root.files;
456
+ }
457
+ };
458
+
459
+ // src/plugin.ts
460
+ var pluginFakerName = "plugin-faker";
461
+ var pluginFaker = createPlugin((options) => {
462
+ const {
463
+ output = { path: "mocks" },
464
+ seed,
465
+ group,
466
+ exclude = [],
467
+ include,
468
+ override = [],
469
+ transformers: transformers3 = {},
470
+ mapper = {},
471
+ dateType = "string",
472
+ unknownType = "any",
473
+ dateParser,
474
+ regexGenerator = "faker"
475
+ } = options;
476
+ const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`;
477
+ return {
478
+ name: pluginFakerName,
479
+ options: {
480
+ extName: output.extName,
481
+ transformers: transformers3,
482
+ dateType,
483
+ seed,
484
+ unknownType,
485
+ dateParser,
486
+ mapper,
487
+ override,
488
+ regexGenerator
489
+ },
490
+ pre: [pluginOasName, pluginTsName3],
491
+ resolvePath(baseName, pathMode, options2) {
492
+ const root = path.resolve(this.config.root, this.config.output.path);
493
+ const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
494
+ if (mode === "single") {
495
+ return path.resolve(root, output.path);
496
+ }
497
+ if (options2?.tag && group?.type === "tag") {
498
+ const tag = camelCase(options2.tag);
499
+ return path.resolve(root, renderTemplate(template, { tag }), baseName);
500
+ }
501
+ return path.resolve(root, output.path, baseName);
502
+ },
503
+ resolveName(name, type) {
504
+ const resolvedName = camelCase(name, {
505
+ prefix: type ? "create" : void 0,
506
+ isFile: type === "file"
507
+ });
508
+ if (type) {
509
+ return transformers3?.name?.(resolvedName, type) || resolvedName;
510
+ }
511
+ return resolvedName;
512
+ },
513
+ async writeFile(path2, source) {
514
+ if (!path2.endsWith(".ts") || !source) {
515
+ return;
516
+ }
517
+ return this.fileManager.write(path2, source, { sanity: false });
518
+ },
519
+ async buildStart() {
520
+ const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
521
+ const oas = await swaggerPlugin.api.getOas();
522
+ const root = path.resolve(this.config.root, this.config.output.path);
523
+ const mode = FileManager.getMode(path.resolve(root, output.path));
524
+ const schemaGenerator = new SchemaGenerator2(this.plugin.options, {
525
+ oas,
526
+ pluginManager: this.pluginManager,
527
+ plugin: this.plugin,
528
+ contentType: swaggerPlugin.api.contentType,
529
+ include: void 0,
530
+ override,
531
+ mode,
532
+ output: output.path
533
+ });
534
+ const schemaFiles = await schemaGenerator.build();
535
+ await this.addFile(...schemaFiles);
536
+ const operationGenerator = new OperationGenerator(this.plugin.options, {
537
+ oas,
538
+ pluginManager: this.pluginManager,
539
+ plugin: this.plugin,
540
+ contentType: swaggerPlugin.api.contentType,
541
+ exclude,
542
+ include,
543
+ override,
544
+ mode
545
+ });
546
+ const operationFiles = await operationGenerator.build();
547
+ await this.addFile(...operationFiles);
548
+ },
549
+ async buildEnd() {
550
+ if (this.config.output.write === false) {
551
+ return;
552
+ }
553
+ const root = path.resolve(this.config.root, this.config.output.path);
554
+ if (group?.type === "tag") {
555
+ const rootFiles = await getGroupedByTagFiles({
556
+ logger: this.logger,
557
+ files: this.fileManager.files,
558
+ plugin: this.plugin,
559
+ template,
560
+ exportAs: group.exportAs || "{{tag}}Mocks",
561
+ root,
562
+ output
563
+ });
564
+ await this.addFile(...rootFiles);
565
+ }
566
+ await this.fileManager.addIndexes({
567
+ root,
568
+ output,
569
+ meta: { pluginKey: this.plugin.key },
570
+ logger: this.logger
571
+ });
572
+ }
573
+ };
574
+ });
575
+ export {
576
+ pluginFaker,
577
+ pluginFakerName
578
+ };
579
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin.ts","../src/OperationGenerator.tsx","../src/components/OperationSchema.tsx","../src/SchemaGenerator.tsx","../src/components/Schema.tsx","../src/parser/index.ts"],"sourcesContent":["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'\nimport { getGroupedByTagFiles } from '@kubb/plugin-oas/utils'\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 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 writeFile(path, source) {\n if (!path.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(path, source, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.api.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.api.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.api.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build()\n await this.addFile(...operationFiles)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n if (group?.type === 'tag') {\n const rootFiles = await getGroupedByTagFiles({\n logger: this.logger,\n files: this.fileManager.files,\n plugin: this.plugin,\n template,\n exportAs: group.exportAs || '{{tag}}Mocks',\n root,\n output,\n })\n\n await this.addFile(...rootFiles)\n }\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n logger: this.logger,\n })\n },\n }\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 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 { Oas } from '@kubb/plugin-oas/components'\nimport { useOas, useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { File, Parser, useApp } from '@kubb/react'\nimport { pluginTsName } from '@kubb/plugin-ts'\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 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 extName={plugin.options.extName} 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 extName={plugin.options.extName} />}\n <File.Source>\n <OperationSchema description={description} />\n </File.Source>\n </Oas.Schema>\n )\n }\n\n return (\n <Parser language=\"typescript\">\n <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>\n <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {plugin.options.regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {items.map(mapItem)}\n </File>\n </Parser>\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 { File, Function, useApp, useFile } from '@kubb/react'\nimport { pluginTsName } from '@kubb/plugin-ts'\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 return (\n <>\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 </>\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 <File.Source>\n <Schema description={schema?.description} withData={withData} />\n </File.Source>\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 <File.Import name={['faker']} path=\"@faker-js/faker\" />\n {regexGenerator === 'randexp' && <File.Import name={'RandExp'} path={'randexp'} />}\n {dateParser && <File.Import path={dateParser} name={dateParser} />}\n {typeName && typePath && <File.Import extName={extName} isTypeOnly root={root} path={typePath} name={[typeName]} />}\n </>\n )\n}\n","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"],"mappings":";AAAA,OAAO,UAAU;AAEjB,SAAS,aAAa,eAAe,oBAAoB;AACzD,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AACrC,SAAS,gBAAAA,qBAAoB;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D,YAAM,KAAK,QAAQ,GAAG,cAAc;AAAA,IACtC;AAAA,IACA,MAAM,WAAW;AACf,UAAI,KAAK,OAAO,OAAO,UAAU,OAAO;AACtC;AAAA,MACF;AAEA,YAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,IAAI;AAEnE,UAAI,OAAO,SAAS,OAAO;AACzB,cAAM,YAAY,MAAM,qBAAqB;AAAA,UAC3C,QAAQ,KAAK;AAAA,UACb,OAAO,KAAK,YAAY;AAAA,UACxB,QAAQ,KAAK;AAAA,UACb;AAAA,UACA,UAAU,MAAM,YAAY;AAAA,UAC5B;AAAA,UACA;AAAA,QACF,CAAC;AAED,cAAM,KAAK,QAAQ,GAAG,SAAS;AAAA,MACjC;AAEA,YAAM,KAAK,YAAY,WAAW;AAAA,QAChC;AAAA,QACA;AAAA,QACA,MAAM,EAAE,WAAW,KAAK,OAAO,IAAI;AAAA,QACnC,QAAQ,KAAK;AAAA,MACf,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;","names":["pluginTsName","Generator","Oas","App","createRoot","Oas","File","useApp","pluginTsName","Oas","transformers","schemaKeywords","value","options","transformers","schema","schemaKeywords","jsx","SchemaGenerator","Oas","jsx","jsxs","useApp","SchemaGenerator","pluginTsName","Oas","File","jsx","Generator","createRoot","App","Oas","transformers","pluginTsName","options","path","SchemaGenerator"]}